Skip to content
Merged
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ jobs:
poetry-version: 2.1
- name: Install dependencies
run: poetry install -E dev
- name: isort
run: poetry run isort --check-only --quiet --settings pyproject.toml .
- name: flake8
run: poetry run flake8
- name: black
run: poetry run black --check --config pyproject.toml .
- name: tests
- name: Ruff Linter
run: poetry run ruff check
- name: Ruff Formatter
run: poetry run ruff format --check
- name: Tests
run: poetry run pytest
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Changelog
=========

.. towncrier release notes start

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


Changelog
=========


1.4.0 (2022-12-14)
------------------

Expand Down
1 change: 1 addition & 0 deletions changes/python310.other
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lowered the minimum required Python version from 3.12 to 3.10. [buchi]
1 change: 1 addition & 0 deletions changes/six-removal.other
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed dependency on six. [buchi]
9 changes: 9 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ target "default" {
"linux/amd64",
strlen(GIT_TAG) > 0 ? "linux/arm64" : "",
]
attest = [
{
type = "provenance"
mode = "max"
},
{
type = "sbom"
}
]
}
4 changes: 2 additions & 2 deletions docxcompose/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def setup_parser():
parser = ArgumentParser(description="compose multiple docx files into one file.")
parser.add_argument(
"master",
help="path to master template that defines styles, " "headings and so on",
help="path to master template that defines styles, headings and so on",
)
parser.add_argument(
"files",
nargs="+",
help="path to one or more word-files to be appended " "to the master template",
help="path to one or more word-files to be appended to the master template",
metavar="file",
)
parser.add_argument(
Expand Down
1 change: 0 additions & 1 deletion docxcompose/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


class Composer(object):

def __init__(self, doc):
self.doc = doc
self.pkg = doc.part.package
Expand Down
18 changes: 8 additions & 10 deletions docxcompose/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from docx.oxml.coreprops import CT_CoreProperties
from lxml.etree import FunctionNamespace
from lxml.etree import QName
from six import binary_type
from six import text_type

from docxcompose.utils import NS
from docxcompose.utils import word_to_python_date_format
Expand All @@ -38,17 +36,17 @@ def value2vt(value):
el.text = "true" if value else "false"
elif isinstance(value, int):
el = parse_xml(CUSTOM_PROPERTY_TYPES["int"])
el.text = text_type(value)
el.text = str(value)
elif isinstance(value, float):
el = parse_xml(CUSTOM_PROPERTY_TYPES["float"])
el.text = text_type(value)
el.text = str(value)
elif isinstance(value, datetime):
el = parse_xml(CUSTOM_PROPERTY_TYPES["datetime"])
el.text = value.strftime("%Y-%m-%dT%H:%M:%SZ")
elif isinstance(value, text_type):
elif isinstance(value, str):
el = parse_xml(CUSTOM_PROPERTY_TYPES["text"])
el.text = value
elif isinstance(value, binary_type):
elif isinstance(value, bytes):
value = value.decode("utf-8")
el = parse_xml(CUSTOM_PROPERTY_TYPES["text"])
el.text = value
Expand Down Expand Up @@ -171,7 +169,7 @@ def __delitem__(self, key):
# Renumber pids
pid = MIN_PID
for prop in self._element:
prop.set("pid", text_type(pid))
prop.set("pid", str(pid))
pid += 1

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

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

Expand All @@ -365,7 +363,7 @@ def _format_value(self, value, language=None):
return format_datetime(value, self.date_format, locale=language)
return format_datetime(value, self.date_format)
else:
return text_type(value)
return str(value)

def update(self, value, language=None):
"""Sets the value of the docproperty in the document"""
Expand Down
3 changes: 1 addition & 2 deletions docxcompose/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
async def compose(request):

documents = []
temp_dir = None

if not request.content_type == "multipart/form-data":
logger.info(
Expand Down Expand Up @@ -81,7 +80,7 @@ async def stream_file(request, filename, content_type):
reason="OK",
headers={
"Content-Type": content_type,
"Content-Disposition": f'attachment; filename="{os.path.basename(filename)}"',
"Content-Disposition": f'attachment; filename="{os.path.basename(filename)}"', # noqa
},
)
await response.prepare(request)
Expand Down
Loading
Loading