great_expectations.types

Package Contents

Classes

SerializableDotDict()

Analogously to the way “SerializableDictDot” extends “DictDot” to provide JSON serialization, the present class,

ClassConfig(class_name, module_name=None)

Defines information sufficient to identify a class to be (dynamically) loaded for a DataContext.

DictDot()

A convenience class for migrating away from untyped dictionaries to stronger typed objects.

SerializableDictDot()

A convenience class for migrating away from untyped dictionaries to stronger typed objects.

Functions

safe_deep_copy(data, memo=None)

This method makes a copy of a dictionary, applying deep copy to attribute values, except for non-pickleable objects.

class great_expectations.types.SerializableDotDict

Bases: great_expectations.types.base.DotDict

Analogously to the way “SerializableDictDot” extends “DictDot” to provide JSON serialization, the present class, “SerializableDotDict” extends “DotDict” to provide JSON-serializable version of the “DotDict” class as well. Since “DotDict” is already YAML-serializable, “SerializableDotDict” is both YAML-serializable and JSON-serializable.

abstract to_json_dict(self)
class great_expectations.types.ClassConfig(class_name, module_name=None)

Defines information sufficient to identify a class to be (dynamically) loaded for a DataContext.

property class_name(self)
property module_name(self)
great_expectations.types.logger
great_expectations.types.pyspark
class great_expectations.types.DictDot

A convenience class for migrating away from untyped dictionaries to stronger typed objects.

Can be instantiated with arguments:

my_A = MyClassA(

foo=”a string”, bar=1,

)

Can be instantiated from a dictionary:

my_A = MyClassA(
**{

“foo”: “a string”, “bar”: 1,

}

)

Can be accessed using both dictionary and dot notation

my_A.foo == “a string” my_A.bar == 1

my_A[“foo”] == “a string” my_A[“bar”] == 1

Pairs nicely with @dataclass:

@dataclass() class MyClassA(DictDot):

foo: str bar: int

Can be made immutable:

@dataclass(frozen=True) class MyClassA(DictDot):

foo: str bar: int

For more examples of usage, please see test_dataclass_serializable_dot_dict_pattern.py in the tests folder.

include_field_names :Set[str]
exclude_field_names :Set[str]
__getitem__(self, item)
__setitem__(self, key, value)
__delitem__(self, key)
__contains__(self, key)
__len__(self)
keys(self)
values(self)
items(self)
get(self, key, default_value=None)
to_raw_dict(self)

Convert this object into a standard dictionary, recursively.

This is often convenient for serialization, and in cases where an untyped version of the object is required.

to_dict(self)
property_names(self, include_keys: Optional[Set[str]] = None, exclude_keys: Optional[Set[str]] = None)

Assuming that – by convention – names of private properties of an object are prefixed by “_” (a single underscore character), return these property names as public property names. To support this convention, the extending classes must implement property accessors, corresponding to the property names, return by this method.

Parameters
  • include_keys – inclusion list (“include only these properties, while excluding all the rest”)

  • exclude_keys – exclusion list (“exclude only these properties, while include all the rest”)

Returns

property names, subject to inclusion/exclusion filtering

class great_expectations.types.SerializableDictDot

Bases: great_expectations.types.DictDot

A convenience class for migrating away from untyped dictionaries to stronger typed objects.

Can be instantiated with arguments:

my_A = MyClassA(

foo=”a string”, bar=1,

)

Can be instantiated from a dictionary:

my_A = MyClassA(
**{

“foo”: “a string”, “bar”: 1,

}

)

Can be accessed using both dictionary and dot notation

my_A.foo == “a string” my_A.bar == 1

my_A[“foo”] == “a string” my_A[“bar”] == 1

Pairs nicely with @dataclass:

@dataclass() class MyClassA(DictDot):

foo: str bar: int

Can be made immutable:

@dataclass(frozen=True) class MyClassA(DictDot):

foo: str bar: int

For more examples of usage, please see test_dataclass_serializable_dot_dict_pattern.py in the tests folder.

abstract to_json_dict(self)

# TODO: <Alex>2/4/2022</Alex> A reference implementation can be provided, once circular import dependencies, caused by relative locations of the “great_expectations/types/__init__.py” and “great_expectations/core/util.py” modules are resolved.

great_expectations.types.safe_deep_copy(data, memo=None)

This method makes a copy of a dictionary, applying deep copy to attribute values, except for non-pickleable objects.