PKDaHgradescope_utils/__init__.pyPKWCaH-gradescope_utils/autograder_utils/__init__.pyPKWCaH[Äàm/gradescope_utils/autograder_utils/decorators.pyclass weight(object): """Simple decorator to add a __weight__ property to a function Usage: @weight(3.0) """ def __init__(self, val): self.val = val def __call__(self, func): func.__weight__ = self.val return func class tags(object): """Simple decorator to add a __tags__ property to a function Usage: @tags("concept1", "concept2") """ def __init__(self, *args): self.tags = args def __call__(self, func): func.__tags__ = self.tags return func PKwEaH‘Žá++5gradescope_utils/autograder_utils/json_test_runner.py"""Running tests""" from __future__ import print_function import sys import time import json from unittest import result from unittest.signals import registerResult class JSONTestResult(result.TestResult): """A test result class that can print formatted text results to a stream. Used by JSONTestRunner. """ def __init__(self, stream, descriptions, verbosity, results): super(JSONTestResult, self).__init__(stream, descriptions, verbosity) self.descriptions = descriptions self.results = results def getDescription(self, test): doc_first_line = test.shortDescription() if self.descriptions and doc_first_line: return doc_first_line else: return str(test) def getTags(self, test): return getattr(getattr(test, test._testMethodName), '__tags__', None) def getWeight(self, test): return getattr(getattr(test, test._testMethodName), '__weight__', 0.0) def startTest(self, test): super(JSONTestResult, self).startTest(test) def getOutput(self): if self.buffer: out = self._stdout_buffer.getvalue() err = self._stderr_buffer.getvalue() if err: if not out.endswith('\n'): out += '\n' out += err return out def buildResult(self, test, passed): weight = self.getWeight(test) tags = self.getTags(test) output = self.getOutput() result = { "name": self.getDescription(test), "score": weight if passed else 0.0, "max_score": weight, } if tags: result["tags"] = tags if output and len(output) > 0: result["output"] = output return result def addSuccess(self, test): super(JSONTestResult, self).addSuccess(test) self.results.append(self.buildResult(test, True)) def addError(self, test, err): super(JSONTestResult, self).addError(test, err) print("ERROR:", err[1]) self.results.append(self.buildResult(test, False)) def addFailure(self, test, err): super(JSONTestResult, self).addFailure(test, err) print("Test Failed:", str(err[1])) self.results.append(self.buildResult(test, False)) class JSONTestRunner(object): """A test runner class that displays results in JSON form. """ resultclass = JSONTestResult def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1, failfast=False, buffer=False): """ Set buffer to True to include test output in JSON """ self.stream = stream self.descriptions = descriptions self.verbosity = verbosity self.failfast = failfast self.buffer = buffer self.json_data = {} self.json_data["tests"] = [] def _makeResult(self): return self.resultclass(self.stream, self.descriptions, self.verbosity, self.json_data["tests"]) def run(self, test): "Run the given test case or test suite." result = self._makeResult() registerResult(result) result.failfast = self.failfast result.buffer = self.buffer startTime = time.time() startTestRun = getattr(result, 'startTestRun', None) if startTestRun is not None: startTestRun() try: test(result) finally: stopTestRun = getattr(result, 'stopTestRun', None) if stopTestRun is not None: stopTestRun() stopTime = time.time() timeTaken = stopTime - startTime self.json_data["execution_time"] = format(timeTaken, "0.2f") json.dump(self.json_data, self.stream, indent=4) self.stream.write('\n') return result PKÏEaH^-Ò 0gradescope_utils-0.1.1.dist-info/DESCRIPTION.rstUNKNOWN PKÏEaH‚zÈ}EE.gradescope_utils-0.1.1.dist-info/metadata.json{"classifiers": ["Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5"], "extensions": {"python.details": {"contacts": [{"email": "ibrahim@gradescope.com", "name": "Ibrahim Awwal", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/gradescope/gradescope-utils"}}}, "extras": ["dev", "test"], "generator": "bdist_wheel (0.26.0)", "keywords": ["gradescope", "http", "service"], "license": "MIT", "metadata_version": "2.0", "name": "gradescope-utils", "run_requires": [{"extra": "dev", "requires": ["check-manifest"]}, {"extra": "test", "requires": ["coverage"]}], "summary": "Utilities for interacting with Gradescope", "version": "0.1.1"}PKÏEaHù ” .gradescope_utils-0.1.1.dist-info/top_level.txtgradescope_utils PKÏEaHìndªnn&gradescope_utils-0.1.1.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any PKÏEaH ó@ÎÎ)gradescope_utils-0.1.1.dist-info/METADATAMetadata-Version: 2.0 Name: gradescope-utils Version: 0.1.1 Summary: Utilities for interacting with Gradescope Home-page: https://github.com/gradescope/gradescope-utils Author: Ibrahim Awwal Author-email: ibrahim@gradescope.com License: MIT Keywords: gradescope http service Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: Topic :: Software Development :: Build Tools Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Provides-Extra: dev Requires-Dist: check-manifest; extra == 'dev' Provides-Extra: test Requires-Dist: coverage; extra == 'test' UNKNOWN PKÏEaHX$°°'gradescope_utils-0.1.1.dist-info/RECORDgradescope_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 gradescope_utils/autograder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 gradescope_utils/autograder_utils/decorators.py,sha256=7Tf0-3NKnZkRfs3js_Qpb18e93G2c76c6aaeDP-PSWs,538 gradescope_utils/autograder_utils/json_test_runner.py,sha256=OjwoXEoHX36JHAxnrWNUF5ium59DHJKds4WkobdbR2Y,3883 gradescope_utils-0.1.1.dist-info/DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10 gradescope_utils-0.1.1.dist-info/METADATA,sha256=MYtzIyWmEZ7vn4lwaCJFDqjQ2Qv6CdhX_hHJee1gpjw,974 gradescope_utils-0.1.1.dist-info/RECORD,, gradescope_utils-0.1.1.dist-info/WHEEL,sha256=GrqQvamwgBV4nLoJe0vhYRSWzWsx7xjlt74FT0SWYfE,110 gradescope_utils-0.1.1.dist-info/metadata.json,sha256=KkJ8n-VyBt6arJVeXiQaC2xQZoZTqZQRxLZlneRT7z4,1093 gradescope_utils-0.1.1.dist-info/top_level.txt,sha256=OWJXD0Ey6lDjiRWeQashG_lmieSeOkcIwcY7pfVvS4w,17 PKDaHgradescope_utils/__init__.pyPKWCaH-:gradescope_utils/autograder_utils/__init__.pyPKWCaH[Äàm/…gradescope_utils/autograder_utils/decorators.pyPKwEaH‘Žá++5ìgradescope_utils/autograder_utils/json_test_runner.pyPKÏEaH^-Ò 0jgradescope_utils-0.1.1.dist-info/DESCRIPTION.rstPKÏEaH‚zÈ}EE.Âgradescope_utils-0.1.1.dist-info/metadata.jsonPKÏEaHù ” .Sgradescope_utils-0.1.1.dist-info/top_level.txtPKÏEaHìndªnn&°gradescope_utils-0.1.1.dist-info/WHEELPKÏEaH ó@ÎÎ)bgradescope_utils-0.1.1.dist-info/METADATAPKÏEaHX$°°'wgradescope_utils-0.1.1.dist-info/RECORDPK {l