From 325c3a50f5db566cf7450631d84d08cf54b9ab9a Mon Sep 17 00:00:00 2001 From: William Ayd Date: Sat, 10 Dec 2022 12:33:04 -0800 Subject: [PATCH] Backport PR #50117: Alternate Ubuntu CI fix --- .github/workflows/32-bit-linux.yml | 2 +- .github/workflows/assign.yml | 2 +- .github/workflows/asv-bot.yml | 2 +- .../autoupdate-pre-commit-config.yml | 2 +- .github/workflows/code-checks.yml | 10 +++---- .github/workflows/codeql.yml | 2 +- .github/workflows/docbuild-and-upload.yml | 2 +- .github/workflows/python-dev.yml | 2 +- .github/workflows/sdist.yml | 2 +- .github/workflows/stale-pr.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- pandas/_libs/tslibs/offsets.pyx | 4 ++- pandas/_libs/tslibs/parsing.pyx | 26 +++---------------- 13 files changed, 21 insertions(+), 39 deletions(-) diff --git a/.github/workflows/32-bit-linux.yml b/.github/workflows/32-bit-linux.yml index 23ebd55200b66..49df3a077cfe7 100644 --- a/.github/workflows/32-bit-linux.yml +++ b/.github/workflows/32-bit-linux.yml @@ -17,7 +17,7 @@ permissions: jobs: pytest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/assign.yml b/.github/workflows/assign.yml index 979cd4679c0a0..b3331060823a9 100644 --- a/.github/workflows/assign.yml +++ b/.github/workflows/assign.yml @@ -11,7 +11,7 @@ jobs: permissions: issues: write pull-requests: write - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - if: github.event.comment.body == 'take' run: | diff --git a/.github/workflows/asv-bot.yml b/.github/workflows/asv-bot.yml index f676baa31aa14..d264698e60485 100644 --- a/.github/workflows/asv-bot.yml +++ b/.github/workflows/asv-bot.yml @@ -21,7 +21,7 @@ jobs: name: "Run benchmarks" # TODO: Support more benchmarking options later, against different branches, against self, etc if: startsWith(github.event.comment.body, '@github-actions benchmark') - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -el {0} diff --git a/.github/workflows/autoupdate-pre-commit-config.yml b/.github/workflows/autoupdate-pre-commit-config.yml index 4de8b35f93a69..376aa8343c571 100644 --- a/.github/workflows/autoupdate-pre-commit-config.yml +++ b/.github/workflows/autoupdate-pre-commit-config.yml @@ -15,7 +15,7 @@ jobs: pull-requests: write # for technote-space/create-pr-action to create a PR if: github.repository_owner == 'pandas-dev' name: Autoupdate pre-commit config - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up Python uses: actions/setup-python@v4 diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 403dbb317a883..167f62087f739 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -20,7 +20,7 @@ permissions: jobs: pre_commit: name: pre-commit - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-pre-commit @@ -39,7 +39,7 @@ jobs: typing_and_docstring_validation: name: Docstring and typing validation - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -el {0} @@ -98,7 +98,7 @@ jobs: asv-benchmarks: name: ASV Benchmarks - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -el {0} @@ -129,7 +129,7 @@ jobs: build_docker_dev_environment: name: Build Docker Dev Environment - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -el {0} @@ -156,7 +156,7 @@ jobs: requirements-dev-text-installable: name: Test install requirements-dev.txt - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dfe6b0574b20a..05a5d003c1dd1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,7 +10,7 @@ concurrency: jobs: analyze: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 permissions: actions: read contents: read diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index bbdc9decd96b1..13da56806de6e 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -22,7 +22,7 @@ permissions: jobs: web_and_docs: name: Doc Build and Upload - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index c4dd818e97070..ef16a4fb3fa33 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -49,7 +49,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macOS-latest, windows-latest] + os: [ubuntu-22.04, macOS-latest, windows-latest] name: actions-311-dev timeout-minutes: 120 diff --git a/.github/workflows/sdist.yml b/.github/workflows/sdist.yml index fe1f165250b2c..46b453532ad0b 100644 --- a/.github/workflows/sdist.yml +++ b/.github/workflows/sdist.yml @@ -19,7 +19,7 @@ permissions: jobs: build: if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 60 defaults: run: diff --git a/.github/workflows/stale-pr.yml b/.github/workflows/stale-pr.yml index 3a555de8eadbe..c47745e097d17 100644 --- a/.github/workflows/stale-pr.yml +++ b/.github/workflows/stale-pr.yml @@ -11,7 +11,7 @@ jobs: stale: permissions: pull-requests: write - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/stale@v4 with: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index be8d3ad0c322b..4602d12d8505e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -20,7 +20,7 @@ permissions: jobs: pytest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -el {0} diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 851488a89cd43..242eeffd1ee79 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -4134,7 +4134,9 @@ def shift_months( cnp.broadcast mi = cnp.PyArray_MultiIterNew2(out, dtindex) - if day_opt not in [None, "start", "end", "business_start", "business_end"]: + if day_opt is not None and day_opt not in { + "start", "end", "business_start", "business_end" + }: raise ValueError("day must be None, 'start', 'end', " "'business_start', or 'business_end'") diff --git a/pandas/_libs/tslibs/parsing.pyx b/pandas/_libs/tslibs/parsing.pyx index 074cc5504d6da..35f97f1978b69 100644 --- a/pandas/_libs/tslibs/parsing.pyx +++ b/pandas/_libs/tslibs/parsing.pyx @@ -12,7 +12,6 @@ from cpython.datetime cimport ( datetime, datetime_new, import_datetime, - tzinfo, ) from cpython.object cimport PyObject_Str from cython cimport Py_ssize_t @@ -44,7 +43,6 @@ from dateutil.relativedelta import relativedelta from dateutil.tz import ( tzlocal as _dateutil_tzlocal, tzoffset, - tzstr as _dateutil_tzstr, tzutc as _dateutil_tzutc, ) @@ -441,7 +439,7 @@ cdef parse_datetime_string_with_reso( try: parsed, reso = dateutil_parse(date_string, _DEFAULT_DATETIME, dayfirst=dayfirst, yearfirst=yearfirst, - ignoretz=False, tzinfos=None) + ignoretz=False) except (ValueError, OverflowError) as err: # TODO: allow raise of errors within instead raise DateParseError(err) @@ -633,7 +631,6 @@ cdef dateutil_parse( str timestr, object default, bint ignoretz=False, - object tzinfos=None, bint dayfirst=False, bint yearfirst=False, ): @@ -642,7 +639,7 @@ cdef dateutil_parse( cdef: str attr datetime ret - object res, tzdata + object res object reso = None dict repl = {} @@ -671,24 +668,7 @@ cdef dateutil_parse( if res.weekday is not None and not res.day: ret = ret + relativedelta.relativedelta(weekday=res.weekday) if not ignoretz: - if callable(tzinfos) or tzinfos and res.tzname in tzinfos: - # Note: as of 1.0 this is not reached because - # we never pass tzinfos, see GH#22234 - if callable(tzinfos): - tzdata = tzinfos(res.tzname, res.tzoffset) - else: - tzdata = tzinfos.get(res.tzname) - if isinstance(tzdata, tzinfo): - new_tzinfo = tzdata - elif isinstance(tzdata, str): - new_tzinfo = _dateutil_tzstr(tzdata) - elif isinstance(tzdata, int): - new_tzinfo = tzoffset(res.tzname, tzdata) - else: - raise ValueError("offset must be tzinfo subclass, " - "tz string, or int offset") - ret = ret.replace(tzinfo=new_tzinfo) - elif res.tzname and res.tzname in time.tzname: + if res.tzname and res.tzname in time.tzname: ret = ret.replace(tzinfo=_dateutil_tzlocal()) elif res.tzoffset == 0: ret = ret.replace(tzinfo=_dateutil_tzutc())