Skip to content

PR for retroactive code review#1

Open
bw2 wants to merge 20 commits intoemptyfrom
master
Open

PR for retroactive code review#1
bw2 wants to merge 20 commits intoemptyfrom
master

Conversation

@bw2
Copy link
Copy Markdown
Contributor

@bw2 bw2 commented May 23, 2017

This PR covers all code in the initial version of obo_parser

Copy link
Copy Markdown

@konradjk konradjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are super nit-picky changes. NB: I've only gone through for style and a vague understanding of what the code is generally doing. I haven't dug in fully or tested anything.

Comment thread obo_parser.py Outdated
}


def convert_obo_to_tsv(input_path, output_path="-", root_id=None, add_category_column=False):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like - in a function signature. I'd suggest actually using output_path=sys.stdout instead as the default. And then later checking if output_path is already a file handle. Alternatively, just say output_path="stdout"

Comment thread tests/test_other_functions.py Outdated
import sys
import unittest

if sys.version_info > (3, 0):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should probably be >= in all places

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Comment thread obo_parser.py

# remove new-line character and any comments
line = line.rstrip('\n').split("!")[0]
if len(line) == 0:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like if not len(line) but doesn't really matter too much.

Copy link
Copy Markdown
Contributor Author

@bw2 bw2 May 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think len(line) == 0 is more readable vs. "not length"

Comment thread obo_parser.py Outdated
continue

# remove new-line character and any comments
line = line.rstrip('\n').split("!")[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is whitespace generally important on the edges? Generally, line.strip() will catch any other weird whitespace issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Comment thread obo_parser.py


if __name__ == "__main__":
p = argparse.ArgumentParser(description="Parse an .obo file and write out a .tsv table")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's just a parser, but I still don't really like single letter variable (outside of lambdas)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you usually call it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants