Skip to content

Commit

Permalink
Switch to ruff; bump requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
sumpfork committed Aug 18, 2024
1 parent b8fb136 commit 8e1f271
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 72 deletions.
25 changes: 9 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,20 @@ default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: black
# Run the linter.
- id: ruff
args:
- --fix
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --indent=4]
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [--max-line-length=120, "--ignore=E203,W503"]
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
53 changes: 25 additions & 28 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
# pip-compile --extra=dev --no-emit-index-url --output-file=dev-requirements.txt
#
backports-tarfile==1.1.1
backports-tarfile==1.2.0
# via jaraco-context
build==1.2.1
# via domdiv (pyproject.toml)
certifi==2024.2.2
certifi==2024.7.4
# via requests
cfgv==3.4.0
# via pre-commit
Expand All @@ -26,15 +26,15 @@ docutils==0.21.2
# via readme-renderer
doit==0.36.0
# via domdiv (pyproject.toml)
exceptiongroup==1.2.1
exceptiongroup==1.2.2
# via pytest
filelock==3.14.0
filelock==3.15.4
# via virtualenv
identify==2.5.36
identify==2.6.0
# via pre-commit
idna==3.7
# via requests
importlib-metadata==7.1.0
importlib-metadata==8.2.0
# via
# build
# doit
Expand All @@ -46,55 +46,55 @@ jaraco-classes==3.4.0
# via keyring
jaraco-context==5.3.0
# via keyring
jaraco-functools==4.0.1
jaraco-functools==4.0.2
# via keyring
keyring==25.2.0
keyring==25.3.0
# via twine
loguru==0.7.2
# via domdiv (pyproject.toml)
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.2.0
more-itertools==10.4.0
# via
# jaraco-classes
# jaraco-functools
nh3==0.2.17
nh3==0.2.18
# via readme-renderer
nodeenv==1.8.0
nodeenv==1.9.1
# via pre-commit
packaging==24.0
packaging==24.1
# via
# build
# pytest
pillow==10.3.0
pillow==10.4.0
# via
# domdiv (pyproject.toml)
# reportlab
pkginfo==1.10.0
# via twine
platformdirs==4.2.1
platformdirs==4.2.2
# via virtualenv
pluggy==1.5.0
# via pytest
pre-commit==3.7.0
pre-commit==3.8.0
# via domdiv (pyproject.toml)
pygments==2.17.2
pygments==2.18.0
# via
# readme-renderer
# rich
pyproject-hooks==1.1.0
# via build
pytest==8.2.0
pytest==8.3.2
# via domdiv (pyproject.toml)
pyyaml==6.0.1
pyyaml==6.0.2
# via pre-commit
readme-renderer==43.0
readme-renderer==44.0
# via twine
reportlab==4.2.0
reportlab==4.2.2
# via domdiv (pyproject.toml)
requests==2.31.0
requests==2.32.3
# via
# requests-toolbelt
# twine
Expand All @@ -108,16 +108,13 @@ tomli==2.0.1
# via
# build
# pytest
twine==5.0.0
twine==5.1.1
# via domdiv (pyproject.toml)
urllib3==2.2.1
urllib3==2.2.2
# via
# requests
# twine
virtualenv==20.26.1
virtualenv==20.26.3
# via pre-commit
zipp==3.18.1
zipp==3.20.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ domdiv_dedupe_cards = "domdiv.tools.cleanup_language_dupes:main"
[tool.setuptools_scm]
# doing this break CI as the version file gets written when just `get_version` is called
# version_file = "src/domdiv/_version.py"

[tool.ruff.lint]
select = ["I"]
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ configargparse==1.7
# via domdiv (pyproject.toml)
loguru==0.7.2
# via domdiv (pyproject.toml)
pillow==10.3.0
pillow==10.4.0
# via
# domdiv (pyproject.toml)
# reportlab
reportlab==4.2.0
reportlab==4.2.2
# via domdiv (pyproject.toml)
12 changes: 7 additions & 5 deletions src/domdiv/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ def __init__(self, canvas, x=0, y=0, cropmarkLength=-1, cropmarkSpacing=-1):
self.NO_LINE,
self.DOT,
self.DEBUG,
) = range(
1, 9
) # Constants
) = range(1, 9) # Constants
if cropmarkLength < 0:
cropmarkLength = 0.2
if cropmarkSpacing < 0:
Expand Down Expand Up @@ -852,7 +850,9 @@ def drawPanelOutline(
line = (
plotter.LINE
if lineType.lower() == "line"
else plotter.DOT if lineType.lower() == "dot" else NO_LINE
else plotter.DOT
if lineType.lower() == "dot"
else NO_LINE
)
# lines ending at a midpoint (no dots)
midline = NO_LINE if line == plotter.DOT else line
Expand Down Expand Up @@ -1076,7 +1076,9 @@ def tabHeight(panelStyle, panelHeight):
return (
panelHeight
if panelStyle in ["tab", "strap"]
else item.tabHeight if panelStyle == "folder" else 0.0
else item.tabHeight
if panelStyle == "folder"
else 0.0
)

headTabHeight = tabHeight(self.options.head, headHeight)
Expand Down
38 changes: 17 additions & 21 deletions src/domdiv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def by_cost_sort_key(self, card):
)

def get_card_name_sort_key(self, c):
if (
self.collator
): # If the PyICU collator attribute has been set up, get the collator based sort key
if self.collator: # If the PyICU collator attribute has been set up, get the collator based sort key
return self.collator.getSortKey(c)
else: # Default method: strip the card name character accents
return self.strip_accents(c)
Expand Down Expand Up @@ -338,21 +336,21 @@ def filter_sort_cards(cards, options):
if card.group_top:
# this is a designated card to represent the group, so update important data
group_cards[(card.group_tag, card.cardset_tag)].cost = card.cost
group_cards[(card.group_tag, card.cardset_tag)].potcost = (
card.potcost
)
group_cards[(card.group_tag, card.cardset_tag)].debtcost = (
card.debtcost
)
group_cards[(card.group_tag, card.cardset_tag)].types = (
card.types
)
group_cards[(card.group_tag, card.cardset_tag)].randomizer = (
card.randomizer
)
group_cards[(card.group_tag, card.cardset_tag)].image = (
card.image
)
group_cards[
(card.group_tag, card.cardset_tag)
].potcost = card.potcost
group_cards[
(card.group_tag, card.cardset_tag)
].debtcost = card.debtcost
group_cards[
(card.group_tag, card.cardset_tag)
].types = card.types
group_cards[
(card.group_tag, card.cardset_tag)
].randomizer = card.randomizer
group_cards[
(card.group_tag, card.cardset_tag)
].image = card.image

group_cards[(card.group_tag, card.cardset_tag)].addCardCount(
card.count
Expand Down Expand Up @@ -394,9 +392,7 @@ def filter_sort_cards(cards, options):

# Split out Official and Fan set information
Official_sets = set() # Will hold official sets
Official_search = (
[]
) # Will hold official sets for searching, both set key and set_name
Official_search = [] # Will hold official sets for searching, both set key and set_name
Fan_sets = set() # Will hold fan sets
Fan_search = [] # Will hold fan sets for searching, both set key and set_name
wantedSets = set() # Will hold all the sets requested for printing
Expand Down

0 comments on commit 8e1f271

Please sign in to comment.