Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix of AtCoderContest.from_url() #434

Merged
merged 2 commits into from
Jun 5, 2019
Merged

Conversation

kjnh10
Copy link
Contributor

@kjnh10 kjnh10 commented Jun 5, 2019

For urls like "https://atcoder.jp/contests/abc128/tasks/abc128_a",
AtCoderContest.from_url() returns None.
This commit will fix it.

For urls like "https://atcoder.jp/contests/abc128/tasks/abc128_a",
AtCoderContest.from_url() returns None.
This commit will fix it.
@kjnh10
Copy link
Contributor Author

kjnh10 commented Jun 5, 2019

新形式の方は問題のurlを引数にするとうまく対応出来ていなかったようです。
大した修正ではないですがもしよければマージしてください。

from onlinejudge.service.atcoder import AtCoderProblem, AtCoderContest

con1 = AtCoderContest.from_url("https://kupc2014.contest.atcoder.jp") # -> ok
con2 = AtCoderContest.from_url("https://kupc2014.contest.atcoder.jp/tasks/kupc2014_d") # -> ok
con3 = AtCoderContest.from_url("https://atcoder.jp/contests/abc128") # -> ok
con4 = AtCoderContest.from_url("https://atcoder.jp/contests/abc128/tasks/abc128_a")  # -> fail

print(con1) # <onlinejudge.service.atcoder.AtCoderContest object at 0x7fb89f4d2278>
print(con2) # <onlinejudge.service.atcoder.AtCoderContest object at 0x7fb89e0e9828>
print(con3) # <onlinejudge.service.atcoder.AtCoderContest object at 0x7fb89e0e9908>
print(con4) # None

@kmyk kmyk self-requested a review June 5, 2019 12:59
Copy link
Member

@kmyk kmyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんだか動いてなさそうなので修正お願いします 🙏

onlinejudge/service/atcoder.py Outdated Show resolved Hide resolved
@kmyk
Copy link
Member

kmyk commented Jun 5, 2019

URLの新旧の形式によって挙動に差があるのは明らかに混乱を生むので、このプルリクはマージしたいです。
しかし今のところ AtCoderContest.from_url("https://atcoder.jp/contests/abc128/tasks/abc128_a") のような呼出が何を返すべきかははっきりしていないので、ドキュメントには書かれていない未定義の動作であるという状況は維持するつもりでいます。

@kjnh10
Copy link
Contributor Author

kjnh10 commented Jun 5, 2019

すみません。。.*と$の順番は単純にミスしてました。ありがとうございます。
あまりお作法的なのが分かってないですが問題なければマージしてください。

@kmyk
Copy link
Member

kmyk commented Jun 5, 2019

修正できてることが確認できたのでマージします

@kmyk kmyk merged commit 5c74182 into online-judge-tools:master Jun 5, 2019
@kmyk
Copy link
Member

kmyk commented Jun 5, 2019

@kjnh10 作法的なことに関して、特になにも問題はありませんでした。

一般には、 CONTRIBUTING.md のようなファイルが用意されている場合が多く、もしあればそれに従うとよいです。もちろんなにか問題があってもレビューで指摘されるだけなので、あまり完璧を目指さずにプルリクを投げてしまってもよいと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants