Switch from map() to list comprehensions.

This commit is contained in:
Florian Bruhin 2015-12-01 07:16:32 +01:00
parent 251e657bd1
commit 6f9b02741a
5 changed files with 7 additions and 6 deletions

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=line-too-long # pylint: disable=line-too-long,bad-builtin
"""A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit.""" """A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit."""
@ -29,7 +29,7 @@ __license__ = "GPL"
__maintainer__ = __author__ __maintainer__ = __author__
__email__ = "mail@qutebrowser.org" __email__ = "mail@qutebrowser.org"
__version_info__ = (0, 4, 1) __version_info__ = (0, 4, 1)
__version__ = '.'.join(map(str, __version_info__)) __version__ = '.'.join(str(e) for e in __version_info__)
__description__ = "A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit." __description__ = "A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit."
basedir = os.path.dirname(os.path.realpath(__file__)) basedir = os.path.dirname(os.path.realpath(__file__))

View File

@ -45,6 +45,7 @@ def check_python_version():
if sys.hexversion < 0x03040000: if sys.hexversion < 0x03040000:
# We don't use .format() and print_function here just in case someone # We don't use .format() and print_function here just in case someone
# still has < 2.6 installed. # still has < 2.6 installed.
# pylint: disable=bad-builtin
version_str = '.'.join(map(str, sys.version_info[:3])) version_str = '.'.join(map(str, sys.version_info[:3]))
text = ("At least Python 3.4 is required to run qutebrowser, but " + text = ("At least Python 3.4 is required to run qutebrowser, but " +
version_str + " is installed!\n") version_str + " is installed!\n")

View File

@ -262,7 +262,7 @@ def _get_action_metavar(action, nargs=1):
elems = action.metavar elems = action.metavar
return ' '.join("'{}'".format(e) for e in elems) return ' '.join("'{}'".format(e) for e in elems)
elif action.choices is not None: elif action.choices is not None:
choices = ','.join(map(str, action.choices)) choices = ','.join(str(e) for e in action.choices)
return "'{{{}}}'".format(choices) return "'{{{}}}'".format(choices)
else: else:
return "'{}'".format(action.dest.upper()) return "'{}'".format(action.dest.upper())

View File

@ -101,7 +101,7 @@ def write_git_file():
setupdata = { setupdata = {
'name': 'qutebrowser', 'name': 'qutebrowser',
'version': '.'.join(map(str, _get_constant('version_info'))), 'version': '.'.join(str(e) for e in _get_constant('version_info')),
'description': _get_constant('description'), 'description': _get_constant('description'),
'long_description': read_file('README.asciidoc'), 'long_description': read_file('README.asciidoc'),
'url': 'http://www.qutebrowser.org/', 'url': 'http://www.qutebrowser.org/',

View File

@ -115,7 +115,7 @@ def test_mhtml(test_name, download_dir, quteproc, httpbin):
actual_requests = httpbin.get_requests() actual_requests = httpbin.get_requests()
# Requests are not hashable, we need to convert to ExpectedRequests # Requests are not hashable, we need to convert to ExpectedRequests
actual_requests = map(httpbin.ExpectedRequest.from_request, actual_requests = [httpbin.ExpectedRequest.from_request(req)
actual_requests) for req in actual_requests]
assert (collections.Counter(actual_requests) == assert (collections.Counter(actual_requests) ==
collections.Counter(expected_requests)) collections.Counter(expected_requests))