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

#403: add a feature to download MatchOverview of Topcoder Marathon Match #406

Merged
merged 5 commits into from
Mar 30, 2019

Conversation

kmyk
Copy link
Member

@kmyk kmyk commented Mar 29, 2019

close #403

かなりそのままな形で実装しました。
cr rd のような妙な名前は Topcoder 側のしている省略に合わせています。
型名がすごく長いですが、短くするよりましだと思ったのでこうなってます。

@kmyk kmyk added this to the v6.2.0 milestone Mar 29, 2019
@kmyk kmyk requested a review from fukatani March 29, 2019 21:56
submissions += [TopcoderLongContestProblemIndividualResultsFeedSubmission(number, score, language, time)]
testcases = [] # type: List[TopcoderLongContestProblemIndividualResultsFeedTestCase]
for testcase in list(root)[4]:
test_case_id = int(list(testcase)[0].text or '')
Copy link
Contributor

Choose a reason for hiding this comment

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

この(or '')ってなんでしょう?int('')だと例外発生します。

Copy link
Member Author

Choose a reason for hiding this comment

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

mypy を黙らせるための処理です。例外はむしろ発生するのが適切です。
ちょっと上で次のようにコメントしてるのと同じものです。

選択肢はいくつかありますが、まず # type: ignore を付けると行全体が無効化されてしまうのでだめ、次に

x = list(testcase)[0]
if x is None:
    raise RuntimeError
test_case_id = int(x)

は長すぎてこれもだめ。
次のような関数を定義することもできますが、

def unwrap(s: Optional[str]) -> str:

これを定義するのと次のようにコメントで示すのはあまり差がないと思ったのですが、そうではなかったですか?

https://github.com/kmyk/online-judge-tools/blob/1b68404eb89cc0b7d80cd1ce1f19f7348cf0187d/onlinejudge/service/topcoder.py#L311

@fukatani fukatani assigned kmyk and unassigned fukatani Mar 30, 2019
@kmyk kmyk assigned fukatani and unassigned kmyk Mar 30, 2019
@kmyk
Copy link
Member Author

kmyk commented Mar 30, 2019

きれいに解決できる方法を見付けたのでそうしました

Copy link
Contributor

@fukatani fukatani left a comment

Choose a reason for hiding this comment

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

LGTM

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.

a feature to download MatchOverview of Topcoder Marathon Match
2 participants