From 211100d0739b22cd8ca8cc5e2342ecfba74a7f1f Mon Sep 17 00:00:00 2001 From: dcallies Date: Thu, 30 Jan 2025 10:22:36 -0500 Subject: [PATCH] [hma/pytx] Black format everything --- .../scaled_deployment_curator_omm_config.py | 2 +- .../scaled_deployment_hasher_omm_config.py | 4 ++-- .../OpenMediaMatch/migrations/versions/21cb8a3df884_.py | 2 +- hasher-matcher-actioner/src/OpenMediaMatch/persistence.py | 2 +- .../src/OpenMediaMatch/storage/interface.py | 6 +++--- .../src/OpenMediaMatch/utils/fetch_benchmarking.py | 4 ++-- python-threatexchange/threatexchange/cli/cli_config.py | 2 +- python-threatexchange/threatexchange/cli/main.py | 2 +- .../threatexchange/cli/storage/interfaces.py | 8 ++++---- .../threatexchange/exchanges/clients/ncmec/hash_api.py | 2 +- python-threatexchange/threatexchange/exchanges/helpers.py | 2 +- .../threatexchange/exchanges/impl/file_api.py | 2 +- .../exchanges/tests/test_state_compatibility.py | 4 ++-- .../threatexchange/extensions/vpdq/vpdq_util.py | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_curator_omm_config.py b/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_curator_omm_config.py index cc35ac4eb..fa75546e7 100644 --- a/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_curator_omm_config.py +++ b/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_curator_omm_config.py @@ -4,7 +4,7 @@ A production-ish OMM config, for the curator role. The curator role only gets internal traffic, and so you can probably -get away with a single instance for a long time. +get away with a single instance for a long time. """ import os diff --git a/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_hasher_omm_config.py b/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_hasher_omm_config.py index fd2b4f333..ebe4e3290 100644 --- a/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_hasher_omm_config.py +++ b/hasher-matcher-actioner/reference_omm_configs/scaled_deployment_hasher_omm_config.py @@ -7,11 +7,11 @@ You only need a hasher role if you are not doing hashing on the instances of your service that are handling the content uploads, which can save on -transmission costs at the expense of CPU cost on your frontend. +transmission costs at the expense of CPU cost on your frontend. A common pattern is to use a queue external to OMM to build up items to be hashed and checked, in which case a hasher role might be your largest tier, -since converting large content like videos can take a significant amount of +since converting large content like videos can take a significant amount of CPU. """ diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/migrations/versions/21cb8a3df884_.py b/hasher-matcher-actioner/src/OpenMediaMatch/migrations/versions/21cb8a3df884_.py index ccb7a8859..5b8cc2a9a 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/migrations/versions/21cb8a3df884_.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/migrations/versions/21cb8a3df884_.py @@ -1,7 +1,7 @@ """empty message Revision ID: 21cb8a3df884 -Revises: +Revises: Create Date: 2024-03-13 17:54:36.675199 """ diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/persistence.py b/hasher-matcher-actioner/src/OpenMediaMatch/persistence.py index 13e74af86..82f2fccc9 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/persistence.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/persistence.py @@ -11,7 +11,7 @@ think future deployers may change their mind about which backends to use. We know we are going to have more than relational data, so SQLAlchemy isn't going to be enough. Thus an even more abstract -accessor. +accessor. """ import typing as t diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/storage/interface.py b/hasher-matcher-actioner/src/OpenMediaMatch/storage/interface.py index d9b478478..5d9a2f5d7 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/storage/interface.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/storage/interface.py @@ -4,15 +4,15 @@ Abstraction layer for fetching information needed to run OMM. To try and separate concerns for extension, this file provides -access to all the persistent data needed to run OMM. In the -default implementation, we have a unified implementation that +access to all the persistent data needed to run OMM. In the +default implementation, we have a unified implementation that implements all interfaces, but different implementations may prefer to store different data in different places. For implementations, see storage.mocked.MockedStore, which provides plausable defaults for all of these interfaces, useful for testing, or storage.default.DefaultOMMStore, which uses a combination of -static configuration and postgres. +static configuration and postgres. """ import abc diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/utils/fetch_benchmarking.py b/hasher-matcher-actioner/src/OpenMediaMatch/utils/fetch_benchmarking.py index adc29199d..eca4e8251 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/utils/fetch_benchmarking.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/utils/fetch_benchmarking.py @@ -3,8 +3,8 @@ """ Helpers for fetch benchmarking and testing. -In the long term, these are generic enough that should probably live in -python-threatexchange, but for short-term needs we're just working on them +In the long term, these are generic enough that should probably live in +python-threatexchange, but for short-term needs we're just working on them here. """ from dataclasses import dataclass, field, replace diff --git a/python-threatexchange/threatexchange/cli/cli_config.py b/python-threatexchange/threatexchange/cli/cli_config.py index d7a7789df..16a251046 100644 --- a/python-threatexchange/threatexchange/cli/cli_config.py +++ b/python-threatexchange/threatexchange/cli/cli_config.py @@ -3,7 +3,7 @@ """ Local storage and configuration for the CLI. -The CLI and Hasher-Matcher-Actioner are roughly parallel, but this isn't a +The CLI and Hasher-Matcher-Actioner are roughly parallel, but this isn't a scalable service running on AWS. Instead, we have all of our state in a file (likely ~/.threatexchange) """ diff --git a/python-threatexchange/threatexchange/cli/main.py b/python-threatexchange/threatexchange/cli/main.py index c2e65c61a..4f0d00c47 100644 --- a/python-threatexchange/threatexchange/cli/main.py +++ b/python-threatexchange/threatexchange/cli/main.py @@ -12,7 +12,7 @@ 3. Match data $ threatexchange match photo my_photo.jpg 4. Contribute labels to external APIs - $ threatexchange label photo my_photo.jpg dog + $ threatexchange label photo my_photo.jpg dog $ threatexchange label photo my_photo.jpg --false-positive Additionally, there are a number of utility commands: diff --git a/python-threatexchange/threatexchange/cli/storage/interfaces.py b/python-threatexchange/threatexchange/cli/storage/interfaces.py index a6e8dff10..3a60ede8e 100644 --- a/python-threatexchange/threatexchange/cli/storage/interfaces.py +++ b/python-threatexchange/threatexchange/cli/storage/interfaces.py @@ -5,19 +5,19 @@ Most of the individual components of pytx are find to use piecemeal, and the full interface covers the most complex and complete useage. A usecase -with one collection of hashes using one algorithm might be better off +with one collection of hashes using one algorithm might be better off hardcoding those things rather than fully implementing the interface. # Migration Notes There's an earlier attempt at these interfaces used for CLI at <@Mackay-Fisher add the right pointer to the CLI storage>. -During the development of Hasher-Matcher-Actioner 2.0 +During the development of Hasher-Matcher-Actioner 2.0 (github.com/facebook/ThreatExchange/tree/main/hasher-matcher-actioner/) we realized that the original attempt at this wouldn't meet the needs -of that code and wrote a new interface. +of that code and wrote a new interface. As of 12/2024, we are now migrating that interface from HMA into pytx -proper as part of a migration to dbm +proper as part of a migration to dbm (github.com/facebook/ThreatExchange/issues/1687). The general approach is: 1. Copy the interface unchanged from HMA to pytx 2. Release a new version of pytx diff --git a/python-threatexchange/threatexchange/exchanges/clients/ncmec/hash_api.py b/python-threatexchange/threatexchange/exchanges/clients/ncmec/hash_api.py index 4e931f668..7b433f0ac 100644 --- a/python-threatexchange/threatexchange/exchanges/clients/ncmec/hash_api.py +++ b/python-threatexchange/threatexchange/exchanges/clients/ncmec/hash_api.py @@ -3,7 +3,7 @@ """ Simple implementation for the NCMEC hash sharing XML API -You can find the complete documentation at +You can find the complete documentation at https://report.cybertip.org/hashsharing/v2/documentation.pdf """ diff --git a/python-threatexchange/threatexchange/exchanges/helpers.py b/python-threatexchange/threatexchange/exchanges/helpers.py index 3e574a95f..290cdf4a7 100644 --- a/python-threatexchange/threatexchange/exchanges/helpers.py +++ b/python-threatexchange/threatexchange/exchanges/helpers.py @@ -3,7 +3,7 @@ """ Helpers for implementing SignalExchangeAPIs or state. -They demonstrate how the methods in SignalExchangeAPI can be used to +They demonstrate how the methods in SignalExchangeAPI can be used to reproduce databases of signals, as well as simple recipes for stage. """ diff --git a/python-threatexchange/threatexchange/exchanges/impl/file_api.py b/python-threatexchange/threatexchange/exchanges/impl/file_api.py index 290cb7909..ac7018dc3 100644 --- a/python-threatexchange/threatexchange/exchanges/impl/file_api.py +++ b/python-threatexchange/threatexchange/exchanges/impl/file_api.py @@ -3,7 +3,7 @@ """ A solution that allows loading signals directly from a file. -This is useful if you don't have access to an API, but still have a list of +This is useful if you don't have access to an API, but still have a list of hashes from somewhere. """ diff --git a/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py b/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py index 11f7ccc7f..788fc5139 100644 --- a/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py +++ b/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py @@ -11,7 +11,7 @@ In the test cases, the class descriptions will be used for context, so include: - 1. The last version it was available + 1. The last version it was available 2. The change i.e. @@ -24,7 +24,7 @@ class SignalOpinionOwnerRemoved: ''' owner: int category: SignalOpinionCategory - tags: t.Set[str] + tags: t.Set[str] """ import copy diff --git a/python-threatexchange/threatexchange/extensions/vpdq/vpdq_util.py b/python-threatexchange/threatexchange/extensions/vpdq/vpdq_util.py index ca2d95332..e69d0dc31 100644 --- a/python-threatexchange/threatexchange/extensions/vpdq/vpdq_util.py +++ b/python-threatexchange/threatexchange/extensions/vpdq/vpdq_util.py @@ -135,7 +135,7 @@ def OLD_json_to_vpdq(json_str: str) -> t.List[vpdq.VpdqFeature]: def OLD_read_file_to_hash( - input_hash_filename: t.Union[str, pathlib.Path] + input_hash_filename: t.Union[str, pathlib.Path], ) -> t.List[VpdqCompactFeature]: """Read hash file and return list of VPDQ features