Skip to content
This repository has been archived by the owner on Dec 27, 2020. It is now read-only.

Commit

Permalink
Merge 66742d9 into 3923714
Browse files Browse the repository at this point in the history
  • Loading branch information
whisller committed Dec 30, 2018
2 parents 3923714 + 66742d9 commit 3ac8f6c
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions ssmenv/__init__.py
@@ -1,38 +1,21 @@
import functools
import os
import re
from collections.abc import Mapping
from collections import UserDict

import boto3

__version__ = "1.3.2"


class SSMEnv(Mapping):
class SSMEnv(UserDict):
def __init__(self, include, prefixes=None, ssm_client=None, no_aws_default=None):
self._include = (include,) if type(include) == str else include
self._prefixes = prefixes
self._ssm_client = ssm_client
self._no_aws_default = no_aws_default
self._data = {}

def __getitem__(self, item):
if not self._data:
self._data = self._load()

return self._data[item]

def __iter__(self):
if not self._data:
self._data = self._load()

yield from self._data

def __len__(self):
if not self._data:
self._data = self._load()

return len(self._data)
super().__init__(self._load())

def _load(self):
if self._no_aws_default and not any(
Expand Down

0 comments on commit 3ac8f6c

Please sign in to comment.