Пример #1
0
	function=Spec().re(function_name_re).func(check_segment_function).optional(),
	exclude_modes=Spec().list(vim_mode_spec()).optional(),
	include_modes=Spec().list(vim_mode_spec()).optional(),
	exclude_function=exinclude_spec().optional(),
	include_function=exinclude_spec().optional(),
	draw_hard_divider=Spec().type(bool).optional(),
	draw_soft_divider=Spec().type(bool).optional(),
	draw_inner_divider=Spec().type(bool).optional(),
	display=Spec().type(bool).optional(),
	module=segment_module_spec(),
	priority=Spec().type(int, float, type(None)).optional(),
	after=Spec().printable().optional(),
	before=Spec().printable().optional(),
	width=Spec().either(Spec().unsigned(), Spec().cmp('eq', 'auto')).optional(),
	align=Spec().oneof(set('lr')).optional(),
	args=args_spec().func(lambda *args, **kwargs: check_args(get_one_segment_function, *args, **kwargs)),
	contents=Spec().printable().optional(),
	highlight_groups=Spec().list(
		highlight_group_spec().re(
			'^(?:(?!:divider$).)+$',
			(lambda value: 'it is recommended that only divider highlight group names end with ":divider"')
		)
	).func(check_highlight_groups).optional(),
	divider_highlight_group=highlight_group_spec().func(check_highlight_group).re(
		':divider$',
		(lambda value: 'it is recommended that divider highlight group names end with ":divider"')
	).optional(),
).func(check_full_segment_data).copy
subsegment_spec = segment_spec_base().update(
	type=Spec().oneof(set((key for key in type_keys if key != 'segment_list'))).optional(),
)
Пример #2
0
        mode_translations_value_spec(),
    ).optional().context_message(
        'Error while loading mode translations (key {key})'),
).context_message('Error while loading vim colorscheme'))

args_spec = Spec(
    pl=Spec().error('pl object must be set by powerline').optional(),
    segment_info=Spec().error(
        'Segment info dictionary must be set by powerline').optional(),
).unknown_spec(Spec(), Spec()).optional().copy
segment_module_spec = Spec().type(unicode).func(
    check_segment_module).optional().copy
exinclude_spec = Spec().either(
    Spec(function=Spec().re(function_name_re).func(check_segment_function),
         args=Spec().unknown_spec(
             Spec(), Spec()).func(lambda *args, **kwargs: check_args(
                 get_one_segment_function, *args, **kwargs))).func(
                     lambda *args, **kwargs: (True, True, False)),
    Spec().re(function_name_re).func(check_exinclude_function)).copy
segment_spec_base = Spec(
    name=Spec().re('^[a-zA-Z_]\w*$').optional(),
    function=Spec().re(function_name_re).func(
        check_segment_function).optional(),
    exclude_modes=Spec().optional(),
    include_modes=Spec().optional(),
    exclude_function=exinclude_spec().optional(),
    include_function=exinclude_spec().optional(),
    draw_hard_divider=Spec().type(bool).optional(),
    draw_soft_divider=Spec().type(bool).optional(),
    draw_inner_divider=Spec().type(bool).optional(),
    display=Spec().type(bool).optional(),
    module=segment_module_spec(),