From 62efcee4dd225d626121c9f98a8a6864d6e29697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 3 Aug 2022 11:41:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=20Make=20codespell=20pre-commit=20che?= =?UTF-8?q?ck=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/jsclientlib/util.rst | 4 ++-- setup.cfg | 2 +- src/octoprint/plugins/gcodeviewer/__init__.py | 2 +- .../gcodeviewer/static/js/{viewer => lib}/pako.js | 0 src/octoprint/server/__init__.py | 8 ++++---- src/octoprint/static/js/app/main.js | 4 ++-- src/octoprint/util/jinja.py | 8 ++++---- tests/static/js/test-helpers.js | 12 ++++++------ 8 files changed, 20 insertions(+), 20 deletions(-) rename src/octoprint/plugins/gcodeviewer/static/js/{viewer => lib}/pako.js (100%) diff --git a/docs/jsclientlib/util.rst b/docs/jsclientlib/util.rst index a5454b64d..fc2a711a2 100644 --- a/docs/jsclientlib/util.rst +++ b/docs/jsclientlib/util.rst @@ -30,7 +30,7 @@ .. code-block:: javascript - OctoPrint.util.testPath("/som/path/to/a/file") + OctoPrint.util.testPath("/some/path/to/a/file") .done(function(response) { if (response.result) { // check passed @@ -45,7 +45,7 @@ .. code-block:: javascript - OctoPrint.util.testPath("/som/path/to/a/file", {"check_type": "file", "check_access": ["r", "x"]}) + OctoPrint.util.testPath("/some/path/to/a/file", {"check_type": "file", "check_access": ["r", "x"]}) .done(function(response) { if (response.result) { // check passed diff --git a/setup.cfg b/setup.cfg index 552e134b7..f02d12124 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ known_first_party = octoprint_client [codespell] -skip = *.po,*.min.js,.git,*/vendor,*/lib,*/bootstrap,*/node_modules,*/translations,*/venv*,*/.*,*/build,*/_build,setup.cfg,AUTHORS.md +skip = *.po,*.min.js,.git,*/vendor/*,*/lib/*,*/bootstrap/*,*/node_modules/*,*/translations/*,*/venv*,*/.*,*/build/*,*/_build/*,setup.cfg,AUTHORS.md ignore-words = .codespell_ignore_words quiet-level = 3 count = diff --git a/src/octoprint/plugins/gcodeviewer/__init__.py b/src/octoprint/plugins/gcodeviewer/__init__.py index 00f61c787..a72b1f860 100644 --- a/src/octoprint/plugins/gcodeviewer/__init__.py +++ b/src/octoprint/plugins/gcodeviewer/__init__.py @@ -17,7 +17,7 @@ class GcodeviewerPlugin( "js/viewer/ui.js", "js/viewer/reader.js", "js/viewer/renderer.js", - "js/viewer/pako.js", + "js/lib/pako.js", ] return { diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/pako.js b/src/octoprint/plugins/gcodeviewer/static/js/lib/pako.js similarity index 100% rename from src/octoprint/plugins/gcodeviewer/static/js/viewer/pako.js rename to src/octoprint/plugins/gcodeviewer/static/js/lib/pako.js diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 8d29f8548..eea4b319b 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -1487,19 +1487,19 @@ class Server: return html_header_regex.sub(repl, s) markdown_header_regex = re.compile( - r"^(?P#+)\s+(?P.*)$", flags=re.MULTILINE + r"^(?P#+)\s+(?P.*)$", flags=re.MULTILINE ) def offset_markdown_headers(s, offset): def repl(match): - number = len(match.group("hashs")) + number = len(match.group("hashes")) number += offset if number > 6: number = 6 elif number < 1: number = 1 - return "{hashs} {content}".format( - hashs="#" * number, content=match.group("content") + return "{hashes} {content}".format( + hashes="#" * number, content=match.group("content") ) return markdown_header_regex.sub(repl, s) diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index 3e284b2f0..d3fca0d32 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -444,7 +444,7 @@ $(function () { }; } - // make sure we have atleast a function + // make sure we have at least a function if (!_.isFunction(viewModel.construct)) { log.error("No function to instantiate with", viewModel); continue; @@ -533,7 +533,7 @@ $(function () { } } - // anything that's now in the postponed list has to be readded to the unprocessedViewModels + // anything that's now in the postponed list has to be re-added to the unprocessedViewModels unprocessedViewModels = unprocessedViewModels.concat(postponed); // if we still have the same amount of items in our list of unprocessed view models it means that we diff --git a/src/octoprint/util/jinja.py b/src/octoprint/util/jinja.py index 488a7cb66..26ad4b7ab 100644 --- a/src/octoprint/util/jinja.py +++ b/src/octoprint/util/jinja.py @@ -85,13 +85,13 @@ class SelectedFilesLoader(BaseLoader): mtime = os.path.getmtime(path) - def uptodate(): + def up_to_date(): try: return os.path.getmtime(path) == mtime except OSError: return False - return contents, path, uptodate + return contents, path, up_to_date def list_templates(self): return self.files.keys() @@ -136,11 +136,11 @@ class WarningLoader(BaseLoader): import logging try: - contents, filename, uptodate = self.loader.get_source(environment, template) + contents, filename, up_to_date = self.loader.get_source(environment, template) logging.getLogger(__name__).warning( self.warning_message.format(template=template, filename=filename) ) - return contents, filename, uptodate + return contents, filename, up_to_date except TemplateNotFound: raise diff --git a/tests/static/js/test-helpers.js b/tests/static/js/test-helpers.js index f56bc7188..abbd8717e 100644 --- a/tests/static/js/test-helpers.js +++ b/tests/static/js/test-helpers.js @@ -992,27 +992,27 @@ QUnit.cases( }, { title: "Text", - input: "text", + input: "abcd", sep: undefined, stripEmpty: false, filter: undefined, - expected: ["text"] + expected: ["abcd"] }, { title: "TextSeparator", - input: "te#xt", + input: "ab#cd", sep: "#", stripEmpty: false, filter: undefined, - expected: ["te", "xt"] + expected: ["ab", "cd"] }, { title: "TrimmedText", - input: "te # xt", + input: "ab # cd", sep: "#", stripEmpty: false, filter: undefined, - expected: ["te", "xt"] + expected: ["ab", "cd"] } ];