Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecated selenium 4.10 options #81

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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