Skip to content

Commit 093ce1a

Browse files
authored
imprv: property and enum stub generation (#306)
Generate property stubs with separate getter/setter annotations based on readability, writability, and nullability of the underlying GObject getter/setter. Read-only and write-only props now use @Property and @name.setter respectively, with typing.Never for the unreadable side. Emit enum/flag value type aliases (_NameLiteralType and _NameValueType) so APIs accepting enum values can also accept their string nicks/names, and consolidate the flag/enum builders into a single helper. Fixes #259
1 parent 448dd7d commit 093ce1a

33 files changed

Lines changed: 25092 additions & 7144 deletions

pyproject.toml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,25 @@ exclude = [
6262
[tool.ruff.lint]
6363
select = [
6464
"ANN", # flake8-annotations
65-
"B", # flake8-bugbear
66-
"C4", # flake8-comprehensions
67-
"E", # pycodestyle errors
68-
"EXE", # flake8-executable
69-
"F", # pyflakes
65+
"B", # flake8-bugbear
66+
"C4", # flake8-comprehensions
67+
"E", # pycodestyle errors
68+
"EXE", # flake8-executable
69+
"F", # pyflakes
7070
"I", # isort
71-
"INP", # flake8-no-pep420
72-
"ISC", # flake8-implicit-str-concat
73-
"PIE", # flake8-pie
74-
"PTH", # flake8-use-pathlib
71+
"INP", # flake8-no-pep420
72+
"ISC", # flake8-implicit-str-concat
73+
"PIE", # flake8-pie
74+
"PTH", # flake8-use-pathlib
7575
"PYI", # flake8-pyi
76-
"Q", # flake8-quotes
77-
"RET", # flake8-return
78-
"RSE", # flake8-raise
79-
"SIM", # flake8-simplify
76+
"Q", # flake8-quotes
77+
"RET", # flake8-return
78+
"RSE", # flake8-raise
79+
"SIM", # flake8-simplify
8080
"T10", # flake8-debugger
8181
"TC", # flake8-type-checking
8282
"UP", # pyupgrade
83-
"W", # pycodestyle warnings
83+
"W", # pycodestyle warnings
8484
"RUF", # ruff-specific rules
8585
]
8686
ignore = [
@@ -89,6 +89,7 @@ ignore = [
8989
"PYI019", # Methods like `__or__` should return `typing.Self` instead of a custom `TypeVar`
9090
"PYI021", # Docstrings should not be included in stubs
9191
"PYI026", # Use `typing_extensions.TypeAlias`
92+
"PYI047", # Private `TypeAlias` is never used
9293
"PYI052", # Need type annotation
9394
"PYI054", # Numeric literals with a string representation longer than ten characters are not permitted
9495
"PYI016", # Duplicate union member `None`
@@ -110,3 +111,5 @@ typing = ["_typeshed", "typing", "typing_extensions"]
110111

111112
[tool.pyright]
112113
pythonVersion = "3.10"
114+
115+
reportMissingModuleSource = "none"

0 commit comments

Comments
 (0)