<commit_before>-module(dberl.introspect).

-import(lists).
-import(xmerl_scan).

-include("xmerl.hrl").
-include("dbus.hrl").

-compile([export_all]).

%% api


build_introspect(Service, Path) ->
    Headers = [
	       [?HEADER_PATH, #variant{type=object_path, value=Path}],
	       [?HEADER_DESTINATION, #variant{type=string, value=Service}],
	       [?HEADER_INTERFACE, #variant{type=string, value="org.freedesktop.DBus.Introspectable"}],
	       [?HEADER_MEMBER, #variant{type=string, value="Introspect"}]
	      ],

    #header{type=?TYPE_METHOD_CALL,
	    headers=Headers}.



from_xml() ->
    from_xml("/home/mikael/src/dbus/introspect.xml").

from_xml_string(Data) when is_list(Data) ->
    {Xml, _Misc} = xmerl_scan:string(Data),
    xml(Xml).

from_xml(FileName) ->
    {Xml, _Misc} = xmerl_scan:file(FileName, []),
    xml(Xml).<commit_msg>Don't use export_all<commit_after>-module(dberl.introspect).

-import(lists).
-import(xmerl_scan).

-include("xmerl.hrl").
-include("dbus.hrl").

-export([
	 build_introspect/2,
	 from_xml/1,
	 from_xml_string/1
	]).

%% api


build_introspect(Service, Path) ->
    Headers = [
	       [?HEADER_PATH, #variant{type=object_path, value=Path}],
	       [?HEADER_DESTINATION, #variant{type=string, value=Service}],
	       [?HEADER_INTERFACE, #variant{type=string, value="org.freedesktop.DBus.Introspectable"}],
	       [?HEADER_MEMBER, #variant{type=string, value="Introspect"}]
	      ],

    #header{type=?TYPE_METHOD_CALL,
	    headers=Headers}.



from_xml_string(Data) when is_list(Data) ->
    {Xml, _Misc} = xmerl_scan:string(Data),
    xml(Xml).

from_xml(FileName) ->
    {Xml, _Misc} = xmerl_scan:file(FileName, []),
    xml(Xml).
{'fraction_non_alphanumeric': 0.17821195973949083, 'fraction_numerical': 0.0017761989342806395, 'mean_word_length': 4.13677811550152, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 13}, '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': '7555432', 'n_tokens_mistral': 675, 'n_tokens_neox': 644, 'n_words': 78}