<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os

#enables logging of messages on a channel/channels, storing the logs sorted by channel by day in the format "channelID Y-M-D"
def log(response, args, sc, rmsg):
	LOG = False
	LOGC = []

	#Finds log.txt, opens it, and assigns values based on its contents
	filename = "config/log.txt"
	script_dir = os.path.dirname(os.path.dirname(__file__))
	fullDir = os.path.join(script_dir, filename)
	target = open(fullDir, "r")
	if target.readline().strip('\n') == "True":
		LOG = True
	LOGC = [line.rstrip('\n') for line in target]
	target.close()

	#If the first argument is true,
	if "true" == args[0].lower():
		LOG = True
		if len(args) > 2:
			print "PantherBot:LOG:List of channels to log gathered"
			#obtains list of public channels PB is in
			pub_channels = sc.api_call("channels.list",exclude_archived = 1)
			#obtains list of private channels PB is in
			pri_channels = sc.api_call("groups.list",exclude_archived = 1)
			#Goes through the arguments after true
			print "PantherBot:LOG:Parsing list of channels to log"
			for w in range(2, len(args)):
				#goes through the list of public channels, if found by name, its ID is added to the list of channels to go monitor
				for channel in pub_channels["channels"]:
					if channel["name"].lower() == args[w].lower():
						LOGC.append(str(channel["id"]))
						rmsg(response, [channel["name"] + " added to list of channels to log"])
				#Same as above
				for channel in pri_channels["groups"]:
					if channel["name"].lower() == args[w].lower():
						LOGC.append(str(channel["id"]))<commit_msg>Fixed log.py because of archaic code<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os

#enables logging of messages on a channel/channels, storing the logs sorted by channel by day in the format "channelID Y-M-D"
def log(response, args, sc, rmsg):
	LOG = False
	LOGC = []

	#Finds log.txt, opens it, and assigns values based on its contents
	filename = "config/log.txt"
	script_dir = os.path.dirname(os.path.dirname(__file__))
	fullDir = os.path.join(script_dir, filename)
	target = open(fullDir, "r")
	if target.readline().strip('\n') == "True":
		LOG = True
	LOGC = [line.rstrip('\n') for line in target]
	target.close()

	#If the first argument is true,
	if "true" == args[0].lower():
		LOG = True
		if len(args) > 1:
			print "PantherBot:LOG:List of channels to log gathered"
			#obtains list of public channels PB is in
			pub_channels = sc.api_call("channels.list",exclude_archived = 1)
			#obtains list of private channels PB is in
			pri_channels = sc.api_call("groups.list",exclude_archived = 1)
			#Goes through the arguments after true
			print "PantherBot:LOG:Parsing list of channels to log"
			for w in range(1, len(args)):
				#goes through the list of public channels, if found by name, its ID is added to the list of channels to go monitor
				for channel in pub_channels["channels"]:
					if channel["name"].lower() == args[w].lower():
						LOGC.append(str(channel["id"]))
						rmsg(response, [channel["name"] + " added to list of channels to log"])
				#Same as above
				for channel in pri_channels["groups"]:
					if channel["name"].lower() == args[w].lower():
						LOGC.append(str(channel["id"]))
{'fraction_non_alphanumeric': 0.13347652654188402, 'fraction_numerical': 0.00368211107701749, 'mean_word_length': 3.917043740573152, 'pattern_counts': {'":': 2, '<': 3, '<?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': '4067681', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1052, 'n_words': 362}