* [PATCH] bitbake: fetch2: Have decodeurl() return a namedtuple
@ 2015-02-26 18:44 Randy Witt
0 siblings, 0 replies; only message in thread
From: Randy Witt @ 2015-02-26 18:44 UTC (permalink / raw)
To: bitbake-devel
Since decodeurl() returns a tuple with six values, return a namedtuple
instead, so the result is easier to use and assists in writing cleaner code.
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
---
bitbake/lib/bb/fetch2/__init__.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 599ea8c..8dfe978 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -39,6 +39,7 @@ import bb.checksum
from bb import data
import bb.process
import subprocess
+from collections import namedtuple
__version__ = "2"
_checksum_cache = bb.checksum.FileChecksumCache()
@@ -379,8 +380,9 @@ def decodeurl(url):
raise MalformedUrl(url, "The URL: '%s' is invalid: parameter %s does not specify a value (missing '=')" % (url, s))
s1, s2 = s.split('=')
p[s1] = s2
-
- return type, host, urllib.unquote(path), user, pswd, p
+ result_tuple = namedtuple('decodeurl_tuple',
+ 'type, host, path, user, password, parameters')
+ return result_tuple(type, host, urllib.unquote(path), user, pswd, p)
def encodeurl(decoded):
"""Encodes a URL from tokens (scheme, network location, path,
--
1.9.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-26 18:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 18:44 [PATCH] bitbake: fetch2: Have decodeurl() return a namedtuple Randy Witt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.