Skip to content

Commit

Permalink
sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Sep 29, 2024
1 parent 4aed9b3 commit 4fd6440
Show file tree
Hide file tree
Showing 39 changed files with 79 additions and 67 deletions.
16 changes: 3 additions & 13 deletions integration_tests/base_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
from collections import defaultdict
from typing import Optional, TypedDict

from integration_tests.subroutes import sub_router, di_subrouter
from integration_tests.views import SyncView, AsyncView
from robyn import Headers
from robyn import (
Request,
Response,
Robyn,
WebSocket,
jsonify,
serve_file,
serve_html,
WebSocketConnector,
)
from integration_tests.subroutes import di_subrouter, sub_router
from integration_tests.views import AsyncView, SyncView
from robyn import Headers, Request, Response, Robyn, WebSocket, WebSocketConnector, jsonify, serve_file, serve_html
from robyn.authentication import AuthenticationHandler, BearerGetter, Identity
from robyn.templating import JinjaTemplate

Expand Down
3 changes: 2 additions & 1 deletion integration_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import pathlib
import platform
import signal
import socket
import subprocess
import time
from typing import List
import platform

import pytest

from integration_tests.helpers.network_helpers import get_network_host


Expand Down
2 changes: 1 addition & 1 deletion integration_tests/helpers/network_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import socket
import platform
import socket


def get_network_host():
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/subroutes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from robyn import SubRouter, jsonify, WebSocket
from robyn import SubRouter, WebSocket, jsonify

from .di_subrouter import di_subrouter

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/subroutes/di_subrouter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from robyn import SubRouter, Request
from robyn import Request, SubRouter

di_subrouter = SubRouter(__file__, "/di_subrouter")
GLOBAL_DEPENDENCY = "GLOBAL DEPENDENCY OVERRIDE"
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/test_add_route_without_decorator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from collections.abc import Callable

import pytest

from integration_tests.helpers.http_methods_helpers import get, post, put


Expand Down
6 changes: 3 additions & 3 deletions integration_tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from robyn import Robyn, ALLOW_CORS
import pytest

from robyn import ALLOW_CORS, Robyn
from robyn.events import Events
from robyn.robyn import Headers

import pytest


@pytest.mark.benchmark
def test_add_request_header():
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_base_url.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import pytest

import pytest
import requests

from integration_tests.helpers.network_helpers import get_network_host
Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_delete_requests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import delete


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_env_populator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import pathlib

import pytest

from robyn.env_populator import load_vars, parser
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/test_exception_handling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from collections.abc import Callable

import pytest

from integration_tests.helpers.http_methods_helpers import get, post, put


Expand Down
11 changes: 11 additions & 0 deletions integration_tests/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pytest
import requests
from requests import Response

from integration_tests.helpers.http_methods_helpers import get


@pytest.mark.benchmark
def test_http_exception(session):
r = get(f"/sync/http_exception")
assert r.text == "1"
1 change: 1 addition & 0 deletions integration_tests/test_file_download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import get


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_multipart_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import multipart_post


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_patch_requests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import patch


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_post_requests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import post


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_put_requests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import put


Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_status_code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from integration_tests.helpers.http_methods_helpers import get


Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_subrouter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from websocket import create_connection
import pytest
from websocket import create_connection

from integration_tests.helpers.http_methods_helpers import generic_http_helper, head

Expand Down
3 changes: 2 additions & 1 deletion integration_tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from integration_tests.helpers.http_methods_helpers import get, post
import pytest

from integration_tests.helpers.http_methods_helpers import get, post


@pytest.mark.benchmark
def test_get_sync_view(session):
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_web_sockets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json

from websocket import create_connection
import pytest
from websocket import create_connection

BASE_URL = "ws://127.0.0.1:8080"

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .sync_view import SyncView
from .async_view import AsyncView
from .sync_view import SyncView

__all__ = ["SyncView", "AsyncView"]
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

import nox


Expand Down
2 changes: 1 addition & 1 deletion robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import multiprocess as mp
from nestd import get_all_nested
from robyn.robyn import FunctionInfo, Headers, HttpMethod, Request, Response, WebSocketConnector, get_version

from robyn import status_codes
from robyn.argument_parser import Config
Expand All @@ -20,6 +19,7 @@
from robyn.processpool import run_processes
from robyn.reloader import compile_rust_files
from robyn.responses import html, serve_file, serve_html
from robyn.robyn import FunctionInfo, Headers, HttpMethod, Request, Response, WebSocketConnector, get_version
from robyn.router import MiddlewareRouter, MiddlewareType, Router, WebSocketRouter
from robyn.types import Directory
from robyn.ws import WebSocket
Expand Down
16 changes: 9 additions & 7 deletions robyn/cli.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import os
import shutil
import subprocess
import sys
from typing import Optional
import webbrowser
from InquirerPy.resolver import prompt
from pathlib import Path
from typing import Optional

