wcp-library 1.6.4__tar.gz → 1.6.6__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.
Files changed (28) hide show
  1. {wcp_library-1.6.4 → wcp_library-1.6.6}/PKG-INFO +1 -1
  2. {wcp_library-1.6.4 → wcp_library-1.6.6}/pyproject.toml +1 -1
  3. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/__init__.py +22 -28
  4. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/ftp/ftp.py +1 -1
  5. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/sql/oracle.py +5 -4
  6. {wcp_library-1.6.4 → wcp_library-1.6.6}/README.md +0 -0
  7. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/browser_automation/__init__.py +0 -0
  8. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/browser_automation/browser.py +0 -0
  9. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/browser_automation/interactions.py +0 -0
  10. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/__init__.py +0 -0
  11. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/_credential_manager_asynchronous.py +0 -0
  12. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/_credential_manager_synchronous.py +0 -0
  13. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/api.py +0 -0
  14. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/ftp.py +0 -0
  15. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/internet.py +0 -0
  16. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/oracle.py +0 -0
  17. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/credentials/postgres.py +0 -0
  18. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/emailing.py +0 -0
  19. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/ftp/__init__.py +0 -0
  20. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/ftp/sftp.py +0 -0
  21. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/informatica.py +0 -0
  22. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/logging.py +0 -0
  23. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/selenium/__init__.py +0 -0
  24. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/selenium/_selenium_driver.py +0 -0
  25. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/selenium/selenium_helper.py +0 -0
  26. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/sql/__init__.py +0 -0
  27. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/sql/postgres.py +0 -0
  28. {wcp_library-1.6.4 → wcp_library-1.6.6}/wcp_library/time.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcp-library
3
- Version: 1.6.4
3
+ Version: 1.6.6
4
4
  Summary: Common utilites for internal development at WCP
5
5
  Author: Mitch-Petersen
6
6
  Author-email: mitch.petersen@wcap.ca
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "wcp-library"
3
- version = "1.6.4"
3
+ version = "1.6.6"
4
4
  description = "Common utilites for internal development at WCP"
5
5
  authors = [{name="Mitch-Petersen", email="mitch.petersen@wcap.ca"}]
6
6
  readme = "README.md"
@@ -42,24 +42,21 @@ def divide_chunks(list_obj: list, size: int) -> Generator:
42
42
 
43
43
 
44
44
  def retry(
45
- exception: Type[Exception],
45
+ exceptions: tuple[Type[Exception]],
46
46
  max_attempts: Optional[int] = MAX_ATTEMPTS,
47
47
  delay: Optional[int] = DELAY,
48
48
  backoff: Optional[int] = BACKOFF,
49
49
  jitter: Optional[int] = JITTER,
50
50
  ) -> Callable:
51
- """Decorator to retry a synchronous function on a specified exception with
52
- exponential backoff and jitter.
53
-
54
- Args:
55
- exception (Type[Exception]): The exception type to catch and retry on.
56
- max_attempts (int): Maximum number of retry attempts.
57
- delay (int): Initial delay between retries (in seconds).
58
- backoff (int): Multiplier to increase delay after each failure.
59
- jitter (int): Maximum number of seconds to add randomly to each delay.
60
-
61
- Returns:
62
- Callable: The decorated function with retry logic.
51
+ """
52
+ Decorator to retry a synchronous function on a specified exception with exponential backoff and jitter.
53
+
54
+ :param exceptions: Tuple of exception types to catch and retry on.
55
+ :param max_attempts: Maximum number of retry attempts.
56
+ :param delay: Initial delay between retries (in seconds).
57
+ :param backoff: Multiplier to increase delay after each failure.
58
+ :param jitter: Maximum number of seconds to add randomly to each delay.
59
+ :return: The decorated function with retry logic.
63
60
  """
64
61
 
65
62
  def decorator(func: Callable) -> Callable:
@@ -70,7 +67,7 @@ def retry(
70
67
  for attempt in range(0, max_attempts):
71
68
  try:
72
69
  return func(*args, **kwargs)
73
- except exception as error:
70
+ except exceptions as error:
74
71
  if attempt == max_attempts:
75
72
  logger.error("Retry failed after %d attempts.", max_attempts)
76
73
  raise
@@ -90,24 +87,21 @@ def retry(
90
87
 
91
88
 
92
89
  def async_retry(
93
- exception: Type[Exception],
90
+ exceptions: tuple[Type[Exception]],
94
91
  max_attempts: Optional[int] = MAX_ATTEMPTS,
95
92
  delay: Optional[int] = DELAY,
96
93
  backoff: Optional[int] = BACKOFF,
97
94
  jitter: Optional[int] = JITTER,
98
95
  ) -> Callable:
99
- """Decorator to retry an async function on a specified exception
100
- with exponential backoff and jitter.
101
-
102
- Args:
103
- exception (Type[Exception]): The exception type to catch and retry on.
104
- max_attempts (int): Maximum number of retry attempts.
105
- delay (int): Initial delay between retries (in seconds).
106
- backoff (int): Multiplier to increase delay after each failure.
107
- jitter (int): Maximum number of seconds to add randomly to each delay.
108
-
109
- Returns:
110
- Callable: The decorated async function with retry logic.
96
+ """
97
+ Decorator to retry an async function on a specified exception with exponential backoff and jitter.
98
+
99
+ :param exceptions: Tuple of exception types to catch and retry on.
100
+ :param max_attempts: Maximum number of retry attempts.
101
+ :param delay: Initial delay between retries (in seconds).
102
+ :param backoff: Multiplier to increase delay after each failure.
103
+ :param jitter: Maximum number of seconds to add randomly to each delay.
104
+ :return: The decorated async function with retry logic.
111
105
  """
