WL i @ddlmZddlZ ddZddZy)) annotationsNct|du|du|dugdkDr td|dks|dkrtd|d|d|N|dz |dz z}tt|d|}|dk(rd}n%||k(rd }nt |}||kDr|}n |d|df}|t |t r|\}}n|x}}tt|d|dz }tt|d|dz }tj|dz |z tj|dz |z f}|dx} } nt |t r|\} } n|x} } | dks| dkr td | | fS) a1Calculate chunk sizes. Args: chunk_size (int or tuple(int, int), optional): Chunk size in (y, x) directions, or the same size in both directions if only one is specified. Cannot be negative. chunk_count (int or tuple(int, int), optional): Chunk count in (y, x) directions, or the same count in both directions if only one is specified. If less than 1, set to 1. total_chunk_count (int, optional): Total number of chunks. If less than 1, set to 1. ny (int): Number of grid points in y-direction. nx (int): Number of grid points in x-direction. Return: tuple(int, int): Chunk sizes (y_chunk_size, x_chunk_size). Note: Zero or one of ``chunk_size``, ``chunk_count`` and ``total_chunk_count`` should be specified. NzGOnly one of chunk_size, chunk_count and total_chunk_count should be setz'(ny, nx) must be at least (2, 2), not (z, )r)rrzchunk_size cannot be negative) sum ValueErrorminmax two_factors isinstancetuplemathceil) chunk_size chunk_counttotal_chunk_countnynxmax_chunk_countfactors y_chunk_count x_chunk_count y_chunk_size x_chunk_sizes U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/contourpy/chunk.pycalc_chunk_sizesrs2 Jd "Kt$;=NVZ=Z [\_``bcc AvaB2$bANOO$a4"Q$-$5q 9?K  !J / 1J!"34GBw% &qz71:6  k5 )+6 (M=,7 7MMC q12a48 C q12a48 iiA 67BqDMCY9Z[ &'' | J &%/" l&00 |ar*sU" @&,@&-@&"@& @& @&  @&Fr