| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/jedi/api/__pycache__/ |
Upload File : |
�
p�{c&z � � � 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> ej? d"� � G d#� d$� � Z@ G d%� d&e@� � ZAd'� ZBe
jC d(d(d(fd)�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 � � e Zd ZdZd!dddd�d�Zej d� � � Zd� Zd� Z e
d"dd �d
�� � Ze
d"ddd�d�� � Ze
d"ddddd
�d�� � Z
dd�d�Zed#d�� � Zd� Ze
d"d�� � Ze
d"d�� � Ze
d"d�� � Ze
d"d�� � Zd� Zd� Zd� Zd$d�Zd"d�Ze
ddd�d�� � Ze
ddd�d�� � Zd"d �ZdS )%�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 �, � || _ t |t � � rt |� � }|r|� � � nd | _ |�M|�t
d� � �t |d� � 5 }|� � � }d d d � � n# 1 swxY w Y |�"t | j �d n| j j
� � }t ||| j �� � | _ t j d� � | j � || j |o
|j dk dt"