Skip to content
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 22, 2024
commit 6adaa4076a1fc57ff9f278f9578b4120fc3b5083
9 changes: 4 additions & 5 deletions src/pyscript/plugins/run.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from __future__ import annotations

from typing import Optional

import socketserver
import threading
import webbrowser
from functools import partial
from http.server import SimpleHTTPRequestHandler
from pathlib import Path
from typing import Optional

import typer

Expand All @@ -16,7 +15,7 @@

def get_folder_based_http_request_handler(
folder: Path,
default_file: Optional[Path] = None,
default_file: Path | None = None,
) -> type[SimpleHTTPRequestHandler]:
"""
Returns a FolderBasedHTTPRequestHandler with the specified directory.
Expand Down Expand Up @@ -71,7 +70,7 @@ def split_path_and_filename(path: Path) -> tuple[Path, str]:
return abs_path, ""


def start_server(path: Path, show: bool, port: int, default_file: Optional[Path] = None):
def start_server(path: Path, show: bool, port: int, default_file: Path | None = None):
"""
Creates a local server to run the app on the path and port specified.

Expand Down Expand Up @@ -125,7 +124,7 @@ def run(
),
view: bool = typer.Option(True, help="Open the app in web browser."),
port: int = typer.Option(8000, help="The port that the app will run on."),
default_file: Optional[Path] = typer.Option(
default_file: Path | None = typer.Option(
None, help="A default file to serve when a nonexistent file is accessed."
),
):
Expand Down