7
7
import os
8
8
9
9
def read_index (index_path ):
10
- """Read the index of strategies"""
10
+ """
11
+ Read the index of strategies
12
+
13
+ Parameters
14
+ ----------
15
+ index_path : str
16
+ A file path for the index file where all strategies are auto documented
17
+
18
+ Returns
19
+ -------
20
+ strategies_reference : str
21
+ The string value of the contents of the index file.
22
+ """
11
23
with open (index_path , "r" ) as f :
12
24
strategies_reference = f .read ()
13
25
return strategies_reference
@@ -16,6 +28,16 @@ def get_module_name(module_path):
16
28
"""
17
29
Take string of the form `./axelrod/strategies/titfortat.py` and returns
18
30
`titfortat`.
31
+
32
+ Parameters
33
+ ----------
34
+ module_path : str
35
+ A file path for a module file.
36
+
37
+ Returns
38
+ -------
39
+ module_name : str
40
+ The name of the module
19
41
"""
20
42
filename = os .path .basename (module_path )
21
43
module_name = os .path .splitext (filename )[0 ]
@@ -25,11 +47,24 @@ def check_module(module_path,
25
47
index_path = "./docs/reference/all_strategies.rst" ,
26
48
excluded = ("_strategies" , "__init__" , "_filters" , "human" )):
27
49
"""
28
- Check if a module is contained in the index of strategies
50
+ Check if a module name is written in the index of strategies.
51
+
52
+ Parameters
53
+ ----------
54
+ module_path : str
55
+ A file path for a module file.
56
+ index_path : str
57
+ A file path for the index file where all strategies are auto documented
58
+ excluded : tuple
59
+ A collection of module names to be ignored
60
+
61
+ Returns
62
+ -------
63
+ boolean : bool
64
+ True/False if module is referenced.
29
65
30
- Returns boolean: True/False if module is referenced.
31
66
"""
32
- strategies_reference = read_index (index_path )
67
+ strategies_index = read_index (index_path )
33
68
module_name = get_module_name (module_path )
34
69
if module_name not in excluded :
35
70
if module_name not in strategies_reference :
0 commit comments