
    Mh                     ,    d Z ddlZddlZd Zd Zd ZdS )z9A fancy version of Python's builtin :func:`dir` function.    Nc                 8    	 t          | |           dS #  Y dS xY w)zfIn recent versions of Python, hasattr() only catches AttributeError.
    This catches all errors.
    TF)getattr)objattrs     R/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/utils/dir2.pysafe_hasattrr      s,    Ttuus    c                    	 t          t          |                     }n# t          $ r t                      }Y nw xY wt          | d          r$|t          t          | j                            z  }d |D             }t          |          S )av  dir2(obj) -> list of strings

    Extended version of the Python builtin dir(), which does a few extra
    checks.

    This version is guaranteed to return only a list of true strings, whereas
    dir() returns anything that objects inject into themselves, even if they
    are later not really valid for attribute access (many extension libraries
    have such bugs).
    	__class__c                 <    g | ]}t          |t                    |S  )
isinstancestr).0ws     r   
<listcomp>zdir2.<locals>.<listcomp>1   s'    4441As!3!34Q444    )setdir	Exceptionr   r
   sorted)r   wordss     r   dir2r      s    CHH    C%% )S''(((
 54444E%==s    ::c                     	 t          | dd          }n# t          $ r Y dS w xY w|dS 	 t          | |d          }n# t          $ r Y dS w xY wt          j        |           rt	          |t
          j                  sdS t          |          r|S dS )aE  Like getattr, but with a few extra sanity checks:

    - If obj is a class, ignore everything except class methods
    - Check if obj is a proxy that claims to have all attributes
    - Catch attribute access failing with any exception
    - Check that the attribute is a callable object

    Returns the method or None.
    (_ipython_canary_method_should_not_exist_N)r   r   inspectisclassr   types
MethodTypecallable)r   namecanaryms       r   get_real_methodr#   5   s    H$OO   tt tCt$$   tt s Jq%2B$C$C t{{ 4s    
""< 
A
	A
)__doc__r   r   r   r   r#   r   r   r   <module>r%      sV    ? ?
      >    r   