Skip to content

Commit 7bc2092

Browse files
authored
Merge pull request #122 from 4teamwork/cleanup
Some housekeeping
2 parents 6841266 + 0f6dcb3 commit 7bc2092

18 files changed

Lines changed: 268 additions & 366 deletions

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ jobs:
2323
poetry-version: 2.1
2424
- name: Install dependencies
2525
run: poetry install -E dev
26-
- name: isort
27-
run: poetry run isort --check-only --quiet --settings pyproject.toml .
28-
- name: flake8
29-
run: poetry run flake8
30-
- name: black
31-
run: poetry run black --check --config pyproject.toml .
32-
- name: tests
26+
- name: Ruff Linter
27+
run: poetry run ruff check
28+
- name: Ruff Formatter
29+
run: poetry run ruff format --check
30+
- name: Tests
3331
run: poetry run pytest

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Changelog
2+
=========
3+
4+
.. towncrier release notes start
15

26
2.0.2 (2026-02-17)
37
------------------
@@ -28,10 +32,6 @@ Other changes:
2832
- Use poetry for dependecy management and towncrier and zest.releaser for release managment. [jch]
2933

3034

31-
Changelog
32-
=========
33-
34-
3535
1.4.0 (2022-12-14)
3636
------------------
3737

changes/python310.other

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lowered the minimum required Python version from 3.12 to 3.10. [buchi]

changes/six-removal.other

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed dependency on six. [buchi]

docker-bake.hcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,13 @@ target "default" {
3737
"linux/amd64",
3838
strlen(GIT_TAG) > 0 ? "linux/arm64" : "",
3939
]
40+
attest = [
41+
{
42+
type = "provenance"
43+
mode = "max"
44+
},
45+
{
46+
type = "sbom"
47+
}
48+
]
4049
}

docxcompose/command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def setup_parser():
1111
parser = ArgumentParser(description="compose multiple docx files into one file.")
1212
parser.add_argument(
1313
"master",
14-
help="path to master template that defines styles, " "headings and so on",
14+
help="path to master template that defines styles, headings and so on",
1515
)
1616
parser.add_argument(
1717
"files",
1818
nargs="+",
19-
help="path to one or more word-files to be appended " "to the master template",
19+
help="path to one or more word-files to be appended to the master template",
2020
metavar="file",
2121
)
2222
parser.add_argument(

docxcompose/composer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737

3838
class Composer(object):
39-
4039
def __init__(self, doc):
4140
self.doc = doc
4241
self.pkg = doc.part.package

docxcompose/properties.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from docx.oxml.coreprops import CT_CoreProperties
1414
from lxml.etree import FunctionNamespace
1515
from lxml.etree import QName
16-
from six import binary_type
17-
from six import text_type
1816

1917
from docxcompose.utils import NS
2018
from docxcompose.utils import word_to_python_date_format
@@ -38,17 +36,17 @@ def value2vt(value):
3836
el.text = "true" if value else "false"
3937
elif isinstance(value, int):
4038
el = parse_xml(CUSTOM_PROPERTY_TYPES["int"])
41-
el.text = text_type(value)
39+
el.text = str(value)
4240
elif isinstance(value, float):
4341
el = parse_xml(CUSTOM_PROPERTY_TYPES["float"])
44-
el.text = text_type(value)
42+
el.text = str(value)
4543
elif isinstance(value, datetime):
4644
el = parse_xml(CUSTOM_PROPERTY_TYPES["datetime"])
4745
el.text = value.strftime("%Y-%m-%dT%H:%M:%SZ")
48-
elif isinstance(value, text_type):
46+
elif isinstance(value, str):
4947
el = parse_xml(CUSTOM_PROPERTY_TYPES["text"])
5048
el.text = value
51-
elif isinstance(value, binary_type):
49+
elif isinstance(value, bytes):
5250
value = value.decode("utf-8")
5351
el = parse_xml(CUSTOM_PROPERTY_TYPES["text"])
5452
el.text = value
@@ -171,7 +169,7 @@ def __delitem__(self, key):
171169
# Renumber pids
172170
pid = MIN_PID
173171
for prop in self._element:
174-
prop.set("pid", text_type(pid))
172+
prop.set("pid", str(pid))
175173
pid += 1
176174

177175
self._update_part()
@@ -235,7 +233,7 @@ def add(self, name, value):
235233
prop = parse_xml('<cp:property xmlns:cp="{}"/>'.format(NS["cp"]))
236234
prop.set("fmtid", CUSTOM_PROPERTY_FMTID)
237235
prop.set("name", name)
238-
prop.set("pid", text_type(pid))
236+
prop.set("pid", str(pid))
239237
value_el = value2vt(value)
240238
prop.append(value_el)
241239
self._element.append(prop)
@@ -345,7 +343,7 @@ class FieldBase(object):
345343
"""Class used to represent a docproperty field in the document.xml."""
346344

347345
fieldname_and_format_search_expr = re.compile(
348-
r'DOCPROPERTY +"{0,1}([^\\]*?)"{0,1} +(?:\\\@ +"{0,1}([^\\]*?)"{0,1} +){0,1}\\\* MERGEFORMAT',
346+
r'DOCPROPERTY +"{0,1}([^\\]*?)"{0,1} +(?:\\\@ +"{0,1}([^\\]*?)"{0,1} +){0,1}\\\* MERGEFORMAT', # noqa
349347
flags=re.UNICODE,
350348
)
351349

@@ -365,7 +363,7 @@ def _format_value(self, value, language=None):
365363
return format_datetime(value, self.date_format, locale=language)
366364
return format_datetime(value, self.date_format)
367365
else:
368-
return text_type(value)
366+
return str(value)
369367

370368
def update(self, value, language=None):
371369
"""Sets the value of the docproperty in the document"""

docxcompose/server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
async def compose(request):
2121

2222
documents = []
23-
temp_dir = None
2423

2524
if not request.content_type == "multipart/form-data":
2625
logger.info(
@@ -81,7 +80,7 @@ async def stream_file(request, filename, content_type):
8180
reason="OK",
8281
headers={
8382
"Content-Type": content_type,
84-
"Content-Disposition": f'attachment; filename="{os.path.basename(filename)}"',
83+
"Content-Disposition": f'attachment; filename="{os.path.basename(filename)}"', # noqa
8584
},
8685
)
8786
await response.prepare(request)

0 commit comments

Comments
 (0)