text
stringlengths
1
93.6k
pickle.dump(save_dict, f)
def run(self):
self.pre()
early_stop = self.kwargs.get('early_stop', False)
while self.temp_step <= self.steps:
self.slice()
self.grad()
self.sample()
self.forward()
self.test()
self.update()
self.temp_step += 1
if early_stop and self.temp_output == self.target:
break
is_save = self.kwargs.get('is_save', False)
if is_save:
self.save()
# <FILESEP>
# github_no_partners.py
# Dan Wallach <dwallach@rice.edu>
# Available subject to the Apache 2.0 License
# https://www.apache.org/licenses/LICENSE-2.0
import argparse
import pandas as pd
from github_config import *
from github_scanner import *
# your graders, preferably their GitHub IDs (we'll ignore them if they've also checked out a copy of the assignment)
grader_list = default_grader_list
# your own GitHub ID and/or anybody else who you wish to exclude from being graded
ignore_list = default_grader_ignore_list
# command-line argument processing
parser = argparse.ArgumentParser(description='find all students with no partners and/or no repo')
parser.add_argument('--token',
nargs=1,
default=[default_github_token],
help='GitHub API token')
parser.add_argument('--org',
nargs=1,
default=[default_github_organization],
help='GitHub organization to scan, default: ' + default_github_organization)
parser.add_argument('--prefix',
nargs=1,
default=[default_prefix],
help='Prefix on projects to match (default: match all projects)')
parser.add_argument('--students',
nargs=1,
default=[default_student_csv_name],
help="CSV file name with student information (default: student-data.csv)")
parser.add_argument('--ignore',
nargs=1,
default=[""],
help="string pattern in group names to ignore, e.g., STAFF (no default)")
parser.add_argument('--min_team_size',
nargs=1,
default=["2"],
help="minimum team size (default: 2)")
args = parser.parse_args()
github_prefix = args.prefix[0]
github_organization = args.org[0]
github_token = args.token[0]
student_file_name = args.students[0]
ignore_str = args.ignore[0]
min_team_size = int(args.min_team_size[0])
df_students = {} # will replace below
df_students_success = False
try:
df_students = pd.read_csv(student_file_name)
# force lower-case of GitHub IDs
df_students.GitHubID = df_students.GitHubID.astype(str).str.lower() # force lower-case of GitHub IDs
df_students_success = True
except FileNotFoundError:
print("Cannot file student info file: %s\n" % student_file_name)
pass
def student_known(github_id: str) -> bool:
"""
Given a GitHub IDs, returns whether that student is a known student in
the student-data CSV file.
"""
if df_students_success:
matches = df_students[df_students['GitHubID'] == github_id.lower()]
if len(matches) == 1:
return True
elif len(matches) == 0:
return False
else:
print("Warning: two or more rows found for github-id (%s) in s info!\n" % github_id)
return True