From 222c0a22ca78361638b28e1d01f8801008d220bb Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 21 Nov 2023 10:22:38 -0800 Subject: [PATCH] wow this took too long --- stripe/__init__.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stripe/__init__.py b/stripe/__init__.py index 7aeb0a0c6..6bc02c7f5 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -1,6 +1,6 @@ from typing_extensions import TYPE_CHECKING, Literal from typing import Optional -import sys +import sys as _sys import os # Stripe Python bindings @@ -18,6 +18,7 @@ if TYPE_CHECKING: from stripe.http_client import HTTPClient +_this_module = _sys.modules[__name__] api_key: Optional[str] = None client_id: Optional[str] = None api_base: str = "https://api.stripe.com" @@ -145,7 +146,7 @@ def set_app_info( # Python 3.7+ supports module level __getattr__ that allows us to lazy load deprecated modules # this matters because if we pre-load all modules from api_resources while suppressing warning # users will never see those warnings - if sys.version_info[:3] > (3, 6): + if _sys.version_info[:2] >= (3, 7): def __getattr__(name): if name == "abstract": @@ -161,11 +162,8 @@ def __getattr__(name): with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) - import stripe.api_resources.abstract as _abstract - import stripe.api_resources as _api_resources - - globals()["abstract"] = _abstract - globals()["api_resources"] = _api_resources + import stripe.api_resources.abstract as abstract + import stripe.api_resources as api_resources # API resources