_C='Can only compare to tuples of length 2.'
_B='utf-8'
_A=None
import re,sys
from ast import literal_eval
from functools import total_ordering
from typing import NamedTuple,Sequence,Union
_NON_LINE_BREAKS='\x0b','\x0c','\x1c','\x1d','\x1e','\x85','\u2028','\u2029'
class Version(NamedTuple):major:int;minor:int;micro:int
def split_lines(string,keepends=False):
	'\n    Intended for Python code. In contrast to Python\'s :py:meth:`str.splitlines`,\n    looks at form feeds and other special characters as normal text. Just\n    splits ``\\n`` and ``\\r\\n``.\n    Also different: Returns ``[""]`` for an empty string input.\n\n    In Python 2.7 form feeds are used as normal characters when using\n    str.splitlines. However in Python 3 somewhere there was a decision to split\n    also on form feeds.\n    ';B=string
	if keepends:
		A=B.splitlines(True);D=[]
		for(E,F)in enumerate(A):
			try:G=F[-1]
			except IndexError:pass
			else:
				if G in _NON_LINE_BREAKS:D.append(E)
		for C in reversed(D):
			try:A[C]=A[C]+A[C+1];del A[C+1]
			except IndexError:pass
		if B.endswith('\n')or B.endswith('\r')or B=='':A.append('')
		return A
	else:return re.split('\\n|\\r\\n|\\r',B)
def python_bytes_to_unicode(source,encoding=_B,errors='strict'):
	"\n    Checks for unicode BOMs and PEP 263 encoding declarations. Then returns a\n    unicode object like in :py:meth:`bytes.decode`.\n\n    :param encoding: See :py:meth:`bytes.decode` documentation.\n    :param errors: See :py:meth:`bytes.decode` documentation. ``errors`` can be\n        ``'strict'``, ``'replace'`` or ``'ignore'``.\n    ";D='replace';B=errors;C=encoding;A=source
	def E():
		'\n        For the implementation of encoding definitions in Python, look at:\n        - http://www.python.org/dev/peps/pep-0263/\n        - http://docs.python.org/2/reference/lexical_analysis.html#encoding-declarations\n        ';F=literal_eval("b'\\xef\\xbb\\xbf'")
		if A.startswith(F):return _B
		G=re.match(b'(?:[^\\r\\n]*(?:\\r\\n|\\r|\\n)){0,2}',A).group(0);E=re.search(b'coding[=:]\\s*([-\\w.]+)',G)
		if E:
			B=E.group(1)
			if not isinstance(B,str):B=str(B,'ascii',D)
			return B
		else:return C
	if isinstance(A,str):return A
	C=E()
	try:return str(A,C,B)
	except LookupError:
		if B==D:return str(A,_B,B)
		raise
def version_info():"\n    Returns a namedtuple of parso's version, similar to Python's\n    ``sys.version_info``.\n    ";from parso import __version__;A=re.findall('[a-z]+|\\d+',__version__);return Version(*[A if B==3 else int(A)for(B,A)in enumerate(A)])
class _PythonVersionInfo(NamedTuple):major:int;minor:int
@total_ordering
class PythonVersionInfo(_PythonVersionInfo):
	def __gt__(A,other):
		B=other
		if isinstance(B,tuple):
			if len(B)!=2:raise ValueError(_C)
			return(A.major,A.minor)>B
		super().__gt__(B);return A.major,A.minor
	def __eq__(B,other):
		A=other
		if isinstance(A,tuple):
			if len(A)!=2:raise ValueError(_C)
			return(B.major,B.minor)==A
		super().__eq__(A)
	def __ne__(A,other):return not A.__eq__(other)
def _parse_version(version):
	B=re.match('(\\d+)(?:\\.(\\d{1,2})(?:\\.\\d+)?)?((a|b|rc)\\d)?$',version)
	if B is _A:raise ValueError('The given version is not in the right format. Use something like "3.8" or "3".')
	C=int(B.group(1));A=B.group(2)
	if A is _A:
		if C==2:A='7'
		elif C==3:A='6'
		else:raise NotImplementedError('Sorry, no support yet for those fancy new/old versions.')
	A=int(A);return PythonVersionInfo(C,A)
def parse_version_string(version=_A):
	'\n    Checks for a valid version number (e.g. `3.8` or `3.10.1` or `3`) and\n    returns a corresponding version info that is always two characters long in\n    decimal.\n    ';A=version
	if A is _A:A='%s.%s'%sys.version_info[:2]
	if not isinstance(A,str):raise TypeError('version must be a string like "3.8"')
	return _parse_version(A)