Skip to content

Commit 0b1415a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a07a782 commit 0b1415a

File tree

8 files changed

+46
-54
lines changed

8 files changed

+46
-54
lines changed

BWBImportBot/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env python
22

33
"""
4-
__init__.py
5-
~~~~~~~~~~~
6-
:copyright: (c) 2020 by Internet Archive.
7-
:license: AGPL v3
4+
__init__.py
5+
~~~~~~~~~~~
6+
:copyright: (c) 2020 by Internet Archive.
7+
:license: AGPL v3
88
"""
99

1010
__title__ = "bwbimportbot"

ia-bulkmarc-bot/bulk-import.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python3
22

33
"""
4-
Iterates over an archive.org bulk MARC item, such as OpenLibraries-Trent-MARCs,
5-
and imports all records in all of its MARC files to Open Library.
4+
Iterates over an archive.org bulk MARC item, such as OpenLibraries-Trent-MARCs,
5+
and imports all records in all of its MARC files to Open Library.
66
7-
USAGE: ./bulk-import.py <archive.org item id>
7+
USAGE: ./bulk-import.py <archive.org item id>
88
9-
Logs results to STDOUT
9+
Logs results to STDOUT
1010
"""
1111

1212
import argparse

old-onix-bot/onix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def startElementNS(self, name, qname, attrs):
105105
self.subhandler.startElementNS(name, qname, attrs)
106106
self.subdepth += 1
107107
else:
108-
(uri, localname) = name
108+
uri, localname = name
109109
if localname == "product":
110110
self.subhandler = xmltramp.Seeder(self.parser)
111111
self.subhandler.startElementNS(name, qname, attrs)

old-onix-bot/sax_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def startElementNS(self, name, qname, attrs):
121121
if self.ignoring:
122122
self.ignoring += 1
123123
else:
124-
(uri, localname) = name
124+
uri, localname = name
125125
c_maker = self.collector_table.get(localname) or self.collector_table.get(
126126
collector_any
127127
)
@@ -180,7 +180,7 @@ def __init__(self, collector_table):
180180
self.values = {}
181181

182182
def collect(self, key_value):
183-
(key, value) = key_value
183+
key, value = key_value
184184
if self.values.get(key):
185185
raise Exception(f"dictionary key '{key}' is already mapped")
186186
else:

old-onix-bot/thread_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def re_raise(self):
4343

4444

4545
def ForeignException_extract():
46-
(exc_type, exc_value, exc_traceback) = sys.exc_info()
46+
exc_type, exc_value, exc_traceback = sys.exc_info()
4747
return ForeignException(exc_type, exc_value, exc_traceback)
4848

4949

old-onix-bot/urlcache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_entries(self):
2727

2828
def get(self, url):
2929
url = url.strip()
30-
(entries, next, index) = self.get_entries()
30+
entries, next, index = self.get_entries()
3131
id = entries.get(url)
3232
if id is None:
3333
# with index locked, add an entry for this url and

old-onix-bot/xmltramp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,17 +415,15 @@ def unittest():
415415
doc = Namespace("http://example.org/bar")
416416
bbc = Namespace("http://example.org/bbc")
417417
dc = Namespace("http://purl.org/dc/elements/1.1/")
418-
d = parse(
419-
"""<doc version="2.7182818284590451"
418+
d = parse("""<doc version="2.7182818284590451"
420419
xmlns="http://example.org/bar"
421420
xmlns:dc="http://purl.org/dc/elements/1.1/"
422421
xmlns:bbc="http://example.org/bbc">
423422
<author>John Polk and John Palfrey</author>
424423
<dc:creator>John Polk</dc:creator>
425424
<dc:creator>John Palfrey</dc:creator>
426425
<bbc:show bbc:station="4">Buffy</bbc:show>
427-
</doc>"""
428-
)
426+
</doc>""")
429427

430428
assert repr(d) == '<doc version="2.7182818284590451">...</doc>'
431429
assert (

pyproject.toml

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
[tool.ruff]
2-
select = [
3-
"C4", # flake8-comprehensions
4-
"C90", # mccabe
5-
"E", # pycodestyle
6-
"F", # Pyflakes
7-
"I", # isort
8-
"ICN", # flake8-import-conventions
9-
"PGH", # pygrep-hooks
10-
"PIE", # flake8-pie
11-
"PLC", # Pylint conventions
12-
"PLE", # Pylint errors
13-
"PLR091", # Pylint refactor just for max-args, max-branches, etc.
14-
"PYI", # flake8-pyi
15-
"RSE", # flake8-raise
16-
"RUF", # Ruff-specific rules
17-
"T10", # flake8-debugger
18-
"TCH", # flake8-type-checking
19-
"TID", # flake8-tidy-imports
20-
"UP", # pyupgrade
21-
"W", # pycodestyle
22-
"YTT", # flake8-2020
23-
]
2+
target-version = "py37"
3+
line-length = 616
244
ignore = [
255
"E402",
266
"E722",
@@ -31,20 +11,34 @@ ignore = [
3111
"PLC1901",
3212
"RUF001",
3313
]
34-
line-length = 616
35-
target-version = "py37"
36-
37-
[tool.ruff.mccabe]
38-
max-complexity = 21
39-
40-
[tool.ruff.pylint]
41-
max-args = 8
42-
max-branches = 18
43-
max-statements = 73
44-
45-
[tool.ruff.per-file-ignores]
46-
"test/*" = ["S101"]
14+
mccabe.max-complexity = 21
15+
per-file-ignores."test/*" = [ "S101" ]
16+
pylint.max-args = 8
17+
pylint.max-branches = 18
18+
pylint.max-statements = 73
19+
select = [
20+
"C4", # flake8-comprehensions
21+
"C90", # mccabe
22+
"E", # pycodestyle
23+
"F", # Pyflakes
24+
"I", # isort
25+
"ICN", # flake8-import-conventions
26+
"PGH", # pygrep-hooks
27+
"PIE", # flake8-pie
28+
"PLC", # Pylint conventions
29+
"PLE", # Pylint errors
30+
"PLR091", # Pylint refactor just for max-args, max-branches, etc.
31+
"PYI", # flake8-pyi
32+
"RSE", # flake8-raise
33+
"RUF", # Ruff-specific rules
34+
"T10", # flake8-debugger
35+
"TCH", # flake8-type-checking
36+
"TID", # flake8-tidy-imports
37+
"UP", # pyupgrade
38+
"W", # pycodestyle
39+
"YTT", # flake8-2020
40+
]
4741

4842
[tool.codespell]
49-
ignore-words-list = 'didnt'
50-
skip = './.*,*.xsd'
43+
ignore-words-list = "didnt"
44+
skip = "./.*,*.xsd"

0 commit comments

Comments
 (0)