Skip to content

Commit

Permalink
flake8 add
Browse files Browse the repository at this point in the history
  • Loading branch information
search5 committed Mar 10, 2024
1 parent 5f0bd45 commit ab42bc5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
args: [--fix=lf]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ find = {}

[tool.setuptools.dynamic]
version = {attr = "social_flask_sqlalchemy.__version__"}

[tool.flake8]
max-line-length = 79
# Ignore some well known paths
exclude = ['.venv','.tox','dist','doc','build','*.egg','db/env.py','db/versions/*.py','site','Pipfile','Pipfile.lock']
10 changes: 5 additions & 5 deletions social_flask_sqlalchemy/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Flask SQLAlchemy ORM models for Social Auth"""
from sqlalchemy import String, ForeignKey
from sqlalchemy.orm import relationship, backref, Mapped, mapped_column, DeclarativeBase
from sqlalchemy import ForeignKey
from sqlalchemy.orm import (relationship, backref,
mapped_column, DeclarativeBase)
from sqlalchemy.schema import UniqueConstraint

from social_core.utils import setting_name, module_member
Expand Down Expand Up @@ -72,11 +73,10 @@ class FlaskStorage(BaseSQLAlchemyStorage):


def init_social(app, session):
UID_LENGTH = app.config.get(setting_name('UID_LENGTH'), 255)
User = module_member(app.config[setting_name('USER_MODEL')])
_AppSession._set_session(session)
UserSocialAuth.__table_args__ = (UniqueConstraint('provider', 'uid'),)
UserSocialAuth.user_id = mapped_column(ForeignKey(User.id),
nullable=False, index=True)
UserSocialAuth.user_id = mapped_column(
ForeignKey(User.id), nullable=False, index=True)
UserSocialAuth.user = relationship(User, backref=backref('social_auth',
lazy='dynamic'))

0 comments on commit ab42bc5

Please sign in to comment.