Skip to content

Commit 1e3a1e4

Browse files
committed
Updated config files.
1 parent 61221af commit 1e3a1e4

File tree

7 files changed

+44
-4
lines changed

7 files changed

+44
-4
lines changed

.github/workflows/octocheese.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ jobs:
1616
pypi_name: "domdf_python_tools"
1717
env:
1818
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
19+
if: startsWith(github.ref, 'refs/tags/') != true

.isort.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ known_third_party =
2323
github
2424
importlib_metadata
2525
importlib_resources
26+
natsort
2627
packaging
2728
pandas
2829
pydash

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ repos:
4444
rev: v1.7.0
4545
hooks:
4646
- id: python-no-eval
47+
- id: rst-backticks
48+
- id: rst-directive-colons
49+
- id: rst-inline-touching-normal
4750

4851
- repo: https://github.com/asottile/pyupgrade
4952
rev: v2.7.4

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ domdf_python_tools
2828
- |license| |language| |requires| |pre_commit|
2929

3030
.. |docs| image:: https://img.shields.io/readthedocs/domdf_python_tools/latest?logo=read-the-docs
31-
:target: https://domdf_python_tools.readthedocs.io/en/latest/?badge=latest
31+
:target: https://domdf_python_tools.readthedocs.io/en/latest
3232
:alt: Documentation Build Status
3333

3434
.. |docs_check| image:: https://github.com/domdfcoding/domdf_python_tools/workflows/Docs%20Check/badge.svg

doc-source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
templates_path = ["_templates"]
6262
html_static_path = ["_static"]
6363
source_suffix = ".rst"
64-
exclude_patterns = []
65-
6664
master_doc = "index"
6765
suppress_warnings = ["image.nonlocal_uri"]
6866
pygments_style = "default"

mutdef.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from functools import wraps
2+
from types import FunctionType
3+
from typing import Callable, List, NamedTuple
4+
5+
6+
class Factory(NamedTuple):
7+
func: Callable
8+
9+
def __call__(self):
10+
return self.func()
11+
12+
def __repr__(self) -> str:
13+
return f"{type(self).__name__}({self.func!r})"
14+
15+
16+
def mutdef(func: FunctionType) -> Callable:
17+
18+
@wraps(func)
19+
def wrapper(*args, **kwargs):
20+
print(func.__defaults__)
21+
defaults = func.__defaults__ or ()
22+
func.__defaults__ = tuple(d() if isinstance(d, Factory) else d for d in defaults)
23+
24+
return func(*args, **kwargs)
25+
26+
return wrapper
27+
28+
29+
@mutdef # type: ignore
30+
def foo(name: str, occupations: List[str] = Factory(list)):
31+
print(f"name={name}")
32+
print(f"occupations={occupations}")
33+
34+
35+
if __name__ == '__main__':
36+
foo("Wendy")
37+
foo("Bob", ["Builder"])

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ long_description_content_type = text/x-rst
1717
platforms = Windows, macOS, Linux
1818
url = https://github.com/domdfcoding/domdf_python_tools
1919
project_urls =
20-
Documentation = https://domdf_python_tools.readthedocs.io
20+
Documentation = https://domdf_python_tools.readthedocs.io/en/latest
2121
Issue_Tracker = https://github.com/domdfcoding/domdf_python_tools/issues
2222
Source_Code = https://github.com/domdfcoding/domdf_python_tools
2323
classifiers =

0 commit comments

Comments
 (0)