Format: application/x-python-code
⬇ Download File (29.1 KB)
   1  o
   2  
   3  �h�s�@sFdZddlZddlmZddlmZddlmZddlm	Z	ddlm
   4  Z
   5  ddlmZdd	l
   6  mZdd
   7  lmZddlmZmZddlmZdd
   8  lmZmZddlmZmZddlmZddlmZddl m!Z!dd�Z"dd�Z#dd�Z$Gdd�d�Z%Gdd�de%�Z&Gdd�de%�Z'Gdd�de'�Z(Gd d!�d!e(�Z)Gd"d#�d#e'�Z*dS)$a`
   9  There are a couple of classes documented in here:
  10  
  11  - :class:`.BaseName` as an abstact base class for almost everything.
  12  - :class:`.Name` used in a lot of places
  13  - :class:`.Completion` for completions
  14  - :class:`.BaseSignature` as a base class for signatures
  15  - :class:`.Signature` for :meth:`.Script.get_signatures` only
  16  - :class:`.ParamName` used for parameters of signatures
  17  - :class:`.Refactoring` for refactorings
  18  - :class:`.SyntaxError` for :meth:`.Script.get_syntax_errors` only
  19  
  20  These classes are the much biggest part of the API, because they contain
  21  the interesting information about all operations.
  22  �N)�Path)�Optional)�search_ancestor)�settings)�debug)�unite)�memoize_method)�	MixedName)�
  23  ImportName�
  24  SubModuleName)�StubModuleValue)�
  25  convert_names�convert_values)�ValueSet�HasNoContext)�KeywordName)�completion_cache)�filter_follow_importscCst|dd�d�S)NcSs
  26  |jpdS�N�rr)�	start_pos��s�r�Fc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/api/classes.py�<lambda>%s
  27  z*_sort_names_by_start_pos.<locals>.<lambda>��key)�sorted)�namesrrr�_sort_names_by_start_pos$sr csXz|��}WntygYSwt|���}dd�|��D�}�fdd�t|�D�S)zi
  28      List sub-definitions (e.g., methods in class).
  29  
  30      :type scope: Scope
  31      :rtype: list of Name
  32      cSsg|]}|�qSrr)�.0�namerrr�
  33  <listcomp>4sz!defined_names.<locals>.<listcomp>csg|]}t�|��qSr)�Name�r!�n��inference_staterrr#5s)�
  34  as_contextr�nextZget_filters�valuesr )r(�value�context�filterrrr'r�
  35  defined_names(s�r/cCsdd�|D�S)NcSsg|]	}t|j|j��qSr)r$r(r"�r!�crrrr#9sz*_values_to_definitions.<locals>.<listcomp>r)r+rrr�_values_to_definitions8sr2c
  36  @s|eZdZdZddddddddddddd	�Zed
  37  d�dd
  38  i��D��Zdd�Ze	dd��Z
  39  edee
  40  fdd��Zedd��Zedd��Zedd��Zdd�Zedd��Zedd ��Zd!d"�Zd#d$�ZdMd'd(�Zd)d*�Zd+d,�Zed-d.��Zed/d0��Zd1d2�Zd3d4�Ze�d5�d%d%d%d%d6�d7d8��Z e�d9�d%d%d:�d;d<��Z!d=d>�Z"d?d@�Z#dNdBdC�Z$dOdDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLS)P�BaseNamezI
  41      The base class for all definitions, completions and signatures.
  42      zos.path�os�io�	functools�collections�socket�sqlite3)�	posixpathZ
  43  riscospath�ntpathZ
  44  os2emxpathZmacpath�genericpath�posix�_io�
  45  _functools�_collections�_socketZ_sqlite3ccs&�|]\}}t|�d��|fVqdS)�.N)�tuple�split)r!�k�vrrr�	<genexpr>Os�$zBaseName.<genexpr>zargparse._ActionsContainerzargparse.ArgumentParsercCs ||_||_	t|jt�|_dS�N)�_inference_state�_name�
  46  isinstancerZ
  47  is_keyword)�selfr(r"rrr�__init__SszBaseName.__init__cC�
  48  |j��SrH)rJ�get_root_context�rLrrr�_get_module_context[s
  49  zBaseName._get_module_context�returncCs,|��}|��s|��s|����}|SdS)zT
  50          Shows the file path of a module. e.g. ``/usr/lib/python3.9/os.py``
  51          N)rQ�is_stub�is_compiledZ
  52  py__file__)rL�module�pathrrr�module_pathbs
  53  zBaseName.module_pathcCrN)z�
  54          Name of variable/function/class/module.
  55  
  56          For example, for ``x = None`` it returns ``'x'``.
  57  
  58          :rtype: str or None
  59          )rJ�get_public_namerPrrrr"ps
  60  	z
  61  BaseName.namecCsj|jj}d}|dur|��}|dur|jdkr|��rd}t|jt�s%|r1|j��D]}|jS|jjS)a�
  62          The type of the definition.
  63  
  64          Here is an example of the value of this attribute.  Let's consider
  65          the following source.  As what is in ``variable`` is unambiguous
  66          to Jedi, :meth:`jedi.Script.infer` should return a list of
  67          definition for ``sys``, ``f``, ``C`` and ``x``.
  68  
  69          >>> from jedi import Script
  70          >>> source = '''
  71          ... import keyword
  72          ...
  73          ... class C:
  74          ...     pass
  75          ...
  76          ... class D:
  77          ...     pass
  78          ...
  79          ... x = D()
  80          ...
  81          ... def f():
  82          ...     pass
  83          ...
  84          ... for variable in [keyword, f, C, x]:
  85          ...     variable'''
  86  
  87          >>> script = Script(source)
  88          >>> defs = script.infer()
  89  
  90          Before showing what is in ``defs``, let's sort it by :attr:`line`
  91          so that it is easy to relate the result to the source code.
  92  
  93          >>> defs = sorted(defs, key=lambda d: d.line)
  94          >>> print(defs)  # doctest: +NORMALIZE_WHITESPACE
  95          [<Name full_name='keyword', description='module keyword'>,
  96           <Name full_name='__main__.C', description='class C'>,
  97           <Name full_name='__main__.D', description='instance D'>,
  98           <Name full_name='__main__.f', description='def f'>]
  99  
 100          Finally, here is what you can get from :attr:`type`:
 101  
 102          >>> defs = [d.type for d in defs]
 103          >>> defs[0]
 104          'module'
 105          >>> defs[1]
 106          'class'
 107          >>> defs[2]
 108          'instance'
 109          >>> defs[3]
 110          'function'
 111  
 112          Valid values for type are ``module``, ``class``, ``instance``, ``function``,
 113          ``param``, ``path``, ``keyword``, ``property`` and ``statement``.
 114  
 115          FNZimport_fromT)	rJ�	tree_name�get_definition�type�
 116  is_definitionrKr�infer�api_type)rLrY�resolve�
 117  definitionr,rrrr[{s9�
 118  z
 119  BaseName.typecCs|����S)aP
 120          The module name, a bit similar to what ``__name__`` is in a random
 121          Python module.
 122  
 123          >>> from jedi import Script
 124          >>> source = 'import json'
 125          >>> script = Script(source, path='example.py')
 126          >>> d = script.infer()[0]
 127          >>> print(d.module_name)  # doctest: +ELLIPSIS
 128          json
 129          )rQZ
 130  py__name__rPrrr�module_name�s
 131  zBaseName.module_namecCs2|����}t|t�rtdd�|jD��S|��S)z<
 132          Returns True, if this is a builtin module.
 133          cs��|]}|��VqdSrH)rT)r!rFrrrrG���z-BaseName.in_builtin_module.<locals>.<genexpr>)rQ�	get_valuerKr�anyZnon_stub_value_setrT)rLr,rrr�in_builtin_module�s
 134  zBaseName.in_builtin_modulecC�|jj}|dur
 135  dS|dS)z7The line where the definition occurs (starting with 1).Nr�rJr�rLrrrr�line��z
 136  BaseName.linecCrg)z9The column where the definition occurs (starting with 0).N�rhrirrr�column�rkzBaseName.columncCs2|jjdurdS|jj��}|dur|jjS|jS)z�
 137          The (row, column) of the start of the definition range. Rows start with
 138          1, columns start with 0.
 139  
 140          :rtype: Optional[Tuple[int, int]]
 141          N)rJrYrZr)rLr`rrr�get_definition_start_position�sz&BaseName.get_definition_start_positioncCs`|jjdurdS|jj��}|dur|jjjS|jdvr-|��}|jdkr*|��jS|jS|jS)z�
 142          The (row, column) of the end of the definition range. Rows start with
 143          1, columns start with 0.
 144  
 145          :rtype: Optional[Tuple[int, int]]
 146          N)�function�class�newline)rJrYrZ�end_posr[Z
 147  get_last_leafZget_previous_leaf)rLr`Z	last_leafrrr�get_definition_end_position�s
 148  
 149  
 150  
 151  z$BaseName.get_definition_end_positionFTcCsHt|jt�r
 152  |r
 153  dS|��}|r|S|��}|r |r |d|S||S)ai
 154          Return a document string for this completion object.
 155  
 156          Example:
 157  
 158          >>> from jedi import Script
 159          >>> source = '''\
 160          ... def f(a, b=1):
 161          ...     "Document for function f."
 162          ... '''
 163          >>> script = Script(source, path='example.py')
 164          >>> doc = script.infer(1, len('def f'))[0].docstring()
 165          >>> print(doc)
 166          f(a, b=1)
 167          <BLANKLINE>
 168          Document for function f.
 169  
 170          Notice that useful extra information is added to the actual
 171          docstring, e.g. function signatures are prepended to their docstrings.
 172          If you need the actual docstring, use ``raw=True`` instead.
 173  
 174          >>> print(script.infer(1, len('def f'))[0].docstring(raw=True))
 175          Document for function f.
 176  
 177          :param fast: Don't follow imports that are only one level deep like
 178              ``import foo``, but follow ``from foo import bar``. This makes
 179              sense for speed reasons. Completing `import a` is slow if you use
 180              the ``foo.docstring(fast=False)`` on every object, because it
 181              parses all libraries starting with ``a``.
 182          �z
 183  
 184  )rKrJr
 185  �_get_docstring�_get_docstring_signature)rL�raw�fast�docZsignature_textrrr�	docstringszBaseName.docstringcCrNrH)rJZ	py__doc__rPrrrru6s
 186  zBaseName._get_docstringcCsd�dd�|jdd�D��S)N�
 187  csrbrH)�	to_string)r!�	signaturerrrrG:s
 188  ��
 189  �z4BaseName._get_docstring_signature.<locals>.<genexpr>T)�
 190  for_docstring)�join�_get_signaturesrPrrrrv9s
 191  
 192  �z!BaseName._get_docstring_signaturecCs�|j}|jj}|dkr|d|j��S|dvs|dur+|dkr"d}|d|j��S|jdd�p2|}|jd	d
 193  �}t�dd|�}t�dd|��	�}|S)
 194  aZ
 195          A description of the :class:`.Name` object, which is heavily used
 196          in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
 197  
 198          Example:
 199  
 200          >>> from jedi import Script
 201          >>> source = '''
 202          ... def f():
 203          ...     pass
 204          ...
 205          ... class C:
 206          ...     pass
 207          ...
 208          ... variable = f if random.choice([0,1]) else C'''
 209          >>> script = Script(source)  # line is maximum by default
 210          >>> defs = script.infer(column=3)
 211          >>> defs = sorted(defs, key=lambda d: d.line)
 212          >>> print(defs)  # doctest: +NORMALIZE_WHITESPACE
 213          [<Name full_name='__main__.f', description='def f'>,
 214           <Name full_name='__main__.C', description='class C'>]
 215          >>> str(defs[0].description)
 216          'def f'
 217          >>> str(defs[1].description)
 218          'class C'
 219  
 220          �param� )rorprU�instanceNro�defT)Zinclude_setitemF)Zinclude_prefixz	#[^\n]+\nz\s+)
 221  r[rJrYr|rXrZ�get_code�re�sub�strip)rL�typrYr`�txtrrr�description?szBaseName.descriptioncCsb|jjsdS|jjdd�}|durdSt|�}z|j|d|d<Wn	ty+Ynwd�|�S)a�
 222          Dot-separated path of this object.
 223  
 224          It is in the form of ``<module>[.<submodule>[...]][.<object>]``.
 225          It is useful when you want to look up Python manual of the
 226          object at hand.
 227  
 228          Example:
 229  
 230          >>> from jedi import Script
 231          >>> source = '''
 232          ... import os
 233          ... os.path.join'''
 234          >>> script = Script(source, path='example.py')
 235          >>> print(script.infer(3, len('os.path.join'))[0].full_name)
 236          os.path.join
 237  
 238          Notice that it returns ``'os.path.join'`` instead of (for example)
 239          ``'posixpath.join'``. This is not correct, since the modules name would
 240          be ``<module 'posixpath' ...>```. However most users find the latter
 241          more practical.
 242          NT)Zinclude_module_namesrrB)rJ�
 243  is_value_nameZget_qualified_names�list�_mapping�KeyErrorr)rLrrrr�	full_nameps�
 244  zBaseName.full_namecCs|jjsdS|j����S)zM
 245          Returns True if the current name is defined in a stub file.
 246          F)rJr�rOrSrPrrrrS�szBaseName.is_stubcCs(|jj}|dur
 247  dS|��o|jjdkS)z�
 248          Checks if a name is defined as ``self.foo = 3``. In case of self, this
 249          function would return False, for foo it would return True.
 250          NF�trailer)rJrYr\�parentr[)rLrYrrr�is_side_effect�szBaseName.is_side_effectzgoto on name)�follow_imports�follow_builtin_imports�
 251  only_stubs�prefer_stubscsD�jjsgS�j��}|rt||�}t|||d�}�fdd�|D�S)ag
 252          Like :meth:`.Script.goto` (also supports the same params), but does it
 253          for the current name. This is typically useful if you are using
 254          something like :meth:`.Script.get_names()`.
 255  
 256          :param follow_imports: The goto call will follow imports.
 257          :param follow_builtin_imports: If follow_imports is True will try to
 258              look up names in builtins (i.e. compiled or extension modules).
 259          :param only_stubs: Only return stubs for this goto call.
 260          :param prefer_stubs: Prefer stubs to Python objects for this goto call.
 261          :rtype: list of :class:`Name`
 262          �r�r�c�&g|]}|�jkr�nt�j|��qSr�rJr$rIr%rPrrr#���z!BaseName.goto.<locals>.<listcomp>)rJr��gotorr
 263  )rLr�r�r�r�rrrPrr��s
 264  
 265  �
 266  �z
 267  BaseName.gotoz
 268  infer on namer�csf|r|rJ��jjsgSt�jgdd�}tt�dd�|D��||d�}dd�|D�}�fdd�|D�S)	a�
 269          Like :meth:`.Script.infer`, it can be useful to understand which type
 270          the current name has.
 271  
 272          Return the actual definitions. I strongly recommend not using it for
 273          your completions, because it might slow down |jedi|. If you want to
 274          read only a few objects (<=20), it might be useful, especially to get
 275          the original docstrings. The basic problem of this function is that it
 276          follows all results. This means with 1000 completions (e.g.  numpy),
 277          it's just very, very slow.
 278  
 279          :param only_stubs: Only return stubs for this goto call.
 280          :param prefer_stubs: Prefer stubs to Python objects for this type
 281              inference call.
 282          :rtype: list of :class:`Name`
 283          T�r�csrbrH)r]r%rrrrG�rcz!BaseName.infer.<locals>.<genexpr>r�cSsg|]}|j�qSr)r"r0rrrr#�sz"BaseName.infer.<locals>.<listcomp>cr�rr�r%rPrrr#�r�)rJr�r
 284  rrZ	from_sets)rLr�r�rr+Zresulting_namesrrPrr]�s�
 285  �zBaseName.infercCs�|jjsdS|jdvr(|jjdur(|jj��}t|ddd�}|���|���}n|jj	}|dur2dS|j
 286  dur?|j	}|j
 287  dus7t|j|j
 288  �S)zT
 289          Returns the parent scope of this identifier.
 290  
 291          :rtype: Name
 292          N)rorpr�ZfuncdefZclassdefZ
 293  file_input)
 294  rJr�r[rYrZrrQZcreate_valuer)Zparent_contextr"r$rI)rLZcls_or_func_noder�r-rrrr��s
 295  
 296  
 297  �zBaseName.parentcCs(d|jj|jr	dnd|jp|j|jfS)Nz<%s %sname=%r, description=%r>Zfull_rt)�	__class__�__name__r�r"r�rPrrr�__repr__
 298  s
 299  �zBaseName.__repr__rcCs\|jjsdS|j��j}|durdS|jjdd}t||d�}d�||||d��S)aI
 300          Returns the line of code where this object was defined.
 301  
 302          :param before: Add n lines before the current line to the output.
 303          :param after: Add n lines after the current line to the output.
 304  
 305          :return str: Returns the line(s) of code or an empty string if it's a
 306                       builtin.
 307          rtNrrl)rJr�rOZ
 308  code_linesr�maxr)rL�before�after�lines�indexZstart_indexrrr�
 309  get_line_codes
 310  zBaseName.get_line_codecCsd|jjdkrgS|r|jjdkr|��sgSt|jt�r#|j����St|jgdd�}dd�|D�S)N�propertyZ	statementTr�cSs"g|]
 311  }|����D]}|�q
 312  qSr)r]�get_signatures)r!r"�sigrrrr#:s"z,BaseName._get_signatures.<locals>.<listcomp>)rJr^rSrKr	Zinfer_compiled_valuer�r
 313  )rLr~rrrrr�+szBaseName._get_signaturescs�fdd����D�S)z�
 314          Returns all potential signatures for a function or a class. Multiple
 315          signatures are typical if you use Python stubs with ``@overload``.
 316  
 317          :rtype: list of :class:`BaseSignature`
 318          c�g|]}t�j|��qSr)�
 319  BaseSignaturerI)r!rrPrrr#Cs
 320  ��z+BaseName.get_signatures.<locals>.<listcomp>)r�rPrrPrr�<s
 321  �zBaseName.get_signaturescCst|j�����S)z�
 322          Uses type inference to "execute" this identifier and returns the
 323          executed objects.
 324  
 325          :rtype: list of :class:`Name`
 326          )r2rJr]Zexecute_with_valuesrPrrr�executeHszBaseName.executecCs|j����S)a*
 327          Returns type hints like ``Iterable[int]`` or ``Union[int, str]``.
 328  
 329          This method might be quite slow, especially for functions. The problem
 330          is finding executions for those functions to return something like
 331          ``Callable[[int, str], str]``.
 332  
 333          :rtype: str
 334          )rJr]�
 335  get_type_hintrPrrrr�Qs
 336  zBaseName.get_type_hintN�FTr)F))r��
 337  __module__�__qualname__�__doc__r��dict�itemsZ_tuple_mappingrMrrQr�rrrWr"r[rarfrjrmrnrsrzrurvr�r�rSr�rZincrease_indent_cmr�r]r�r�r�r�r�r�r�rrrrr3<sx���
 338  
 339  
 340  
 341  F
 342  	
 343  
 344  
 345  +
 346  0
 347  &	
 348  �#!
 349  
 350  	r3cs�eZdZdZ	d�fdd�	Zdd�Zedd��Zed	d
 351  ��Zd�fd
 352  d�	Z	�fdd�Z
 353  �fdd�Z�fdd�Ze�fdd��Z
 354  dd�Zdd�Z�ZS)�
 355  Completionz�
 356      ``Completion`` objects are returned from :meth:`.Script.complete`. They
 357      provide additional information about a completion.
 358      Ncs0t��||�||_||_||_||_g|_dSrH)�superrM�_like_name_length�_stack�	_is_fuzzy�_cached_nameZ_same_name_completions)rLr(r"�stackZlike_name_lengthZis_fuzzyZcached_name�r�rrrMcs
 359  zCompletion.__init__cCs<d}tjr|jdkrd}|j��}|r||jd�}||S)Nrtro�()rZadd_bracket_after_functionr[rJrXr�)rLZ	like_name�appendr"rrr�	_completeps
 360  
 361  zCompletion._completecCs|jrdS|�d�S)a!
 362          Only works with non-fuzzy completions. Returns None if fuzzy
 363          completions are used.
 364  
 365          Return the rest of the word, e.g. completing ``isinstance``::
 366  
 367              isinstan# <-- Cursor is here
 368  
 369          would return the string 'ce'. It also adds additional stuff, depending
 370          on your ``settings.py``.
 371  
 372          Assuming the following function definition::
 373  
 374              def foo(param=0):
 375                  pass
 376  
 377          completing ``foo(par`` would give a ``Completion`` which ``complete``
 378          would be ``am=``.
 379          NT)r�r�rPrrr�complete{s
 380  zCompletion.completecCs
 381  |�d�S)aB
 382          Similar to :attr:`.name`, but like :attr:`.name` returns also the
 383          symbols, for example assuming the following function definition::
 384  
 385              def foo(param=0):
 386                  pass
 387  
 388          completing ``foo(`` would give a ``Completion`` which
 389          ``name_with_symbols`` would be "param=".
 390  
 391          F)r�rPrrr�name_with_symbols�s
 392  
 393  zCompletion.name_with_symbolsFTcs|jdkrd}t�j||d�S)z>
 394          Documented under :meth:`BaseName.docstring`.
 395          �F)rwrx)r�r�rz)rLrwrxr�rrrz�s
 396  zCompletion.docstringc�2�jdurt��j�j���fdd��St���S)Nc����SrH��
 397  _get_cacherrPrrr��z+Completion._get_docstring.<locals>.<lambda>)r�r�
 398  get_docstringrJrXr�rurPr�rPrru��
 399  
 400  �
 401  zCompletion._get_docstringcr�)Ncr�rHr�rrPrrr�r�z5Completion._get_docstring_signature.<locals>.<lambda>)r�rZget_docstring_signaturerJrXr�rvrPr�rPrrv�r�z#Completion._get_docstring_signaturecst�jt���t���fSrH)r�r[rvrurPr�rrr��s�zCompletion._get_cachecs0�jdurt��j�j���fdd��St�jS)z9
 402          Documented under :meth:`BaseName.type`.
 403          Ncr�rHr�rrPrrr�r�z!Completion.type.<locals>.<lambda>)r�r�get_typerJrXr�r[rPr�rPrr[�s
 404  
 405  �zCompletion.typecCs|jS)ao
 406          Returns the length of the prefix being completed.
 407          For example, completing ``isinstance``::
 408  
 409              isinstan# <-- Cursor is here
 410  
 411          would return 8, because len('isinstan') == 8.
 412  
 413          Assuming the following function definition::
 414  
 415              def foo(param=0):
 416                  pass
 417  
 418          completing ``foo(par`` would return 3.
 419          )r�rPrrr�get_completion_prefix_length�sz'Completion.get_completion_prefix_lengthcCsdt|�j|j��fS)Nz<%s: %s>)r[r�rJrXrPrrrr��szCompletion.__repr__rHr�)r�r�r�r�rMr�r�r�r�rzrurvr�r[r�r��
 420  __classcell__rrr�rr�^s"�
 421  
 422  
 423  		r�csLeZdZdZ�fdd�Zedd��Zdd�Zdd	�Zd
 424  d�Z	dd
 425  �Z
 426  �ZS)r$z{
 427      *Name* objects are returned from many different APIs including
 428      :meth:`.Script.goto` or :meth:`.Script.infer`.
 429      cst��||�dSrH)r�rM)rLr(r`r�rrrM�sz
 430  Name.__init__cs,�j��}tt�fdd�|D��dd�d�S)zg
 431          List sub-definitions (e.g., methods in class).
 432  
 433          :rtype: list of :class:`Name`
 434          c3s�|]	}t�j|�VqdSrH)r/rI)r!�drPrrrG�s�z%Name.defined_names.<locals>.<genexpr>cSs|jjpdSrrhrrrrr�sz$Name.defined_names.<locals>.<lambda>r)rJr]rr)rLZdefsrrPrr/�s
 435  
 436  �zName.defined_namescCs|jjdurdS|jj��S)z�
 437          Returns True, if defined as a name in a statement, function or class.
 438          Returns False, if it's a reference to such a definition.
 439          NT)rJrYr\rPrrrr\szName.is_definitioncCs4|jj|jjko|j|jko|j|jko|j|jkSrH)rJrrWr"rI�rL�otherrrr�__eq__s
 440  �
 441  �
 442  �zName.__eq__cCs|�|�SrH)r�r�rrr�__ne__szName.__ne__cCst|jj|j|j|jf�SrH)�hashrJrrWr"rIrPrrr�__hash__sz
 443  Name.__hash__)r�r�r�r�rMrr/r\r�r�r�r�rrr�rr$�s
 444  
 445  r$cs4eZdZdZ�fdd�Zedd��Zdd�Z�ZS)r�zU
 446      These signatures are returned by :meth:`BaseName.get_signatures`
 447      calls.
 448      cst��||j�||_dSrH)r�rMr"�
 449  _signature)rLr(r}r�rrrMs
 450  zBaseSignature.__init__cs�fdd��jjdd�D�S)z�
 451          Returns definitions for all parameters that a signature defines.
 452          This includes stuff like ``*args`` and ``**kwargs``.
 453  
 454          :rtype: list of :class:`.ParamName`
 455          cr�r)�	ParamNamerIr%rPrrr#)s�z(BaseSignature.params.<locals>.<listcomp>T�Z
 456  resolve_stars)r��get_param_namesrPrrPr�params!s
 457  �zBaseSignature.paramscCrN)z�
 458          Returns a text representation of the signature. This could for example
 459          look like ``foo(bar, baz: int, **kwargs)``.
 460  
 461          :rtype: str
 462          )r�r|rPrrrr|,�
 463  zBaseSignature.to_string)	r�r�r�r�rMr�r�r|r�rrr�rr�s
 464  
 465  r�cs@eZdZdZ�fdd�Zedd��Zedd��Zdd	�Z�Z	S)
 466  �	Signaturez\
 467      A full signature object is the return value of
 468      :meth:`.Script.get_signatures`.
 469      cst��||�||_||_dSrH)r�rM�
 470  _call_detailsr�)rLr(r}Zcall_detailsr�rrrM;s
 471  zSignature.__init__cCs|j�|jjdd��S)z�
 472          Returns the param index of the current cursor position.
 473          Returns None if the index cannot be found in the curent call.
 474  
 475          :rtype: int
 476          Tr�)r�Zcalculate_indexr�r�rPrrrr�@s�zSignature.indexcCs
 477  |jjjS)z�
 478          Returns a line/column tuple of the bracket that is responsible for the
 479          last function call. The first line is 1 and the first column 0.
 480  
 481          :rtype: int, int
 482          )r�Zbracket_leafrrPrrr�
 483  bracket_startLs
 484  zSignature.bracket_startcCsdt|�j|j|j��fS)Nz<%s: index=%r %s>)r[r�r�r�r|rPrrrr�Vs
 485  �zSignature.__repr__)
 486  r�r�r�r�rMr�r�r�r�r�rrr�rr�6s
 487  
 488  	r�c@s0eZdZdd�Zdd�Zdd�Zedd��Zd	S)
 489  r�cCst|j���S)zu
 490          Returns default values like the ``1`` of ``def foo(x=1):``.
 491  
 492          :rtype: list of :class:`.Name`
 493          )r2rJ�
 494  infer_defaultrPrrrr�_szParamName.infer_defaultcKst|jjdddi|���S)z�
 495          :param execute_annotation: Default True; If False, values are not
 496              executed and classes are returned instead of instances.
 497          :rtype: list of :class:`.Name`
 498          Zignore_starsTNr)r2rJ�infer_annotation)rL�kwargsrrrr�gszParamName.infer_annotationcCrN)zz
 499          Returns a simple representation of a param, like
 500          ``f: Callable[..., Any]``.
 501  
 502          :rtype: str
 503          )rJr|rPrrrr|or�zParamName.to_stringcCrN)z�
 504          Returns an enum instance of :mod:`inspect`'s ``Parameter`` enum.
 505  
 506          :rtype: :py:attr:`inspect.Parameter.kind`
 507          )rJZget_kindrPrrr�kindxr�zParamName.kindN)r�r�r�r�r�r|r�r�rrrrr�^s	r�)+r�r��pathlibr�typingrZ
 508  parso.treerZjedirrZjedi.inference.utilsrZ
 509  jedi.cacherZjedi.inference.compiled.mixedr	Zjedi.inference.namesr
 510  rZ!jedi.inference.gradual.stub_valuerZ!jedi.inference.gradual.conversionr
 511  rZjedi.inference.base_valuerrZjedi.api.keywordsrZjedi.apirZjedi.api.helpersrr r/r2r3r�r$r�r�r�rrrr�<module>s>&,(