Skip to content
This repository was archived by the owner on Oct 2, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
34c4d18
Add files via upload
andyjjrt Nov 29, 2020
e73b23c
Delete oj.py
andyjjrt Nov 29, 2020
dc1270b
Adding Update function
andyjjrt Nov 29, 2020
739832b
Delete __init__.py
andyjjrt Nov 29, 2020
5eb71af
Add Update function
andyjjrt Nov 29, 2020
0eef037
Delete oj.py
andyjjrt Nov 29, 2020
28e78f9
add update function
andyjjrt Nov 29, 2020
8e6a7c4
Delete __init__.py
andyjjrt Nov 29, 2020
2f04c99
add update function
andyjjrt Nov 29, 2020
64a014b
add update function
andyjjrt Nov 29, 2020
2558720
Add rank,update,and status fubcs
Nov 30, 2020
6295da6
Redesign output and change some function name
Nov 30, 2020
cd463e3
Update README.md
andyjjrt Nov 30, 2020
3e2a119
Merge pull request #1 from andyjjrt/andyjjrt/oj-cli-2
andyjjrt Nov 30, 2020
3817e3a
Redesign status function ui and add quick function to see user's own …
Dec 1, 2020
8149779
Redesign status function ui and add quick function to see user's own …
Dec 1, 2020
4d9d236
Merge pull request #2 from andyjjrt/oj-cli-3
andyjjrt Dec 1, 2020
7e05a92
Fix 2 bugs
Dec 2, 2020
038d1aa
Merge pull request #4 from andyjjrt/oj-cli-3.2
andyjjrt Dec 2, 2020
eabf628
merge from 3.2
Dec 3, 2020
0b0d18e
adhust outputs and found few bugs,
Dec 6, 2020
cb01aef
adhust outputs and found few bugs,
Dec 6, 2020
dd83c4b
adhust outputs and found few bugs,
Dec 6, 2020
e1a6e40
adhust outputs and found few bugs,
Dec 6, 2020
cfd56e8
Merge pull request #6 from andyjjrt/oj-cli-3.5
andyjjrt Dec 6, 2020
c4958d5
fixed bug:new user can't use mystat
Dec 6, 2020
93ee75a
fixed bug:new user can't use mystat
Dec 6, 2020
4fd0beb
Merge pull request #7 from andyjjrt/oj-cli-3.5
andyjjrt Dec 6, 2020
fa75b2e
Update oj.py
andyjjrt Dec 6, 2020
480488d
Update README.md
andyjjrt Dec 6, 2020
22855e6
Update README.md
andyjjrt Dec 6, 2020
0a7c318
Update README.md
andyjjrt Dec 6, 2020
1b2a2cf
Update README.md
andyjjrt Dec 7, 2020
81bf1df
weired bug fixed
andyjjrt Dec 7, 2020
95fc1d2
Merge pull request #8 from andyjjrt/oj-cli-3.6
andyjjrt Dec 7, 2020
ade9403
update bug detecting and rank render bug fixed.
andyjjrt Dec 11, 2020
6fe6e7e
Merge pull request #9 from andyjjrt/oj-cli-4
andyjjrt Dec 11, 2020
f2ebe82
Add one-click install and update shell script, not sure if it works
andyjjrt Dec 11, 2020
eccbcd9
Merge pull request #10 from andyjjrt/v1.0
andyjjrt Dec 11, 2020
375897f
adjust update.sh
andyjjrt Dec 11, 2020
2cb858e
Merge pull request #11 from andyjjrt/v1.0
andyjjrt Dec 11, 2020
366531e
Update README.md
andyjjrt Dec 11, 2020
581104b
Update update.sh
andyjjrt Dec 11, 2020
61a35c0
Update README.md
andyjjrt Dec 11, 2020
f00f471
Update status_log.json
andyjjrt Dec 11, 2020
a4b063b
Update install manual
andyjjrt Dec 11, 2020
56f0f72
Let chinese word in contest title be 'XX' and will not throw error.
andyjjrt Dec 11, 2020
9cbbc36
Let chinese word in contest title be 'XX' and will not throw error.
andyjjrt Dec 11, 2020
ce67d46
Merge pull request #12 from andyjjrt/v1.1
andyjjrt Dec 11, 2020
c827638
fix bug: can't show TLE properly.
andyjjrt Dec 11, 2020
0b03192
Merge pull request #13 from andyjjrt/v1.2
andyjjrt Dec 11, 2020
4ab59f8
Delete 109703011|edd70d37ff9777e2a8fa6c2941e9d565.c
andyjjrt Dec 12, 2020
d727bcd
Let install.sh automatically leed to login command.
andyjjrt Dec 12, 2020
ad0c79f
Merge pull request #14 from andyjjrt/v1.2.1
andyjjrt Dec 12, 2020
d16ff4d
fix bug while some user cam't use 'python'.
andyjjrt Dec 12, 2020
c64afb2
Merge pull request #15 from andyjjrt/v1.2.2
andyjjrt Dec 12, 2020
0e346b8
remove install.sh and edit README.md file of the installation part.
andyjjrt Dec 12, 2020
1e8f081
remove install.sh and edit README.md file of the installation part.
andyjjrt Dec 12, 2020
ea79cb0
remove unexpected file .bashrc
andyjjrt Dec 12, 2020
e5038d4
Merge pull request #16 from andyjjrt/v1.2.3
andyjjrt Dec 12, 2020
af7ea50
Fixed error
andyjjrt Dec 16, 2020
9702d38
add problem_submit function to submit problems
andyjjrt Dec 18, 2020
26f510d
Merge pull request #17 from andyjjrt/v1.4
andyjjrt Dec 18, 2020
a289d48
add priblem_submit instructions
andyjjrt Dec 18, 2020
cf27774
v1.5 Design for CP2 Class
andyjjrt Feb 28, 2021
70b67eb
v1.5 Design for CP2 Class
andyjjrt Feb 28, 2021
f68bb32
v1.5.1 CP2 Class Ver.
andyjjrt Feb 28, 2021
8ed8186
v1.5.1 change display settings
andyjjrt Mar 1, 2021
c91ebe2
v1.5.2 : allow c++ code submission.
andyjjrt Mar 2, 2021
4d29465
v1.5.2 : allow c++ code submission.
andyjjrt Mar 2, 2021
61405bb
v1.5.2 : allow c++ code submission.
andyjjrt Mar 2, 2021
2d70bb3
v1.5.3: fix status and rank page display
andyjjrt Mar 2, 2021
b33256e
v1.5.4: make problem submission performance better
andyjjrt Mar 2, 2021
4c6f511
v1.7.0: CP2
andyjjrt Mar 2, 2021
70a2f92
v1.7.1: Fix rank page error
andyjjrt Mar 3, 2021
34fb4f9
v1.7.2: fix time display
andyjjrt Mar 4, 2021
3643a37
v1.7.3: Fix status page display.
andyjjrt Mar 4, 2021
0e9803b
v1.7.4: auto detecting on problem submit
andyjjrt Mar 6, 2021
54862f6
update README.md
andyjjrt Mar 11, 2021
96d95b6
V1.7.5: tab indentant and add error catcher
andyjjrt Mar 24, 2021
f12cb00
V1.7.6 avoid chinese error
andyjjrt Apr 6, 2021
395053b
v1.7.7: new Host
andyjjrt Apr 18, 2021
7509726
v1.7.8:Fix Login Bug
andyjjrt May 11, 2021
e974b8d
seperate problem update and assign update, adjust settings for 1101CP1
andyjjrt Sep 23, 2021
6d10873
seperate problem update and assign update, adjust settings for 1101CP1
andyjjrt Sep 23, 2021
23f9fbd
v1.7.9: add 110CP1 data and add some error display
andyjjrt Sep 27, 2021
817fb74
v1.7.10 error fixed
andyjjrt Oct 21, 2021
afff26d
get ac grades
mozixreality Mar 18, 2022
f93f5a0
Merge pull request #19 from MozixReality/ac_grades
andyjjrt Mar 28, 2022
c78f4dd
v1.8.0: Add grade collection and update contest name
andyjjrt Mar 28, 2022
3e13ed9
fix: Add .pyc to .gitignore
andyjjrt Sep 14, 2022
95df5b5
fix: Update 1111CP1 as target contest
andyjjrt Sep 14, 2022
139aeea
v1.8.1: 2FA login
andyjjrt Sep 26, 2022
95a8fe1
Update constants.py
kkai0828 Feb 22, 2023
d17a0ee
updated contest, added support for cpp files
snowmii Feb 25, 2023
f4de83d
Merge pull request #20 from kkai0828/master
andyjjrt Feb 25, 2023
50c4e02
Merge branch 'master' into master
andyjjrt Feb 25, 2023
f25f8df
Merge pull request #21 from snowmii/master
andyjjrt Feb 25, 2023
a7b25bb
fix: 1121 update
andyjjrt Sep 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,10 @@ dmypy.json
# pytype static type analyzer
.pytype/

*.pyc

# jetbrains pycharm
.idea/

# End of https://www.toptal.com/developers/gitignore/api/python
n
267 changes: 235 additions & 32 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,64 +1,267 @@
# oj-cli
## Installation
### Ghost Server
### Installation in NCCU GHOST

```
cd ~
echo 'export PATH="~f103207425/.local/bin:$PATH"' >> ~/.profile
source ~/.bashrc
echo 'alias oj="python2.7 ~s10940/oj-cli/oj.py"' >> ~/.profile
source ~/.profile
```

### Install from Source Code
1. Clone this project
### Installation from source code

```
git clone https://github.com/josix/oj-cli.git
git clone https://github.com/andyjjrt/oj-cli.git
cd oj-cli
echo "alias oj='python2.7 $PWD/oj'" >> ~/.bashrc
source ~/.bashrc
```

2. Update `HOST` variable value in file `oj-cli/constants.py` to the OnlineJudge URL you accessing
3. Update Shebang(`#!/opt/csw/bin/python2.7`) value to a suitable one in `oj.py`
If your shell is different like `ash`, you may need to change `.bashrc` to `.profile`.
After installation, please modify `CONTEST_NAME` variable in `constants.py` to the target contest name.


### Commands
### `oj login`
### About
### oj login
#### About
Use `oj login` to login to the account in OnlineJudge. It required you to enter your account information so that `oj-cli` could access OnlineJudge service successfully. After entering your username and password. `oj-cli` will respond if you login successfully or not.
### Usage
#### Usage
No argument required. Only enter `oj login` and fill the account information to login to OnlineJudge.
### Example
#### Example
```
$ oj login
Usernme:
Password:
```

### `oj get_assign <assign_no>`
### About
Use `oj get_assign <assign_no>` to download the latest assignment from contest. The downloaded files are stored in folder `hwX` or `exX`. The folder includes testing data, output data, and template C script, which are named as `1.in`, `1.out`, and `hwX.c`(or `exX.c`) separately.
### Usage
`oj get_assign` only required one argument to execute.
#### assign_no
assign_no represents your assign number like `hw1`, `ex1`, etc. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened.
### oj get <assign_no>
#### About
Use `oj get <assign_no>` to download the latest assignment from contest. The downloaded files are stored in folder `hwX`. The folder includes testing data, output data, and template C script, which are named as `1.in`, `1.out`, and `main.c` separately.
#### Usage
`oj get` only required one argument to execute.
##### assign_no
assign_no represents your assign number like `hw1`, `hw2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened and give valid assign numbers.

### Example
#### Example
```
$ oj get_assign hw2
$ oj get_assign ex3
$ oj get hw1
Made a [hw1] folder in your current directory.
```

### oj get_p <problem_no>
#### About
Use `oj get_p <problem_no>` to download the problem in problem list. The downloaded files are stored in folder `problem_X`. The folder includes testing data, output data, and template C script, which are named as `1.in`, `1.out`, and `main.c` separately.
#### Usage
`oj get_p` only required one argument to execute.
##### problem_no
problem_no represents your problem display id like `1`, `57-2` according to your updates. `oj-cli` will prompt `Invalid Problem Id!` if the input problem id is invalid.
##### Notice
problem_no somtimes has blanks, cli will automatically replace them.
#### Example
```
$ oj get_p 57-2
Made a [problem_57-2] folder in your current directory.
```

### `oj submit <assign_no> <code_file>`
### About
Use `oj submit <assign_no> <code_file>` to submit your code to contest.
### oj submit <assign_no> <code_file>
#### About
Use `oj submit <assign_no> <code_file>` to submit your code to contest and return the results.

### Usage
`oj get_assign` required two arguments to execute.
#### Usage
`oj submit` required two arguments to execute.

#### assign_no
assign_no represents your assign number like `hw1`, `ex1`, etc. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened.
##### assign_no
assign_no represents your assign number like `hw1`, `hw2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened and give valid assign numbers.

#### code_file
##### code_file
code_file is the path to your script. `oj` will read the file then submit this answer to OnlineJudge Service.

#### Example
```
$ oj submit hw2 hw2.c
$ oj submit ex3 ../ex3.c
Submit successfully!
Getting submission status...
=================================================
Result: AC(Accept) Score: 100
|ID |Status | Time| Mem| Score|
|#1 |AC(Accept) | 0ms| 2MB| 20|
|#2 |AC(Accept) | 2ms| 2MB| 20|
|#3 |AC(Accept) | 40ms| 2MB| 20|
|#4 |AC(Accept) | 75ms| 2MB| 20|
|#5 |AC(Accept) | 5ms| 2MB| 20|
=================================================
```


### oj submit_p <problem_no> <code_file>
#### About
Use `oj submit_p <problem_no> <code_file>` to submit your code to problem and return the results.

#### Usage
`oj submit_p` required three arguments to execute.

##### problem_no
assign_no represents your assign number like `1`, `2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number soes not exist.

Notice that blanks in `problem_no` will be replaced by nothing.

##### code_file
code_file is the path to your script. `oj` will read the file then submit this answer to OnlineJudge Service.

#### Example
```
$ oj problem_submit 1091CP1_Exercise8 ex8.c
Submit successfully!!
Getting submission status...
========================================================
Result: AC(Accept) Score: 100
|ID |Status | Time| Mem| Score|
|#1 |AC(Accept) | 1ms| 2MB| 20|
|#2 |AC(Accept) | 1ms| 2MB| 20|
|#3 |AC(Accept) | 1ms| 2MB| 20|
|#4 |AC(Accept) | 2ms| 2MB| 20|
|#5 |AC(Accept) | 1ms| 2MB| 20|
========================================================

```


### oj rank <assign_no>
#### About
Use `oj rank <assign_no>` to view the class result of this assign.
#### Usage
`oj rank` only required one argument to execute.
#### assign_no
assign_no represents your assign number like `hw1`, `hw2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened and give valid assign numbers.

#### Example
```
$ oj rank hw2
Your status of hw2 : AC(Accept)
================================================
1~ 10 : 0 | AC(Accept) : 8
11~ 20 : 0 | RE(Runtime Error) : 29
21~ 30 : 0 | PAC(Partial Accepted) : 54
31~ 40 : 1 | WA(Wrong Answer) : 81
41~ 50 : 0 | CE(Compilation Error) : 10
51~ 60 : 0 |--------------------------------
61~ 70 : 0 | Total submissions : 182
71~ 80 : 0 |
81~ 90 : 0 |
91~100 : 12 |
================================================
For real score ranking,please go to the website.
```


### oj update
#### About
Use `oj update` to get the latest assignments.
#### Usage
No argument required. Only enter `oj update` and it will automatically get the assignments.

#### Example
```
$ oj update
Target Contest: 1101CP1
Found HomeWork: hw0 [Online Submission]
```

### oj update_p
#### About
Use `oj update_p` to get the latest assignments.
#### Usage
No argument required. Only enter `oj update_p` and it will automatically get the problems.

#### Example
```
$ oj update_p
Updated problems successfully!
```


