Skip to content

Commit 82e0408

Browse files
committed
- run() works perfectly if called multiple times
- updated setup.py for next release - ignore some pylint errors
1 parent 8e7f16f commit 82e0408

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
22
python:
3+
- "3.5"
34
- "3.6"
45
- "3.7"
56
- "3.8"
@@ -14,6 +15,6 @@ script:
1415
- isort --check-only --recursive coderunner
1516
- black --check --diff coderunner
1617
- flake8 coderunner --max-line-length=88 --ignore=F401
17-
- pylint coderunner --disable=bad-continuation,invalid-name,too-many-instance-attributes,too-many-arguments
18+
- pylint coderunner --disable=bad-continuation,invalid-name,too-many-instance-attributes,too-many-arguments,attribute-defined-outside-init
1819
after_success:
1920
- codecov

coderunner/coderunner.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ def __readStatus(self, token: str):
101101
return self.__response["status"]["description"]
102102

103103
def __submit(self):
104-
if self.program_input is not None:
105-
api_params["stdin"] = self.program_input
104+
if self.inp is not None:
105+
api_params["stdin"] = self.inp
106106

107-
api_params["expected_output"] = self.program_output
107+
api_params["expected_output"] = self.output
108108
api_params["language_id"] = self.language_id
109-
api_params["source_code"] = self.source_code
109+
api_params["source_code"] = self.source
110110

111111
res = requests.post(API_URL, data=api_params)
112112
token = res.json()
@@ -152,22 +152,23 @@ def getTime(self):
152152

153153
def run(self):
154154
"""
155-
submit the source code on judge0's server
155+
submit the source code on judge0's server & return status
156156
"""
157-
print(self.path)
158-
print(self.inp)
159-
print(self.source)
160-
print(self.output)
161-
if self.path:
162-
if self.inp is not None:
163-
self.program_input = self.__readStandardInput()
164-
self.source_code = self.__readCode()
165-
self.program_output = self.__readExpectedOutput()
157+
if os.path.exists(self.source):
158+
if self.path:
159+
if self.inp is not None:
160+
self.inp = self.__readStandardInput()
161+
self.source = self.__readCode()
162+
self.output = self.__readExpectedOutput()
166163

167164
token = self.__submit()
168165
self.__token = token
169166

170167
def getStatus(self):
168+
"""
169+
Return submission status
170+
"""
171+
171172
status = self.__readStatus(self.__token)
172173

173174
return status

demo.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
r.run()
1717

1818
# get Submission status
19-
print("Status : " + r.getStatus)
19+
print("Status : " + r.getStatus())
20+
21+
r.run()
22+
23+
# get Submission status
24+
print("Status : " + r.getStatus())
2025

2126
# check if any error occured
2227
if r.getError() is not None:

setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
setuptools.setup(
77
name="coderunner",
8-
version="0.4",
9-
author="Bhupesh Varshey",
8+
version="0.5",
9+
license="MIT",
10+
author="Bhupesh Varshney",
1011
author_email="varsheybhupesh@gmail.com",
11-
description="Judge0 API Interface written in Python",
12+
description="A judge for your programs, run and test your programs through Python",
1213
keywords='judge0 coderunner judge0-api codeclassroom',
1314
long_description=long_description,
1415
long_description_content_type="text/markdown",
15-
url="https://github.com/codeclassroom/CodeRunner",
16+
url="https://codeclassroom.github.io/CodeRunner/",
1617
project_urls={
1718
"Documentation": "https://coderunner.readthedocs.io/en/latest/",
1819
"Source Code": "https://github.com/codeclassroom/CodeRunner",
@@ -24,11 +25,12 @@
2425
'requests',
2526
],
2627
classifiers=[
28+
"Programming Language :: Python :: 3",
2729
"Programming Language :: Python :: 3.6",
2830
"Programming Language :: Python :: 3.7",
2931
"Programming Language :: Python :: 3.8",
32+
"Programming Language :: Python :: 3 :: Only",
3033
"License :: OSI Approved :: MIT License",
31-
'Topic :: Software Development :: Build Tools',
3234
"Topic :: Education",
3335
"Topic :: Education",
3436
"Topic :: Software Development",

0 commit comments

Comments
 (0)