Skip to content

Commit 7ddebe8

Browse files
committed
[py] Fix type annotations
1 parent a847365 commit 7ddebe8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

py/generate.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from pathlib import Path
3838
import re
3939
from textwrap import dedent, indent as tw_indent
40-
from typing import Optional , cast, List, Union, Iterator
40+
from typing import Optional, Self, List, Union, Iterator, cast
4141

4242
import inflection # type: ignore
4343

@@ -393,9 +393,9 @@ def generate_enum_code(self):
393393
def to_json(self) -> str:
394394
return self.value''')
395395

396-
def_from_json = dedent('''\
396+
def_from_json = dedent(f'''\
397397
@classmethod
398-
def from_json(cls, json: str) -> AXValueSourceType:
398+
def from_json(cls, json: str) -> {self.id}:
399399
return cls(json)''')
400400

401401
code = f'class {self.id}(enum.Enum):\n'
@@ -447,9 +447,9 @@ def to_json(self) -> T_JSON_DICT:
447447

448448
# Emit from_json() method. The properties are sorted in the same order
449449
# as above for readability.
450-
def_from_json = dedent('''\
450+
def_from_json = dedent(f'''\
451451
@classmethod
452-
def from_json(cls, json: T_JSON_DICT) -> AXValue:
452+
def from_json(cls, json: T_JSON_DICT) -> {self.id}:
453453
return cls(
454454
''')
455455
from_jsons = []

0 commit comments

Comments
 (0)