Skip to content
This repository
Browse code

Extended API documentation to include all significant methods.

  • Loading branch information...
commit 17e0d322932c58fb06e67f3bf628e52c1ca47ffb 1 parent 7e17e8b
Calum J. Eadie authored

Showing 1 changed file with 41 additions and 22 deletions. Show diff stats Hide diff stats

  1. +41 22 microbuild/microbuild.py
63 microbuild/microbuild.py
@@ -18,7 +18,7 @@
18 18
19 19 def build(module,args):
20 20 """
21   - Build the specified module.
  21 + Build the specified module with specified arguments.
22 22
23 23 @type module: module
24 24 @type args: list of arguments
@@ -34,6 +34,11 @@ def build(module,args):
34 34 _run_from_task_name(module,args.task)
35 35
36 36 def _run_from_task_name(module,task_name):
  37 + """
  38 + @type module: module
  39 + @type task_name: string
  40 + @param task_name: Task name, exactly corresponds to function name.
  41 + """
37 42
38 43 # Create logger.
39 44 logger = _get_logger(module)
@@ -41,27 +46,6 @@ def _run_from_task_name(module,task_name):
41 46 task = getattr(module,task_name)
42 47 _run(module,logger,task,set([]))
43 48
44   -def _get_logger(module):
45   -
46   - # Create Logger
47   - logger = logging.getLogger(os.path.basename(module.__file__))
48   - logger.setLevel(logging.DEBUG)
49   -
50   - # Create console handler and set level to debug
51   - ch = logging.StreamHandler()
52   - ch.setLevel(logging.DEBUG)
53   -
54   - # Create formatter
55   - formatter = logging.Formatter(_LOGGING_FORMAT)
56   -
57   - # Add formatter to ch
58   - ch.setFormatter(formatter)
59   -
60   - # Add ch to logger
61   - logger.addHandler(ch)
62   -
63   - return logger
64   -
65 49 def _run(module,logger,task,completed_tasks):
66 50 """
67 51 @type module: module
@@ -104,6 +88,10 @@ def _run(module,logger,task,completed_tasks):
104 88 return completed_tasks
105 89
106 90 def _create_parser(module):
  91 + """
  92 + @type module: module
  93 + @rtype: argparse.ArgumentParser
  94 + """
107 95
108 96 # Get all tasks.
109 97 tasks = _get_tasks(module)
@@ -195,6 +183,8 @@ def __call__(self,func):
195 183 def ignore(obj):
196 184 """
197 185 Decorator to specify that a task should be ignored.
  186 +
  187 + @type obj: function or Task, depending on order @ignore and @task used
198 188 """
199 189 obj.ignorable = True
200 190 return obj
@@ -230,6 +220,8 @@ def is_ignorable(self):
230 220 def _get_tasks(module):
231 221 """
232 222 Returns all functions marked as tasks.
  223 +
  224 + @type module: module
233 225 """
234 226 # Get all functions that are marked as task and pull out the task object
235 227 # from each (name,value) pair.
@@ -238,5 +230,32 @@ def _get_tasks(module):
238 230 def _get_max_name_length(module):
239 231 """
240 232 Returns the length of the longest task name.
  233 +
  234 + @type module: module
241 235 """
242 236 return max([len(task.__name__) for task in _get_tasks(module)])
  237 +
  238 +def _get_logger(module):
  239 + """
  240 + @type module: module
  241 + @rtype: logging.Logger
  242 + """
  243 +
  244 + # Create Logger
  245 + logger = logging.getLogger(os.path.basename(module.__file__))
  246 + logger.setLevel(logging.DEBUG)
  247 +
  248 + # Create console handler and set level to debug
  249 + ch = logging.StreamHandler()
  250 + ch.setLevel(logging.DEBUG)
  251 +
  252 + # Create formatter
  253 + formatter = logging.Formatter(_LOGGING_FORMAT)
  254 +
  255 + # Add formatter to ch
  256 + ch.setFormatter(formatter)
  257 +
  258 + # Add ch to logger
  259 + logger.addHandler(ch)
  260 +
  261 + return logger

0 comments on commit 17e0d32

Please sign in to comment.
Something went wrong with that request. Please try again.