Skip to content

Conversation

@flinder
Copy link
Contributor

@flinder flinder commented Jan 7, 2026

Summary:
Code quality improvements for segmentation.py and its tests following Google Python style guide and Python Enhancement Proposals (PEPs):

Logging format (Google style guide 3.10.1):

  • Changed logger.debug() from f-string to %-placeholder format
  • Logging functions should use pattern-strings with %-placeholders as their first argument, not f-strings, because:
    • Logging implementations can collect unexpanded pattern-strings as queryable fields
    • Prevents spending time rendering messages that no logger is configured to output

Docstring formatting (PEP 257 / PEP 8 - 80 character limit):

  • Reformatted get_segment_masks() docstring to comply with 80-character line limit
  • Split long summary line into concise summary + detailed description
  • Wrapped all parameter descriptions to fit within 80 characters
  • Fixed Notes section formatting to use proper indentation (was using NumPy-style ------ separator)

Test naming fixes (PEP 8 - descriptive naming):

  • Fixed typo "nana" → "NaN" in two test function comments (lines 35, 106)
  • Fixed typo "infequent" → "infrequent" in function name:
    test_that_collapse_infrequent_values_collapses_correctly_for_happy_path
  • Fixed typo "numer" → "number" in two function names:
    • test_that_collapse_numeric_values_returns_correct_number_of_values
    • test_that_collapse_numeric_values_returns_correct_number_of_values_with_max_values_1

Reviewed By: flinder

Differential Revision: D90172889

Niek Tax and others added 2 commits January 6, 2026 01:41
Summary: This diff removes internal references to wikis, documentation, code, etc from utils.py and its tests.

Differential Revision: D90120757
Summary:
Code quality improvements for segmentation.py and its tests following Google Python style guide and Python Enhancement Proposals (PEPs):

**Logging format (Google style guide 3.10.1):**
- Changed `logger.debug()` from f-string to %-placeholder format
- Logging functions should use pattern-strings with %-placeholders as their first argument, not f-strings, because:
  - Logging implementations can collect unexpanded pattern-strings as queryable fields
  - Prevents spending time rendering messages that no logger is configured to output

**Docstring formatting (PEP 257 / PEP 8 - 80 character limit):**
- Reformatted `get_segment_masks()` docstring to comply with 80-character line limit
- Split long summary line into concise summary + detailed description
- Wrapped all parameter descriptions to fit within 80 characters
- Fixed Notes section formatting to use proper indentation (was using NumPy-style `------` separator)

**Test naming fixes (PEP 8 - descriptive naming):**
- Fixed typo "nana" → "NaN" in two test function comments (lines 35, 106)
- Fixed typo "infequent" → "infrequent" in function name:
  `test_that_collapse_infrequent_values_collapses_correctly_for_happy_path`
- Fixed typo "numer" → "number" in two function names:
  - `test_that_collapse_numeric_values_returns_correct_number_of_values`
  - `test_that_collapse_numeric_values_returns_correct_number_of_values_with_max_values_1`

Reviewed By: flinder

Differential Revision: D90172889
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 7, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 7, 2026

@flinder has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90172889.

@meta-codesync
Copy link

meta-codesync bot commented Jan 7, 2026

This pull request has been merged in 7a18df8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants