Skip to content

Commit cd9261d

Browse files
committed
Add documentation
1 parent ce1cddc commit cd9261d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tools/toolchains/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ def is_ignored(self, file_path):
430430
return True
431431
return False
432432

433+
# Create a Resources object from the path pointed to by *path* by either traversing a
434+
# a directory structure, when *path* is a directory, or adding *path* to the resources,
435+
# when *path* is a file.
436+
# The parameter *base_path* is used to set the base_path attribute of the Resources
437+
# object and the parameter *exclude_paths* is used by the directory traversal to
438+
# exclude certain paths from the traversal.
433439
def scan_resources(self, path, exclude_paths=None, base_path=None):
434440
resources = Resources(path)
435441
if not base_path:
@@ -445,6 +451,9 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
445451
self._add_dir(path, resources, base_path, exclude_paths=exclude_paths)
446452
return resources
447453

454+
# A helper function for scan_resources. _add_dir traverses *path* (assumed to be a
455+
# directory) and heeds the ".mbedignore" files along the way. _add_dir calls _add_file
456+
# on every file it considers adding to the resources object.
448457
def _add_dir(self, path, resources, base_path, exclude_paths=None):
449458
""" os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])
450459
When topdown is True, the caller can modify the dirnames list in-place
@@ -508,6 +517,8 @@ def _add_dir(self, path, resources, base_path, exclude_paths=None):
508517
file_path = join(root, file)
509518
self._add_file(file_path, resources, base_path)
510519

520+
# A helper function for both scan_resources and _add_dir. _add_file adds one file
521+
# (*file_path*) to the resources object based on the file type.
511522
def _add_file(self, file_path, resources, base_path, exclude_paths=None):
512523
resources.file_basepath[file_path] = base_path
513524

0 commit comments

Comments
 (0)