Meta parser that will try all known parser and it will bring the first found id
    :param list[Callable] parsers: A list of callable parsers to try to extract request_id
    :return: The request id if it is found or None
    :rtype: str|None
12511
def auto_parser(parsers=(x_request_id, x_correlation_id, amazon_elb_trace_id)):
    

    for parser in parsers:
        request_id = parser()
        if request_id is not None:
            return request_id

    return None
391948
def GetParserObjectByName(cls, parser_name):
    
    parser_class = cls._parser_classes.get(parser_name, None)
    if parser_class:
      return parser_class()
    return None
215160
def get_config(parser=PARSER):
    
    parser_class = PARSERS[parser]
    _check_parser(parser_class, parser)
    return parser_class.instance()
427754
def list_parsers(self, *args):
        """"""
        print('==== Available parsing modules: ====\n')
        for parser in sorted(self.parse_modules):
            print(self.parse_modules[parser].name.ljust(16) + \
                ': ' + self.parse_modules[parser].desc)
        sys.exit(0)
682641
def get_default_yaml_parsers(parser_finder: ParserFinder, conversion_finder: ConversionFinder) -> List[AnyParser]:
    
    return [# yaml for any object
            SingleFileParserFunction(parser_function=read_object_from_yaml,
                                     streaming_mode=True,
                                     supported_exts={'.yaml','.yml'},
                                     supported_types={AnyObject},
                                     ),
            # yaml for collection objects
            SingleFileParserFunction(parser_function=read_collection_from_yaml,
                                     custom_name='read_collection_from_yaml',
                                     streaming_mode=True,
                                     supported_exts={'.yaml','.yml'},
                                     supported_types={Tuple, Dict, List, Set},
                                     function_args={'conversion_finder': conversion_finder}
                                     )
    ]
737590
def _get_show_ids(self):
        
        # get the show page
        logger.info('Getting show ids')
        r = self.session.get(self.server_url + 'shows.php', timeout=10)
        r.raise_for_status()
        soup = ParserBeautifulSoup(r.content, ['lxml', 'html.parser'])

        # populate the show ids
        show_ids = {}
        for show in soup.select('td.version > h3 > a[href^="/show/"]'):
            show_ids[sanitize(show.text)] = int(show['href'][6:])
        logger.debug('Found %d show ids', len(show_ids))

        return show_ids
9334
def basic_parser(patterns, with_name=None):
    
    def parse(line):
        output = None
        highest_order = 0
        highest_pattern_name = None
        for pattern in patterns:
            results = pattern.findall(line)
            if results and any(results):
                if pattern.order > highest_order:
                    output = results
                    highest_order = pattern.order
                    if with_name:
                        highest_pattern_name = pattern.name
        if with_name:
            return output, highest_pattern_name
        return output

    return parse
204208
def get(self, arg):
        
        try:
            reservations = self.get_all_instances(filters={'tag:Name': [arg]})
            instance = reservations[0].instances[0]
        except IndexError:
            try:
                instance = self.get_all_instances([arg])[0].instances[0]
            except (_ResponseError, IndexError):
                # TODO: encapsulate actual exception for debugging
                err = "Can't find any instance with name or ID '%s'" % arg
                raise ValueError(err)
        return instance
23735
def get_id(name=None, tags=None, region=None, key=None,
           keyid=None, profile=None, in_states=None, filters=None):

    '''
    

    '''
    instance_ids = find_instances(name=name, tags=tags, region=region, key=key,
                                  keyid=keyid, profile=profile, in_states=in_states,
                                  filters=filters)
    if instance_ids:
        log.info("Instance ids: %s", " ".join(instance_ids))
        if len(instance_ids) == 1:
            return instance_ids[0]
        else:
            raise CommandExecutionError('Found more than one instance '
                                        'matching the criteria.')
    else:
        log.warning('Could not find instance.')
        return None
8578
def parse_request_headers(headers):
    
    request_header_keys = set(headers.keys(lower=True))
    request_meta_keys = set(XHEADERS_TO_ARGS_DICT.keys())
    data_header_keys = request_header_keys.intersection(request_meta_keys)
    return dict(([XHEADERS_TO_ARGS_DICT[key],
                  headers.get(key, None)] for key in data_header_keys))
242062
def request_id(self, request_id):
        
        if request_id is not None and not re.search('^[A-Za-z0-9]{32}', request_id):
            raise ValueError("Invalid value for `request_id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`")

        self._request_id = request_id
429614
def get_all_parsers(self, strict_type_matching: bool = False) -> List[Parser]:
        
        matching = self.find_all_matching_parsers(strict=strict_type_matching)[0]

        # matching[1] (approx match) is supposed to be empty since we use a joker on type and a joker on ext : only
        # exact and generic match should exist, no approx match
        if len(matching[1]) > 0:
            raise Exception('Internal error - this matching[1] list is supposed to be empty for such a query')
        return matching[0] + matching[2]
340041
def _get_parser_compound(cls, *parse_methods):
        
        def parse(value):
            parsed = value

            for method in parse_methods:
                parsed = method(parsed)

            return parsed

        return parse
913459
def get_model(self, ids):
        
        to_get_ids = [i for i in ids if i not in self._known_models]
        models = [dxl_to_model(m) for m in self._get_model(to_get_ids, convert=False)]
        self._known_models.update(zip(to_get_ids, models))

        return tuple(self._known_models[id] for id in ids)
61059
def add_parser_options(options: Dict[str, Dict[str, Any]], parser_id: str, parser_options: Dict[str, Dict[str, Any]],
                       overwrite: bool = False):
    
    if parser_id in options.keys() and not overwrite:
        raise ValueError('There are already options in this dictionary for parser id ' + parser_id)
    options[parser_id] = parser_options
    return options
779172
def _check_parser(parser):
    
    from pandas.core.computation.expr import _parsers

    if parser not in _parsers:
        raise KeyError('Invalid parser {parser!r} passed, valid parsers are'
                       ' {valid}'.format(parser=parser, valid=_parsers.keys()))
1176082
def get_details(self, ids):
        
        if isinstance(ids, list):
            if len(ids) > 5:
                ids = ids[:5]
            id_param = ';'.join(ids) + '/'
        else:
            ids = str(ids)
            id_param = ids + '/'

        header, content = self._http_request(id_param)
        resp = json.loads(content)
        if not self._is_http_response_ok(header):
            error = resp.get('error_message', 'Unknown Error')
            raise HttpException(header.status, header.reason, error) 
        return resp