Skip to content

Commit 8ca14a0

Browse files
author
Ian Doarn
authored
Merge branch 'master' into master
2 parents 31ae442 + e3ac07b commit 8ca14a0

File tree

19 files changed

+239
-200
lines changed

19 files changed

+239
-200
lines changed

CONTIRBUTORS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
- Songzhuozhuo '[souo](https://github.com/souo)'
1414
- Emil '[Skeen](https://github.com/Skeen)' Madsen
1515
- Ian '[IanDoarn](https://github.com/IanDoarn)' Doarn
16-
- Timothy '[Tjstretchalot](https://github.com/Tjstretchalot)' Moore
16+
- Timothy '[Tjstretchalot](https://github.com/Tjstretchalot)' Moore
17+
- Sharad '[sharadbhat](https://github.com/sharadbhat)' Bhat
18+
- Alexey '[aesee](https://github.com/aesee)' Sarapulov
19+
- Anthony '[MrDupin](https://github.com/MrDupin)' Marakis

pygorithm/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
"""
3232

33-
__version__ = '1.0.0'
33+
__version__ = '1.0.3'
3434
__author__ = 'Omkar Pathak'
3535

3636
# List maintainers here
@@ -65,4 +65,5 @@
6565
'sorting',
6666
'string',
6767
'pathfinding'
68+
'geometry',
6869
]

pygorithm/data_structures/__init__.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
"""
22
Collection of data structure examples
33
"""
4-
from . import graph
5-
from . import heap
6-
from . import linked_list
7-
from . import queue
8-
from . import stack
9-
from . import tree
4+
import pkgutil
105

11-
__all__ = [
12-
'graph',
13-
'heap',
14-
'linked_list',
15-
'queue',
16-
'stack',
17-
'tree',
18-
'trie'
19-
]
6+
def modules():
7+
"""
8+
Find all functions in pygorithm.data_structures
9+
"""
10+
from pygorithm import data_structures
11+
package = data_structures
12+
modules_list = []
13+
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
14+
modules_list.append(modname)
15+
modules_list.remove('modules')
16+
modules_list.sort()
17+
return modules_list
18+
19+
modules_list = modules()
20+
21+
__all__ = modules_list

pygorithm/data_structures/modules.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

pygorithm/fibonacci/__init__.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
"""
22
Collection of fibonacci methods and functions
33
"""
4-
from . import generator
5-
from . import goldenratio
6-
from . import memoization
7-
from . import modules
8-
from . import recursion
4+
import pkgutil
95

10-
__all__ = [
11-
'generator',
12-
'goldenratio',
13-
'memoization',
14-
'recursion'
15-
]
6+
def modules():
7+
"""
8+
Find all functions in pygorithm.fibonacci
9+
"""
10+
from pygorithm import fibonacci
11+
package = fibonacci
12+
modules_list = []
13+
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
14+
modules_list.append(modname)
15+
modules_list.remove('modules')
16+
modules_list.sort()
17+
return modules_list
18+
19+
modules_list = modules()
20+
21+
__all__ = modules_list

pygorithm/fibonacci/modules.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

pygorithm/geometry/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Collection of special geometry functions
3+
"""
4+
import pkgutil
5+
6+
def modules():
7+
"""
8+
Find all functions in pygorithm.geometry
9+
"""
10+
from pygorithm import geometry
11+
package = geometry
12+
modules_list = []
13+
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
14+
modules_list.append(modname)
15+
modules_list.remove('modules')
16+
modules_list.sort()
17+
return modules_list
18+
19+
modules_list = modules()
20+
21+
__all__ = modules_list
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
Author: ALEXEY SARAPULOV
3+
Created On: 23 August 2017
4+
"""
5+
6+
# To test if two rectangle intersect, we only have to find out
7+
# if their projections intersect on all of the coordinate axes
8+
9+
import inspect
10+
11+
12+
class Coord:
13+
"""Coord
14+
Class to initialize Coordinate of one point
15+
"""
16+
17+
def __init__(self, x, y):
18+
self.x = x
19+
self.y = y
20+
21+
22+
class SimpleRectangle:
23+
"""SimpleRectangle
24+
Class to initialize Body of Object
25+
"""
26+
27+
def __init__(self, coord1, coord2):
28+
"""
29+
:type coord1: object of class Coord
30+
:type coord2: object of class Coord
31+
"""
32+
self.min_x = coord1.x
33+
self.min_y = coord1.y
34+
self.max_x = coord2.x
35+
self.max_y = coord2.y
36+
37+
38+
def broad_phase(simpleRect1, simpleRect2):
39+
"""
40+
:type simpleRect1: object
41+
:type simpleRect2: object
42+
"""
43+
d1x = simpleRect2.min_x - simpleRect1.max_x
44+
d1y = simpleRect2.min_y - simpleRect1.max_y
45+
d2x = simpleRect1.min_x - simpleRect2.max_x
46+
d2y = simpleRect1.min_y - simpleRect2.max_y
47+
48+
if d1x > 0 or d1y > 0:
49+
return False
50+
51+
if d2x > 0 or d2y > 0:
52+
return False
53+
54+
return True
55+
56+
57+
def get_code():
58+
"""
59+
returns the code for the broad phase function
60+
"""
61+
return inspect.getsource(broad_phase)

pygorithm/math/__init__.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
"""
22
Collection of special math functions
33
"""
4-
from . import lcm
5-
from . import lcm_using_gcd
6-
from . import sieve_of_eratosthenes
4+
import pkgutil
75

8-
__all__ = [
9-
'lcm',
10-
'lcm_using_gcd',
11-
'sieve_of_eratosthenes'
12-
]
6+
def modules():
7+
"""
8+
Find all functions in pygorithm.math
9+
"""
10+
from pygorithm import math
11+
package = math
12+
modules_list = []
13+
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
14+
modules_list.append(modname)
15+
modules_list.remove('modules')
16+
modules_list.sort()
17+
return modules_list
18+
19+
modules_list = modules()
20+
21+
__all__ = modules_list

pygorithm/math/modules.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)