Skip to content

Commit 6cc7413

Browse files
committed
removing test cases on macOS and WinOS
1 parent cd81724 commit 6cc7413

30 files changed

Lines changed: 1270 additions & 1 deletion

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
15-
os: [ubuntu-latest, windows-latest, macos-latest]
15+
os: [ubuntu-latest]
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Set up Python version ${{ matrix.python-version }}

build/lib/easyPythonpi/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
import __main__
12+
13+
__all__ = ('easyPythonpi_VERSION')
14+
15+
easyPythonpi_VERSION = '1.1.9'

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+
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/usr/bin/env python
2+
#-*- coding: utf-8 -*-
3+
4+
import easyPythonpi as pi
5+
import regex as re
6+
7+
def add(x:'float', y:'float')->'float': # For addition of 2 numbers
8+
return x+y
9+
10+
def sub(x:'float', y:'float')->'float': # For substraction of 2 numbers
11+
return x-y
12+
13+
def multi(x:'float', y:'float')->'float': # For multiplication of 2 numbers
14+
return x*y
15+
16+
def div(x:'float', y:'float')->'float': # For division of 2 numbers
17+
return x/y
18+
19+
def mod(x:'float', y:'float')->'float': # For finding the modulus of 2 numbers
20+
return x%y
21+
22+
def calculate_percentage(part, whole):
23+
if whole == 0:
24+
return 0 # Avoid division by zero
25+
return (part / whole) * 100
26+
27+
28+
def factorial(n:'int')->'int': # To find the factorial of 2 numbers
29+
# single line to find factorial
30+
return 1 if (n == 1 or n == 0) else n * factorial(n - 1)
31+
32+
# To compute the factord of the argument passed
33+
def factors(n:'int')->'int':
34+
factors = []
35+
for i in range(1, n+1):
36+
if n % i == 0:
37+
factors.append(i)
38+
return factors
39+
40+
def Area_circle(r:'float')->'float': # To find the area of a circle using the radius r
41+
PI = 3.142
42+
return PI * (r * r)
43+
44+
def Perimeter_circle(r:'float')->'float': # To find the perimeter of a circle using the radius r
45+
PI = 3.142
46+
return 2 * PI * r
47+
48+
def fibonacci(n:'int')->'int': #To find the nth fibonacci series
49+
"""Finds the fibonacci of the nth sequence.
50+
51+
This function calculates the fibonacci sequence. This function calculates
52+
the nth fibonacci of a number by finding the sum of two numbers in the
53+
fibonacci sequence before n
54+
55+
Args:
56+
n ('int') : The number to find the fibonacci sequence of, assumes n >=1
57+
as valid numbers to find the fibonacci of n.
58+
59+
Returns:
60+
The fibonacci of arg n.
61+
62+
Raises:
63+
No errors
64+
"""
65+
if n<=0:
66+
raise pi.InvalidNumberFibException(n)
67+
# First Fibonacci number is 0
68+
elif n==1:
69+
return 0
70+
# Second Fibonacci number is 1
71+
elif n==2:
72+
return 1
73+
else:
74+
fib1 = 0
75+
fib2 = 1
76+
77+
for i in range(2,n-1):
78+
fibN = fib1 + fib2
79+
fib1 = fib2
80+
fib2 = fibN
81+
82+
return fib1 +fib2
83+
84+
#method to print the 1st prime number between the range
85+
def printprime(start:'int',end:'int')->'list':
86+
if start<=0:
87+
start=2
88+
p=[]
89+
for i in range(start,end+1):
90+
j=0
91+
for k in range(2,i):
92+
if i%k==0:
93+
j=1
94+
break
95+
if j==0:
96+
p.append(i)
97+
98+
return p
99+
100+
def even_or_odd(data:'int'):
101+
try :
102+
if data%2==0:
103+
return 'even'
104+
else:
105+
return 'odd'
106+
107+
except:
108+
print("\nError occured, parameter passed should be purely numeric")

0 commit comments

Comments
 (0)