D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
blackhat.pw
:
/
kunden
/
usr
/
lib
/
python3
/
dist-packages
/
breezy
/
__pycache__
/
Filename :
pyutils.cpython-313.pyc
back
Copy
� p��g� � �$ � S r SSKrSS jrSS jrg)z%General Python convenience functions.� Nc �� � U( a: UR S5 nUSS n[ U 0 0 U5 nU H n[ XE5 nM U$ [ U [ 5 [ 5 / 5 [ R U nU$ )a� Get the Python object named by a given module and member name. This is usually much more convenient than dealing with ``__import__`` directly:: >>> doc = get_named_object('breezy.pyutils', 'get_named_object.__doc__') >>> doc.splitlines()[0] 'Get the Python object named by a given module and member name.' :param module_name: a module name, as would be found in sys.modules if the module is already imported. It may contain dots. e.g. 'sys' or 'os.path'. :param member_name: (optional) a name of an attribute in that module to return. It may contain dots. e.g. 'MyClass.some_method'. If not given, the named module will be returned instead. :raises: ImportError or AttributeError. �.N� )�split� __import__�getattr�globals�locals�sys�modules)�module_name�member_name� attr_chain� from_list�obj�attrs �0/usr/lib/python3/dist-packages/breezy/pyutils.py�get_named_objectr sv � �, � !�&�&�s�+� ��r��N� ���b�"�i�8���D��#�$�C� � �J� �;�� �6�8�R�8��k�k�+�&���J� c �� � Ub0 UR SS5 n[ U5 S:X a U SU4$ XS US 4$ U R SS5 n[ U5 S:X a [ SR U 5 5 eUS SUS 4$ )z�Determine the 'parent' of a given dotted module name and (optional) member name. The idea is that ``getattr(parent_obj, final_attr)`` will equal get_named_object(module_name, member_name). :return: (module_name, member_name, final_attr) tuple. Nr r r z*No parent object for top-level module {!r})�rsplit�len�AssertionError�format)r r � split_names r �calc_parent_namer = s� � � �� �'�'��Q�/� ��z�?�a����{�3�3��A�� �1� �>�>� �'�'��Q�/� ��z�?�a�� �<�C�C�K�P�� � �q�M�4��A��7�7r )N)�__doc__r r r � r r �<module>r s ��"