blackfennec.type_system.interpretation package

Submodules

blackfennec.type_system.interpretation.coverage module

class blackfennec.type_system.interpretation.coverage.Coverage(subject_node_count, type_node_count)[source]

Bases: Comparable

Coverage calculated on a Type

Only two comparison operators are implemented(eq,lt) the rest is included via inheritance/mixin.

COVERED = Coverage(1, 1)
NOT_COVERED = Coverage(1, 0)
is_covered() bool[source]

blackfennec.type_system.interpretation.interpretation module

class blackfennec.type_system.interpretation.interpretation.Interpretation(structure: Structure, specification: Specification, types)[source]

Bases: object

Interpretation Class.

Is produced by the InterpretationService. Contains the relevant structure and can create a view. Dispatches navigation requests to navigation_service.

navigate(destination: Structure)[source]

Navigation dispatch.

Navigation request is dispatched to navigation_service. The sender is set to self.

Parameters

destination (Structure) – where to navigate to

set_navigation_service(navigation_service) None[source]

Set navigation service to be used.

Parameters

navigation_service (NavigationService) – The navigation service. Must not be None.

property specification: Specification
property structure: Structure

structure getter

Returns

the structure that is represented by this interpretation.

Return type

Structure

property types

blackfennec.type_system.interpretation.interpretation_service module

class blackfennec.type_system.interpretation.interpretation_service.InterpretationService(type_registry: TypeRegistry)[source]

Bases: object

Interpretation Service Class.

Is produced during the selection process and is the Creator of Interpretations

interpret(structure: Structure, specification: Specification) Interpretation[source]

Interpret the given structure following the a specification

Parameters
  • structure (Structure) – The structure to be interpreted

  • specification (Specification, optional) – The specification to be followed. Defaults to default constructed Specification.

Returns

Represents what black fennec believes to be

the meaning of the structure.

Return type

Interpretation

blackfennec.type_system.interpretation.offer module

class blackfennec.type_system.interpretation.offer.Offer(subject: Structure, type: Type)[source]

Bases: Comparable

Offer that is sent to Auctioneer by StructureViewBidder.

Only two comparison operators are implemented(eq,lt) the rest is included via inheritance/mixin.

_subject

Structure that is auctioned

Type

Structure

_specificity

Describes inheritance hierarchy level

Type

Int

_view_factory

View Factory for corresponding type

_type

structure that type can handle

_coverage

Describes coverage of nodes of subject

Type

Coverage

property coverage: Coverage

coverage getter

Returns

coverage property set by constructor

Return type

float

property specificity: int

specificity getter

Returns

specificity property set by constructor

Return type

int

property subject: Structure

subject getter

Returns

subject property set by constructor

Return type

Structure

property type: Type

type getter

Returns

Type property set by constructor

Return type

Structure

blackfennec.type_system.interpretation.specification module

class blackfennec.type_system.interpretation.specification.Specification(request_preview: bool = False)[source]

Bases: object

Specification, specifies which interpretation is desired.

This allows the manipulation of the interpreter such that the result

better suites the envisioned use case of the interpretation. For example, the callee of the interpretation service can request previews.

property is_request_for_preview: bool

Property to query if this specification requests a preview.

Returns

true iff a preview has been requested.

Return type

bool

Module contents