Triger any formatting rules specified with the reformat directive.
 The attributes are reformatted and mutated in place.

 Returns an instance of the form object.
553613
def reformatted!
      self.class.format_fields.each do |field_name, format_method, options|
        formatted_value = send(format_method, get_field(field_name), options)
        set_field(field_name, formatted_value)
      end
      self
    end
1028164
def input_format(&block)
      case
      when block && !@input_format_block
        @input_format_block = block
      when !block && @input_format_block
        return @input_format ||= Apipie::Params::Description.define(&@input_format_block)
      when block && @input_format_block
        raise "The input_format has already been defined in #{self.class}"
      when !block && !@input_format_block
        if superclass.respond_to? :input_format
          superclass.input_format
        else
          raise "The input_format has not been defined yet in #{self.class}"
        end
      end
    end
1037592
def generate_docstr(element, indent='', wrap=None):
    
    result = []

    txt = element.text and element.text.rstrip()
    if txt:
        result.append(_reindent(txt, indent))
        result.append(indent)

    for d in element.findall('doc') + element.findall('rule'):
        docval = ''.join(d.textlist()).rstrip()
        if not docval:
            continue
        reformat = True
        if 'name' in d.attrib:
            result.append(indent + d.attrib['name'].upper() + ':')
            result.append(indent)
            extra_indent = '    '
            if d.attrib['name'] == 'grammar':
                reformat = False # Don't want re-indenting to mess this up
        elif d.tag == 'rule':
            result.append(indent + 'RULE:')
            result.append(indent)
            extra_indent = '    '
        else:
            extra_indent = ''
        result.append(_reindent(docval, indent + extra_indent, reformat))
        result.append(indent)

    fields = element.findall('field')
    if fields:
        result.append(indent + 'PARAMETERS:')
        for f in fields:
            result.append(indent + '    ' + _fixup_field_name(f) + ': ' + _field_type(f))
            field_docs = generate_docstr(f, indent + '        ')
            if field_docs:
                result.append(indent)
                result.append(field_docs)
            result.append(indent)

    if not result:
        return None

    if wrap is not None:
        result = [wrap] + result + [wrap]

    return '\n'.join(x.rstrip() for x in result) + '\n'
779753
function selected2format()
			{
				formatFieldSwitch(true);
				
				formatbar.find("a").click(function()
				{
					$("*",this).click(function(e)
					{
						e.preventDefault();
						return false;
					});
					
					formatLabelView($(this).text());
					
					var formatValue = $(this).attr(vars.css + "-formatval"); // the type of format value
					
					// convert to selected format
					selectionSet("formatBlock",'<'+formatValue+'>');
					
					formatFieldSwitch(false);
				});
			}
484398
def form(self) -> Optional['HTMLFormElement']:
        """"""
        if self.__form:
            return self.__form
        parent = self.parentNode
        while parent:
            if isinstance(parent, HTMLFormElement):
                return parent
            else:
                parent = parent.parentNode
        return None
1024877
def _attrib_to_transform(attrib):
    

    transform = np.eye(4, dtype=np.float64)
    if 'transform' in attrib:
        # wangle their transform format
        values = np.array(
            attrib['transform'].split(),
            dtype=np.float64).reshape((4, 3)).T
        transform[:3, :4] = values
    return transform
827407
def unformat_rule(celf, rule) :
        ""
        if isinstance(rule, dict) :
            pass
        elif isinstance(rule, str) :
            PARSE = celf.PARSE
            parsed = {}
            chars = iter(rule)
            state = PARSE.EXPECT_NAME
            curname = None
            curval = None
            while True :
                ch = next(chars, None)
                if ch == None :
                    if state == PARSE.EXPECT_ESCAPED :
                        raise SyntaxError("missing character after backslash")
                    elif state == PARSE.EXPECT_QUOTED_VALUE :
                        raise SyntaxError("missing closing apostrophe")
                    else : # state in (PARSE.EXPECT_NAME, PARSE.EXPECT_UNQUOTED_VALUE)
                        if curname != None :
                            if curval != None :
                                if curname in parsed :
                                    raise SyntaxError("duplicated attribute “%s”" % curname)
                                #end if
                                parsed[curname] = curval
                            else :
                                raise SyntaxError("missing value for attribute “%s”" % curname)
                            #end if
                        #end if
                    #end if
                    break
                #end if
                if state == PARSE.EXPECT_ESCAPED :
                    if ch == "'" :
                        usech = ch
                        nextch = None
                    else :
                        usech = "\\"
                        nextch = ch
                    #end if
                    ch = usech
                    if curval == None :
                        curval = ch
                    else :
                        curval += ch
                    #end if
                    ch = nextch # None indicates already processed
                    state = PARSE.EXPECT_UNQUOTED_VALUE
                #end if
                if ch != None :
                    if ch == "," and state != PARSE.EXPECT_QUOTED_VALUE :
                        if state == PARSE.EXPECT_UNQUOTED_VALUE :
                            if curname in parsed :
                                raise SyntaxError("duplicated attribute “%s”" % curname)
                            #end if
                            if curval == None :
                                curval = ""
                            #end if
                            parsed[curname] = curval
                            curname = None
                            curval = None
                            state = PARSE.EXPECT_NAME
                        else :
                            raise SyntaxError("unexpected comma")
                        #end if
                    elif ch == "\\" and state != PARSE.EXPECT_QUOTED_VALUE :
                        if state == PARSE.EXPECT_UNQUOTED_VALUE :
                            state = PARSE.EXPECT_ESCAPED
                        else :
                            raise SyntaxError("unexpected backslash")
                        #end if
                    elif ch == "=" and state != PARSE.EXPECT_QUOTED_VALUE :
                        if curname == None :
                            raise SyntaxError("empty attribute name")
                        #end if
                        if state == PARSE.EXPECT_NAME :
                            state = PARSE.EXPECT_UNQUOTED_VALUE
                        else :
                            raise SyntaxError("unexpected equals sign")
                        #end if
                    elif ch == "'" :
                        if state == PARSE.EXPECT_UNQUOTED_VALUE :
                            state = PARSE.EXPECT_QUOTED_VALUE
                        elif state == PARSE.EXPECT_QUOTED_VALUE :
                            state = PARSE.EXPECT_UNQUOTED_VALUE
                        else :
                            raise SyntaxError("unexpected apostrophe")
                        #end if
                    else :
                        if state == PARSE.EXPECT_NAME :
                            if curname == None :
                                curname = ch
                            else :
                                curname += ch
                            #end if
                        elif state in (PARSE.EXPECT_QUOTED_VALUE, PARSE.EXPECT_UNQUOTED_VALUE) :
                            if curval == None :
                                curval = ch
                            else :
                                curval += ch
                            #end if
                        else :
                            raise AssertionError("shouldn’t occur: parse state %s" % repr(state))
                        #end if
                    #end if
                #end if
            #end while
            rule = parsed
        else :
            raise TypeError("rule “%s” must be a dict or string" % repr(rule))
        #end if
        return \
            rule
