summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac/aepack.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-07 23:15:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-07 23:15:56 (GMT)
commit1325790b932c4bab4f8f94f5a36c09f4036ed9f8 (patch)
tree5f4c1d854783a4d082c5867094ec345f4772bf35 /Lib/plat-mac/aepack.py
parent7b955bd125951db694f19a1b8648b806b14bd61f (diff)
downloadcpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.zip
cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.gz
cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.bz2
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines Get rid of some remnants of classic classes. types.ClassType == type. Also get rid of almost all uses of the types module and use the builtin name. ........ r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line Remove a use of types, verify commit hook works ........ r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines Fix syntax error introduced by Neal in last checkin. ........
Diffstat (limited to 'Lib/plat-mac/aepack.py')
-rw-r--r--Lib/plat-mac/aepack.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py
index 3511270..7ce8548 100644
--- a/Lib/plat-mac/aepack.py
+++ b/Lib/plat-mac/aepack.py
@@ -13,8 +13,6 @@ coerce(x, wanted_sample) coerces a python object to another python object
#
import struct
-import types
-from types import *
from Carbon import AE
from Carbon.AppleEvents import *
import MacOS
@@ -74,7 +72,7 @@ def pack(x, forcetype = None):
"""Pack a python object into an AE descriptor"""
if forcetype:
- if type(x) is StringType:
+ if isinstance(x, str):
return AE.AECreateDesc(forcetype, x)
else:
return pack(x).AECoerceDesc(forcetype)
@@ -90,29 +88,29 @@ def pack(x, forcetype = None):
return AE.AECreateDesc('fsrf', x.data)
if isinstance(x, AliasType):
return AE.AECreateDesc('alis', x.data)
- if isinstance(x, IntType):
+ if isinstance(x, int):
return AE.AECreateDesc('long', struct.pack('l', x))
- if isinstance(x, FloatType):
+ if isinstance(x, float):
return AE.AECreateDesc('doub', struct.pack('d', x))
- if isinstance(x, StringType):
+ if isinstance(x, str):
return AE.AECreateDesc('TEXT', x)
- if isinstance(x, UnicodeType):
+ if isinstance(x, unicode):
data = x.encode('utf16')
if data[:2] == '\xfe\xff':
data = data[2:]
return AE.AECreateDesc('utxt', data)
- if isinstance(x, ListType):
+ if isinstance(x, list):
list = AE.AECreateList('', 0)
for item in x:
list.AEPutDesc(0, pack(item))
return list
- if isinstance(x, DictionaryType):
+ if isinstance(x, dict):
record = AE.AECreateList('', 1)
for key, value in x.items():
packkey(record, key, value)
#record.AEPutParamDesc(key, pack(value))
return record
- if type(x) == types.ClassType and issubclass(x, ObjectSpecifier):
+ if isinstance(x, type) and issubclass(x, ObjectSpecifier):
# Note: we are getting a class object here, not an instance
return AE.AECreateDesc('type', x.want)
if hasattr(x, '__aepack__'):
@@ -340,7 +338,7 @@ def mkobject(dict):
# to __class__ is safe. Moreover, shouldn't there be a better
# initializer for the classes in the suites?
def mkobjectfrommodule(dict, modulename):
- if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier):
+ if isinstance(dict['want'], type) and issubclass(dict['want'], ObjectSpecifier):
# The type has already been converted to Python. Convert back:-(
classtype = dict['want']
dict['want'] = aetypes.mktype(classtype.want)