From d5535498aa8a08d44b6195a6482edd5deb2fa8b3 Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Thu, 11 Jan 2007 19:02:17 +0000 Subject: docs for grabdict svn path=/main/trunk/; revision=5556 --- pym/portage_util.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'pym/portage_util.py') 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 -- cgit v1.2.3-1-g7c22