wcp-library 1.1.0__tar.gz → 1.1.2__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 (21) hide show
  1. {wcp_library-1.1.0 → wcp_library-1.1.2}/PKG-INFO +2 -2
  2. {wcp_library-1.1.0 → wcp_library-1.1.2}/README.md +1 -1
  3. {wcp_library-1.1.0 → wcp_library-1.1.2}/pyproject.toml +1 -1
  4. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_sql/oracle.py +4 -4
  5. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_sql/postgres.py +4 -4
  6. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/emailing.py +3 -3
  7. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/logging.py +6 -5
  8. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/sql/oracle.py +4 -4
  9. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/sql/postgres.py +3 -3
  10. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/__init__.py +0 -0
  11. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_credentials/__init__.py +0 -0
  12. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_credentials/api.py +0 -0
  13. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_credentials/oracle.py +0 -0
  14. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_credentials/postgres.py +0 -0
  15. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/async_sql/__init__.py +0 -0
  16. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/credentials/__init__.py +0 -0
  17. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/credentials/api.py +0 -0
  18. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/credentials/oracle.py +0 -0
  19. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/credentials/postgres.py +0 -0
  20. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/informatica.py +0 -0
  21. {wcp_library-1.1.0 → wcp_library-1.1.2}/wcp_library/sql/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wcp-library
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Summary: Common utilites for internal development at WCP
5
5
  Home-page: https://github.com/Whitecap-DNA/WCP-Library
6
6
  Author: Mitch-Petersen
@@ -32,7 +32,7 @@ Commonly used functions for the D&A team.
32
32
  `pip install WCP-Library`
33
33
 
34
34
  ## Usage
35
- See Wiki for more information.
35
+ See [Wiki](https://github.com/Whitecap-DNA/WCP-Library/wiki/) for more information.
36
36
 
37
37
  ## Authors and acknowledgment
38
38
  Mitch Petersen
@@ -7,7 +7,7 @@ Commonly used functions for the D&A team.
7
7
  `pip install WCP-Library`
8
8
 
9
9
  ## Usage
10
- See Wiki for more information.
10
+ See [Wiki](https://github.com/Whitecap-DNA/WCP-Library/wiki/) for more information.
11
11
 
12
12
  ## Authors and acknowledgment
13
13
  Mitch Petersen
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wcp-library"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  description = "Common utilites for internal development at WCP"
5
5
  authors = ["Mitch-Petersen <mitch.petersen@wcap.ca>"]
6
6
  readme = "README.md"
@@ -10,8 +10,8 @@ from wcp_library.async_sql import retry
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
- async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
- max_connections: int) -> AsyncConnectionPool:
13
+ async def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
+ max_connections: int) -> AsyncConnectionPool:
15
15
  """
16
16
  Create Warehouse Connection
17
17
 
@@ -71,8 +71,8 @@ class AsyncOracleConnection(object):
71
71
 
72
72
  sid_or_service = self._database if self._database else self._sid
73
73
 
74
- self._session_pool = await connect_warehouse(self._username, self._password, self._hostname, self._port,
75
- sid_or_service, self.min_connections, self.max_connections)
74
+ self._session_pool = await _connect_warehouse(self._username, self._password, self._hostname, self._port,
75
+ sid_or_service, self.min_connections, self.max_connections)
76
76
 
77
77
  async def set_user(self, credentials_dict: dict) -> None:
78
78
  """
@@ -10,8 +10,8 @@ from wcp_library.async_sql import retry
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
- async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
- max_connections: int) -> AsyncConnectionPool:
13
+ async def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
+ max_connections: int) -> AsyncConnectionPool:
15
15
  """
16
16
  Create Warehouse Connection
17
17
 
@@ -66,8 +66,8 @@ class AsyncPostgresConnection(object):
66
66
  :return: None
67
67
  """
68
68
 
69
- self._session_pool = await connect_warehouse(self._username, self._password, self._hostname, self._port,
70
- self._database, self.min_connections, self.max_connections)
69
+ self._session_pool = await _connect_warehouse(self._username, self._password, self._hostname, self._port,
70
+ self._database, self.min_connections, self.max_connections)
71
71
 
72
72
  async def set_user(self, credentials_dict: dict) -> None:
