10.7.5. Utilities for all Adapters

pytan3.adapters.check_adapter_types(adapter)[source]

Check Adapter.get_type() against api_client and objects type.

Parameters:adapter (Adapter) – Adapter to perform type checking on.
Raises:exceptions.TypeMismatchError – If Adapter.get_type() is not equal to pytan3.api_objects.ApiObjects.module_type or pytan3.api_clients.ApiClient.get_type().
pytan3.adapters.check_adapter_version(adapter)[source]

Check Adapter.get_version_req() against api_client and objects version.

Parameters:adapter (Adapter) – Adapter to perform version checking on.
Raises:pytan3.utils.exceptions.VersionMismatchError – If the version requirements from Adapter.get_version_req() fail to match pytan3.api_clients.ApiClient.version or pytan3.api_objects.ApiObjects.module_version.
pytan3.adapters.check_object_attrs(obj, attrs)[source]

Check if any attributes of an obj are set.

Parameters:
Raises:

exceptions.EmptyAttributeError – If none of the attributes in attrs on obj are not set to None.

pytan3.adapters.check_object_type(obj, types)[source]

Check if an obj is an instance of types.

Parameters:
  • obj (object) – Object to check against types.
  • types (tuple of type) – Types to check against obj.
Raises:

exceptions.InvalidTypeError – If type of obj is not on of types.