### oj status <assign_no>
#### About
Use `oj status <assign_no>` to view the latest 20 submissions of this contest.
#### Usage
`oj status` only required one argument to execute.
##### assign_no
assign_no represents your assign number like `hw1`, `hw2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened and give valid assign numbers.

#### Example
```
$ oj status hw2
============================================================================
| Contest Name: hw2 |
============================================================================
|User |Status | Time| Mem| When|
|108xxxxxx |WA(Wrong Answer) | 0ms| 2MB|2020-12-18 10:31:12|
|109xxxxxx |AC(Accept) | 0ms| 2MB|2020-12-18 10:07:14|
|109xxxxxx |PAC(Partial Accepted) | 0ms| 2MB|2020-12-18 09:20:10|
|109xxxxxx |PAC(Partial Accepted) | 21ms| 2MB|2020-12-18 09:20:02|
|109xxxxxx |PAC(Partial Accepted) | 17ms| 2MB|2020-12-18 09:07:19|
|109xxxxxx |PAC(Partial Accepted) | 1ms| 4MB|2020-12-18 08:50:13|
============================================================================
...
```

### oj mystat <option>
#### About
Use `oj mystat <option>` to view your latest 20 submissions of this contest, each of the submission has the specific ID.
#### Usage
`oj mystat` only required one argument to execute.
##### option
Here we have two options:
1. assign_no represents your assign number like `hw1`, `hw2` according to your updates. `oj-cli` will prompt `Invalid Assign Number!` if the input assign number has not opened and give valid assign numbers.
2. IDx is the specific ID that `oj mystat <hwx>` gives you, here you can see details of this submition.
#### Note
The ID will only update if you type `oj mystat <hwx>`

#### Example
```
$ oj mystat hw1
====================================================================
| Contest Name: hw1 |
====================================================================
|ID |Status | Time| Mem| When|
|ID 0|AC(Accept) | 0ms| 2MB|2020-12-17 10:39:13|
====================================================================

$ oj mystat ID4
=================================================
Result: PAC(Partial Accepted) Score: 20
|ID |Status | Time| Mem| Score|
|#1 |AC(Accept) | 1ms| 2MB| 20|
|#2 |WA(Wrong Answer) | 2ms| 2MB| 0|
|#3 |WA(Wrong Answer) | 28ms| 2MB| 0|
|#4 |WA(Wrong Answer) | 48ms| 2MB| 0|
|#5 |WA(Wrong Answer) | 5ms| 2MB| 0|
=================================================
```

### oj dl <ID>
#### About
Use `oj dl <ID>` to download your specific submission's source code.
#### Usage
`oj dl` only required one argument to execute.
#### option
ID is the specific ID that `oj mystat <hwx>` gives you, here you can see details of this submition.
#### Note
The ID will only update if you type `oj mystat <hwx>`

#### Example
```
$ oj dl ID0
=================================================
Result: AC(Accept) Score: 100
|ID |Status | Time| Mem| Score|
|#1 |AC(Accept) | 0ms| 2MB| 20|
|#2 |AC(Accept) | 2ms| 2MB| 20|
|#3 |AC(Accept) | 40ms| 2MB| 20|
|#4 |AC(Accept) | 75ms| 2MB| 20|
|#5 |AC(Accept) | 5ms| 2MB| 20|
=================================================
Downloaded your file!!!
File name:1097030xx|xxxxxxxxxxxxxxxxxxxxxxx.c in yor current directory.
```


72 changes: 0 additions & 72 deletions assign_mapping.json

This file was deleted.

9 changes: 7 additions & 2 deletions commands/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
from .login import auth
from .status import status
from .submit import submit

__all__ = ["auth", "get_assign", "submit", "get_problem", "status"]
from .update_contest import update_contest_map
from .update_problem import update_problem_map
from .contest import contests_result, contests_status, my_contests_status
from .download import dl
from .problem import problem_submit
from .grade import get_grades
__all__ = ["auth", "get_assign", "submit", "get_problem", "status","update_contest_map","update_problem_map","contests_result", "contests_status", "my_contests_status", "dl", "problem_submit", "get_grades"]
Loading