Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Base costs (without heating)
baseRent = FloatCol(default=None)
baseRentOriginalCurrency = FloatCol(default=None)
# Total cost
totalRent = FloatCol(default=None)
totalRentOriginalCurrency = FloatCol(default=None)
# Country, 2 letter code
country = StringCol(length=2, notNull=True)
# Currency, 3 letter code
currency = StringCol(length=3, default='EUR')
# Surface in square meters
livingSpace = FloatCol(default=None)
# Price per square meter
pricePerSqm = FloatCol(default=None)
# True if the flat or house is furnished
furnished = BoolCol(default=None)
# y if realtor, n if rented by a physical person
realtor = BoolCol(default=None)
# The name of the realtor or person offering the flat
realtorName = UnicodeCol(length=300, dbEncoding='utf8', default=None)
# Latitude
latitude = FloatCol(default=None)
# Longitude
longitude = FloatCol(default=None)
# "y" if there is a balcony/terrasse
balcony = BoolCol(default=None)
# The year the building was built
yearConstructed = StringCol(length=100, dbEncoding='utf8', default=None)
# "y" if the flat comes with a cellar
cellar = BoolCol(default=None)
# "y" if the flat comes with a parking or a garage
parking = BoolCol(default=None)
.. py:attribute:: synced
flag indicating if the media file is synced back to home
library from seedbox
.. py:attribute:: missing
flag indicating if the media file was missing from folder
.. py:attribute:: skipped
flag indicating if the media file was skipped for processing
.. py:attribute:: torrent
foreign key reference to the associated Torrent
"""
filename = sqlobject.StringCol()
file_ext = sqlobject.StringCol()
file_path = sqlobject.StringCol(default=None)
size = sqlobject.IntCol(default=0)
compressed = sqlobject.BoolCol(default=False)
synced = sqlobject.BoolCol(default=False)
missing = sqlobject.BoolCol(default=False)
skipped = sqlobject.BoolCol(default=False)
torrent = sqlobject.ForeignKey('Torrent', cascade=True)
class AppState(sqlobject.SQLObject):
"""
A class that defines maintains information about the state of the
application and internal processing. Effectively it is just a
key-value pair except we store the values by type.
.. py:attribute:: name
an identifer for the state
.. py:attribute:: val_str
a value of type string
.. py:attribute:: val_int
log = logging.getLogger(__name__)
DB_NAME = 'torrent.db'
MAX_BACKUP_COUNT = 12
class Torrent(sqlobject.SQLObject):
"""
A class that defines a torrent and associated database table using
SQLObjects to handle persistence.
"""
name = sqlobject.StringCol(unique=True)
create_date = sqlobject.DateCol(default=sqlobject.DateTimeCol.now)
state = sqlobject.EnumCol(enumValues=['init', 'ready', 'active', 'done', 'cancelled'], default='init')
retry_count = sqlobject.IntCol(default=0)
failed = sqlobject.BoolCol(default=False)
error_msg = sqlobject.StringCol(default=None)
invalid = sqlobject.BoolCol(default=False)
purged = sqlobject.BoolCol(default=False)
media_files = sqlobject.SQLMultipleJoin('MediaFile')
class MediaFile(sqlobject.SQLObject):
"""
A class that defines a media file contained within a torrent file
and associatd database table using SQLObjects to handle persistence.
"""
filename = sqlobject.StringCol()
file_ext = sqlobject.StringCol()
file_path = sqlobject.StringCol(default=None)
size = sqlobject.IntCol(default=0)
compressed = sqlobject.BoolCol(default=False)
synced = sqlobject.BoolCol(default=False)
missing = sqlobject.BoolCol(default=False)
class Commands(SQLObject):
class sqlmeta:
lazyUpdate = True
description = UnicodeCol()
taskId = IntCol()
status = IntCol()
completion = FloatCol()
creationTime = DateTimeCol()
startTime = DateTimeCol()
updateTime = DateTimeCol()
endTime = DateTimeCol()
assignedRNId = IntCol()
message = UnicodeCol()
stats = UnicodeCol()
archived = BoolCol()
args = UnicodeCol()
# REZ env management support
runnerPackages = UnicodeCol()
watcherPackages = UnicodeCol()
# Adding autoretry capability on command
attempt = IntCol()
class Pools(SQLObject):
class sqlmeta:
lazyUpdate = True
name = UnicodeCol()
archived = BoolCol()
renderNodes = RelatedJoin('RenderNodes')
media_files = sqlobject.SQLMultipleJoin('MediaFile')
class MediaFile(sqlobject.SQLObject):
"""
A class that defines a media file contained within a torrent file
and associatd database table using SQLObjects to handle persistence.
"""
filename = sqlobject.StringCol()
file_ext = sqlobject.StringCol()
file_path = sqlobject.StringCol(default=None)
size = sqlobject.IntCol(default=0)
compressed = sqlobject.BoolCol(default=False)
synced = sqlobject.BoolCol(default=False)
missing = sqlobject.BoolCol(default=False)
skipped = sqlobject.BoolCol(default=False)
torrent = sqlobject.ForeignKey('Torrent', cascade=True)
class AppState(sqlobject.SQLObject):
"""
A class that defines maintains information about the state of the application
and internal processing. Effectively it is just a key-value pair except we
store the values by type.
"""
name = sqlobject.StringCol(unique=True)
val_str = sqlobject.StringCol(default=None)
val_int = sqlobject.IntCol(default=-99999)
val_list = sqlobject.StringCol(default=None)
val_flag = sqlobject.BoolCol(default=False)
val_date = sqlobject.DateTimeCol(default=sqlobject.DateTimeCol.now)
.. py:attribute:: media_files
reference to a collection of MediaFile records
"""
name = sqlobject.StringCol(unique=True)
create_date = sqlobject.DateCol(default=sqlobject.DateTimeCol.now)
state = sqlobject.EnumCol(enumValues=[INIT,
READY,
ACTIVE,
DONE,
CANCELLED],
default=INIT)
retry_count = sqlobject.IntCol(default=0)
failed = sqlobject.BoolCol(default=False)
error_msg = sqlobject.StringCol(default=None)
invalid = sqlobject.BoolCol(default=False)
purged = sqlobject.BoolCol(default=False)
media_files = sqlobject.SQLMultipleJoin('MediaFile')
class MediaFile(sqlobject.SQLObject):
"""
A class that defines a media file contained within a torrent file
and associatd database table using SQLObjects to handle persistence.
.. py:attribute:: filename
the name of the file associated with media
.. py:attribute:: file_ext
the file type extension associated with media
.. py:attribute:: file_path
the location where the media file is stored
.. py:attribute:: size
the size in bytes of the media file
baseRentOriginalCurrency = FloatCol(default=None)
# Total cost
totalRent = FloatCol(default=None)
totalRentOriginalCurrency = FloatCol(default=None)
# Country, 2 letter code
country = StringCol(length=2, notNull=True)
# Currency, 3 letter code
currency = StringCol(length=3, default='EUR')
# Surface in square meters
livingSpace = FloatCol(default=None)
# Price per square meter
pricePerSqm = FloatCol(default=None)
# True if the flat or house is furnished
furnished = BoolCol(default=None)
# y if realtor, n if rented by a physical person
realtor = BoolCol(default=None)
# The name of the realtor or person offering the flat
realtorName = UnicodeCol(length=300, dbEncoding='utf8', default=None)
# Latitude
latitude = FloatCol(default=None)
# Longitude
longitude = FloatCol(default=None)
# "y" if there is a balcony/terrasse
balcony = BoolCol(default=None)
# The year the building was built
yearConstructed = StringCol(length=100, dbEncoding='utf8', default=None)
# "y" if the flat comes with a cellar
cellar = BoolCol(default=None)
# "y" if the flat comes with a parking or a garage
parking = BoolCol(default=None)
# House Number in the street
houseNumber = StringCol(length=100, dbEncoding='utf8', default=None)
- I{is_main_supplier}: defines if this object stores information
for the main supplier.
- I{base_cost}: the cost which helps the purchaser to define the
main cost of a certain product. Each product can
have multiple suppliers and for each supplier a
base_cost is available. The purchaser in this case
must decide how to define the main cost based in
the base cost avarage of all suppliers.
- I(icms): a Brazil-specific attribute that means
'Imposto sobre circulacao de mercadorias e prestacao '
'de servicos'
"""
base_cost = FloatCol(default=0.0)
notes = StringCol(default='')
is_main_supplier = BoolCol(default=False)
# This is Brazil-specific information
icms = FloatCol(default=0.0)
supplier = ForeignKey('PersonAdaptToSupplier')
product = ForeignKey('Product')
#
# Auxiliary methods
#
def get_name(self):
if not self.supplier:
raise ValueError('This object must have a valid supplier '
'attribute')
return self.supplier.get_adapted().name
invalid = sqlobject.BoolCol(default=False)
purged = sqlobject.BoolCol(default=False)
media_files = sqlobject.SQLMultipleJoin('MediaFile')
class MediaFile(sqlobject.SQLObject):
"""
A class that defines a media file contained within a torrent file
and associatd database table using SQLObjects to handle persistence.
"""
filename = sqlobject.StringCol()
file_ext = sqlobject.StringCol()
file_path = sqlobject.StringCol(default=None)
size = sqlobject.IntCol(default=0)
compressed = sqlobject.BoolCol(default=False)
synced = sqlobject.BoolCol(default=False)
missing = sqlobject.BoolCol(default=False)
skipped = sqlobject.BoolCol(default=False)
torrent = sqlobject.ForeignKey('Torrent', cascade=True)
class AppState(sqlobject.SQLObject):
"""
A class that defines maintains information about the state of the application
and internal processing. Effectively it is just a key-value pair except we
store the values by type.
"""
name = sqlobject.StringCol(unique=True)
val_str = sqlobject.StringCol(default=None)
val_int = sqlobject.IntCol(default=-99999)
val_list = sqlobject.StringCol(default=None)
val_flag = sqlobject.BoolCol(default=False)