885221
def _format_attrs(self):
        
        attrs = [
            ('levels', ibase.default_pprint(self._levels,
                                            max_seq_items=False)),
            ('codes', ibase.default_pprint(self._codes,
                                           max_seq_items=False))]
        if com._any_not_none(*self.names):
            attrs.append(('names', ibase.default_pprint(self.names)))
        if self.sortorder is not None:
            attrs.append(('sortorder', ibase.default_pprint(self.sortorder)))
        return attrs
1285324
def format(self, format_spec='f'):
        
        """
        if format_spec == '' or format_spec == 'f':
            cpf = CPF.clean(self._cpf)
            return '{0}.{1}.{2}-{3}'.format(cpf[0:3], cpf[3:6], cpf[6:9], cpf[9:11])
        if format_spec == 'r':
            return self._cpf
        raise ValueError(
            "Unknown format code '{0}' for object of type '{1}'".format(format_spec, CPF.__name__))
1119249
def format(self, *args, **kwargs):
        
        return self.__class__(super(ColorStr, self).format(*args, **kwargs), keep_tags=True)
174627
def _remove_pre_formatting(self):
        
        preformatted_wrappers = [
            'pre',
            'code'
        ]

        for wrapper in preformatted_wrappers:
            for formatter in FORMATTERS:
                tag = FORMATTERS[formatter]
                character = formatter

                regex = r'(<{w}>.*)<{t}>(.*)</{t}>(.*</{w}>)'.format(
                    t=tag,
                    w=wrapper
                )
                repl = r'\g<1>{c}\g<2>{c}\g<3>'.format(c=character)
                self.cleaned_html = re.sub(regex, repl, self.cleaned_html)
528768
def process_form(self, instance, field, form, empty_marker=None,
                     emptyReturnsMarker=False):
        
        fieldName = field.getName()
        if fieldName + "_uid" in form:
            uid = form.get(fieldName + "_uid", '')
            if field.multiValued and\
                    (isinstance(uid, str) or isinstance(uid, unicode)):
                uid = uid.split(",")
        elif fieldName in form:
            uid = form.get(fieldName, '')
            if field.multiValued and\
                    (isinstance(uid, str) or isinstance(uid, unicode)):
                uid = uid.split(",")
        else:
            uid = None
        return uid, {}
310945
def change_format(self):
        """"""
        format, valid = QInputDialog.getText(self, _( 'Format'),
                                 _( "Float formatting"),
                                 QLineEdit.Normal, self.model.get_format())
        if valid:
            format = str(format)
            try:
                format % 1.1
            except:
                QMessageBox.critical(self, _("Error"),
                                     _("Format (%s) is incorrect") % format)
                return
            self.model.set_format(format)
37548
def reformat_input(self, **kwargs):
        
        reformatted_input = {}
        needed_formats = []
        for task_cls in self.tasks:
            needed_formats.append(task_cls.data_format)
        self.needed_formats = list(set(needed_formats))

        for output_format in self.needed_formats:
            reformatted_input.update(
                {
                    output_format :
                        {
                        'data' : self.reformat_file(self.input_file, self.input_format, output_format),
                        'target' : self.reformat_file(self.target_file, self.target_format, output_format)
                        }
                }
            )
        return reformatted_input
978459
def validate_format(self, **kwargs):
        
        args = dict(
            dict_type=self._dict,
            allow_no_value=self._allow_no_value,
            inline_comment_prefixes=self._inline_comment_prefixes,
            strict=self._strict,
            empty_lines_in_values=self._empty_lines_in_values
        )
        args.update(kwargs)
        parser = ConfigParser(**args)
        updated_cfg = str(self)
        parser.read_string(updated_cfg)
890064
def format(self, *args, **kwargs):
        
        return self.__class__(self.data.format(*args, **kwargs))
1266948
public String getFormatted() {
        String input = this.getUnformatted() + "   ";
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
            buf.append(input, i, i+4);
            buf.append(' ');
        }
        return buf.toString().trim();
    }