ó
    Ñ]jï  ã                  ó  • S r SSKJr  SSKJr  SSKrSSKrSSKJ	r	  SSK
Jr  SSKJr  SSKJrJrJr  SS	KJrJr  SS
KJr  SSKJrJrJrJrJrJr  \(       a  SSKJrJ r   SSKJ!r!  SS jr" " S S\5      r# S   SS jjr$SS jr%SS jr&g)zÚ
This is a pseudo-public API for downstream libraries.  We ask that downstream
authors

1) Try to avoid using internals directly altogether, and failing that,
2) Use only functions exposed here (or in core.internals)

é    )Úannotations)ÚTYPE_CHECKINGN)ÚBlockPlacement)ÚPandas4Warning)Úpandas_dtype)ÚDatetimeTZDtypeÚExtensionDtypeÚPeriodDtype)ÚDatetimeArrayÚTimedeltaArray)Úextract_array)ÚDatetimeLikeBlockÚ
check_ndimÚensure_block_shapeÚextract_pandas_arrayÚget_block_typeÚmaybe_coerce_values)Ú	ArrayLikeÚDtype)ÚBlockc                ó  • U R                   n[        U5      n[        U5      n[        U[        5      (       a  UR
                  (       d  [        U [        [        45      (       a
  [        U SS9n [        U 5      n U" U SUS9$ )aÆ  
This is an analogue to blocks.new_block(_2d) that ensures:
1) correct dimension for EAs that support 2D (`ensure_block_shape`), and
2) correct EA class for datetime64/timedelta64 (`maybe_coerce_values`).

The input `values` is assumed to be either numpy array or ExtensionArray:
- In case of a numpy array, it is assumed to already be in the expected
  shape for Blocks (2D, (cols, rows)).
- In case of an ExtensionArray the input can be 1D, also for EAs that are
  internally stored as 2D.

For the rest no preprocessing or validation is done, except for those dtypes
that are internally stored as EAs but have an exact numpy equivalent (and at
the moment use that numpy dtype), i.e. datetime64/timedelta64.
é   )Úndim©r   Ú	placement)
Údtyper   r   Ú
isinstancer	   Ú_supports_2dr   r   r   r   )Úvaluesr   r   ÚklassÚplacement_objs        ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pandas/core/internals/api.pyÚ_make_blockr#   2   su   € ð  �L‰L€EÜ˜5Ó!€EÜ" 9Ó-€Mä�5œ.×)Ñ)¨e×.@×.@ÄZØ”¤Ð/÷Fñ Fô $ F°Ñ3ˆä  Ó(€FÙ�˜a¨=Ñ9Ð9ó    c                  ó(   • \ rS rSr% SrS\S'   SrSrg)Ú_DatetimeTZBlockéO   z0implement a datetime64 block with a tz attributer   r   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__Ú	__slots__Ú__static_attributes__r(   r$   r"   r&   r&   O   s   ‡ Ù:àÓàƒIr$   r&   c                óŽ  • [         R                  " S[        SS9  Ub  [        U5      n[	        XU5      u  pSSKJn  X%L a!  [        U R                  [        5      (       a  SnUc!  U=(       d    U R                  n[        U5      nO=U[        L a4  [        U R                  [        5      (       d  [        R                  " U US9n [        U[        5      (       d  [        U5      n[!        XU5      n[        U R                  [        [        45      (       a  [#        U SS	9n [%        X5      n ['        XU5        [)        U 5      n U" XUS
9$ )a  
This is a pseudo-public analogue to blocks.new_block.

We ask that downstream libraries use this rather than any fully-internal
APIs, including but not limited to:

- core.internals.blocks.make_block
- Block.make_block
- Block.make_block_same_class
- Block.__init__
z¦make_block is deprecated and will be removed in a future version. Use pd.api.internals.create_dataframe_from_blocks or (recommended) higher-level public APIs instead.r   ©Ú
stacklevelNr   )ÚExtensionBlock)r   T)Úextract_numpyr   )ÚwarningsÚwarnr   r   r   Úpandas.core.internals.blocksr4   r   r   r
   r   r&   r   r   Ú_simple_newr   Ú_maybe_infer_ndimr   r   r   r   )r   r   r    r   r   r4   s         r"   Ú
make_blockr;   W   s  € ô ‡M‚Mð	:ô 	Øòð ÑÜ˜UÓ#ˆä(¨¸Ó=�M€Få;àÒ¤:¨f¯l©l¼K×#HÑ#Hð ˆà�}Ø×%˜Ÿ™ˆÜ˜uÓ%‰à	Ô"Ò	"¬:°f·l±lÄO×+TÑ+Tä×*Ò*ð Øñ
ˆô �i¤×0Ñ0Ü" 9Ó-ˆ	ä˜V°Ó5€DÜ�&—,‘,¤¬oÐ >×?Ñ?ô ˜v°TÑ:ˆÜ# FÓ1ˆäˆv $Ô'Ü  Ó(€FÙ�¨iÑ8Ð8r$   c                ó¦   • UcM  [        U R                  [        R                  5      (       d  [        U5      S:w  a  SnU$ Sn U$ U R                  nU$ )ú@
If `ndim` is not provided, infer it from placement and values.
é   r   )r   r   ÚnpÚlenr   ©r   r   r   s      r"   r:   r:   ˜   sT   € ð �|ä˜&Ÿ,™,¬¯©×1Ñ1Ü�9‹~ Ó"Ø�ð
 €Kð ‘ð €Kð —;‘;ˆDØ€Kr$   c                óN   • [         R                  " S[        SS9  [        XU5      $ )r=   zGmaybe_infer_ndim is deprecated and will be removed in a future version.r   r2   )r6   r7   r   r:   rA   s      r"   Úmaybe_infer_ndimrC   ¨   s(   € ô ‡M‚MØQÜØòô
 ˜V°Ó5Ð5r$   )r   r   r   z
np.ndarrayÚreturnr   )NNN)r   zDtype | NonerD   r   )r   r   r   z
int | NonerD   Úint)'r-   Ú
__future__r   Útypingr   r6   Únumpyr?   Úpandas._libs.internalsr   Úpandas.errorsr   Úpandas.core.dtypes.commonr   Úpandas.core.dtypes.dtypesr   r	   r
   Úpandas.core.arraysr   r   Úpandas.core.constructionr   r8   r   r   r   r   r   r   Úpandas._typingr   r   r   r#   r&   r;   r:   rC   r(   r$   r"   Ú<module>rP      s‡   ðñõ #å  Û ã å 1Ý (å 2÷ñ ÷õ 3÷÷ ö ÷õ
 3ô:ô:Ð(ô ð EIð>9Ø5Að>9à
õ>9ôBõ 	6r$   