diff options
author | Alec Warner <antarus@gentoo.org> | 2007-01-11 19:02:17 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-01-11 19:02:17 +0000 |
commit | d5535498aa8a08d44b6195a6482edd5deb2fa8b3 (patch) | |
tree | dd26082380d5819e9ec252467126999356e14d80 | |
parent | 71a41f72cc38e646ed2945f4c7b343a60247d968 (diff) | |
download | portage-d5535498aa8a08d44b6195a6482edd5deb2fa8b3.tar.gz portage-d5535498aa8a08d44b6195a6482edd5deb2fa8b3.tar.bz2 portage-d5535498aa8a08d44b6195a6482edd5deb2fa8b3.zip |
docs for grabdict
svn path=/main/trunk/; revision=5556
-rw-r--r-- | pym/portage_util.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py index 2d92fc048..407dcc122 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -178,7 +178,27 @@ def stack_lists(lists, incremental=1): return new_list.keys() def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1): - """This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary""" + """ + This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary + + @param myfilename: file to process + @type myfilename: string (path) + @param juststrings: only return strings + @type juststrings: Boolean (integer) + @param empty: Ignore certain lines + @type empty: Boolean (integer) + @param recursive: Recursively grab ( support for /etc/portage/package.keywords/* and friends ) + @type recursive: Boolean (integer) + @param incremental: Append to the return list, don't overwrite + @type incremental: Boolean (integer) + @rtype: Dictionary + @returns: + 1. Returns the lines in a file in a dictionary, for example: + 'sys-apps/portage x86 amd64 ppc' + would return + { "sys-apps/portage" : [ 'x86', 'amd64', 'ppc' ] + the line syntax is key : [list of values] + """ newdict={} for x in grablines(myfilename, recursive): #the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line |