← Back
Editing: osm.cpython-311.pyc
� �@�c�w � � � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddlm Z ddlmZ ddlm Z mZ ddlmZ dd lmZmZmZmZmZmZ dd lmZ ddlmZ ddlmZ dd lmZ ddl m!Z! ddl"m#Z# e G d� de� � � � Z$dS )z�Implementation of magic functions for interaction with the OS. Note: this module is named 'osm' instead of 'os' to avoid a collision with the builtin. � N)�pformat)�magic_arguments)�oinspect)�page)� AliasError�Alias)� UsageError)�Magics�compress_dhist�magics_class� line_magic� cell_magic�line_cell_magic)�skip_doctest)�source_to_unicode)� abbrev_cwd)�set_term_title)�Bool)�warnc � � � e Zd ZdZ edd�� � � d�� � Zd'� fd� Zd � Zd � Z d� Z eed(d �� � � � Z ed(d�� � Zed(d�� � Zeed(d�� � � � Zeed(d�� � � � Zed(d�� � Zed� � � Zed(d�� � Zed(d�� � Zed(d�� � Zed(d�� � Zeed(d�� � � � Zed)d�� � Z ed� � e� � Z ed� � e� � Zed(d�� � Zed(d�� � Z e j � � e j! ddd dd!�"� � e j! d#e"d$�%� � ed&� � � � � � � � � Z#� xZ$S )*�OSMagicszJMagics to interact with the underlying OS (shell-type functionality). Fz5Force %cd magic to be quiet even if -q is not passed.)�helpT)�configNc � �� d| _ d | _ t j dk rd| _ n� t j d � dd� � � dd� � }n# t $ r d }Y nw xY w t j d |z t j � � | _ nM# t j $ r; t d� � d }t j d |z t j � � | _ Y nw xY w t � � j d d|i|�� d S )NF�posixT�pathext�;�|�.� zexe|com|bat|pyz(.*)\.(%s)$z�Seems like your pathext environmental variable is malformed. Please check it to enable a proper handle of file extensions managed for your system�shell� )�is_posix�execre�os�name�environ�replace�KeyError�re�compile� IGNORECASE�errorr �super�__init__)�selfr! �kwargs�winext� __class__s ��9/usr/lib/python3/dist-packages/IPython/core/magics/osm.pyr/ zOSMagics.__init__) s) �� � �� ���� �7�g��� �D�M�M� *���I�.�6�6�s�3�?�?�G�G��B�O�O����� *� *� *�)���� *���� P� �j��&�)@���O�O������8� P� P� P�� /� 0� 0� 0� *�� �j��&�)@���O�O����� P���� �����/�/�u�/��/�/�/�/�/s$ �:A$ �$A3�2A3�7'B �AC)�(C)c �v � t j |j t j � � r|� � � S dS )z7 Test for executable on a POSIX system F)r% �access�path�X_OK�is_file�r0 �files r4 � _isexec_POSIXzOSMagics._isexec_POSIXC s/ � � �9�T�Y���(�(� "��<�<�>�>�!��u� c �l � |� � � o | j � |j � � duS )�> Test for executable file on non POSIX system N)r9 r$ �matchr&