pyobjc / pyobjc-core / Lib / PyObjCTools / KeyValueCoding.py

Diff from to

pyobjc-core/Lib/PyObjCTools/KeyValueCoding.py

 """
 from __future__ import unicode_literals
 import sys
+from objc._convenience import is_str_or_bytes
 
 __all__ = ("getKey", "setKey", "getKeyPath", "setKeyPath")
 if sys.version_info[0] == 2:
             pass
 
     # check for array-like objects
-    if not isinstance(obj, basestring):
+    if not is_str_or_bytes(obj):
         try:
             itr = iter(obj)
         except TypeError:
         object.__setattr__(self, attr, value)
 
     def __getitem__(self, item):
-        if not isinstance(item, basestring):
+        if not is_str_or_bytes(item):
             raise TypeError('Keys must be strings')
         return getKeyPath(self.__pyobjc_object__, item)
 
     def __setitem__(self, item, value):
-        if not isinstance(item, basestring):
+        if not is_str_or_bytes(item):
             raise TypeError('Keys must be strings')
         setKeyPath(self.__pyobjc_object__, item, value)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.