Skip to content

Commit c679907

Browse files
authored
Merge branch 'main' into tooling_updates
2 parents ec747f4 + 49495d2 commit c679907

File tree

5 files changed

+29
-19
lines changed

5 files changed

+29
-19
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## What is this change?
2+
- (List out the changes.)
3+
- (Link to any relevant Github issues or Slack discussion)
4+
5+
## Considerations for discussion
6+
- (List out any significant design decisions that were made and why.)
7+
8+
## How to test the changes (if needed)
9+
- (How should a reviewer test this functionality)

parsons/etl/etl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def convert_column(self, *column, **kwargs):
207207
"""
208208
Transform values under one or more fields via arbitrary functions, method
209209
invocations or dictionary translations. This leverages the petl ``convert()``
210-
method. Example usage can be found `here <https://petl.readthedocs.io/en/v0.24/transform.html#petl.convert>`_.
210+
method. Example usage can be found `here <https://petl.readthedocs.io/latest/transform.html#petl.transform.conversions.convert>`_.
211211
212212
`Args:`
213213
*column: str

parsons/newmode/newmode.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,11 @@ def converted_request(
427427
client=client,
428428
override_api_version=override_api_version,
429429
)
430-
431-
if convert_to_table:
432-
return client.convert_to_table(data=response)
433-
else:
434-
return response
430+
if response:
431+
if convert_to_table:
432+
return client.convert_to_table(data=response)
433+
else:
434+
return response
435435

436436
def get_campaign(self, campaign_id, params={}):
437437
"""

parsons/redash/redash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def __init__(
4545
):
4646
self.base_url = check("REDASH_BASE_URL", base_url)
4747
self.user_api_key = check("REDASH_USER_API_KEY", user_api_key, optional=True)
48-
self.pause = int(check("REDASH_PAUSE_TIME", pause_time, optional=True))
49-
self.timeout = int(check("REDASH_TIMEOUT", timeout, optional=True))
48+
self.pause = int(check("REDASH_PAUSE_TIME", str(pause_time), optional=True))
49+
self.timeout = int(check("REDASH_TIMEOUT", str(timeout), optional=True))
5050

5151
self.verify = verify # for https requests
5252
self.session = requests.Session()

parsons/utilities/check_env.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import os
2-
from typing import NoReturn, Optional, Union
2+
from typing import Optional
33

44

5-
def check(env: str, field: Optional[str], optional: Optional[bool] = False) -> Union[str, NoReturn]:
5+
def check(env: str, field: Optional[str], optional: Optional[bool] = False) -> Optional[str]:
66
"""
77
Check if an environment variable has been set. If it has not been set
88
and the passed field or arguments have not been passed, then raise an
99
error.
1010
"""
11-
if not field:
12-
try:
13-
return os.environ[env]
14-
except KeyError:
15-
if not optional:
16-
raise KeyError(
17-
f"No {env} found. Store as environment variable or pass as an argument."
18-
)
19-
return field
11+
if field:
12+
return field
13+
try:
14+
return os.environ[env]
15+
except KeyError as e:
16+
if not optional:
17+
raise KeyError(
18+
f"No {env} found. Store as environment variable or pass as an argument."
19+
) from e
20+
return None

0 commit comments

Comments
 (0)