Skip to content

Commit fb7bfef

Browse files
committed
Linting
1 parent 5445427 commit fb7bfef

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

sentry_sdk/integrations/redis/_async_common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def patch_redis_async_pipeline(
2727
pipeline_cls, is_cluster, get_command_args_fn, get_db_data_fn
2828
):
29-
# type: (Union[type[Pipeline[Any]], type[ClusterPipeline[Any]]], bool, Any, Callable[[Span, Any], None]) -> None
29+
# type: (Union[type[Pipeline[Any]], type[ClusterPipeline[Any]]], bool, Any, Callable[[Any], dict[str, Any]]) -> None
3030
old_execute = pipeline_cls.execute
3131

3232
from sentry_sdk.integrations.redis import RedisIntegration
@@ -47,7 +47,9 @@ async def _sentry_execute(self, *args, **kwargs):
4747
is_cluster=is_cluster,
4848
get_command_args_fn=get_command_args_fn,
4949
is_transaction=False if is_cluster else self.is_transaction,
50-
command_stack=self._command_stack if is_cluster else self.command_stack,
50+
command_stack=(
51+
self._command_stack if is_cluster else self.command_stack
52+
),
5153
)
5254
_update_span(span, span_data, pipeline_data)
5355

@@ -57,7 +59,7 @@ async def _sentry_execute(self, *args, **kwargs):
5759

5860

5961
def patch_redis_async_client(cls, is_cluster, get_db_data_fn):
60-
# type: (Union[type[StrictRedis[Any]], type[RedisCluster[Any]]], bool, Callable[[Span, Any], None]) -> None
62+
# type: (Union[type[StrictRedis[Any]], type[RedisCluster[Any]]], bool, Callable[[Any], dict[str, Any]]) -> None
6163
old_execute_command = cls.execute_command
6264

6365
from sentry_sdk.integrations.redis import RedisIntegration

sentry_sdk/integrations/redis/_sync_common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def patch_redis_pipeline(
2727
get_command_args_fn,
2828
get_db_data_fn,
2929
):
30-
# type: (Any, bool, Any, Callable[[Span, Any], None]) -> None
30+
# type: (Any, bool, Any, Callable[[Any], dict[str, Any]]) -> None
3131
old_execute = pipeline_cls.execute
3232

3333
from sentry_sdk.integrations.redis import RedisIntegration
@@ -37,7 +37,6 @@ def sentry_patched_execute(self, *args, **kwargs):
3737
if sentry_sdk.get_client().get_integration(RedisIntegration) is None:
3838
return old_execute(self, *args, **kwargs)
3939

40-
4140
with sentry_sdk.start_span(
4241
op=OP.DB_REDIS,
4342
name="redis.pipeline.execute",
@@ -59,7 +58,7 @@ def sentry_patched_execute(self, *args, **kwargs):
5958

6059

6160
def patch_redis_client(cls, is_cluster, get_db_data_fn):
62-
# type: (Any, bool, Callable[[Span, Any], None]) -> None
61+
# type: (Any, bool, Callable[[Any], dict[str, Any]]) -> None
6362
"""
6463
This function can be used to instrument custom redis client classes or
6564
subclasses.
@@ -100,7 +99,7 @@ def sentry_patched_execute_command(self, name, *args, **kwargs):
10099
db_span.__enter__()
101100

102101
db_span_data = get_db_data_fn(self)
103-
db_client_span_data = _get_client_data(db_span, is_cluster, name, *args)
102+
db_client_span_data = _get_client_data(is_cluster, name, *args)
104103
_update_span(db_span, db_span_data, db_client_span_data)
105104

106105
value = old_execute_command(self, name, *args, **kwargs)

sentry_sdk/integrations/redis/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ def _parse_rediscluster_command(command):
124124
return command.args
125125

126126

127-
def _get_pipeline_data(
128-
is_cluster, get_command_args_fn, is_transaction, command_stack
129-
):
127+
def _get_pipeline_data(is_cluster, get_command_args_fn, is_transaction, command_stack):
130128
# type: (bool, Any, bool, Sequence[Any]) -> dict[str, Any]
131129
data = {
132130
"redis.is_cluster": is_cluster,
133131
"redis.transaction": is_transaction,
134-
}
132+
} # type: dict[str, Any]
135133

136134
commands = []
137135
for i, arg in enumerate(command_stack):
@@ -151,7 +149,8 @@ def _get_client_data(is_cluster, name, *args):
151149
# type: (bool, str, *Any) -> dict[str, Any]
152150
data = {
153151
"redis.is_cluster": is_cluster,
154-
}
152+
} # type: dict[str, Any]
153+
155154
if name:
156155
data["redis.command"] = name
157156
data[SPANDATA.DB_OPERATION] = name
@@ -163,4 +162,4 @@ def _get_client_data(is_cluster, name, *args):
163162
):
164163
data["redis.key"] = args[0]
165164

166-
return data
165+
return data

0 commit comments

Comments
 (0)