-
Notifications
You must be signed in to change notification settings - Fork 45
chore(deps): bump nltk from 3.8.1 to 3.9.1 fix unit tests for dependabot/pip/nltk-3.9 branch #51
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
Merged
Aldo Gonzalez (aldogonzalez8)
merged 5 commits into
dependabot/pip/nltk-3.9
from
dependabot/pip/nltk_bump_debugging/debugging
Nov 18, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c7b7944
airbyte-cdk: trying to fix unit tests
aldogonzalez8 a83c0f7
airbyte-cdk: download dependencies if missing punk_tan or punkt
aldogonzalez8 70742a6
airbyte-cdk: ruff fix
aldogonzalez8 fb545f8
airbyte-cdk: fix mypy and update .gitignore
aldogonzalez8 b79ad21
airbyte-cdk: fix ruff
aldogonzalez8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,4 +12,5 @@ dist | |
| .mypy_cache | ||
| .venv | ||
| .pytest_cache | ||
| .idea | ||
| **/__pycache__ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,11 +35,19 @@ | |
| FileType, | ||
| detect_filetype, | ||
| ) | ||
| import nltk | ||
|
|
||
| unstructured_partition_pdf = None | ||
| unstructured_partition_docx = None | ||
| unstructured_partition_pptx = None | ||
|
|
||
| try: | ||
| nltk.data.find("tokenizers/punkt.zip") | ||
| nltk.data.find("tokenizers/punkt_tab.zip") | ||
| except LookupError: | ||
| nltk.download("punkt") | ||
| nltk.download("punkt_tab") | ||
|
|
||
|
|
||
| def optional_decode(contents: Union[str, bytes]) -> str: | ||
| if isinstance(contents, bytes): | ||
|
|
@@ -162,6 +170,10 @@ def parse_records( | |
| logger.warn(f"File {file.uri} cannot be parsed. Skipping it.") | ||
| else: | ||
| raise e | ||
| except Exception as e: | ||
| exception_str = str(e) | ||
| logger.error(f"File {file.uri} caused an error during parsing: {exception_str}.") | ||
| raise e | ||
|
|
||
| def _read_file( | ||
| self, | ||
|
|
@@ -186,7 +198,7 @@ def _read_file( | |
| remote_file, | ||
| self._get_file_type_error_message(filetype), | ||
| ) | ||
| if filetype in {FileType.MD, filetype is FileType.TXT}: | ||
| if filetype in {FileType.MD, FileType.TXT}: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
| file_content: bytes = file_handle.read() | ||
| decoded_content: str = optional_decode(file_content) | ||
| return decoded_content | ||
|
|
@@ -418,7 +430,12 @@ def _render_markdown(self, elements: List[Any]) -> str: | |
|
|
||
| def _convert_to_markdown(self, el: Dict[str, Any]) -> str: | ||
| if dpath.get(el, "type") == "Title": | ||
| heading_str = "#" * (dpath.get(el, "metadata/category_depth", default=1) or 1) | ||
| category_depth = dpath.get(el, "metadata/category_depth", default=1) or 1 | ||
| if not isinstance(category_depth, int): | ||
| category_depth = ( | ||
| int(category_depth) if isinstance(category_depth, (str, float)) else 1 | ||
| ) | ||
| heading_str = "#" * category_depth | ||
|
Comment on lines
+433
to
+438
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👍 |
||
| return f"{heading_str} {dpath.get(el, 'text')}" | ||
| elif dpath.get(el, "type") == "ListItem": | ||
| return f"- {dpath.get(el, 'text')}" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nice.