Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FastAPI monkey-patch #218

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions plugins/yjs/fps_yjs/routes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import asyncio
import re
from datetime import datetime
from pathlib import Path
from typing import Optional, Set, Tuple
from typing import Optional, Tuple

import fastapi
from fastapi import APIRouter, Depends, WebSocketDisconnect
from fps.hooks import register_router # type: ignore
from fps_contents.routes import read_content, write_content # type: ignore
Expand All @@ -27,14 +25,6 @@ class JupyterSQLiteYStore(SQLiteYStore):
router = APIRouter()


def get_path_param_names(path: str) -> Set[str]:
return {name.split(":")[0] for name in re.findall("{(.*?)}", path)}


# FIXME: remove the patch when https://github.com/tiangolo/fastapi/pull/3879 is merged
fastapi.utils.get_path_param_names.__code__ = get_path_param_names.__code__


def to_datetime(iso_date: str) -> datetime:
return datetime.fromisoformat(iso_date.rstrip("Z"))

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package_dir =
python_requires = >=3.7

install_requires =
fastapi >=0.82.0
fps >=0.0.19
fps-uvicorn >=0.0.19
fps-contents
Expand Down