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

text-splitters: add pydocstyle linting #28127

Merged

Conversation

dangiankit
Copy link
Contributor

As seen in #23188, turned on Google-style docstrings by enabling pydocstyle linting in the text-splitters package. Each resulting linting error was addressed differently: ignored, resolved, suppressed, and missing docstrings were added.

Fixes one of the checklist items from #25154, similar to #25939 in core package. Ran make format, make lint and make test from the root of the package text-splitters to ensure no issues were found.

Added a `# noqa: D100` directive to suppress the missing module docstring
error for the `__future__` annotations import. This resolves the linter
issue while maintaining compliance with pydocstyle.
Fixed the following pydocstyle issues:
- D202: Removed blank lines following function docstrings.
- D205: Added a blank line between the summary line and description.
- D209: Ensured multi-line docstring closing quotes are on a separate line.
- D212: Adjusted multi-line docstring summary to start on the first line.
- D212: Ensured multi-line docstring summaries start on the first line.
- D415: Updated the first line of docstrings to end with a period, question mark, or exclamation point.

These changes align the code with PEP 257 guidelines and improve docstring consistency.
…or `__init__`

Resolved the following pydocstyle errors:
- D107: Added a docstring to the `__init__` method to describe its purpose.
- D417: Included a description for the `**kwargs` argument in the `__init__` docstring.

These changes ensure compliance with PEP 257 and improve code clarity by documenting
the constructor and its parameters.
Added a docstring to address the `D101` pydocstyle error, documenting the purpose
and functionality of the affected public class. This ensures compliance with PEP 257
and improves code clarity.
Added missing docstrings to public methods to resolve `D102` pydocstyle errors.
These updates ensure compliance with PEP 257 and improve code documentation
and readability.
Added `# type: ignore[attr-defined]` to suppress the `mypy` error: "PageElement"
has no attribute 'name'. This fix resolves the immediate issue while maintaining
compatibility with BeautifulSoup and ensuring the code passes type checks.
Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Dec 9, 2024 5:55am

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Ɑ: text splitters Related to text splitters package 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs labels Nov 15, 2024
@dangiankit
Copy link
Contributor Author

dangiankit commented Nov 19, 2024

@efriis and @baskaryan Request to address pending PR review and merge.

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Dec 9, 2024
@efriis efriis self-assigned this Dec 9, 2024
@efriis efriis enabled auto-merge (squash) December 9, 2024 05:55
@efriis efriis merged commit 90f162e into langchain-ai:master Dec 9, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging. 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs size:L This PR changes 100-499 lines, ignoring generated files. Ɑ: text splitters Related to text splitters package
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants