Add `__enter__` and `__exit__` to `lt.Thing`

オープン 初心者向け
#435 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
fastapi, python

調査の方向性

lt.Thingの定義を見つけ、既存のライフサイクルメソッドと近くにあるテストを読んでください。説明に従って空の__enter__メソッドと__exit__メソッドを追加し、関連するテストを実行して、Thingをコンテキストマネージャーとして使用できることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Is your feature request related to a problem? Please describe.
In this MR discussion it was pointed out that having __enter__ and __exit__ defined on lt.Thing would make some downstream code cleaner.

I think the only reason I left this out was in anticipation that (at some point in the future) it might be possible to write an async Thing. That looks increasingly far away, and in any case it would be fine to redefine the synchronous methods to raise an exception if we want to be async.

Describe the solution you'd like
Add (empty) __enter__ and __exit__ methods to lt.Thing.

Additional context
MR Thread

主要言語
Python
スター
10
フォーク
4
平均マージ
4日 15時間
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

labthings/labthings-fastapi のほかの issue

labthings/labthings-fastapi の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。