---------------- /*
Given a cronspec, return the human-readable string.
192881
function(cronspec, sixth) {
    var schedule = later.parse.cron(cronspec, sixth);
    return scheduleToSentence(schedule['schedules'][0], sixth);
  }
531462
public
  static
  String getFacilityString(int syslogFacility) {
    switch(syslogFacility) {
    case LOG_KERN:      return "kern";
    case LOG_USER:      return "user";
    case LOG_MAIL:      return "mail";
    case LOG_DAEMON:    return "daemon";
    case LOG_AUTH:      return "auth";
    case LOG_SYSLOG:    return "syslog";
    case LOG_LPR:       return "lpr";
    case LOG_NEWS:      return "news";
    case LOG_UUCP:      return "uucp";
    case LOG_CRON:      return "cron";
    case LOG_AUTHPRIV:  return "authpriv";
    case LOG_FTP:       return "ftp";
    case LOG_LOCAL0:    return "local0";
    case LOG_LOCAL1:    return "local1";
    case LOG_LOCAL2:    return "local2";
    case LOG_LOCAL3:    return "local3";
    case LOG_LOCAL4:    return "local4";
    case LOG_LOCAL5:    return "local5";
    case LOG_LOCAL6:    return "local6";
    case LOG_LOCAL7:    return "local7";
    default:            return null;
    }
  }
816125
public static String humanize(long value) {
        if (value < 0) {
            return '-' + humanize(-value);
        } else if (value > 1000000000000000000L) {
            return Double.toString(
                    (value + 500000000000000L) / 1000000000000000L * 1000000000000000L / 1000000000000000000.0) + 'E';
        } else if (value > 100000000000000000L) {
            return Double.toString(
                    (value + 50000000000000L) / 100000000000000L * 100000000000000L / 1000000000000000.0) + 'P';
        } else if (value > 10000000000000000L) {
            return Double
                    .toString((value + 5000000000000L) / 10000000000000L * 10000000000000L / 1000000000000000.0) + 'P';
        } else if (value > 1000000000000000L) {
            return Double
                    .toString((value + 500000000000L) / 1000000000000L * 1000000000000L / 1000000000000000.0) + 'P';
        } else if (value > 100000000000000L) {
            return Double.toString((value + 50000000000L) / 100000000000L * 100000000000L / 1000000000000.0) + 'T';
        } else if (value > 10000000000000L) {
            return Double.toString((value + 5000000000L) / 10000000000L * 10000000000L / 1000000000000.0) + 'T';
        } else if (value > 1000000000000L) {
            return Double.toString((value + 500000000) / 1000000000 * 1000000000 / 1000000000000.0) + 'T';
        } else if (value > 100000000000L) {
            return Double.toString((value + 50000000) / 100000000 * 100000000 / 1000000000.0) + 'G';
        } else if (value > 10000000000L) {
            return Double.toString((value + 5000000) / 10000000 * 10000000 / 1000000000.0) + 'G';
        } else if (value > 1000000000) {
            return Double.toString((value + 500000) / 1000000 * 1000000 / 1000000000.0) + 'G';
        } else if (value > 100000000) {
            return Double.toString((value + 50000) / 100000 * 100000 / 1000000.0) + 'M';
        } else if (value > 10000000) {
            return Double.toString((value + 5000) / 10000 * 10000 / 1000000.0) + 'M';
        } else if (value > 1000000) {
            return Double.toString((value + 500) / 1000 * 1000 / 1000000.0) + 'M';
        } else if (value > 100000) {
            return Double.toString((value + 50) / 100 * 100 / 1000.0) + 'K';
        } else if (value > 10000) {
            return Double.toString((value + 5) / 10 * 10 / 1000.0) + 'K';
        } else if (value > 1000) {
            return Double.toString(value / 1000.0) + 'K';
        } else {
            return Long.toString(value) + ' ';
        }
    }
1282095
def str_def(self):
        
        return "classname={!r}; min_api_version={!r}; api_version={!r}; " \
            "message={!r};". \
            format(self.__class__.__name__, self.min_api_version,
                   self.api_version, self.args[0])
1290596
private static final String human (long n) {
        if (n >= 1000000) return String.format(Locale.getDefault(), "%.1fM", n/1000000.0);
        if (n >= 1000) return String.format(Locale.getDefault(), "%.1fk", n/1000.0);
        else return String.format(Locale.getDefault(), "%d", n);
    }
1217130
function (str, callback) {
            var root, start, end, zone, line, lines, buff = [], c, error = null;

            i = j = current = furthest = 0;
            input = str.replace(/\r\n/g, '\n');

            // Remove potential UTF Byte Order Mark
            input = input.replace(/^\uFEFF/, '');

            // Split the input into chunks.
            chunks = (function (chunks) {
                var j = 0,
                    skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
                    comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
                    string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
                    level = 0,
                    match,
                    chunk = chunks[0],
                    inParam;

                for (var i = 0, c, cc; i < input.length;) {
                    skip.lastIndex = i;
                    if (match = skip.exec(input)) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                        }
                    }
                    c = input.charAt(i);
                    comment.lastIndex = string.lastIndex = i;

                    if (match = string.exec(input)) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                            continue;
                        }
                    }

                    if (!inParam && c === '/') {
                        cc = input.charAt(i + 1);
                        if (cc === '/' || cc === '*') {
                            if (match = comment.exec(input)) {
                                if (match.index === i) {
                                    i += match[0].length;
                                    chunk.push(match[0]);
                                    continue;
                                }
                            }
                        }
                    }
                    
                    switch (c) {
                        case '{': if (! inParam) { level ++;        chunk.push(c);                           break }
                        case '}': if (! inParam) { level --;        chunk.push(c); chunks[++j] = chunk = []; break }
                        case '(': if (! inParam) { inParam = true;  chunk.push(c);                           break }
                        case ')': if (  inParam) { inParam = false; chunk.push(c);                           break }
                        default:                                    chunk.push(c);
                    }
                    
                    i++;
                }
                if (level != 0) {
                    error = new(LessError)({
                        index: i-1,
                        type: 'Parse',
                        message: (level > 0) ? "missing closing `}`" : "missing opening `{`",
                        filename: env.filename
                    }, env);
                }

                return chunks.map(function (c) { return c.join('') });;
            })([[]]);

            if (error) {
                return callback(error, env);
            }

            // Start with the primary rule.
            // The whole syntax tree is held under a Ruleset node,
            // with the `root` property set to true, so no `{}` are
            // output. The callback is called when the input is parsed.
            try {
                root = new(tree.Ruleset)([], $(this.parsers.primary));
                root.root = true;
            } catch (e) {
                return callback(new(LessError)(e, env));
            }

            root.toCSS = (function (evaluate) {
                var line, lines, column;

                return function (options, variables) {
                    var frames = [], importError;

                    options = options || {};
                    //
                    // Allows setting variables with a hash, so:
                    //
                    //   `{ color: new(tree.Color)('#f01') }` will become:
                    //
                    //   new(tree.Rule)('@color',
                    //     new(tree.Value)([
                    //       new(tree.Expression)([
                    //         new(tree.Color)('#f01')
                    //       ])
                    //     ])
                    //   )
                    //
                    if (typeof(variables) === 'object' && !Array.isArray(variables)) {
                        variables = Object.keys(variables).map(function (k) {
                            var value = variables[k];

                            if (! (value instanceof tree.Value)) {
                                if (! (value instanceof tree.Expression)) {
                                    value = new(tree.Expression)([value]);
                                }
                                value = new(tree.Value)([value]);
                            }
                            return new(tree.Rule)('@' + k, value, false, 0);
                        });
                        frames = [new(tree.Ruleset)(null, variables)];
                    }

                    try {
                        var css = evaluate.call(this, { frames: frames })
                                          .toCSS([], { compress: options.compress || false, dumpLineNumbers: env.dumpLineNumbers });
                    } catch (e) {
                        throw new(LessError)(e, env);
                    }

                    if ((importError = parser.imports.error)) { // Check if there was an error during importing
                        if (importError instanceof LessError) throw importError;
                        else                                  throw new(LessError)(importError, env);
                    }

                    if (options.yuicompress && less.mode === 'node') {
                        return require('ycssmin').cssmin(css);
                    } else if (options.compress) {
                        return css.replace(/(\s)+/g, "$1");
                    } else {
                        return css;
                    }
                };
            })(root.eval);

            // If `i` is smaller than the `input.length - 1`,
            // it means the parser wasn't able to parse the whole
            // string, so we've got a parsing error.
            //
            // We try to extract a \n delimited string,
            // showing the line where the parse error occured.
            // We split it up into two parts (the part which parsed,
            // and the part which didn't), so we can color them differently.
            if (i < input.length - 1) {
                i = furthest;
                lines = input.split('\n');
                line = (input.slice(0, i).match(/\n/g) || "").length + 1;

                for (var n = i, column = -1; n >= 0 && input.charAt(n) !== '\n'; n--) { column++ }

                error = {
                    type: "Parse",
                    message: "Syntax Error on line " + line,
                    index: i,
                    filename: env.filename,
                    line: line,
                    column: column,
                    extract: [
                        lines[line - 2],
                        lines[line - 1],
                        lines[line]
                    ]
                };
            }

            if (this.imports.queue.length > 0) {
                finish = function (e) {
                    e = error || e;
                    if (e) callback(e);
                    else callback(null, root);
                };
            } else {
                callback(error, root);
            }
        }
918885
def read_string(buff, byteorder='big'):
    """"""
    length = read_numeric(USHORT, buff, byteorder)
    return buff.read(length).decode('utf-8')
76946
private static URL makeURLFromFilespec(final String filespec) throws IOException {
        String decoded = URLDecoder.decode(filespec, "UTF-8");
        File file = new File(decoded);
        // make sure it is canonical (no ../ and such)
        file = file.getCanonicalFile();

        return file.toURI().toURL();
    }
1162085
def to_str(self):
        """"""
        val = c_backend.pystring_get_str(self._ptr)
        delattr(self, '_ptr')
        setattr(self, 'to_str', _dangling_pointer)
        return val.decode("utf-8")
1095798
def _strfactory(cls, line):
        """"""

        cmp = line.rstrip().split()
        chrom = cmp[2]
        if not chrom.startswith("chr"):
            chrom = "chr%s" % chrom
        instance =  tuple.__new__(cls,
                (cmp[0], cmp[1],
                    chrom, int(cmp[3]), int(cmp[4]),
                    {'1' : '+', '-1' : '-'}[cmp[5]], cmp[6]))
        span = instance.end - instance.start + 1
        m_num = sum( (t[1] == "M" and [t[0]] or [0])[0] for t in instance.cigar_iter(False) )
        if span != m_num:
            log.warning("[{gabid}] {species}.{chrom}:{start}-{end}.".format(**instance._asdict()) + "(span) %d != %d (matches)" % (span, m_num))
            return None
        return instance
1355304
public function calc_cron($cron_string = null)
    {

        if (empty($cron_string)) return false;

        // set the given cronstring
        $this->cron_string = $cron_string;
        // get the curren timestamp
        $this->current_time = strtotime(date('Y-m-d H:i:00', time()));
        $this->calc_time    = strtotime(date('Y-m-d H:i:00', time()));

        $this->next_run      = 0;
        $this->date_next_run = 0;

        // display cleanup
        $this->year        = null;
        $this->cron_month  = null;
        $this->cron_day    = null;
        $this->cron_minute = null;
        $this->cron_hour   = null;

        $count = count($tmp_array = explode(' ', $this->cron_string));

        if (trim($this->cron_string) == '* * * * *' || trim($this->cron_string) == '* * * * * *') {
            $this->next_run      = strtotime('+1 minute', $this->current_time);
            $this->date_next_run = date('Y-m-d H:i:s', $this->next_run);

            // display cleanup
            $this->cron_minute = (strlen($this->cron_minute = date('i', $this->current_time)) < 2) ? "0$this->cron_minute" : $this->cron_minute;
            $this->cron_hour   = (strlen($this->cron_hour = date('h', $this->current_time)) < 2) ? "0$this->cron_hour" : $this->cron_hour;
            $this->cron_day    = (strlen($this->cron_day = date('d', $this->current_time)) < 2) ? "0$this->cron_day" : $this->cron_day;
            $this->cron_month  = (strlen($this->cron_month = date('m', $this->current_time)) < 2) ? "0$this->cron_month" : $this->cron_month;
            $this->cron_year   = (strlen($this->cron_year = date('Y', $this->current_time)) < 2) ? "0$this->cron_hour" : $this->cron_hour;
            $this->cron_array  = array();

            return true;
        }

        // set the cron array
        $this->cron_array = array(
            0 => array(
                'placeholder' => 'i',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_minute'
            ),
            1 => array(
                'placeholder' => 'H',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_hour'
            ),
            2 => array(
                'placeholder' => 'd',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_day'
            ),
            3 => array(
                'placeholder' => 'm',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_month'
            ),
            4 => array(
                'placeholder' => 'w',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_weekday'
            ),
            5 => array(
                'placeholder' => 'Y',
                'range'       => array(
                    'range'    => '*',
                    'interval' => false
                ),
                'p_name'      => 'cron_year'
            )
        );

        // get the time range for the specific year / month
        for ($i = 0; $i < $count; $i++) {
            $this->cron_array[$i]['range'] = $this->parse_position($tmp_array[$i]);
        }

        unset($tmp_array, $i);

        // since the year is optional
        if ($count < 6) {
            $this->cron_array[5]['range'] = $this->parse_position(date('Y'));
            $count++;
        }

        $next_up = false;

        // foreach ( $this->cron_array as $key => $val )
        for ($i = 0; $i < $count; $i++) {
            if (!empty($this->cron_array[$i]['range']) && !is_array($this->cron_array[$i]['range']['range'])) {
                $sub_range = array(
                    'range'       => $this->cron_array[$i]['range']['range'],
                    'interval'    => $this->cron_array[$i]['range']['interval'],
                    'placeholder' => $this->cron_array[$i]['placeholder'],
                    'p_name'      => $this->cron_array[$i]['p_name']
                );

                $this->__set_value($sub_range);
            } else {

                foreach ($this->cron_array[$i]['range'] as $range) {
                    if (!is_array($range)) continue;

                    if ($next_up === true) {
                        $val_string  = (string)substr($this->cron_array[$i]['p_name'], 5);
                        $val         = (string)date($this->cron_array[$i]['placeholder'], strtotime("+1 $val_string", $this->calc_time));
                        $date_string = '';
                        switch ($i) {
                            case 0 :
                                $date_string = (string)"Y-m-d H:$val:00";
                                break;
                            case 1 :
                                $date_string = (string)"Y-m-d $val:00:00";
                                break;
                            case 2 :
                                $date_string = (string)"Y-m-$val 00:00:00";
                                break;
                            case 3 :
                                $date_string = (string)"Y-$val-01 00:00:00";
                                break;
                            case 4 :
                                break;
                            case 5 :
                                $date_string = (string)"$val-01-01 00:00";
                                break;
                            default :
                                $date_string = (string)"Y-m-d H:i:s";
                                break;
                        }
                        // the calcuation date
                        $this->calc_time = (int)strtotime(date((string)$date_string));

                        // reset the restart
                        $next_up = false;

                        for ($x = 0; count($this->cron_array) > $x; $x++) {
                            $this->{$this->cron_array[$x]['p_name']} = null;
                        }
                        // cleanup useless vars
                        unset($x, $val, $val_string, $date_string);
                        // reset to the first field
                        $i = -1;
                        // start from beginning break this loop
                        break;
                    }

                    // go through all subranges
                    foreach ($range as $sub_range) {
                        $sub_range['placeholder'] = (string)$this->cron_array[$i]['placeholder'];
                        $sub_range['p_name']      = (string)$this->cron_array[$i]['p_name'];
                        if (!empty($this->{$this->cron_array[$i]['p_name']})) break;
                        $this->__set_value((array)$sub_range);
                    }

                    // check if a value has been set
                    if (!isset($this->{$this->cron_array[$i]['p_name']})) {
                        $next_up = true;
                    }
                    unset($sub_range);
                }
                unset($range);
            }
        }
        // display cleanup
        $this->cron_minute = (strlen($this->cron_minute) < 2) ? "0$this->cron_minute" : $this->cron_minute;
        $this->cron_hour   = (strlen($this->cron_hour) < 2) ? "0$this->cron_hour" : $this->cron_hour;
        $this->cron_day    = (strlen($this->cron_day) < 2) ? "0$this->cron_day" : $this->cron_day;
        $this->cron_month  = (strlen($this->cron_month) < 2) ? "0$this->cron_month" : $this->cron_month;
        // set the next possible timestamp
        $this->date_next_run = "{$this->cron_year}-{$this->cron_month}-{$this->cron_day} {$this->cron_hour}:{$this->cron_minute}:00";
        $this->next_run      = strtotime($this->date_next_run);

        // clear cron array
        $this->cron_array = array();

        return $this->next_run;
    }
1323764
def Description(self):
        """"""
        descr = " ".join((self.getId(), self.aq_parent.Title()))
        return safe_unicode(descr).encode('utf-8')
1360496
function jsonSpec() {
  return parsedArgs.specFile ?
    read(parsedArgs.specFile).then(JSON.parse) :
    require("../index").fetch(parsedArgs.urls)
      .then(mdSource => require("../index").parse(mdSource))
}
1143058
def getString(t):
    
    slen = c_int()
    s = c_char_p()
    if PL_get_string_chars(t, byref(s), byref(slen)):
        return s.value
    else:
        raise InvalidTypeError("string")
1030428
def polite_string(a_string):
    """"""
    if is_py3() and hasattr(a_string, 'decode'):
        try:
            return a_string.decode('utf-8')
        except UnicodeDecodeError:
            return a_string

    return a_string
434005
def getSpec(cls):
    
    spec = cls.getBaseSpec()
    p, o = _getAdditionalSpecs()
    spec["parameters"].update(p)
    spec["parameters"].update(o)

    return spec
541516
def get_readable(self):
        '''
        
        '''
        query = (u'?' + u'&'.join(u'{}={}'.format(urlquote(k), urlquote(v))
                                  for k, v in six.iteritems(self.query))
                 if self.query else '')
        hash_part = (u'#' + self.fragment) if self.fragment is not None else u''

        path, query, hash_part = uri_to_iri_parts(self.path, query, hash_part)

        if self.host:
            port = u':' + self.port if self.port else u''
            return u''.join((self.scheme, '://', self.host, port, path, query, hash_part))
        else:
            return path + query + hash_part