o
    2gN~                     @  s  U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ded< zddlZW n ey`   dZY nw zddlZddlZd	ZW n eyx   d
ZY nw edZ e	j!dkre"e#dd Z$ded< ne%ddZ&e"e&j'd Z$W d   n1 sw   Y  e(dZ)ded< dZ*ded< dZ+ded< dZ,ded< dZ-ded< dZ.ded< e/dZ0ded< ddd%d&Z1dd'd(Z2dd+d,Z3dd1d2Z4dd4d5Z5dd8d9Z6dd=d>Z7dd@dAZ8G dBdC dCe9Z:ddEdFZ;ddKdLZ<ddRdSZ=ddUdVZ>dWZ?dedX< dYZ@dedZ< d[ZAded\< d]ZBded^< d_ZCded`< ddhdiZDddkdlZEG dmdn dnZFddpdqZGddvdwZHi ZIdxedy< dd}d~ZJ	ddddZKdddZLe	jMdks}e	jMdkrdddZNndddZNddddZOdddZPdddZQdddZRdddZSdddZTdddZUddddZVdddZWdddZXdddZYG dd dZZdddZ[dddZ\dddZ]e
j^Z_dddZ`dddZadddńZbddddȄZcdddʄZddS )z3Utility functions with no non-trivial dependencies.    )annotationsN)	resources)	IOAnyCallable	ContainerFinalIterableSequenceSizedTypeVar)Literalr   orjsonTFT)   	   mypytypeshedr   TYPESHED_DIRzpy.typeds=   ([ \t\v]*#.*(\r\n?|\n))??[ \t\v]*#.*coding[:=][ \t]*([-\w.]+)ENCODING_RE   DEFAULT_SOURCE_OFFSETP   DEFAULT_COLUMNS   MINIMUM_WIDTH
   MINIMUM_WINDOWS_MAJOR_VT100iZ)  MINIMUM_WINDOWS_BUILD_VT100)__init____new____call____init_subclass____class_getitem__SPECIAL_DUNDERSnamestrexclude_specialboolreturnc                 C  s$   |r| t v rdS | do| dS )zReturns whether name is a dunder name.

    Args:
        exclude_special: Whether to return False for a couple special dunder methods.

    F__)r$   
startswithendswith)r%   r'    r-   A/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/util.py	is_dunderA   s   r/   c                 C  s   t |  o| do| dS N_)r/   r+   r,   r%   r-   r-   r.   	is_sunderM   s   r3   mod_name	list[str]c                 C  s4   | g}d| v r|  ddd } ||  d| v s|S )zReturn the module and all parent module names.

    So, if `mod_name` is 'a.b.c', this function will return
    ['a.b.c', 'a.b', and 'a'].
    .   r   )rsplitappend)r4   outr-   r-   r.   split_module_namesQ   s   
r;   modulesIterable[str]target
str | Nonec                 C  s   t | |}|d u rd S |d S Nr   )split_target)r<   r>   resultr-   r-   r.   module_prefix^   s   
rC   tuple[str, str] | Nonec                 C  sR   g }	 || v r|d |fS |dd}t|dkrd S |d }|d|d  q)NTr6   r7   r   )joinr8   leninsert)r<   r>   	remaining
componentsr-   r-   r.   rA   e   s   rA   objobjectc                 C  s,   | du rdS t t| }|dd dS )zReturn the last component of the type name of an object.

    If obj is None, return 'nil'. For example, if obj is 1, return 'int'.
    Nnilr6   z'>)r&   typesplitrstrip)rJ   tr-   r-   r.   
short_typeq   s   rR   textbytestuple[str, int]c                 C  sZ   t | }|r'|drdnd}|dd}|ds!|dkr#d}||fS d}|d	fS )
z*PEP-263 for detecting Python file encodingr7      r   ascii)ziso-latin-1-zlatin-1-ziso-latin-1zlatin-1utf8rM   )r   matchgroupdecoder+   )rS   rB   lineencodingdefault_encodingr-   r-   r.   find_python_encoding|   s   
r_   bc                 C  s   t | dd S )a2  Converts bytes into some human-readable representation. Unprintable
    bytes such as the nul byte are escaped. For example:

        >>> b = bytes([102, 111, 111, 10, 0])
        >>> s = bytes_to_human_readable_repr(b)
        >>> print(s)
        foo
 
        >>> print(repr(s))
        'foo\n\x00'
    rV   rM   )repr)r`   r-   r-   r.   bytes_to_human_readable_repr   s   rb   c                   @  s   e Zd ZdZdS )DecodeErrorzException raised when a file cannot be decoded due to an unknown encoding type.

    Essentially a wrapper for the LookupError raised by `bytearray.decode`
    N)__name__
__module____qualname____doc__r-   r-   r-   r.   rc      s    rc   sourcec              
   C  s`   |  drd}| dd } nt| \}}z| |}W |S  ty/ } ztt||d}~ww )zmRead the Python file with while obeying PEP-263 encoding detection.

    Returns the source as a string.
    s   ﻿rX   r   N)r+   r_   r[   LookupErrorrc   r&   )rh   r]   r1   source_text	lookuperrr-   r-   r.   decode_python_encoding   s   
rl   pathreadCallable[[str], bytes]list[str] | Nonec                 C  sJ   z|| }W n
 t y   Y dS w z	t| }W |S  ty$   Y dS w )zaTry reading a Python file as list of source lines.

    Return None if something goes wrong.
    N)OSErrorrl   
splitlinesrc   )rm   rn   rh   source_linesr-   r-   r.   read_py_file   s   rt   r\   max_lenintcol	min_widthc                 C  s   |d| d k rd| d }t | |kr| dfS || |k r(| d| d dfS |t | | d k rL|| | d }d| ||| d   d |d fS d| | d  t | | d fS )a  Trim a line of source code to fit into max_len.

    Show 'min_width' characters on each side of 'col' (an error location). If either
    start or end is trimmed, this is indicated by adding '...' there.
    A typical result looks like this:
        ...some_variable = function_to_call(one_arg, other_arg) or...

    Return the trimmed string and the column offset to to adjust error location.
    rV   r7   r   N...r   rF   )r\   ru   rw   rx   offsetr-   r-   r.   trim_source_line   s   
$"r|   list[tuple[int, str]]c                 C  s\   d}|| vrg S |  d}g }t|D ]\}}||r+||d |t|d  f q|S )Nz# mypy: 
r7   )rO   	enumerater+   r9   rF   )rh   PREFIXlinesresultsir\   r-   r-   r.   get_mypy_comments   s   

r   z<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="{errors}" failures="{failures}" name="mypy" skips="0" tests="{tests}" time="{time:.3f}">
JUNIT_HEADER_TEMPLATEz  <testcase classname="mypy" file="{filename}" line="1" name="{name}" time="{time:.3f}">
    <failure message="mypy produced messages">{text}</failure>
  </testcase>
JUNIT_TESTCASE_FAIL_TEMPLATEz  <testcase classname="mypy" file="mypy" line="1" name="mypy-py{ver}-{platform}" time="{time:.3f}">
    <error message="mypy produced errors">{text}</error>
  </testcase>
JUNIT_ERROR_TEMPLATEzr  <testcase classname="mypy" file="mypy" line="1" name="mypy-py{ver}-{platform}" time="{time:.3f}">
  </testcase>
JUNIT_TESTCASE_PASS_TEMPLATEz</testsuite>
JUNIT_FOOTERdtfloatseriousmessages_by_filedict[str | None, list[str]]versionplatformc                 C  s   ddl m} |rd}t|}nt|}d}tj||| t|pdd}|s/|tj| ||d7 }n:| D ]5\}	}
|	d urR|tj|d|
|	| dj|||	dd	7 }q3|tj|d|
d
| d| d| d	7 }q3|t	7 }|S )Nr   )escaper7   )errorsfailurestimetests)r   verr   r~   z"mypy-py{ver}-{platform} {filename})r   r   filename)rS   r   r   r%   r   zmypy-py-)
xml.sax.saxutilsr   rF   r   formatr   itemsr   rE   r   )r   r   r   r   r   r   r   r   xmlr   messagesr-   r-   r.   _generate_junit_contents	  s@   


	
r   Nonec           	      C  sr   t | ||||}tjtj|}tj|dd t|d}||d W d    d S 1 s2w   Y  d S )NT)exist_okwbutf-8)	r   osrm   dirnameabspathmakedirsopenwriteencode)	r   r   r   rm   r   r   r   xml_dirsfr-   r-   r.   write_junit_xml;  s   "r   c                   @  s$   e Zd ZdZdddZdd	d
ZdS )IdMapperzGenerate integer ids for objects.

    Unlike id(), these start from 0 and increment by 1, and ids won't
    get reused across the life-time of IdMapper.

    Assume objects don't redefine __eq__ or __hash__.
    r)   r   c                 C  s   i | _ d| _d S r@   id_mapnext_idselfr-   r-   r.   r   V  s   
zIdMapper.__init__orK   rv   c                 C  s.   || j vr| j| j |< |  jd7  _| j | S )Nr7   r   )r   r   r-   r-   r.   idZ  s   

zIdMapper.idN)r)   r   )r   rK   r)   rv   )rd   re   rf   rg   r   r   r-   r-   r-   r.   r   M  s    
r   fullnamec                 C  s   |  ddd S )zBDrop the final component of a qualified name (e.g. ('x.y' -> 'x').r6   r7   r   )r8   )r   r-   r-   r.   
get_prefixa  s   r   
cur_mod_idrelativeis_cur_package_init_filetuple[str, bool]c                 C  sp   |dkr|dfS |  d}|}|r|d8 }t||k}|dkr)d|d |  } | |r3d|  |fS d |fS )Nr   Tr6   r7    )rO   rF   rE   )r   r   r>   r   partsrelokr-   r-   r.   correct_relative_importf  s   
r   z$Final[dict[type[object], list[str]]]fields_cacheclstype[object]Sequence[str]c                   s>   dd l  | tvr |  fdd}dd |D t| < t|  S )Nr   c                   s     | p	 | S N)isgetsetdescriptorismemberdescriptor)r   inspectr-   r.   <lambda>  s    z'get_class_descriptors.<locals>.<lambda>c                 S  s$   g | ]\}}|d kr|dkr|qS )__weakref____dict__r-   ).0xyr-   r-   r.   
<listcomp>  s   $ z)get_class_descriptors.<locals>.<listcomp>)r   r   
getmembers)r   membersr-   r   r.   get_class_descriptorsx  s   r   r-   newold	copy_dict
skip_slotstuple[str, ...]c              	   C  s   t |dr|rt|j| _n|j| _t|jD ]+}||v rqzt ||r.t| |t|| n
t | |r8t| | W q tyB   Y qw dS )a   Copy state of old node to the new node.

    This handles cases where there is __dict__ and/or attribute descriptors
    (either from slots or because the type is defined in a C extension module).

    Assume that both objects have the same __class__.
    r   N)	hasattrdictr   r   	__class__setattrgetattrdelattrAttributeError)r   r   r   r   attrr-   r-   r.   replace_object_state  s"   




r   dirc                 C  s    | tjs|tj7 }| |S )ay  Given two paths, return if path is a sub-path of dir.

    Moral equivalent of: Path(dir) in Path(path).parents

    Similar to the pathlib version:
    - Treats paths case-sensitively
    - Does not fully handle unnormalised paths (e.g. paths with "..")
    - Does not handle a mix of absolute and relative paths
    Unlike the pathlib version:
    - Fast
    - On Windows, assumes input has been slash normalised
    - Handles even fewer unnormalised paths (e.g. paths with "." and "//")

    As a result, callers should ensure that inputs have had os.path.abspath called on them
    (note that os.path.abspath will normalise)
    )r,   r   sepr+   )rm   r   r-   r-   r.   is_sub_path_normabs  s   

r   linuxdarwinc                 C  s0   | ds| s	|S | dr| | S | d | S )N/)r+   r,   )rm   r`   r-   r-   r.   os_path_join  s
   
r   apc                 C  s   t j| |S r   )r   rm   rE   )r   r   r-   r-   r.   r     s   statusc                 C  s"   t j  t j  t|  dS )zKill the current process without fully cleaning up.

    This can be quite a bit faster than a normal exit() since objects are not freed.
    N)sysstdoutflushstderrr   _exit)r   r-   r-   r.   	hard_exit  s   

r   c                 C  s
   |  dS )z+Remove internal suffixes from a short name.')rP   r2   r-   r-   r.   unmangle  s   
r   existingContainer[str]c                 C  sL   | d }||vr
|S d}|t | |v r |d7 }|t | |v s|t | S )zGet a simple redefinition name not present among existing.

    For example, for name 'foo' we try 'foo-redefinition', 'foo-redefinition2',
    'foo-redefinition3', etc. until we find one that is not in existing.
    z-redefinitionrV   r7   )r&   )r%   r   r_namer   r-   r-   r.   get_unique_redefinition_name  s   r   programc                 C  s,   t jdd dk rt dj| d dS dS )zAReport issues with the Python used to run mypy, dmypy, or stubgenNrV   )r      zXRunning {name} with Python 3.7 or lower is not supported; please upgrade to 3.8 or newerr2   )r   version_infoexitr   )r   r-   r-   r.   check_python_version  s   r   r   tuple[int, int, int]c                 C  s@   dd | D }dd |D }dd | D }t |t |t |fS )zDCount total number of errors, notes and error_files in message list.c                 S     g | ]}d |v r|qS ): error:r-   r   er-   r-   r.   r         zcount_stats.<locals>.<listcomp>c                 S  s   h | ]	}| d d qS ):r   )rO   r   r-   r-   r.   	<setcomp>  s    zcount_stats.<locals>.<setcomp>c                 S  r   ): note:r-   r   r-   r-   r.   r     r  rz   )r   r   error_filesnotesr-   r-   r.   count_stats  s   r  msgc                 C  sV   d}g }d}| D ]}|dkr|r| | d}q|dkr| }||7 }q| | |S )z=Split line of text into words (but not within quoted groups).r   T ")r9   )r  	next_wordresallow_breakcr-   r-   r.   split_words  s   


r  c                   C  s   t tddpt jptS )zIGet current terminal width if possible, otherwise return the default one.MYPY_FORCE_TERMINAL_WIDTH0)rv   r   getenvshutilget_terminal_sizecolumnsr   r-   r-   r-   r.   get_terminal_width  s
   r  first_offset
num_indentc           
      C  s   t | }|d}g }|r8|d}|r|| n|| }t|t| d |kr/|d| 7 }n|| |}|s|| dd|  }	|	|S )a  Wrap a long error message into few lines.

    Breaks will only happen between words, and never inside a quoted group
    (to avoid breaking types such as "Union[int, str]"). The 'first_offset' is
    the width before the start of first line.

    Pad every next line with 'num_indent' spaces. Every line will be at most 'max_len'
    characters, except if it is a single word or quoted group.

    For example:
               first_offset
        ------------------------
        path/to/file: error: 58: Some very long error message
            that needs to be split in separate lines.
            "Long[Type, Names]" are never split.
        ^^^^--------------------------------------------------
        num_indent           max_len
    r   r7   r	  r~   )r  poprF   r9   rE   )
r  ru   r  r  words	next_liner   r  max_line_lenpaddingr-   r-   r.   	soft_wrap  s   



	
r  datac                 C  s   t |  S )zCompute a hash digest of some data.

    We use a cryptographic hash because we want a low probability of
    accidental collision, but we don't really care about any of the
    cryptographic properties.
    )hashlibsha1	hexdigestr  r-   r-   r.   hash_digest;  s   r$  cupc                 C  sH   t jdkr	J dd| dd  dg}t|dd	d
 }|S )z.Reproduce a gray color in ANSI escape sequencewin32Fz"curses is not available on Windowsr   NrM   mr   r7   r   )r   r   rE   r[   cursestparmr   )r%  	set_colorgrayr-   r-   r.   parse_gray_colorE  s
   
r,  c                  C  s>   t dt dd} ztt| W S  ty   t|  Y S w )NMYPY_FORCE_COLORFORCE_COLORr  )r   r  r(   rv   
ValueError)env_varr-   r-   r.   should_force_colorN  s   r1  c                   @  s   e Zd ZdZ	d8d9ddZd:ddZd:ddZd:ddZ			d;d<ddZ	d=d>d!d"Z	d?d$d%Z
d@d'd(ZdAd*d+ZdBdCd0d1Zdd,d2dDd6d7ZdS )EFancyFormatterzcApply color and bold font to terminal output.

    This currently only works on Linux and Mac.
    Ff_outIO[str]f_errhide_error_codesr(   hide_successr)   r   c                 C  s   || _ || _tjdvrd| _d S t s | r| s d| _d S tjdkr,|   | _ntjdkr8|   | _n| 	  | _| jsP| j
| j| j| jdd| _d S d S )N)r   r   r&  
emscriptenTr&  r8  r   )redgreenblueyellownone)r6  r7  r   r   
dummy_termr1  isattyinitialize_win_colorsinitialize_vt100_colorsinitialize_unix_colorsREDGREENBLUEYELLOWcolors)r   r3  r5  r6  r7  r-   r-   r.   r   \  s*   


zFancyFormatter.__init__c                 C  sB   t jdv sJ d| _d| _d| _d| _d| _d| _d| _d	| _	d
S )SReturn True if initialization was successful and we can use colors, False otherwise)r&  r8  z[1mz[4mz[94mz[92mz[91mz[93mz[0mz[2mT)
r   r   BOLDUNDERrE  rD  rC  rF  NORMALDIMr   r-   r-   r.   rA  x  s   z&FancyFormatter.initialize_vt100_colorsc                 C  s   t jdksJ t jdkr?t  }|jtk s|jtk rdS ddl}|jj	}d}d}d}d}|
||||B |B  |   d	S dS )
rH  r&  Fr   Nr7   rV   r   iT)r   r   getwindowsversionmajorr   buildr   ctypeswindllkernel32SetConsoleModeGetStdHandlerA  )r   winverrP  rR  ENABLE_PROCESSED_OUTPUTENABLE_WRAP_AT_EOL_OUTPUT"ENABLE_VIRTUAL_TERMINAL_PROCESSINGSTD_OUTPUT_HANDLEr-   r-   r.   r@    s.   


z$FancyFormatter.initialize_win_colorsc                 C  s^  t jdksts	dS z7zt j }W n' tjy8   tdd}tj	| d W d   n1 s1w   Y  Y nw tj	|d W n tj
yK   Y dS w td}td}td	}td
}td}|ro|ro|ro|ro|sqdS | | _| | _| | _t|| _t|tj | _t|tj | _t|tj | _t|tj | _dS )rH  r&  Fz	/dev/nullrb)fdNboldsmulsetafr%  sgr0T)r   r   CURSES_ENABLEDr   filenoioUnsupportedOperationr   r(  	setuptermerrortigetstrr[   rK  rI  rJ  r,  rL  r)  
COLOR_BLUErE  COLOR_GREENrD  	COLOR_REDrC  COLOR_YELLOWrF  )r   r[  r   r\  underr*  set_eseqnormalr-   r-   r.   rB    s@   








z%FancyFormatter.initialize_unix_colorsrS   r&   color1Literal['red', 'green', 'blue', 'yellow', 'none']r\  	underlinedimc                 C  sN   | j r|S |r| j}nd}|r|| j7 }|r|| j7 }|| j|  | | j S )z2Apply simple color and style (underlined or bold).r   )r>  rI  rJ  rL  rG  rK  )r   rS   rn  r\  rp  rq  startr-   r-   r.   style  s   	

zFancyFormatter.styleNr   r5   fixed_terminal_width
int | Nonec                 C  sZ  |pt  }| }t|D ]\}}d|v r3|jddd\}}t||t|td d}|d | ||< |dt rd|vr|td	 }||d  }	|	d}
|
t }d
|	vrZd}n|	|
|		d
d  }|t d }t
|||t\}}dt | ||< dt| |  | }t|t|| krt|dkr|d	t|| d  d }|||d < q|S )zHImprove readability by wrapping error messages and trimming source code.r   error:r7   maxsplitzerror: )r  r	  ^N~   r   ry   )r  copyr   rO   r  rF   r+   r   indexrindexr|   r   )r   r   rt  widthnew_messagesr   re  locr  marker_linemarker_columncolumnmarkerru   source_liner{   new_marker_liner-   r-   r.   fit_in_terminal  s0   

 zFancyFormatter.fit_in_terminalre  c                 C  s  d|v rL|j ddd\}}| jr|| jdddd | | S |d}|d	kr5||d
 }|d
| }nd}|| jdddd | | | |d S d|v rk|j ddd\}}| | |}|| dd | S |dt rd|vr~| j|dddS | |dS |S )zBColorize an output line by highlighting the status and error code.r   rv  r7   rw  r9  Tr\  [rM   Nr   r<  r  znote:r;  r	  ry  r=  )rq  )rO   r6  rs  highlight_quote_groupsrfindunderline_linkr+   r   )r   re  r  r  codeposcode	formattedr-   r-   r.   colorize  s6   

zFancyFormatter.colorizer  c                 C  sp   | dd r	|S |d}d}t|D ]!\}}|d dkr'|| |d7 }q|| jd| d ddd7 }q|S )zMake groups quoted with double quotes bold (including quotes).

        This is used to highlight types, attribute names etc.
        r
  rV   r   r   r=  Tr  )countrO   r   rs  )r   r  r   r:   r   partr-   r-   r.   r  #  s   
z%FancyFormatter.highlight_quote_groupsnotec                 C  sT   t d|}|s
|S | }| }|d| | j||| ddd ||d  S )zuUnderline a link in a note message (if any).

        This assumes there is at most one link in the message.
        zhttps?://\S*Nr=  T)rp  )researchrr  endrs  )r   r  rY   rr  r  r-   r-   r.   r  4  s   0zFancyFormatter.underline_linkT	n_sourcesrv   	use_colorc                 C  s6   | j rdS d| dt| }|s|S | j|dddS )zFormat short summary in case of success.

        n_sources is total number of files passed directly on command line,
        i.e. excluding stubs and followed imports.
        r   zSuccess: no issues found in  source filer:  Tr  )r7  plural_srs  )r   r  r  r  r-   r-   r.   format_success@  s   zFancyFormatter.format_success)blockersr  n_errorsn_filesr  c             	   C  sd   d| dt | d| dt | }|r|d7 }n|d| dt | d7 }|s*|S | j|d	d
dS )z)Format a short summary in case of errors.zFound z errorz in z filez$ (errors prevented further checking)z
 (checked r  )r9  Tr  )r  rs  )r   r  r  r  r  r  r  r-   r-   r.   format_errorN  s   $

zFancyFormatter.format_errorF)
r3  r4  r5  r4  r6  r(   r7  r(   r)   r   r)   r(   )FFF)rS   r&   rn  ro  r\  r(   rp  r(   rq  r(   r)   r&   r   )r   r5   rt  ru  r)   r5   )re  r&   r)   r&   )r  r&   r)   r&   )r  r&   r)   r&   )T)r  rv   r  r(   r)   r&   )r  rv   r  rv   r  rv   r  r(   r  r(   r)   r&   )rd   re   rf   rg   r   rA  r@  rB  rs  r  r  r  r  r  r  r-   r-   r-   r.   r2  V  s(    


)
%
 
r2  typeshed_dirfilec                 C  sD   | d ur| nt } ztj| tj|f| kW S  ty!   Y dS w )NF)r   r   rm   
commonpathr   r/  )r  r  r-   r-   r.   is_typeshed_fileb  s   r  c                 C  s0   |  dsdS tdd tjtj| D S )Nz.pyiFc                 s  s    | ]}| d V  qdS )z-stubsN)r,   )r   	componentr-   r-   r.   	<genexpr>n  s    z'is_stub_package_file.<locals>.<genexpr>)r,   anyr   rm   rO   r   )r  r-   r-   r.   is_stub_package_filej  s   
"r  c                 C  s   | d uo| dkS r0   r-   r2   r-   r-   r.   unnamed_functionq  s   r  t0c                 C  s   t t |  d S )Ni  )rv   r   perf_counter_ns)r  r-   r-   r.   time_spent_usx  s   r  sint | Sizedc                 C  s&   t | tr| nt| }|dkrdS dS )Nr7   r  r   )
isinstancerv   rF   )r  r  r-   r-   r.   r  |  s   r  docstrc                 C  sh   d tdt| }|dr.d|dd vr(|d dkr(d|dd  dS d	| d	S d
| d
S )zKReturns docstring correctly encapsulated in a single or double quoted form.r~   z(?<=[^\\])\\nr   r
  r7   rM   z"""z''z"")rE   r  rO   ra   r+   )r  docstr_reprr-   r-   r.   quote_docstring  s   
r  debugc                 C  sb   t d ur|rt j| t jt jB dS t j| t jdS |r&tj| ddddS tj| ddddS )N)optionrV   T)indent	sort_keysr   ),r  )r  
separators)r   dumpsOPT_INDENT_2OPT_SORT_KEYSjsonr   )rJ   r  r-   r-   r.   
json_dumps  s   r  c                 C  s   t d ur	t | S t| S r   )r   loadsr  r#  r-   r-   r.   
json_loads  s   

r  r  )r%   r&   r'   r(   r)   r(   )r%   r&   r)   r(   )r4   r&   r)   r5   )r<   r=   r>   r&   r)   r?   )r<   r=   r>   r&   r)   rD   )rJ   rK   r)   r&   )rS   rT   r)   rU   )r`   rT   r)   r&   )rh   rT   r)   r&   )rm   r&   rn   ro   r)   rp   )
r\   r&   ru   rv   rw   rv   rx   rv   r)   rU   )rh   r&   r)   r}   )r   r   r   r(   r   r   r   r&   r   r&   r)   r&   )r   r   r   r(   r   r   rm   r&   r   r&   r   r&   r)   r   )r   r&   r)   r&   )
r   r&   r   rv   r>   r&   r   r(   r)   r   )r   r   r)   r   )Fr-   )
r   rK   r   rK   r   r(   r   r   r)   r   )rm   r&   r   r&   r)   r(   )rm   r&   r`   r&   r)   r&   )r   r&   r   r&   r)   r&   )r   )r   rv   r)   r   )r%   r&   r)   r&   )r%   r&   r   r   r)   r&   )r   r&   r)   r   )r   r5   r)   r   )r  r&   r)   r5   )r)   rv   )
r  r&   ru   rv   r  rv   r  rv   r)   r&   )r  rT   r)   r&   )r%  rT   r)   r&   r  )r  r?   r  r&   r)   r(   )r  r&   r)   r(   )r%   r?   r)   r(   )r  rv   r)   rv   )r  r  r)   r&   )r  r&   r)   r&   )rJ   rK   r  r(   r)   rT   )r  rT   r)   r   )erg   
__future__r   r   rb  r  r   r  r  r   r   	importlibr   importlib_resourcestypingr   r   r   r   r   r	   r
   r   r   typing_extensionsr   __annotations__r   ImportErrorr(  _cursesr`  r   r   r&   filesr   rm   	_resourceparentcompiler   r   r   r   r   r   	frozensetr$   r/   r3   r;   rC   rA   rR   r_   rb   	Exceptionrc   rl   rt   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r$  r,  r1  r2  r  r  r  r  time_refr  r  r  r  r  r-   r-   r-   r.   <module>   s    ,











 

2



 








	
$


	  





