-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f623974
commit 49dc9ff
Showing
513 changed files
with
132,349 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cover 97% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
application-import-names = dmoj,judge,django_ace,event_socket_server | ||
import-order-style = pycharm | ||
enable-extensions = G | ||
ignore = | ||
W504, # line break occurred after a binary operator | ||
# allow only generator_stop and annotations future imports | ||
FI10,FI11,FI12,FI13,FI14,FI15,FI16,FI17,FI18,FI55,FI58, | ||
C814, # missing trailing comma in Python 2 only | ||
per-file-ignores = | ||
# F401: unused imports, ignore in all __init__.py | ||
# F403: import * | ||
./*/__init__.py:F401,F403 | ||
# F405: name comes from import * | ||
./event_socket_server/__init__.py:F401,F403,F405 | ||
./judge/management/commands/runmoss.py:F403,F405 | ||
# E501: line too long, ignore in migrations | ||
./judge/migrations/*.py:E501 | ||
# E303: too many blank lines | ||
# PyCharm likes to have double lines between class/def in an if statement. | ||
./judge/widgets/pagedown.py:E303 | ||
exclude = | ||
./dmoj/local_settings.py, # belongs to the user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: build | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Install flake8 | ||
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 --version | ||
flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: compilemessages | ||
on: | ||
push: | ||
paths: | ||
- 'locale/**' | ||
pull_request: | ||
paths: | ||
- 'locale/**' | ||
jobs: | ||
compilemessages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Checkout submodules | ||
run: | | ||
git submodule init | ||
git submodule update | ||
- name: Install requirements | ||
run: | | ||
sudo apt-get install gettext | ||
pip install -r requirements.txt | ||
pip install pymysql | ||
- name: Check .po file validity | ||
run: | | ||
fail=0 | ||
while read -r file; do | ||
if ! msgfmt --check-format "$file"; then | ||
fail=$((fail + 1)) | ||
fi | ||
done < <(find locale -name '*.po') | ||
exit "$fail" | ||
shell: bash | ||
- name: Compile messages | ||
run: | | ||
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py | ||
python manage.py compilemessages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: makemessages | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
makemessages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Checkout submodules | ||
run: | | ||
git submodule init | ||
git submodule update | ||
- name: Install requirements | ||
run: | | ||
sudo apt-get install gettext | ||
curl -O https://artifacts.crowdin.com/repo/deb/crowdin.deb | ||
sudo dpkg -i crowdin.deb | ||
pip install -r requirements.txt | ||
pip install pymysql | ||
- name: Collect localizable strings | ||
run: | | ||
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py | ||
python manage.py makemessages -l en -e py,html,txt | ||
python manage.py makemessages -l en -d djangojs | ||
- name: Upload strings to Crowdin | ||
env: | ||
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | ||
run: | | ||
cat > crowdin.yaml <<EOF | ||
project_identifier: dmoj | ||
files: | ||
- source: /locale/en/LC_MESSAGES/django.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/django.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
sr-CS: sr_Latn | ||
- source: /locale/en/LC_MESSAGES/djangojs.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/djangojs.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
sr-CS: sr_Latn | ||
EOF | ||
echo "api_key: ${CROWDIN_API_TOKEN}" >> crowdin.yaml | ||
crowdin upload sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: updatemessages | ||
on: | ||
schedule: | ||
- cron: '0 * * * *' | ||
jobs: | ||
updatemessages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Checkout submodules | ||
run: | | ||
git submodule init | ||
git submodule update | ||
- name: Install requirements | ||
run: | | ||
sudo apt-get install gettext | ||
curl -O https://artifacts.crowdin.com/repo/deb/crowdin.deb | ||
sudo dpkg -i crowdin.deb | ||
pip install -r requirements.txt | ||
pip install pymysql | ||
- name: Download strings from Crowdin | ||
env: | ||
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | ||
run: | | ||
cat > crowdin.yaml <<EOF | ||
project_identifier: dmoj | ||
files: | ||
- source: /locale/en/LC_MESSAGES/django.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/django.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
zh-TW: zh_Hant | ||
sr-CS: sr_Latn | ||
- source: /locale/en/LC_MESSAGES/djangojs.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/djangojs.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
zh-TW: zh_Hant | ||
sr-CS: sr_Latn | ||
EOF | ||
echo "api_key: ${CROWDIN_API_TOKEN}" >> crowdin.yaml | ||
crowdin download | ||
rm crowdin.yaml | ||
- name: Cleanup | ||
run: | | ||
rm -rf src/ | ||
git add locale | ||
git checkout . | ||
git clean -fd | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v1.4.1-multi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
COMMIT_MESSAGE: 'i18n: update translations from Crowdin' | ||
PULL_REQUEST_TITLE: 'Update translations from Crowdin' | ||
PULL_REQUEST_BODY: This PR has been auto-generated to pull in latest translations from [Crowdin](https://translate.dmoj.ca). | ||
PULL_REQUEST_LABELS: i18n, enhancement | ||
PULL_REQUEST_REVIEWERS: Xyene, quantum5 | ||
PULL_REQUEST_BRANCH: update-i18n | ||
BRANCH_SUFFIX: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,13 @@ | ||
# History files | ||
.Rhistory | ||
.Rapp.history | ||
|
||
# Session Data files | ||
.RData | ||
|
||
# User-specific files | ||
.Ruserdata | ||
|
||
# Example code in package build process | ||
*-Ex.R | ||
|
||
# Output files from R CMD build | ||
/*.tar.gz | ||
|
||
# Output files from R CMD check | ||
/*.Rcheck/ | ||
|
||
# RStudio files | ||
.Rproj.user/ | ||
|
||
# produced vignettes | ||
vignettes/*.html | ||
vignettes/*.pdf | ||
|
||
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 | ||
.httr-oauth | ||
|
||
# knitr and R markdown default cache directories | ||
*_cache/ | ||
/cache/ | ||
|
||
# Temporary files created by R markdown | ||
*.utf8.md | ||
*.knit.md | ||
|
||
# R Environment Variables | ||
.Renviron | ||
.idea | ||
.vscode | ||
.sass-cache | ||
*.sqlite3 | ||
*.py[co] | ||
*.mo | ||
*~ | ||
dmoj/local_settings.py | ||
resources/style.css | ||
resources/content-description.css | ||
resources/ranks.css | ||
resources/table.css | ||
sass_processed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[submodule "resources/pagedown"] | ||
path = resources/pagedown | ||
url = https://github.com/DMOJ/dmoj-pagedown.git | ||
branch = master | ||
[submodule "resources/libs"] | ||
path = resources/libs | ||
url = https://github.com/DMOJ/site-assets.git | ||
branch = master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>502 bad gateway - DMOJ</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<style type="text/css"> | ||
hr { | ||
margin: 0 22em; | ||
} | ||
|
||
body { | ||
background: #f5f5f5; | ||
padding-top: 3em; | ||
} | ||
|
||
.popup { | ||
width: 30%; | ||
display: table; | ||
text-align: center; | ||
margin: 0px auto; | ||
border: 3px solid rgb(41, 128, 185); | ||
border-radius: 30px; | ||
box-shadow: 5px 5px 10px rgb(85, 85, 85); | ||
} | ||
|
||
.display { | ||
position: fixed; | ||
text-align: center; | ||
width: 100%; | ||
} | ||
|
||
.logo { | ||
top: 25%; | ||
width: 115px; | ||
text-align: center; | ||
padding-top: 1em; | ||
} | ||
|
||
.msg { | ||
font-size: 1.2em; | ||
color: rgb(85, 85, 85); | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="display"> | ||
<hr> | ||
<br> | ||
<div class="popup"> | ||
<div> | ||
<img class="logo" src="/logo.png" alt="DMOJ"> | ||
</div> | ||
<h1 style="width: 100%;">Oops, the DMOJ is down.</h1> | ||
</div> | ||
<br> | ||
<hr> | ||
<br> | ||
<h2 class="msg">But don't worry, we'll be back soon.</h2> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import django | ||
from django.utils.encoding import force_text | ||
|
||
if (2, 2) <= django.VERSION < (3,): | ||
# Django 2.2.x is incompatible with PyMySQL. | ||
# This monkey patch backports the Django 3.0+ code. | ||
|
||
from django.db.backends.mysql.operations import DatabaseOperations | ||
|
||
def last_executed_query(self, cursor, sql, params): | ||
# With MySQLdb, cursor objects have an (undocumented) "_executed" | ||
# attribute where the exact query sent to the database is saved. | ||
# See MySQLdb/cursors.py in the source distribution. | ||
# MySQLdb returns string, PyMySQL bytes. | ||
return force_text(getattr(cursor, '_executed', None), errors='replace') | ||
|
||
DatabaseOperations.last_executed_query = last_executed_query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
Django-ace originally from https://github.com/bradleyayers/django-ace. | ||
""" | ||
|
||
from .widgets import AceWidget |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.