Revision: 62
Author: mbaas
Date: 2006-05-03 02:27:12 -0700 (Wed, 03 May 2006)
ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=62&view=rev
Log Message:
-----------
Turned the info messages into debug messages
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/scopedef.py
Modified: pygccxml_dev/pygccxml/declarations/scopedef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/scopedef.py 2006-05-03 09:09:56 UTC (rev 61)
+++ pygccxml_dev/pygccxml/declarations/scopedef.py 2006-05-03 09:27:12 UTC (rev 62)
@@ -6,56 +6,56 @@
"""
defines base class for L{namespace_t} and L{class_t} classes
"""
-
+
import time
-import algorithm
+import algorithm
import filtering
-import declaration
-import mdecl_wrapper
+import declaration
+import mdecl_wrapper
from pygccxml import utils
-import matcher as matcher_module
+import matcher as matcher_module
class scopedef_t( declaration.declaration_t ):
"""Base class for L{namespace_t} and L{class_t} classes.
This is the base class for all declaration classes that may have
children nodes. The children can be accessed via the C{declarations}
- property.
-
- Also this class provides "get/select/find" interface. Using this class you
- can get instance or instances of internal declaration(s).
-
- You can find declaration(s) using next criteria:
- 1. name - declaration name, could be full qualified name
- 2. header_dir - directory, to which belongs file, that the declaration was declarated in.
- header_dir should be absolute path.
- 3. header_file - file that the declaration was declarated in.
- 4. function - user ( your ) custom criteria. The interesting thing is that
- this function will be joined with other arguments ( criteria ).
- 5. recursive - the search declaration range, if True will be search in
- internal declarations too.
-
- Every "select" API you can invoke and pass as first argument at declaration
- name or function. This class will find out correctly what argument represents.
-
- Example::
- ns - referrers to global namespace
- ns.member_function( "do_something ) - will return reference to member
- function named "do_something". If there is no such function exception
- will be raised. If there is more then one function exception will be
- raised too.
-
- Example 2::
- ns - referers to global namespace
- do_smths = ns.member_functions( "do_something ) - will return instance
- of L{mdecl_wrapper_t} object. This object allows you few things:
-
- 1. To iterate on selected declarations
- 2. To set some property to desired value using one line of code only:
- do_smths.call_policies = x
- 3. To call some function on every instance using one line of code:
- do_smths.exclude()
-
+ property.
+
+ Also this class provides "get/select/find" interface. Using this class you
+ can get instance or instances of internal declaration(s).
+
+ You can find declaration(s) using next criteria:
+ 1. name - declaration name, could be full qualified name
+ 2. header_dir - directory, to which belongs file, that the declaration was declarated in.
+ header_dir should be absolute path.
+ 3. header_file - file that the declaration was declarated in.
+ 4. function - user ( your ) custom criteria. The interesting thing is that
+ this function will be joined with other arguments ( criteria ).
+ 5. recursive - the search declaration range, if True will be search in
+ internal declarations too.
+
+ Every "select" API you can invoke and pass as first argument at declaration
+ name or function. This class will find out correctly what argument represents.
+
+ Example::
+ ns - referrers to global namespace
+ ns.member_function( "do_something ) - will return reference to member
+ function named "do_something". If there is no such function exception
+ will be raised. If there is more then one function exception will be
+ raised too.
+
+ Example 2::
+ ns - referers to global namespace
+ do_smths = ns.member_functions( "do_something ) - will return instance
+ of L{mdecl_wrapper_t} object. This object allows you few things:
+
+ 1. To iterate on selected declarations
+ 2. To set some property to desired value using one line of code only:
+ do_smths.call_policies = x
+ 3. To call some function on every instance using one line of code:
+ do_smths.exclude()
+
Pay attention: you can not use "get" functions or properties.
"""
@@ -115,7 +115,7 @@
if base is declaration.declaration_t:
continue
if base in visited:
- continue
+ continue
if 'pygccxml' not in base.__module__:
continue
types.append( base )
@@ -146,7 +146,7 @@
Almost every query includes declaration type information. Also very
common query is to search some declaration(s) by name or full name.
Those hashtables allows to search declaration very quick.
- """
+ """
if self.name == '::':
utils.logger.debug( "preparing data structures for query optimizer - started" )
start_time = time.clock()
@@ -226,15 +226,15 @@
matcher = match_class( **matcher_args )
if keywds['function']:
- utils.logger.info( 'running query: %s and <user defined function>' % str( matcher ) )
+ utils.logger.debug( 'running query: %s and <user defined function>' % str( matcher ) )
return lambda decl: matcher( decl ) and keywds['function'](decl)
else:
- utils.logger.info( 'running query: %s' % str( matcher ) )
+ utils.logger.debug( 'running query: %s' % str( matcher ) )
return matcher
def __findout_range( self, name, decl_type, recursive ):
if not self._optimized:
- utils.logger.info( 'running non optimized query - optimization has not been done' )
+ utils.logger.debug( 'running non optimized query - optimization has not been done' )
decls = self.declarations
if recursive:
decls = algorithm.make_flatten( self.declarations )
@@ -245,34 +245,34 @@
if matcher.is_full_name():
name = matcher.decl_name_only
if recursive:
- utils.logger.info( 'query has been optimized on type and name' )
+ utils.logger.debug( 'query has been optimized on type and name' )
if self._type2name2decls[decl_type].has_key( name ):
return self._type2name2decls[decl_type][name]
else:
return []
else:
- utils.logger.info( 'non recursive query has been optimized on type and name' )
+ utils.logger.debug( 'non recursive query has been optimized on type and name' )
if self._type2name2decls_nr[decl_type].has_key( name ):
return self._type2name2decls_nr[decl_type][name]
else:
return []
elif decl_type:
if recursive:
- utils.logger.info( 'query has been optimized on type' )
+ utils.logger.debug( 'query has been optimized on type' )
return self._type2decls[ decl_type ]
else:
- utils.logger.info( 'non recursive query has been optimized on type' )
+ utils.logger.debug( 'non recursive query has been optimized on type' )
return self._type2decls_nr[ decl_type ]
else:
if recursive:
- utils.logger.info( 'query has not been optimized ( hint: query does not contain type and/or name )' )
+ utils.logger.debug( 'query has not been optimized ( hint: query does not contain type and/or name )' )
return self._all_decls
else:
- utils.logger.info( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' )
+ utils.logger.debug( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' )
return self.declarations
def _find_single( self, match_class, **keywds ):
- utils.logger.info( 'find single query execution - started' )
+ utils.logger.debug( 'find single query execution - started' )
start_time = time.clock()
norm_keywds = self.__normalize_args( **keywds )
matcher = self.__create_matcher( match_class, **norm_keywds )
@@ -280,11 +280,11 @@
recursive_ = self.__findout_recursive( **norm_keywds )
decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ )
found = matcher_module.matcher.get_single( matcher, decls, False )
- utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) )
+ utils.logger.debug( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) )
return found
def _find_multiple( self, match_class, **keywds ):
- utils.logger.info( 'find all query execution - started' )
+ utils.logger.debug( 'find all query execution - started' )
start_time = time.clock()
norm_keywds = self.__normalize_args( **keywds )
matcher = self.__create_matcher( match_class, **norm_keywds )
@@ -294,8 +294,8 @@
decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ )
found = matcher_module.matcher.find( matcher, decls, False )
mfound = mdecl_wrapper.mdecl_wrapper_t( found )
- utils.logger.info( '%d declaration(s) that match query' % len(mfound) )
- utils.logger.info( 'find single query execution - done( %f seconds )'
+ utils.logger.debug( '%d declaration(s) that match query' % len(mfound) )
+ utils.logger.debug( 'find single query execution - done( %f seconds )'
% ( time.clock() - start_time ) )
if not mfound and not allow_empty:
raise RuntimeError( "Multi declaration query returned 0 declarations." )
@@ -306,7 +306,7 @@
"""Finds any declaration by criteria. Please see L{scopedef_t} for full explanation."""
return self._find_single( self._impl_matchers[ scopedef_t.decl ]
, name=name
- , function=function
+ , function=function
, decl_type=decl_type
, header_dir=header_dir
, header_file=header_file
@@ -315,7 +315,7 @@
def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ):
return self._find_multiple( self._impl_matchers[ scopedef_t.decl ]
, name=name
- , function=function
+ , function=function
, decl_type=decl_type
, header_dir=header_dir
, header_file=header_file
@@ -523,4 +523,4 @@
, recursive=recursive
, allow_empty=allow_empty)
#adding small aliase
- enums = enumerations
\ No newline at end of file
+ enums = enumerations
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|