// Called on startup to make a callback so that modules can be initialized through the `RegisterModuleInit` function
511602
func init() {
	AddInitEventHandler(func(typeOf Event, value interface{}) (responseOf EventResponse) {
		if typeOf == REVEL_BEFORE_MODULES_LOADED {
			Modules = []*Module{appModule}
			appModule.Path = filepath.ToSlash(AppPath)
			appModule.ImportPath = filepath.ToSlash(AppPath)
		}

		return
	})
}
343939
func (ls *LState) PreloadModule(name string, loader LGFunction) {
	preload := ls.GetField(ls.GetField(ls.Get(EnvironIndex), "package"), "preload")
	if _, ok := preload.(*LTable); !ok {
		ls.RaiseError("package.preload must be a table")
	}
	ls.SetField(preload, name, ls.NewFunction(loader))
}
675297
func init() {
	flag.Var(&recursivelyIgnoredPkgs, "ignorePkgRecursively", "ignore the specified package and all subpackages recursively")
	flag.Var(&ignoredPkgs, "ignorePkg", "ignore the specified package")
	flag.Var(&ignoredFiles, "ignoreFile", "ignore the specified file by its path and/or go path (package/file.go)")
	flag.Var(&allowedFinishers, "finisher", "allowed finisher for the event chain")
	flag.Parse()

	// add zerolog to recursively ignored packages
	recursivelyIgnoredPkgs = append(recursivelyIgnoredPkgs, "github.com/rs/zerolog")
	args := flag.Args()
	if len(args) != 1 {
		fmt.Fprintln(os.Stderr, "you must provide exactly one package path")
		os.Exit(1)
	}
	rootPkg = args[0]
}
242926
func (g *generateServiceBuilder) addModule(thriftPath string) (api.ModuleID, error) {
	if id, ok := g.moduleIDs[thriftPath]; ok {
		return id, nil
	}

	id := g.nextModuleID
	g.nextModuleID++
	g.moduleIDs[thriftPath] = id

	importPath, err := g.importer.Package(thriftPath)
	if err != nil {
		return 0, err
	}

	dir, err := g.importer.RelativePackage(thriftPath)
	if err != nil {
		return 0, err
	}

	g.Modules[id] = &api.Module{
		ImportPath:     importPath,
		Directory:      dir,
		ThriftFilePath: thriftPath,
	}
	return id, nil
}
54221
func (m *Module) Init(c *service.Config) {
	c.Setup = func() error {
		m.configDefs = []reflect.Type{}
		switch {
		case m.ConfigPath != "":
		// do nothing
		case os.Getenv(ConfigEnv) != "":
			m.ConfigPath = os.Getenv(ConfigEnv)
		default:
			m.ConfigPath = "config.json"
		}

		err := m.LoadConfig(m.ConfigPath)
		// we only return an error if production, which
		// allows this to pass for env=test
		if err != nil {
			return errIfProduction(c, err)
		}
		return nil
	}
	c.SetupTest = func() {
		// this is a hack to have a safe default value
		// for m.Byte if we haven't loaded any config
		if len(m.Byte) == 0 {
			m.Byte = []byte(`{}`)
		}
		if m.TestConfigPath == "" {
			return
		}
		err := m.LoadConfig(m.TestConfigPath)
		if err != nil {
			panic(err)
		}
	}
}
170045
func RegisterCallbacks(db *gorm.DB) {
	if db.Callback().Create().Get("sorting:initalize_position") == nil {
		db.Callback().Create().Before("gorm:create").Register("sorting:initalize_position", initalizePosition)
	}
	if db.Callback().Delete().Get("sorting:reorder_positions") == nil {
		db.Callback().Delete().After("gorm:after_delete").Register("sorting:reorder_positions", reorderPositions)
	}
	if db.Callback().Query().Get("sorting:sort_by_position") == nil {
		db.Callback().Query().Before("gorm:query").Register("sorting:sort_by_position", beforeQuery)
	}
}
938057
func NewModule(addr addrs.ModuleInstance) *Module {
	return &Module{
		Addr:         addr,
		Resources:    map[string]*Resource{},
		OutputValues: map[string]*OutputValue{},
		LocalValues:  map[string]cty.Value{},
	}
}
887042
func (intr *Interpreter) runModule(ctx context.Context, key moduleKey, kind ThreadKind) (starlark.StringDict, error) {
	// Grab the source code.
	dict, src, err := intr.invokeLoader(key)
	switch {
	case err != nil:
		return nil, err
	case dict != nil:
		// This is a native module constructed in Go, no need to interpret it.
		return dict, nil
	}

	// Otherwise make a thread for executing the code. We do not reuse threads
	// between modules. All global state is passed through intr.globals,
	// intr.modules and ctx.
	th := intr.Thread(ctx)
	th.Load = func(th *starlark.Thread, module string) (starlark.StringDict, error) {
		key, err := makeModuleKey(module, th)
		if err != nil {
			return nil, err
		}
		dict, err := intr.LoadModule(ctx, key.pkg, key.path)
		// See comment in execBuiltin about why we extract EvalError backtrace into
		// new error.
		if evalErr, ok := err.(*starlark.EvalError); ok {
			err = fmt.Errorf("%s", evalErr.Backtrace())
		}
		return dict, err
	}

	// Let builtins know what this thread is doing. Some calls (most notably Exec
	// itself) are allowed only from exec'ing threads, not from load'ing ones.
	th.SetLocal(threadKindKey, kind)
	// Let builtins (and in particular makeModuleKey and LoadSource) know the
	// package and the module that the thread executes.
	th.SetLocal(threadModKey, key)

	if kind == ThreadExecing {
		if intr.PreExec != nil {
			intr.PreExec(th, key.pkg, key.path)
		}
		if intr.PostExec != nil {
			defer intr.PostExec(th, key.pkg, key.path)
		}
	}

	// Execute the module. It may 'load' or 'exec' other modules inside, which
	// will either call LoadModule or ExecModule.
	//
	// Use user-friendly module name (with omitted "@__main__") for error messages
	// and stack traces to avoid confusing the user.
	return starlark.ExecFile(th, key.String(), src, intr.globals)
}
723112
func init() {
	GoStructRegistry = GoStructRegistryType{
		Registry: make(map[string]*RegisteredType),
		Builtin:  make(map[string]*RegisteredType),
		Userdef:  make(map[string]*RegisteredType),
	}

	gsr := &GoStructRegistry

	// add go builtin types
	// ====================

	// empty array
	gsr.RegisterBuiltin("[]", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpArray{}, nil
	}})

	// scope, as used by the package operation
	gsr.RegisterBuiltin("packageScope", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		pkg := env.NewScope()
		pkg.Name = "prototype"
		pkg.IsPackage = true
		return pkg, nil
	}})

	gsr.RegisterBuiltin("packageScopeStack", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		pkg := env.NewStack(0)
		pkg.Name = "prototypePackageScopeStack"
		pkg.IsPackage = true
		return pkg, nil
	}})

	gsr.RegisterBuiltin("arraySelector", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpArraySelector{}, nil
	}})

	gsr.RegisterBuiltin("hashSelector", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpHashSelector{}, nil
	}})

	gsr.RegisterBuiltin("comment",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return SexpNull, nil
		}})
	gsr.RegisterBuiltin("byte",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(byte), nil
		}})
	gsr.RegisterBuiltin("uint8",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(byte), nil
		}})

	gsr.RegisterBuiltin("int",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(int), nil
		}})
	gsr.RegisterBuiltin("uint16",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint16), nil
		}})
	gsr.RegisterBuiltin("uint32",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint32), nil
		}})
	gsr.RegisterBuiltin("uint64",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint64), nil
		}})
	gsr.RegisterBuiltin("int8", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int8), nil
	}})
	gsr.RegisterBuiltin("int16", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int16), nil
	}})
	gsr.RegisterBuiltin("int32", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int32), nil
	}})
	gsr.RegisterBuiltin("rune", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int32), nil
	}})
	gsr.RegisterBuiltin("int64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int64), nil
	}})
	gsr.RegisterBuiltin("float32", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(float32), nil
	}})

	gsr.RegisterBuiltin("float64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(float64), nil
	}})

	gsr.RegisterBuiltin("complex64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(complex64), nil
	}})

	gsr.RegisterBuiltin("complex128", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(complex128), nil
	}})

	gsr.RegisterBuiltin("bool", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(bool), nil
	}})

	gsr.RegisterBuiltin("string", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(string), nil
	}})

	gsr.RegisterBuiltin("time.Time", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(time.Time), nil
	}})

	// add Sexp types

	gsr.RegisterBuiltin("symbol", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpSymbol{}, nil
	}})

	/* either:

	gsr.RegisterBuiltin("time.Time", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(time.Time), nil
	}})
	*/

	// PairRT *RegisteredType
	// RawRT *RegisteredType
	// ReflectRT *RegisteredType
	// ErrorRT *RegisteredType
	gsr.RegisterBuiltin("error", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		var err error
		return &err, nil
	}})

	// SentinelRT *RegisteredType
	// ClosureRT *RegisteredType
}
473976
func ActiveModule(local *config.LocalConfig, moduleKind ModuleKind) string {
	var (
		modulesValue = reflect.ValueOf(local).Elem().FieldByName("Modules")
		modulesType  = modulesValue.Type()
		numField     = modulesType.NumField()
		kind         = string(moduleKind)
	)
	for i := 0; i < numField; i++ {
		var (
			fieldValue = modulesValue.Field(i)
			fieldType  = modulesType.Field(i)
		)
		if fieldType.Tag.Get("json") == kind {
			return fieldValue.Interface().(string)
		}
	}

	return ""
}
552981
func init() {
	DefaultCallback.Delete().Register("gorm:begin_transaction", beginTransactionCallback)
	DefaultCallback.Delete().Register("gorm:before_delete", beforeDeleteCallback)
	DefaultCallback.Delete().Register("gorm:delete", deleteCallback)
	DefaultCallback.Delete().Register("gorm:after_delete", afterDeleteCallback)
	DefaultCallback.Delete().Register("gorm:commit_or_rollback_transaction", commitOrRollbackTransactionCallback)
}
39624
func (h *stiGit) SubmoduleInit(repo string) error {
	opts := cmd.CommandOpts{
		Stdout: os.Stdout,
		Stderr: os.Stderr,
		Dir:    repo,
	}
	return h.RunWithOptions(opts, "git", "submodule", "init")
}
340089
func (s *Application) Module(args ...string) *Module {
	name := s.RootModuleName
	if len(args) > 0 {
		name = args[0]
		if ap, ok := s.moduleNames[name]; ok {
			return ap
		}
	}
	return s.NewModule(name)
}
1084429
func (m *Module) Init(c *service.Config) {
	m.registerCommands(c)

	c.Setup = func() error {
		m.env = c.Env()
		m.backoff = &backoff.StopBackOff{}
		err := m.Config.ReadConfig(&m.config)
		if m.config.MigrationsTable != "" {
			migrate.SetTable(m.config.MigrationsTable)
		}
		return err
	}
}
501997
func (s *State) AddModule(path addrs.ModuleInstance) *ModuleState {
	s.Lock()
	defer s.Unlock()

	return s.addModule(path)
}
863990
func (s *Submodule) Init() error {
	cfg, err := s.w.r.Storer.Config()
	if err != nil {
		return err
	}

	_, ok := cfg.Submodules[s.c.Name]
	if ok {
		return ErrSubmoduleAlreadyInitialized
	}

	s.initialized = true

	cfg.Submodules[s.c.Name] = s.c
	return s.w.r.Storer.SetConfig(cfg)
}
473416
func RegisterModuleAfter(module interfaces.Module, name string) error {
	if err := alreadyRegistered(name); err != nil {
		return err
	}

	modulesMap[name] = module
	modulesArr = append(modulesArr, moduleWrapper{
		module: module,
		name:   name,
	})

	return nil
}