112
106
 
113
107
  def decorator(func: Callable) -> Callable:
@@ -118,7 +112,7 @@ def async_retry(
118
112
  for attempt in range(0, max_attempts):
119
113
  try:
120
114
  return await func(*args, **kwargs)
121
- except exception as error:
115
+ except exceptions as error:
122
116
  if attempt == max_attempts:
123
117
  logger.error("Retry failed after %d attempts.", max_attempts)
124
118
  raise
@@ -17,7 +17,7 @@ class FTP:
17
17
 
18
18
  self._ftp_factory: ftputil.session.session_factory = ftputil.session.session_factory(port=self.port)
19
19
  self.ftp_connection: Optional[ftputil.FTPHost] = None if not (self._username and self._password) \
20
- else ftputil.FTPHost(self.host, self._username, self._password, session_factory=self._ftp_factory)
20
+ else ftputil.FTPHost(self.host, self._username, self._password) #, session_factory=self._ftp_factory)
21
21
 
22
22
  def login(self, username: str, password: str) -> None:
23
23
  """
@@ -9,6 +9,7 @@ from oracledb import ConnectionPool, AsyncConnectionPool, Connection, AsyncConne
9
9
  from wcp_library.sql import retry, async_retry
10
10
 
11
11
  logger = logging.getLogger(__name__)
12
+ oracledb.defaults.fetch_lobs = False
12
13
 
13
14
 
14
15
  def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
@@ -44,7 +45,7 @@ def _connect_warehouse(username: str, password: str, hostname: str, port: int, d
44
45
  connection = oracledb.connect(
45
46
  user=username,
46
47
  password=password,
47
- dsn=oracledb.makedsn(hostname, port, sid=database)
48
+ dsn=oracledb.makedsn(hostname, port, service_name=database)
48
49
  )
49
50
  return connection
50
51
 
@@ -82,7 +83,7 @@ async def _async_connect_warehouse(username: str, password: str, hostname: str,
82
83
  connection = await oracledb.connect_async(
83
84
  user=username,
84
85
  password=password,
85
- dsn=oracledb.makedsn(hostname, port, sid=database)
86
+ dsn=oracledb.makedsn(hostname, port, service_name=database)
86
87
  )
87
88
  return connection
88
89
 
@@ -113,7 +114,7 @@ class OracleConnection(object):
113
114
 
114
115
  self._retry_count = 0
115
116
  self.retry_limit = 50
116
- self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011', 'ORA-08103']
117
+ self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011', 'ORA-08103', 'ORA-04021']
117
118
 
118
119
  @retry
119
120
  def _connect(self) -> None:
@@ -392,7 +393,7 @@ class AsyncOracleConnection(object):
392
393
 
393
394
  self._retry_count = 0
394
395
  self.retry_limit = 50
395
- self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011', 'ORA-08103']
396
+ self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011', 'ORA-08103', 'ORA-04021']
396
397
 
397
398
  @async_retry
398
399
  async def _connect(self) -> None:
File without changes