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
5 changes: 2 additions & 3 deletions .github/workflows/conda_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ on:
push:
branches: ["master"]

permissions:
contents: read

jobs:
tests:
name: "Conda"
permissions:
contents: read
runs-on: ubuntu-22.04
defaults:
run:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/docs_test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ on:
- 'imgbot'
pull_request:

permissions:
contents: read

jobs:
docs:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ on:
- 'imgbot'
pull_request:

permissions:
contents: read

jobs:
Run:
name: "Flake8"
permissions:
contents: read
runs-on: "ubuntu-22.04"

steps:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ on:
- 'imgbot'
pull_request:

permissions:
contents: read

jobs:
Run:
permissions:
contents: read
name: "mypy / ${{ matrix.os }}"
runs-on: ${{ matrix.os }}

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/octocheese.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
schedule:
- cron: 0 12 * * *

permissions:
contents: write

jobs:
Run:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: domdfcoding/octocheese@master
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/python_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ on:

pull_request:

permissions:
actions: write
issues: write
contents: read

jobs:
tests:
permissions:
actions: write
contents: read
name: "windows-2022 / Python ${{ matrix.config.python-version }}"
runs-on: "windows-2022"
continue-on-error: ${{ matrix.config.experimental }}
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/python_ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ on:
- '*'
pull_request:

permissions:
actions: write
issues: write
contents: read

jobs:
tests:
permissions:
actions: write
contents: read
name: "ubuntu-22.04 / Python ${{ matrix.config.python-version }}"
runs-on: "ubuntu-22.04"
continue-on-error: ${{ matrix.config.experimental }}
Expand Down Expand Up @@ -85,6 +83,9 @@ jobs:

Coverage:
needs: tests
permissions:
actions: write
contents: read
runs-on: "ubuntu-22.04"
steps:
- name: Checkout 🛎️
Expand Down Expand Up @@ -134,7 +135,10 @@ jobs:

Deploy:
needs: tests

permissions:
actions: write
issues: write
contents: read
runs-on: "ubuntu-22.04"
steps:
- name: Checkout 🛎️
Expand Down Expand Up @@ -179,6 +183,8 @@ jobs:

Conda:
needs: deploy
permissions:
contents: read
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/') || (startsWith(github.event.head_commit.message, 'Bump version') != true)
steps:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/python_ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ on:

pull_request:

permissions:
actions: write
issues: write
contents: read

jobs:
tests:
permissions:
actions: write
contents: read
name: "macos-${{ matrix.config.os-ver }} / Python ${{ matrix.config.python-version }}"
runs-on: "macos-${{ matrix.config.os-ver }}"
continue-on-error: ${{ matrix.config.experimental }}
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ repos:
- id: check-added-large-files
- id: check-ast
- id: fix-byte-order-marker
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
Expand Down Expand Up @@ -81,13 +80,15 @@ repos:
- id: snippet-fmt

- repo: https://github.com/python-formate/formate
rev: v0.8.0
rev: v0.9.0
hooks:
- id: formate
exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$
additional_dependencies:
- formate-trailing-commas>=0.1.1

- repo: https://github.com/python-coincidence/dep_checker
rev: v0.8.0
rev: v0.9.0
hooks:
- id: dep_checker
args:
Expand Down
2 changes: 1 addition & 1 deletion .style.yapf
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ split_before_dict_set_generator=True
#
# foo = ('This is a really long string: {}, {}, {}, {}'
# .format(a, b, c, d))
split_before_dot=False
split_before_dot=True

# Split after the opening paren which surrounds an expression if it doesn't
# fit on a single line.
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ Cawdrey
:target: https://github.com/domdfcoding/cawdrey/commit/master
:alt: GitHub last commit

.. |maintained| image:: https://img.shields.io/maintenance/yes/2025
.. |maintained| image:: https://img.shields.io/maintenance/yes/2026
:alt: Maintenance

.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/cawdrey
:target: https://pypi.org/project/cawdrey/
:target: https://pypistats.org/packages/cawdrey
:alt: PyPI - Downloads

