ace.constraints package

An interface and runner of model consistency constraints.

class ace.constraints.Checker(db_sess)

Bases: object

A class which visits objects of the ORM and performs checks to create Issue objects.

Parameters:

db_sess – A database session to operate within.

check(src: Optional[AdmModule] = None)

Check a specific ADM for issues.

Parameters:

src – The ADM to check or None.

Returns:

A list of found Issue objects.

class ace.constraints.Issue(check_name: Optional[str] = None, adm_name: Optional[str] = None, obj: Optional[object] = None, detail: Optional[str] = None)

Bases: object

An issue resulting from a failed constraint.

adm_name: str = None

The name of the ADM containing the issue, which will be set automatically

check_name: str = None

The name of the constraint noting the issue, which will be set automatically

detail: str = None

Any specific detail about the issue

obj: object = None

The object containing the issue

ace.constraints.register(obj)

A decorator to mark a function as being ADM constraint-checking.

All constraint functions must take arguments of:
  • issuelist: a list of aggregated Issue objects

  • obj: The object being checked, starting at the AdmModule

  • db_sess: The database session being run under.

Submodules

Basic constraints enforced from the ADM definitions.

An interface and runner of model consistency constraints.

ace.constraints.core.CONSTRAINTS = {'ace.constraints.basic.minimal_metadata': <function minimal_metadata>, 'ace.constraints.basic.same_file_name': <function same_file_name>, 'ace.constraints.basic.unique_adm_names': <ace.constraints.basic.unique_adm_names object>, 'ace.constraints.basic.unique_object_names': <ace.constraints.basic.unique_object_names object>, 'ace.constraints.basic.valid_reference_ari': <ace.constraints.basic.valid_reference_ari object>, 'ace.constraints.basic.valid_type_name': <ace.constraints.basic.valid_type_name object>}

Accumulated list of all constraints to check

class ace.constraints.core.Checker(db_sess)

Bases: object

A class which visits objects of the ORM and performs checks to create Issue objects.

Parameters:

db_sess – A database session to operate within.

check(src: Optional[AdmModule] = None)

Check a specific ADM for issues.

Parameters:

src – The ADM to check or None.

Returns:

A list of found Issue objects.

class ace.constraints.core.Issue(check_name: Optional[str] = None, adm_name: Optional[str] = None, obj: Optional[object] = None, detail: Optional[str] = None)

Bases: object

An issue resulting from a failed constraint.

adm_name: str = None

The name of the ADM containing the issue, which will be set automatically

check_name: str = None

The name of the constraint noting the issue, which will be set automatically

detail: str = None

Any specific detail about the issue

obj: object = None

The object containing the issue

ace.constraints.core.register(obj)

A decorator to mark a function as being ADM constraint-checking.

All constraint functions must take arguments of:
  • issuelist: a list of aggregated Issue objects

  • obj: The object being checked, starting at the AdmModule

  • db_sess: The database session being run under.