Skip to content

Commit 19436ee

Browse files
feat: minimize use of colors, emphasis on load/pop, update theme according to feedbacks
1 parent 023fcf7 commit 19436ee

1 file changed

Lines changed: 12 additions & 49 deletions

File tree

Lib/_colorize.py

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -202,39 +202,26 @@ class Difflib(ThemeSection):
202202

203203
@dataclass(frozen=True, kw_only=True)
204204
class Dis(ThemeSection):
205-
label_bg: str = ANSIColors.BACKGROUND_BLUE
205+
label_bg: str = ANSIColors.BACKGROUND_CYAN
206206
label_fg: str = ANSIColors.BLACK
207+
208+
L:str = ANSIColors.BOLD_RED
207209
exception_label: str = ANSIColors.CYAN
208-
argument_detail: str = ANSIColors.GREY
210+
argument_detail: str = ANSIColors.CYAN
209211

210-
op_stack: str = ANSIColors.BOLD_YELLOW
211-
op_load_store: str = ANSIColors.BOLD_CYAN
212-
op_call_return: str = ANSIColors.BOLD_MAGENTA
213-
op_binary_unary: str = ANSIColors.BOLD_BLUE
212+
op_load: str = ANSIColors.BOLD_BLUE
213+
op_pop: str = ANSIColors.BOLD_MAGENTA
214+
op_call_return: str = ANSIColors.BOLD_YELLOW
214215
op_control_flow: str = ANSIColors.BOLD_GREEN
215-
op_build: str = ANSIColors.BOLD_WHITE
216-
op_exceptions: str = ANSIColors.BOLD_RED
217-
op_other: str = ANSIColors.GREY
218216

219217
reset: str = ANSIColors.RESET
220218

221219
def color_by_opname(self, opname: str) -> str:
222-
if opname in (
223-
"POP_TOP",
224-
"POP_ITER",
225-
"END_FOR",
226-
"END_SEND",
227-
"COPY",
228-
"SWAP",
229-
"PUSH_NULL",
230-
"PUSH_EXC_INFO",
231-
"NOP",
232-
"CACHE",
233-
):
234-
return self.op_stack
220+
if opname.startswith("LOAD_"):
221+
return self.op_load
235222

236-
if opname.startswith(("LOAD_", "STORE_", "DELETE_", "IMPORT_")):
237-
return self.op_load_store
223+
if opname.startswith("POP_"):
224+
return self.op_pop
238225

239226
if opname.startswith(("CALL", "RETURN")) or opname in (
240227
"YIELD_VALUE",
@@ -244,17 +231,6 @@ def color_by_opname(self, opname: str) -> str:
244231
):
245232
return self.op_call_return
246233

247-
if opname.startswith(("BINARY_", "UNARY_")) or opname in (
248-
"COMPARE_OP",
249-
"IS_OP",
250-
"CONTAINS_OP",
251-
"GET_ITER",
252-
"GET_YIELD_FROM_ITER",
253-
"TO_BOOL",
254-
"DELETE_SUBSCR",
255-
):
256-
return self.op_binary_unary
257-
258234
if opname.startswith(("JUMP_", "POP_JUMP_", "FOR_ITER")) or opname in (
259235
"SEND",
260236
"GET_AWAITABLE",
@@ -265,21 +241,8 @@ def color_by_opname(self, opname: str) -> str:
265241
):
266242
return self.op_control_flow
267243

268-
if opname.startswith(
269-
("BUILD_", "LIST_", "DICT_", "UNPACK_")
270-
) or opname in ("SET_ADD", "MAP_ADD", "SET_UPDATE"):
271-
return self.op_build
272-
273-
if opname.startswith(("SETUP_", "CHECK_")) or opname in (
274-
"POP_EXCEPT",
275-
"RERAISE",
276-
"WITH_EXCEPT_START",
277-
"RAISE_VARARGS",
278-
"POP_BLOCK",
279-
):
280-
return self.op_exceptions
281244

282-
return self.op_other
245+
return self.reset
283246

284247

285248
@dataclass(frozen=True, kw_only=True)

0 commit comments

Comments
 (0)