Merge pull request #12 from jepler/fix-deprecated-utcnow
Avoid deprecated utcnow
This commit is contained in:
commit
d2a348cf38
6 changed files with 21 additions and 27 deletions
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
|
@ -18,10 +18,10 @@ jobs:
|
|||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
|
||||
- uses: actions/checkout@v2.2.0
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
|
|
|
|||
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
|
|
@ -17,11 +17,11 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- uses: actions/checkout@v2.2.0
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install deps
|
||||
run: python -mpip install -r requirements-dev.txt
|
||||
|
|
@ -33,11 +33,11 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- '3.8'
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
- '3.12.0-alpha.0 - 3.12'
|
||||
- '3.12'
|
||||
- '3.13.0-alpha.0 - 3.13'
|
||||
- 'pypy-3.9'
|
||||
os-version:
|
||||
- 'ubuntu-latest'
|
||||
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
|
|
@ -73,5 +73,4 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
- uses: pre-commit/action@v3.0.1
|
||||
|
|
|
|||
|
|
@ -6,18 +6,8 @@ default_language_version:
|
|||
python: python3
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.7.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort (python)
|
||||
args: ['--profile', 'black']
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
|
|
@ -25,10 +15,15 @@ repos:
|
|||
- id: trailing-whitespace
|
||||
exclude: tests
|
||||
- repo: https://github.com/fsfe/reuse-tool
|
||||
rev: v2.1.0
|
||||
rev: v3.0.2
|
||||
hooks:
|
||||
- id: reuse
|
||||
- repo: https://github.com/pycqa/pylint
|
||||
rev: v2.17.1
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.4.3
|
||||
hooks:
|
||||
- id: pylint
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
args: [ --fix ]
|
||||
# Run the formatter.
|
||||
- id: ruff-format
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class LeapSecondData:
|
|||
|
||||
def _check_validity(self, when: Optional[datetime.datetime]) -> Optional[str]:
|
||||
if when is None:
|
||||
when = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
|
||||
when = datetime.datetime.now(datetime.timezone.utc)
|
||||
if not self.valid_until:
|
||||
return "Data validity unknown"
|
||||
if when > self.valid_until:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ long_description_content_type = text/markdown
|
|||
url = https://github.com/jepler/leapseconddata
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
Programming Language :: Python :: 3.11
|
||||
|
|
@ -25,7 +24,7 @@ classifiers =
|
|||
[options]
|
||||
package_dir =
|
||||
=.
|
||||
python_requires = >=3.8
|
||||
python_requires = >=3.9
|
||||
packages = leapseconddata
|
||||
|
||||
[options.package_data]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
"""Test most leapseconddata functionality"""
|
||||
|
||||
# pylint: disable=missing-class-docstring,missing-function-docstring
|
||||
import datetime
|
||||
import unittest
|
||||
|
|
|
|||
Loading…
Reference in a new issue