<commit_before>
SREG_URI = 'http://openid.net/sreg/1.0'

class ExtensionCollection(object):
    # namespaces that should use a certain alias (for
    # backwards-compatibility or beauty)
    namespace_aliases = {SREG_URI:'sreg'}

    def __init__(self):
        # two-level dictionary. The first level is the namespace URI.
        self.args = {}

    def toQueryArgs(self):
        """Build a dictionary of parameters to add to an OpenID query
        or form for the extensions that are defined in this extension
        collection.

        @returntype: {unicode:unicode}
        """
        query_args = {}
        for i, (ns_uri, ns) in enumerate(self.args.iteritems()):
            ns_alias = self.namespace_aliases.get(ns_uri, str(i))
            query_args['openid.ns.%s' % (ns_alias,)] = ns_uri
            for ns_key, ns_val in ns.iteritems():
                query_args['openid.%s.%s' % (ns_alias, ns_key)] = ns_val

        return query_args

    def fromQueryArgs(cls, query):
        """Construct a ExtensionCollection from a query

        This method should be the inverse of toQueryArgs

        @param query: The parsed query string or form post parameters
        @type query: {unicode:unicode}

        @rtype: ExtensionCollection
        """
        # Build alias table mapping from alias to extension URI
        aliases = {}
        for k, v in query.iteritems():
            if k.startswith('openid.ns.'):
                aliases[k[10:]] = v

        args = {}<commit_msg>[project @ remove enumerate, since it breaks 2.2]<commit_after>
SREG_URI = 'http://openid.net/sreg/1.0'

class ExtensionCollection(object):
    # namespaces that should use a certain alias (for
    # backwards-compatibility or beauty)
    namespace_aliases = {SREG_URI:'sreg'}

    def __init__(self):
        # two-level dictionary. The first level is the namespace URI.
        self.args = {}

    def toQueryArgs(self):
        """Build a dictionary of parameters to add to an OpenID query
        or form for the extensions that are defined in this extension
        collection.

        @returntype: {unicode:unicode}
        """
        query_args = {}
        i = 0
        for (ns_uri, ns) in self.args.iteritems():
            ns_alias = self.namespace_aliases.get(ns_uri, str(i))
            query_args['openid.ns.%s' % (ns_alias,)] = ns_uri
            for ns_key, ns_val in ns.iteritems():
                query_args['openid.%s.%s' % (ns_alias, ns_key)] = ns_val

            i += 1

        return query_args

    def fromQueryArgs(cls, query):
        """Construct a ExtensionCollection from a query

        This method should be the inverse of toQueryArgs

        @param query: The parsed query string or form post parameters
        @type query: {unicode:unicode}

        @rtype: ExtensionCollection
        """
        # Build alias table mapping from alias to extension URI
        aliases = {}
        for k, v in query.iteritems():
            if k.startswith('openid.ns.'):
                aliases[k[10:]] = v

        args = {}
{'fraction_non_alphanumeric': 0.10006561679790026, 'fraction_numerical': 0.003937007874015748, 'mean_word_length': 2.240170031880978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5790927', 'n_tokens_mistral': 903, 'n_tokens_neox': 853, 'n_words': 275}