index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
26,244
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app02/test_main.py
16,17
1,24
test_app
17,24
17,24
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
18
105
76
181
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
26,245
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app02_an/main.py
16,18
1,23
info
18,23
18,23
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
102
55
157
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
26,246
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app02_an/test_main.py
16,17
1,24
test_app
17,24
17,24
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
18
105
76
181
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
26,247
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app02_an_py39/main.py
16,18
1,23
info
18,23
18,23
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
100
55
155
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): FILL_FUNC_BODY
26,248
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app02_an_py39/test_main.py
16,17
1,24
test_app
17,24
17,24
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API", "admin_email": "testing_admin@example.com", "items_per_user": 50, }
18
105
76
181
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="testing_admin@example.com") app.dependency_overrides[get_settings] = get_settings_override def test_app(): FILL_FUNC_B...
26,249
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app03/main.py
15,17
1,22
info
17,22
17,22
from functools import lru_cache from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: config.Settings = Depends(get_settings)): FILL_FUNC_BODY
from functools import lru_cache from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: config.Settings = Depends(get_settings)): FILL_FUNC_BODY
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
92
55
147
from functools import lru_cache from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: config.Settings = Depends(get_settings)): FILL_FUNC_BODY
from functools import lru_cache from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: config.Settings = Depends(get_settings)): FILL_FUNC_BODY
26,250
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app03_an/main.py
16,18
1,23
info
18,23
18,23
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BODY
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
103
55
158
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BODY
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BODY
26,251
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/app03_an_py39/main.py
16,18
1,23
info
18,23
18,23
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BO...
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BO...
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
105
55
160
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BO...
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): FILL_FUNC_BO...
26,252
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/settings/tutorial001.py
15,17
1,22
info
17,22
17,22
from fastapi import FastAPI from pydantic_settings import BaseSettings class Settings(BaseSettings): app_name: str = "Awesome API" admin_email: str items_per_user: int = 50 settings = Settings() app = FastAPI() @app.get("/info") async def info(): FILL_FUNC_BODY
from fastapi import FastAPI from pydantic_settings import BaseSettings class Settings(BaseSettings): app_name: str = "Awesome API" admin_email: str items_per_user: int = 50 settings = Settings() app = FastAPI() @app.get("/info") async def info(): FILL_FUNC_BODY
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user, }
9
97
55
152
from fastapi import FastAPI from pydantic_settings import BaseSettings class Settings(BaseSettings): app_name: str = "Awesome API" admin_email: str items_per_user: int = 50 settings = Settings() app = FastAPI() @app.get("/info") async def info(): FILL_FUNC_BODY
from fastapi import FastAPI from pydantic_settings import BaseSettings class Settings(BaseSettings): app_name: str = "Awesome API" admin_email: str items_per_user: int = 50 settings = Settings() app = FastAPI() @app.get("/info") async def info(): FILL_FUNC_BODY
26,253
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app/alt_main.py
44,46
1,63
read_user
46,52
46,52
from typing import List from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session...
from typing import List from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session...
db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user
db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user
15
606
67
673
from typing import List from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session...
from typing import List from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session...
26,254
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app/crud.py
6,7
1,37
get_user
7,10
7,10
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): FILL_FUNC_BODYdef get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_users(db: Session, skip: int = 0, limit: int = 100): return...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): FILL_FUNC_BODYdef get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_users(db: Session, skip: int = 0, limit: int = 100): return...
return db.query(models.User).filter(models.User.id == user_id).first()
return db.query(models.User).filter(models.User.id == user_id).first()
4
367
30
397
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): FILL_FUNC_BODYdef get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_users(db: Session, skip: int = 0, limit: int = 100): return...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): FILL_FUNC_BODYdef get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_users(db: Session, skip: int = 0, limit: int = 100): return...
26,255
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app/main.py
23,25
1,56
create_user
25,31
25,31
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: ...
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: ...
db_user = crud.get_user_by_email(db, email=user.email) if db_user: raise HTTPException(status_code=400, detail="Email already registered") return crud.create_user(db=db, user=user)
db_user = crud.get_user_by_email(db, email=user.email) if db_user: raise HTTPException(status_code=400, detail="Email already registered") return crud.create_user(db=db, user=user)
14
512
79
591
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: ...
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: ...
26,256
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py310/alt_main.py
36,38
1,61
read_users
38,42
38,42
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
users = crud.get_users(db, skip=skip, limit=limit) return users
users = crud.get_users(db, skip=skip, limit=limit) return users
7
634
31
665
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
26,257
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py310/crud.py
27,28
1,37
get_items
28,31
28,31
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
return db.query(models.Item).offset(skip).limit(limit).all()
return db.query(models.Item).offset(skip).limit(limit).all()
2
371
26
397
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
26,258
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py310/main.py
21,23
1,54
create_user
23,29
23,29
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
db_user = crud.get_user_by_email(db, email=user.email) if db_user: raise HTTPException(status_code=400, detail="Email already registered") return crud.create_user(db=db, user=user)
db_user = crud.get_user_by_email(db, email=user.email) if db_user: raise HTTPException(status_code=400, detail="Email already registered") return crud.create_user(db=db, user=user)
14
506
79
585
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
26,259
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py39/alt_main.py
12,14
1,61
db_session_middleware
14,24
14,24
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
response = Response("Internal server error", status_code=500) try: request.state.db = SessionLocal() response = await call_next(request) finally: request.state.db.close() return response # Dependency
response = Response("Internal server error", status_code=500) try: request.state.db = SessionLocal() response = await call_next(request) finally: request.state.db.close() return response # Dependency
20
592
79
671
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Requ...
26,260
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py39/crud.py
18,19
1,37
create_user
19,27
19,27
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
fake_hashed_password = user.password + "notreallyhashed" db_user = models.User(email=user.email, hashed_password=fake_hashed_password) db.add(db_user) db.commit() db.refresh(db_user) return db_user
fake_hashed_password = user.password + "notreallyhashed" db_user = models.User(email=user.email, hashed_password=fake_hashed_password) db.add(db_user) db.commit() db.refresh(db_user) return db_user
14
311
91
402
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
from sqlalchemy.orm import Session from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).filter(models.User.id == user_id).first() def get_user_by_email(db: Session, email: str): return db.query(models.User).filter(models.User.email == email).first() def get_...
26,261
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases/sql_app_py39/main.py
35,37
1,54
read_user
37,43
37,43
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user
db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user
15
518
67
585
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally...
26,262
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases_peewee/sql_app/crud.py
27,28
1,31
create_user_item
28,31
28,31
from . import models, schemas def get_user(user_id: int): return models.User.filter(models.User.id == user_id).first() def get_user_by_email(email: str): return models.User.filter(models.User.email == email).first() def get_users(skip: int = 0, limit: int = 100): return list(models.User.select().offse...
from . import models, schemas def get_user(user_id: int): return models.User.filter(models.User.id == user_id).first() def get_user_by_email(email: str): return models.User.filter(models.User.email == email).first() def get_users(skip: int = 0, limit: int = 100): return list(models.User.select().offse...
db_item = models.Item(**item.dict(), owner_id=user_id) db_item.save() return db_item
db_item = models.Item(**item.dict(), owner_id=user_id) db_item.save() return db_item
7
272
40
312
from . import models, schemas def get_user(user_id: int): return models.User.filter(models.User.id == user_id).first() def get_user_by_email(email: str): return models.User.filter(models.User.email == email).first() def get_users(skip: int = 0, limit: int = 100): return list(models.User.select().offse...
from . import models, schemas def get_user(user_id: int): return models.User.filter(models.User.id == user_id).first() def get_user_by_email(email: str): return models.User.filter(models.User.email == email).first() def get_users(skip: int = 0, limit: int = 100): return list(models.User.select().offse...
26,263
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sql_databases_peewee/sql_app/main.py
71,75
1,80
read_slow_users
75,80
75,80
import time from typing import List from fastapi import Depends, FastAPI, HTTPException from . import crud, database, models, schemas from .database import db_state_default database.db.connect() database.db.create_tables([models.User, models.Item]) database.db.close() app = FastAPI() sleep_time = 10 async def re...
import time from typing import List from fastapi import Depends, FastAPI, HTTPException from . import crud, database, models, schemas from .database import db_state_default database.db.connect() database.db.create_tables([models.User, models.Item]) database.db.close() app = FastAPI() sleep_time = 10 async def re...
global sleep_time sleep_time = max(0, sleep_time - 1) time.sleep(sleep_time) # Fake long processing request users = crud.get_users(skip=skip, limit=limit) return users
global sleep_time sleep_time = max(0, sleep_time - 1) time.sleep(sleep_time) # Fake long processing request users = crud.get_users(skip=skip, limit=limit) return users
20
722
68
790
import time from typing import List from fastapi import Depends, FastAPI, HTTPException from . import crud, database, models, schemas from .database import db_state_default database.db.connect() database.db.create_tables([models.User, models.Item]) database.db.close() app = FastAPI() sleep_time = 10 async def re...
import time from typing import List from fastapi import Depends, FastAPI, HTTPException from . import crud, database, models, schemas from .database import db_state_default database.db.connect() database.db.create_tables([models.User, models.Item]) database.db.close() app = FastAPI() sleep_time = 10 async def re...
26,264
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/sub_applications/tutorial001.py
6,8
1,20
read_main
8,11
8,11
from fastapi import FastAPI app = FastAPI() @app.get("/app") def read_main(): FILL_FUNC_BODYsubapi = FastAPI() @subapi.get("/sub") def read_sub(): return {"message": "Hello World from sub API"} app.mount("/subapi", subapi)
from fastapi import FastAPI app = FastAPI() @app.get("/app") def read_main(): FILL_FUNC_BODYsubapi = FastAPI() @subapi.get("/sub") def read_sub(): return {"message": "Hello World from sub API"} app.mount("/subapi", subapi)
return {"message": "Hello World from main app"}
return {"message": "Hello World from main app"}
7
90
18
108
from fastapi import FastAPI app = FastAPI() @app.get("/app") def read_main(): FILL_FUNC_BODYsubapi = FastAPI() @subapi.get("/sub") def read_sub(): return {"message": "Hello World from sub API"} app.mount("/subapi", subapi)
from fastapi import FastAPI app = FastAPI() @app.get("/app") def read_main(): FILL_FUNC_BODYsubapi = FastAPI() @subapi.get("/sub") def read_sub(): return {"message": "Hello World from sub API"} app.mount("/subapi", subapi)
26,265
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/templates/tutorial001.py
14,16
1,19
read_item
16,19
16,19
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") @app.ge...
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") @app.ge...
return templates.TemplateResponse( request=request, name="item.html", context={"id": id} )
return templates.TemplateResponse( request=request, name="item.html", context={"id": id} )
7
138
34
172
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") @app.ge...
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") @app.ge...
26,266
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/using_request_directly/tutorial001.py
6,8
1,10
read_root
8,10
8,10
from fastapi import FastAPI, Request app = FastAPI() @app.get("/items/{item_id}") def read_root(item_id: str, request: Request): FILL_FUNC_BODY
from fastapi import FastAPI, Request app = FastAPI() @app.get("/items/{item_id}") def read_root(item_id: str, request: Request): FILL_FUNC_BODY
client_host = request.client.host return {"client_host": client_host, "item_id": item_id}
client_host = request.client.host return {"client_host": client_host, "item_id": item_id}
8
57
34
91
from fastapi import FastAPI, Request app = FastAPI() @app.get("/items/{item_id}") def read_root(item_id: str, request: Request): FILL_FUNC_BODY
from fastapi import FastAPI, Request app = FastAPI() @app.get("/items/{item_id}") def read_root(item_id: str, request: Request): FILL_FUNC_BODY
26,267
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial001.py
46,48
1,52
websocket_endpoint
48,52
48,52
from fastapi import FastAPI, WebSocket from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)"> <input type="text" id="me...
from fastapi import FastAPI, WebSocket from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)"> <input type="text" id="me...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text(f"Message text was: {data}")
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text(f"Message text was: {data}")
13
366
50
416
from fastapi import FastAPI, WebSocket from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)"> <input type="text" id="me...
from fastapi import FastAPI, WebSocket from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)"> <input type="text" id="me...
26,268
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial002.py
76,83
1,92
websocket_endpoint
83,92
83,92
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>W...
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>W...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
39
727
126
853
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>W...
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>W...
26,269
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial002_an.py
77,85
1,94
websocket_endpoint
85,94
85,94
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse from typing_extensions import Annotated app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</tit...
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse from typing_extensions import Annotated app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</tit...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
39
753
126
879
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse from typing_extensions import Annotated app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</tit...
from typing import Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse from typing_extensions import Annotated app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</tit...
26,270
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial002_an_py310.py
61,63
1,93
get
63,66
63,66
from typing import Annotated from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <...
from typing import Annotated from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <...
return HTMLResponse(html)
return HTMLResponse(html)
2
844
13
857
from typing import Annotated from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <...
from typing import Annotated from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <...
26,271
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial002_an_py39.py
76,84
1,93
websocket_endpoint
84,93
84,93
from typing import Annotated, Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> ...
from typing import Annotated, Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> ...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text( f"Session cookie or query token value is: {cookie_or_token}" ) if q is not None: await websocket.send_text(f"Query parameter q is: {q}") await web...
39
748
126
874
from typing import Annotated, Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> ...
from typing import Annotated, Union from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> ...
26,272
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial002_py310.py
64,69
1,90
get_cookie_or_token
69,74
69,74
from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> ...
from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> ...
if session is None and token is None: raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION) return session or token
if session is None and token is None: raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION) return session or token
14
783
51
834
from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> ...
from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> ...
26,273
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial003.py
68,70
1,84
get
70,73
70,73
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
return HTMLResponse(html)
return HTMLResponse(html)
2
738
13
751
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
26,274
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial003.py
57,58
46,65
send_personal_message
ConnectionManager
58,60
58,60
class ConnectionManager: def __init__(self): self.active_connections: List[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.r...
class ConnectionManager: def __init__(self): self.active_connections: List[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.r...
await websocket.send_text(message)
await websocket.send_text(message)
2
166
15
181
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
from typing import List from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span><...
26,275
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial003_py39.py
71,73
1,82
websocket_endpoint
73,82
73,82
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
await manager.connect(websocket) try: while True: data = await websocket.receive_text() await manager.send_personal_message(f"You wrote: {data}", websocket) await manager.broadcast(f"Client #{client_id} says: {data}") except WebSocketDisconnect: manager.di...
await manager.connect(websocket) try: while True: data = await websocket.receive_text() await manager.send_personal_message(f"You wrote: {data}", websocket) await manager.broadcast(f"Client #{client_id} says: {data}") except WebSocketDisconnect: manager.di...
28
621
130
751
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
26,276
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/websockets/tutorial003_py39.py
55,56
44,63
send_personal_message
ConnectionManager
56,58
56,58
class ConnectionManager: def __init__(self): self.active_connections: list[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.r...
class ConnectionManager: def __init__(self): self.active_connections: list[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.r...
await websocket.send_text(message)
await websocket.send_text(message)
2
166
15
181
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <h2>Your ID: <span id="ws-id"></span></h2> <form action...
26,277
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/wsgi/tutorial001.py
9,11
1,24
flask_main
11,15
11,15
from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from flask import Flask, request from markupsafe import escape flask_app = Flask(__name__) @flask_app.route("/") def flask_main(): FILL_FUNC_BODYapp = FastAPI() @app.get("/v2") def read_main(): return {"message": "Hello World"} ap...
from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from flask import Flask, request from markupsafe import escape flask_app = Flask(__name__) @flask_app.route("/") def flask_main(): FILL_FUNC_BODYapp = FastAPI() @app.get("/v2") def read_main(): return {"message": "Hello World"} ap...
name = request.args.get("name", "World") return f"Hello, {escape(name)} from Flask!"
name = request.args.get("name", "World") return f"Hello, {escape(name)} from Flask!"
9
137
37
174
from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from flask import Flask, request from markupsafe import escape flask_app = Flask(__name__) @flask_app.route("/") def flask_main(): FILL_FUNC_BODYapp = FastAPI() @app.get("/v2") def read_main(): return {"message": "Hello World"} ap...
from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from flask import Flask, request from markupsafe import escape flask_app = Flask(__name__) @flask_app.route("/") def flask_main(): FILL_FUNC_BODYapp = FastAPI() @app.get("/v2") def read_main(): return {"message": "Hello World"} ap...
26,279
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/background.py
38,53
9,60
add_task
BackgroundTasks
59,60
53,60
class BackgroundTasks(StarletteBackgroundTasks): """ A collection of background tasks that will be called after a response has been sent to the client. Read more about it in the [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). ## Example ```pyt...
class BackgroundTasks(StarletteBackgroundTasks): """ A collection of background tasks that will be called after a response has been sent to the client. Read more about it in the [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). ## Example ```pyt...
return super().add_task(func, *args, **kwargs)
""" Add a function to be called in the background after the response is sent. Read more about it in the [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). """ return super().add_task(func, *args, **kwargs)
4
433
18
451
from typing import Any, Callable from starlette.background import BackgroundTasks as StarletteBackgroundTasks from typing_extensions import Annotated, Doc, ParamSpec P = ParamSpec("P") class BackgroundTasks(StarletteBackgroundTasks): """ A collection of background tasks that will be called after a response ...
from typing import Any, Callable from starlette.background import BackgroundTasks as StarletteBackgroundTasks from typing_extensions import Annotated, Doc, ParamSpec P = ParamSpec("P") class BackgroundTasks(StarletteBackgroundTasks): """ A collection of background tasks that will be called after a response ...
26,280
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/datastructures.py
197,198
1,205
Default
204,205
198,205
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
return DefaultPlaceholder(value) # type: ignore
""" You shouldn't use this function directly. It's used internally to recognize when a default value has been overwritten, even if the overridden default value was truthy. """ return DefaultPlaceholder(value) # type: ignore
5
1,672
15
1,687
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
26,281
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/datastructures.py
145,147
30,176
validate
UploadFile
147,151
147,151
class UploadFile(StarletteUploadFile): """ A file uploaded in a request. Define it as a *path operation function* (or dependency) parameter. If you are using a regular `def` function, you can use the `upload_file.file` attribute to access the raw standard Python file (blocking, not async), useful ...
class UploadFile(StarletteUploadFile): """ A file uploaded in a request. Define it as a *path operation function* (or dependency) parameter. If you are using a regular `def` function, you can use the `upload_file.file` attribute to access the raw standard Python file (blocking, not async), useful ...
if not isinstance(v, StarletteUploadFile): raise ValueError(f"Expected UploadFile, received: {type(v)}") return v
if not isinstance(v, StarletteUploadFile): raise ValueError(f"Expected UploadFile, received: {type(v)}") return v
11
1,147
44
1,191
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
from typing import ( Any, BinaryIO, Callable, Dict, Iterable, Optional, Type, TypeVar, cast, ) from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, with_info_plain_validator_function, ) from starlette.datastructures import...
26,283
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/exception_handlers.py
11,12
1,35
http_exception_handler
12,20
12,20
from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.utils import is_body_allowed_for_status_code from fastapi.websockets import WebSocket from starlette.exceptions import HTTPException from starlette.requests import Request fr...
from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.utils import is_body_allowed_for_status_code from fastapi.websockets import WebSocket from starlette.exceptions import HTTPException from starlette.requests import Request fr...
headers = getattr(exc, "headers", None) if not is_body_allowed_for_status_code(exc.status_code): return Response(status_code=exc.status_code, headers=headers) return JSONResponse( {"detail": exc.detail}, status_code=exc.status_code, headers=headers )
headers = getattr(exc, "headers", None) if not is_body_allowed_for_status_code(exc.status_code): return Response(status_code=exc.status_code, headers=headers) return JSONResponse( {"detail": exc.detail}, status_code=exc.status_code, headers=headers )
18
318
96
414
from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.utils import is_body_allowed_for_status_code from fastapi.websockets import WebSocket from starlette.exceptions import HTTPException from starlette.requests import Request fr...
from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError from fastapi.utils import is_body_allowed_for_status_code from fastapi.websockets import WebSocket from starlette.exceptions import HTTPException from starlette.requests import Request fr...
26,284
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/exceptions.py
153,154
149,157
errors
ValidationException
154,157
154,157
class ValidationException(Exception): def __init__(self, errors: Sequence[Any]) -> None: self._errors = errors def errors(self) -> Sequence[Any]: FILL_FUNC_BODY
class ValidationException(Exception): def __init__(self, errors: Sequence[Any]) -> None: self._errors = errors def errors(self) -> Sequence[Any]: FILL_FUNC_BODY
return self._errors
return self._errors
2
59
11
70
from typing import Any, Dict, Optional, Sequence, Type, Union from pydantic import BaseModel, create_model from starlette.exceptions import HTTPException as StarletteHTTPException from starlette.exceptions import WebSocketException as StarletteWebSocketException from typing_extensions import Annotated, Doc class HTT...
from typing import Any, Dict, Optional, Sequence, Type, Union from pydantic import BaseModel, create_model from starlette.exceptions import HTTPException as StarletteHTTPException from starlette.exceptions import WebSocketException as StarletteWebSocketException from typing_extensions import Annotated, Doc class HTT...
26,286
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/openapi/models.py
29,31
24,58
validate
EmailStr
31,37
31,37
class EmailStr(str): # type: ignore @classmethod def __get_validators__(cls) -> Iterable[Callable[..., Any]]: yield cls.validate @classmethod def validate(cls, v: Any) -> str: FILL_FUNC_BODY @classmethod def _validate(cls, __input_value: Any, _: Any) -> s...
class EmailStr(str): # type: ignore @classmethod def __get_validators__(cls) -> Iterable[Callable[..., Any]]: yield cls.validate @classmethod def validate(cls, v: Any) -> str: FILL_FUNC_BODY @classmethod def _validate(cls, __input_value: Any, _: Any) -> s...
logger.warning( "email-validator not installed, email fields will be treated as str.\n" "To install, run: pip install email-validator" ) return str(v)
logger.warning( "email-validator not installed, email fields will be treated as str.\n" "To install, run: pip install email-validator" ) return str(v)
20
292
58
350
from enum import Enum from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Type, Union from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, _model_rebuild, with_info_plain_validator_function, ) from fastapi.logger import logger from pyd...
from enum import Enum from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Type, Union from fastapi._compat import ( PYDANTIC_V2, CoreSchema, GetJsonSchemaHandler, JsonSchemaValue, _model_rebuild, with_info_plain_validator_function, ) from fastapi.logger import logger from pyd...
26,288
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/responses.py
44,45
36,49
render
ORJSONResponse
45,49
45,49
class ORJSONResponse(JSONResponse): """ JSON response using the high-performance orjson library to serialize data to JSON. Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). """ def render(self, con...
class ORJSONResponse(JSONResponse): """ JSON response using the high-performance orjson library to serialize data to JSON. Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). """ def render(self, con...
assert orjson is not None, "orjson must be installed to use ORJSONResponse" return orjson.dumps( content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY )
assert orjson is not None, "orjson must be installed to use ORJSONResponse" return orjson.dumps( content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY )
19
107
70
177
from typing import Any from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import HTMLResponse as HTMLResponse # noqa from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa from starl...
from typing import Any from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import HTMLResponse as HTMLResponse # noqa from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa from starl...
26,289
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/responses.py
31,32
23,36
render
UJSONResponse
32,36
32,36
class UJSONResponse(JSONResponse): """ JSON response using the high-performance ujson library to serialize data to JSON. Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). """ def render(self, conte...
class UJSONResponse(JSONResponse): """ JSON response using the high-performance ujson library to serialize data to JSON. Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). """ def render(self, conte...
assert ujson is not None, "ujson must be installed to use UJSONResponse" return ujson.dumps(content, ensure_ascii=False).encode("utf-8")
assert ujson is not None, "ujson must be installed to use UJSONResponse" return ujson.dumps(content, ensure_ascii=False).encode("utf-8")
15
107
52
159
from typing import Any from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import HTMLResponse as HTMLResponse # noqa from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa from starl...
from typing import Any from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import HTMLResponse as HTMLResponse # noqa from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa from starl...
26,293
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/routing.py
382,383
353,389
matches
APIWebSocketRoute
383,389
383,389
class APIWebSocketRoute(routing.WebSocketRoute): def __init__( self, path: str, endpoint: Callable[..., Any], *, name: Optional[str] = None, dependencies: Optional[Sequence[params.Depends]] = None, dependency_overrides_provider: Optional[Any] = None, ) -> ...
class APIWebSocketRoute(routing.WebSocketRoute): def __init__( self, path: str, endpoint: Callable[..., Any], *, name: Optional[str] = None, dependencies: Optional[Sequence[params.Depends]] = None, dependency_overrides_provider: Optional[Any] = None, ) -> ...
match, child_scope = super().matches(scope) if match != Match.NONE: child_scope["route"] = self return match, child_scope
match, child_scope = super().matches(scope) if match != Match.NONE: child_scope["route"] = self return match, child_scope
14
346
52
398
import asyncio import dataclasses import email.message import inspect import json from contextlib import AsyncExitStack from enum import Enum, IntEnum from typing import ( Any, Callable, Coroutine, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, ) from fastapi impor...
import asyncio import dataclasses import email.message import inspect import json from contextlib import AsyncExitStack from enum import Enum, IntEnum from typing import ( Any, Callable, Coroutine, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, ) from fastapi impor...
26,294
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/fastapi/security/utils.py
4,7
1,11
get_authorization_scheme_param
7,11
7,11
from typing import Optional, Tuple def get_authorization_scheme_param( authorization_header_value: Optional[str], ) -> Tuple[str, str]: FILL_FUNC_BODY
from typing import Optional, Tuple def get_authorization_scheme_param( authorization_header_value: Optional[str], ) -> Tuple[str, str]: FILL_FUNC_BODY
if not authorization_header_value: return "", "" scheme, _, param = authorization_header_value.partition(" ") return scheme, param
if not authorization_header_value: return "", "" scheme, _, param = authorization_header_value.partition(" ") return scheme, param
15
55
43
98
from typing import Optional, Tuple def get_authorization_scheme_param( authorization_header_value: Optional[str], ) -> Tuple[str, str]: FILL_FUNC_BODY
from typing import Optional, Tuple def get_authorization_scheme_param( authorization_header_value: Optional[str], ) -> Tuple[str, str]: FILL_FUNC_BODY
26,297
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/mkdocs_hooks.py
36,37
1,141
on_config
37,47
37,47
from functools import lru_cache from pathlib import Path from typing import Any, List, Union import material from mkdocs.config.defaults import MkDocsConfig from mkdocs.structure.files import File, Files from mkdocs.structure.nav import Link, Navigation, Section from mkdocs.structure.pages import Page non_traslated_s...
from functools import lru_cache from pathlib import Path from typing import Any, List, Union import material from mkdocs.config.defaults import MkDocsConfig from mkdocs.structure.files import File, Files from mkdocs.structure.nav import Link, Navigation, Section from mkdocs.structure.pages import Page non_traslated_s...
available_langs = get_mkdocs_material_langs() dir_path = Path(config.docs_dir) lang = dir_path.parent.name if lang in available_langs: config.theme["language"] = lang if not (config.site_url or "").endswith(f"{lang}/") and not lang == "en": config.site_url = f"{config.site_url}{lang}...
available_langs = get_mkdocs_material_langs() dir_path = Path(config.docs_dir) lang = dir_path.parent.name if lang in available_langs: config.theme["language"] = lang if not (config.site_url or "").endswith(f"{lang}/") and not lang == "en": config.site_url = f"{config.site_url}{lang}...
31
1,487
128
1,615
from functools import lru_cache from pathlib import Path from typing import Any, List, Union import material from mkdocs.config.defaults import MkDocsConfig from mkdocs.structure.files import File, Files from mkdocs.structure.nav import Link, Navigation, Section from mkdocs.structure.pages import Page non_traslated_s...
from functools import lru_cache from pathlib import Path from typing import Any, List, Union import material from mkdocs.config.defaults import MkDocsConfig from mkdocs.structure.files import File, Files from mkdocs.structure.nav import Link, Navigation, Section from mkdocs.structure.pages import Page non_traslated_s...
26,298
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/playwright/separate_openapi_schemas/image01.py
6,7
1,30
run
7,22
7,22
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("POST/items/Create Item").click() page.get_by_role("tab", name="Schema").first.click() ...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("POST/items/Create Item").click() page.get_by_role("tab", name="Schema").first.click() ...
24
128
191
319
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
26,299
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/playwright/separate_openapi_schemas/image02.py
6,7
1,31
run
7,23
7,23
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("GET/items/Read Items").click() page.get_by_role("button", name="Try it out").click() ...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("GET/items/Read Items").click() page.get_by_role("button", name="Try it out").click() ...
28
128
212
340
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
26,300
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/playwright/separate_openapi_schemas/image03.py
6,7
1,31
run
7,23
7,23
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("GET/items/Read Items").click() page.get_by_role("tab", name="Schema").click() page.g...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_text("GET/items/Read Items").click() page.get_by_role("tab", name="Schema").click() page.g...
27
128
220
348
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
26,301
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/playwright/separate_openapi_schemas/image04.py
6,7
1,30
run
7,22
7,22
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_role("button", name="Item-Input").click() page.get_by_role("button", name="Item-Output").click...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_role("button", name="Item-Input").click() page.get_by_role("button", name="Item-Output").click...
28
128
218
346
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
26,302
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/scripts/playwright/separate_openapi_schemas/image05.py
6,7
1,30
run
7,22
7,22
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial002:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial002:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_role("button", name="Item", exact=True).click() page.set_viewport_size({"width": 960, "height"...
browser = playwright.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 960, "height": 1080}) page = context.new_page() page.goto("http://localhost:8000/docs") page.get_by_role("button", name="Item", exact=True).click() page.set_viewport_size({"width": 960, "height"...
27
128
200
328
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial002:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
import subprocess from playwright.sync_api import Playwright, sync_playwright def run(playwright: Playwright) -> None: FILL_FUNC_BODYprocess = subprocess.Popen( ["uvicorn", "docs_src.separate_openapi_schemas.tutorial002:app"] ) try: with sync_playwright() as playwright: run(playwright) finally: p...
26,494
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/app_dir/tutorial001.py
8,9
1,17
main
9,15
9,15
from pathlib import Path import typer APP_NAME = "my-super-cli-app" def main(): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from pathlib import Path import typer APP_NAME = "my-super-cli-app" def main(): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
app_dir = typer.get_app_dir(APP_NAME) config_path: Path = Path(app_dir) / "config.json" if not config_path.is_file(): print("Config file doesn't exist yet")
app_dir = typer.get_app_dir(APP_NAME) config_path: Path = Path(app_dir) / "config.json" if not config_path.is_file(): print("Config file doesn't exist yet")
17
62
71
133
from pathlib import Path import typer APP_NAME = "my-super-cli-app" def main(): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from pathlib import Path import typer APP_NAME = "my-super-cli-app" def main(): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,495
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/default/tutorial001.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument("Wade Wilson")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("Wade Wilson")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
54
16
70
import typer def main(name: str = typer.Argument("Wade Wilson")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("Wade Wilson")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,496
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/default/tutorial001_an.py
5,6
1,11
main
6,9
6,9
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()] = "Wade Wilson"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()] = "Wade Wilson"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
70
16
86
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()] = "Wade Wilson"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()] = "Wade Wilson"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,497
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/default/tutorial002.py
6,7
1,16
get_name
7,10
7,10
import random import typer def get_name(): FILL_FUNC_BODYdef main(name: str = typer.Argument(default_factory=get_name)): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
import random import typer def get_name(): FILL_FUNC_BODYdef main(name: str = typer.Argument(default_factory=get_name)): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
5
81
31
112
import random import typer def get_name(): FILL_FUNC_BODYdef main(name: str = typer.Argument(default_factory=get_name)): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
import random import typer def get_name(): FILL_FUNC_BODYdef main(name: str = typer.Argument(default_factory=get_name)): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
26,498
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/default/tutorial002_an.py
7,8
1,17
get_name
8,11
8,11
import random import typer from typing_extensions import Annotated def get_name(): FILL_FUNC_BODYdef main(name: Annotated[str, typer.Argument(default_factory=get_name)]): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
import random import typer from typing_extensions import Annotated def get_name(): FILL_FUNC_BODYdef main(name: Annotated[str, typer.Argument(default_factory=get_name)]): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
5
94
31
125
import random import typer from typing_extensions import Annotated def get_name(): FILL_FUNC_BODYdef main(name: Annotated[str, typer.Argument(default_factory=get_name)]): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
import random import typer from typing_extensions import Annotated def get_name(): FILL_FUNC_BODYdef main(name: Annotated[str, typer.Argument(default_factory=get_name)]): print(f"Hello {name}") if __name__ == "__main__": typer.run(main)
26,499
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial001.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
62
18
80
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,500
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial001_an.py
5,6
1,11
main
6,9
6,9
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(envvar="AWESOME_NAME")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(envvar="AWESOME_NAME")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
77
18
95
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(envvar="AWESOME_NAME")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(envvar="AWESOME_NAME")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,501
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial002.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument("World", envvar=["AWESOME_NAME", "GOD_NAME"])): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar=["AWESOME_NAME", "GOD_NAME"])): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
69
18
87
import typer def main(name: str = typer.Argument("World", envvar=["AWESOME_NAME", "GOD_NAME"])): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar=["AWESOME_NAME", "GOD_NAME"])): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,502
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial002_an.py
5,8
1,13
main
8,11
8,11
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
88
18
106
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,503
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial003.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME", show_envvar=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME", show_envvar=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
69
18
87
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME", show_envvar=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", envvar="AWESOME_NAME", show_envvar=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,504
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/envvar/tutorial003_an.py
5,10
1,15
main
10,13
10,13
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(envvar="AWESOME_NAME", show_envvar=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(envvar="AWESOME_NAME", show_envvar=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello Mr. {name}")
print(f"Hello Mr. {name}")
3
92
18
110
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(envvar="AWESOME_NAME", show_envvar=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(envvar="AWESOME_NAME", show_envvar=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,505
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial001.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
63
16
79
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,506
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial001_an.py
5,6
1,11
main
6,9
6,9
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
74
16
90
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,507
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial002.py
4,5
1,13
main
8,11
5,11
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
82
16
98
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(..., help="The name of the user to greet")): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,508
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial002_an.py
5,6
1,14
main
9,12
6,12
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
93
16
109
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="The name of the user to greet")]): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,509
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial003.py
4,5
1,13
main
8,11
5,11
import typer def main(name: str = typer.Argument("World", help="Who to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", help="Who to greet")): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
78
16
94
import typer def main(name: str = typer.Argument("World", help="Who to greet")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", help="Who to greet")): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,510
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial003_an.py
5,6
1,14
main
9,12
6,12
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="Who to greet")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="Who to greet")] = "World"): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
93
16
109
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="Who to greet")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(help="Who to greet")] = "World"): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,511
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial004.py
4,5
1,13
main
8,11
5,11
import typer def main(name: str = typer.Argument("World", help="Who to greet", show_default=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", help="Who to greet", show_default=False)): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
84
16
100
import typer def main(name: str = typer.Argument("World", help="Who to greet", show_default=False)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", help="Who to greet", show_default=False)): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,512
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial004_an.py
5,10
1,18
main
13,16
10,16
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(help="Who to greet", show_default=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(help="Who to greet", show_default=False) ] = "World", ): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
107
16
123
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(help="Who to greet", show_default=False) ] = "World", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument(help="Who to greet", show_default=False) ] = "World", ): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,513
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial005.py
4,9
1,14
main
9,12
9,12
import typer def main( name: str = typer.Argument( "Wade Wilson", help="Who to greet", show_default="Deadpoolio the amazing's name" ), ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main( name: str = typer.Argument( "Wade Wilson", help="Who to greet", show_default="Deadpoolio the amazing's name" ), ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
85
16
101
import typer def main( name: str = typer.Argument( "Wade Wilson", help="Who to greet", show_default="Deadpoolio the amazing's name" ), ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main( name: str = typer.Argument( "Wade Wilson", help="Who to greet", show_default="Deadpoolio the amazing's name" ), ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,514
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial005_an.py
5,13
1,18
main
13,16
13,16
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument( help="Who to greet", show_default="Deadpoolio the amazing's name" ), ] = "Wade Wilson", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument( help="Who to greet", show_default="Deadpoolio the amazing's name" ), ] = "Wade Wilson", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
106
16
122
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument( help="Who to greet", show_default="Deadpoolio the amazing's name" ), ] = "Wade Wilson", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main( name: Annotated[ str, typer.Argument( help="Who to greet", show_default="Deadpoolio the amazing's name" ), ] = "Wade Wilson", ): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,515
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial006.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument("World", metavar="✨username✨")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", metavar="✨username✨")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
65
16
81
import typer def main(name: str = typer.Argument("World", metavar="✨username✨")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", metavar="✨username✨")): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,516
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial006_an.py
5,6
1,11
main
6,9
6,9
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(metavar="✨username✨")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(metavar="✨username✨")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
80
16
96
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(metavar="✨username✨")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(metavar="✨username✨")] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,517
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial007.py
4,13
1,21
main
16,19
13,19
import typer def main( name: str = typer.Argument(..., help="Who to greet"), lastname: str = typer.Argument( "", help="The last name", rich_help_panel="Secondary Arguments" ), age: str = typer.Argument( "", help="The user's age", rich_help_panel="Secondary Arguments" ), ): FILL_FUN...
import typer def main( name: str = typer.Argument(..., help="Who to greet"), lastname: str = typer.Argument( "", help="The last name", rich_help_panel="Secondary Arguments" ), age: str = typer.Argument( "", help="The user's age", rich_help_panel="Secondary Arguments" ), ): """ ...
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
156
16
172
import typer def main( name: str = typer.Argument(..., help="Who to greet"), lastname: str = typer.Argument( "", help="The last name", rich_help_panel="Secondary Arguments" ), age: str = typer.Argument( "", help="The user's age", rich_help_panel="Secondary Arguments" ), ): FILL_FUN...
import typer def main( name: str = typer.Argument(..., help="Who to greet"), lastname: str = typer.Argument( "", help="The last name", rich_help_panel="Secondary Arguments" ), age: str = typer.Argument( "", help="The user's age", rich_help_panel="Secondary Arguments" ), ): """ ...
26,518
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial007_an.py
5,15
1,23
main
18,21
15,21
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(help="Who to greet")], lastname: Annotated[ str, typer.Argument(help="The last name", rich_help_panel="Secondary Arguments") ] = "", age: Annotated[ str, typer.Argument(help="The ...
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(help="Who to greet")], lastname: Annotated[ str, typer.Argument(help="The last name", rich_help_panel="Secondary Arguments") ] = "", age: Annotated[ str, typer.Argument(help="The ...
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
180
16
196
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(help="Who to greet")], lastname: Annotated[ str, typer.Argument(help="The last name", rich_help_panel="Secondary Arguments") ] = "", age: Annotated[ str, typer.Argument(help="The ...
import typer from typing_extensions import Annotated def main( name: Annotated[str, typer.Argument(help="Who to greet")], lastname: Annotated[ str, typer.Argument(help="The last name", rich_help_panel="Secondary Arguments") ] = "", age: Annotated[ str, typer.Argument(help="The ...
26,519
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial008.py
4,5
1,13
main
8,11
5,11
import typer def main(name: str = typer.Argument("World", hidden=True)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", hidden=True)): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
75
16
91
import typer def main(name: str = typer.Argument("World", hidden=True)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument("World", hidden=True)): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,520
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/help/tutorial008_an.py
5,6
1,14
main
9,12
6,12
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(hidden=True)] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(hidden=True)] = "World"): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
""" Say hi to NAME very gently, like Dirk. """ print(f"Hello {name}")
2
90
16
106
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(hidden=True)] = "World"): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument(hidden=True)] = "World"): """ Say hi to NAME very gently, like Dirk. """ FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,521
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/optional/tutorial001.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument()): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument()): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
50
16
66
import typer def main(name: str = typer.Argument()): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument()): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,522
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/optional/tutorial001_an.py
5,6
1,11
main
6,9
6,9
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
64
16
80
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer from typing_extensions import Annotated def main(name: Annotated[str, typer.Argument()]): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,523
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/optional/tutorial002.py
6,7
1,15
main
7,13
7,13
from typing import Optional import typer def main(name: Optional[str] = typer.Argument(default=None)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from typing import Optional import typer def main(name: Optional[str] = typer.Argument(default=None)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
if name is None: print("Hello World!") else: print(f"Hello {name}")
if name is None: print("Hello World!") else: print(f"Hello {name}")
9
63
38
101
from typing import Optional import typer def main(name: Optional[str] = typer.Argument(default=None)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from typing import Optional import typer def main(name: Optional[str] = typer.Argument(default=None)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,524
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/optional/tutorial002_an.py
7,8
1,16
main
8,14
8,14
from typing import Optional import typer from typing_extensions import Annotated def main(name: Annotated[Optional[str], typer.Argument()] = None): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from typing import Optional import typer from typing_extensions import Annotated def main(name: Annotated[Optional[str], typer.Argument()] = None): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
if name is None: print("Hello World!") else: print(f"Hello {name}")
if name is None: print("Hello World!") else: print(f"Hello {name}")
9
74
38
112
from typing import Optional import typer from typing_extensions import Annotated def main(name: Annotated[Optional[str], typer.Argument()] = None): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
from typing import Optional import typer from typing_extensions import Annotated def main(name: Annotated[Optional[str], typer.Argument()] = None): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,525
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/arguments/optional/tutorial003.py
4,5
1,10
main
5,8
5,8
import typer def main(name: str = typer.Argument(default=...)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(default=...)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
print(f"Hello {name}")
print(f"Hello {name}")
2
54
16
70
import typer def main(name: str = typer.Argument(default=...)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
import typer def main(name: str = typer.Argument(default=...)): FILL_FUNC_BODYif __name__ == "__main__": typer.run(main)
26,526
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/arguments/tutorial001.py
6,8
1,18
create
8,11
8,11
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") if __name__ == "__main__": app()
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") if __name__ == "__main__": app()
print(f"Creating user: {username}")
print(f"Creating user: {username}")
3
86
19
105
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") if __name__ == "__main__": app()
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") if __name__ == "__main__": app()
26,527
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/callback/tutorial001.py
25,27
1,37
main
30,35
27,35
import typer app = typer.Typer() state = {"verbose": False} @app.command() def create(username: str): if state["verbose"]: print("About to create a user") print(f"Creating user: {username}") if state["verbose"]: print("Just created a user") @app.command() def delete(username: str): ...
import typer app = typer.Typer() state = {"verbose": False} @app.command() def create(username: str): if state["verbose"]: print("About to create a user") print(f"Creating user: {username}") if state["verbose"]: print("Just created a user") @app.command() def delete(username: str): ...
if verbose: print("Will write verbose output") state["verbose"] = True
""" Manage users in the awesome CLI app. """ if verbose: print("Will write verbose output") state["verbose"] = True
9
220
32
252
import typer app = typer.Typer() state = {"verbose": False} @app.command() def create(username: str): if state["verbose"]: print("About to create a user") print(f"Creating user: {username}") if state["verbose"]: print("Just created a user") @app.command() def delete(username: str): ...
import typer app = typer.Typer() state = {"verbose": False} @app.command() def create(username: str): if state["verbose"]: print("About to create a user") print(f"Creating user: {username}") if state["verbose"]: print("Just created a user") @app.command() def delete(username: str): ...
26,528
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/callback/tutorial002.py
4,5
1,18
callback
5,8
5,8
import typer def callback(): FILL_FUNC_BODYapp = typer.Typer(callback=callback) @app.command() def create(name: str): print(f"Creating user: {name}") if __name__ == "__main__": app()
import typer def callback(): FILL_FUNC_BODYapp = typer.Typer(callback=callback) @app.command() def create(name: str): print(f"Creating user: {name}") if __name__ == "__main__": app()
print("Running a command")
print("Running a command")
3
80
13
93
import typer def callback(): FILL_FUNC_BODYapp = typer.Typer(callback=callback) @app.command() def create(name: str): print(f"Creating user: {name}") if __name__ == "__main__": app()
import typer def callback(): FILL_FUNC_BODYapp = typer.Typer(callback=callback) @app.command() def create(name: str): print(f"Creating user: {name}") if __name__ == "__main__": app()
26,529
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/callback/tutorial003.py
16,18
1,23
create
18,21
18,21
import typer def callback(): print("Running a command") app = typer.Typer(callback=callback) @app.callback() def new_callback(): print("Override callback, running a command") @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer def callback(): print("Running a command") app = typer.Typer(callback=callback) @app.callback() def new_callback(): print("Override callback, running a command") @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
print(f"Creating user: {name}")
print(f"Creating user: {name}")
3
99
19
118
import typer def callback(): print("Running a command") app = typer.Typer(callback=callback) @app.callback() def new_callback(): print("Override callback, running a command") @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer def callback(): print("Running a command") app = typer.Typer(callback=callback) @app.callback() def new_callback(): print("Override callback, running a command") @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
26,530
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/callback/tutorial004.py
17,19
1,24
create
19,22
19,22
import typer app = typer.Typer() @app.callback() def callback(): """ Manage users CLI app. Use it with the create command. A new user with the given NAME will be created. """ @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer app = typer.Typer() @app.callback() def callback(): """ Manage users CLI app. Use it with the create command. A new user with the given NAME will be created. """ @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
print(f"Creating user: {name}")
print(f"Creating user: {name}")
3
106
19
125
import typer app = typer.Typer() @app.callback() def callback(): """ Manage users CLI app. Use it with the create command. A new user with the given NAME will be created. """ @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer app = typer.Typer() @app.callback() def callback(): """ Manage users CLI app. Use it with the create command. A new user with the given NAME will be created. """ @app.command() def create(name: str): FILL_FUNC_BODYif __name__ == "__main__": app()
26,531
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/context/tutorial001.py
11,13
1,26
delete
13,16
13,16
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): FILL_FUNC_BODY@app.callback() def main(ctx: typer.Context): """ Manage users in the awesome CLI app. """ print(f"About to execute command: {ct...
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): FILL_FUNC_BODY@app.callback() def main(ctx: typer.Context): """ Manage users in the awesome CLI app. """ print(f"About to execute command: {ct...
print(f"Deleting user: {username}")
print(f"Deleting user: {username}")
3
143
20
163
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): FILL_FUNC_BODY@app.callback() def main(ctx: typer.Context): """ Manage users in the awesome CLI app. """ print(f"About to execute command: {ct...
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): FILL_FUNC_BODY@app.callback() def main(ctx: typer.Context): """ Manage users in the awesome CLI app. """ print(f"About to execute command: {ct...
26,532
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/context/tutorial002.py
6,8
1,26
create
8,11
8,11
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(): """ Manage users in the awesome CLI app. """ print("Initializing database...
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(): """ Manage users in the awesome CLI app. """ print("Initializing database...
print(f"Creating user: {username}")
print(f"Creating user: {username}")
3
132
19
151
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(): """ Manage users in the awesome CLI app. """ print("Initializing database...
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(): """ Manage users in the awesome CLI app. """ print("Initializing database...
26,533
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/context/tutorial003.py
16,18
1,27
main
21,25
18,25
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": ...
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(ctx: typer.Context): """ Manage users in the awesome CLI...
if ctx.invoked_subcommand is None: print("Initializing database")
""" Manage users in the awesome CLI app. """ if ctx.invoked_subcommand is None: print("Initializing database")
6
145
27
172
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": ...
import typer app = typer.Typer() @app.command() def create(username: str): print(f"Creating user: {username}") @app.command() def delete(username: str): print(f"Deleting user: {username}") @app.callback(invoke_without_command=True) def main(ctx: typer.Context): """ Manage users in the awesome CLI...
26,534
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/context/tutorial004.py
6,10
1,16
main
10,14
10,14
import typer app = typer.Typer() @app.command( context_settings={"allow_extra_args": True, "ignore_unknown_options": True} ) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer app = typer.Typer() @app.command( context_settings={"allow_extra_args": True, "ignore_unknown_options": True} ) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": app()
for extra_arg in ctx.args: print(f"Got extra arg: {extra_arg}")
for extra_arg in ctx.args: print(f"Got extra arg: {extra_arg}")
8
84
34
118
import typer app = typer.Typer() @app.command( context_settings={"allow_extra_args": True, "ignore_unknown_options": True} ) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": app()
import typer app = typer.Typer() @app.command( context_settings={"allow_extra_args": True, "ignore_unknown_options": True} ) def main(ctx: typer.Context): FILL_FUNC_BODYif __name__ == "__main__": app()
26,535
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial001.py
6,8
1,63
create
11,14
8,14
import typer app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete( username: str, force: bool = typer.Option( ..., prompt="Are you sure you want to delete the user?", help="Force deletion without confirma...
import typer app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ FILL_FUNC_BODY@app.command() def delete( username: str, force: bool = typer.Option( ..., prompt="Are you sure you want to delete the ...
print(f"Creating user: {username}")
""" Create a new user with USERNAME. """ print(f"Creating user: {username}")
3
364
19
383
import typer app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): FILL_FUNC_BODY@app.command() def delete( username: str, force: bool = typer.Option( ..., prompt="Are you sure you want to delete the user?", help="Force deletion without confirma...
import typer app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ FILL_FUNC_BODY@app.command() def delete( username: str, force: bool = typer.Option( ..., prompt="Are you sure you want to delete the ...
26,536
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial001_an.py
37,47
1,68
delete_all
52,58
47,58
import typer from typing_extensions import Annotated app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ print(f"Creating user: {username}") @app.command() def delete( username: str, force: Annotated[ ...
import typer from typing_extensions import Annotated app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ print(f"Creating user: {username}") @app.command() def delete( username: str, force: Annotated[ ...
if force: print("Deleting all users") else: print("Operation cancelled")
""" Delete ALL users in the database. If --force is not used, will ask for confirmation. """ if force: print("Deleting all users") else: print("Operation cancelled")
8
374
35
409
import typer from typing_extensions import Annotated app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ print(f"Creating user: {username}") @app.command() def delete( username: str, force: Annotated[ ...
import typer from typing_extensions import Annotated app = typer.Typer(help="Awesome CLI user manager.") @app.command() def create(username: str): """ Create a new user with USERNAME. """ print(f"Creating user: {username}") @app.command() def delete( username: str, force: Annotated[ ...
26,537
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial002.py
6,8
1,24
create
11,14
8,14
import typer app = typer.Typer() @app.command(help="Create a new user with USERNAME.") def create(username: str): FILL_FUNC_BODY@app.command(help="Delete a user with USERNAME.") def delete(username: str): """ Some internal utility function to delete. """ print(f"Deleting user: {username}") if __nam...
import typer app = typer.Typer() @app.command(help="Create a new user with USERNAME.") def create(username: str): """ Some internal utility function to create. """ FILL_FUNC_BODY@app.command(help="Delete a user with USERNAME.") def delete(username: str): """ Some internal utility function to dele...
print(f"Creating user: {username}")
""" Some internal utility function to create. """ print(f"Creating user: {username}")
3
139
19
158
import typer app = typer.Typer() @app.command(help="Create a new user with USERNAME.") def create(username: str): FILL_FUNC_BODY@app.command(help="Delete a user with USERNAME.") def delete(username: str): """ Some internal utility function to delete. """ print(f"Deleting user: {username}") if __nam...
import typer app = typer.Typer() @app.command(help="Create a new user with USERNAME.") def create(username: str): """ Some internal utility function to create. """ FILL_FUNC_BODY@app.command(help="Delete a user with USERNAME.") def delete(username: str): """ Some internal utility function to dele...
26,538
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial003.py
6,8
1,26
create
11,14
8,14
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command(deprecated=True) def delete(username: str): """ Delete a user. This is deprecated and will stop being supported soon. """ print(f"Deleting user: {username}") if __name__ == "__main__": app...
import typer app = typer.Typer() @app.command() def create(username: str): """ Create a user. """ FILL_FUNC_BODY@app.command(deprecated=True) def delete(username: str): """ Delete a user. This is deprecated and will stop being supported soon. """ print(f"Deleting user: {username}") ...
print(f"Creating user: {username}")
""" Create a user. """ print(f"Creating user: {username}")
3
128
19
147
import typer app = typer.Typer() @app.command() def create(username: str): FILL_FUNC_BODY@app.command(deprecated=True) def delete(username: str): """ Delete a user. This is deprecated and will stop being supported soon. """ print(f"Deleting user: {username}") if __name__ == "__main__": app...
import typer app = typer.Typer() @app.command() def create(username: str): """ Create a user. """ FILL_FUNC_BODY@app.command(deprecated=True) def delete(username: str): """ Delete a user. This is deprecated and will stop being supported soon. """ print(f"Deleting user: {username}") ...
26,539
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial004.py
20,27
1,35
delete
30,33
27,33
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: str = typer.Argument( ..., help="The username to be [green]created[/green]" ), ): """ [bold green]Create[/bold green] a new [italic]shiny[/italic] user. :sparkles: This requires a [underline]user...
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: str = typer.Argument( ..., help="The username to be [green]created[/green]" ), ): """ [bold green]Create[/bold green] a new [italic]shiny[/italic] user. :sparkles: This requires a [underline]user...
print(f"Deleting user: {username}")
""" Some internal utility function to delete. """ print(f"Deleting user: {username}")
3
280
20
300
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: str = typer.Argument( ..., help="The username to be [green]created[/green]" ), ): """ [bold green]Create[/bold green] a new [italic]shiny[/italic] user. :sparkles: This requires a [underline]user...
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: str = typer.Argument( ..., help="The username to be [green]created[/green]" ), ): """ [bold green]Create[/bold green] a new [italic]shiny[/italic] user. :sparkles: This requires a [underline]user...
26,540
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial004_an.py
7,13
1,38
create
18,21
13,21
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: Annotated[ str, typer.Argument(help="The username to be [green]created[/green]") ], ): FILL_FUNC_BODY@app.command(help="[bold red]Delete[/bold red] a user with [italic]...
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: Annotated[ str, typer.Argument(help="The username to be [green]created[/green]") ], ): """ [bold green]Create[/bold green] a new [italic]shinny[/italic] user. :...
print(f"Creating user: {username}")
""" [bold green]Create[/bold green] a new [italic]shinny[/italic] user. :sparkles: This requires a [underline]username[/underline]. """ print(f"Creating user: {username}")
3
307
19
326
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: Annotated[ str, typer.Argument(help="The username to be [green]created[/green]") ], ): FILL_FUNC_BODY@app.command(help="[bold red]Delete[/bold red] a user with [italic]...
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="rich") @app.command() def create( username: Annotated[ str, typer.Argument(help="The username to be [green]created[/green]") ], ): """ [bold green]Create[/bold green] a new [italic]shinny[/italic] user. :...
26,541
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial005.py
22,27
1,35
delete
30,33
27,33
import typer app = typer.Typer(rich_markup_mode="markdown") @app.command() def create(username: str = typer.Argument(..., help="The username to be **created**")): """ **Create** a new *shiny* user. :sparkles: * Create a username * Show that the username is created --- Learn more at the [T...
import typer app = typer.Typer(rich_markup_mode="markdown") @app.command() def create(username: str = typer.Argument(..., help="The username to be **created**")): """ **Create** a new *shiny* user. :sparkles: * Create a username * Show that the username is created --- Learn more at the [T...
print(f"Deleting user: {username}")
""" Some internal utility function to delete. """ print(f"Deleting user: {username}")
3
265
20
285
import typer app = typer.Typer(rich_markup_mode="markdown") @app.command() def create(username: str = typer.Argument(..., help="The username to be **created**")): """ **Create** a new *shiny* user. :sparkles: * Create a username * Show that the username is created --- Learn more at the [T...
import typer app = typer.Typer(rich_markup_mode="markdown") @app.command() def create(username: str = typer.Argument(..., help="The username to be **created**")): """ **Create** a new *shiny* user. :sparkles: * Create a username * Show that the username is created --- Learn more at the [T...
26,542
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial005_an.py
25,30
1,38
delete
33,36
30,36
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="markdown") @app.command() def create( username: Annotated[str, typer.Argument(help="The username to be **created**")], ): """ **Create** a new *shinny* user. :sparkles: * Create a username * Show that the u...
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="markdown") @app.command() def create( username: Annotated[str, typer.Argument(help="The username to be **created**")], ): """ **Create** a new *shinny* user. :sparkles: * Create a username * Show that the u...
print(f"Deleting user: {username}")
""" Some internal utility function to delete. """ print(f"Deleting user: {username}")
3
289
20
309
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="markdown") @app.command() def create( username: Annotated[str, typer.Argument(help="The username to be **created**")], ): """ **Create** a new *shinny* user. :sparkles: * Create a username * Show that the u...
import typer from typing_extensions import Annotated app = typer.Typer(rich_markup_mode="markdown") @app.command() def create( username: Annotated[str, typer.Argument(help="The username to be **created**")], ): """ **Create** a new *shinny* user. :sparkles: * Create a username * Show that the u...
26,543
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer
/home/hieuvd/dung_repo/raw/stars_01/tiangolo_typer/typer/docs_src/commands/help/tutorial006.py
46,48
1,56
report
51,54
48,54
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create(username: str): """ [green]Create[/green] a new user. :sparkles: """ print(f"Creating user: {username}") @app.command() def delete(username: str): """ [red]Delete[/red] a user. :fire: """ print(f"Delet...
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create(username: str): """ [green]Create[/green] a new user. :sparkles: """ print(f"Creating user: {username}") @app.command() def delete(username: str): """ [red]Delete[/red] a user. :fire: """ print(f"Delet...
print("Please open a new issue online, not a direct message")
""" [yellow]Report[/yellow] an issue. :bug: """ print("Please open a new issue online, not a direct message")
10
384
21
405
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create(username: str): """ [green]Create[/green] a new user. :sparkles: """ print(f"Creating user: {username}") @app.command() def delete(username: str): """ [red]Delete[/red] a user. :fire: """ print(f"Delet...
import typer app = typer.Typer(rich_markup_mode="rich") @app.command() def create(username: str): """ [green]Create[/green] a new user. :sparkles: """ print(f"Creating user: {username}") @app.command() def delete(username: str): """ [red]Delete[/red] a user. :fire: """ print(f"Delet...