Safely create a symbolic link to an input field.
1762
def make_symlink(src_path, lnk_path):
    """"""

    # Check for Lustre 60-character symbolic link path bug
    if CHECK_LUSTRE_PATH_LEN:
        src_path = patch_lustre_path(src_path)
        lnk_path = patch_lustre_path(lnk_path)

    # os.symlink will happily make a symlink to a non-existent
    # file, but we don't want that behaviour
    # XXX: Do we want to be doing this?
    if not os.path.exists(src_path):
        return

    try:
        os.symlink(src_path, lnk_path)
    except EnvironmentError as exc:
        if exc.errno != errno.EEXIST:
            raise
        elif not os.path.islink(lnk_path):
            # Warn the user, but do not interrupt the job
            print("Warning: Cannot create symbolic link to {p}; a file named "
                  "{f} already exists.".format(p=src_path, f=lnk_path))
        else:
            # Overwrite any existing symbolic link
            if os.path.realpath(lnk_path) != src_path:
                os.remove(lnk_path)
                os.symlink(src_path, lnk_path)
23050
def symlink(src, path):
    '''
    
    '''
    path = os.path.expanduser(path)

    try:
        if os.path.normpath(os.readlink(path)) == os.path.normpath(src):
            log.debug('link already in correct state: %s -> %s', path, src)
            return True
    except OSError:
        pass

    if not os.path.isabs(path):
        raise SaltInvocationError('File path must be absolute.')

    try:
        os.symlink(src, path)
        return True
    except (OSError, IOError):
        raise CommandExecutionError('Could not create \'{0}\''.format(path))
    return False
811716
def _expect_inline_link(text, start):
    """"""
    if start >= len(text) or text[start] != '(':
        return None
    i = start + 1
    m = patterns.whitespace.match(text, i)
    if m:
        i = m.end()
    m = patterns.link_dest_1.match(text, i)
    if m:
        link_dest = m.start(), m.end(), m.group()
        i = m.end()
    else:
        open_num = 0
        escaped = False
        prev = i
        while i < len(text):
            c = text[i]
            if escaped:
                escaped = False
            elif c == '\\':
                escaped = True
            elif c == '(':
                open_num += 1
            elif c in string.whitespace:
                break
            elif c == ')':
                if open_num > 0:
                    open_num -= 1
                else:
                    break
            i += 1
        if open_num != 0:
            return None
        link_dest = prev, i, text[prev:i]
    link_title = i, i, None
    tail_re = re.compile(r'(?:\s+%s)?\s*\)' % patterns.link_title, flags=re.UNICODE)
    m = tail_re.match(text, i)
    if not m:
        return None
    if m.group('title'):
        link_title = m.start('title'), m.end('title'), m.group('title')
    return (link_dest, link_title, m.end())
823218
def link(self, rel):
        """"""
        for link in self.ln:
            if ('rel' in link and
                    link['rel'] == rel):
                return(link)
        return(None)
1128248
def raw_input_replacement(self, prompt=''):
        """"""
        self.widget_proxy.wait_input(prompt)
        self.input_condition.acquire()
        while not self.widget_proxy.data_available():
            self.input_condition.wait()
        inp = self.widget_proxy.input_data
        self.input_condition.release()
        return inp
1041472
function linkForInput() {
                var valTemplate = config.zValidateTemplate;
                var requiredTemplate = config.zRequiredTemplate || '';
                var decorator = angular.element('<span class="z-decorator"></span>');
                if (attrs.zAppendTo){
                    angular.element(document.querySelector(attrs.zAppendTo)).append(decorator);
                } else {
                    element.after(decorator);
                }

                // unwrap bound elements
                decorator = decorator[0];
                scope.$watch(info.getValErrs, valErrsChanged);

                // update the message in the validation template
                // when a validation error changes on an input control
                // newValue is either a string or null (null when no bound entity)
                function valErrsChanged(newValue) {

                    // HTML5 custom validity
                    // http://dev.w3.org/html5/spec-preview/constraints.html#the-constraint-validation-api
                    if (domEl.setCustomValidity) {
                        /* only works in HTML 5. Maybe should throw if not available. */
                        domEl.setCustomValidity(newValue || '');
                    }

                    var errorHtml = newValue ? valTemplate.replace(/%error%/, newValue) : "";
                    var isRequired = info.getIsRequired();
                    var requiredHtml = isRequired ? requiredTemplate : '';
                    decorator.innerHTML = (isRequired || !!errorHtml) ? requiredHtml + errorHtml : "";
                }
            }
116830
def gen_input_view(sig_dic):
    '''
    
    '''
    if sig_dic['en'] == 'tag_file_download':
        html_str = HTML_TPL_DICT['input_view_download'].format(
            sig_zh=sig_dic['zh'],
            sig_unit=sig_dic['dic'][1]
        )
    elif sig_dic['en'] in ['tag_access_link', 'tag_dmoz_url',
                           'tag_online_link', 'tag_event_url',
                           'tag_expert_home', 'tag_pic_url']:
        html_str = HTML_TPL_DICT['input_view_link'].format(
            sig_dic['en'],
            sig_dic['zh'],
            sig_dic['dic'][1]
        )

    else:
        html_str = HTML_TPL_DICT['input_view'].format(
            sig_dic['en'],
            sig_dic['zh'],
            sig_dic['dic'][1]
        )
    return html_str
251504
function create_hint(value, match, type, title, description, link) {
        var $hint = $(document.createElement('span'));
        $hint.addClass('brackets-js-hints brackets-js-hints-with-type-details');
        $hint.attr('title', title);
        if (match) {
            value = value.replace(match, '');
            $hint.append($(document.createElement('span')).text(match).addClass('matched-hint'));
            $hint.append($(document.createElement('span')).text(value).addClass('require-hint-value'));
        }
        else {
            $hint.append($(document.createElement('span')).text(value).addClass('require-hint-value'));
        }
        if (link) {
            $hint.append($(document.createElement('a')).addClass('jshint-link').attr('href', link));
        }
        $hint.append($(document.createElement('span')).text(type).addClass('brackets-js-hints-type-details'));
        $hint.append($(document.createElement('span')).text(type).addClass('jshint-description'));
        if (description) {
            $hint.append($(document.createElement('span')).text(description).addClass('jshint-jsdoc'));
        }

        return $hint;
    }
1088236
function() {
      
      // This element wraps the input node in a float: none div
      this.wrapEl = inputEx.cn('div', {className: 'inputEx-StringField-wrapper'});
      
      // Attributes of the input field
      var attributes = {};
      attributes.id = this.divEl.id?this.divEl.id+'-field':YAHOO.util.Dom.generateId();
      attributes.rows = this.options.rows;
      attributes.cols = this.options.cols;
      if(this.options.name) attributes.name = this.options.name;
      if(this.options.readonly) attributes.readonly = 'readonly';
      
      //if(this.options.maxLength) attributes.maxLength = this.options.maxLength;
   
      // Create the node
      this.el = inputEx.cn('textarea', attributes, null, this.options.value);
      
      // Append it to the main element
      this.wrapEl.appendChild(this.el);
      this.fieldContainer.appendChild(this.wrapEl);
   }
709063
function createRootSymLink() {
    var li1 = process.argv[1].lastIndexOf('\\'), li2 = process.argv[1].lastIndexOf('/');
    if (li2 > li1) { li1 = li2; }
    var AppPath = process.argv[1].substring(0,li1);
    var p1 = resolve(AppPath + "/" + nativescriptAppPath);
    var p2 = resolve(AppPath + "/" + webAppPath);
    if (debugging) {
        console.log("Path: ", p1, p2);
    }
    fs.symlinkSync(p2, p1, 'junction');
}
1320890
def href(*args, **kw):
    
    result = [(request.script_root if request else "") + "/"]
    for idx, arg in enumerate(args):
        result.append(("/" if idx else "") + url_quote(arg))
    if kw:
        result.append("?" + url_encode(kw))
    return "".join(result)
96786
def input_format(self, content_type):
        """"""
        return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None))
715623
def safe_url(url):
    """"""
    parsed = urlparse(url)
    if parsed.password is not None:
        pwd = ':%s@' % parsed.password
        url = url.replace(pwd, ':*****@')
    return url
229928
Supplier<SymbolicLink> symbolicLinkCreator(JimfsPath target) {
    state.checkOpen();
    return factory.symbolicLinkCreator(target);
  }
983792
function encodeLink(path, value, attrs) {
    var allowedAttrs = [ 'pmin', 'pmax', 'gt', 'lt', 'st' ],
        pathType = cutils.getPathDateType(path),
        pathArray = cutils.getPathArray(path),
        oid = pathArray[0],
        attrsPayload = '',
        linkFormat = '';

    _.forEach(attrs, function (val, key) {
        if (_.includes(allowedAttrs, key) && _.isNumber(val))
            attrsPayload = attrsPayload + ';' + key + '=' + val;   // ';pmin=0;pmax=60'
    });

    path = cutils.getNumPath(path);
    linkFormat = '<' + path + '>' + attrsPayload + ',';

    switch (pathType) {
        case 'object':         // obj
            _.forEach(value, function (iobj, iid) {
                _.forEach(iobj, function (val, rid) {
                    linkFormat = linkFormat + '<' + path + '/' + iid + '/' + cutils.ridNumber(oid, rid) + '>' + ',';
                });
            });
            break;

        case 'instance':         // inst
            _.forEach(value, function (val, rid) {
                linkFormat = linkFormat + '<' + path + '/' + cutils.ridNumber(oid, rid) + '>' + ',';
            });
            break;

        case 'resource':         // resrc
            break;

        default:
            break;
    }

    if (linkFormat[linkFormat.length-1] === ',')
        linkFormat = linkFormat.slice(0, linkFormat.length - 1);

    return linkFormat;
}
205097
def link(text, link_func):
    """"""
    def object_formatter(v, c, m, p):
        """Format object view link."""
        return Markup('<a href="{0}">{1}</a>'.format(
            link_func(m), text))
    return object_formatter
432285
public static Link link(String href, String rel, String name, String prompt, String render) {
        return link(new URIImpl(href), rel, name, prompt, render);
    }