<commit_before># This file has all the functions which will 
# be used in retriving data from GitHub API.

import urllib2
import json

# Basic retrival of data from 
# https://api.github.com/users/user_name
def basic_retrive(user_name):

	# concatenate user name to create link
	link = "https://api.github.com/users/" + user_name
	# empty list for collecting things I need
	box = []

	# Try to open link and if failed return None
	try:
		response = urllib2.urlopen(link)
		data = json.load(response)
		if not data:
			return None
	except:
		return None

	# Check if the link opened is user type
	if not data['type'] == "User":
		return None

	# Empty dict
	box_feed = {}

	# Collect everything in box and return box 
	try:
		box_feed['login'] = data['login']
		box_feed['avatar_url'] = data['avatar_url']
		box_feed['html_url'] = data['html_url']
		box_feed['name'] = data['name']
		box_feed['company'] = data['company']
		box_feed['blog'] = data['blog']
		box_feed['location'] = data['location']
		box_feed['bio'] = data['bio']
		box_feed['public_repos'] = data['public_repos']
		box_feed['public_gists'] = data['public_gists']
		box_feed['followers'] = data['followers']
		box_feed['following'] = data['following']
		box.append(box_feed)
		return box
	except:
		return None

def watch_list(user_name):
	# concatenate user name to create link
	link = "https://api.github.com/users/" + user_name + "/subscriptions"
	
	# empty list for collecting things I need
	box = []

	# Try to open link and if failed return None
	try:
		response = urllib2.urlopen(link)
		data = json.load(response)
		if not data:
			return None
	except:
		return None

	# pack the box with info we need
	for i in range(len(data)):
		box_feed = {}
		box_feed["full_name"] = data[i]["full_name"]
		box_feed["html_url"] = data[i]["html_url"]
		box.append(box_feed)

	return box<commit_msg>organizations function added in helpers<commit_after># This file has all the functions which will 
# be used in retriving data from GitHub API.

import urllib2
import json

# Basic retrival of data from 
# https://api.github.com/users/user_name
def basic_retrive(user_name):

	# concatenate user name to create link
	link = "https://api.github.com/users/" + user_name
	# empty list for collecting things I need
	box = []

	# Try to open link and if failed return None
	try:
		response = urllib2.urlopen(link)
		data = json.load(response)
		if not data:
			return None
	except:
		return None

	# Check if the link opened is user type
	if not data['type'] == "User":
		return None

	# Empty dict
	box_feed = {}

	# Collect everything in box and return box 
	try:
		box_feed['login'] = data['login']
		box_feed['avatar_url'] = data['avatar_url']
		box_feed['html_url'] = data['html_url']
		box_feed['name'] = data['name']
		box_feed['company'] = data['company']
		box_feed['blog'] = data['blog']
		box_feed['location'] = data['location']
		box_feed['bio'] = data['bio']
		box_feed['public_repos'] = data['public_repos']
		box_feed['public_gists'] = data['public_gists']
		box_feed['followers'] = data['followers']
		box_feed['following'] = data['following']
		box.append(box_feed)
		return box
	except:
		return None

def watch_list(user_name):
	# concatenate user name to create link
	link = "https://api.github.com/users/" + user_name + "/subscriptions"
	
	# empty list for collecting things I need
	box = []

	# Try to open link and if failed return None
	try:
		response = urllib2.urlopen(link)
		data = json.load(response)
		if not data:
			return None
	except:
		return None

	# pack the box with info we need
	for i in range(len(data)):
		box_feed = {}
		box_feed["full_name"] = data[i]["full_name"]
		box_feed["html_url"] = data[i]["html_url"]
		box.append(box_feed)

	return box

def organizations(user_name):
	# concatenate user name to create link
	link = "https://api.github.com/users/" + user_name + "/orgs"
	
	# empty list for collecting things I need
	box = []

	# Try to open link and if failed return None
	try:
		response = urllib2.urlopen(link)
		data = json.load(response)
		if not data:
			return None
	except:
		return None

	# pack the box with info we need
	for i in range(len(data)):
		box_feed = {}
		box_feed["name"] = data[i]["login"]
		box_feed["url"] = "https://github.com/" + data[i]["login"]
		box_feed["icon"] = data[i]["avatar_url"]
		box.append(box_feed)

	return box

{'fraction_non_alphanumeric': 0.13171179440110142, 'fraction_numerical': 0.0016062413951353832, 'mean_word_length': 4.128235294117647, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '41088', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1486, 'n_words': 435}