Exemplo n.º 1
0
    def __init__(self,
                 start_time,
                 end_time,
                 summary,
                 creator_name=None,
                 creator_email=None,
                 location=None):
        """
        :param start_time: EventTime:
        :param end_time: EventTime:
        :param summary: unicode:
        :param creator_name: unicode:
        :param creator_email: unicode:
        :param location: unicode:
        """
        assert isinstance(start_time, EventTime)
        assert isinstance(end_time, EventTime)
        assert start_time.has_time == end_time.has_time
        assert start_time <= end_time

        CaseClass.__init__(self,
                           ('start_time', start_time),
                           ('end_time', end_time),
                           ('summary', summary),
                           ('creator_name', creator_name),
                           ('creator_email', creator_email),
                           ('location', location)
                           )
Exemplo n.º 2
0
        def __init__(self,
                     java_version,  # just use for assertion
                     heap_min=None,
                     heap_max=None,
                     perm_min=None,
                     perm_max=None,
                     metaspace_min=None,
                     metaspace_max=None,
                     new_min=None,
                     new_max=None,
                     survivor_ratio=None,
                     target_survivor_ratio=None):
            # constraints
            assert perm_min is None or java_version < 1.8, 'java.memory.perm_min is not applicable to java >= 1.8'
            assert perm_max is None or java_version < 1.8, 'java.memory.perm_max is not applicable to java >= 1.8'
            assert metaspace_min is None or java_version >= 1.8, \
                'java.memory.metaspace_min is not applicable to java < 1.8'
            assert metaspace_max is None or java_version >= 1.8, \
                'java.memory.metaspace_max is not applicable to java < 1.8'

            CaseClass.__init__(
                self,
                ('heap_min', heap_min),
                ('heap_max', heap_max),
                ('perm_min', perm_min),
                ('perm_max', perm_max),
                ('metaspace_min', metaspace_min),
                ('metaspace_max', metaspace_max),
                ('new_min', new_min),
                ('new_max', new_max),
                ('survivor_ratio', survivor_ratio),
                ('target_survivor_ratio', target_survivor_ratio)
            )
Exemplo n.º 3
0
 def __init__(self,
              config_path=None,
              extra_args=None,
              dry_run=False,
              debug=False,
              app_setting=None,
              java_setting=None,
              log_setting=None,
              os_setting=None,
              pre_commands=None,
              post_commands=None):
     """
     :param config_path:
     :param extra_args: arguments for Java application
     :param dry_run:
     :param debug: debug mode if true
     :param app_setting:
     :param java_setting:
     :param log_setting:
     :param os_setting:
     :param pre_commands:
     :param post_commands:
     :return:
     """
     CaseClass.__init__(self, ('config_path', config_path),
                        ('extra_args', oget(extra_args, [])),
                        ('dry_run', dry_run), ('debug', debug),
                        ('app_setting', app_setting),
                        ('java_setting', java_setting),
                        ('log_setting', log_setting),
                        ('os_setting', os_setting),
                        ('pre_commands', oget(pre_commands, [])),
                        ('post_commands', oget(post_commands, [])))
Exemplo n.º 4
0
    def __init__(self,
                 event_id,
                 start_time,
                 end_time,
                 summary,
                 creator_name=None,
                 creator_email=None,
                 location=None):
        """
        :param start_time: EventTime:
        :param end_time: EventTime:
        :param summary: unicode:
        :param creator_name: unicode:
        :param creator_email: unicode:
        :param location: unicode:
        """
        assert isinstance(start_time, EventTime)
        assert isinstance(end_time, EventTime)
        assert start_time.has_time == end_time.has_time
        assert start_time <= end_time

        CaseClass.__init__(self,
                           ('event_id', event_id),
                           ('start_time', start_time),
                           ('end_time', end_time),
                           ('summary', summary),
                           ('creator_name', creator_name),
                           ('creator_email', creator_email),
                           ('location', location)
                           )
Exemplo n.º 5
0
 def __init__(self, title, command_lines):
     """
     :param title:
     :param command_lines:
     :return:
     """
     CaseClass.__init__(self, ('title', title), ('command_lines', command_lines))
Exemplo n.º 6
0
 def __init__(self, has_time, datetime_tz):
     """
     :param has_time: bool: False if the all-day event
     :param datetime_tz: datetime: timezone-aware datetime
     """
     assert datetime_tz.tzinfo is not None, 'datetime_tz must be timezone-aware'
     CaseClass.__init__(self, ('has_time', has_time), ('datetime_tz', datetime_tz))
Exemplo n.º 7
0
 def __init__(self, has_time, datetime_tz):
     """
     :param has_time: bool: False if the all-day event
     :param datetime_tz: datetime: timezone-aware datetime
     """
     assert datetime_tz.tzinfo is not None, 'datetime_tz must be timezone-aware'
     CaseClass.__init__(self, ('has_time', has_time), ('datetime_tz', datetime_tz))
Exemplo n.º 8
0
        def __init__(
                self,
                java_version,  # just use for assertion
                heap_min=None,
                heap_max=None,
                perm_min=None,
                perm_max=None,
                metaspace_min=None,
                metaspace_max=None,
                new_min=None,
                new_max=None,
                survivor_ratio=None,
                target_survivor_ratio=None):
            # constraints
            assert perm_min is None or java_version < 1.8, 'java.memory.perm_min is not applicable to java >= 1.8'
            assert perm_max is None or java_version < 1.8, 'java.memory.perm_max is not applicable to java >= 1.8'
            assert metaspace_min is None or java_version >= 1.8, \
                'java.memory.metaspace_min is not applicable to java < 1.8'
            assert metaspace_max is None or java_version >= 1.8, \
                'java.memory.metaspace_max is not applicable to java < 1.8'

            CaseClass.__init__(
                self, ('heap_min', heap_min), ('heap_max', heap_max),
                ('perm_min', perm_min), ('perm_max', perm_max),
                ('metaspace_min', metaspace_min),
                ('metaspace_max', metaspace_max), ('new_min', new_min),
                ('new_max', new_max), ('survivor_ratio', survivor_ratio),
                ('target_survivor_ratio', target_survivor_ratio))
Exemplo n.º 9
0
    def __init__(self,
                 home=None,
                 version=None,
                 server=None,
                 memory=None,
                 jmx=None,
                 prop=None,
                 option=None):
        # constraints
        assert home is not None and os.path.isabs(home), 'java.home is required and must be an absolute path'
        assert version is not None, 'java.version is required'

        # TODO: check value types and format
        assert prop is None or isinstance(prop, dict), 'java.prop must be a dict'
        assert option is None or isinstance(option, list), 'java.option must be a list'

        CaseClass.__init__(
            self,
            ('home', home),
            ('version', version),
            ('server', server),
            ('memory', JavaSetting.Memory(version, **oget(memory, {}))),
            ('jmx', JavaSetting.JMX(**oget(jmx, {}))),
            ('prop', oget(prop, {})),
            ('option', oget(option, [])),
        )
Exemplo n.º 10
0
    def __init__(self,
                 home=None,
                 version=None,
                 server=None,
                 memory=None,
                 jmx=None,
                 prop=None,
                 option=None):
        # constraints
        assert home is not None and os.path.isabs(
            home), 'java.home is required and must be an absolute path'
        assert version is not None, 'java.version is required'

        # TODO: check value types and format
        assert prop is None or isinstance(prop,
                                          dict), 'java.prop must be a dict'
        assert option is None or isinstance(option,
                                            list), 'java.option must be a list'

        CaseClass.__init__(
            self,
            ('home', home),
            ('version', version),
            ('server', server),
            ('memory', JavaSetting.Memory(version, **oget(memory, {}))),
            ('jmx', JavaSetting.JMX(**oget(jmx, {}))),
            ('prop', oget(prop, {})),
            ('option', oget(option, [])),
        )
Exemplo n.º 11
0
    def __init__(self,
                 timer_sec=None,
                 say_enabled=None,
                 say_cmd=None,
                 say_countdown_sec=None,
                 say_periodic_min=None,
                 say_specific_min=None,
                 lang=None,
                 i18n=None,
                 stdin=None,
                 stdout=None,
                 stderr=None):
        lang_setting = oget(lang, self._find_lang())

        CaseClass.__init__(
            self, ('timer_sec', timer_sec), ('say_enabled', say_enabled),
            ('say_cmd', say_cmd),
            ('say_countdown_sec',
             oget(say_countdown_sec, DEFAULT_SAY_COUNTDOWN_SEC)),
            ('say_periodic_min',
             oget(say_periodic_min, DEFAULT_SAY_PERIODIC_MIN)),
            ('say_specific_min',
             oget(say_specific_min, DEFAULT_SAY_SPECIFIC_MIN)),
            ('lang', lang_setting), ('i18n', self._find_i18n(lang_setting)),
            ('stdin', oget(stdin, sys.stdin)),
            ('stdout', oget(stdout, sys.stdout)),
            ('stderr', oget(stderr, sys.stderr)))
