Returns the module holding the conversion functions for a
    particular model).
961659
def _get_converter_module(sk_obj):
    
    try:
        cv_idx = _converter_lookup[sk_obj.__class__]
    except KeyError:
        raise ValueError(
                "Transformer '%s' not supported; supported transformers are %s."
                % (repr(sk_obj),
                    ",".join(k.__name__ for k in _converter_module_list)))

    return _converter_module_list[cv_idx]
1152712
def GetConvertersByClass(value_cls):
    """"""
    try:
      return ExportConverter.converters_cache[value_cls]
    except KeyError:
      results = [
          cls for cls in itervalues(ExportConverter.classes)
          if cls.input_rdf_type == value_cls
      ]
      if not results:
        results = [DataAgnosticExportConverter]

      ExportConverter.converters_cache[value_cls] = results
      return results
657832
def get_function(self):
        
        if not hasattr(self, '_function'):
            try:
                modname, funcname = self.function.rsplit('.', 1)
                mod = import_module(modname)
                self._function = getattr(mod, funcname)
            except (ImportError, AttributeError, ValueError), err:
                raise ProcessorConfigurationError(err)

        return self._function
656713
def _function_lookup(name, module):
    
    try:
        return _registered_functions[name]
    except KeyError:  # force function registering
        __import__(module)
        mod = sys.modules[module]
        getattr(mod, name)

        return _registered_functions[name]
179151
def _get_custom_models(models):
    """"""
    if models is None:
        models = Model.model_class_reverse_map.values()

    custom_models = OrderedDict()
    for cls in models:
        impl = getattr(cls, "__implementation__", None)

        if impl is not None:
            model = CustomModel(cls)
            custom_models[model.full_name] = model

    if not custom_models:
        return None
    return custom_models
469274
def module(self):
        
        module = self.frame.f_globals.get('__name__', '')
        if module is None:
            module = ''

        return module
1263396
def _convert(cls, name, module, filter, source=None):
    
    # convert all constants from source (or module) that pass filter() to
    # a new Enum called name, and export the enum and its members back to
    # module;
    # also, replace the __reduce_ex__ method so unpickling works in
    # previous Python versions
    module_globals = vars(_sys.modules[module])
    if source:
        source = vars(source)
    else:
        source = module_globals
    members = dict((name, value) for name, value in source.items() if filter(name))
    cls = cls(name, members, module=module)
    cls.__reduce_ex__ = _reduce_ex_by_name
    module_globals.update(cls.__members__)
    module_globals[name] = cls
    return cls
702094
def model_function(self, model_name, version, func_name):
        """"""
        assert func_name in ('serializer', 'loader', 'invalidator')
        name = "%s_%s_%s" % (model_name.lower(), version, func_name)
        return getattr(self, name)
193276
def compiled_model(self):
        """"""
        return ALCHEMY_TEMPLATES.model.safe_substitute(class_name=self.class_name,
                                                       table_name=self.table_name,
                                                       column_definitions=self.compiled_columns,
                                                       init_function=self.compiled_init_func,
                                                       update_function=self.compiled_update_func,
                                                       hash_function=self.compiled_hash_func,
                                                       eq_function=self.compiled_eq_func,
                                                       neq_function=self.compiled_neq_func,
                                                       str_function=self.compiled_str_func,
                                                       unicode_function=self.compiled_unicode_func,
                                                       repr_function=self.compiled_repr_func,
                                                       types=", ".join(self.basic_types),
                                                       username=self.username,
                                                       foreign_keys=self.compiled_foreign_keys,
                                                       relationships=self.compiled_relationships,
                                                       named_imports=self.compiled_named_imports,
                                                       orm_imports=self.compiled_orm_imports,
                                                       get_proxy_cls_function=self.compiled_proxy_cls_func,
                                                       add_function=ALCHEMY_TEMPLATES.add_function.template,
                                                       delete_function=ALCHEMY_TEMPLATES.delete_function.template,
                                                       to_dict_function=ALCHEMY_TEMPLATES.to_dict_function.template,
                                                       to_proxy_function=ALCHEMY_TEMPLATES.to_proxy_function.template,
                                                       from_proxy_function=ALCHEMY_TEMPLATES.from_proxy_function.template)
657469
def module(self):
        
        modname = ffi.string(lib.EnvDeftemplateModule(self._env, self._tpl))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)
387359
def get_converter(self, parameter):
        """"""
        if parameter not in self._converters:
            param = self.get_parameter(parameter)
            try:
                scale = float(param['Scale'])
            except KeyError:
                scale = 1

            def convert(value):
                # easy_scale = float(param['EasyScale'])
                # easy_scale_multiplier = float(param['EasyScaleMultiplier'])
                return value * scale

            return convert
