Results of 1 - 10 of about 15 for closing (0.010 sec.)
- contextlib --- with 文コンテキスト用ユーティリティ 13706
- contextlib --- with 文コンテキスト用ユーティリティ ソースコード: Lib/contextlib.py このモジュールは with 文に関わる一般的なタスクのためのユーティリティを提供します。詳しい情報は、 コンテキストマネージャ型 と with文とコンテキストマネージャ を
...することができます。 多くのオブジェクトは with 文での使用をサポートしていますが、コンテキストマネージャではなく、 contextlib.closing で使うための close() メソッドも実装していないリソースを管理する必要が生じることもあります。 リソースを正しく管理するよう保...変更: @asynccontextmanager で作成した非同期コンテキストマネージャをデコレータとして使用できるようになりました。 contextlib. closing ( thing ) ブロックの完了時に thing を close するコンテキストマネージャを返します。これは基本的に以下と等価です: from conte...xtlib import contextmanager @contextmanager def closing ( thing ): try : yield thing finally : thing . close () そして、明示的に page を close する必要なしに、次のように書くことが... - https://man.mtool.work/python/3.14/library/contextlib.html
- タイマーファイル記述子 HOWTO 11686
- タイマーファイル記述子 HOWTO リリース : 1.13 この HOWTO では、Linux のタイマーファイル記述子を Python で使う方法を説明します。 使用例 次の例は、タイマーファイル記述子を使って 1 秒に 2 回関数を実行する方法を示します。 # 実用的なスクリプトでは
...is_active = False else : print ( f "Unknown command: { cmd } " ) else : # これ以上データがないので接続を閉じる print ( f "Closing connection { fd } " ) ep . unregister ( conn ) conn . close () conn = None elif fd in fds : print ( f "Reading timer { fd...ver" ) is_active = False else : print ( f "Unknown command: { cmd } " ) else : # No more data, close connection print ( f "Closing connection { fd } " ) select_fds . remove ( conn ) conn . close () conn = None elif fd in fds : print ( f "Reading timer {... - https://man.mtool.work/python/3.14/howto/timerfd.html
- 変更履歴 9665
- 変更履歴 次の Python バージョン リリース日: XXXX-XX-XX セキュリティ gh-160499 : Fix unbounded memory growth in asyncio TLS connections when a peer stops reading but keeps sending records that make OpenSSL generate its own replies (such as T
...Previously it sent uri="" , which servers could reject. Patch by Senthil Kumaran. gh-109564 : Fix a race in asyncio where closing a server after it accepted a connection, but before the connection's transport was created, reported an AssertionError to...ces in f-strings and t-strings. The SyntaxError now points at the literal part that contains the escape, instead of at the closing quote. gh-160268 : Fix a crash in tokenize when a mismatched closing bracket follows the opening brace of an f-string or t...SL transports not applying ssl_shutdown_timeout when the peer has sent EOF but does not read the data still queued for it. Closing such a connection could wait indefinitely; it is now aborted with TimeoutError once the timeout expires. gh-160326 : Raise... - https://man.mtool.work/python/3.14/whatsnew/changelog.html
- 低水準の API インデックス 8673
- 低水準の API インデックス このページでは低水準の asyncio API を全てリストしています。 イベントループの取得 asyncio.get_running_loop() 実行中のイベントループを取得するために 利用が推奨される 関数です。 asyncio.get_event_loop() 実行中のイベン
...ンスポート 全てのトランスポートは以下のメソッドを実装します: transport.close() トランスポートをクローズします。 transport.is_closing() トランスポートを閉じている最中か閉じていた場合 True を返します。 transport.get_extra_info() トランスポートについての情報... - https://man.mtool.work/python/3.14/library/asyncio-llapi-index.html
- selectors --- 高水準の I/O 多重化 8673
- selectors --- 高水準の I/O 多重化 Added in version 3.4. ソースコード: Lib/selectors.py はじめに このモジュールにより、 select モジュールプリミティブに基づく高水準かつ効率的な I/O の多重化が行えます。OS 水準のプリミティブを使用した正確な制御
...if data : print ( 'echoing' , repr ( data ), 'to' , conn ) conn . send ( data ) # ブロックしないことを期待 else : print ( 'closing' , conn ) sel . unregister ( conn ) conn . close () sock = socket . socket () sock . bind (( 'localhost' , 1234 )) sock .... - https://man.mtool.work/python/3.14/library/selectors.html
- What's New in Python 2.5 8673
- What's New in Python 2.5 著者 : A.M. Kuchling この記事では Python 2.5 の新機能を説明します。 Python 2.5 の最終リリースは 2006 年 8 月に予定されており、 PEP 356 にリリース計画が記載されています。 Python 2.5 は 2006 年 9 月 19 日にリリースされ
...ます: lock = threading . Lock () with nested ( db_transaction ( db ), lock ) as ( cursor , locked ): ... 最後になりますが、 closing(object) 関数は object をそのまま返して変数に束縛出来るようにし、かつブロックの終了で、与えた引数が持つ object.close を呼び...出します: import urllib , sys from contextlib import closing with closing ( urllib . urlopen ( 'http://www.yahoo.com' )) as f : for line in f : sys . stdout . write ( line ) 参考 PEP... - https://man.mtool.work/python/3.14/whatsnew/2.5.html
- asyncio での開発 8168
- asyncio での開発 非同期プログラミングは、従来の「逐次的」なプログラミングとは異なります。 このページはよくある間違いや落とし穴を列挙し、それらを回避する方法を説明します。 デバッグモード asyncio はデフォルトで本運用モードで実行されます。いっ
...末が行われることがあります。 これを避けるには、 aclose() メソッドを呼び出して明示的にジェネレーターを閉じるか、 contextlib.aclosing() コンテキストマネージャーを使ってください。 import asyncio import contextlib async def gen (): yield 1 yield 2 async def...func (): async with contextlib . aclosing ( gen ()) as g : async for x in g : break # 最後までイテレーションしない asyncio . run ( func ()) 前述のとおり、これらの非...例は、 cursor と rows の非同期ジェネレーターを明示的に閉じることで修正できます。 async def main (): async with contextlib . aclosing ( cursor ()) as cursor_gen : async for c in cursor_gen : async with contextlib . aclosing ( rows ()) as rows_gen : async f... - https://man.mtool.work/python/3.14/library/asyncio-dev.html
- ストリーム 8168
- ストリーム ソースコード: Lib/asyncio/streams.py ストリームはネットワークコネクションと合わせて動作する高水準の async/await 可能な基本要素です。ストリームはコールバックや低水準のプロトコルやトランスポートを使うことなくデータを送受信することを
...sslcontext.check_hostname が True で、 server_hostname が指定されていない場合に ValueError を送出するようになりました。 is_closing ( ) ストリームがクローズされたか、またはクローズ処理中の場合に True を返します。 Added in version 3.7. async wait_closed (... - https://man.mtool.work/python/3.14/library/asyncio-stream.html
- sqlite3 --- SQLite データベース用の DB-API 2.0 インターフェース 8168
- sqlite3 --- SQLite データベース用の DB-API 2.0 インターフェース ソースコード: Lib/sqlite3/ SQLite は、軽量なディスク上のデータベースを提供する C ライブラリです。別のサーバプロセスを用意する必要なく、 SQL クエリー言語の非標準的な一種を使用し
...も行いません。 注釈 The context manager neither implicitly opens a new transaction nor closes the connection. If you need a closing context manager, consider using contextlib.closing() . con = sqlite3 . connect ( ":memory:" ) con . execute ( "CREATE TABL... - https://man.mtool.work/python/3.14/library/sqlite3.html
- What's New in Python 2.6 8168
- What's New in Python 2.6 著者 : A.M. Kuchling (amk at amk.ca) この記事では、2008 年 10 月 1 日にリリースされた Python 2.6 の新機能を説明します。 リリース日程は PEP 361 に記載されています。 Python 2.6 の主要なテーマは、言語を大幅に再設計する
...けています: lock = threading . Lock () with nested ( db_transaction ( db ), lock ) as ( cursor , locked ): ... Finally, the closing() function returns its argument so that it can be bound to a variable, and calls the argument's .close() method at the end...of the block. import urllib , sys from contextlib import closing with closing ( urllib . urlopen ( 'http://www.yahoo.com' )) as f : for line in f : sys . stdout . write ( line ) 参考 PEP... - https://man.mtool.work/python/3.14/whatsnew/2.6.html