Skip to content
Open
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
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: detect-private-key
Expand All @@ -24,34 +24,34 @@ repos:
- --markdown-linebreak-ext=md

- repo: https://github.com/MarcoGorelli/auto-walrus
rev: v0.2.2
rev: 0.4.1
hooks:
- id: auto-walrus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
rev: v0.15.12
hooks:
- id: ruff # See pyproject.toml for args
# args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/psf/black
rev: 24.2.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
hooks:
- id: black # See pyproject.toml for args

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.4.2
hooks:
- id: codespell # See pyproject.toml for args
additional_dependencies:
- tomli

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: v2.21.1
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.25
hooks:
- id: validate-pyproject
8 changes: 4 additions & 4 deletions BWBImportBot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

"""
__init__.py
~~~~~~~~~~~
:copyright: (c) 2020 by Internet Archive.
:license: AGPL v3
__init__.py
~~~~~~~~~~~
:copyright: (c) 2020 by Internet Archive.
:license: AGPL v3
"""

__title__ = "bwbimportbot"
Expand Down
8 changes: 4 additions & 4 deletions ia-bulkmarc-bot/bulk-import.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3

"""
Iterates over an archive.org bulk MARC item, such as OpenLibraries-Trent-MARCs,
and imports all records in all of its MARC files to Open Library.
Iterates over an archive.org bulk MARC item, such as OpenLibraries-Trent-MARCs,
and imports all records in all of its MARC files to Open Library.

USAGE: ./bulk-import.py <archive.org item id>
USAGE: ./bulk-import.py <archive.org item id>

Logs results to STDOUT
Logs results to STDOUT
"""

import argparse
Expand Down
2 changes: 1 addition & 1 deletion old-onix-bot/onix.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def startElementNS(self, name, qname, attrs):
self.subhandler.startElementNS(name, qname, attrs)
self.subdepth += 1
else:
(uri, localname) = name
uri, localname = name
if localname == "product":
self.subhandler = xmltramp.Seeder(self.parser)
self.subhandler.startElementNS(name, qname, attrs)
Expand Down
4 changes: 2 additions & 2 deletions old-onix-bot/sax_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def startElementNS(self, name, qname, attrs):
if self.ignoring:
self.ignoring += 1
else:
(uri, localname) = name
uri, localname = name
c_maker = self.collector_table.get(localname) or self.collector_table.get(
collector_any
)
Expand Down Expand Up @@ -180,7 +180,7 @@ def __init__(self, collector_table):
self.values = {}

def collect(self, key_value):
(key, value) = key_value
key, value = key_value
if self.values.get(key):
raise Exception(f"dictionary key '{key}' is already mapped")
else:
Expand Down
2 changes: 1 addition & 1 deletion old-onix-bot/thread_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def re_raise(self):


def ForeignException_extract():
(exc_type, exc_value, exc_traceback) = sys.exc_info()
exc_type, exc_value, exc_traceback = sys.exc_info()
return ForeignException(exc_type, exc_value, exc_traceback)


Expand Down
2 changes: 1 addition & 1 deletion old-onix-bot/urlcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_entries(self):

def get(self, url):
url = url.strip()
(entries, next, index) = self.get_entries()
entries, next, index = self.get_entries()
id = entries.get(url)
if id is None:
# with index locked, add an entry for this url and
Expand Down
6 changes: 2 additions & 4 deletions old-onix-bot/xmltramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,15 @@ def unittest():
doc = Namespace("http://example.org/bar")
bbc = Namespace("http://example.org/bbc")
dc = Namespace("http://purl.org/dc/elements/1.1/")
d = parse(
"""<doc version="2.7182818284590451"
d = parse("""<doc version="2.7182818284590451"
xmlns="http://example.org/bar"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:bbc="http://example.org/bbc">
<author>John Polk and John Palfrey</author>
<dc:creator>John Polk</dc:creator>
<dc:creator>John Palfrey</dc:creator>
<bbc:show bbc:station="4">Buffy</bbc:show>
</doc>"""
)
</doc>""")

assert repr(d) == '<doc version="2.7182818284590451">...</doc>'
assert (
Expand Down
68 changes: 31 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
[tool.ruff]
select = [
"C4", # flake8-comprehensions
"C90", # mccabe
"E", # pycodestyle
"F", # Pyflakes
"I", # isort
"ICN", # flake8-import-conventions
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # Pylint conventions
"PLE", # Pylint errors
"PLR091", # Pylint refactor just for max-args, max-branches, etc.
"PYI", # flake8-pyi
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
target-version = "py37"
line-length = 616
ignore = [
"E402",
"E722",
Expand All @@ -31,20 +11,34 @@ ignore = [
"PLC1901",
"RUF001",
]
line-length = 616
target-version = "py37"

[tool.ruff.mccabe]
max-complexity = 21

[tool.ruff.pylint]
max-args = 8
max-branches = 18
max-statements = 73

[tool.ruff.per-file-ignores]
"test/*" = ["S101"]
mccabe.max-complexity = 21
per-file-ignores."test/*" = [ "S101" ]
pylint.max-args = 8
pylint.max-branches = 18
pylint.max-statements = 73
select = [
"C4", # flake8-comprehensions
"C90", # mccabe
"E", # pycodestyle
"F", # Pyflakes
"I", # isort
"ICN", # flake8-import-conventions
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # Pylint conventions
"PLE", # Pylint errors
"PLR091", # Pylint refactor just for max-args, max-branches, etc.
"PYI", # flake8-pyi
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]

[tool.codespell]
ignore-words-list = 'didnt'
skip = './.*,*.xsd'
ignore-words-list = "didnt"
skip = "./.*,*.xsd"
Loading