Used by crispy_forms_tags to get helper attributes
338704
def get_attributes(self, template_pack=TEMPLATE_PACK):
        
        items = {
            'form_method': self.form_method.strip(),
            'form_tag': self.form_tag,
            'form_style': self.form_style.strip(),
            'form_show_errors': self.form_show_errors,
            'help_text_inline': self.help_text_inline,
            'error_text_inline': self.error_text_inline,
            'html5_required': self.html5_required,
            'form_show_labels': self.form_show_labels,
            'disable_csrf': self.disable_csrf,
            'label_class': self.label_class,
            'field_class': self.field_class,
            'include_media': self.include_media
        }
        
        if template_pack == 'bootstrap4':
            bootstrap_size_match = re.findall('col-(xl|lg|md|sm)-(\d+)', self.label_class)
            if bootstrap_size_match:
                if template_pack == 'bootstrap4':
                    offset_pattern = 'offset-%s-%s'
                else:
                    offset_pattern = 'col-%s-offset-%s'
                items['bootstrap_checkbox_offsets'] = [offset_pattern % m for m in bootstrap_size_match]
        else:
            bootstrap_size_match = re.findall('col-(lg|md|sm|xs)-(\d+)', self.label_class)
            if bootstrap_size_match:
                if template_pack == 'bootstrap4':
                    offset_pattern = 'offset-%s-%s'
                else:
                    offset_pattern = 'col-%s-offset-%s'
                items['bootstrap_checkbox_offsets'] = [offset_pattern % m for m in bootstrap_size_match]

        items['attrs'] = {}
        if self.attrs:
            items['attrs'] = self.attrs.copy()
        if self.form_action:
            items['attrs']['action'] = self.form_action.strip()
        if self.form_id:
            items['attrs']['id'] = self.form_id.strip()
        if self.form_class:
            # uni_form TEMPLATE PACK has a uniForm class by default
            if template_pack == 'uni_form':
                items['attrs']['class'] = "uniForm %s" % self.form_class.strip()
            else:
                items['attrs']['class'] = self.form_class.strip()
        else:
            if template_pack == 'uni_form':
                items['attrs']['class'] = self.attrs.get('class', '') + " uniForm"
        if self.form_group_wrapper_class:
            items['attrs']['form_group_wrapper_class'] = self.form_group_wrapper_class

        items['flat_attrs'] = flatatt(items['attrs'])

        if self.inputs:
            items['inputs'] = self.inputs
        if self.form_error_title:
            items['form_error_title'] = self.form_error_title.strip()
        if self.formset_error_title:
            items['formset_error_title'] = self.formset_error_title.strip()

        for attribute_name, value in self.__dict__.items():
            if attribute_name not in items and attribute_name not in ['layout', 'inputs'] and not attribute_name.startswith('_'):
                items[attribute_name] = value

        return items
491358
public function getAttributesForForm(Form $form)
    {
        // Obtain Attributes (from parent):
        
        $attributes = parent::getAttributesForForm($form);
        
        // Define Group Class:
        
        $attributes['data-group-class'] = $this->config()->group_class;
        
        // Define Error Wrapper Class:
        
        $attributes['data-error-wrapper-class'] = $this->config()->error_wrapper_class;
        
        // Define Error Classes:
        
        $attributes['data-group-error-class']   = $this->config()->group_error_class;
        $attributes['data-field-error-class']   = $this->config()->field_error_class;
        
        // Define Success Classes:
        
        $attributes['data-group-success-class'] = $this->config()->group_success_class;
        $attributes['data-field-success-class'] = $this->config()->field_success_class;
        
        // Define Trigger Events:
        
        $attributes['data-parsley-trigger'] = $this->getTriggerOn();
        
        // Answer Attributes:
        
        return $this->flatten($attributes);
    }
1170751
def get_form_context(self, obj, ns=None):
        
        return {
            "url": url_for("entity_tags.edit", object_id=obj.id),
            "form": self.entity_tags_form(obj)(obj=obj, ns=ns),
            "buttons": [EDIT_BUTTON],
        }
