Skip to content

Commit d176efe

Browse files
committed
bump
1 parent 1d13c0e commit d176efe

File tree

3 files changed

+293
-78
lines changed

3 files changed

+293
-78
lines changed

ast_generic_v1.py

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5807,15 +5807,15 @@ def to_json_string(self, **kw: Any) -> str:
58075807
class ImportFrom:
58085808
"""Original type: directive = [ ... | ImportFrom of ... | ... ]"""
58095809

5810-
value: Tuple[Tok, ModuleName, List[Tuple[Alias, Optional[Alias]]]]
5810+
value: Tuple[Tok, ModuleName, List[ImportFromKind]]
58115811

58125812
@property
58135813
def kind(self) -> str:
58145814
"""Name of the class representing this variant."""
58155815
return 'ImportFrom'
58165816

58175817
def to_json(self) -> Any:
5818-
return ['ImportFrom', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), _atd_write_list((lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)]
5818+
return ['ImportFrom', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), _atd_write_list((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)]
58195819

58205820
def to_json_string(self, **kw: Any) -> str:
58215821
return json.dumps(self.to_json(), **kw)
@@ -5945,7 +5945,7 @@ def from_json(cls, x: Any) -> 'Directive':
59455945
if isinstance(x, List) and len(x) == 2:
59465946
cons = x[0]
59475947
if cons == 'ImportFrom':
5948-
return cls(ImportFrom((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), _atd_read_list((lambda x: (Alias.from_json(x[0]), _atd_read_nullable(Alias.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1])))
5948+
return cls(ImportFrom((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), _atd_read_list(ImportFromKind.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1])))
59495949
if cons == 'ImportAs':
59505950
return cls(ImportAs((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), _atd_read_nullable(Alias.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1])))
59515951
if cons == 'ImportAll':
@@ -7331,6 +7331,74 @@ def from_json_string(cls, x: str) -> 'IdInfo':
73317331
def to_json_string(self, **kw: Any) -> str:
73327332
return json.dumps(self.to_json(), **kw)
73337333

7334+
@dataclass
7335+
class Direct:
7336+
"""Original type: import_from_kind = [ ... | Direct of ... | ... ]"""
7337+
7338+
value: Alias
7339+
7340+
@property
7341+
def kind(self) -> str:
7342+
"""Name of the class representing this variant."""
7343+
return 'Direct'
7344+
7345+
def to_json(self) -> Any:
7346+
return ['Direct', (lambda x: x.to_json())(self.value)]
7347+
7348+
def to_json_string(self, **kw: Any) -> str:
7349+
return json.dumps(self.to_json(), **kw)
7350+
7351+
7352+
@dataclass
7353+
class Aliased:
7354+
"""Original type: import_from_kind = [ ... | Aliased of ... | ... ]"""
7355+
7356+
value: Tuple[Ident, Alias]
7357+
7358+
@property
7359+
def kind(self) -> str:
7360+
"""Name of the class representing this variant."""
7361+
return 'Aliased'
7362+
7363+
def to_json(self) -> Any:
7364+
return ['Aliased', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)]
7365+
7366+
def to_json_string(self, **kw: Any) -> str:
7367+
return json.dumps(self.to_json(), **kw)
7368+
7369+
7370+
@dataclass
7371+
class ImportFromKind:
7372+
"""Original type: import_from_kind = [ ... ]"""
7373+
7374+
value: Union[Direct, Aliased]
7375+
7376+
@property
7377+
def kind(self) -> str:
7378+
"""Name of the class representing this variant."""
7379+
return self.value.kind
7380+
7381+
@classmethod
7382+
def from_json(cls, x: Any) -> 'ImportFromKind':
7383+
if isinstance(x, List) and len(x) == 2:
7384+
cons = x[0]
7385+
if cons == 'Direct':
7386+
return cls(Direct(Alias.from_json(x[1])))
7387+
if cons == 'Aliased':
7388+
return cls(Aliased((lambda x: (Ident.from_json(x[0]), Alias.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1])))
7389+
_atd_bad_json('ImportFromKind', x)
7390+
_atd_bad_json('ImportFromKind', x)
7391+
7392+
def to_json(self) -> Any:
7393+
return self.value.to_json()
7394+
7395+
@classmethod
7396+
def from_json_string(cls, x: str) -> 'ImportFromKind':
7397+
return cls.from_json(json.loads(x))
7398+
7399+
def to_json_string(self, **kw: Any) -> str:
7400+
return json.dumps(self.to_json(), **kw)
7401+
73347402
@dataclass
73357403
class Item:
73367404
"""Original type: item"""

0 commit comments

Comments
 (0)