<commit_before>'''
Created on Aug 23, 2011

@package: superdesk person
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: <NAME>

Contains the SQL alchemy meta for person API.
'''

from ..api.person import Person
from sqlalchemy.dialects.mysql.base import INTEGER
from sqlalchemy.schema import Column
from sqlalchemy.types import String
from superdesk.meta.metadata_superdesk import Base
from sqlalchemy.ext.hybrid import hybrid_property
from ally.container.binder_op import validateManaged
from ally.support.sqlalchemy.mapper import registerValidation
from sqlalchemy.orm.mapper import reconstructor

# --------------------------------------------------------------------

class PersonMapped(Base, Person):
    '''
    Provides the mapping for Person entity.
    '''
    __tablename__ = 'person'
    __table_args__ = dict(mysql_engine='InnoDB', mysql_charset='utf8')

    Id = Column('id', INTEGER(unsigned=True), primary_key=True)
    FirstName = Column('first_name', String(255))
    LastName = Column('last_name', String(255))
    Address = Column('address', String(255))

    # Calculated model attributes ------------------------------------
    @hybrid_property
    def Name(self):
        name = '%s %s' % ('' if self.FirstName is None else self.FirstName,
                          '' if self.LastName is None else self.LastName)
        print('name: %s' % name)<commit_msg>NR-114 : Live Blog back end<commit_after>'''
Created on Aug 23, 2011

@package: superdesk person
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: <NAME>

Contains the SQL alchemy meta for person API.
'''

from ..api.person import Person
from sqlalchemy.dialects.mysql.base import INTEGER
from sqlalchemy.schema import Column
from sqlalchemy.types import String
from superdesk.meta.metadata_superdesk import Base
from sqlalchemy.ext.hybrid import hybrid_property
from ally.container.binder_op import validateManaged
from ally.support.sqlalchemy.mapper import registerValidation
from sqlalchemy.orm.mapper import reconstructor

# --------------------------------------------------------------------

class PersonMapped(Base, Person):
    '''
    Provides the mapping for Person entity.
    '''
    __tablename__ = 'person'
    __table_args__ = dict(mysql_engine='InnoDB', mysql_charset='utf8')

    Id = Column('id', INTEGER(unsigned=True), primary_key=True)
    FirstName = Column('first_name', String(255))
    LastName = Column('last_name', String(255))
    Address = Column('address', String(255))

    # Calculated model attributes ------------------------------------
    @hybrid_property
    def Name(self):
        name = '%s %s' % ('' if self.FirstName is None else self.FirstName,
                          '' if self.LastName is None else self.LastName)
        #TODO: remove
        print('name: %s' % name)
{'fraction_non_alphanumeric': 0.1715076071922545, 'fraction_numerical': 0.01625172890733057, 'mean_word_length': 2.85219707057257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4441723', 'n_tokens_mistral': 883, 'n_tokens_neox': 805, 'n_words': 229}