Skip to content

Commit

Permalink
Merge pull request #214 from rtibbles/cleanup_on_aisle_2.7
Browse files Browse the repository at this point in the history
Clean up residual Python 2.7 code paths
  • Loading branch information
bjester committed Mar 6, 2024
2 parents d209706 + b2c7b3d commit a9373c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
7 changes: 2 additions & 5 deletions morango/models/fields/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
import hashlib
import re
import sys

import rsa as PYRSA
from django.db import models
Expand Down Expand Up @@ -41,10 +40,8 @@
except ImportError:
CRYPTOGRAPHY_EXISTS = False

if sys.version_info[0] < 3:
from base64 import encodestring as b64encode, decodestring as b64decode
else:
from base64 import encodebytes as b64encode, decodebytes as b64decode

from base64 import encodebytes as b64encode, decodebytes as b64decode


PKCS8_HEADER = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A"
Expand Down
19 changes: 2 additions & 17 deletions tests/testapp/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import sys
import uuid
from base64 import encodebytes as b64encode

from django.db import connection
from django.test.utils import CaptureQueriesContext
Expand All @@ -10,7 +10,7 @@
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from facility_profile.models import MyUser
from rest_framework.test import APITestCase as BaseTestCase
from rest_framework.test import APITestCase

from .compat import EnvironmentVarGuard
from morango.api.serializers import BufferSerializer
Expand All @@ -33,21 +33,6 @@
from morango.sync.syncsession import compress_string
from morango.sync.utils import validate_and_create_buffer_data

if sys.version_info >= (3,):
from base64 import encodebytes as b64encode

# A weird hack because of http://bugs.python.org/issue17866
class APITestCase(BaseTestCase):
def assertItemsEqual(self, *args, **kwargs):
self.assertCountEqual(*args, **kwargs)


else:
from base64 import encodestring as b64encode

class APITestCase(BaseTestCase):
pass


class CertificateTestCaseMixin(object):
def setUp(self):
Expand Down

0 comments on commit a9373c0

Please sign in to comment.