Skip to content

Commit

Permalink
fix: deprecated selenium 4.10 options
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Jun 13, 2023
1 parent f5faa4b commit aaa0e59
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
13 changes: 9 additions & 4 deletions src/jupynium/cmds/jupynium.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from persistqueue.exceptions import Empty
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

Expand Down Expand Up @@ -89,11 +91,14 @@ def webdriver_firefox(

logger.info(f"Using firefox profile: {profile_path}")

profile = webdriver.FirefoxProfile(profile_path)
profile.set_preference("browser.link.open_newwindow", 3)
profile.set_preference("browser.link.open_newwindow.restriction", 0)
options = Options()
options.profile = webdriver.FirefoxProfile(profile_path)
options.set_preference("browser.link.open_newwindow", 3)
options.set_preference("browser.link.open_newwindow.restriction", 0)
# profile.setAlwaysLoadNoFocusLib(True);
return webdriver.Firefox(profile, service_log_path=os.path.devnull)

service = Service(log_path=os.path.devnull)
return webdriver.Firefox(options=options, service=service)


# def webdriver_safari():
Expand Down
26 changes: 16 additions & 10 deletions src/jupynium/lua/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -617,24 +617,30 @@ function Jupynium_kernel_hover(bufnr)
-- Strip ANSI Escape code: https://stackoverflow.com/a/55324681
-- \x1b is the escape character
-- %[%d+; is the ANSI escape code for a digit color
:gsub("\x1b%[%d+;%d+;%d+;%d+;%d+m", "")
:gsub(
"\x1b%[%d+;%d+;%d+;%d+;%d+m",
""
)
:gsub("\x1b%[%d+;%d+;%d+;%d+m", "")
:gsub("\x1b%[%d+;%d+;%d+m", "")
:gsub("\x1b%[%d+;%d+m", "")
:gsub("\x1b%[%d+m", "")
:gsub("\x1b%[H", "\t")
-- Groups: name, 0 or more new line, content till end
-- TODO: Fix for non-python kernel
:gsub("^(Call signature):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub(
"^(Call signature):(%s*)(.-)\n$",
"```python\n%3 # %1\n```"
)
:gsub("^(Init signature):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub("^(Signature):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub("^(String form):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub("^(Docstring):(%s*)(.-)$", "\n---\n```rst\n%3\n```")
:gsub("^(Class docstring):(%s*)(.-)$", "\n---\n```rst\n%3\n```")
:gsub("^(File):(%s*)(.-)\n$", "*%1*: `%3`\n")
:gsub("^(Type):(%s*)(.-)\n$", "*%1*: %3\n")
:gsub("^(Length):(%s*)(.-)\n$", "*%1*: %3\n")
:gsub("^(Subclasses):(%s*)(.-)\n$", "*%1*: %3\n")
:gsub("^(Signature):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub("^(String form):(%s*)(.-)\n$", "```python\n%3 # %1\n```")
:gsub("^(Docstring):(%s*)(.-)$", "\n---\n```rst\n%3\n```")
:gsub("^(Class docstring):(%s*)(.-)$", "\n---\n```rst\n%3\n```")
:gsub("^(File):(%s*)(.-)\n$", "*%1*: `%3`\n")
:gsub("^(Type):(%s*)(.-)\n$", "*%1*: %3\n")
:gsub("^(Length):(%s*)(.-)\n$", "*%1*: %3\n")
:gsub("^(Subclasses):(%s*)(.-)\n$", "*%1*: %3\n")
if section:match "%S" ~= nil and section:match "%S" ~= "" then
-- Only add non-empty section
out = out .. section
Expand Down

0 comments on commit aaa0e59

Please sign in to comment.