diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9faaf25d..0ff7a270 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,6 +77,7 @@ jobs: path: "htmlcov" - name: "Make badge" + if: github.ref == 'refs/heads/main' uses: "schneegans/dynamic-badges-action@v1.4.0" with: # GIST_TOKEN is a GitHub personal access token with scope "gist". diff --git a/HISTORY.md b/HISTORY.md index e0baf91c..4e9d5770 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,6 +12,8 @@ - Improve the implementation of `cattrs._compat.is_typeddict`. The implementation is now simpler, and relies on fewer private implementation details from `typing` and typing_extensions. ([#384](https://github.com/python-attrs/cattrs/pull/384)) - Improve handling of TypedDicts with forward references. +- Speed up generated _attrs_ and TypedDict structuring functions by changing their signature slightly. + ([#388](https://github.com/python-attrs/cattrs/pull/388)) ## 23.1.2 (2023-06-02) @@ -19,7 +21,8 @@ ## 23.1.1 (2023-05-30) -- Add `typing_extensions` as a direct dependency on 3.10. ([#369](https://github.com/python-attrs/cattrs/issues/369) [#370](https://github.com/python-attrs/cattrs/pull/370)) +- Add `typing_extensions` as a direct dependency on 3.10. + ([#369](https://github.com/python-attrs/cattrs/issues/369) [#370](https://github.com/python-attrs/cattrs/pull/370)) ## 23.1.0 (2023-05-30) diff --git a/src/cattrs/gen/__init__.py b/src/cattrs/gen/__init__.py index 279934b0..8e3dc29d 100644 --- a/src/cattrs/gen/__init__.py +++ b/src/cattrs/gen/__init__.py @@ -470,7 +470,7 @@ def make_dict_structure_fn( globs[k] = v total_lines = [ - f"def {fn_name}(o, _, *, {internal_arg_line}):", + f"def {fn_name}(o, _, {internal_arg_line}):", *lines, *post_lines, *instantiation_lines, diff --git a/src/cattrs/gen/typeddicts.py b/src/cattrs/gen/typeddicts.py index 6b794397..cbbc4bdc 100644 --- a/src/cattrs/gen/typeddicts.py +++ b/src/cattrs/gen/typeddicts.py @@ -504,7 +504,7 @@ def make_dict_structure_fn( globs[k] = v total_lines = [ - f"def {fn_name}(o, _, *, {internal_arg_line}):", + f"def {fn_name}(o, _, {internal_arg_line}):", *lines, *post_lines, " return res",