[Numpy-svn] r4511 - in trunk/numpy: . core/tests distutils distutils/command f2py f2py/lib/extgen f2py/lib/parser numarray testing

numpy-svn@scip... numpy-svn@scip...
Tue Nov 27 23:13:25 CST 2007


Author: jarrod.millman
Date: 2007-11-27 23:12:37 -0600 (Tue, 27 Nov 2007)
New Revision: 4511

Modified:
   trunk/numpy/_import_tools.py
   trunk/numpy/core/tests/test_defmatrix.py
   trunk/numpy/distutils/command/build_ext.py
   trunk/numpy/distutils/command/build_src.py
   trunk/numpy/distutils/core.py
   trunk/numpy/distutils/cpuinfo.py
   trunk/numpy/distutils/from_template.py
   trunk/numpy/distutils/misc_util.py
   trunk/numpy/distutils/system_info.py
   trunk/numpy/f2py/auxfuncs.py
   trunk/numpy/f2py/capi_maps.py
   trunk/numpy/f2py/cb_rules.py
   trunk/numpy/f2py/cfuncs.py
   trunk/numpy/f2py/crackfortran.py
   trunk/numpy/f2py/f2py2e.py
   trunk/numpy/f2py/f90mod_rules.py
   trunk/numpy/f2py/func2subr.py
   trunk/numpy/f2py/lib/extgen/base.py
   trunk/numpy/f2py/lib/extgen/py_support.py
   trunk/numpy/f2py/lib/parser/Fortran2003.py
   trunk/numpy/f2py/lib/parser/block_statements.py
   trunk/numpy/f2py/lib/parser/parsefortran.py
   trunk/numpy/f2py/lib/parser/statements.py
   trunk/numpy/f2py/lib/parser/utils.py
   trunk/numpy/f2py/rules.py
   trunk/numpy/f2py/use_rules.py
   trunk/numpy/numarray/numerictypes.py
   trunk/numpy/numarray/session.py
   trunk/numpy/testing/numpytest.py
   trunk/numpy/testing/utils.py
Log:
use 'in' keyword to test dictionary membership


Modified: trunk/numpy/_import_tools.py
===================================================================
--- trunk/numpy/_import_tools.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/_import_tools.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -21,7 +21,7 @@
         if isinstance(parent_path, str):
             parent_path = [parent_path]
         self.parent_path = parent_path
-        if not frame.f_locals.has_key('__all__'):
+        if '__all__' not in frame.f_locals:
             exec('__all__ = []',frame.f_globals,frame.f_locals)
         self.parent_export_names = eval('__all__',frame.f_globals,frame.f_locals)
 
@@ -77,7 +77,7 @@
                                   % (package_name,':'.join(self.parent_path), msg))
 
         for package_name,info_file in info_files:
-            if info_modules.has_key(package_name):
+            if package_name in info_modules:
                 continue
             fullname = self.parent_name +'.'+ package_name
             if info_file[-1]=='c':
@@ -119,7 +119,7 @@
 
         while depend_dict:
             for name, lst in depend_dict.items():
-                new_lst = [n for n in lst if depend_dict.has_key(n)]
+                new_lst = [n for n in lst if n in depend_dict]
                 if not new_lst:
                     package_names.append(name)
                     del depend_dict[name]
@@ -225,7 +225,7 @@
                 if verbose!=-1:
                     old_objects = {}
                     for s in symbols:
-                        if frame.f_locals.has_key(s):
+                        if s in frame.f_locals:
                             old_objects[s] = frame.f_locals[s]
 
                 cmdstr = 'from '+package_name+' import '+symbol
@@ -325,7 +325,7 @@
             global_symbols = getattr(info_module,'global_symbols',[])
             fullname = self.parent_name +'.'+ package_name
             note = ''
-            if not sys.modules.has_key(fullname):
+            if fullname not in sys.modules:
                 note = ' [*]'
             titles.append((fullname,self._get_doc_title(info_module) + note))
             if global_symbols:

Modified: trunk/numpy/core/tests/test_defmatrix.py
===================================================================
--- trunk/numpy/core/tests/test_defmatrix.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/core/tests/test_defmatrix.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -159,7 +159,7 @@
                 # reset contents of a
                 a.astype('f8')
                 a.fill(1.0)
-                if methodargs.has_key(attrib):
+                if attrib in methodargs:
                     args = methodargs[attrib]
                 else:
                     args = ()

Modified: trunk/numpy/distutils/command/build_ext.py
===================================================================
--- trunk/numpy/distutils/command/build_ext.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/command/build_ext.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -84,14 +84,14 @@
         clibs = {}
         if build_clib is not None:
             for libname,build_info in build_clib.libraries or []:
-                if clibs.has_key(libname) and clibs[libname]!=build_info:
+                if libname in clibs and clibs[libname] != build_info:
                     log.warn('library %r defined more than once,'\
                              ' overwriting build_info\n%s... \nwith\n%s...' \
                              % (libname, `clibs[libname]`[:300], `build_info`[:300]))
                 clibs[libname] = build_info
         # .. and distribution libraries:
         for libname,build_info in self.distribution.libraries or []:
-            if clibs.has_key(libname):
+            if libname in clibs:
                 # build_clib libraries have a precedence before distribution ones
                 continue
             clibs[libname] = build_info

Modified: trunk/numpy/distutils/command/build_src.py
===================================================================
--- trunk/numpy/distutils/command/build_src.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/command/build_src.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -202,7 +202,7 @@
                 if source is None:
                     continue
                 modules = [(package, module_base, source)]
-                if not self.py_modules_dict.has_key(package):
+                if package not in self.py_modules_dict:
                     self.py_modules_dict[package] = []
                 self.py_modules_dict[package] += modules
             else:
@@ -259,7 +259,7 @@
 
         sources, py_files = self.filter_py_files(sources)
 
-        if not self.py_modules_dict.has_key(package):
+        if package not in self.py_modules_dict:
             self.py_modules_dict[package] = []
         modules = []
         for f in py_files:
@@ -292,7 +292,7 @@
         else:
             if is_sequence(extension):
                 name = extension[0]
-            #    if not extension[1].has_key('include_dirs'):
+            #    if 'include_dirs' not in extension[1]:
             #        extension[1]['include_dirs'] = []
             #    incl_dirs = extension[1]['include_dirs']
             else:

Modified: trunk/numpy/distutils/core.py
===================================================================
--- trunk/numpy/distutils/core.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/core.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -50,7 +50,7 @@
 
 def _dict_append(d, **kws):
     for k,v in kws.items():
-        if not d.has_key(k):
+        if k not in d:
             d[k] = v
             continue
         dv = d[k]
@@ -119,11 +119,11 @@
     cmdclass = numpy_cmdclass.copy()
 
     new_attr = attr.copy()
-    if new_attr.has_key('cmdclass'):
+    if 'cmdclass' in new_attr:
         cmdclass.update(new_attr['cmdclass'])
     new_attr['cmdclass'] = cmdclass
 
-    if new_attr.has_key('configuration'):
+    if 'configuration' in new_attr:
         # To avoid calling configuration if there are any errors
         # or help request in command in the line.
         configuration = new_attr.pop('configuration')
@@ -163,14 +163,14 @@
                                 "library %r" % (item,))
         ext.libraries = new_libraries
     if libraries:
-        if not new_attr.has_key('libraries'):
+        if 'libraries' not in new_attr:
             new_attr['libraries'] = []
         for item in libraries:
             _check_append_library(new_attr['libraries'], item)
 
     # sources in ext_modules or libraries may contain header files
-    if (new_attr.has_key('ext_modules') or new_attr.has_key('libraries')) \
-       and not new_attr.has_key('headers'):
+    if ('ext_modules' in new_attr or 'libraries' in new_attr) \
+       and 'headers' not in new_attr:
         new_attr['headers'] = []
 
     return old_setup(**new_attr)

Modified: trunk/numpy/distutils/cpuinfo.py
===================================================================
--- trunk/numpy/distutils/cpuinfo.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/cpuinfo.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -104,7 +104,7 @@
                 if len(name_value) != 2:
                     continue
                 name, value = name_value
-                if not info or info[-1].has_key(name): # next processor
+                if not info or name in info[-1]: # next processor
                     info.append({})
                 info[-1][name] = value
             fo.close()

Modified: trunk/numpy/distutils/from_template.py
===================================================================
--- trunk/numpy/distutils/from_template.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/from_template.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -149,11 +149,11 @@
     base_rule = None
     rules = {}
     for r in template_re.findall(substr):
-        if not rules.has_key(r):
+        if r not in rules:
             thelist = lnames.get(r,names.get(r,None))
             if thelist is None:
                 raise ValueError,'No replicates found for <%s>' % (r)
-            if not names.has_key(r) and not thelist.startswith('_'):
+            if r not in names and not thelist.startswith('_'):
                 names[r] = thelist
             rule = [i.replace('@comma@',',') for i in thelist.split(',')]
             num = len(rule)

Modified: trunk/numpy/distutils/misc_util.py
===================================================================
--- trunk/numpy/distutils/misc_util.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/misc_util.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -230,7 +230,7 @@
 # Hooks for colored terminal output.
 # See also http://www.livinglogic.de/Python/ansistyle
 def terminal_has_colors():
-    if sys.platform=='cygwin' and not os.environ.has_key('USE_COLOR'):
+    if sys.platform=='cygwin' and 'USE_COLOR' not in os.environ:
         # Avoid importing curses that causes illegal operation
         # with a message:
         #  PYTHON2 caused an invalid page fault in
@@ -323,7 +323,7 @@
         return
     if get_build_architecture() != 'AMD64':
         return
-    if os.environ.has_key('DISTUTILS_USE_SDK'):
+    if 'DISTUTILS_USE_SDK' in os.environ:
         return
     # try to avoid _MSVCCompiler__root attribute error
     print 'Forcing DISTUTILS_USE_SDK=1'
@@ -704,7 +704,7 @@
         - quiet
         """
         for key, value in options.items():
-            if self.options.has_key(key):
+            if key in self.options:
                 self.options[key] = value
             else:
                 raise ValueError,'Unknown option: '+key
@@ -934,7 +934,7 @@
     def _optimize_data_files(self):
         data_dict = {}
         for p,files in self.data_files:
-            if not data_dict.has_key(p):
+            if p not in data_dict:
                 data_dict[p] = set()
             map(data_dict[p].add,files)
         self.data_files[:] = [(p,list(files)) for p,files in data_dict.items()]
@@ -1092,7 +1092,7 @@
         ext_args['name'] = dot_join(self.name,name)
         ext_args['sources'] = sources
 
-        if ext_args.has_key('extra_info'):
+        if 'extra_info' in ext_args:
             extra_info = ext_args['extra_info']
             del ext_args['extra_info']
             if isinstance(extra_info, dict):
@@ -1405,7 +1405,7 @@
 
 
 def get_cmd(cmdname, _cache={}):
-    if not _cache.has_key(cmdname):
+    if cmdname not in _cache:
         import distutils.core
         dist = distutils.core._setup_distribution
         if dist is None:
@@ -1443,7 +1443,7 @@
 
 def dict_append(d, **kws):
     for k, v in kws.items():
-        if d.has_key(k):
+        if k in d:
             ov = d[k]
             if isinstance(ov,str):
                 d[k] = v

Modified: trunk/numpy/distutils/system_info.py
===================================================================
--- trunk/numpy/distutils/system_info.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/distutils/system_info.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -396,7 +396,7 @@
         self.saved_results[self.__class__.__name__] = info
 
     def has_info(self):
-        return self.saved_results.has_key(self.__class__.__name__)
+        return self.__class__.__name__ in self.saved_results
 
     def get_info(self,notfound_action=0):
         """ Return a dictonary with items that are compatible
@@ -441,13 +441,13 @@
             if is_sequence(env_var):
                 e0 = env_var[-1]
                 for e in env_var:
-                    if os.environ.has_key(e):
+                    if e in os.environ:
                         e0 = e
                         break
                 if not env_var[0]==e0:
                     log.info('Setting %s=%s' % (env_var[0],e0))
                 env_var = e0
-        if env_var and os.environ.has_key(env_var):
+        if env_var and env_var in os.environ:
             d = os.environ[env_var]
             if d=='None':
                 log.info('Disabled %s: %s',self.__class__.__name__,'(%s is None)' \
@@ -1146,7 +1146,7 @@
     libraries = config.get('libraries', [])
     library_dirs = config.get('library_dirs', [])
     key = (tuple(libraries), tuple(library_dirs))
-    if _cached_atlas_version.has_key(key):
+    if key in _cached_atlas_version:
         return _cached_atlas_version[key]
     c = cmd_config(Distribution())
     atlas_version = None
@@ -1229,7 +1229,7 @@
         if atlas_info:
             version_info = atlas_info.copy()
             atlas_version = get_atlas_version(**version_info)
-            if not atlas_info.has_key('define_macros'):
+            if 'define_macros' not in atlas_info:
                 atlas_info['define_macros'] = []
             if atlas_version is None:
                 atlas_info['define_macros'].append(('NO_ATLAS_INFO',2))
@@ -1328,7 +1328,7 @@
         if atlas_info:
             version_info = atlas_info.copy()
             atlas_version = get_atlas_version(**version_info)
-            if not atlas_info.has_key('define_macros'):
+            if 'define_macros' not in atlas_info:
                 atlas_info['define_macros'] = []
             if atlas_version is None:
                 atlas_info['define_macros'].append(('NO_ATLAS_INFO',2))
@@ -1657,7 +1657,7 @@
     cflags_flag = '--cflags'
 
     def get_config_exe(self):
-        if os.environ.has_key(self.config_env_var):
+        if self.config_env_var in os.environ:
             return os.environ[self.config_env_var]
         return self.default_config_exe
     def get_config_output(self, config_exe, option):
@@ -1890,7 +1890,7 @@
         if k=='language':
             languages.append(v)
             continue
-        if d.has_key(k):
+        if k in d:
             if k in ['library_dirs','include_dirs','define_macros']:
                 [d[k].append(vv) for vv in v if vv not in d[k]]
             else:

Modified: trunk/numpy/f2py/auxfuncs.py
===================================================================
--- trunk/numpy/f2py/auxfuncs.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/auxfuncs.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -38,111 +38,200 @@
     if options.get('verbose',1):
         sys.stdout.write(t)
 
-def debugcapi(var): return 'capi' in debugoptions
+def debugcapi(var):
+    return 'capi' in debugoptions
+
 def _isstring(var):
-    return var.has_key('typespec') and var['typespec']=='character' and (not isexternal(var))
+    return 'typespec' in var and var['typespec']=='character' and (not isexternal(var))
+
 def isstring(var):
     return _isstring(var) and not isarray(var)
+
 def ischaracter(var):
-    return isstring(var) and not (var.has_key('charselector'))
+    return isstring(var) and 'charselector' not in var
+
 def isstringarray(var):
     return isarray(var) and _isstring(var)
+
 def isarrayofstrings(var):
     # leaving out '*' for now so that
     # `character*(*) a(m)` and `character a(m,*)`
     # are treated differently. Luckily `character**` is illegal.
     return isstringarray(var) and var['dimension'][-1]=='(*)'
-def isarray(var): return var.has_key('dimension') and (not isexternal(var))
-def isscalar(var): return not (isarray(var) or isstring(var) or isexternal(var))
+
+def isarray(var):
+    return 'dimension' in var and (not isexternal(var))
+
+def isscalar(var):
+    return not (isarray(var) or isstring(var) or isexternal(var))
+
 def iscomplex(var):
     return isscalar(var) and var.get('typespec') in ['complex','double complex']
+
 def islogical(var):
     return isscalar(var) and var.get('typespec')=='logical'
+
 def isinteger(var):
     return isscalar(var) and var.get('typespec')=='integer'
+
 def isreal(var):
     return isscalar(var) and var.get('typespec')=='real'
+
 def get_kind(var):
-    try: return var['kindselector']['*']
+    try:
+        return var['kindselector']['*']
     except KeyError:
-        try: return var['kindselector']['kind']
-        except KeyError: pass
+        try:
+            return var['kindselector']['kind']
+        except KeyError:
+            pass
+
 def islong_long(var):
-    if not isscalar(var): return 0
-    if var.get('typespec') not in ['integer','logical']: return 0
+    if not isscalar(var):
+        return 0
+    if var.get('typespec') not in ['integer','logical']:
+        return 0
     return get_kind(var)=='8'
+
 def isunsigned_char(var):
-    if not isscalar(var): return 0
-    if var.get('typespec') != 'integer': return 0
+    if not isscalar(var):
+        return 0
+    if var.get('typespec') != 'integer':
+        return 0
     return get_kind(var)=='-1'
+
 def isunsigned_short(var):
-    if not isscalar(var): return 0
-    if var.get('typespec') != 'integer': return 0
+    if not isscalar(var):
+        return 0
+    if var.get('typespec') != 'integer':
+        return 0
     return get_kind(var)=='-2'
+
 def isunsigned(var):
-    if not isscalar(var): return 0
-    if var.get('typespec') != 'integer': return 0
+    if not isscalar(var):
+        return 0
+    if var.get('typespec') != 'integer':
+        return 0
     return get_kind(var)=='-4'
+
 def isunsigned_long_long(var):
-    if not isscalar(var): return 0
-    if var.get('typespec') != 'integer': return 0
+    if not isscalar(var):
+        return 0
+    if var.get('typespec') != 'integer':
+        return 0
     return get_kind(var)=='-8'
+
 def isdouble(var):
-    if not isscalar(var): return 0
-    if not var.get('typespec')=='real': return 0
+    if not isscalar(var):
+        return 0
+    if not var.get('typespec')=='real':
+        return 0
     return get_kind(var)=='8'
+
 def islong_double(var):
-    if not isscalar(var): return 0
-    if not var.get('typespec')=='real': return 0
+    if not isscalar(var):
+        return 0
+    if not var.get('typespec')=='real':
+        return 0
     return get_kind(var)=='16'
+
 def islong_complex(var):
-    if not iscomplex(var): return 0
+    if not iscomplex(var):
+        return 0
     return get_kind(var)=='32'
 
-def iscomplexarray(var): return isarray(var) and var.get('typespec') in ['complex','double complex']
-def isint1array(var): return isarray(var) and var.get('typespec')=='integer' \
+def iscomplexarray(var):
+    return isarray(var) and var.get('typespec') in ['complex','double complex']
+
+def isint1array(var):
+    return isarray(var) and var.get('typespec')=='integer' \
     and get_kind(var)=='1'
-def isunsigned_chararray(var): return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-1'
-def isunsigned_shortarray(var): return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-2'
-def isunsignedarray(var): return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-4'
-def isunsigned_long_longarray(var): return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-8'
+
+def isunsigned_chararray(var):
+    return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-1'
+
+def isunsigned_shortarray(var):
+    return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-2'
+
+def isunsignedarray(var):
+    return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-4'
+
+def isunsigned_long_longarray(var):
+    return isarray(var) and var.get('typespec')=='integer' and get_kind(var)=='-8'
+
 def isallocatable(var):
-    return var.has_key('attrspec') and 'allocatable' in var['attrspec']
-def ismutable(var): return not (not var.has_key('dimension') or isstring(var))
-def ismoduleroutine(rout): return rout.has_key('modulename')
-def ismodule(rout): return (rout.has_key('block') and 'module'==rout['block'])
-def isfunction(rout): return (rout.has_key('block') and 'function'==rout['block'])
+    return 'attrspec' in var and 'allocatable' in var['attrspec']
+
+def ismutable(var):
+    return not (not 'dimension' in var or isstring(var))
+
+def ismoduleroutine(rout):
+    return 'modulename' in rout
+
+def ismodule(rout):
+    return ('block' in rout and 'module'==rout['block'])
+
+def isfunction(rout):
+    return ('block' in rout and 'function'==rout['block'])
+
 #def isfunction_wrap(rout):
 #    return wrapfuncs and (iscomplexfunction(rout) or isstringfunction(rout)) and (not isexternal(rout))
+
 def isfunction_wrap(rout):
-    if isintent_c(rout): return 0
+    if isintent_c(rout):
+        return 0
     return wrapfuncs and isfunction(rout) and (not isexternal(rout))
-def issubroutine(rout): return (rout.has_key('block') and 'subroutine'==rout['block'])
-def isroutine(rout): return isfunction(rout) or issubroutine(rout)
+
+def issubroutine(rout):
+    return ('block' in rout and 'subroutine'==rout['block'])
+
+def isroutine(rout):
+    return isfunction(rout) or issubroutine(rout)
+
 def islogicalfunction(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return islogical(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return islogical(rout['vars'][a])
     return 0
+
 def islong_longfunction(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return islong_long(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return islong_long(rout['vars'][a])
     return 0
+
 def islong_doublefunction(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return islong_double(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return islong_double(rout['vars'][a])
     return 0
+
 def iscomplexfunction(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return iscomplex(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return iscomplex(rout['vars'][a])
     return 0
+
 def iscomplexfunction_warn(rout):
     if iscomplexfunction(rout):
         outmess("""\
@@ -155,46 +244,86 @@
     **************************************************************\n""")
         return 1
     return 0
+
 def isstringfunction(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return isstring(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return isstring(rout['vars'][a])
     return 0
-def hasexternals(rout): return rout.has_key('externals') and rout['externals']
-def isthreadsafe(rout): return rout.has_key('f2pyenhancements') and rout['f2pyenhancements'].has_key('threadsafe')
-def hasvariables(rout): return rout.has_key('vars') and rout['vars']
-def isoptional(var): return (var.has_key('attrspec') and 'optional' in var['attrspec'] and 'required' not in var['attrspec']) and isintent_nothide(var)
-def isexternal(var): return (var.has_key('attrspec') and 'external' in var['attrspec'])
-def isrequired(var): return not isoptional(var) and isintent_nothide(var)
+
+def hasexternals(rout):
+    return 'externals' in rout and rout['externals']
+
+def isthreadsafe(rout):
+    return 'f2pyenhancements' in rout and 'threadsafe' in rout['f2pyenhancements']
+
+def hasvariables(rout):
+    return 'vars' in rout and rout['vars']
+
+def isoptional(var):
+    return ('attrspec' in var and 'optional' in var['attrspec'] and 'required' not in var['attrspec']) and isintent_nothide(var)
+
+def isexternal(var):
+    return ('attrspec' in var and 'external' in var['attrspec'])
+
+def isrequired(var):
+    return not isoptional(var) and isintent_nothide(var)
+
 def isintent_in(var):
-    if not var.has_key('intent'): return 1
-    if 'hide' in var['intent']: return 0
-    if 'inplace' in var['intent']: return 0
-    if 'in' in var['intent']: return 1
-    if 'out' in var['intent']: return 0
-    if 'inout' in var['intent']: return 0
-    if 'outin' in var['intent']: return 0
+    if 'intent' not in var:
+        return 1
+    if 'hide' in var['intent']:
+        return 0
+    if 'inplace' in var['intent']:
+        return 0
+    if 'in' in var['intent']:
+        return 1
+    if 'out' in var['intent']:
+        return 0
+    if 'inout' in var['intent']:
+        return 0
+    if 'outin' in var['intent']:
+        return 0
     return 1
-def isintent_inout(var): return var.has_key('intent') and ('inout' in var['intent'] or 'outin' in var['intent']) and 'in' not in var['intent'] and 'hide' not in var['intent'] and 'inplace' not in var['intent']
+
+def isintent_inout(var):
+    return 'intent' in var and ('inout' in var['intent'] or 'outin' in var['intent']) and 'in' not in var['intent'] and 'hide' not in var['intent'] and 'inplace' not in var['intent']
+
 def isintent_out(var):
     return 'out' in var.get('intent',[])
-def isintent_hide(var): return (var.has_key('intent') and ('hide' in var['intent'] or ('out' in var['intent'] and 'in' not in var['intent'] and (not l_or(isintent_inout,isintent_inplace)(var)))))
-def isintent_nothide(var): return not isintent_hide(var)
+
+def isintent_hide(var):
+    return ('intent' in var and ('hide' in var['intent'] or ('out' in var['intent'] and 'in' not in var['intent'] and (not l_or(isintent_inout,isintent_inplace)(var)))))
+
+def isintent_nothide(var):
+    return not isintent_hide(var)
+
 def isintent_c(var):
     return 'c' in var.get('intent',[])
+
 # def isintent_f(var):
 #     return not isintent_c(var)
+
 def isintent_cache(var):
     return 'cache' in var.get('intent',[])
+
 def isintent_copy(var):
     return 'copy' in var.get('intent',[])
+
 def isintent_overwrite(var):
     return 'overwrite' in var.get('intent',[])
+
 def isintent_callback(var):
     return 'callback' in var.get('intent',[])
+
 def isintent_inplace(var):
     return 'inplace' in var.get('intent',[])
+
 def isintent_aux(var):
     return 'aux' in var.get('intent',[])
 
@@ -206,42 +335,64 @@
                  }
 
 def isprivate(var):
-    return var.has_key('attrspec') and 'private' in var['attrspec']
+    return 'attrspec' in var and 'private' in var['attrspec']
 
-def hasinitvalue(var): return var.has_key('=')
+def hasinitvalue(var):
+    return '=' in var
+
 def hasinitvalueasstring(var):
-    if not hasinitvalue(var): return 0
+    if not hasinitvalue(var):
+        return 0
     return var['='][0] in ['"',"'"]
+
 def hasnote(var):
-    return var.has_key('note')
+    return 'note' in var
+
 def hasresultnote(rout):
-    if not isfunction(rout): return 0
-    if rout.has_key('result'): a=rout['result']
-    else: a=rout['name']
-    if rout['vars'].has_key(a): return hasnote(rout['vars'][a])
+    if not isfunction(rout):
+        return 0
+    if 'result' in rout:
+        a=rout['result']
+    else:
+        a=rout['name']
+    if a in rout['vars']:
+        return hasnote(rout['vars'][a])
     return 0
+
 def hascommon(rout):
-    return rout.has_key('common')
+    return 'common' in rout
+
 def containscommon(rout):
-    if hascommon(rout): return 1
+    if hascommon(rout):
+        return 1
     if hasbody(rout):
         for b in rout['body']:
-            if containscommon(b): return 1
+            if containscommon(b):
+                return 1
     return 0
+
 def containsmodule(block):
-    if ismodule(block): return 1
-    if not hasbody(block): return 0
+    if ismodule(block):
+        return 1
+    if not hasbody(block):
+        return 0
     for b in block['body']:
-        if containsmodule(b): return 1
+        if containsmodule(b):
+            return 1
     return 0
+
 def hasbody(rout):
-    return rout.has_key('body')
+    return 'body' in rout
+
 def hascallstatement(rout):
     return getcallstatement(rout) is not None
 
-def istrue(var): return 1
-def isfalse(var): return 0
+def istrue(var):
+    return 1
 
+def isfalse(var):
+    return 0
+
 class F2PYError(Exception):
     pass
 
@@ -258,12 +409,14 @@
         l='%s,f%d=f[%d]'%(l,i,i)
         l2.append('f%d(v)'%(i))
     return eval('%s:%s'%(l,' and '.join(l2)))
+
 def l_or(*f):
     l,l2='lambda v',[]
     for i in range(len(f)):
         l='%s,f%d=f[%d]'%(l,i,i)
         l2.append('f%d(v)'%(i))
     return eval('%s:%s'%(l,' or '.join(l2)))
+
 def l_not(f):
     return eval('lambda v,f=f:not f(v)')
 
@@ -328,7 +481,7 @@
         var = rout['vars'][n]
         if isintent_callback(var):
             continue
-        if cb_map.has_key(n):
+        if n in cb_map:
             ctype = cb_map[n]+'_typedef'
         else:
             ctype = getctype(var)
@@ -351,6 +504,7 @@
 
 def getusercode(rout):
     return getmultilineblock(rout,'usercode')
+
 def getusercode1(rout):
     return getmultilineblock(rout,'usercode',counter=1)
 
@@ -359,9 +513,9 @@
 
 def getargs(rout):
     sortargs,args=[],[]
-    if rout.has_key('args'):
+    if 'args' in rout:
         args=rout['args']
-        if rout.has_key('sortvars'):
+        if 'sortvars' in rout:
             for a in rout['sortvars']:
                 if a in args: sortargs.append(a)
             for a in args:
@@ -375,7 +529,7 @@
     auxvars = [a for a in rout['vars'].keys() if isintent_aux(rout['vars'][a])\
                and a not in args]
     args = auxvars + args
-    if rout.has_key('sortvars'):
+    if 'sortvars' in rout:
         for a in rout['sortvars']:
             if a in args: sortargs.append(a)
         for a in args:
@@ -385,7 +539,7 @@
     return args,sortargs
 
 def getrestdoc(rout):
-    if not rout.has_key('f2pymultilines'):
+    if 'f2pymultilines' not in rout:
         return None
     k = None
     if rout['block']=='python module':
@@ -395,21 +549,25 @@
 def gentitle(name):
     l=(80-len(name)-6)/2
     return '/*%s %s %s*/'%(l*'*',name,l*'*')
+
 def flatlist(l):
     if type(l)==types.ListType:
         return reduce(lambda x,y,f=flatlist:x+f(y),l,[])
     return [l]
+
 def stripcomma(s):
     if s and s[-1]==',': return s[:-1]
     return s
+
 def replace(str,dict,defaultsep=''):
     if type(dict)==types.ListType:
         return map(lambda d,f=replace,sep=defaultsep,s=str:f(s,d,sep),dict)
     if type(str)==types.ListType:
         return map(lambda s,f=replace,sep=defaultsep,d=dict:f(s,d,sep),str)
     for k in 2*dict.keys():
-        if k=='separatorsfor': continue
-        if dict.has_key('separatorsfor') and dict['separatorsfor'].has_key(k):
+        if k=='separatorsfor':
+            continue
+        if 'separatorsfor' in dict and k in dict['separatorsfor']:
             sep=dict['separatorsfor'][k]
         else:
             sep=defaultsep
@@ -421,22 +579,30 @@
 
 def dictappend(rd,ar):
     if type(ar)==types.ListType:
-        for a in ar: rd=dictappend(rd,a)
+        for a in ar:
+            rd=dictappend(rd,a)
         return rd
     for k in ar.keys():
-        if k[0]=='_': continue
-        if rd.has_key(k):
-            if type(rd[k])==types.StringType: rd[k]=[rd[k]]
+        if k[0]=='_':
+            continue
+        if k in rd:
+            if type(rd[k])==types.StringType:
+                rd[k]=[rd[k]]
             if type(rd[k])==types.ListType:
-                if type(ar[k])==types.ListType: rd[k]=rd[k]+ar[k]
-                else: rd[k].append(ar[k])
+                if type(ar[k])==types.ListType:
+                    rd[k]=rd[k]+ar[k]
+                else:
+                    rd[k].append(ar[k])
             elif type(rd[k])==types.DictType:
                 if type(ar[k])==types.DictType:
                     if k=='separatorsfor':
                         for k1 in ar[k].keys():
-                            if not rd[k].has_key(k1): rd[k][k1]=ar[k][k1]
-                    else: rd[k]=dictappend(rd[k],ar[k])
-        else: rd[k]=ar[k]
+                            if k1 not in rd[k]:
+                                rd[k][k1]=ar[k][k1]
+                    else:
+                        rd[k]=dictappend(rd[k],ar[k])
+        else:
+            rd[k]=ar[k]
     return rd
 
 def applyrules(rules,dict,var={}):
@@ -445,23 +611,27 @@
         for r in rules:
             rr=applyrules(r,dict,var)
             ret=dictappend(ret,rr)
-            if rr.has_key('_break'): break
+            if '_break' in rr:
+                break
         return ret
-    if rules.has_key('_check') and (not rules['_check'](var)): return ret
-    if rules.has_key('need'):
+    if '_check' in rules and (not rules['_check'](var)):
+        return ret
+    if 'need' in rules:
         res = applyrules({'needs':rules['need']},dict,var)
-        if res.has_key('needs'):
+        if 'needs' in res:
             cfuncs.append_needs(res['needs'])
 
     for k in rules.keys():
-        if k=='separatorsfor': ret[k]=rules[k]; continue
+        if k=='separatorsfor':
+            ret[k]=rules[k]; continue
         if type(rules[k])==types.StringType:
             ret[k]=replace(rules[k],dict)
         elif type(rules[k])==types.ListType:
             ret[k]=[]
             for i in rules[k]:
                 ar=applyrules({k:i},dict,var)
-                if ar.has_key(k): ret[k].append(ar[k])
+                if k in ar:
+                    ret[k].append(ar[k])
         elif k[0]=='_':
             continue
         elif type(rules[k])==types.DictType:
@@ -472,19 +642,23 @@
                         for i in rules[k][k1]:
                             if type(i)==types.DictType:
                                 res=applyrules({'supertext':i},dict,var)
-                                if res.has_key('supertext'): i=res['supertext']
+                                if 'supertext' in res:
+                                    i=res['supertext']
                                 else: i=''
                             ret[k].append(replace(i,dict))
                     else:
                         i=rules[k][k1]
                         if type(i)==types.DictType:
                             res=applyrules({'supertext':i},dict)
-                            if res.has_key('supertext'): i=res['supertext']
+                            if 'supertext' in res:
+                                i=res['supertext']
                             else: i=''
                         ret[k].append(replace(i,dict))
         else:
             errmess('applyrules: ignoring rule %s.\n'%`rules[k]`)
         if type(ret[k])==types.ListType:
-            if len(ret[k])==1: ret[k]=ret[k][0]
-            if ret[k]==[]: del ret[k]
+            if len(ret[k])==1:
+                ret[k]=ret[k][0]
+            if ret[k]==[]:
+                del ret[k]
     return ret

Modified: trunk/numpy/f2py/capi_maps.py
===================================================================
--- trunk/numpy/f2py/capi_maps.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/capi_maps.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -175,10 +175,11 @@
                 d1[k1.lower()] = d1[k1]
             d[k.lower()] = d[k]
         for k in d.keys():
-            if not f2cmap_all.has_key(k): f2cmap_all[k]={}
+            if k not in f2cmap_all:
+                f2cmap_all[k]={}
             for k1 in d[k].keys():
-                if c2py_map.has_key(d[k][k1]):
-                    if f2cmap_all[k].has_key(k1):
+                if d[k][k1] in c2py_map:
+                    if k1 in f2cmap_all[k]:
                         outmess("\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n"%(k,k1,f2cmap_all[k][k1],d[k][k1]))
                     f2cmap_all[k][k1] = d[k][k1]
                     outmess('\tMapping "%s(kind=%s)" to "%s"\n' % (k,k1,d[k][k1]))
@@ -213,29 +214,33 @@
     """
     ctype='void'
     if isfunction(var):
-        if var.has_key('result'): a=var['result']
-        else: a=var['name']
-        if var['vars'].has_key(a): return getctype(var['vars'][a])
-        else: errmess('getctype: function %s has no return value?!\n'%a)
+        if 'result' in var:
+            a=var['result']
+        else:
+            a=var['name']
+        if a in var['vars']:
+            return getctype(var['vars'][a])
+        else:
+            errmess('getctype: function %s has no return value?!\n'%a)
     elif issubroutine(var):
         return ctype
-    elif var.has_key('typespec') and f2cmap_all.has_key(var['typespec'].lower()):
+    elif 'typespec' in var and var['typespec'].lower() in f2cmap_all:
         typespec = var['typespec'].lower()
         f2cmap=f2cmap_all[typespec]
         ctype=f2cmap[''] # default type
-        if var.has_key('kindselector'):
-            if var['kindselector'].has_key('*'):
+        if 'kindselector' in var:
+            if '*' in var['kindselector']:
                 try:
                     ctype=f2cmap[var['kindselector']['*']]
                 except KeyError:
                     errmess('getctype: "%s %s %s" not supported.\n'%(var['typespec'],'*',var['kindselector']['*']))
-            elif var['kindselector'].has_key('kind'):
-                if f2cmap_all.has_key(typespec+'kind'):
+            elif 'kind' in var['kindselector']:
+                if typespec+'kind' in f2cmap_all:
                     f2cmap=f2cmap_all[typespec+'kind']
                 try:
                     ctype=f2cmap[var['kindselector']['kind']]
                 except KeyError:
-                    if f2cmap_all.has_key(typespec):
+                    if typespec in f2cmap_all:
                         f2cmap=f2cmap_all[typespec]
                     try:
                         ctype=f2cmap[str(var['kindselector']['kind'])]
@@ -247,25 +252,33 @@
         if not isexternal(var):
             errmess('getctype: No C-type found in "%s", assuming void.\n'%var)
     return ctype
+
 def getstrlength(var):
     if isstringfunction(var):
-        if var.has_key('result'): a=var['result']
-        else: a=var['name']
-        if var['vars'].has_key(a): return getstrlength(var['vars'][a])
-        else: errmess('getstrlength: function %s has no return value?!\n'%a)
+        if 'result' in var:
+            a=var['result']
+        else:
+            a=var['name']
+        if a in var['vars']:
+            return getstrlength(var['vars'][a])
+        else:
+            errmess('getstrlength: function %s has no return value?!\n'%a)
     if not isstring(var):
         errmess('getstrlength: expected a signature of a string but got: %s\n'%(`var`))
     len='1'
-    if var.has_key('charselector'):
+    if 'charselector' in var:
         a=var['charselector']
-        if a.has_key('*'): len=a['*']
-        elif a.has_key('len'): len=a['len']
+        if '*' in a:
+            len=a['*']
+        elif 'len' in a:
+            len=a['len']
     if re.match(r'\(\s*([*]|[:])\s*\)',len) or re.match(r'([*]|[:])',len):
     #if len in ['(*)','*','(:)',':']:
         if isintent_hide(var):
             errmess('getstrlength:intent(hide): expected a string with defined length but got: %s\n'%(`var`))
         len='-1'
     return len
+
 def getarrdims(a,var,verbose=0):
     global depargs
     ret={}
@@ -319,13 +332,18 @@
 #         if not isintent_c(var):
 #             var['dimension'].reverse()
     return ret
+
 def getpydocsign(a,var):
     global lcb_map
     if isfunction(var):
-        if var.has_key('result'): af=var['result']
-        else: af=var['name']
-        if var['vars'].has_key(af): return getpydocsign(af,var['vars'][af])
-        else: errmess('getctype: function %s has no return value?!\n'%af)
+        if 'result' in var:
+            af=var['result']
+        else:
+            af=var['name']
+        if af in var['vars']:
+            return getpydocsign(af,var['vars'][af])
+        else:
+            errmess('getctype: function %s has no return value?!\n'%af)
         return '',''
     sig,sigout=a,a
     opt=''
@@ -370,7 +388,7 @@
                     %(out_a,rank,c2pycode_map[ctype],','.join(dim),a)
     elif isexternal(var):
         ua=''
-        if lcb_map.has_key(a) and lcb2_map.has_key(lcb_map[a]) and lcb2_map[lcb_map[a]].has_key('argname'):
+        if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]:
             ua=lcb2_map[lcb_map[a]]['argname']
             if not ua==a: ua=' => %s'%ua
             else: ua=''
@@ -379,6 +397,7 @@
     else:
         errmess('getpydocsign: Could not resolve docsignature for "%s".\\n'%a)
     return sig,sigout
+
 def getarrdocsign(a,var):
     ctype=getctype(var)
     if isstring(var) and (not isarray(var)):
@@ -446,7 +465,7 @@
     else:
         ret['intent'] = 'F2PY_INTENT_IN'
     if isarray(var): ret['varrformat']='N'
-    elif c2buildvalue_map.has_key(ret['ctype']):
+    elif ret['ctype'] in c2buildvalue_map:
         ret['varrformat']=c2buildvalue_map[ret['ctype']]
     else: ret['varrformat']='O'
     ret['init'],ret['showinit']=getinit(a,var)
@@ -454,7 +473,7 @@
         ret['init.r'],ret['init.i'] = markoutercomma(ret['init'][1:-1]).split('@,@')
     if isexternal(var):
         ret['cbnamekey']=a
-        if lcb_map.has_key(a):
+        if a in lcb_map:
             ret['cbname']=lcb_map[a]
             ret['maxnofargs']=lcb2_map[lcb_map[a]]['maxnofargs']
             ret['nofoptargs']=lcb2_map[lcb_map[a]]['nofoptargs']
@@ -468,7 +487,8 @@
     if isarray(var):
         ret=dictappend(ret,getarrdims(a,var))
         dim=copy.copy(var['dimension'])
-    if c2capi_map.has_key(ret['ctype']): ret['atype']=c2capi_map[ret['ctype']]
+    if ret['ctype'] in c2capi_map:
+        ret['atype']=c2capi_map[ret['ctype']]
     # Debug info
     if debugcapi(var):
         il=[isintent_in,'input',isintent_out,'output',
@@ -502,13 +522,13 @@
         else:
             ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],','.join(rl))
         if isscalar(var):
-            if cformat_map.has_key(ret['ctype']):
+            if ret['ctype'] in cformat_map:
                 ret['vardebugshowvalue']='debug-capi:%s=%s'%(a,cformat_map[ret['ctype']])
         if isstring(var):
             ret['vardebugshowvalue']='debug-capi:slen(%s)=%%d %s=\\"%%s\\"'%(a,a)
         if isexternal(var):
             ret['vardebugshowvalue']='debug-capi:%s=%%p'%(a)
-    if cformat_map.has_key(ret['ctype']):
+    if ret['ctype'] in cformat_map:
         ret['varshowvalue']='#name#:%s=%s'%(a,cformat_map[ret['ctype']])
         ret['showvalueformat']='%s'%(cformat_map[ret['ctype']])
     if isstring(var):
@@ -548,36 +568,38 @@
     else:
         ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC'
     lcb_map={}
-    if rout.has_key('use'):
+    if 'use' in rout:
         for u in rout['use'].keys():
-            if cb_rules.cb_map.has_key(u):
+            if u in cb_rules.cb_map:
                 for un in cb_rules.cb_map[u]:
                     ln=un[0]
-                    if rout['use'][u].has_key('map'):
+                    if 'map' in rout['use'][u]:
                         for k in rout['use'][u]['map'].keys():
                             if rout['use'][u]['map'][k]==un[0]: ln=k;break
                     lcb_map[ln]=un[1]
             #else:
             #    errmess('routsign2map: cb_map does not contain module "%s" used in "use" statement.\n'%(u))
-    elif rout.has_key('externals') and rout['externals']:
+    elif 'externals' in rout and rout['externals']:
         errmess('routsign2map: Confused: function %s has externals %s but no "use" statement.\n'%(ret['name'],`rout['externals']`))
     ret['callprotoargument'] = getcallprotoargument(rout,lcb_map) or ''
     if isfunction(rout):
-        if rout.has_key('result'): a=rout['result']
-        else: a=rout['name']
+        if 'result' in rout:
+            a=rout['result']
+        else:
+            a=rout['name']
         ret['rname']=a
         ret['pydocsign'],ret['pydocsignout']=getpydocsign(a,rout)
         ret['ctype']=getctype(rout['vars'][a])
         if hasresultnote(rout):
             ret['resultnote']=rout['vars'][a]['note']
             rout['vars'][a]['note']=['See elsewhere.']
-        if c2buildvalue_map.has_key(ret['ctype']):
+        if ret['ctype'] in c2buildvalue_map:
             ret['rformat']=c2buildvalue_map[ret['ctype']]
         else:
             ret['rformat']='O'
             errmess('routsign2map: no c2buildvalue key for type %s\n'%(`ret['ctype']`))
         if debugcapi(rout):
-            if cformat_map.has_key(ret['ctype']):
+            if ret['ctype'] in cformat_map:
                 ret['routdebugshowvalue']='debug-capi:%s=%s'%(a,cformat_map[ret['ctype']])
             if isstringfunction(rout):
                 ret['routdebugshowvalue']='debug-capi:slen(%s)=%%d %s=\\"%%s\\"'%(a,a)
@@ -619,9 +641,9 @@
 def cb_sign2map(a,var):
     ret={'varname':a}
     ret['ctype']=getctype(var)
-    if c2capi_map.has_key(ret['ctype']):
+    if ret['ctype'] in c2capi_map:
         ret['atype']=c2capi_map[ret['ctype']]
-    if cformat_map.has_key(ret['ctype']):
+    if ret['ctype'] in cformat_map:
         ret['showvalueformat']='%s'%(cformat_map[ret['ctype']])
     if isarray(var):
         ret=dictappend(ret,getarrdims(a,var))
@@ -669,13 +691,15 @@
 """
         else:
             ret['returncptr'] = 'return_value='
-    if cformat_map.has_key(ret['ctype']):
+    if ret['ctype'] in cformat_map:
         ret['showvalueformat']='%s'%(cformat_map[ret['ctype']])
     if isstringfunction(rout):
         ret['strlength']=getstrlength(rout)
     if isfunction(rout):
-        if rout.has_key('result'): a=rout['result']
-        else: a=rout['name']
+        if 'result' in rout:
+            a=rout['result']
+        else:
+            a=rout['name']
         if hasnote(rout['vars'][a]):
             ret['note']=rout['vars'][a]['note']
             rout['vars'][a]['note']=['See elsewhere.']
@@ -695,7 +719,7 @@
             rout['note']=['See elsewhere.']
     nofargs=0
     nofoptargs=0
-    if rout.has_key('args') and rout.has_key('vars'):
+    if 'args' in rout and 'vars' in rout:
         for a in rout['args']:
             var=rout['vars'][a]
             if l_or(isintent_in,isintent_inout)(var):
@@ -704,7 +728,7 @@
                     nofoptargs=nofoptargs+1
     ret['maxnofargs']=`nofargs`
     ret['nofoptargs']=`nofoptargs`
-    if hasnote(rout) and isfunction(rout) and rout.has_key('result'):
+    if hasnote(rout) and isfunction(rout) and 'result' in rout:
         ret['routnote']=rout['note']
         rout['note']=['See elsewhere.']
     return ret
@@ -712,10 +736,11 @@
 def common_sign2map(a,var): # obsolute
     ret={'varname':a}
     ret['ctype']=getctype(var)
-    if isstringarray(var): ret['ctype']='char'
-    if c2capi_map.has_key(ret['ctype']):
+    if isstringarray(var):
+        ret['ctype']='char'
+    if ret['ctype'] in c2capi_map:
         ret['atype']=c2capi_map[ret['ctype']]
-    if cformat_map.has_key(ret['ctype']):
+    if ret['ctype'] in cformat_map:
         ret['showvalueformat']='%s'%(cformat_map[ret['ctype']])
     if isarray(var):
         ret=dictappend(ret,getarrdims(a,var))

Modified: trunk/numpy/f2py/cb_rules.py
===================================================================
--- trunk/numpy/f2py/cb_rules.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/cb_rules.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -426,7 +426,7 @@
     rd=dictappend({},vrd)
     cb_map[um].append([rout['name'],rd['name']])
     for r in cb_rout_rules:
-        if (r.has_key('_check') and r['_check'](rout)) or (not r.has_key('_check')):
+        if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
             ar=applyrules(r,vrd,rout)
             rd=dictappend(rd,ar)
     savevrd={}
@@ -434,31 +434,40 @@
         vrd=capi_maps.cb_sign2map(a,var[a])
         savevrd[a]=vrd
         for r in cb_arg_rules:
-            if r.has_key('_depend'): continue
-            if r.has_key('_optional') and isoptional(var[a]): continue
-            if (r.has_key('_check') and r['_check'](var[a])) or (not r.has_key('_check')):
+            if '_depend' in r:
+                continue
+            if '_optional' in r and isoptional(var[a]):
+                continue
+            if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
                 ar=applyrules(r,vrd,var[a])
                 rd=dictappend(rd,ar)
-                if r.has_key('_break'): break
+                if '_break' in r:
+                    break
     for a in args:
         vrd=savevrd[a]
         for r in cb_arg_rules:
-            if r.has_key('_depend'): continue
-            if (not r.has_key('_optional')) or (r.has_key('_optional') and isrequired(var[a])): continue
-            if (r.has_key('_check') and r['_check'](var[a])) or (not r.has_key('_check')):
+            if '_depend' in r:
+                continue
+            if ('_optional' not in r) or ('_optional' in r and isrequired(var[a])):
+                continue
+            if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
                 ar=applyrules(r,vrd,var[a])
                 rd=dictappend(rd,ar)
-                if r.has_key('_break'): break
+                if '_break' in r:
+                    break
     for a in depargs:
         vrd=savevrd[a]
         for r in cb_arg_rules:
-            if not r.has_key('_depend'): continue
-            if r.has_key('_optional'): continue
-            if (r.has_key('_check') and r['_check'](var[a])) or (not r.has_key('_check')):
+            if '_depend' not in r:
+                continue
+            if '_optional' in r:
+                continue
+            if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
                 ar=applyrules(r,vrd,var[a])
                 rd=dictappend(rd,ar)
-                if r.has_key('_break'): break
-    if rd.has_key('args') and rd.has_key('optargs'):
+                if '_break' in r:
+                    break
+    if 'args' in rd and 'optargs' in rd:
         if type(rd['optargs'])==type([]):
             rd['optargs']=rd['optargs']+["""
 #ifndef F2PY_CB_RETURNCOMPLEX
@@ -492,14 +501,14 @@
     rd['docstrsigns']=[]
     rd['latexdocstrsigns']=[]
     for k in ['docstrreq','docstropt','docstrout','docstrcbs']:
-        if rd.has_key(k) and type(rd[k])==types.ListType:
+        if k in rd and type(rd[k])==types.ListType:
             rd['docstrsigns']=rd['docstrsigns']+rd[k]
         k='latex'+k
-        if rd.has_key(k) and type(rd[k])==types.ListType:
+        if k in rd and type(rd[k])==types.ListType:
             rd['latexdocstrsigns']=rd['latexdocstrsigns']+rd[k][0:1]+\
                                     ['\\begin{description}']+rd[k][1:]+\
                                     ['\\end{description}']
-    if not rd.has_key('args'):
+    if 'args' not in rd:
         rd['args']=''
         rd['args_td']=''
         rd['args_nm']=''
@@ -511,7 +520,7 @@
     if type(ar['need'])==types.StringType:
         ar['need']=[ar['need']]
 
-    if rd.has_key('need'):
+    if 'need' in rd:
         for t in cfuncs.typedefs.keys():
             if t in rd['need']:
                 ar['need'].append(t)

Modified: trunk/numpy/f2py/cfuncs.py
===================================================================
--- trunk/numpy/f2py/cfuncs.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/cfuncs.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -1067,28 +1067,39 @@
             append_needs(n,flag)
     elif type(need)==types.StringType:
         if not need: return
-        if includes0.has_key(need): n = 'includes0'
-        elif includes.has_key(need): n = 'includes'
-        elif typedefs.has_key(need): n = 'typedefs'
-        elif typedefs_generated.has_key(need): n = 'typedefs_generated'
-        elif cppmacros.has_key(need): n = 'cppmacros'
-        elif cfuncs.has_key(need): n = 'cfuncs'
-        elif callbacks.has_key(need): n = 'callbacks'
-        elif f90modhooks.has_key(need): n = 'f90modhooks'
-        elif commonhooks.has_key(need): n = 'commonhooks'
+        if need in includes0:
+            n = 'includes0'
+        elif need in includes:
+            n = 'includes'
+        elif need in typedefs:
+            n = 'typedefs'
+        elif need in typedefs_generated:
+            n = 'typedefs_generated'
+        elif need in cppmacros:
+            n = 'cppmacros'
+        elif need in cfuncs:
+            n = 'cfuncs'
+        elif need in callbacks:
+            n = 'callbacks'
+        elif need in f90modhooks:
+            n = 'f90modhooks'
+        elif need in commonhooks:
+            n = 'commonhooks'
         else:
             errmess('append_needs: unknown need %s\n'%(`need`))
             return
         if need in outneeds[n]: return
         if flag:
             tmp={}
-            if needs.has_key(need):
+            if need in needs:
                 for nn in needs[need]:
                     t=append_needs(nn,0)
                     if type(t)==types.DictType:
                         for nnn in t.keys():
-                            if tmp.has_key(nnn): tmp[nnn]=tmp[nnn]+t[nnn]
-                            else: tmp[nnn]=t[nnn]
+                            if nnn in tmp:
+                                tmp[nnn]=tmp[nnn]+t[nnn]
+                            else:
+                                tmp[nnn]=t[nnn]
             for nn in tmp.keys():
                 for nnn in tmp[nn]:
                     if nnn not in outneeds[nn]:
@@ -1096,14 +1107,17 @@
             outneeds[n].append(need)
         else:
             tmp={}
-            if needs.has_key(need):
+            if need in needs:
                 for nn in needs[need]:
                     t=append_needs(nn,flag)
                     if type(t)==types.DictType:
                         for nnn in t.keys():
-                            if tmp.has_key(nnn): tmp[nnn]=t[nnn]+tmp[nnn]
-                            else: tmp[nnn]=t[nnn]
-            if not tmp.has_key(n): tmp[n]=[]
+                            if nnn in tmp:
+                                tmp[nnn]=t[nnn]+tmp[nnn]
+                            else:
+                                tmp[nnn]=t[nnn]
+            if n not in tmp:
+                tmp[n]=[]
             tmp[n].append(need)
             return tmp
     else:
@@ -1116,7 +1130,7 @@
         out=[]
         saveout=copy.copy(outneeds[n])
         while len(outneeds[n])>0:
-            if not needs.has_key(outneeds[n][0]):
+            if outneeds[n][0] not in needs:
                 out.append(outneeds[n][0])
                 del outneeds[n][0]
             else:
@@ -1136,6 +1150,7 @@
                 out=out+saveout
                 break
             saveout=copy.copy(outneeds[n])
-        if out==[]: out=[n]
+        if out==[]:
+            out=[n]
         res[n]=out
     return res

Modified: trunk/numpy/f2py/crackfortran.py
===================================================================
--- trunk/numpy/f2py/crackfortran.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/crackfortran.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -214,14 +214,14 @@
     badnames[n]=n+'_bn'
     invbadnames[n+'_bn']=n
 def rmbadname1(name):
-    if badnames.has_key(name):
+    if name in badnames:
         errmess('rmbadname1: Replacing "%s" with "%s".\n'%(name,badnames[name]))
         return badnames[name]
     return name
 def rmbadname(names): return map(rmbadname1,names)
 
 def undo_rmbadname1(name):
-    if invbadnames.has_key(name):
+    if name in invbadnames:
         errmess('undo_rmbadname1: Replacing "%s" with "%s".\n'\
                 %(name,invbadnames[name]))
         return invbadnames[name]
@@ -568,11 +568,12 @@
     if not m:
         re_1 = crackline_re_1
         if 0<=skipblocksuntil<=groupcounter:return
-        if groupcache[groupcounter].has_key('externals'):
+        if 'externals' in groupcache[groupcounter]:
             for name in groupcache[groupcounter]['externals']:
-                if invbadnames.has_key(name):
+                if name in invbadnames:
                     name=invbadnames[name]
-                if groupcache[groupcounter].has_key('interfaced') and name in groupcache[groupcounter]['interfaced']: continue
+                if 'interfaced' in groupcache[groupcounter] and name in groupcache[groupcounter]['interfaced']:
+                    continue
                 m1=re.match(r'(?P<before>[^"]*)\b%s\b\s*@\(@(?P<args>[^@]*)@\)@.*\Z'%name,markouterparen(line),re.I)
                 if m1:
                     m2 = re_1.match(m1.group('before'))
@@ -665,7 +666,8 @@
     if decl is decl2: return decl
     for k in decl2.keys():
         if k=='typespec':
-            if force or not decl.has_key(k): decl[k]=decl2[k]
+            if force or k not in decl:
+                decl[k]=decl2[k]
         elif k=='attrspec':
             for l in decl2[k]:
                 decl=setattrspec(decl,l,force)
@@ -674,7 +676,8 @@
         elif k=='charselector':
             decl=setcharselector(decl,decl2[k],force)
         elif k in ['=','typename']:
-            if force or not decl.has_key(k): decl[k]=decl2[k]
+            if force or k not in decl:
+                decl[k]=decl2[k]
         elif k=='note':
             pass
         elif k in ['intent','check','dimension','optional','required']:
@@ -754,12 +757,15 @@
 
         if case in ['call','callfun']:
             needinterface=1
-            if not groupcache[groupcounter].has_key('args'): return
+            if 'args' not in groupcache[groupcounter]:
+                return
             if name not in groupcache[groupcounter]['args']:
                 return
             for it in grouplist[groupcounter]:
-                if it['name']==name: return
-            if name in groupcache[groupcounter]['interfaced']: return
+                if it['name']==name:
+                    return
+            if name in groupcache[groupcounter]['interfaced']:
+                return
             block={'call':'subroutine','callfun':'function'}[case]
         if f77modulename and neededmodule==-1 and groupcounter<=1:
             neededmodule=groupcounter+2
@@ -834,7 +840,7 @@
             try: groupcache[groupcounter]['vars'][name]=appenddecl(groupcache[groupcounter]['vars'][name],groupcache[groupcounter-2]['vars'][''])
             except: pass
             if case=='callfun': # return type
-                if result and groupcache[groupcounter]['vars'].has_key(result):
+                if result and result in groupcache[groupcounter]['vars']:
                     if not name==result:
                         groupcache[groupcounter]['vars'][name]=appenddecl(groupcache[groupcounter]['vars'][name],groupcache[groupcounter]['vars'][result])
             #if groupcounter>1: # name is interfaced
@@ -876,7 +882,7 @@
             i=markouterparen(ll).find('@)@')-2
             ll=ll[:i+1]+'::'+ll[i+1:]
             i=ll.find('::')
-            if ll[i:]=='::' and groupcache[groupcounter].has_key('args'):
+            if ll[i:]=='::' and 'args' in groupcache[groupcounter]:
                 outmess('All arguments will have attribute %s%s\n'%(m.group('this'),ll[:i]))
                 ll = ll + ','.join(groupcache[groupcounter]['args'])
         if i<0:i=0;pl=''
@@ -896,8 +902,10 @@
                     continue
             else:
                 k=rmbadname1(m1.group('name'))
-            if not edecl.has_key(k): edecl[k]={}
-            if case=='dimension': ap=case+m1.group('after')
+            if k not in edecl:
+                edecl[k]={}
+            if case=='dimension':
+                ap=case+m1.group('after')
             if case=='intent':
                 ap=m.group('this')+pl
                 if _intentcallbackpattern.match(ap):
@@ -910,9 +918,12 @@
                     else:
                         errmess('analyzeline: intent(callback) %s is already'\
                                 ' in argument list' % (k))
-            if case in ['optional','required','public','external','private','intrisic']: ap=case
-            if edecl[k].has_key('attrspec'): edecl[k]['attrspec'].append(ap)
-            else: edecl[k]['attrspec']=[ap]
+            if case in ['optional','required','public','external','private','intrisic']:
+                ap=case
+            if 'attrspec' in edecl[k]:
+                edecl[k]['attrspec'].append(ap)
+            else:
+                edecl[k]['attrspec']=[ap]
             if case=='external':
                 if groupcache[groupcounter]['block']=='program':
                     outmess('analyzeline: ignoring program arguments\n')
@@ -920,7 +931,7 @@
                 if k not in groupcache[groupcounter]['args']:
                     #outmess('analyzeline: ignoring external %s (not in arguments list)\n'%(`k`))
                     continue
-                if not groupcache[groupcounter].has_key('externals'):
+                if 'externals' not in groupcache[groupcounter]:
                     groupcache[groupcounter]['externals']=[]
                 groupcache[groupcounter]['externals'].append(k)
             last_name = k
@@ -938,8 +949,9 @@
                 outmess('analyzeline: could not extract name,expr in parameter statement "%s" of "%s"\n'%(e,ll));continue
             params = get_parameters(edecl)
             k=rmbadname1(k)
-            if not edecl.has_key(k): edecl[k]={}
-            if edecl[k].has_key('=') and (not edecl[k]['=']==initexpr):
+            if k not in edecl:
+                edecl[k]={}
+            if '=' in edecl[k] and (not edecl[k]['=']==initexpr):
                 outmess('analyzeline: Overwriting the value of parameter "%s" ("%s") with "%s".\n'%(k,edecl[k]['='],initexpr))
             t = determineexprtype(initexpr,params)
             if t:
@@ -959,7 +971,7 @@
                         % (initexpr, msg))
                 continue
             edecl[k]['='] = repr(v)
-            if edecl[k].has_key('attrspec'):
+            if 'attrspec' in edecl[k]:
                 edecl[k]['attrspec'].append('parameter')
             else: edecl[k]['attrspec']=['parameter']
             last_name = k
@@ -970,7 +982,7 @@
         if m.group('after').strip().lower()=='none':
             groupcache[groupcounter]['implicit']=None
         elif m.group('after'):
-            if groupcache[groupcounter].has_key('implicit'):
+            if 'implicit' in groupcache[groupcounter]:
                 impl=groupcache[groupcounter]['implicit']
             else: impl={}
             if impl is None:
@@ -1026,7 +1038,7 @@
                 dl = dl[1:].strip()
             ll.append([dl,il])
         vars={}
-        if groupcache[groupcounter].has_key('vars'):
+        if 'vars' in groupcache[groupcounter]:
             vars=groupcache[groupcounter]['vars']
         last_name = None
         for l in ll:
@@ -1051,9 +1063,9 @@
                     i=i+1
                 i=i+1
                 #v,l[1][j:i-1]=name,initvalue
-                if not vars.has_key(v):
+                if v not in vars:
                     vars[v]={}
-                if vars[v].has_key('=') and not vars[v]['=']==l[1][j:i-1]:
+                if '=' in vars[v] and not vars[v]['=']==l[1][j:i-1]:
                     outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n'%(v,vars[v]['='],l[1][j:i-1]))
                 vars[v]['=']=l[1][j:i-1]
                 j=i
@@ -1079,10 +1091,10 @@
         if not bn: bn='_BLNK_'
         cl.append([bn,ol])
         commonkey={}
-        if groupcache[groupcounter].has_key('common'):
+        if 'common' in groupcache[groupcounter]:
             commonkey=groupcache[groupcounter]['common']
         for c in cl:
-            if commonkey.has_key(c[0]):
+            if c[0] in commonkey:
                 outmess('analyzeline: previously defined common block encountered. Skipping.\n')
                 continue
             commonkey[c[0]]=[]
@@ -1094,12 +1106,14 @@
         m1=re.match(r'\A\s*(?P<name>\b[\w]+\b)\s*((,(\s*\bonly\b\s*:|(?P<notonly>))\s*(?P<list>.*))|)\s*\Z',m.group('after'),re.I)
         if m1:
             mm=m1.groupdict()
-            if not groupcache[groupcounter].has_key('use'): groupcache[groupcounter]['use']={}
+            if 'use' not in groupcache[groupcounter]:
+                groupcache[groupcounter]['use']={}
             name=m1.group('name')
             groupcache[groupcounter]['use'][name]={}
             isonly=0
-            if mm.has_key('list') and mm['list'] is not None:
-                if mm.has_key('notonly') and mm['notonly'] is None:isonly=1
+            if 'list' in mm and mm['list'] is not None:
+                if 'notonly' in mm and mm['notonly'] is None:
+                    isonly=1
                 groupcache[groupcounter]['use'][name]['only']=isonly
                 ll=[x.strip() for x in mm['list'].split(',')]
                 rl={}
@@ -1119,10 +1133,10 @@
             print m.groupdict()
             outmess('analyzeline: Could not crack the use statement.\n')
     elif case in ['f2pyenhancements']:
-        if not groupcache[groupcounter].has_key ('f2pyenhancements'):
+        if 'f2pyenhancements' not in groupcache[groupcounter]:
             groupcache[groupcounter]['f2pyenhancements'] = {}
         d = groupcache[groupcounter]['f2pyenhancements']
-        if m.group('this')=='usercode' and d.has_key('usercode'):
+        if m.group('this')=='usercode' and 'usercode' in d:
             if type(d['usercode']) is type(''):
                 d['usercode'] = [d['usercode']]
             d['usercode'].append(m.group('after'))
@@ -1144,10 +1158,10 @@
             outmess('analyzeline: No code implemented for line.\n')
 
 def appendmultiline(group, context_name,ml):
-    if not group.has_key('f2pymultilines'):
+    if 'f2pymultilines' not in group:
         group['f2pymultilines'] = {}
     d = group['f2pymultilines']
-    if not d.has_key(context_name):
+    if context_name not in d:
         d[context_name] = []
     d[context_name].append(ml)
     return
@@ -1231,36 +1245,36 @@
             continue
         ename=rmbadname1(m.group('name'))
         edecl={}
-        if groupcache[groupcounter]['vars'].has_key(ename):
+        if ename in groupcache[groupcounter]['vars']:
             edecl=groupcache[groupcounter]['vars'][ename].copy()
-            has_typespec = edecl.has_key('typespec')
-            if not has_typespec:
+            not_has_typespec = 'typespec' not in edecl
+            if not_has_typespec:
                 edecl['typespec']=typespec
             elif typespec and (not typespec==edecl['typespec']):
                 outmess('updatevars: attempt to change the type of "%s" ("%s") to "%s". Ignoring.\n' % (ename,edecl['typespec'],typespec))
-            if not edecl.has_key('kindselector'):
+            if 'kindselector' not in edecl:
                 edecl['kindselector']=copy.copy(kindselect)
             elif kindselect:
                 for k in kindselect.keys():
-                    if edecl['kindselector'].has_key(k) and (not kindselect[k]==edecl['kindselector'][k]):
+                    if k in edecl['kindselector'] and (not kindselect[k]==edecl['kindselector'][k]):
                         outmess('updatevars: attempt to change the kindselector "%s" of "%s" ("%s") to "%s". Ignoring.\n' % (k,ename,edecl['kindselector'][k],kindselect[k]))
                     else: edecl['kindselector'][k]=copy.copy(kindselect[k])
-            if not edecl.has_key('charselector') and charselect:
-                if not has_typespec:
+            if 'charselector' not in edecl and charselect:
+                if not_has_typespec:
                     edecl['charselector']=charselect
                 else:
                     errmess('updatevars:%s: attempt to change empty charselector to %r. Ignoring.\n' \
                             %(ename,charselect))
             elif charselect:
                 for k in charselect.keys():
-                    if edecl['charselector'].has_key(k) and (not charselect[k]==edecl['charselector'][k]):
+                    if k in edecl['charselector'] and (not charselect[k]==edecl['charselector'][k]):
                         outmess('updatevars: attempt to change the charselector "%s" of "%s" ("%s") to "%s". Ignoring.\n' % (k,ename,edecl['charselector'][k],charselect[k]))
                     else: edecl['charselector'][k]=copy.copy(charselect[k])
-            if not edecl.has_key('typename'):
+            if 'typename' not in edecl:
                 edecl['typename']=typename
             elif typename and (not edecl['typename']==typename):
                 outmess('updatevars: attempt to change the typename of "%s" ("%s") to "%s". Ignoring.\n' % (ename,edecl['typename'],typename))
-            if not edecl.has_key('attrspec'):
+            if 'attrspec' not in edecl:
                 edecl['attrspec']=copy.copy(attrspec)
             elif attrspec:
                 for a in attrspec:
@@ -1281,7 +1295,7 @@
                 for k in d1.keys():
                     if d1[k] is not None: d1[k]=unmarkouterparen(d1[k])
                     else: del d1[k]
-                if d1.has_key('len') and d1.has_key('array'):
+                if 'len' in d1 and 'array' in d1:
                     if d1['len']=='':
                         d1['len']=d1['array']
                         del d1['array']
@@ -1289,9 +1303,9 @@
                         d1['array']=d1['array']+','+d1['len']
                         del d1['len']
                         errmess('updatevars: "%s %s" is mapped to "%s %s(%s)"\n'%(typespec,e,typespec,ename,d1['array']))
-                if d1.has_key('array'):
+                if 'array' in d1:
                     dm = 'dimension(%s)'%d1['array']
-                    if not edecl.has_key('attrspec') or (not edecl['attrspec']):
+                    if 'attrspec' not in edecl or (not edecl['attrspec']):
                         edecl['attrspec']=[dm]
                     else:
                         edecl['attrspec'].append(dm)
@@ -1302,26 +1316,29 @@
                                         % (ename,dm1,dm))
                                 break
 
-                if d1.has_key('len'):
+                if 'len' in d1:
                     if typespec in ['complex','integer','logical','real']:
-                        if (not edecl.has_key('kindselector')) or (not edecl['kindselector']):
+                        if ('kindselector' not in edecl) or (not edecl['kindselector']):
                             edecl['kindselector']={}
                         edecl['kindselector']['*']=d1['len']
                     elif typespec == 'character':
-                        if (not edecl.has_key('charselector')) or (not edecl['charselector']): edecl['charselector']={}
-                        if edecl['charselector'].has_key('len'): del edecl['charselector']['len']
+                        if ('charselector' not in edecl) or (not edecl['charselector']):
+                            edecl['charselector']={}
+                        if 'len' in edecl['charselector']:
+                            del edecl['charselector']['len']
                         edecl['charselector']['*']=d1['len']
-                if d1.has_key('init'):
-                    if edecl.has_key('=') and (not edecl['=']==d1['init']):
+                if 'init' in d1:
+                    if '=' in edecl and (not edecl['=']==d1['init']):
                         outmess('updatevars: attempt to change the init expression of "%s" ("%s") to "%s". Ignoring.\n' % (ename,edecl['='],d1['init']))
                     else:
                         edecl['=']=d1['init']
             else:
                 outmess('updatevars: could not crack entity declaration "%s". Ignoring.\n'%(ename+m.group('after')))
         for k in edecl.keys():
-            if not edecl[k]: del edecl[k]
+            if not edecl[k]:
+                del edecl[k]
         groupcache[groupcounter]['vars'][ename]=edecl
-        if groupcache[groupcounter].has_key('varnames'):
+        if 'varnames' in groupcache[groupcounter]:
             groupcache[groupcounter]['varnames'].append(ename)
         last_name = ename
     return last_name
@@ -1373,9 +1390,11 @@
     return kindselect,charselect,typename
 ######
 def setattrspec(decl,attr,force=0):
-    if not decl: decl={}
-    if not attr: return decl
-    if not decl.has_key('attrspec'):
+    if not decl:
+        decl={}
+    if not attr:
+        return decl
+    if 'attrspec' not in decl:
         decl['attrspec']=[attr]
         return decl
     if force: decl['attrspec'].append(attr)
@@ -1391,40 +1410,52 @@
     else:
         decl['attrspec'].append(attr)
     return decl
+
 def setkindselector(decl,sel,force=0):
-    if not decl: decl={}
-    if not sel: return decl
-    if not decl.has_key('kindselector'):
+    if not decl:
+        decl={}
+    if not sel:
+        return decl
+    if 'kindselector' not in decl:
         decl['kindselector']=sel
         return decl
     for k in sel.keys():
-        if force or not decl['kindselector'].has_key(k):
+        if force or k not in decl['kindselector']:
             decl['kindselector'][k]=sel[k]
     return decl
+
 def setcharselector(decl,sel,force=0):
-    if not decl: decl={}
-    if not sel: return decl
-    if not decl.has_key('charselector'):
+    if not decl:
+        decl={}
+    if not sel:
+        return decl
+    if 'charselector' not in decl:
         decl['charselector']=sel
         return decl
     for k in sel.keys():
-        if force or not decl['charselector'].has_key(k):
+        if force or k not in decl['charselector']:
             decl['charselector'][k]=sel[k]
     return decl
+
 def getblockname(block,unknown='unknown'):
-    if block.has_key('name'): return block['name']
+    if 'name' in block:
+        return block['name']
     return unknown
+
 ###### post processing
+
 def setmesstext(block):
     global filepositiontext
-    try: filepositiontext='In: %s:%s\n'%(block['from'],block['name'])
-    except: pass
+    try:
+        filepositiontext='In: %s:%s\n'%(block['from'],block['name'])
+    except:
+        pass
 
 def get_usedict(block):
     usedict = {}
-    if block.has_key('parent_block'):
+    if 'parent_block' in block:
         usedict = get_usedict(block['parent_block'])
-    if block.has_key('use'):
+    if 'use' in block:
         usedict.update(block['use'])
     return usedict
 
@@ -1437,7 +1468,7 @@
         return param_map
     for usename,mapping in usedict.items():
         usename = usename.lower()
-        if not f90modulevars.has_key(usename):
+        if usename not in f90modulevars:
             continue
         mvars = f90modulevars[usename]
         params = get_parameters(mvars)
@@ -1447,7 +1478,7 @@
         if mapping:
             errmess('get_useparameters: mapping for %s not impl.' % (mapping))
         for k,v in params.items():
-            if param_map.has_key(k):
+            if k in param_map:
                 outmess('get_useparameters: overriding parameter %s with'\
                         ' value from module %s' % (`k`,`usename`))
             param_map[k] = v
@@ -1469,15 +1500,15 @@
     if param_map is None:
         param_map = get_useparameters(block)
 
-    if param_map is not None and block.has_key('vars'):
+    if param_map is not None and 'vars' in block:
         vars = block['vars']
         for n in vars.keys():
             var = vars[n]
-            if var.has_key('kindselector'):
+            if 'kindselector' in var:
                 kind = var['kindselector']
-                if kind.has_key('kind'):
+                if 'kind' in kind:
                     val = kind['kind']
-                    if param_map.has_key(val):
+                    if val in param_map:
                         kind['kind'] = param_map[val]
     new_body = []
     for b in block['body']:
@@ -1500,44 +1531,48 @@
         for g in block:
             setmesstext(g)
             g=postcrack(g,tab=tab+'\t')
-            if g.has_key('name') and '__user__' in g['name']: # sort user routines to appear first
+            if 'name' in g and '__user__' in g['name']: # sort user routines to appear first
                 uret.append(g)
             else:
                 gret.append(g)
         return uret+gret
     setmesstext(block)
-    if (not type(block)==types.DictType) and not block.has_key('block'):
+    if (not type(block)==types.DictType) and 'block' not in block:
         raise 'postcrack: Expected block dictionary instead of ',block
-    if block.has_key('name') and not block['name']=='unknown_interface':
+    if 'name' in block and not block['name']=='unknown_interface':
         outmess('%sBlock: %s\n'%(tab,block['name']),0)
     blocktype=block['block']
     block=analyzeargs(block)
     block=analyzecommon(block)
     block['vars']=analyzevars(block)
     block['sortvars']=sortvarnames(block['vars'])
-    if block.has_key('args') and block['args']:
+    if 'args' in block and block['args']:
         args=block['args']
     block['body']=analyzebody(block,args,tab=tab)
 
     userisdefined=[]
 ##     fromuser = []
-    if block.has_key('use'):
+    if 'use' in block:
         useblock=block['use']
         for k in useblock.keys():
             if '__user__' in k:
                 userisdefined.append(k)
-##                 if useblock[k].has_key('map'):
+##                 if 'map' in useblock[k]:
 ##                     for n in useblock[k]['map'].values():
 ##                         if n not in fromuser: fromuser.append(n)
     else: useblock={}
     name=''
-    if block.has_key('name'):name=block['name']
-    if block.has_key('externals') and block['externals']:# and not userisdefined: # Build a __user__ module
+    if 'name' in block:
+        name=block['name']
+    if 'externals' in block and block['externals']:# and not userisdefined: # Build a __user__ module
         interfaced=[]
-        if block.has_key('interfaced'): interfaced=block['interfaced']
+        if 'interfaced' in block:
+            interfaced=block['interfaced']
         mvars=copy.copy(block['vars'])
-        if name: mname=name+'__user__routines'
-        else: mname='unknown__user__routines'
+        if name:
+            mname=name+'__user__routines'
+        else:
+            mname='unknown__user__routines'
         if mname in userisdefined:
             i=1
             while '%s_%i'%(mname,i) in userisdefined: i=i+1
@@ -1556,7 +1591,7 @@
                         i=-1
                         for bb in b['body']:
                             i=i+1
-                            if bb.has_key('name') and bb['name']==e:
+                            if 'name' in bb and bb['name']==e:
                                 edef=copy.copy(bb)
                                 del b['body'][i]
                                 break
@@ -1566,7 +1601,7 @@
                             break
                 interface['body'].append(edef)
             else:
-                if mvars.has_key(e) and not isexternal(mvars[e]):
+                if e in mvars and not isexternal(mvars[e]):
                     interface['vars'][e]=mvars[e]
         if interface['vars'] or interface['body']:
             block['interfaced']=interfaced
@@ -1581,7 +1616,7 @@
     indep = []
     dep = []
     for v in vars.keys():
-        if vars[v].has_key('depend') and vars[v]['depend']:
+        if 'depend' in vars[v] and vars[v]['depend']:
             dep.append(v)
             #print '%s depends on %s'%(v,vars[v]['depend'])
         else: indep.append(v)
@@ -1623,8 +1658,8 @@
                 if m.group('dims'):
                     dims=[x.strip() for x in markoutercomma(m.group('dims')).split('@,@')]
                 n=m.group('name').strip()
-                if block['vars'].has_key(n):
-                    if block['vars'][n].has_key('attrspec'):
+                if n in block['vars']:
+                    if 'attrspec' in block['vars'][n]:
                         block['vars'][n]['attrspec'].append('dimension(%s)'%(','.join(dims)))
                     else:
                         block['vars'][n]['attrspec']=['dimension(%s)'%(','.join(dims))]
@@ -1638,11 +1673,12 @@
                 errmess('analyzecommon: failed to extract "<name>[(<dims>)]" from "%s" in common /%s/.\n'%(e,k))
             comvars.append(n)
         block['common'][k]=comvars
-    if not block.has_key('commonvars'):
+    if 'commonvars' not in block:
         block['commonvars']=commonvars
     else:
         block['commonvars']=block['commonvars']+commonvars
     return block
+
 def analyzebody(block,args,tab=''):
     global usermodules,skipfuncs,onlyfuncs,f90modulevars
     setmesstext(block)
@@ -1661,7 +1697,7 @@
         else: as_=args
         b=postcrack(b,as_,tab=tab+'\t')
         if b['block']=='interface' and not b['body']:
-            if not b.has_key('f2pyenhancements'):
+            if 'f2pyenhancements' not in b:
                 continue
         if b['block'].replace(' ','')=='pythonmodule':
             usermodules.append(b)
@@ -1670,11 +1706,12 @@
                 f90modulevars[b['name']] = b['vars']
             body.append(b)
     return body
+
 def buildimplicitrules(block):
     setmesstext(block)
     implicitrules=defaultimplicitrules
     attrrules={}
-    if block.has_key('implicit'):
+    if 'implicit' in block:
         if block['implicit'] is None:
             implicitrules=None
             if verbose>1:
@@ -1834,12 +1871,12 @@
 word_pattern = re.compile(r'\b[a-z][\w$]*\b',re.I)
 
 def _get_depend_dict(name, vars, deps):
-    if vars.has_key(name):
+    if name in vars:
         words = vars[name].get('depend',[])
 
-        if vars[name].has_key('=') and not isstring(vars[name]):
+        if '=' in vars[name] and not isstring(vars[name]):
             for word in word_pattern.findall(vars[name]['=']):
-                if word not in words and vars.has_key(word):
+                if word not in words and word not in vars:
                     words.append(word)
         for word in words[:]:
             for w in deps.get(word,[]) \
@@ -1870,13 +1907,13 @@
             del depend_dict[name]
     while depend_dict:
         for name, lst in depend_dict.items():
-            new_lst = [n for n in lst if depend_dict.has_key(n)]
+            new_lst = [n for n in lst if n in depend_dict]
             if not new_lst:
                 names.append(name)
                 del depend_dict[name]
             else:
                 depend_dict[name] = new_lst
-    return [name for name in names if vars.has_key(name)]
+    return [name for name in names if name in vars]
 
 def _kind_func(string):
     #XXX: return something sensible.
@@ -1904,16 +1941,16 @@
     for name,func in [('kind',_kind_func),
                       ('selected_int_kind',_selected_int_kind_func),
                       ]:
-        if not g_params.has_key(name):
+        if name not in g_params:
             g_params[name] = func
     param_names = []
     for n in get_sorted_names(vars):
-        if vars[n].has_key('attrspec') and 'parameter' in vars[n]['attrspec']:
+        if 'attrspec' in vars[n] and 'parameter' in vars[n]['attrspec']:
             param_names.append(n)
     kind_re = re.compile(r'\bkind\s*\(\s*(?P<value>.*)\s*\)',re.I)
     selected_int_kind_re = re.compile(r'\bselected_int_kind\s*\(\s*(?P<value>.*)\s*\)',re.I)
     for n in param_names:
-        if vars[n].has_key('='):
+        if '=' in vars[n]:
             v = vars[n]['=']
             if islogical(vars[n]):
                 v = v.lower()
@@ -1978,11 +2015,11 @@
     setmesstext(block)
     implicitrules,attrrules=buildimplicitrules(block)
     vars=copy.copy(block['vars'])
-    if block['block']=='function' and not vars.has_key(block['name']):
+    if block['block']=='function' and block['name'] not in vars:
         vars[block['name']]={}
-    if block['vars'].has_key(''):
+    if '' in block['vars']:
         del vars['']
-        if block['vars'][''].has_key('attrspec'):
+        if 'attrspec' in block['vars']['']:
             gen=block['vars']['']['attrspec']
             for n in vars.keys():
                 for k in ['public','private']:
@@ -2014,14 +2051,14 @@
     for n in svars:
         if n[0] in attrrules.keys():
             vars[n]=setattrspec(vars[n],attrrules[n[0]])
-        if not vars[n].has_key('typespec'):
-            if not(vars[n].has_key('attrspec') and 'external' in vars[n]['attrspec']):
+        if 'typespec' not in vars[n]:
+            if not('attrspec' in vars[n] and 'external' in vars[n]['attrspec']):
                 if implicitrules:
                     ln0 = n[0].lower()
                     for k in implicitrules[ln0].keys():
                         if k=='typespec' and implicitrules[ln0][k]=='undefined':
                             continue
-                        if not vars[n].has_key(k):
+                        if k not in vars[n]:
                             vars[n][k]=implicitrules[ln0][k]
                         elif k=='attrspec':
                             for l in implicitrules[ln0][k]:
@@ -2029,8 +2066,8 @@
                 elif n in block['args']:
                     outmess('analyzevars: typespec of variable %s is not defined in routine %s.\n'%(`n`,block['name']))
 
-        if vars[n].has_key('charselector'):
-            if vars[n]['charselector'].has_key('len'):
+        if 'charselector' in vars[n]:
+            if 'len' in vars[n]['charselector']:
                 l = vars[n]['charselector']['len']
                 try:
                     l = str(eval(l,{},params))
@@ -2038,8 +2075,8 @@
                     pass
                 vars[n]['charselector']['len'] = l
 
-        if vars[n].has_key('kindselector'):
-            if vars[n]['kindselector'].has_key('kind'):
+        if 'kindselector' in vars[n]:
+            if 'kind' in vars[n]['kindselector']:
                 l = vars[n]['kindselector']['kind']
                 try:
                     l = str(eval(l,{},params))
@@ -2048,7 +2085,7 @@
                 vars[n]['kindselector']['kind'] = l
 
         savelindims = {}
-        if vars[n].has_key('attrspec'):
+        if 'attrspec' in vars[n]:
             attr=vars[n]['attrspec']
             attr.reverse()
             vars[n]['attrspec']=[]
@@ -2061,7 +2098,8 @@
                 elif a[:4]=='note': note=(a[4:].strip())[1:-1]
                 else: vars[n]=setattrspec(vars[n],a)
                 if intent:
-                    if not vars[n].has_key('intent'): vars[n]['intent']=[]
+                    if 'intent' not in vars[n]:
+                        vars[n]['intent']=[]
                     for c in [x.strip() for x in markoutercomma(intent).split('@,@')]:
                         if not c in vars[n]['intent']:
                             vars[n]['intent'].append(c)
@@ -2069,27 +2107,32 @@
                 if note:
                     note=note.replace('\\n\\n','\n\n')
                     note=note.replace('\\n ','\n')
-                    if not vars[n].has_key('note'): vars[n]['note']=[note]
-                    else: vars[n]['note'].append(note)
+                    if 'note' not in vars[n]:
+                        vars[n]['note']=[note]
+                    else:
+                        vars[n]['note'].append(note)
                     note=None
                 if depend is not None:
-                    if not vars[n].has_key('depend'): vars[n]['depend']=[]
+                    if 'depend' not in vars[n]:
+                        vars[n]['depend']=[]
                     for c in rmbadname([x.strip() for x in markoutercomma(depend).split('@,@')]):
                         if c not in vars[n]['depend']:
                             vars[n]['depend'].append(c)
                     depend=None
                 if check is not None:
-                    if not vars[n].has_key('check'): vars[n]['check']=[]
+                    if 'check' not in vars[n]:
+                        vars[n]['check']=[]
                     for c in [x.strip() for x in markoutercomma(check).split('@,@')]:
                         if not c in vars[n]['check']:
                             vars[n]['check'].append(c)
                     check=None
-            if dim and not vars[n].has_key('dimension'):
+            if dim and 'dimension' not in vars[n]:
                 vars[n]['dimension']=[]
                 for d in rmbadname([x.strip() for x in markoutercomma(dim).split('@,@')]):
                     star = '*'
-                    if d==':': star=':'
-                    if params.has_key(d):
+                    if d==':':
+                        star=':'
+                    if d in params:
                         d = str(params[d])
                     for p in params.keys():
                         m = re.match(r'(?P<before>.*?)\b'+p+r'\b(?P<after>.*)',d,re.I)
@@ -2110,15 +2153,15 @@
                         if di and di[-4:] == '/(1)': di = di[:-4]
                         if v: savelindims[d] = v,di
                     vars[n]['dimension'].append(d)
-        if vars[n].has_key('dimension'):
+        if 'dimension' in vars[n]:
             if isintent_c(vars[n]):
                 shape_macro = 'shape'
             else:
                 shape_macro = 'shape'#'fshape'
             if isstringarray(vars[n]):
-                if vars[n].has_key('charselector'):
+                if 'charselector' in vars[n]:
                     d = vars[n]['charselector']
-                    if d.has_key('*'):
+                    if '*' in d:
                         d = d['*']
                         errmess('analyzevars: character array "character*%s %s(%s)" is considered as "character %s(%s)"; "intent(c)" is forced.\n'\
                                 %(d,n,
@@ -2126,17 +2169,18 @@
                                   n,','.join(vars[n]['dimension']+[d])))
                         vars[n]['dimension'].append(d)
                         del vars[n]['charselector']
-                        if not vars[n].has_key('intent'):
+                        if 'intent' not in vars[n]:
                             vars[n]['intent'] = []
                         if 'c' not in vars[n]['intent']:
                             vars[n]['intent'].append('c')
                     else:
                         errmess("analyzevars: charselector=%r unhandled." % (d))
-        if not vars[n].has_key('check') and block.has_key('args') and n in block['args']:
-            flag=not vars[n].has_key('depend')
-            if flag: vars[n]['depend']=[]
+        if 'check' not in vars[n] and 'args' in block and n in block['args']:
+            flag = 'depend' not in vars[n]
+            if flag:
+                vars[n]['depend']=[]
             vars[n]['check']=[]
-            if vars[n].has_key('dimension'):
+            if 'dimension' in vars[n]:
                 #/----< no check
                 #vars[n]['check'].append('rank(%s)==%s'%(n,len(vars[n]['dimension'])))
                 i=-1; ni=len(vars[n]['dimension'])
@@ -2145,40 +2189,42 @@
                     ad=''
                     pd=''
                     #origd = d
-                    if not vars.has_key(d):
-                        if savelindims.has_key(d):
+                    if d not in vars:
+                        if d in savelindims:
                             pd,ad='(',savelindims[d][1]
                             d = savelindims[d][0]
                         else:
                             for r in block['args']:
                             #for r in block['vars'].keys():
-                                if not vars.has_key(r): continue
+                                if r not in vars:
+                                    continue
                                 if re.match(r'.*?\b'+r+r'\b',d,re.I):
                                     ddeps.append(r)
-                    if vars.has_key(d):
-                        if vars[d].has_key('attrspec'):
+                    if d in vars:
+                        if 'attrspec' in vars[d]:
                             for aa in vars[d]['attrspec']:
                                 if aa[:6]=='depend':
                                     ddeps += aa[6:].strip()[1:-1].split(',')
-                        if vars[d].has_key('depend'):
+                        if 'depend' in vars[d]:
                             ddeps=ddeps+vars[d]['depend']
                     i=i+1
-                    if vars.has_key(d) and (not vars[d].has_key('depend')) \
-                       and (not vars[d].has_key('=')) and (d not in vars[n]['depend']) \
-                       and l_or(isintent_in,isintent_inout,isintent_inplace)(vars[n]):
+                    if d in vars and ('depend' not in vars[d]) \
+                       and ('=' not in vars[d]) and (d not in vars[n]['depend']) \
+                       and l_or(isintent_in, isintent_inout, isintent_inplace)(vars[n]):
                         vars[d]['depend']=[n]
                         if ni>1:
                             vars[d]['=']='%s%s(%s,%s)%s'% (pd,shape_macro,n,i,ad)
                         else:
                             vars[d]['=']='%slen(%s)%s'% (pd,n,ad)
                         #  /---< no check
-                        if 1 and not vars[d].has_key('check'):
+                        if 1 and 'check' not in vars[d]:
                             if ni>1:
                                 vars[d]['check']=['%s%s(%s,%i)%s==%s'\
                                                   %(pd,shape_macro,n,i,ad,d)]
                             else:
                                 vars[d]['check']=['%slen(%s)%s>=%s'%(pd,n,ad,d)]
-                        if not vars[d].has_key('attrspec'): vars[d]['attrspec']=['optional']
+                        if 'attrspec' not in vars[d]:
+                            vars[d]['attrspec']=['optional']
                         if ('optional' not in vars[d]['attrspec']) and\
                            ('required' not in vars[d]['attrspec']):
                             vars[d]['attrspec'].append('optional')
@@ -2187,32 +2233,35 @@
                         #if ni>1: vars[n]['check'].append('shape(%s,%i)==%s'%(n,i,d))
                         #else: vars[n]['check'].append('len(%s)>=%s'%(n,d))
                         if flag:
-                            if vars.has_key(d):
+                            if d in vars:
                                 if n not in ddeps:
                                     vars[n]['depend'].append(d)
                             else:
                                 vars[n]['depend'] = vars[n]['depend'] + ddeps
             elif isstring(vars[n]):
                 length='1'
-                if vars[n].has_key('charselector'):
-                    if vars[n]['charselector'].has_key('*'):
+                if 'charselector' in vars[n]:
+                    if '*' in vars[n]['charselector']:
                         length = _eval_length(vars[n]['charselector']['*'],
                                               params)
                         vars[n]['charselector']['*']=length
-                    elif vars[n]['charselector'].has_key('len'):
+                    elif 'len' in vars[n]['charselector']:
                         length = _eval_length(vars[n]['charselector']['len'],
                                               params)
                         del vars[n]['charselector']['len']
                         vars[n]['charselector']['*']=length
 
-            if not vars[n]['check']: del vars[n]['check']
-            if flag and not vars[n]['depend']: del vars[n]['depend']
-        if vars[n].has_key('='):
-            if not vars[n].has_key('attrspec'): vars[n]['attrspec']=[]
+            if not vars[n]['check']:
+                del vars[n]['check']
+            if flag and not vars[n]['depend']:
+                del vars[n]['depend']
+        if '=' in vars[n]:
+            if 'attrspec' not in vars[n]:
+                vars[n]['attrspec']=[]
             if ('optional' not in vars[n]['attrspec']) and \
                ('required' not in vars[n]['attrspec']):
                 vars[n]['attrspec'].append('optional')
-            if not vars[n].has_key('depend'):
+            if 'depend' not in vars[n]:
                 vars[n]['depend']=[]
                 for v,m in dep_matches.items():
                     if m(vars[n]['=']): vars[n]['depend'].append(v)
@@ -2222,12 +2271,12 @@
 
     for n in vars.keys():
         if n==block['name']: # n is block name
-            if vars[n].has_key('note'):
+            if 'note' in vars[n]:
                 block['note']=vars[n]['note']
             if block['block']=='function':
-                if block.has_key('result') and vars.has_key(block['result']):
+                if 'result' in block and block['result'] in vars:
                     vars[n]=appenddecl(vars[n],vars[block['result']])
-                if block.has_key('prefix'):
+                if 'prefix' in block:
                     pr=block['prefix']; ispure=0; isrec=1
                     pr1=pr.replace('pure','')
                     ispure=(not pr==pr1)
@@ -2239,7 +2288,7 @@
                         kindselect,charselect,typename=cracktypespec(typespec,selector)
                         vars[n]['typespec']=typespec
                         if kindselect:
-                            if kindselect.has_key('kind'):
+                            if 'kind' in kindselect:
                                 try:
                                     kindselect['kind'] = eval(kindselect['kind'],{},params)
                                 except:
@@ -2252,27 +2301,27 @@
                     else:
                         outmess('analyzevars: prefix (%s) were not used\n'%`block['prefix']`)
     if not block['block'] in ['module','pythonmodule','python module','block data']:
-        if block.has_key('commonvars'):
+        if 'commonvars' in block:
             neededvars=copy.copy(block['args']+block['commonvars'])
         else:
             neededvars=copy.copy(block['args'])
         for n in vars.keys():
             if l_or(isintent_callback,isintent_aux)(vars[n]):
                 neededvars.append(n)
-        if block.has_key('entry'):
+        if 'entry' in block:
             neededvars.extend(block['entry'].keys())
             for k in block['entry'].keys():
                 for n in block['entry'][k]:
                     if n not in neededvars:
                         neededvars.append(n)
         if block['block']=='function':
-            if block.has_key('result'):
+            if 'result' in block:
                 neededvars.append(block['result'])
             else:
                 neededvars.append(block['name'])
         if block['block'] in ['subroutine','function']:
             name = block['name']
-            if vars.has_key(name) and vars[name].has_key('intent'):
+            if name in vars and 'intent' in vars[name]:
                 block['intent'] = vars[name]['intent']
         if block['block'] == 'type':
             neededvars.extend(vars.keys())
@@ -2280,11 +2329,13 @@
             if n not in neededvars:
                 del vars[n]
     return vars
+
 analyzeargs_re_1 = re.compile(r'\A[a-z]+[\w$]*\Z',re.I)
 def analyzeargs(block):
     setmesstext(block)
     implicitrules,attrrules=buildimplicitrules(block)
-    if not block.has_key('args'): block['args']=[]
+    if 'args' not in block:
+        block['args']=[]
     args=[]
     re_1 = analyzeargs_re_1
     for a in block['args']:
@@ -2297,29 +2348,32 @@
             if na[-1]=='_': na=na+'e'
             else: na=na+'_e'
             a=na
-            while block['vars'].has_key(a) or a in block['args']: a=a+'r'
+            while a in block['vars'] or a in block['args']:
+                a=a+'r'
             block['vars'][a]=at
         args.append(a)
-        if not block['vars'].has_key(a):
+        if a not in block['vars']:
             block['vars'][a]={}
-        if block.has_key('externals') and a in block['externals']+block['interfaced']:
+        if 'externals' in block and a in block['externals']+block['interfaced']:
             block['vars'][a]=setattrspec(block['vars'][a],'external')
     block['args']=args
 
-    if block.has_key('entry'):
+    if 'entry' in block:
         for k,args1 in block['entry'].items():
             for a in args1:
-                if not block['vars'].has_key(a):
+                if a not in block['vars']:
                     block['vars'][a]={}
 
     for b in block['body']:
         if b['name'] in args:
-            if not block.has_key('externals'): block['externals']=[]
+            if 'externals' not in block:
+                block['externals']=[]
             if b['name'] not in block['externals']:
                 block['externals'].append(b['name'])
-    if block.has_key('result') and not block['vars'].has_key(block['result']):
+    if 'result' in block and block['result'] not in block['vars']:
         block['vars'][block['result']]={}
     return block
+
 determineexprtype_re_1 = re.compile(r'\A\(.+?[,].+?\)\Z',re.I)
 determineexprtype_re_2 = re.compile(r'\A[+-]?\d+(_(P<name>[\w]+)|)\Z',re.I)
 determineexprtype_re_3 = re.compile(r'\A[+-]?[\d.]+[\d+-de.]*(_(P<name>[\w]+)|)\Z',re.I)
@@ -2336,24 +2390,24 @@
     return r
 
 def determineexprtype(expr,vars,rules={}):
-    if vars.has_key(expr):
+    if expr in vars:
         return _ensure_exprdict(vars[expr])
     expr=expr.strip()
     if determineexprtype_re_1.match(expr):
         return {'typespec':'complex'}
     m=determineexprtype_re_2.match(expr)
     if m:
-        if m.groupdict().has_key('name') and m.group('name'):
+        if 'name' in m.groupdict() and m.group('name'):
             outmess('determineexprtype: selected kind types not supported (%s)\n'%`expr`)
         return {'typespec':'integer'}
     m = determineexprtype_re_3.match(expr)
     if m:
-        if m.groupdict().has_key('name') and m.group('name'):
+        if 'name' in m.groupdict() and m.group('name'):
             outmess('determineexprtype: selected kind types not supported (%s)\n'%`expr`)
         return {'typespec':'real'}
     for op in ['+','-','*','/']:
         for e in [x.strip() for x in markoutercomma(expr,comma=op).split('@'+op+'@')]:
-            if vars.has_key(e):
+            if e in vars:
                 return _ensure_exprdict(vars[e])
     t={}
     if determineexprtype_re_4.match(expr): # in parenthesis
@@ -2363,15 +2417,17 @@
         if m:
             rn=m.group('name')
             t=determineexprtype(m.group('name'),vars,rules)
-            if t and t.has_key('attrspec'): del t['attrspec']
+            if t and 'attrspec' in t:
+                del t['attrspec']
             if not t:
-                if rules.has_key(rn[0]):
+                if rn[0] in rules:
                     return _ensure_exprdict(rules[rn[0]])
     if expr[0] in '\'"':
         return {'typespec':'character','charselector':{'*':'*'}}
     if not t:
         outmess('determineexprtype: could not determine expressions (%s) type.\n'%(`expr`))
     return t
+
 ######
 def crack2fortrangen(block,tab='\n'):
     global skipfuncs, onlyfuncs
@@ -2392,14 +2448,15 @@
     blocktype=block['block']
     if blocktype=='program': return ''
     al=[]
-    if block.has_key('name'): name=block['name']
-    if block.has_key('args'):
+    if 'name' in block:
+        name=block['name']
+    if 'args' in block:
         vars = block['vars']
         al = [a for a in block['args'] if not isintent_callback(vars[a])]
         if block['block']=='function' or al:
             args='(%s)'%','.join(al)
     f2pyenhancements = ''
-    if block.has_key('f2pyenhancements'):
+    if 'f2pyenhancements' in block:
         for k in block['f2pyenhancements'].keys():
             f2pyenhancements = '%s%s%s %s'%(f2pyenhancements,tab+tabchar,k,block['f2pyenhancements'][k])
     intent_lst = block.get('intent',[])[:]
@@ -2410,24 +2467,25 @@
                            (f2pyenhancements,tab+tabchar,
                             ','.join(intent_lst),name)
     use=''
-    if block.has_key('use'):
+    if 'use' in block:
         use=use2fortran(block['use'],tab+tabchar)
     common=''
-    if block.has_key('common'):
+    if 'common' in block:
         common=common2fortran(block['common'],tab+tabchar)
     if name=='unknown_interface': name=''
     result=''
-    if block.has_key('result'):
+    if 'result' in block:
         result=' result (%s)'%block['result']
         if block['result'] not in al:
             al.append(block['result'])
-    #if block.has_key('prefix'): prefix=block['prefix']+' '
+    #if 'prefix' in block:
+    #    prefix=block['prefix']+' '
     body=crack2fortrangen(block['body'],tab+tabchar)
     vars=vars2fortran(block,block['vars'],al,tab+tabchar)
     mess=''
-    if block.has_key('from'):
+    if 'from' in block:
         mess='! in %s'%block['from']
-    if block.has_key('entry'):
+    if 'entry' in block:
         entry_stmts = ''
         for k,i in block['entry'].items():
             entry_stmts = '%s%sentry %s(%s)' \
@@ -2437,6 +2495,7 @@
         name = ''
     ret='%s%s%s %s%s%s %s%s%s%s%s%s%send %s %s'%(tab,prefix,blocktype,name,args,result,mess,f2pyenhancements,use,vars,common,body,tab,blocktype,name)
     return ret
+
 def common2fortran(common,tab=''):
     ret=''
     for k in common.keys():
@@ -2445,6 +2504,7 @@
         else:
             ret='%s%scommon /%s/ %s'%(ret,tab,k,','.join(common[k]))
     return ret
+
 def use2fortran(use,tab=''):
     ret=''
     for m in use.keys():
@@ -2452,9 +2512,9 @@
         if use[m]=={}:
             if ret and ret[-1]==',': ret=ret[:-1]
             continue
-        if use[m].has_key('only') and use[m]['only']:
+        if 'only' in use[m] and use[m]['only']:
             ret='%s,only:'%(ret)
-        if use[m].has_key('map') and use[m]['map']:
+        if 'map' in use[m] and use[m]['map']:
             c=' '
             for k in use[m]['map'].keys():
                 if k==use[m]['map'][k]:
@@ -2463,6 +2523,7 @@
                     ret='%s%s%s=>%s'%(ret,c,k,use[m]['map'][k]); c=','
         if ret and ret[-1]==',': ret=ret[:-1]
     return ret
+
 def true_intent_list(var):
     lst = var['intent']
     ret = []
@@ -2474,6 +2535,7 @@
         if c:
             ret.append(intent)
     return ret
+
 def vars2fortran(block,vars,args,tab=''):
     """
     TODO:
@@ -2484,41 +2546,47 @@
     ret=''
     nout=[]
     for a in args:
-        if block['vars'].has_key(a): nout.append(a)
-    if block.has_key('commonvars'):
+        if a in block['vars']:
+            nout.append(a)
+    if 'commonvars' in block:
         for a in block['commonvars']:
-            if vars.has_key(a):
-                if a not in nout: nout.append(a)
-            else: errmess('vars2fortran: Confused?!: "%s" is not defined in vars.\n'%a)
-    if block.has_key('varnames'):
+            if a in vars:
+                if a not in nout:
+                    nout.append(a)
+            else:
+                errmess('vars2fortran: Confused?!: "%s" is not defined in vars.\n'%a)
+    if 'varnames' in block:
         nout.extend(block['varnames'])
     for a in vars.keys():
-        if a not in nout: nout.append(a)
+        if a not in nout:
+            nout.append(a)
     for a in nout:
-        if vars[a].has_key('depend'):
+        if 'depend' in vars[a]:
             for d in vars[a]['depend']:
-                if vars.has_key(d) and vars[d].has_key('depend') and a in vars[d]['depend']:
+                if d in vars and 'depend' in vars[d] and a in vars[d]['depend']:
                     errmess('vars2fortran: Warning: cross-dependence between variables "%s" and "%s"\n'%(a,d))
-        if block.has_key('externals') and a in block['externals']:
+        if 'externals' in block and a in block['externals']:
             if isintent_callback(vars[a]):
                 ret='%s%sintent(callback) %s'%(ret,tab,a)
             ret='%s%sexternal %s'%(ret,tab,a)
             if isoptional(vars[a]):
                 ret='%s%soptional %s'%(ret,tab,a)
-            if vars.has_key(a) and not vars[a].has_key('typespec'):
+            if a in vars and 'typespec' not in vars[a]:
                 continue
             cont=1
             for b in block['body']:
-                if a==b['name'] and b['block']=='function': cont=0;break
-            if cont: continue
-        if not vars.has_key(a):
+                if a==b['name'] and b['block']=='function':
+                    cont=0;break
+            if cont:
+                continue
+        if a not in vars:
             show(vars)
             outmess('vars2fortran: No definition for argument "%s".\n'%a)
             continue
         if a==block['name'] and not block['block']=='function':
             continue
-        if not vars[a].has_key('typespec'):
-            if vars[a].has_key('attrspec') and 'external' in vars[a]['attrspec']:
+        if 'typespec' not in vars[a]:
+            if 'attrspec' in vars[a] and 'external' in vars[a]['attrspec']:
                 if a in args:
                     ret='%s%sexternal %s'%(ret,tab,a)
                 continue
@@ -2526,27 +2594,29 @@
             outmess('vars2fortran: No typespec for argument "%s".\n'%a)
             continue
         vardef=vars[a]['typespec']
-        if vardef=='type' and vars[a].has_key('typename'):
+        if vardef=='type' and 'typename' in vars[a]:
             vardef='%s(%s)'%(vardef,vars[a]['typename'])
         selector={}
-        if vars[a].has_key('kindselector'): selector=vars[a]['kindselector']
-        elif vars[a].has_key('charselector'): selector=vars[a]['charselector']
-        if selector.has_key('*'):
+        if 'kindselector' in vars[a]:
+            selector=vars[a]['kindselector']
+        elif 'charselector' in vars[a]:
+            selector=vars[a]['charselector']
+        if '*' in selector:
             if selector['*'] in ['*',':']:
                 vardef='%s*(%s)'%(vardef,selector['*'])
             else:
                 vardef='%s*%s'%(vardef,selector['*'])
         else:
-            if selector.has_key('len'):
+            if 'len' in selector:
                 vardef='%s(len=%s'%(vardef,selector['len'])
-                if selector.has_key('kind'):
+                if 'kind' in selector:
                     vardef='%s,kind=%s)'%(vardef,selector['kind'])
                 else:
                     vardef='%s)'%(vardef)
-            elif selector.has_key('kind'):
+            elif 'kind' in selector:
                 vardef='%s(kind=%s)'%(vardef,selector['kind'])
         c=' '
-        if vars[a].has_key('attrspec'):
+        if 'attrspec' in vars[a]:
             attr=[]
             for l in vars[a]['attrspec']:
                 if l not in ['external']:
@@ -2554,23 +2624,23 @@
             if attr:
                 vardef='%s %s'%(vardef,','.join(attr))
                 c=','
-        if vars[a].has_key('dimension'):
+        if 'dimension' in vars[a]:
 #             if not isintent_c(vars[a]):
 #                 vars[a]['dimension'].reverse()
             vardef='%s%sdimension(%s)'%(vardef,c,','.join(vars[a]['dimension']))
             c=','
-        if vars[a].has_key('intent'):
+        if 'intent' in vars[a]:
             lst = true_intent_list(vars[a])
             if lst:
                 vardef='%s%sintent(%s)'%(vardef,c,','.join(lst))
             c=','
-        if vars[a].has_key('check'):
+        if 'check' in vars[a]:
             vardef='%s%scheck(%s)'%(vardef,c,','.join(vars[a]['check']))
             c=','
-        if vars[a].has_key('depend'):
+        if 'depend' in vars[a]:
             vardef='%s%sdepend(%s)'%(vardef,c,','.join(vars[a]['depend']))
             c=','
-        if vars[a].has_key('='):
+        if '=' in vars[a]:
             v = vars[a]['=']
             if vars[a]['typespec'] in ['complex','double complex']:
                 try:
@@ -2595,6 +2665,7 @@
     outmess('Post-processing (stage 2)...\n',0)
     postlist=postcrack2(postlist)
     return usermodules+postlist
+
 def crack2fortran(block):
     global f2py_version
     pyf=crack2fortrangen(block)+'\n'

Modified: trunk/numpy/f2py/f2py2e.py
===================================================================
--- trunk/numpy/f2py/f2py2e.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/f2py2e.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -245,7 +245,7 @@
         os.mkdir(buildpath)
     if signsfile:
         signsfile = os.path.join(buildpath,signsfile)
-    if signsfile and os.path.isfile(signsfile) and not options.has_key('h-overwrite'):
+    if signsfile and os.path.isfile(signsfile) and 'h-overwrite' not in options:
         errmess('Signature file "%s" exists!!! Use --overwrite-signature to overwrite.\n'%(signsfile))
         sys.exit()
 
@@ -269,16 +269,16 @@
     funcs=[]
     crackfortran.debug=options['debug']
     crackfortran.verbose=options['verbose']
-    if options.has_key('module'):
+    if 'module' in options:
         crackfortran.f77modulename=options['module']
-    if options.has_key('skipfuncs'):
+    if 'skipfuncs' in options:
         crackfortran.skipfuncs=options['skipfuncs']
-    if options.has_key('onlyfuncs'):
+    if 'onlyfuncs' in options:
         crackfortran.onlyfuncs=options['onlyfuncs']
     crackfortran.include_paths[:]=options['include_paths']
     crackfortran.dolowercase=options['do-lower']
     postlist=crackfortran.crackfortran(files)
-    if options.has_key('signsfile'):
+    if 'signsfile' in options:
         outmess('Saving signatures to file "%s"\n'%(options['signsfile']))
         pyf=crackfortran.crack2fortran(postlist)
         if options['signsfile'][-6:]=='stdout':
@@ -297,21 +297,22 @@
         if '__user__' in list[i]['name']:
             cb_rules.buildcallbacks(list[i])
         else:
-            if list[i].has_key('use'):
+            if 'use' in list[i]:
                 for u in list[i]['use'].keys():
-                    if not isusedby.has_key(u): isusedby[u]=[]
+                    if u not in isusedby:
+                        isusedby[u]=[]
                     isusedby[u].append(list[i]['name'])
             modules.append(list[i])
             mnames.append(list[i]['name'])
     ret = {}
     for i in range(len(mnames)):
-        if isusedby.has_key(mnames[i]):
+        if mnames[i] in isusedby:
             outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],','.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]))))
         else:
             um=[]
-            if modules[i].has_key('use'):
+            if 'use' in modules[i]:
                 for u in modules[i]['use'].keys():
-                    if isusedby.has_key(u) and u in mnames:
+                    if u in isusedby and u in mnames:
                         um.append(modules[mnames.index(u)])
                     else:
                         outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n'%(mnames[i],u))
@@ -321,7 +322,7 @@
 
 def dict_append(d_out,d_in):
     for (k,v) in d_in.items():
-        if not d_out.has_key(k):
+        if k not in d_out:
             d_out[k] = []
         if type(v) is types.ListType:
             d_out[k] = d_out[k] + v
@@ -341,23 +342,24 @@
     postlist=callcrackfortran(files,options)
     isusedby={}
     for i in range(len(postlist)):
-        if postlist[i].has_key('use'):
+        if 'use' in postlist[i]:
             for u in postlist[i]['use'].keys():
-                if not isusedby.has_key(u): isusedby[u]=[]
+                if u not in isusedby:
+                    isusedby[u]=[]
                 isusedby[u].append(postlist[i]['name'])
     for i in range(len(postlist)):
         if postlist[i]['block']=='python module' and '__user__' in postlist[i]['name']:
-            if isusedby.has_key(postlist[i]['name']):
+            if postlist[i]['name'] in isusedby:
                 #if not quiet:
                 outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],','.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']]))))
-    if options.has_key('signsfile'):
+    if 'signsfile' in options:
         if options['verbose']>1:
             outmess('Stopping. Edit the signature file and then run f2py on the signature file: ')
             outmess('%s %s\n'%(os.path.basename(sys.argv[0]),options['signsfile']))
         return
     for i in range(len(postlist)):
         if postlist[i]['block']!='python module':
-            if not options.has_key('python module'):
+            if 'python module' not in options:
                 errmess('Tip: If your original code is Fortran source then you must use -m option.\n')
             raise TypeError,'All blocks must be python module blocks but got %s'%(`postlist[i]['block']`)
     auxfuncs.debugoptions=options['debug']

Modified: trunk/numpy/f2py/f90mod_rules.py
===================================================================
--- trunk/numpy/f2py/f90mod_rules.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/f90mod_rules.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -136,7 +136,7 @@
             if not dms: dms='-1'
             use_fgetdims2 = fgetdims2
             if isstringarray(var):
-                if var.has_key('charselector') and var['charselector'].has_key('len'):
+                if 'charselector' in var and 'len' in var['charselector']:
                     cadd('\t{"%s",%s,{{%s,%s}},%s},'\
                          %(undo_rmbadname1(n),dm['rank'],dms,var['charselector']['len'],at))
                     use_fgetdims2 = fgetdims2_sa
@@ -186,7 +186,7 @@
                 else:
                     fargs.append(b['name'])
                     mfargs.append(fargs[-1])
-                    #if options.has_key('--external-modroutines') and options['--external-modroutines']:
+                    #if '--external-modroutines' in options and options['--external-modroutines']:
                     #    outmess('\t\t\tapplying --external-modroutines for %s\n'%(b['name']))
                     #     efargs.append(fargs[-1])
                 api['externroutines']=[]

Modified: trunk/numpy/f2py/func2subr.py
===================================================================
--- trunk/numpy/f2py/func2subr.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/func2subr.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -31,26 +31,26 @@
 def var2fixfortran(vars,a,fa=None,f90mode=None):
     if fa is None:
         fa = a
-    if not vars.has_key(a):
+    if a not in vars:
         show(vars)
         outmess('var2fixfortran: No definition for argument "%s".\n'%a)
         return ''
-    if not vars[a].has_key('typespec'):
+    if 'typespec' not in vars[a]:
         show(vars[a])
         outmess('var2fixfortran: No typespec for argument "%s".\n'%a)
         return ''
     vardef=vars[a]['typespec']
-    if vardef=='type' and vars[a].has_key('typename'):
+    if vardef=='type' and 'typename' in vars[a]:
         vardef='%s(%s)'%(vardef,vars[a]['typename'])
     selector={}
     lk = ''
-    if vars[a].has_key('kindselector'):
+    if 'kindselector' in vars[a]:
         selector=vars[a]['kindselector']
         lk = 'kind'
-    elif vars[a].has_key('charselector'):
+    elif 'charselector' in vars[a]:
         selector=vars[a]['charselector']
         lk = 'len'
-    if selector.has_key('*'):
+    if '*' in selector:
         if f90mode:
             if selector['*'] in ['*',':','(*)']:
                 vardef='%s(len=*)'%(vardef)
@@ -62,17 +62,17 @@
             else:
                 vardef='%s*%s'%(vardef,selector['*'])
     else:
-        if selector.has_key('len'):
+        if 'len' in selector:
             vardef='%s(len=%s'%(vardef,selector['len'])
-            if selector.has_key('kind'):
+            if 'kind' in selector:
                 vardef='%s,kind=%s)'%(vardef,selector['kind'])
             else:
                 vardef='%s)'%(vardef)
-        elif selector.has_key('kind'):
+        elif 'kind' in selector:
             vardef='%s(kind=%s)'%(vardef,selector['kind'])
 
     vardef='%s %s'%(vardef,fa)
-    if vars[a].has_key('dimension'):
+    if 'dimension' in vars[a]:
         vardef='%s(%s)'%(vardef,','.join(vars[a]['dimension']))
     return vardef
 
@@ -86,7 +86,7 @@
     f90mode = ismoduleroutine(rout)
     newname = '%sf2pywrap'%(name)
     vars = rout['vars']
-    if not vars.has_key(newname):
+    if newname not in vars:
         vars[newname] = vars[name]
         args = [newname]+rout['args'][1:]
     else:
@@ -150,12 +150,13 @@
     rout = copy.copy(rout)
     fname = name
     rname = fname
-    if rout.has_key('result'):
+    if 'result' in rout:
         rname = rout['result']
         rout['vars'][fname]=rout['vars'][rname]
     fvar = rout['vars'][fname]
     if not isintent_out(fvar):
-        if not fvar.has_key('intent'): fvar['intent']=[]
+        if 'intent' not in fvar:
+            fvar['intent']=[]
         fvar['intent'].append('out')
         flag=1
         for i in fvar['intent']:

Modified: trunk/numpy/f2py/lib/extgen/base.py
===================================================================
--- trunk/numpy/f2py/lib/extgen/base.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/extgen/base.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -358,7 +358,7 @@
         d = Component._registered_components_map
         for component in components:
             provides = component.provides
-            if d.has_key(provides):
+            if provides in d:
                 Component.warning('component that provides %r is already registered, ignoring.' % (provides))
             else:
                 d[provides] = component
@@ -440,7 +440,7 @@
         return bool(self.list)
 
     def has(self, label):
-        return self.label_map.has_key(label)
+        return label in self.label_map
 
     def get(self, label):
         return self.list[self.label_map[label]]

Modified: trunk/numpy/f2py/lib/extgen/py_support.py
===================================================================
--- trunk/numpy/f2py/lib/extgen/py_support.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/extgen/py_support.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -507,7 +507,7 @@
         while dep_map:
             dep_map_copy = dep_map.copy()
             for name, deps in dep_map.items():
-                d = [n for n in deps if dep_map.has_key(n)]
+                d = [n for n in deps if n in dep_map]
                 if not d:
                     sorted_arguments.append(comp_map[name])
                     del dep_map[name]

Modified: trunk/numpy/f2py/lib/parser/Fortran2003.py
===================================================================
--- trunk/numpy/f2py/lib/parser/Fortran2003.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/parser/Fortran2003.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -5825,11 +5825,12 @@
 if 1: # Optimize subclass tree:
 
     def _rpl_list(clsname):
-        if not Base_classes.has_key(clsname):
+        if clsname not in Base_classes:
             print 'Not implemented:',clsname
             return [] # remove this code when all classes are implemented
         cls = Base_classes[clsname]
-        if cls.__dict__.has_key('match'): return [clsname]
+        if 'match' in cls.__dict__:
+            return [clsname]
         l = []
         for n in getattr(cls,'subclass_names',[]):
             l1 = _rpl_list(n)
@@ -5862,7 +5863,7 @@
     except KeyError:
         Base.subclasses[clsname] = l = []
     for n in subclass_names:
-        if Base_classes.has_key(n):
+        if n in Base_classes:
             l.append(Base_classes[n])
         else:
             print '%s not implemented needed by %s' % (n,clsname)
@@ -5882,7 +5883,7 @@
             if n not in subclasses_names:
                 print '%s needs to be added to %s subclass_name list' % (n,cls.__name__)
         for n in use_names + subclass_names:
-            if not Base_classes.has_key(n):
+            if n not in Base_classes:
                 print '%s not defined used by %s' % (n, cls.__name__)
 
 

Modified: trunk/numpy/f2py/lib/parser/block_statements.py
===================================================================
--- trunk/numpy/f2py/lib/parser/block_statements.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/parser/block_statements.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -36,7 +36,7 @@
         if implicit_rules is None:
             raise AnalyzeError,'Implicit rules mapping is null while getting %r type' % (name)
         l = name[0].lower()
-        if implicit_rules.has_key(l):
+        if l in implicit_rules:
             return implicit_rules[l]
         # default rules:
         if l in 'ijklmn':
@@ -60,7 +60,7 @@
             if c.startswith('default'):
                 continue
             st = t.tostr()
-            if items.has_key(st):
+            if st in items:
                 items[st].append(c)
             else:
                 items[st] = [c]
@@ -116,7 +116,7 @@
 
     def get_variable_by_name(self, name):
         variables = self.a.variables
-        if variables.has_key(name):
+        if name in variables:
             var = variables[name]
         else:
             var = variables[name] = Variable(self, name)
@@ -316,7 +316,7 @@
         #module_provides = self.a.module_provides
         #for name, var in self.a.variables.items():
         #    if var.is_public():
-        #        if module_provides.has_key(name):
+        #        if name in module_provides:
         #            self.warning('module data object name conflict with %s, overriding.' % (name))
         #        module_provides[name] = var
 
@@ -477,12 +477,12 @@
         if content:
             self.show_message('Not analyzed content: %s' % content)
 
-        if self.parent.a.variables.has_key(self.name):
+        if self.name in self.parent.a.variables:
             var = self.parent.a.variables.pop(self.name)
             self.update_attributes(var.attributes)
 
         parent_interface = self.parent.get_interface()
-        if parent_interface.has_key(self.name):
+        if self.name in parent_interface:
             p = parent_interface[self.name]
             last = p.content.pop()
             assert isinstance(last,EndInterface),`last.__class__`
@@ -576,7 +576,7 @@
 
         variables = self.a.variables
         for a in self.args:
-            assert not variables.has_key(a)
+            assert a not in variables
             assert is_name(a)
             variables[a] = Variable(self, a)
 
@@ -604,7 +604,7 @@
         #parent_provides = self.parent.get_provides()
         #if parent_provides is not None:
         #    if self.is_public():
-        #        if parent_provides.has_key(self.name):
+        #        if self.name in parent_provides:
         #            self.warning('module subprogram name conflict with %s, overriding.' % (self.name))
         #        parent_provides[self.name] = self
 
@@ -1081,7 +1081,7 @@
         #parent_provides = self.parent.get_provides()
         #if parent_provides is not None:
         #    if self.is_public():
-        #        if parent_provides.has_key(self.name):
+        #        if self.name in parent_provides:
         #            self.warning('type declaration name conflict with %s, overriding.' % (self.name))
         #        parent_provides[self.name] = self
 

Modified: trunk/numpy/f2py/lib/parser/parsefortran.py
===================================================================
--- trunk/numpy/f2py/lib/parser/parsefortran.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/parser/parsefortran.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -31,7 +31,7 @@
         Use .parse() method for parsing, parsing result is saved in .block attribute.
         """
         self.reader = reader
-        if self.cache.has_key(reader.id):
+        if reader.id in self.cache:
             parser = self.cache[reader.id]
             self.block = parser.block
             self.is_analyzed = parser.is_analyzed

Modified: trunk/numpy/f2py/lib/parser/statements.py
===================================================================
--- trunk/numpy/f2py/lib/parser/statements.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/parser/statements.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -875,11 +875,11 @@
 
     def analyze(self):
         use = self.parent.a.use
-        if use.has_key(self.name):
+        if self.name in use:
             return
 
         modules = self.top.a.module
-        if not modules.has_key(self.name):
+        if self.name not in modules:
             fn = None
             for d in self.reader.include_dirs:
                 fn = get_module_file(self.name, d)
@@ -896,7 +896,7 @@
                 parser.analyze()
                 modules.update(parser.block.a.module)
 
-        if not modules.has_key(self.name):
+        if self.name not in modules:
             self.warning('no information about the module %r in use statement' % (self.name))
             return
 

Modified: trunk/numpy/f2py/lib/parser/utils.py
===================================================================
--- trunk/numpy/f2py/lib/parser/utils.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/lib/parser/utils.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -113,7 +113,7 @@
 
 
 def get_module_files(directory, _cache={}):
-    if _cache.has_key(directory):
+    if directory in _cache:
         return _cache[directory]
     module_line = re.compile(r'(\A|^)module\s+(?P<name>\w+)\s*(!.*|)$',re.I | re.M)
     d = {}
@@ -121,7 +121,7 @@
         f = open(fn,'r')
         for name in module_line.findall(f.read()):
             name = name[1]
-            if d.has_key(name):
+            if name in d:
                 print d[name],'already defines',name
                 continue
             d[name] = fn

Modified: trunk/numpy/f2py/rules.py
===================================================================
--- trunk/numpy/f2py/rules.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/rules.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -1105,7 +1105,7 @@
             errmess('buildmodule: Could not found the body of interfaced routine "%s". Skipping.\n'%(n))
             continue
         nb_list = [nb]
-        if nb.has_key('entry'):
+        if 'entry' in nb:
             for k,a in nb['entry'].items():
                 nb1 = copy.deepcopy(nb)
                 del nb1['entry']
@@ -1146,22 +1146,32 @@
         code[n]=[]
         for k in needs[n]:
             c=''
-            if cfuncs.includes0.has_key(k): c=cfuncs.includes0[k]
-            elif cfuncs.includes.has_key(k): c=cfuncs.includes[k]
-            elif cfuncs.userincludes.has_key(k): c=cfuncs.userincludes[k]
-            elif cfuncs.typedefs.has_key(k): c=cfuncs.typedefs[k]
-            elif cfuncs.typedefs_generated.has_key(k):
+            if k in cfuncs.includes0:
+                c=cfuncs.includes0[k]
+            elif k in cfuncs.includes:
+                c=cfuncs.includes[k]
+            elif k in cfuncs.userincludes:
+                c=cfuncs.userincludes[k]
+            elif k in cfuncs.typedefs:
+                c=cfuncs.typedefs[k]
+            elif k in cfuncs.typedefs_generated:
                 c=cfuncs.typedefs_generated[k]
-            elif cfuncs.cppmacros.has_key(k): c=cfuncs.cppmacros[k]
-            elif cfuncs.cfuncs.has_key(k): c=cfuncs.cfuncs[k]
-            elif cfuncs.callbacks.has_key(k): c=cfuncs.callbacks[k]
-            elif cfuncs.f90modhooks.has_key(k): c=cfuncs.f90modhooks[k]
-            elif cfuncs.commonhooks.has_key(k): c=cfuncs.commonhooks[k]
-            else: errmess('buildmodule: unknown need %s.\n'%(`k`));continue
+            elif k in cfuncs.cppmacros:
+                c=cfuncs.cppmacros[k]
+            elif k in cfuncs.cfuncs:
+                c=cfuncs.cfuncs[k]
+            elif k in cfuncs.callbacks:
+                c=cfuncs.callbacks[k]
+            elif k in cfuncs.f90modhooks:
+                c=cfuncs.f90modhooks[k]
+            elif k in cfuncs.commonhooks:
+                c=cfuncs.commonhooks[k]
+            else:
+                errmess('buildmodule: unknown need %s.\n'%(`k`));continue
             code[n].append(c)
     mod_rules.append(code)
     for r in mod_rules:
-        if (r.has_key('_check') and r['_check'](m)) or (not r.has_key('_check')):
+        if ('_check' in r and r['_check'](m)) or ('_check' not in r):
             ar=applyrules(r,vrd,m)
             rd=dictappend(rd,ar)
     ar=applyrules(module_rules,rd)
@@ -1185,10 +1195,10 @@
         ret['ltx'] = fn
         f=open(fn,'w')
         f.write('%% This file is auto-generated with f2py (version:%s)\n'%(f2py_version))
-        if not options.has_key('shortlatex'):
+        if 'shortlatex' not in options:
             f.write('\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n')
         f.write('\n'.join(ar['latexdoc']))
-        if not options.has_key('shortlatex'):
+        if 'shortlatex' not in options:
             f.write('\\end{document}')
         f.close()
         outmess('\tDocumentation is saved to file "%s/%smodule.tex"\n'%(options['buildpath'],vrd['modulename']))
@@ -1252,7 +1262,7 @@
     vrd=routsign2map(rout)
     rd=dictappend({},vrd)
     for r in rout_rules:
-        if (r.has_key('_check') and r['_check'](rout)) or (not r.has_key('_check')):
+        if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
             ar=applyrules(r,vrd,rout)
             rd=dictappend(rd,ar)
 
@@ -1275,11 +1285,13 @@
             else: vrd['nth']='hidden'
         savevrd[a]=vrd
         for r in _rules:
-            if r.has_key('_depend'): continue
-            if (r.has_key('_check') and r['_check'](var[a])) or (not r.has_key('_check')):
+            if '_depend' in r:
+                continue
+            if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
                 ar=applyrules(r,vrd,var[a])
                 rd=dictappend(rd,ar)
-                if r.has_key('_break'): break
+                if '_break' in r:
+                    break
     for a in depargs:
         if isintent_aux(var[a]):
             _rules = aux_rules
@@ -1287,12 +1299,14 @@
             _rules = arg_rules
         vrd=savevrd[a]
         for r in _rules:
-            if not r.has_key('_depend'): continue
-            if (r.has_key('_check') and r['_check'](var[a])) or (not r.has_key('_check')):
+            if '_depend' not in r:
+                continue
+            if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
                 ar=applyrules(r,vrd,var[a])
                 rd=dictappend(rd,ar)
-                if r.has_key('_break'): break
-        if var[a].has_key('check'):
+                if '_break' in r:
+                    break
+        if 'check' in var[a]:
             for c in var[a]['check']:
                 vrd['check']=c
                 ar=applyrules(check_rules,vrd,var[a])
@@ -1329,10 +1343,10 @@
     rd['docstrsigns']=[]
     rd['latexdocstrsigns']=[]
     for k in ['docstrreq','docstropt','docstrout','docstrcbs']:
-        if rd.has_key(k) and type(rd[k])==types.ListType:
+        if k in rd and type(rd[k])==types.ListType:
             rd['docstrsigns']=rd['docstrsigns']+rd[k]
         k='latex'+k
-        if rd.has_key(k) and type(rd[k])==types.ListType:
+        if k in rd and type(rd[k])==types.ListType:
             rd['latexdocstrsigns']=rd['latexdocstrsigns']+rd[k][0:1]+\
                                     ['\\begin{description}']+rd[k][1:]+\
                                     ['\\end{description}']

Modified: trunk/numpy/f2py/use_rules.py
===================================================================
--- trunk/numpy/f2py/use_rules.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/f2py/use_rules.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -61,15 +61,15 @@
     outmess('\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n'%(m['name']))
     varsmap={}
     revmap={}
-    if r.has_key('map'):
+    if 'map' in r:
         for k in r['map'].keys():
-            if revmap.has_key(r['map'][k]):
+            if r['map'][k] in revmap:
                 outmess('\t\t\tVariable "%s<=%s" is already mapped by "%s". Skipping.\n'%(r['map'][k],k,revmap[r['map'][k]]))
             else:
                 revmap[r['map'][k]]=k
-    if r.has_key('only') and r['only']:
+    if 'only' in r and r['only']:
         for v in r['map'].keys():
-            if m['vars'].has_key(r['map'][v]):
+            if r['map'][v] in m['vars']:
 
                 if revmap[r['map'][v]]==v:
                     varsmap[v]=r['map'][v]
@@ -79,7 +79,7 @@
                 outmess('\t\t\tNo definition for variable "%s=>%s". Skipping.\n'%(v,r['map'][v]))
     else:
         for v in m['vars'].keys():
-            if revmap.has_key(v):
+            if v in revmap:
                 varsmap[v]=revmap[v]
             else:
                 varsmap[v]=v

Modified: trunk/numpy/numarray/numerictypes.py
===================================================================
--- trunk/numpy/numarray/numerictypes.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/numarray/numerictypes.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -80,13 +80,13 @@
 def IsType(rep):
     """Determines whether the given object or string, 'rep', represents
     a numarray type."""
-    return isinstance(rep, NumericType) or typeDict.has_key(rep)
+    return isinstance(rep, NumericType) or rep in typeDict
 
 def _register(name, type, force=0):
     """Register the type object.  Raise an exception if it is already registered
     unless force is true.
     """
-    if typeDict.has_key(name) and not force:
+    if name in typeDict and not force:
         raise ValueError("Type %s has already been registered" % name)
     typeDict[name] = type
     return type
@@ -104,7 +104,7 @@
         particular type parameterization,  i.e. the second time you try to
         create "Int32",  you get the original Int32, not a new one.
         """
-        if typeDict.has_key(name):
+        if name in typeDict:
             self = typeDict[name]
             if self.bytes != bytes or self.default != default or \
                    self.typeno != typeno:

Modified: trunk/numpy/numarray/session.py
===================================================================
--- trunk/numpy/numarray/session.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/numarray/session.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -165,7 +165,7 @@
         return False
 
 def _loadmodule(module):
-    if not sys.modules.has_key(module):
+    if module not in sys.modules:
         modules = module.split(".")
         s = ""
         for i in range(len(modules)):

Modified: trunk/numpy/testing/numpytest.py
===================================================================
--- trunk/numpy/testing/numpytest.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/testing/numpytest.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -379,7 +379,7 @@
         test_dir_module = parent_module_name+'.tests'
         test_module_name = test_dir_module+'.'+test_module_name
 
-        if not sys.modules.has_key(test_dir_module):
+        if test_dir_module not in sys.modules:
             sys.modules[test_dir_module] = imp.new_module(test_dir_module)
 
         old_sys_path = sys.path[:]
@@ -463,7 +463,8 @@
             d = os.path.join(d, 'tests')
             if not os.path.isdir(d):
                 continue
-            if test_dirs_names.has_key(d): continue
+            if d in test_dirs_names:
+                continue
             test_dir_module = '.'.join(name.split('.')[:-1]+['tests'])
             test_dirs_names[d] = test_dir_module
 
@@ -477,7 +478,7 @@
         for test_dir in test_dirs:
             test_dir_module = test_dirs_names[test_dir]
 
-            if not sys.modules.has_key(test_dir_module):
+            if test_dir_module not in sys.modules:
                 sys.modules[test_dir_module] = imp.new_module(test_dir_module)
 
             for fn in os.listdir(test_dir):

Modified: trunk/numpy/testing/utils.py
===================================================================
--- trunk/numpy/testing/utils.py	2007-11-26 10:16:48 UTC (rev 4510)
+++ trunk/numpy/testing/utils.py	2007-11-28 05:12:37 UTC (rev 4511)
@@ -130,7 +130,7 @@
         assert isinstance(actual, dict), repr(type(actual))
         assert_equal(len(actual),len(desired),err_msg,verbose)
         for k,i in desired.items():
-            assert actual.has_key(k), repr(k)
+            assert k in actual, repr(k)
             assert_equal(actual[k], desired[k], 'key=%r\n%s' % (k,err_msg), verbose)
         return
     if isinstance(desired, (list,tuple)) and isinstance(actual, (list,tuple)):



More information about the Numpy-svn mailing list