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
This commit is contained in:
Justin Wood 2019-05-13 15:29:30 -04:00
Родитель f2e598c580
Коммит d6720a8be2
2 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -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')

Просмотреть файл

@ -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.')