Skip to content

Commit

Permalink
Upgrade to Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanforbes committed Aug 29, 2023
1 parent 2e4ccaf commit 937df53
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
uses: bryanforbes/python-workflows/.github/workflows/reusable-unit-tests.yml@master
with:
python_versions: '["3.10"]'
python_versions: '["3.11"]'
coverage: true
pytest_args: '--block-network --record-mode=none -p no:sugar'
secrets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def upgrade():
op.execute(
daily_breads_after.update()
.filter_by(guild_id=row[0])
.values({'next_scheduled': row[1].replace(tzinfo=datetime.timezone.utc)})
.values({'next_scheduled': row[1].replace(tzinfo=datetime.UTC)})
)


Expand Down
4 changes: 2 additions & 2 deletions erasmus/cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import textwrap
import traceback
from contextlib import asynccontextmanager, redirect_stdout
from typing import TYPE_CHECKING, Any, Final
from typing_extensions import Self, override
from typing import TYPE_CHECKING, Any, Final, Self
from typing_extensions import override

import discord
from botus_receptus import GroupCog, utils
Expand Down
4 changes: 1 addition & 3 deletions erasmus/cogs/bible/bible_lookup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Self

from attrs import frozen
from discord import app_commands

from ...utils import AutoCompleter

if TYPE_CHECKING:
from typing_extensions import Self

from ...types import Bible


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from itertools import chain
from typing import TYPE_CHECKING, ClassVar, Final, cast
from typing_extensions import Self, Unpack, override
from typing import TYPE_CHECKING, ClassVar, Final, Self, Unpack, cast
from typing_extensions import override

import discord
import pendulum
Expand Down
4 changes: 2 additions & 2 deletions erasmus/cogs/confession.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from itertools import pairwise
from typing import TYPE_CHECKING, Final, NamedTuple, cast
from typing_extensions import Self, override
from typing import TYPE_CHECKING, Final, NamedTuple, Self, cast
from typing_extensions import override

import discord
from attrs import frozen
Expand Down
5 changes: 1 addition & 4 deletions erasmus/config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from __future__ import annotations

from typing import TYPE_CHECKING, TypedDict
from typing import NotRequired, TypedDict

from botus_receptus import Config as BaseConfig

if TYPE_CHECKING:
from typing_extensions import NotRequired


class ServiceConfig(TypedDict):
api_key: NotRequired[str]
Expand Down
4 changes: 2 additions & 2 deletions erasmus/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from enum import Flag, auto
from pathlib import Path
from typing import TYPE_CHECKING, Final, TypedDict
from typing_extensions import Self, override
from typing import TYPE_CHECKING, Final, Self, TypedDict
from typing_extensions import override

import orjson
from attrs import evolve, frozen
Expand Down
4 changes: 2 additions & 2 deletions erasmus/db/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing_extensions import Self, override
from typing import TYPE_CHECKING, Self
from typing_extensions import override

import pendulum
from pendulum.tz.timezone import Timezone as _Timezone
Expand Down
3 changes: 1 addition & 2 deletions erasmus/l10n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Literal, TypedDict, overload
from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict, Unpack, overload

from attrs import define, field, frozen
from discord import app_commands
Expand All @@ -14,7 +14,6 @@
if TYPE_CHECKING:
from _typeshed import SupportsItems
from collections.abc import Iterator
from typing_extensions import NotRequired, Unpack

import discord

Expand Down
4 changes: 2 additions & 2 deletions erasmus/l10n/fluent.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from datetime import timedelta
from typing import TYPE_CHECKING, ClassVar, Literal, get_args
from typing_extensions import Self, override
from typing import TYPE_CHECKING, ClassVar, Literal, Self, get_args
from typing_extensions import override

from attrs import define, field, validators
from babel.dates import format_timedelta
Expand Down
3 changes: 2 additions & 1 deletion erasmus/page_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from abc import abstractmethod
from collections.abc import AsyncIterable, Awaitable, Callable, Iterable, Sequence
from typing import (
NotRequired,
ParamSpec,
Protocol,
TypeAlias,
TypedDict,
runtime_checkable,
)
from typing_extensions import NotRequired, TypeVar, override
from typing_extensions import TypeVar, override

import discord

Expand Down
4 changes: 2 additions & 2 deletions erasmus/services/apibible.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import asyncio
import contextlib
from typing import TYPE_CHECKING, Final, Literal, TypedDict
from typing_extensions import Self, override
from typing import TYPE_CHECKING, Final, Literal, Self, TypedDict
from typing_extensions import override

import orjson
from attrs import field, frozen
Expand Down
4 changes: 1 addition & 3 deletions erasmus/services/base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import logging
from abc import abstractmethod
from typing import TYPE_CHECKING, Final
from typing import TYPE_CHECKING, Final, Self

