Commit a1e212d0 by Anselm Jia

comment spacing

parent 369c6124
......@@ -6,14 +6,14 @@ import glob
var = "[\s]*([a-zA-Z_][\w, ]*)[\s]*=[^=]"
def get_unique_vars(filename):
'''
Goes through a file and finds all of the unique variable names.
Input:
filename(string): name of file from which to pull variable names.
Output:
unique_vs(set): set containing variable names as strings
'''
'''
Goes through a file and finds all of the unique variable names.
Input:
filename(string): name of file from which to pull variable names.
Output:
unique_vs(set): set containing variable names as strings
'''
#Create set to accumulate variables.
unique_vs = set()
with open(filename) as f:
......@@ -28,15 +28,15 @@ Output:
def main():
'''
Works over our pydata directory and pulls variables from the number of files
specified.
Input:
subset(int): number of files to run over within the directory.
Output:
None, but writes all variable files to our pyvariables directory.
'''
'''
Works over our pydata directory and pulls variables from the number of files
specified.
Input:
subset(int): number of files to run over within the directory.
Output:
None, but writes all variable files to our pyvariables directory.
'''
count = 0
for filename in glob.glob("pydata/pyfile*.txt"):
if count == subset:
......
import re
def go(subset):
'''
Takes in the raw python text file and splits the file into a subset.
'''
Takes in the raw python text file and splits the file into a subset.
Input:
subset(int): number of files desired for subset.
Output:
None but the function files will be written to the directory pyfiles.
'''
Input:
subset(int): number of files desired for subset.
Output:
None but the function files will be written to the directory pyfiles.
'''
#Initialize counters and boolean.
count = 0
prev = False
......
import re
def go(subset):
'''
Takes in the raw python text file and splits the functions into a subset of
individual files.
'''
Takes in the raw python text file and splits the functions into a subset of
individual files.
Input:
subset(int): number of files desired for subset.
Output:
None but the function files will be written to the directory pyfunctions
with the names, parameters, and body separated.
'''
Input:
subset(int): number of files desired for subset.
Output:
None but the function files will be written to the directory pyfunctions
with the names, parameters, and body separated.
'''
with open("data/python.txt", 'r') as f:
#Initializes all counters and function accumulator.
func = False
......
import json
def to_json(filename, dataname):
'''
Takes the output of mrjob and turns it into a json.
'''
Takes the output of mrjob and turns it into a json.
Inputs:
filename(string): name of .txt file to be processed.
dataname(string): name of .json file to be written.
Outputs:
.json file with the output.
'''
Inputs:
filename(string): name of .txt file to be processed.
dataname(string): name of .json file to be written.
Outputs:
.json file with the output.
'''
resultdict = {}
with open(filename) as resultfile:
results = resultfile.readlines()
......
......@@ -6,15 +6,15 @@ REG_F = "def [a-zA-Z_][\w]*\("
DEFAULT_RETURN = 1
def funcsim(file1name,file2name):
'''
Given two function files generated by pyfuncsplit.py, we get
the parameters of these functions.
'''
Given two function files generated by pyfuncsplit.py, we get
the parameters of these functions.
Inputs:
file1name, file2name (strings): files to be read.
Output:
tuple with name, parameters, and text of files.
'''
Inputs:
file1name, file2name (strings): files to be read.
Output:
tuple with name, parameters, and text of files.
'''
with open(file1name) as f1:
with open(file2name) as f2:
f1text = f1.read()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment