Skip to content

Commit 2cd8ce6

Browse files
authored
Merge branch 'testbranch' into master
2 parents ac09fe8 + 870b9a0 commit 2cd8ce6

25 files changed

+1163
-0
lines changed

build/lib/easyPythonpi/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
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"""
10+
11+
__all__ = ('easyPythonpi_VERSION')
12+
13+
easyPythonpi_VERSION = '1.1.9'
14+
import __main__

build/lib/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
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
""" A python module that helps you to calculate some of the most used calculations.....
3+
usage--
4+
Just download the file from git and unzip in ur system.
5+
And while using this module, just write as code-
6+
'from easypythonpi import *' and u r good to go...
7+
~Happy programming"""
8+
9+
10+
# Programmer defined exceptions go here:
11+
12+
# define exception for invalid Binary Strings
13+
14+
class InvalidBinaryException(Exception):
15+
pass
16+
17+
class InvalidNumberFibException(Exception):
18+
def __init__(self, n, message="n is not valid, must be greater than or equal to 1"):
19+
self.n = n
20+
self.message = message
21+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
5+
class Graph:
6+
def __init__(self):
7+
self.graph = {}
8+
9+
def add_edge(self, u, v):
10+
if u not in self.graph:
11+
self.graph[u] = []
12+
self.graph[u].append(v)
13+
14+
def add_vertex(self, vertex):
15+
if vertex not in self.graph:
16+
self.graph[vertex] = []
17+
18+
def get_vertices(self):
19+
return list(self.graph.keys())
20+
21+
def get_edges(self):
22+
edges = []
23+
for vertex, neighbors in self.graph.items():
24+
for neighbor in neighbors:
25+
edges.append((vertex, neighbor))
26+
return edges
27+
28+
def is_vertex_exist(self, vertex):
29+
return vertex in self.graph
30+
31+
def is_edge_exist(self, u, v):
32+
return u in self.graph and v in self.graph[u]
33+
34+
def remove_edge(self, u, v):
35+
if self.is_edge_exist(u, v):
36+
self.graph[u].remove(v)
37+
38+
def remove_vertex(self, vertex):
39+
if self.is_vertex_exist(vertex):
40+
del self.graph[vertex]
41+
for u in self.graph:
42+
self.graph[u] = [v for v in self.graph[u] if v != vertex]
43+
44+
def clear(self):
45+
self.graph = {}
46+
47+
def __str__(self):
48+
return str(self.graph)
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 -*-
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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
10+
for i in range(length):
11+
# if entered dtype is an interger
12+
if dtype=='int':
13+
array_input=int(input(f"Enter {i+1} element : "))
14+
new_array.append(array_input)
15+
# if entered dtype is a string
16+
elif dtype=='str' or dtype=='string':
17+
array_input=str(input("Enter {i+1} element : "))
18+
new_array.append(array_input)
19+
# if entered dtype is a float
20+
elif dtype=='float':
21+
array_input=float(input("Enter {i+1} element : "))
22+
new_array.append(array_input)
23+
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=[]
31+
for i in range(len(array)-1,-1,-1):
32+
temp_array.append(array[i])
33+
reversed_array=np.array(temp_array)
34+
35+
return reversed_array
36+

0 commit comments

Comments
 (0)