-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Hinty] Type hinting automaton.py #3391
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3391 +/- ##
==========================================
- Coverage 85.28% 85.27% -0.01%
==========================================
Files 277 277
Lines 57135 57192 +57
==========================================
+ Hits 48728 48771 +43
- Misses 8407 8421 +14
|
How did the % on files that I didn't change get affected? |
Don't care about it. Codecov has some instability. |
You need to add |
Added, noticed flake had some things to say about my hints too. |
Cleared out a couple hundred errors that mypy threw out, was nice to learn that there was a thing that would help with checking the type annotations. Made some notes along the way because there's some particularly hairy ones that I haven't gotten to resolving yet, some of which might involve changing other files. Pasting below:
|
Thats some very solid work thanks a lot ! I have a trick for the |
Used ansmachine.py as initial reference, grepped into some other files along the way. Some notes taken while adding the hints: add_breakpoints returns None Unsure of object type that could have fileno() on 609 645 assumed from rd and wr from the above class
@@ -21,7 +21,7 @@ | |||
open_test_sockets = list() # type: List[TestSocket] | |||
|
|||
|
|||
class TestSocket(ObjectPipe, object): | |||
class TestSocket(ObjectPipe[Packet], SuperSocket): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've tested this, but than decided to implement the Supersocket functions directly, since I had problems with the close function. Maybe that's fixed now, I just wanted to mention this, in case of strange bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was indeed super buggy but I think I figured it out, it needed an overwrite of the recv()
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the previous ping btw 😅
Your welcome. I was searching for the question, but couldn't find it.
--
Viele Grüße
Nils Weiß
On November 1, 2021 10:48:16 PM GMT+01:00, gpotter2 ***@***.***> wrote:
***@***.*** commented on this pull request.>
…>
>
>
> @@ -21,7 +21,7 @@>
open_test_sockets = list() # type: List[TestSocket]>
>
>
-class TestSocket(ObjectPipe, object):>
+class TestSocket(ObjectPipe[Packet], SuperSocket):>
>
Sorry for the previous ping btw 😅 >
>
-- >
You are receiving this because you were mentioned.>
Reply to this email directly or view it on GitHub:>
#3391 (comment)
|
Also, select or select_objects made a problem. But again, maybe it's all fixed now. Just to keep in mind.
--
Viele Grüße
Nils Weiß
On November 1, 2021 10:47:54 PM GMT+01:00, gpotter2 ***@***.***> wrote:
***@***.*** commented on this pull request.
…
> @@ -21,7 +21,7 @@
open_test_sockets = list() # type: List[TestSocket]
-class TestSocket(ObjectPipe, object):
+class TestSocket(ObjectPipe[Packet], SuperSocket):
This was indeed super buggy but I think I figured it out, it needed an
overwrite of the `recv()` function
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#3391 (comment)
|
@guedou This is ready for review. There is mostly pipetools and arch left |
|
||
def select_objects(inputs, remain): | ||
# type: (List[Any], Union[float, int, None]) -> List[Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use a stricter type than Any here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears python itself isn't sure how to type this better: https://github.com/python/typeshed/blob/994b69ef8f18e76689daca3947879c3d7f76173e/stdlib/select.pyi#L28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too bad =/
* Type hinting automaton.py Used ansmachine.py as initial reference, grepped into some other files along the way. Some notes taken while adding the hints: add_breakpoints returns None Unsure of object type that could have fileno() on 609 645 assumed from rd and wr from the above class * Various typing fixes Co-authored-by: gpotter2 <[email protected]>
Used ansmachine.py as initial reference, Looked at some other files that I grepped into along the way.
Some notes taken while adding the hints:
add_breakpoints() returns None
Unsure of object type that could have fileno() on 609
645 assumed from rd and wr from the above class
Part of the long series of commits to work towards completion of #2158
Tests fail on my branch, but the error message seems unrelated to the file I changed, and I tried committing just a copy of master and that fails too so I guess it's just some teething issue in master