Skip to content

Commit

Permalink
Merge pull request #4693 from Textualize/optimize-import
Browse files Browse the repository at this point in the history
speed up import
  • Loading branch information
willmcgugan authored Jul 3, 2024
2 parents f2add3c + a7ca2db commit 55e54af
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/textual/_time.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import asyncio
import platform
import sys
from asyncio import sleep as asyncio_sleep
from time import monotonic, perf_counter

PLATFORM = platform.system()
WINDOWS = PLATFORM == "Windows"
WINDOWS = sys.platform == "win32"


if WINDOWS:
Expand Down
4 changes: 1 addition & 3 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import inspect
import io
import os
import platform
import signal
import sys
import threading
Expand Down Expand Up @@ -132,8 +131,7 @@
from .pilot import Pilot
from .widget import MountError # type: ignore # noqa: F401

PLATFORM = platform.system()
WINDOWS = PLATFORM == "Windows"
WINDOWS = sys.platform == "win32"

# asyncio will warn against resources not being cleared
if constants.DEBUG:
Expand Down
4 changes: 2 additions & 2 deletions src/textual/drivers/_input_reader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import platform
import sys

__all__ = ["InputReader"]

WINDOWS = platform.system() == "Windows"
WINDOWS = sys.platform == "win32"

if WINDOWS:
from ._input_reader_windows import InputReader
Expand Down
3 changes: 1 addition & 2 deletions src/textual/drivers/web_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import asyncio
import json
import os
import platform
import signal
import sys
from codecs import getincrementaldecoder
Expand All @@ -29,7 +28,7 @@
from ._byte_stream import ByteStream
from ._input_reader import InputReader

WINDOWS = platform.system() == "Windows"
WINDOWS = sys.platform == "win32"


class _ExitInput(Exception):
Expand Down
2 changes: 1 addition & 1 deletion src/textual/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ async def do_work() -> ResultType:
return asyncio.run(do_work())

def run_coroutine(
work: Callable[[], Coroutine[None, None, ResultType]]
work: Callable[[], Coroutine[None, None, ResultType]],
) -> ResultType:
"""Set the active worker and await coroutine."""
return run_awaitable(work())
Expand Down

0 comments on commit 55e54af

Please sign in to comment.