Skip to content

Commit

Permalink
fix: potential IndexError bug. Fix typo and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Mar 16, 2023
1 parent 938ca15 commit 71a4217
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jupynium/events_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ def choose_default_kernel(driver, page_type: str, buf_filetype, conda_or_venv_pa
if kern["spec"]["language"].lower() == buf_filetype.lower():
valid_kernel_names.append(kernel_name)

def match_with_path(env_path: str) -> str:
def match_with_path(env_path: str) -> str | None:
"""Match kernel executable path with conda/virtual environment bin directory
Args:
env_path (str): Path ot the conda/virtual environment directory
env_path (str): Path of the conda/virtual environment directory
Returns:
str: Name of the kernel matching the environment, returns None if no match
Expand All @@ -360,7 +360,7 @@ def match_with_path(env_path: str) -> str:
env_exec_path = os.path.join(env_path, "bin", exec_name)
if kernel_exec_path == env_exec_path:
return kernel_name
except KeyError:
except (KeyError, IndexError):
pass
return

Expand Down

0 comments on commit 71a4217

Please sign in to comment.