Skip to content

Commit

Permalink
precommit: add typos check & fixing some (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Feb 2, 2024
1 parent 37e484b commit 3dbc43f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ repos:
- id: check-added-large-files
- id: detect-private-key

# todo: another great hook
# - repo: https://github.com/crate-ci/typos
# rev: v1.16.26
# hooks:
# - id: typos
# # empty to do not write fixes
# args: []
# exclude: pyproject.toml
- repo: https://github.com/crate-ci/typos
rev: v1.16.26
hooks:
- id: typos
# empty to do not write fixes
args: []
exclude: versioneer.py

# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.5
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Persistent, stale-free, local and cross-machine caching for Python functions.
@cachier(stale_after=datetime.timedelta(days=3))
def foo(arg1, arg2):
"""foo now has a persistent cache, trigerring recalculation for values stored more than 3 days."""
"""foo now has a persistent cache, triggering recalculation for values stored more than 3 days."""
return {'arg1': arg1, 'arg2': arg2}
Expand Down Expand Up @@ -150,7 +150,7 @@ The current defaults can be fetched by calling `get_default_params`.
Threads Limit
~~~~~~~~~~~~~

To limit the number of threads Cachier is allowed to spawn, set the ``CACHIER_MAX_WORKERS`` with the desired number. The defeault is 8, so to enable Cachier to spawn even more threads, you'll have to set a higher limit explicitly.
To limit the number of threads Cachier is allowed to spawn, set the ``CACHIER_MAX_WORKERS`` with the desired number. The default is 8, so to enable Cachier to spawn even more threads, you'll have to set a higher limit explicitly.


Global Enable/Disable
Expand Down Expand Up @@ -406,7 +406,7 @@ Running MongoDB tests against a live MongoDB instance

**Note to developers:** By default, all MongoDB tests are run against a mocked MongoDB instance, provided by the ``pymongo_inmemory`` package. To run them against a live MongoDB instance, the ``CACHIER_TEST_VS_LIVE_MONGO`` environment variable is set to ``True`` in the ``test`` environment of this repository (and additional environment variables are populated with the appropriate credentials), used by the GitHub Action running tests on every commit and pull request.

Contributers are not expected to run these tests against a live MongoDB instance when developing, as credentials for the testing instance used will NOT be shared, but rather use the testing against the in-memory MongoDB instance as a good proxy.
Contributors are not expected to run these tests against a live MongoDB instance when developing, as credentials for the testing instance used will NOT be shared, but rather use the testing against the in-memory MongoDB instance as a good proxy.

**HOWEVER, the tests run against a live MongoDB instance when you submit a PR are the determining tests for deciding whether your code functions correctly against MongoDB.**

Expand Down
2 changes: 1 addition & 1 deletion cachier/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
# TAG-NUM-gHEX
mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
if not mo:
# unparseable. Maybe git-describe is misbehaving?
# unparsable. Maybe git-describe is misbehaving?
pieces["error"] = ("unable to parse git-describe output: '%s'"
% describe_out)
return pieces
Expand Down
4 changes: 2 additions & 2 deletions cachier/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, hash_func, default_params):

def set_func(self, func):
"""Sets the function this core will use. This has to be set before any
method is called. Also determine if the funtion is an object method."""
method is called. Also determine if the function is an object method."""
func_params = list(inspect.signature(func).parameters)
self.func_is_method = func_params and func_params[0] == 'self'
self.func = func
Expand All @@ -48,7 +48,7 @@ def precache_value(self, args, kwds, value_to_cache):
return value_to_cache

def check_calc_timeout(self, time_spent):
"""Raise an exception if a recalulation is needed."""
"""Raise an exception if a recalculation is needed."""
if self.wait_for_calc_timeout is not None:
calc_timeout = self.wait_for_calc_timeout
else:
Expand Down
6 changes: 3 additions & 3 deletions cachier/pickle_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

# Altenative: https://github.com/WoLpH/portalocker
# Alternative: https://github.com/WoLpH/portalocker

from .base_core import _BaseCore

Expand Down Expand Up @@ -58,11 +58,11 @@ def _check_calculation(self):
# print(entry)
try:
if not entry['being_calculated']:
# print('stoping observer!')
# print('stopping observer!')
self.value = entry['value']
self.observer.stop()
# else:
# print('NOT stoping observer... :(')
# print('NOT stopping observer... :(')
except TypeError:
self.value = None
self.observer.stop()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pickle_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _helper_bad_cache_file(sleeptime, separate_files):
return True


# we want this to succeed at leat once
# we want this to succeed at least once
@pytest.mark.pickle
@pytest.mark.xfail
@pytest.mark.parametrize('separate_files', [True, False])
Expand Down

0 comments on commit 3dbc43f

Please sign in to comment.