Skip to content

Commit 4214a7f

Browse files
authored
Security/748 updated dependency to black (#749)
1 parent 9d434f2 commit 4214a7f

15 files changed

Lines changed: 649 additions & 625 deletions

File tree

doc/changes/unreleased.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Unreleased
22

33
## Summary
4+
5+
## Security Issues
6+
7+
* #748: Updated dependency to `black`

exasol/toolbox/metrics.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,11 @@ def _key(name: str) -> str:
307307
for name, entry in entries.items()
308308
)
309309

310-
return cleandoc(
311-
"""
310+
return cleandoc("""
312311
{heading}
313312
{seperator}
314313
{entries}
315-
"""
316-
).format(
314+
""").format(
317315
heading=row.format("Category", "Status"),
318316
seperator=row.format("-" * col1_width, "-" * col2_width),
319317
entries="\n".join(rows),

exasol/toolbox/tools/lint.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ def _rows(findings: Iterable[Finding]) -> str:
5858
rows += f"|{finding.message}|\n"
5959
return rows
6060

61-
template = cleandoc(
62-
"""
61+
template = cleandoc("""
6362
{header}{rows}
64-
"""
65-
)
63+
""")
6664
lint_issues = sorted(lint_issues, key=lambda i: (i.path, i.message_id, i.line))
6765
return template.format(header=_header(), rows=_rows(lint_issues))
6866

exasol/toolbox/tools/security.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,9 @@ def from_json(report_str: str, prefix: Path) -> Iterable[SecurityIssue]:
200200

201201

202202
def issues_to_markdown(issues: Iterable[SecurityIssue]) -> str:
203-
template = cleandoc(
204-
"""
203+
template = cleandoc("""
205204
{header}{rows}
206-
"""
207-
)
205+
""")
208206

209207
def _header():
210208
header = "# Security\n\n"
@@ -233,8 +231,7 @@ def security_issue_body(issue: Issue) -> str:
233231
def as_markdown_listing(elements: Iterable[str]):
234232
return "\n".join(f"- {element}" for element in elements)
235233

236-
body = cleandoc(
237-
"""
234+
body = cleandoc("""
238235
## Summary
239236
{description}
240237
@@ -243,8 +240,7 @@ def as_markdown_listing(elements: Iterable[str]):
243240
244241
## References
245242
{references}
246-
"""
247-
)
243+
""")
248244
return body.format(
249245
cve=issue.cve,
250246
cwe=issue.cwe,

exasol/toolbox/util/dependencies/licenses.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,10 @@ class PackageLicenseReport:
131131

132132
@staticmethod
133133
def _format_group_table_header(group: str) -> str:
134-
return cleandoc(
135-
f"""## `{group}` Dependencies
134+
return cleandoc(f"""## `{group}` Dependencies
136135
|Package|Version|License|
137136
|---|---|---|
138-
"""
139-
)
137+
""")
140138

141139
def _format_group_table(
142140
self, group: str, group_package_names: set[NormalizedPackageStr]

exasol/toolbox/util/release/changelog.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@
1313
from exasol.toolbox.util.dependencies.track_changes import DependencyChanges
1414
from exasol.toolbox.util.version import Version
1515

16-
UNRELEASED_INITIAL_CONTENT = (
17-
cleandoc(
18-
"""
16+
UNRELEASED_INITIAL_CONTENT = cleandoc("""
1917
# Unreleased
2018
2119
## Summary
22-
"""
23-
)
24-
+ "\n"
25-
)
20+
""") + "\n"
2621

2722

2823
class Changelogs:

poetry.lock

Lines changed: 606 additions & 535 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
]
2929
dependencies = [
3030
"bandit[toml]>=1.7.9,<2",
31-
"black>=24.1.0,<26",
31+
"black>=26.3.1,<27",
3232
"coverage>=6.4.4,<8.0.0",
3333
"furo>=2022.9.15",
3434
"importlib-resources>=5.12.0",
@@ -38,7 +38,7 @@ dependencies = [
3838
"mypy>=0.971",
3939
"myst-parser>=2.0.0,<4",
4040
"nox>=2022.8.7",
41-
"pip-audit>=2.7.3,<3",
41+
"pip-audit>=2.7.3,<2.10.0", # see issue https://github.com/exasol/python-toolbox/issues/750
4242
"pip-licenses>=5.0.0,<6",
4343
"pluggy>=1.5.0,<2",
4444
"pre-commit>=4,<5",

test/integration/util/dependencies/audit_integration_test.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ def create_poetry_project(tmp_path, sample_vulnerability, poetry_path):
2323
env={},
2424
)
2525

26-
poetry_export = cleandoc(
27-
"""
26+
poetry_export = cleandoc("""
2827
[tool.poetry.requires-plugins]
2928
poetry-plugin-export = ">=1.8"
30-
"""
31-
)
29+
""")
3230

3331
with (poetry_root_dir / "pyproject.toml").open("a") as f:
3432
f.write(poetry_export)

test/unit/nox/_artifacts_test.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,12 @@ def test_missing_files(tmp_path, capsys):
280280
copy_artifacts(session)
281281
captured = capsys.readouterr()
282282
assert re.match(
283-
cleandoc(
284-
"""
283+
cleandoc("""
285284
Could not find any file .*/coverage-python9.9\\*/.coverage
286285
File not found .*/lint-python9.9/.lint.txt
287286
File not found .*/lint-python9.9/.lint.json
288287
File not found .*/security-python9.9/.security.json
289-
"""
290-
),
288+
"""),
291289
captured.err,
292290
)
293291

@@ -313,13 +311,11 @@ def test_all_files(tmp_path, capsys):
313311
EndsWith("coverage-python9.9-slow/.coverage"),
314312
)
315313
assert re.match(
316-
cleandoc(
317-
"""
314+
cleandoc("""
318315
Copying file .*/lint-python9.9/.lint.txt
319316
Copying file .*/lint-python9.9/.lint.json
320317
Copying file .*/security-python9.9/.security.json
321-
"""
322-
),
318+
"""),
323319
captured.err,
324320
)
325321
for f in [".lint.txt", ".lint.json", ".security.json"]:
@@ -347,9 +343,7 @@ def test_that_bad_coverage_file_still_raises_error(
347343
monkeypatch.setattr(_artifacts, "COVERAGE_XML", coverage_xml)
348344
_create_coverage_file(coverage_db, COVERAGE_TABLES)
349345

350-
with pytest.raises(
351-
_SessionQuit, match="doesn't seem to be a coverage data file"
352-
):
346+
with pytest.raises(_SessionQuit, match="isn't a coverage data file"):
353347
_prepare_coverage_xml(nox_session, tmp_path, cwd=tmp_path)
354348

355349
assert coverage_db.exists()

0 commit comments

Comments
 (0)