From b623c392f3a5ff35fd0f21636840f1807c0489ec Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Mon, 27 Jul 2026 14:42:39 -0700 Subject: [PATCH] build: Rename types to core_types to avoid stdlib shadow This file could potentially shadow python's own types module, so rename it to core_types. --- revup/__main__.py | 4 ++-- revup/amend.py | 2 +- revup/cherry_pick.py | 2 +- revup/config.py | 2 +- revup/{types.py => core_types.py} | 0 revup/forge_utils.py | 2 +- revup/git.py | 2 +- revup/github/endpoint.py | 2 +- revup/github/github.py | 2 +- revup/restack.py | 12 ++++++------ revup/revup.py | 2 +- revup/toolkit.py | 2 +- revup/topic_stack.py | 4 ++-- revup/upload.py | 2 +- tests/git_env.py | 2 +- tests/test_amend.py | 2 +- tests/test_config.py | 2 +- tests/test_github.py | 2 +- tests/test_upload.py | 2 +- 19 files changed, 25 insertions(+), 25 deletions(-) rename revup/{types.py => core_types.py} (100%) diff --git a/revup/__main__.py b/revup/__main__.py index df40112..8c1104a 100644 --- a/revup/__main__.py +++ b/revup/__main__.py @@ -3,14 +3,14 @@ import logging import sys -from revup.revup import build_parser, main -from revup.types import ( +from revup.core_types import ( RevupConflictException, RevupForgeException, RevupRequestException, RevupShellException, RevupUsageException, ) +from revup.revup import build_parser, main def _main() -> None: diff --git a/revup/amend.py b/revup/amend.py index 944f8a8..ee3b20b 100644 --- a/revup/amend.py +++ b/revup/amend.py @@ -8,7 +8,7 @@ from typing import Dict, List, Set from revup import git, topic_stack -from revup.types import ( +from revup.core_types import ( CommitHeader, GitCommitHash, GitConflictException, diff --git a/revup/cherry_pick.py b/revup/cherry_pick.py index bf201a2..9f1d7c4 100644 --- a/revup/cherry_pick.py +++ b/revup/cherry_pick.py @@ -3,8 +3,8 @@ from typing import Tuple from revup import config, git +from revup.core_types import GitCommitHash, GitTreeHash, RevupUsageException from revup.forge_utils import RE_PR_URL, forge_connection, parse_pull_request_url -from revup.types import GitCommitHash, GitTreeHash, RevupUsageException async def resolve_pr_url( diff --git a/revup/config.py b/revup/config.py index 54a5525..77d495d 100644 --- a/revup/config.py +++ b/revup/config.py @@ -7,7 +7,7 @@ from argparse import _StoreAction, _StoreFalseAction, _StoreTrueAction from typing import Any, Dict, List, Optional, Tuple -from revup.types import RevupUsageException +from revup.core_types import RevupUsageException class RevupArgParser(argparse.ArgumentParser): diff --git a/revup/types.py b/revup/core_types.py similarity index 100% rename from revup/types.py rename to revup/core_types.py diff --git a/revup/forge_utils.py b/revup/forge_utils.py index 0d5ae5a..6792347 100644 --- a/revup/forge_utils.py +++ b/revup/forge_utils.py @@ -6,8 +6,8 @@ from typing import AsyncGenerator from revup import config, git, logs +from revup.core_types import RevupUsageException from revup.forge import Forge, ForgeRepoInfo, PullRequestParams -from revup.types import RevupUsageException RE_PR_URL = re.compile( r"^https://(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/pull/(?P[0-9]+)/?$" diff --git a/revup/git.py b/revup/git.py index a2f6f02..efc23cd 100644 --- a/revup/git.py +++ b/revup/git.py @@ -12,7 +12,7 @@ from async_lru import alru_cache as lru_cache from revup import shell -from revup.types import ( +from revup.core_types import ( CommitHeader, GitCommitHash, GitConflict, diff --git a/revup/github/endpoint.py b/revup/github/endpoint.py index f060047..1afbcfc 100644 --- a/revup/github/endpoint.py +++ b/revup/github/endpoint.py @@ -7,8 +7,8 @@ from aiohttp import ClientSession, ContentTypeError +from revup.core_types import RevupForgeException, RevupRequestException from revup.github.graphql import GraphqlResponse -from revup.types import RevupForgeException, RevupRequestException # HTTP statuses worth retrying: gateway/timeout (5xx) and secondary-rate-limit (403). TRANSIENT_STATUSES = frozenset({500, 502, 503, 504}) diff --git a/revup/github/github.py b/revup/github/github.py index 4fce78d..443e10c 100644 --- a/revup/github/github.py +++ b/revup/github/github.py @@ -1,6 +1,7 @@ import logging from typing import Any, Dict, List, Optional, Set, Tuple +from revup.core_types import RevupForgeException from revup.forge import ( MAX_COMMENTS_TO_QUERY, Forge, @@ -17,7 +18,6 @@ GraphqlQuery, GraphqlResponse, ) -from revup.types import RevupForgeException PR_FRAGMENT = f""" fragment PrResult on PullRequestConnection {{ diff --git a/revup/restack.py b/revup/restack.py index 654c9be..6d818b3 100644 --- a/revup/restack.py +++ b/revup/restack.py @@ -4,6 +4,12 @@ from typing import Dict, List, Optional, Set, Tuple from revup import git, topic_stack +from revup.core_types import ( + GitCommitHash, + GitConflictException, + GitTreeHash, + RevupConflictException, +) from revup.topic_stack import ( TAG_ASSIGNEE, TAG_BRANCH, @@ -18,12 +24,6 @@ TopicStack, add_tags, ) -from revup.types import ( - GitCommitHash, - GitConflictException, - GitTreeHash, - RevupConflictException, -) TAG_ORDER = [ TAG_TOPIC, diff --git a/revup/revup.py b/revup/revup.py index 2b1546d..7137f55 100755 --- a/revup/revup.py +++ b/revup/revup.py @@ -17,9 +17,9 @@ topic_completer, ) from revup.config import RevupArgParser +from revup.core_types import RevupUsageException from revup.forge_utils import parse_forge_info from revup.topic_stack import PrBodySource -from revup.types import RevupUsageException from revup.version import REVUP_VERSION REVUP_CONFIG_ENV_VAR = "REVUP_CONFIG_PATH" diff --git a/revup/toolkit.py b/revup/toolkit.py index 3f180de..c2370d2 100644 --- a/revup/toolkit.py +++ b/revup/toolkit.py @@ -2,8 +2,8 @@ import asyncio from revup import git +from revup.core_types import RevupUsageException from revup.topic_stack import TopicStack -from revup.types import RevupUsageException async def get_topics( diff --git a/revup/topic_stack.py b/revup/topic_stack.py index 69cc522..d114860 100644 --- a/revup/topic_stack.py +++ b/revup/topic_stack.py @@ -15,14 +15,14 @@ from rich.markup import escape from revup import git -from revup.forge import MAX_COMMENTS_TO_QUERY, Forge, PrComment, PrInfo, PrUpdate -from revup.types import ( +from revup.core_types import ( GitCommitHash, GitConflictException, GitTreeHash, RevupConflictException, RevupUsageException, ) +from revup.forge import MAX_COMMENTS_TO_QUERY, Forge, PrComment, PrInfo, PrUpdate # Since topic name is incorporated into the branch name, we must ensure that it matches # the character set that forges support. It's possible to have other characters if they're diff --git a/revup/upload.py b/revup/upload.py index c13562b..d9d5889 100644 --- a/revup/upload.py +++ b/revup/upload.py @@ -6,8 +6,8 @@ from rich import get_console from revup import git, topic_stack +from revup.core_types import RevupShellException from revup.forge import Forge -from revup.types import RevupShellException class UploadPhase(enum.Enum): diff --git a/tests/git_env.py b/tests/git_env.py index 630dd6f..7ecf2d2 100644 --- a/tests/git_env.py +++ b/tests/git_env.py @@ -6,7 +6,7 @@ from pathlib import Path from revup import git, shell -from revup.types import GitCommitHash +from revup.core_types import GitCommitHash TEST_AUTHOR_NAME = "Test Author" TEST_AUTHOR_EMAIL = "test@example.com" diff --git a/tests/test_amend.py b/tests/test_amend.py index 7706600..e73c80d 100644 --- a/tests/test_amend.py +++ b/tests/test_amend.py @@ -10,7 +10,7 @@ ) from revup import amend -from revup.types import RevupConflictException, RevupUsageException +from revup.core_types import RevupConflictException, RevupUsageException def make_amend_args(**kwargs): diff --git a/tests/test_config.py b/tests/test_config.py index 344109f..9fc92ae 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -8,7 +8,7 @@ import pytest from revup.config import Config, RevupArgParser, collect_known_keys, config_main -from revup.types import RevupUsageException +from revup.core_types import RevupUsageException def make_parsers(): diff --git a/tests/test_github.py b/tests/test_github.py index 4b46e44..324417b 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -7,11 +7,11 @@ import pytest +from revup.core_types import RevupForgeException, RevupRequestException from revup.forge import ForgeRepoInfo, PrComment, PrInfo, PrUpdate from revup.github.endpoint import GitHubEndpoint, _backoff_delay from revup.github.github import _MAX_STALLED_RETRIES, Github, _merge_data from revup.github.graphql import GraphqlResponse -from revup.types import RevupForgeException, RevupRequestException def gql(data, errors=None): diff --git a/tests/test_upload.py b/tests/test_upload.py index bf2d425..a3454bd 100644 --- a/tests/test_upload.py +++ b/tests/test_upload.py @@ -6,6 +6,7 @@ from fake_forge import FakeForge from git_env import GitTestEnvironment, async_test +from revup.core_types import RevupConflictException, RevupUsageException from revup.forge import PrInfo from revup.topic_stack import ( PrBodySource, @@ -14,7 +15,6 @@ TopicStack, format_remote_branch, ) -from revup.types import RevupConflictException, RevupUsageException def make_upload_args(**kwargs):