-
Notifications
You must be signed in to change notification settings - Fork 8
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
🔧 MAINTAIN: Add typing #113
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #113 +/- ##
===========================================
- Coverage 99.80% 99.68% -0.13%
===========================================
Files 7 7
Lines 1553 1585 +32
===========================================
+ Hits 1550 1580 +30
- Misses 3 5 +2
Continue to review full report at Codecov.
|
a8af7c8
to
f902178
Compare
cb7491d
to
06318c5
Compare
- Remove `@property` from `seekable` method (as per BinaryIO) - Disallow mode in `LazyOpen` (should always be readable binary)
06318c5
to
7c8f994
Compare
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.
Hey, I think this all looks good!
My only question is if it would be possible to separate the addition of type checking from the other changes enumerated in the description or if there is something specific preventing this. Ideally I would have made a PR for each of these two sets of changes, but if that is a bit too much work I would say having two separate commits on this PR should be enough.
@ramirezfranciscof thanks for the review, but the other changes were specifically added to fix typing issues i.e. without them the type checking fails. So it doesn’t make sense to split them |
Ah, really? That is very surprising. Can you tell me what kind of problem you were getting for each of those three changes? I'll be very interested in understanding how the typing affects that, since I'm trying to incorporate it myself when I'm coding and may run into these too 😅 . On the other hand, perhaps it was wrong of me to limit my comment to "the other changes enumerated in the description", as there are also a couple of modifications that were not mentioned there but I was also referring to. For example, there is a modification in the |
any changes were because of type checking |
All these changes are because |
Ah, ok, I see, so these are to fix the interface of However, if this were modifications made "in preparation" for the type checking, this does not prevent us to have them in a first commit and then have a second one for just the type checking. I do agree now that it makes sense to have these on the same PR, but I still think the two commits are valuable to keep separated everything that is behavior-modifying, which would make it much easier to review (meaning not only for reviewing like what I'm doing now, since it is now a bit too late for that, haha, but I mean for revisiting in general if at some point in the future there is any need to debug or understand anything related to these changes). |
if instance attributes are set dynamically, I.e in sonde if statements, it means they may not be set and mypy cannot statically determine that. Basically you should generally always set instance attributes with a default value |
if have to disagree with this I’m afraid; they made because of typing check failures, not in preparation. The commit would not be reviewable in isolation, since it would claim to fix typing issues that were not yet tested |
I mean, yeah, I agree that this was the actual order in which things happened / reason why the changes were made. What I am saying is that conceptually the changes can make sense separated ("adapting the interface to comply with |
Ah dude, I completely disagree; it won't provide any measurable benefit, its just overcomplicating things But its really not worth falling out over lol, so my comprise is that I've made this commit and rebased the PR on it: 2d2d32c |
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.
Mmm ok; I still don't understand what would be the overcomplication here (the two resulting commits should each be simpler than the compound). But I'll agree to the second part, and for the sake of expediency I'll take the compromise.
Thanks 🙏 |
currently based on top of #112@property
fromseekable
method (as per BinaryIO)LazyOpen
(should always be readable binary)add__enter__
/__exit__
methods toPackedObjectReader
,CallbackStreamWrapper
,ZlibLikeBaseStreamDecompresser
, so they won't fail inadd_streamed_objects_to_pack
withopen_streams=True
Come across this issue for
get_objects
/get_object_stream_and_meta
: pylint-dev/pylint#3233Types initially generated with https://github.com/Instagram/MonkeyType