<commit_before># -*- coding: utf-8 -*-
from base import *
import ast
from urllib.request import urlopen
import pprint

url="http://redflare.ofthings.net"

def msg(mp):
  if mp.wcmd("ison"):
    search = mp.args()
    found = {}
    total_names = 0
    with urlopen(url+"/reports") as u:
      servers = ast.literal_eval(u.read().decode())
      for server in servers.keys():
        for name_p in servers[server]['playerNames']:
          name = name_p['plain']
          if name.lower().find(search.lower()) != -1:
            if server not in found:
              found[server]=list()
            found[server].append(name)
            total_names = total_names+1
      main.sendcmsg("Found "+str(total_names)+".")
      for s in found:
        out = servers[s]['description']+": "
        for p in found[s]:
          out+=p+", "
        main.sendcmsg(out)
    return True
  return False
  
def showhelp():
  main.sendcmsg(".ison name of player: Search "+url+" for <name>.")<commit_msg>ison additions<commit_after># -*- coding: utf-8 -*-
from base import *
import ast
from urllib.request import urlopen
import pprint

url="http://redflare.ofthings.net"

def msg(mp):
  if mp.wcmd("ison"):
    search = mp.args()
    found = {}
    total_names = 0
    total_servers = 0
    with urlopen(url+"/reports") as u:
      servers = ast.literal_eval(u.read().decode())
      for server in servers.keys():
        for name_p in servers[server]['playerNames']:
          name = name_p['plain']
          if name.lower().find(search.lower()) != -1:
            if server not in found:
              found[server]=list()
            found[server].append(name)
            total_names = total_names+1
      main.sendcmsg("Found "+str(total_names)+" in "+str(len(found))+" server(s).")
      for s in found:
        out = servers[s]['description']+": "
        for p in found[s]:
          out+=p+", "
        main.sendcmsg(out)
    return True
  return False
  
def showhelp():
  main.sendcmsg(".ison name of player: Search "+url+" for <name>.")
{'fraction_non_alphanumeric': 0.15388397246804325, 'fraction_numerical': 0.004424778761061947, 'mean_word_length': 2.4608843537414966, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '207546', 'n_tokens_mistral': 650, 'n_tokens_neox': 644, 'n_words': 165}