Loads settings from a settings_string. Expects an escaped string like
        the following:
            "NAME=\'stuff\'\nTYPE=[\'item\']\n"

        @param settings_string: The string with your settings
        @return: A dict of loaded settings
545308
def load_from_string(self, settings_string='', module_name='customsettings'):
        '''
        
        '''
        try:
            mod = imp.new_module(module_name)
            exec(settings_string, mod.__dict__)
        except TypeError:
            log.warning("Could not import settings")
        self.my_settings = {}
        try:
            self.my_settings = self._convert_to_dict(mod)
        except ImportError:
            log.warning("Settings unable to be loaded")

        return self.settings()
184934
def _user_settings(self):
        
        user_settings = getattr(settings, self._name, {})
        if not user_settings and self._required:
            raise ImproperlyConfigured("Settings file is missing dict options with name {}".format(self._name))
        keys = frozenset(user_settings.keys())

        required = self._required - keys
        if required:
            raise ImproperlyConfigured("Following options for {} are missing from settings file: {}".format(self._name, ', '.join(sorted(required))))

        removed = keys & self._removed
        if removed:
            raise ImproperlyConfigured("Following options for {} have been removed: {}".format(self._name, ', '.join(sorted(removed))))

        return user_settings
417050
def import_from_string(val, setting_name):
    
    try:
        # Nod to tastypie's use of importlib.
        parts = val.split('.')
        module_path, class_name = '.'.join(parts[:-1]), parts[-1]
        module = importlib.import_module(module_path)
        return getattr(module, class_name)
    except (ImportError, AttributeError) as e:
        msg = "Could not import '%s' for Graph Auth setting '%s'. %s: %s." % (val, setting_name, e.__class__.__name__, e)
        raise ImportError(msg)
678884
def iter_settings(mixed: Settings) -> Iterator[Tuple[str, Any]]:
    
    if isinstance(mixed, types.ModuleType):
        for attr in dir(mixed):
            if not is_setting_key(attr):
                continue
            yield (attr, getattr(mixed, attr))
    else:
        yield from filter(lambda item: is_setting_key(item[0]), mixed.items())
821080
def load_settings_file(self, settings_file=None):
        

        if not settings_file:
            settings_file = self.get_json_or_yaml_settings()
        if not os.path.isfile(settings_file):
            raise ClickException("Please configure your zappa_settings file or call `zappa init`.")

        path, ext = os.path.splitext(settings_file)
        if ext == '.yml' or ext == '.yaml':
            with open(settings_file) as yaml_file:
                try:
                    self.zappa_settings = yaml.load(yaml_file)
                except ValueError: # pragma: no cover
                    raise ValueError("Unable to load the Zappa settings YAML. It may be malformed.")
        elif ext == '.toml':
            with open(settings_file) as toml_file:
                try:
                    self.zappa_settings = toml.load(toml_file)
                except ValueError: # pragma: no cover
                    raise ValueError("Unable to load the Zappa settings TOML. It may be malformed.")
        else:
            with open(settings_file) as json_file:
                try:
                    self.zappa_settings = json.load(json_file)
                except ValueError: # pragma: no cover
                    raise ValueError("Unable to load the Zappa settings JSON. It may be malformed.")
672675
def import_from_str(value):
    
    try:
        parts = value.split('.')
        module_path, class_name = '.'.join(parts[:-1]), parts[-1]
        module = importlib.import_module(module_path)
        return getattr(module, class_name)
    except ImportError as e:
        msg = 'Could not import %s for settings. %s: %s.' % (value, e.__class__.__name__, e)
        raise ImportError(msg)
1260264
def use_settings_dict(self, settings_dict):
        '''
        
        '''
        class SettingsDictModule:
            __slots__ = tuple(key.upper() for key in settings_dict.keys())
        settings_obj = SettingsDictModule()
        for key, value in settings_dict.items():
            setattr(settings_obj, key.upper(), value)
        self.use_settings(settings_obj)
835126
def get_from_string(cls, string_condition):
        

        if string_condition == 'PodScheduled':
            return cls.SCHEDULED
        elif string_condition == 'Ready':
            return cls.READY
        elif string_condition == 'Initialized':
            return cls.INITIALIZED
        elif string_condition == 'Unschedulable':
            return cls.UNSCHEDULABLE
        elif string_condition == 'ContainersReady':
            return cls.CONTAINERS_READY

        return cls.UNKNOWN
507076
def get_item_string(items_list):
    
    if not items_list:
        return ''
    string_list = []
    for item in items_list:
        try:
            name = item.name
            string_list.append(name)
        except AttributeError:
            pass
    return ":".join(string_list)
