Skip to content

Commit defa696

Browse files
committed
apply formatting
1 parent bab600e commit defa696

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/somesy/pyproject/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ class SetuptoolsConfig(BaseModel):
161161
]
162162
description: str
163163
readme: Optional[Union[Path, List[Path], File]] = None
164-
license: Optional[License] = Field(
165-
None, description="An SPDX license identifier."
166-
)
164+
license: Optional[License] = Field(None, description="An SPDX license identifier.")
167165
authors: Optional[List[STPerson]] = None
168166
maintainers: Optional[List[STPerson]] = None
169167
keywords: Optional[Set[str]] = None

src/somesy/pyproject/writer.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from rich.pretty import pretty_repr
1010
from tomlkit import load
1111

12-
from somesy.core.models import Person,ProjectMetadata
12+
from somesy.core.models import Person, ProjectMetadata
1313
from somesy.core.writer import ProjectMetadataWriter
1414

1515
from .models import PoetryConfig, SetuptoolsConfig
@@ -146,14 +146,16 @@ def _to_person(person_obj) -> Person:
146146
"email": person_obj["email"].strip(),
147147
}
148148
)
149-
150-
149+
151150
def sync(self, metadata: ProjectMetadata) -> None:
152151
"""Sync metadata with pyproject.toml file and fix license field."""
153152
super().sync(metadata)
154-
153+
155154
# if license field has both text and file, remove file
156-
if self._get_property(["license", "file"]) is not None and self._get_property(["license", "text"]) is not None:
155+
if (
156+
self._get_property(["license", "file"]) is not None
157+
and self._get_property(["license", "text"]) is not None
158+
):
157159
# delete license file property
158160
self._data["project"]["license"].pop("file")
159161
logger.debug("Removed license file from pyproject.toml")

tests/output/test_pyproject_writer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def assert_content_match(pyproject_file):
3838
pyproject_file.description
3939
== "This is a test package for demonstration purposes."
4040
)
41-
assert pyproject_file.license == "MIT" or pyproject_file.license["text"] == "MIT"
41+
assert (
42+
pyproject_file.license == "MIT" or pyproject_file.license["text"] == "MIT"
43+
)
4244
assert len(pyproject_file.authors) == 1
4345

4446
# assert for both formats

0 commit comments

Comments
 (0)