<commit_before><?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Routine name="CPM.MetaInfo" type="MAC" languagemode="0"><![CDATA[
#include CPM.License

/// dump only dependencies
DumpDeps(FileName) [xmltree] public {
    do ArrayFromXml(FileName,$name(xmltree))
    #dim i As %String
    #dim deps
    merge deps=xmltree("Manifest",2,"Dependencies")
    set i=$order(deps(""))
    while i'="" {
        write deps(i,"Dependency","Name"), ?20,
              $get(deps(i,"Dependency","Version"),$get(deps(i,"Dependency","Path"))),
              !
        set i=$order(deps(i))
    }
    //zw xmltree
}

Dump(FileName) public {
    // TODO - convert XML to multidimensional array, then use it elsewhere
    #dim XmlParser As %XML.TextReader
    do ##class(%XML.TextReader).ParseFile(FileName,.XmlParser)
    while XmlParser.Read() {
        write XmlParser.NodeType, ?20, XmlParser.Name, ?32, XmlParser.Value,!
        for i=1:1:XmlParser.AttributeCount {
            do XmlParser.MoveToAttributeIndex(i)
            write ?8, XmlParser.NodeType, ?20, XmlParser.Name, ?32, XmlParser.Value,!
        }
    }
}

#include CPM.DataTypes

ArrayFromXml(FileName,LocalName) public {
    #dim xreader As %XML.TextReader
    do ##class(%XML.TextReader).ParseFile(FileName,.xreader)

    #dim modeStack As %ArrayOfDataTypes
    #dim arrayMode As %Boolean
    $$$INITSTACK(modeStack)

    while xreader.Read() {
        // opening tag e.g. <Package>
        if xreader.NodeType = "element" {
            // push tag
            set arrayMode =  $$$TOPSTACK(modeStack)
            if (arrayMode) {
                set LocalName = $name(@LocalName@($increment(@LocalName),xreader.Name))
            } else {
                set LocalName = $name(@LocalName@(xreader.Name))
            }
            // we are switching to "array mode" if there is no
            // single attribute in the current tag <commit_msg>Added reasonable explanation for ArrayFromXml<commit_after><?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Routine name="CPM.MetaInfo" type="MAC" languagemode="0"><![CDATA[
#include CPM.License

/// dump only dependencies
DumpDeps(FileName) [xmltree] public {
    do ArrayFromXml(FileName,$name(xmltree))
    #dim i As %String
    #dim deps
    merge deps=xmltree("Manifest",2,"Dependencies")
    set i=$order(deps(""))
    while i'="" {
        write deps(i,"Dependency","Name"), ?20,
              $get(deps(i,"Dependency","Version"),$get(deps(i,"Dependency","Path"))),
              !
        set i=$order(deps(i))
    }
    //zw xmltree
}

Dump(FileName) public {
    // TODO - convert XML to multidimensional array, then use it elsewhere
    #dim XmlParser As %XML.TextReader
    do ##class(%XML.TextReader).ParseFile(FileName,.XmlParser)
    while XmlParser.Read() {
        write XmlParser.NodeType, ?20, XmlParser.Name, ?32, XmlParser.Value,!
        for i=1:1:XmlParser.AttributeCount {
            do XmlParser.MoveToAttributeIndex(i)
            write ?8, XmlParser.NodeType, ?20, XmlParser.Name, ?32, XmlParser.Value,!
        }
    }
}

#include CPM.DataTypes

#; Load metainfo from given XML file into "local name"
#; this name could be local, process private or global name
ArrayFromXml(FileName,LocalName) public {
    #dim xreader As %XML.TextReader
    do ##class(%XML.TextReader).ParseFile(FileName,.xreader)

    #dim modeStack As %ArrayOfDataTypes
    #dim arrayMode As %Boolean
    $$$INITSTACK(modeStack)

    while xreader.Read() {
        // opening tag e.g. <Package>
        if xreader.NodeType = "element" {
            // push tag
            set arrayMode =  $$$TOPSTACK(modeStack)
            if (arrayMode) {
                set LocalName = $name(@LocalName@($increment(@LocalName),xreader.Name))
            } else {
                set LocalName = $name(@LocalName@(xreader.Name))
            }
            // we are switching to "array mode" if there is no
            // single attribute in the current tag 
{'fraction_non_alphanumeric': 0.13814639020734448, 'fraction_numerical': 0.009992505620784412, 'mean_word_length': 2.7916666666666665, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 2, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '767529', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1225, 'n_words': 293}