Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/traitlets/utils/__pycache__/__init__.cpython-39.pyc
Ðазад
a _�hH � @ sd d dl mZ d dlZd dlZd dlmZ ddddd�dd �Zddd dd�dd �Zddd�dd�ZdS )� )�annotationsN)�Sequence�utf-8zstr | bytes�str)�s�encoding�returnc C s t | t�r| �|d�S | S )N�replace)� isinstance�bytes�decode)r r � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/traitlets/utils/__init__.py�cast_unicode s r zSequence[str] | None)�filename� path_dirsr c C s� | � d�� d�} tj�| �r,tj�| �r,| S |du r:d}n(t|t�rL|f}nt|tj�rbt|�f}|D ]B}|dkrzt� � }t tj�|| ��}tj�|�rftj�|� S qft d| �d|����dS )a� Find a file by looking through a sequence of paths. This iterates through a sequence of paths looking for a file and returns the full, absolute path of the first occurrence of the file. If no set of path dirs is given, the filename is tested as is, after running through :func:`expandvars` and :func:`expanduser`. Thus a simple call:: filefind('myfile.txt') will find the file in the current working dir, but:: filefind('~/myfile.txt') Will find the file in the users home directory. This function does not automatically try any paths, such as the cwd or the user's home directory. Parameters ---------- filename : str The filename to look for. path_dirs : str, None or sequence of str The sequence of paths to look for the file in. If None, the filename need to be absolute or be in the cwd. If a string, the string is put into a sequence and the searched. If a sequence, walk through each element and join with ``filename``, calling :func:`expandvars` and :func:`expanduser` before testing for existence. Returns ------- Raises :exc:`IOError` or returns absolute path to file. �"�'N)� �.zFile z, does not exist in any of the search paths: )�strip�os�path�isabs�isfiler r �pathlib�Path�getcwd�expand_path�join�abspath�OSError)r r r Ztestnamer r r �filefind s " r"