This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| urgent_words = ["urgente", "asap", "hoy", "inmediato", | |
| "último aviso", "venc", "vencimiento"] | |
| medium_words = ["mañana", "esta semana", "pendiente", "recordatorio"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| triggers = [ | |
| "por favor", "favor", "responde", "responder", "confirmar", "confirma", | |
| "envía", "enviar", "adjunta", "adjuntar", "pagar", "pago", | |
| "revisar", "revisa", "agendar", "agenda", "asistir", "asiste", | |
| "firma", "firmar", "aprobar", "aprueba" | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SPANISH_STOPWORDS = { | |
| "de", "la", "que", "el", "en", "y", "a", "los", "del", "se", "las", | |
| "por", "un", "para", "con", "no", "una", "su", "al", "lo", "como", | |
| "más", "mas", "o", "pero", "sus", "le", "ya", "si", "porque", "cuando", | |
| "muy", "sin", "sobre", "también", "tambien", "me", "hasta", "hay", | |
| "donde", "han", "quien", "entre", "está", "esta", "ser", "son", | |
| } | |
| def tokenize(text: str) -> List[str]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from "react"; | |
| function App() { | |
| const [data, setData] = useState(null); | |
| const [error, setError] = useState(null); | |
| const fetchData = async () => { | |
| setData(null); | |
| setError(null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CATEGORIES = [ | |
| {"name": "Python", "slug": "python"}, | |
| {"name": "FastAPI", "slug": "fastapi"}, | |
| {"name": "SQLAlchemy", "slug": "sqlalchemy"}, | |
| {"name": "Django", "slug": "django"}, | |
| {"name": "Flask", "slug": "flask"}, | |
| {"name": "Javascript", "slug": "javascript"}, | |
| {"name": "Golang", "slug": "golang"}, | |
| {"name": "Laravel", "slug": "laravel"}, | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import APIRouter, Depends, HTTPException, status | |
| from sqlalchemy.orm import Session | |
| from app.api.v1.categories.repository import CategoryRepository | |
| from app.core.db import get_db | |
| from app.api.v1.categories.schemas import CategoryCreate, CategoryUpdate, CategoryPublic | |
| router = APIRouter(prefix="/categories", tags=["categories"]) | |
| @router.get("", response_model=list[CategoryPublic]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import annotations | |
| from typing import Iterable, Sequence | |
| from collections.abc import Iterable as IterableABC | |
| from sqlalchemy import select, func | |
| from sqlalchemy.exc import IntegrityError | |
| from sqlalchemy.orm import Session | |
| from app.models.category import CategoryORM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _ChunkCounter: | |
| def __init__(self, f): | |
| self._f = f | |
| self.calls = 0 | |
| self.sizes = [] | |
| def read(self, n=-1): | |
| data = self._f.read(n) | |
| if data: | |
| self.calls += 1 | |
| self.sizes.append(len(data)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import httpx | |
| import time | |
| URL = "http://127.0.0.1:8000/posts/async" | |
| async def hit(t, client: httpx.AsyncClient): | |
| start = time.perf_counter() | |
| r = await client.get(URL, params={"t": t}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FAKE_USERS = { | |
| "[email protected]": {"email": "[email protected]", "username": "ricardo", "password": "secret123"}, | |
| "[email protected]": {"email": "[email protected]", "username": "alumno", "password": "123456"}, | |
| } |
NewerOlder