-
Notifications
You must be signed in to change notification settings - Fork 1
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
型アノテーションを付けた #277
型アノテーションを付けた #277
Conversation
今型アノテーションを付けたりOptionalな型に対してガードを付けたりしています @n4o847 DiaPlanner.pyの50行目から始まるダイヤの設定に対して型の不一致が起こっています。 |
行き違ってしまいましたが、#279 を立てているのでそちらをマージしてもらえれば大丈夫だと思います |
あ!気づいていませんでした!取り込みます。 |
なかなかに破壊的な変更が含まれていると思いますが、正直この辺のアルゴリズムは @thgcMtdh の担当で、これで正常に動くかどうかは僕だけじゃ保証できないんですよね…… |
全然大丈夫ライン
まあ大丈夫ライン
怪しいライン
とかなんですけど、ちょっとチェックに気合が必要なので、時間かかりそう…… |
めちゃくちゃ重い変更を投げている自覚があるのでレビューはゆっくりで全然問題ありません! もしチェックに時間がかかる かつ 型のチェッカー導入にコストが見合わないと考える のであれば型チェックをCiから外すこともありだと考えています。(とりあえずflake8の静的解析だけ導入する) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ATOで若干ロジック修正、あとは軽微なコメント等をつけてコミットしました。マージして大丈夫だと思われます
backend/auto_operation/ATO.py
Outdated
train.currentSection.id == testSection.id | ||
and train.mileage >= testSection.stationPosition | ||
): | ||
if train.mileage >= testSection.stationPosition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
train.currentSection.id==testsection.id に対応する条件が消えてる?
backend/auto_operation/ATO.py
Outdated
if testSection.station != None: | ||
if testSection is None: | ||
# FIXME; 型ガードのために適当な値を返している | ||
return 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここは return 0.0 でよさそう(train.currentSection が取れないのはやばいので、停止距離0.0で停止した方がよい)
train = self.__state.getTrainInSection(junction.getOutSection()) # 前方セクションにいる列車を取得 | ||
if train == None: # 前方セクションに在線なし | ||
in_section = junction.getInSection() | ||
out_section = junction.getOutSection() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snake_case と camelCase だけ修正
これを現行のmainと結合するのがきわめて破壊的作業なのか(型アノテーションによる変更と、停止指示を速度指令からストップレールに変えたことによるロジック変更が混ざったconflictが生じる)、とりあえず atuo_operation 部分については責任もって conflict 解消を試みます。 |
そもそも、 |
@thgcMtdh レビュー & conflict 解決ありがとう!!
たしかに、設計としてはその方が正しそう WSL 環境なら sudo apt install make
pip -r requirements.dev.txt して、push する前に make format # 自動整形
make staticcheck # 静的解析
make typecheck # 型チェック などすると上記3つがローカルで試せます |
1回閉じましょうかね。諸々会場の実機で確認すべき点を優先したく考えています。 |
そうですね〜 他グループのリポジトリにコードを入れる以上、負の遺産になってしまわないようにコードを綺麗にしたいという気持ちはやまやまなのですが、現状を鑑みてそれ以外の箇所がヤバいので…… 調布祭の後でもコード整備のお手伝いはしますので、これは一旦 close でいいかもしれません |
破壊します |
Close #276
型アノテーションを付けました。ついでにflake8に沿ったコードに修正
チェックに通るように機械的に行ったので間違っている可能性が大いにあります。どんどん指摘してください