vcorelib.target
index
/home/vkottler/src/vkottler/workspace/vcorelib/vcorelib/target/__init__.py

A module defining an interface for dynamic task targets.

 
Package Contents
       
evaluation
expression
resolver

 
Classes
       
builtins.tuple(builtins.object)
TargetMatch
vcorelib.target.evaluation.TargetInterface(abc.ABC, typing.Generic)
Target

 
class Target(vcorelib.target.evaluation.TargetInterface)
    Target(data: 'str') -> 'None'
 
An interface for string targets that may encode data substitutions or
otherwise be matched to only a single, literal string.
 
 
Method resolution order:
Target
vcorelib.target.evaluation.TargetInterface
abc.ABC
typing.Generic
builtins.object

Methods defined here:
evaluate(self, data: 'str') -> 'TargetMatch'
Attempt to match this target with some string data.

Class methods defined here:
parse(data: 'str') -> '_Optional[DynamicTargetEvaluator]' from abc.ABCMeta
Obtain a compiled target evaluator if data is a dynamic target, else
None.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__orig_bases__ = (vcorelib.target.evaluation.TargetInterface[vcorelib.target.evaluation.DynamicTargetEvaluator],)
__parameters__ = ()
valid = '[a-zA-Z0-9-_.]+'

Methods inherited from vcorelib.target.evaluation.TargetInterface:
__eq__(self, other: 'object') -> 'bool'
Check if two targets are equal.
__hash__(self) -> 'int'
Get the hash for this target.
__init__(self, data: 'str') -> 'None'
Initialize this target.
__str__(self) -> 'str'
Get this target as a string.
compile(self, substitutions: 'Substitutions' = None) -> 'str'
Attempt to get a target literal from this target and optional
substitutions.

Class methods inherited from vcorelib.target.evaluation.TargetInterface:
is_literal(data: 'str') -> 'bool' from abc.ABCMeta
Determine if a target is guaranteed to be literal or not.
segment_count(data: 'str') -> 'int' from abc.ABCMeta
Count the number of dynamic segments and validate syntax.

Data descriptors inherited from vcorelib.target.evaluation.TargetInterface:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

Data and other attributes inherited from vcorelib.target.evaluation.TargetInterface:
dynamic_end = '}'
dynamic_start = '{'

Class methods inherited from typing.Generic:
__class_getitem__(...) from abc.ABCMeta
Parameterizes a generic class.
 
At least, parameterizing a generic class is the *main* thing this
method does. For example, for some generic class `Foo`, this is called
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 
However, note that this method is also called when defining generic
classes in the first place with `class Foo[T]: ...`.
__init_subclass__(...) from abc.ABCMeta
Function to initialize subclasses.

 
class TargetMatch(builtins.tuple)
    TargetMatch(matched: ForwardRef('bool'), substitutions: ForwardRef('_Optional[Substitutions]') = None)
 
An encapsulation of results when attempting to patch a target name to a
pattern. If a target was matched and had keyword substitutions, the actual
values used will be set as match data.
 
 
Method resolution order:
TargetMatch
builtins.tuple
builtins.object

Methods defined here:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new dict which maps field names to their values.
_replace(self, /, **kwds)
Return a new TargetMatch object replacing specified fields with new values
get(self, data: 'str') -> 'str'
Get data for keys that matched the target.

Class methods defined here:
_make(iterable) from builtins.type
Make a new TargetMatch object from a sequence or iterable

Static methods defined here:
__new__(_cls, matched: ForwardRef('bool'), substitutions: ForwardRef('_Optional[Substitutions]') = None)
Create new instance of TargetMatch(matched, substitutions)

Data descriptors defined here:
matched
Alias for field number 0
substitutions
Alias for field number 1

Data and other attributes defined here:
__annotations__ = {'matched': ForwardRef('bool'), 'substitutions': ForwardRef('_Optional[Substitutions]')}
__match_args__ = ('matched', 'substitutions')
__orig_bases__ = (<function NamedTuple>,)
_field_defaults = {'substitutions': None}
_fields = ('matched', 'substitutions')

Methods inherited from builtins.tuple:
__add__(self, value, /)
Return self+value.
__contains__(self, key, /)
Return bool(key in self).
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(self, key, /)
Return self[key].
__gt__(self, value, /)
Return self>value.
__hash__(self, /)
Return hash(self).
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__mul__(self, value, /)
Return self*value.
__ne__(self, value, /)
Return self!=value.
__rmul__(self, value, /)
Return value*self.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
 
Raises ValueError if the value is not present.

Class methods inherited from builtins.tuple:
__class_getitem__(...) from builtins.type
See PEP 585

 
Data
        LITERAL_MATCH = TargetMatch(matched=True, substitutions=None)
NO_MATCH = TargetMatch(matched=False, substitutions=None)
Substitutions = typing.Dict[str, typing.Union[str, int]]
__all__ = ['Substitutions', 'TargetMatch', 'LITERAL_MATCH', 'NO_MATCH', 'Target']