from attrs import frozen
from botus_receptus import re

if TYPE_CHECKING:
from typing_extensions import Self

import aiohttp

from ..config import ServiceConfig
Expand Down
4 changes: 2 additions & 2 deletions erasmus/ui_pages.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import contextlib
from typing import TYPE_CHECKING, Final, Generic, cast
from typing_extensions import Self, TypeVar, override
from typing import TYPE_CHECKING, Final, Generic, Self, cast
from typing_extensions import TypeVar, override

import discord
from botus_receptus import utils
Expand Down
13 changes: 11 additions & 2 deletions erasmus/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from __future__ import annotations

from collections import OrderedDict
from typing import TYPE_CHECKING, Final, Generic, Protocol, TypedDict, overload
from typing_extensions import NotRequired, TypeVar, Unpack, override
from typing import (
TYPE_CHECKING,
Final,
Generic,
NotRequired,
Protocol,
TypedDict,
Unpack,
overload,
)
from typing_extensions import TypeVar, override

from attrs import field, frozen
from botus_receptus import utils
Expand Down
25 changes: 2 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.11"
alembic = "1.11.3"
attrs = "23.1.0"
beautifulsoup4 = "4.12.2"
Expand Down Expand Up @@ -46,7 +46,7 @@ erasmus = 'erasmus.run:main'

[tool.black]
line-length = 88
target-version = ["py310"]
target-version = ["py311"]
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
Expand Down Expand Up @@ -82,7 +82,7 @@ select = [
ignore = ["ANN101", "ANN102", "PLR0913", "PLR2004", "PT004", "TRY003"]
extend-exclude = [".venv*"]
line-length = 88
target-version = "py310"
target-version = "py311"

[tool.ruff.per-file-ignores]
"*.pyi" = ["ANN401", "E501", "E701", "E741", "F401", "F403", "F405", "F811", "FBT001", "FBT002", "PGH003"]
Expand Down Expand Up @@ -118,7 +118,7 @@ stubPath = "./stubs"
venvPath = "."
venv = ".venv"

pythonVersion = "3.10"
pythonVersion = "3.11"
reportUnnecessaryTypeIgnoreComment = "warning"
typeCheckingMode = "strict"
reportPrivateUsage = "none"
Expand Down
3 changes: 2 additions & 1 deletion stubs/bs4/element.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ from typing import (
Literal,
NewType,
Protocol,
Self,
TypeAlias,
overload,
type_check_only,
)
from typing_extensions import Self, TypeVar
from typing_extensions import TypeVar

from . import BeautifulSoup
from .builder import TreeBuilder
Expand Down
3 changes: 1 addition & 2 deletions stubs/pendulum/date.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import date, timedelta
from typing import Literal, SupportsIndex, overload
from typing_extensions import Self
from typing import Literal, Self, SupportsIndex, overload

from .datetime import DateTime
from .mixins.default import FormattableMixin
Expand Down
3 changes: 1 addition & 2 deletions stubs/pendulum/datetime.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import date, datetime, time, timedelta, tzinfo
from typing import ClassVar, Literal, SupportsIndex
from typing_extensions import Self
from typing import ClassVar, Literal, Self, SupportsIndex

from .date import Date
from .period import Period
Expand Down
3 changes: 1 addition & 2 deletions stubs/pendulum/duration.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import timedelta
from typing import overload
from typing_extensions import Self
from typing import Self, overload

class Duration(timedelta):
def __new__(
Expand Down
3 changes: 1 addition & 2 deletions stubs/pendulum/period.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from collections.abc import Iterator
from datetime import date, timedelta
from typing import overload
from typing_extensions import Self
from typing import Self, overload

from .duration import Duration

Expand Down
3 changes: 1 addition & 2 deletions stubs/pendulum/time.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import time, timedelta, tzinfo
from typing import Literal, overload
from typing_extensions import Self
from typing import Literal, Self, overload

from .duration import AbsoluteDuration, Duration
from .mixins.default import FormattableMixin
Expand Down
6 changes: 3 additions & 3 deletions tests/db/test_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from datetime import datetime, time, timezone
from datetime import UTC, datetime, time

import pendulum
import pytest
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_process_bind_param(
[
(
True,
datetime(2020, 6, 26, 5, tzinfo=timezone.utc),
datetime(2020, 6, 26, 5, tzinfo=UTC),
pendulum.datetime(2020, 6, 26, 5, tz=pendulum.UTC),
),
(
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_process_bind_param(
'result_value,expected',
[
(
time(5, 30, 1, 2, tzinfo=timezone.utc),
time(5, 30, 1, 2, tzinfo=UTC),
pendulum.Time(5, 30, 1, 2, tzinfo=None),
),
(None, None),
Expand Down
Loading

0 comments on commit 937df53

Please sign in to comment.