Closed
Conversation
This commit includes fixes for a subset of pydocstyle `D` rule violations, primarily focusing on: - D401: Ensuring the first line of docstrings is in the imperative mood. - D100/D102/D104/D107: Adding missing docstrings for modules, methods, packages, and __init__ methods. - D205: Ensuring one blank line between summary and description. - D301: Using raw string literals for docstrings with backslashes. - D417: Adding missing argument descriptions. - D418: Addressed by ensuring overloads have docstrings as per specific prompt instructions. Files addressed so far include: - docs/conf.py - tsercom/__init__.py - Various files under tsercom/api/ - Various files under tsercom/caller_id/ - Various files under tsercom/data/ Further work is pending to address all remaining `D` rule violations across the codebase. Static analysis: - `black .` passes. - `mypy tsercom/` has pre-existing errors; no new errors were introduced by these changes. Unused `type: ignore` comments were removed. - `ruff check . --select D` will be fully addressed in subsequent commits. Testing: - `pytest --timeout=120` (run via `PYTEST_TIMEOUT=120 python -m pytest`) passed twice with 970 tests passing, 11 skipped, and 13 warnings. No new test failures were introduced. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit addresses multiple aspects of codebase health:
1. **Test Failures:**
* Resolved 3 failing tests in `tsercom/runtime_e2etest.py` related to out-of-process error propagation and handling. The fixes involved improving synchronization using `multiprocessing.Event` to ensure child process errors are reliably detected by the parent `RuntimeManager`. Affected tests:
* `test_out_of_process_error_check_for_exception`
* `test_out_of_process_error_run_until_exception`
* `test_out_of_process_initializer_create_error`
2. **Overload Docstrings:**
* Ensured all functions using `@typing.overload` (aliased as `@overload`) have complete Google-style docstrings for each individual overload signature and for the main implementation. This involved adding or verifying docstrings in files such as:
* `tsercom/api/runtime_handle.py`
* `tsercom/runtime/runtime_data_handler.py`
* `tsercom/runtime/runtime_data_handler_base.py`
* `tsercom/tensor/demuxer/stream_receiver.py`
* `tsercom/tensor/muxer/aggregate_tensor_multiplexer.py`
* Files like `tsercom/data/remote_data_aggregator.py`, `tsercom/data/remote_data_aggregator_impl.py`, `tsercom/discovery/discovery_host.py`, `tsercom/runtime/endpoint_data_processor.py`, and `tsercom/runtime/id_tracker.py`, `tsercom/runtime/runtime_config.py` were reviewed and found to already have compliant overload documentation.
3. **Ruff Issues:**
* Added `D418` (Function decorated with @overload is missing a docstring) to the ignore list in `pyproject.toml` as the main implementation docstrings are intentionally brief when overloads are fully documented.
* Ran `ruff check . --fix` to automatically correct applicable issues.
* Manually addressed remaining Ruff violations, including:
* `E501` (Line too long) by shortening docstrings, comments, and code lines.
* `D401` (First line of docstring should be in imperative mood).
* Other `D` series docstring convention errors (D100, D101, D102, D103, D105, D107, D203, D205, D210, D211, D212, D213, D404, D413, D417).
* `W293` (Blank line contains whitespace).
* Corrected syntax errors that were inadvertently introduced during manual E501 fixes by ensuring docstrings were properly formatted.
* The codebase now passes `ruff check .` cleanly.
4. **Static Analysis and Verification:**
* Ran `black .` to format the code.
* `mypy tsercom/` was run; identified errors were pre-existing and not introduced by these changes.
* The full test suite (`pytest --timeout=120`) was run twice successfully after all changes to ensure no regressions.
This work improves test reliability, documentation quality, and code style adherence across the `tsercom/` codebase.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.