.. end shields
Expand Down
24 changes: 12 additions & 12 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def getUuid():
"setup": "key = getUuid(); get = x.get",
"iterations": 13000000,
"name": "d.get(key)",
**size_unaffected
**size_unaffected,
},
{
"code": "x['12323f29-c31f-478c-9b15-e7acc5354df9']",
**skip_setup,
**x10000000,
"name": "d[key]",
**size_unaffected
**size_unaffected,
},
{"code": "key in x", **setup_getuid, **x10000000, "name": "key in d", **size_unaffected},
{"code": "key not in x", **setup_getuid, **x20000000, "name": "key not in d", **size_unaffected},
Expand All @@ -75,50 +75,50 @@ def getUuid():
"setup": "keys = x.keys",
**x100000,
"name": "d.keys()",
**size_affected
**size_affected,
},
{
"code": "for _ in values(): pass",
"setup": "values = x.values",
**x100000,
"name": "d.values()",
**size_affected
**size_affected,
},
{
"code": "for _ in items(): pass",
"setup": "items = x.items",
"iterations": 50000,
"name": "d.items()",
**size_affected
**size_affected,
},
{"code": "for _ in iter(x): pass", **skip_setup, **x100000, "name": "iter(d)", **size_affected},
{
"code": "klass(d)",
"setup": "klass = type(x)",
"iterations": 10000,
"name": "constructor(dict)",
**size_affected
**size_affected,
},
{
"code": "klass(v)",
"setup": "klass = type(x); v = tuple(d.items())",
"iterations": 10000,
"name": "constructor(d.items())",
**size_affected
**size_affected,
},
{
"code": "klass(**d)",
"setup": "klass = type(x)",
"iterations": 5000,
"name": "constructor(**d)",
**size_affected
**size_affected,
},
{
"code": "klass(x)",
"setup": "klass = type(x)",
"iterations": 50000,
"name": "constructor(self)",
**size_affected
**size_affected,
},
{"code": "x == d", **skip_setup, **x100000, "name": "d1 == d2", **size_affected},
{"code": "x == x", **skip_setup, **x100000, "name": "self == self", **size_affected},
Expand Down Expand Up @@ -154,10 +154,10 @@ def getUuid():
stmt=statement["code"],
setup=statement["setup"],
globals={'x': x, "getUuid": getUuid, 'd': d},
number=iterations
number=iterations,
)

print(
"Dictionary size: {: >4}; Type: {: >10}; Statement: {: <25} time: {:.3f}; iterations: {: >8}".
format(n, type(x).__name__, "`{}`;".format(statement["name"]), t, iterations)
"Dictionary size: {: >4}; Type: {: >10}; Statement: {: <25} time: {:.3f}; iterations: {: >8}"
.format(n, type(x).__name__, "`{}`;".format(statement["name"]), t, iterations),
)
2 changes: 1 addition & 1 deletion doc-source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Cawdrey
:last-commit:
:alt: GitHub last commit

.. |maintained| maintained-shield:: 2025
.. |maintained| maintained-shield:: 2026
:alt: Maintenance

.. |pypi-downloads| pypi-shield::
Expand Down
22 changes: 6 additions & 16 deletions formate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ priority = 30
[hooks.yapf.kwargs]
yapf_style = ".style.yapf"

[hooks.trailing_commas]
priority = 21

[hooks.trailing_commas.kwargs]
format_ImportFrom = false

[hooks.isort]
priority = 50

Expand All @@ -27,22 +33,6 @@ lines_between_types = 0
use_parentheses = true
remove_redundant_aliases = true
default_section = "THIRDPARTY"
known_third_party = [
"coincidence",
"coverage",
"coverage_pyver_pragma",
"domdf_python_tools",
"github",
"immutables",
"importlib_metadata",
"pytest",
"pytest_cov",
"pytest_randomly",
"pytest_rerunfailures",
"pytest_timeout",
"requests",
"typing_extensions",
]
known_first_party = [ "cawdrey",]

[config]
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ incomplete-defs:
tox -e lint -- --select MAN

commas:
tox -e lint -- --select C812,C813,C814,C815,C816
tox -e lint -- --select C810,C812,C813,C814,C815,C816

vdiff:
git diff $(repo-helper show version -q)..HEAD
Expand Down
Loading
Loading