__init__.py (13681:9e8e1a96c423) __init__.py (13712:e36f980fdc36)
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 57 unchanged lines hidden (view full) ---

66 f("stats.txt", desc=False)
67
68 """
69
70 from functools import wraps
71
72 @wraps(func)
73 def wrapper(url):
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 57 unchanged lines hidden (view full) ---

66 f("stats.txt", desc=False)
67
68 """
69
70 from functools import wraps
71
72 @wraps(func)
73 def wrapper(url):
74 from urlparse import parse_qs
74 try:
75 from urllib.parse import parse_qs
76 except ImportError:
77 # Python 2 fallback
78 from urlparse import parse_qs
75 from ast import literal_eval
76
77 qs = parse_qs(url.query, keep_blank_values=True)
78
79 # parse_qs returns a list of values for each parameter. Only
80 # use the last value since kwargs don't allow multiple values
81 # per parameter. Use literal_eval to transform string param
82 # values into proper Python types.

--- 47 unchanged lines hidden (view full) ---

130
131 The available formats are listed in the factories list. Factories
132 are called with the path as the first positional parameter and the
133 parameters are keyword arguments. Parameter values must be valid
134 Python literals.
135
136 """
137
79 from ast import literal_eval
80
81 qs = parse_qs(url.query, keep_blank_values=True)
82
83 # parse_qs returns a list of values for each parameter. Only
84 # use the last value since kwargs don't allow multiple values
85 # per parameter. Use literal_eval to transform string param
86 # values into proper Python types.

--- 47 unchanged lines hidden (view full) ---

134
135 The available formats are listed in the factories list. Factories
136 are called with the path as the first positional parameter and the
137 parameters are keyword arguments. Parameter values must be valid
138 Python literals.
139
140 """
141
138 from urlparse import urlsplit
142 try:
143 from urllib.parse import urlsplit
144 except ImportError:
145 # Python 2 fallback
146 from urlparse import urlsplit
139
140 parsed = urlsplit(url)
141
142 try:
143 factory = factories[parsed.scheme]
144 except KeyError:
145 fatal("Illegal stat file type specified.")
146

--- 87 unchanged lines hidden ---
147
148 parsed = urlsplit(url)
149
150 try:
151 factory = factories[parsed.scheme]
152 except KeyError:
153 fatal("Illegal stat file type specified.")
154

--- 87 unchanged lines hidden ---