b XddlmZmZmZmZmZmZddlmZm Z erddl m Z GddZ y)) TYPE_CHECKINGAnyDictOptionalTupleUnion) RedisError ResponseError) ClusterNodecteZdZdZdZd dZddedddfdZd edee e d ffd Z d edee e d ffd Z y)CommandsParsera% Parses Redis commands to get command keys. COMMAND output is used to determine key locations. Commands that do not have a predefined key location are flagged with 'movablekeys', and these commands' keys are determined by the command 'COMMAND GETKEYS'. NOTE: Due to a bug in redis<7.0, this does not work properly for EVAL or EVALSHA when the `numkeys` arg is 0. - issue: https://github.com/redis/redis/issues/9493 - fix: https://github.com/redis/redis/pull/9733 So, don't use this with EVAL or EVALSHA. )commandsnodereturnNci|_yN)r)selfs 6/usr/lib/python3/dist-packages/redis/asyncio/parser.py__init__zCommandsParser.__init__s ?A rr cK|r||_|jjdd{}|jD]?\}}d|dvrd||<|ddk(r|ddk(rd||<)|ddk(s2|ddk(s;d||<A|jDcic]\}}|j|c}}|_y7cc}}ww) NCOMMAND movablekeysflags first_key_posr last_key_pos)rexecute_commanditemsupperr)rrrcmdcommands r initializezCommandsParser.initializes DI229==$NN, "LC 00 " )Q.7>3Ja3O ! )Q.7>3Ja3O !  "CK..BRS,#wg-S >Ts.(CB9AC1C:CB;/ C;Cargs.c*Kt|dkry |j|d}|dk(r|dfS|dk(ry|dk(r|j|d{S|d}|dkrt||z}||d|dz|dS#t$r|djt |ddz}|dj }||jvr5|j d{7||jvrt|d|j|}YwxYw7íw) Nrrz( command doesn't exist in Redis commandsrrr step_count) lenrKeyErrorsplitlistr!r$r _get_moveable_keys)rr%r#cmd_namers rget_keyszCommandsParser.get_keys/s? t9q= .mmDG,G" a<G:  a< b=000$77 7~. ! t9|3LGO,|a/?',BWWXX5 .7==?T$qr(^3DAw}}Ht}},oo'''4==0$#*$LMmmH-G .*8s@DA;(D D-D;ADC0D D DDcK |jjdg|d{}|S7#t$r$}|j}d|vsd|vrYd}~y|d}~wwxYww)NzCOMMAND GETKEYSzInvalid argumentsz The command has no key arguments)rrr __str__)rr%keysemessages rr-z!CommandsParser._get_moveable_keysRsi 2223DLtLLD M iikG#w.5@ s<A -+-A- AAAAAA)rNr) __name__ __module__ __qualname____doc__ __slots__rrr$rrstrr/r-rrr r ss %IB TXm%< T T"!YC!YHU38_,E!YF c huS#X6O rr N) typingrrrrrrredis.exceptionsr r redis.asyncio.clusterr r r;rrr?s CC61UUr