Appends link to automation script to the test description.
13882
def add_automation_link(testcase):
    """"""
    automation_link = (
        '<a href="{}">Test Source</a>'.format(testcase["automation_script"])
        if testcase.get("automation_script")
        else ""
    )
    testcase["description"] = "{}<br/>{}".format(testcase.get("description") or "", automation_link)
234908
def admin_link(inst, attr_string="target=\"_blank\"", inner_html=""):
    

    # TODO: call with new window command, that adds new window icon and attr
    if inst:
        t = Template("""{% load admin_urls %}<a title="Edit '{{ inst }}'" href="{% url opts|admin_urlname:'change' inst.pk %}" {{ attr_string|safe }}>{% if inner_html %}{{ inner_html|safe }}{% else %}Edit <em>{{ inst }}</em>{% endif %}</a>""")
        return mark_safe(t.render(Context({ 'inst': inst, 'opts': inst._meta, 'attr_string': attr_string, 'inner_html': inner_html})))
    return ""
195386
def __generate(results):
        
        doc, tag, text = Doc().tagtext()

        # Counters for testsuite tag info
        count = 0
        fails = 0
        errors = 0
        skips = 0

        for result in results:
            # Loop through all results and count the ones that were not later retried.
            if result.passed() is False:
                if result.retries_left > 0:
                    # This will appear in the list again, move on
                    continue
            count += 1
            if result.passed():
                # Passed, no need to increment anything else
                continue
            elif result.skipped():
                skips += 1
            elif result.was_inconclusive():
                errors += 1
            else:
                fails += 1

        with tag('testsuite',
                 tests=str(count),
                 failures=str(fails),
                 errors=str(errors),
                 skipped=str(skips)):
            for result in results:
                if result.passed() is False and result.retries_left > 0:
                    continue
                class_name = result.get_tc_name()
                models = result.get_dut_models()
                if models:
                    class_name = class_name + "." + models
                name = result.get_toolchain()
                with tag('testcase', classname=class_name, name=name,
                         time=result.get_duration(seconds=True)):
                    if result.stdout:
                        with tag('system-out'):
                            text(result.stdout)
                    if result.passed():
                        continue
                    elif result.skipped():
                        with tag('skipped'):
                            text(result.skip_reason)
                    elif result.was_inconclusive():
                        with tag('error', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
                    else:
                        with tag('failure', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
        return indent(
            doc.getvalue(),
            indentation=' '*4
        )
279670
protected void appendDirectEditOpenerScript(StringBuffer html) {

        html.append("<script type=\"text/javascript\">\n");
        html.append("function doOnload() {\n");

        // the window's name must be the same as in:
        // system/workplace/resources/commons/explorer.js
        html.append("window.name='preview';");
        html.append("window.location.replace('");
        html.append(link(m_directEditPath));
        html.append("');");

        html.append("}\n");
        html.append("</script>\n");
    }
1081434
function injectScriptFile(url, rawText) {
  var filename = url;
  var lastSlash = url.lastIndexOf('/');
  if (lastSlash != -1) {
    filename = url.substr(lastSlash + 1);
  }

  var source = [
    '(function() {' + rawText + '})();',
    '// Web Tracing Framework injected file: ' + url,
    '//# sourceURL=x://wtf-injector/' + filename
  ].join('\n');

  // Setup script tag with the raw source.
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.text = source;

  // Add to page.
  injectScriptTag(script);
}
1164472
def tag(value):
    
    rdict = load_feedback()
    tests = rdict.setdefault("tests", {})
    tests["*auto-tag-" + str(hash(str(value)))] = str(value)
    save_feedback(rdict)
126572
public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        _doScript(req, rsp, req.getView(this, "_scriptText.jelly"), FilePath.localChannel, getACL());
    }
1310699
def _add_link(self, edge):
        
        edge_data = self.data['probnet']['edges'][edge]
        if isinstance(edge, six.string_types):
            edge = eval(edge)
        link = etree.SubElement(self.links, 'Link', attrib={'var1': edge[0], 'var2': edge[1],
                                                            'directed': edge_data['directed']})
        try:
            etree.SubElement(link, 'Comment').text = edge_data['Comment']
        except KeyError:
            pass
        try:
            etree.SubElement(link, 'Label').text = edge_data['Label']
        except KeyError:
            pass
        try:
            self._add_additional_properties(link, edge_data['AdditionalProperties'])
        except KeyError:
            etree.SubElement(link, 'AdditionalProperties')
1313089
def link_add(self, rel, href, **atts):
        
        self.link_set(rel, href, allow_duplicates=True, **atts)
1364636
def _augment_info(info):
    """"""

    info['description_header'] = "=" * len(info['description'])
    info['component_name'] = info['plugin_name'].capitalize()
    info['year'] = time.localtime().tm_year
    info['license_longtext'] = ''

    info['keyword_list'] = u""
    for keyword in info['keywords'].split(" "):
        print(keyword)
        info['keyword_list'] += u"\'" + str(keyword) + u"\', "
    print(info['keyword_list'])
    if len(info['keyword_list']) > 0:
        # strip last comma
        info['keyword_list'] = info['keyword_list'][:-2]

    return info
630395
def add_jira_status(test_key, test_status, test_comment):
    
    global attachments
    if test_key and enabled:
        if test_key in jira_tests_status:
            # Merge data with previous test status
            previous_status = jira_tests_status[test_key]
            test_status = 'Pass' if previous_status[1] == 'Pass' and test_status == 'Pass' else 'Fail'
            if previous_status[2] and test_comment:
                test_comment = '{}\n{}'.format(previous_status[2], test_comment)
            elif previous_status[2] and not test_comment:
                test_comment = previous_status[2]
            attachments += previous_status[3]
        # Add or update test status
        jira_tests_status[test_key] = (test_key, test_status, test_comment, attachments)
891243
function(scriptUrl) {
    goog.base(this, descriptor);

    /**
     * Tracking ID.
     * @type {number}
     * @private
     */
    this.workerId_ = nextWorkerId++;

    // Create the child worker.
    // If we are injecting generate a shim script and use that.
    var newScriptUrl = scriptUrl;
    if (injecting) {
      newScriptUrl = createInjectionShim(scriptUrl, this.workerId_);
    }
    var scope = workerCtorEvent(scriptUrl, this.workerId_);
    goog.global['Worker'] = originalWorker;
    var previousGlobalWorker = goog.global['Worker'];
    var handle;
    try {
      handle = new originalWorker(newScriptUrl);
    } finally {
      goog.global['Worker'] = previousGlobalWorker;
      wtf.trace.leaveScope(scope);
    }

    /**
     * Handle to the underlying worker instance.
     * @type {!Worker}
     * @private
     */
    this.handle_ = handle;

    /**
     * Event type trackers, by name.
     * @type {!Object.<Function>}
     * @private
     */
    this.trackers_ = {};

    this.setEventHook('error', function(e) {
      wtf.trace.appendScopeData('id', this.workerId_);
    }, this);
    this.setEventHook('message', function(e) {
      wtf.trace.appendScopeData('id', this.workerId_);
    }, this);

    // Always hook onmessage.
    // By doing it here we get first access to the event.
    var self = this;
    this.handle_.addEventListener('message', function(e) {
      // Sniff provider messages.
      if (!e.data['__wtf_worker_msg__']) {
        return;
      }
      e['__wtf_ignore__'] = true;

      var value = e.data['value'];
      switch (e.data['command']) {
        case 'snapshot':
          var result = pendingSnapshots[value['id']];
          delete pendingSnapshots[value['id']];
          if (!result.getError()) {
            result.setValue(value['data']);
          }
          break;
        case 'close':
          goog.array.remove(provider.childWorkers_, self);
          break;
      }
    }, false);

    provider.childWorkers_.push(this);
  }
1334793
@CallMethod(pattern = "install/version/script")
    public void addScript(@CallParam(pattern = "install/version/script") final String _code,
                          @CallParam(pattern = "install/version/script", attributeName = "type") final String _type,
                          @CallParam(pattern = "install/version/script", attributeName = "name") final String _name,
                          @CallParam(pattern = "install/version/script", attributeName = "function")
                            final String _function)
    {
        AbstractScript script = null;
        if ("rhino".equalsIgnoreCase(_type)) {
            script = new RhinoScript(_code, _name, _function);
        } else if ("groovy".equalsIgnoreCase(_type)) {
            script = new GroovyScript(_code, _name, _function);
        }
        if (script != null) {
            this.scripts.add(script);
        }
    }
403984
def addSuccess(self, test, capt):
        
        self.__insert_test_result(constants.State.PASS, test)
1132923
public synchronized final void append(Link link)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "append");

        Link prev = _dummyTail._getPreviousLink();
        link._link(prev, _dummyTail, _nextPositionToIssue++, this);
        prev._setNextLink(link);
        _dummyTail._setPreviousLink(link);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "append", _debugString());
    }
