Browse Source

chore: Drop dead and deprecated code

* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
pull/2/head
Gavin D'souza 4 years ago
parent
commit
025f47c7f9
16 changed files with 7 additions and 29 deletions
  1. +1
    -2
      payments/payment_gateways/doctype/braintree_settings/braintree_settings.py
  2. +0
    -2
      payments/payment_gateways/doctype/braintree_settings/test_braintree_settings.py
  3. +1
    -2
      payments/payment_gateways/doctype/paypal_settings/paypal_settings.py
  4. +2
    -3
      payments/payment_gateways/doctype/paytm_settings/paytm_settings.py
  5. +0
    -2
      payments/payment_gateways/doctype/paytm_settings/test_paytm_settings.py
  6. +1
    -2
      payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py
  7. +1
    -2
      payments/payment_gateways/doctype/stripe_settings/stripe_settings.py
  8. +0
    -2
      payments/payment_gateways/doctype/stripe_settings/test_stripe_settings.py
  9. +0
    -1
      payments/payments/doctype/payment_gateway/payment_gateway.py
  10. +0
    -2
      payments/payments/doctype/payment_gateway/test_payment_gateway.py
  11. +0
    -1
      payments/templates/pages/braintree_checkout.py
  12. +0
    -1
      payments/templates/pages/payment_cancel.py
  13. +0
    -2
      payments/templates/pages/payment_success.py
  14. +0
    -1
      payments/templates/pages/paytm_checkout.py
  15. +1
    -3
      payments/templates/pages/razorpay_checkout.py
  16. +0
    -1
      payments/templates/pages/stripe_checkout.py

+ 1
- 2
payments/payment_gateways/doctype/braintree_settings/braintree_settings.py View File

@@ -2,12 +2,11 @@
# Copyright (c) 2018, Frappe Technologies and contributors # Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt # For license information, please see license.txt


from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
import braintree import braintree
from frappe import _ from frappe import _
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode
from frappe.utils import get_url, call_hook_method from frappe.utils import get_url, call_hook_method
from frappe.integrations.utils import create_request_log, create_payment_gateway from frappe.integrations.utils import create_request_log, create_payment_gateway




+ 0
- 2
payments/payment_gateways/doctype/braintree_settings/test_braintree_settings.py View File

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors # Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals

import unittest import unittest


class TestBraintreeSettings(unittest.TestCase): class TestBraintreeSettings(unittest.TestCase):


+ 1
- 2
payments/payment_gateways/doctype/paypal_settings/paypal_settings.py View File

@@ -63,12 +63,11 @@ More Details:


""" """


from __future__ import unicode_literals
import frappe import frappe
import json import json
import pytz import pytz
from frappe import _ from frappe import _
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode
from frappe.model.document import Document from frappe.model.document import Document
from frappe.integrations.utils import create_request_log, make_post_request, create_payment_gateway from frappe.integrations.utils import create_request_log, make_post_request, create_payment_gateway
from frappe.utils import get_url, call_hook_method, cint, get_datetime from frappe.utils import get_url, call_hook_method, cint, get_datetime


+ 2
- 3
payments/payment_gateways/doctype/paytm_settings/paytm_settings.py View File

@@ -2,10 +2,9 @@
# Copyright (c) 2020, Frappe Technologies and contributors # Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt # For license information, please see license.txt


from __future__ import unicode_literals
import json import json
import requests import requests
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode


import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
@@ -59,7 +58,7 @@ def get_paytm_params(payment_details, order_id, paytm_config):


# initialize a dictionary # initialize a dictionary
paytm_params = dict() paytm_params = dict()
redirect_uri = get_request_site_address(True) + "/api/method/frappe.integrations.doctype.paytm_settings.paytm_settings.verify_transaction" redirect_uri = get_request_site_address(True) + "/api/method/frappe.integrations.doctype.paytm_settings.paytm_settings.verify_transaction"






+ 0
- 2
payments/payment_gateways/doctype/paytm_settings/test_paytm_settings.py View File

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors # Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals

# import frappe # import frappe
import unittest import unittest




+ 1
- 2
payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py View File

@@ -60,14 +60,13 @@ For razorpay payment status is Authorized


""" """


from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
import json import json
import hmac import hmac
import razorpay import razorpay
import hashlib import hashlib
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import get_url, call_hook_method, cint, get_timestamp from frappe.utils import get_url, call_hook_method, cint, get_timestamp
from frappe.integrations.utils import (make_get_request, make_post_request, create_request_log, from frappe.integrations.utils import (make_get_request, make_post_request, create_request_log,


+ 1
- 2
payments/payment_gateways/doctype/stripe_settings/stripe_settings.py View File

@@ -2,11 +2,10 @@
# Copyright (c) 2017, Frappe Technologies and contributors # Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt # For license information, please see license.txt


from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
from frappe import _ from frappe import _
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode
from frappe.utils import get_url, call_hook_method, cint, flt from frappe.utils import get_url, call_hook_method, cint, flt
from frappe.integrations.utils import make_get_request, make_post_request, create_request_log, create_payment_gateway from frappe.integrations.utils import make_get_request, make_post_request, create_request_log, create_payment_gateway




+ 0
- 2
payments/payment_gateways/doctype/stripe_settings/test_stripe_settings.py View File

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors # Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals

import unittest import unittest


class TestStripeSettings(unittest.TestCase): class TestStripeSettings(unittest.TestCase):


+ 0
- 1
payments/payments/doctype/payment_gateway/payment_gateway.py View File

@@ -2,7 +2,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt


from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document




+ 0
- 2
payments/payments/doctype/payment_gateway/test_payment_gateway.py View File

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals

import frappe import frappe
import unittest import unittest




+ 0
- 1
payments/templates/pages/braintree_checkout.py View File

@@ -1,6 +1,5 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import flt from frappe.utils import flt


+ 0
- 1
payments/templates/pages/payment_cancel.py View File

@@ -1,7 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt


from __future__ import unicode_literals
import frappe import frappe


def get_context(context): def get_context(context):


+ 0
- 2
payments/templates/pages/payment_success.py View File

@@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt


from __future__ import unicode_literals

import frappe import frappe
no_cache = True no_cache = True




+ 0
- 1
payments/templates/pages/paytm_checkout.py View File

@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
import json import json


+ 1
- 3
payments/templates/pages/razorpay_checkout.py View File

@@ -1,11 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import flt, cint from frappe.utils import flt, cint
import json import json
from six import string_types


no_cache = 1 no_cache = 1


@@ -47,7 +45,7 @@ def get_api_key():
def make_payment(razorpay_payment_id, options, reference_doctype, reference_docname, token): def make_payment(razorpay_payment_id, options, reference_doctype, reference_docname, token):
data = {} data = {}


if isinstance(options, string_types):
if isinstance(options, str):
data = json.loads(options) data = json.loads(options)


data.update({ data.update({


+ 0
- 1
payments/templates/pages/stripe_checkout.py View File

@@ -1,6 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cint, fmt_money from frappe.utils import cint, fmt_money


Loading…
Cancel
Save