Skip to content

Commit

Permalink
Replace black with ruff formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Oct 24, 2023
1 parent e2eedec commit c5f0e2c
Show file tree
Hide file tree
Showing 67 changed files with 126 additions and 83 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ repos:
- id: check-builtin-literals
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Build Status](https://github.com/jupyter-server/jupyverse/workflows/CI/badge.svg)](https://github.com/jupyter-server/jupyverse/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# jupyverse

Expand Down
1 change: 0 additions & 1 deletion jupyverse_api/jupyverse_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from .app import App


__version__ = "0.3.0"


Expand Down
3 changes: 1 addition & 2 deletions jupyverse_api/jupyverse_api/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations

import logging
from datetime import datetime, timezone
from collections import defaultdict
from datetime import datetime, timezone
from typing import Dict, List

from fastapi import FastAPI, Request

from ..exceptions import RedirectException, _redirect_exception_handler


logger = logging.getLogger("app")


Expand Down
1 change: 1 addition & 0 deletions jupyverse_api/jupyverse_api/auth/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional

from pydantic import BaseModel


Expand Down
2 changes: 1 addition & 1 deletion jupyverse_api/jupyverse_api/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pkg_resources
from typing import List, Tuple

import pkg_resources
import rich_click as click
from asphalt.core.cli import run

Expand Down
5 changes: 3 additions & 2 deletions jupyverse_api/jupyverse_api/contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from typing import Dict, List, Optional, Union

from fastapi import APIRouter, Depends, Request, Response

from jupyverse_api import Router

from .models import Checkpoint, Content, SaveContent
from ..auth import Auth, User
from ..app import App
from ..auth import Auth, User
from .models import Checkpoint, Content, SaveContent


class FileIdManager(ABC):
Expand Down
3 changes: 2 additions & 1 deletion jupyverse_api/jupyverse_api/jupyterlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse

from jupyverse_api import Config, Router

from ..auth import Auth, User
from ..app import App
from ..auth import Auth, User


class JupyterLab(Router, ABC):
Expand Down
3 changes: 2 additions & 1 deletion jupyverse_api/jupyverse_api/kernels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from typing import List, Optional

from fastapi import APIRouter, Depends, Request
from jupyverse_api import Router, Config
from pydantic import Field

from jupyverse_api import Config, Router

from ..app import App
from ..auth import Auth, User
from .models import Session
Expand Down
3 changes: 2 additions & 1 deletion jupyverse_api/jupyverse_api/lab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

from fastapi import APIRouter, Depends, Request, Response
from fastapi.staticfiles import StaticFiles

from jupyverse_api import Router
from jupyverse_api.jupyterlab import JupyterLabConfig

from ..auth import Auth, User
from ..app import App
from ..auth import Auth, User


class Lab(Router, ABC):
Expand Down
1 change: 1 addition & 0 deletions jupyverse_api/jupyverse_api/login/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod

from fastapi import APIRouter

from jupyverse_api import Router

from ..app import App
Expand Down
1 change: 1 addition & 0 deletions jupyverse_api/jupyverse_api/nbconvert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod

from fastapi import APIRouter, Depends

from jupyverse_api import Router

from ..app import App
Expand Down
5 changes: 3 additions & 2 deletions jupyverse_api/jupyverse_api/resource_usage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from abc import ABC, abstractmethod

from fastapi import APIRouter, Depends
from jupyverse_api import Router, Config

from ..auth import Auth, User
from jupyverse_api import Config, Router

from ..app import App
from ..auth import Auth, User


class ResourceUsage(Router, ABC):
Expand Down
1 change: 1 addition & 0 deletions jupyverse_api/jupyverse_api/retrolab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from fastapi import APIRouter, Depends
from fastapi.responses import HTMLResponse

from jupyverse_api import Router

from ..app import App
Expand Down
3 changes: 2 additions & 1 deletion jupyverse_api/jupyverse_api/terminals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
from typing import List

from fastapi import APIRouter, Depends

from jupyverse_api import Router

from .models import Terminal
from ..app import App
from ..auth import Auth, User
from .models import Terminal


class Terminals(Router, ABC):
Expand Down
3 changes: 2 additions & 1 deletion jupyverse_api/jupyverse_api/yjs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
from typing import Any

from fastapi import APIRouter, Depends, Request, Response

from jupyverse_api import Router

from ..auth import Auth, User
from ..app import App
from ..auth import Auth, User


class Yjs(Router, ABC):
Expand Down
6 changes: 3 additions & 3 deletions notebooks/admin_users.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import contextlib

from fps_auth.models import UserCreate, UserUpdate
from fps_auth.backends import get_backend
from fps_auth.config import _AuthConfig
from jupyverse_api.frontend import FrontendConfig
from fps_auth.db import get_db
from fps_auth.backends import get_backend
from fps_auth.models import UserCreate, UserUpdate
from rich.console import Console
from rich.table import Table
from sqlalchemy import select

from jupyverse_api.frontend import FrontendConfig

auth_config = _AuthConfig()
frontend_config = FrontendConfig()
Expand Down
4 changes: 2 additions & 2 deletions plugins/auth/fps_auth/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
from fastapi_users.authentication.transport.base import Transport
from fastapi_users.db import SQLAlchemyUserDatabase
from httpx_oauth.clients.github import GitHubOAuth2
from starlette.requests import Request

from jupyverse_api.exceptions import RedirectException
from jupyverse_api.frontend import FrontendConfig
from starlette.requests import Request

from .config import _AuthConfig
from .db import User
from .models import UserCreate, UserRead


logger = logging.getLogger("auth")


Expand Down
3 changes: 1 addition & 2 deletions plugins/auth/fps_auth/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import Any, AsyncGenerator, List

from fastapi import Depends
from fastapi_users.db import SQLAlchemyBaseOAuthAccountTableUUID
from fastapi_users.db import (
SQLAlchemyBaseOAuthAccountTableUUID,
SQLAlchemyBaseUserTableUUID,
SQLAlchemyUserDatabase,
)
Expand All @@ -16,7 +16,6 @@

from .config import _AuthConfig


logger = logging.getLogger("auth")


Expand Down
4 changes: 2 additions & 2 deletions plugins/auth/fps_auth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from asphalt.core import Component, Context
from fastapi_users.exceptions import UserAlreadyExists

from jupyverse_api.app import App
from jupyverse_api.auth import Auth, AuthConfig
from jupyverse_api.frontend import FrontendConfig
from jupyverse_api.app import App
from jupyverse_api.main import Host, QueryParams

from .config import _AuthConfig
from .routes import auth_factory


logger = logging.getLogger("auth")


Expand Down
1 change: 1 addition & 0 deletions plugins/auth/fps_auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Dict, List

from fastapi_users import schemas

from jupyverse_api.auth import User


Expand Down
5 changes: 2 additions & 3 deletions plugins/auth/fps_auth/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
from typing import Any, Callable, Dict, List, Optional, Tuple

from fastapi import APIRouter, Depends
from sqlalchemy import select # type: ignore

from jupyverse_api import Router
from jupyverse_api.app import App
from jupyverse_api.auth import Auth
from jupyverse_api.frontend import FrontendConfig
from sqlalchemy import select # type: ignore

from .backends import get_backend
from .config import _AuthConfig
from .db import get_db

from .models import UserCreate, UserRead, UserUpdate


logger = logging.getLogger("auth")


Expand Down
1 change: 1 addition & 0 deletions plugins/auth_fief/fps_auth_fief/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from fastapi.security import APIKeyCookie
from fief_client import FiefAccessTokenInfo, FiefAsync, FiefUserInfo
from fief_client.integrations.fastapi import FiefAuth

from jupyverse_api.auth import User

from .config import _AuthFiefConfig
Expand Down
3 changes: 2 additions & 1 deletion plugins/auth_fief/fps_auth_fief/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from jupyverse_api.auth import AuthConfig
from pydantic import Field

from jupyverse_api.auth import AuthConfig


class _AuthFiefConfig(AuthConfig):
base_url: str = Field(description="Base URL of Fief tenant")
Expand Down
3 changes: 2 additions & 1 deletion plugins/auth_fief/fps_auth_fief/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from asphalt.core import Component, Context
from jupyverse_api.auth import Auth, AuthConfig

from jupyverse_api.app import App
from jupyverse_api.auth import Auth, AuthConfig

from .config import _AuthFiefConfig
from .routes import auth_factory
Expand Down
1 change: 1 addition & 0 deletions plugins/auth_fief/fps_auth_fief/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from fastapi import APIRouter, Depends, Query, Request, Response
from fastapi.responses import RedirectResponse
from fief_client import FiefAccessTokenInfo

from jupyverse_api import Router
from jupyverse_api.app import App
from jupyverse_api.auth import Auth, User
Expand Down
3 changes: 2 additions & 1 deletion plugins/auth_jupyterhub/fps_auth_jupyterhub/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from jupyverse_api.auth import AuthConfig
from pydantic import Field

from jupyverse_api.auth import AuthConfig


class AuthJupyterHubConfig(AuthConfig):
db_url: str = Field(
Expand Down
5 changes: 3 additions & 2 deletions plugins/auth_jupyterhub/fps_auth_jupyterhub/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import httpx
from asphalt.core import Component, ContainerComponent, Context, context_teardown
from jupyverse_api.auth import Auth, AuthConfig
from jupyverse_api.app import App
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession

from jupyverse_api.app import App
from jupyverse_api.auth import Auth, AuthConfig

from .config import AuthJupyterHubConfig
from .db import Base
from .routes import auth_factory
Expand Down
3 changes: 2 additions & 1 deletion plugins/auth_jupyterhub/fps_auth_jupyterhub/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Dict, List

from jupyverse_api.auth import User
from pydantic import ConfigDict

from jupyverse_api.auth import User


class JupyterHubUser(User):
model_config = ConfigDict(from_attributes=True)
Expand Down
7 changes: 4 additions & 3 deletions plugins/auth_jupyterhub/fps_auth_jupyterhub/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
import os
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

import httpx
from fastapi import APIRouter, Cookie, Depends, HTTPException, Request, WebSocket, status
from fastapi.responses import RedirectResponse
from jupyterhub.services.auth import HubOAuth
from jupyterhub.utils import isoformat
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select
from typing_extensions import Annotated

from jupyverse_api import Router
from jupyverse_api.app import App
from jupyverse_api.auth import Auth, User
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select

from .db import UserDB
from .models import JupyterHubUser
Expand Down
Loading

0 comments on commit c5f0e2c

Please sign in to comment.