예제 #1
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))
예제 #2
0
 def __init__(self, title, command_lines):
     """
     :param title:
     :param command_lines:
     :return:
     """
     CaseClass.__init__(self, ('title', title), ('command_lines', command_lines))
예제 #3
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)
            )
예제 #4
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, [])),
        )
예제 #5
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))
예제 #6
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)
                           )
예제 #7
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))
예제 #8
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, {}))),
     )
예제 #9
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))
예제 #10
0
파일: command.py 프로젝트: jbz601/easy-menu
 def __init__(self, title, command_lines):
     """
     :param title:
     :param command_lines:
     :return:
     """
     CaseClass.__init__(self, ('title', title),
                        ('command_lines', command_lines))
예제 #11
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))
예제 #12
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))
예제 #13
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))
예제 #14
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 = '..'
예제 #15
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))
        )
예제 #16
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)
                           )
예제 #17
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, []))
     )
예제 #18
0
 def __init__(self, home, path=None):
     CaseClass.__init__(self, ('path', omap(lambda p: normalize_path(p, home), path)))
예제 #19
0
 def __init__(self, home, prefix=None):
     CaseClass.__init__(self, ('prefix', omap(lambda p: normalize_path(p, home), prefix)))
예제 #20
0
 def __init__(self, port=None, ssl=None, authenticate=None):
     CaseClass.__init__(self, ('port', port), ('ssl', ssl),
                        ('authenticate', authenticate))
예제 #21
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)
                        )
예제 #22
0
 def __init__(self, port=None, ssl=None, authenticate=None):
     CaseClass.__init__(self, ('port', port), ('ssl', ssl), ('authenticate', authenticate))
예제 #23
0
 def __init__(self, setting, logger, failed=False):
     CaseClass.__init__(self, ('setting', setting), ('logger', logger), ('failed', failed))
예제 #24
0
 def __init__(self, ident):
     """
     :param ident: identity for logger
     """
     CaseClass.__init__(self, ('ident', ident))
 def __init__(self):
     CaseClass.__init__(self, x=123, y=45)
 def __init__(self, c):
     CaseClass.__init__(self, ('c', c))