def load_file(self, path=None, env=None, silent=True, key=None):
        """Programmatically load files from ``path``.

        :param path: A single filename or a file list
        :param env: Which env to load from file (default current_env)
        :param silent: Should raise errors?
        :param key: Load a single key?
        """
        env = (env or self.current_env).upper()
        files = ensure_a_list(path)
        if files:
            self.logger.debug("Got %s files to process", files)
            already_loaded = set()
            for _filename in files:
                self.logger.debug("Processing file %s", _filename)
                filepath = os.path.join(self._root_path, _filename)
                self.logger.debug("File path is %s", filepath)
                # Handle possible *.globs sorted alphanumeric
                for path in sorted(glob.glob(filepath)):
                    self.logger.debug("Loading %s", path)
                    if path in already_loaded:  # pragma: no cover
                        self.logger.debug("Skipping %s, already loaded", path)
                        continue
                    settings_loader(
                        obj=self,
                        env=env,
                        silent=silent,
                        key=key,
                        filename=path,
                    )
                    already_loaded.add(path)
            if not already_loaded:
                self.logger.warning(
                    "Not able to locate the files %s to load", files
                )
def load_file ( self , path = None , env = None , silent = True , key = None ) : env = ( env or self . current_env ) . upper ( ) files = ensure_a_list ( path ) if files : self . logger . debug ( "Got %s files to process" , files ) already_loaded = set ( ) for _filename in files : self . logger . debug ( "Processing file %s" , _filename ) filepath = os . path . join ( self . _root_path , _filename ) self . logger . debug ( "File path is %s" , filepath ) for path in sorted ( glob . glob ( filepath ) ) : self . logger . debug ( "Loading %s" , path ) if path in already_loaded : self . logger . debug ( "Skipping %s, already loaded" , path ) continue settings_loader ( obj = self , env = env , silent = silent , key = key , filename = path , ) already_loaded . add ( path ) if not already_loaded : self . logger . warning ( "Not able to locate the files %s to load" , files )
Programmatically load files from ``path``.

        :param path: A single filename or a file list
        :param env: Which env to load from file (default current_env)
        :param silent: Should raise errors?
        :param key: Load a single key?