Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_listify(data, expected):
assert listify(data) == expected
def __init__(self, possible_paths):
self.cfg = {}
possible_paths = listify(possible_paths)
for path in possible_paths:
if not path:
continue
path = os.path.abspath(os.path.expanduser(path.strip()))
if path and os.path.isfile(path):
self.cfg = self.parse_ini_file(path)
break
def get(self, key, namespace=None):
# The namespace is either None, a string or a list of
# strings. This converts it into a list.
namespace = listify(namespace)
try:
if len(namespace) > 0:
secret = getSecret(
name="{}.{}".format(namespace[0], key),
context={"app": "sso-dashboard"},
region="us-east-1",
)
else:
secret = None
except ItemNotFound:
secret = None
if secret is not None:
return secret
return NO_VALUE
def __init__(self, possible_paths):
self.cfg = {}
self.path = None
possible_paths = listify(possible_paths)
for path in possible_paths:
if not path:
continue
path = os.path.abspath(os.path.expanduser(path.strip()))
if path and os.path.isfile(path):
self.path = path
self.cfg = self.parse_yaml_file(path)
break
if not self.path:
logger.debug("No YAML file found: %s", possible_paths)
def __init__(self, possible_paths):
self.cfg = {}
self.path = None
possible_paths = listify(possible_paths)
for path in possible_paths:
if not path:
continue
path = os.path.abspath(os.path.expanduser(path.strip()))
if path and os.path.isfile(path):
self.path = path
self.cfg.update(self.parse_ini_file(path))
break
if not self.path:
logger.debug("No INI file found: %s", possible_paths)