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/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: 11 additions & 7 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 @@ -82,6 +80,9 @@ jobs:

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

Deploy:
needs: tests

permissions:
actions: write
issues: write
contents: read
runs-on: "ubuntu-22.04"
steps:
- name: Checkout 🛎️
Expand Down Expand Up @@ -162,7 +166,7 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
skip-existing: true

- name: Close milestone 🚪
if: startsWith(github.ref, 'refs/tags/')
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ docs/_build/
doc/build
target/
.ipynb_checkpoints
.python-version
celerybeat-schedule
celerybeat.pid
*.sage.py
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ The pertinent changes from Python 3.6 to Python 3.9 are:
:target: https://github.com/domdfcoding/pprint36/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/pprint36
:target: https://pypi.org/project/pprint36/
:target: https://pypistats.org/packages/pprint36
:alt: PyPI - Downloads

.. end shields
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ unused-imports:
incomplete-defs:
tox -e lint -- --select MAN

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

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

Expand Down
13 changes: 11 additions & 2 deletions pprint36/_pprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@
def pprint(object, stream=None, indent=1, width=80, depth=None, *, compact=False, sort_dicts=True):
"""Pretty-print a Python object to a stream [default is sys.stdout]."""
printer = PrettyPrinter(
stream=stream, indent=indent, width=width, depth=depth, compact=compact, sort_dicts=sort_dicts
stream=stream,
indent=indent,
width=width,
depth=depth,
compact=compact,
sort_dicts=sort_dicts,
)
printer.pprint(object)


def pformat(object, indent=1, width=80, depth=None, *, compact=False, sort_dicts=True):
"""Format a Python object into a pretty-printed representation."""
return PrettyPrinter(
indent=indent, width=width, depth=depth, compact=compact, sort_dicts=sort_dicts
indent=indent,
width=width,
depth=depth,
compact=compact,
sort_dicts=sort_dicts,
).pformat(object)


Expand Down
4 changes: 2 additions & 2 deletions tests/_test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@
def test_pickling(self):
for i in range(pickle.HIGHEST_PROTOCOL + 1):
p = pickle.dumps(self.s, i)
dup = pickle.loads(p)

Check warning on line 246 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L246

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
self.assertEqual(self.s, dup, f"{self.s} != {dup}")
if type(self.s) not in (set, frozenset):
self.s.x = 10
p = pickle.dumps(self.s, i)
dup = pickle.loads(p)

Check warning on line 251 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L251

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
self.assertEqual(self.s.x, dup.x)

def test_iterator_pickling(self):
Expand All @@ -256,20 +256,20 @@
itorg = iter(self.s)
data = self.thetype(self.s)
d = pickle.dumps(itorg, proto)
it = pickle.loads(d)

Check warning on line 259 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L259

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
# Set iterators unpickle as list iterators due to the
# undefined order of set items.
# self.assertEqual(type(itorg), type(it))
self.assertIsInstance(it, collections.abc.Iterator)
self.assertEqual(self.thetype(it), data)

it = pickle.loads(d)

Check warning on line 266 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L266

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
try:
drop = next(it)
except StopIteration:
continue
d = pickle.dumps(it, proto)
it = pickle.loads(d)

Check warning on line 272 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L272

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
self.assertEqual(self.thetype(it), data - self.thetype((drop, )))

def test_deepcopy(self):
Expand Down Expand Up @@ -726,7 +726,7 @@
frozenset(range(0)),
frozenset(frozenset()),
frozenset(f),
f
f,
]
# All of the empty frozensets should have just one id()
self.assertEqual(len(set(map(id, efs))), 1)
Expand Down Expand Up @@ -836,7 +836,7 @@
f,
F,
Frozenset(f),
Frozenset(F)
Frozenset(F),
]
# All empty frozenset subclass instances should have different ids
self.assertEqual(len(set(map(id, efs))), len(efs))
Expand Down Expand Up @@ -954,7 +954,7 @@
def test_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
p = pickle.dumps(self.set, proto)
copy = pickle.loads(p)

Check warning on line 957 in tests/_test_set.py

View check run for this annotation

codefactor.io / CodeFactor

tests/_test_set.py#L957

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
self.assertEqual(self.set, copy, f"{self.set} != {copy}")

def test_issue_37219(self):
Expand Down
Loading
Loading