diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5858a283f9e91de15d22143a4924242873200378..cc9e264bbb4e5164c2a700a2f216c539fbac4afa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,7 +91,7 @@ lint: - source ./venv/bin/activate - pip install pycodestyle script: - - pycodestyle --show-source --show-pep8 ./backend + - pycodestyle --config=./backend ./backend test: diff --git a/README.md b/README.md index 462bb8b3b86433e65893fea02c9703c53a60f495..98d206a431368d2ca63ecefba935e383d013d969 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,12 @@ Start the development server running `python -m uvicorn main:app --reload --port Navigate to [http://localhost:3001](http://localhost:3001) +<br/> + +### *Le linter* +So the new commits can be deployed, you'll need to use the linter from backend : +`pycodestyle --config=./setup.cnf --exclude=./env ./` + <br/> ## In production mode diff --git a/backend/db/crud.py b/backend/db/crud.py index 45f099a6f81d551df76bbc4645d2c189f422467e..989c6bc25b754dc811c98eb4cb7f76f8bf54c0ae 100644 --- a/backend/db/crud.py +++ b/backend/db/crud.py @@ -7,8 +7,7 @@ from db import models, schemas def get_records(place: str, db: Session): """ Get all the records for the given place """ - records = db.query(models.Records).filter( - models.Records.place == place).order_by(models.Records.date.desc()).all() + records = db.query(models.Records).filter(models.Records.place == place).order_by(models.Records.date.desc()).all() return records diff --git a/backend/db/database.py b/backend/db/database.py index 24d0618c30abfffc5d88776c5eec1507c84bc7ca..4ea65170ae38296262221fe4341191ebff75975d 100644 --- a/backend/db/database.py +++ b/backend/db/database.py @@ -9,7 +9,13 @@ import os # load environment variables load_dotenv() -SQLALCHEMY_DATABASE_URL = f"mysql+pymysql://{os.getenv('MYSQL_USER')}:{os.getenv('MYSQL_PASSWORD')}@{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('MYSQL_DATABASE')}?charset=utf8" +user = os.getenv('MYSQL_USER') +password = os.getenv('MYSQL_PASSWORD') +host = os.getenv('DB_HOST') +port = os.getenv('DB_PORT') +database = os.getenv('MYSQL_DATABASE') + +SQLALCHEMY_DATABASE_URL = f"mysql+pymysql://{user}:{password}@{host}:{port}/{database}?charset=utf8" engine = create_engine(SQLALCHEMY_DATABASE_URL) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) diff --git a/backend/setup.cnf b/backend/setup.cnf new file mode 100644 index 0000000000000000000000000000000000000000..8fbaf1e1ca767f58e6163e9b65d68610fe7a8ca9 --- /dev/null +++ b/backend/setup.cnf @@ -0,0 +1,2 @@ +[pycodestyle] +max-line-length = 160 \ No newline at end of file diff --git a/backend/utils/preprocessing.py b/backend/utils/preprocessing.py index e4ec2c636251ca0c02258a07d9d899bf13ffc91e..19384b5ed9d4088108722f3a5476751efa2d86d7 100644 --- a/backend/utils/preprocessing.py +++ b/backend/utils/preprocessing.py @@ -23,6 +23,7 @@ def norm_by_imagenet(img): print('Wrong shape of the input.') return None + def fix_singular_shape(img, unit_len=16): """ Some network like w-net has both N maxpooling layers and concatenate layers,