def convert(self): """ Performs the actual conversion. :return: None if successful, otherwise errors message :rtype: str """ self._output = classes.to_commandline(self._input) return None
def make_copy(cls, generator): """ Creates a copy of the generator. :param generator: the generator to copy :type generator: DataGenerator :return: the copy of the generator :rtype: DataGenerator """ return from_commandline( to_commandline(generator), classname=classes.get_classname(DataGenerator()))
def to_commandline(o): """ Turns the object into a commandline string. However, first checks whether a string represents a internal value placeholder (@{...}). :param o: the object to turn into commandline :type o: object :return: the commandline :rtype: str """ if isinstance(o, str) and o.startswith("@{") and o.endswith("}"): return o else: return classes.to_commandline(o)
def from_config(self, k, v): """ Hook method that allows converting values from the dictionary :param k: the key in the dictionary :type k: str :param v: the value :type v: object :return: the potentially parsed value :rtype: object """ if k == "setup": return from_commandline(v, classname=to_commandline(datagen.DataGenerator())) return super(DataGenerator, self).from_config(k, v)
def from_config(self, k, v): """ Hook method that allows converting values from the dictionary. :param k: the key in the dictionary :type k: str :param v: the value :type v: object :return: the potentially parsed value :rtype: object """ if k == "setup": return from_commandline(v, classname=to_commandline(datagen.DataGenerator())) return super(DataGenerator, self).from_config(k, v)