276567
def get_django_settings(cls, name, default=None):
        # pylint: disable=access-member-before-definition
        
        if hasattr(cls, '__django_settings__'):
            return getattr(cls.__django_settings__, name, default)
        from django.conf import settings
        cls.__django_settings__ = settings
        return cls.get_django_settings(name)
117760
def _ParseNamesString(self, names_string):
    
    if not names_string:
      return

    names_string = names_string.lower()
    names = [name.strip() for name in names_string.split(',')]
    file_entry_filter = file_entry_filters.NamesFileEntryFilter(names)
    self._filter_collection.AddFilter(file_entry_filter)
1373408
def set_settings(self, settings):
        
        for k, v in settings.items():
            setattr(self, k, v)
1328396
def _load(self, file_path: Text) -> None:
        

        # noinspection PyUnresolvedReferences
        module_ = types.ModuleType('settings')
        module_.__file__ = file_path

        try:
            with open(file_path, encoding='utf-8') as f:
                exec(compile(f.read(), file_path, 'exec'), module_.__dict__)
        except IOError as e:
            e.strerror = 'Unable to load configuration file ({})'\
                .format(e.strerror)
            raise

        for key in dir(module_):
            if CONFIG_ATTR.match(key):
                self[key] = getattr(module_, key)
38505
def _load_settings_from_source(self, source):
        
        if not source:
            pass
        elif source == 'env_settings_uri':
            for env_settings_uri_key in self.env_settings_uri_keys:
                env_settings_uri = self._search_environ(env_settings_uri_key)
                if env_settings_uri:
                    logger.debug('Found {} in the environment.'.format(env_settings_uri_key))
                    yield env_settings_uri, self._load_settings_from_uri(env_settings_uri)
                #end if
            #end for

        elif source == 'env':
            logger.debug('Loaded {} settings from the environment.'.format(len(os.environ)))
            yield source, dict(os.environ.items())

        elif isinstance(source, ParseResult):
            settings = self._load_settings_from_uri(source)
            yield source, settings

        elif isinstance(source, str):
            try: spec = importlib.util.find_spec(source)
            except (AttributeError, ImportError): spec = None

            settings = self._load_settings_from_spec(spec, name=source)
            if settings is None:
                _, ext = os.path.splitext(source)
                with uri_open(source, 'rb') as f:
                    yield source, self._load_settings_from_file(f, ext=ext)
            else:
                yield source, settings
            #end if

        elif hasattr(source, 'read'):
            yield source.name, self._load_settings_from_file(source)

        elif hasattr(source, 'items'):
            source_type = type(source).__name__
            for dict_settings_uri_key in self.dict_settings_uri_keys:
                if dict_settings_uri_key and dict_settings_uri_key in source and source[dict_settings_uri_key]:
                    logger.debug('Found {} in the dict-like object <{}>.'.format(dict_settings_uri_key, source_type))
                    yield from self._load_settings_from_source(source[dict_settings_uri_key])
                #end if
            #end for

            logger.debug('Loaded {} settings from dict-like object <{}>.'.format(len(source), source_type))
            yield self._get_unique_name(source_type), source

        else:
            source_type = type(source).__name__
            for object_settings_uri_key in self.object_settings_uri_keys:
                if object_settings_uri_key and hasattr(source, object_settings_uri_key) and getattr(source, object_settings_uri_key):
                    logger.debug('Found {} in the object <{}>.'.format(object_settings_uri_key, source_type))
                    yield from self._load_settings_from_source(getattr(source, object_settings_uri_key))
                #end if
            #end for

            settings = dict((k, v) for k, v in source.__dict__.items() if not k.startswith('__'))
            logger.debug('Loaded {} settings from object <{}>.'.format(len(settings), source_type))
            yield self._get_unique_name(source_type), settings
565208
def loads(s, **kwargs):
    
    if not isinstance(s, string_type):
        raise TypeError("Expected s to be a str, got %s" % type(s))

    try:
        fp = unicodeIO(s)
    except TypeError:
        fp = strIO(s)

    return parse(fp, **kwargs)
637047
def parse_column_key(setting_string):
        
        if ':' in setting_string:
            # splits <column>:<key> into <column> and <key>
            column, key = setting_string.split(':', 1)
        else:
            # stores <column> and <value>=None
            column = setting_string
            key = None

        return column, key
921161
def load(self, local='localsettings.py', default='settings.py'):
        '''
        
        '''
        self._load_defaults(default)
        self._load_custom(local)

        return self.settings()