includes required submodules into the model class,
 which usually is called User.
191960
def include_required_submodules!
      class_eval do
        @sorcery_config.submodules = ::Sorcery::Controller::Config.submodules
        @sorcery_config.submodules.each do |mod|
          # TODO: Is there a cleaner way to handle missing submodules?
          # rubocop:disable Lint/HandleExceptions
          begin
            include Submodules.const_get(mod.to_s.split('_').map(&:capitalize).join)
          rescue NameError
            # don't stop on a missing submodule. Needed because some submodules are only defined
            # in the controller side.
          end
          # rubocop:enable Lint/HandleExceptions
        end
      end
    end
574897
def setup_model_event_subscribers(config, model_cls, schema):
    
    events_map = get_events_map()
    model_events = schema.get('_event_handlers', {})
    event_kwargs = {'model': model_cls}

    for event_tag, subscribers in model_events.items():
        type_, action = event_tag.split('_')
        event_objects = events_map[type_][action]

        if not isinstance(event_objects, list):
            event_objects = [event_objects]

        for sub_name in subscribers:
            sub_func = resolve_to_callable(sub_name)
            config.subscribe_to_events(
                sub_func, event_objects, **event_kwargs)
913118
def load_model_from_package(name, **overrides):
    """"""
    cls = importlib.import_module(name)
    return cls.load(**overrides)
1226904
def add_included_hook
      with_hook_context do |context|
        mod.define_singleton_method :included do |object|
          Builder.pending << object unless context.finalize?
          context.modules.each { |mod| object.send(:include, mod) }
          object.define_singleton_method(:attribute, context.attribute_method)
        end
      end
    end
126386
def setActiveModule(Module):
  
  """
  module_name = Module.__name__

  if module_name not in ModuleMembers:
    ModuleMembers[module_name] = []
    ModulesQ.append(module_name)
    Group(Module, {}) # brand the module with __ec_member__

  state.ActiveModuleMemberQ = ModuleMembers[module_name]
307291
def included(object)
      super

      if Class === object
        @inclusions.reject do |mod|
          object.ancestors.include?(mod)
        end.each do |mod|
          object.send(:include, mod)
        end
        define_attributes(object)
      else
        object.extend(ModuleExtensions)
        ModuleExtensions.setup(object, @inclusions, @attribute_definitions)
      end
    end
1253047
def register_model(cls: Type[Model]):
    
    if not issubclass(cls, Model):
        raise TypeError("model bust be a subclass of Model")
    if issubclass(cls, GenericModel):
        raise TypeError("model must not be a subclass of GenericModel")
    __models__.add(cls)
    return cls
148804
def include_sqlalchemy_models(nc, Base):
    

    from sqlalchemy.ext.declarative.clsregistry import _ModuleMarker

    # Include all SQLAlchemy models in the local namespace
    for name, klass in Base._decl_class_registry.items():
        print(name, klass)
        if isinstance(klass, _ModuleMarker):
            continue

        add_script(nc, get_import_statement(klass))
        add_greeting(nc, "* **{}** - {}".format(klass.__name__, get_dotted_path(klass)))
894109
def register_model(klass)
      LOCK.synchronize do
        models.push(klass) unless models.include?(klass)
      end
    end
886751
def register(self, model_module, model_module_version_range, model_name, view_module, view_module_version_range, view_name, klass):
        """"""
        model_module = self._registry.setdefault(model_module, {})
        model_version = model_module.setdefault(model_module_version_range, {})
        model_name = model_version.setdefault(model_name, {})
        view_module = model_name.setdefault(view_module, {})
        view_version = view_module.setdefault(view_module_version_range, {})
        view_version[view_name] = klass
1182463
function (smList, cb) {
            // sub-module creation is now entirely managed in ModuleCtrlFactory
            // simple shortcut for aria.templates.ModuleCtrlFactory.loadSubModules
            ariaTemplatesModuleCtrlFactory.__loadSubModules(this, smList, {
                fn : this.__onLoadSubModulesComplete,
                scope : this,
                args : cb
            });
        }
945867
def submodules(options = {})
      ref = options[:ref]

      modules = []
      IniParse.parse(`git show #{ref}:.gitmodules 2> #{File::NULL}`).each do |section|
        # git < 1.8.5 does not update the .gitmodules file with submodule
        # changes, so when we are looking at the current state of the work tree,
        # we need to check if the submodule actually exists via another method,
        # since the .gitmodules file we parsed does not represent reality.
        if ref.nil? && GIT_VERSION < '1.8.5'
          result = Overcommit::Utils.execute(%W[
            git submodule status #{section['path']}
          ])
          next unless result.success?
        end

        modules << Submodule.new(section['path'], section['url'])
      end

      modules
    rescue IniParse::IniParseError => ex
      raise Overcommit::Exceptions::GitSubmoduleError,
            "Unable to read submodule information from #{ref}:.gitmodules file: #{ex.message}"
    end
183574
public void setSubModules(java.util.Collection<SubModule> subModules) {
        if (subModules == null) {
            this.subModules = null;
            return;
        }

        this.subModules = new java.util.ArrayList<SubModule>(subModules);
    }
57207
def handle_addSubmodule(repo, **kwargs):
    """"""
    log.info('addSubmodule: %s %s' %(repo, kwargs))
    try:
        proxy = repo.addSubmodule(**kwargs)
        return [serialize(proxy, type='submodule', url=proxy.url)]
    except RepoError, e:
        raise
1218104
function _requireModule(rootPath, name) {
  let modulePath = _normalizeRequire(rootPath, name),
    moduleRes;
  try {
    moduleRes = require(modulePath);
  } catch (e) {
    if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(name) !== -1) {
      try {
        moduleRes = require(name);
      } catch (e) {
        if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(name) !== -1) {
          throw "NOT_FOUND";
        }
        throw e;
      }
    } else {
      throw e;
    }
  }
  return moduleRes;
}
492724
def acts_as_google_user *modules
      # assign devise modules to module variable
      if modules.empty?
        self.devise_modules_to_include = [:omniauthable]
      else
        # restrict modules given to devise
        self.devise_modules_to_include = (modules + [:omniauthable] - FORBIDDEN_MODULES) & ALLOWED_MODULES
      end
      # include model methods
      include ActsAsGoogleUser::Model
    end
1075697
def owner_class=(klass)
      @owner_class = klass
      
      # Create modules for extending the class with state/event-specific methods
      @helper_modules = helper_modules = {:instance => HelperModule.new(self, :instance), :class => HelperModule.new(self, :class)}
      owner_class.class_eval do
        extend helper_modules[:class]
        include helper_modules[:instance]
      end
      
      # Add class-/instance-level methods to the owner class for state initialization
      unless owner_class < StateMachine::InstanceMethods
        owner_class.class_eval do
          extend StateMachine::ClassMethods
          include StateMachine::InstanceMethods
        end
        
        define_state_initializer if @initialize_state
      end
      
      # Record this machine as matched to the name in the current owner class.
      # This will override any machines mapped to the same name in any superclasses.
      owner_class.state_machines[name] = self
    end