From c6375f7bf74a99c7c4e6264fff31921cb8e3f142 Mon Sep 17 00:00:00 2001 From: Pablo Estevez Date: Sun, 1 Feb 2026 11:34:21 +0000 Subject: [PATCH 1/2] remove unused imports --- braintree/account_updater_daily_report.py | 1 - braintree/ach_mandate.py | 2 -- braintree/add_on_gateway.py | 1 - braintree/address.py | 2 -- braintree/address_gateway.py | 1 - braintree/apple_pay_gateway.py | 1 - braintree/blik_alias.py | 1 - braintree/client_token.py | 6 ------ braintree/client_token_gateway.py | 1 - braintree/credentials_parser.py | 3 --- braintree/credit_card.py | 1 - braintree/credit_card_gateway.py | 1 - braintree/credit_card_verification.py | 2 +- braintree/customer.py | 7 ------- braintree/customer_gateway.py | 1 - braintree/customer_session_gateway.py | 4 ---- braintree/discount_gateway.py | 1 - braintree/dispute_gateway.py | 3 --- braintree/document_upload.py | 2 -- braintree/document_upload_gateway.py | 1 - braintree/environment.py | 2 +- braintree/europe_bank_account.py | 2 -- braintree/exchange_rate_quote.py | 1 - .../inputs/customer_recommendations_input.py | 1 - .../types/customer_recommendations_payload.py | 2 +- braintree/local_payment.py | 1 - braintree/merchant_account_gateway.py | 2 -- braintree/merchant_gateway.py | 3 --- braintree/meta_checkout_card.py | 2 -- braintree/meta_checkout_token.py | 2 -- braintree/oauth_gateway.py | 3 --- braintree/package_details.py | 1 - braintree/paginated_collection.py | 1 - braintree/partner_merchant.py | 1 - braintree/payment_method.py | 1 - braintree/payment_method_gateway.py | 21 ++----------------- braintree/payment_method_nonce.py | 7 +++---- braintree/payment_method_nonce_gateway.py | 2 -- braintree/payment_method_parser.py | 2 -- braintree/paypal_account_gateway.py | 1 - braintree/paypal_here.py | 1 - braintree/paypal_payment_resource.py | 1 - braintree/paypal_payment_resource_gateway.py | 1 - braintree/plan.py | 5 ----- braintree/plan_gateway.py | 2 -- braintree/resource.py | 2 -- braintree/resource_collection.py | 3 +-- .../sepa_direct_debit_account_gateway.py | 3 --- braintree/settlement_batch_summary.py | 7 ------- braintree/settlement_batch_summary_gateway.py | 2 -- braintree/signature_service.py | 1 - braintree/subscription.py | 7 ------- braintree/subscription_gateway.py | 1 - braintree/transaction.py | 10 +-------- braintree/transaction_line_item.py | 3 --- braintree/transaction_line_item_gateway.py | 3 --- braintree/unknown_payment_method.py | 1 - braintree/us_bank_account.py | 3 +-- braintree/us_bank_account_gateway.py | 1 - .../us_bank_account_verification_search.py | 1 - braintree/util/crypto.py | 1 - braintree/util/generator.py | 1 - braintree/util/http.py | 1 - braintree/util/parser.py | 1 - braintree/webhook_notification.py | 1 - braintree/webhook_notification_gateway.py | 2 -- braintree/webhook_testing.py | 1 - braintree/webhook_testing_gateway.py | 1 - .../test_bank_account_instant_verification.py | 1 - tests/integration/test_braintree_gateway.py | 1 - tests/integration/test_client_token.py | 4 ---- tests/integration/test_credentials_parser.py | 1 - .../test_customer_session_gateway.py | 2 -- tests/integration/test_disputes.py | 2 -- tests/integration/test_document_upload.py | 1 - tests/integration/test_merchant.py | 1 - tests/integration/test_oauth.py | 2 -- tests/integration/test_package_tracking.py | 1 - .../test_paypal_payment_resource.py | 3 --- .../test_sepa_direct_debit_account.py | 1 - tests/integration/test_test_helper.py | 1 - .../test_transaction_payment_facilitator.py | 6 ------ tests/integration/test_transaction_search.py | 1 - .../integration/test_transaction_transfer.py | 3 --- .../test_transaction_transfer_sdwo.py | 6 ------ tests/test_helper.py | 6 +----- ...nk_account_instant_verification_gateway.py | 5 +---- tests/unit/test_configuration.py | 1 - tests/unit/test_customer_session_gateway.py | 10 +-------- tests/unit/test_oauth_access_revocation.py | 1 - tests/unit/test_payment_method_parser.py | 1 - .../test_paypal_payment_resource_gateway.py | 3 +-- tests/unit/test_transaction.py | 1 - tests/unit/test_transaction_transfer.py | 8 ------- 94 files changed, 15 insertions(+), 225 deletions(-) diff --git a/braintree/account_updater_daily_report.py b/braintree/account_updater_daily_report.py index bcac914d..456ec218 100644 --- a/braintree/account_updater_daily_report.py +++ b/braintree/account_updater_daily_report.py @@ -1,4 +1,3 @@ -from braintree.configuration import Configuration from braintree.resource import Resource class AccountUpdaterDailyReport(Resource): diff --git a/braintree/ach_mandate.py b/braintree/ach_mandate.py index 96de85bc..724266d4 100644 --- a/braintree/ach_mandate.py +++ b/braintree/ach_mandate.py @@ -1,5 +1,3 @@ -import braintree -from braintree.util.datetime_parser import parse_datetime from braintree.resource import Resource class AchMandate(Resource): diff --git a/braintree/add_on_gateway.py b/braintree/add_on_gateway.py index 9146cef2..c4838a66 100644 --- a/braintree/add_on_gateway.py +++ b/braintree/add_on_gateway.py @@ -1,4 +1,3 @@ -import braintree from braintree.add_on import AddOn from braintree.resource_collection import ResourceCollection diff --git a/braintree/address.py b/braintree/address.py index 0187ea44..e07590e5 100644 --- a/braintree/address.py +++ b/braintree/address.py @@ -1,5 +1,3 @@ -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/address_gateway.py b/braintree/address_gateway.py index 7eeabdf3..87fa47ce 100644 --- a/braintree/address_gateway.py +++ b/braintree/address_gateway.py @@ -1,5 +1,4 @@ import re -import braintree from braintree.address import Address from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/apple_pay_gateway.py b/braintree/apple_pay_gateway.py index 2346780c..4eba8b14 100644 --- a/braintree/apple_pay_gateway.py +++ b/braintree/apple_pay_gateway.py @@ -2,7 +2,6 @@ from braintree.apple_pay_options import ApplePayOptions from braintree.error_result import ErrorResult from braintree.successful_result import SuccessfulResult -from braintree.exceptions.unexpected_error import UnexpectedError class ApplePayGateway(object): def __init__(self, gateway): diff --git a/braintree/blik_alias.py b/braintree/blik_alias.py index c74bee9a..deb58bc3 100644 --- a/braintree/blik_alias.py +++ b/braintree/blik_alias.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource diff --git a/braintree/client_token.py b/braintree/client_token.py index 0822190d..f82676f8 100644 --- a/braintree/client_token.py +++ b/braintree/client_token.py @@ -1,10 +1,4 @@ -import datetime -import json -import urllib from braintree.configuration import Configuration -from braintree.signature_service import SignatureService -from braintree.util.crypto import Crypto -from braintree import exceptions class ClientToken(object): diff --git a/braintree/client_token_gateway.py b/braintree/client_token_gateway.py index 820f77d9..a487ce4b 100644 --- a/braintree/client_token_gateway.py +++ b/braintree/client_token_gateway.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource from braintree.client_token import ClientToken from braintree import exceptions diff --git a/braintree/credentials_parser.py b/braintree/credentials_parser.py index acc19c58..2d513b10 100644 --- a/braintree/credentials_parser.py +++ b/braintree/credentials_parser.py @@ -1,6 +1,3 @@ -import os -import sys -import braintree from braintree.exceptions.configuration_error import ConfigurationError from braintree.environment import Environment diff --git a/braintree/credit_card.py b/braintree/credit_card.py index b7a9f911..4d1264e9 100644 --- a/braintree/credit_card.py +++ b/braintree/credit_card.py @@ -1,5 +1,4 @@ import braintree -import warnings from braintree.resource import Resource from braintree.address import Address from braintree.configuration import Configuration diff --git a/braintree/credit_card_gateway.py b/braintree/credit_card_gateway.py index 673d33e2..9fcbcfa6 100644 --- a/braintree/credit_card_gateway.py +++ b/braintree/credit_card_gateway.py @@ -1,4 +1,3 @@ -import braintree import warnings from braintree.credit_card import CreditCard from braintree.error_result import ErrorResult diff --git a/braintree/credit_card_verification.py b/braintree/credit_card_verification.py index be0a0347..0b5e8da8 100644 --- a/braintree/credit_card_verification.py +++ b/braintree/credit_card_verification.py @@ -49,7 +49,7 @@ def __init__(self, gateway, attributes): else: self.risk_data = None - if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: + if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None diff --git a/braintree/customer.py b/braintree/customer.py index 9d1c1267..1d1cb838 100644 --- a/braintree/customer.py +++ b/braintree/customer.py @@ -1,7 +1,3 @@ -import warnings -from braintree.util.http import Http -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult from braintree.resource import Resource from braintree.apple_pay_card import ApplePayCard from braintree.android_pay_card import AndroidPayCard @@ -16,9 +12,6 @@ from braintree.masterpass_card import MasterpassCard from braintree.address import Address from braintree.configuration import Configuration -from braintree.ids_search import IdsSearch -from braintree.exceptions.not_found_error import NotFoundError -from braintree.resource_collection import ResourceCollection # NEXT_MAJOR_VERSION remove SamsungPayCard from braintree.samsung_pay_card import SamsungPayCard diff --git a/braintree/customer_gateway.py b/braintree/customer_gateway.py index 3c494ea0..64bfca74 100644 --- a/braintree/customer_gateway.py +++ b/braintree/customer_gateway.py @@ -3,7 +3,6 @@ from braintree.customer import Customer from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError -from braintree.ids_search import IdsSearch from braintree.resource import Resource from braintree.resource_collection import ResourceCollection from braintree.successful_result import SuccessfulResult diff --git a/braintree/customer_session_gateway.py b/braintree/customer_session_gateway.py index d550aca8..b267220c 100644 --- a/braintree/customer_session_gateway.py +++ b/braintree/customer_session_gateway.py @@ -1,5 +1,4 @@ from typing import Dict -import braintree from braintree.error_result import ErrorResult from braintree.exceptions.unexpected_error import UnexpectedError from braintree.successful_result import SuccessfulResult @@ -7,11 +6,8 @@ from braintree.graphql import ( CreateCustomerSessionInput, UpdateCustomerSessionInput, - CustomerRecommendations, CustomerRecommendationsInput, CustomerRecommendationsPayload, - RecommendedPaymentOption, - PaymentOptions, ) class CustomerSessionGateway: diff --git a/braintree/discount_gateway.py b/braintree/discount_gateway.py index 8973b903..10806582 100644 --- a/braintree/discount_gateway.py +++ b/braintree/discount_gateway.py @@ -1,4 +1,3 @@ -import braintree from braintree.discount import Discount from braintree.resource_collection import ResourceCollection diff --git a/braintree/dispute_gateway.py b/braintree/dispute_gateway.py index 902dcf15..29401145 100644 --- a/braintree/dispute_gateway.py +++ b/braintree/dispute_gateway.py @@ -1,6 +1,3 @@ -import braintree -import re -import warnings from braintree.dispute import Dispute from braintree.dispute_details import DisputeEvidence from braintree.error_result import ErrorResult diff --git a/braintree/document_upload.py b/braintree/document_upload.py index 55b794f6..2f508885 100644 --- a/braintree/document_upload.py +++ b/braintree/document_upload.py @@ -1,5 +1,3 @@ -import mimetypes -from braintree.successful_result import SuccessfulResult from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/document_upload_gateway.py b/braintree/document_upload_gateway.py index ddfcd543..c888a286 100644 --- a/braintree/document_upload_gateway.py +++ b/braintree/document_upload_gateway.py @@ -1,4 +1,3 @@ -import braintree import mimetypes from braintree.document_upload import DocumentUpload from braintree.error_result import ErrorResult diff --git a/braintree/environment.py b/braintree/environment.py index 7016780e..1f986d04 100644 --- a/braintree/environment.py +++ b/braintree/environment.py @@ -64,7 +64,7 @@ def parse_environment(environment): return environment try: return Environment.All[environment] - except KeyError as e: + except KeyError: raise ConfigurationError("Unable to process supplied environment") @staticmethod diff --git a/braintree/europe_bank_account.py b/braintree/europe_bank_account.py index 331755db..5255a7dc 100644 --- a/braintree/europe_bank_account.py +++ b/braintree/europe_bank_account.py @@ -1,6 +1,4 @@ -import braintree from braintree.resource import Resource -from braintree.configuration import Configuration #NEXT_MAJOR_VERSION this was specific to iDEAL integrations and can be removed class EuropeBankAccount(Resource): diff --git a/braintree/exchange_rate_quote.py b/braintree/exchange_rate_quote.py index d314e643..f41607ec 100644 --- a/braintree/exchange_rate_quote.py +++ b/braintree/exchange_rate_quote.py @@ -1,5 +1,4 @@ from braintree.attribute_getter import AttributeGetter -from braintree.monetary_amount import MonetaryAmount class ExchangeRateQuote(AttributeGetter): def __init__(self,attributes): diff --git a/braintree/graphql/inputs/customer_recommendations_input.py b/braintree/graphql/inputs/customer_recommendations_input.py index ac9c4530..9e89d4c6 100644 --- a/braintree/graphql/inputs/customer_recommendations_input.py +++ b/braintree/graphql/inputs/customer_recommendations_input.py @@ -1,7 +1,6 @@ from typing import List, Dict from braintree.graphql.inputs.customer_session_input import CustomerSessionInput from braintree.graphql.inputs.paypal_purchase_unit_input import PayPalPurchaseUnitInput -from braintree.graphql.enums.recommendations import Recommendations from braintree.util.experimental import Experimental @Experimental diff --git a/braintree/graphql/types/customer_recommendations_payload.py b/braintree/graphql/types/customer_recommendations_payload.py index b00e6e10..87bb8a3d 100644 --- a/braintree/graphql/types/customer_recommendations_payload.py +++ b/braintree/graphql/types/customer_recommendations_payload.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Any, Optional +from typing import Dict, Any from braintree.exceptions.server_error import ServerError from braintree.graphql.enums.recommended_payment_option import RecommendedPaymentOption from braintree.graphql.unions.customer_recommendations import CustomerRecommendations diff --git a/braintree/local_payment.py b/braintree/local_payment.py index 4985af29..933e7cb6 100644 --- a/braintree/local_payment.py +++ b/braintree/local_payment.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource class LocalPayment(Resource): diff --git a/braintree/merchant_account_gateway.py b/braintree/merchant_account_gateway.py index c3c5b545..37357b05 100644 --- a/braintree/merchant_account_gateway.py +++ b/braintree/merchant_account_gateway.py @@ -1,9 +1,7 @@ -import warnings from braintree.error_result import ErrorResult from braintree.merchant_account import MerchantAccount from braintree.paginated_collection import PaginatedCollection from braintree.paginated_result import PaginatedResult -from braintree.resource import Resource from braintree.resource_collection import ResourceCollection from braintree.successful_result import SuccessfulResult from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/merchant_gateway.py b/braintree/merchant_gateway.py index 66d0b154..6e955eb0 100644 --- a/braintree/merchant_gateway.py +++ b/braintree/merchant_gateway.py @@ -1,8 +1,5 @@ from braintree.error_result import ErrorResult -from braintree.resource import Resource -from braintree.resource_collection import ResourceCollection from braintree.successful_result import SuccessfulResult -from braintree.exceptions.not_found_error import NotFoundError from braintree.merchant import Merchant from braintree.oauth_credentials import OAuthCredentials diff --git a/braintree/meta_checkout_card.py b/braintree/meta_checkout_card.py index 25b8b8e8..e698ebc5 100644 --- a/braintree/meta_checkout_card.py +++ b/braintree/meta_checkout_card.py @@ -1,5 +1,3 @@ -import braintree -from braintree.address import Address from braintree.resource import Resource class MetaCheckoutCard(Resource): diff --git a/braintree/meta_checkout_token.py b/braintree/meta_checkout_token.py index 16419ea8..9ee3c93e 100644 --- a/braintree/meta_checkout_token.py +++ b/braintree/meta_checkout_token.py @@ -1,5 +1,3 @@ -import braintree -from braintree.address import Address from braintree.resource import Resource class MetaCheckoutToken(Resource): diff --git a/braintree/oauth_gateway.py b/braintree/oauth_gateway.py index 5b6b25c2..314fb49e 100644 --- a/braintree/oauth_gateway.py +++ b/braintree/oauth_gateway.py @@ -1,10 +1,7 @@ -import braintree from braintree.error_result import ErrorResult from braintree.successful_result import SuccessfulResult -from braintree.exceptions.not_found_error import NotFoundError from braintree.oauth_credentials import OAuthCredentials -import sys from urllib.parse import quote_plus from functools import reduce diff --git a/braintree/package_details.py b/braintree/package_details.py index cf2bb70d..da01ed59 100644 --- a/braintree/package_details.py +++ b/braintree/package_details.py @@ -1,5 +1,4 @@ from braintree.attribute_getter import AttributeGetter -from warnings import warn class PackageDetails(AttributeGetter): """ diff --git a/braintree/paginated_collection.py b/braintree/paginated_collection.py index 75a35a4a..deaaf6f1 100644 --- a/braintree/paginated_collection.py +++ b/braintree/paginated_collection.py @@ -1,4 +1,3 @@ -import braintree class PaginatedCollection(object): """ diff --git a/braintree/partner_merchant.py b/braintree/partner_merchant.py index f105cb1d..32033e2d 100644 --- a/braintree/partner_merchant.py +++ b/braintree/partner_merchant.py @@ -1,4 +1,3 @@ -from braintree.configuration import Configuration from braintree.resource import Resource class PartnerMerchant(Resource): diff --git a/braintree/payment_method.py b/braintree/payment_method.py index ee81d969..f1aa7dcc 100644 --- a/braintree/payment_method.py +++ b/braintree/payment_method.py @@ -1,4 +1,3 @@ -import braintree from braintree.address import Address from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/payment_method_gateway.py b/braintree/payment_method_gateway.py index a6097aba..8f438aad 100644 --- a/braintree/payment_method_gateway.py +++ b/braintree/payment_method_gateway.py @@ -1,31 +1,14 @@ -import braintree -from braintree.apple_pay_card import ApplePayCard -from braintree.credit_card import CreditCard from braintree.payment_method import PaymentMethod -from braintree.paypal_account import PayPalAccount -from braintree.europe_bank_account import EuropeBankAccount -from braintree.android_pay_card import AndroidPayCard # NEXT_MAJOR_VERSION remove amex express checkout -from braintree.amex_express_checkout_card import AmexExpressCheckoutCard -from braintree.sepa_direct_debit_account import SepaDirectDebitAccount -from braintree.venmo_account import VenmoAccount -from braintree.us_bank_account import UsBankAccount -from braintree.visa_checkout_card import VisaCheckoutCard # NEXT_MAJOR_VERSION remove masterpass -from braintree.masterpass_card import MasterpassCard # NEXT_MAJOR_VERSION remove SamsungPayCard -from braintree.samsung_pay_card import SamsungPayCard -from braintree.unknown_payment_method import UnknownPaymentMethod from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError -from braintree.ids_search import IdsSearch from braintree.payment_method_nonce import PaymentMethodNonce from braintree.payment_method_parser import parse_payment_method from braintree.resource import Resource -from braintree.resource_collection import ResourceCollection from braintree.successful_result import SuccessfulResult -import sys from urllib.parse import urlencode @@ -38,7 +21,7 @@ def create(self, params=None): if params is None: params = {} Resource.verify_keys(params, PaymentMethod.create_signature()) - self.__check_for_deprecated_attributes(params); + self.__check_for_deprecated_attributes(params) return self._post("/payment_methods", {"payment_method": params}) def find(self, payment_method_token): @@ -53,7 +36,7 @@ def find(self, payment_method_token): def update(self, payment_method_token, params): Resource.verify_keys(params, PaymentMethod.update_signature()) - self.__check_for_deprecated_attributes(params); + self.__check_for_deprecated_attributes(params) try: if payment_method_token is None or payment_method_token.strip() == "": raise NotFoundError() diff --git a/braintree/payment_method_nonce.py b/braintree/payment_method_nonce.py index 9402999c..d441d8aa 100644 --- a/braintree/payment_method_nonce.py +++ b/braintree/payment_method_nonce.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource from braintree.configuration import Configuration from braintree.three_d_secure_info import ThreeDSecureInfo @@ -16,17 +15,17 @@ def find(payment_method_nonce): def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) - if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: + if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None - if "authentication_insight" in attributes and not attributes["authentication_insight"] is None: + if "authentication_insight" in attributes and attributes["authentication_insight"] is not None: self.authentication_insight = attributes["authentication_insight"] else: self.authentication_insight = None - if "bin_data" in attributes and not attributes["bin_data"] is None: + if "bin_data" in attributes and attributes["bin_data"] is not None: self.bin_data = BinData(attributes["bin_data"]) else: self.bin_data = None diff --git a/braintree/payment_method_nonce_gateway.py b/braintree/payment_method_nonce_gateway.py index be0e0fe5..39ae254f 100644 --- a/braintree/payment_method_nonce_gateway.py +++ b/braintree/payment_method_nonce_gateway.py @@ -1,10 +1,8 @@ -import braintree from braintree.payment_method_nonce import PaymentMethodNonce from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError from braintree.resource import Resource -from braintree.resource_collection import ResourceCollection from braintree.successful_result import SuccessfulResult class PaymentMethodNonceGateway(object): diff --git a/braintree/payment_method_parser.py b/braintree/payment_method_parser.py index 48b0dff9..3ba575cc 100644 --- a/braintree/payment_method_parser.py +++ b/braintree/payment_method_parser.py @@ -1,7 +1,5 @@ -import braintree from braintree.apple_pay_card import ApplePayCard from braintree.credit_card import CreditCard -from braintree.payment_method import PaymentMethod from braintree.paypal_account import PayPalAccount from braintree.europe_bank_account import EuropeBankAccount from braintree.android_pay_card import AndroidPayCard diff --git a/braintree/paypal_account_gateway.py b/braintree/paypal_account_gateway.py index cd748aff..09de9567 100644 --- a/braintree/paypal_account_gateway.py +++ b/braintree/paypal_account_gateway.py @@ -1,4 +1,3 @@ -import braintree from braintree.paypal_account import PayPalAccount from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/paypal_here.py b/braintree/paypal_here.py index 1e4eb008..5b4d47ce 100644 --- a/braintree/paypal_here.py +++ b/braintree/paypal_here.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource class PayPalHere(Resource): diff --git a/braintree/paypal_payment_resource.py b/braintree/paypal_payment_resource.py index d338879b..367a3b6c 100644 --- a/braintree/paypal_payment_resource.py +++ b/braintree/paypal_payment_resource.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/paypal_payment_resource_gateway.py b/braintree/paypal_payment_resource_gateway.py index 926ba60d..d3a71004 100644 --- a/braintree/paypal_payment_resource_gateway.py +++ b/braintree/paypal_payment_resource_gateway.py @@ -1,7 +1,6 @@ from braintree.resource import Resource from braintree.paypal_payment_resource import PayPalPaymentResource from braintree.payment_method_nonce import PaymentMethodNonce -from braintree.util.xml_util import XmlUtil from braintree.error_result import ErrorResult from braintree.successful_result import SuccessfulResult from braintree.exceptions.unexpected_error import UnexpectedError diff --git a/braintree/plan.py b/braintree/plan.py index 5366f699..ef372779 100644 --- a/braintree/plan.py +++ b/braintree/plan.py @@ -1,12 +1,7 @@ -from braintree.util.http import Http -import braintree from braintree.add_on import AddOn from braintree.configuration import Configuration from braintree.discount import Discount -from braintree.resource_collection import ResourceCollection from braintree.resource import Resource -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult class Plan(Resource): diff --git a/braintree/plan_gateway.py b/braintree/plan_gateway.py index 2cbf432c..f4ee7e14 100644 --- a/braintree/plan_gateway.py +++ b/braintree/plan_gateway.py @@ -1,5 +1,3 @@ -import re -import braintree from braintree.plan import Plan from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/resource.py b/braintree/resource.py index 4ce6af5b..85097147 100644 --- a/braintree/resource.py +++ b/braintree/resource.py @@ -1,6 +1,4 @@ import re -import string -import sys from braintree.attribute_getter import AttributeGetter text_type = str diff --git a/braintree/resource_collection.py b/braintree/resource_collection.py index 469fe9a3..18343878 100644 --- a/braintree/resource_collection.py +++ b/braintree/resource_collection.py @@ -1,4 +1,3 @@ -import braintree from braintree.exceptions.unexpected_error import UnexpectedError class ResourceCollection(object): @@ -53,7 +52,7 @@ def __batch_ids(self): @staticmethod def _extract_as_array(results, attribute): - if not attribute in results: + if attribute not in results: return [] value = results[attribute] diff --git a/braintree/sepa_direct_debit_account_gateway.py b/braintree/sepa_direct_debit_account_gateway.py index 3c3d2d9f..ef1ae68b 100644 --- a/braintree/sepa_direct_debit_account_gateway.py +++ b/braintree/sepa_direct_debit_account_gateway.py @@ -1,8 +1,5 @@ -import braintree from braintree.sepa_direct_debit_account import SepaDirectDebitAccount -from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError -from braintree.resource import Resource from braintree.successful_result import SuccessfulResult diff --git a/braintree/settlement_batch_summary.py b/braintree/settlement_batch_summary.py index bf0ad0ac..71c0b536 100644 --- a/braintree/settlement_batch_summary.py +++ b/braintree/settlement_batch_summary.py @@ -1,10 +1,3 @@ -from braintree.util.http import Http -import braintree -import warnings -from braintree.exceptions.not_found_error import NotFoundError -from braintree.resource_collection import ResourceCollection -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/settlement_batch_summary_gateway.py b/braintree/settlement_batch_summary_gateway.py index 43af4515..66516668 100644 --- a/braintree/settlement_batch_summary_gateway.py +++ b/braintree/settlement_batch_summary_gateway.py @@ -1,5 +1,3 @@ -import braintree -from braintree.resource import Resource from braintree.settlement_batch_summary import SettlementBatchSummary from braintree.successful_result import SuccessfulResult from braintree.error_result import ErrorResult diff --git a/braintree/signature_service.py b/braintree/signature_service.py index a5bf46e7..f19fba8a 100644 --- a/braintree/signature_service.py +++ b/braintree/signature_service.py @@ -1,4 +1,3 @@ -import urllib from braintree.util.crypto import Crypto class SignatureService(object): diff --git a/braintree/subscription.py b/braintree/subscription.py index 4ba61d74..4fc8d364 100644 --- a/braintree/subscription.py +++ b/braintree/subscription.py @@ -1,15 +1,8 @@ from decimal import Decimal -from braintree.util.http import Http -import braintree -import warnings from braintree.add_on import AddOn from braintree.descriptor import Descriptor from braintree.discount import Discount -from braintree.exceptions.not_found_error import NotFoundError -from braintree.resource_collection import ResourceCollection from braintree.subscription_status_event import SubscriptionStatusEvent -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult from braintree.transaction import Transaction from braintree.resource import Resource from braintree.configuration import Configuration diff --git a/braintree/subscription_gateway.py b/braintree/subscription_gateway.py index 34a33a33..7046c229 100644 --- a/braintree/subscription_gateway.py +++ b/braintree/subscription_gateway.py @@ -1,4 +1,3 @@ -import re import braintree from braintree.subscription import Subscription from braintree.error_result import ErrorResult diff --git a/braintree/transaction.py b/braintree/transaction.py index 2bc14758..36cc8de7 100644 --- a/braintree/transaction.py +++ b/braintree/transaction.py @@ -1,4 +1,3 @@ -import braintree import warnings from decimal import Decimal from braintree.add_on import AddOn @@ -14,31 +13,24 @@ from braintree.disbursement_detail import DisbursementDetail from braintree.discount import Discount from braintree.dispute import Dispute -from braintree.error_result import ErrorResult from braintree.europe_bank_account import EuropeBankAccount -from braintree.exceptions.not_found_error import NotFoundError from braintree.facilitated_details import FacilitatedDetails from braintree.facilitator_details import FacilitatorDetails -from braintree.liability_shift import LiabilityShift from braintree.local_payment import LocalPayment from braintree.masterpass_card import MasterpassCard from braintree.meta_checkout_card import MetaCheckoutCard from braintree.meta_checkout_token import MetaCheckoutToken from braintree.payment_facilitator import PaymentFacilitator -from braintree.payment_instrument_type import PaymentInstrumentType from braintree.paypal_account import PayPalAccount from braintree.paypal_here import PayPalHere from braintree.resource import Resource -from braintree.resource_collection import ResourceCollection from braintree.risk_data import RiskData from braintree.samsung_pay_card import SamsungPayCard from braintree.sepa_direct_debit_account import SepaDirectDebitAccount from braintree.package_details import PackageDetails from braintree.status_event import StatusEvent from braintree.subscription_details import SubscriptionDetails -from braintree.successful_result import SuccessfulResult from braintree.three_d_secure_info import ThreeDSecureInfo -from braintree.transaction_line_item import TransactionLineItem from braintree.transfer import Transfer from braintree.us_bank_account import UsBankAccount from braintree.venmo_account import VenmoAccount @@ -911,7 +903,7 @@ def __init__(self, gateway, attributes): self.risk_data = RiskData(attributes["risk_data"]) else: self.risk_data = None - if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: + if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None diff --git a/braintree/transaction_line_item.py b/braintree/transaction_line_item.py index 3e58ce94..8e1cae83 100644 --- a/braintree/transaction_line_item.py +++ b/braintree/transaction_line_item.py @@ -1,8 +1,5 @@ -import braintree -import warnings from braintree.attribute_getter import AttributeGetter -from braintree.resource import Resource from braintree.configuration import Configuration class TransactionLineItem(AttributeGetter): diff --git a/braintree/transaction_line_item_gateway.py b/braintree/transaction_line_item_gateway.py index 670ada45..23a89b7a 100644 --- a/braintree/transaction_line_item_gateway.py +++ b/braintree/transaction_line_item_gateway.py @@ -1,6 +1,3 @@ -import braintree -from braintree.error_result import ErrorResult -from braintree.resource import Resource from braintree.resource_collection import ResourceCollection from braintree.transaction_line_item import TransactionLineItem from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/unknown_payment_method.py b/braintree/unknown_payment_method.py index f1f8273b..1e420ea1 100644 --- a/braintree/unknown_payment_method.py +++ b/braintree/unknown_payment_method.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource class UnknownPaymentMethod(Resource): diff --git a/braintree/us_bank_account.py b/braintree/us_bank_account.py index 7574a761..e75f0ef8 100644 --- a/braintree/us_bank_account.py +++ b/braintree/us_bank_account.py @@ -1,4 +1,3 @@ -import braintree from braintree.resource import Resource from braintree.configuration import Configuration from braintree.ach_mandate import AchMandate @@ -13,7 +12,7 @@ def find(token): @staticmethod def sale(token, transactionRequest): transactionRequest["payment_method_token"] = token - if not "options" in transactionRequest: + if "options" not in transactionRequest: transactionRequest["options"] = {} transactionRequest["options"]["submit_for_settlement"] = True return Configuration.gateway().transaction.sale(transactionRequest) diff --git a/braintree/us_bank_account_gateway.py b/braintree/us_bank_account_gateway.py index 5e7a7622..a2b51833 100644 --- a/braintree/us_bank_account_gateway.py +++ b/braintree/us_bank_account_gateway.py @@ -1,4 +1,3 @@ -import braintree from braintree.us_bank_account import UsBankAccount from braintree.exceptions.not_found_error import NotFoundError diff --git a/braintree/us_bank_account_verification_search.py b/braintree/us_bank_account_verification_search.py index c97dd98c..295bad63 100644 --- a/braintree/us_bank_account_verification_search.py +++ b/braintree/us_bank_account_verification_search.py @@ -1,4 +1,3 @@ -from braintree.us_bank_account import UsBankAccount from braintree.us_bank_account_verification import UsBankAccountVerification from braintree.search import Search from braintree.util import Constants diff --git a/braintree/util/crypto.py b/braintree/util/crypto.py index fa275259..2b563132 100644 --- a/braintree/util/crypto.py +++ b/braintree/util/crypto.py @@ -1,6 +1,5 @@ import hashlib import hmac -import sys text_type = str diff --git a/braintree/util/generator.py b/braintree/util/generator.py index b7b68eca..18206aaa 100644 --- a/braintree/util/generator.py +++ b/braintree/util/generator.py @@ -1,5 +1,4 @@ import datetime -import sys from decimal import Decimal integer_types = int diff --git a/braintree/util/http.py b/braintree/util/http.py index 131b36dd..1070d865 100644 --- a/braintree/util/http.py +++ b/braintree/util/http.py @@ -1,4 +1,3 @@ -import sys import requests from base64 import encodebytes import json diff --git a/braintree/util/parser.py b/braintree/util/parser.py index 1bbd0fbb..20d2cc1a 100644 --- a/braintree/util/parser.py +++ b/braintree/util/parser.py @@ -2,7 +2,6 @@ from datetime import datetime from braintree.util.datetime_parser import parse_datetime import re -import sys binary_type = bytes diff --git a/braintree/webhook_notification.py b/braintree/webhook_notification.py index 48b65989..635fa412 100644 --- a/braintree/webhook_notification.py +++ b/braintree/webhook_notification.py @@ -4,7 +4,6 @@ from braintree.connected_merchant_status_transitioned import ConnectedMerchantStatusTransitioned from braintree.disbursement import Disbursement from braintree.dispute import Dispute -from braintree.error_result import ErrorResult from braintree.granted_payment_instrument_update import GrantedPaymentInstrumentUpdate from braintree.local_payment_completed import LocalPaymentCompleted from braintree.local_payment_expired import LocalPaymentExpired diff --git a/braintree/webhook_notification_gateway.py b/braintree/webhook_notification_gateway.py index 20fb2976..44f4796e 100644 --- a/braintree/webhook_notification_gateway.py +++ b/braintree/webhook_notification_gateway.py @@ -1,7 +1,5 @@ import re -import sys from base64 import decodebytes -import sys from braintree.exceptions.invalid_signature_error import InvalidSignatureError from braintree.exceptions.invalid_challenge_error import InvalidChallengeError from braintree.util.crypto import Crypto diff --git a/braintree/webhook_testing.py b/braintree/webhook_testing.py index 36b4376c..e90923cc 100644 --- a/braintree/webhook_testing.py +++ b/braintree/webhook_testing.py @@ -1,4 +1,3 @@ -import braintree from braintree.configuration import Configuration class WebhookTesting(object): diff --git a/braintree/webhook_testing_gateway.py b/braintree/webhook_testing_gateway.py index 4a8a16bb..c2eb8c43 100644 --- a/braintree/webhook_testing_gateway.py +++ b/braintree/webhook_testing_gateway.py @@ -1,6 +1,5 @@ from braintree.util.crypto import Crypto from braintree.webhook_notification import WebhookNotification -import sys from base64 import encodebytes from datetime import datetime diff --git a/tests/integration/test_bank_account_instant_verification.py b/tests/integration/test_bank_account_instant_verification.py index e2112ef6..a3dd0daf 100644 --- a/tests/integration/test_bank_account_instant_verification.py +++ b/tests/integration/test_bank_account_instant_verification.py @@ -2,7 +2,6 @@ from braintree.configuration import Configuration from braintree.us_bank_account_verification import UsBankAccountVerification import requests -import json class TestBankAccountInstantVerification(unittest.TestCase): diff --git a/tests/integration/test_braintree_gateway.py b/tests/integration/test_braintree_gateway.py index ef76fb77..fd0528f8 100644 --- a/tests/integration/test_braintree_gateway.py +++ b/tests/integration/test_braintree_gateway.py @@ -2,7 +2,6 @@ from braintree.braintree_gateway import BraintreeGateway from braintree.configuration import Configuration -from braintree.environment import Environment class TestBraintreeGateway(unittest.TestCase): diff --git a/tests/integration/test_client_token.py b/tests/integration/test_client_token.py index 7aa078bf..d06013c3 100644 --- a/tests/integration/test_client_token.py +++ b/tests/integration/test_client_token.py @@ -1,10 +1,6 @@ from tests.test_helper import * import json -import urllib -import datetime import braintree -from braintree.util import Http -from base64 import b64decode class TestClientTokenGenerate(unittest.TestCase): def test_allows_client_token_version_to_be_specified(self): diff --git a/tests/integration/test_credentials_parser.py b/tests/integration/test_credentials_parser.py index bab7f02d..37f5bfbe 100644 --- a/tests/integration/test_credentials_parser.py +++ b/tests/integration/test_credentials_parser.py @@ -1,5 +1,4 @@ from tests.test_helper import * -from braintree.test.nonces import Nonces from braintree.credentials_parser import CredentialsParser class TestCredentialsParser(unittest.TestCase): diff --git a/tests/integration/test_customer_session_gateway.py b/tests/integration/test_customer_session_gateway.py index d850e42f..57ed654d 100644 --- a/tests/integration/test_customer_session_gateway.py +++ b/tests/integration/test_customer_session_gateway.py @@ -12,9 +12,7 @@ ) from braintree.graphql.enums.recommended_payment_option import RecommendedPaymentOption from braintree.exceptions.authorization_error import AuthorizationError -from braintree.util.graphql_client import GraphQLClient from decimal import Decimal -import json class CustomerSessionIT(unittest.TestCase): diff --git a/tests/integration/test_disputes.py b/tests/integration/test_disputes.py index 797b3b95..7ea4547d 100644 --- a/tests/integration/test_disputes.py +++ b/tests/integration/test_disputes.py @@ -1,6 +1,4 @@ import re -import time -import datetime from tests.test_helper import * from braintree.test.credit_card_numbers import CreditCardNumbers diff --git a/tests/integration/test_document_upload.py b/tests/integration/test_document_upload.py index 22c1be88..e5084428 100644 --- a/tests/integration/test_document_upload.py +++ b/tests/integration/test_document_upload.py @@ -1,6 +1,5 @@ import os from tests.test_helper import * -from braintree.test.nonces import Nonces class TestDocumentUpload(unittest.TestCase): def setUp(self): diff --git a/tests/integration/test_merchant.py b/tests/integration/test_merchant.py index 3e3e48e4..81da44b1 100644 --- a/tests/integration/test_merchant.py +++ b/tests/integration/test_merchant.py @@ -1,5 +1,4 @@ from tests.test_helper import * -from braintree.test.nonces import Nonces @unittest.skip("pending this suite of tests") class TestMerchantGateway(unittest.TestCase): diff --git a/tests/integration/test_oauth.py b/tests/integration/test_oauth.py index 2d88a52e..78cec5f7 100644 --- a/tests/integration/test_oauth.py +++ b/tests/integration/test_oauth.py @@ -1,6 +1,4 @@ from tests.test_helper import * -from braintree.test.nonces import Nonces -import sys import urllib.parse as urlparse class TestOAuthGateway(unittest.TestCase): diff --git a/tests/integration/test_package_tracking.py b/tests/integration/test_package_tracking.py index d6e42125..13b0db99 100644 --- a/tests/integration/test_package_tracking.py +++ b/tests/integration/test_package_tracking.py @@ -1,4 +1,3 @@ -import json from tests.test_helper import * from braintree.transaction import Transaction diff --git a/tests/integration/test_paypal_payment_resource.py b/tests/integration/test_paypal_payment_resource.py index e687c232..97041693 100644 --- a/tests/integration/test_paypal_payment_resource.py +++ b/tests/integration/test_paypal_payment_resource.py @@ -1,7 +1,4 @@ -import braintree import unittest -import os -from braintree.test.nonces import Nonces from tests.test_helper import * diff --git a/tests/integration/test_sepa_direct_debit_account.py b/tests/integration/test_sepa_direct_debit_account.py index a39d190d..55af49e6 100644 --- a/tests/integration/test_sepa_direct_debit_account.py +++ b/tests/integration/test_sepa_direct_debit_account.py @@ -1,5 +1,4 @@ from tests.test_helper import * -import time from braintree.test.nonces import Nonces class TestSepaDirectDebitAccount(unittest.TestCase): diff --git a/tests/integration/test_test_helper.py b/tests/integration/test_test_helper.py index 9c83241f..0365db59 100644 --- a/tests/integration/test_test_helper.py +++ b/tests/integration/test_test_helper.py @@ -1,5 +1,4 @@ from tests.test_helper import * -from braintree.test.nonces import Nonces class TestTestHelper(unittest.TestCase): def setUp(self): diff --git a/tests/integration/test_transaction_payment_facilitator.py b/tests/integration/test_transaction_payment_facilitator.py index 631ea5cf..5635778f 100644 --- a/tests/integration/test_transaction_payment_facilitator.py +++ b/tests/integration/test_transaction_payment_facilitator.py @@ -1,11 +1,5 @@ -import json from tests.test_helper import * -from braintree.test.credit_card_numbers import CreditCardNumbers -from braintree.test.nonces import Nonces -from braintree.dispute import Dispute -from braintree.payment_instrument_type import PaymentInstrumentType from braintree.transaction import Transaction -from datetime import date class TestTransactionPaymentFacilitator(unittest.TestCase): diff --git a/tests/integration/test_transaction_search.py b/tests/integration/test_transaction_search.py index 4b0151b6..b2352b7f 100644 --- a/tests/integration/test_transaction_search.py +++ b/tests/integration/test_transaction_search.py @@ -1,4 +1,3 @@ -from unittest.mock import patch from tests.test_helper import * class TestTransactionSearch(unittest.TestCase): diff --git a/tests/integration/test_transaction_transfer.py b/tests/integration/test_transaction_transfer.py index 8fc987c4..f356f6b0 100644 --- a/tests/integration/test_transaction_transfer.py +++ b/tests/integration/test_transaction_transfer.py @@ -1,7 +1,4 @@ -import json from tests.test_helper import * -from braintree.test.credit_card_numbers import CreditCardNumbers -from braintree.payment_instrument_type import PaymentInstrumentType from braintree.transaction import Transaction from datetime import date diff --git a/tests/integration/test_transaction_transfer_sdwo.py b/tests/integration/test_transaction_transfer_sdwo.py index 91db0d4e..f21b024f 100644 --- a/tests/integration/test_transaction_transfer_sdwo.py +++ b/tests/integration/test_transaction_transfer_sdwo.py @@ -1,12 +1,6 @@ -import json from tests.test_helper import * -from braintree.test.credit_card_numbers import CreditCardNumbers -from braintree.test.nonces import Nonces -from braintree.dispute import Dispute from braintree.error_codes import ErrorCodes -from braintree.payment_instrument_type import PaymentInstrumentType from braintree.transaction import Transaction -from datetime import date class TestTransactionTransferSdwo(unittest.TestCase): diff --git a/tests/test_helper.py b/tests/test_helper.py index 25b088b2..08b01afd 100644 --- a/tests/test_helper.py +++ b/tests/test_helper.py @@ -3,17 +3,14 @@ from datetime import date, datetime, timedelta from decimal import Decimal from enum import Enum -from http.client import HTTPConnection -from subprocess import Popen, PIPE from braintree.successful_result import SuccessfulResult from braintree.attribute_getter import AttributeGetter -from urllib.parse import urlencode, quote_plus +from urllib.parse import quote_plus import json import os import random import re import requests -import subprocess import sys import time import unittest @@ -22,7 +19,6 @@ from braintree import * from braintree.exceptions import * from braintree.test.credit_card_numbers import CreditCardNumbers -from braintree.test.nonces import Nonces from braintree.testing_gateway import * from braintree.util import * diff --git a/tests/unit/test_bank_account_instant_verification_gateway.py b/tests/unit/test_bank_account_instant_verification_gateway.py index 68229cf0..1bd24e55 100644 --- a/tests/unit/test_bank_account_instant_verification_gateway.py +++ b/tests/unit/test_bank_account_instant_verification_gateway.py @@ -1,10 +1,7 @@ import unittest -from unittest.mock import Mock, MagicMock +from unittest.mock import Mock from braintree.bank_account_instant_verification_gateway import BankAccountInstantVerificationGateway from braintree.bank_account_instant_verification_jwt_request import BankAccountInstantVerificationJwtRequest -from braintree.bank_account_instant_verification_jwt import BankAccountInstantVerificationJwt -from braintree.successful_result import SuccessfulResult -from braintree.error_result import ErrorResult class TestBankAccountInstantVerificationGateway(unittest.TestCase): diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py index 5b24540b..9a414200 100644 --- a/tests/unit/test_configuration.py +++ b/tests/unit/test_configuration.py @@ -1,6 +1,5 @@ from tests.test_helper import * import braintree -import os import importlib class TestConfiguration(unittest.TestCase): diff --git a/tests/unit/test_customer_session_gateway.py b/tests/unit/test_customer_session_gateway.py index 2ad42458..490ea6ec 100644 --- a/tests/unit/test_customer_session_gateway.py +++ b/tests/unit/test_customer_session_gateway.py @@ -2,20 +2,12 @@ from braintree.customer_session_gateway import CustomerSessionGateway from braintree.graphql import ( CreateCustomerSessionInput, - CustomerSessionInput, UpdateCustomerSessionInput, CustomerRecommendationsInput, - CustomerRecommendations, - CustomerRecommendationsPayload, - PaymentOptions, - RecommendedPaymentOption, Recommendations ) -from braintree.error_result import ErrorResult -from braintree.successful_result import SuccessfulResult -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock from tests.test_helper import unittest -import json class TestCustomerSessionGateway(unittest.TestCase): def setUp(self): diff --git a/tests/unit/test_oauth_access_revocation.py b/tests/unit/test_oauth_access_revocation.py index eace1ffd..fecd2063 100644 --- a/tests/unit/test_oauth_access_revocation.py +++ b/tests/unit/test_oauth_access_revocation.py @@ -1,5 +1,4 @@ from tests.test_helper import * -import datetime class TestOAuthAccessRevocation(unittest.TestCase): def test_assigns_merchant_id(self): diff --git a/tests/unit/test_payment_method_parser.py b/tests/unit/test_payment_method_parser.py index e03e61f1..d6c2b428 100644 --- a/tests/unit/test_payment_method_parser.py +++ b/tests/unit/test_payment_method_parser.py @@ -1,6 +1,5 @@ from tests.test_helper import * from braintree.payment_method_parser import parse_payment_method -from unittest.mock import MagicMock class TestPaymentMethodParser(unittest.TestCase): def test_parse_response_returns_a_credit_card(self): diff --git a/tests/unit/test_paypal_payment_resource_gateway.py b/tests/unit/test_paypal_payment_resource_gateway.py index 0f53f3ab..843d8601 100644 --- a/tests/unit/test_paypal_payment_resource_gateway.py +++ b/tests/unit/test_paypal_payment_resource_gateway.py @@ -4,7 +4,6 @@ from braintree.resource import Resource from unittest.mock import patch, MagicMock from decimal import Decimal -from braintree.util.xml_util import XmlUtil class TestPayPalPaymentResourceGateway(unittest.TestCase): def setUp(self): self.gateway = MagicMock() @@ -78,7 +77,7 @@ def test_update_calls_put_with_correct_params(self, mock_verify_keys): } try: self.paypal_payment_resource_gateway.update(request) - except: + except Exception: pass self.gateway.config.http().put.assert_called_once_with( diff --git a/tests/unit/test_transaction.py b/tests/unit/test_transaction.py index 4c5666dd..8e5549c4 100644 --- a/tests/unit/test_transaction.py +++ b/tests/unit/test_transaction.py @@ -6,7 +6,6 @@ from braintree.meta_checkout_token import MetaCheckoutToken from datetime import datetime from datetime import date -from braintree.authorization_adjustment import AuthorizationAdjustment from unittest.mock import MagicMock diff --git a/tests/unit/test_transaction_transfer.py b/tests/unit/test_transaction_transfer.py index 3cf2ac18..56eb9233 100644 --- a/tests/unit/test_transaction_transfer.py +++ b/tests/unit/test_transaction_transfer.py @@ -1,13 +1,5 @@ from tests.test_helper import * -from braintree.test.credit_card_numbers import CreditCardNumbers -from braintree.payment_facilitator import PaymentFacilitator -from braintree.sub_merchant import SubMerchant -from braintree.meta_checkout_card import MetaCheckoutCard -from braintree.meta_checkout_token import MetaCheckoutToken -from datetime import datetime from datetime import date -from braintree.authorization_adjustment import AuthorizationAdjustment -from unittest.mock import MagicMock transfer_type = ["account_to_account", "person_to_person", "wallet_transfer", "fund_transfer", "fund_disbursement", "payroll_disbursement", "prepaid_top_up"] class TestTransactionTransferType(unittest.TestCase): From 5a7639199f7b43eee73a5ab7483c27f637c4b10d Mon Sep 17 00:00:00 2001 From: Pablo Estevez Date: Sun, 1 Feb 2026 11:40:35 +0000 Subject: [PATCH 2/2] remove extra changes --- braintree/credit_card_verification.py | 2 +- braintree/payment_method_nonce.py | 6 +++--- braintree/resource_collection.py | 2 +- braintree/transaction.py | 2 +- braintree/us_bank_account.py | 2 +- tests/unit/test_paypal_payment_resource_gateway.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/braintree/credit_card_verification.py b/braintree/credit_card_verification.py index 0b5e8da8..be0a0347 100644 --- a/braintree/credit_card_verification.py +++ b/braintree/credit_card_verification.py @@ -49,7 +49,7 @@ def __init__(self, gateway, attributes): else: self.risk_data = None - if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: + if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None diff --git a/braintree/payment_method_nonce.py b/braintree/payment_method_nonce.py index d441d8aa..4949d8de 100644 --- a/braintree/payment_method_nonce.py +++ b/braintree/payment_method_nonce.py @@ -15,17 +15,17 @@ def find(payment_method_nonce): def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) - if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: + if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None - if "authentication_insight" in attributes and attributes["authentication_insight"] is not None: + if "authentication_insight" in attributes and not attributes["authentication_insight"] is None: self.authentication_insight = attributes["authentication_insight"] else: self.authentication_insight = None - if "bin_data" in attributes and attributes["bin_data"] is not None: + if "bin_data" in attributes and not attributes["bin_data"] is None: self.bin_data = BinData(attributes["bin_data"]) else: self.bin_data = None diff --git a/braintree/resource_collection.py b/braintree/resource_collection.py index 18343878..baf0d061 100644 --- a/braintree/resource_collection.py +++ b/braintree/resource_collection.py @@ -52,7 +52,7 @@ def __batch_ids(self): @staticmethod def _extract_as_array(results, attribute): - if attribute not in results: + if not attribute in results: return [] value = results[attribute] diff --git a/braintree/transaction.py b/braintree/transaction.py index 36cc8de7..b8168e2f 100644 --- a/braintree/transaction.py +++ b/braintree/transaction.py @@ -903,7 +903,7 @@ def __init__(self, gateway, attributes): self.risk_data = RiskData(attributes["risk_data"]) else: self.risk_data = None - if "three_d_secure_info" in attributes and attributes["three_d_secure_info"] is not None: + if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None: self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"]) else: self.three_d_secure_info = None diff --git a/braintree/us_bank_account.py b/braintree/us_bank_account.py index e75f0ef8..76a64410 100644 --- a/braintree/us_bank_account.py +++ b/braintree/us_bank_account.py @@ -12,7 +12,7 @@ def find(token): @staticmethod def sale(token, transactionRequest): transactionRequest["payment_method_token"] = token - if "options" not in transactionRequest: + if not "options" in transactionRequest: transactionRequest["options"] = {} transactionRequest["options"]["submit_for_settlement"] = True return Configuration.gateway().transaction.sale(transactionRequest) diff --git a/tests/unit/test_paypal_payment_resource_gateway.py b/tests/unit/test_paypal_payment_resource_gateway.py index 843d8601..5fdc948b 100644 --- a/tests/unit/test_paypal_payment_resource_gateway.py +++ b/tests/unit/test_paypal_payment_resource_gateway.py @@ -77,7 +77,7 @@ def test_update_calls_put_with_correct_params(self, mock_verify_keys): } try: self.paypal_payment_resource_gateway.update(request) - except Exception: + except: pass self.gateway.config.http().put.assert_called_once_with(