Skip to content

Commit 23afa57

Browse files
committed
Reorganize
1 parent 7f62b78 commit 23afa57

File tree

9 files changed

+19
-36
lines changed

9 files changed

+19
-36
lines changed

pylasu/customserialization/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import contextlib
22

3-
from .model.naming import ReferenceByName
4-
from .model.position import Point, Position
5-
from .validation.validation import Result, Issue, IssueType, IssueSeverity
3+
from pylasu.model.naming import ReferenceByName
4+
from pylasu.model.position import Point, Position
5+
from pylasu.validation.validation import Result, Issue, IssueType, IssueSeverity
6+
from deprecated import deprecated
67

78

9+
@deprecated(reason="Use LionWeb serialization instead")
810
def unserialize_result(json_result, root_unserializer) -> Result:
911
result = Result(root=root_unserializer(json_result['root']) if 'root' in json_result else None)
1012
result.issues = [unserialize_issue(issue) for issue in json_result['issues']] if 'issues' in json_result else []
1113
return result
1214

1315

16+
@deprecated(reason="Use LionWeb serialization instead")
1417
def unserialize_issue(json_issue) -> Issue:
1518
return Issue(
1619
type=unserialize_issue_type(json_issue['type']) if json_issue['type'] else None,
@@ -20,42 +23,49 @@ def unserialize_issue(json_issue) -> Issue:
2023
)
2124

2225

26+
@deprecated(reason="Use LionWeb serialization instead")
2327
def unserialize_issue_type(json_issue_type) -> IssueType or None:
2428
with contextlib.suppress(Exception):
2529
return IssueType[json_issue_type]
2630

2731

32+
@deprecated(reason="Use LionWeb serialization instead")
2833
def unserialize_issue_severity(json_issue_severity) -> IssueSeverity:
2934
with contextlib.suppress(Exception):
3035
return IssueSeverity[json_issue_severity]
3136

3237

38+
@deprecated(reason="Use LionWeb serialization instead")
3339
def check_type(json, expected_type):
3440
if "#type" not in json:
3541
raise Exception("type not specified, expected %s" % expected_type)
3642
if json["#type"] != expected_type:
3743
raise Exception("unexpected type, expected %s but found %s" % (expected_type, json["#type"]))
3844

3945

46+
@deprecated(reason="Use LionWeb serialization instead")
4047
def unserialize_point(json_point):
4148
return Point(
4249
line=json_point['line'] if 'line' in json_point else None,
4350
column=json_point['column'] if 'column' in json_point else None,
4451
)
4552

4653

54+
@deprecated(reason="Use LionWeb serialization instead")
4755
def unserialize_position(json_position):
4856
return Position(
4957
start=unserialize_point(json_position['start']) if 'start' in json_position else None,
5058
end=unserialize_point(json_position['end']) if 'end' in json_position else None
5159
)
5260

5361

62+
@deprecated(reason="Use LionWeb serialization instead")
5463
def unserialize_reference_by_name(json_reference_by_name):
5564
return ReferenceByName(
5665
name=json_reference_by_name['name'] if 'name' in json_reference_by_name else None
5766
)
5867

5968

69+
@deprecated(reason="Use LionWeb serialization instead")
6070
def unserialize_long(json):
6171
return json

pylasu/emf/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pyecore.resources import Resource
55

66
from pylasu.model import Node
7-
from pylasu.support import extension_method
7+
from pylasu.reflection.support import extension_method
88

99
from deprecated import deprecated
1010

pylasu/lionweb/ast_generation.py

+1-28
Original file line numberDiff line numberDiff line change
@@ -155,34 +155,7 @@ def _generate_constructor(concept: Concept) -> ast.FunctionDef:
155155
func=ast.Attribute(value=ast.Name(id='self', ctx=ast.Load()), attr='set_id', ctx=ast.Load()),
156156
args=[ast.Name(id='id', ctx=ast.Load())],
157157
keywords=[]
158-
)),
159-
# # self._set_containment_single_value(..., ...)
160-
# ast.Expr(value=ast.Call(
161-
# func=ast.Attribute(
162-
# value=ast.Name(id='self', ctx=ast.Load()),
163-
# attr='_set_containment_single_value',
164-
# ctx=ast.Load()
165-
# ),
166-
# args=[],
167-
# keywords=[
168-
# ast.keyword(
169-
# arg='containment',
170-
# value=ast.Call(
171-
# func=ast.Attribute(
172-
# value=ast.Name(id='concept', ctx=ast.Load()),
173-
# attr='get_containment_by_name',
174-
# ctx=ast.Load()
175-
# ),
176-
# args=[ast.Constant(value='externalName')],
177-
# keywords=[]
178-
# )
179-
# ),
180-
# ast.keyword(
181-
# arg='value',
182-
# value=ast.Name(id='externalName', ctx=ast.Load())
183-
# )
184-
# ]
185-
# ))
158+
))
186159
],
187160
decorator_list=[],
188161
returns=None

pylasu/model/processing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from . import walk
55
from .model import Node, internal_property
6-
from ..support import extension_method
6+
from pylasu.reflection.support import extension_method
77

88

99
@extension_method(Node)

pylasu/model/traversing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from . import Position
44
from .model import Node
5-
from ..support import extension_method
5+
from pylasu.reflection.support import extension_method
66

77

88
@extension_method(Node)

pylasu/parsing/parse_tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pylasu.model import Origin, Position, Point
88
from pylasu.model.model import internal_property, Node
99
from pylasu.model.position import Source
10-
from pylasu.support import extension_method
10+
from pylasu.reflection.support import extension_method
1111

1212
import inspect
1313

File renamed without changes.

tests/model/test_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pylasu.model.model import node_property, node_containment
77
from pylasu.model.reflection import Multiplicity, PropertyDescription
88
from pylasu.model.naming import ReferenceByName, Named, Scope, Symbol
9-
from pylasu.support import extension_method
9+
from pylasu.reflection.support import extension_method
1010

1111

1212
@dataclasses.dataclass

0 commit comments

Comments
 (0)