gfw.common.dictionaries#

Utility functions for dictionary and mapping operations.

This module provides general-purpose helpers for working with dictionaries and other mapping types, such as filtering entries or transforming data.

Functions

copy_dict_without

Returns a shallow copy of the given dictionary excluding specified keys.

filter_none_values

Return a new dictionary excluding keys with None values.

filter_none_values(mapping)[source]#

Return a new dictionary excluding keys with None values.

Parameters:

mapping (Mapping[K, V]) – Input mapping.

Returns:

A new dictionary with all keys having non-None values.

Return type:

Dict[K, V]

copy_dict_without(dictionary, keys)[source]#

Returns a shallow copy of the given dictionary excluding specified keys.

Parameters:
  • dictionary (Mapping[K, V]) – The source dictionary to copy.

  • keys (list[Any]) – A list of keys to remove from the resulting dictionary.

Returns:

A new dictionary with the specified keys removed.

Return type:

Dict[Any, Any]