titus.signature.Sigs

class titus.signature.Sigs(cases)[source]

Bases: titus.signature.Signature

PFA function signature for ad-hoc polymorphism (list of different signatures supported by the function).

__init__(cases)
Parameters:cases (list of titus.signature.Sig) – signatures supported by this function; the order of this list is the order in which Titus will attempt to resolve the signatures (the first one that matches is used)
accepts(args, version)

Determine if this list of signatures accepts the given arguments for a given PFA version number.

Parameters:
  • args (list of titus.datatype.AvroType) – arguments to match against each of the signature patterns
  • version (titus.signature.PFAVersion) – PFA version number in which to interpret the patterns
Return type:

(titus.signature.Sig, list of titus.datatype.AvroType, AvroType)

Returns:

(matching signature, resolved argument types, resolved return type) if one of the signatures accepts the arguments; None otherwise