Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit 654b508

Browse files
amyreesefacebook-github-bot
authored andcommitted
apply Black 2024 style in fbcode (8/16)
Summary: Formats the covered files with pyfmt. paintitblack Reviewed By: aleivag Differential Revision: D54447737 fbshipit-source-id: 6c05d7941c6b4f1787b8da6cf810693f48a96c4e
1 parent ffdca9d commit 654b508

File tree

44 files changed

+203
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+203
-167
lines changed

fbpcs/bolt/oss_bolt_pcs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ class BoltPCSCreateInstanceArgs(BoltCreateInstanceArgs, DataClassJsonMixin):
6464
# if no value is provided in the yaml file, then the dataclass json
6565
# library will return the default stage flow. Otherwise, if it was
6666
# provided in the yaml file, we should decode the string.
67-
decoder=lambda x: x
68-
if x is PrivateComputationBaseStageFlow
69-
else PrivateComputationBaseStageFlow.cls_name_to_cls(x),
67+
decoder=lambda x: (
68+
x
69+
if x is PrivateComputationBaseStageFlow
70+
else PrivateComputationBaseStageFlow.cls_name_to_cls(x)
71+
),
7072
)
7173
},
7274
)

fbpcs/bolt/read_config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
from fbpcs.utils.config_yaml.config_yaml_dict import ConfigYamlDict
2121

2222

23-
def parse_bolt_config(
24-
config: Dict[str, Any], logger: logging.Logger
25-
) -> Tuple[
23+
def parse_bolt_config(config: Dict[str, Any], logger: logging.Logger) -> Tuple[
2624
BoltRunner[BoltPCSCreateInstanceArgs, BoltPCSCreateInstanceArgs],
2725
List[BoltJob[BoltPCSCreateInstanceArgs, BoltPCSCreateInstanceArgs]],
2826
]:

fbpcs/bolt/test/test_bolt_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def test_non_joint_stage(
161161
@mock.patch("fbpcs.bolt.bolt_runner.asyncio.sleep")
162162
async def test_get_server_ips_after_start(self, mock_sleep) -> None:
163163
mock_server_ips = ["1.1.1.1"]
164-
for (test_stage, test_publisher_status) in (
164+
for test_stage, test_publisher_status in (
165165
( # test Non-joint stage should get None server ips
166166
DummyNonJointStageFlow.NON_JOINT_STAGE,
167167
DummyNonJointStageFlow.NON_JOINT_STAGE.completed_status,

fbpcs/common/entity/dataclasses_hooks.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ def run(
3131
previous_field_value: Any,
3232
new_field_value: Any,
3333
hook_event: HookEventType,
34-
) -> None:
35-
...
34+
) -> None: ...
3635

3736
@property
3837
@abstractmethod
39-
def triggers(self) -> Iterable[HookEventType]:
40-
...
38+
def triggers(self) -> Iterable[HookEventType]: ...
4139

4240

4341
@dataclass

fbpcs/common/feature/pcs_feature_gate_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ def get_stage_flow(
3737
) -> Type[PrivateComputationBaseStageFlow]:
3838
selected_stage_flow_cls = unwrap_or_default(
3939
optional=stage_flow_cls,
40-
default=PrivateComputationPCF2StageFlow
41-
if game_type is PrivateComputationGameType.ATTRIBUTION
42-
else PrivateComputationStageFlow,
40+
default=(
41+
PrivateComputationPCF2StageFlow
42+
if game_type is PrivateComputationGameType.ATTRIBUTION
43+
else PrivateComputationStageFlow
44+
),
4345
)
4446

4547
# warning, enabled feature gating will override stage flow, Please contact PSI team to have a similar adoption

fbpcs/common/service/test/test_pcs_container_service.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ def test_create_instances_with_list_of_env_vars(self, mock_create_instance):
123123
]
124124

125125
# Act
126-
container_instances: List[
127-
ContainerInstance
128-
] = self.container_svc.create_instances(
129-
container_definition=f"{TEST_TASK_DEFNITION}#{TEST_CONTAINER_DEFNITION}",
130-
cmds=cmd_list,
131-
env_vars=[TEST_ENV_VARS, TEST_ENV_VARS_2],
132-
container_type=TEST_CONTAINER_TYPE,
133-
permission=TEST_CONTAINER_PERMISSION,
126+
container_instances: List[ContainerInstance] = (
127+
self.container_svc.create_instances(
128+
container_definition=f"{TEST_TASK_DEFNITION}#{TEST_CONTAINER_DEFNITION}",
129+
cmds=cmd_list,
130+
env_vars=[TEST_ENV_VARS, TEST_ENV_VARS_2],
131+
container_type=TEST_CONTAINER_TYPE,
132+
permission=TEST_CONTAINER_PERMISSION,
133+
)
134134
)
135135

136136
# Assert

fbpcs/common/service/test/test_trace_logging_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def test_write_checkpoint_cm(self) -> None:
7272
"run_id": "run123",
7373
"instance_id": "instance456",
7474
"checkpoint_name": "foo",
75-
"checkpoint_data": checkpoint_data.copy()
76-
if checkpoint_data
77-
else None,
75+
"checkpoint_data": (
76+
checkpoint_data.copy() if checkpoint_data else None
77+
),
7878
}
7979

8080
try:

fbpcs/common/tests/entity/test_comprehensive_hooks_and_mutability.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def region_is_deleted(obj: InstanceBase) -> bool:
126126
# generic hooks: track the highest pressure
127127
##########################
128128

129+
129130
# keep track of the highest pressure
130131
def set_highest_pressure(obj: InstanceBase) -> None:
131132
# pyre-ignore Undefined attribute [16]: `InstanceBase` has no attribute `pressure`

fbpcs/common/tests/entity/test_generic_hook.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from fbpcs.common.entity.generic_hook import GenericHook
1414
from fbpcs.common.entity.instance_base import InstanceBase
1515

16+
1617
# keep tracking the highest pressure
1718
def set_highest_pressure(obj: InstanceBase) -> None:
1819
pressure: int = getattr(obj, "pressure", None)

fbpcs/infra/cloud_bridge/data_ingestion/data_transformation_lambda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ def lambda_handler(
204204
def _parse_client_user_agent(client_user_agent: str) -> Dict[str, str]:
205205
parsed_fields = {}
206206

207-
for (regex, browserName) in BROWSER_NAME_REGEXES:
207+
for regex, browserName in BROWSER_NAME_REGEXES:
208208
if regex.match(client_user_agent):
209209
parsed_fields[BROWSER_NAME] = browserName
210210
break
211-
for (regex, deviceOs) in DEVICE_OS_REGEXES:
211+
for regex, deviceOs in DEVICE_OS_REGEXES:
212212
if regex.match(client_user_agent):
213213
parsed_fields[DEVICE_OS] = deviceOs
214214
break

0 commit comments

Comments
 (0)