Exemplo n.º 12
0
 def __init__(self,
              i18n=messages_en,
              stdin=sys.stdin,
              stdout=sys.stdout,
              stderr=sys.stderr):
     CaseClass.__init__(self, ('i18n', i18n), ('stdin', stdin),
                        ('stdout', stdout), ('stderr', stderr))
Exemplo n.º 13
0
 def __init__(self, home, console=None, gc=None, dump=None, error=None):
     CaseClass.__init__(
         self,
         ('console', LogSetting.Console(home, **oget(console, {}))),
         ('gc', LogSetting.GC(home, **oget(gc, {}))),
         ('dump', LogSetting.Dump(home, **oget(dump, {}))),
         ('error', LogSetting.Error(home, **oget(error, {}))),
     )
Exemplo n.º 14
0
 def __init__(self, cmd, meta, encoding='utf-8'):
     """
     :param cmd: command line string
     :param meta:
     :param encoding: encoding for command line string
     :return:
     """
     CaseClass.__init__(self, ('cmd', cmd), ('meta', meta), ('encoding', encoding))
Exemplo n.º 15
0
    def __init__(self, user=None, env=None):
        # constraints
        assert user is not None, "os.user is required"
        assert isinstance(user, six.string_types), "os.user must be a string"
        assert env is None or isinstance(env, dict), "os.env must be a dict"

        d = dict((k, str(v)) for k, v in oget(env, {}).items())
        CaseClass.__init__(self, ("user", user), ("env", d))
Exemplo n.º 16
0
    def __init__(self, user=None, env=None):
        # constraints
        assert user is not None, 'os.user is required'
        assert isinstance(user, six.string_types), 'os.user must be a string'
        assert env is None or isinstance(env, dict), 'os.env must be a dict'

        d = dict((k, str(v)) for k, v in oget(env, {}).items())
        CaseClass.__init__(self, ('user', user), ('env', d))
Exemplo n.º 17
0
 def __init__(self, home, console=None, gc=None, dump=None, error=None):
     CaseClass.__init__(
         self,
         ('console', LogSetting.Console(home, **oget(console, {}))),
         ('gc', LogSetting.GC(home, **oget(gc, {}))),
         ('dump', LogSetting.Dump(home, **oget(dump, {}))),
         ('error', LogSetting.Error(home, **oget(error, {}))),
     )
Exemplo n.º 18
0
 def __init__(self, title, command_lines):
     """
     :param title:
     :param command_lines:
     :return:
     """
     CaseClass.__init__(self, ('title', title),
                        ('command_lines', command_lines))
Exemplo n.º 19
0
 def __init__(self, work_dir=None, env=None, lock=False):
     """
     :param work_dir:
     :param env:
     :param lock:
     :return:
     """
     env = env or {}
     CaseClass.__init__(self, ('work_dir', work_dir), ('env', env), ('lock', lock))
Exemplo n.º 20
0
 def __init__(self, cmd, meta, encoding='utf-8'):
     """
     :param cmd: command line string
     :param meta:
     :param encoding: encoding for command line string
     :return:
     """
     CaseClass.__init__(self, ('cmd', cmd), ('meta', meta),
                        ('encoding', encoding))
Exemplo n.º 21
0
 def __init__(self, work_dir=None, env=None, lock=False):
     """
     :param work_dir:
     :param env:
     :param lock:
     :return:
     """
     env = env or {}
     CaseClass.__init__(self, ('work_dir', work_dir), ('env', env),
                        ('lock', lock))
Exemplo n.º 22
0
        def __init__(self, home, prefix=None, max_size=None, backup=None, preserve=None):
            # constraints
            assert backup is None or isinstance(backup, int), 'log.console.backup must be an integer'
            assert preserve is None or isinstance(backup, int), 'log.console.preserve must be an integer'

            CaseClass.__init__(
                self,
                ('prefix', omap(lambda p: normalize_path(p, home), prefix)),
                ('max_size', omap(DataSize, max_size)),
                ('backup', backup),
                ('preserve', preserve))
Exemplo n.º 23
0
    def __init__(self, size):
        if isinstance(size, int) or size.isdigit():
            value = int(size)
            scale = ''
        else:
            val, last = size[:-1], size[-1:]
            assert last.lower() in self._scales.keys(), 'Unknown scale: %s' % last
            assert val.isdigit(), 'Size must be an integer: %s' % val

            value = int(val)
            scale = last
        CaseClass.__init__(self, ('value', value), ('scale', scale))
Exemplo n.º 24
0
    def __init__(self, size):
        if isinstance(size, int) or size.isdigit():
            value = int(size)
            scale = ''
        else:
            val, last = size[:-1], size[-1:]
            assert last.lower() in self._scales.keys(
            ), 'Unknown scale: %s' % last
            assert val.isdigit(), 'Size must be an integer: %s' % val

            value = int(val)
            scale = last
        CaseClass.__init__(self, ('value', value), ('scale', scale))
Exemplo n.º 25
0
 def __init__(self,
              enabled,
              say_cmd,
              say_countdown_sec,
              say_periodic_min,
              say_specific_min,
              i18n=messages_en,
              stdin=sys.stdin,
              stdout=sys.stdout,
              stderr=sys.stderr):
     CaseClass.__init__(self, ('enabled', enabled), ('say_cmd', say_cmd),
                        ('say_countdown_sec', say_countdown_sec),
                        ('say_periodic_min', say_periodic_min),
                        ('say_specific_min', say_specific_min),
                        ('i18n', i18n), ('stdin', stdin),
                        ('stdout', stdout), ('stderr', stderr))
Exemplo n.º 26
0
        def __init__(self,
                     home,
                     prefix=None,
                     max_size=None,
                     backup=None,
                     preserve=None):
            # constraints
            assert backup is None or isinstance(
                backup, int), 'log.console.backup must be an integer'
            assert preserve is None or isinstance(
                backup, int), 'log.console.preserve must be an integer'

            CaseClass.__init__(
                self,
                ('prefix', omap(lambda p: normalize_path(p, home), prefix)),
                ('max_size', omap(DataSize, max_size)), ('backup', backup),
                ('preserve', preserve))
Exemplo n.º 27
0
 def __init__(self, term_type=None, encoding=None,
              stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,
              getch_repeat_threshold=DEFAULT_GETCH_REPEAT_THRESHOLD,
              keep_input_clean=True, getch_enabled=True):
     CaseClass.__init__(self,
                        ('term_type', term_type or self._detect_term_type()),
                        ('encoding', encoding or self._detect_encoding(stdout)),
                        ('stdin', stdin),
                        ('stdout', stdout),
                        ('stderr', stderr),
                        ('getch_repeat_threshold', getch_repeat_threshold),
                        ('keep_input_clean', keep_input_clean),
                        ('getch_enabled', getch_enabled and self._can_getch_enable(stdin))
                        )
     self.restore_terminal = self._get_restore_function()  # binary function for restoring terminal attributes
     self.last_getch_time = 0.0
     self.last_getch_char = '..'
Exemplo n.º 28
0
    def __init__(self, name=None, home=None, jar=None, entry_point=None, command=None, pid_file=None):
        # constraints
        assert name is not None, 'app.name is required'
        assert home is not None, 'app.home is required'
        assert os.path.isabs(home), 'app.home must be an absolute path'
        assert (jar is None) != (command is None), 'Either app.jar or app.command but not both must be given'
        assert jar is not None or entry_point is None, 'app.entry_point must be used with app.jar'

        normalize = lambda p: normalize_path(p, home)

        CaseClass.__init__(
            self,
            ('name', name),
            ('home', home),
            ('jar', omap(normalize, jar)),
            ('entry_point', entry_point),
            ('command', omap(normalize, command)),
            ('pid_file', omap(normalize, pid_file))
        )
Exemplo n.º 29
0
 def __init__(self,
              term_type=None,
              encoding=None,
              stdin=sys.stdin,
              stdout=sys.stdout,
              stderr=sys.stderr,
              getch_repeat_threshold=DEFAULT_GETCH_REPEAT_THRESHOLD,
              keep_input_clean=True,
              getch_enabled=True):
     CaseClass.__init__(
         self, ('term_type', term_type or self._detect_term_type()),
         ('encoding', encoding or self._detect_encoding(stdout)),
         ('stdin', stdin), ('stdout', stdout), ('stderr', stderr),
         ('getch_repeat_threshold', getch_repeat_threshold),
         ('keep_input_clean', keep_input_clean),
         ('getch_enabled', getch_enabled and self._can_getch_enable(stdin)))
     self.restore_terminal = self._get_restore_function(
     )  # binary function for restoring terminal attributes
     self.last_getch_time = 0.0
     self.last_getch_char = '..'
Exemplo n.º 30
0
    def __init__(self, config_path=None, work_dir=None, root_menu=None, encoding=None, lang=None, width=None,
                 clear_cache=False, cache_dir=EVAL_CACHE_DIR, pid_dir=COMMAND_PID_DIR,
                 stdin=None, stdout=None, stderr=None, getch_enabled=True, source_enabled=True):
        is_url = Loader.is_url(config_path)
        work_dir = omap(lambda s: to_unicode(s, encoding), self._search_work_dir(work_dir, config_path, is_url))

        CaseClass.__init__(self,
                           ('config_path', config_path),
                           ('work_dir', work_dir),
                           ('root_menu', oget(root_menu, {})),
                           ('encoding', encoding),
                           ('lang', self._find_lang(lang)),
                           ('width', width),
                           ('clear_cache', clear_cache),
                           ('cache_dir', cache_dir),
                           ('pid_dir', pid_dir),
                           ('stdin', oget(stdin, sys.stdin)),
                           ('stdout', oget(stdout, sys.stdout)),
                           ('stderr', oget(stderr, sys.stderr)),
                           ('getch_enabled', getch_enabled),
                           ('source_enabled', source_enabled)
                           )
Exemplo n.º 31
0
 def __init__(self,
              config_path=None,
              extra_args=None,
              dry_run=False,
              debug=False,
              app_setting=None,
              java_setting=None,
              log_setting=None,
              os_setting=None,
              pre_commands=None,
              post_commands=None):
     """
     :param config_path:
     :param extra_args: arguments for Java application
     :param dry_run:
     :param debug: debug mode if true
     :param app_setting:
     :param java_setting:
     :param log_setting:
     :param os_setting:
     :param pre_commands:
     :param post_commands:
     :return:
     """
     CaseClass.__init__(
         self,
         ('config_path', config_path),
         ('extra_args', oget(extra_args, [])),
         ('dry_run', dry_run),
         ('debug', debug),
         ('app_setting', app_setting),
         ('java_setting', java_setting),
         ('log_setting', log_setting),
         ('os_setting', os_setting),
         ('pre_commands', oget(pre_commands, [])),
         ('post_commands', oget(post_commands, []))
     )
Exemplo n.º 32
0
 def __init__(self, home, prefix=None):
     CaseClass.__init__(
         self,
         ('prefix', omap(lambda p: normalize_path(p, home), prefix)))
Exemplo n.º 33
0
 def __init__(self, port=None, ssl=None, authenticate=None):
     CaseClass.__init__(self, ('port', port), ('ssl', ssl),
                        ('authenticate', authenticate))
Exemplo n.º 34
0
 def __init__(self, operation=None, now=None, debug=None):
     CaseClass.__init__(self,
                        ('operation', operation),
                        ('now', now or get_localzone().localize(datetime.now())),
                        ('debug', debug)
                        )
Exemplo n.º 35
0
 def __init__(self, port=None, ssl=None, authenticate=None):
     CaseClass.__init__(self, ('port', port), ('ssl', ssl), ('authenticate', authenticate))
 def __init__(self):
     CaseClass.__init__(self, x=123, y=45)
Exemplo n.º 37
0
 def __init__(self, operation=None, now=None, debug=None):
     CaseClass.__init__(self,
                        ('operation', operation),
                        ('now', now or get_localzone().localize(datetime.now())),
                        ('debug', debug)
                        )
Exemplo n.º 38
0
 def __init__(self, home, prefix=None):
     CaseClass.__init__(self, ('prefix', omap(lambda p: normalize_path(p, home), prefix)))
Exemplo n.º 39
0
 def __init__(self, ident):
     """
     :param ident: identity for logger
     """
     CaseClass.__init__(self, ('ident', ident))
Exemplo n.º 40
0
 def __init__(self, ident):
     """
     :param ident: identity for logger
     """
     CaseClass.__init__(self, ('ident', ident))
Exemplo n.º 41
0
 def __init__(self, setting, logger, failed=False):
     CaseClass.__init__(self, ('setting', setting), ('logger', logger), ('failed', failed))
 def __init__(self, c):
     CaseClass.__init__(self, ('c', c))
Exemplo n.º 43
0
 def __init__(self, home, path=None):
     CaseClass.__init__(self, ('path', omap(lambda p: normalize_path(p, home), path)))
Exemplo n.º 44
0
 def __init__(self, home, path=None):
     CaseClass.__init__(
         self, ('path', omap(lambda p: normalize_path(p, home), path)))
Exemplo n.º 45
0
 def __init__(self):
     CaseClass.__init__(self, x=123, y=45)
Exemplo n.º 46
0
 def __init__(self, c):
     CaseClass.__init__(self, ('c', c))