Skip to main content

Simple python script converting polygon package to domjudge(kattis) package

Project description

Polygon2DOMjudge

中文

What is this

It is a simple python script converting polygon package to domjudge(kattis) package.

CLI Example

# Unzip your polygon-package to /path/to/polygon-package first
$ ./bin/p2d --code A --color FF0000 -o /path/to/domjudge-package /path/to/polygon-package

Run this command to make a package from /path/to/polygon-package to /path/to/domjudge-package.zip and set probcode and color.

Config

In config.json, you can change some special checker's validator's flag or add some checker configs manually.

You can use --default to force use the default output validator, and add some flags by command line.

You can use --auto to use the default output validator if the checker is defined in config and can be replaced by the default one.

You can use --memory_limit to override the memory limit for domjudge package, default is using the memory limit defined in polygon package.

You can use --output_limit to override the output limit for domjudge package, default is using the default output limit in domjudge setting.

Environment Variable

Don't change them unless you know what you are doing.

  • CONFIG_PATH
  • TESTLIB_PATH
  • EXTENTION_FOR_DESC

API Example

import tempfile

from p2d import Polygon2DOMjudge

package_dir = '/path/to/polygon-package'
output_file = '/path/to/domjudge-package.zip'

with tempfile.TemporaryDirectory() as temp_dir:
    try:
        Polygon2DOMjudge(package_dir, temp_dir, output_file).process()
    except Exception as e:
        # do something
        pass

Development

# install
poetry install

# build
poetry build

# run unittest
poetry run pytest

# release
./release.sh ${your version}

Polygon2DOMjudge

这是什么

这是一个简单的将 polygon 题目包转换成 domjudge (kattis) 题目包的 python 脚本。

命令行使用示例

# 首先把你的 polygon-package 解压到 /path/to/polygon-package 位置
$ ./bin/p2d --code A --color FF0000 -o /path/to/domjudge-package /path/to/polygon-package

运行此命令可以从 /path/to/polygon-package 处的转换题目包为 /path/to/domjudge-package.zip,并设置 probcodecolor 属性。

配置

config.json 文件中,你可以设置一些特殊的 checker 的输出校验器参数,并手动添加一些。

你可以在命令行中使用 --default 参数,并添加自定义的参数,来强制使用 DOMJudge 默认的输出校验器。

你可以在命令行中使用 --auto 参数来使用 DOMJudge 默认的输出校验器,如果 checker 在配置文件中被定义,则使用默认的输出校验器替代。

你可以在命令行中使用 --memory_limit 参数来覆盖 DOMJudge 题目包的内存限制,如果不设置,则使用 Polygon 题目包中的内存限制。

你可以在命令行中使用 --output_limit 参数来覆盖 DOMJudge 题目包的输出限制,如果不设置,则使用 DOMJudge 设置中默认的输出限制。

环境变量

某些时候可能会有用。但如果你不知道你在干啥,请不要随便修改。

  • CONFIG_PATH
  • TESTLIB_PATH
  • EXTENTION_FOR_DESC

API 使用示例

import tempfile

from p2d import Polygon2DOMjudge

package_dir = '/path/to/polygon-package'
output_file = '/path/to/domjudge-package.zip'

with tempfile.TemporaryDirectory() as temp_dir:
    try:
        Polygon2DOMjudge(package_dir, temp_dir, output_file).process()
    except Exception as e:
        # do something
        pass

开发

# install
poetry install

# build
poetry build

# run unittest
poetry run pytest

# release
./release.sh ${your version}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

p2d-0.0.5.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

p2d-0.0.5-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file p2d-0.0.5.tar.gz.

File metadata

  • Download URL: p2d-0.0.5.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/23.1.0

File hashes

Hashes for p2d-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3e57fc4eb94bbc108aec8cd154c8872d7dafebd46d3e169d7f878f838419be7b
MD5 b474a71c705a6d0287eda41ee5befd87
BLAKE2b-256 60d9f2939ab46e2b35dd0f782d666ac5dd5d8cd79f20abdc603c98b2f101ea29

See more details on using hashes here.

File details

Details for the file p2d-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: p2d-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 51.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/23.1.0

File hashes

Hashes for p2d-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 27b2b7375058292c85065d4c027206fe7252b7cf59086f123fe7ff7e212bd92e
MD5 5e9426dd4cbedc2d4d12236323b6448e
BLAKE2b-256 a71ef6fc418f0c864381b9c06008f1d635623b397e0166678889658a12518bd7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page