Skip to content
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

Optimised and cleaned the code [MRG] #280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

python3-dev
Copy link

Made some minor changes to the code – mostly making some parts of the code more Pythonic and readable – while trying to understand the implementation of Camelot. Great piece of work, and would love to work on more issues/features in the near future. Here is a list of changes which I have made.

camelot/core.py
— Modified the 'for' loops in lines 527-532 to a cleaner and optimised form.

camelot/utils.py
— Added "Accept-Encoding": "gzip;q=1.0, deflate;q=0.9, br;q=0.8, compress;q=0.7, *;q=0.1" to headers in line 86

camelot/handlers.py
— Modified line 38 as self.filepath = download_url(filepath) if is_url(filepath) else filepath

camelot/parsers/lattice.py
— Changed the attribute from 't' to 'table' in the static method _reduce_index() to match the docstring
— Changed the attribute from 't' to 'table' in the static method _copy_spanning_text() and the docstring for consistency across the code, and clarity of usage
— Code optimisations to if conditionals in lines 190-201 to become more Pythonic (Merged adjacent 'if' conditionals with 'and')

@MartinThoma
Copy link
Contributor

Hey!

As camelot is dead, we try to build a maintained fork at pypdf_table_extraction.

Do you want to open the PR against that branch so that we can merge your improvement?

@python3-dev
Copy link
Author

python3-dev commented Feb 27, 2024 via email

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.

None yet

2 participants