794554
private void getAttributes(Context context, AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PinView);

        if (typedArray != null) {
            try {
                mNumberPinBoxes = typedArray
                        .getInteger(R.styleable.PinView_numberPinBoxes, PinViewSettings.DEFAULT_NUMBER_PIN_BOXES);
                mMaskPassword = typedArray
                        .getBoolean(R.styleable.PinView_password, PinViewSettings.DEFAULT_MASK_PASSWORD);
                mNumberCharacters = typedArray
                        .getInteger(R.styleable.PinView_numberCharacters, PinViewSettings.DEFAULT_NUMBER_CHARACTERS);
                mSplit = typedArray.getString(R.styleable.PinView_split);
                mKeyboardMandatory = typedArray
                        .getBoolean(R.styleable.PinView_keyboardMandatory, PinViewSettings.DEFAULT_KEYBOARD_MANDATORY);
                mDeleteOnClick = typedArray
                        .getBoolean(R.styleable.PinView_deleteOnClick, PinViewSettings.DEFAULT_DELETE_ON_CLICK);
                mNativePinBox = typedArray
                        .getBoolean(R.styleable.PinView_nativePinBox, PinViewSettings.DEFAULT_NATIVE_PIN_BOX);
                mCustomDrawablePinBox = typedArray
                        .getResourceId(R.styleable.PinView_drawablePinBox, PinViewSettings.DEFAULT_CUSTOM_PIN_BOX);
                mColorTextPinBoxes = typedArray
                        .getColor(R.styleable.PinView_colorTextPinBox,
                                getResources().getColor(PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX));
                mColorTextTitles = typedArray
                        .getColor(R.styleable.PinView_colorTextTitles,
                                getResources().getColor(PinViewSettings.DEFAULT_TEXT_COLOR_TITLES));
                mColorSplit = typedArray
                        .getColor(R.styleable.PinView_colorSplit,
                                getResources().getColor(PinViewSettings.DEFAULT_COLOR_SPLIT));
                mTextSizePinBoxes = typedArray
                        .getDimension(R.styleable.PinView_textSizePinBox,
                                getResources().getDimension(PinViewSettings.DEFAULT_TEXT_SIZE_PIN_BOX));
                mTextSizeTitles = typedArray
                        .getDimension(R.styleable.PinView_textSizeTitles,
                                getResources().getDimension(PinViewSettings.DEFAULT_TEXT_SIZE_TITLES));
                mSizeSplit = typedArray
                        .getDimension(R.styleable.PinView_sizeSplit,
                                getResources().getDimension(PinViewSettings.DEFAULT_SIZE_SPLIT));

                int titles;
                titles = typedArray.getResourceId(R.styleable.PinView_titles, -1);
                if (titles != -1) {
                    setTitles(getResources().getStringArray(titles));
                }

                if (this.mNumberPinBoxes != 0) {
                    setPin(this.mNumberPinBoxes);
                }

            } catch (Exception e) {
                Log.e(LOG_TAG, "Error while creating the view PinView: ", e);
            } finally {
                typedArray.recycle();
            }
        }
    }
1241679
def thread_helper(form_tag=True, edit_mode=False, for_moderator=False):
    
    helper = FormHelper()
    helper.form_action = '.'
    helper.attrs = {'data_abide': ''}
    helper.form_tag = form_tag
    
    fieldsets = [
        Row(
            Column(
                'subject',
                css_class='small-12'
            ),
        ),
    ]
    
    # Category field only in edit form
    if edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'category',
                    css_class='small-12'
                ),
            ),
        )
    
    if for_moderator:
        fieldsets.append(
            Row(
                Column(
                    'sticky',
                    css_class='small-12 medium-4'
                ),
                Column(
                    'announce',
                    css_class='small-12 medium-4'
                ),
                Column(
                    'closed',
                    css_class='small-12 medium-4'
                ),
            ),
        )
    
    # First message is not in edit form
    if not edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'text',
                    css_class='small-12'
                ),
            ),
        )
    
    if for_moderator:
        fieldsets.append(
            Row(
                Column(
                    'visible',
                    css_class='small-12'
                ),
            ),
        )
    
    # Threadwatch option is not in edit form
    if not edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'threadwatch',
                    css_class='small-12'
                ),
            ),
        )
    
    fieldsets = fieldsets+[
        ButtonHolderPanel(
            Submit('submit', _('Submit')),
            css_class='text-right',
        ),
    ]
    
    helper.layout = Layout(*fieldsets)
    
    return helper
1295682
function getAttributeType (name, isDirective) {
  if (isDirective) {
    if (name === 'for') {
      return 'LIST_RENDERING'
    } else if (name === 'if' || name === 'else-if' || name === 'else' || name === 'show' || name === 'cloak') {
      return 'CONDITIONALS'
    } else if (name === 'pre' || name === 'once') {
      return 'RENDER_MODIFIERS'
    } else if (name === 'model') {
      return 'TWO_WAY_BINDING'
    } else if (name === 'on') {
      return 'EVENTS'
    } else if (name === 'html' || name === 'text') {
      return 'CONTENT'
    } else {
      return 'OTHER_ATTR'
    }
  } else {
    if (name === 'is') {
      return 'DEFINITION'
    } else if (name === 'id') {
      return 'GLOBAL'
    } else if (name === 'ref' || name === 'key' || name === 'slot') {
      return 'UNIQUE'
    } else {
      return 'OTHER_ATTR'
    }
  }
}
84339
def show_edit_form(obj, attrs=None, title="", toolTips=None):
    

    if attrs is None:
        if hasattr(obj, "keys"):
            attrs = list(obj.keys())
        else:
            raise RuntimeError("attrs is None and cannot determine it from obj")

    specs = []
    for i, name in enumerate(attrs):
        # Tries as attribute, then as key
        try:
            value = obj.__getattribute__(name)
        except AttributeError:
            value = obj[name]

        if value is None:
            value = ""  # None becomes str

        dict_ = {"value": value}

        if toolTips is not None:
            dict_["toolTip"] = toolTips[i]
            dict_["tooltip"] = toolTips[i]

        specs.append((name, dict_))
    form = XParametersEditor(specs=specs, title=title)
    r = form.exec_()
    return r, form
892185
def get_attributes(element)
        attributes = {}
        element.attributes.each { |n, v| attributes[n] = v }
        attributes
      end
1047401
def get_form_kwargs(self):
        
        kwargs = {'initial': self.get_initial(),
                  'instance': self.object}

        if self.request.method in ('POST', 'PUT') and self.can_submit:
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES
            })
        return kwargs
1014863
def get_attrs(cls):
        
        ignore = dir(type('dummy', (object,), {})) + ['__metaclass__']
        attrs = [
            item for item in inspect.getmembers(cls) if item[0] not in ignore
            and not isinstance(
                item[1], (
                    types.FunctionType,
                    types.MethodType,
                    classmethod,
                    staticmethod,
                    property))]
        # sort by idx and use attribute name to break ties
        attrs.sort(key=lambda attr: (getattr(attr[1], 'idx', -1), attr[0]))
        return attrs
1222506
def post_helper(form_tag=True, edit_mode=False):
    
    helper = FormHelper()
    helper.form_action = '.'
    helper.attrs = {'data_abide': ''}
    helper.form_tag = form_tag
    
    fieldsets = [
        Row(
            Column(
                'text',
                css_class='small-12'
            ),
        ),
    ]
    
    # Threadwatch option is not in edit form
    if not edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'threadwatch',
                    css_class='small-12'
                ),
            ),
        )
    
    fieldsets = fieldsets+[
        ButtonHolderPanel(
            Submit('submit', _('Submit')),
            css_class='text-right',
        ),
    ]
    
    helper.layout = Layout(*fieldsets)
    
    return helper
475458
def js_for_has_many(class_string, &form_block)
      assoc_name       = assoc_klass.model_name
      placeholder      = "NEW_#{assoc_name.to_s.underscore.upcase.gsub(/\//, '_')}_RECORD"
      opts = {
        for: [assoc, assoc_klass.new],
        class: class_string,
        for_options: { child_index: placeholder }
      }
      html = template.capture { __getobj__.send(:inputs_for_nested_attributes, opts, &form_block) }
      text = new_record.is_a?(String) ? new_record : I18n.t('active_admin.has_many_new', model: assoc_name.human)

      template.link_to text, '#', class: "button has_many_add", data: {
        html: CGI.escapeHTML(html).html_safe, placeholder: placeholder
      }
    end
83826
def get_form_kwargs(self):
        
        kwargs = super(FormAcceptsRequestMixin, self).get_form_kwargs()
        if self.form_accepts_request:
            kwargs.update({'request': self.request})
        return kwargs
625758
def category_helper(form_tag=True):
    
    helper = FormHelper()
    helper.form_action = '.'
    helper.attrs = {'data_abide': ''}
    helper.form_tag = form_tag
    
    helper.layout = Layout(
        Row(
            Column(
                'title',
                css_class='small-12'
            ),
        ),
        Row(
            Column(
                'slug',
                css_class='small-12 medium-10'
            ),
            Column(
                'order',
                css_class='small-12 medium-2'
            ),
        ),
        Row(
            Column(
                'description',
                css_class='small-12'
            ),
        ),
        Row(
            Column(
                'visible',
                css_class='small-12'
            ),
        ),
        ButtonHolderPanel(
            Submit('submit', _('Submit')),
            css_class='text-right',
        ),
    )
    
    return helper
81597
function getAttribs(node) {
          var attribs = {};

          each(dom.getAttribs(node), function (attr) {
            var name = attr.nodeName.toLowerCase();

            // Don't compare internal attributes or style
            if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {
              attribs[name] = dom.getAttrib(node, name);
            }
          });

          return attribs;
        }
48261
def get_form_kwargs(self, **kwargs):
        '''  '''
        kwargs = super(CompensationActionView, self).get_form_kwargs(**kwargs)
        kwargs['staffmembers'] = self.queryset
        return kwargs
1247276
function( el, form ) {
			if ( typeof form == 'string' )
				el.name = form;
			// Form is an instance of CKEDITOR.style.
			else {
				var def = form.getDefinition(),
					defStyles = def.styles,
					defAttrs = def.attributes,
					attrName, styleName,
					existingClassesPattern, defClasses, cl;

				el.name = def.element;

				for ( attrName in defAttrs ) {
					if ( attrName == 'class' ) {
						existingClassesPattern = el.classes.join( '|' );
						defClasses = defAttrs[ attrName ].split( /\s+/ );

						while ( ( cl = defClasses.pop() ) ) {
							if ( existingClassesPattern.indexOf( cl ) == -1 )
								el.classes.push( cl );
						}
					} else {
						el.attributes[ attrName ] = defAttrs[ attrName ];
					}

				}

				for ( styleName in defStyles ) {
					el.styles[ styleName ] = defStyles[ styleName ];
				}
			}
		}