73
73
  """
@@ -7,7 +7,7 @@ from email.utils import formatdate
7
7
  from pathlib import Path
8
8
 
9
9
 
10
- def send_email(sender: str, recipients: list, subject: str, message=None):
10
+ def send_email(sender: str, recipients: list, subject: str, message: str=None) -> None:
11
11
  """
12
12
  Function to send an email
13
13
 
@@ -32,7 +32,7 @@ def send_email(sender: str, recipients: list, subject: str, message=None):
32
32
  server.quit()
33
33
 
34
34
 
35
- def email_reporting(subject: str, message: str):
35
+ def email_reporting(subject: str, message: str) -> None:
36
36
  """
37
37
  Function to email the reporting team from the Python email
38
38
 
@@ -55,7 +55,7 @@ def email_reporting(subject: str, message: str):
55
55
  server.quit()
56
56
 
57
57
 
58
- def email_with_attachments(sender: str, recipients: list, subject: str, message=None, attachments: list[Path]=None):
58
+ def email_with_attachments(sender: str, recipients: list, subject: str, message: str=None, attachments: list[Path]=None) -> None:
59
59
  """
60
60
  Function to send an email with attachments
61
61
 
@@ -4,7 +4,7 @@ import sys
4
4
  from wcp_library import application_path
5
5
 
6
6
 
7
- def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
7
+ def create_log(file_level: int, console_level: int, iterations: int, project_name: str, mode: str = "w",
8
8
  format: str = "%(asctime)s:%(levelname)s:%(module)s:%(filename)s:%(lineno)d:%(message)s"):
9
9
  """
10
10
  Create log file.
@@ -13,7 +13,8 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
13
13
 
14
14
  format help: https://docs.python.org/3/library/logging.html#logrecord-attributes
15
15
 
16
- :param level: Logging level to output to log file.
16
+ :param file_level: Logging level to output to log file.
17
+ :param console_level: Logging level to output to console.
17
18
  :param iterations: Number of log files to keep.
18
19
  :param project_name: Name of the project. (Used as the log file name)
19
20
  :param mode: Mode to open the log file. (Default: "w")
@@ -33,12 +34,12 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
33
34
 
34
35
  logging.basicConfig(
35
36
  filename=(application_path / (project_name + ".log")),
36
- level=level,
37
+ level=file_level,
37
38
  format=format,
38
39
  filemode=mode
39
40
  )
40
41
 
41
- MIN_LEVEL = logging.DEBUG
42
+ MIN_LEVEL = console_level
42
43
  stdout_hdlr = logging.StreamHandler(sys.stdout)
43
44
  stderr_hdlr = logging.StreamHandler(sys.stderr)
44
45
  stdout_hdlr.setLevel(MIN_LEVEL)
@@ -48,4 +49,4 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
48
49
  rootLogger.addHandler(stdout_hdlr)
49
50
  rootLogger.addHandler(stderr_hdlr)
50
51
  logger = logging.getLogger(__name__)
51
- logger.setLevel(logging.DEBUG)
52
+ logger.setLevel(console_level)
@@ -10,8 +10,8 @@ from wcp_library.sql import retry
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
- def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
- max_connections: int) -> ConnectionPool:
13
+ def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
+ max_connections: int) -> ConnectionPool:
15
15
  """
16
16
  Create Warehouse Connection
17
17
 
@@ -72,8 +72,8 @@ class OracleConnection(object):
72
72
 
73
73
  sid_or_service = self._database if self._database else self._sid
74
74
 
75
- self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
76
- sid_or_service, self.min_connections, self.max_connections)
75
+ self._session_pool = _connect_warehouse(self._username, self._password, self._hostname, self._port,
76
+ sid_or_service, self.min_connections, self.max_connections)
77
77
 
78
78
  def set_user(self, credentials_dict: dict) -> None:
79
79
  """
@@ -10,8 +10,8 @@ from wcp_library.sql import retry
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
- def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
- max_connections: int) -> ConnectionPool:
13
+ def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
14
+ max_connections: int) -> ConnectionPool:
15
15
  """
16
16
  Create Warehouse Connection
17
17
 
@@ -66,7 +66,7 @@ class PostgresConnection(object):
66
66
  :return: None
67
67
  """
68
68
 
69
- self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
69
+ self._session_pool = _connect_warehouse(self._username, self._password, self._hostname, self._port,
70
70
  self._database, self.min_connections, self.max_connections)
71
71
 
72
72
  def set_user(self, credentials_dict: dict) -> None: