"\nThis is the syntax tree for Python 3 syntaxes. The classes represent\nsyntax elements like functions and imports.\n\nAll of the nodes can be traced back to the `Python grammar file\n<https://docs.python.org/3/reference/grammar.html>`_. If you want to know how\na tree is structured, just analyse that file (for each Python version it's a\nbit different).\n\nThere's a lot of logic here that makes it easier for Jedi (and other libraries)\nto deal with a Python syntax tree.\n\nBy using :py:meth:`parso.tree.NodeOrLeaf.get_code` on a module, you can get\nback the 1-to-1 representation of the input given to the parser. This is\nimportant if you want to refactor a parser tree.\n\n>>> from parso import parse\n>>> parser = parse('import os')\n>>> module = parser.get_root_node()\n>>> module\n<Module: @1-1>\n\nAny subclasses of :class:`Scope`, including :class:`Module` has an attribute\n:attr:`iter_imports <Scope.iter_imports>`:\n\n>>> list(module.iter_imports())\n[<ImportName: import os@1,0>]\n\nChanges to the Python Grammar\n-----------------------------\n\nA few things have changed when looking at Python grammar files:\n\n- :class:`Param` does not exist in Python grammar files. It is essentially a\n  part of a ``parameters`` node.  |parso| splits it up to make it easier to\n  analyse parameters. However this just makes it easier to deal with the syntax\n  tree, it doesn't actually change the valid syntax.\n- A few nodes like `lambdef` and `lambdef_nocond` have been merged in the\n  syntax tree to make it easier to do deal with them.\n\nParser Tree Classes\n-------------------\n"
_e='with_item'
_d='yield_expr'
_c='except_clause'
_b='<%s: %s>'
_a='string'
_Z='file_input'
_Y='namedexpr_test'
_X='sync_comp_for'
_W='expr_stmt'
_V='async_funcdef'
_U='decorated'
_T='try_stmt'
_S='while_stmt'
_R='if_stmt'
_Q='annassign'
_P='lambdef'
_O='tfpdef'
_N='keyword'
_M='param'
_L='simple_stmt'
_K='with_stmt'
_J='for_stmt'
_I='import_name'
_H='classdef'
_G='import_from'
_F='suite'
_E='funcdef'
_D='name'
_C='*'
_B=False
_A=None
import re
try:from collections.abc import Mapping
except ImportError:from collections import Mapping
from typing import Tuple
from parso.tree import Node,BaseNode,Leaf,ErrorNode,ErrorLeaf,search_ancestor
from parso.python.prefix import split_prefix
from parso.utils import split_lines
_FLOW_CONTAINERS=set([_R,_S,_J,_T,_K,'async_stmt',_F])
_RETURN_STMT_CONTAINERS=set([_F,_L])|_FLOW_CONTAINERS
_FUNC_CONTAINERS=set([_F,_L,_U,_V])|_FLOW_CONTAINERS
_GET_DEFINITION_TYPES=set([_W,_X,_K,_J,_I,_G,_M,'del_stmt',_Y])
_IMPORTS=set([_I,_G])
class DocstringMixin:
	__slots__=()
	def get_doc_node(B):
		"\n        Returns the string leaf of a docstring. e.g. ``r'''foo'''``.\n        "
		if B.type==_Z:A=B.children[0]
		elif B.type in(_E,_H):
			A=B.children[B.children.index(':')+1]
			if A.type==_F:A=A.children[1]
		else:
			C=B.parent;D=C.parent.children;E=D.index(C)
			if not E:return
			A=D[E-1]
		if A.type==_L:A=A.children[0]
		if A.type==_a:return A
class PythonMixin:
	'\n    Some Python specific utilities.\n    ';__slots__=()
	def get_name_of_position(D,position):
		'\n        Given a (line, column) tuple, returns a :py:class:`Name` or ``None`` if\n        there is no name at that position.\n        ';B=position
		for A in D.children:
			if isinstance(A,Leaf):
				if A.type==_D and A.start_pos<=B<=A.end_pos:return A
			else:
				C=A.get_name_of_position(B)
				if C is not _A:return C
