From: Alec Warner Date: Thu, 11 Jan 2007 19:02:17 +0000 (-0000) Subject: docs for grabdict X-Git-Tag: v2.1.2~75 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d5535498aa8a08d44b6195a6482edd5deb2fa8b3;p=portage.git docs for grabdict svn path=/main/trunk/; revision=5556 --- 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