zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
U
T±daã@s¤ddlZddlZddlmZmZdddddgZd    d„Zd
d„Zejd d d d Gdd„dej    ƒƒZ
ejd d d dGdd„de
ƒƒZ ejd d d dGdd„de
ƒƒZ dS)éNé)ÚAlreadyUsedErrorÚremove_tb_framesÚErrorÚOutcomeÚValueÚacaptureÚcapturec
OsNzt|||ŽƒWStk
rH}zt|dƒ}t|ƒWY¢Sd}~XYnXdS)zŒRun ``sync_fn(*args, **kwargs)`` and capture the result.
 
    Returns:
      Either a :class:`Value` or :class:`Error` as appropriate.
 
    rN©rÚ BaseExceptionrr)Zsync_fnÚargsÚkwargsÚexc©rúDd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\outcome/_impl.pyr    
s
 
c
ÏsTzt|||ŽIdHƒWStk
rN}zt|dƒ}t|ƒWY¢Sd}~XYnXdS)z“Run ``await async_fn(*args, **kwargs)`` and capture the result.
 
    Returns:
      Either a :class:`Value` or :class:`Error` as appropriate.
 
    Nrr
)Zasync_fnr r rrrrrs
 
FT)ÚreprÚinitÚslotsc@sReZdZdZejddddZdd„Zej    dd„ƒZ
ej    dd    „ƒZ ej    d
d „ƒZ d S) ra;An abstract class representing the result of a Python computation.
 
    This class has two concrete subclasses: :class:`Value` representing a
    value, and :class:`Error` representing an exception.
 
    In addition to the methods described below, comparison operators on
    :class:`Value` and :class:`Error` objects (``==``, ``<``, etc.) check that
    the other object is also a :class:`Value` or :class:`Error` object
    respectively, and then compare the contained objects.
 
    :class:`Outcome` objects are hashable if the contained objects are
    hashable.
 
    F)ÚdefaultÚeqrcCs|jr
t‚t |dd¡dS)NÚ
_unwrappedT)rrÚobjectÚ __setattr__©ÚselfrrrÚ_set_unwrapped8szOutcome._set_unwrappedcCsdS)zºReturn or raise the contained value or exception.
 
        These two lines of code are equivalent::
 
           x = fn(*args)
           x = outcome.capture(fn, *args).unwrap()
 
        NrrrrrÚunwrap=szOutcome.unwrapcCsdS)zÑSend or throw the contained value or exception into the given
        generator object.
 
        Args:
          gen: A generator object supporting ``.send()`` and ``.throw()``
              methods.
 
        Nr©rÚgenrrrÚsendHsz Outcome.sendcÃsdS)záSend or throw the contained value or exception into the given async
        generator object.
 
        Args:
          agen: An async generator object supporting ``.asend()`` and
              ``.athrow()`` methods.
 
        Nr©rZagenrrrÚasendSsz Outcome.asendN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__ÚattrÚibrrÚabcÚabstractmethodrrr!rrrrr&s
 
 
 
)Úfrozenrrc@s8eZdZdZe ¡Zdd„Zdd„Zdd„Z    dd    „Z
d
S) rzFConcrete :class:`Outcome` subclass representing a regular value.
 
    cCsd|j›dS)NzValue(ú))ÚvaluerrrrÚ__repr__hszValue.__repr__cCs| ¡|jS©N)rr,rrrrrksz Value.unwrapcCs| ¡| |j¡Sr.)rrr,rrrrrosz
Value.sendcÃs| ¡| |j¡IdHSr.)rr!r,r rrrr!ssz Value.asendN) r"r#r$r%r&r'r,r-rrr!rrrrr_s c@sDeZdZdZejej e¡dZ    dd„Z
dd„Z dd„Z d    d
„Z d S) rzIConcrete :class:`Outcome` subclass representing a raised exception.
 
    )Z    validatorcCsd|j›dS)NzError(r+)Úerrorrrrrr-szError.__repr__cCs"| ¡|j}z|‚W5~~XdSr.)rr/)rZcaptured_errorrrrr„s
z Error.unwrapcCs| ¡| |j¡Sr.)rÚthrowr/)rÚitrrrršsz
Error.sendcÃs| ¡| |j¡IdHSr.)rÚathrowr/r rrrr!žsz Error.asendN)r"r#r$r%r&r'Z
validatorsZ instance_ofr r/r-rrr!rrrrrxs ) r(r&Z_utilrrÚ__all__r    rÚsÚABCrrrrrrrÚ<module>s8