Skip to content

Commit

Permalink
remove unused imports (#449)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #449

## What

* `~/fbsource/fbcode/python/libcst/libcst codemod remove_unused_imports.RemoveUnusedImportsWithGlean {fbpcs,measurement/private_lift}`
* Removed unused imports in 23 files

## Why

Removing unused imports is good

Reviewed By: leegross, gorel

Differential Revision: D32940259

fbshipit-source-id: 11fab0f5224853a4feac94eff8b2c14e949927f8
  • Loading branch information
jrodal98 authored and facebook-github-bot committed Dec 8, 2021
1 parent 06ca11e commit 769d1f6
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 51 deletions.
2 changes: 1 addition & 1 deletion fbpcs/pid/service/pid_service/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

import abc
from typing import Any, Dict, Optional, Union
from typing import Optional

from fbpcs.pid.entity.pid_instance import PIDProtocol, PIDRole

Expand Down
2 changes: 1 addition & 1 deletion fbpcs/pid/service/pid_service/pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pyre-strict

import logging
from typing import Any, DefaultDict, Dict, List, Optional
from typing import DefaultDict, List, Optional

from fbpcp.service.onedocker import OneDockerService
from fbpcp.service.storage import StorageService
Expand Down
4 changes: 1 addition & 3 deletions fbpcs/pid/service/pid_service/pid_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

import asyncio
import logging
import pathlib
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union
from typing import DefaultDict, Dict, List, Optional, Tuple

import networkx as nx
from fbpcp.service.onedocker import OneDockerService
from fbpcp.service.storage import StorageService
from fbpcp.util import yaml
from fbpcs.onedocker_binary_config import OneDockerBinaryConfig
from fbpcs.pid.entity.pid_instance import (
PIDInstance,
Expand Down
3 changes: 1 addition & 2 deletions fbpcs/pid/service/pid_service/pid_run_protocol_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
# LICENSE file in the root directory of this source tree.

import logging
from typing import Dict, Any, List, Optional
from typing import Dict, List, Optional

from fbpcp.service.onedocker import OneDockerService
from fbpcp.service.storage import StorageService
from fbpcp.util import reflect
from fbpcp.util.typing import checked_cast
from fbpcs.common.util.wait_for_containers import wait_for_containers_async
from fbpcs.onedocker_binary_config import OneDockerBinaryConfig
Expand Down
3 changes: 1 addition & 2 deletions fbpcs/pid/service/pid_service/pid_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import abc
import logging
import os
from typing import Any, Dict, List
from typing import List
from typing import Optional

from fbpcp.entity.container_instance import ContainerInstanceStatus, ContainerInstance
from fbpcp.service.onedocker import OneDockerService
from fbpcp.service.storage import PathType, StorageService
from fbpcp.util import reflect
from fbpcs.onedocker_binary_config import OneDockerBinaryConfig
from fbpcs.pid.entity.pid_instance import PIDInstanceStatus, PIDStageStatus
from fbpcs.pid.entity.pid_stages import UnionPIDStage
Expand Down
18 changes: 13 additions & 5 deletions fbpcs/pid/service/pid_service/pid_stage_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any, DefaultDict, Dict, List, Optional
from typing import DefaultDict, Dict, List, Optional

from fbpcp.service.onedocker import OneDockerService
from fbpcp.service.storage import StorageService
Expand Down Expand Up @@ -45,15 +45,19 @@ def get_stage(
instance_repository,
storage_svc,
onedocker_svc,
onedocker_binary_config_map[OneDockerBinaryNames.SHARDER_HASHED_FOR_PID.value],
onedocker_binary_config_map[
OneDockerBinaryNames.SHARDER_HASHED_FOR_PID.value
],
)
elif stage is UnionPIDStage.PUBLISHER_PREPARE:
return PIDPrepareStage(
stage,
instance_repository,
storage_svc,
onedocker_svc,
onedocker_binary_config_map[OneDockerBinaryNames.UNION_PID_PREPARER.value],
onedocker_binary_config_map[
OneDockerBinaryNames.UNION_PID_PREPARER.value
],
)
elif stage is UnionPIDStage.PUBLISHER_RUN_PID:
return PIDProtocolRunStage(
Expand All @@ -70,15 +74,19 @@ def get_stage(
instance_repository,
storage_svc,
onedocker_svc,
onedocker_binary_config_map[OneDockerBinaryNames.SHARDER_HASHED_FOR_PID.value],
onedocker_binary_config_map[
OneDockerBinaryNames.SHARDER_HASHED_FOR_PID.value
],
)
elif stage is UnionPIDStage.ADV_PREPARE:
return PIDPrepareStage(
stage,
instance_repository,
storage_svc,
onedocker_svc,
onedocker_binary_config_map[OneDockerBinaryNames.UNION_PID_PREPARER.value],
onedocker_binary_config_map[
OneDockerBinaryNames.UNION_PID_PREPARER.value
],
)
elif stage is UnionPIDStage.ADV_RUN_PID:
return PIDProtocolRunStage(
Expand Down
2 changes: 1 addition & 1 deletion fbpcs/pid/service/pid_service/tests/test_pid_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import unittest
from collections import defaultdict
from unittest.mock import mock_open, patch, MagicMock
from unittest.mock import patch, MagicMock

from fbpcp.service.container_aws import AWSContainerService
from fbpcp.service.onedocker import OneDockerService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import os
from dataclasses import dataclass
from enum import Enum
from typing import List, Union, Optional, Type, TYPE_CHECKING
from typing import List, Union, Optional, TYPE_CHECKING

if TYPE_CHECKING:
from fbpcs.private_computation.stage_flows.private_computation_base_stage_flow import (
PrivateComputationBaseStageFlow,
)
from typing import Type

from fbpcp.entity.mpc_instance import MPCInstanceStatus
from fbpcs.common.entity.instance_base import InstanceBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# pyre-strict

from typing import Any, Dict, List, Optional
from typing import List, Optional

from fbpcs.pid.entity.pid_instance import PIDInstance
from fbpcs.pid.entity.pid_instance import PIDInstanceStatus, PIDProtocol, PIDRole
Expand Down
2 changes: 1 addition & 1 deletion fbpcs/private_computation/service/pid_stage_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# pyre-strict

from typing import Any, Dict, List, Optional
from typing import List, Optional

from fbpcs.pid.entity.pid_instance import (
PIDInstance,
Expand Down
18 changes: 1 addition & 17 deletions fbpcs/private_computation/service/private_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import json
import logging
from datetime import datetime, timezone
from typing import DefaultDict, Dict, List, Optional, Any, Type, TypeVar
from typing import DefaultDict, Dict, List, Optional, Type, TypeVar

from fbpcp.entity.mpc_instance import MPCInstance
from fbpcp.service.mpc import MPCService
Expand Down Expand Up @@ -41,12 +41,6 @@
from fbpcs.private_computation.repository.private_computation_instance import (
PrivateComputationInstanceRepository,
)
from fbpcs.private_computation.service.aggregate_shards_stage_service import (
AggregateShardsStageService,
)
from fbpcs.private_computation.service.compute_metrics_stage_service import (
ComputeMetricsStageService,
)
from fbpcs.private_computation.service.constants import (
NUM_NEW_SHARDS_PER_FILE,
STAGE_STARTED_STATUSES,
Expand All @@ -61,20 +55,10 @@
from fbpcs.private_computation.service.errors import (
PrivateComputationServiceValidationError,
)
from fbpcs.private_computation.service.id_match_stage_service import IdMatchStageService
from fbpcs.private_computation.service.post_processing_stage_service import (
PostProcessingStageService,
)
from fbpcs.private_computation.service.prepare_data_stage_service import (
PrepareDataStageService,
)
from fbpcs.private_computation.service.private_computation_stage_service import (
PrivateComputationStageService,
PrivateComputationStageServiceArgs,
)
from fbpcs.private_computation.service.utils import (
ready_for_partial_container_retry,
)
from fbpcs.utils.optional import unwrap_or_default

T = TypeVar("T")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import abc
from dataclasses import dataclass
from typing import Any, Dict, DefaultDict
from typing import Dict, DefaultDict
from typing import List, Optional

from fbpcp.service.mpc import MPCService
Expand All @@ -19,7 +19,7 @@
from fbpcs.post_processing_handler.post_processing_handler import PostProcessingHandler
from fbpcs.private_computation.entity.private_computation_instance import (
PrivateComputationInstance,
PrivateComputationInstanceStatus
PrivateComputationInstanceStatus,
)


Expand Down
8 changes: 0 additions & 8 deletions fbpcs/private_computation_cli/private_computation_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,12 @@
from fbpcs.private_computation.stage_flows.private_computation_base_stage_flow import (
PrivateComputationBaseStageFlow,
)

# TODO: T105929150 clean up these imports once buck imports is fixed
from fbpcs.private_computation.stage_flows.private_computation_decoupled_local_test_stage_flow import (
PrivateComputationDecoupledLocalTestStageFlow,
)
from fbpcs.private_computation.entity.private_computation_instance import (
AggregationType,
AttributionRule,
PrivateComputationRole,
PrivateComputationGameType,
)
from fbpcs.private_computation.stage_flows.private_computation_local_test_stage_flow import (
PrivateComputationLocalTestStageFlow,
)
from fbpcs.private_computation.stage_flows.private_computation_stage_flow import (
PrivateComputationStageFlow,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@
from fbpcs.private_computation.stage_flows.private_computation_base_stage_flow import (
PrivateComputationBaseStageFlow,
)
from fbpcs.private_computation.stage_flows.private_computation_decoupled_stage_flow import (
PrivateComputationDecoupledStageFlow,
)
from fbpcs.private_computation.entity.private_computation_instance import (
AggregationType,
AttributionRule,
PrivateComputationGameType,
PrivateComputationRole,
PrivateComputationInstance,
)
from fbpcs.private_computation.stage_flows.private_computation_stage_flow import (
PrivateComputationStageFlow,
)
from fbpcs.private_computation.repository.private_computation_instance import (
PrivateComputationInstanceRepository,
)
Expand Down

0 comments on commit 769d1f6

Please sign in to comment.