From 1e6fdb317b4db4f76f521bb0322a56b29a765cbe Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 16 Oct 2019 00:50:32 +0500 Subject: [PATCH 01/11] Travis CI: Upgrade to Python 3.8 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index be227df1fdbd..cd1b9eb16599 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python -dist: xenial # required for Python >= 3.7 -python: 3.7 +python: 3.8 cache: pip before_install: pip install --upgrade pip setuptools install: pip install -r requirements.txt From 9155e1df21974b4caf4a218200869ecbaf13436c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 17 Oct 2019 09:42:06 +0300 Subject: [PATCH 02/11] Rerun test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd1b9eb16599..ce60bca91442 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: python +language: python python: 3.8 cache: pip before_install: pip install --upgrade pip setuptools From f26352e898371f53f33868b15b6c0e1a9ff386ef Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 29 Oct 2019 22:05:16 +0100 Subject: [PATCH 03/11] Remove opencv-python --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 824f534a245f..a62923680709 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ flake8 matplotlib mypy numpy -opencv-python pandas pillow pytest From c78c14e0f0f2f4d39f638603da1e837e9d1c6ecb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 15 Nov 2019 04:43:17 +0100 Subject: [PATCH 04/11] Rerun tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ce60bca91442..cd1b9eb16599 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: python +language: python python: 3.8 cache: pip before_install: pip install --upgrade pip setuptools From 2f6ccca6ca029b80570b65ccceb09468b4801a95 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 6 Dec 2019 07:37:07 +0100 Subject: [PATCH 05/11] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index a62923680709..824f534a245f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ flake8 matplotlib mypy numpy +opencv-python pandas pillow pytest From aba0131a7f27b605ffd80d946bf6abc9c56f206a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 6 Dec 2019 07:52:31 +0100 Subject: [PATCH 06/11] tensorflow>=2.1.0-rc0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 824f534a245f..dadb4853f525 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,4 @@ requests scikit-fuzzy sklearn sympy -tensorflow +tensorflow>=2.1.0-rc0 From 6af2e4a3217c802b9569f8a4029f46e9dcc9ed6e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 6 Dec 2019 07:55:20 +0100 Subject: [PATCH 07/11] tensorflow>=2.1.0rc0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dadb4853f525..1b067f48659c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,4 @@ requests scikit-fuzzy sklearn sympy -tensorflow>=2.1.0-rc0 +tensorflow>=2.1.0rc0 From 5d7c50a155f345cc8980c268cceaa608b635c869 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 6 Dec 2019 08:58:47 +0100 Subject: [PATCH 08/11] tensorflow==2.1.0rc0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1b067f48659c..7a3413c2a2f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,4 @@ requests scikit-fuzzy sklearn sympy -tensorflow>=2.1.0rc0 +tensorflow==2.1.0rc0 From 8ad9a1296a4c730232568049af6f63f20f18b25a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 9 Dec 2019 08:08:56 +0100 Subject: [PATCH 09/11] numpy>=1.17.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7a3413c2a2f4..8fcc8ac3dfe4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ fake_useragent flake8 matplotlib mypy -numpy +numpy>=1.17.4 opencv-python pandas pillow From b202a01a1139f3a1112282c5db896e691aab6a83 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 8 Jan 2020 13:41:24 +0100 Subject: [PATCH 10/11] tensorflow==2.1.0rc2 https://github.com/tensorflow/tensorflow/issues/33374#issuecomment-571074915 --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8fcc8ac3dfe4..6d1101259e08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ fake_useragent flake8 matplotlib mypy -numpy>=1.17.4 +numpy>=1.18.1 opencv-python pandas pillow @@ -13,4 +13,4 @@ requests scikit-fuzzy sklearn sympy -tensorflow==2.1.0rc0 +tensorflow==2.1.0rc2 From 361e2d2e529de4245c75acc1ce3dc4cf9f3eddce Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Wed, 8 Jan 2020 12:42:45 +0000 Subject: [PATCH 11/11] fixup! Format Python code with psf/black push --- data_structures/linked_list/deque_doubly.py | 49 ++++++++++++--------- sorts/recursive_bubble_sort.py | 23 +++++----- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/data_structures/linked_list/deque_doubly.py b/data_structures/linked_list/deque_doubly.py index d858333220e9..abc7bc1f769f 100644 --- a/data_structures/linked_list/deque_doubly.py +++ b/data_structures/linked_list/deque_doubly.py @@ -7,31 +7,36 @@ 4. remove from the end -> O(1) """ + class _DoublyLinkedBase: """ A Private class (to be inherited) """ + class _Node: - __slots__ = '_prev', '_data', '_next' + __slots__ = "_prev", "_data", "_next" + def __init__(self, link_p, element, link_n): self._prev = link_p self._data = element self._next = link_n - + def has_next_and_prev(self): - return " Prev -> {0}, Next -> {1}".format(self._prev != None, self._next != None) - + return " Prev -> {0}, Next -> {1}".format( + self._prev != None, self._next != None + ) + def __init__(self): self._header = self._Node(None, None, None) self._trailer = self._Node(None, None, None) self._header._next = self._trailer self._trailer._prev = self._header self._size = 0 - + def __len__(self): return self._size - + def is_empty(self): return self.__len__() == 0 - + def _insert(self, predecessor, e, successor): # Create new_node by setting it's prev.link -> header # setting it's next.link -> trailer @@ -40,11 +45,11 @@ def _insert(self, predecessor, e, successor): successor._prev = new_node self._size += 1 return self - + def _delete(self, node): predecessor = node._prev successor = node._next - + predecessor._next = successor successor._prev = predecessor self._size -= 1 @@ -53,8 +58,8 @@ def _delete(self, node): del node return temp + class LinkedDeque(_DoublyLinkedBase): - def first(self): """ return first element >>> d = LinkedDeque() @@ -62,11 +67,11 @@ def first(self): 'A' >>> d.add_first('B').first() 'B' - """ + """ if self.is_empty(): - raise Exception('List is empty') + raise Exception("List is empty") return self._header._next._data - + def last(self): """ return last element >>> d = LinkedDeque() @@ -76,27 +81,27 @@ def last(self): 'B' """ if self.is_empty(): - raise Exception('List is empty') + raise Exception("List is empty") return self._trailer._prev._data - + ### DEque Insert Operations (At the front, At the end) ### - + def add_first(self, element): """ insertion in the front >>> LinkedDeque().add_first('AV').first() 'AV' """ return self._insert(self._header, element, self._header._next) - + def add_last(self, element): """ insertion in the end >>> LinkedDeque().add_last('B').last() 'B' """ return self._insert(self._trailer._prev, element, self._trailer) - + ### DEqueu Remove Operations (At the front, At the end) ### - + def remove_first(self): """ removal from the front >>> d = LinkedDeque() @@ -114,9 +119,9 @@ def remove_first(self): True """ if self.is_empty(): - raise IndexError('remove_first from empty list') + raise IndexError("remove_first from empty list") return self._delete(self._header._next) - + def remove_last(self): """ removal in the end >>> d = LinkedDeque() @@ -134,5 +139,5 @@ def remove_last(self): True """ if self.is_empty(): - raise IndexError('remove_first from empty list') + raise IndexError("remove_first from empty list") return self._delete(self._trailer._prev) diff --git a/sorts/recursive_bubble_sort.py b/sorts/recursive_bubble_sort.py index 88c13cbb95b5..616044778a4a 100644 --- a/sorts/recursive_bubble_sort.py +++ b/sorts/recursive_bubble_sort.py @@ -24,17 +24,18 @@ def bubble_sort(list1): """ - for i, num in enumerate(list1): - try: - if list1[i+1] < num: - list1[i] = list1[i+1] - list1[i+1] = num - bubble_sort(list1) - except IndexError: + for i, num in enumerate(list1): + try: + if list1[i + 1] < num: + list1[i] = list1[i + 1] + list1[i + 1] = num + bubble_sort(list1) + except IndexError: pass - return list1 + return list1 -if __name__ == "__main__": - list1 = [33,99,22,11,66] - bubble_sort(list1) + +if __name__ == "__main__": + list1 = [33, 99, 22, 11, 66] + bubble_sort(list1) print(list1)