From 056831cb80b9cd6be4e8bd96bd231cde47ee3695 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 9 Dec 2023 08:54:15 -0500 Subject: [PATCH] Add codespell: config, workflow (to alert when new typos added) and get typos fixed (#302) * Add github action to codespell master on push and PRs * Add rudimentary codespell config * remove spurious space added in d79fe14c * ignore logs * [DATALAD RUNCMD] run codespell throughout but ignore fail === Do not change lines below === { "chain": [], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- .github/CONTRIBUTING.md | 2 +- .github/workflows/codespell.yml | 22 +++++++++++++++++++ CHANGELOG.md | 2 +- docs/source/THANKS | 2 +- docs/source/_templates/autosummary/module.rst | 2 +- docs/source/addons-mercurial.rst | 2 +- docs/source/addons-mysql.rst | 2 +- docs/source/addons-virtual.rst | 2 +- docs/source/changelog04.md | 2 +- docs/source/development.rst | 6 ++--- docs/source/installation.rst | 2 +- docs/source/user_guide_access.rst | 6 ++--- docs/source/user_guide_configure.rst | 2 +- pyproject.toml | 6 +++++ sample_wsgidav.yaml | 4 ++-- setup_bdist_msi.py | 2 +- tests/davclient.py | 2 +- tests/stressor/results.md | 2 +- tests/stressor/test_rw.yaml | 2 +- tests/test_litmus.py | 6 ++--- tests/test_streaming.py | 2 +- tests/test_util.py | 4 ++-- wsgidav/dav_provider.py | 6 ++--- wsgidav/default_conf.py | 2 +- wsgidav/fs_dav_provider.py | 2 +- wsgidav/lock_man/lock_manager.py | 2 +- wsgidav/mw/debug_filter.py | 2 +- wsgidav/prop_man/mongo_property_manager.py | 2 +- wsgidav/server/ext_wsgiutils_server.py | 4 ++-- wsgidav/stream_tools.py | 4 ++-- wsgidav/util.py | 2 +- 31 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6ceef098..80324247 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -43,7 +43,7 @@ or using Python's builtin `venv` instead of `virtualenvwrapper`: ``` The new environment exists and is activated. -Now install the development dependencies into that environemt: +Now install the development dependencies into that environment: ``` (wsgidav_py34) $ pip install -r requirements-dev.txt ``` diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..7373affc --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,22 @@ +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 241435b6..a05a5cb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ [symlinks may be a security risk](https://serverfault.com/questions/244592/followsymlinks-on-apache-why-is-it-a-security-risk).
File resources that are symlinks are still enumerated and listed by the directory browser. However trying to access content will raise '403 Forbidden' - Pass _follow_symlinks=True_ to the FilesystemProvider constructor or yaml configration + Pass _follow_symlinks=True_ to the FilesystemProvider constructor or yaml configuration to restore the previous behavior. - Add `fs_dav_provider.shadow_map`, which can be used to blend in a favicon when context is opened inline (#230) diff --git a/docs/source/THANKS b/docs/source/THANKS index e2923c54..dd35f3eb 100644 --- a/docs/source/THANKS +++ b/docs/source/THANKS @@ -6,7 +6,7 @@ Martin Wendt: * Stéphane Klein for many contributions and testing on Mac -* All other contributers: +* All other contributors: http://code.google.com/p/wsgidav/people/list https://github.com/mar10/wsgidav/graphs/contributors diff --git a/docs/source/_templates/autosummary/module.rst b/docs/source/_templates/autosummary/module.rst index 143b9718..aff6dc7d 100644 --- a/docs/source/_templates/autosummary/module.rst +++ b/docs/source/_templates/autosummary/module.rst @@ -3,7 +3,7 @@ .. Custom formatting of module doc layout https://stackoverflow.com/questions/48074094/use-sphinx-autosummary-recursively-to-generate-api-documentation - TODO: how can we add the documented module attribuets (constants, ...)? + TODO: how can we add the documented module attributes (constants, ...)? .. rubric:: Description diff --git a/docs/source/addons-mercurial.rst b/docs/source/addons-mercurial.rst index 489f69ac..954befd8 100644 --- a/docs/source/addons-mercurial.rst +++ b/docs/source/addons-mercurial.rst @@ -17,7 +17,7 @@ Usage ----- .. note:: This is **not** production code. -To publish a Mercurial repository by the share name 'hg', simply add thes lines +To publish a Mercurial repository by the share name 'hg', simply add these lines to the configuration file:: # Publish a Mercurial repository diff --git a/docs/source/addons-mysql.rst b/docs/source/addons-mysql.rst index 0fa820eb..b92990c2 100644 --- a/docs/source/addons-mysql.rst +++ b/docs/source/addons-mysql.rst @@ -20,7 +20,7 @@ The table's columns are mad accessible as live properties: Usage ----- -To publish an MySQL database, simply add thes lines to the configuration file:: +To publish an MySQL database, simply add these lines to the configuration file:: ### Publish an MySQL 'world' database as share '/world-db' from wsgidav.samples.mysql_dav_provider import MySQLBrowserProvider diff --git a/docs/source/addons-virtual.rst b/docs/source/addons-virtual.rst index 85d57d2b..8909bed6 100644 --- a/docs/source/addons-virtual.rst +++ b/docs/source/addons-virtual.rst @@ -28,7 +28,7 @@ contains some virtual files with additional information: Usage ----- -To publish the sample virtual resources, simply add thes lines to the +To publish the sample virtual resources, simply add these lines to the configuration file:: # Publish a virtual structure diff --git a/docs/source/changelog04.md b/docs/source/changelog04.md index c094f46e..dad6acdd 100644 --- a/docs/source/changelog04.md +++ b/docs/source/changelog04.md @@ -83,7 +83,7 @@ Also, the config file is optional, i.e. the server runs also with command line o
  • Property manager
    -Removed propertylibrary helper fuctions (only !PropManager class left).
    +Removed propertylibrary helper functions (only !PropManager class left).
    Add property functions to davProvider getProperties() returns (name, value) tuples, where value is etree.Element or HTTPRequestException().
    diff --git a/docs/source/development.rst b/docs/source/development.rst index d58202e2..1749abf1 100644 --- a/docs/source/development.rst +++ b/docs/source/development.rst @@ -93,7 +93,7 @@ committing the changes. The pull request will then need to be approved before i .. note:: Don't mix different topics in a single commit or issue. Instead submit a new pull request (and - even create separate branches as apropriate). + even create separate branches as appropriate). Setup for Development @@ -120,7 +120,7 @@ Create and Activate a Virtual Environment ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Virtual environments allow us to develop and test in a sandbox, without affecting our -system othwerwise. |br| +system otherwise. |br| We need `Python 2.7 `_, `Python 3.4+ `_, and `pip `_ on our system. @@ -183,7 +183,7 @@ Hack, Hack, Hack Since version 3.x source formatting rules are delegated to the `Black library `_. - Failing tests or not follwing PEP 8 will break builds on + Failing tests or not following PEP 8 will break builds on `travis `_ and therefore be automatically rejected: diff --git a/docs/source/installation.rst b/docs/source/installation.rst index e2c10e56..f9d97481 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -86,7 +86,7 @@ If everything is cool, this should work now:: Windows ------- -Install the preconditions if neccessary. +Install the preconditions if necessary. Basically the same as for `Linux / macOS`_ .. note:: diff --git a/docs/source/user_guide_access.rst b/docs/source/user_guide_access.rst index 9e828329..21a198f9 100644 --- a/docs/source/user_guide_access.rst +++ b/docs/source/user_guide_access.rst @@ -38,7 +38,7 @@ Redirector The easiest way to access a WebDAV share from a Windows client is probably to map it as a network drive, and then use the File Explorer. -If the share allows anonymous access, type this at the command promt:: +If the share allows anonymous access, type this at the command prompt:: > net use W: http://192.168.0.2/ > dir W: @@ -67,7 +67,7 @@ To stop a connection:: **Known issues on all Windows versions** -* See als greenbytes `WebDAV Mini-Redirector (MRXDAV.SYS) Versions and Issues +* See also greenbytes `WebDAV Mini-Redirector (MRXDAV.SYS) Versions and Issues List `_. * The WebDAV server must respond to PROPFIND and OPTIONS requests at the root @@ -145,7 +145,7 @@ Microsoft's "WebFolder" client predates Windows XP's WebDAV Redirector. .. note:: Some known quirks of Microsoft's "WebFolder" client are listed below. - See als greenbytes `Web Folder Client (MSDAIPP.DLL) Versions and Issues List + See also greenbytes `Web Folder Client (MSDAIPP.DLL) Versions and Issues List `_. diff --git a/docs/source/user_guide_configure.rst b/docs/source/user_guide_configure.rst index d0788238..e2b13b8f 100644 --- a/docs/source/user_guide_configure.rst +++ b/docs/source/user_guide_configure.rst @@ -237,7 +237,7 @@ Three syntax variants are supported: 2. ``: { "root": , "readonly": }``: use ``FilesystemProvider(folder_path, readonly)`` 3. ``: { "class": , args: [arg, ...], kwargs: {"arg1": val1, "arg2": val2, ... }}`` - Instantiate a custom class (derrived from ``DAVProvider``) using named + Instantiate a custom class (derived from ``DAVProvider``) using named kwargs. .. diff --git a/pyproject.toml b/pyproject.toml index 2a993463..685085d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,3 +27,9 @@ src_paths = ["wsgidav", "tests"] # [tool.flake8] # Flake8 currently does not support pyproject.toml. # See [flake8] section in setup.cfg instead. + +[tool.codespell] +skip = '.git,*.pdf,*.svg,*.lock,*.css,logs' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' diff --git a/sample_wsgidav.yaml b/sample_wsgidav.yaml index a3f30939..6fabb149 100644 --- a/sample_wsgidav.yaml +++ b/sample_wsgidav.yaml @@ -135,7 +135,7 @@ provider_mapping: path: '/path/to/share3' another_arg: 42 -#: Addional configuration passed to `FilesystemProvider(..., fs_opts)` +#: Additional configuration passed to `FilesystemProvider(..., fs_opts)` fs_dav_provider: #: Mapping from request URL to physical file location, e.g. #: make sure that a `/favicon.ico` URL is resolved, even if a `*.html` @@ -246,7 +246,7 @@ property_manager: null #: Optional additional live property modification #: Note: by default live properties like file size and last-modified time are -#: read-only, but that can be overriden here if the underlying DAV provider +#: read-only, but that can be overridden here if the underlying DAV provider #: supports it. For now only the FileSystemProvider supports it and only namely #: changes to the last-modified timestamp. Enable it with the mutable_live_props #: list as below to allow clients to use the utime system call or e.g. the diff --git a/setup_bdist_msi.py b/setup_bdist_msi.py index 5c5f15e3..1ebf33c9 100644 --- a/setup_bdist_msi.py +++ b/setup_bdist_msi.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# NOTE: isort must not chage this import order: +# NOTE: isort must not change this import order: # isort: skip_file import os diff --git a/tests/davclient.py b/tests/davclient.py index ad31d964..f9bac636 100644 --- a/tests/davclient.py +++ b/tests/davclient.py @@ -84,7 +84,7 @@ def object_to_etree(parent, obj, namespace=""): elif type(obj) is dict: # If the object is a dictionary we"ll need to parse it and send it back - # recusively + # recursively for key, value in obj.items(): if key.startswith("{") is False: key_etree = ElementTree.SubElement(parent, "{%s}%s" % (namespace, key)) diff --git a/tests/stressor/results.md b/tests/stressor/results.md index 8c7b0956..c3292f5f 100644 --- a/tests/stressor/results.md +++ b/tests/stressor/results.md @@ -312,7 +312,7 @@ $ ### Cheroot v8.1.0 **2.9k activities per 30 sec** -**Major Preformance Drop Introduced with v8.1.0** +**Major Performance Drop Introduced with v8.1.0** ``` $ stressor run tests/stressor/test_rw.yaml -q 23:00:22.793 <4745440704> NOTE All 10 sessions running, waiting for them to terminate... diff --git a/tests/stressor/test_rw.yaml b/tests/stressor/test_rw.yaml index ad0ba058..1caa3e52 100644 --- a/tests/stressor/test_rw.yaml +++ b/tests/stressor/test_rw.yaml @@ -57,7 +57,7 @@ sequences: # - activity: $debug() - # Other sections can have arbitrary names and are excuted in order of appearance + # Other sections can have arbitrary names and are executed in order of appearance main: # Test dirbrowser for root URL - activity: GetRequest diff --git a/tests/test_litmus.py b/tests/test_litmus.py index cce136ec..1cf9f4fa 100644 --- a/tests/test_litmus.py +++ b/tests/test_litmus.py @@ -104,7 +104,7 @@ def _report_missing_litmus(self, extra=""): raise unittest.SkipTest(f"Test requires litmus test suite{extra}") def test_litmus_with_authentication(self): - """Run litmus test suite on HTTP with authentification.""" + """Run litmus test suite on HTTP with authentication.""" with WsgiDavTestServer(with_auth=True, with_ssl=False): try: res = subprocess.call( @@ -117,7 +117,7 @@ def test_litmus_with_authentication(self): return def test_litmus_anonymous(self): - """Run litmus test suite on HTTP with authentification.""" + """Run litmus test suite on HTTP with authentication.""" with WsgiDavTestServer(with_auth=False, with_ssl=False): try: res = subprocess.call(["litmus", "http://127.0.0.1:8080/"]) @@ -128,7 +128,7 @@ def test_litmus_anonymous(self): return def test_litmus_with_ssl_and_authentication(self): - """Run litmus test suite on SSL / HTTPS with authentification.""" + """Run litmus test suite on SSL / HTTPS with authentication.""" with WsgiDavTestServer(with_auth=True, with_ssl=True): try: res = subprocess.call( diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 11c3acc7..6c7f0d49 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -53,7 +53,7 @@ def begin_write(self, *, content_type=None): # print("begin_write: {}".format(self.target_path)) queue = FileLikeQueue(max_size=1) - # Simulate an asynchrounous consumer. We use a file, so we can check + # Simulate an asynchronous consumer. We use a file, so we can check # the result from the parent unittest process. In real live this could be # requests.post(..., data=queue), ... def _consumer(): diff --git a/tests/test_util.py b/tests/test_util.py index 25b546d1..c3bb6080 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -232,7 +232,7 @@ def testDefault(self): # No output should be generated in the root logger assert rootOutput == "" # The library logger should default to INFO level - # (this output will not be visble, because the base logger only has a NullHandler) + # (this output will not be visible, because the base logger only has a NullHandler) assert ".debug" not in baseOutput assert ".info" in baseOutput assert ".warning" in baseOutput @@ -256,7 +256,7 @@ def testEnablePropagation(self): # Now output we should see output in the root logger assert rootOutput == baseOutput # The library logger should default to INFO level - # (this output will not be visble, because the base logger only has a NullHandler) + # (this output will not be visible, because the base logger only has a NullHandler) assert ".debug" not in baseOutput assert ".info" in baseOutput assert ".warning" in baseOutput diff --git a/wsgidav/dav_provider.py b/wsgidav/dav_provider.py index 6af6523b..4b2a2fe1 100644 --- a/wsgidav/dav_provider.py +++ b/wsgidav/dav_provider.py @@ -391,7 +391,7 @@ def get_ref_url(self): return quote(self.provider.share_path + self.get_preferred_path()) # def getRefKey(self): - # """Return an unambigous identifier string for a resource. + # """Return an unambiguous identifier string for a resource. # # Since it is always unique for one resource, is used as key for # the lock- and property storage dictionaries. @@ -830,7 +830,7 @@ def set_property_value(self, name, value, *, dry_run=False): raise DAVError(HTTP_FORBIDDEN) # Handle MS Windows Win32LastModifiedTime, if enabled. - # Note that the WebDAV client in Win7 and earler has issues and can't be used + # Note that the WebDAV client in Win7 and earlier has issues and can't be used # with this so we ignore older clients. Others pre-Win10 should be tested. if name.startswith("{urn:schemas-microsoft-com:}"): agent = self.environ.get("HTTP_USER_AGENT", "None") @@ -1100,7 +1100,7 @@ def copy_move_single(self, dest_path, *, is_move): - Live properties should be moved too (e.g. creationdate) - Non-collections must be moved, not copied - For collections, this function behaves like in copy-mode: - detination collection must be created and properties are copied. + destination collection must be created and properties are copied. Members are NOT created. The source collection MUST NOT be removed. diff --git a/wsgidav/default_conf.py b/wsgidav/default_conf.py index 016f84a1..889d7348 100644 --- a/wsgidav/default_conf.py +++ b/wsgidav/default_conf.py @@ -12,7 +12,7 @@ |__/|__/___/\_, /_/____/_/ |_|___/ /___/ -Default confguration. +Default configuration. """ # from wsgidav.mw.debug_filter import WsgiDavDebugFilter from wsgidav.dir_browser import WsgiDavDirBrowser diff --git a/wsgidav/fs_dav_provider.py b/wsgidav/fs_dav_provider.py index f263d858..ce1e4c15 100644 --- a/wsgidav/fs_dav_provider.py +++ b/wsgidav/fs_dav_provider.py @@ -375,7 +375,7 @@ def set_last_modified(self, dest_path, time_stamp, *, dry_run): # FilesystemProvider # ======================================================================== class FilesystemProvider(DAVProvider): - """Default implementation of a filessystem DAVProvider. + """Default implementation of a filesystem DAVProvider. Args: root_folder (str) diff --git a/wsgidav/lock_man/lock_manager.py b/wsgidav/lock_man/lock_manager.py index 25328eed..8a316bc1 100644 --- a/wsgidav/lock_man/lock_manager.py +++ b/wsgidav/lock_man/lock_manager.py @@ -476,7 +476,7 @@ def check_write_permission(self, *, url, depth, token_list, principal): for lock in lock_list: _logger.debug(" lock={}".format(lock_string(lock))) if u != url and lock["depth"] != "infinity": - # We only consider parents with Depth: inifinity + # We only consider parents with Depth: infinity continue elif principal == lock["principal"] and lock["token"] in token_list: # User owns this lock diff --git a/wsgidav/mw/debug_filter.py b/wsgidav/mw/debug_filter.py index aeda1fe0..a2179b84 100644 --- a/wsgidav/mw/debug_filter.py +++ b/wsgidav/mw/debug_filter.py @@ -38,7 +38,7 @@ Configured like:: - debug_methods = ["PROPPATCH", "PROPFIND", "GET", "HEAD", "DELET E", + debug_methods = ["PROPPATCH", "PROPFIND", "GET", "HEAD", "DELETE", "PUT", "COPY", "MOVE", "LOCK", "UNLOCK", ] diff --git a/wsgidav/prop_man/mongo_property_manager.py b/wsgidav/prop_man/mongo_property_manager.py index d450ca5d..3af65a82 100644 --- a/wsgidav/prop_man/mongo_property_manager.py +++ b/wsgidav/prop_man/mongo_property_manager.py @@ -36,7 +36,7 @@ HIDDEN_KEYS = ("_id", "_url", "_title") # MongiDB doesn't accept '.' in key names, so we have to escape it. -# Use a key that is unlikely to occur in proprty names +# Use a key that is unlikely to occur in property names DOT_ESCAPE = "^" diff --git a/wsgidav/server/ext_wsgiutils_server.py b/wsgidav/server/ext_wsgiutils_server.py index b2be75b3..d3e8e7f6 100644 --- a/wsgidav/server/ext_wsgiutils_server.py +++ b/wsgidav/server/ext_wsgiutils_server.py @@ -260,13 +260,13 @@ def wsgiWriteData(self, data): self.end_headers() self.wsgiSentHeaders = 1 # Send the data - assert type(data) is bytes # If not, Content-Length is propably wrong! + assert type(data) is bytes # If not, Content-Length is probably wrong! _logger.debug( "wsgiWriteData: write {} bytes: '{!r}'...".format( len(data), util.to_str(data[:50]) ) ) - if util.is_str(data): # If not, Content-Length is propably wrong! + if util.is_str(data): # If not, Content-Length is probably wrong! _logger.info("ext_wsgiutils_server: Got unicode data: {!r}".format(data)) # data = util.wsgi_to_bytes(data) data = util.to_bytes(data) diff --git a/wsgidav/stream_tools.py b/wsgidav/stream_tools.py index 231c87e3..ea36da78 100644 --- a/wsgidav/stream_tools.py +++ b/wsgidav/stream_tools.py @@ -67,7 +67,7 @@ def read(self, size=0): # Get next chunk, cumulating requested size as needed while res == b"" or size < 0 or (size > 0 and len(res) < size): try: - # Read pending data, blocking if neccessary + # Read pending data, blocking if necessary # (but handle the case that close() is called while waiting) res += self.queue.get(True, 0.1) except queue.Empty: @@ -128,7 +128,7 @@ class StreamingFile: """A file object wrapped around an iterator / data stream.""" def __init__(self, data_stream): - """Intialise the object with the data stream.""" + """Initialise the object with the data stream.""" self.data_stream = data_stream self.buffer = "" diff --git a/wsgidav/util.py b/wsgidav/util.py index 88d6ce53..174fe025 100644 --- a/wsgidav/util.py +++ b/wsgidav/util.py @@ -390,7 +390,7 @@ def init_logging(config): The base logger is filtered by the `verbose` configuration option. Log entries will have a time stamp and thread id. - **Note:** init_logging() is automatically calle if an application adds + **Note:** init_logging() is automatically called if an application adds ``"logging": { "enable": true }`` to the configuration. Module loggers