mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 12:34:44 +02:00
mypy: Turn on return value checks
Its a shame GvR is married to "return None" https://github.com/python/mypy/issues/7511
This commit is contained in:
@@ -35,6 +35,7 @@ If specified close the tab of the window this command is run in, rather than the
|
||||
for tab in self.tabs_for_match_payload(boss, window, payload_get):
|
||||
if tab:
|
||||
boss.close_tab_no_confirm(tab)
|
||||
return None
|
||||
|
||||
|
||||
close_tab = CloseTab()
|
||||
|
||||
@@ -34,6 +34,7 @@ If specified close the window this command is run in, rather than the active win
|
||||
for window in self.windows_for_match_payload(boss, window, payload_get):
|
||||
if window:
|
||||
boss.close_window(window)
|
||||
return None
|
||||
|
||||
|
||||
close_window = CloseWindow()
|
||||
|
||||
@@ -45,6 +45,7 @@ If specified apply marker to the window this command is run in, rather than the
|
||||
args = payload_get('marker_spec')
|
||||
for window in self.windows_for_match_payload(boss, window, payload_get):
|
||||
window.set_marker(args)
|
||||
return None
|
||||
|
||||
|
||||
create_marker = CreateMarker()
|
||||
|
||||
@@ -57,6 +57,7 @@ If specified detach the tab this command is run in, rather than the active tab.
|
||||
|
||||
for tab in tabs:
|
||||
boss._move_tab_to(tab=tab, **kwargs)
|
||||
return None
|
||||
|
||||
|
||||
detach_tab = DetachTab()
|
||||
|
||||
@@ -53,6 +53,7 @@ If specified detach the window this command is run in, rather than the active wi
|
||||
kwargs = {'target_os_window_id': newval} if target_tab_id is None else {'target_tab_id': target_tab_id}
|
||||
for window in windows:
|
||||
boss._move_window_to(window=window, **kwargs)
|
||||
return None
|
||||
|
||||
|
||||
detach_window = DetachWindow()
|
||||
|
||||
@@ -52,6 +52,7 @@ cause ligatures to be changed in all windows.
|
||||
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
||||
windows = self.windows_for_payload(boss, window, payload_get)
|
||||
boss.disable_ligatures_in(windows, payload_get('strategy'))
|
||||
return None
|
||||
# }}}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class Env(RemoteCommand):
|
||||
else:
|
||||
env.pop(k, None)
|
||||
set_default_env(env)
|
||||
return None
|
||||
|
||||
|
||||
env = Env()
|
||||
|
||||
@@ -41,6 +41,7 @@ using this option means that you will not be notified of failures.
|
||||
if tab:
|
||||
boss.set_active_tab(tab)
|
||||
break
|
||||
return None
|
||||
|
||||
|
||||
focus_tab = FocusTab()
|
||||
|
||||
@@ -43,6 +43,7 @@ the command will exit with a success code.
|
||||
if os_window_id:
|
||||
focus_os_window(os_window_id, True)
|
||||
break
|
||||
return None
|
||||
|
||||
|
||||
focus_window = FocusWindow()
|
||||
|
||||
@@ -47,6 +47,7 @@ class GotoLayout(RemoteCommand):
|
||||
tab.goto_layout(payload_get('layout'), raise_exception=True)
|
||||
except ValueError:
|
||||
raise UnknownLayout('The layout {} is unknown or disabled'.format(payload_get('layout')))
|
||||
return None
|
||||
|
||||
|
||||
goto_layout = GotoLayout()
|
||||
|
||||
@@ -51,6 +51,7 @@ class Kitten(RemoteCommand):
|
||||
break
|
||||
if isinstance(retval, (str, bool)):
|
||||
return retval
|
||||
return None
|
||||
|
||||
|
||||
kitten = Kitten()
|
||||
|
||||
@@ -45,6 +45,7 @@ the command will exit with a success code.
|
||||
for tab in self.tabs_for_match_payload(boss, window, payload_get):
|
||||
if tab:
|
||||
tab.last_used_layout()
|
||||
return None
|
||||
|
||||
|
||||
last_used_layout = LastUsedLayout()
|
||||
|
||||
@@ -34,6 +34,7 @@ If specified apply marker to the window this command is run in, rather than the
|
||||
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
||||
for window in self.windows_for_match_payload(boss, window, payload_get):
|
||||
window.remove_marker()
|
||||
return None
|
||||
|
||||
|
||||
remove_marker = RemoveMarker()
|
||||
|
||||
@@ -96,6 +96,7 @@ using this option means that you will not be notified of failures.
|
||||
boss.toggle_fullscreen(os_window_id)
|
||||
elif ac == 'toggle-maximized':
|
||||
boss.toggle_maximized(os_window_id)
|
||||
return None
|
||||
|
||||
|
||||
resize_os_window = ResizeOSWindow()
|
||||
|
||||
@@ -69,6 +69,7 @@ class ScrollWindow(RemoteCommand):
|
||||
func = getattr(window, f'scroll_{unit}_{direction}')
|
||||
for i in range(abs(amt)):
|
||||
func()
|
||||
return None
|
||||
|
||||
|
||||
scroll_window = ScrollWindow()
|
||||
|
||||
@@ -161,6 +161,7 @@ Do not send text to the active window, even if it is one of the matched windows.
|
||||
window.write_to_child(kdata)
|
||||
else:
|
||||
window.write_to_child(data)
|
||||
return None
|
||||
|
||||
|
||||
send_text = SendText()
|
||||
|
||||
@@ -124,6 +124,7 @@ failed, the command will exit with a success code.
|
||||
except ValueError as err:
|
||||
err.hide_traceback = True # type: ignore
|
||||
raise
|
||||
return None
|
||||
|
||||
|
||||
set_background_image = SetBackgroundImage()
|
||||
|
||||
@@ -53,6 +53,7 @@ cause colors to be changed in all windows.
|
||||
windows = self.windows_for_payload(boss, window, payload_get)
|
||||
for os_window_id in {w.os_window_id for w in windows}:
|
||||
boss._set_os_window_background_opacity(os_window_id, payload_get('opacity'))
|
||||
return None
|
||||
|
||||
|
||||
set_background_opacity = SetBackgroundOpacity()
|
||||
|
||||
@@ -107,6 +107,7 @@ this option, any color arguments are ignored and --configured and --all are impl
|
||||
if default_bg_changed:
|
||||
boss.default_bg_changed_for(w.id)
|
||||
w.refresh()
|
||||
return None
|
||||
|
||||
|
||||
set_colors = SetColors()
|
||||
|
||||
@@ -64,6 +64,7 @@ as well.
|
||||
for tab in tabs:
|
||||
if tab:
|
||||
tab.set_enabled_layouts(layouts)
|
||||
return None
|
||||
|
||||
|
||||
set_enabled_layouts = SetEnabledLayouts()
|
||||
|
||||
@@ -49,6 +49,7 @@ the font size for any newly created OS Windows in the future.
|
||||
boss.change_font_size(
|
||||
payload_get('all'),
|
||||
payload_get('increment_op'), payload_get('size'))
|
||||
return None
|
||||
|
||||
|
||||
set_font_size = SetFontSize()
|
||||
|
||||
@@ -119,6 +119,7 @@ windows).
|
||||
|
||||
for tab in dirtied_tabs.values():
|
||||
tab.relayout()
|
||||
return None
|
||||
|
||||
|
||||
set_spacing = SetSpacing()
|
||||
|
||||
@@ -76,6 +76,7 @@ If specified close the tab this command is run in, rather than the active tab.
|
||||
for k, v in s.items():
|
||||
setattr(tab, k, v)
|
||||
tab.mark_tab_bar_dirty()
|
||||
return None
|
||||
|
||||
|
||||
set_tab_color = SetTabColor()
|
||||
|
||||
@@ -37,6 +37,7 @@ class SetTabTitle(RemoteCommand):
|
||||
for tab in self.tabs_for_match_payload(boss, window, payload_get):
|
||||
if tab:
|
||||
tab.set_title(payload_get('title'))
|
||||
return None
|
||||
|
||||
|
||||
set_tab_title = SetTabTitle()
|
||||
|
||||
@@ -57,6 +57,7 @@ want to allow other programs to change it afterwards, use this option.
|
||||
window.title_changed(payload_get('title'))
|
||||
else:
|
||||
window.set_title(payload_get('title'))
|
||||
return None
|
||||
|
||||
|
||||
set_window_title = SetWindowTitle()
|
||||
|
||||
@@ -47,6 +47,7 @@ class SignalChild(RemoteCommand):
|
||||
for window in windows:
|
||||
if window:
|
||||
window.signal_child(*signals)
|
||||
return None
|
||||
|
||||
|
||||
signal_child = SignalChild()
|
||||
|
||||
Reference in New Issue
Block a user