<commit_before># -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals

from xml.etree import cElementTree as ET

from .utils import create_unique_id, create_software_id

from itertools import groupby


ROLE = 'tagcreator'
VERSION_SCHEME = 'alphanumeric'
XMLNS = 'http://standards.iso.org/iso/19770/-2/2015/schema.xsd'
XML_DECLARATION = '<?xml version="1.0" encoding="utf-8"?>'
N8060 = 'http://csrc.nist.gov/schema/swid/2015-extensions/swid-2015-extensions-1.0.xsd'


def _create_payload_tag(package_info):
    payload = ET.Element('Payload')

    def _file_hierarchy(filelist, payload_tag=None, last_tag=None):
        filelist.sort(key=_keyfunc)

        for head, tail_of_file_iterator in groupby(filelist, _keyfunc):
            if payload_tag is not None:
                current_tag = ET.SubElement(payload_tag, 'Directory')
                current_tag.set('root', head)
                last_tag = payload_tag
            else:
                current_tag = ET.SubElement(last_tag, 'Directory')
                current_tag.set('name', head)
            sub_files = list()
            for file_info in tail_of_file_iterator:

                if len(file_info.fullpathname_splitted) == 2:
                    file_tag = ET.SubElement(current_tag, 'File')
                    file_tag.set('name', file_info.fullpathname_splitted[1])
                    if file_info.mutable:
                        file_tag.set('mutable', "True")
                    del file_info
                else:<commit_msg>tagCreator-Role on Swid-Tag now changed to Camel Case<commit_after># -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals

from xml.etree import cElementTree as ET

from .utils import create_unique_id, create_software_id

from itertools import groupby


ROLE = 'tagCreator'
VERSION_SCHEME = 'alphanumeric'
XMLNS = 'http://standards.iso.org/iso/19770/-2/2015/schema.xsd'
XML_DECLARATION = '<?xml version="1.0" encoding="utf-8"?>'
N8060 = 'http://csrc.nist.gov/schema/swid/2015-extensions/swid-2015-extensions-1.0.xsd'


def _create_payload_tag(package_info):
    payload = ET.Element('Payload')

    def _file_hierarchy(filelist, payload_tag=None, last_tag=None):
        filelist.sort(key=_keyfunc)

        for head, tail_of_file_iterator in groupby(filelist, _keyfunc):
            if payload_tag is not None:
                current_tag = ET.SubElement(payload_tag, 'Directory')
                current_tag.set('root', head)
                last_tag = payload_tag
            else:
                current_tag = ET.SubElement(last_tag, 'Directory')
                current_tag.set('name', head)
            sub_files = list()
            for file_info in tail_of_file_iterator:

                if len(file_info.fullpathname_splitted) == 2:
                    file_tag = ET.SubElement(current_tag, 'File')
                    file_tag.set('name', file_info.fullpathname_splitted[1])
                    if file_info.mutable:
                        file_tag.set('mutable', "True")
                    del file_info
                else:
{'fraction_non_alphanumeric': 0.10432569974554708, 'fraction_numerical': 0.019083969465648856, 'mean_word_length': 2.4713024282560707, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 2, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4322359', 'n_tokens_mistral': 1022, 'n_tokens_neox': 957, 'n_words': 188}