Sat, 23 Dec 2023 19:35:14 +0100
Corrected some code style issues and converted some source code documentation to the new style.
--- a/PluginTimeTracker.epj Sat Dec 23 15:48:55 2023 +0100 +++ b/PluginTimeTracker.epj Sat Dec 23 19:35:14 2023 +0100 @@ -1,7 +1,7 @@ { "header": { "comment": "eric project file for project PluginTimeTracker", - "copyright": "Copyright (C) 2022 Detlev Offenbach, detlev@die-offenbachs.de" + "copyright": "Copyright (C) 2023 Detlev Offenbach, detlev@die-offenbachs.de" }, "project": { "AUTHOR": "Detlev Offenbach", @@ -11,10 +11,14 @@ "AllowStarArgAny": false, "AllowUntypedDefs": false, "AllowUntypedNested": false, + "CheckFutureAnnotations": false, "DispatchDecorators": [ "singledispatch", "singledispatchmethod" ], + "ExemptedTypingSymbols": [ + "" + ], "ForceFutureAnnotations": false, "MaximumComplexity": 3, "MaximumLength": 7, @@ -62,15 +66,18 @@ "CopyrightAuthor": "", "CopyrightMinFileSize": 0, "DocstringType": "eric_black", - "EnabledCheckerCategories": "C, D, E, M, N, S, Y, W", + "EnabledCheckerCategories": "C, D, E, I, L, M, NO, N, S, Y, U, W", "ExcludeFiles": "*/Ui_*.py, */*_rc.py,", - "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,N802,N803,N807,N808,N821,W293,W503,Y119,Y401,Y402", + "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,M852,N802,N803,N807,N808,N821,W293,W503,Y119,Y401,Y402", "FixCodes": "", "FixIssues": false, "FutureChecker": "", "HangClosing": false, "ImportsChecker": { - "ApplicationPackageNames": [], + "ApplicationPackageNames": [ + "TimeTracker", + "eric7" + ], "BanRelativeImports": "", "BannedModules": [] }, @@ -80,6 +87,17 @@ "MaxCodeComplexity": 10, "MaxDocLineLength": 88, "MaxLineLength": 88, + "NameOrderChecker": { + "ApplicationPackageNames": [ + "TimeTracker", + "eric7" + ], + "CombinedAsImports": false, + "SortCaseSensitive": false, + "SortFromFirst": false, + "SortIgnoringStyle": false, + "SortOrder": "natural" + }, "NoFixCodes": "E501", "RepeatMessages": true, "SecurityChecker": { @@ -113,6 +131,19 @@ "WeakKeySizeRsaMedium": "2048" }, "ShowIgnored": false, + "UnusedChecker": { + "IgnoreAbstract": true, + "IgnoreDunderGlobals": true, + "IgnoreDunderMethods": true, + "IgnoreEventHandlerMethods": false, + "IgnoreLambdas": false, + "IgnoreNestedFunctions": false, + "IgnoreOverload": true, + "IgnoreOverride": true, + "IgnoreSlotMethods": false, + "IgnoreStubs": true, + "IgnoreVariadicNames": false + }, "ValidEncodings": "latin-1, utf-8" } }, @@ -132,6 +163,7 @@ ], "outputDirectory": "TimeTracker/Documentation/source", "qtHelpEnabled": false, + "startDirectory": "", "useRecursion": true } }, @@ -197,7 +229,7 @@ ], "OTHERTOOLSPARMS": { "Black": { - "exclude": "/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.mypy_cache|\\.nox|\\.tox|\\.venv|venv|\\.svn|\\.ipynb_checkpoints|_build|buck-out|build|dist|__pypackages__)/", + "exclude": "/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.ipynb_checkpoints|\\.mypy_cache|\\.nox|\\.pytest_cache|\\.ruff_cache|\\.tox|\\.svn|\\.venv|\\.vscode|__pypackages__|_build|buck-out|build|dist|venv)/", "extend-exclude": "", "force-exclude": "", "line-length": 88, @@ -205,6 +237,7 @@ "skip-string-normalization": false, "source": "project", "target-version": [ + "py312", "py311", "py310", "py39", @@ -253,6 +286,7 @@ "TimeTracker/__init__.py", "__init__.py" ], + "SOURCESDIR": "", "SPELLEXCLUDES": "", "SPELLLANGUAGE": "en", "SPELLWORDS": "",
--- a/PluginTimeTracker.py Sat Dec 23 15:48:55 2023 +0100 +++ b/PluginTimeTracker.py Sat Dec 23 19:35:14 2023 +0100 @@ -38,7 +38,7 @@ timeTrackerPluginObject = None -def createTimeTrackerPage(configDlg): +def createTimeTrackerPage(configDlg): # noqa: U100 """ Module function to create the Time Tracker configuration page. @@ -47,8 +47,9 @@ @return reference to the configuration page @rtype TimeTrackerPage """ + from TimeTracker.ConfigurationPage.TimeTrackerPage import TimeTrackerPage + global timeTrackerPluginObject - from TimeTracker.ConfigurationPage.TimeTrackerPage import TimeTrackerPage return TimeTrackerPage(timeTrackerPluginObject) @@ -222,4 +223,4 @@ # -# eflag: noqa = M801 +# eflag: noqa = M801, U200
--- a/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTracker.html Sat Dec 23 15:48:55 2023 +0100 +++ b/TimeTracker/Documentation/source/Plugin_Time_Tracker.TimeTracker.TimeTracker.html Sat Dec 23 19:35:14 2023 +0100 @@ -340,9 +340,9 @@ </p> <dl> -<dt><i>fname</i></dt> +<dt><i>fname</i> (str)</dt> <dd> -name of the file to import (string) +name of the file to import </dd> </dl> <a NAME="TimeTracker.mergeDuplicateTrackerEntries" ID="TimeTracker.mergeDuplicateTrackerEntries"></a>
--- a/TimeTracker/TimeTracker.py Sat Dec 23 15:48:55 2023 +0100 +++ b/TimeTracker/TimeTracker.py Sat Dec 23 19:35:14 2023 +0100 @@ -149,6 +149,8 @@ """ Private slot to read the time tracker entries from a file. """ + from .TimeTrackEntry import TimeTrackEntry + if os.path.exists(self.__trackerFilePath): try: with open(self.__trackerFilePath, "r") as f: @@ -165,8 +167,6 @@ ) return - from .TimeTrackEntry import TimeTrackEntry - invalidCount = 0 for data in entriesDataList: entry = TimeTrackEntry(self.__plugin) @@ -209,7 +209,7 @@ jsonString = json.dumps(entriesDataList, indent=2) with open(filePath, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: EricMessageBox.critical( self.__ui, self.tr("Save Time Tracker File"), @@ -223,8 +223,11 @@ """ Public slot to import tracker entries from a file. - @param fname name of the file to import (string) + @param fname name of the file to import + @type str """ + from .TimeTrackEntry import TimeTrackEntry + try: with open(fname, "r", encoding="utf-8") as f: jsonString = f.read() @@ -240,8 +243,6 @@ ) return - from .TimeTrackEntry import TimeTrackEntry - invalidCount = 0 duplicateCount = 0 entries = [] @@ -320,6 +321,8 @@ @param comment comment @type str """ + from .TimeTrackEntry import TimeTrackEntry + if not self.__plugin.getPreferences("AllowDuplicates"): startDateTimes = [ entry.getStartDateTime() for entry in self.__entries.values() @@ -332,8 +335,6 @@ nextID = max(self.__entries.keys()) + 1 if len(self.__entries.keys()) else 0 - from .TimeTrackEntry import TimeTrackEntry - entry = TimeTrackEntry(self.__plugin) entry.setID(nextID) entry.setStartDateTime(startDateTime)
--- a/TimeTracker/TimeTrackerEntryDialog.py Sat Dec 23 15:48:55 2023 +0100 +++ b/TimeTracker/TimeTrackerEntryDialog.py Sat Dec 23 19:35:14 2023 +0100 @@ -74,7 +74,7 @@ ) @pyqtSlot(QDateTime) - def on_startDateTimeEdit_dateTimeChanged(self, date): + def on_startDateTimeEdit_dateTimeChanged(self, date): # noqa: U100 """ Private slot handling a change of the start date and time. @@ -84,7 +84,7 @@ self.__checkOk() @pyqtSlot(int) - def on_durationSpinBox_valueChanged(self, value): + def on_durationSpinBox_valueChanged(self, value): # noqa: U100 """ Private slot handling a change of the duration.
--- a/TimeTracker/TimeTrackerWidget.py Sat Dec 23 15:48:55 2023 +0100 +++ b/TimeTracker/TimeTrackerWidget.py Sat Dec 23 19:35:14 2023 +0100 @@ -130,7 +130,7 @@ self.__tracker.startTrackerEntry() @pyqtSlot(QPoint) - def on_entriesList_customContextMenuRequested(self, pos): + def on_entriesList_customContextMenuRequested(self, pos): # noqa: U100 """ Private slot to create the context menu and show it. @@ -190,14 +190,14 @@ """ Private slot to edit the selected tracker entry. """ + from .TimeTrackerEntryDialog import TimeTrackerEntryDialog + itm = self.entriesList.selectedItems()[0] eid = itm.data(0, Qt.ItemDataRole.UserRole) if eid > -1: # the current entry is edited via the elements of this widget entry = self.__tracker.getEntry(eid) if entry is not None: - from .TimeTrackerEntryDialog import TimeTrackerEntryDialog - tasks = [ self.taskCombo.itemText(index) for index in range(self.taskCombo.count()) @@ -235,7 +235,7 @@ res = EricMessageBox.yesNo( self, self.tr("Delete Selected Entries"), - self.tr("""Do you really want to delete the selected""" """ entries?"""), + self.tr("""Do you really want to delete the selected entries?"""), ) if res: for item in self.entriesList.selectedItems(): @@ -304,7 +304,7 @@ self, self.tr("Export Time Tracker Entries"), self.tr( - "<p>The file <b>{0}</b> already exists." " Overwrite it?</p>" + "<p>The file <b>{0}</b> already exists. Overwrite it?</p>" ).format(fname), icon=EricMessageBox.Warning, )