From da9c0df8380e08c6fd13b96bf9e21e3777477911 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Sun, 1 Jan 2023 07:06:37 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20UPGRADE:=20Autoupdate?= =?UTF-8?q?=20pre-commit=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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] From ca0e8418a78ddc36d9b74410451450efce6d7e68 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Sun, 1 Jan 2023 08:21:51 +0000 Subject: [PATCH 2/3] fixup --- pandas/_libs/algos.pyx | 53 +++++++++++++++----------------- pandas/_libs/tslibs/strptime.pyx | 30 +++++++++--------- 2 files changed, 39 insertions(+), 44 deletions(-) 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..76d88863054dd 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 @@ -487,22 +501,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 f44fb3d3c68099a2bc84316e843bb05f35e4a224 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Sun, 1 Jan 2023 08:30:19 +0000 Subject: [PATCH 3/3] put import at top of file --- pandas/_libs/tslibs/strptime.pyx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pandas/_libs/tslibs/strptime.pyx b/pandas/_libs/tslibs/strptime.pyx index 76d88863054dd..ac5d783f769ac 100644 --- a/pandas/_libs/tslibs/strptime.pyx +++ b/pandas/_libs/tslibs/strptime.pyx @@ -24,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() @@ -501,13 +506,6 @@ def array_strptime( return result, result_timezone.base -from _strptime import ( - TimeRE as _TimeRE, - _getlang, -) -from _strptime import LocaleTime # no-cython-lint - - class TimeRE(_TimeRE): """ Handle conversion from format directives to regexes.