def __init__(self):
     self.stash = MockedWorldConfigTerraform()
     self.resource_type = 'aws_db_instance'
     self.name = ''
     self.addresses = 'aws_db_instance.something'
     self.property_name = 'mocked_property'
     self.no_failure = False
     self.no_skip = False
     self.failure_class = 'no_name'
     self.match = Match(case_sensitive=False)
def look_for_bdd_tags(_step_obj):
    _step_obj.context.no_failure = False
    _step_obj.context.failure_class = None
    _step_obj.context.no_skip = False
    _step_obj.context.skip_class = None # to pick a tagname that user used
    _step_obj.context.lines_to_noskip = []
    _step_obj.context.bad_tags = False

    defaults = Defaults()

    if hasattr(_step_obj, 'all_tags') and len(_step_obj.all_tags) > 0:
        _step_obj.context.case_insensitivity = True

        for tag in _step_obj.all_tags:
            if tag.name.lower() in defaults.no_failure_tags:
                _step_obj.context.no_failure = True
                _step_obj.context.failure_class = tag.name
            elif tag.name.lower() in defaults.case_sensitive_tags:
                _step_obj.context.case_insensitivity = False
            elif tag.name.lower() in defaults.no_skip_tags:
                _step_obj.context.no_skip = True
                _step_obj.context.skip_class = tag.name
                _step_obj.context.lines_to_noskip = [-1]
            elif re.search(r'({})_at_lines?_.*'.format('|'.join(defaults.no_skip_tags)), tag.name.lower()):
                # check for '@noskip at line x'
                regex = r'({})_at_lines?((_\d*)*)'.format('|'.join(defaults.no_skip_tags))
                
                m = re.search(regex, tag.name.lower())
                if m is not None:
                    _step_obj.context.no_skip = True
                    _step_obj.context.skip_class = tag.name

                    line_numbers_string = m.group(2)

                    try:
                        line_numbers = map(int, line_numbers_string.strip('_').split('_'))
                        if _step_obj.context.lines_to_noskip != [-1]: # no need to worry about this tag if we already have a general noskip
                            _step_obj.context.lines_to_noskip.extend(line_numbers)
                    
                    except Exception as e:
                        Error(_step_obj, f'A tag was determined to be a noskip, but line numbers could not be grouped by the regex {regex}\n{e}')


    if _step_obj.context.no_failure and _step_obj.context.no_skip:
        _step_obj.context.no_failure = False
        _step_obj.context.bad_tags = True
        Error(_step_obj, f'@{_step_obj.context.failure_class} and @{_step_obj.context.skip_class} tags can not be used at the same time.')

    ## set the match here
    case_sensitive = True if hasattr(_step_obj.context, 'case_insensitivity') and not _step_obj.context.case_insensitivity else False
    _step_obj.context.match = Match(case_sensitive=case_sensitive)

    return _step_obj
    def get_providers_from_configuration(self, provider_type, match=Match(case_sensitive=False)):
        '''
        Returns all providers as a list for the given provider type

        :param provider_type: String of a provider type like aws
        :return: list of providers that has this type
        '''
        providers = []
        for provider_alias, values in self.configuration['providers'].items():
            if isinstance(values, dict) and match.equals(values.get('name'), provider_type):
                providers.append(values)

        return providers
    def find_data_by_type(self, resource_type, match=Match(case_sensitive=False)):
        '''
        Finds all data matching with the resource_type

        :param resource_type: String of resource type defined in terraform
        :return: list of dict including resources
        '''
        resource_list = []

        for resource_data in self.data.values():
            if match.equals(resource_data['type'], resource_type):
                resource_list.append(resource_data)

        return resource_list
    def find_resources_by_type(self, resource_type, match=Match(case_sensitive=False)):
        '''
        Finds all resources matching with the resource_type

        :param resource_type: String of resource type defined in terraform
        :return: list of dict including resources
        '''
        resource_list = []

        for resource_data in self.resources.values():
            if resource_type == 'any' or (match.equals(resource_data['type'], resource_type) and resource_data['mode'] == 'managed'):
                resource_list.append(resource_data)

        return resource_list