class PythonLeaf(PythonMixin,Leaf):
	__slots__=()
	def _split_prefix(A):return split_prefix(A,A.get_start_pos_of_prefix())
	def get_start_pos_of_prefix(B):
		'\n        Basically calls :py:meth:`parso.tree.NodeOrLeaf.get_start_pos_of_prefix`.\n        ';A=B.get_previous_leaf()
		if A is not _A and A.type=='error_leaf'and A.token_type in('INDENT','DEDENT','ERROR_DEDENT'):A=A.get_previous_leaf()
		if A is _A:C=split_lines(B.prefix);return B.line-len(C)+1,0
		return A.end_pos
class _LeafWithoutNewlines(PythonLeaf):
	'\n    Simply here to optimize performance.\n    ';__slots__=()
	@property
	def end_pos(self):A=self;return A.line,A.column+len(A.value)
class PythonBaseNode(PythonMixin,BaseNode):__slots__=()
class PythonNode(PythonMixin,Node):__slots__=()
class PythonErrorNode(PythonMixin,ErrorNode):__slots__=()
class PythonErrorLeaf(ErrorLeaf,PythonLeaf):__slots__=()
class EndMarker(_LeafWithoutNewlines):
	__slots__=();type='endmarker'
	def __repr__(A):return'<%s: prefix=%s end_pos=%s>'%(type(A).__name__,repr(A.prefix),A.end_pos)
class Newline(PythonLeaf):
	'Contains NEWLINE and ENDMARKER tokens.';__slots__=();type='newline'
	def __repr__(A):return _b%(type(A).__name__,repr(A.value))
class Name(_LeafWithoutNewlines):
	'\n    A string. Sometimes it is important to know if the string belongs to a name\n    or not.\n    ';type=_D;__slots__=()
	def __repr__(A):return'<%s: %s@%s,%s>'%(type(A).__name__,A.value,A.line,A.column)
	def is_definition(A,include_setitem=_B):'\n        Returns True if the name is being defined.\n        ';return A.get_definition(include_setitem=include_setitem)is not _A
	def get_definition(B,import_name_always=_B,include_setitem=_B):
		"\n        Returns None if there's no definition for a name.\n\n        :param import_name_always: Specifies if an import name is always a\n            definition. Normally foo in `from foo import bar` is not a\n            definition.\n        ";A=B.parent;C=A.type
		if C in(_E,_H):
			if B==A.name:return A
			return
		if C==_c:
			if B.get_previous_sibling()=='as':return A.parent
			return
		while A is not _A:
			if A.type==_F:return
			if A.type in _GET_DEFINITION_TYPES:
				if B in A.get_defined_names(include_setitem):return A
				if import_name_always and A.type in _IMPORTS:return A
				return
			A=A.parent
class Literal(PythonLeaf):__slots__=()
class Number(Literal):type='number';__slots__=()
class String(Literal):
	type=_a;__slots__=()
	@property
	def string_prefix(self):return re.match('\\w*(?=[\\\'"])',self.value).group(0)
	def _get_payload(B):A=re.search('(\'{3}|"{3}|\'|")(.*)$',B.value,flags=re.DOTALL);return A.group(2)[:-len(A.group(1))]
class FStringString(PythonLeaf):'\n    f-strings contain f-string expressions and normal python strings. These are\n    the string parts of f-strings.\n    ';type='fstring_string';__slots__=()
class FStringStart(PythonLeaf):'\n    f-strings contain f-string expressions and normal python strings. These are\n    the string parts of f-strings.\n    ';type='fstring_start';__slots__=()
class FStringEnd(PythonLeaf):'\n    f-strings contain f-string expressions and normal python strings. These are\n    the string parts of f-strings.\n    ';type='fstring_end';__slots__=()
class _StringComparisonMixin:
	__slots__=()
	def __eq__(B,other):
		'\n        Make comparisons with strings easy.\n        Improves the readability of the parser.\n        ';A=other
		if isinstance(A,str):return B.value==A
		return B is A
	def __hash__(A):return hash(A.value)
