Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
f"{str(self.date)} - {str(self.package)} - {str(self.category)}"
)
class PythonMinorDownloadCount(Model):
"""Download counts by python minor version."""
__tablename__ = "python_minor"
date = Column(db.Date, primary_key=True)
package = Column(
db.String(128), primary_key=True, nullable=False, index=True
)
# python_minor version, e.g. 2.7 or 3.6 (or null)
category = Column(db.String(4), primary_key=True, nullable=True)
downloads = Column(db.Integer(), nullable=False)
def __repr__(self):
return "
MAX_FAVORITES = 20
class User(UserMixin, SurrogatePK, Model):
"""A user of the app."""
__tablename__ = 'users'
uid = Column(db.Integer(), unique=True)
username = Column(db.String(39), nullable=False)
avatar_url = Column(db.String(256))
token = Column(db.String(256))
created_at = \
Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
active = Column(db.Boolean(), default=False)
is_admin = Column(db.Boolean(), default=False)
favorites = Column(ARRAY(db.String(128), dimensions=1))
def __init__(self, token, **kwargs):
"""Create instance."""
db.Model.__init__(self, token=token, **kwargs)
def __repr__(self):
"""Represent instance as a unique string."""
return f""
MAX_FAVORITES = 20
class User(UserMixin, SurrogatePK, Model):
"""A user of the app."""
__tablename__ = 'users'
uid = Column(db.Integer(), unique=True)
username = Column(db.String(39), nullable=False)
avatar_url = Column(db.String(256))
token = Column(db.String(256))
created_at = \
Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
active = Column(db.Boolean(), default=False)
is_admin = Column(db.Boolean(), default=False)
favorites = Column(ARRAY(db.String(128), dimensions=1))
def __init__(self, token, **kwargs):
"""Create instance."""
db.Model.__init__(self, token=token, **kwargs)
def __repr__(self):
"""Represent instance as a unique string."""
return f""
# recency, e.g. day, week, month
category = Column(db.String(8), primary_key=True, nullable=False)
downloads = Column(db.BigInteger(), nullable=False)
def __repr__(self):
return "".format(
f"{str(self.package)} - {str(self.category)}"
)
class SystemDownloadCount(Model):
"""Download counts by system."""
__tablename__ = "system"
date = Column(db.Date, primary_key=True)
package = Column(
db.String(128), primary_key=True, nullable=False, index=True
)
# system, e.g. Windows or Linux or Darwin (or null)
category = Column(db.String(8), primary_key=True, nullable=True)
downloads = Column(db.Integer(), nullable=False)
def __repr__(self):
return "
def __repr__(self):
return "".format(
f"{str(self.package)} - {str(self.category)}"
)
class SystemDownloadCount(Model):
"""Download counts by system."""
__tablename__ = "system"