tatamo / atcoder-cli Goto Github PK
View Code? Open in Web Editor NEWAtCoder command line tools
Home Page: https://www.npmjs.com/package/atcoder-cli
License: BSD 3-Clause "New" or "Revised" License
AtCoder command line tools
Home Page: https://www.npmjs.com/package/atcoder-cli
License: BSD 3-Clause "New" or "Revised" License
素晴らしいツールの開発・メンテナンスありがとうございます。
本格的にatcoderがんばろうと、数ヶ月前に使い始めて便利に利用させていただいております。
普段と異なるネットワーク環境で利用の際、acc loginができなくなることがありました。
具体的には
http_proxyとhttps_proxyにはhttp://{username}:password}@{address}:portが設定されており、
curlで https://atcoder.jp/ に正常に接続できる状態で、acc loginを行ったところ下記のエラーとなりました。
(node:18257) UnhandledPromiseRejectionWarning: Error: Request failed with status code 301
at createError (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/createError.js:16:15)
at settle (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:18257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
何か他の環境変数を設定して渡してあげなければならないなどありますでしょうか?
初めてIssuesを起票しましたので、適切でない点があれば合わせてご教授いただけますと幸いです。
yargs looks like a better alternative to commander.
It supports nested-subcommands better.
http://tatamo.81.la/blog/2018/12/07/atcoder-cli-tutorial/ のデフォルト動作の説明のページのacc cnfig -hはacc config -hではないでしょうか? それと素晴らしいツールありがとうございます!まさに探していたツールです
acc new -d
default-new-contest-cmd
in acc config -h
npm install -g atcoder-cli
shows warnings.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
とても便利なツールを開発・公開してくださりありがとうございます。
さて、表題の件ですが、 acc submit
を実行すると
[WARNING] the problem "https://atcoder.jp/contests/abc101/tasks/abc101_b" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
Are you sure? Please type "abcb"
のようになり、 abcb
などとタイプしないと提出できないのがわずかにですがわずらわしいです。
この件についてこちらに投稿することが適切でなければ申し訳ありませんが、これは online-judge-tools との依存関係に由来する仕様との理解でよろしいでしょうか。
online-judge-tools では ~/.cache/online-judge-tools/download-history.jsonl に該当するダウンロード履歴が記録されていないとこの警告が出る模様です。
そして oj/onlinejudge_command/subcommand/download.py の 134 行目で
などとあって、 oj
コマンドの呼び出し書式がデフォルトの場合にダウンロード履歴を記録する仕様のようです。
実際、初心者でよくわからないなりにコードを拝見し、
atcoder-cli/src/project.ts 194 行目
Line 194 in f385e71
を
await OnlineJudge.call(["dl", task.url]);
と改変し手元の環境でビルドしなおして実行してみたところ、上記の警告はなくなり [y/N]
というプロンプトになりました。
しかし、このように修正してしまうとサンプル ケースを配置するディレクトリ名を変更できなくなるので、やはり本件は仕様ということでしょうか。
お時間に余裕のあるときにでも作者様のご意見をいただければ幸いです。
以上、よろしくお願いいたします。
import request from "request"
takes over 140ms.
It would be better to use axios
(or another) instead of request
.
Templateのオプションのひとつであるsubmitコマンドがformatを解釈しない問題が発生しています。
具体的には次のような状況にてエラーが発生します。
$ acc new abc001; cd abc001/a; tree .
########################################
# atcoder-cli/online-judge-tools outputs
########################################
.
|-- a.py
`-- test
|-- sample-1.in
|-- sample-1.out
|-- sample-2.in
|-- sample-2.out
|-- sample-3.in
`-- sample-3.out
$ acc s
submit to: https://atcoder.jp/contests/abc001/tasks/abc001_1
[INFO] online-judge-tools 11.1.3 (+ online-judge-api-client 10.8.0)
[INFO] problem recognized: AtCoderProblem.from_url('https://atcoder.jp/contests/abc001/tasks/abc001_1'): https://atcoder.jp/contests/abc001/tasks/abc001_1
[ERROR] [Errno 2] No such file or directory: '{tasklabel}.py'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/main.py", line 280, in main
run_program(parsed, parser=parser)
File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/main.py", line 250, in run_program
submit(args)
File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/subcommand/submit.py", line 42, in submit
with args.file.open('rb') as fh:
File "/usr/lib/python3.8/pathlib.py", line 1218, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "/usr/lib/python3.8/pathlib.py", line 1074, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '{tasklabel}.py'
template.json
やonline-judge-tools
・atcoder-cli
のバージョンは以下の通りです。
{
"task": {
"program": [["main.py", "{tasklabel}.py"]],
"submit": "{tasklabel}.py"
}
}
$ oj --version; acc --version
online-judge-tools 11.1.3 (+ online-judge-api-client 10.8.0)
2.1.0
どこかに間違っている設定があるのでしょうか。
kmyk/online-judge-template-generator というのを開発しています。online-judge-tools/oj#687 で議論していたやつです。kyuridenamida/atcoder-tools のテンプレート生成機能だけを抜き出して再実装した感じです。
atcoder-cli との相性はそれほど良くはなさそうな感じはありますが、機能としては直交しているし組み合わせるとうれしいものであるはずなので、とりあえず提案しておきます。連携を検討してみてください。
ログイン結果の出力
console.log(await atcoder.login() ? "OK" : "login failed");
等の出力は
成功時も失敗時も同じく標準出力console.log
が使用されていますが、
すでにログインしている場合の表示
console.error("you logged-in already");
のように、失敗時は標準エラー出力である、console.error
を利用していただきたいです。
I'd like to set default-contest-dirname-format
, default-task-dirname-format
, and default-test-dirname-format
options to be deprecated.
These options should be configured in template.json.
Reproduce: npm test
I'm sorry but I can't understand how to set default language PyPy3.
Would you tell me how to set this?
$ acc task abc100 abc100_a
A Happy Birthday! https://atcoder.jp/contests/abc100/tasks/abc100_a
$ acc task --id abc100 abc100_a
abc100_a A Happy Birthday! https://atcoder.jp/contests/abc100/tasks/abc100_a
$ acc task --id abc100 abc100_a
abc100_a
$ acc task --title abc100 abc100_a
Happy Birthday!
$ acc task --url abc100 abc100_a
https://atcoder.jp/contests/abc100/tasks/abc100_a
This causes breaking change, for the --id
option.
先週の beta.atcoder.jp
が atcoder.jp
で置き換わったやつにより壊れてます
$ acc n abc001
Request failed with status code 301
ログイン時エラー等のエラーメッセージを標準エラー出力で出力してほしい。
素晴らしいツールの開発・メンテナンスありがとうございます。1年近く利用させて頂いています。
docker containerでAtCoder用の環境を作り、その中で利用しているのですが、ユーザー名・パスワードを毎回打つのが面倒に感じています。online-judge-toolsのように以下のようなログインオプションがあったら、嬉しく存じます。
$ acc login --help
Usage: index login [options]
login to AtCoder
Options:
-u, --username <username> your username
-p, --password <password> your password
-h, --help output usage information
初めてIssueを書くので、不手際があったらすみません。
本日atcoder-cli
をインストールして使ってみたのですが、どうやら、acc new abc~
で作成されるサンプルケースの名前がtests
になっており、一方online-judge-tools
では test
フォルダに対してチェックを行っているようで、
[WARNING] the problem "https://atcoder.jp/contests/abc190/tasks/abc190_a" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
このように表示されます。
どこか設定等間違っていれば教えていただければ幸いです。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.