Skip to content

Commit a8e9285

Browse files
optimize imports
1 parent f482f49 commit a8e9285

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "netunicorn-library"
3-
version = "0.3.4"
3+
version = "0.3.5"
44
authors = [
55
{name = "Roman Beltiukov", email = "[email protected]"},
66
]

tasks/letsencrypt/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import dns.resolver
21
import requests
32
from returns.result import Success, Failure, Result
43

@@ -15,6 +14,7 @@ def validate_http_01(domain: str, token_name: str, token_data: str) -> Result[No
1514

1615

1716
def validate_dns_01(domain: str, token: str) -> Result[None, str]:
17+
import dns.resolver
1818
try:
1919
result = dns.resolver.resolve(f"_acme-challenge.{domain}", "TXT")
2020
result = list(result.response.answer[0])[-1].strings[0]

tasks/upload/fileio.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Uploads files to file.io -- temporary file storage
33
"""
44

5-
import os
65
import subprocess
7-
from typing import Literal, Optional, Set
86

97
from netunicorn.base.nodes import Architecture, Node
108
from netunicorn.base.task import Task, TaskDispatcher

tasks/video_watchers/twitch_watcher.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
from netunicorn.base.architecture import Architecture
1212
from netunicorn.base.nodes import Node
1313

14-
from selenium import webdriver
15-
from selenium.webdriver.chrome.options import Options
16-
from selenium.webdriver.chrome.service import Service
17-
1814

1915
def watch(
2016
url: str, duration: int = 10, chrome_location: Optional[str] = None
2117
) -> Result[str, str]:
18+
from selenium import webdriver
19+
from selenium.webdriver.chrome.options import Options
20+
from selenium.webdriver.chrome.service import Service
21+
2222
display_number = random.randint(100, 500)
2323
xvfb_process = subprocess.Popen(
2424
["Xvfb", f":{display_number}", "-screen", "0", "1920x1080x24"]

tasks/video_watchers/vimeo_watcher.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
from netunicorn.base.architecture import Architecture
1212
from netunicorn.base.nodes import Node
1313

14-
from selenium import webdriver
15-
from selenium.webdriver.chrome.options import Options
16-
from selenium.webdriver.chrome.service import Service
17-
1814

1915
def watch(
2016
url: str, duration: Optional[int] = 100, chrome_location: Optional[str] = None
2117
) -> Result[str, str]:
18+
from selenium import webdriver
19+
from selenium.webdriver.chrome.options import Options
20+
from selenium.webdriver.chrome.service import Service
21+
2222
display_number = random.randint(100, 500)
2323
xvfb_process = subprocess.Popen(
2424
["Xvfb", f":{display_number}", "-screen", "0", "1920x1080x24"]

tasks/video_watchers/youtube_watcher.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
from netunicorn.base.architecture import Architecture
1313
from netunicorn.base.nodes import Node
1414

15-
from selenium import webdriver
16-
from selenium.webdriver.chrome.options import Options
17-
from selenium.webdriver.chrome.service import Service
18-
from selenium.webdriver.common.by import By
19-
from selenium.webdriver.common.keys import Keys
20-
2115

2216
class YouTubeIFrameStatus(IntEnum):
2317
UNSTARTED = -1
@@ -31,6 +25,12 @@ class YouTubeIFrameStatus(IntEnum):
3125
def watch(
3226
url: str, duration: Optional[int] = 100, chrome_location: Optional[str] = None
3327
) -> Result[str, str]:
28+
from selenium import webdriver
29+
from selenium.webdriver.chrome.options import Options
30+
from selenium.webdriver.chrome.service import Service
31+
from selenium.webdriver.common.by import By
32+
from selenium.webdriver.common.keys import Keys
33+
3434
display_number = random.randint(100, 500)
3535
xvfb_process = subprocess.Popen(
3636
["Xvfb", f":{display_number}", "-screen", "0", "1920x1080x24"]

0 commit comments

Comments
 (0)