Skip to content

Commit 66176bc

Browse files
committed
style: upgrade code style
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent f31ab3d commit 66176bc

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cyclonedx_py/_internal/pipenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __call__(self, *, # type:ignore[override]
124124

125125
lock_file = join(project_directory, 'Pipfile.lock')
126126
try:
127-
lock = open(lock_file, 'rt', encoding='utf8', errors='replace')
127+
lock = open(lock_file, encoding='utf8', errors='replace')
128128
except OSError as err:
129129
raise ValueError(f'Could not open lock file: {lock_file}') from err
130130
with lock:

cyclonedx_py/_internal/poetry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def __call__(self, *, # type:ignore[override]
171171
pyproject_file = join(project_directory, 'pyproject.toml')
172172
lock_file = join(project_directory, 'poetry.lock')
173173
try:
174-
pyproject = open(pyproject_file, 'rt', encoding='utf8', errors='replace')
174+
pyproject = open(pyproject_file, encoding='utf8', errors='replace')
175175
except OSError as err:
176176
raise ValueError(f'Could not open pyproject file: {pyproject_file}') from err
177177
try:
178-
lock = open(lock_file, 'rt', encoding='utf8', errors='replace')
178+
lock = open(lock_file, encoding='utf8', errors='replace')
179179
except OSError as err:
180180
pyproject.close()
181181
raise ValueError(f'Could not open lock file: {lock_file}') from err

cyclonedx_py/_internal/utils/pyproject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def pyproject2component(data: dict[str, Any], *,
4343

4444
def pyproject_load(pyproject_file: str) -> dict[str, Any]:
4545
try:
46-
pyproject_fh = open(pyproject_file, 'rt', encoding='utf8', errors='replace')
46+
pyproject_fh = open(pyproject_file, encoding='utf8', errors='replace')
4747
except OSError as err:
4848
raise ValueError(f'Could not open pyproject file: {pyproject_file}') from err
4949
with pyproject_fh:

tests/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from os import getenv, path
2121
from pathlib import Path
2222
from re import sub as re_sub
23-
from typing import Any, Dict, Union
23+
from typing import Any, Union
2424
from unittest import TestCase
2525
from xml.sax.saxutils import escape as xml_escape, quoteattr as xml_quoteattr # nosec:B406
2626

@@ -62,12 +62,12 @@ def getSnapshotFile(snapshot_name: str) -> str: # noqa: N802
6262

6363
@classmethod
6464
def writeSnapshot(cls, snapshot_name: str, data: str) -> None: # noqa: N802
65-
with open(cls.getSnapshotFile(snapshot_name), 'wt', encoding='utf8', newline='\n') as sf:
65+
with open(cls.getSnapshotFile(snapshot_name), 'w', encoding='utf8', newline='\n') as sf:
6666
sf.write(data)
6767

6868
@classmethod
6969
def readSnapshot(cls, snapshot_name: str) -> str: # noqa: N802
70-
with open(cls.getSnapshotFile(snapshot_name), 'rt', encoding='utf8', newline='\n') as sf:
70+
with open(cls.getSnapshotFile(snapshot_name), encoding='utf8', newline='\n') as sf:
7171
return sf.read()
7272

7373
def assertEqualSnapshot(self: Union[TestCase, 'SnapshotMixin'], # noqa: N802
@@ -227,7 +227,7 @@ def make_comparable(bom: str, of: OutputFormat) -> str:
227227
# endregion reproducible test results
228228

229229

230-
def load_pyproject() -> Dict[str, Any]:
230+
def load_pyproject() -> dict[str, Any]:
231231
if sys.version_info >= (3, 11):
232232
from tomllib import load as toml_load
233233
else:

0 commit comments

Comments
 (0)