class Operator(_LeafWithoutNewlines,_StringComparisonMixin):type='operator';__slots__=()
class Keyword(_LeafWithoutNewlines,_StringComparisonMixin):type=_N;__slots__=()
class Scope(PythonBaseNode,DocstringMixin):
	'\n    Super class for the parser tree, which represents the state of a python\n    text file.\n    A Scope is either a function, class or lambda.\n    ';__slots__=()
	def __init__(A,children):super().__init__(children)
	def iter_funcdefs(A):'\n        Returns a generator of `funcdef` nodes.\n        ';return A._search_in_scope(_E)
	def iter_classdefs(A):'\n        Returns a generator of `classdef` nodes.\n        ';return A._search_in_scope(_H)
	def iter_imports(A):'\n        Returns a generator of `import_name` and `import_from` nodes.\n        ';return A._search_in_scope(_I,_G)
	def _search_in_scope(A,*C):
		def B(children):
			for A in children:
				if A.type in C:yield A
				if A.type in _FUNC_CONTAINERS:yield from B(A.children)
		return B(A.children)
	def get_suite(A):'\n        Returns the part that is executed by the function.\n        ';return A.children[-1]
	def __repr__(A):
		try:B=A.name.value
		except AttributeError:B=''
		return'<%s: %s@%s-%s>'%(type(A).__name__,B,A.start_pos[0],A.end_pos[0])
class Module(Scope):
	'\n    The top scope, which is always a module.\n    Depending on the underlying parser this may be a full module or just a part\n    of a module.\n    ';__slots__='_used_names',;type=_Z
	def __init__(A,children):super().__init__(children);A._used_names=_A
	def _iter_future_import_names(C):
		'\n        :return: A list of future import names.\n        :rtype: list of str\n        '
		for A in C.iter_imports():
			if A.type==_G and A.level==0:
				for D in A.get_paths():
					B=[A.value for A in D]
					if len(B)==2 and B[0]=='__future__':yield B[1]
	def get_used_names(A):
		'\n        Returns all the :class:`Name` leafs that exist in this module. This\n        includes both definitions and references of names.\n        '
		if A._used_names is _A:
			B={}
			def C(node):
				A=node
				try:D=A.children
				except AttributeError:
					if A.type==_D:E=B.setdefault(A.value,[]);E.append(A)
				else:
					for F in D:C(F)
			C(A);A._used_names=UsedNamesMapping(B)
		return A._used_names
class Decorator(PythonBaseNode):type='decorator';__slots__=()
class ClassOrFunc(Scope):
	__slots__=()
	@property
	def name(self):'\n        Returns the `Name` leaf that defines the function or class name.\n        ';return self.children[1]
	def get_decorators(B):
		'\n        :rtype: list of :class:`Decorator`\n        ';A=B.parent
		if A.type==_V:A=A.parent
		if A.type==_U:
			if A.children[0].type=='decorators':return A.children[0].children
			else:return A.children[:1]
		else:return[]
class Class(ClassOrFunc):
	'\n    Used to store the parsed contents of a python class.\n    ';type=_H;__slots__=()
	def __init__(A,children):super().__init__(children)
	def get_super_arglist(A):
		'\n        Returns the `arglist` node that defines the super classes. It returns\n        None if there are no arguments.\n        '
		if A.children[2]!='(':return
		elif A.children[3]==')':return
		else:return A.children[3]
def _create_params(parent,argslist_list):
	"\n    `argslist_list` is a list that can contain an argslist as a first item, but\n    most not. It's basically the items between the parameter brackets (which is\n    at most one item).\n    This function modifies the parser structure. It generates `Param` objects\n    from the normal ast. Those param objects do not exist in a normal ast, but\n    make the evaluation of the ast tree so much easier.\n    You could also say that this function replaces the argslist node with a\n    list of Param objects.\n    ";C=parent
	try:B=argslist_list[0]
	except IndexError:return[]
	if B.type in(_D,'fpdef'):return[Param([B],C)]
	elif B==_C:return[B]
	else:
		if B.type==_O:D=[B]
		else:D=B.children
		E=[];F=0
		for(G,H)in enumerate(D+[_A],1):
			if H is _A or H==',':
				A=D[F:G]
				if A:
					if A[0]==_C and(len(A)==1 or A[1]==',')or A[0]=='/':
						for I in A:I.parent=C
						E+=A
					else:E.append(Param(A,C))
					F=G
		return E
class Function(ClassOrFunc):
	'\n    Used to store the parsed contents of a python function.\n\n    Children::\n\n        0. <Keyword: def>\n        1. <Name>\n        2. parameter list (including open-paren and close-paren <Operator>s)\n        3. or 5. <Operator: :>\n        4. or 6. Node() representing function body\n        3. -> (if annotation is also present)\n        4. annotation (if present)\n    ';type=_E;__slots__=()
	def __init__(C,children):
		super().__init__(children);A=C.children[2];B=A.children[1:-1]
		if not any(isinstance(A,Param)for A in B):A.children[1:-1]=_create_params(A,B)
	def _get_param_nodes(A):return A.children[2].children
	def get_params(A):'\n        Returns a list of `Param()`.\n        ';return[A for A in A._get_param_nodes()if A.type==_M]
	@property
	def name(self):return self.children[1]
	def iter_yield_exprs(A):
		'\n        Returns a generator of `yield_expr`.\n        '
		def B(children):
			for A in children:
				if A.type in(_H,_E,_P):continue
				try:C=A.children
				except AttributeError:
					if A.value=='yield':
						if A.parent.type==_d:yield A.parent
						else:yield A
				else:yield from B(C)
		return B(A.children)
	def iter_return_stmts(A):
		'\n        Returns a generator of `return_stmt`.\n        '
		def B(children):
			for A in children:
				if A.type=='return_stmt'or A.type==_N and A.value=='return':yield A
				if A.type in _RETURN_STMT_CONTAINERS:yield from B(A.children)
		return B(A.children)
	def iter_raise_stmts(A):
		'\n        Returns a generator of `raise_stmt`. Includes raise statements inside try-except blocks\n        '
		def B(children):
			for A in children:
				if A.type=='raise_stmt'or A.type==_N and A.value=='raise':yield A
				if A.type in _RETURN_STMT_CONTAINERS:yield from B(A.children)
		return B(A.children)
	def is_generator(A):'\n        :return bool: Checks if a function is a generator or not.\n        ';return next(A.iter_yield_exprs(),_A)is not _A
	@property
	def annotation(self):
		'\n        Returns the test node after `->` or `None` if there is no annotation.\n        ';A=self
		try:
			if A.children[3]=='->':return A.children[4]
			assert A.children[3]==':';return
		except IndexError:return
class Lambda(Function):
	'\n    Lambdas are basically trimmed functions, so give it the same interface.\n\n    Children::\n\n         0. <Keyword: lambda>\n         *. <Param x> for each argument x\n        -2. <Operator: :>\n        -1. Node() representing body\n    ';type=_P;__slots__=()
	def __init__(A,children):
		super(Function,A).__init__(children);B=A.children[1:-2]
		if not any(isinstance(A,Param)for A in B):A.children[1:-2]=_create_params(A,B)
	@property
	def name(self):"\n        Raises an AttributeError. Lambdas don't have a defined name.\n        ";raise AttributeError('lambda is not named.')
	def _get_param_nodes(A):return A.children[1:-2]
	@property
	def annotation(self):"\n        Returns `None`, lambdas don't have annotations.\n        "
	def __repr__(A):return'<%s@%s>'%(A.__class__.__name__,A.start_pos)
class Flow(PythonBaseNode):__slots__=()
class IfStmt(Flow):
	type=_R;__slots__=()
	def get_test_nodes(A):
		'\n        E.g. returns all the `test` nodes that are named as x, below:\n\n            if x:\n                pass\n            elif x:\n                pass\n        '
		for(B,C)in enumerate(A.children):
			if C in('elif','if'):yield A.children[B+1]
	def get_corresponding_test_node(C,node):
		'\n        Searches for the branch in which the node is and returns the\n        corresponding test node (see function above). However if the node is in\n        the test node itself and not in the suite return None.\n        ';B=node.start_pos
		for A in reversed(list(C.get_test_nodes())):
			if A.start_pos<B:
				if B<A.end_pos:return
				else:return A
	def is_node_after_else(B,node):
		'\n        Checks if a node is defined after `else`.\n        '
		for A in B.children:
			if A=='else':
				if node.start_pos>A.start_pos:return True
		else:return _B
class WhileStmt(Flow):type=_S;__slots__=()
class ForStmt(Flow):
	type=_J;__slots__=()
	def get_testlist(A):'\n        Returns the input node ``y`` from: ``for x in y:``.\n        ';return A.children[3]
	def get_defined_names(A,include_setitem=_B):return _defined_names(A.children[1],include_setitem)
class TryStmt(Flow):
	type=_T;__slots__=()
	def get_except_clause_tests(B):
		'\n        Returns the ``test`` nodes found in ``except_clause`` nodes.\n        Returns ``[None]`` for except clauses without an exception given.\n        '
		for A in B.children:
			if A.type==_c:yield A.children[1]
			elif A=='except':yield _A
class WithStmt(Flow):
	type=_K;__slots__=()
	def get_defined_names(C,include_setitem=_B):
		'\n        Returns the a list of `Name` that the with statement defines. The\n        defined names are set after `as`.\n        ';A=[]
		for B in C.children[1:-2:2]:
			if B.type==_e:A+=_defined_names(B.children[2],include_setitem)
		return A
	def get_test_node_from_name(B,name):
		A=name.search_ancestor(_e)
		if A is _A:raise ValueError('The name is not actually part of a with statement.')
		return A.children[0]
class Import(PythonBaseNode):
	__slots__=()
	def get_path_for_name(C,name):
		'\n        The path is the list of names that leads to the searched name.\n\n        :return list of Name:\n        ';A=name
		try:A=C._aliases()[A]
		except KeyError:pass
		for B in C.get_paths():
			if A in B:return B[:B.index(A)+1]
		raise ValueError('Name should be defined in the import itself')
	def is_nested(A):return _B
	def is_star_import(A):return A.children[-1]==_C
class ImportFrom(Import):
	type=_G;__slots__=()
	def get_defined_names(A,include_setitem=_B):'\n        Returns the a list of `Name` that the import defines. The\n        defined names are set after `import` or in case an alias - `as` - is\n        present that name is returned.\n        ';return[B or A for(A,B)in A._as_name_tuples()]
	def _aliases(A):'Mapping from alias to its corresponding name.';return dict((A,B)for(B,A)in A._as_name_tuples()if A is not _A)
	def get_from_names(B):
		for A in B.children[1:]:
			if A not in('.','...'):break
		if A.type=='dotted_name':return A.children[::2]
		elif A=='import':return[]
		else:return[A]
	@property
	def level(self):
		'The level parameter of ``__import__``.';A=0
		for B in self.children[1:]:
			if B in('.','...'):A+=len(B.value)
			else:break
		return A
	def _as_name_tuples(C):
		A=C.children[-1]
		if A==')':A=C.children[-2]
		elif A==_C:return
		if A.type=='import_as_names':D=A.children[::2]
		else:D=[A]
		for B in D:
			if B.type==_D:yield(B,_A)
			else:yield B.children[::2]
	def get_paths(A):
		'\n        The import paths defined in an import statement. Typically an array\n        like this: ``[<Name: datetime>, <Name: date>]``.\n\n        :return list of list of Name:\n        ';B=A.get_from_names()
		if A.children[-1]==_C:return[B]
		return[B+[A]for(A,C)in A._as_name_tuples()]
class ImportName(Import):
	'For ``import_name`` nodes. Covers normal imports without ``from``.';type=_I;__slots__=()
	def get_defined_names(A,include_setitem=_B):'\n        Returns the a list of `Name` that the import defines. The defined names\n        is always the first name after `import` or in case an alias - `as` - is\n        present that name is returned.\n        ';return[B or A[0]for(A,B)in A._dotted_as_names()]
	@property
	def level(self):'The level parameter of ``__import__``.';return 0
	def get_paths(A):return[A for(A,B)in A._dotted_as_names()]
	def _dotted_as_names(E):
		'Generator of (list(path), alias) where alias may be None.';B=E.children[1]
		if B.type=='dotted_as_names':D=B.children[::2]
		else:D=[B]
		for A in D:
			if A.type=='dotted_as_name':C=A.children[2];A=A.children[0]
			else:C=_A
			if A.type==_D:yield([A],C)
			else:yield(A.children[::2],C)
	def is_nested(A):'\n        This checks for the special case of nested imports, without aliases and\n        from statement::\n\n            import foo.bar\n        ';return bool([1 for(A,B)in A._dotted_as_names()if B is _A and len(A)>1])
	def _aliases(A):'\n        :return list of Name: Returns all the alias\n        ';return dict((A,B[-1])for(B,A)in A._dotted_as_names()if A is not _A)
class KeywordStatement(PythonBaseNode):
	'\n    For the following statements: `assert`, `del`, `global`, `nonlocal`,\n    `raise`, `return`, `yield`.\n\n    `pass`, `continue` and `break` are not in there, because they are just\n    simple keywords and the parser reduces it to a keyword.\n    ';__slots__=()
	@property
	def type(self):'\n        Keyword statements start with the keyword and end with `_stmt`. You can\n        crosscheck this with the Python grammar.\n        ';return'%s_stmt'%self.keyword
	@property
	def keyword(self):return self.children[0].value
	def get_defined_names(A,include_setitem=_B):
		B=A.keyword
		if B=='del':return _defined_names(A.children[1],include_setitem)
		if B in('global','nonlocal'):return A.children[1::2]
		return[]
class AssertStmt(KeywordStatement):
	__slots__=()
	@property
	def assertion(self):return self.children[1]
class GlobalStmt(KeywordStatement):
	__slots__=()
	def get_global_names(A):return A.children[1::2]
class ReturnStmt(KeywordStatement):__slots__=()
class YieldExpr(PythonBaseNode):type=_d;__slots__=()
def _defined_names(current,include_setitem):
	'\n    A helper function to find the defined names in statements, for loops and\n    list comprehensions.\n    ';D=include_setitem;A=current;B=[]
	if A.type in('testlist_star_expr','testlist_comp','exprlist','testlist'):
		for F in A.children[::2]:B+=_defined_names(F,D)
	elif A.type in('atom','star_expr'):B+=_defined_names(A.children[1],D)
	elif A.type in('power','atom_expr'):
		if A.children[-2]!='**':
			E=A.children[-1]
			if E.children[0]=='.':B.append(E.children[1])
			elif E.children[0]=='['and D:
				for C in A.children[-2::-1]:
					if C.type=='trailer':B.append(C.children[1]);break
					if C.type==_D:B.append(C);break
	else:B.append(A)
	return B
class ExprStmt(PythonBaseNode,DocstringMixin):
	type=_W;__slots__=()
	def get_defined_names(A,include_setitem=_B):
		'\n        Returns a list of `Name` defined before the `=` sign.\n        ';B=include_setitem;C=[]
		if A.children[1].type==_Q:C=_defined_names(A.children[0],B)
		return[D for C in range(0,len(A.children)-2,2)if'='in A.children[C+1].value for D in _defined_names(A.children[C],B)]+C
	def get_rhs(B):
		'Returns the right-hand-side of the equals.';A=B.children[-1]
		if A.type==_Q:
			if len(A.children)==4:A=A.children[3]
			else:A=A.children[1]
		return A
	def yield_operators(B):
		'\n        Returns a generator of `+=`, `=`, etc. or None if there is no operation.\n        ';A=B.children[1]
		if A.type==_Q:
			if len(A.children)<=2:return
			A=A.children[2]
		yield A;yield from B.children[3::2]
class NamedExpr(PythonBaseNode):
	type=_Y
	def get_defined_names(A,include_setitem=_B):return _defined_names(A.children[0],include_setitem)
class Param(PythonBaseNode):
	"\n    It's a helper class that makes business logic with params much easier. The\n    Python grammar defines no ``param`` node. It defines it in a different way\n    that is not really suited to working with parameters.\n    ";type=_M
	def __init__(A,children,parent=_A):super().__init__(children);A.parent=parent
	@property
	def star_count(self):
		'\n        Is `0` in case of `foo`, `1` in case of `*foo` or `2` in case of\n        `**foo`.\n        ';A=self.children[0]
		if A in(_C,'**'):return len(A.value)
		return 0
	@property
	def default(self):
		'\n        The default is the test node that appears after the `=`. Is `None` in\n        case no default is present.\n        ';A=self;B=A.children[-1]==','
		try:
			if A.children[-2-int(B)]=='=':return A.children[-1-int(B)]
		except IndexError:return
	@property
	def annotation(self):
		'\n        The default is the test node that appears after `:`. Is `None` in case\n        no annotation is present.\n        ';A=self._tfpdef()
		if A.type==_O:assert A.children[1]==':';assert len(A.children)==3;B=A.children[2];return B
		else:return
	def _tfpdef(A):'\n        tfpdef: see e.g. grammar36.txt.\n        ';B=int(A.children[0]in(_C,'**'));return A.children[B]
	@property
	def name(self):
		'\n        The `Name` leaf of the param.\n        ';A=self
		if A._tfpdef().type==_O:return A._tfpdef().children[0]
		else:return A._tfpdef()
	def get_defined_names(A,include_setitem=_B):return[A.name]
	@property
	def position_index(self):
		'\n        Property for the positional index of a paramter.\n        ';B=self;A=B.parent.children.index(B)
		try:
			C=B.parent.children.index(_C)
			if A>C:A-=2
		except ValueError:pass
		try:
			C=B.parent.children.index('/')
			if A>C:A-=2
		except ValueError:pass
		return A-1
	def get_parent_function(A):'\n        Returns the function/lambda of a parameter.\n        ';return A.search_ancestor(_E,_P)
	def get_code(B,include_prefix=True,include_comma=True):
		'\n        Like all the other get_code functions, but includes the param\n        `include_comma`.\n\n        :param include_comma bool: If enabled includes the comma in the string output.\n        ';C=include_prefix
		if include_comma:return super().get_code(C)
		A=B.children
		if A[-1]==',':A=A[:-1]
		return B._get_code_for_children(A,include_prefix=C)
	def __repr__(A):B=''if A.default is _A else'=%s'%A.default.get_code();return _b%(type(A).__name__,str(A._tfpdef())+B)
class SyncCompFor(PythonBaseNode):
	type=_X;__slots__=()
	def get_defined_names(A,include_setitem=_B):'\n        Returns the a list of `Name` that the comprehension defines.\n        ';return _defined_names(A.children[1],include_setitem)
CompFor=SyncCompFor
class UsedNamesMapping(Mapping):
	'\n    This class exists for the sole purpose of creating an immutable dict.\n    '
	def __init__(A,dct):A._dict=dct
	def __getitem__(A,key):return A._dict[key]
	def __len__(A):return len(A._dict)
	def __iter__(A):return iter(A._dict)
	def __hash__(A):return id(A)
	def __eq__(A,other):return A is other