fix MovedIn20Warning
shouldn't actually cause any issues currently since SQLAlchemy is (to my annoyance) import *ed everywhere but.
This commit is contained in:
parent
e61e35226d
commit
9b94e524bb
28 changed files with 32 additions and 29 deletions
|
@ -11,7 +11,6 @@ from flask_limiter import Limiter
|
|||
from flask_compress import Compress
|
||||
from flask_mail import Mail
|
||||
import flask_profiler
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker, scoped_session
|
||||
from sqlalchemy import *
|
||||
import gevent
|
||||
|
@ -150,8 +149,6 @@ limiter = Limiter(
|
|||
enabled=app.config['RATE_LIMITER_ENABLED'],
|
||||
)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
engine = create_engine(app.config['DATABASE_URL'])
|
||||
|
||||
db_session = scoped_session(sessionmaker(bind=engine, autoflush=False))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
|
||||
class Alt(Base):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base, app
|
||||
from files.classes.base import Base
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
|
|
3
files/classes/base.py
Normal file
3
files/classes/base.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from sqlalchemy.orm import declarative_base
|
||||
|
||||
Base = declarative_base()
|
|
@ -3,7 +3,7 @@ from sqlalchemy import *
|
|||
from sqlalchemy.orm import relationship
|
||||
from .submission import Submission
|
||||
from .comment import Comment
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
|
|
@ -6,7 +6,8 @@ from urllib.parse import urlencode, urlparse, parse_qs
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base, app
|
||||
from files.classes.base import Base
|
||||
from files.__main__ import app
|
||||
from files.classes.votes import CommentVote
|
||||
from files.helpers.const import *
|
||||
from files.helpers.content import moderated_body
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class BannedDomain(Base):
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class Exile(Base):
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
import time
|
||||
|
||||
class Follow(Base):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class Marsey(Base):
|
||||
__tablename__ = "marseys"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import *
|
||||
import time
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
import time
|
||||
from files.helpers.lazy import lazy
|
||||
from os import environ
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
import time
|
||||
|
||||
class Notification(Base):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
|
||||
class SaveRelationship(Base):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from os import environ
|
||||
from .sub_block import *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class SubBlock(Base):
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ from urllib.parse import urlparse
|
|||
from flask import render_template
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, deferred
|
||||
from files.__main__ import Base, app
|
||||
from files.classes.base import Base
|
||||
from files.__main__ import app
|
||||
from files.helpers.const import *
|
||||
from files.helpers.content import moderated_body
|
||||
from files.helpers.lazy import lazy
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class Subscription(Base):
|
||||
__tablename__ = "subscriptions"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from sqlalchemy.orm import deferred, aliased
|
||||
from secrets import token_hex
|
||||
import pyotp
|
||||
from files.classes.base import Base
|
||||
from files.helpers.media import *
|
||||
from files.helpers.const import *
|
||||
from .alts import Alt
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
|
||||
class UserBlock(Base):
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import time
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.const import *
|
||||
from enum import Enum
|
||||
from sqlalchemy import Enum as EnumType
|
||||
|
@ -63,4 +63,4 @@ class UserNote(Base):
|
|||
'tag': self.tag.value
|
||||
}
|
||||
|
||||
return data
|
||||
return data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import *
|
||||
import time
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import enum
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
from files.helpers.lazy import lazy
|
||||
import time
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ logger = logging.getLogger('alembic.env')
|
|||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
target_metadata = Base.metadata
|
||||
|
||||
config.set_main_option(
|
||||
|
|
|
@ -53,7 +53,7 @@ As an example, let's say we want to add a column `is_flagged` to the `comments`
|
|||
|
||||
1. Update the `Comment` model in `files/classes/comment.py`
|
||||
```python
|
||||
from files.__main__ import Base
|
||||
from files.classes.base import Base
|
||||
class Comment(Base):
|
||||
__tablename__ = "comments"
|
||||
id = Column(Integer, primary_key=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue