hyb
2025-11-07 cadac0a99d87c53805a07f3b4ca7fd11e524fe4a
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Ë
 
çúh¥:ãóþ—ddlZddlZddlmZddlmZddlmZddlm    Z    m
Z
m Z ddl m Z mZmZmZGd„de «ZGd    „d
e «ZGd „d e    «ZGd „dee «ZGd„d«ZGd„de
«ZGd„de«Zy)éN)ÚOptional)ÚRedis)ÚSentinelCommands)Ú
ConnectionÚConnectionPoolÚ SSLConnection)ÚConnectionErrorÚ ReadOnlyErrorÚ ResponseErrorÚ TimeoutErrorcó —eZdZy)ÚMasterNotFoundErrorN©Ú__name__Ú
__module__Ú __qualname__©óõaH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\redis/sentinel.pyrró„Ørrcó —eZdZy)ÚSlaveNotFoundErrorNrrrrrrrrrcób‡—eZdZˆfd„Zd„Zd„Zd„Zd„Z    d dddœdee    d    ee    fˆfd
„Z
ˆxZ S) ÚSentinelManagedConnectionc óP•—|jd«|_t‰| di|¤Žy)NÚconnection_poolr)ÚpoprÚsuperÚ__init__)ÚselfÚkwargsÚ    __class__s  €rrz"SentinelManagedConnection.__init__s%ø€Ø%Ÿz™zÐ*;Ó<ˆÔÜ ‰ÑÑ"˜6Ó"rcóð—|j}dt|«j›dt|«j›d|j›d}|j
r!d|j
›d|j ›}||z}|S)Nú<ú.ú    (service=z%s)>z,host=z,port=)rÚtyperrÚ service_nameÚhostÚport)r ÚpoolÚsÚ    host_infos    rÚ__repr__z"SentinelManagedConnection.__repr__s{€Ø×#Ñ#ˆà”T“
×%Ñ%Ð& a¬¨T«
×(;Ñ(;Ð'<ؘ×)Ñ)Ð*¨$ð 0ð    
ð 9Š9Ø  §¡  ¨6°$·)±)°Ð=ˆIؐI‘ ˆA؈rcóp—|\|_|_|j|jjd¬«y)NF)Ú check_healthÚretry_socket_connect)r)r*Úconnect_check_healthrÚcheck_connection)r Úaddresss  rÚ
connect_toz$SentinelManagedConnection.connect_to(s5€Ø&шŒ    4”9à ×!Ñ!Ø×-Ñ-×>Ñ>Ø!&ð    "õ    
rcó*—|jry|jjr*|j|jj    ««y|jj «D]}    |j|«cSt‚#t $rYŒ)wxYw©N)Ú_sockrÚ    is_masterr5Úget_master_addressÚ rotate_slavesr    r)r Úslaves  rÚ_connect_retryz(SentinelManagedConnection._connect_retry0s„€Ø :Š:Ø Ø × Ñ × )Ò )Ø O‰O˜D×0Ñ0×CÑCÓEÕ Fà×-Ñ-×;Ñ;Ó=ò ðØŸ?™?¨5Ó1Ò1ð ô
%Ð $øô'òÙðúsÁ,B    BÂBcóP—|jj|jd„«S)Ncó—yr7r)Úerrors rú<lambda>z3SentinelManagedConnection.connect.<locals>.<lambda>>sr)ÚretryÚcall_with_retryr=©r s rÚconnectz!SentinelManagedConnection.connect=s €Øz‰z×)Ñ)¨$×*=Ñ*=Ñ?QÓRÐRrF)Údisconnect_on_errorÚ push_requestrFrGc󨕗    t‰||||¬«S#t$r3|jjr|j «t d«‚‚wxYw)N)Údisable_decodingrFrGz"The previous master is now a slave)rÚ read_responser
rr9Ú
disconnectr    )r rIrFrGr"s    €rrJz'SentinelManagedConnection.read_response@scø€ð    Ü‘7Ñ(Ø!1Ø$7Ø)ð)óð øô
ò        Ø×#Ñ#×-Ò-ð —‘Ô!Ü%Ð&JÓKÐKØ ð        ús    ƒ•<A)F) rrrrr.r5r=rErÚboolrJÚ __classcell__©r"s@rrrsUø„ô#ò    ò
ò %òSð
ðð/4Ø',ò ð& d™^ð    ð
˜t‘n÷ ñrrcó —eZdZy)ÚSentinelManagedSSLConnectionNrrrrrPrPYrrrPcó$—eZdZd„Zd„Zd„Zd„Zy)ÚSentinelConnectionPoolProxycó—tj|«|_||_||_||_||_|j«yr7)ÚweakrefÚrefÚconnection_pool_refr9r3r(Úsentinel_managerÚreset)r rr9r3r(rWs      rrz$SentinelConnectionPoolProxy.__init__^s=€ô$+§;¡;¨Ó#?ˆÔ Ø"ˆŒØ 0ˆÔØ(ˆÔØ 0ˆÔØ 
‰
 rcó —d|_d|_yr7)Úmaster_addressÚslave_rr_counterrDs rrXz!SentinelConnectionPoolProxy.resetms€Ø"ˆÔØ $ˆÕrcóܗ|jj|j«}|jr:|j|k7r+||_|j «}||j d¬«|S)NF)Úinuse_connections)rWÚdiscover_masterr(r9rZrVrK)r rZrs   rr:z.SentinelConnectionPoolProxy.get_master_addressqsg€Ø×.Ñ.×>Ñ>¸t×?PÑ?PÓQˆØ >Š>˜d×1Ñ1°^ÒCØ"0ˆDÔ ð#×6Ñ6Ó8ˆOØÐ*Ø×*Ñ*¸UÐ*ÔCØÐrc#óÊK—|jj|j«}|r|j€'t    j
dt |«dz
«|_tt |««D]5}|jdzt |«z|_||j}|–—Œ7    |j«–—td|j›«‚#t$rYŒ#wxYw­w)NrézNo slave found for ) rWÚdiscover_slavesr(r[ÚrandomÚrandintÚlenÚranger:rr)r ÚslavesÚ_r<s    rr;z)SentinelConnectionPoolProxy.rotate_slaves|sØèø€Ø×&Ñ&×6Ñ6°t×7HÑ7HÓIˆÙ Ø×$Ñ$Ð,Ü(.¯©°q¼#¸f»+ȹ/Ó(JÔ%Üœ3˜v›;Ó'ò Ø)-×)>Ñ)>ÀÑ)BÄcÈ&ÃkÑ(QÔ%ؘt×4Ñ4Ñ5Ø“ ð ð
    Ø×)Ñ)Ó+Ò +ô!Ð#6°t×7HÑ7HÐ6KÐ!LÓMÐMøô#ò    Ù ð    üs*‚B'C#Â*CÂ<C#à   C ÃC#ÃC àC#N)rrrrrXr:r;rrrrRrR]s„ò ò%ò    óNrrRcóX‡—eZdZdZˆfd„Zd„Zˆfd„Zed„«Zˆfd„Z    d„Z
d„Z ˆxZ S)    ÚSentinelConnectionPoolz¸
    Sentinel backed connection pool.
 
    If ``check_connection`` flag is set to True, SentinelManagedConnection
    sends a PING command right after establishing the connection.
    c ó‚•—|jd|jdd«rtnt«|d<|jdd«|_|jdd«|_t ||j|j
||¬«|_t‰|$d    i|¤Ž|j|jd<||_ ||_ y)
NÚconnection_classÚsslFr9Tr3)rr9r3r(rWrr) ÚgetrrPrr9r3rRÚproxyrrÚconnection_kwargsr(rW)r r(rWr!r"s    €rrzSentinelConnectionPool.__init__•s¶ø€Ø%+§Z¡ZØ ð—:‘:˜e UÔ+õ-ä.ó &
ˆÐ!Ñ"ð Ÿ™ K°Ó6ˆŒØ &§
¡
Ð+=¸uÓ EˆÔÜ0ؠؗn‘nØ!×2Ñ2Ø%Ø-ô 
ˆŒ
ô    ‰ÑÑ"˜6Ò"Ø48·J±Jˆ×ÑÐ0Ñ1Ø(ˆÔØ 0ˆÕrc    ó —|jrdnd}dt|«j›dt|«j›d|j›d|›d    S)NÚmasterr<r$r%r&ú(z))>)r9r'rrr()r Úroles  rr.zSentinelConnectionPool.__repr__¬sR€ØŸ>š>‰x¨wˆà”T“
×%Ñ%Ð& a¬¨T«
×(;Ñ(;Ð'<ؘ×)Ñ)Ð*¨!¨D¨6°ð 6ð    
rcóV•—t‰|«|jj«yr7)rrXrn)r r"s €rrXzSentinelConnectionPool.reset³sø€Ü ‰‰ ŒØ 
‰
×ÑÕrcó.—|jjSr7)rnrZrDs rrZz%SentinelConnectionPool.master_address·s€àz‰z×(Ñ(Ð(rcóƕ—|j xs3|jxr%|j|j|jfk(}t    «}|xr|j |«Sr7)r9rZr)r*rÚowns_connection)r Ú
connectionÚcheckÚparentr"s    €rrwz&SentinelConnectionPool.owns_connection»sZø€Ø—N‘NÐ"ò
Ø N‰NÒ X˜t×2Ñ2°z·±È
ÏÉÐ6XÑXð    ô“ˆØÒ;˜×/Ñ/°
Ó;Ð;rcó6—|jj«Sr7)rnr:rDs rr:z)SentinelConnectionPool.get_master_addressÂs€Øz‰z×,Ñ,Ó.Ð.rcó6—|jj«S)zRound-robin slave balancer)rnr;rDs rr;z$SentinelConnectionPool.rotate_slavesÅs€àz‰z×'Ñ'Ó)Ð)r) rrrÚ__doc__rr.rXÚpropertyrZrwr:r;rMrNs@rriris:ø„ñô1ò.
ôðñ)óð)ô<ò/ö*rricóZ—eZdZdZ            d d„Zd„Zd„Zd„Zd„Zd„Z    d    „Z
e e fd
„Z e e fd „Zy) ÚSentinelar
    Redis Sentinel cluster client
 
    >>> from redis.sentinel import Sentinel
    >>> sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1)
    >>> master = sentinel.master_for('mymaster', socket_timeout=0.1)
    >>> master.set('foo', 'bar')
    >>> slave = sentinel.slave_for('mymaster', socket_timeout=0.1)
    >>> slave.get('foo')
    b'bar'
 
    ``sentinels`` is a list of sentinel nodes. Each node is represented by
    a pair (hostname, port).
 
    ``min_other_sentinels`` defined a minimum number of peers for a sentinel.
    When querying a sentinel, if it doesn't meet this threshold, responses
    from that sentinel won't be considered valid.
 
    ``sentinel_kwargs`` is a dictionary of connection arguments used when
    connecting to sentinel instances. Any argument that can be passed to
    a normal Redis connection can be specified here. If ``sentinel_kwargs`` is
    not specified, any socket_timeout and socket_keepalive options specified
    in ``connection_kwargs`` will be used.
 
    ``connection_kwargs`` are keyword arguments that will be used when
    establishing a connection to a Redis server.
    Nc     ó —|€5|j«Dcic]\}}|jd«sŒ||“Œ}}}||_|D    cgc]\}}    t||    fi|j¤Ž‘Œc}    }|_||_||_||_ycc}}wcc}    }w)NÚsocket_)ÚitemsÚ
startswithÚsentinel_kwargsrÚ    sentinelsÚmin_other_sentinelsroÚ_force_master_ip)
r r†r‡r…Úforce_master_iproÚkÚvÚhostnamer*s
          rrzSentinel.__init__çs €ð Ð "à!2×!8Ñ!8Ó!:÷Ù˜˜A¸a¿l¹lÈ9Õ>U1‘ðˆOñð /ˆÔð#,÷
