-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix #2, modernize and support plain import #3
Conversation
@altendky , do you feel like taking a look at this? |
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'm unlikely to get to a detailed review here, but did scan through it quickly and left a couple minor comments.
pygrep/__init__.py
Outdated
class IdentVisitor(ast.NodeVisitor): | ||
def __init__(self, path, ident, callback): | ||
class IdentVisitor: | ||
def __init__(self, ident: str): | ||
super(IdentVisitor, self).__init__() |
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.
In so much as you want to keep this around, this fits into a 2->3 conversion pattern. I think technically everything should super init, but we usually don't bother...
super(IdentVisitor, self).__init__() | |
super().__init__() |
yield (path, *t) | ||
|
||
|
||
def main(): |
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.
If you want to make pygrep 'more runnable', you may want a pygrep/__main__.py
. That's what would be run for python -m pygrep
, for example. It could consist of nothing more than import pygrep; pygrep.main()
.
Quite a bit of stuff from back then changed.
Also add support for regular
import foo.bar
, and, well, tests.