<commit_before>""" SDE Database object-relational configuration.

Module contains mapping between SDE database tables and python classes

"""
from sqlalchemy import Column, Integer, String, Boolean, REAL
from sqlalchemy.ext.declarative import declarative_base

_Base = declarative_base()


class System(_Base):
    __tablename__ = 'mapSolarSystems'

    regionID = Column(Integer)
    constellationID = Column(Integer)
    id = Column(Integer, primary_key=True, name="solarSystemID")
    name = Column(String(length=100), name='solarSystemName')
    x = Column(REAL)
    y = Column(REAL)
    z = Column(REAL)
    xMin = Column(REAL)
    xMax = Column(REAL)
    yMin = Column(REAL)
    yMax = Column(REAL)
    zMin = Column(REAL)
    zMax = Column(REAL)
    luminosity = Column(REAL)
    border = Column(Boolean)
    fringe = Column(Boolean)
    corridor = Column(Boolean)
    hub = Column(Boolean)
    international = Column(Boolean)
    regional = Column(Boolean)
    constellation = Column(Boolean)
    security = Column(REAL)
    factionID = Column(Integer)
    radius = Column(REAL)
    sunTypeID = Column(Integer)
    securityClass = Column(String(length=2))


class Region(_Base):
    __tablename__ = 'mapRegions'

    id = Column(Integer, primary_key=True, name="regionID")
    name = Column(String(length=100),  name="regionName")
    x = Column(REAL)
    y = Column(REAL)
    z = Column(REAL)
    xMin = Column(REAL)
    xMax = Column(REAL)
    yMin = Column(REAL)
    yMax = Column(REAL)
    zMin = Column(REAL)
    zMax = Column(REAL)
    factionID = Column(Integer)
    radius = Column(REAL)


class RegionJump(_Base):
    __tablename__ = 'mapRegionJumps'

    fromID = Column(Integer, primary_key=True, name="fromRegionID")
    toID = Column(Integer, primary_key=True, name="toRegionID")


class ConstellationJump(_Base):
    __tablename__ = 'mapConstellationJumps'

    fromID = Column(Integer,
                    primary_key=True,
                    name="fromConstellationID")
    toID = Column(Integer,
                  primary_key=True,
                  name="toConstellationID")
    fromRegionID = Column(Integer,
                          primary_key=True,
                          name="fromRegionID")
    toRegionID = Column(Integer,
                        primary_key=True,
                        name="toRegionID")


class SystemJump(_Base):
    __tablename__ = 'mapSolarSystemJumps'

    fromID = Column(Integer,
                    primary_key=True,
                    name="fromSolarSystemID")
    toID = Column(Integer,
                  primary_key=True,
                  name="toSolarSystemID")
    fromConstellationID = Column(Integer,
                                 primary_key=True,
                                 name="fromConstellationID")
    toConstellationID = Column(Integer,
                               primary_key=True,
                               name="toConstellationID")
    fromRegionID = Column(Integer,
                          primary_key=True,
                          name="fromRegionID")
    toRegionID = Column(Integer,
                        primary_key=True,
                        name="toRegionID")
<commit_msg>Provided all modules with as_dict() method for easier conversion to JSON. New-style class, because classic not supported<commit_after>""" SDE Database object-relational configuration.

Module contains mapping between SDE database tables and python classes

"""
from copy import deepcopy
from sqlalchemy import Column, Integer, String, Boolean, REAL
from sqlalchemy.ext.declarative import declarative_base


class _DictableBase(object):
    """Pass this class as `cls` argument to declarative base to add method for
    getting dict representation to all child classes

    """

    def as_dict(self):
        """Return a dictionary of the entry's attribute-value pair, obeying
        custom propery names

        """
        d = deepcopy(self.__dict__)
        d.pop('_sa_instance_state')
        return d

_Base = declarative_base(cls=_DictableBase)


class System(_Base):
    __tablename__ = 'mapSolarSystems'

    regionID = Column(Integer)
    constellationID = Column(Integer)
    id = Column(Integer, primary_key=True, name="solarSystemID")
    name = Column(String(length=100), name='solarSystemName')
    x = Column(REAL)
    y = Column(REAL)
    z = Column(REAL)
    xMin = Column(REAL)
    xMax = Column(REAL)
    yMin = Column(REAL)
    yMax = Column(REAL)
    zMin = Column(REAL)
    zMax = Column(REAL)
    luminosity = Column(REAL)
    border = Column(Boolean)
    fringe = Column(Boolean)
    corridor = Column(Boolean)
    hub = Column(Boolean)
    international = Column(Boolean)
    regional = Column(Boolean)
    constellation = Column(Boolean)
    security = Column(REAL)
    factionID = Column(Integer)
    radius = Column(REAL)
    sunTypeID = Column(Integer)
    securityClass = Column(String(length=2))

    def as_dict(self):
        d = deepcopy(self.__dict__)
        d.pop('_sa_instance_state')
        return d


class Region(_Base):
    __tablename__ = 'mapRegions'

    id = Column(Integer, primary_key=True, name="regionID")
    name = Column(String(length=100),  name="regionName")
    x = Column(REAL)
    y = Column(REAL)
    z = Column(REAL)
    xMin = Column(REAL)
    xMax = Column(REAL)
    yMin = Column(REAL)
    yMax = Column(REAL)
    zMin = Column(REAL)
    zMax = Column(REAL)
    factionID = Column(Integer)
    radius = Column(REAL)


class RegionJump(_Base):
    __tablename__ = 'mapRegionJumps'

    fromID = Column(Integer, primary_key=True, name="fromRegionID")
    toID = Column(Integer, primary_key=True, name="toRegionID")


class ConstellationJump(_Base):
    __tablename__ = 'mapConstellationJumps'

    fromID = Column(Integer,
                    primary_key=True,
                    name="fromConstellationID")
    toID = Column(Integer,
                  primary_key=True,
                  name="toConstellationID")
    fromRegionID = Column(Integer,
                          primary_key=True,
                          name="fromRegionID")
    toRegionID = Column(Integer,
                        primary_key=True,
                        name="toRegionID")


class SystemJump(_Base):
    __tablename__ = 'mapSolarSystemJumps'

    fromID = Column(Integer,
                    primary_key=True,
                    name="fromSolarSystemID")
    toID = Column(Integer,
                  primary_key=True,
                  name="toSolarSystemID")
    fromConstellationID = Column(Integer,
                                 primary_key=True,
                                 name="fromConstellationID")
    toConstellationID = Column(Integer,
                               primary_key=True,
                               name="toConstellationID")
    fromRegionID = Column(Integer,
                          primary_key=True,
                          name="fromRegionID")
    toRegionID = Column(Integer,
                        primary_key=True,
                        name="toRegionID")

{'fraction_non_alphanumeric': 0.0933863184785694, 'fraction_numerical': 0.0019869429463525404, 'mean_word_length': 2.3398104265402844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3935571', 'n_tokens_mistral': 2092, 'n_tokens_neox': 2016, 'n_words': 430}