Repository navigation
Code style: _kit/ without comments, its long functions split up - #91
Merged
Merged
Conversation
Every # comment in _kit/ is gone: what it said is in a docstring now (a dataclass's fields, a module's limits, why a helper does what it does), or in a name (_FILTER_MIN_ROWS, _SCROLL_ROWS, _LINE_EVERY, _source_offset). The functions over ruff's limits are split into steps: - render._table_html reads as its steps: the columns' texts, which ones sort and filter, the header and body cells, the Columns menu, the filters, and the frame around them, each a helper of its own. - view._BaseView._progress keeps its state on a _ProgressLine instead of closures over one-item lists; the line prints through the View (_progress_to_terminal), so rules.py's print rule holds. - window._Explorer._later keeps a background job as a _Job and runs it with _run_now or _run_in_background. - fmt._zone_from hands offsets to _offset_zone and names to _named_zone; highlight._python_html's colours come from _python_css. The broad excepts that are guards on purpose (a widget callback's error said in the window, tqdm falling back to the plain line) carry noqa: BLE001, and _kit/ is off ruff.toml's per-file-ignores and tests/test_style.py's comment allowances. Every report renders as before (snapshot.py compare: only the known traceback line numbers in lambda-how-it-works differ). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Step 3 of the code style work, for
_kit/. Stacked on #90: this PR targets that branch. Merge #90 first, and GitHub will retarget this one tomain.What changed
Comments. All 136
#comments in_kit/are gone. What each one said now lives in one of two places:_FILTER_MIN_ROWS,_SCROLL_ROWS,_SHORT_CELL,_LINE_EVERY,_PATH_CHARACTERS,_source_offset, ...What's left is directives:
noqa, plus the onetype: ignorethat was already there.Long functions split into steps:
render._table_html: 120 lines, complexity 21_column_texts,_table_sorts,_header_html,_cell_td,_row_attributes,_columns_menu,_filter_controlsand_table_frameview._BaseView._progress: closures over one-item lists (bar[0],started[:])_ProgressLineclass withtick,_update_bar,_update_lineandclear. It writes to the terminal through_BaseView._progress_to_terminal, so rules.py's "only the View prints" rule still holdswindow._Explorer._later: complexity 13, an inner coroutine_Jobrecord, run by_run_nowor_run_in_backgroundfmt._zone_from: complexity 11_offset_zoneand_named_zone(with_zone_places)highlight._python_html: complexity 13_python_cssIntentional broad excepts. These are guards on purpose and carry
# noqa: BLE001: a widget callback's error is shown in the window, a background job's error goes to itsfailedhandler, and tqdm falls back to the plain progress line. Two constructors whose parameters really belong together carry# noqa: PLR0913:_JsonTreeand_Picker._kit/comes off both allowance lists,ruff.toml'sper-file-ignoresandtests/test_style.py'sCOMMENTS_LEFT, so from now on it's held to every rule.Nothing a user sees changed
snapshot.py compareagainst the baseline shows 319 of 321 outputs identical, no names lost, and the same AWS operations. The two differences are the knownsnapshot.pytraceback line numbers forlambda-how-it-works, which already fails on main (see Code style: docstrings on their own lines, and checks that keep the rules #90).check/run.pypasses: ruff, imports, package, rules (0 errors), and pytest with 1,164 passed and 16 skipped.viewmod._progress_bar_class,time.monotonic,x._tasksandx._said.No CHANGELOG entry: nothing a user sees changes.
🤖 Generated with Claude Code