-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Pcapreader() does not work with PosixPath and WindowsPath fix #3596 #3597
Conversation
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.
Thanks for this fix. I think we can (should?) use os.PathLike
here. What do you think?
I didn't know about |
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.
OK now the return type has changed, since filename might be an os.PathLike
object. Also it seems that you have to specify something like PathLike[Any]
(meaning either PathLike[str]
or PathLike[bytes]
).
Anyway, not sure it was a good idea after all, since Python 2.7 lacks |
Codecov Report
@@ Coverage Diff @@
## master #3597 +/- ##
==========================================
+ Coverage 86.19% 86.21% +0.02%
==========================================
Files 284 296 +12
Lines 64874 67082 +2208
==========================================
+ Hits 55915 57832 +1917
- Misses 8959 9250 +291
|
Sorry, I think it is better to come back to your first option, it was better since it would have worked with Python 2 directly, am I wrong? |
Unsure this PR is really necessary: there are quite a few ways to get the full absolute path from the |
@gpotter2 your call |
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.
- PR doesn't pass both PEP8 and Mypy tests
- I said
scapy.compat
, not scapy.libs.six because we regularly update it so any changes in there would be lost. - PR is wrong because:
filename = fname
is wrong in case of anos.PathLike
... it's not the filename anymore- you can't just change the return type of
filename
toUnion[...]
just to make it pass the tests, you need to actually fix it
(As for the doc build failure: sphinx-doc/sphinx#10710) |
I am unsure this PR is necessary. |
I kinda agree. Are we really going to update every function in Scapy to support path stuff, when in one call you can get the absolute path |
I am closing this PR as Scapy maintainers seem that it is not necessary. |
Pcapreader()
works fine even if the providedfilename
is in PosixPath or WindowsPath type. Fix #3596I don't know if this PR requires unit tests. If it does, then please guide me where they can be added.