geodesic.utils#

geodesic.utils.memcache module#

class geodesic.utils.memcache.Cache(max_cache_size_bytes=4000000000.0)[source]#

Bases: object

A basic cache to store results of large computations.

Rather than using count, this uses a configurable memory size.

clear()[source]#
pop(key)[source]#
remove_least_used()[source]#

Module contents#

geodesic.utils.deprecated(version=None, dep_func=None)[source]#

Provides a deprecated message on a function for a specified version.

If version is left as None, it will be left unspecified when it will be deprecated

Example

old_function = deprecated(“v1.0.0”)(new_function)

geodesic.utils.is_offset_aware(t)[source]#

Returns True if input is offset aware, False otherwise.

geodesic.utils.datetime_to_utc(d)[source]#

Ensures input is localized UTC.

geodesic.utils.hamming_distance(a, b)[source]#

Utility to check the hamming distance between two strings.

Used for very simple typo recognition.

class geodesic.utils.MockImport(module_name)[source]#

Bases: object

Use a MockImport when something requires a particular module.

On import error, set the module instance to this class initialized with the import module name. This will raise a readable exception when used instead of a more challenging error.

class geodesic.utils.DeferredImport(module_name, attr=None)[source]#

Bases: object