Python sqlalchemy.orm.mapper.isa() Examples

The following are code examples for showing how to use sqlalchemy.orm.mapper.isa(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: flasky   Author: RoseOu   File: util.py    MIT License 5 votes vote down vote up
def replace(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        if not entity or entity.isa(self.mapper):
            return sql_util.ColumnAdapter.replace(self, elem)
        else:
            return None 
Example 2
Project: flasky   Author: RoseOu   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 3
Project: Flask_Blog   Author: sugarguo   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 4
Project: Flask_Blog   Author: sugarguo   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 5
Project: jbox   Author: jpush   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 6
Project: jbox   Author: jpush   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 7
Project: Mahjong-Solitaire   Author: MEASHY   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 8
Project: Mahjong-Solitaire   Author: MEASHY   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 9
Project: Mahjong-Solitaire   Author: MEASHY   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 10
Project: Mahjong-Solitaire   Author: MEASHY   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 11
Project: oa_qian   Author: sunqb   File: util.py    Apache License 2.0 5 votes vote down vote up
def replace(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        if not entity or entity.isa(self.mapper):
            return sql_util.ColumnAdapter.replace(self, elem)
        else:
            return None 
Example 12
Project: oa_qian   Author: sunqb   File: util.py    Apache License 2.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 13
Project: analyzePF   Author: analyzeDFIR   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 14
Project: analyzePF   Author: analyzeDFIR   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 15
Project: analyzePF   Author: analyzeDFIR   File: util.py    MIT License 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or \
            given.mapper.isa(mapper)
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 16
Project: xuemc   Author: skycucumber   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def replace(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        if not entity or entity.isa(self.mapper):
            return sql_util.ColumnAdapter.replace(self, elem)
        else:
            return None 
Example 17
Project: xuemc   Author: skycucumber   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 18
Project: chihu   Author: yelongyu   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 19
Project: chihu   Author: yelongyu   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 20
Project: url_shortener   Author: martydill   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 21
Project: url_shortener   Author: martydill   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 22
Project: DevFest-MaxBond   Author: aiyyoi   File: util.py    MIT License 5 votes vote down vote up
def replace(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        if not entity or entity.isa(self.mapper):
            return sql_util.ColumnAdapter.replace(self, elem)
        else:
            return None 
Example 23
Project: DevFest-MaxBond   Author: aiyyoi   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 24
Project: myBlog   Author: adxc   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 25
Project: myBlog   Author: adxc   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 26
Project: planespotter   Author: yfauser   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 27
Project: planespotter   Author: yfauser   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 28
Project: planespotter   Author: yfauser   File: util.py    MIT License 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or \
            given.mapper.isa(mapper)
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 29
Project: WRGameVideos-API   Author: thundernet8   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 30
Project: WRGameVideos-API   Author: thundernet8   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 31
Project: pipa-pay-server   Author: davidvon   File: util.py    Apache License 2.0 5 votes vote down vote up
def replace(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        if not entity or entity.isa(self.mapper):
            return sql_util.ColumnAdapter.replace(self, elem)
        else:
            return None 
Example 32
Project: pipa-pay-server   Author: davidvon   File: util.py    Apache License 2.0 5 votes vote down vote up
def contains_mapper(self, mapper):
        for path_mapper in [
            self.path[i] for i in range(0, len(self.path), 2)
        ]:
            if isinstance(path_mapper, mapperlib.Mapper) and \
                path_mapper.isa(mapper):
                return True
        else:
            return False 
Example 33
Project: pipa-pay-server   Author: davidvon   File: util.py    Apache License 2.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (mapper, self) 
Example 34
Project: Light_control   Author: laurent-colas   File: util.py    The Unlicense 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 35
Project: Light_control   Author: laurent-colas   File: util.py    The Unlicense 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 36
Project: Light_control   Author: laurent-colas   File: util.py    The Unlicense 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or \
            given.mapper.isa(mapper)
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 37
Project: plataforma-livre-dados-abertos   Author: pbaesse   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get("parentmapper", None)
        return not entity or entity.isa(self.mapper) 
Example 38
Project: plataforma-livre-dados-abertos   Author: pbaesse   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__
                )._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (mapper, self) 
Example 39
Project: plataforma-livre-dados-abertos   Author: pbaesse   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or given.mapper.isa(
            mapper
        )
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 40
Project: Ridr_app   Author: RydrDojo   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 41
Project: Ridr_app   Author: RydrDojo   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            return getattr(self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 42
Project: webapp   Author: superchilli   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 43
Project: webapp   Author: superchilli   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 44
Project: my_hass_config   Author: ivencooli   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 45
Project: my_hass_config   Author: ivencooli   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 46
Project: Full-Stack-Application-Development   Author: Bolton-and-Menk-GIS   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 47
Project: Full-Stack-Application-Development   Author: Bolton-and-Menk-GIS   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self) 
Example 48
Project: Full-Stack-Application-Development   Author: Bolton-and-Menk-GIS   File: util.py    GNU General Public License v3.0 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or \
            given.mapper.isa(mapper)
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 49
Project: sqlalchemy   Author: sqlalchemy   File: util.py    MIT License 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get("parentmapper", None)
        return not entity or entity.isa(self.mapper) 
Example 50
Project: sqlalchemy   Author: sqlalchemy   File: util.py    MIT License 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__
                )._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (mapper, self) 
Example 51
Project: sqlalchemy   Author: sqlalchemy   File: util.py    MIT License 5 votes vote down vote up
def _entity_isa(given, mapper):
    """determine if 'given' "is a" mapper, in terms of the given
    would load rows of type 'mapper'.

    """
    if given.is_aliased_class:
        return mapper in given.with_polymorphic_mappers or given.mapper.isa(
            mapper
        )
    elif given.with_polymorphic_mappers:
        return mapper in given.with_polymorphic_mappers
    else:
        return given.isa(mapper) 
Example 52
Project: WRGameVideos-Server   Author: thundernet8   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def _include_fn(self, elem):
        entity = elem._annotations.get('parentmapper', None)
        return not entity or entity.isa(self.mapper) 
Example 53
Project: WRGameVideos-Server   Author: thundernet8   File: util.py    GNU General Public License v2.0 5 votes vote down vote up
def _entity_for_mapper(self, mapper):
        self_poly = self.with_polymorphic_mappers
        if mapper in self_poly:
            if mapper is self.mapper:
                return self
            else:
                return getattr(
                    self.entity, mapper.class_.__name__)._aliased_insp
        elif mapper.isa(self.mapper):
            return self
        else:
            assert False, "mapper %s doesn't correspond to %s" % (
                mapper, self)