Returns range of values used in limit/offset constructs >>> [_ for _ in getLimitRange(10)] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
(count, plusOne=False)
| 1874 | return expression |
| 1875 | |
| 1876 | def getLimitRange(count, plusOne=False): |
| 1877 | """ |
| 1878 | Returns range of values used in limit/offset constructs |
| 1879 | |
| 1880 | >>> [_ for _ in getLimitRange(10)] |
| 1881 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
| 1882 | """ |
| 1883 | |
| 1884 | retVal = None |
| 1885 | count = int(count) |
| 1886 | limitStart, limitStop = 1, count |
| 1887 | reverse = False |
| 1888 | |
| 1889 | if kb.dumpTable: |
| 1890 | if conf.limitStart and conf.limitStop and conf.limitStart > conf.limitStop: |
| 1891 | limitStop = conf.limitStart |
| 1892 | limitStart = conf.limitStop |
| 1893 | reverse = True |
| 1894 | else: |
| 1895 | if isinstance(conf.limitStop, int) and conf.limitStop > 0 and conf.limitStop < limitStop: |
| 1896 | limitStop = conf.limitStop |
| 1897 | |
| 1898 | if isinstance(conf.limitStart, int) and conf.limitStart > 0 and conf.limitStart <= limitStop: |
| 1899 | limitStart = conf.limitStart |
| 1900 | |
| 1901 | retVal = xrange(limitStart, limitStop + 1) if plusOne else xrange(limitStart - 1, limitStop) |
| 1902 | |
| 1903 | if reverse: |
| 1904 | retVal = xrange(retVal[-1], retVal[0] - 1, -1) |
| 1905 | |
| 1906 | return retVal |
| 1907 | |
| 1908 | def parseUnionPage(page): |
| 1909 | """ |
no test coverage detected
searching dependent graphs…