<commit_before>library kaa;

import 'dart:async';
import 'dart:convert';
import 'dart:html';
import 'package:polymer/polymer.dart';

@CustomTag('eplusx-kancolle-assistant')
class Assistant extends PolymerElement {
  @observable String peekResult;

  Assistant.created() : super.created();

  @override
  void enteredView() {
  }

  void peek() {
    var path = "http://localhost:9090/proxy/9091/har";
    HttpRequest.getString(path)
        .then((String content) {
          var json = JSON.decode(content);
          peekResult = formatJson(json);
        });
  }

  static void appendIndentedText(String text, int level, StringBuffer buffer) {
    var indentationMark = "  ";
    for (var i = 0; i < level; ++i) {
      buffer.write(indentationMark);
    }
    buffer.write(text);<commit_msg>Infer the server address from the URL.<commit_after>library kaa;

import 'dart:async';
import 'dart:convert';
import 'dart:html';
import 'package:polymer/polymer.dart';

@CustomTag('eplusx-kancolle-assistant')
class Assistant extends PolymerElement {
  @observable String peekResult;

  Uri serverGetstate;

  Assistant.created() : super.created();

  @override
  void enteredView() {
    var clientRoot = Uri.parse(window.location.href);
    serverGetstate = clientRoot.resolve("/getstate");
    peekResult = serverGetstate.toString();
  }

  void peek() {
    HttpRequest.getString(serverGetstate.toString())
        .then((String content) {
          var json = JSON.decode(content);
          peekResult = formatJson(json);
        });
  }

  static void appendIndentedText(String text, int level, StringBuffer buffer) {
    var indentationMark = "  ";
    for (var i = 0; i < level; ++i) {
      buffer.write(indentationMark);
    }
    buffer.write(text);
{'fraction_non_alphanumeric': 0.12984054669703873, 'fraction_numerical': 0.0056947608200455585, 'mean_word_length': 3.5636363636363635, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1327370', 'n_tokens_mistral': 564, 'n_tokens_neox': 538, 'n_words': 121}