Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rsa/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def byte_literal(s):
def byte_literal(s):
return s

# Range generator.
try:
# < Python3
range = xrange
except NameError:
# Python3
range = range

# ``long`` is no more. Do type detection using this instead.
try:
integer_types = (int, long)
Expand Down
2 changes: 1 addition & 1 deletion rsa/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import logging

from rsa._compat import b
from rsa._compat import b, range
import rsa.prime
import rsa.pem
import rsa.common
Expand Down
1 change: 1 addition & 0 deletions rsa/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import multiprocessing as mp

from rsa._compat import range
import rsa.prime
import rsa.randnum

Expand Down
3 changes: 2 additions & 1 deletion rsa/pem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"""Functions that load and write PEM-encoded files."""

import base64
from rsa._compat import b, is_bytes

from rsa._compat import b, is_bytes, range


def _markers(pem_marker):
Expand Down
2 changes: 1 addition & 1 deletion rsa/pkcs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import hashlib
import os

from rsa._compat import b
from rsa._compat import b, range
from rsa import common, transform, core

# ASN.1 codes that describe the hash algorithm used.
Expand Down
1 change: 1 addition & 0 deletions rsa/prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Roberto Tamassia, 2002.
"""

from rsa._compat import range
import rsa.common
import rsa.randnum

Expand Down
1 change: 1 addition & 0 deletions rsa/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import binascii
from struct import pack

from rsa import common
from rsa._compat import is_integer, b, byte, get_word_alignment, ZERO_BYTE, EMPTY_BYTE

Expand Down
2 changes: 1 addition & 1 deletion tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import struct
import sys

from rsa._compat import is_bytes, byte, b
from rsa._compat import b, byte, is_bytes, range


class TestByte(unittest.TestCase):
Expand Down
1 change: 1 addition & 0 deletions tests/test_prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import unittest

from rsa._compat import range
import rsa.prime
import rsa.randnum

Expand Down