Exemple #1
0
    def __init__(self, template, regex):
        self.template = template
        self.regex = regex

        self.fields = re.findall("{([^}]+)}", template)

        #composed identifier (e.g. '{fld1}-{fld2}, {fld1}:{fld2}')
        get_identifier = expand_kwargs(template.format)

        extract_ident = partial(extract_identifier, regex)

        self.record_to_dn = compose(extract_ident, get_identifier)
    def __init__(self, template, regex):
        self.template = template
        self.regex = regex

        self.fields = re.findall("{([^}]+)}", template)

        # composed identifier (e.g. '{fld1}-{fld2}, {fld1}:{fld2}')
        get_identifier = expand_kwargs(template.format)

        extract_ident = partial(extract_identifier, regex)

        self.record_to_dn = compose(extract_ident, get_identifier)
Exemple #3
0
    else:
        return {}


def to_granularity_seconds(g):
    return int(GRANULARITIES.get(g, g))


def to_bool(b):
    return b.lower() in ('t', 'true', '1')


PROFILE_SCHEMA = {
    "storage": ensure_type(storage.Storage, to_storage),
    "field_selector": create_field_selector,
    "timezone": str,
    "identifier": expand_kwargs(IdentifierExtractor),
    "timestamp": create_timestamp_fn,
    "character_encoding": str,
    "dialect": create_dialect,
    "fields": create_row_mapping
}


class Profile(object):
    def __init__(self, configuration):
        typed_dict = type_mapping(PROFILE_SCHEMA)(configuration)

        for name, value in typed_dict.items():
            setattr(self, name, value)
Exemple #4
0
    else:
        return {}


def to_granularity_seconds(g):
    return int(GRANULARITIES.get(g, g))


def to_bool(b):
    return b.lower() in ('t', 'true', '1')


PROFILE_SCHEMA = {
    "storage": ensure_type(storage.Storage, to_storage),
    "field_selector": create_field_selector,
    "timezone": str,
    "identifier": expand_kwargs(IdentifierExtractor),
    "timestamp": create_timestamp_fn,
    "character_encoding": str,
    "dialect": create_dialect,
    "fields": create_row_mapping
}


class Profile(object):
    def __init__(self, configuration):
        typed_dict = type_mapping(PROFILE_SCHEMA)(configuration)

        for name, value in typed_dict.items():
            setattr(self, name, value)