Пример #1
0
    def __init__(self, target):
        if not target.upper() in self.get_known_targets():
            code, msg = Messages.get_unknown_target(target)
            Logger.log_message(message=msg, code=code, log_level=LoggingLevel.ERROR)
            self._target = ""
            raise InvalidTargetException()

        self._target = target
Пример #2
0
    def handle_target(cls, target):
        if target is None or target.upper() == "NONE":
            target = ""     # make sure `target` is always a string

        if target not in CodeGenerator.get_known_targets():
            code, message = Messages.get_unknown_target(target)
            Logger.log_message(None, code, message, None, LoggingLevel.ERROR)
            raise InvalidTargetException()

        cls.target = target
Пример #3
0
    def handle_target(cls, target):
        if target is None or target.upper() == 'NONE':
            target = ''  # make sure `target` is always a string

        from pynestml.codegeneration.codegenerator import CodeGenerator

        if target.upper() not in CodeGenerator.get_known_targets():
            code, message = Messages.get_unknown_target(target)
            Logger.log_message(None, code, message, None, LoggingLevel.ERROR)
            raise InvalidTargetException()

        cls.target = target
Пример #4
0
    def __init__(self, target, options: Optional[Mapping[str, Any]] = None):
        if not target.upper() in self.get_known_targets():
            code, msg = Messages.get_unknown_target(target)
            Logger.log_message(message=msg,
                               code=code,
                               log_level=LoggingLevel.ERROR)
            raise InvalidTargetException()

        self._target = target
        if "_default_options" in dir(self.__class__):
            self._options = dict(self.__class__._default_options)
        if options:
            self.set_options(options)
Пример #5
0
    def __init__(self, target, options: Optional[Mapping[str, Any]] = None):
        super(CodeGenerator, self).__init__(options)
        from pynestml.frontend.pynestml_frontend import get_known_targets

        if not target.upper() in get_known_targets():
            code, msg = Messages.get_unknown_target(target)
            Logger.log_message(message=msg,
                               code=code,
                               log_level=LoggingLevel.ERROR)
            self._target = ""
            raise InvalidTargetException()

        self._target = target
Пример #6
0
    def handle_target_platform(cls, target_platform: Optional[str]):
        if target_platform is None or target_platform.upper() == 'NONE':
            target_platform = ''  # make sure `target_platform` is always a string

        from pynestml.frontend.pynestml_frontend import get_known_targets

        if target_platform.upper() not in get_known_targets():
            code, message = Messages.get_unknown_target_platform(
                target_platform)
            Logger.log_message(None, code, message, None, LoggingLevel.ERROR)
            raise InvalidTargetException()

        cls.target_platform = target_platform