Skip to content

Commit

Permalink
hide pylint import-outside-toplevel error
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixthrush committed Nov 17, 2024
1 parent 7ddac5f commit 98f9047
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/aniworld/common/adventure.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def display_ascii_art():

def adventure():
try:
import ollama # pylint: disable=import-error
import ollama # pylint: disable=import-error, import-outside-toplevel
except ModuleNotFoundError:
print("The 'ollama' module is not installed. Please install it to play the game.")
return
Expand Down
16 changes: 8 additions & 8 deletions src/aniworld/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def fetch_url_content_with_playwright(
}

install_and_import("playwright")
from playwright.sync_api import sync_playwright # pylint: disable=import-error
from playwright.sync_api import sync_playwright # pylint: disable=import-error, import-outside-toplevel

with sync_playwright() as p:
browser_options = {}
Expand Down Expand Up @@ -1246,7 +1246,7 @@ def show_messagebox(message, title="Message", box_type="info"):
system = platform.system()

if system == "Windows":
import ctypes
import ctypes # pylint: disable=import-outside-toplevel
msg_box_type = {
"info": 0x40,
"yesno": 0x04 | 0x20,
Expand Down Expand Up @@ -1304,8 +1304,8 @@ def show_messagebox(message, title="Message", box_type="info"):
logging.debug("Error showing messagebox on Linux: %s", e)
return False

import tkinter as tk
from tkinter import messagebox
import tkinter as tk # pylint: disable=import-outside-toplevel
from tkinter import messagebox # pylint: disable=import-outside-toplevel

root = tk.Tk()
root.withdraw()
Expand All @@ -1328,7 +1328,7 @@ def get_current_wallpaper():
system = platform.system()

if system == "Windows":
import ctypes
import ctypes # pylint: disable=import-outside-toplevel
buf = ctypes.create_unicode_buffer(512)
ctypes.windll.user32.SystemParametersInfoW(0x73, len(buf), buf, 0)
return buf.value
Expand Down Expand Up @@ -1358,8 +1358,8 @@ def get_current_wallpaper():

def set_wallpaper_fit(image_path):
try:
import winreg # pylint: disable=import-error
import ctypes # pylint: disable=import-error
import winreg # pylint: disable=import-error, import-outside-toplevel
import ctypes # pylint: disable=import-error, import-outside-toplevel
except ModuleNotFoundError as e:
raise ImportError("Required modules (winreg, ctypes) not found. Ensure you're on Windows.") from e

Expand Down Expand Up @@ -1389,7 +1389,7 @@ def set_wallpaper(image_path):

def minimize_all_windows():
if platform.system() == "Windows":
import ctypes
import ctypes # pylint: disable=import-outside-toplevel
ctypes.windll.user32.keybd_event(0x5B, 0, 0, 0) # Press Windows key
ctypes.windll.user32.keybd_event(0x44, 0, 0, 0) # Press 'D' key
ctypes.windll.user32.keybd_event(0x44, 0, 2, 0) # Release 'D' key
Expand Down
2 changes: 1 addition & 1 deletion src/aniworld/extractors/streamkiste/streamkiste.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def clear_screen() -> None:
def fetch_direct_link(link):
filtered_urls = []
install_and_import("playwright")
from playwright.sync_api import sync_playwright # pylint: disable=import-error
from playwright.sync_api import sync_playwright # pylint: disable=import-error, import-outside-toplevel
with sync_playwright() as p:
# TODO - add firefox or chromium fallback
browser = p.webkit.launch(headless=True)
Expand Down

0 comments on commit 98f9047

Please sign in to comment.