Return number of hebrew parasha.
190307
def get_reading(self):
        """"""
        _year_type = (self.year_size() % 10) - 3
        year_type = (
            self.diaspora * 1000 +
            self.rosh_hashana_dow() * 100 +
            _year_type * 10 +
            self.pesach_dow())

        _LOGGER.debug("Year type: %d", year_type)

        # Number of days since rosh hashana
        rosh_hashana = HebrewDate(self.hdate.year, Months.Tishrei, 1)
        days = self._jdn - conv.hdate_to_jdn(rosh_hashana)
        # Number of weeks since rosh hashana
        weeks = (days + self.rosh_hashana_dow() - 1) // 7
        _LOGGER.debug("Days: %d, Weeks %d", days, weeks)

        # If it's currently Simchat Torah, return VeZot Haberacha.
        if weeks == 3:
            if (days <= 22 and self.diaspora and self.dow != 7 or
                    days <= 21 and not self.diaspora):
                return 54

        # Special case for Simchat Torah in diaspora.
        if weeks == 4 and days == 22 and self.diaspora:
            return 54

        # Return the indexes for the readings of the given year
        def unpack_readings(readings):
            return list(chain(
                *([x] if isinstance(x, int) else x for x in readings)))

        reading_for_year = htables.READINGS[year_type]
        readings = unpack_readings(reading_for_year)
        # Maybe recompute the year type based on the upcoming shabbat.
        # This avoids an edge case where today is before Rosh Hashana but
        # Shabbat is in a new year afterwards.
        if (weeks >= len(readings)
                and self.hdate.year < self.upcoming_shabbat.hdate.year):
            return self.upcoming_shabbat.get_reading()
        return readings[weeks]
27046
def get_line_number (s, index):
    """
    i = 0
    if index < 0:
        return 0
    line = 1
    while i < index:
        if s[i] == '\n':
            line += 1
        i += 1
    return line
333222
def num_examples(self):
        """"""
        if self.is_list:
            return len(self.list_or_slice)
        else:
            start, stop, step = self.slice_to_numerical_args(
                self.list_or_slice, self.original_num_examples)
            return stop - start
1304554
def count(self, q):
        
        q = "SELECT COUNT(*) %s"%q
        return int(self.quick(q).split("\n")[1])
363595
def numbers(self):
        
        if self._numbers is None:
            self._numbers = NumberList(self._version, )
        return self._numbers
1317440
def num_in_memory(self):
    """"""
    n = len(self._data) - 1
    while n >= 0:
      if isinstance(self._data[n], _TensorValueDiscarded):
        break
      n -= 1
    return len(self._data) - 1 - n
1149841
def holiday_description(self):
        
        entry = self._holiday_entry()
        desc = entry.description
        return desc.hebrew.long if self.hebrew else desc.english
1107119
def count(self, item):
        """"""
        try:
            return self.items.get(item, 0)
        except TypeError:
            return self.items.get(repr(item), 0)
254923
function(months) {

    var parts, days, result;

    // year's birth (Molad) distance than the sunday before first Rosh Hashana
    parts = months * MONTH_LENGTH + 31524;
    result = days = Math.floor(modulo(parts, 181440) / DAY_LENGTH);
    parts = modulo(parts, DAY_LENGTH);

    // 'MOLAD ZAKEN'
    if(parts >= 19440) {
      result++;
    }

    // 'LO ADU ROSH'
    if([0,3,5,7].indexOf(result) + 1) {
      result++;
    }

    if(result == days) {
      
      // 'GETRED'
      if(result == 2 && parts >= 9924 && !isLeap(months2year(months))) {
        result += 2;
      }

      // 'BETUTAKPAT'
      else if (result == 1 && parts >= 16789 && isLeap(months2year(months) - 1)) {
        result++;
      }

    }

    return Math.floor((months * MONTH_LENGTH + 31524) / DAY_LENGTH) + result - days;

  }
1266688
def count(self, q='*:*', fq=None):
        """"""
        params = {'q': q, 'rows': '0'}
        if fq is not None:
            params['fq'] = fq
        res = self.search(params)
        hits = res['response']['numFound']
        return hits
490223
def r_get_numbers(matchgroup, num):
    """"""
    res = []
    for i in range(num):
        res.append(float(matchgroup.next().group()))
    return np.array(res)
503292
def qubits_count_tuple(qubits: Union[int, Qubits]) -> Tuple[int, Qubits]:
    """"""
    if isinstance(qubits, int):
        return qubits, tuple(range(qubits))
    return len(qubits), qubits
692273
def hebrew_date(self):
        """"""
        return u"{} {} {}".format(
            hebrew_number(self.hdate.day, hebrew=self.hebrew),   # Day
            htables.MONTHS[self.hdate.month - 1][self.hebrew],   # Month
            hebrew_number(self.hdate.year, hebrew=self.hebrew))
966362
def rosh_hashana_dow(self):
        """"""
        jdn = conv.hdate_to_jdn(HebrewDate(self.hdate.year, Months.Tishrei, 1))
        return (jdn + 1) % 7 + 1
1051038
function () {
            return [
                        __.filter (123, _.constant (456)).assert (456),
                        __.filter (['foo', 456], _.isString).assert (['foo']),
                        __.filter (['foo', 456], __.constant ('baz')).assert (['baz', 'baz']),
                        __.filter ({ foo: 123, bar: '456' }, _.isNumber).assert ({ foo: 123 })
                    ] }
124201
int getNumberOfAllTextParagraphs() {
    try {
      if (xPCursor == null) {
        return 0;
      }
      xPCursor.gotoStart(false);
      int nPara = 1;
      while (xPCursor.gotoNextParagraph(false)) nPara++;
      return nPara;
    } catch (Throwable t) {
      MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
      return 0;              // Return 0 as method failed
    }
  }
1270558
def count(self):
        """"""
        if self.request["Select"] == "COUNT":
            while not self.exhausted:
                next(self, None)
        return self._count