-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add a setup.py file #2
Comments
Thanks for the suggestion! I followed your suggestions to make this change, and started making fixes as recommended by pylint. There are many more to address (and in an ideal world I would also make this python 3 compatible), but that will have to wait for another day. |
Awesome! Thanks for replying so quickly :-D I'm glad you like the suggestions. Another one I'd recommend is using python classes instead of dicts for storing info, e.g. here def gen_missing_successor(ctree, error):
# ...
info = {
'type': 'add',
'label': get_label(nnode),
'span': nnode.span,
'subtrees': [get_label(subtree) for subtree in nnode.subtrees],
'parent': nnode.parent.label,
# etc...
}
# ... Becomes: class Transform:
def __init__(self, nnode, ttype)
self.type = ttype
self.label = get_label(nnode)
self.span = nnode.span
self.subtrees = [get_label(subtree) for subtree in nnode.subtrees]
self.parent = nnode.parent.label
# etc...
def gen_missing_successor(ctree, error):
# ...
info = Transform(nnode, ttype='add')
# ... |
Yeah... that was definitely a case of a quick and dirty solution that grew and grew. |
Ha! I know that phenomena all too well. Using dictionaries that way is very "Perl style" (as is quick 'n dirty). I thought maybe you were be a Perl hacker writing Python. |
I've written practically no Perl actually, but with sufficiently little effort poor programming style can be achieved in any language :) |
Thanks for the great package. In an effort to make the package easier to use, I'd strongly recommend making it a python package by simply adding a
setup.py
file, which should (minimally) look like:Note: It's conventional rename the
src
directory to the name of the project, e.g.,berkeley_parse_analyser
.It would also be a good idea to run this code through pylint and the pep8 coding style checker (which pylint will do for you).
The text was updated successfully, but these errors were encountered: