Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class ST_Multi(GenericFunction):
name = 'ST_Multi'
type = Geometry
class ST_Collect(GenericFunction):
name = 'ST_Collect'
type = Geometry
class ST_Union(GenericFunction):
name = 'ST_Union'
type = Geometry
class ST_Buffer(GenericFunction):
name = 'ST_Buffer'
type = Geometry
class ST_SetSRID(GenericFunction):
name = 'ST_SetSRID'
type = Geometry
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
make_translatable()
users_licenses_table = Table(
'users_licenses', Base.metadata,
Column('user', BigInteger, ForeignKey('users.id')),
class ST_Buffer(GenericFunction):
""" Exposes PostGIS ST_Buffer function """
name = "ST_Buffer"
type = Geometry
class ST_Intersects(GenericFunction):
""" Exposes PostGIS ST_Intersects function """
name = "ST_Intersects"
type = Geometry
class ST_MakeEnvelope(GenericFunction):
""" Exposes PostGIS ST_MakeEnvelope function """
name = "ST_MakeEnvelope"
type = Geometry
class ST_X(GenericFunction):
""" Exposes PostGIS ST_X function """
name = "ST_X"
type = Geometry
class ST_Y(GenericFunction):
""" Exposes PostGIS ST_Y function """
)
from pyramid.threadlocal import get_current_registry
class ST_Multi(GenericFunction):
name = 'ST_Multi'
type = Geometry
class ST_Collect(GenericFunction):
name = 'ST_Collect'
type = Geometry
class ST_Union(GenericFunction):
name = 'ST_Union'
type = Geometry
class ST_Buffer(GenericFunction):
name = 'ST_Buffer'
type = Geometry
class ST_SetSRID(GenericFunction):
name = 'ST_SetSRID'
type = Geometry
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
class ST_Collect(GenericFunction):
name = 'ST_Collect'
type = Geometry
class ST_Union(GenericFunction):
name = 'ST_Union'
type = Geometry
class ST_Buffer(GenericFunction):
name = 'ST_Buffer'
type = Geometry
class ST_SetSRID(GenericFunction):
name = 'ST_SetSRID'
type = Geometry
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
make_translatable()
users_licenses_table = Table(
'users_licenses', Base.metadata,
Column('user', BigInteger, ForeignKey('users.id')),
Column('license', Integer, ForeignKey('licenses.id')))
# user roles
ADMIN = 1
PROJECT_MANAGER = 2
class ST_Centroid(GenericFunction):
""" Exposes PostGIS ST_Centroid function """
name = "ST_Centroid"
type = Geometry
class ST_Transform(GenericFunction):
""" Exposes PostGIS ST_Transform function """
name = "ST_Transform"
type = Geometry
class ST_Area(GenericFunction):
""" Exposes PostGIS ST_Area function """
name = "ST_Area"
type = None
class ST_Buffer(GenericFunction):
""" Exposes PostGIS ST_Buffer function """
name = "ST_Buffer"
type = Geometry
class ST_Intersects(GenericFunction):
""" Exposes PostGIS ST_Intersects function """
docs.append(doc[0])
docs.append('see http://postgis.net/docs/{0}.html'.format(doc[1]))
elif doc is not None:
docs.append(doc)
docs.append('see http://postgis.net/docs/{0}.html'.format(name))
if type_ is not None:
attributes['type'] = type_
type_str = '{0}.{1}'.format(type_.__module__, type_.__name__)
docs.append('Return type: :class:`{0}`.'.format(type_str))
if len(docs) != 0:
attributes['__doc__'] = '\n\n'.join(docs)
globals()[name] = type(name, (GenericFunction,), attributes)
#
# Define compiled versions for functions in SpatiaLite whose names don't have
# the ST_ prefix.
#
_SQLITE_FUNCTIONS = {
"ST_GeomFromEWKT": "GeomFromEWKT",
"ST_GeomFromEWKB": "GeomFromEWKB",
"ST_AsBinary": "AsBinary",
"ST_AsEWKB": "AsEWKB",
"ST_AsGeoJSON": "AsGeoJSON",
}
return datetime.datetime.utcnow()
class ST_GeomFromText(GenericFunction):
""" Export the postgis ST_GeomFromText function """
name = 'ST_GeomFromText'
type = Geometry
class ST_Intersects(GenericFunction):
""" Exposes PostGIS ST_Intersects function """
name = 'ST_Intersects'
type = Geometry
class ST_MakeEnvelope(GenericFunction):
""" Exposes PostGIS ST_MakeEnvelope function """
name = 'ST_MakeEnvelope'
type = Geometry
class ST_AsText(GenericFunction):
""" Exposes PostGIS ST_AsText function """
name = 'ST_AsText'
type = Geometry
class ST_Area(GenericFunction):
""" Exposes PostGIS ST_Area function """
name = "ST_Area"
type = None
class ST_Buffer(GenericFunction):
""" Exposes PostGIS ST_Buffer function """
name = "ST_Buffer"
type = Geometry
class ST_Intersects(GenericFunction):
""" Exposes PostGIS ST_Intersects function """
name = "ST_Intersects"
type = Geometry
class ST_MakeEnvelope(GenericFunction):
""" Exposes PostGIS ST_MakeEnvelope function """
name = "ST_MakeEnvelope"
type = Geometry
class ST_X(GenericFunction):
""" Exposes PostGIS ST_X function """
from sqlalchemy_i18n import (
Translatable,
make_translatable,
translation_base,
)
from pyramid.threadlocal import get_current_registry
class ST_Multi(GenericFunction):
name = 'ST_Multi'
type = Geometry
class ST_Collect(GenericFunction):
name = 'ST_Collect'
type = Geometry
class ST_Union(GenericFunction):
name = 'ST_Union'
type = Geometry
class ST_Buffer(GenericFunction):
name = 'ST_Buffer'
type = Geometry
class ST_SetSRID(GenericFunction):
name = 'ST_SetSRID'
class VersionNotFound(Exception):
""" Custom exception to indicate that model version is not found """
pass
class PredictionsNotFound(Exception):
""" Custom exception to indicate that no predictions were found """
def timestamp():
""" Used in SQL Alchemy models to ensure we refresh
timestamp when new models initialised"""
return datetime.datetime.utcnow()
class ST_GeomFromText(GenericFunction):
""" Export the postgis ST_GeomFromText function """
name = 'ST_GeomFromText'
type = Geometry
class ST_Intersects(GenericFunction):
""" Exposes PostGIS ST_Intersects function """
name = 'ST_Intersects'
type = Geometry
class ST_MakeEnvelope(GenericFunction):
""" Exposes PostGIS ST_MakeEnvelope function """
name = 'ST_MakeEnvelope'
type = Geometry