762775
def add_scripts(self):
        """"""
        common_script = self.node(self.defs, 'script', type='text/javascript')

        def get_js_dict():
            return dict(
                (k, getattr(self.graph.state, k))
                for k in dir(self.graph.config)
                if not k.startswith('_') and hasattr(self.graph.state, k)
                and not hasattr(getattr(self.graph.state, k), '__call__')
            )

        def json_default(o):
            if isinstance(o, (datetime, date)):
                return o.isoformat()
            if hasattr(o, 'to_dict'):
                return o.to_dict()
            return json.JSONEncoder().default(o)

        dct = get_js_dict()
        # Config adds
        dct['legends'] = [
            l.get('title') if isinstance(l, dict) else l
            for l in self.graph._legends + self.graph._secondary_legends
        ]

        common_js = 'window.pygal = window.pygal || {};'
        common_js += 'window.pygal.config = window.pygal.config || {};'
        if self.graph.no_prefix:
            common_js += 'window.pygal.config = '
        else:
            common_js += 'window.pygal.config[%r] = ' % self.graph.uuid

        common_script.text = common_js + json.dumps(dct, default=json_default)

        for js in self.graph.js:
            if js.startswith('file://'):
                script = self.node(self.defs, 'script', type='text/javascript')
                with io.open(js[len('file://'):], encoding='utf-8') as f:
                    script.text = f.read()
            else:
                if js.startswith('//') and self.graph.force_uri_protocol:
                    js = '%s:%s' % (self.graph.force_uri_protocol, js)
                self.node(self.defs, 'script', type='text/javascript', href=js)
865906
private static String addScriptDirectives(Element scriptElement) throws IOException, DocumentTemplateException {
    String scriptReplacement = "";

    List scriptParts = parseScriptParts(scriptElement.getValue());
    for (int index = 0; index < scriptParts.size(); index++) {
      ScriptPart scriptPart = (ScriptPart) scriptParts.get(index);
      if (scriptPart.getLocation() == null) {
        scriptReplacement = scriptPart.getText();
      }
      else {
        Element enclosingElement = findEnclosingElement(scriptElement, scriptPart.getLocation());
        if (scriptPart.isTagAttribute()) {
          String[] nameValue = scriptPart.getText().split("=", 2);
          if (nameValue.length != 2) {
            throw new DocumentTemplateException("script error: # attribute name=value not found");
          }

          String attributeNamespace = enclosingElement.getNamespaceURI();
          if (nameValue[0].contains(":")) {
            String prefix = nameValue[0].split(":")[0];
            if (!prefix.equals(enclosingElement.getNamespacePrefix())) {
              attributeNamespace = XPATH_CONTEXT.lookup(prefix);
              if (attributeNamespace == null) {
                throw new DocumentTemplateException("unsupported attribute namespace: " + prefix);
              }
            }
          }

          enclosingElement.addAttribute(new Attribute(nameValue[0], attributeNamespace, nameValue[1]));
        }
        else {
          ParentNode parent = enclosingElement.getParent();
          int parentIndex = parent.indexOf(enclosingElement);
          if (scriptPart.afterEndTag()) {
            parentIndex++;
          }
          parent.insertChild(newNode(scriptPart.getText()), parentIndex);
        }
      }
    }

    return scriptReplacement;
  }