diff -r 411df92e881f -r 3b34efa2857c src/eric7/Project/Project.py --- a/src/eric7/Project/Project.py Sun Dec 03 14:54:00 2023 +0100 +++ b/src/eric7/Project/Project.py Mon Jan 01 11:10:45 2024 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> +# Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> # """ @@ -168,8 +168,10 @@ """ Constructor - @param parent parent widget (usually the ui object) (QWidget) - @param filename optional filename of a project file to open (string) + @param parent parent widget (usually the ui object) + @type QWidget + @param filename optional filename of a project file to open + @type str """ super().__init__(parent) @@ -274,8 +276,10 @@ """ Private method to get the source extensions of a programming language. - @param language programming language (string) - @return source extensions (list of string) + @param language programming language + @type str + @return source extensions + @rtype list of str """ if language == "Python3": extensions = Preferences.getPython("Python3Extensions") @@ -302,7 +306,8 @@ """ Public method to get the programming languages supported by project. - @return list of supported programming languages (list of string) + @return list of supported programming languages + @rtype list of str """ return self.__progLanguages[:] @@ -368,8 +373,9 @@ Public method to get the list of supported project types. @param progLanguage programming language to get project types for - (string) + @type str @return reference to the dictionary of project types. + @rtype dict """ if progLanguage and progLanguage in self.__projectProgLanguages: ptypes = {} @@ -383,9 +389,12 @@ """ Public method to check, if a project type is already registered. - @param type_ internal type designator (string) - @param progLanguage programming language of the project type (string) - @return flag indicating presence of the project type (boolean) + @param type_ internal type designator + @type str + @param progLanguage programming language of the project type + @type str + @return flag indicating presence of the project type + @rtype bool """ if progLanguage: return ( @@ -407,18 +416,24 @@ """ Public method to register a project type. - @param type_ internal type designator to be registered (string) - @param description more verbose type name (display string) (string) + @param type_ internal type designator to be registered + @type str + @param description more verbose type name (display string) + @type str @param fileTypeCallback reference to a method returning a dictionary - of filetype associations. + of filetype associations + @type function @param binaryTranslationsCallback reference to a method returning the name of the binary translation file given the name of the raw translation file + @type function @param lexerAssociationCallback reference to a method returning the lexer type to be used for syntax highlighting given the name of a file + @type function @param progLanguages programming languages supported by the - project type (list of string) + project type + @type list of str """ if progLanguages: for progLanguage in progLanguages: @@ -471,7 +486,8 @@ """ Public method to unregister a project type. - @param type_ internal type designator to be unregistered (string) + @param type_ internal type designator to be unregistered + @type str """ for progLanguage in self.__projectProgLanguages: if type_ in self.__projectProgLanguages[progLanguage]: @@ -646,6 +662,7 @@ @param default value to return in case the key is not found (defaults to None) @type Any (optional) @return a copy of the requested data or None + @rtype Any """ # __IGNORE_WARNING_D202__ if ( @@ -667,12 +684,16 @@ """ Public method to store data in the project data store. - @param category category of the data to get (string, one of + @param category category of the data to get (one of PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS, DOCUMENTATIONPARMS or OTHERTOOLSPARMS) - @param key key of the data entry to get (string). + @type str + @param key key of the data entry to get + @type str @param data data to be stored - @return flag indicating success (boolean) + @type Any + @return flag indicating success + @rtype bool """ # __IGNORE_WARNING_D202__ if category not in [ @@ -710,7 +731,7 @@ @return list of known file categories @rtype list of str """ - return list(self.__fileCategoriesRepository.keys()) + return list(self.__fileCategoriesRepository) def getFileCategoryFilters(self, categories=None, withOthers=False, withAll=True): """ @@ -910,7 +931,7 @@ # File categories handled by activated plugin project browsers for fileCategory in [ f - for f in self.__fileCategoriesRepository.keys() + for f in self.__fileCategoriesRepository if f not in ["SOURCES", "FORMS", "RESOURCES", "TRANSLATIONS", "OTHERS"] ]: for ext in self.__fileCategoriesRepository[ @@ -948,7 +969,7 @@ with contextlib.suppress(KeyError): if self.__fileTypeCallbacks[self.__pdata["PROJECTTYPE"]] is not None: ftypes = self.__fileTypeCallbacks[self.__pdata["PROJECTTYPE"]]() - for pattern, ftype in list(ftypes.items()): + for pattern, ftype in ftypes.items(): if pattern not in self.__pdata["FILETYPES"]: self.__pdata["FILETYPES"][pattern] = ftype self.setDirty(True) @@ -976,7 +997,8 @@ """ Public method to get the most recently opened project. - @return path of the most recently opened project (string) + @return path of the most recently opened project + @rtype str """ if len(self.recent): return self.recent[0] @@ -987,7 +1009,8 @@ """ Public method to get a reference to the project browser model. - @return reference to the project browser model (ProjectBrowserModel) + @return reference to the project browser model + @rtype ProjectBrowserModel """ return self.__model @@ -1008,6 +1031,7 @@ Public method to get a reference to the VCS object. @return reference to the VCS object + @rtype VersionControl """ return self.vcs @@ -1054,7 +1078,8 @@ """ Public method to return the dirty state. - @return dirty state (boolean) + @return dirty state + @rtype bool """ return self.__dirty @@ -1062,7 +1087,8 @@ """ Public method to return the opened state. - @return open state (boolean) + @return open state + @rtype bool """ return self.opened @@ -1074,7 +1100,8 @@ filesystem. Non existant files are removed from the list and the dirty state of the project is changed accordingly. - @param index key of the list to be checked (string) + @param index key of the list to be checked + @type str """ removed = False removelist = [] @@ -1092,8 +1119,10 @@ """ Private method to read in a project (.epj or .e4p) file. - @param fn filename of the project file to be read (string) + @param fn filename of the project file to be read + @type str @return flag indicating success + @rtype bool """ if os.path.splitext(fn)[1] == ".epj": # new JSON based format @@ -1180,7 +1209,9 @@ is used. This is the 'save' action. If fn is given, this filename is used instead of the one in the project object. This is the 'save as' action. + @type str @return flag indicating success + @rtype bool """ if self.vcs is not None: self.__pdata["VCSOPTIONS"] = copy.deepcopy(self.vcs.vcsGetOptions()) @@ -1280,7 +1311,9 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. - @param indicator indicator string (string) + @type bool + @param indicator indicator string + @type str """ if self.pfile is None: if not quiet: @@ -1327,7 +1360,9 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. - @param indicator indicator string (string) + @type bool + @param indicator indicator string + @type str """ if self.pfile is None: if not quiet: @@ -1453,6 +1488,7 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. + @type bool """ if self.pfile is None: if not quiet: @@ -1499,6 +1535,7 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. + @type bool """ if self.pfile is None: if not quiet: @@ -1575,7 +1612,8 @@ """ Public method to return the status of the debug properties. - @return load status of debug properties (boolean) + @return load status of debug properties + @rtype bool """ return self.debugPropertiesLoaded or self.__pdata["EMBEDDED_VENV"] @@ -1593,8 +1631,10 @@ """ Public method to retrieve a debugger property. - @param key key of the property (string) + @param key key of the property + @type str @return value of the property + @rtype Any """ if key == "INTERPRETER": return ( @@ -1682,7 +1722,8 @@ """ Public method to get the translation pattern. - @return translation pattern (string) + @return translation pattern + @rtype str """ return self.__pdata["TRANSLATIONPATTERN"] @@ -1734,8 +1775,10 @@ Private method to calculate the filename of the binary translations file given the name of the raw translations file. - @param langFile name of the raw translations file (string) - @return name of the binary translations file (string) + @param langFile name of the raw translations file + @type str + @return name of the binary translations file + @rtype str """ qmFile = "" try: @@ -1777,7 +1820,8 @@ The translation file is not deleted from the project directory. - @param langFile the translation file to be removed (string) + @param langFile the translation file to be removed + @type str """ langFile = self.getRelativePath(langFile) qmFile = self.__binaryTranslationFile(langFile) @@ -1801,7 +1845,8 @@ """ Public slot to delete a translation from the project directory. - @param langFile the translation file to be removed (string) + @param langFile the translation file to be removed + @type str """ langFile = self.getRelativePath(langFile) qmFile = self.__binaryTranslationFile(langFile) @@ -1851,11 +1896,14 @@ """ Public method to append a file to the project. - @param fn filename to be added to the project (string) + @param fn filename to be added to the project + @type str @param isSourceFile flag indicating that this is a source file - even if it doesn't have the source extension (boolean) + even if it doesn't have the source extension + @type bool @param updateModel flag indicating an update of the model is - requested (boolean) + requested + @type bool """ dirty = False @@ -1872,7 +1920,7 @@ if fnmatch.fnmatch(bfn, "*.ts") or fnmatch.fnmatch(bfn, "*.qm"): filetype = "TRANSLATIONS" else: - for pattern in sorted(self.__pdata["FILETYPES"].keys(), reverse=True): + for pattern in sorted(self.__pdata["FILETYPES"], reverse=True): if fnmatch.fnmatch(bfn, pattern): filetype = self.__pdata["FILETYPES"][pattern] break @@ -1980,15 +2028,19 @@ Private method used to add all files of a single directory to the project. - @param filetype type of files to add (string) - @param source source directory (string) - @param target target directory (string) - @param quiet flag indicating quiet operations (boolean) + @param filetype type of files to add + @type str + @param source source directory + @type str + @param target target directory + @type str + @param quiet flag indicating quiet operations + @type bool """ # get all relevant filename patterns patterns = [] ignorePatterns = [] - for pattern, patterntype in list(self.__pdata["FILETYPES"].items()): + for pattern, patterntype in self.__pdata["FILETYPES"].items(): if patterntype == filetype: patterns.append(pattern) elif patterntype == "__IGNORE__": @@ -2061,9 +2113,12 @@ The tree is rooted at source to another one rooted at target. This method decents down to the lowest subdirectory. - @param filetype type of files to add (string) - @param source source directory (string) - @param target target directory (string) + @param filetype type of files to add + @type str + @param source source directory + @type str + @param target target directory + @type str """ # first perform the addition of source self.__addSingleDirectory(filetype, source, target, True) @@ -2140,7 +2195,8 @@ """ Public method to add a file/directory to the OTHERS project data. - @param fn file name or directory name to add (string) + @param fn file name or directory name to add + @type str """ if fn: # if it is below the project directory, make it relative to that @@ -2162,8 +2218,10 @@ """ Public method to rename the main script. - @param oldfn old filename (string) - @param newfn new filename of the main script (string) + @param oldfn old filename + @type str + @param newfn new filename of the main script + @type str """ if self.__pdata["MAINSCRIPT"]: ofn = self.getRelativePath(oldfn) @@ -2178,9 +2236,12 @@ """ Public slot to rename a file of the project. - @param oldfn old filename of the file (string) - @param newfn new filename of the file (string) + @param oldfn old filename of the file + @type str + @param newfn new filename of the file + @type str @return flag indicating success + @rtype bool """ fn = self.getRelativePath(oldfn) isSourceFile = fn in self.__pdata["SOURCES"] @@ -2232,10 +2293,13 @@ """ Public method to rename a file in the __pdata structure. - @param oldname old filename (string) - @param newname new filename (string) + @param oldname old filename + @type str + @param newname new filename + @type str @param isSourceFile flag indicating that this is a source file - even if it doesn't have the source extension (boolean) + even if it doesn't have the source extension + @type bool """ fn = self.getRelativePath(oldname) if os.path.dirname(oldname) == os.path.dirname(newname): @@ -2254,8 +2318,10 @@ """ Public method to get all files starting with a common prefix. - @param start prefix (string) - @return list of files starting with a common prefix (list of strings) + @param start prefix + @type str + @return list of files starting with a common prefix + @rtype list of str """ filelist = [] start = self.getRelativePath(start) @@ -2283,7 +2349,7 @@ for fn in self.__pdata[fileCategory][:]: filetype = fileCategory bfn = os.path.basename(fn) - for pattern in sorted(self.__pdata["FILETYPES"].keys(), reverse=True): + for pattern in sorted(self.__pdata["FILETYPES"], reverse=True): if fnmatch.fnmatch(bfn, pattern): filetype = self.__pdata["FILETYPES"][pattern] break @@ -2306,8 +2372,10 @@ """ Public slot to copy a directory. - @param olddn original directory name (string) - @param newdn new directory name (string) + @param olddn original directory name + @type str + @param newdn new directory name + @type str """ olddn = self.getRelativePath(olddn) newdn = self.getRelativePath(newdn) @@ -2326,8 +2394,10 @@ """ Public slot to move a directory. - @param olddn old directory name (string) - @param newdn new directory name (string) + @param olddn old directory name + @type str + @param newdn new directory name + @type str """ olddn = self.getRelativePath(olddn) newdn = self.getRelativePath(newdn) @@ -2366,8 +2436,9 @@ The file is not deleted from the project directory. @param fn filename to be removed from the project - @param updateModel flag indicating an update of the model is - requested (boolean) + @type str + @param updateModel flag indicating an update of the model is requested + @type bool """ fn = self.getRelativePath(fn) for fileCategory in self.getFileCategories(): @@ -2386,6 +2457,7 @@ The directory is not deleted from the project directory. @param dn directory name to be removed from the project + @type str """ dirty = False dn = self.getRelativePath(dn) @@ -2409,7 +2481,9 @@ Public method to delete a file from the project directory. @param fn filename to be deleted from the project - @return flag indicating success (boolean) + @type str + @return flag indicating success + @rtype bool """ try: os.remove(os.path.join(self.ppath, fn)) @@ -2449,12 +2523,14 @@ Public method to delete a directory from the project directory. @param dn directory name to be removed from the project - @return flag indicating success (boolean) + @type str + @return flag indicating success + @rtype bool """ if not os.path.isabs(dn): dn = os.path.join(self.ppath, dn) try: - shutil.rmtree(dn, True) + shutil.rmtree(dn, ignore_errors=True) except OSError as err: EricMessageBox.critical( self.ui, @@ -2473,8 +2549,10 @@ """ Public method to check the project for a file. - @param fn filename to be checked (string) - @return flag indicating, if the project contains the file (boolean) + @param fn filename to be checked + @type str + @return flag indicating, if the project contains the file + @rtype bool """ fn = self.getRelativePath(fn) return any( @@ -2776,8 +2854,7 @@ .getPluginDisplayStrings("version_control") ) vcsSystemsDisplay = [self.tr("None")] - keys = sorted(vcsSystemsDict.keys()) - for key in keys: + for key in sorted(vcsSystemsDict): vcsSystemsDisplay.append(vcsSystemsDict[key]) vcsSelected, ok = QInputDialog.getItem( None, @@ -2857,7 +2934,8 @@ """ Public method to add files to a new project. - @param mainscript name of the mainscript (string) + @param mainscript name of the mainscript + @type str """ # Show the file type associations for the user to change self.__showFiletypeAssociations() @@ -2870,8 +2948,7 @@ ignoreList = [os.path.split(environmentPath)[-1]] with EricOverrideCursor(): # search the project directory for files with known extensions - filespecs = list(self.__pdata["FILETYPES"].keys()) - for filespec in filespecs: + for filespec in self.__pdata["FILETYPES"]: files = FileSystemUtilities.direntries( self.ppath, filesonly=True, @@ -3118,11 +3195,13 @@ Public method to retrieve a lexer association. @param filename filename used to determine the associated lexer - language (string) - @return the requested lexer language (string) + language + @type str + @return the requested lexer language + @rtype str """ # try user settings first - for pattern, language in list(self.__pdata["LEXERASSOCS"].items()): + for pattern, language in self.__pdata["LEXERASSOCS"].items(): if fnmatch.fnmatch(filename, pattern): return language @@ -3152,9 +3231,12 @@ Public slot to open a project. @param fn optional filename of the project file to be read + @type str @param restoreSession flag indicating to restore the project - session (boolean) - @param reopen flag indicating a reopening of the project (boolean) + session + @type bool + @param reopen flag indicating a reopening of the project + @type bool """ if not self.checkDirty(): return @@ -3336,6 +3418,7 @@ Public slot to save the current project. @return flag indicating success + @rtype bool """ if self.isDirty(): if len(self.pfile) > 0: @@ -3355,7 +3438,8 @@ """ Public slot to save the current project to a different file. - @return flag indicating success (boolean) + @return flag indicating success + @rtype bool """ defaultFilter = self.tr("Project Files (*.epj)") defaultPath = ( @@ -3415,7 +3499,8 @@ """ Public method to check dirty status and open a message window. - @return flag indicating whether this operation was successful (boolean) + @return flag indicating whether this operation was successful + @rtype bool """ if self.isDirty(): res = EricMessageBox.okToClearData( @@ -3559,8 +3644,10 @@ Public method to save all scripts belonging to the project. @param reportSyntaxErrors flag indicating special reporting - for syntax errors (boolean) - @return flag indicating success (boolean) + for syntax errors + @type bool + @return flag indicating success + @rtype bool """ vm = ericApp().getObject("ViewManager") success = True @@ -3593,8 +3680,10 @@ their dirty status. @param reportSyntaxErrors flag indicating special reporting - for syntax errors (boolean) - @return flag indicating success (boolean) + for syntax errors + @type bool + @return flag indicating success + @rtype bool """ vm = ericApp().getObject("ViewManager") success = True @@ -3676,7 +3765,8 @@ """ Public method to get the type of the project. - @return UI type of the project (string) + @return UI type of the project + @rtype str """ return self.__pdata["PROJECTTYPE"] @@ -3684,7 +3774,8 @@ """ Public method to get the project's programming language. - @return programming language (string) + @return programming language + @rtype str """ return self.__pdata["PROGLANGUAGE"] @@ -3702,7 +3793,8 @@ Public method to check, if this project is a Python3 or MicroPython project. - @return flag indicating a Python project (boolean) + @return flag indicating a Python project + @rtype bool """ return self.__pdata["PROGLANGUAGE"] in ["Python3", "MicroPython"] @@ -3710,7 +3802,8 @@ """ Public method to check, if this project is a Python3 project. - @return flag indicating a Python3 project (boolean) + @return flag indicating a Python3 project + @rtype bool """ return self.__pdata["PROGLANGUAGE"] == "Python3" @@ -3727,7 +3820,8 @@ """ Public method to check, if this project is a Ruby project. - @return flag indicating a Ruby project (boolean) + @return flag indicating a Ruby project + @rtype bool """ return self.__pdata["PROGLANGUAGE"] == "Ruby" @@ -3735,7 +3829,8 @@ """ Public method to check, if this project is a JavaScript project. - @return flag indicating a JavaScript project (boolean) + @return flag indicating a JavaScript project + @rtype bool """ return self.__pdata["PROGLANGUAGE"] == "JavaScript" @@ -3743,7 +3838,8 @@ """ Public method to get the project's programming language. - @return programming language (string) + @return programming language + @rtype str """ return self.__pdata["SPELLLANGUAGE"] @@ -3751,8 +3847,9 @@ """ Public method to get the names of the project specific dictionaries. - @return tuple of two strings giving the absolute path names of the - project specific word and exclude list + @return tuple containing the absolute path names of the project specific + word and exclude list + @rtype tuple of (str, str) """ pwl = "" if self.__pdata["SPELLWORDS"]: @@ -3773,7 +3870,8 @@ Public method to get the default extension for the project's programming language. - @return default extension (including the dot) (string) + @return default extension (including the dot) + @rtype str """ lang = self.__pdata["PROGLANGUAGE"] if lang in ("", "Python"): @@ -3784,7 +3882,8 @@ """ Public method to get the project path. - @return project path (string) + @return project path + @rtype str """ return self.ppath @@ -3812,7 +3911,8 @@ """ Public method to get the path of the project file. - @return path of the project file (string) + @return path of the project file + @rtype str """ return self.pfile @@ -3822,7 +3922,8 @@ The project name is determined from the name of the project file. - @return name of the project (string) + @return name of the project + @rtype str """ if self.pfile: name = os.path.splitext(self.pfile)[0] @@ -3834,7 +3935,8 @@ """ Public method to get the path of the management directory. - @return path of the management directory (string) + @return path of the management directory + @rtype str """ return os.path.join(self.ppath, ".eric7project") @@ -3853,7 +3955,8 @@ """ Public method to get the project hash. - @return project hash as a hex string (string) + @return project hash as a hex string + @rtype str """ return self.__pdata["HASH"] @@ -3862,9 +3965,11 @@ Public method to convert a file path to a project relative file path. - @param path file or directory name to convert (string) + @param path file or directory name to convert + @type str @return project relative path or unchanged path, if path doesn't - belong to the project (string) + belong to the project + @rtype str """ if path is None: return "" @@ -3879,9 +3984,11 @@ Public method to convert a file path to a project relative file path with universal separators. - @param path file or directory name to convert (string) + @param path file or directory name to convert + @type str @return project relative path or unchanged path, if path doesn't - belong to the project (string) + belong to the project + @rtype str """ return FileSystemUtilities.fromNativeSeparators(self.getRelativePath(path)) @@ -3890,8 +3997,10 @@ Public method to convert a project relative file path to an absolute file path. - @param fn file or directory name to convert (string) - @return absolute path (string) + @param fn file or directory name to convert + @type str + @return absolute path + @rtype str """ if not os.path.isabs(fn): fn = os.path.join(self.ppath, fn) @@ -3902,8 +4011,10 @@ Public method to convert a project relative file path with universal separators to an absolute file path. - @param fn file or directory name to convert (string) - @return absolute path (string) + @param fn file or directory name to convert + @type str + @return absolute path + @rtype str """ if not os.path.isabs(fn): fn = os.path.join(self.ppath, FileSystemUtilities.toNativeSeparators(fn)) @@ -3913,7 +4024,8 @@ """ Public method to get the EOL-string to be used by the project. - @return eol string (string) + @return eol string + @rtype str """ if self.__pdata["EOL"] >= 0: return self.eols[self.__pdata["EOL"]] @@ -3933,7 +4045,8 @@ """ Public method to check, if the project uses the system eol setting. - @return flag indicating the usage of system eol (boolean) + @return flag indicating the usage of system eol + @rtype bool """ return self.__pdata["EOL"] == 0 @@ -4105,8 +4218,10 @@ Public method used to check, if the passed in filename belongs to the project. - @param fn filename to be checked (string) - @return flag indicating membership (boolean) + @param fn filename to be checked + @type str + @return flag indicating membership + @rtype bool """ return any( self.__checkProjectFileGroup(fn, category) @@ -4118,9 +4233,12 @@ Private method to check, if a file is in a specific file group of the project. - @param fn filename to be checked (string) - @param group group to check (string) - @return flag indicating membership (boolean) + @param fn filename to be checked + @type str + @param group group to check + @type str + @return flag indicating membership + @rtype bool """ newfn = os.path.abspath(fn) newfn = self.getRelativePath(newfn) @@ -4211,7 +4329,7 @@ self.reloadAct = EricAction( self.tr("Reload project"), EricPixmapCache.getIcon("projectReload"), - self.tr("&Reload"), + self.tr("Re&load"), 0, 0, self.actGrp1, @@ -5418,8 +5536,9 @@ toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) - @return tuple of the generated toolbars (tuple of two QToolBar) + @type EricToolBarManager + @return tuple of the generated toolbars + @rtype tuple of two QToolBar """ from eric7 import VCS @@ -5493,7 +5612,8 @@ Private method to open a project from the list of rencently opened projects. - @param act reference to the action that triggered (QAction) + @param act reference to the action that triggered + @type QAction """ file = act.data() if file: @@ -5547,9 +5667,11 @@ automatically added to the project. @param AI flag indicating whether the automatic inclusion should - be honoured (boolean) + be honoured + @type bool @param onUserDemand flag indicating whether this method was - requested by the user via a menu action (boolean) + requested by the user via a menu action + @type bool """ from .AddFoundFilesDialog import AddFoundFilesDialog @@ -5612,7 +5734,7 @@ filetype = "" bfn = os.path.basename(fn) - for pattern in sorted(self.__pdata["FILETYPES"].keys(), reverse=True): + for pattern in sorted(self.__pdata["FILETYPES"], reverse=True): if fnmatch.fnmatch(bfn, pattern): filetype = self.__pdata["FILETYPES"][pattern] break @@ -5670,9 +5792,10 @@ Public slot to be called, if something was added to the OTHERS project data area. - @param fn filename or directory name added (string) + @param fn filename or directory name added + @type str @param updateModel flag indicating an update of the model is requested - (boolean) + @type bool """ self.projectFileAdded.emit(fn, "OTHERS") updateModel and self.__model.addNewItem("OTHERS", fn) @@ -5681,7 +5804,8 @@ """ Public method to get a list of all actions. - @return list of all actions (list of EricAction) + @return list of all actions + @rtype list of EricAction """ return self.actions[:] @@ -5689,7 +5813,8 @@ """ Public method to add actions to the list of actions. - @param actions list of actions (list of EricAction) + @param actions list of actions + @type list of EricAction """ self.actions.extend(actions) @@ -5697,7 +5822,8 @@ """ Public method to remove actions from the list of actions. - @param actions list of actions (list of EricAction) + @param actions list of actions + @type list of EricAction """ for act in actions: with contextlib.suppress(ValueError): @@ -5707,8 +5833,10 @@ """ Public method to get a reference to the main menu or a submenu. - @param menuName name of the menu (string) - @return reference to the requested menu (QMenu) or None + @param menuName name of the menu + @type str + @return reference to the requested menu or None + @rtype QMenu """ try: return self.__menus[menuName] @@ -5719,7 +5847,8 @@ """ Public slot to repopulate a named item. - @param fullname full name of the item to repopulate (string) + @param fullname full name of the item to repopulate + @type str """ if not self.isOpen(): return @@ -5738,10 +5867,12 @@ """ Public method used to instantiate a vcs system. - @param vcsSystem type of VCS to be used (string) + @param vcsSystem type of VCS to be used + @type str @param nooverride flag indicating to ignore an override request - (boolean) + @type bool @return a reference to the vcs object + @rtype VersionControl """ from eric7 import VCS @@ -5854,7 +5985,8 @@ Public method to check, if some supported VCS software is available to the IDE. - @return flag indicating availability of VCS software (boolean) + @return flag indicating availability of VCS software + @rtype bool """ vcsSystemsDict = ( ericApp() @@ -6084,7 +6216,8 @@ """ Public method to se the interval of the VCS status monitor thread. - @param interval status monitor interval in seconds (integer) + @param interval status monitor interval in seconds + @type int """ if self.vcs is not None: self.vcs.setStatusMonitorInterval(interval, self) @@ -6093,7 +6226,8 @@ """ Public method to get the monitor interval. - @return interval in seconds (integer) + @return interval in seconds + @rtype int """ if self.vcs is not None: return self.vcs.getStatusMonitorInterval() @@ -6104,7 +6238,8 @@ """ Public method to enable the auto update function. - @param auto status of the auto update function (boolean) + @param auto status of the auto update function + @type bool """ if self.vcs is not None: self.vcs.setStatusMonitorAutoUpdate(auto) @@ -6113,7 +6248,8 @@ """ Public method to retrieve the status of the auto update function. - @return status of the auto update function (boolean) + @return status of the auto update function + @rtype bool """ if self.vcs is not None: return self.vcs.getStatusMonitorAutoUpdate() @@ -6131,7 +6267,8 @@ """ Public method to clear the cached VCS state of a file/directory. - @param name name of the entry to be cleared (string) + @param name name of the entry to be cleared + @type str """ if self.vcs is not None: self.vcs.clearStatusMonitorCachedState(name) @@ -6233,7 +6370,8 @@ """ Private slot to create eric plugin archives. - @param snapshot flag indicating snapshot archives (boolean) + @param snapshot flag indicating snapshot archives + @type bool """ if not self.__pdata["MAINSCRIPT"]: EricMessageBox.critical( @@ -6435,8 +6573,10 @@ """ Private method to create dir entries in the zip file. - @param path name of the directory entry to create (string) - @param zipFile open ZipFile object (zipfile.ZipFile) + @param path name of the directory entry to create + @type str + @param zipFile open ZipFile object + @type zipfile.ZipFile """ if path in ("", "/", "\\"): return @@ -6456,8 +6596,10 @@ a snapshot version. This method appends the string "-snapshot-" and date indicator to the version string. - @param filename name of the plugin file to modify (string) - @return modified source (bytes), snapshot version string (string) + @param filename name of the plugin file to modify + @type str + @return modified source (bytes), snapshot version string + @rtype str """ try: sourcelines, encoding = Utilities.readEncodedFile(filename) @@ -6497,8 +6639,10 @@ """ Private method to extract the version number entry. - @param filename name of the plugin file (string) - @return version string (string) + @param filename name of the plugin file + @type str + @return version string + @rtype str """ version = "0.0.0" try: @@ -6757,7 +6901,7 @@ @param name name of the parameter @type str @return value of the given parameter - @rtype any, None in case on non-existence + @rtype Any, None in case on non-existence """ if name in self.__pdata["UICPARAMS"]: return self.__pdata["UICPARAMS"][name] @@ -7055,7 +7199,7 @@ self.__configureEnvironment() if not self.__venvConfiguration["interpreter"]: # user canceled the environment creation, delete the created directory - shutil.rmtree(configuration["targetDirectory"], True) + shutil.rmtree(configuration["targetDirectory"], ignore_errors=True) self.__setEmbeddedEnvironmentProjectConfig(False) return