Skip to content

Commit ab299ea

Browse files
committed
revert to official UML method syntax
Fix type hinting in source code.
1 parent de998c1 commit ab299ea

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

py2puml/domain/umlclass.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33

44
from py2puml.domain.umlitem import UmlItem
55

6+
67
@dataclass
7-
class UmlAttribute(object):
8+
class UmlAttribute:
89
name: str
910
type: str
1011
static: bool
1112

1213

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

tests/data/with_methods.puml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ class tests.modules.withmethods.withmethods.Point {
88
time_resolution: Tuple[str, TimeUnit]
99
x: int
1010
y: str
11-
{static} from_values(x: int, y: str, u: float, z: List[int]) -> Point
12-
get_coordinates() -> Tuple(float, float)
13-
__init__(x: int, y: str, unit: str, u: float, z: List[int])
11+
{static} Point from_values(x: int, y: str)
12+
Tuple[float, str] get_coordinates(self)
13+
__init__(self, x: int, y: str)
1414
}
1515
class tests.modules.withmethods.withinheritedmethods.ThreeDimensionalPoint {
1616
z: float
17-
__init__(x: int, y: str, z: float)
18-
move(offset: int)
19-
check_positive() -> bool
17+
__init__(self, x: int, y: str, z: float)
18+
move(self, offset: int)
19+
bool check_positive(self)
2020
}
2121
class tests.modules.withmethods.withmethods.Coordinates {
2222
x: float
2323
y: float
24+
__init__(self, x: float, y: float)
2425
}
2526
tests.modules.withmethods.withmethods.Point *-- tests.modules.withmethods.withmethods.Coordinates
2627
tests.modules.withmethods.withmethods.Point <|-- tests.modules.withmethods.withinheritedmethods.ThreeDimensionalPoint

tests/modules/withmethods/withinheritedmethods.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
class ThreeDimensionalPoint(Point):
55

6-
def __init__(self, x: int, y: str, z: float):
6+
def __init__(self, x: int, y: str, z: float) -> None:
77
super().__init__(x=x, y=y)
88
self.z = z
99

10-
def move(self, offset: int):
10+
def move(self, offset: int) -> None:
1111
self.x += offset
1212

1313
def check_positive(self) -> bool:

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

0 commit comments

Comments
 (0)