Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/jedi/api/__pycache__/__init__.cpython-39.pyc
Ðазад
a j�h�~ � @ s� d Z ddlZddlmZ ddlZddlmZ ddlmZ ddl m Z ddl mZ ddl mZ dd l mZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZ ddlm Z ddlm!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddl%m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z: dd l;m<Z< dd!l=m>Z> e�?d"� G d#d$� d$�Z@G d%d&� d&e@�ZAd'd(� ZBe jCd)d)d)fd*d+�ZDdS ),aQ The API basically only provides one class. You can create a :class:`Script` and use its methods. Additionally you can add a debug function with :func:`set_debug_function`. Alternatively, if you don't need a custom function and are happy with printing debug messages to stdout, simply call :func:`set_debug_function` without arguments. � N)�Path)�tree)�get_executable_nodes)�debug)�settings)�cache)�KnownContentFileIO)�classes)�interpreter)�helpers)�validate_line_column)� Completion�search_in_module)�KeywordName)�InterpreterEnvironment)�get_default_project�Project)�parso_to_jedi_errors)�refactoring)�extract_function�extract_variable)�InferenceState)�imports)�find_references)�try_iter_content)�infer_call_of_leaf)�transform_path_to_dotted)�tree_name_to_values)�ModuleValue)�ValueSet)�unpack_tuple_to_dict)� convert_names�convert_values)�load_proper_stub_module)�to_listi� c @ s@ e Zd ZdZd7dddd�dd�Zejdd� �Zdd � Zd d� Z e d8dd �dd��Ze d9ddd�dd��Ze d:ddddd�dd��Z dd�dd�Zed;dd��Zdd� Ze d<dd��Ze d=dd ��Ze d>d!d"��Ze d?d#d$��Zd%d&� Zd'd(� Zd)d*� Zd@d,d-�ZdAd.d/�Ze ddd0�d1d2��Ze ddd0�d3d4��ZdBd5d6�ZdS )C�ScriptaK A Script is the base for completions, goto or whatever you want to do with Jedi. The counter part of this class is :class:`Interpreter`, which works with actual dictionaries and can work with a REPL. This class should be used when a user edits code in an editor. You can either use the ``code`` parameter or ``path`` to read a file. Usually you're going to want to use both of them (in an editor). The Script's ``sys.path`` is very customizable: - If `project` is provided with a ``sys_path``, that is going to be used. - If `environment` is provided, its ``sys.path`` will be used (see :func:`Environment.get_sys_path <jedi.api.environment.Environment.get_sys_path>`); - Otherwise ``sys.path`` will match that of the default environment of Jedi, which typically matches the sys path that was used at the time when Jedi was imported. Most methods have a ``line`` and a ``column`` parameter. Lines in Jedi are always 1-based and columns are always zero based. To avoid repetition they are not always documented. You can omit both line and column. Jedi will then just do whatever action you are calling at the end of the file. If you provide only the line, just will complete at the end of that line. .. warning:: By default :attr:`jedi.settings.fast_parser` is enabled, which means that parso reuses modules (i.e. they are not immutable). With this setting Jedi is **not thread safe** and it is also not safe to use multiple :class:`.Script` instances and its definitions at the same time. If you are a normal plugin developer this should not be an issue. It is an issue for people that do more complex stuff with Jedi. This is purely a performance optimization and works pretty well for all typical usages, however consider to turn the setting off if it causes you problems. See also `this discussion <https://github.com/davidhalter/jedi/issues/1240>`_. :param code: The source code of the current file, separated by newlines. :type code: str :param path: The path of the file in the file system, or ``''`` if it hasn't been saved yet. :type path: str or pathlib.Path or None :param Environment environment: Provide a predefined :ref:`Environment <environments>` to work with a specific Python version or virtualenv. :param Project project: Provide a :class:`.Project` to make sure finding references works well, because the right folder is searched. There are also ways to modify the sys path and other things. N)�path�environment�projectc C s || _ t|t�rt|�}|r$|�� nd | _|d u rt|d u rBtd��t|d��}|�� }W d � n1 sj0 Y |d u r�t | jd u r�d n| jj �}t||| jd�| _t �d� | jj|| j|o�|jdkdtjtjd�\| _}t �d� tj|d d �| _|| _t�� t �� d S )Nz)Must provide at least one of code or path�rb)r'