<commit_before>#!/ms/dist/python/PROJ/core/2.5.0/bin/python
""" Company is a subclass of Location """

import sys
import os

if __name__ == '__main__':
    DIR = os.path.dirname(os.path.realpath(__file__))
    sys.path.insert(0, os.path.realpath(os.path.join(DIR, '..', '..', '..')))
    import aquilon.aqdb.depends

from sqlalchemy import Column, Integer, ForeignKey

from aquilon.aqdb.loc.location import Location, location


class Company(Location):
    """ Company is a subtype of location """
    __tablename__ = 'company'
    __mapper_args__ = {'polymorphic_identity' : 'company'}
    id = Column(Integer,
                ForeignKey('location.id', name = 'company_loc_fk',
                           ondelete = 'CASCADE'),
                primary_key=True)

company = Company.__table__
company.primary_key.name = 'company_pk'

table = company

def populate(db, *args, **kw):
    s=db.session()

    company.create(checkfirst = True)

    if len(s.query(Company).all()) < 1:
        #NO PARENT ID: breaks 'connect by'
        #TODO: make non-null with exception (I think theres a way to do it)
        a = Company(name='ms.com', fullname = 'root node')
        s.add(a)
        s.commit()


# Copyright (C) 2008 <NAME>
# This module is part of Aquilon

# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-<commit_msg>company/root node has no parent, and it's name is 'ms' not ms.com.<commit_after>#!/ms/dist/python/PROJ/core/2.5.0/bin/python
""" Company is a subclass of Location """

import sys
import os

if __name__ == '__main__':
    DIR = os.path.dirname(os.path.realpath(__file__))
    sys.path.insert(0, os.path.realpath(os.path.join(DIR, '..', '..', '..')))
    import aquilon.aqdb.depends

from sqlalchemy import Column, Integer, ForeignKey

from aquilon.aqdb.loc.location import Location, location


class Company(Location):
    """ Company is a subtype of location """
    __tablename__ = 'company'
    __mapper_args__ = {'polymorphic_identity' : 'company'}
    id = Column(Integer,
                ForeignKey('location.id', name = 'company_loc_fk',
                           ondelete = 'CASCADE'),
                primary_key=True)

company = Company.__table__
company.primary_key.name = 'company_pk'

table = company

def populate(db, *args, **kw):
    s=db.session()

    company.create(checkfirst = True)

    if len(s.query(Company).all()) < 1:
        a = Company(name='ms', fullname = 'root node')
        #NO PARENT FOR THE ROOT NODE: breaks connect_by
        #TODO: audit for null parents in location table
        #      where its not the root node
        s.add(a)
        s.commit()


# Copyright (C) 2008 <NAME>
# This module is part of Aquilon

# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
{'fraction_non_alphanumeric': 0.1382488479262673, 'fraction_numerical': 0.008507621410847217, 'mean_word_length': 2.941340782122905, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6189696', 'n_tokens_mistral': 963, 'n_tokens_neox': 915, 'n_words': 240}