Skip to content

Commit 796f7b5

Browse files
committed
Working on improving specificity of type hinting
1 parent b173faa commit 796f7b5

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
run: uv run pytest -v
4040

4141
- name: Run StubTest
42+
env:
43+
MYPYPATH: ./stubs
4244
run: uv run stubtest pyslang --allowlist allowlist.txt
4345

4446
- name: Test Package Build

src/pyslang-stubs/__init__.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class ASTContext(metaclass=_metaclass):
173173
def evalInteger(self, expr: Any, extraFlags: EvalFlags = ...) -> int | None: ...
174174
def evalPackedDimension(self, syntax: Any) -> EvaluatedDimension: ...
175175
def evalUnpackedDimension(self, syntax: Any) -> EvaluatedDimension: ...
176-
def getRandMode(self, symbol: Any) -> Any: ...
176+
def getRandMode(self, symbol: Any) -> RandMode: ...
177177
def requireBooleanConvertible(self, expr: Any) -> bool: ...
178178
def requireGtZero(self, value: int | None, range: Any) -> bool: ...
179179
@typing.overload
@@ -183,33 +183,33 @@ class ASTContext(metaclass=_metaclass):
183183
def requireNoUnknowns(self, value: Any, range: Any) -> bool: ...
184184
def requirePositive(self, value: Any, range: Any) -> bool: ...
185185
@typing.overload
186-
def requireSimpleExpr(self, expr: Any) -> Any: ...
186+
def requireSimpleExpr(self, expr: Any) -> ExpressionSyntax: ...
187187
@typing.overload
188-
def requireSimpleExpr(self, expr: Any, code: Any) -> Any: ...
188+
def requireSimpleExpr(self, expr: Any, code: Any) -> ExpressionSyntax: ...
189189
@typing.overload
190190
def requireValidBitWidth(self, width: int, range: Any) -> bool: ...
191191
@typing.overload
192192
def requireValidBitWidth(self, value: Any, range: Any) -> int | None: ...
193193
def resetFlags(self, addedFlags: ASTFlags) -> ASTContext: ...
194-
def tryEval(self, expr: Any) -> Any: ...
194+
def tryEval(self, expr: Any) -> ConstantValue: ...
195195
@property
196196
def flags(self) -> ASTFlags: ...
197197
@property
198-
def getCompilation(self) -> Any: ...
198+
def getCompilation(self) -> Compilation: ...
199199
@property
200-
def getInstance(self) -> Any: ...
200+
def getInstance(self) -> InstanceSymbolBase: ...
201201
@property
202-
def getLocation(self) -> Any: ...
202+
def getLocation(self) -> LookupLocation: ...
203203
@property
204-
def getProceduralBlock(self) -> Any: ...
204+
def getProceduralBlock(self) -> ProceduralBlockSymbol: ...
205205
@property
206206
def inAlwaysCombLatch(self) -> bool: ...
207207
@property
208208
def inUnevaluatedBranch(self) -> bool: ...
209209
@property
210210
def lookupIndex(self) -> Any: ...
211211
@property
212-
def scope(self) -> Any: ...
212+
def scope(self) -> Scope: ...
213213

214214
class AbortAssertionExpr(AssertionExpr):
215215
class Action(metaclass=_metaclass):
@@ -231,9 +231,9 @@ class AbortAssertionExpr(AssertionExpr):
231231
Reject: Final = Action.Reject
232232

233233
@property
234-
def action(self) -> Any: ...
234+
def action(self) -> Action: ...
235235
@property
236-
def condition(self) -> Any: ...
236+
def condition(self) -> Expression: ...
237237
@property
238238
def expr(self) -> AssertionExpr: ...
239239
@property
@@ -1596,7 +1596,7 @@ class ConstantValue(metaclass=_metaclass):
15961596
def isTrue(self) -> bool: ...
15971597
def size(self) -> int: ...
15981598
@property
1599-
def value(self) -> typing.Any: ...
1599+
def value(self) -> Any: ...
16001600

16011601
class Constraint(metaclass=_metaclass):
16021602
def __repr__(self) -> str: ...

0 commit comments

Comments
 (0)