<commit_before># Copyright (C) 2014 <NAME> 
# License: AGPLv3+

from urllib.request import urlopen
from lxml import etree
from subprocess import *

from model import *
import serverFetcher


def getGameSpyList():
	source = urlopen(
		"http://gstadmin.gamespy.net/masterserver/?gamename=vietcong")
	tree = etree.parse(source, parser = etree.HTMLParser())
	rows = tree.xpath("/html/body/form/table/tr")[1:]

	servers = []
	for row in rows:
		servers.append(Server(ip = row[0].text, infoport = int(row[1].text)))
	
	return servers


def getQtrackerList():
	source = urlopen("http://www.qtracker.com/server_lists/vietcong.txt")
	lines = source.readlines()
	arr = [str(line, encoding = "utf8").split(":")
		for line in lines if line.strip()]
	return list(map(lambda row: Server(
		ip = row[0],
		infoport = int(row[1])), arr))


def callAluigi():
	with Popen(["./gslist", "-n", "vietcong"], stdout = PIPE, stderr = PIPE) \
			as proc:
		output = proc.stdout.read().decode("ascii")
		arr = [line.split() for line in output.split("\n") if line.strip()]
		return list(map(lambda row: Server(
			ip = row[0],
			infoport = int(row[1])), arr))
	

def fetchNewServers(servers):
	for server in servers:
		if not Server.select().where(Server.ip == server.ip,
				Server.infoport == server.infoport).exists():<commit_msg>Using freshly generated list by Qtracker.<commit_after># Copyright (C) 2014 <NAME> 
# License: AGPLv3+

from urllib.request import urlopen
from lxml import etree
from subprocess import *

from model import *
import serverFetcher


def getGameSpyList():
	source = urlopen(
		"http://gstadmin.gamespy.net/masterserver/?gamename=vietcong")
	tree = etree.parse(source, parser = etree.HTMLParser())
	rows = tree.xpath("/html/body/form/table/tr")[1:]

	servers = []
	for row in rows:
		servers.append(Server(ip = row[0].text, infoport = int(row[1].text)))
	
	return servers


def getQtrackerList():
	source = urlopen("http://www.qtracker.com/server_list_details.php?game=vietcong")
	lines = source.readlines()
	arr = [str(line, encoding = "utf8").split(":")
		for line in lines if line.strip()]
	return list(map(lambda row: Server(
		ip = row[0],
		infoport = int(row[1])), arr))


def callAluigi():
	with Popen(["./gslist", "-n", "vietcong"], stdout = PIPE, stderr = PIPE) \
			as proc:
		output = proc.stdout.read().decode("ascii")
		arr = [line.split() for line in output.split("\n") if line.strip()]
		return list(map(lambda row: Server(
			ip = row[0],
			infoport = int(row[1])), arr))
	

def fetchNewServers(servers):
	for server in servers:
		if not Server.select().where(Server.ip == server.ip,
				Server.infoport == server.infoport).exists():
{'fraction_non_alphanumeric': 0.1650339110776187, 'fraction_numerical': 0.009796533534287867, 'mean_word_length': 4.418367346938775, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '5124575', 'n_tokens_mistral': 1003, 'n_tokens_neox': 959, 'n_words': 230}