Skip to content

Commit

Permalink
run black --preview and modify main.yml to check black --preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustaballer committed Aug 3, 2023
1 parent b6cce11 commit d9eefa0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Check formatting with Black
run: poetry run black --check .
run: poetry run black --preview --check .

- name: Run Flake8
run: poetry run flake8
2 changes: 1 addition & 1 deletion openadapt/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,6 @@ def process_events(
f"{num_total=}"
)
logger.info(
f"{pct_action_events=} {pct_window_events=} {pct_screenshots=} " f"{pct_total=}"
f"{pct_action_events=} {pct_window_events=} {pct_screenshots=} {pct_total=}"
)
return action_events, window_events, screenshots
8 changes: 5 additions & 3 deletions openadapt/scrub.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@ def scrub_dict(
scrubbed_dict[key] = scrubbed_text
elif isinstance(value, list):
scrubbed_list = [
_scrub_list_item(item, key, list_keys, force_scrub_children)
if _should_scrub_list_item(item, key, list_keys)
else item
(
_scrub_list_item(item, key, list_keys, force_scrub_children)
if _should_scrub_list_item(item, key, list_keys)
else item
)
for item in value
]
scrubbed_dict[key] = scrubbed_list
Expand Down
2 changes: 1 addition & 1 deletion openadapt/strategies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run(self) -> None:
[action_event],
drop_constant=False,
)[0]
logger.info(f"action_event=\n" f"{pformat(action_event_dict)}")
logger.info(f"action_event=\n{pformat(action_event_dict)}")
try:
playback.play_action_event(
action_event,
Expand Down
8 changes: 5 additions & 3 deletions openadapt/strategies/stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ def get_window_state_diffs(
ignore_window_ids.add(last_window_id)
logger.info(f"ignoring {first_window_title=} {last_window_title=}")
window_event_states = [
action_event.window_event.state
if action_event.window_event.state["window_id"] not in ignore_window_ids
else {}
(
action_event.window_event.state
if action_event.window_event.state["window_id"] not in ignore_window_ids
else {}
)
for action_event in action_events
]
diffs = [
Expand Down
3 changes: 2 additions & 1 deletion tests/openadapt/test_scrub.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def test_scrub_all_together() -> None:
" He was born on 01/01/1980."
)
assert (
scrub.scrub_text(text_with_pii_phi) == "<PERSON> email is <EMAIL_ADDRESS> and"
scrub.scrub_text(text_with_pii_phi)
== "<PERSON> email is <EMAIL_ADDRESS> and"
" his phone number is <PHONE_NUMBER>."
"His credit card number is <CREDIT_CARD> and"
" his social security number is <US_SSN>."
Expand Down

0 comments on commit d9eefa0

Please sign in to comment.