Skip to content

Commit

Permalink
Bump black from 22.8.0 to 23.1.0 (#2756)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas <[email protected]>
  • Loading branch information
dependabot[bot] and ThomasLaPiana authored Mar 27, 2023
1 parent 128f017 commit 4241fb0
Show file tree
Hide file tree
Showing 74 changed files with 41 additions and 114 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==22.8.0
black==23.1.0
debugpy==1.6.3
Faker==14.1.0
GitPython==3.1.27
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ loguru>=0.5,<0.6
multidimensional_urlencode==0.0.4
okta==2.7.0
openpyxl==3.0.9
packaging==21.3
packaging==23.0
pandas==1.4.3
passlib[bcrypt]==1.7.4
plotly==5.13.1
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ctl/database/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ async def upsert_resources(
sql_model=sql_model.__name__,
fides_keys=[resource["fides_key"] for resource in resource_dicts],
):

async with async_session.begin():
try:
log.debug("Upserting resources")
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ctl/database/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def load_default_dsr_policies() -> None:
inserts them to target a default set of data categories if not.
"""
with sync_session() as db_session: # type: ignore[attr-defined]

client_id = get_client_id(db_session)

# By default, include all categories *except* those related to a user's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def upgrade():

result = conn.execute(statement)
for row in result:

op.execute(
f"UPDATE messagingconfig SET service_type = '{row[0]}' WHERE id = '{row[1]}';"
)
Expand Down Expand Up @@ -123,7 +122,6 @@ def downgrade():

result = conn.execute(statement)
for row in result:

op.execute(
f"UPDATE messagingconfig SET service_type = '{row[0]}' WHERE id = '{row[1]}';"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


def upgrade():

session = Session(bind=op.get_bind())
conn = session.connection()
statement = text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


def upgrade():

for table_name in SQL_MODEL_LIST:
op.add_column(
table_name,
Expand All @@ -54,7 +53,6 @@ def upgrade():


def downgrade():

for table_name in SQL_MODEL_LIST:
op.drop_column(table_name, "created_at")
op.drop_column(table_name, "updated_at")
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def upgrade():


def downgrade():

op.rename_table("ctl_data_categories", "data_categories")
op.execute("ALTER INDEX ctl_data_categories_pkey RENAME TO data_categories_pkey")
op.execute(
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def __get_validators__(cls) -> Generator: # pragma: no cover

@classmethod
def validate(cls, value: str) -> str:

# HTML Escapes
value = escape(value)

Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/api/v1/endpoints/messaging_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def update_config_secrets(
messaging_config: MessagingConfig,
unvalidated_messaging_secrets: possible_messaging_secrets,
) -> TestMessagingStatusMessage:

try:
secrets_schema = get_schema_for_secrets(
service_type=messaging_config.service_type, # type: ignore
Expand Down
4 changes: 3 additions & 1 deletion src/fides/api/ops/api/v1/endpoints/saas_config_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

router = APIRouter(tags=["SaaS Configs"], prefix=V1_URL_PREFIX)


# Helper method to inject the parent ConnectionConfig into these child routes
def _get_saas_connection_config(
connection_key: FidesKey, db: Session = Depends(deps.get_db)
Expand Down Expand Up @@ -198,7 +199,8 @@ def delete_saas_config(
connection_config: ConnectionConfig = Depends(_get_saas_connection_config),
) -> None:
"""Removes the SaaS config for the given connection config.
The corresponding dataset and secrets must be deleted before deleting the SaaS config"""
The corresponding dataset and secrets must be deleted before deleting the SaaS config
"""

logger.info("Finding SaaS config for connection '{}'", connection_config.key)
saas_config = connection_config.saas_config
Expand Down
3 changes: 1 addition & 2 deletions src/fides/api/ops/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ def __init__(self, *datasets: GraphDataset) -> None:

for node_address, node in self.nodes.items():
for field_path, ref_list in node.collection.references().items():

source_field_address: FieldAddress = FieldAddress(
node_address.dataset, node_address.collection, *field_path.levels
)
for (dest_field_address, direction) in ref_list:
for dest_field_address, direction in ref_list:
if dest_field_address.collection_address() not in self.nodes:
logger.warning(
"Referenced object {} does not exist", dest_field_address
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/graph/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ def traverse( # pylint: disable=R0914
running_node_queue: MatchingQueue[TraversalNode] = MatchingQueue(self.root_node)
remaining_edges: Set[Edge] = self.edges.copy()
while not running_node_queue.is_empty():

# this is to support the "run traversal_node A AFTER traversal_node B functionality:"
n = running_node_queue.pop_first_match(
lambda x: x.can_run_given(remaining_node_keys)
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/models/datasetconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ def get_graph(self) -> GraphDataset:
and self.connection_config.saas_config is not None
and self.connection_config.saas_config["fides_key"] == self.fides_key
):

dataset_graph = merge_datasets(
dataset_graph,
self.connection_config.get_saas_config().get_graph(self.connection_config.secrets), # type: ignore
Expand Down
3 changes: 2 additions & 1 deletion src/fides/api/ops/schemas/policy_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class Config:

class PolicyWebhookUpdateResponse(BaseSchema):
"""Response schema after a PATCH to a single webhook - because updating the order of this webhook can update the
order of other webhooks, new_order will include the new order if order was adjusted at all"""
order of other webhooks, new_order will include the new order if order was adjusted at all
"""

resource: PolicyWebhookResponse
new_order: List[WebhookOrder]
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/service/connectors/fides/fides_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def authenticated_request(
data: Optional[Any] = None,
json: Optional[Any] = None,
) -> Request:

if not self.token:
raise FidesError(
f"Unable to create authenticated request. No token for Fides connector for server {self.uri}"
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/service/connectors/query_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def display_query_data(self) -> Dict[str, Any]:
t = QueryToken()

for field_str, input_collection_address in self.query_sources().items():

if (
len(input_collection_address) == 1
and input_collection_address[0] == ROOT_COLLECTION_ADDRESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def result(*args: Any, **kwargs: Any) -> Response:
sleep_time = backoff_factor * (2 ** (attempt + 1))
try:
return func(*args, **kwargs)
except RequestFailureResponseException as exc: # pylint: disable=W0703
except (
RequestFailureResponseException
) as exc: # pylint: disable=W0703
response: Response = exc.response
status_code: int = response.status_code
last_exception = ClientUnsuccessfulException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import os
from abc import ABC, abstractmethod
from typing import Dict, Iterable, List, Optional, Union
from typing import Dict, Iterable, List, Optional

from loguru import logger
from packaging.version import LegacyVersion, Version
from packaging.version import Version
from packaging.version import parse as parse_version
from sqlalchemy.orm import Session

Expand Down Expand Up @@ -77,7 +77,6 @@ def get_connector_templates(self) -> Dict[str, ConnectorTemplate]:

# pylint: disable=protected-access
class ConnectorRegistry:

_instance = None
_templates: Dict[str, ConnectorTemplate] = {}

Expand Down Expand Up @@ -177,9 +176,7 @@ def update_saas_configs(db: Session) -> None:
connector_type
)
saas_config = SaaSConfig(**load_config_from_string(template.config))
template_version: Union[LegacyVersion, Version] = parse_version(
saas_config.version
)
template_version: Version = parse_version(saas_config.version)

connection_configs: Iterable[ConnectionConfig] = ConnectionConfig.filter(
db=db,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class AesEncryptionMaskingStrategy(MaskingStrategy):

name = "aes_encrypt"
configuration_model = AesEncryptionMaskingConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class CursorPaginationStrategy(PaginationStrategy):

name = "cursor"
configuration_model = CursorPaginationConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class LinkPaginationStrategy(PaginationStrategy):

name = "link"
configuration_model = LinkPaginationConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class OffsetPaginationStrategy(PaginationStrategy):

name = "offset"
configuration_model = OffsetPaginationConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def send_email_batch(self: DatabaseTask) -> EmailExitState:

logger.info("Starting batched email send...")
with self.get_new_session() as session:

privacy_requests: Query = (
session.query(PrivacyRequest)
.filter(PrivacyRequest.status == PrivacyRequestStatus.awaiting_email_send)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def mailchimp_messages_access(
processed_data = []
if conversation_ids:
for conversation_id in conversation_ids:

response = client.send(
SaaSRequestParams(
method=HTTPMethod.GET,
Expand Down
8 changes: 6 additions & 2 deletions src/fides/api/ops/task/refine_target_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def build_refined_target_paths(

def refine_target_path(
row: Row, target_path: List[str], only: Optional[List[Any]] = None
) -> DetailedPath: # Can also return a list of DetailedPaths if there are multiple matches.
) -> (
DetailedPath
): # Can also return a list of DetailedPaths if there are multiple matches.
"""
Recursively modify the target_path to be more detailed path(s) to the referenced data. Instead of just strings,
the path will expand to include indices where applicable.
Expand Down Expand Up @@ -95,7 +97,9 @@ def refine_target_path(
try:
current_level = target_path[0]
current_elem = row[current_level]
except KeyError: # FieldPath not found in record, this is expected to happen when data doesn't exist in collection
except (
KeyError
): # FieldPath not found in record, this is expected to happen when data doesn't exist in collection
return []
except (
IndexError,
Expand Down
3 changes: 2 additions & 1 deletion src/fides/api/ops/task/task_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def __exit__(self, _type: Any, value: Any, traceback: Any) -> None:

def cache_results_with_placeholders(self, key: str, value: Any) -> None:
"""Cache raw results from node. Object will be
stored in redis under 'PLACEHOLDER_RESULTS__PRIVACY_REQUEST_ID__TYPE__COLLECTION_ADDRESS"""
stored in redis under 'PLACEHOLDER_RESULTS__PRIVACY_REQUEST_ID__TYPE__COLLECTION_ADDRESS
"""
self.cache.set_encoded_object(
f"PLACEHOLDER_RESULTS__{self.request.id}__{key}", value
)
Expand Down
3 changes: 2 additions & 1 deletion src/fides/api/ops/util/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def delete_keys_by_prefix(self, prefix: str) -> None:

def get_values(self, keys: List[str]) -> Dict[str, Optional[Any]]:
"""Retrieve all values corresponding to the set of input keys and return them as a
dictionary. Note that if a key does not exist in redis it will be returned as None"""
dictionary. Note that if a key does not exist in redis it will be returned as None
"""
values = self.mget(keys)
return {x[0]: x[1] for x in zip(keys, values)}

Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/util/connection_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def patch_connection_configs(
configs: conlist(CreateConnectionConfigurationWithSecrets, max_items=50), # type: ignore
system: Optional[System] = None,
) -> BulkPutConnectionConfiguration:

created_or_updated: List[ConnectionConfigurationResponse] = []
failed: List[BulkUpdateFailed] = []
logger.info("Starting bulk upsert for {} connection configuration(s)", len(configs))
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/ops/util/storage_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def get_s3_session(
) -> Session:
"""Abstraction to retrieve s3 session using secrets"""
if auth_method == S3AuthMethod.SECRET_KEYS.value:

if storage_secrets is None:
err_msg = "Storage secrets not found for S3 storage."
logger.warning(err_msg)
Expand Down
1 change: 0 additions & 1 deletion src/fides/core/config/notification_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class NotificationSettings(FidesSettings):
def validate_notification_service_type(cls, value: Optional[str]) -> Optional[str]:
"""Ensure the provided type is a valid value."""
if value:

valid_values = [
"mailgun",
"twilio_text",
Expand Down
4 changes: 0 additions & 4 deletions src/fides/core/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ def evaluate_dataset_reference(
"""
evaluation_violation_list = []
if dataset.data_categories:

dataset_violation_message = "Declaration ({}) of system ({}) failed rule ({}) from policy ({}) for dataset ({})".format(
privacy_declaration.name,
system.fides_key,
Expand All @@ -300,7 +299,6 @@ def evaluate_dataset_reference(
evaluation_violation_list += dataset_result_violations

for collection in dataset.collections:

collection_violation_message = "Declaration ({}) of system ({}) failed rule ({}) from policy ({}) for dataset collection ({})".format(
privacy_declaration.name,
system.fides_key,
Expand All @@ -323,7 +321,6 @@ def evaluate_dataset_reference(
evaluation_violation_list += dataset_collection_result_violations

for field in get_all_level_fields(collection.fields):

field_violation_message = "Declaration ({}) of system ({}) failed rule ({}) from policy ({}) for dataset field ({})".format(
privacy_declaration.name,
system.fides_key,
Expand Down Expand Up @@ -415,7 +412,6 @@ def execute_evaluation(taxonomy: Taxonomy) -> Evaluation:
for rule in policy.rules:
for system in taxonomy.system:
for declaration in system.privacy_declarations:

evaluation_violation_list += evaluate_privacy_declaration(
taxonomy=taxonomy,
policy=policy,
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def event_loop():

@pytest.fixture(scope="session")
def config():

CONFIG.test_mode = True
yield CONFIG

Expand Down Expand Up @@ -922,7 +921,6 @@ def approver_user(db):

@pytest.fixture(scope="function")
def system(db: Session) -> System:

system = System.create(
db=db,
data={
Expand Down
2 changes: 0 additions & 2 deletions tests/ctl/api/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_generate(
generate_target: str,
test_client: TestClient,
) -> None:

data = {
"organization_key": "default_organization",
"generate": {
Expand Down Expand Up @@ -115,7 +114,6 @@ def test_generate_failure(
generate_target: str,
test_client: TestClient,
) -> None:

data = {
"organization_key": "default_organization",
"generate": {
Expand Down
1 change: 0 additions & 1 deletion tests/ctl/api/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_generate_route_file_map(route_file_map: Dict[re.Pattern, Path]) -> None
def test_match_route(
tmp_static: Path, route_file_map: Dict[re.Pattern, Path], route: str, expected: str
) -> None:

# Test example routes.
assert match_route(route_file_map, route) == tmp_static / expected

Expand Down
Loading

0 comments on commit 4241fb0

Please sign in to comment.