scraper/github/queryManager.py
def fileSave(self, filePath=None, updatePath=False):
        """Write the internal JSON data dictionary to a JSON data file.

        If no file path is provided, the stored data file path will be used.

        Args:
            filePath (Optional[str]): A relative or absolute path to a
                '.json' file. Defaults to None.
            updatePath (Optional[bool]): Specifies whether or not to update
                the stored data file path. Defaults to False.

        """
        if not filePath:
            filePath = self.filePath
        if not os.path.isfile(filePath):
            print("Data file '%s' does not exist, will create new file." % (filePath))
            if not os.path.exists(os.path.split(filePath)[0]):
                os.makedirs(os.path.split(filePath)[0])
        dataJsonString = json.dumps(self.data, indent=4, sort_keys=True)
        print("Writing to file '%s' ... " % (filePath), end="", flush=True)
        with open(filePath, "w") as fileout:
            fileout.write(dataJsonString)
        print("Wrote file!")
        if updatePath:
            self.filePath = filePath
def fileSave(self, filePath=None, updatePath=False):
        if not filePath:
            filePath = self.filePath
        if not os.path.isfile(filePath):
            print("Data file '%s' does not exist, will create new file." % (filePath))
            if not os.path.exists(os.path.split(filePath)[0]):
                os.makedirs(os.path.split(filePath)[0])
        dataJsonString = json.dumps(self.data, indent=4, sort_keys=True)
        print("Writing to file '%s' ... " % (filePath), end="", flush=True)
        with open(filePath, "w") as fileout:
            fileout.write(dataJsonString)
        print("Wrote file!")
        if updatePath:
            self.filePath = filePath
def fileSave ( self , filePath = None , updatePath = False ) : if not filePath : filePath = self . filePath if not os . path . isfile ( filePath ) : print ( "Data file '%s' does not exist, will create new file." % ( filePath ) ) if not os . path . exists ( os . path . split ( filePath ) [ 0 ] ) : os . makedirs ( os . path . split ( filePath ) [ 0 ] ) dataJsonString = json . dumps ( self . data , indent = 4 , sort_keys = True ) print ( "Writing to file '%s' ... " % ( filePath ) , end = "" , flush = True ) with open ( filePath , "w" ) as fileout : fileout . write ( dataJsonString ) print ( "Wrote file!" ) if updatePath : self . filePath = filePath
Write the internal JSON data dictionary to a JSON data file.

        If no file path is provided, the stored data file path will be used.

        Args:
            filePath (Optional[str]): A relative or absolute path to a
                '.json' file. Defaults to None.
            updatePath (Optional[bool]): Specifies whether or not to update
                the stored data file path. Defaults to False.
Write the internal JSON data dictionary to a JSON data file .