diff --git a/build/lib/easyPythonpi/__init__.py b/build/lib/easyPythonpi/__init__.py deleted file mode 100644 index a1386b4..0000000 --- a/build/lib/easyPythonpi/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -""" A python module that helps you to calculate some of the most used calculations..... - usage-- - Just download the file from git and unzip in ur system. - And while using this module, just write as code- - 'from easypythonpi import *' and u r good to go... - ~Happy programming""" - -__all__ = ('easyPythonpi_VERSION') - -easyPythonpi_VERSION = '1.1.9' -import __main__ \ No newline at end of file diff --git a/build/lib/easyPythonpi/__main__.py b/build/lib/easyPythonpi/__main__.py deleted file mode 100644 index ba81ed7..0000000 --- a/build/lib/easyPythonpi/__main__.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -from easyPythonpi.methods.array import * -from easyPythonpi.methods.basics import * -from easyPythonpi.methods.graph import * -from easyPythonpi.methods.linkedlist import * -from easyPythonpi.methods.matrix import * -from easyPythonpi.methods.search import * -from easyPythonpi.methods.sorting import * - -from easyPythonpi.test.test_basics import * -from easyPythonpi.test.test_Bin2Hex import * -from easyPythonpi.test.test_FibRefactored import * -from easyPythonpi.test.test_graph import * -from easyPythonpi.test.test_search import * - -if __name__ == "__main__": - pass diff --git a/build/lib/easyPythonpi/easyPythonpi.py b/build/lib/easyPythonpi/easyPythonpi.py deleted file mode 100644 index 93258fc..0000000 --- a/build/lib/easyPythonpi/easyPythonpi.py +++ /dev/null @@ -1,21 +0,0 @@ - -""" A python module that helps you to calculate some of the most used calculations..... - usage-- - Just download the file from git and unzip in ur system. - And while using this module, just write as code- - 'from easypythonpi import *' and u r good to go... - ~Happy programming""" - - -# Programmer defined exceptions go here: - -# define exception for invalid Binary Strings - -class InvalidBinaryException(Exception): - pass - -class InvalidNumberFibException(Exception): - def __init__(self, n, message="n is not valid, must be greater than or equal to 1"): - self.n = n - self.message = message - diff --git a/build/lib/easyPythonpi/methods/Graph.py b/build/lib/easyPythonpi/methods/Graph.py deleted file mode 100644 index b9c95bc..0000000 --- a/build/lib/easyPythonpi/methods/Graph.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - - -class Graph: - def __init__(self): - self.graph = {} - - def add_edge(self, u, v): - if u not in self.graph: - self.graph[u] = [] - self.graph[u].append(v) - - def add_vertex(self, vertex): - if vertex not in self.graph: - self.graph[vertex] = [] - - def get_vertices(self): - return list(self.graph.keys()) - - def get_edges(self): - edges = [] - for vertex, neighbors in self.graph.items(): - for neighbor in neighbors: - edges.append((vertex, neighbor)) - return edges - - def is_vertex_exist(self, vertex): - return vertex in self.graph - - def is_edge_exist(self, u, v): - return u in self.graph and v in self.graph[u] - - def remove_edge(self, u, v): - if self.is_edge_exist(u, v): - self.graph[u].remove(v) - - def remove_vertex(self, vertex): - if self.is_vertex_exist(vertex): - del self.graph[vertex] - for u in self.graph: - self.graph[u] = [v for v in self.graph[u] if v != vertex] - - def clear(self): - self.graph = {} - - def __str__(self): - return str(self.graph) diff --git a/build/lib/easyPythonpi/methods/__init__.py b/build/lib/easyPythonpi/methods/__init__.py deleted file mode 100644 index d943c71..0000000 --- a/build/lib/easyPythonpi/methods/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- \ No newline at end of file diff --git a/build/lib/easyPythonpi/methods/array.py b/build/lib/easyPythonpi/methods/array.py deleted file mode 100644 index 5722421..0000000 --- a/build/lib/easyPythonpi/methods/array.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import numpy as np - - -def createarray(length:'int',dtype='int')->'list': - # To create an array of entered length and entered data type(interger data type is a default data type) - new_array=[] #empty list - for i in range(length): - # if entered dtype is an interger - if dtype=='int': - array_input=int(input(f"Enter {i+1} element : ")) - new_array.append(array_input) - # if entered dtype is a string - elif dtype=='str' or dtype=='string': - array_input=str(input("Enter {i+1} element : ")) - new_array.append(array_input) - # if entered dtype is a float - elif dtype=='float': - array_input=float(input("Enter {i+1} element : ")) - new_array.append(array_input) - - created_array = np.array(new_array) - - return created_array - -def arrayrev(array:'list')->'list': - # To reverese the array elements - temp_array=[] - for i in range(len(array)-1,-1,-1): - temp_array.append(array[i]) - reversed_array=np.array(temp_array) - - return reversed_array - diff --git a/build/lib/easyPythonpi/methods/basics.py b/build/lib/easyPythonpi/methods/basics.py deleted file mode 100644 index fd09945..0000000 --- a/build/lib/easyPythonpi/methods/basics.py +++ /dev/null @@ -1,343 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import easyPythonpi.easyPythonpi as pi -import regex as re - -def add(x:'float', y:'float')->'float': # For addition of 2 numbers - return x+y - -def sub(x:'float', y:'float')->'float': # For substraction of 2 numbers - return x-y - -def multi(x:'float', y:'float')->'float': # For multiplication of 2 numbers - return x*y - - -def calculate_average(*args, **kwargs): - total_sum = sum(args) - count = len(args) + len(kwargs.values()) - - for value in kwargs.values(): - total_sum += value - - average = total_sum / count - return average - -def div(x:'float', y:'float')->'float': # For division of 2 numbers - return x/y - -def mod(x:'float', y:'float')->'float': # For finding the modulus of 2 numbers - return x%y - -def calculate_percentage(part, whole): - - if whole == 0: - return 0 # Avoid division by zero - return (part / whole) * 100 - - -def factorial(n:'int')->'int': # To find the factorial of 2 numbers - # single line to find factorial - return 1 if (n == 1 or n == 0) else n * factorial(n - 1) - -# To compute the factord of the argument passed -def factors(n:'int')->'int': - factors = [] - for i in range(1, n+1): - if n % i == 0: - factors.append(i) - return factors - -def Area_circle(r:'float')->'float': # To find the area of a circle using the radius r - PI = 3.142 - return PI * (r * r) - -def Perimeter_circle(r:'float')->'float': # To find the perimeter of a circle using the radius r - PI = 3.142 - return 2 * PI * r - - -def fibonacci(n:'int')->'int': #To find the nth fibonacci series - """Finds the fibonacci of the nth sequence. - - This function calculates the fibonacci sequence. This function calculates - the nth fibonacci of a number by finding the sum of two numbers in the - fibonacci sequence before n - - Args: - n ('int') : The number to find the fibonacci sequence of, assumes n >=1 - as valid numbers to find the fibonacci of n. - - Returns: - The fibonacci of arg n. - - Raises: - No errors - """ - if n<=0: - raise pi.InvalidNumberFibException(n) - # First Fibonacci number is 0 - elif n==1: - return 0 - # Second Fibonacci number is 1 - elif n==2: - return 1 - else: - fib1 = 0 - fib2 = 1 - - for i in range(2,n-1): - fibN = fib1 + fib2 - fib1 = fib2 - fib2 = fibN - - return fib1 +fib2 - - - -#method to print the 1st prime number between the range -def printprime(start:'int',end:'int')->'list': - if start<=0: - start=2 - p=[] - for i in range(start,end+1): - j=0 - for k in range(2,i): - if i%k==0: - j=1 - break - if j==0: - p.append(i) - - return p -#A method to convert Hexadecimal input to binary numbers -def hex2bin(x:'hex')->'bin': - x=str(x) - r='' - for i in x: - if i=='A': - r=r+'1010' - elif i=='B': - r=r+'1011' - elif i=='C': - r=r+'1100' - elif i=='D': - r=r+'1101' - elif i=='E': - r=r+'1110' - elif i=='F': - r=r+'1111' - else: - h=bin(int(i)) - n=h[2:] - for j in range(4): - if len(n)<4: - n='0'+n - - r=r+n - return r - - -#A method to convert Octal input to binary numbers -def oct2bin(x:'oct')->'bin': - r='' - x=str(x) - for i in x: - h=bin(int(i)) - n=h[2:] - for i in range(3): - if len(n)<3: - n='0'+n - r=r+n - return r - -#A method to convert binary input to decimal numbers -def bin2dec(x:'bin')->'int': - x=list(str(x)) - l=len(x) - a=0 - r=0 - for i in range(l-1,-1,-1): - - r=r+(int(x[i])*(2**a)) - - a=a+1 - return r - -# A function that converts a binary string to hexadecimal -def bin2hex(x:'bin')->'hex': - """Converts a binary string to a hexadecimal string. - - This function converts a binary string to hexadecimal. If the binary - string's length is a multiple of 4, simply break up the string into - substrings of 4 binary digits and determine their hexadecimal digit. - If the binary string's length not a multiple of 4 prepend the - necessary number of 0's to make the string a multiple of 4. - - Args: - x ('bin') : Binary string to convert to hexadecimal. - - Returns: - The binary converted to hexadecimal. - - Raises: - No errors - """ - - h = '' # hexadecimal number converted from binary and to be returned - - - x=str(x) - - # Determine if the string has invalid characters - if re.search('[^(0-1)]', x): - raise pi.InvalidBinaryException - - # Get the length of the string - l=len(x) - - # Begin the process of converting x to its hexadecimal number - - # If the length is not a multiple of 4, prepend 0's before converting - if l % 4 != 0: - numZerosPrepended = 4 - ( l % 4 ) # number of zeros to prepend - x = (numZerosPrepended * '0') + x # concatenate numZerosPrepended to x - - - for i in range(len(x)-1, 0, -4): - substring = x[i-3:i+1] # The substring converted to a hex character - - # Determine the binary substring's hex and prepend to h - if substring == '0000': - h = '0' + h - elif substring == '0001': - h = '1' + h - elif substring == '0010': - h = '2' + h - elif substring == '0011': - h = '3' + h - elif substring == '0100': - h = '4' + h - elif substring == '0101': - h = '5' + h - elif substring == '0110': - h = '6' + h - elif substring == '0111': - h = '7' + h - elif substring == '1000': - h = '8' + h - elif substring == '1001': - h = '9' + h - elif substring == '1010': - h = 'A' + h - elif substring == '1011': - h = 'B' + h - elif substring == '1100': - h = 'C' + h - elif substring == '1100': - h = 'C' + h - elif substring == '1101': - h = 'D' + h - elif substring == '1110': - h = 'E' + h - elif substring == '1111': - h = 'F' + h - - return h - - -def bin2oct(x:'bin')->'oct': - o = '' # hexadecimal number converted from binary and to be returned - - x=str(x) - - # Determine if the string has invalid characters - if re.search('[^(0-1)]', x): - raise pi.InvalidBinaryException - - # Get the length of the string - l=len(x) - - # Begin the process of converting x to its hexadecimal number - - # If the length is not a multiple of 3, prepend 0's before converting - if l % 3 != 0: - numZerosPrepended = 3 - ( l % 3 ) # number of zeros to prepend - x = (numZerosPrepended * '0') + x # concatenate numZerosPrepended to x - - for i in range(len(x), 0, -3): - substring = x[i-3:i] - - if substring == '000': - o = '0' + o - elif substring == '001': - o = '1' + o - elif substring == '010': - o = '2' + o - elif substring == '011': - o = '3' + o - elif substring == '100': - o = '4' + o - elif substring == '101': - o = '5' + o - elif substring == '110': - o = '6' + o - elif substring == '111': - o = '7' + o - - return o - - -def ispalindrome(x:'str')->'str': # To check if the given parameter is palindrome or not - x=str(x) #explicitly convert into string data type so as to iterate through each character - r='' - for i in range(len(x)-1,-1,-1): - r=r+x[i] - if x==r: # if the parameter get matched with its reverse then returns true othewise false - return True - else: - return False - - - -def even_or_odd(data:'int'): - try : - if data%2==0: - return 'even' - else: - return 'odd' - - except: - print("\nError occured, parameter passed should be purely numeric") - - - -def remove_punctuation(my_str:'str')->'str': - punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' - # remove punctuations from the string - no_punct = "" - #run a for loop and traverse every element in a string and check ,if char is not match with punctuations char then it will add in no_punct - for char in my_str: - if char not in punctuations: - no_punct = no_punct + char - #return no_punct - return no_punct - -def count_vowels(ip_str:'str')->'int': - # string of vowels - vowels = 'aeiou' - # make it suitable for comparisions - ip_str = ip_str.casefold() - - # make a dictionary with each vowel a key and value 0 - count = {}.fromkeys(vowels,0) - - # count the vowels - for char in ip_str: - if char in count: - count[char] += 1 - - #return the count dictionary - return count - diff --git a/build/lib/easyPythonpi/methods/linkedlist.py b/build/lib/easyPythonpi/methods/linkedlist.py deleted file mode 100644 index fd49a7c..0000000 --- a/build/lib/easyPythonpi/methods/linkedlist.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - - -#Linked list - -def create_node(data:'int')->'list': - class node: - def __init__(self,data): - self.data=data - self.next=None - - a=node(data) - return a - -# to link a node with another node -def node_link(a:'int',b:'int'): - a.next=b - b.next=None - #a=node(data1) - - -# to count number of nodes -def count_node(head:'node')->'int': - if head is None: - return 0 - else: - temp=head - count=0 - while(temp!=None): - count=count+1 - temp=temp.next - return count - -# to diplay a linked list whose header node is passed as an argument. -def display_nodes(head:'node')->'int': - t=head - while t is not None: - print(t.data,"->",end="") - t=t.next - print("NULL") - diff --git a/build/lib/easyPythonpi/methods/matrix.py b/build/lib/easyPythonpi/methods/matrix.py deleted file mode 100644 index 11068f6..0000000 --- a/build/lib/easyPythonpi/methods/matrix.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - - -# Matrix problems - -def matrix_add(array1:'list',array2:'list')->'list': - import numpy as np - - result=np.array(array1)+np.array(array2) - return result - - -def matrix_sub(array1:'list',array2:'list')->'list': - import numpy as np - - result=np.array(array1)-np.array(array2) - return result - - # Multiplication of two -def matrix_mul(matrix1:'list',matrix2:'list')->'list': - import numpy as np - matrix1=np.array(matrix1) # converting list into array - matrix2=np.array(matrix2) - a=list(matrix1.shape) # getting the shape of the array - b=list(matrix2.shape) - if len(a)==1: - k=a[0] # suppose if row is one , for eg [1,2,3] ,then shape returns (3,) instead of [1,3].. - a[1]=k - a[0]=1 # here first element becomes last element and in place of first element , 1 is appended.. - if a[1]==b[0]: # from matrix multiplication convention, number of columns of first matrix needs to be equal to number of rows of second matrix - tt=[] - for i in range(b[0]): - u=[] - for j in range(b[0]): - u.append(matrix2[j][i]) - tt.append(u) - t=np.array(tt) # arrays of coloumn of second matrix - pp=[] - - for k in range(b[0]): - ar=[] - for l in range(b[0]): - y=matrix1[k]*t[l] # multiplication of rows and columns - ar.append(list(y)) # appending the result into a list - pp.append(ar) - l=[] - for i in pp: - zz=[] - for j in i: - sum1=0 - for c in j: - sum1=sum1+c # sum all the element of each row each column - zz.append(sum1) - l.append(zz) # appending the sum of each row and column of result matrix into a list - l=np.array(l) # convert the list of result matrix into array - return l - - - -def matrix_shape(matrix1:'list')->'list': - import numpy as np - matrix1=np.array(matrix1) - a=list(matrix1.shape) - if len(a)==1: - k=a[0] - a[1]=k - a[0]=1 - return a #returns shape of a matrix - - - - -def matrix_transpose(matrix1:'list')->'list': - import numpy as np - matrix1=np.array(matrix1) # converting list into array - a=list(matrix1.shape) # getting the shape of the array - tt=[] - for i in range(a[0]): - u=[] - for j in range(len(a)): - u.append(matrix1[j][i]) - tt.append(u) - t=np.array(tt) # get a transpose of matrix1 - return t - - diff --git a/build/lib/easyPythonpi/methods/search.py b/build/lib/easyPythonpi/methods/search.py deleted file mode 100644 index ead0b38..0000000 --- a/build/lib/easyPythonpi/methods/search.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import heapq - -from collections import deque - -def bfs(graph, start): - visited = set() - queue = deque([start]) - result = [] - - while queue: - node = queue.popleft() - if node not in visited: - visited.add(node) - result.append(node) - queue.extend(set(graph.get(node, [])) - visited) - - return result - -def dfs(graph, start): - visited = set() - stack = [start] - result = [] - - while stack: - node = stack.pop() - if node not in visited: - visited.add(node) - result.append(node) - stack.extend(set(graph.get(node, [])) - visited) - - return result - - -def dijkstra(graph, start): - distances = {vertex: float('infinity') for vertex in graph} - distances[start] = 0 - priority_queue = [(0, start)] - - while priority_queue: - current_distance, current_vertex = heapq.heappop(priority_queue) - - if current_distance > distances[current_vertex]: - continue - - for neighbor, weight in graph[current_vertex].items(): - distance = current_distance + weight - - if distance < distances[neighbor]: - distances[neighbor] = distance - heapq.heappush(priority_queue, (distance, neighbor)) - - return distances - - - -def a_star(graph, start, goal): - open_set = [(0, start)] - came_from = {} - g_score = {vertex: float('infinity') for vertex in graph} - g_score[start] = 0 - f_score = {vertex: float('infinity') for vertex in graph} - f_score[start] = heuristic(start, goal) - - while open_set: - _, current = heapq.heappop(open_set) - - if current == goal: - return reconstruct_path(came_from, current) - - for neighbor, cost in graph[current].items(): - tentative_g_score = g_score[current] + cost - - if tentative_g_score < g_score[neighbor]: - came_from[neighbor] = current - g_score[neighbor] = tentative_g_score - f_score[neighbor] = tentative_g_score + heuristic(neighbor, goal) - heapq.heappush(open_set, (f_score[neighbor], neighbor)) - - return None - -def heuristic(node, goal): - # Define your heuristic function here (e.g., Manhattan distance, Euclidean distance, etc.) - pass - -def reconstruct_path(came_from, current): - path = [current] - while current in came_from: - current = came_from[current] - path.append(current) - return path[::-1] - diff --git a/build/lib/easyPythonpi/methods/sorting.py b/build/lib/easyPythonpi/methods/sorting.py deleted file mode 100644 index 46fbc6d..0000000 --- a/build/lib/easyPythonpi/methods/sorting.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -# To bubble sort and array or list -def sort(list:'list'): - for i in range(len(list) - 1, 0, -1): - for j in range(i): - if list[j] > list[j + 1]: - temp = list[j] - list[j] = list[j + 1] - list[j + 1] = temp diff --git a/build/lib/easyPythonpi/test/__init__.py b/build/lib/easyPythonpi/test/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/build/lib/easyPythonpi/test/__main__.py b/build/lib/easyPythonpi/test/__main__.py deleted file mode 100644 index 6a9b443..0000000 --- a/build/lib/easyPythonpi/test/__main__.py +++ /dev/null @@ -1,15 +0,0 @@ -import test_basics -import test_Bin2Hex -import test_FibRefactored -import test_graph -import test_search - - -def test_all(): - test_basics.TestBasicMath() - #run test cases for all the test files. - -#test all methods -if __name__ == "__main__": - test_all() - diff --git a/build/lib/easyPythonpi/test/test_Bin2Hex.py b/build/lib/easyPythonpi/test/test_Bin2Hex.py deleted file mode 100644 index ea65b99..0000000 --- a/build/lib/easyPythonpi/test/test_Bin2Hex.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import unittest -import easyPythonpi.easyPythonpi as pi - -from easyPythonpi.methods.basics import * - - -class TestBin2Hex(unittest.TestCase): - def test_single_binary_zero(self): - self.assertEqual( bin2hex('0'), '0') - - def test_single_binary_one(self): - self.assertEqual( bin2hex('1'), '1') - - def test_binary_two_zeros(self): - self.assertEqual( bin2hex('00'), '0') - - def test_binary_three_zeros(self): - self.assertEqual( bin2hex('000'), '0') - - def test_binary_four_zeros(self): - self.assertEqual( bin2hex('0000'), '0') - - def test_binary_1111_to_hex(self): - self.assertEqual( bin2hex('1111'), 'F') - - def test_binary_1110_to_hex(self): - self.assertEqual( bin2hex('1110'), 'E') - - def test_binary_1101_to_hex(self): - self.assertEqual( bin2hex('1101'), 'D') - - def test_binary_1100_to_hex(self): - self.assertEqual( bin2hex('1100'), 'C') - - def test_binary_1011_to_hex(self): - self.assertEqual( bin2hex('1011'), 'B') - - def test_binary_1010_to_hex(self): - self.assertEqual( bin2hex('1010'), 'A') - - def test_binary_1001_to_hex(self): - self.assertEqual( bin2hex('1001'), '9') - - def test_binary_1000_to_hex(self): - self.assertEqual( bin2hex('1000'), '8') - - def test_binary_0111_to_hex(self): - self.assertEqual( bin2hex('0111'), '7') - - def test_binary_111_to_hex(self): - self.assertEqual( bin2hex('111'), '7') - - def test_binary_0110_to_hex(self): - self.assertEqual( bin2hex('0110'), '6') - - def test_binary_110_to_hex(self): - self.assertEqual( bin2hex('110'), '6') - - def test_binary_0101_to_hex(self): - self.assertEqual( bin2hex('0101'), '5') - - def test_binary_101_to_hex(self): - self.assertEqual( bin2hex('101'), '5') - - def test_binary_0100_to_hex(self): - self.assertEqual( bin2hex('0100'), '4') - - def test_binary_100_to_hex(self): - self.assertEqual( bin2hex('100'), '4') - - def test_binary_0011_to_hex(self): - self.assertEqual( bin2hex('0011'), '3') - - def test_binary_011_to_hex(self): - self.assertEqual( bin2hex('011'), '3') - - def test_binary_11_to_hex(self): - self.assertEqual( bin2hex('11'), '3') - - def test_binary_0010_to_hex(self): - self.assertEqual( bin2hex('0010'), '2') - - def test_binary_010_to_hex(self): - self.assertEqual( bin2hex('010'), '2') - - def test_binary_10_to_hex(self): - self.assertEqual( bin2hex('10'), '2') - - def test_binary_01_to_hex(self): - self.assertEqual( bin2hex('01'), '1') - - def test_binary_110100001111_to_hex(self): - self.assertEqual( bin2hex('110100001111'), 'D0F') - - def test_binary_0100011111_to_hex(self): - self.assertEqual( bin2hex('0100011111'), '11F') - - def test_invalid_binary_A(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('A') - - def test_invalid_binary_123(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('123') - - def test_invalid_binary_0101A1000100(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('0101A1000100') - - def test_invalid_binary_A101100010B(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('A101100010B') - - def test_invalid_binary_nonalphanumeric(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('!') - - def test_invalid_binary_nonalphanumeric_in_binary(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('001~') - - def test_invalid_binary_subtraction(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('0000-1000') - - def test_invalid_binary_anding(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('0000&1000') - - def test_invalid_helloWorld_expression(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('hello world') - - def test_invalid_regexpression(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2hex('[0-1]') - - -class TestBin2Octal(unittest.TestCase): - def test_single_binary_zero(self): - self.assertEqual( bin2oct('0'), '0') - def test_single_binary_one(self): - self.assertEqual( bin2oct('1'), '1') - def test_single_binary_triple_zero(self): - self.assertEqual( bin2oct('000'), '0') - def test_single_binary_001(self): - self.assertEqual( bin2oct('001'), '1') - def test_single_binary_010(self): - self.assertEqual( bin2oct('010'), '2') - def test_single_binary_011(self): - self.assertEqual( bin2oct('011'), '3') - def test_single_binary_100(self): - self.assertEqual( bin2oct('100'), '4') - def test_single_binary_101(self): - self.assertEqual( bin2oct('101'), '5') - def test_single_binary_110(self): - self.assertEqual( bin2oct('110'), '6') - def test_single_binary_111(self): - self.assertEqual( bin2oct('111'), '7') - def test_single_binary_000010(self): - self.assertEqual( bin2oct('000010'), '02') - def test_single_binary_00010(self): - self.assertEqual( bin2oct('00010'), '02') - def test_invalid_binary_A(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('A') - def test_invalid_binary_123(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('123') - def test_invalid_binary_0101A1000100(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('0101A1000100') - def test_invalid_binary_A101100010B(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('A101100010B') - def test_invalid_binary_nonalphanumeric(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('!') - def test_invalid_binary_nonalphanumeric_in_binary(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('001~') - def test_invalid_binary_subtraction(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('0000-1000') - def test_invalid_binary_anding(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('0000&1000') - def test_invalid_helloWorld_expression(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('hello world') - def test_invalid_regexpression(self): - with self.assertRaises(pi.InvalidBinaryException): - bin2oct('[0-1]') - -if __name__ == '__main__': - unittest.main() diff --git a/build/lib/easyPythonpi/test/test_FibRefactored.py b/build/lib/easyPythonpi/test/test_FibRefactored.py deleted file mode 100644 index d3e2920..0000000 --- a/build/lib/easyPythonpi/test/test_FibRefactored.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import unittest - -from easyPythonpi.methods.basics import fibonacci -from easyPythonpi.easyPythonpi import InvalidNumberFibException - - -class TestFibRefactored(unittest.TestCase): - def test_fibonacci_0(self): - with self.assertRaises(InvalidNumberFibException): - fibonacci(0) - - def test_fibonacci_negative_number(self): - with self.assertRaises(InvalidNumberFibException): - fibonacci(-10) - - def test_fibonacci_1(self): - self.assertEqual( fibonacci(1), 0) - - def test_fibonacci_2(self): - self.assertEqual( fibonacci(2), 1) - - def test_fibonacci_3(self): - self.assertEqual( fibonacci(3), 1) - - def test_fibonacci_4(self): - self.assertEqual( fibonacci(4), 2) - - def test_fibonacci_5(self): - self.assertEqual( fibonacci(5), 3) - - def test_fibonacci_6(self): - self.assertEqual( fibonacci(6), 5) - - def test_fibonacci_7(self): - self.assertEqual( fibonacci(7), 8) - - def test_fibonacci_8(self): - self.assertEqual( fibonacci(8), 13) - - def test_fibonacci_9(self): - self.assertEqual( fibonacci(9), 21) - - def test_fibonacci_10(self): - self.assertEqual( fibonacci(10), 34) - -if __name__ == '__main__': - unittest.main() diff --git a/build/lib/easyPythonpi/test/test_basics.py b/build/lib/easyPythonpi/test/test_basics.py deleted file mode 100644 index 71c8fc0..0000000 --- a/build/lib/easyPythonpi/test/test_basics.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -import unittest - -from easyPythonpi.methods.basics import * - -class TestBasicMath(unittest.TestCase): - def test_add_positive_numbers(self): - self.assertEqual(add(2, 3), 5) - - def test_add_negative_numbers(self): - self.assertEqual(add(-1, 1), 0) - - def test_add_with_zero(self): - self.assertEqual(add(0.5, 0.5), 1.0) - - def test_subtract_positive_numbers(self): - self.assertEqual(sub(5, 2), 3) - - def test_subtract_with_zero(self): - self.assertEqual(sub(0, 0), 0) - - def test_subtract_negative_numbers(self): - self.assertEqual(sub(-1, -1), 0) - - def test_multiply_positive_numbers(self): - self.assertEqual(multi(3, 4), 12) - - def test_multiply_by_zero(self): - self.assertEqual(multi(0, 5), 0) - - def test_multiply_by_negative_numbers(self): - self.assertEqual(multi(-2, 6), -12) - - def test_divide_by_smaller_number(self): - self.assertEqual(div(6, 2), 3.0) - - def test_divide_zero_by_number(self): - self.assertEqual(div(0, 5), 0.0) - - def test_divide_by_zero_raises_exception(self): - with self.assertRaises(ZeroDivisionError): - div(5, 0) - - def test_mod_positive_numbers(self): - self.assertEqual(mod(7, 3), 1) - self.assertEqual(mod(10, 2), 0) - - def test_mod_zero(self): - self.assertEqual(mod(0, 5), 0) - - def test_mod_divide_by_zero(self): - with self.assertRaises(ZeroDivisionError): - mod(8, 0) - - -if __name__ == '__main__': - unittest.main() diff --git a/build/lib/easyPythonpi/test/test_graph.py b/build/lib/easyPythonpi/test/test_graph.py deleted file mode 100644 index c7cf5f4..0000000 --- a/build/lib/easyPythonpi/test/test_graph.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -# Import the necessary modules and classes from graph.py -#from Graph import Graph - -from easyPythonpi.methods.graph import Graph -from easyPythonpi.methods.search import * - -# Create an instance of the Graph class - -graph = Graph() - -# Test adding edges -def test_add_edge(): - graph.add_edge('A', 'B') - graph.add_edge('A', 'C') - graph.add_edge('B', 'C') - graph.add_edge('C', 'A') - assert 'A' in graph.graph - assert 'B' in graph.graph - assert 'C' in graph.graph - assert 'B' in graph.graph['A'] - assert 'C' in graph.graph['A'] - assert 'C' in graph.graph['B'] - - -def test_bfs(): - graph2=Graph() - graph2.add_edge('A', 'B') - graph2.add_edge('A', 'C') - graph2.add_edge('B', 'C') - graph2.add_edge('C', 'D') - result = bfs(graph2.graph, 'A') - assert result == ['A', 'B', 'C', 'D'] - -# Test Depth-First Search (DFS) from main.py -def test_dfs(): - graph3=Graph() - graph3.add_edge('A', 'B') - graph3.add_edge('A', 'C') - graph3.add_edge('B', 'C') - graph3.add_edge('C', 'D') - result = dfs(graph3.graph, 'A') - assert result == ['A', 'C', 'D', 'B'] - -# Run the test -test_bfs() -test_dfs() -test_add_edge() diff --git a/build/lib/easyPythonpi/test/test_search.py b/build/lib/easyPythonpi/test/test_search.py deleted file mode 100644 index 37842ca..0000000 --- a/build/lib/easyPythonpi/test/test_search.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -# Import the necessary modules and functions from searchalgorithms.py - -from easyPythonpi.methods.search import * - -# Create a sample graph for testing -graph = { - 'A': ['B', 'C'], - 'B': ['C', 'D'], - 'C': ['D'], - 'D': ['C'], - 'E': ['F'], - 'F': ['C'], -} - -# Test Breadth-First Search (BFS) -def test_bfs(): - result = bfs(graph, 'A') - assert result == ['A', 'B', 'C', 'D'] - -# Test Depth-First Search (DFS) -def test_dfs(): - result = dfs(graph, 'A') - assert result == ['A', 'C', 'D', 'B'] - -# Run the tests -test_bfs() -test_dfs() diff --git a/dist/easyPythonpi-0.0.0-py3.10.egg b/dist/easyPythonpi-0.0.0-py3.10.egg deleted file mode 100644 index f0e6bf7..0000000 Binary files a/dist/easyPythonpi-0.0.0-py3.10.egg and /dev/null differ diff --git a/easyPythonpi.egg-info/PKG-INFO b/easyPythonpi.egg-info/PKG-INFO deleted file mode 100644 index a84cc69..0000000 --- a/easyPythonpi.egg-info/PKG-INFO +++ /dev/null @@ -1,13 +0,0 @@ -Metadata-Version: 2.1 -Name: easyPythonpi -Version: 0.0.0 -Summary: A simple library for Python beginners -Author: extinctsion (Aditya Sharma) -Author-email: -Keywords: python,sorting,beginners,sockets -Classifier: Development Status :: 1 - Planning -Classifier: Programming Language :: Python :: 3 -Classifier: Operating System :: Unix -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Operating System :: Microsoft :: Windows -Description-Content-Type: text/markdown diff --git a/easyPythonpi.egg-info/SOURCES.txt b/easyPythonpi.egg-info/SOURCES.txt deleted file mode 100644 index 65f98b9..0000000 --- a/easyPythonpi.egg-info/SOURCES.txt +++ /dev/null @@ -1,25 +0,0 @@ -README.md -setup.py -easyPythonpi/__init__.py -easyPythonpi/__main__.py -easyPythonpi/easyPythonpi.py -easyPythonpi.egg-info/PKG-INFO -easyPythonpi.egg-info/SOURCES.txt -easyPythonpi.egg-info/dependency_links.txt -easyPythonpi.egg-info/requires.txt -easyPythonpi.egg-info/top_level.txt -easyPythonpi/methods/Graph.py -easyPythonpi/methods/__init__.py -easyPythonpi/methods/array.py -easyPythonpi/methods/basics.py -easyPythonpi/methods/linkedlist.py -easyPythonpi/methods/matrix.py -easyPythonpi/methods/search.py -easyPythonpi/methods/sorting.py -easyPythonpi/test/__init__.py -easyPythonpi/test/__main__.py -easyPythonpi/test/test_Bin2Hex.py -easyPythonpi/test/test_FibRefactored.py -easyPythonpi/test/test_basics.py -easyPythonpi/test/test_graph.py -easyPythonpi/test/test_search.py \ No newline at end of file diff --git a/easyPythonpi.egg-info/dependency_links.txt b/easyPythonpi.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/easyPythonpi.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/easyPythonpi.egg-info/requires.txt b/easyPythonpi.egg-info/requires.txt deleted file mode 100644 index b0e64dd..0000000 --- a/easyPythonpi.egg-info/requires.txt +++ /dev/null @@ -1 +0,0 @@ -numpy>=1.19.5 diff --git a/easyPythonpi.egg-info/top_level.txt b/easyPythonpi.egg-info/top_level.txt deleted file mode 100644 index 9036ae2..0000000 --- a/easyPythonpi.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -easyPythonpi