Moved to use contextlib suppress pattern than empty exception blocks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Python imports
|
||||
from contextlib import suppress
|
||||
import os
|
||||
|
||||
# Lib imports
|
||||
@@ -58,11 +59,9 @@ class OpenFilesButton(Gtk.Button):
|
||||
|
||||
chooser.set_select_multiple(True)
|
||||
|
||||
try:
|
||||
with suppress(Exception):
|
||||
folder = widget.get_current_file().get_parent() if not start_dir else start_dir
|
||||
chooser.set_current_folder( folder.get_path() )
|
||||
except Exception as e:
|
||||
...
|
||||
|
||||
response = chooser.run()
|
||||
if not response == Gtk.ResponseType.OK:
|
||||
|
||||
@@ -99,7 +99,7 @@ class VteWidget(Vte.Terminal):
|
||||
try:
|
||||
command_ran = lines[-1].split("-->:")[1].strip()
|
||||
except VteWidgetException as e:
|
||||
logger.debud(e)
|
||||
logger.debug(e)
|
||||
return
|
||||
|
||||
if not command_ran[0:3].encode() in self.cd_cmd_prefix:
|
||||
@@ -114,12 +114,12 @@ class VteWidget(Vte.Terminal):
|
||||
event = Event("pty_path_updated", "", target_path)
|
||||
event_system.emit("handle_bridge_event", (event,))
|
||||
|
||||
def update_term_path(self, fpath):
|
||||
def update_term_path(self, fpath: str):
|
||||
self.dont_process = True
|
||||
|
||||
cmds = [f"cd '{fpath}'\n", "clear\n"]
|
||||
for i in cmds:
|
||||
self.run_command(i)
|
||||
for cmd in cmds:
|
||||
self.run_command(cmd)
|
||||
|
||||
def run_command(self, cmd):
|
||||
def run_command(self, cmd: str):
|
||||
self.feed_child_binary(bytes(cmd, 'utf8'))
|
||||
Reference in New Issue
Block a user