コード例 #1
0
def init() -> None:
    db = SessionLocal()

    create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )
コード例 #2
0
ファイル: initial_data.py プロジェクト: UniBucAlert/bubble
def init() -> None:
    db = SessionLocal()

    create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )
コード例 #3
0
def init() -> None:
    db = SessionLocal()

    create_user(
        db,
        UserCreate(
            email="{{cookiecutter.superuser_email}}",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )
コード例 #4
0
def init() -> None:
    db = SessionLocal()

    create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )
コード例 #5
0
def init() -> None:
    db = SessionLocal()
    admin_user_exists = get_user_by_email(db, "*****@*****.**")
    if not admin_user_exists:
        create_user(
            db,
            UserCreate(
                email="*****@*****.**",
                password="******",
                is_active=True,
                is_superuser=True,
            ),
        )
コード例 #6
0
ファイル: initial_data.py プロジェクト: huideyeren/odaikun
def init() -> None:
    db = SessionLocal()

    create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            first_name="Iosif",
            last_name="Takakura",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )
コード例 #7
0
ファイル: users.py プロジェクト: sngnt/fastapi-celery
async def user_create(
        user_in: UserCreate,
        db: Session = Depends(get_db),
        current_user: models.User = Depends(get_current_active_superuser),
):
    """
    Create a new user
    """
    return create_user(db=db, user=user_in)
コード例 #8
0
async def user_create(
    request: Request,
    user: UserCreate,
    db=Depends(get_db),
    current_user=Depends(get_current_active_superuser),
):
    """
    Create a new user
    """
    return create_user(db, user)
コード例 #9
0
def sign_up_new_user(db, email: str, password: str):
    user = get_user_by_email(db, email)
    if user:
        return False  # User already exists
    new_user = create_user(
        db,
        schemas.UserCreate(
            email=email,
            password=password,
            is_active=True,
            is_superuser=False,
        ),
    )
    return new_user
コード例 #10
0
ファイル: initial_data.py プロジェクト: gangiman/CountryRank
def init() -> None:
    db = SessionLocal()

    first_user = create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )

    with open('joined_init_rankings.json') as fh:
        data = json.loads(fh.read())
        for _record in data:
            create_rankings(db, RankingBase(
                name=_record['name'],
                created_date=data.today(),
                ranking=_record['ranking'],
                number_of_countries=_record['number_of_countries'],
                source=_record['source'],
                user_id=first_user.id
            ), first_user.id)
コード例 #11
0
ファイル: initial_data.py プロジェクト: PhanVinhLong/facereg
def init() -> None:
    db = SessionLocal()

    Base.metadata.create_all(bind=engine)

    create_user(
        db,
        UserCreate(
            email="*****@*****.**",
            password="******",
            is_active=True,
            is_superuser=True,
        ),
    )

    create_model(
        db,
        ModelCreate(
            name="YOLOv4-init",
            is_active=True,
            model_type="YOLOv4 pytorch",
            created_time="2020-12-01T15:53:00+08:00",
            description="Initial YOLOv4 model using default hyperparameters",
            input_width=416,
            input_height=416,
            weight_size=255))

    create_model(
        db,
        ModelCreate(name="YOLOv4-r",
                    is_active=True,
                    model_type="YOLOv4 pytorch",
                    created_time="2020-12-01T15:53:00+08:00",
                    description="YOLOv4 model changed input size (ratio)",
                    input_width=544,
                    input_height=320,
                    weight_size=255))

    create_model(
        db,
        ModelCreate(name="YOLOv4-a",
                    is_active=True,
                    model_type="YOLOv4 pytorch",
                    created_time="2020-12-01T15:53:00+08:00",
                    description="YOLOv4 model changed anchor boxes",
                    input_width=416,
                    input_height=416,
                    weight_size=255))

    # create_model(
    #     db,
    #     ModelCreate(
    #         name="YOLOv4-s",
    #         is_active=True,
    #         model_type="YOLOv4 pytorch",
    #         created_time="2020-12-01T15:53:00+08:00",
    #         description="YOLOv4 model changed input size (increase size)",
    #         input_width=512,
    #         input_height=512,
    #         weight_size=255
    #     )
    # )

    create_model(
        db,
        ModelCreate(name="YOLOv4-n",
                    is_active=True,
                    model_type="YOLOv4 pytorch",
                    created_time="2020-12-01T15:53:00+08:00",
                    description="YOLOv4 model changed network structure",
                    input_width=416,
                    input_height=416,
                    weight_size=255))

    create_model(
        db,
        ModelCreate(name="YOLOv4-final",
                    is_active=True,
                    model_type="YOLOv4 pytorch",
                    created_time="2020-12-01T15:53:00+08:00",
                    description="YOLOv4 model combine all optimizations",
                    input_width=672,
                    input_height=384,
                    weight_size=255))
コード例 #12
0
def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
    db_user = crud.get_user_by_email(db, user.email)
    if db_user:
        raise HTTPException(status_code=400, detail="Email already registered")
    return crud.create_user(db, user)