diff --git a/common/web/SchemaParser.h b/common/web/SchemaParser.h index dfbd34f44a..ba49dba29e 100644 --- a/common/web/SchemaParser.h +++ b/common/web/SchemaParser.h @@ -91,7 +91,7 @@ class SchemaParser : public JsonParserInterface { /** * @brief Claim the RootValidator that was created by parsing the schema. * @returns A new Validator, or NULL if the schema wasn't valid. Ownership of - * the validtor is transferred to the caller. + * the validator is transferred to the caller. */ ValidatorInterface* ClaimRootValidator(); diff --git a/python/ola/StringUtils.py b/python/ola/StringUtils.py index a0f51cfafd..4a4d7dd7de 100644 --- a/python/ola/StringUtils.py +++ b/python/ola/StringUtils.py @@ -32,11 +32,11 @@ def StringEscape(s): """Escape unprintable characters in a string.""" # TODO(Peter): How does this interact with the E1.20 Unicode flag? # We don't use sys.version_info.major to support Python 2.6. - if sys.version_info[0] == 2 and type(s) == str: + if sys.version_info[0] == 2 and isinstance(s, str): return s.encode('string-escape') - elif sys.version_info[0] == 2 and type(s) == unicode: + elif sys.version_info[0] == 2 and isinstance(s, unicode): return s.encode('unicode-escape') - elif type(s) == str: + elif isinstance(s, str): # All strings in Python 3 are unicode # This encode/decode pair gets us an escaped string return s.encode('unicode-escape').decode(encoding="ascii", diff --git a/tools/rdm/ResponderTest.py b/tools/rdm/ResponderTest.py index c83388f19a..2ef001d352 100644 --- a/tools/rdm/ResponderTest.py +++ b/tools/rdm/ResponderTest.py @@ -694,15 +694,15 @@ def _CheckForAckOrNack(self, response, unpacked_data, unpack_exception): @staticmethod def _EscapeData(data): - if type(data) == list: + if isinstance(data, list): return [ResponderTestFixture._EscapeData(i) for i in data] - elif type(data) == dict: + elif isinstance(data, dict): d = {} for k, v in data.items(): # We can't escape the key as then it may become a new key d[k] = ResponderTestFixture._EscapeData(v) return d - elif type(data) == str or type(data) == unicode: + elif isinstance(data, str) or isinstance(data, unicode): return StringEscape(data) else: return data diff --git a/tools/rdm/TestHelpers.py b/tools/rdm/TestHelpers.py index 51eb606de7..4a157bcf63 100644 --- a/tools/rdm/TestHelpers.py +++ b/tools/rdm/TestHelpers.py @@ -31,7 +31,7 @@ def ContainsUnprintable(s): """Check if a string s contain unprintable characters.""" # TODO(Peter): How does this interact with the E1.20 Unicode flag? - if type(s) == str or type(s) == unicode: + if isinstance(s, str) or isinstance(s, unicode): # All strings in Python 3 are unicode, Python 2 ones might not be return s != StringEscape(s) else: