From d6720a8be279ece1231f961d4634c666ffb784ba Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 13 May 2019 15:29:30 -0400 Subject: [PATCH] Bug 1547730 - Stop using some cases of types.NoneType. r=#build Differential Revision: https://phabricator.services.mozilla.com/D30966 --HG-- extra : rebase_source : f17544d38e19f0a26922111136d5f5d08c0fd72f extra : source : 38ee1d2f1c4cc11a373509a549cb340443a21c3c --- python/mozbuild/mozbuild/configure/options.py | 3 +-- python/mozbuild/mozbuild/util.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py index 87184d1d1a57..3436bb77e1bb 100644 --- a/python/mozbuild/mozbuild/configure/options.py +++ b/python/mozbuild/mozbuild/configure/options.py @@ -7,7 +7,6 @@ from __future__ import absolute_import, print_function, unicode_literals import os import six import sys -import types from collections import OrderedDict @@ -189,7 +188,7 @@ class Option(object): raise InvalidOptionError( "nargs must be a positive integer, '?', '*' or '+'") if (not isinstance(default, six.string_types) and - not isinstance(default, (bool, types.NoneType)) and + not isinstance(default, (bool, type(None))) and not istupleofstrings(default)): raise InvalidOptionError( 'default must be a bool, a string or a tuple of strings') diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py index 54436c4759d0..9e4e91ff0169 100644 --- a/python/mozbuild/mozbuild/util.py +++ b/python/mozbuild/mozbuild/util.py @@ -21,7 +21,6 @@ import six import stat import sys import time -import types from collections import ( Iterable, @@ -385,7 +384,7 @@ class ListMixin(object): def __add__(self, other): # Allow None and EmptyValue is a special case because it makes undefined # variable references in moz.build behave better. - other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other + other = [] if isinstance(other, (type(None), EmptyValue)) else other if not isinstance(other, list): raise ValueError('Only lists can be appended to lists.') @@ -394,7 +393,7 @@ class ListMixin(object): return new_list def __iadd__(self, other): - other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other + other = [] if isinstance(other, (type(None), EmptyValue)) else other if not isinstance(other, list): raise ValueError('Only lists can be appended to lists.')