builtup4/bu4/evaluation/targets/avnamedcontainer.py
2021-09-12 12:39:24 +03:00

23 lines
699 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from bu4.evaluation.av.aftervalue import AfterValue
from bu4.evaluation.constructs.evaluable import Evaluable
from bu4.evaluation.constructs.evalue import EValue
from bu4.evaluation.targets.avtarget import AVTarget
__all__ = ('AVNamedContainer',)
class AVNamedContainer(AVTarget):
def __init__(self, evaluable: Evaluable, name: bytes):
self.after_value = AfterValue(evaluable, self)
self.name = name
def given(self, value: EValue) -> Evaluable:
self.after_value.evaluable = value
self.after_value.target = self
return value
def __str__(self):
return f'[{self.name.decode()}]'