Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tags): import Self from typing for Python 3.11+ #1365

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions commitizen/tags.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations

import re
import sys
import warnings
from collections.abc import Sequence
from dataclasses import dataclass, field
from functools import cached_property
from string import Template
from typing import TYPE_CHECKING, NamedTuple

from typing_extensions import Self

from commitizen import out
from commitizen.defaults import DEFAULT_SETTINGS, Settings, get_tag_regexes
from commitizen.git import GitTag
Expand All @@ -24,6 +23,12 @@
if TYPE_CHECKING:
from commitizen.version_schemes import VersionScheme

# Self is Python 3.11+ but backported in typing-extensions
if sys.version_info < (3, 11):
from typing_extensions import Self
else:
from typing import Self


class VersionTag(NamedTuple):
"""Represent a version and its matching tag form."""
Expand Down
Loading