diff options
author | David Gilman <dgilman@aidentified.com> | 2022-12-14 04:18:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 11:18:41 +0200 |
commit | 3fb65de645bf4dd1beb8e893bdaa2c4766bbd1fa (patch) | |
tree | d5074882a70d502c91122f252788f27f1670901e /redis | |
parent | 6487f9555ba2d08083a081df9b65b642427361fa (diff) | |
download | redis-py-3fb65de645bf4dd1beb8e893bdaa2c4766bbd1fa.tar.gz |
Combine auto-concatenated strings (#2482)
Diffstat (limited to 'redis')
-rw-r--r-- | redis/asyncio/client.py | 6 | ||||
-rw-r--r-- | redis/asyncio/lock.py | 6 | ||||
-rwxr-xr-x | redis/client.py | 8 | ||||
-rw-r--r-- | redis/cluster.py | 4 | ||||
-rw-r--r-- | redis/commands/core.py | 42 | ||||
-rw-r--r-- | redis/commands/graph/node.py | 2 | ||||
-rw-r--r-- | redis/commands/search/commands.py | 2 | ||||
-rwxr-xr-x | redis/connection.py | 4 | ||||
-rw-r--r-- | redis/lock.py | 2 |
9 files changed, 35 insertions, 41 deletions
diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index abe7d67..5a2c496 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -1132,7 +1132,7 @@ class Pipeline(Redis): # lgtm [py/init-calls-subclass] raise RedisError("Cannot issue nested calls to MULTI") if self.command_stack: raise RedisError( - "Commands without an initial WATCH have already " "been issued" + "Commands without an initial WATCH have already been issued" ) self.explicit_transaction = True @@ -1157,7 +1157,7 @@ class Pipeline(Redis): # lgtm [py/init-calls-subclass] if self.watching: await self.reset() raise WatchError( - "A ConnectionError occurred on while " "watching one or more keys" + "A ConnectionError occurred on while watching one or more keys" ) # if retry_on_timeout is not set, or the error is not # a TimeoutError, raise it @@ -1345,7 +1345,7 @@ class Pipeline(Redis): # lgtm [py/init-calls-subclass] # indicates the user should retry this transaction. if self.watching: raise WatchError( - "A ConnectionError occurred on while " "watching one or more keys" + "A ConnectionError occurred on while watching one or more keys" ) # if retry_on_timeout is not set, or the error is not # a TimeoutError, raise it diff --git a/redis/asyncio/lock.py b/redis/asyncio/lock.py index 7f45c8b..2f78d69 100644 --- a/redis/asyncio/lock.py +++ b/redis/asyncio/lock.py @@ -259,7 +259,7 @@ class Lock: keys=[self.name], args=[expected_token], client=self.redis ) ): - raise LockNotOwnedError("Cannot release a lock" " that's no longer owned") + raise LockNotOwnedError("Cannot release a lock that's no longer owned") def extend( self, additional_time: float, replace_ttl: bool = False @@ -289,7 +289,7 @@ class Lock: client=self.redis, ) ): - raise LockNotOwnedError("Cannot extend a lock that's" " no longer owned") + raise LockNotOwnedError("Cannot extend a lock that's no longer owned") return True def reacquire(self) -> Awaitable[bool]: @@ -309,5 +309,5 @@ class Lock: keys=[self.name], args=[self.local.token, timeout], client=self.redis ) ): - raise LockNotOwnedError("Cannot reacquire a lock that's" " no longer owned") + raise LockNotOwnedError("Cannot reacquire a lock that's no longer owned") return True diff --git a/redis/client.py b/redis/client.py index ed857c8..1a9b96b 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1881,7 +1881,7 @@ class Pipeline(Redis): raise RedisError("Cannot issue nested calls to MULTI") if self.command_stack: raise RedisError( - "Commands without an initial WATCH have already " "been issued" + "Commands without an initial WATCH have already been issued" ) self.explicit_transaction = True @@ -1904,7 +1904,7 @@ class Pipeline(Redis): if self.watching: self.reset() raise WatchError( - "A ConnectionError occurred on while " "watching one or more keys" + "A ConnectionError occurred on while watching one or more keys" ) # if retry_on_timeout is not set, or the error is not # a TimeoutError, raise it @@ -1997,7 +1997,7 @@ class Pipeline(Redis): if len(response) != len(commands): self.connection.disconnect() raise ResponseError( - "Wrong number of response items from " "pipeline execution" + "Wrong number of response items from pipeline execution" ) # find any errors in the response and raise if necessary @@ -2078,7 +2078,7 @@ class Pipeline(Redis): # indicates the user should retry this transaction. if self.watching: raise WatchError( - "A ConnectionError occurred on while " "watching one or more keys" + "A ConnectionError occurred on while watching one or more keys" ) # if retry_on_timeout is not set, or the error is not # a TimeoutError, raise it diff --git a/redis/cluster.py b/redis/cluster.py index cd559b6..f115007 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -1648,7 +1648,7 @@ class ClusterPubSub(PubSub): pubsub_node = node elif any([host, port]) is True: # only 'host' or 'port' passed - raise DataError("Passing a host requires passing a port, " "and vice versa") + raise DataError("Passing a host requires passing a port, and vice versa") else: # nothing passed by the user. set node to None pubsub_node = None @@ -2126,7 +2126,7 @@ class ClusterPipeline(RedisCluster): """ if len(names) != 1: raise RedisClusterException( - "deleting multiple keys is not " "implemented in pipeline command" + "deleting multiple keys is not implemented in pipeline command" ) return self.execute_command("DEL", names[0]) diff --git a/redis/commands/core.py b/redis/commands/core.py index eaedffb..4cd0a9f 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -101,7 +101,7 @@ class ACLCommands(CommandsProtocol): raise ValueError except ValueError: raise DataError( - "genpass optionally accepts a bits argument, " "between 0 and 4096." + "genpass optionally accepts a bits argument, between 0 and 4096." ) return self.execute_command("ACL GENPASS", *pieces, **kwargs) @@ -142,7 +142,7 @@ class ACLCommands(CommandsProtocol): args = [] if count is not None: if not isinstance(count, int): - raise DataError("ACL LOG count must be an " "integer") + raise DataError("ACL LOG count must be an integer") args.append(count) return self.execute_command("ACL LOG", *args, **kwargs) @@ -276,7 +276,7 @@ class ACLCommands(CommandsProtocol): if (passwords or hashed_passwords) and nopass: raise DataError( - "Cannot set 'nopass' and supply " "'passwords' or 'hashed_passwords'" + "Cannot set 'nopass' and supply 'passwords' or 'hashed_passwords'" ) if passwords: @@ -1613,7 +1613,7 @@ class BasicKeyCommands(CommandsProtocol): if start is not None and end is not None: params.append(end) elif start is None and end is not None: - raise DataError("start argument is not set, " "when end is specified") + raise DataError("start argument is not set, when end is specified") if mode is not None: params.append(mode) @@ -3457,9 +3457,7 @@ class StreamCommands(CommandsProtocol): """ pieces: list[EncodableT] = [] if maxlen is not None and minid is not None: - raise DataError( - "Only one of ```maxlen``` or ```minid``` " "may be specified" - ) + raise DataError("Only one of ```maxlen``` or ```minid``` may be specified") if maxlen is not None: if not isinstance(maxlen, int) or maxlen < 1: @@ -3515,7 +3513,7 @@ class StreamCommands(CommandsProtocol): try: if int(min_idle_time) < 0: raise DataError( - "XAUTOCLAIM min_idle_time must be a non" "negative integer" + "XAUTOCLAIM min_idle_time must be a nonnegative integer" ) except TypeError: pass @@ -3573,7 +3571,7 @@ class StreamCommands(CommandsProtocol): For more information see https://redis.io/commands/xclaim """ if not isinstance(min_idle_time, int) or min_idle_time < 0: - raise DataError("XCLAIM min_idle_time must be a non negative " "integer") + raise DataError("XCLAIM min_idle_time must be a non negative integer") if not isinstance(message_ids, (list, tuple)) or not message_ids: raise DataError( "XCLAIM message_ids must be a non empty list or " @@ -3906,7 +3904,7 @@ class StreamCommands(CommandsProtocol): pieces.append(str(count)) if block is not None: if not isinstance(block, int) or block < 0: - raise DataError("XREADGROUP block must be a non-negative " "integer") + raise DataError("XREADGROUP block must be a non-negative integer") pieces.append(b"BLOCK") pieces.append(str(block)) if noack: @@ -3968,7 +3966,7 @@ class StreamCommands(CommandsProtocol): """ pieces: list[EncodableT] = [] if maxlen is not None and minid is not None: - raise DataError("Only one of ``maxlen`` or ``minid`` " "may be specified") + raise DataError("Only one of ``maxlen`` or ``minid`` may be specified") if maxlen is None and minid is None: raise DataError("One of ``maxlen`` or ``minid`` must be specified") @@ -4342,14 +4340,12 @@ class SortedSetCommands(CommandsProtocol): num: Union[int, None] = None, ) -> ResponseT: if byscore and bylex: - raise DataError( - "``byscore`` and ``bylex`` can not be " "specified together." - ) + raise DataError("``byscore`` and ``bylex`` can not be specified together.") if (offset is not None and num is None) or (num is not None and offset is None): raise DataError("``offset`` and ``num`` must both be specified.") if bylex and withscores: raise DataError( - "``withscores`` not supported in combination " "with ``bylex``." + "``withscores`` not supported in combination with ``bylex``." ) pieces = [command] if dest: @@ -5301,7 +5297,7 @@ class GeoCommands(CommandsProtocol): if nx and xx: raise DataError("GEOADD allows either 'nx' or 'xx', not both") if len(values) % 3 != 0: - raise DataError("GEOADD requires places with lon, lat and name" " values") + raise DataError("GEOADD requires places with lon, lat and name values") pieces = [name] if nx: pieces.append("NX") @@ -5487,7 +5483,7 @@ class GeoCommands(CommandsProtocol): raise DataError("GEORADIUS invalid sort") if kwargs["store"] and kwargs["store_dist"]: - raise DataError("GEORADIUS store and store_dist cant be set" " together") + raise DataError("GEORADIUS store and store_dist cant be set together") if kwargs["store"]: pieces.extend([b"STORE", kwargs["store"]]) @@ -5624,13 +5620,11 @@ class GeoCommands(CommandsProtocol): # FROMMEMBER or FROMLONLAT if kwargs["member"] is None: if kwargs["longitude"] is None or kwargs["latitude"] is None: - raise DataError( - "GEOSEARCH must have member or" " longitude and latitude" - ) + raise DataError("GEOSEARCH must have member or longitude and latitude") if kwargs["member"]: if kwargs["longitude"] or kwargs["latitude"]: raise DataError( - "GEOSEARCH member and longitude or latitude" " cant be set together" + "GEOSEARCH member and longitude or latitude cant be set together" ) pieces.extend([b"FROMMEMBER", kwargs["member"]]) if kwargs["longitude"] is not None and kwargs["latitude"] is not None: @@ -5639,7 +5633,7 @@ class GeoCommands(CommandsProtocol): # BYRADIUS or BYBOX if kwargs["radius"] is None: if kwargs["width"] is None or kwargs["height"] is None: - raise DataError("GEOSEARCH must have radius or" " width and height") + raise DataError("GEOSEARCH must have radius or width and height") if kwargs["unit"] is None: raise DataError("GEOSEARCH must have unit") if kwargs["unit"].lower() not in ("m", "km", "mi", "ft"): @@ -5647,7 +5641,7 @@ class GeoCommands(CommandsProtocol): if kwargs["radius"]: if kwargs["width"] or kwargs["height"]: raise DataError( - "GEOSEARCH radius and width or height" " cant be set together" + "GEOSEARCH radius and width or height cant be set together" ) pieces.extend([b"BYRADIUS", kwargs["radius"], kwargs["unit"]]) if kwargs["width"] and kwargs["height"]: @@ -5668,7 +5662,7 @@ class GeoCommands(CommandsProtocol): if kwargs["any"]: pieces.append(b"ANY") elif kwargs["any"]: - raise DataError("GEOSEARCH ``any`` can't be provided " "without count") + raise DataError("GEOSEARCH ``any`` can't be provided without count") # other properties for arg_name, byte_repr in ( diff --git a/redis/commands/graph/node.py b/redis/commands/graph/node.py index c5f8429..0ebe510 100644 --- a/redis/commands/graph/node.py +++ b/redis/commands/graph/node.py @@ -32,7 +32,7 @@ class Node: self.labels = label else: raise AssertionError( - "label should be either None, " "string or a list of strings" + "label should be either None, string or a list of strings" ) self.properties = properties or {} diff --git a/redis/commands/search/commands.py b/redis/commands/search/commands.py index f02805e..3bd7d47 100644 --- a/redis/commands/search/commands.py +++ b/redis/commands/search/commands.py @@ -527,7 +527,7 @@ class SearchCommands: cmd += query.get_args() cmd += self.get_params_args(query_params) else: - raise ValueError("Must provide AggregateRequest object or " "Query object.") + raise ValueError("Must provide AggregateRequest object or Query object.") res = self.execute_command(*cmd) diff --git a/redis/connection.py b/redis/connection.py index 9c5b536..dce0735 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -62,9 +62,9 @@ SYM_EMPTY = b"" SERVER_CLOSED_CONNECTION_ERROR = "Connection closed by server." SENTINEL = object() -MODULE_LOAD_ERROR = "Error loading the extension. " "Please check the server logs." +MODULE_LOAD_ERROR = "Error loading the extension. Please check the server logs." NO_SUCH_MODULE_ERROR = "Error unloading module: no such module with that name" -MODULE_UNLOAD_NOT_POSSIBLE_ERROR = "Error unloading module: operation not " "possible." +MODULE_UNLOAD_NOT_POSSIBLE_ERROR = "Error unloading module: operation not possible." MODULE_EXPORTS_DATA_TYPES_ERROR = ( "Error unloading module: the module " "exports one or more module-side data " diff --git a/redis/lock.py b/redis/lock.py index 912ff57..4cca102 100644 --- a/redis/lock.py +++ b/redis/lock.py @@ -256,7 +256,7 @@ class Lock: if not bool( self.lua_release(keys=[self.name], args=[expected_token], client=self.redis) ): - raise LockNotOwnedError("Cannot release a lock" " that's no longer owned") + raise LockNotOwnedError("Cannot release a lock that's no longer owned") def extend(self, additional_time: int, replace_ttl: bool = False) -> bool: """ |