-
Notifications
You must be signed in to change notification settings - Fork 354
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
[MRG + 1] Make pep8 #125
[MRG + 1] Make pep8 #125
Conversation
Codecov Report
@@ Coverage Diff @@
## master #125 +/- ##
==========================================
- Coverage 84.28% 84.22% -0.07%
==========================================
Files 12 12
Lines 1203 1198 -5
Branches 288 288
==========================================
- Hits 1014 1009 -5
Misses 145 145
Partials 44 44
Continue to review full report at Codecov.
|
@Oshawk The PR looks great! I had a couple of changes to request (will tag the smaller ones in the review).
Can you give me examples of long URLs and uppercase function variables? Also, please take a look at the contribution guidelines, specifically adding a prefix to the PR title and Capitalizing the commit message. Thanks! |
camelot/__init__.py
Outdated
@@ -1,4 +1,6 @@ | |||
# -*- coding: utf-8 -*- | |||
from .__version__ import __version__ |
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.
[import]
camelot/cli.py
Outdated
@@ -1,18 +1,17 @@ | |||
# -*- coding: utf-8 -*- | |||
from . import __version__ |
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.
[import]
camelot/image_processing.py
Outdated
@@ -43,10 +43,10 @@ def adaptive_threshold(imagename, process_background=False, blocksize=15, c=-2): | |||
|
|||
if process_background: | |||
threshold = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, | |||
cv2.THRESH_BINARY, blocksize, c) | |||
cv2.THRESH_BINARY, blocksize, c) |
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.
[indent]
camelot/image_processing.py
Outdated
@@ -180,7 +180,7 @@ def find_table_joints(contours, vertical, horizontal): | |||
tables = {} | |||
for c in contours: | |||
x, y, w, h = c | |||
roi = joints[y : y + h, x : x + w] | |||
roi = joints[y: y + h, x: x + w] |
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.
pep8 suggests the earlier version.
camelot/image_processing.py
Outdated
@@ -263,13 +263,13 @@ def find_cuts(threshold, char_size_scaling=200): | |||
|
|||
try: | |||
__, contours, __ = cv2.findContours(threshold, cv2.RETR_EXTERNAL, | |||
cv2.CHAIN_APPROX_SIMPLE) | |||
cv2.CHAIN_APPROX_SIMPLE) |
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.
[indent]
camelot/parsers/lattice.py
Outdated
@@ -183,7 +183,7 @@ def _generate_image(self): | |||
else: | |||
gs_call.insert(0, "gsc") | |||
subprocess.call(gs_call, stdout=open(os.devnull, 'w'), | |||
stderr=subprocess.STDOUT) | |||
stderr=subprocess.STDOUT) |
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.
[indent]
camelot/parsers/lattice.py
Outdated
@@ -320,9 +320,9 @@ def extract_tables(self, filename): | |||
_tables = [] | |||
# sort tables based on y-coord | |||
for table_idx, tk in enumerate(sorted(self.table_bbox.keys(), | |||
key=lambda x: x[1], reverse=True)): | |||
key=lambda x: x[1], reverse=True)): |
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.
[indent]
camelot/parsers/stream.py
Outdated
@@ -358,9 +358,9 @@ def extract_tables(self, filename): | |||
_tables = [] | |||
# sort tables based on y-coord | |||
for table_idx, tk in enumerate(sorted(self.table_bbox.keys(), | |||
key=lambda x: x[1], reverse=True)): | |||
key=lambda x: x[1], reverse=True)): |
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.
[indent]
tests/test_common.py
Outdated
@@ -49,7 +49,7 @@ def test_lattice(): | |||
df = pd.DataFrame(data_lattice) | |||
|
|||
filename = os.path.join(testdir, | |||
"tabula/icdar2013-dataset/competition-dataset-us/us-030.pdf") | |||
"tabula/icdar2013-dataset/competition-dataset-us/us-030.pdf") |
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.
[indent]
Will do this tomorrow! |
There are lots of capital letters in core.py. E.g. Also really sorry for not capitulating the commits. Did not notice that part until they were made. |
Yeah, kept them uppercase to signify that they're counterparts of the same lowercase letters. (J <-> j)
No worries, you can still reword the commit if you want. Check this GitHub article for how to do that. Thanks for the changes, I'll merge this after I merge the other tests PR. I suspect that some things might break, but I'll look into that! |
Add new line at end of file, fix bare except, remove unused import.
Add some newlines at and of files and a visual indent.
Fix block comments and add new lines at end of files.
Fixed unused import, a few weirdly ordered imports, a docstring typo and many new lines at the end of lines.
Fix import order and remove a couple more unused imports.
Fix indentation (no opening delimiter alignment).
@Oshawk Thanks for the contribution! |
@vinayak-mehta You are welcome! Glad to help. |
Have tried to adhere to pep8 but kept things that looked like a stylistic decision or or things like long URLs that can't really be changed.
A couple of things I have not done:
shift_text
argument of__init__
inLattice
to a tuple as lists are mutable and thus bad practice (again, not sure what it might break).