Skip to content

Commit 0974bf1

Browse files
grayfox88lucsorel
authored andcommitted
revert to official UML method syntax
Fix type hinting in source code.
1 parent 6c0dbd6 commit 0974bf1

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

py2puml/domain/umlclass.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from py2puml.domain.umlitem import UmlItem
55

6+
67
@dataclass
78
class UmlAttribute:
89
name: str
@@ -11,7 +12,7 @@ class UmlAttribute:
1112

1213

1314
@dataclass
14-
class UmlMethod(object):
15+
class UmlMethod:
1516
name: str
1617
signature: str
1718

tests/modules/withmethods/withmethods.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class Coordinates:
10-
def __init__(self, x: float, y: float):
10+
def __init__(self, x: float, y: float) -> None:
1111
self.x = x
1212
self.y = y
1313

@@ -17,13 +17,13 @@ class Point:
1717
origin = Coordinates(0, 0)
1818

1919
@staticmethod
20-
def from_values(x: int, y: str, u: float) -> 'Point':
21-
return Point(x, y, u)
20+
def from_values(x: int, y: str) -> 'Point':
21+
return Point(x, y)
2222

23-
def get_coordinates(self):
23+
def get_coordinates(self) -> Tuple[float, str]:
2424
return self.x, self.y
2525

26-
def __init__(self, x: int, y: str):
26+
def __init__(self, x: int, y: str) -> None:
2727
self.coordinates: Coordinates = Coordinates(x, float(y))
2828
self.day_unit: withenum.TimeUnit = withenum.TimeUnit.DAYS
2929
self.hour_unit: modules.withenum.TimeUnit = modules.withenum.TimeUnit.HOURS

tests/puml_files/with_methods.puml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ class tests.modules.withmethods.withmethods.Point {
1111
time_resolution: Tuple[str, TimeUnit]
1212
x: int
1313
y: str
14-
from_values(x: int, y: str, u: float) -> 'Point'
15-
get_coordinates(self)
14+
{static} Point from_values(x: int, y: str)
15+
Tuple[float, str] get_coordinates(self)
16+
__init__(self, x: int, y: str)
1617
}
1718
class tests.modules.withmethods.withinheritedmethods.ThreeDimensionalPoint {
1819
z: float
19-
check_positive(self) -> bool
20-
from_values(x: int, y: str, u: float) -> 'Point'
21-
get_coordinates(self)
20+
__init__(self, x: int, y: str, z: float)
2221
move(self, offset: int)
22+
bool check_positive(self)
2323
}
2424
class tests.modules.withmethods.withmethods.Coordinates {
2525
x: float
2626
y: float
27+
__init__(self, x: float, y: float)
2728
}
2829
tests.modules.withmethods.withmethods.Point *-- tests.modules.withmethods.withmethods.Coordinates
2930
tests.modules.withmethods.withmethods.Point <|-- tests.modules.withmethods.withinheritedmethods.ThreeDimensionalPoint

0 commit comments

Comments
 (0)