Skip to content

Commit ac09fe8

Browse files
authored
Changed the library and given new look v 1.1.9 -> Testbranch (#56)
* Changed all the files path and fixed everything * again made a change including changes in all the files
1 parent a61b99c commit ac09fe8

21 files changed

+145
-98
lines changed

easyPythonpi/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
from easyPythonpi.easyPythonpi import *
2-
from easyPythonpi.methods.array import *
3-
from easyPythonpi.methods.basics import *
4-
from easyPythonpi.methods.matrix import *
5-
from easyPythonpi.methods.linkedlist import *
6-
from easyPythonpi.methods.sorting import *
7-
from easyPythonpi.methods.Graph import *
8-
from easyPythonpi.methods.search import *
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
93

4+
""" A python module that helps you to calculate some of the most used calculations.....
5+
usage--
6+
Just download the file from git and unzip in ur system.
7+
And while using this module, just write as code-
8+
'from easypythonpi import *' and u r good to go...
9+
~Happy programming"""
1010

11+
__all__ = ('easyPythonpi_VERSION')
12+
13+
easyPythonpi_VERSION = '1.1.9'

easyPythonpi/__main__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
from easyPythonpi.methods.array import *
5+
from easyPythonpi.methods.basics import *
6+
from easyPythonpi.methods.graph import *
7+
from easyPythonpi.methods.linkedlist import *
8+
from easyPythonpi.methods.matrix import *
9+
from easyPythonpi.methods.search import *
10+
from easyPythonpi.methods.sorting import *
11+
12+
from easyPythonpi.test.test_basics import *
13+
from easyPythonpi.test.test_Bin2Hex import *
14+
from easyPythonpi.test.test_FibRefactored import *
15+
from easyPythonpi.test.test_graph import *
16+
from easyPythonpi.test.test_search import *
17+
18+
if __name__ == "__main__":
19+
pass
Binary file not shown.

easyPythonpi/easyPythonpi.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
1-
import regex as re,os,sys
2-
from methods.Graph import *
3-
from methods.search import *
4-
from methods.sorting import *
5-
from methods.array import *
6-
from methods.basics import *
7-
from methods.linkedlist import *
8-
from methods.matrix import *
1+
92
""" A python module that helps you to calculate some of the most used calculations.....
103
usage--
114
Just download the file from git and unzip in ur system.
125
And while using this module, just write as code-
13-
'from module import *' and u r good to go...
6+
'from easypythonpi import *' and u r good to go...
147
~Happy programming"""
158

169

1710
# Programmer defined exceptions go here:
1811

1912
# define exception for invalid Binary Strings
2013

21-
2214
class InvalidBinaryException(Exception):
2315
pass
2416

easyPythonpi/methods/Graph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
15
class Graph:
26
def __init__(self):
37
self.graph = {}

easyPythonpi/methods/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-

easyPythonpi/methods/array.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
def createarray(length:'int',dtype='int')->'array': # To create an array of entered length and entered data type(interger data type is a default data type)
2-
import numpy as np
3-
a=[] #empty list
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
import numpy as np
5+
6+
7+
def createarray(length:'int',dtype='int')->'list':
8+
# To create an array of entered length and entered data type(interger data type is a default data type)
9+
new_array=[] #empty list
410
for i in range(length):
511
# if entered dtype is an interger
6-
if dtype=='int':
7-
e=int(input(f"Enter {i+1} element : "))
8-
a.append(e)
12+
if dtype=='int':
13+
array_input=int(input(f"Enter {i+1} element : "))
14+
new_array.append(array_input)
915
# if entered dtype is a string
10-
elif dtype=='str' or dtype=='string':
11-
e=str(input("Enter {i+1} element : "))
12-
a.append(e)
16+
elif dtype=='str' or dtype=='string':
17+
array_input=str(input("Enter {i+1} element : "))
18+
new_array.append(array_input)
1319
# if entered dtype is a float
14-
elif dtype=='float':
15-
e=float(input("Enter {i+1} element : "))
16-
a.append(e)
17-
18-
19-
b=np.array(a)
20-
return b
20+
elif dtype=='float':
21+
array_input=float(input("Enter {i+1} element : "))
22+
new_array.append(array_input)
2123

22-
def arrayrev(array:'array')->'array': # To reverese the array elements
23-
import numpy as np
24-
r=[]
24+
created_array = np.array(new_array)
25+
26+
return created_array
27+
28+
def arrayrev(array:'list')->'list':
29+
# To reverese the array elements
30+
temp_array=[]
2531
for i in range(len(array)-1,-1,-1):
26-
r.append(array[i])
27-
a=np.array(r)
28-
return a
32+
temp_array.append(array[i])
33+
reversed_array=np.array(temp_array)
34+
35+
return reversed_array
2936

easyPythonpi/methods/basics.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
import easyPythonpi.easyPythonpi as pi
15
import regex as re
2-
import os,sys
3-
p=os.getcwd()[:-11]
4-
sys.path.append(p)
5-
import easyPythonpi as pi
6+
67
def add(x:'float', y:'float')->'float': # For addition of 2 numbers
78
return x+y
89

@@ -48,7 +49,7 @@ def factors(n:'int')->'int':
4849
factors.append(i)
4950
return factors
5051

51-
def Area_circle(r:'double')->'double': # To find the area of a circle using the radius r
52+
def Area_circle(r:'float')->'float': # To find the area of a circle using the radius r
5253
PI = 3.142
5354
return PI * (r * r)
5455

@@ -152,7 +153,7 @@ def oct2bin(x:'oct')->'bin':
152153
return r
153154

154155
#A method to convert binary input to decimal numbers
155-
def bin2dec(x:'bin')->'dec':
156+
def bin2dec(x:'bin')->'int':
156157
x=list(str(x))
157158
l=len(x)
158159
a=0

easyPythonpi/methods/linkedlist.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
13

24

35
#Linked list
46

5-
def create_node(data:'int')->'Linked list':
7+
def create_node(data:'int')->'list':
68
class node:
79
def __init__(self,data):
810
self.data=data
911
self.next=None
1012

1113
a=node(data)
1214
return a
13-
# to link a node with another node
1415

16+
# to link a node with another node
1517
def node_link(a:'int',b:'int'):
1618
a.next=b
1719
b.next=None
1820
#a=node(data1)
1921

2022

21-
# to count number of nodes
22-
23+
# to count number of nodes
2324
def count_node(head:'node')->'int':
2425
if head is None:
2526
return 0
@@ -31,8 +32,7 @@ def count_node(head:'node')->'int':
3132
temp=temp.next
3233
return count
3334

34-
# to diplay a linked list whose header node is passed as an argument
35-
35+
# to diplay a linked list whose header node is passed as an argument.
3636
def display_nodes(head:'node')->'int':
3737
t=head
3838
while t is not None:

easyPythonpi/methods/matrix.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
14

25
# Matrix problems
36

4-
def matrix_add(array1:'array',array2:'array')->'array':
7+
def matrix_add(array1:'list',array2:'list')->'list':
58
import numpy as np
69

710
result=np.array(array1)+np.array(array2)
811
return result
912

1013

11-
def matrix_sub(array1:'array',array2:'array')->'array':
14+
def matrix_sub(array1:'list',array2:'list')->'list':
1215
import numpy as np
1316

1417
result=np.array(array1)-np.array(array2)
1518
return result
1619

1720
# Multiplication of two
18-
def matrix_mul(matrix1:'array',matrix2:'array')->'array':
21+
def matrix_mul(matrix1:'list',matrix2:'list')->'list':
1922
import numpy as np
2023
matrix1=np.array(matrix1) # converting list into array
2124
matrix2=np.array(matrix2)
@@ -55,7 +58,7 @@ def matrix_mul(matrix1:'array',matrix2:'array')->'array':
5558

5659

5760

58-
def matrix_shape(matrix1:'array')->'list':
61+
def matrix_shape(matrix1:'list')->'list':
5962
import numpy as np
6063
matrix1=np.array(matrix1)
6164
a=list(matrix1.shape)
@@ -68,7 +71,7 @@ def matrix_shape(matrix1:'array')->'list':
6871

6972

7073

71-
def matrix_transpose(matrix1:'array')->'array':
74+
def matrix_transpose(matrix1:'list')->'list':
7275
import numpy as np
7376
matrix1=np.array(matrix1) # converting list into array
7477
a=list(matrix1.shape) # getting the shape of the array

0 commit comments

Comments
 (0)