Compare commits
2 Commits
e6e7c20479
...
eb1d1e1dd3
| Author | SHA1 | Date | |
|---|---|---|---|
| eb1d1e1dd3 | |||
| 21ffc736bc |
30
.pre-commit-config.yaml
Normal file
30
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
repos:
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.7.4
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py37-plus]
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.0.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
- --ignore-words-list=sigl
|
||||
- --skip="./.*,*.csv,*.json"
|
||||
- --quiet-level=2
|
||||
exclude_types: [csv, json]
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.8.4
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies:
|
||||
- flake8-docstrings==1.5.0
|
||||
- pydocstyle==5.1.1
|
||||
files: ^(sigl|tests)/.+\.py$
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.5.3
|
||||
hooks:
|
||||
- id: isort
|
||||
@@ -8,15 +8,11 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
def init_shell(): # pragma: no cover
|
||||
"""Initialize the Flask Shell Context."""
|
||||
import datetime
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sigl.database import db
|
||||
from sigl.domain.models import (
|
||||
ListEntry,
|
||||
Product,
|
||||
ProductLocation,
|
||||
ShoppingList,
|
||||
)
|
||||
from sigl.domain.models import ListEntry, Product, ProductLocation, ShoppingList
|
||||
|
||||
return {
|
||||
# Imports
|
||||
|
||||
@@ -4,27 +4,18 @@ Simple Grocery List (Sigl) | sigl.app
|
||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
"""
|
||||
|
||||
from sigl.domain.models import (
|
||||
Product,
|
||||
ProductLocation,
|
||||
)
|
||||
from sigl.domain.models import Product, ProductLocation
|
||||
from sigl.domain.models.list import ListEntry, ShoppingList
|
||||
|
||||
from .globals import db
|
||||
from .tables import (
|
||||
list_entries,
|
||||
lists,
|
||||
product_locations,
|
||||
products,
|
||||
)
|
||||
from .tables import list_entries, lists, product_locations, products
|
||||
|
||||
__all__ = ('init_orm', )
|
||||
|
||||
|
||||
def init_orm():
|
||||
"""Initialize the Sigl ORM."""
|
||||
|
||||
# # List Entries
|
||||
# List Entries
|
||||
db.mapper(ListEntry, list_entries, properties={
|
||||
'product': db.relationship(
|
||||
Product,
|
||||
|
||||
@@ -5,7 +5,7 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, List
|
||||
|
||||
from .mixins import NotesMixin, TimestampMixin
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from typing import List, Optional, Union
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from sigl.exc import DomainError, NotFoundError
|
||||
|
||||
from .models import ListEntry, Product, ProductLocation, ShoppingList
|
||||
|
||||
|
||||
@@ -140,7 +141,7 @@ def list_stores(session: Session, id: Optional[int]) -> List[str]:
|
||||
Product has locations are returned.
|
||||
"""
|
||||
if id is None:
|
||||
return list(set([loc.store for loc in session.query(ProductLocation).all()]))
|
||||
return list({loc.store for loc in session.query(ProductLocation).all()})
|
||||
|
||||
sList = list_by_id(session, id)
|
||||
if not sList:
|
||||
|
||||
@@ -6,17 +6,32 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
|
||||
from flask import (
|
||||
Blueprint,
|
||||
flash, jsonify, make_response, redirect, render_template, request, url_for
|
||||
flash,
|
||||
jsonify,
|
||||
make_response,
|
||||
redirect,
|
||||
render_template,
|
||||
request,
|
||||
url_for,
|
||||
)
|
||||
|
||||
from sigl.exc import DomainError, Error, NotFoundError
|
||||
from sigl.database import db
|
||||
from sigl.domain.service import (
|
||||
list_entry_by_id, lists_all, list_by_id, list_create, list_delete,
|
||||
list_update, list_addItem, list_deleteItem, list_editItem, list_stores,
|
||||
list_deleteCrossedOff, list_entry_set_crossedOff,
|
||||
list_addItem,
|
||||
list_by_id,
|
||||
list_create,
|
||||
list_delete,
|
||||
list_deleteCrossedOff,
|
||||
list_deleteItem,
|
||||
list_editItem,
|
||||
list_entry_by_id,
|
||||
list_entry_set_crossedOff,
|
||||
list_stores,
|
||||
list_update,
|
||||
lists_all,
|
||||
products_all,
|
||||
)
|
||||
from sigl.exc import DomainError, Error, NotFoundError
|
||||
|
||||
__all__ = ('bp', )
|
||||
|
||||
|
||||
@@ -4,23 +4,20 @@ Simple Grocery List (Sigl) | sigl.app
|
||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
"""
|
||||
|
||||
from flask import (
|
||||
Blueprint,
|
||||
flash, redirect, render_template, request, url_for
|
||||
)
|
||||
from flask import Blueprint, flash, redirect, render_template, request, url_for
|
||||
|
||||
from sigl.exc import Error, NotFoundError
|
||||
from sigl.database import db
|
||||
from sigl.domain.service import (
|
||||
list_stores,
|
||||
products_all,
|
||||
product_addLocation,
|
||||
product_by_id,
|
||||
product_create,
|
||||
product_delete,
|
||||
product_update,
|
||||
product_addLocation,
|
||||
product_removeLocation,
|
||||
product_update,
|
||||
products_all,
|
||||
)
|
||||
from sigl.exc import Error, NotFoundError
|
||||
|
||||
__all__ = ('bp', )
|
||||
|
||||
|
||||
@@ -6,5 +6,4 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||
|
||||
from .factory import create_app
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
Reference in New Issue
Block a user