database-wrapper-redis 0.2.14__tar.gz → 0.2.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database_wrapper_redis
3
- Version: 0.2.14
3
+ Version: 0.2.17
4
4
  Summary: database_wrapper for Redis database
5
5
  Author-email: Gints Murans <gm@gm.lv>
6
6
  License: GNU General Public License v3.0 (GPL-3.0)
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
32
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
- Requires-Dist: database_wrapper==0.2.14
35
+ Requires-Dist: database_wrapper==0.2.17
36
36
  Requires-Dist: redis
37
37
 
38
38
  # database_wrapper_redis
@@ -1,27 +1,20 @@
1
1
  import logging
2
-
3
2
  from contextvars import ContextVar
4
3
  from threading import Event
5
4
  from typing import Any, NotRequired, TypedDict
6
5
 
7
- from redis import (
8
- Redis as RedisClient,
9
- ConnectionPool as RedisConnectionPool,
10
- SSLConnection as RedisSSLConnection,
11
- Connection as RedisConnection,
12
- exceptions as RedisExceptions,
13
- )
14
- from redis.asyncio import (
15
- Redis as RedisClientAsync,
16
- ConnectionPool as RedisConnectionPoolAsync,
17
- SSLConnection as RedisSSLConnectionAsync,
18
- Connection as RedisConnectionAsync,
19
- )
6
+ from redis import Connection as RedisConnection
7
+ from redis import ConnectionPool as RedisConnectionPool
8
+ from redis import Redis as RedisClient
9
+ from redis import SSLConnection as RedisSSLConnection
20
10
  from redis import exceptions as RedisExceptions
21
- from redis.retry import Retry as SyncRetry
11
+ from redis.asyncio import Connection as RedisConnectionAsync
12
+ from redis.asyncio import ConnectionPool as RedisConnectionPoolAsync
13
+ from redis.asyncio import Redis as RedisClientAsync
14
+ from redis.asyncio import SSLConnection as RedisSSLConnectionAsync
22
15
  from redis.asyncio.retry import Retry as AsyncRetry
23
16
  from redis.backoff import ExponentialWithJitterBackoff
24
-
17
+ from redis.retry import Retry as SyncRetry
25
18
 
26
19
  MODULE_NAME = "py_shared_lib.libs.db.common..kv_conn"
27
20
 
@@ -265,13 +258,13 @@ class RedisDB(KVDbBase):
265
258
  protocol=3,
266
259
  decode_responses=True,
267
260
  )
268
- redis_conn.ping() # type: ignore
261
+ redis_conn.ping()
269
262
  self.logger.debug(f"{logBuffer}OK")
270
263
  return redis_conn
271
264
 
272
265
  except RedisExceptions.RedisError as e:
273
266
  if redis_conn:
274
- redis_conn.close() # type: ignore
267
+ redis_conn.close()
275
268
 
276
269
  self.logger.error(f"{logBuffer}ERR ({e})")
277
270
  self.shutdown_requested.wait(self.timeout)
@@ -311,7 +304,7 @@ class RedisDBAsync(KVDbBase):
311
304
  async def new_connection(self) -> RedisClientAsync:
312
305
  tries = 0
313
306
  while self.wait_for_connection and not self.shutdown_requested.is_set():
314
- self.logger.debug(f"Attempting to connect to redis .. ", extra={"end": ""})
307
+ self.logger.debug("Attempting to connect to redis .. ", extra={"end": ""})
315
308
  redis_conn = None
316
309
  try:
317
310
  redis_conn = RedisClientAsync(
@@ -330,7 +323,7 @@ class RedisDBAsync(KVDbBase):
330
323
  protocol=3,
331
324
  decode_responses=True,
332
325
  )
333
- await redis_conn.ping() # type: ignore
326
+ await redis_conn.ping()
334
327
  self.logger.debug("OK", extra={"clean": True})
335
328
  return redis_conn
336
329
 
@@ -405,13 +398,13 @@ class RedisDBWithPool(KVDbBase):
405
398
  redis_conn = None
406
399
  try:
407
400
  redis_conn = RedisClient(connection_pool=self.pool)
408
- redis_conn.ping() # type: ignore
401
+ redis_conn.ping()
409
402
  self.logger.debug(f"{logBuffer}OK")
410
403
  return redis_conn
411
404
 
412
405
  except RedisExceptions.RedisError as e:
413
406
  if redis_conn:
414
- redis_conn.close() # type: ignore
407
+ redis_conn.close()
415
408
 
416
409
  self.logger.error(f"{logBuffer}ERR ({e})")
417
410
  self.shutdown_requested.wait(self.timeout)
@@ -479,11 +472,11 @@ class RedisDBWithPoolAsync(KVDbBase):
479
472
  async def new_connection(self) -> RedisClientAsync:
480
473
  tries = 0
481
474
  while self.wait_for_connection and not self.shutdown_requested.is_set():
482
- self.logger.debug(f"Attempting to connect to redis .. ", extra={"end": ""})
475
+ self.logger.debug("Attempting to connect to redis .. ", extra={"end": ""})
483
476
  redis_conn = None
484
477
  try:
485
478
  redis_conn = RedisClientAsync(connection_pool=self.pool)
486
- await redis_conn.ping() # type: ignore
479
+ await redis_conn.ping()
487
480
  self.logger.debug("OK", extra={"clean": True})
488
481
  return redis_conn
489
482
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database_wrapper_redis
3
- Version: 0.2.14
3
+ Version: 0.2.17
4
4
  Summary: database_wrapper for Redis database
5
5
  Author-email: Gints Murans <gm@gm.lv>
6
6
  License: GNU General Public License v3.0 (GPL-3.0)
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
32
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
- Requires-Dist: database_wrapper==0.2.14
35
+ Requires-Dist: database_wrapper==0.2.17
36
36
  Requires-Dist: redis
37
37
 
38
38
  # database_wrapper_redis
@@ -0,0 +1,2 @@
1
+ database_wrapper==0.2.17
2
+ redis
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "database_wrapper_redis"
7
- version = "0.2.14"
7
+ version = "0.2.17"
8
8
  description = "database_wrapper for Redis database"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -35,7 +35,7 @@ classifiers = [
35
35
  ]
36
36
  keywords = ["database", "wrapper", "python", "redis"]
37
37
  dependencies = [
38
- "database_wrapper == 0.2.14",
38
+ "database_wrapper == 0.2.17",
39
39
  "redis",
40
40
  ]
41
41
 
@@ -1,2 +0,0 @@
1
- database_wrapper==0.2.14
2
- redis
@@ -9,19 +9,19 @@ Part of the database_wrapper package
9
9
  import logging
10
10
 
11
11
  from .connector import (
12
+ # Connection and Cursor types
13
+ RedisClient,
14
+ RedisClientAsync,
12
15
  # Basics
13
16
  RedisConfig,
14
- RedisDefaultConfig,
17
+ RedisConnection,
18
+ RedisConnectionAsync,
15
19
  # Connectors
16
20
  RedisDB,
17
21
  RedisDBAsync,
18
22
  RedisDBWithPool,
19
23
  RedisDBWithPoolAsync,
20
- # Connection and Cursor types
21
- RedisClient,
22
- RedisClientAsync,
23
- RedisConnection,
24
- RedisConnectionAsync,
24
+ RedisDefaultConfig,
25
25
  )
26
26
 
27
27
  # Set the logger to a quiet default, can be enabled if needed