ᐘ$ô (˜DÑ 9 D×$8Ñ$8Ó 9ó
ˆŒð$7ˆÔ Ø!2ˆÔØ /ˆÕùóùó
 
s–B°BÁ!B
cól—t|jdd««}t|jdd««}|r:tj|j«j
|i|¤Ž}|r|gS|rdSdSg}|jD]#}|j |j
|i|¤Ž«Œ%|r|St|«S)zÓ
        Execute Sentinel command in sentinel nodes.
        once - If set to True, then execute the resulting command on a single
        node at random, rather than across the entire sentinel cluster.
        ÚonceFÚreturn_responsesT)rLrrbÚchoicer†Úexecute_commandÚappendÚall)r Úargsr!rŽrÚresponseÚ    responsesÚsentinels        rr‘zSentinel.execute_commandÿsÁ€ô F—J‘J˜v uÓ-Ó.ˆô  §
¡
Ð+=¸uÓ EÓFÐá ØD”v—}‘} T§^¡^Ó4×DÑDÀdÐUÈfÑUˆHÙØ zÐ!á'tÐ2¨UÐ2àˆ    ØŸ™ò    HˆHØ × Ñ Ð5˜X×5Ñ5°tÐF¸vÑFÕ Gð    Hñ ØÐ ä9‹~Ðrcó—g}|jD]6}|jdj|jj««Œ8dt |«j ›dt |«j›ddj|«›dS)Nz {host}:{port}r$r%z (sentinels=[ú,z])>)    r†r’Ú
format_maprror'rrÚjoin)r Úsentinel_addressesr—s   rr.zSentinel.__repr__s†€ØÐØŸ™ò    ˆHØ × %Ñ %Ø×*Ñ*¨8×+CÑ+C×+UÑ+UÓVõ ð    ð
”T“
×%Ñ%Ð& a¬¨T«
×(;Ñ(;Ð'<ؘ3Ÿ8™8Ð$6Ó7Ð8¸ð =ð    
rcóJ—|dr
|ds|dry|d|jkryy)Nr9Úis_sdownÚis_odownFznum-other-sentinelsT)r‡)r Ústater(s   rÚcheck_master_statezSentinel.check_master_state&s5€Ø[Ò! U¨:Ò%6¸%À
Ò:KØà Ð&Ñ '¨$×*BÑ*BÒ BØØrcó.—t«}t|j«D]Ž\}}    |j«}|j|«}|sŒ+|j||«sŒ>||jdc|jd<|j|<|j |jn|d}||dfcSd}    t|«dkDrddj|«›}    td    |›|    ›«‚#tt
f$r }|j |›d|›«Yd}~Œïd}~wwxYw)
        Asks sentinel servers for the Redis master's address corresponding
        to the service labeled ``service_name``.
 
        Returns a pair (address, port) or raises MasterNotFoundError if no
        master is found.
        z - NrÚipr*Úz : z, zNo master found for ) ÚlistÚ    enumerater†Úsentinel_mastersr    r r’rmr¡rˆrdr›r)
r r(Úcollected_errorsÚ sentinel_nor—ÚmastersÚer r£Ú
error_infos
          rr^zSentinel.discover_master.s7€ô ›6ÐÜ%.¨t¯~©~Ó%>ò    )Ñ !ˆK˜ð Ø"×3Ñ3Ó5ð—K‘K  Ó-ˆEÚ˜×0Ñ0°¸ ÕEðØ—N‘N 1Ñ%ð?—‘˜qÑ! 4§>¡>°+Ñ#>ð×,Ñ,Ð8ð×)Ò)à˜t™ðð
