diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3158e64df8dd..82d8fc12c59fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: types_or: [python, rst, markdown] additional_dependencies: [tomli] - repo: https://github.com/MarcoGorelli/cython-lint - rev: v0.9.1 + rev: v0.10.1 hooks: - id: cython-lint - id: double-quote-cython-strings @@ -77,12 +77,12 @@ repos: - flake8-bugbear==22.7.1 - pandas-dev-flaker==0.5.0 - repo: https://github.com/pycqa/pylint - rev: v2.15.6 + rev: v2.15.9 hooks: - id: pylint stages: [manual] - repo: https://github.com/pycqa/pylint - rev: v2.15.6 + rev: v2.15.9 hooks: - id: pylint alias: redefined-outer-name @@ -99,11 +99,11 @@ repos: args: [--disable=all, --enable=redefined-outer-name] stages: [manual] - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v3.2.2 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/pandas/_libs/algos.pyx b/pandas/_libs/algos.pyx index 7fcba58772ac4..77876d0c55337 100644 --- a/pandas/_libs/algos.pyx +++ b/pandas/_libs/algos.pyx @@ -647,40 +647,37 @@ def pad_2d_inplace(numeric_object_t[:, :] values, uint8_t[:, :] mask, limit=None val = values[j, i] -""" -Backfilling logic for generating fill vector - -Diagram of what's going on - -Old New Fill vector Mask - . 0 1 - . 0 1 - . 0 1 -A A 0 1 - . 1 1 - . 1 1 - . 1 1 - . 1 1 - . 1 1 -B B 1 1 - . 2 1 - . 2 1 - . 2 1 -C C 2 1 - . 0 - . 0 -D -""" - - @cython.boundscheck(False) @cython.wraparound(False) def backfill( ndarray[numeric_object_t] old, ndarray[numeric_object_t] new, limit=None -) -> ndarray: - # -> ndarray[intp_t, ndim=1] +) -> ndarray: # -> ndarray[intp_t, ndim=1] + """ + Backfilling logic for generating fill vector + + Diagram of what's going on + + Old New Fill vector Mask + . 0 1 + . 0 1 + . 0 1 + A A 0 1 + . 1 1 + . 1 1 + . 1 1 + . 1 1 + . 1 1 + B B 1 1 + . 2 1 + . 2 1 + . 2 1 + C C 2 1 + . 0 + . 0 + D + """ cdef: Py_ssize_t i, j, nleft, nright ndarray[intp_t, ndim=1] indexer diff --git a/pandas/_libs/tslibs/strptime.pyx b/pandas/_libs/tslibs/strptime.pyx index 27e99706137b6..ac5d783f769ac 100644 --- a/pandas/_libs/tslibs/strptime.pyx +++ b/pandas/_libs/tslibs/strptime.pyx @@ -1,4 +1,18 @@ """Strptime-related classes and functions. + +TimeRE, _calc_julian_from_U_or_W are vendored +from the standard library, see +https://github.com/python/cpython/blob/main/Lib/_strptime.py +The original module-level docstring follows. + +Strptime-related classes and functions. +CLASSES: + LocaleTime -- Discovers and stores locale-specific time information + TimeRE -- Creates regexes for pattern matching a string of text containing + time information +FUNCTIONS: + _getlang -- Figure out what language is being used for the locale + strptime -- Calculates the time struct represented by the passed-in string """ from datetime import timezone @@ -10,6 +24,11 @@ from cpython.datetime cimport ( timedelta, tzinfo, ) +from _strptime import ( + TimeRE as _TimeRE, + _getlang, +) +from _strptime import LocaleTime # no-cython-lint import_datetime() @@ -487,29 +506,6 @@ def array_strptime( return result, result_timezone.base -""" -TimeRE, _calc_julian_from_U_or_W are vendored -from the standard library, see -https://github.com/python/cpython/blob/main/Lib/_strptime.py -The original module-level docstring follows. - -Strptime-related classes and functions. -CLASSES: - LocaleTime -- Discovers and stores locale-specific time information - TimeRE -- Creates regexes for pattern matching a string of text containing - time information -FUNCTIONS: - _getlang -- Figure out what language is being used for the locale - strptime -- Calculates the time struct represented by the passed-in string -""" - -from _strptime import ( - TimeRE as _TimeRE, - _getlang, -) -from _strptime import LocaleTime # no-cython-lint - - class TimeRE(_TimeRE): """ Handle conversion from format directives to regexes.