@@ -101,7 +101,7 @@ def acl_genpass(self, bits: Union[int, None] = None, **kwargs) -> ResponseT:
101
101
raise ValueError
102
102
except ValueError :
103
103
raise DataError (
104
- "genpass optionally accepts a bits argument, " " between 0 and 4096."
104
+ "genpass optionally accepts a bits argument, between 0 and 4096."
105
105
)
106
106
return self .execute_command ("ACL GENPASS" , * pieces , ** kwargs )
107
107
@@ -142,7 +142,7 @@ def acl_log(self, count: Union[int, None] = None, **kwargs) -> ResponseT:
142
142
args = []
143
143
if count is not None :
144
144
if not isinstance (count , int ):
145
- raise DataError ("ACL LOG count must be an " " integer" )
145
+ raise DataError ("ACL LOG count must be an integer" )
146
146
args .append (count )
147
147
148
148
return self .execute_command ("ACL LOG" , * args , ** kwargs )
@@ -276,7 +276,7 @@ def acl_setuser(
276
276
277
277
if (passwords or hashed_passwords ) and nopass :
278
278
raise DataError (
279
- "Cannot set 'nopass' and supply " " 'passwords' or 'hashed_passwords'"
279
+ "Cannot set 'nopass' and supply 'passwords' or 'hashed_passwords'"
280
280
)
281
281
282
282
if passwords :
@@ -1151,6 +1151,30 @@ def latency_histogram(self, *args):
1151
1151
"LATENCY HISTOGRAM is intentionally not implemented in the client."
1152
1152
)
1153
1153
1154
+ def latency_history (self , event : str ) -> ResponseT :
1155
+ """
1156
+ Returns the raw data of the ``event``'s latency spikes time series.
1157
+
1158
+ For more information see https://redis.io/commands/latency-history
1159
+ """
1160
+ return self .execute_command ("LATENCY HISTORY" , event )
1161
+
1162
+ def latency_latest (self ) -> ResponseT :
1163
+ """
1164
+ Reports the latest latency events logged.
1165
+
1166
+ For more information see https://redis.io/commands/latency-latest
1167
+ """
1168
+ return self .execute_command ("LATENCY LATEST" )
1169
+
1170
+ def latency_reset (self , * events : str ) -> ResponseT :
1171
+ """
1172
+ Resets the latency spikes time series of all, or only some, events.
1173
+
1174
+ For more information see https://redis.io/commands/latency-reset
1175
+ """
1176
+ return self .execute_command ("LATENCY RESET" , * events )
1177
+
1154
1178
def ping (self , ** kwargs ) -> ResponseT :
1155
1179
"""
1156
1180
Ping the Redis server
@@ -1589,7 +1613,7 @@ def bitpos(
1589
1613
if start is not None and end is not None :
1590
1614
params .append (end )
1591
1615
elif start is None and end is not None :
1592
- raise DataError ("start argument is not set, " " when end is specified" )
1616
+ raise DataError ("start argument is not set, when end is specified" )
1593
1617
1594
1618
if mode is not None :
1595
1619
params .append (mode )
@@ -3433,9 +3457,7 @@ def xadd(
3433
3457
"""
3434
3458
pieces : list [EncodableT ] = []
3435
3459
if maxlen is not None and minid is not None :
3436
- raise DataError (
3437
- "Only one of ```maxlen``` or ```minid``` " "may be specified"
3438
- )
3460
+ raise DataError ("Only one of ```maxlen``` or ```minid``` may be specified" )
3439
3461
3440
3462
if maxlen is not None :
3441
3463
if not isinstance (maxlen , int ) or maxlen < 1 :
@@ -3491,7 +3513,7 @@ def xautoclaim(
3491
3513
try :
3492
3514
if int (min_idle_time ) < 0 :
3493
3515
raise DataError (
3494
- "XAUTOCLAIM min_idle_time must be a non" "negative integer"
3516
+ "XAUTOCLAIM min_idle_time must be a nonnegative integer"
3495
3517
)
3496
3518
except TypeError :
3497
3519
pass
@@ -3549,7 +3571,7 @@ def xclaim(
3549
3571
For more information see https://redis.io/commands/xclaim
3550
3572
"""
3551
3573
if not isinstance (min_idle_time , int ) or min_idle_time < 0 :
3552
- raise DataError ("XCLAIM min_idle_time must be a non negative " " integer" )
3574
+ raise DataError ("XCLAIM min_idle_time must be a non negative integer" )
3553
3575
if not isinstance (message_ids , (list , tuple )) or not message_ids :
3554
3576
raise DataError (
3555
3577
"XCLAIM message_ids must be a non empty list or "
@@ -3882,7 +3904,7 @@ def xreadgroup(
3882
3904
pieces .append (str (count ))
3883
3905
if block is not None :
3884
3906
if not isinstance (block , int ) or block < 0 :
3885
- raise DataError ("XREADGROUP block must be a non-negative " " integer" )
3907
+ raise DataError ("XREADGROUP block must be a non-negative integer" )
3886
3908
pieces .append (b"BLOCK" )
3887
3909
pieces .append (str (block ))
3888
3910
if noack :
@@ -3944,7 +3966,7 @@ def xtrim(
3944
3966
"""
3945
3967
pieces : list [EncodableT ] = []
3946
3968
if maxlen is not None and minid is not None :
3947
- raise DataError ("Only one of ``maxlen`` or ``minid`` " " may be specified" )
3969
+ raise DataError ("Only one of ``maxlen`` or ``minid`` may be specified" )
3948
3970
3949
3971
if maxlen is None and minid is None :
3950
3972
raise DataError ("One of ``maxlen`` or ``minid`` must be specified" )
@@ -4318,14 +4340,12 @@ def _zrange(
4318
4340
num : Union [int , None ] = None ,
4319
4341
) -> ResponseT :
4320
4342
if byscore and bylex :
4321
- raise DataError (
4322
- "``byscore`` and ``bylex`` can not be " "specified together."
4323
- )
4343
+ raise DataError ("``byscore`` and ``bylex`` can not be specified together." )
4324
4344
if (offset is not None and num is None ) or (num is not None and offset is None ):
4325
4345
raise DataError ("``offset`` and ``num`` must both be specified." )
4326
4346
if bylex and withscores :
4327
4347
raise DataError (
4328
- "``withscores`` not supported in combination " " with ``bylex``."
4348
+ "``withscores`` not supported in combination with ``bylex``."
4329
4349
)
4330
4350
pieces = [command ]
4331
4351
if dest :
@@ -5277,7 +5297,7 @@ def geoadd(
5277
5297
if nx and xx :
5278
5298
raise DataError ("GEOADD allows either 'nx' or 'xx', not both" )
5279
5299
if len (values ) % 3 != 0 :
5280
- raise DataError ("GEOADD requires places with lon, lat and name" " values" )
5300
+ raise DataError ("GEOADD requires places with lon, lat and name values" )
5281
5301
pieces = [name ]
5282
5302
if nx :
5283
5303
pieces .append ("NX" )
@@ -5463,7 +5483,7 @@ def _georadiusgeneric(
5463
5483
raise DataError ("GEORADIUS invalid sort" )
5464
5484
5465
5485
if kwargs ["store" ] and kwargs ["store_dist" ]:
5466
- raise DataError ("GEORADIUS store and store_dist cant be set" " together" )
5486
+ raise DataError ("GEORADIUS store and store_dist cant be set together" )
5467
5487
5468
5488
if kwargs ["store" ]:
5469
5489
pieces .extend ([b"STORE" , kwargs ["store" ]])
@@ -5600,13 +5620,11 @@ def _geosearchgeneric(
5600
5620
# FROMMEMBER or FROMLONLAT
5601
5621
if kwargs ["member" ] is None :
5602
5622
if kwargs ["longitude" ] is None or kwargs ["latitude" ] is None :
5603
- raise DataError (
5604
- "GEOSEARCH must have member or" " longitude and latitude"
5605
- )
5623
+ raise DataError ("GEOSEARCH must have member or longitude and latitude" )
5606
5624
if kwargs ["member" ]:
5607
5625
if kwargs ["longitude" ] or kwargs ["latitude" ]:
5608
5626
raise DataError (
5609
- "GEOSEARCH member and longitude or latitude" " cant be set together"
5627
+ "GEOSEARCH member and longitude or latitude cant be set together"
5610
5628
)
5611
5629
pieces .extend ([b"FROMMEMBER" , kwargs ["member" ]])
5612
5630
if kwargs ["longitude" ] is not None and kwargs ["latitude" ] is not None :
@@ -5615,15 +5633,15 @@ def _geosearchgeneric(
5615
5633
# BYRADIUS or BYBOX
5616
5634
if kwargs ["radius" ] is None :
5617
5635
if kwargs ["width" ] is None or kwargs ["height" ] is None :
5618
- raise DataError ("GEOSEARCH must have radius or" " width and height" )
5636
+ raise DataError ("GEOSEARCH must have radius or width and height" )
5619
5637
if kwargs ["unit" ] is None :
5620
5638
raise DataError ("GEOSEARCH must have unit" )
5621
5639
if kwargs ["unit" ].lower () not in ("m" , "km" , "mi" , "ft" ):
5622
5640
raise DataError ("GEOSEARCH invalid unit" )
5623
5641
if kwargs ["radius" ]:
5624
5642
if kwargs ["width" ] or kwargs ["height" ]:
5625
5643
raise DataError (
5626
- "GEOSEARCH radius and width or height" " cant be set together"
5644
+ "GEOSEARCH radius and width or height cant be set together"
5627
5645
)
5628
5646
pieces .extend ([b"BYRADIUS" , kwargs ["radius" ], kwargs ["unit" ]])
5629
5647
if kwargs ["width" ] and kwargs ["height" ]:
@@ -5644,7 +5662,7 @@ def _geosearchgeneric(
5644
5662
if kwargs ["any" ]:
5645
5663
pieces .append (b"ANY" )
5646
5664
elif kwargs ["any" ]:
5647
- raise DataError ("GEOSEARCH ``any`` can't be provided " " without count" )
5665
+ raise DataError ("GEOSEARCH ``any`` can't be provided without count" )
5648
5666
5649
5667
# other properties
5650
5668
for arg_name , byte_repr in (
0 commit comments