
    1e                     @    d Z ddlZddlmZ ddlmZ eefZd Z	ddZ
dS )	ze
Copy/paste from scrapy source at the moment, to ensure tests are working.
Refactoring to come later
    N)partial)is_itemc                 |    | g S t          | d          r&t          | t                    st          |           s| S | gS )zConvert an argument to an iterable. The argument can be a None, single
    value, or an iterable.

    Exception: if arg is a dict, [arg] will be returned
    N__iter__)hasattr
isinstance_ITERABLE_SINGLE_VALUESr   )args    1lib/python3.11/site-packages/itemloaders/utils.pyarg_to_iterr      sQ     {	Z  3 788 
 
u    Fc                 2   t          |           s$t          dt          |           j                  g }	 t	          j        |           }n# t          $ r |cY S w xY wt          | t                    rY| j	        }| j
        }|j                                        D ]0\  }}|j        |v r|r
|j        |v r|                    |           1n1|j                                        D ]}|                    |           |r|r|d         dk    r
|dd         }|S )z2Return the argument name list of a callable objectzfunc must be callable, got r   self   N)callable	TypeErrortype__name__inspect	signature
ValueErrorr   r   argskeywords
parametersitemsnameappendkeys)func	stripselfr   sigpartial_args
partial_kwr   params           r   get_func_argsr%      sX   D>> OMd4jj6IMMNNND%%    $   y]
>//11 	 	KD%z\)) ejJ66KK	 N'')) 	 	DKK T d1g//ABBxKs   A AA)F)__doc__r   	functoolsr   itemadapterr   strbytesr	   r   r%    r   r   <module>r,      su                 u*   $     r   