˜5 ™=Ð(Ò(ð'    )ð*ˆ
Ü ÐÓ   1Ò $ؘtŸy™yÐ)9Ó:Ð;Ð<ˆJÜ!Ð$8¸Ð8HÈÈ Ð"UÓVÐVøô+$¤\Ð2ò Ø ×'Ñ'¨8¨*°C¸°uÐ(=Ô>Üûð ús§C%Ã%DÃ4DÄDcó`—g}|D]&}|ds|drŒ|j|d|df«Œ(|S)z1Remove slaves that are in an ODOWN or SDOWN staterŸržr£r*)r’)r rfÚ slaves_aliver<s    rÚ filter_slaveszSentinel.filter_slavesQsK€àˆ Øò    >ˆEؐZÒ  E¨*Ò$5ØØ × Ñ   t¡¨e°F©mР<Õ =ð    >ðÐrcó®—|jD]+}    |j|«}|j |«}|sŒ)|cSgS#tttf$rYŒFwxYw)z;Returns a list of alive slaves for service ``service_name``)r†Úsentinel_slavesr    r r r¯)r r(r—rfs    rrazSentinel.discover_slavesZsf€àŸ™ò    ˆHð Ø!×1Ñ1°,Ó?ð×'Ñ'¨Ó/ˆFÚØ’ ð    ðˆ    øô $¤]´LÐAò Ùð ús‘=½AÁAc óŠ—d|d<t|j«}|j|«|j|||fi|¤Ž«S)aý
        Returns a redis client instance for the ``service_name`` master.
        Sentinel client will detect failover and reconnect Redis clients
        automatically.
 
        A :py:class:`~redis.sentinel.SentinelConnectionPool` class is
        used to retrieve the master's address before establishing a new
        connection.
 
        NOTE: If the master's address has changed, any cached connections to
        the old master are closed.
 
        By default clients will be a :py:class:`~redis.Redis` instance.
        Specify a different class to the ``redis_class`` argument if you
        desire something different.
 
        The ``connection_pool_class`` specifies the connection pool to
        use.  The :py:class:`~redis.sentinel.SentinelConnectionPool`
        will be used by default.
 
        All other keyword arguments are merged with any connection_kwargs
        passed to this class and passed to the connection pool as keyword
        arguments to be used to initialize Redis connections.
        Tr9©ÚdictroÚupdateÚ    from_pool©r r(Ú redis_classÚconnection_pool_classr!ros      rÚ
master_forzSentinel.master_forfsP€ð>#ˆˆ{ÑÜ  ×!7Ñ!7Ó8ÐØ× Ñ  Ô(Ø×$Ñ$Ù ! ,°Ñ JÐ8IÑ Jó
ð    
rc óŠ—d|d<t|j«}|j|«|j|||fi|¤Ž«S)aâ
        Returns redis client instance for the ``service_name`` slave(s).
 
        A SentinelConnectionPool class is used to retrieve the slave's
        address before establishing a new connection.
 
        By default clients will be a :py:class:`~redis.Redis` instance.
        Specify a different class to the ``redis_class`` argument if you
        desire something different.
 
        The ``connection_pool_class`` specifies the connection pool to use.
        The SentinelConnectionPool will be used by default.
 
        All other keyword arguments are merged with any connection_kwargs
        passed to this class and passed to the connection pool as keyword
        arguments to be used to initialize Redis connections.
        Fr9r³r·s      rÚ    slave_forzSentinel.slave_forŒsP€ð0$ˆˆ{ÑÜ  ×!7Ñ!7Ó8ÐØ× Ñ  Ô(Ø×$Ñ$Ù ! ,°Ñ JÐ8IÑ Jó
ð    
r)rNN)rrrr}rr‘r.r¡r^r¯rarrirºr¼rrrr€r€ÊsR„ñð>ØØó 0ò0ò8    
òò!WòFò
ðØ4ó    $
ðRØ4ô    
rr€)rbrTÚtypingrÚ redis.clientrÚredis.commandsrÚredis.connectionrrrÚredis.exceptionsr    r
r r rrrrPrRrir€rrrú<module>rÂsðÛ ÛÝåÝ+ßFÑF÷óô    ˜/ô    ô    ˜ô    ô> 
ô>ôB    Ð#<¸mô    ÷-Nñ-Nô`:*˜^ô:*ôz_
Ðõ_
r