Skip to content

Commit 80866a9

Browse files
committed
Moving FormalAnnotation down
1 parent c348c47 commit 80866a9

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

pyannotating.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@
22
from typing import Optional, Any, Union, Iterable, Self, Mapping, Final, Callable, _UnionGenericAlias
33

44

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
245

256

267
class AnnotationFactory(ABC):
@@ -170,6 +151,27 @@ def __recursively_format(self, collection: Iterable) -> list:
170151
return formatted_collection
171152

172153

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+
173175
class Special:
174176
"""
175177
Annotation class for formally specifying specific behavior for subclasses.

0 commit comments

Comments
 (0)