|
20 | 20 | from enum import Enum, auto |
21 | 21 | from abc import ABCMeta |
22 | 22 | from hashlib import sha1 |
| 23 | +from typing import Optional |
23 | 24 |
|
24 | 25 | from lobster.location import Location |
25 | 26 |
|
26 | 27 |
|
27 | 28 | class Tracing_Tag: |
28 | | - def __init__(self, namespace, tag, version=None): |
| 29 | + def __init__( |
| 30 | + self, |
| 31 | + namespace: str, |
| 32 | + tag: str, |
| 33 | + version: Optional[str] = None, |
| 34 | + ): |
29 | 35 | assert isinstance(namespace, str) and " " not in namespace |
30 | 36 | assert isinstance(tag, str) |
31 | 37 | assert version is None or isinstance(version, (str, int)) |
@@ -84,7 +90,7 @@ class Tracing_Status(Enum): |
84 | 90 |
|
85 | 91 |
|
86 | 92 | class Item(metaclass=ABCMeta): |
87 | | - def __init__(self, tag, location): |
| 93 | + def __init__(self, tag: Tracing_Tag, location: Location): |
88 | 94 | assert isinstance(tag, Tracing_Tag) |
89 | 95 | assert isinstance(location, Location) |
90 | 96 |
|
@@ -220,8 +226,16 @@ def to_json(self): |
220 | 226 |
|
221 | 227 |
|
222 | 228 | class Requirement(Item): |
223 | | - def __init__(self, tag, location, framework, kind, name, |
224 | | - text=None, status=None): |
| 229 | + def __init__( |
| 230 | + self, |
| 231 | + tag: Tracing_Tag, |
| 232 | + location: Location, |
| 233 | + framework: str, |
| 234 | + kind: str, |
| 235 | + name: str, |
| 236 | + text: Optional[str] = None, |
| 237 | + status: Optional[str] = None, |
| 238 | + ): |
225 | 239 | super().__init__(tag, location) |
226 | 240 | assert isinstance(framework, str) |
227 | 241 | assert isinstance(kind, str) |
@@ -270,7 +284,14 @@ def from_json(cls, level, data, schema_version): |
270 | 284 |
|
271 | 285 |
|
272 | 286 | class Implementation(Item): |
273 | | - def __init__(self, tag, location, language, kind, name): |
| 287 | + def __init__( |
| 288 | + self, |
| 289 | + tag: Tracing_Tag, |
| 290 | + location: Location, |
| 291 | + language: str, |
| 292 | + kind: str, |
| 293 | + name: str, |
| 294 | + ): |
274 | 295 | super().__init__(tag, location) |
275 | 296 | assert isinstance(language, str) |
276 | 297 | assert isinstance(kind, str) |
@@ -303,7 +324,14 @@ def from_json(cls, level, data, schema_version): |
303 | 324 |
|
304 | 325 |
|
305 | 326 | class Activity(Item): |
306 | | - def __init__(self, tag, location, framework, kind, status=None): |
| 327 | + def __init__( |
| 328 | + self, |
| 329 | + tag: Tracing_Tag, |
| 330 | + location: Location, |
| 331 | + framework: str, |
| 332 | + kind: str, |
| 333 | + status: Optional[str] = None, |
| 334 | + ): |
307 | 335 | super().__init__(tag, location) |
308 | 336 | assert isinstance(framework, str) |
309 | 337 | assert isinstance(kind, str) |
|
0 commit comments