Skip to content

Commit

Permalink
fix: mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLaPiana committed Sep 16, 2023
1 parent 761b9fc commit 4255114
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/backend_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
[
"isort",
"black",
"mypy",
"pylint",
"xenon",
"check_install",
Expand Down
1 change: 1 addition & 0 deletions noxfiles/docker_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Callable, Dict, List, Optional, Tuple

import nox

from constants_nox import (
DEV_TAG_SUFFIX,
IMAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from sqlalchemy.engine import Connection, ResultProxy
from sqlalchemy.sql.elements import TextClause


# revision identifiers, used by Alembic.
from fides.api.models.sql_models import DataUse

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ def _filter_experiences_by_region_or_country(
if not region:
return experience_query

region: str = escape(region).replace("-", "_").lower()
country: str = region.split("_")[0]
formatted_region: str = escape(region).replace("-", "_").lower()
country: str = formatted_region.split("_")[0]

overlay: Optional[
PrivacyExperience
] = PrivacyExperience.get_experience_by_region_and_component(
db, region, ComponentType.overlay
db, formatted_region, ComponentType.overlay
) or PrivacyExperience.get_experience_by_region_and_component(
db, country, ComponentType.overlay
)
privacy_center: Optional[
PrivacyExperience
] = PrivacyExperience.get_experience_by_region_and_component(
db, region, ComponentType.privacy_center
db, formatted_region, ComponentType.privacy_center
) or PrivacyExperience.get_experience_by_region_and_component(
db, country, ComponentType.privacy_center
)
Expand Down
10 changes: 8 additions & 2 deletions src/fides/core/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,13 @@ def evaluate_dataset_reference(
dataset.fides_key,
)

data_qualifier = str(dataset.data_qualifier) if dataset.data_qualifier else ""
dataset_result_violations = evaluate_policy_rule(
taxonomy=taxonomy,
policy_rule=policy_rule,
data_subjects=[str(x) for x in privacy_declaration.data_subjects],
data_categories=[str(x) for x in dataset.data_categories],
data_qualifier=dataset.data_qualifier,
data_qualifier=data_qualifier,
data_use=privacy_declaration.data_use,
declaration_violation_message=dataset_violation_message,
)
Expand Down Expand Up @@ -371,12 +372,17 @@ def evaluate_privacy_declaration(
)
)

data_qualifier = (
str(privacy_declaration.data_qualifier)
if privacy_declaration.data_qualifier
else ""
)
declaration_result_violations = evaluate_policy_rule(
taxonomy=taxonomy,
policy_rule=policy_rule,
data_subjects=[str(x) for x in privacy_declaration.data_subjects],
data_categories=[str(x) for x in privacy_declaration.data_categories],
data_qualifier=privacy_declaration.data_qualifier,
data_qualifier=data_qualifier,
data_use=privacy_declaration.data_use,
declaration_violation_message=declaration_violation_message,
)
Expand Down

0 comments on commit 4255114

Please sign in to comment.