# Path: lamvery/clients/base.py
# class BaseClient:
# 
#     __metaclass__ = ABCMeta
# 
#     def __init__(self, region=None, profile=None, dry_run=False):
#         self._session = boto3.session.Session(
#             profile_name=profile, region_name=region)
#         self._dry_run = dry_run
#         self._sts = self._session.client('sts')
# 
#     def get_account_id(self):
#         return self._sts.get_caller_identity().get('Account')
# 
# Path: lamvery/utils.py
# def previous_alias(alias):
#     return '{}-pre'.format(alias)


import botocore
import hashlib
import lamvery.config
from lamvery.clients.base import BaseClient
from lamvery.utils import previous_alias
    def create_alias(self, function, alias, version):
        if not self._dry_run:
            self._lambda.create_alias(
                FunctionName=function,
                Name=alias,
                FunctionVersion=version)

    def update_alias(self, function, alias, version):
        if not self._dry_run:
            self._lambda.update_alias(
                FunctionName=function,
                Name=alias,
                FunctionVersion=version)

    def calculate_capacity(self, next_marker=None):
        if next_marker:
            r = self._lambda.list_functions(MaxItems=500, Marker=next_marker)
        else:
            r = self._lambda.list_functions(MaxItems=500)

        size = sum(
            self._calculate_versions_capacity(
                f['FunctionName']) for f in r['Functions'])

        if 'NextMarker' in r:
            return size + self.calculate_capacity(next_marker=r['NextMarker'])
        else:
            return size

    def _calculate_versions_capacity(self, function_name, next_marker=None):

# Path: lamvery/clients/base.py
# class BaseClient:
# 
#     __metaclass__ = ABCMeta
# 
#     def __init__(self, region=None, profile=None, dry_run=False):
#         self._session = boto3.session.Session(
#             profile_name=profile, region_name=region)
#         self._dry_run = dry_run
#         self._sts = self._session.client('sts')
# 
#     def get_account_id(self):
#         return self._sts.get_caller_identity().get('Account')
# 
# Path: lamvery/utils.py
# def previous_alias(alias):
#     return '{}-pre'.format(alias)


# Path: lamvery/clients/function.py
import botocore
import hashlib
import lamvery.config
from lamvery.clients.base import BaseClient
from lamvery.utils import previous_alias

    def create_alias(self, function, alias, version):
        if not self._dry_run:
            self._lambda.create_alias(
                FunctionName=function,
                Name=alias,
                FunctionVersion=version)

    def update_alias(self, function, alias, version):
        if not self._dry_run:
            self._lambda.update_alias(
                FunctionName=function,
                Name=alias,
                FunctionVersion=version)

    def calculate_capacity(self, next_marker=None):
        if next_marker:
            r = self._lambda.list_functions(MaxItems=500, Marker=next_marker)
        else:
            r = self._lambda.list_functions(MaxItems=500)

        size = sum(
            self._calculate_versions_capacity(
                f['FunctionName']) for f in r['Functions'])

        if 'NextMarker' in r:
            return size + self.calculate_capacity(next_marker=r['NextMarker'])
        else:
            return size

    def _calculate_versions_capacity(self, function_name, next_marker=None):

        if next_marker: