Skip to content

Commit 630ecbf

Browse files
committed
rfctr(lint): tune in ruff settings
1 parent 57d3b9e commit 630ecbf

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Homepage = "https://github.com/python-openxml/python-docx"
3939
Repository = "https://github.com/python-openxml/python-docx"
4040

4141
[tool.black]
42+
line-length = 100
4243
target-version = ["py37", "py38", "py39", "py310", "py311"]
4344

4445
[tool.pytest.ini_options]
@@ -69,6 +70,10 @@ python_functions = ["it_", "its_", "they_", "and_", "but_"]
6970

7071
[tool.ruff]
7172
exclude = []
73+
line-length = 100
74+
target-version = "py38"
75+
76+
[tool.ruff.lint]
7277
ignore = [
7378
"COM812", # -- over-aggressively insists on trailing commas where not desired --
7479
"PT001", # -- wants @pytest.fixture() instead of @pytest.fixture --
@@ -88,9 +93,8 @@ select = [
8893
"UP032", # -- Use f-string instead of `.format()` call --
8994
"UP034", # -- Avoid extraneous parentheses --
9095
]
91-
target-version = "py37"
9296

93-
[tool.ruff.isort]
97+
[tool.ruff.lint.isort]
9498
known-first-party = ["docx"]
9599
known-local-folder = ["helpers"]
96100

src/docx/image/tiff.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ def _dpi(self, resolution_tag):
9898
return 72
9999

100100
# resolution unit defaults to inches (2)
101-
resolution_unit = (
102-
ifd_entries[TIFF_TAG.RESOLUTION_UNIT]
103-
if TIFF_TAG.RESOLUTION_UNIT in ifd_entries
104-
else 2
105-
)
101+
resolution_unit = ifd_entries.get(TIFF_TAG.RESOLUTION_UNIT, 2)
106102

107103
if resolution_unit == 1: # aspect ratio only
108104
return 72

tests/unitutil/cxml.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def from_token(cls, token):
8989
Return an ``Element`` object constructed from a parser element token.
9090
"""
9191
tagname = token.tagname
92-
attrs = [(name, value) for name, value in token.attr_list]
92+
attrs = [tuple(a) for a in token.attr_list]
9393
text = token.text
9494
return cls(tagname, attrs, text)
9595

@@ -263,9 +263,7 @@ def grammar():
263263
child_node_list << (open_paren + delimitedList(node) + close_paren | node)
264264

265265
root_node = (
266-
element("element")
267-
+ Group(Optional(slash + child_node_list))("child_node_list")
268-
+ stringEnd
266+
element("element") + Group(Optional(slash + child_node_list))("child_node_list") + stringEnd
269267
).setParseAction(connect_root_node_children)
270268

271269
return root_node

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy