Returns lifespan formatted for the web, for example:

        1850 - 1922
        1850, Cologne - 1922, Berlin
        1968 -
        n.d. - 1540s
421895
def lifespan_for_web(self, join="&nbsp;&ndash; "):
        
        birth = ", ".join(filter(None, (
            self.start_date_display,
            self.start_place
        )))
        death = ", ".join(filter(None, (
            self.end_date_display,
            self.end_place
        )))

        if death and not birth:
            if not death.startswith("died"):
                return mark_safe("n.d.&nbsp;&ndash;&nbsp;" + death)

        return mark_safe(join.join(filter(None, (birth, death))))
98977
def get_timerange_formatted(self, now):
        
        later = now + datetime.timedelta(days=self.days)
        return now.isoformat(), later.isoformat()
713471
def expired(self):
    """"""
    expiry_time = self.expiry_time
    if expiry_time is not None:
      return expiry_time < rdfvalue.RDFDatetime.Now()
    else:
      return False
220793
def getLastModified(self):
        ""
        last_modified = self.headers.get('last-modified')
        if last_modified:
            last_modified = self.convertTimeString(last_modified)
        return last_modified
1163901
function year(options) {
    var content = ''
      , y = this.year;

    while(++y < this.max_year) {
      content += options.fn({
        year: y,
        selected: +this.expiration_year === y ? ' selected' : '',
      });
    }

    return content;
  }
481714
private String getUpfrontReservationTime(Long dateInMillis) {
        DateTime now = new DateTime(DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
        DateTime event = new DateTime(dateInMillis, DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
        Duration duration = new Duration(now, event);

        if (duration.getMillis() < 0) {
            return "-1";
        } else if (duration.getStandardSeconds() < 86400) {
            return "1d";
        } else if (duration.getStandardDays() < 4) {
            return "4d";
        } else if (duration.getStandardDays() < 7) {
            return "1w";
        } else if (duration.getStandardDays() < 14) {
            return "2w";
        } else if (duration.getStandardDays() < 28) {
            return "4w";
        } else if (duration.getStandardDays() < 56) {
            return "8w";
        } else {
            return "-";
        }
    }
1007847
def tzname(self):
        

        if self.tzinfo is None:
            return None
        return self.tzinfo.tzname(self.replace(year=2000))
5974
def str(self, indent=0, history=None):
        
        if history is None:
            history = []
        if self in history:
            return '%s ...' % Repr(self)
        history.append(self)
        tab = '%*s' % (indent * 3, '')
        result = []
        result.append('%s<%s' % (tab, self.id))
        for n in self.description():
            if not hasattr(self, n):
                continue
            v = getattr(self, n)
            if v is None:
                continue
            result.append(' %s="%s"' % (n, v))
        if len(self):
            result.append('>')
            for c in self.rawchildren:
                result.append('\n')
                result.append(c.str(indent+1, history[:]))
                if c.isattr():
                    result.append('@')
            result.append('\n%s' % tab)
            result.append('</%s>' % self.__class__.__name__)
        else:
            result.append(' />')
        return ''.join(result)
700703
def ages(self):
        """"""
        match = self._ages_re.match(self.raw_fields.get('ages'))
        if not match:
            match = self._ages_re2.match(self.raw_fields.get('ages'))
            return self.Ages(int(match.group(1)),int(match.group(1)))
        return self.Ages(int(match.group(1)), int(match.group(2)))
682748
public static function getLifetime()
    {
        Base::checkOpen();
        if (Base::driver() == 'file') {
            return intval(ini_get('session.cookie_lifetime'));
        }
        return Base::getSessionObject()->getLifetime();
    }
146233
function getVersionSlice() {
		var era = prefs.get('caniuse.era');
		var ix = erasDB.indexOf(era);
		if (!~ix) {
			ix = erasDB.indexOf('e-2');
		}

		return ix;
	}
1224488
def text_to_edtf_date(text):
    
    if not text:
        return

    t = text.lower()
    result = ''

    for reject_re in REJECT_RULES:
        if re.match(reject_re, t):
            return

    # matches on '1800s'. Needs to happen before is_decade.
    could_be_century = re.findall(r'(\d{2}00)s', t)
    # matches on '1800s' and '1910s'. Removes the 's'.
    # Needs to happen before is_uncertain because e.g. "1860s?"
    t, is_decade = re.subn(r'(\d{3}0)s', r'\1', t)

    # detect approximation signifiers
    # a few 'circa' abbreviations just before the year
    is_approximate = re.findall(r'\b(ca?\.?) ?\d{4}', t)
    # the word 'circa' anywhere
    is_approximate = is_approximate or re.findall(r'\bcirca\b', t)
    # the word 'approx'/'around'/'about' anywhere
    is_approximate = is_approximate or \
                     re.findall(r'\b(approx|around|about)', t)
    # a ~ before a year-ish number
    is_approximate = is_approximate or re.findall(r'\b~\d{4}', t)
    # a ~ at the beginning
    is_approximate = is_approximate or re.findall(r'^~', t)

    # detect uncertainty signifiers
    t, is_uncertain = re.subn(r'(\d{4})\?', r'\1', t)
    # the words uncertain/maybe/guess anywhere
    is_uncertain = is_uncertain or re.findall(
        r'\b(uncertain|possibly|maybe|guess)', t)

    # detect century forms
    is_century = re.findall(CENTURY_RE, t)

    # detect CE/BCE year form
    is_ce = re.findall(CE_RE, t)
    if is_century:
        result = "%02dxx" % (int(is_century[0][0]) - 1,)
        is_approximate = is_approximate or \
                         re.findall(r'\b(ca?\.?) ?' + CENTURY_RE, t)
        is_uncertain = is_uncertain or re.findall(CENTURY_RE + r'\?', t)

        try:
            is_bc = is_century[0][-1] in ("bc", "bce")
            if is_bc:
                result = "-%s" % result
        except IndexError:
            pass

    elif is_ce:
        result = "%04d" % (int(is_ce[0][0]))
        is_approximate = is_approximate or \
                         re.findall(r'\b(ca?\.?) ?' + CE_RE, t)
        is_uncertain = is_uncertain or re.findall(CE_RE + r'\?', t)

        try:
            is_bc = is_ce[0][-1] in ("bc", "bce")
            if is_bc:
                result = "-%s" % result
        except IndexError:
            pass

    else:
        # try dateutil.parse

        try:
            # parse twice, using different defaults to see what was
            # parsed and what was guessed.
            dt1 = parse(
                t,
                dayfirst=appsettings.DAY_FIRST,
                yearfirst=False,
                fuzzy=True,  # force a match, even if it's default date
                default=DEFAULT_DATE_1
            )

            dt2 = parse(
                t,
                dayfirst=appsettings.DAY_FIRST,
                yearfirst=False,
                fuzzy=True,  # force a match, even if it's default date
                default=DEFAULT_DATE_2
            )

        except ValueError:
            return

        if dt1.date() == DEFAULT_DATE_1.date() and \
                dt2.date() == DEFAULT_DATE_2.date():
            # couldn't parse anything - defaults are untouched.
            return

        date1 = dt1.isoformat()[:10]
        date2 = dt2.isoformat()[:10]

        # guess precision of 'unspecified' characters to use
        mentions_year = re.findall(r'\byear\b.+(in|during)\b', t)
        mentions_month = re.findall(r'\bmonth\b.+(in|during)\b', t)
        mentions_day = re.findall(r'\bday\b.+(in|during)\b', t)

        for i in xrange(len(date1)):
            # if the given year could be a century (e.g. '1800s') then use
            # approximate/uncertain markers to decide whether we treat it as
            # a century or a decade.
            if i == 2 and could_be_century and \
                not (is_approximate or is_uncertain):
                result += 'x'
            elif i == 3 and is_decade > 0:
                if mentions_year:
                    result += 'u'  # year precision
                else:
                    result += 'x'  # decade precision
            elif date1[i] == date2[i]:
                # since both attempts at parsing produced the same result
                # it must be parsed value, not a default
                result += date1[i]
            else:
                # different values were produced, meaning that it's likely
                # a default. Use 'unspecified'
                result += "u"

        # strip off unknown chars from end of string - except the first 4

        for i in reversed(xrange(len(result))):
            if result[i] not in ('u', 'x', '-'):
                smallest_length = 4

                if mentions_month:
                    smallest_length = 7
                if mentions_day:
                    smallest_length = 10

                limit = max(smallest_length, i + 1)
                result = result[:limit]
                break

        # check for seasons
        if "spring" in t:
            result = result[:4] + "-21" + result[7:]
        elif "summer" in t:
            result = result[:4] + "-22" + result[7:]
        elif "autumn" in t or "fall" in t:
            result = result[:4] + "-23" + result[7:]
        elif "winter" in t:
            result = result[:4] + "-24" + result[7:]

            # end dateutil post-parsing

    if is_uncertain:
        result += "?"

    if is_approximate:
        result += "~"

    # weed out bad parses
    if result.startswith("uu-uu"):
        return None

    return result
306671
function (pathname) {
    pathname = pathname.replace(':browser', this.browserName);
    pathname = pathname.replace(':version', this._parseBrowserVersion(this.sessionStatus.version));
    pathname = pathname.replace(':timestamp', Math.round(new Date().getTime() / 1000));
    pathname = pathname.replace(':osVersion', this._parseOSVersion(this.driverStatus.os.version));
    pathname = pathname.replace(':os', this._parseOS(this.driverStatus.os.name));
    pathname = pathname.replace(':datetime', this._parseDatetime());
    pathname = pathname.replace(':date', this._parseDate());
    pathname = pathname.replace(':viewport', this._parseViewport());
    return pathname;
  }
890531
public int getYear() {

        MinguoEra era = this.getEra();
        return ((era == MinguoEra.ROC) ? this.iso.getYear() - 1911 : 1912 - this.iso.getYear());

    }
377001
def get_formatted_time(seconds: float) -> str:
    
    seconds = round(seconds)
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    return '{:d}:{:02d}:{:02d}'.format(h, m, s)
544890
protected function formatLongYear(): string
    {
        if ($this->year < 0) {
            return /*  I18N: BCE=Before the Common Era, for Julian years < 0. See http://en.wikipedia.org/wiki/Common_Era */
                I18N::translate('%s&nbsp;BCE', I18N::digits(-$this->year));
        }

        if ($this->new_old_style) {
            return I18N::translate('%s&nbsp;CE', I18N::digits(sprintf('%d/%02d', $this->year - 1, $this->year % 100)));
        }

        /* I18N: CE=Common Era, for Julian years > 0. See http://en.wikipedia.org/wiki/Common_Era */
        return I18N::translate('%s&nbsp;CE', I18N::digits($this->year));
    }
730871
def real(self):
        ''' 
        '''
        result = self.__raw['1'].copy()
        result['c'] = self.__raw['1']['value']
        result['value'] = self.__raw['200']['v2']
        result['date'] = self.__raw['0']['time']
        return result