Skip to content

Fix imports for all namespace packages #2506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 28, 2020
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
2 changes: 1 addition & 1 deletion ciphers/affine_cipher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
import sys

import cryptomath_module as cryptomath
from . import cryptomath_module as cryptomath

SYMBOLS = (
r""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`"""
Expand Down
4 changes: 2 additions & 2 deletions ciphers/elgamal_key_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import random
import sys

import cryptomath_module as cryptoMath
import rabin_miller as rabinMiller
from . import cryptomath_module as cryptoMath
from . import rabin_miller as rabinMiller

min_primitive_root = 3

Expand Down
2 changes: 1 addition & 1 deletion ciphers/rsa_cipher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sys

import rsa_key_generator as rkg
from . import rsa_key_generator as rkg

DEFAULT_BLOCK_SIZE = 128
BYTE_SIZE = 256
Expand Down
4 changes: 2 additions & 2 deletions ciphers/rsa_key_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import random
import sys

import cryptomath_module as cryptoMath
import rabin_miller as rabinMiller
from . import cryptomath_module as cryptoMath
from . import rabin_miller as rabinMiller


def main():
Expand Down
2 changes: 1 addition & 1 deletion ciphers/transposition_cipher_encrypt_decrypt_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import time

import transposition_cipher as transCipher
from . import transposition_cipher as transCipher


def main():
Expand Down
4 changes: 2 additions & 2 deletions data_structures/hashing/double_hash.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
from hash_table import HashTable
from number_theory.prime_numbers import check_prime, next_prime
from .hash_table import HashTable
from .number_theory.prime_numbers import check_prime, next_prime


class DoubleHash(HashTable):
Expand Down
2 changes: 1 addition & 1 deletion data_structures/hashing/hash_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from number_theory.prime_numbers import next_prime
from .number_theory.prime_numbers import next_prime


class HashTable:
Expand Down
2 changes: 1 addition & 1 deletion data_structures/hashing/hash_table_with_linked_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import deque

from hash_table import HashTable
from .hash_table import HashTable


class HashTableWithLinkedList(HashTable):
Expand Down
2 changes: 1 addition & 1 deletion data_structures/hashing/quadratic_probing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from hash_table import HashTable
from .hash_table import HashTable


class QuadraticProbing(HashTable):
Expand Down
4 changes: 2 additions & 2 deletions data_structures/linked_list/deque_doubly.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def remove_first(self):
...
IndexError: remove_first from empty list
>>> d.add_first('A') # doctest: +ELLIPSIS
<linked_list.deque_doubly.LinkedDeque object at ...
<data_structures.linked_list.deque_doubly.LinkedDeque object at ...
>>> d.remove_first()
'A'
>>> d.is_empty()
Expand All @@ -132,7 +132,7 @@ def remove_last(self):
...
IndexError: remove_first from empty list
>>> d.add_first('A') # doctest: +ELLIPSIS
<linked_list.deque_doubly.LinkedDeque object at ...
<data_structures.linked_list.deque_doubly.LinkedDeque object at ...
>>> d.remove_last()
'A'
>>> d.is_empty()
Expand Down
6 changes: 3 additions & 3 deletions data_structures/queue/circular_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __len__(self) -> int:
>>> len(cq)
0
>>> cq.enqueue("A") # doctest: +ELLIPSIS
<circular_queue.CircularQueue object at ...
<data_structures.queue.circular_queue.CircularQueue object at ...
>>> len(cq)
1
"""
Expand Down Expand Up @@ -48,11 +48,11 @@ def enqueue(self, data):
This function insert an element in the queue using self.rear value as an index
>>> cq = CircularQueue(5)
>>> cq.enqueue("A") # doctest: +ELLIPSIS
<circular_queue.CircularQueue object at ...
<data_structures.queue.circular_queue.CircularQueue object at ...
>>> (cq.size, cq.first())
(1, 'A')
>>> cq.enqueue("B") # doctest: +ELLIPSIS
<circular_queue.CircularQueue object at ...
<data_structures.queue.circular_queue.CircularQueue object at ...
>>> (cq.size, cq.first())
(2, 'A')
"""
Expand Down
4 changes: 2 additions & 2 deletions data_structures/queue/priority_queue_using_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class FixedPriorityQueue:
>>> fpq.dequeue()
Traceback (most recent call last):
...
priority_queue_using_list.UnderFlowError: All queues are empty
data_structures.queue.priority_queue_using_list.UnderFlowError: All queues are empty
>>> print(fpq)
Priority 0: []
Priority 1: []
Expand Down Expand Up @@ -141,7 +141,7 @@ class ElementPriorityQueue:
>>> epq.dequeue()
Traceback (most recent call last):
...
priority_queue_using_list.UnderFlowError: The queue is empty
data_structures.queue.priority_queue_using_list.UnderFlowError: The queue is empty
>>> print(epq)
[]
"""
Expand Down
2 changes: 1 addition & 1 deletion geodesy/lamberts_ellipsoidal_distance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from math import atan, cos, radians, sin, tan

from haversine_distance import haversine_distance
from .haversine_distance import haversine_distance


def lamberts_ellipsoidal_distance(
Expand Down
2 changes: 1 addition & 1 deletion greedy_method/test_knapsack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

import greedy_knapsack as kp
from . import greedy_knapsack as kp


class TestClass(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion linear_algebra/src/test_linear_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
import unittest

from lib import Matrix, Vector, axpy, squareZeroMatrix, unitBasisVector, zeroVector
from .lib import Matrix, Vector, axpy, squareZeroMatrix, unitBasisVector, zeroVector


class Test(unittest.TestCase):
Expand Down
5 changes: 4 additions & 1 deletion scripts/validate_filenames.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python3
import os

from build_directory_md import good_file_paths
try:
from .build_directory_md import good_file_paths
except ImportError:
from build_directory_md import good_file_paths

filepaths = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
Expand Down
2 changes: 1 addition & 1 deletion searches/simulated_annealing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
import random

from hill_climbing import SearchProblem
from .hill_climbing import SearchProblem


def simulated_annealing(
Expand Down