<commit_before>(function(exports) {

	var Inspector = new Class({
		initialize: function(server) {
			this._server = server;
			var connection = server.connect();
			this._display = connection.display;
            this._port = connection.clientPort;
            this._port.addEventListener("message", function(messageEvent) {
                this._handleEvent(event);
            }.bind(this));

			this._toplevel = document.createElement('div');
			this._toplevel.classList.add('inspector');
			this.elem = this._toplevel;

			this._windowTree = document.createElement('div');
			this._windowTree.classList.add('window-tree');
			this._toplevel.appendChild(this._windowTree);

			this._display.selectInput({ windowId: this._display.rootWindowId,
									    events: ['SubstructureNotify'] });
		},

		_handleEvent: function(event) {
			this._syncWindowTree();
		},

		_getDebugName: function(xid) {
            var debugName;
            if (!debugName)
            	debugName = this._display.getProperty({ windowId: xid, name: "DEBUG_NAME" });
            if (!debugName)
            	debugName = this._display.getProperty({ windowId: xid, name: "WM_NAME" });
            if (!debugName)
            	debugName = "Unnamed Window";

			return debugName;
		},
		_makeWindowLabel: function(xid) {
			var node = document.createElement("div");
			node.classList.add('title');

			var debugNameLabel = document.createElement("span");
			debugNameLabel.classList.add('debug-name');
			debugNameLabel.innerText = this._getDebugName(xid);
			node.appendChild(debugNameLabel);

			var xidLabel = document.createElement("span");
			xidLabel.classList.add('xid');
			xidLabel.innerText = xid;
			node.appendChild(xidLabel);

			return node;
		},
		_syncWindowTree: function() {
			var makeNodeForWindow = function(xid) {
				var node = document.createElement("div");
				node.classList.add('window');

				var windowLabel = this._makeWindowLabel(xid);
				node.appendChild(windowLabel);

				var childList = document.createElement("div");
				childList.classList.add('children');
				node.appendChild(childList);

				// Recurse
				var query = this._display.queryTree({ windowId: xid });
				query.children.forEach(function(childXid) {
					childList.appendChild(makeNodeForWindow(childXid));
				});
				return node;
			}.bind(this);

			while (this._windowTree.firstChild)
				this._windowTree.removeChild(this._windowTree.firstChild);

			var rootNode = makeNodeForWindow(this._display.rootWindowId);
			this._windowTree.appendChild(rootNode);
		},
	});

	exports.Inspector = Inspector;

})(window);
<commit_msg>spacify inspector<commit_after>(function(exports) {

    var Inspector = new Class({
        initialize: function(server) {
            this._server = server;
            var connection = server.connect();
            this._display = connection.display;
            this._port = connection.clientPort;
            this._port.addEventListener("message", function(messageEvent) {
                this._handleEvent(event);
            }.bind(this));

            this._toplevel = document.createElement('div');
            this._toplevel.classList.add('inspector');
            this.elem = this._toplevel;

            this._windowTree = document.createElement('div');
            this._windowTree.classList.add('window-tree');
            this._toplevel.appendChild(this._windowTree);

            this._display.selectInput({ windowId: this._display.rootWindowId,
                                        events: ['SubstructureNotify'] });
        },

        _handleEvent: function(event) {
            this._syncWindowTree();
        },

        _getDebugName: function(xid) {
            var debugName;
            if (!debugName)
                debugName = this._display.getProperty({ windowId: xid, name: "DEBUG_NAME" });
            if (!debugName)
                debugName = this._display.getProperty({ windowId: xid, name: "WM_NAME" });
            if (!debugName)
                debugName = "Unnamed Window";

            return debugName;
        },
        _makeWindowLabel: function(xid) {
            var node = document.createElement("div");
            node.classList.add('title');

            var debugNameLabel = document.createElement("span");
            debugNameLabel.classList.add('debug-name');
            debugNameLabel.innerText = this._getDebugName(xid);
            node.appendChild(debugNameLabel);

            var xidLabel = document.createElement("span");
            xidLabel.classList.add('xid');
            xidLabel.innerText = xid;
            node.appendChild(xidLabel);

            return node;
        },
        _syncWindowTree: function() {
            var makeNodeForWindow = function(xid) {
                var node = document.createElement("div");
                node.classList.add('window');

                var windowLabel = this._makeWindowLabel(xid);
                node.appendChild(windowLabel);

                var childList = document.createElement("div");
                childList.classList.add('children');
                node.appendChild(childList);

                // Recurse
                var query = this._display.queryTree({ windowId: xid });
                query.children.forEach(function(childXid) {
                    childList.appendChild(makeNodeForWindow(childXid));
                });
                return node;
            }.bind(this);

            while (this._windowTree.firstChild)
                this._windowTree.removeChild(this._windowTree.firstChild);

            var rootNode = makeNodeForWindow(this._display.rootWindowId);
            this._windowTree.appendChild(rootNode);
        },
    });

    exports.Inspector = Inspector;

})(window);

{'fraction_non_alphanumeric': 0.12182387747998608, 'fraction_numerical': 0.0, 'mean_word_length': 2.4005917159763315, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3485906', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1513, 'n_words': 251}