per page, with , order by , clip by
Results of 1 - 10 of about 55 for order (0.007 sec.)
unittest.mock --- モックオブジェクトライブラリ 16010
unittest.mock --- モックオブジェクトライブラリ Added in version 3.3. ソースコード: Lib/unittest/mock.py unittest.mock は Python でテストを行うためのライブラリです。 テスト対象のシステムの一部をモックオブジェクトに置き換え、どのように使われた ... >>> mock ( 'some' , 'thing' , 'else' ) >>> mock . assert_any_call ( 1 , 2 , arg = 'thing' ) assert_has_calls ( calls , any_order = False ) assert the mock has been called with the specified calls. The mock_calls list is checked for the calls. any_orde ... び出しは連続していなければなりません。指定された呼び出しの前、あるいは呼び出しの後に余分な呼び出しがある場合があります。 any_order が true の場合、呼び出しは任意の順番でも構いませんが、それらがすべて mock_calls に現われなければなりません。 >>> mock = Mo ... k . assert_has_calls ( calls ) >>> calls = [ call ( 4 ), call ( 2 ), call ( 3 )] >>> mock . assert_has_calls ( calls , any_order = True ) assert_not_called ( ) モックが一度も呼ばれなかったことをアサートします。 >>> m = Mock () >>> m . hello . assert_n ...
https://man.mtool.work/python/3.14/library/unittest.mock.html
graphlib --- グラフ構造を操作する機能 10851
graphlib --- グラフ構造を操作する機能 ソースコード: Lib/graphlib.py class graphlib. TopologicalSorter ( graph = None ) ハッシュ可能 な頂点のグラフをトポロジカルソートする機能を提供します。 トポロジカル順序はグラフの頂点の線形順序で、頂点 u ... を呼び出します。 すぐにグラフのノードをソートした結果が必要で、並行性が不要な場合、便利なメソッド TopologicalSorter.static_order() を直接呼び出すことができます: >>> graph = { "D" : { "B" , "C" }, "C" : { "A" }, "B" : { "A" }} >>> ts = TopologicalSorte ... r ( graph ) >>> tuple ( ts . static_order ()) ('A', 'C', 'B', 'D') このクラスは、簡単に準備が整ったノードの並列処理を行えるよう設計されています。例えば: topological ... な限りノードを取得できます。 この関数を呼び出した後はグラフを変更できず、 add() でノードを追加することもできません。 static_order() または get_ready() によってソートが開始されている場合は ValueError を送出します。 バージョン 3.14 で変更: ソートが開始さ ...
https://man.mtool.work/python/3.14/library/graphlib.html
The Python Profilers 10585
The Python Profilers Source code: Lib/profile.py and Lib/pstats.py Introduction to the profilers cProfile and profile provide deterministic profiling of Python programs. A profile is a set of statistics that describes how often and for how ... run re.compile() and print profile results like the following: 214 function calls ( 207 primitive calls ) in 0.002 seconds Ordered by : cumulative time ncalls tottime percall cumtime percall filename : lineno ( function ) 1 0.000 0.000 0.002 0.002 { b ... s were monitored. Of those calls, 207 were primitive , meaning that the call was not induced via recursion. The next line: Ordered by: cumulative time indicates the output is sorted by the cumtime values. The column headings include: ncalls for the nu ... can also be invoked as a script to profile another script. For example: python - m cProfile [ - o output_file ] [ - s sort_order ] ( - m module | myscript . py ) -o <output_file> Writes the profile results to a file instead of to stdout. -s <sort_orde ...
https://man.mtool.work/python/3.14/library/profile.html
バッファプロトコル (buffer Protocol) 9638
バッファプロトコル (buffer Protocol) Pythonで利用可能ないくつかのオブジェクトは、下層にあるメモリ配列または buffer へのアクセスを提供します。このようなオブジェクトとして、組み込みの bytes や bytearray 、 array.array のようないくつかの拡張型 ... エラーの場合は例外を送出し、-1 を返します。 Added in version 3.9. int PyBuffer_IsContiguous ( const Py_buffer * view , char order ) 次に属します: Stable ABI (バージョン 3.11 より). view で定義されているメモリが、 C スタイル ( order == 'C' ) のときか、 ... Fortran スタイル ( order == 'F' ) 連続 のときか、そのいずれか ( order == 'A' ) であれば 1 を返します。 それ以外の場合は 0 を返します。 この関数は常 ... (バージョン 3.11 より). Copy contiguous len bytes from buf to view . fort can be 'C' or 'F' (for C-style or Fortran-style ordering). 0 is returned on success, -1 on error. int PyBuffer_ToContiguous ( void * buf , const Py_buffer * src , Py_ssize_t le ...
https://man.mtool.work/python/3.14/c-api/buffer.html
enum --- 列挙型のサポート 9224
enum --- 列挙型のサポート Added in version 3.4. ソースコード: Lib/enum.py Important このページには、リファレンス情報だけが含まれています。チュートリアルは、以下のページを参照してください 基本チュートリアル 上級チュートリアル Enum クックブッ ... 総数に対して二次的に増大する影響があります。 _name_ メンバーの名前。 _value_ メンバーの値です。 __new__() で設定できます。 _order_ No longer used, kept for backward compatibility. (class attribute, removed during class creation). _order_ 属性を指定する ... くのに役立ちます。 この属性を列挙型の実際の順序と照合し、一致しない場合はエラーを送出します。 >>> class Color ( Enum ): ... _order_ = 'RED GREEN BLUE' ... RED = 1 ... BLUE = 3 ... GREEN = 2 ... Traceback (most recent call last): ... TypeError : member o ... rder does not match _order_: ['RED', 'BLUE', 'GREEN'] ['RED', 'GREEN', 'BLUE'] 注釈 Python 2 では、記録する前に定義の順序が失われるため、 _order_ 属性 ...
https://man.mtool.work/python/3.14/library/enum.html
memoryview オブジェクト 8411
memoryview オブジェクト memoryview オブジェクトは、他のオブジェクトと同じように扱える Python オブジェクトの形をした C 言語レベルの バッファのインターフェース です。 PyTypeObject PyMemoryView_Type 次に属します: Stable ABI . この PyTypeObject ... oryView_FromMemory() のほうが望ましいです。 PyObject * PyMemoryView_GetContiguous ( PyObject * obj , int buffertype , char order ) 戻り値: 新しい参照。 次に属します: Stable ABI . buffer インターフェースを定義しているオブジェクトから ('C' か 'F'ortran ... の order で) 連続した メモリチャンクへの memoryview オブジェクトを作ります。メモリが連続している場合、 memoryview オブジェクトは元の ...
https://man.mtool.work/python/3.14/c-api/memoryview.html
dataclasses --- データクラス 8411
dataclasses --- データクラス ソースコード: Lib/dataclasses.py このモジュールは、 __init__() や __repr__() のような 特殊メソッド を生成し、ユーザー定義のクラスに自動的に追加するデコレーターや関数を提供します。このモジュールは元々、 PEP 557 で ... はありません。 Added in version 3.7. モジュールの内容 @ dataclasses. dataclass ( * , init = True , repr = True , eq = True , order = False , unsafe_hash = False , frozen = False , match_args = True , kw_only = False , slots = False , weakref_slot = Fals ... 使い方は等価です。 @dataclass class C : ... @dataclass () class C : ... @dataclass ( init = True , repr = True , eq = True , order = False , unsafe_hash = False , frozen = False , match_args = True , kw_only = False , slots = False , weakref_slot = Fals ... hon 3.12 以前では、フィールドのタプルを作成し、それらを比較していました (例えば (self.a, self.b) == (other.a, other.b) )。 order : 真の場合 (デフォルトは False )、 __lt__() 、 __le__() 、 __gt__() 、 __ge__() メソッドを生成します。 これらのメソッドは、 ...
https://man.mtool.work/python/3.14/library/dataclasses.html
unittest.mock --- 入門 7598
unittest.mock --- 入門 Added in version 3.3. Mock を使う モックでメソッドにパッチを当てる 一般的な Mock の使い方の中には次のものがあります: メソッドにパッチを当てる オブジェクトに対するメソッド呼び出しを記録する システムの他の部分からメソッ ... ething' ) . test_something () When you nest patch decorators the mocks are passed in to the decorated function in the same order they applied (the normal Python order that decorators are applied). This means from the bottom up, so in the example above ... に複数回の呼び出しがあっても、その 一部 だけをアサートしたい場合があります。 順序も問わない場合は、 assert_has_calls に any_order=True を渡せます。 >>> m = MagicMock () >>> m ( 1 ), m . two ( 2 , 3 ), m . seven ( 7 ), m . fifty ( '50' ) (...) >>> calls ... = [ call . fifty ( '50' ), call ( 1 ), call . seven ( 7 )] >>> m . assert_has_calls ( calls , any_order = True ) より複雑な引数の照合 ANY と同じ基本的な考え方でマッチャーを実装し、モックに引数として渡されたオブジェクトに対して ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
codecs --- codec レジストリと基底クラス 7465
codecs --- codec レジストリと基底クラス ソースコード: Lib/codecs.py このモジュールは、標準的な Python codec (エンコーダとデコーダ) 用の基底クラスを定義し、codec とエラー処理検索プロセスを管理する内部の Python codec レジストリへのアクセスを提 ... each code point as four consecutive bytes. There are two possibilities: store the bytes in big endian or in little endian order. These two encodings are called UTF-32-BE and UTF-32-LE respectively. Their disadvantage is that if, for example, you use ... p bytes on encoding and decoding. Python's UTF-16 and UTF-32 codecs avoid this problem by using the platform's native byte order when no BOM is present. Python follows prevailing platform practice, so native-endian data round-trips without redundant b ... yte swapping, even though the Unicode Standard defaults to big-endian when the byte order is unspecified. When these bytes are read by a CPU with a different endianness, the bytes have to be swapped. To be able t ...
https://man.mtool.work/python/3.14/library/codecs.html
optparse --- コマンドラインオプションのパーサー 7465
optparse --- コマンドラインオプションのパーサー ソースコード: Lib/optparse.py 引数解析ライブラリの選択 標準ライブラリには、引数を解析するライブラリが三つあります。 getopt : C の手続き型の getopt API に忠実に対応するモジュールです。 optparse ... 少し複雑な例を示します。 -a が見つかったことを記録しますが、コマンドラインで -b の後に現れた場合はエラーにします。 def check_order ( option , opt_str , value , parser ): if parser . values . b : raise OptionValueError ( "can't use -a after -b" ) parser ... . values . a = 1 ... parser . add_option ( "-a" , action = "callback" , callback = check_order ) parser . add_option ( "-b" , action = "store_true" , dest = "b" ) コールバックの例 3: オプションの順番をチェックする (汎 ... 利用したければ、もう少し作業する必要があります: エラーメッセージとセットされるフラグを一般化しなければなりません。 def check_order ( option , opt_str , value , parser ): if parser . values . b : raise OptionValueError ( "can't use %s after -b" % opt_str ...
https://man.mtool.work/python/3.14/library/optparse.html
PREV 1 2 3 4 5 6 NEXT