Skip to content

Commit

Permalink
Merge pull request #1915 from peternewman/master-resync
Browse files Browse the repository at this point in the history
Master resync
  • Loading branch information
peternewman committed Oct 28, 2023
2 parents 8556eea + 9ad42f9 commit ae8f09d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/web/SchemaParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions python/ola/StringUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions tools/rdm/ResponderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/rdm/TestHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ae8f09d

Please sign in to comment.