Skip to content

Commit 3bf9071

Browse files
yt-msMidnighter
authored andcommitted
docs(views): fix flake8 warnings
1 parent 311ecb6 commit 3bf9071

File tree

7 files changed

+30
-58
lines changed

7 files changed

+30
-58
lines changed

src/structurizr/view/relationship_style.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@
3030

3131

3232
class RelationshipStyleIO(BaseModel):
33-
"""
34-
Represent a relationship's style.
35-
36-
Attributes:
37-
38-
"""
33+
"""Represent a relationship's style."""
3934

4035
tag: str
4136
thickness: Optional[int]
@@ -49,12 +44,7 @@ class RelationshipStyleIO(BaseModel):
4944

5045

5146
class RelationshipStyle(AbstractBase):
52-
"""
53-
Define an relationship's style.
54-
55-
Attributes:
56-
57-
"""
47+
"""Define an relationship's style."""
5848

5949
START_OF_LINE = 0
6050
END_OF_LINE = 100
@@ -87,7 +77,7 @@ def __init__(
8777

8878
@classmethod
8979
def hydrate(cls, relationship_style_io: RelationshipStyleIO) -> "RelationshipStyle":
90-
""""""
80+
"""Hydrate a new RelationshipStyle instance from its IO."""
9181
return cls(
9282
tag=relationship_style_io.tag,
9383
thickness=relationship_style_io.thickness,

src/structurizr/view/relationship_view.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434

3535

3636
class RelationshipViewIO(BaseModel):
37-
"""
38-
Represent an instance of a relationship in a view.
39-
40-
Attributes:
41-
42-
"""
37+
"""Represent an instance of a relationship in a view."""
4338

4439
id: Optional[str]
4540
order: Optional[str]
@@ -51,12 +46,7 @@ class RelationshipViewIO(BaseModel):
5146

5247

5348
class RelationshipView(AbstractBase):
54-
"""
55-
Represent an instance of a relationship in a view.
56-
57-
Attributes:
58-
59-
"""
49+
"""Represent an instance of a relationship in a view."""
6050

6151
def __init__(
6252
self,
@@ -81,6 +71,7 @@ def __init__(
8171
self.position = position
8272

8373
def __repr__(self) -> str:
74+
"""Return repr(self)."""
8475
return (
8576
f"{type(self).__name__}("
8677
f"id={self.id}, "
@@ -91,7 +82,7 @@ def __repr__(self) -> str:
9182

9283
@classmethod
9384
def hydrate(cls, relationship_view_io: RelationshipViewIO) -> "RelationshipView":
94-
""""""
85+
"""Hydrate a new RelationshipView instance from its IO."""
9586
return cls(
9687
id=relationship_view_io.id,
9788
description=relationship_view_io.description,
@@ -102,6 +93,7 @@ def hydrate(cls, relationship_view_io: RelationshipViewIO) -> "RelationshipView"
10293
)
10394

10495
def copy_layout_information_from(self, source: "RelationshipView") -> None:
96+
"""Copy the layout information from another RelationshipView."""
10597
self.vertices = source.vertices
10698
self.routing = source.routing
10799
self.position = source.position

src/structurizr/view/static_view.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def __init__(
6363

6464
@classmethod
6565
def hydrate_arguments(cls, static_view_io: StaticViewIO) -> Dict:
66+
"""Hydrate a StaticViewIO into the constructor arguments for StaticView."""
6667
return {
6768
**super().hydrate_arguments(static_view_io),
6869
"animations": map(Animation.hydrate, static_view_io.animations),

src/structurizr/view/styles.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,14 @@
3030

3131

3232
class StylesIO(BaseModel):
33-
"""
34-
Represent a collection of styles.
35-
36-
Attributes:
37-
38-
"""
33+
"""Represent a collection of styles."""
3934

4035
elements: List[ElementStyleIO] = Field(default=())
4136
relationships: List[RelationshipStyleIO] = Field(default=())
4237

4338

4439
class Styles(AbstractBase):
45-
"""
46-
Represent a collection of styles.
47-
48-
Attributes:
49-
50-
"""
40+
"""Represent a collection of styles."""
5141

5242
def __init__(
5343
self,
@@ -62,7 +52,7 @@ def __init__(
6252
self.relationships = list(relationships)
6353

6454
def add(self, style: Union[ElementStyle, RelationshipStyle]) -> None:
65-
""""""
55+
"""Add a new ElementStyle or RelationshipStyle."""
6656
if isinstance(style, ElementStyle):
6757
self.elements.append(style)
6858
elif isinstance(style, RelationshipStyle):
@@ -73,24 +63,32 @@ def add(self, style: Union[ElementStyle, RelationshipStyle]) -> None:
7363
)
7464

7565
def add_element_style(self, **kwargs) -> None:
76-
""""""
66+
"""
67+
Add a new element style.
68+
69+
See `ElementStyle` for arguments.
70+
"""
7771
self.elements.append(ElementStyle(**kwargs))
7872

7973
def clear_element_styles(self) -> None:
80-
""""""
74+
"""Remove all element styles."""
8175
self.elements.clear()
8276

8377
def add_relationship_style(self, **kwargs) -> None:
84-
""""""
78+
"""
79+
Add a new relationship style.
80+
81+
See `RelationshipStyle` for arguments.
82+
"""
8583
self.relationships.append(RelationshipStyle(**kwargs))
8684

8785
def clear_relationships_styles(self) -> None:
88-
""""""
86+
"""Remove all relationship styles."""
8987
self.relationships.clear()
9088

9189
@classmethod
9290
def hydrate(cls, styles_io: StylesIO) -> "Styles":
93-
""""""
91+
"""Hydrate a new Styles instance from its IO."""
9492
return cls(
9593
elements=map(ElementStyle.hydrate, styles_io.elements),
9694
relationships=map(RelationshipStyle.hydrate, styles_io.relationships),

src/structurizr/view/system_context_view.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def add_all_elements(self) -> None:
6363
self.add_all_people()
6464

6565
def add_nearest_neighbours(self, element: Element):
66+
"""Add all softare systems and people directly connected to the element."""
6667
super().add_nearest_neighbours(element, SoftwareSystem)
6768
super().add_nearest_neighbours(element, Person)
6869

@@ -72,7 +73,7 @@ def hydrate(
7273
system_context_view_io: SystemContextViewIO,
7374
software_system: SoftwareSystem,
7475
) -> "SystemContextView":
75-
""""""
76+
"""Hydrate a new SystemContextView instance from its IO."""
7677
return cls(
7778
**cls.hydrate_arguments(system_context_view_io),
7879
software_system=software_system,

src/structurizr/view/system_landscape_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def hydrate(
7474
system_landscape_view_io: SystemLandscapeViewIO,
7575
model: Model,
7676
) -> "SystemLandscapeView":
77-
""""""
77+
"""Hydrate a new SystemLandscapeView instance from its IO."""
7878
return cls(
7979
**cls.hydrate_arguments(system_landscape_view_io),
8080
model=model,

src/structurizr/view/terminology.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@
2828

2929

3030
class TerminologyIO(BaseModel):
31-
"""
32-
Represent an instance of an element in a view.
33-
34-
Attributes:
35-
36-
"""
31+
"""Represent a way for the terminology on diagrams, etc. to be modified."""
3732

3833
enterprise: Optional[str]
3934
person: Optional[str]
@@ -46,12 +41,7 @@ class TerminologyIO(BaseModel):
4641

4742

4843
class Terminology(AbstractBase):
49-
"""
50-
Provide a way for the terminology on diagrams, etc. to be modified.
51-
52-
Attributes:
53-
54-
"""
44+
"""Provide a way for the terminology on diagrams, etc. to be modified."""
5545

5646
def __init__(
5747
self,

0 commit comments

Comments
 (0)