Store summary if none was given
        and created formatted version of body text.
519588
def save(self, *args, **kwargs):
        
        if not self.summary:
            self.summary = truncatewords(self.body, 50)
        self.body_formatted = sanetize_text(self.body)
        super(Article, self).save()
881444
def _update_summary(self, system):
        
        self.basic.update({
            'nbus': system.Bus.n,
            'ngen': system.PV.n + system.SW.n,
            'ngen_on': sum(system.PV.u) + sum(system.SW.u),
            'nload': system.PQ.n,
            'nshunt': system.Shunt.n,
            'nline': system.Line.n,
            'ntransf': system.Line.trasf.count(True),
            'narea': system.Area.n,
        })
787281
def summary(self):
        """"""
        if self._summary is None:
            self._summary = "No summary for element."
            for doc in self.docstring:
                if doc.doctype == "summary":
                    self._summary = doc.contents
                    break

            #If a parameter, member or local tag has dimensions or other children,
            #then the inner-text is not the right thing to use; find a grand-child
            #summary tag instead.
            if self._summary == "No summary for element." and len(self.docstring) > 0:
                summary = self.doc_children("summary")
                if len(summary) > 0:
                    self._summary = summary[0].contents
                else:
                    self._summary = self.docstring[0].contents

        return self._summary
1007948
def _store_information(self):
        
        
        print '<<< Generating Information Storage >>>'

        # Stores information on Workbench commands and signatures
        for name, meth in inspect.getmembers(self, predicate=inspect.isroutine):
            if not name.startswith('_'):
                info = {'command': name, 'sig': str(funcsigs.signature(meth)), 'docstring': meth.__doc__}
                self.store_info(info, name, type_tag='command')

        # Stores help text into the workbench information system
        self.store_info({'help': '<<< Workbench Server Version %s >>>' % self.version}, 'version', type_tag='help')
        self.store_info({'help': self._help_workbench()}, 'workbench', type_tag='help')
        self.store_info({'help': self._help_basic()}, 'basic', type_tag='help')
        self.store_info({'help': self._help_commands()}, 'commands', type_tag='help')
        self.store_info({'help': self._help_workers()}, 'workers', type_tag='help')
1119620
def if_body_action(self, text, loc, arg):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("IF_BODY:",arg)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        #generate conditional jump (based on last compare)
        label = self.codegen.label("false{0}".format(self.false_label_number), True, False)
        self.codegen.jump(self.relexp_code, True, label)
        #generate 'true' label (executes if condition is satisfied)
        self.codegen.newline_label("true{0}".format(self.label_number), True, True)
        #save label numbers (needed for nested if/while statements)
        self.label_stack.append(self.false_label_number)
        self.label_stack.append(self.label_number)
566727
def store(label, stats = {}, date = nil, opts = {}, meta = {})
      Event.new(self.name, label, date, stats, options.merge(opts), meta).save
    end
227611
def body(self, data):
        """"""
        if data is not None:
            self._body = data
            self.add_header('Content-Length', str(len(self._body)))
48148
def cli_info(data, title='Info'):
    '''
    
    '''

    wrapper = textwrap.TextWrapper()
    wrapper.initial_indent = ' ' * 4
    wrapper.subsequent_indent = wrapper.initial_indent

    return '{title}:\n\n{text}'.format(title=title, text=wrapper.fill(data))
64958
def save(self, *args):
        """"""
        if self.name_wid is None or self.store is None:
            Logger.debug("{}: Not saving, missing name_wid or store".format(type(self).__name__))
            return
        if not (self.name_wid.text or self.name_wid.hint_text):
            Logger.debug("{}: Not saving, no name".format(type(self).__name__))
            return
        if self.name_wid.text and self.name_wid.text[0] in string.digits + string.whitespace + string.punctuation:
            # TODO alert the user to invalid name
            Logger.warning("{}: Not saving, invalid name".format(type(self).__name__))
            return
        if hasattr(self, '_do_parse'):
            try:
                parse(self.source)
            except SyntaxError:
                # TODO alert user to invalid source
                Logger.debug("{}: Not saving, couldn't parse".format(type(self).__name__))
                return
        do_redata = False
        if self.name_wid.text:
            if (
                self.name_wid.hint_text and
                self.name_wid.hint_text != self.name_wid.text and
                hasattr(self.store, self.name_wid.hint_text)
            ):
                delattr(self.store, self.name_wid.hint_text)
                do_redata = True
            if (
                not hasattr(self.store, self.name_wid.text) or
                getattr(self.store, self.name_wid.text) != self.source
            ):
                Logger.debug("{}: Saving!".format(type(self).__name__))
                setattr(self.store, self.name_wid.text, self.source)
                do_redata = True
        elif self.name_wid.hint_text:
            if (
                not hasattr(self.store, self.name_wid.hint_text) or
                getattr(self.store, self.name_wid.hint_text) != self.source
            ):
                Logger.debug("{}: Saving!".format(type(self).__name__))
                setattr(self.store, self.name_wid.hint_text, self.source)
                do_redata = True
        return do_redata
786304
function formErrorText (info, msg) {
  const hr = '----------'

  return addPlatformInformation(info)
  .then((obj) => {
    const formatted = []

    function add (msg) {
      formatted.push(
        stripIndents(msg)
      )
    }

    add(`
      ${obj.description}

      ${obj.solution}

    `)

    if (msg) {
      add(`
        ${hr}

        ${msg}

      `)
    }

    add(`
      ${hr}

      ${obj.platform}
    `)

    if (obj.footer) {
      add(`

        ${hr}

        ${obj.footer}
      `)
    }

    return formatted.join('\n\n')
  })
}
51900
def _create_doc_summary(self, obj, fullname, refrole):
        
        summary_text = extract_docstring_summary(get_docstring(obj))
        summary_text = summary_text.strip()
        # Strip the last "." because the linked ellipses take its place
        if summary_text.endswith('.'):
            summary_text = summary_text.rstrip('.')
        content_node_p = nodes.paragraph(text=summary_text)
        content_node_p += self._create_api_details_link(fullname, refrole)
        return content_node_p
941234
def store_attribute(self, key, value):
        """"""
        if key == 'summary' or key == 'filename' or key == 'previous':
            return
        attr = key.replace('-', '_')
        if key.endswith('-time'):
            value = int(value)
        setattr(self, attr, value)
766552
def generateSummary(self, extraLapse = TYPICAL_LAPSE):
		''' 
		'''
		scriptsRun = self.scriptsRun
		
		body = []
		
		numberOfFailed = 0
		numberWithWarnings = 0
		failedList = []
		successList = []
		warningsList = []
		
		for name, details in sorted(scriptsRun.iteritems()):
			status = None
			daysSinceSuccess = None
			
			if details["lastSuccess"] and expectedScripts.get(name):
				daysSinceSuccess = expectedScripts.get(name).getDaysSinceLastSuccess(details["lastSuccess"])
				if not expectedScripts.check(name, details["lastSuccess"], extraLapse): 
					status = "FAILED"
			else:
				status = "FAILED"
			
			if not status:
				if details["status"] & RETROSPECT_FAIL:
					status = "FAILED"
				elif details["status"] & RETROSPECT_WARNING:
					status = "WARNINGS"
				elif status != "FAILED":
					status = "OK"
			
			if details["lastSuccess"] and daysSinceSuccess:
				lastSuccessDetails = "Last successful run on %s (%0.1f days ago)" % (details["lastSuccess"], daysSinceSuccess)
			else:
				lastSuccessDetails = "No recent successful run."
			
			if details["lastRun"]:
				lastRunDetails = "Last run on %s (%s)" % (details["lastRun"], status)
			else:
				lastRunDetails = "No recent run (%s)" % status
				 
			if status == "FAILED":
				numberOfFailed += 1
				failedList.append("%s: %s. %s" % (name, lastRunDetails, lastSuccessDetails))
			elif status == "WARNINGS":
				numberWithWarnings += 1
				warningsList.append("%s: %s. %s" % (name, lastRunDetails, lastSuccessDetails))
			else:
				successList.append("%s: %s. %s" % (name, lastRunDetails, lastSuccessDetails))
		
		body = []
		if failedList:
			body.append("FAILED JOBS (%d)" % numberOfFailed)
			body.append("****************")
			for j in failedList:
				body.append(j)
			body.append("\n")
		if warningsList:
			body.append("JOBS WITH WARNINGS (%d)" % numberWithWarnings)
			body.append("***********************")
			for j in warningsList:
				body.append(j)
			body.append("\n")
		if successList:
			body.append("SUCCESSFUL JOBS")
			body.append("***************")
			for j in successList:
				body.append(j)
		
		return body, failedList
1088611
def write_summary(duration, total, failures, pending)
      _write do |f|
        f.puts _message(total, failures, pending, duration)
        f.puts _failed_paths.join("\n") if failures > 0
      end
    end
598788
def save(self, *args, **kwargs):
        
        self.body_formatted = sanetize_text(self.body)
        super(Contact, self).save()
1277394
def _get_summary(self, text, **kwargs):
        

        card = cards.extract_card(text, kwargs, self.search_path)
        return flask.Markup((card.description or '').strip())
8239
def text_changed(self):
        """"""
        # Save text as bytes, if it was initially bytes
        if self.is_binary:
            self.text = to_binary_string(self.edit.toPlainText(), 'utf8')
        else:
            self.text = to_text_string(self.edit.toPlainText())
        if self.btn_save_and_close:
            self.btn_save_and_close.setEnabled(True)
            self.btn_save_and_close.setAutoDefault(True)
            self.btn_save_and_close.setDefault(True)