from InquirerPy.base.control import Choice
from .argument_parser import Config
from .reloader import create_rust_file, setup_reloader
from InquirerPy.resolver import prompt

from robyn.env_populator import load_vars
from robyn.robyn import get_version
from pathlib import Path
import shutil
import subprocess

from .argument_parser import Config
from .reloader import create_rust_file, setup_reloader

SCAFFOLD_DIR = Path(__file__).parent / "scaffold"
CURRENT_WORKING_DIR = Path.cwd()
Expand Down
2 changes: 1 addition & 1 deletion robyn/logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
import logging
from enum import Enum
from typing import Optional


Expand Down
2 changes: 1 addition & 1 deletion robyn/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import asdict, dataclass, field
from importlib import resources
from inspect import Signature
from typing import Callable, Dict, List, Optional, TypedDict, Any
from typing import Any, Callable, Dict, List, Optional, TypedDict

from robyn import Response
from robyn.responses import FileResponse, html
Expand Down
9 changes: 5 additions & 4 deletions robyn/processpool.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import asyncio
import webbrowser
from multiprocess import Process
import signal
import sys
import webbrowser
from typing import Dict, List
from robyn.logger import logger

from multiprocess import Process

from robyn.events import Events
from robyn.logger import logger
from robyn.robyn import FunctionInfo, Headers, Server, SocketHeld
from robyn.router import GlobalMiddleware, RouteMiddleware, Route
from robyn.router import GlobalMiddleware, Route, RouteMiddleware
from robyn.types import Directory
from robyn.ws import WebSocket

Expand Down
2 changes: 1 addition & 1 deletion robyn/reloader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import glob
import os
import signal
import subprocess
import sys
Expand Down
6 changes: 3 additions & 3 deletions robyn/responses.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional
import os
import mimetypes
import os
from typing import Optional

from robyn.robyn import Response, Headers
from robyn.robyn import Headers, Response


class FileResponse:
Expand Down
21 changes: 6 additions & 15 deletions robyn/router.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
import inspect
import logging
from abc import ABC, abstractmethod
from asyncio import iscoroutinefunction
from functools import wraps
from inspect import signature
from types import CoroutineType
from typing import Callable, Dict, List, NamedTuple, Union, Optional
from robyn.authentication import AuthenticationHandler, AuthenticationNotConfiguredError
from robyn.dependency_injection import DependencyMap
from robyn.responses import FileResponse
from typing import Callable, Dict, List, NamedTuple, Optional, Union

from robyn.robyn import (
FunctionInfo,
Headers,
HttpMethod,
MiddlewareType,
Request,
Response,
)
from robyn import status_codes
from robyn.authentication import AuthenticationHandler, AuthenticationNotConfiguredError
from robyn.dependency_injection import DependencyMap
from robyn.jsonify import jsonify

from robyn.responses import FileResponse
from robyn.robyn import FunctionInfo, Headers, HttpMethod, MiddlewareType, Request, Response
from robyn.ws import WebSocket

import logging

_logger = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions robyn/scaffold/mongo/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pymongo import MongoClient

from robyn import Robyn

app = Robyn(__file__)
Expand Down
1 change: 1 addition & 0 deletions robyn/scaffold/postgres/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import psycopg2

from robyn import Robyn

DB_NAME = "postgresDB"
Expand Down
3 changes: 2 additions & 1 deletion robyn/scaffold/prisma/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from robyn import Robyn
from prisma import Prisma
from prisma.models import User

from robyn import Robyn

app = Robyn(__file__)
prisma = Prisma(auto_register=True)

Expand Down
3 changes: 2 additions & 1 deletion robyn/scaffold/sqlite/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from robyn import Robyn
import sqlite3

from robyn import Robyn

app = Robyn(__file__)


Expand Down
5 changes: 2 additions & 3 deletions robyn/scaffold/sqlmodel/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from robyn import Robyn

from sqlmodel import SQLModel, Session, create_engine, select
from models import Hero
from sqlmodel import Session, SQLModel, create_engine, select

from robyn import Robyn

app = Robyn(__file__)

Expand Down
4 changes: 2 additions & 2 deletions robyn/templating.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from abc import ABC, abstractmethod

from jinja2 import Environment, FileSystemLoader

from robyn import status_codes

from .robyn import Headers, Response

from jinja2 import Environment, FileSystemLoader


class TemplateInterface(ABC):
def __init__(self): ...
Expand Down
2 changes: 1 addition & 1 deletion robyn/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import asyncio
import inspect
from typing import TYPE_CHECKING, Callable

from robyn.argument_parser import Config
from robyn.dependency_injection import DependencyMap

from robyn.robyn import FunctionInfo

if TYPE_CHECKING:
Expand Down
Loading

0 comments on commit 4fd6440

Please sign in to comment.