Skip to content

Commit 47cb792

Browse files
yt-msMidnighter
authored andcommitted
docs(views): fix flake8 warnings
1 parent 9e03b44 commit 47cb792

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

src/structurizr/view/animation.py

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

6969
@classmethod
7070
def hydrate(cls, animation_io: AnimationIO) -> "Animation":
71+
"""Hydrate a new Animation instance from its IO."""
7172
return cls(
7273
order=animation_io.order,
7374
elements=animation_io.elements,

src/structurizr/view/automatic_layout.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@
2727

2828

2929
class AutomaticLayoutIO(BaseModel):
30-
"""
31-
Define a wrapper for automatic layout configuration.
32-
33-
Attributes:
34-
35-
"""
30+
"""Define a wrapper for automatic layout configuration."""
3631

3732
rank_direction: RankDirection = Field(..., alias="rankDirection")
3833
rank_separation: int = Field(..., alias="rankSeparation")
@@ -42,12 +37,7 @@ class AutomaticLayoutIO(BaseModel):
4237

4338

4439
class AutomaticLayout(AbstractBase):
45-
"""
46-
Define a wrapper for automatic layout configuration.
47-
48-
Attributes:
49-
50-
"""
40+
"""Define a wrapper for automatic layout configuration."""
5141

5242
def __init__(
5343
self,
@@ -69,6 +59,7 @@ def __init__(
6959

7060
@classmethod
7161
def hydrate(cls, automatic_layout_io: AutomaticLayoutIO) -> "AutomaticLayout":
62+
"""Hydrate a new AutomaticLayout instance from its IO."""
7263
return cls(
7364
rank_direction=automatic_layout_io.rank_direction,
7465
rank_separation=automatic_layout_io.rank_separation,

src/structurizr/view/branding.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,14 @@
2727

2828

2929
class BrandingIO(BaseModel):
30-
"""
31-
Represent an instance of a corporate branding.
32-
33-
Attributes:
34-
35-
"""
30+
"""Represent an instance of a corporate branding."""
3631

3732
logo: Optional[str]
3833
font: Optional[FontIO]
3934

4035

4136
class Branding(AbstractBase):
42-
"""
43-
Represent a corporate branding.
44-
45-
Attributes:
46-
47-
"""
37+
"""Represent a corporate branding."""
4838

4939
def __init__(
5040
self, *, logo: Optional[str] = None, font: Optional[Font] = None, **kwargs

src/structurizr/view/component_view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def hydrate(
7575
component_view_io: ComponentViewIO,
7676
container: Container,
7777
) -> "ComponentView":
78-
""""""
78+
"""Hydrate a new ComponentView instance from its IO."""
7979
return cls(
8080
**cls.hydrate_arguments(component_view_io),
8181
container=container,
@@ -86,6 +86,7 @@ def hydrate(
8686

8787
@property
8888
def name(self):
89+
"""Return the (computed) name of this view."""
8990
return f"{self.software_system.name} - {self.container.name} - Components"
9091

9192
def add(
@@ -103,6 +104,7 @@ def add(
103104
return self._add_element(element, add_relationships=True)
104105

105106
def remove(self, element):
107+
"""Remove an individual element from this view."""
106108
self._remove_element(element)
107109

108110
def add_all_elements(self) -> None:
@@ -113,14 +115,17 @@ def add_all_elements(self) -> None:
113115
self.add_all_components()
114116

115117
def add_all_containers(self) -> None:
118+
"""Add all other containers in the software system to this view."""
116119
for container in self.software_system.containers:
117120
self.add(container)
118121

119122
def add_all_components(self) -> None:
123+
"""Add all components in the container to this view."""
120124
for component in self.container.components:
121125
self.add(component)
122126

123127
def add_nearest_neighbours(self, element: Element, _=None) -> None:
128+
"""Add neighbouring people, software systems, containers and components."""
124129
super().add_nearest_neighbours(element, SoftwareSystem)
125130
super().add_nearest_neighbours(element, Person)
126131
super().add_nearest_neighbours(element, Container)

src/structurizr/view/configuration.py

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

3333

3434
class ConfigurationIO(BaseModel):
35-
"""
36-
Represent a configuration instance.
37-
38-
Attributes:
39-
40-
"""
35+
"""Represent a configuration instance."""
4136

4237
branding: Optional[BrandingIO]
4338
styles: Optional[StylesIO]
@@ -52,12 +47,7 @@ class ConfigurationIO(BaseModel):
5247

5348

5449
class Configuration(AbstractBase):
55-
"""
56-
Configure how information in a workspace is rendered.
57-
58-
Attributes:
59-
60-
"""
50+
"""Configure how information in a workspace is rendered."""
6151

6252
def __init__(
6353
self,
@@ -83,7 +73,7 @@ def __init__(
8373

8474
@classmethod
8575
def hydrate(cls, configuration_io: ConfigurationIO) -> "Configuration":
86-
""""""
76+
"""Hydrate new Configuration instance from its IO."""
8777
return cls(
8878
# TODO:
8979
# branding=Branding.hydrate(configuration_io.branding),

src/structurizr/view/container_view.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def hydrate(
6767
container_view_io: ContainerViewIO,
6868
software_system: SoftwareSystem,
6969
) -> "ContainerView":
70-
""""""
70+
"""Hydrate a new ContainerView instance from its IO."""
7171
return cls(
7272
**cls.hydrate_arguments(container_view_io),
7373
software_system=software_system,
@@ -99,10 +99,12 @@ def add_all_elements(self) -> None:
9999
self.add_all_containers()
100100

101101
def add_all_containers(self) -> None:
102+
"""Add all containers within the software system in scope to this view."""
102103
for container in self.software_system.containers:
103104
self.add(container)
104105

105106
def add_nearest_neighbours(self, element: Element, _=None) -> None:
107+
"""Add all people, software systems and containers that neighbor an element."""
106108
super().add_nearest_neighbours(element, SoftwareSystem)
107109
super().add_nearest_neighbours(element, Person)
108110
super().add_nearest_neighbours(element, Container)

0 commit comments

Comments
 (0)