mirror of https://github.com/KLayout/klayout.git
Merge pull request #1763 from KLayout/better_pyi
.pyi files work slightly better with these changes. Also: regeneratin…
This commit is contained in:
commit
8145e3db57
|
|
@ -55,7 +55,7 @@ echo "Generating stubs for tl .."
|
|||
$python $inst/stubgen.py tl >$pyi_srcdir/tlcore.pyi
|
||||
|
||||
echo "Generating stubs for db .."
|
||||
$python $inst/stubgen.py db tl >$pyi_srcdir/dbcore.pyi
|
||||
$python $inst/stubgen.py db tl,lay,rdb >$pyi_srcdir/dbcore.pyi
|
||||
|
||||
echo "Generating stubs for rdb .."
|
||||
$python $inst/stubgen.py rdb tl,db >$pyi_srcdir/rdbcore.pyi
|
||||
|
|
|
|||
|
|
@ -192,6 +192,10 @@ class Stub:
|
|||
stub.format_stub(include_docstring=include_docstring), " " * 4
|
||||
)
|
||||
|
||||
if self.indent_docstring and (include_docstring or len(self.child_stubs)):
|
||||
stub_str += "\n"
|
||||
stub_str += indent("...", " " * 4)
|
||||
|
||||
return stub_str
|
||||
|
||||
|
||||
|
|
@ -369,7 +373,8 @@ def get_py_methods(
|
|||
# Exceptions:
|
||||
# For X.__eq__(self, a:X), treat second argument as type object instead of X
|
||||
if name in ("__eq__", "__ne__"):
|
||||
arg_list[1] = arg_list[1][0], "object"
|
||||
if arg_list[1][1].cls() is not None and arg_list[1][1].cls().__gsi_id__ == c.__gsi_id__:
|
||||
arg_list[1] = arg_list[1][0], "object"
|
||||
# X._assign(self, other:X), mypy complains if _assign is defined at base class.
|
||||
# We can't specialize other in this case.
|
||||
elif name in ("_assign", "assign"):
|
||||
|
|
@ -454,6 +459,7 @@ def get_module_stubs(module: str) -> List[ClassStub]:
|
|||
def print_mod(module, dependencies):
|
||||
print("from typing import Any, ClassVar, Dict, Sequence, List, Iterator, Optional")
|
||||
print("from typing import overload")
|
||||
print("from __future__ import annotations")
|
||||
for dep in dependencies:
|
||||
print(f"import klayout.{dep} as {dep}")
|
||||
for stub in get_module_stubs(module):
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Any, ClassVar, Dict, Sequence, List, Iterator, Optional
|
||||
from typing import overload
|
||||
from __future__ import annotations
|
||||
import klayout.tl as tl
|
||||
import klayout.db as db
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue