zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
U
M±dú ã@sšddlmZddlZddlmZmZmZddlmZddl    m
Z
ddl m Z m Z ejdkrfdd    lmZe rxeege fZGd
d „d ƒZd d dœdd„ZdS)é)Ú annotationsN)ÚCallableÚIterableÚMapping)ÚAbstractContextManager)Ú TracebackType)Ú TYPE_CHECKINGÚAny)éé é)ÚBaseExceptionGroupc@sLeZdZddœdd„Zddœdd„Zd    d
d d d œdd„Zdddœdd„ZdS)Ú_Catcherz2Mapping[tuple[type[BaseException], ...], _Handler])Ú handler_mapcCs
||_dS©N)Ú _handler_map)Úselfr©rúLd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\exceptiongroup/_catch.pyÚ__init__sz_Catcher.__init__ÚNone)ÚreturncCsdSrr)rrrrÚ    __enter__sz_Catcher.__enter__ztype[BaseException] | NonezBaseException | NonezTracebackType | NoneÚbool)ÚetypeÚexcÚtbrcCs4|dk    r0| |¡}||krdS|dkr*dS|d‚dS)NFT)Úhandle_exception)rrrrZ    unhandledrrrÚ__exit__s
z_Catcher.__exit__Ú BaseExceptionzBaseExceptionGroup | None)rrc CsÐt|tƒr|}n td|gƒ}g}|j ¡D]\\}}| |¡\}}|r~z ||ƒWn,tk
r|}z| |¡W5d}~XYnX|s*qˆq*|r¤|rš| |¡td|ƒS|rÈt|jƒdkrÈ|jd|krÈ|S|SdS)NÚr r)    Ú
isinstancer rÚitemsÚsplitrÚappendÚlenÚ
exceptions)rrZexcgroupZnew_exceptionsZ    exc_typesÚhandlerÚmatchedÚnew_excrrrr(s2
 
 
ÿ ÿ ÿz_Catcher.handle_exceptionN)Ú__name__Ú
__module__Ú __qualname__rrrrrrrrrsrzFMapping[type[BaseException] | Iterable[type[BaseException]], _Handler]zAbstractContextManager[None])Ú
__handlersrcCs¸t|tƒstdƒ‚i}| ¡D]\}}t|tƒrBt|tƒrB|f}nt|tƒrVt|ƒ}ntdƒ‚t    |ƒsntdƒ‚|D]2}t|tƒrŠt|tƒs’tdƒ‚t|t
ƒrrtdƒ‚qr|||<qt |ƒS)Nzthe argument must be a mappingzCeach key must be either an exception classes or an iterable thereofzhandlers must be callablezHcatching ExceptionGroup with catch() is not allowed. Use except instead.) r!rÚ    TypeErrorr"ÚtypeÚ
issubclassrrÚtupleÚcallabler r)r-rZtype_or_iterabler'ÚiterableÚexc_typerrrÚcatchHs>
þ ÿ
 
ÿ ÿÿ
ÿ
r5)Ú
__future__rÚsysÚcollections.abcrrrÚ
contextlibrÚtypesrÚtypingrr    Ú version_infoÚ _exceptionsr rZ_Handlerrr5rrrrÚ<module>s   
 8