Skip to content

Commit eab1ad9

Browse files
authored
Merge branch 'main' into tooling_updates
2 parents e6d11cb + 49495d2 commit eab1ad9

File tree

11 files changed

+72
-24
lines changed

11 files changed

+72
-24
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)

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
2323
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
2424

25-
- uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8
25+
- uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9

.github/workflows/security_scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060
results_format: sarif
6161
publish_results: true
6262

63-
- uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b
63+
- uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f
6464
with:
6565
sarif_file: results.sarif

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"sphinx.ext.viewcode",
4848
"myst_parser",
4949
"sphinx_multiversion",
50+
"sphinxcontrib.googleanalytics",
5051
]
5152

5253
# Sorting of attributes
@@ -191,3 +192,6 @@
191192

192193
# Get tags to whitelist from DOCUMENTED_VERSIONS const
193194
smv_tag_whitelist = "|".join(["^" + version + "$" for version in DOCUMENTED_VERSIONS])
195+
196+
# Adds Google Analytics tracking code to the HTML output
197+
googleanalytics_id = "G-L2YB7WHTRG"

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/ngpvan/contact_notes.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ def get_contact_notes(self, van_id):
2727
logger.info(f"Found {tbl.num_rows} custom fields.")
2828
return tbl
2929

30-
def create_contact_note(self, van_id, text, is_view_restricted, note_category_id=None):
30+
def create_contact_note(
31+
self,
32+
van_id,
33+
text,
34+
is_view_restricted,
35+
note_category_id=None,
36+
contact_type_id=None,
37+
input_type_id=None,
38+
date_canvassed=None,
39+
result_code_id=None,
40+
):
3141
"""
3242
Create a contact note
3343
@@ -42,6 +52,15 @@ def create_contact_note(self, van_id, text, is_view_restricted, note_category_id
4252
in the current context.
4353
note_category_id: int
4454
Optional; if set, the note category for this note.
55+
contact_type_id: str
56+
Defaults to 82 if no value is set. This value results in a null contact type in EA.
57+
input_type_id: str
58+
Defaults to 11 if no value is set. If the value is 11,
59+
the input type in EA will be listed as "API"
60+
date_canvassed: date
61+
Defaults to current date if no value is set. Dates should be formatted in ISO8601 standard.
62+
result_code_id: str
63+
Defaults to 205 if no value is set. This value results in a "Contacted" result in EA.
4564
`Returns:`
4665
int
4766
The note ID.
@@ -50,6 +69,20 @@ def create_contact_note(self, van_id, text, is_view_restricted, note_category_id
5069
if note_category_id is not None:
5170
note["category"] = {"noteCategoryId": note_category_id}
5271

72+
contact_history = {}
73+
74+
if contact_type_id is not None:
75+
contact_history["contact_type_id"] = str(contact_type_id)
76+
if input_type_id is not None:
77+
contact_history["input_type_id"] = str(input_type_id)
78+
if date_canvassed is not None:
79+
contact_history["dateCanvassed"] = date_canvassed
80+
if result_code_id is not None:
81+
contact_history["result_code_id"] = str(result_code_id)
82+
83+
if contact_history:
84+
note["contactHistory"] = contact_history
85+
5386
r = self.connection.post_request(f"people/{van_id}/notes", json=note)
5487
logger.info(f"Contact note {r} created.")
5588
return r

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

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
bandit[sarif]==1.8.3
33
coverage==7.8.0
44
pre-commit==4.2.0
5-
pytest-cov==6.0.0
5+
pytest-cov==6.1.1
66
pytest-datadir==1.6.1
77
pytest-mock==3.14.0
88
pytest-xdist==3.6.1
@@ -14,6 +14,7 @@ testfixtures==8.3.0
1414
# Docs Requirements
1515
myst-parser==3.0.1;python_version<'3.10'
1616
myst-parser==4.0.1;python_version>='3.10'
17+
sphinxcontrib-googleanalytics
1718
sphinx-multiversion
1819
sphinx-rtd-theme==3.0.2
1920
Sphinx==7.4.7;python_version<'3.10'

0 commit comments

Comments
 (0)