Skip to content

Commit c8d3335

Browse files
committed
Fix some lint errors
1 parent 90c62a9 commit c8d3335

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

ksc

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Key:
127127
shifted_key=None,
128128
html_entity=None,
129129
clarified_name=None,
130-
ascii=None,
130+
ascii_key=None,
131131
modifier=False,
132132
):
133133
self.key = key
@@ -155,7 +155,7 @@ class Key:
155155
self.modifier = modifier
156156
"""True if this key is a modifier key, like Fn, Shift, etc."""
157157

158-
self.ascii = ascii
158+
self.ascii_key = ascii_key
159159
"""If the key is a modifier, it also has an ASCII representation, like ~ for Option"""
160160

161161

@@ -172,17 +172,17 @@ class MacOS:
172172
# that is a single character
173173
# order matters for the modifier keys, they need to be in the apple
174174
# recommended order for displaying modifier keys
175-
Key("*", "Fn", ["func", "function", "fn"], ascii="*", modifier=True),
175+
Key("*", "Fn", ["func", "function", "fn"], ascii_key="*", modifier=True),
176176
Key(
177177
"⌃", # this is not a caret, it's another unicode character
178178
"Control",
179179
["control", "cont", "ctrl", "ctl"],
180-
ascii="^", # this one is a caret
180+
ascii_key="^", # this one is a caret
181181
modifier=True,
182182
),
183-
Key("⌥", "Option", ["option", "opt", "alt"], ascii="~", modifier=True),
184-
Key("⇧", "Shift", ["shift", "shft"], ascii="$", modifier=True),
185-
Key("⌘", "Command", ["command", "cmd", "clover"], ascii="@", modifier=True),
183+
Key("⌥", "Option", ["option", "opt", "alt"], ascii_key="~", modifier=True),
184+
Key("⇧", "Shift", ["shift", "shft"], ascii_key="$", modifier=True),
185+
Key("⌘", "Command", ["command", "cmd", "clover"], ascii_key="@", modifier=True),
186186
Key("⎋", "Escape", ["escape", "esc"]),
187187
Key("⇥", "Tab", ["tab"]),
188188
Key("⇪", "Caps Lock", ["capslock", "caps"]),
@@ -276,10 +276,10 @@ class MacOS:
276276
for _key in keys:
277277
if _key.modifier:
278278
mods_names.append(_key.name)
279-
mods_plaintext.append(_key.ascii)
279+
mods_plaintext.append(_key.ascii_key)
280280
mods_unicode.append(_key.key)
281281
_regex = r"\b(" + "|".join(_key.input_names) + r")\b"
282-
mods_regex_map.append((_key.ascii, _regex))
282+
mods_regex_map.append((_key.ascii_key, _regex))
283283
if _key.shifted_key:
284284
unshifted_keys += _key.key
285285
shifted_keys += _key.shifted_key
@@ -346,11 +346,6 @@ class MacOS:
346346
347347
"""
348348

349-
"""parse input into a canonical non-unicode representation of the shortcut
350-
351-
letters are always stored as upper case, special key names are always
352-
stored as lower case
353-
"""
354349
# save the original text for an error message
355350
orig_text = text
356351
mods = []
@@ -611,7 +606,7 @@ def test_mac_parse_error():
611606
]
612607
for inp in fails:
613608
with pytest.raises(ValueError):
614-
combos = MacOS.parse_shortcuts(inp)
609+
_ = MacOS.parse_shortcuts(inp)
615610

616611

617612
def test_mac_parse_multiple():
@@ -641,21 +636,24 @@ def test_mac_render(capsys):
641636
for (cmdline, result) in rendermap:
642637
argv = cmdline.split(" ")
643638
exit_code = main(argv)
644-
out, err = capsys.readouterr()
639+
out, _ = capsys.readouterr()
645640
out = out.rstrip()
646641
assert out == result
642+
assert exit_code == EXIT_SUCCESS
647643

648644

649645
def test_mac_list(capsys):
650646
argv = "-l".split(" ")
651647
exit_code = main(argv)
652-
out, err = capsys.readouterr()
648+
out, _ = capsys.readouterr()
653649
assert not MacOS.hyper_name in out
654650
assert "Command" in out
651+
assert exit_code == EXIT_SUCCESS
655652

656653

657654
def test_mac_list_hyper(capsys):
658655
argv = "-ly".split(" ")
659656
exit_code = main(argv)
660-
out, err = capsys.readouterr()
657+
out, _ = capsys.readouterr()
661658
assert MacOS.hyper_name in out
659+
assert exit_code == EXIT_SUCCESS

0 commit comments

Comments
 (0)