Modernize the rest of chunk and opcode generators and differ base.
Review Request #14503 — Created July 11, 2025 and updated
This change finishes up modernization of the
chunk_generator
,
differ
, andopcode_generator
files in the diffviewer. For the most
part this just involves fixing up docstrings and adding type hints.The one functional change in here is a fix for a subtle bug that I
discovered when working through this: when computing headers, we were
subtracting 1 from the end line numbers of the chunk twice: once in
_new_chunk
, and once in_get_interesting_headers
. This meant we'd
stop iterating one line too soon. We obviously didn't notice any bugs in
practice, but it's possible that it was affecting the header
computation, especially for chunks that are only a single line.
- Ran unit tests.
- Smoke tested a bunch of diffs.
Summary | ID |
---|---|
zwkyoovslsqxvknqzpzmtqmpummrntmn |
Description | From | Last Updated |
---|---|---|
Let's make <div> a code literal. |
|
|
Might be a nice time to make these keyword-only. |
|
|
And here. |
|
|
Let's use str(). It's faster than an f-string that just turns into a str(). |
|
|
This can now use the {..., **...} syntax. |
|
|
Mising a period (old bug). |
|
|
We might as well just append [1], since we're not using the variable. |
|
|
Raises comes after Returns. |
|
|
This needs to be the full class path. |
|
|
Not that anyone should hit this, but we might as well localize it. |
|
|
This can be simplified to: self.groups = groups or [] |
|
|
Looks like there's an off-by-one alignment issue here. |
|
|
We can move the r_move_range = None to the else to avoid double-setting the variable. |
|
|
And this changed to keyword only args. |
![]() |
|
Why can't we just give imeta a type of only dict[str, Any], since we always assert it to be non-None. |
![]() |
- Commits:
-
Summary ID 43e56320375f7e93bd17a44c99361c0e4cc8b3b9 7bdd856ae787f2f49ae22406b20643a5a01e58a1
Checks run (2 succeeded)
- Commits:
-
Summary ID 7bdd856ae787f2f49ae22406b20643a5a01e58a1 zwkyoovslsqxvknqzpzmtqmpummrntmn