diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6c65956 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: check-merge-conflict + - id: check-toml + - id: debug-statements + - repo: https://github.com/psf/black.git + rev: 22.8.0 + hooks: + - id: black + name: black + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + name: isort diff --git a/api/api.py b/api/api.py index 601c357..9981853 100644 --- a/api/api.py +++ b/api/api.py @@ -1,7 +1,8 @@ -from fastapi import FastAPI from dotenv import load_dotenv -from api.routes.auth import auth_routes +from fastapi import FastAPI + from api.components.document import document_routes +from api.routes.auth import auth_routes app = FastAPI() app.include_router(auth_routes, prefix="/api") diff --git a/api/components/document.py b/api/components/document.py index c6c7824..dabbc00 100644 --- a/api/components/document.py +++ b/api/components/document.py @@ -2,9 +2,10 @@ import json from fastapi import APIRouter, Response, status from pydantic import BaseModel -from api.middleware.verify_token import VerifyTokenRoute -import backend.mongo as mongo + import backend.elastic as elastic +import backend.mongo as mongo +from api.middleware.verify_token import VerifyTokenRoute document_routes = APIRouter(route_class=VerifyTokenRoute) diff --git a/api/jwt.py b/api/jwt.py index 413300a..1b576ae 100644 --- a/api/jwt.py +++ b/api/jwt.py @@ -1,7 +1,8 @@ -from jwt import encode, decode, exceptions from datetime import datetime, timedelta from os import getenv + from fastapi.responses import JSONResponse +from jwt import decode, encode, exceptions def expire_date(days: int): @@ -9,7 +10,9 @@ def expire_date(days: int): def write_token(data: dict): - return encode(payload={**data, "exp": expire_date(2)}, key=getenv("SECRET"), algorithm="HS256") + return encode( + payload={**data, "exp": expire_date(2)}, key=getenv("SECRET"), algorithm="HS256" + ) def validate_token(token, output=False): diff --git a/api/middleware/verify_token.py b/api/middleware/verify_token.py index a210c55..d27f6f1 100644 --- a/api/middleware/verify_token.py +++ b/api/middleware/verify_token.py @@ -1,7 +1,8 @@ from fastapi import Request -from api.jwt import validate_token from fastapi.routing import APIRoute +from api.jwt import validate_token + class VerifyTokenRoute(APIRoute): def get_route_handler(self): diff --git a/api/routes/auth.py b/api/routes/auth.py index 4770044..c64ffec 100644 --- a/api/routes/auth.py +++ b/api/routes/auth.py @@ -1,8 +1,8 @@ from fastapi import APIRouter, Header -from pydantic import BaseModel, EmailStr -from api.jwt import write_token, validate_token from fastapi.responses import JSONResponse +from pydantic import BaseModel, EmailStr +from api.jwt import validate_token, write_token auth_routes = APIRouter() @@ -26,4 +26,3 @@ def login(user: User): def verify_token(Authorization: str = Header(None)): token = Authorization.split(" ")[1] return validate_token(token, output=True) - diff --git a/backend/elastic.py b/backend/elastic.py index 076dd85..e32a6a1 100644 --- a/backend/elastic.py +++ b/backend/elastic.py @@ -1,4 +1,5 @@ from os import getenv + from elasticsearch import Elasticsearch @@ -19,35 +20,30 @@ def refresh_index(index): def search(index): client = get_client() - resp = client.search(index=index, query={ - # "query_string": { - # "query": "*puan*", - # "default_field": "data" - # } - "bool": { - "must": [ - { - "query_string": { - "query": "*new*", - "default_field": "data" - } - }, - # { - # "match": { - # "id": "1", - # } - # } - ] - } - }, highlight={ - "fields": { - "data": {} - } - }) - print("Got %d hit(s):" % resp['hits']['total']['value']) + resp = client.search( + index=index, + query={ + # "query_string": { + # "query": "*puan*", + # "default_field": "data" + # } + "bool": { + "must": [ + {"query_string": {"query": "*new*", "default_field": "data"}}, + # { + # "match": { + # "id": "1", + # } + # } + ] + } + }, + highlight={"fields": {"data": {}}}, + ) + print("Got %d hit(s):" % resp["hits"]["total"]["value"]) - for hit in resp['hits']['hits']: - print(resp['hits']['total']) - print(resp['hits']) + for hit in resp["hits"]["hits"]: + print(resp["hits"]["total"]) + print(resp["hits"]) print(hit["_source"]) print("%(name)s: %(data)s" % hit["_source"]) diff --git a/backend/mongo.py b/backend/mongo.py index 34c6d46..df27917 100644 --- a/backend/mongo.py +++ b/backend/mongo.py @@ -1,38 +1,40 @@ from os import getenv + from bson import ObjectId from pymongo import MongoClient + import backend.elastic as elastic def get_database(): client = MongoClient(getenv("MONGO_URL")) - return client['documents'] + return client["documents"] def create_document(document): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] doc = document.copy() docs_coll.insert_one(document) - elastic.add_document("test-index", document['_id'], doc) + elastic.add_document("test-index", document["_id"], doc) def get_document_by_id(id): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] doc = docs_coll.find({"_id": ObjectId(id)}, {"_id": 0}).next().items() return doc def get_document_by_name(name): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] return docs_coll.find({"name": name}) def edit_data(id, data): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] docs_coll.update_one({"_id": ObjectId(id)}, {"$set": {"data": data}}) doc = docs_coll.find_one({"_id": ObjectId(id)}, {"_id": 0}) elastic.add_document("test-index", id, doc) @@ -40,11 +42,11 @@ def edit_data(id, data): def edit_access(id, access): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] docs_coll.update_one({"_id": id}, {"$set": {"access": access}}) def edit_name(id, name): dbname = get_database() - docs_coll = dbname['docs'] + docs_coll = dbname["docs"] docs_coll.update_one({"_id": id}, {"$set": {"name": name}}) diff --git a/backend/postgres.py b/backend/postgres.py index 7d39ca8..af97f28 100644 --- a/backend/postgres.py +++ b/backend/postgres.py @@ -10,23 +10,28 @@ def get_connection(): host=getenv("POSTGRES_HOST"), database=getenv("POSTGRES_DB"), user=getenv("POSTGRES_USER"), - password=getenv("POSTGRES_PASSWORD") + password=getenv("POSTGRES_PASSWORD"), ) def create_table(name): conn = get_connection() cur = conn.cursor() - cur.execute(sql.SQL("CREATE TABLE {table} (row_number SERIAL PRIMARY KEY)").format(table=sql.Identifier(name))) + cur.execute( + sql.SQL("CREATE TABLE {table} (row_number SERIAL PRIMARY KEY)").format( + table=sql.Identifier(name) + ) + ) conn.commit() def add_column(name, column, type): conn = get_connection() cur = conn.cursor() - cur.execute(sql.SQL("ALTER TABLE {table} ADD {column}" + type).format( - table=sql.Identifier(name), - column=sql.Identifier(column)) + cur.execute( + sql.SQL("ALTER TABLE {table} ADD {column}" + type).format( + table=sql.Identifier(name), column=sql.Identifier(column) + ) ) conn.commit() @@ -35,9 +40,9 @@ def insert_columns(name, data): conn = get_connection() cur = conn.cursor() str = "(" + "DEFAULT, %s," * (len(data) - 1) + "%s" + ")" # TODO: change. - cur.execute(sql.SQL("INSERT INTO {table} VALUES" + str).format( - table=sql.Identifier(name)), - data + cur.execute( + sql.SQL("INSERT INTO {table} VALUES" + str).format(table=sql.Identifier(name)), + data, ) conn.commit() @@ -47,10 +52,11 @@ def edit_columns(name, columns, data, id): cur = conn.cursor() i = 0 for column in columns: - cur.execute(sql.SQL("UPDATE {table} SET {col} = %s WHERE row_number = " + id).format( - table=sql.Identifier(name), - col=sql.Identifier(column)), - [data[i]] + cur.execute( + sql.SQL("UPDATE {table} SET {col} = %s WHERE row_number = " + id).format( + table=sql.Identifier(name), col=sql.Identifier(column) + ), + [data[i]], ) i += 1 conn.commit() @@ -59,9 +65,10 @@ def edit_columns(name, columns, data, id): def remove_column(name, column): conn = get_connection() cur = conn.cursor() - cur.execute(sql.SQL("ALTER TABLE {table} DROP COLUMN {column}").format( - table=sql.Identifier(name), - column=sql.Identifier(column)) + cur.execute( + sql.SQL("ALTER TABLE {table} DROP COLUMN {column}").format( + table=sql.Identifier(name), column=sql.Identifier(column) + ) ) conn.commit() @@ -70,9 +77,9 @@ def create_sort(name): conn = get_connection() cur = conn.cursor() cur.execute( - sql.SQL("CREATE TABLE {table} (property TEXT, _order CHAR(3), priority int)").format( - table=sql.Identifier(name + "_sort") - ) + sql.SQL( + "CREATE TABLE {table} (property TEXT, _order CHAR(3), priority int)" + ).format(table=sql.Identifier(name + "_sort")) ) conn.commit() @@ -81,8 +88,10 @@ def add_sort(name, property, order, priority): conn = get_connection() cur = conn.cursor() cur.execute( - sql.SQL("INSERT INTO {table} VALUES (%s, %s, %s)").format(table=sql.Identifier(name + "_sort")), - (property, order, priority) + sql.SQL("INSERT INTO {table} VALUES (%s, %s, %s)").format( + table=sql.Identifier(name + "_sort") + ), + (property, order, priority), ) conn.commit() @@ -91,7 +100,9 @@ def sort(name): conn = get_connection() cur = conn.cursor() cur.execute( - sql.SQL("SELECT * FROM {table} ORDER BY priority").format(table=sql.Identifier(name + "_sort")), + sql.SQL("SELECT * FROM {table} ORDER BY priority").format( + table=sql.Identifier(name + "_sort") + ), ) order_clause = "ORDER BY " i = 0 @@ -101,7 +112,9 @@ def sort(name): order_clause += sort[0] + " " + sort[1] i += 1 cur.execute( - sql.SQL("SELECT * FROM {table} " + order_clause).format(table=sql.Identifier(name)), + sql.SQL("SELECT * FROM {table} " + order_clause).format( + table=sql.Identifier(name) + ), ) return cur @@ -155,13 +168,17 @@ def add_filter_trigger(name): def create_filter(name): conn = get_connection() cur = conn.cursor() - cur.execute(sql.SQL(""" + cur.execute( + sql.SQL( + """ CREATE TABLE {table} ( property TEXT, value TEXT, function TEXT CHECK (function IN ('c', 'e', 'n')) ) - """).format(table=sql.Identifier(name + "_filter"))) + """ + ).format(table=sql.Identifier(name + "_filter")) + ) conn.commit() @@ -169,8 +186,10 @@ def add_filter(name, property, value, function): conn = get_connection() cur = conn.cursor() cur.execute( - sql.SQL("INSERT INTO {table} VALUES (%s, %s, %s)").format(table=sql.Identifier(name + "_filter")), - (property, value, function) + sql.SQL("INSERT INTO {table} VALUES (%s, %s, %s)").format( + table=sql.Identifier(name + "_filter") + ), + (property, value, function), ) conn.commit() @@ -188,24 +207,26 @@ def filter(name): filter_clause += " AND " filter_clause += sort[0] match sort[2]: - case 'e': + case "e": filter_clause += " = '" + sort[1] + "'" - case 'ne': + case "ne": filter_clause += " <> '" + sort[1] + "'" - case 'le': + case "le": filter_clause += " <= " + sort[1] - case 'ge': + case "ge": filter_clause += " >= " + sort[1] - case 'l': + case "l": filter_clause += " < " + sort[1] - case 'g': + case "g": filter_clause += " > " + sort[1] - case 'c': + case "c": filter_clause += " ILIKE '%" + sort[1] + "'" - case '_': + case "_": raise "Invalid filter function" i += 1 cur.execute( - sql.SQL("SELECT * FROM {table} " + filter_clause).format(table=sql.Identifier(name)), + sql.SQL("SELECT * FROM {table} " + filter_clause).format( + table=sql.Identifier(name) + ), ) return cur diff --git a/poetry.lock b/poetry.lock index 897b73b..8d3dc73 100644 --- a/poetry.lock +++ b/poetry.lock @@ -15,6 +15,27 @@ doc = ["packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] test = ["contextlib2", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (<0.15)", "uvloop (>=0.15)"] trio = ["trio (>=0.16,<0.22)"] +[[package]] +name = "black" +version = "22.10.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + [[package]] name = "certifi" version = "2022.9.24" @@ -23,6 +44,14 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "cfgv" +version = "3.3.1" +description = "Validate configuration and produce human readable error messages." +category = "dev" +optional = false +python-versions = ">=3.6.1" + [[package]] name = "click" version = "8.1.3" @@ -42,6 +71,14 @@ category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +[[package]] +name = "distlib" +version = "0.3.6" +description = "Distribution utilities" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "dnspython" version = "2.2.1" @@ -118,6 +155,18 @@ dev = ["autoflake (>=1.4.0,<2.0.0)", "flake8 (>=3.8.3,<6.0.0)", "pre-commit (>=2 doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer[all] (>=0.6.1,<0.7.0)"] test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==22.8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flake8 (>=3.8.3,<6.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "pytest-cov (>=2.12.0,<5.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "pyyaml (>=5.3.1,<7.0.0)", "requests (>=2.24.0,<3.0.0)", "sqlalchemy (>=1.3.18,<=1.4.41)", "types-orjson (==3.6.2)", "types-ujson (==5.5.0)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"] +[[package]] +name = "filelock" +version = "3.8.0" +description = "A platform independent file lock." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2022.6.21)", "sphinx (>=5.1.1)", "sphinx-autodoc-typehints (>=1.19.1)"] +testing = ["covdefaults (>=2.2)", "coverage (>=6.4.2)", "pytest (>=7.1.2)", "pytest-cov (>=3)", "pytest-timeout (>=2.1)"] + [[package]] name = "h11" version = "0.14.0" @@ -137,6 +186,17 @@ python-versions = ">=3.5.0" [package.extras] test = ["Cython (>=0.29.24,<0.30.0)"] +[[package]] +name = "identify" +version = "2.5.8" +description = "File identification library for Python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.4" @@ -145,6 +205,61 @@ category = "main" optional = false python-versions = ">=3.5" +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "nodeenv" +version = "1.7.0" +description = "Node.js virtual environment builder" +category = "dev" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" + +[package.dependencies] +setuptools = "*" + +[[package]] +name = "pathspec" +version = "0.10.2" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "platformdirs" +version = "2.5.4" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2022.9.29)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.4)"] +test = ["appdirs (==1.4.4)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pre-commit" +version = "2.20.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +toml = "*" +virtualenv = ">=20.0.8" + [[package]] name = "psycopg2" version = "2.9.5" @@ -221,6 +336,19 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "setuptools" +version = "65.5.1" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "sniffio" version = "1.3.0" @@ -243,6 +371,22 @@ anyio = ">=3.4.0,<5" [package.extras] full = ["itsdangerous", "jinja2", "python-multipart", "pyyaml", "requests"] +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" + [[package]] name = "typing-extensions" version = "4.4.0" @@ -299,16 +443,33 @@ dev = ["Cython (>=0.29.32,<0.30.0)", "Sphinx (>=4.1.2,<4.2.0)", "aiohttp", "flak docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)"] test = ["Cython (>=0.29.32,<0.30.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "mypy (>=0.800)", "psutil", "pyOpenSSL (>=22.0.0,<22.1.0)", "pycodestyle (>=2.7.0,<2.8.0)"] +[[package]] +name = "virtualenv" +version = "20.16.7" +description = "Virtual Python Environment builder" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +distlib = ">=0.3.6,<1" +filelock = ">=3.4.1,<4" +platformdirs = ">=2.4,<3" + +[package.extras] +docs = ["proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-argparse (>=0.3.2)", "sphinx-rtd-theme (>=1)", "towncrier (>=22.8)"] +testing = ["coverage (>=6.2)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=21.3)", "pytest (>=7.0.1)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.6.1)", "pytest-randomly (>=3.10.3)", "pytest-timeout (>=2.1)"] + [[package]] name = "watchfiles" -version = "0.18.0" +version = "0.18.1" description = "Simple, modern and high performance file watching and code reload in python." category = "main" optional = false python-versions = ">=3.7" [package.dependencies] -anyio = ">=3.0.0,<4" +anyio = ">=3.0.0" [[package]] name = "websockets" @@ -321,17 +482,35 @@ python-versions = ">=3.7" [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "ec169a11aede0c06db95820fd011d9a9724df08569901d9ed87c1e6235cb3ae6" +content-hash = "34c7ab7e09f23fdd00873491668b236f5835ff116f56f2a73352da802399ee40" [metadata.files] anyio = [ {file = "anyio-3.6.2-py3-none-any.whl", hash = "sha256:fbbe32bd270d2a2ef3ed1c5d45041250284e31fc0a4df4a5a6071842051a51e3"}, {file = "anyio-3.6.2.tar.gz", hash = "sha256:25ea0d673ae30af41a0c442f81cf3b38c7e79fdc7b60335a4c14e05eb0947421"}, ] +black = [ + {file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"}, + {file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"}, + {file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"}, + {file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"}, + {file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"}, + {file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"}, + {file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"}, + {file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"}, + {file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"}, + {file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"}, + {file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"}, + {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, +] certifi = [ {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, {file = "certifi-2022.9.24.tar.gz", hash = "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"}, ] +cfgv = [ + {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, + {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, +] click = [ {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, @@ -340,6 +519,10 @@ colorama = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +distlib = [ + {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, + {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, +] dnspython = [ {file = "dnspython-2.2.1-py3-none-any.whl", hash = "sha256:a851e51367fb93e9e1361732c1d60dab63eff98712e503ea7d92e6eccb109b4f"}, {file = "dnspython-2.2.1.tar.gz", hash = "sha256:0f7569a4a6ff151958b64304071d370daa3243d15941a7beedf0c9fe5105603e"}, @@ -360,6 +543,10 @@ fastapi = [ {file = "fastapi-0.85.2-py3-none-any.whl", hash = "sha256:6292db0edd4a11f0d938d6033ccec5f706e9d476958bf33b119e8ddb4e524bde"}, {file = "fastapi-0.85.2.tar.gz", hash = "sha256:3e10ea0992c700e0b17b6de8c2092d7b9cd763ce92c49ee8d4be10fee3b2f367"}, ] +filelock = [ + {file = "filelock-3.8.0-py3-none-any.whl", hash = "sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4"}, + {file = "filelock-3.8.0.tar.gz", hash = "sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc"}, +] h11 = [ {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, @@ -407,10 +594,34 @@ httptools = [ {file = "httptools-0.5.0-cp39-cp39-win_amd64.whl", hash = "sha256:1af91b3650ce518d226466f30bbba5b6376dbd3ddb1b2be8b0658c6799dd450b"}, {file = "httptools-0.5.0.tar.gz", hash = "sha256:295874861c173f9101960bba332429bb77ed4dcd8cdf5cee9922eb00e4f6bc09"}, ] +identify = [ + {file = "identify-2.5.8-py2.py3-none-any.whl", hash = "sha256:48b7925fe122720088aeb7a6c34f17b27e706b72c61070f27fe3789094233440"}, + {file = "identify-2.5.8.tar.gz", hash = "sha256:7a214a10313b9489a0d61467db2856ae8d0b8306fc923e03a9effa53d8aedc58"}, +] idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +nodeenv = [ + {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, + {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, +] +pathspec = [ + {file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"}, + {file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"}, +] +platformdirs = [ + {file = "platformdirs-2.5.4-py3-none-any.whl", hash = "sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10"}, + {file = "platformdirs-2.5.4.tar.gz", hash = "sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7"}, +] +pre-commit = [ + {file = "pre_commit-2.20.0-py2.py3-none-any.whl", hash = "sha256:51a5ba7c480ae8072ecdb6933df22d2f812dc897d5fe848778116129a681aac7"}, + {file = "pre_commit-2.20.0.tar.gz", hash = "sha256:a978dac7bc9ec0bcee55c18a277d553b0f419d259dadb4b9418ff2d00eb43959"}, +] psycopg2 = [ {file = "psycopg2-2.9.5-cp310-cp310-win32.whl", hash = "sha256:d3ef67e630b0de0779c42912fe2cbae3805ebaba30cda27fea2a3de650a9414f"}, {file = "psycopg2-2.9.5-cp310-cp310-win_amd64.whl", hash = "sha256:4cb9936316d88bfab614666eb9e32995e794ed0f8f6b3b718666c22819c1d7ee"}, @@ -583,6 +794,10 @@ PyYAML = [ {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, ] +setuptools = [ + {file = "setuptools-65.5.1-py3-none-any.whl", hash = "sha256:d0b9a8433464d5800cbe05094acf5c6d52a91bfac9b52bcfc4d41382be5d5d31"}, + {file = "setuptools-65.5.1.tar.gz", hash = "sha256:e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f"}, +] sniffio = [ {file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"}, {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, @@ -591,6 +806,14 @@ starlette = [ {file = "starlette-0.20.4-py3-none-any.whl", hash = "sha256:c0414d5a56297d37f3db96a84034d61ce29889b9eaccf65eb98a0b39441fcaa3"}, {file = "starlette-0.20.4.tar.gz", hash = "sha256:42fcf3122f998fefce3e2c5ad7e5edbf0f02cf685d646a83a08d404726af5084"}, ] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] typing-extensions = [ {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, @@ -635,25 +858,29 @@ uvloop = [ {file = "uvloop-0.17.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:30babd84706115626ea78ea5dbc7dd8d0d01a2e9f9b306d24ca4ed5796c66ded"}, {file = "uvloop-0.17.0.tar.gz", hash = "sha256:0ddf6baf9cf11a1a22c71487f39f15b2cf78eb5bde7e5b45fbb99e8a9d91b9e1"}, ] +virtualenv = [ + {file = "virtualenv-20.16.7-py3-none-any.whl", hash = "sha256:efd66b00386fdb7dbe4822d172303f40cd05e50e01740b19ea42425cbe653e29"}, + {file = "virtualenv-20.16.7.tar.gz", hash = "sha256:8691e3ff9387f743e00f6bb20f70121f5e4f596cae754531f2b3b3a1b1ac696e"}, +] watchfiles = [ - {file = "watchfiles-0.18.0-cp37-abi3-macosx_10_7_x86_64.whl", hash = "sha256:76a4c4a8e25a2c9a4f7fa3d373bbaf5558c17b97b4cf8411d33de368fe6b68a9"}, - {file = "watchfiles-0.18.0-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:d5d799614d4c56d29c5ba56f4f619f967210dc10a0d6965b62d326b9e2f72c9e"}, - {file = "watchfiles-0.18.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:39b932b044fef6c43e813e0bef908e0edf185bf7b5d8d53246651cb7ac9efe79"}, - {file = "watchfiles-0.18.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1686bc4ac40ffde7256b6543b0f9a2cc8b531ae45243786f1d3f1dda2fe39e24"}, - {file = "watchfiles-0.18.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:320bcde0adaa972403ed3b70f784409437325a1a4df2de54ba0672203d8847e5"}, - {file = "watchfiles-0.18.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4ba6d8c2f957cae3e888bc250bc60ed09fe869b3f55f09d020ed3fecbefb6a4c"}, - {file = "watchfiles-0.18.0-cp37-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:fd4215badad1e3d1ad5fb79f21432dd5157e2e7b0765d27a19dc2a28580c6979"}, - {file = "watchfiles-0.18.0-cp37-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:cfdbfc4b6797c28dd1a8524581fed00ca333971b4111af8cd42fb7a92dcdc227"}, - {file = "watchfiles-0.18.0-cp37-abi3-win32.whl", hash = "sha256:8eddc2d19bf6f49aee224072ec0f4f3258125a49f11b5dcff1448e68718a745e"}, - {file = "watchfiles-0.18.0-cp37-abi3-win_amd64.whl", hash = "sha256:be87c9b1fe2b02105a9ac6d9df7500a110652bbd97cf46b13964eeaef9a6c89c"}, - {file = "watchfiles-0.18.0-cp37-abi3-win_arm64.whl", hash = "sha256:184799818c4fa7dbc6a1e4ca20bcbc6b85e4e0db07ce4554ea2f29b75ccd0cdc"}, - {file = "watchfiles-0.18.0-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:7f39fcdac5d5b9815a0c2ab9005d39854296b11fa15386a9a69c09cbbc5dde2c"}, - {file = "watchfiles-0.18.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78b1e7c29b92dfc8fc32f15949019232b493767d236c2bff31848df13fdb9e8a"}, - {file = "watchfiles-0.18.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27d64a6ed5e0aebef97c70fa3899a6958d4f7f049effc659e7dc3e81f3170a7b"}, - {file = "watchfiles-0.18.0-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:4bbc8bfa0f3871b1867af42837a5635a9c1cbb2b68d039754b4750642c34aaee"}, - {file = "watchfiles-0.18.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9d3a12e4de5446fb6e286b720d0cb3a080811caf0ef43e556c2db5fe10ef0342"}, - {file = "watchfiles-0.18.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e611a90482ac14ef3ec234c1604ed921d1b0c68970eba82f1cf0d59a3e4eb76"}, - {file = "watchfiles-0.18.0.tar.gz", hash = "sha256:bbe10d134eef1666451382015e48f092c941a6d4562a98ffa1a288f79a897c46"}, + {file = "watchfiles-0.18.1-cp37-abi3-macosx_10_7_x86_64.whl", hash = "sha256:9891d3c94272108bcecf5597a592e61105279def1313521e637f2d5acbe08bc9"}, + {file = "watchfiles-0.18.1-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:7102342d60207fa635e24c02a51c6628bf0472e5fef067f78a612386840407fc"}, + {file = "watchfiles-0.18.1-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:00ea0081eca5e8e695cffbc3a726bb90da77f4e3f78ce29b86f0d95db4e70ef7"}, + {file = "watchfiles-0.18.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b8e6db99e49cd7125d8a4c9d33c0735eea7b75a942c6ad68b75be3e91c242fb"}, + {file = "watchfiles-0.18.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bc7c726855f04f22ac79131b51bf0c9f728cb2117419ed830a43828b2c4a5fcb"}, + {file = "watchfiles-0.18.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbaff354d12235002e62d9d3fa8bcf326a8490c1179aa5c17195a300a9e5952f"}, + {file = "watchfiles-0.18.1-cp37-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:888db233e06907c555eccd10da99b9cd5ed45deca47e41766954292dc9f7b198"}, + {file = "watchfiles-0.18.1-cp37-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:dde79930d1b28f15994ad6613aa2865fc7a403d2bb14585a8714a53233b15717"}, + {file = "watchfiles-0.18.1-cp37-abi3-win32.whl", hash = "sha256:e2b2bdd26bf8d6ed90763e6020b475f7634f919dbd1730ea1b6f8cb88e21de5d"}, + {file = "watchfiles-0.18.1-cp37-abi3-win_amd64.whl", hash = "sha256:c541e0f2c3e95e83e4f84561c893284ba984e9d0025352057396d96dceb09f44"}, + {file = "watchfiles-0.18.1-cp37-abi3-win_arm64.whl", hash = "sha256:9a26272ef3e930330fc0c2c148cc29706cc2c40d25760c7ccea8d768a8feef8b"}, + {file = "watchfiles-0.18.1-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:9fb12a5e2b42e0b53769455ff93546e6bc9ab14007fbd436978d827a95ca5bd1"}, + {file = "watchfiles-0.18.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:548d6b42303d40264118178053c78820533b683b20dfbb254a8706ca48467357"}, + {file = "watchfiles-0.18.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e0d8fdfebc50ac7569358f5c75f2b98bb473befccf9498cf23b3e39993bb45a"}, + {file = "watchfiles-0.18.1-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:0f9a22fff1745e2bb930b1e971c4c5b67ea3b38ae17a6adb9019371f80961219"}, + {file = "watchfiles-0.18.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b02e7fa03cd4059dd61ff0600080a5a9e7a893a85cb8e5178943533656eec65e"}, + {file = "watchfiles-0.18.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a868ce2c7565137f852bd4c863a164dc81306cae7378dbdbe4e2aca51ddb8857"}, + {file = "watchfiles-0.18.1.tar.gz", hash = "sha256:4ec0134a5e31797eb3c6c624dbe9354f2a8ee9c720e0b46fc5b7bab472b7c6d4"}, ] websockets = [ {file = "websockets-10.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d58804e996d7d2307173d56c297cf7bc132c52df27a3efaac5e8d43e36c21c48"}, diff --git a/pyproject.toml b/pyproject.toml index 015b99f..4b4e5e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,13 @@ [tool.poetry] name = "bsition" version = "0.1.0" -description = "" -authors = ["Santiago Lo Coco "] +description = "TP BD2" +authors = [ + "Juan Martin Barmasch ", + "Ezequiel Bellver ", + "Santiago Lo Coco ", +] +license = "MIT" readme = "README.md" [tool.poetry.dependencies] @@ -15,6 +20,19 @@ pymongo = {extras = ["srv"], version = "^4.3.2"} psycopg2 = "^2.9.5" elasticsearch = "^8.5.0" +[tool.poetry.dev-dependencies] +pre-commit = "^2.20.0" +black = "^22.6.0" + +[tool.black] +line-length = 88 +skip-string-normalization = false +multi_line_output = 3 +workers = 1 + +[tool.isort] +profile = "black" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..dbdb98e --- /dev/null +++ b/run.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +usage() { + cat <