Improving type system for pyperf library - #257
DebanKsahu wants to merge 4 commits into
Conversation
|
I understood that having wrong type annotations can be worse than not having type annotations. We should check if type annotations are correct using a tool (such as mypy) to make sure that they remain correct when the code will evolve. What is your plan to check type annotations? Does this PR add all type annotations? Or do you plan further changes? |
|
I am planning to add all type annotations in this PR only. For the testing part I am planning to use |
|
Would it be possible to include the type check integration in this change? Otherwise, I don't know how to test this change locally. How can I test that the added type annotations are correct? |
|
Yeah, I was planning to add type checking test at the end but, as you said I will add those test in the next commit. Should I go with Pyrefly? |
As you want, I don't have any preference. |
|
I suggest using two or more type checkers (e.g., |
Sure then, I will go with |
Description
_utils.py
tdist95conf_levelfunction the doc string clearly mention thatdfmeans degree of freedom and expected to be aintthat's why I type annotated it withint. Now thattdist95conf_levelshowing that it required aint degree of freedom so there no need fordf = int(round(df))` as it's now user's reponsibility to pass correct value.pooled_sample_variance,tscoreandis_significantall required input of typeSequence[float]because the inputs are iterated over many time so we can't accept anIterable[float]because it will exhaust the base list.Fixes #255