<commit_before>import sys
import os
from typing import List
from fastapi import Depends, FastAPI, HTTPException
from sqlalchemy.orm import Session
from principal import crud, models, schemas
from principal.database import SessionLocal, engine

app = FastAPI(
    title="NOC-ORCHESTRATOR",
    description="API principal do noc-orchestrator",
    version="0.0.1-sandbox",
)

@app.get("/debug")
async def read_debug():
    versaoPython = f"{sys.version_info.major}.{sys.version_info.minor}"
    ambiente  = f"{os.environ}"
    message = f"Estou vivo! Python - {versaoPython} - {ambiente}"
    return {"message": message}

@app.get("/")
async def read_root():
    message = f":)"
    return {"message": message}



# Dependency
def get_db():
    try:
        db = SessionLocal()
        yield db
    finally:
        db.close()


@app.post("/users/", response_model=schemas.User)
def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
    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)


@app.get("/users/", response_model=List[schemas.User])
def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
    users = crud.get_users(db, skip=skip, limit=limit)
    return users


@app.get("/users/{user_id}", response_model=schemas.User)
def read_user(user_id: int, db: Session = Depends(get_db)):
    db_user = crud.get_user(db, user_id=user_id)
    if db_user is None:
        raise HTTPException(status_code=404, detail="Usuário nao encontrado")
    return db_user


@app.post("/users/{user_id}/items/", response_model=schemas.Item)
def create_item_for_user(
    user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db)
):
    return crud.create_user_item(db=db, item=item, user_id=user_id)


@app.get("/items/", response_model=List[schemas.Item])
def read_items(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
    items = crud.get_items(db, skip=skip, limit=limit)
    return items


<commit_msg>teste<commit_after>import sys
import os
from typing import List
from fastapi import Depends, FastAPI, HTTPException
from sqlalchemy.orm import Session
from principal import crud, models, schemas
from principal.database import SessionLocal, engine

app = FastAPI(
    title="NOC-ORCHESTRATOR",
    description="API principal do noc-orchestrator",
    version="0.0.2-sandbox",
)

@app.get("/debug")
async def read_debug():
    versaoPython = f"{sys.version_info.major}.{sys.version_info.minor}"
    ambiente  = f"{os.environ}"
    message = f"Estou vivo! Python - {versaoPython} - {ambiente}"
    return {"message": message}

@app.get("/")
async def read_root():
    message = f":)"
    return {"message": message}



# Dependency
def get_db():
    try:
        db = SessionLocal()
        yield db
    finally:
        db.close()


@app.post("/users/", response_model=schemas.User)
def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
    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)


@app.get("/users/", response_model=List[schemas.User])
def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
    users = crud.get_users(db, skip=skip, limit=limit)
    return users


@app.get("/users/{user_id}", response_model=schemas.User)
def read_user(user_id: int, db: Session = Depends(get_db)):
    db_user = crud.get_user(db, user_id=user_id)
    if db_user is None:
        raise HTTPException(status_code=404, detail="Usuário nao encontrado")
    return db_user


@app.post("/users/{user_id}/items/", response_model=schemas.Item)
def create_item_for_user(
    user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db)
):
    return crud.create_user_item(db=db, item=item, user_id=user_id)


@app.get("/items/", response_model=List[schemas.Item])
def read_items(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
    items = crud.get_items(db, skip=skip, limit=limit)
    return items



{'fraction_non_alphanumeric': 0.13560929350403034, 'fraction_numerical': 0.008060692271218587, 'mean_word_length': 4.360864040660737, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5280419', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1436, 'n_words': 334}