Пример #1
0
    def _filter_fields_by_access(self, access, field_source):

        def compare_access(decl):
            orig_or_dest = getattr(decl[1], field_source)  # (field_name, Field)
            orig_or_dest_access = orig_or_dest.access if isinstance(orig_or_dest, FieldAccessor) else orig_or_dest
            return access == orig_or_dest_access

        return compat.filter(compare_access, self._fields)
Пример #2
0
 def split(name, pattern=None, **kwargs):
     pattern = re.compile(
         pattern) if pattern else ModelAccessor.SPLIT_ACCESSOR_REGEX
     return compat.filter(None,
                          pattern.split(name,
                                        **kwargs))  # delete empty strings
Пример #3
0
 def filter_children_by_dest_access(self, access):
     return compat.filter(lambda decl: access == decl[1].destination_access,
                          self._children)
Пример #4
0
 def filter_children_by_orig_access(self, access):
     return compat.filter(lambda decl: access == decl[1].origin_access,  # (field_name, ModelMapper)
                          self._children)