Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/8214-bump-fastapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type: Changed
description: Bumped fastapi from 0.123.3 to 0.136.1
pr: 8214
labels: []
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies = [
"expandvars==0.9.0",
"fastapi-cli~=0.0.16",
"fastapi-pagination[sqlalchemy]==0.15.12",
"fastapi[all]==0.123.3",
"fastapi[all]==0.136.1",
"fideslang==3.1.3",
"firebase-admin==5.3.0",
"flower==2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/fides/api/models/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from typing import Any, Dict, Iterable, Optional

from loguru import logger
from pydantic.v1.utils import deep_update
from pydash.objects import get
from sqlalchemy import Boolean, CheckConstraint, Column
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.orm import Session

from fides.api.db.base_class import Base, JSONTypeOverride
from fides.api.db.encryption_utils import encrypted_type
from fides.api.util.collection_util import deep_update
from fides.config import FidesConfig


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any, Optional, Protocol

from pydantic.v1.utils import deep_update

from fides.api.models.policy import Policy
from fides.api.schemas.policy import Policy as PolicySchema
from fides.api.schemas.redis_cache import Identity
Expand All @@ -17,6 +15,7 @@
set_nested_value,
transform_value_for_evaluation,
)
from fides.api.util.collection_util import deep_update


class EvaluablePrivacyRequest(Protocol):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any, Optional, cast

from loguru import logger
from pydantic.v1.utils import deep_update
from sqlalchemy.orm import Session

from fides.api.graph.config import CollectionAddress, FieldAddress
Expand Down Expand Up @@ -29,7 +28,7 @@
extract_field_addresses,
extract_nested_field_value,
)
from fides.api.util.collection_util import Row
from fides.api.util.collection_util import Row, deep_update


def get_all_field_addresses_from_manual_task(manual_task: ManualTask) -> set[str]:
Expand Down
3 changes: 1 addition & 2 deletions src/fides/api/task/manual/manual_task_graph_task.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any, Optional

from loguru import logger
from pydantic.v1.utils import deep_update

from fides.api.common_exceptions import AwaitingAsyncTask
from fides.api.models.attachment import AttachmentType
Expand Down Expand Up @@ -32,7 +31,7 @@
get_manual_task_for_connection_config,
)
from fides.api.task.task_resources import TaskResources
from fides.api.util.collection_util import Row
from fides.api.util.collection_util import Row, deep_update
from fides.service.attachment_service import AttachmentService


Expand Down
31 changes: 25 additions & 6 deletions src/fides/api/util/collection_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@
FIDESOPS_DO_NOT_MASK_INDEX = "FIDESOPS_DO_NOT_MASK"


def deep_update(
mapping: Dict[str, Any], *updating_mappings: Dict[str, Any]
) -> Dict[str, Any]:
"""Recursively merge dicts, with later mappings taking precedence."""
updated_mapping = mapping.copy()
for updating_mapping in updating_mappings:
for k, v in updating_mapping.items():
if (
k in updated_mapping
and isinstance(updated_mapping[k], dict)
and isinstance(v, dict)
):
updated_mapping[k] = deep_update(updated_mapping[k], v)
else:
updated_mapping[k] = v
return updated_mapping


def make_immutable(obj: Any) -> Any:
"""
Recursively converts a mutable object into an immutable version.
Expand All @@ -31,8 +49,9 @@ def make_immutable(obj: Any) -> Any:
def make_mutable(obj: Any) -> Any:
"""
Recursively converts an immutable object into a mutable version.
`Map`s from the `immutables` library and dictionaries are converted to mutable dictionaries,
tuples and `OrderedSet`s are converted to lists, and other objects are returned unchanged.
`Map`s from the `immutables` library and dicts are converted to dicts,
tuples and `OrderedSet`s are converted to lists, and other objects are
returned unchanged.
"""
if isinstance(obj, (dict, immutables.Map)):
return {key: make_mutable(value) for key, value in obj.items()}
Expand Down Expand Up @@ -156,7 +175,7 @@ def unflatten_dict(flat_dict: Dict[str, Any], separator: str = ".") -> Dict[str,
target.append(None)
target[idx] = value
else:
# If the value is a dictionary, add its components to the queue for processing
# If value is a dict, add its components to the queue for processing
if isinstance(value, dict):
target = target.setdefault(keys[-1], {})
for inner_key, inner_value in value.items():
Expand All @@ -174,9 +193,9 @@ def unflatten_dict(flat_dict: Dict[str, Any], separator: str = ".") -> Dict[str,
# pylint: disable=too-many-branches
def flatten_dict(data: Any, prefix: str = "", separator: str = ".") -> Dict[str, Any]:
"""
Recursively flatten a dictionary or list into a flat dictionary with dot-notation keys.
Handles nested dictionaries and arrays with proper indices.
Preserves empty lists and dictionaries.
Recursively flatten a dict or list into a flat dict with dot-notation keys.
Handles nested dicts and arrays with proper indices.
Preserves empty lists and dicts.

example:

Expand Down
49 changes: 5 additions & 44 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading