Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ repos:
args: []
exclude: versioneer.py

# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# additional_dependencies: [tomli]
# args: ["--in-place"]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: ["--in-place"]

# - repo: https://github.com/psf/black-pre-commit-mirror
# rev: 24.1.1
Expand Down
1 change: 0 additions & 1 deletion cachier/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

# This file is released into the public domain. Generated by
# versioneer-0.16 (https://github.com/warner/python-versioneer)

"""Git implementation of _version.py."""

import errno
Expand Down
11 changes: 7 additions & 4 deletions cachier/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ def __init__(self, hash_func, default_params):
self.hash_func = hash_func

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 function is an object method."""
"""Sets the function this core will use.

This has to be set before any 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 Down Expand Up @@ -58,8 +61,8 @@ def check_calc_timeout(self, time_spent):

@abc.abstractmethod
def get_entry_by_key(self, key):
"""Returns the result mapped to the given key in this core's cache,
if such a mapping exists."""
"""Returns the result mapped to the given key in this core's cache, if
such a mapping exists."""

@abc.abstractmethod
def set_entry(self, key, func_res):
Expand Down
5 changes: 3 additions & 2 deletions cachier/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ def set_default_params(**params):
any values set by this function.

Only 'stale_after', 'next_time', and 'wait_for_calc_timeout' can be
changed after the memoization decorator has been applied. Other parameters
will only have an effect on decorators applied after this function is run.
changed after the memoization decorator has been applied. Other
parameters will only have an effect on decorators applied after this
function is run.
"""
valid_params = (p for p in params.items() if p[0] in _default_params)
_default_params.update(valid_params)
Expand Down
2 changes: 1 addition & 1 deletion tests/speed_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _test_int_pickling_compare(int_1, int_2):


def test_pickle_speed():
"""Test speeds"""
"""Test speeds."""
print("Comparing speeds of decorated vs non-decorated functions...")
num_of_vals = 1000
times = []
Expand Down
8 changes: 4 additions & 4 deletions tests/test_core_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_get_default_params():


def test_bad_name():
"""Test that the appropriate exception is thrown when an invalid backend
is given."""
"""Test that the appropriate exception is thrown when an invalid backend is
given."""

name = 'nope'
try:
Expand All @@ -37,8 +37,8 @@ def func():


def test_missing_mongetter():
"""Test that the appropriate exception is thrown when forgetting to
specify the mongetter."""
"""Test that the appropriate exception is thrown when forgetting to specify
the mongetter."""
try:
@cachier(backend='mongo', mongetter=None)
def func():
Expand Down
1 change: 0 additions & 1 deletion tests/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def _calls_wait_for_calc_timeout_slow(res_queue):
res_queue.put(res)

cachier.set_default_params(wait_for_calc_timeout=2)

"""Testing for calls timing out to be performed twice when needed."""
_wait_for_calc_timeout_slow.clear_cache()
res_queue = queue.Queue()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mongo_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def mock_get_entry_2(self, args, kwargs): # skipcq: PYL-W0613

@cachier(mongetter=_test_mongetter, stale_after=stale_after)
def _stalled_func_2():
"""Testing stalled function"""
"""Testing stalled function."""
return 2

res = _stalled_func_2()
Expand All @@ -305,7 +305,7 @@ def _stalled_func_2():
@cachier(mongetter=_test_mongetter,
stale_after=stale_after, next_time=True)
def _stalled_func_3():
"""Testing stalled function"""
"""Testing stalled function."""
return 3

res = _stalled_func_3()
Expand Down
5 changes: 2 additions & 3 deletions versioneer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

# Version: 0.16

"""The Versioneer - like a rocketeer, but for versions.

The Versioneer
Expand Down Expand Up @@ -1128,8 +1127,8 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
def do_vcs_install(manifest_in, versionfile_source, ipy):
"""Git-specific installation logic for Versioneer.

For Git, this means creating/changing .gitattributes to mark _version.py
for export-time keyword substitution.
For Git, this means creating/changing .gitattributes to mark
_version.py for export-time keyword substitution.
"""
GITS = ["git"]
if sys.platform == "win32":
Expand Down