Returns a layout object of type `LayoutClass` with `args` and `kwargs` that
        wraps `fields` inside.
324153
def wrapped_object(self, LayoutClass, fields, *args, **kwargs):
        
        if args:
            if isinstance(fields, list):
                fields = tuple(fields)
            else:
                fields = (fields,)

            if LayoutClass in self.args_first:
                arguments = args + fields
            else:
                arguments = fields + args

            return LayoutClass(*arguments, **kwargs)
        else:
            if isinstance(fields, list):
                return LayoutClass(*fields, **kwargs)
            else:
                return LayoutClass(fields, **kwargs)
1077572
function layoutWidgetAdapterFor( areaHelper, widget ) {
         return layoutLoader.load( widget.layout )
            .then( ({ className, html }) => {
               const adapter = createLayoutWidgetAdapter( areaHelper, className, {
                  area: widget.area,
                  id: widget.id,
                  path: widget.layout
               } );

               return {
                  id: widget.id,
                  adapter,
                  destroy: adapter.destroy,
                  templatePromise: Promise.resolve( html )
               };
            } );
      }
991434
def with_formatter(formatter):
    
    def _decorator_after_args(unwrapped):
        def _wrapped(self, *args, **kwargs):
            logging.debug('unwrapped: %s', unwrapped)
            logging.debug('self: %s', self)
            logging.debug('args: %s', args)
            logging.debug('kwargs: %s', kwargs)
            return_value = unwrapped(self, *args, **kwargs)
            if 'raw' in kwargs and kwargs['raw']:
                return return_value
            else:
                return formatter(return_value)
        return _wrapped
    return _decorator_after_args
495724
def all(self):
        
        self._check_layout()
        return LayoutSlice(self.layout, slice(0, len(self.layout.fields), 1))
76824
def AddToLayout(self, layout):
        
        for param in self.params:
            widget = param.RenderWidget()
            layout.addRow(param.caption, widget)
1326116
private static <T, G extends T> void generateOnLayoutMethod(DexMaker dexMaker,
                                                                TypeId<G> generatedType,
                                                                TypeId<T> baseType) {
        final FieldId<G, Interceptor> interceptorField =
                generatedType.getField(INTERCEPTOR_TYPE, FIELD_NAME_INTERCEPTOR);

        final String methodName = ViewMethod.ON_LAYOUT.getName();

        final MethodId<T, Void> superMethod = baseType.getMethod(VOID_TYPE, methodName,
                TypeId.BOOLEAN, TypeId.INT, TypeId.INT, TypeId.INT, TypeId.INT);
        final MethodId<Interceptor, Void> onLayoutMethod =
                INTERCEPTOR_TYPE.getMethod(VOID_TYPE, methodName, VIEW_TYPE, TypeId.BOOLEAN,
                        TypeId.INT, TypeId.INT, TypeId.INT, TypeId.INT);

        final MethodId<G, Void> methodId = generatedType.getMethod(VOID_TYPE, methodName,
                TypeId.BOOLEAN, TypeId.INT, TypeId.INT, TypeId.INT, TypeId.INT);
        final Code code = dexMaker.declare(methodId, PUBLIC);

        final Local<G> localThis = code.getThis(generatedType);
        final Local<Interceptor> nullInterceptor = code.newLocal(INTERCEPTOR_TYPE);
        final Local<Interceptor> localInterceptor = code.newLocal(INTERCEPTOR_TYPE);
        final Local<Boolean> localChanged = code.getParameter(0, TypeId.BOOLEAN);
        final Local<Integer> localLeft = code.getParameter(1, TypeId.INT);
        final Local<Integer> localTop = code.getParameter(2, TypeId.INT);
        final Local<Integer> localRight = code.getParameter(3, TypeId.INT);
        final Local<Integer> localBottom = code.getParameter(4, TypeId.INT);

        code.iget(interceptorField, localInterceptor, localThis);
        code.loadConstant(nullInterceptor, null);

        // Interceptor is not null, call it.
        final Label interceptorNullCase = new Label();
        code.compare(Comparison.EQ, interceptorNullCase, nullInterceptor, localInterceptor);
        code.invokeVirtual(onLayoutMethod, null, localInterceptor, localThis, localChanged,
                localLeft, localTop, localRight, localBottom);
        code.returnVoid();

        // Interceptor is null, call super method.
        code.mark(interceptorNullCase);
        code.invokeSuper(superMethod, null, localThis, localChanged, localLeft, localTop,
                localRight, localBottom);
        code.returnVoid();

        final MethodId<G, Void> callsSuperMethod = generatedType.getMethod(VOID_TYPE,
                ViewMethod.ON_LAYOUT.getInvokeName(), TypeId.BOOLEAN, TypeId.INT, TypeId.INT,
                TypeId.INT, TypeId.INT);

        final Code superCode = dexMaker.declare(callsSuperMethod, PUBLIC);

        final Local<G> superThis = superCode.getThis(generatedType);
        final Local<Boolean> superLocalChanged = superCode.getParameter(0, TypeId.BOOLEAN);
        final Local<Integer> superLocalLeft = superCode.getParameter(1, TypeId.INT);
        final Local<Integer> superLocalTop = superCode.getParameter(2, TypeId.INT);
        final Local<Integer> superLocalRight = superCode.getParameter(3, TypeId.INT);
        final Local<Integer> superLocalBottom = superCode.getParameter(4, TypeId.INT);
        superCode.invokeSuper(superMethod, null, superThis, superLocalChanged, superLocalLeft,
                superLocalTop, superLocalRight, superLocalBottom);
        superCode.returnVoid();
    }
711669
private Set<String> preprocessFields(Collection<I_CmsFormField> fields) {

        Set<String> displaySet = Sets.newHashSet();
        for (I_CmsFormField field : fields) {
            boolean hasValue = !CmsStringUtil.isEmpty(field.getWidget().getApparentValue());
            if (hasValue || Boolean.TRUE.toString().equals(field.getLayoutData().get(LD_DISPLAY_VALUE))) {
                String propName = field.getLayoutData().get(LD_PROPERTY);
                displaySet.add(propName);
            }
        }
        return displaySet;
    }
531588
def create_layout_params(self, child, layout):
        
        from .android_fragment import AndroidFragment
        if isinstance(child, AndroidFragment):
            return super(AndroidViewPager, self).create_layout_params(child,
                                                                      layout)
        # Only apply to decor views
        dp = self.dp
        w, h = (coerce_size(layout.get('width', 'match_parent')),
                coerce_size(layout.get('height', 'wrap_content')))
        w = w if w < 0 else int(w * dp)
        h = h if h < 0 else int(h * dp)
        # No (w,h) constructor
        params = ViewPagerLayoutParams()
        params.width = w
        params.height = h
        params.isDecor = True
        return params
1156410
def formfield(self, **kwargs):
        

        defaults = {
            'form_class': forms.CharField,
            'required': False
        }

        defaults.update(kwargs)

        form_field = super().formfield(**defaults)
        form_field.widget = forms.HiddenInput()

        return form_field
490893
function loadLayouts (options) {
    // return cached layouts if caching enabled
    if (options.cache && GLOBAL.layouts) {
        return GLOBAL.layouts
    }
    // load layouts
    GLOBAL.layouts = loadTemplates(GLOBAL.layoutDirs, options)
    // return promise that will be resolved with layouts
    return GLOBAL.layouts
}
507606
def _wrap_field(field):
    """"""
    class WrappedField(field):
        def output(self, key, obj):
            value = _fields.get_value(key if self.attribute is None else self.attribute, obj)

            # For all fields, when its value was null (None), return null directly,
            #  instead of return its default value (eg. int type's default value was 0)
            # Because sometimes the client **needs** to know, was a field of the model empty, to decide its behavior.
            return None if value is None else self.format(value)
    return WrappedField
766371
def filter_by_widget(self, widget_type):
        
        self._check_layout_and_form()
        layout_field_names = self.layout.get_field_names()

        # Let's filter all fields with widgets like widget_type
        filtered_fields = []
        for pointer in layout_field_names:
            if isinstance(self.form.fields[pointer[1]].widget, widget_type):
                filtered_fields.append(pointer)

        return LayoutSlice(self.layout, filtered_fields)
605625
def mk_kwargs(cls, kwargs):
        
        ret = {}
        kws = ['row_factory', 'body', 'parent']
        for k in kws:
            if k in kwargs:
                ret[k] = kwargs.pop(k)

        return ret
261967
def to_set_field(cls):
    
    class SetConverter(object):

        def __init__(self, cls):
            self._cls = cls

        @property
        def cls(self):
            return resolve_class(self._cls)

        def __call__(self, values):
            values = values or set()
            args = {to_model(self.cls, value) for value in values}
            return TypedSet(cls=self.cls, args=args)

    return SetConverter(cls)
794803
def do_layout(self, *args):
        """"""
        if self.size == [1, 1]:
            return
        for i in range(0, len(self.decks)):
            self.layout_deck(i)
814853
def get_base_layout(figs):
	
	layout={}
	for fig in figs:
		if not isinstance(fig,dict):
			fig=fig.to_dict()
		for k,v in list(fig['layout'].items()):
			layout[k]=v
	return layout
690218
def get_fields_by_class(cls, field_class):
        

        ret = []

        for key, val in getattr(cls, '_fields').items():
            if isinstance(val, field_class):
                ret.append(key)
        return ret