913118
def load_model_from_package(name, **overrides):
    """"""
    cls = importlib.import_module(name)
    return cls.load(**overrides)
628167
def bind_collection_to_model_cls(cls):
        
        cls.Collection = type('{0}.Collection'.format(cls.__name__),
                              (cls.Collection,),
                              {'value_type': cls})
        cls.Collection.__module__ = cls.__module__
894221
def _get_wrapper(self):
        
        if self.args_type == "MODULE_FUNCTION":
            return getattr(self.obj, self.prop)
        elif self.args_type == "FUNCTION":
            return getattr(self.g, self.obj.__name__)
        elif self.args_type == "PURE":
            return getattr(self.pure, "func")
        else:
            ErrorHandler.wrapper_object_not_found_error()
774769
function modelExport(m) {
  const result = _.mapValues(m.classes, _.head)
  result[m.__name] = m
  return result
}
1239224
def get_app_model_classes(self):
        
        models = []
        for m in self.models:
            mod, cls = m.rsplit('.', 1)
            mod = import_module(mod)
            models.append(getattr(mod, cls))
        return models
434351
def model_functions(vk, model):
    """"""

    def get_vk_extension_functions():
        names = set()
        for extension in get_extensions_filtered(vk):
            for req in extension['require']:
                if 'command' not in req:
                    continue
                for command in req['command']:
                    cn = command['@name']
                    names.add(cn)
                    
                    # add alias command too
                    for alias, n in model['alias'].items():
                        if n == cn:
                            names.add(alias)
        return names

    def get_count_param(command):
        for param in command['param']:
            if param['type'] + param.get('#text', '') == 'uint32_t*':
                return param
        return None

    def member_has_str(name):
        c = next(iter([x for x in model['constructors']
                       if x['name'] == name]), None)
        if c and any(['char' in x['type'] for x in c['members']]):
            return True
        return False

    def format_member(member):
        type_name = member['type']
        if '#text' in member:
            text = member['#text'].replace('const ', '').strip()
            type_name += ' ' + text

        return {'name': member['name'],
                'type': member['type'],
                'none': member['name'] in NULL_MEMBERS,
                'force_array': True if '@len' in member else False,
                'to_create': False,
                'has_str': member_has_str(member['type'])}

    def format_return_member(member):
        t = member['type']

        static_count = None
        if '@len' in member and '::' in member['@len']:
            lens = member['@len'].split('::')
            static_count = {'key': lens[0], 'value': lens[1]}

        is_handle = t in get_handle_names(vk)
        is_enum = t in get_enum_names(vk)
        is_struct = t in get_struct_names(vk)
        return {'name': member['name'],
                'type': t,
                'handle': is_handle,
                'enum': is_enum,
                'struct': is_struct,
                'static_count': static_count,
                'has_str': member_has_str(member['type'])}

    ALLOCATE_PREFIX = ('vkCreate', 'vkGet', 'vkEnumerate', 'vkAllocate',
                       'vkMap', 'vkAcquire')
    ALLOCATE_EXCEPTION = ('vkGetFenceStatus', 'vkGetEventStatus',
                          'vkGetQueryPoolResults',
                          'vkGetPhysicalDeviceXlibPresentationSupportKHR')
    COUNT_EXCEPTION = ('vkAcquireNextImageKHR', 'vkEnumerateInstanceVersion')

    model['functions'] = []
    model['extension_functions'] = []
    functions = [f for f in vk['registry']['commands']['command']]
    extension_function_names = get_vk_extension_functions()

    for function in functions:
        if '@alias' in function:
            continue

        fname = function['proto']['name']
        ftype = function['proto']['type']

        if fname in CUSTOM_FUNCTIONS:
            continue

        if type(function['param']) is not list:
            function['param'] = [function['param']]

        count_param = get_count_param(function)
        if fname in COUNT_EXCEPTION:
            count_param = None
        is_allocate = any([fname.startswith(a) for a in ALLOCATE_PREFIX])
        is_count = is_allocate and count_param is not None

        if fname in ALLOCATE_EXCEPTION or ftype == 'VkBool32':
            is_allocate = is_count = False

        members = []
        for member in function['param']:
            members.append(format_member(member))

        return_member = None
        if is_allocate:
            return_member = format_return_member(function['param'][-1])
            members[-1]['to_create'] = True
        if is_count:
            members[-2]['to_create'] = True

        f = {
            'name': fname,
            'members': members,
            'allocate': is_allocate,
            'count': is_count,
            'return_boolean': True if ftype == 'VkBool32' else False,
            'return_result': True if ftype == 'VkResult' else False,
            'return_member': return_member,
            'is_extension': fname in extension_function_names
        }

        model['functions'].append(f)