|
2 | 2 | from typing import Optional, Any, Union, Iterable, Self, Mapping, Final, Callable, _UnionGenericAlias |
3 | 3 |
|
4 | 4 |
|
5 | | -class FormalAnnotation: |
6 | | - """ |
7 | | - Class allowing to formally specify additional information about the input |
8 | | - resource. |
9 | | -
|
10 | | - When annotating, returns the input. |
11 | | -
|
12 | | - Can be called via [] with some resource. |
13 | | - """ |
14 | | - |
15 | | - def __init__(self, instance_doc: Optional[str] = None): |
16 | | - if instance_doc is not None: |
17 | | - self.__doc__ = instance_doc |
18 | | - |
19 | | - def __repr__(self) -> str: |
20 | | - return f"<{self.__class__.__name__}>" |
21 | | - |
22 | | - def __getitem__(self, resource: Any) -> Any: |
23 | | - return resource |
24 | 5 |
|
25 | 6 |
|
26 | 7 | class AnnotationFactory(ABC): |
@@ -170,6 +151,27 @@ def __recursively_format(self, collection: Iterable) -> list: |
170 | 151 | return formatted_collection |
171 | 152 |
|
172 | 153 |
|
| 154 | +class FormalAnnotation: |
| 155 | + """ |
| 156 | + Class allowing to formally specify additional information about the input |
| 157 | + resource. |
| 158 | +
|
| 159 | + When annotating, returns the input. |
| 160 | +
|
| 161 | + Can be called via [] with some resource. |
| 162 | + """ |
| 163 | + |
| 164 | + def __init__(self, instance_doc: Optional[str] = None): |
| 165 | + if instance_doc is not None: |
| 166 | + self.__doc__ = instance_doc |
| 167 | + |
| 168 | + def __repr__(self) -> str: |
| 169 | + return f"<{self.__class__.__name__}>" |
| 170 | + |
| 171 | + def __getitem__(self, resource: Any) -> Any: |
| 172 | + return resource |
| 173 | + |
| 174 | + |
173 | 175 | class Special: |
174 | 176 | """ |
175 | 177 | Annotation class for formally specifying specific behavior for subclasses. |
|
0 commit comments