idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
43,700
def fresh ( t , non_generic ) : mappings = { } def freshrec ( tp ) : p = prune ( tp ) if isinstance ( p , TypeVariable ) : if is_generic ( p , non_generic ) : if p not in mappings : mappings [ p ] = TypeVariable ( ) return mappings [ p ] else : return p elif isinstance ( p , dict ) : return p elif isinstance ( p , Collection ) : return Collection ( * [ freshrec ( x ) for x in p . types ] ) elif isinstance ( p , Scalar ) : return Scalar ( [ freshrec ( x ) for x in p . types ] ) elif isinstance ( p , TypeOperator ) : return TypeOperator ( p . name , [ freshrec ( x ) for x in p . types ] ) elif isinstance ( p , MultiType ) : return MultiType ( [ freshrec ( x ) for x in p . types ] ) else : assert False , "missing freshrec case {}" . format ( type ( p ) ) return freshrec ( t )
Makes a copy of a type expression .
43,701
def prune ( t ) : if isinstance ( t , TypeVariable ) : if t . instance is not None : t . instance = prune ( t . instance ) return t . instance return t
Returns the currently defining instance of t .
43,702
def occurs_in_type ( v , type2 ) : pruned_type2 = prune ( type2 ) if pruned_type2 == v : return True elif isinstance ( pruned_type2 , TypeOperator ) : return occurs_in ( v , pruned_type2 . types ) return False
Checks whether a type variable occurs in a type expression .
43,703
def visit_Module ( self , node ) : node . body = [ k for k in ( self . visit ( n ) for n in node . body ) if k ] imports = [ ast . Import ( [ ast . alias ( i , mangle ( i ) ) ] ) for i in self . imports ] node . body = imports + node . body ast . fix_missing_locations ( node ) return node
Visit the whole module and add all import at the top level .
43,704
def visit_Name ( self , node ) : if node . id in self . symbols : symbol = path_to_node ( self . symbols [ node . id ] ) if not getattr ( symbol , 'isliteral' , lambda : False ) ( ) : parent = self . ancestors [ node ] [ - 1 ] blacklist = ( ast . Tuple , ast . List , ast . Set , ast . Return ) if isinstance ( parent , blacklist ) : raise PythranSyntaxError ( "Unsupported module identifier manipulation" , node ) new_node = path_to_attr ( self . symbols [ node . id ] ) new_node . ctx = node . ctx ast . copy_location ( new_node , node ) return new_node return node
Replace name with full expanded name .
43,705
def save_function_effect ( module ) : for intr in module . values ( ) : if isinstance ( intr , dict ) : save_function_effect ( intr ) else : fe = FunctionEffects ( intr ) IntrinsicArgumentEffects [ intr ] = fe if isinstance ( intr , intrinsic . Class ) : save_function_effect ( intr . fields )
Recursively save function effect for pythonic functions .
43,706
def prepare ( self , node ) : super ( ArgumentEffects , self ) . prepare ( node ) for n in self . global_declarations . values ( ) : fe = FunctionEffects ( n ) self . node_to_functioneffect [ n ] = fe self . result . add_node ( fe )
Initialise arguments effects as this analyse is inter - procedural .
43,707
def process_locals ( self , node , node_visited , * skipped ) : local_vars = self . scope [ node ] . difference ( skipped ) local_vars = local_vars . difference ( self . openmp_deps ) if not local_vars : return node_visited locals_visited = [ ] for varname in local_vars : vartype = self . typeof ( varname ) decl = Statement ( "{} {}" . format ( vartype , varname ) ) locals_visited . append ( decl ) self . ldecls . difference_update ( local_vars ) return Block ( locals_visited + [ node_visited ] )
Declare variable local to node and insert declaration before .
43,708
def process_omp_attachements ( self , node , stmt , index = None ) : omp_directives = metadata . get ( node , OMPDirective ) if omp_directives : directives = list ( ) for directive in omp_directives : directive . deps = [ self . visit ( dep ) for dep in directive . deps ] directives . append ( directive ) if index is None : stmt = AnnotatedStatement ( stmt , directives ) else : stmt [ index ] = AnnotatedStatement ( stmt [ index ] , directives ) return stmt
Add OpenMP pragma on the correct stmt in the correct order .
43,709
def visit_Assign ( self , node ) : if not all ( isinstance ( n , ( ast . Name , ast . Subscript ) ) for n in node . targets ) : raise PythranSyntaxError ( "Must assign to an identifier or a subscript" , node ) value = self . visit ( node . value ) targets = [ self . visit ( t ) for t in node . targets ] alltargets = "= " . join ( targets ) islocal = ( len ( targets ) == 1 and isinstance ( node . targets [ 0 ] , ast . Name ) and node . targets [ 0 ] . id in self . scope [ node ] and node . targets [ 0 ] . id not in self . openmp_deps ) if islocal : self . ldecls . difference_update ( t . id for t in node . targets ) if self . types [ node . targets [ 0 ] ] . iscombined ( ) : alltargets = '{} {}' . format ( self . typeof ( node . targets [ 0 ] ) , alltargets ) elif isinstance ( self . types [ node . targets [ 0 ] ] , self . types . builder . Assignable ) : alltargets = '{} {}' . format ( self . types . builder . Assignable ( self . types . builder . NamedType ( 'decltype({})' . format ( value ) ) ) , alltargets ) else : assert isinstance ( self . types [ node . targets [ 0 ] ] , self . types . builder . Lazy ) alltargets = '{} {}' . format ( self . types . builder . Lazy ( self . types . builder . NamedType ( 'decltype({})' . format ( value ) ) ) , alltargets ) stmt = Assign ( alltargets , value ) return self . process_omp_attachements ( node , stmt )
Create Assign node for final Cxx representation .
43,710
def gen_for ( self , node , target , local_iter , local_iter_decl , loop_body ) : local_target = "__target{0}" . format ( id ( node ) ) local_target_decl = self . types . builder . IteratorOfType ( local_iter_decl ) if node . target . id in self . scope [ node ] and not hasattr ( self , 'yields' ) : local_type = "auto&&" else : local_type = "" loop_body_prelude = Statement ( "{} {}= *{}" . format ( local_type , target , local_target ) ) assign = self . make_assign ( local_target_decl , local_target , local_iter ) loop = For ( "{}.begin()" . format ( assign ) , "{0} < {1}.end()" . format ( local_target , local_iter ) , "++{0}" . format ( local_target ) , Block ( [ loop_body_prelude , loop_body ] ) ) return [ self . process_omp_attachements ( node , loop ) ]
Create For representation on iterator for Cxx generation .
43,711
def handle_real_loop_comparison ( self , args , target , upper_bound ) : if len ( args ) <= 2 : order = 1 elif isinstance ( args [ 2 ] , ast . Num ) : order = - 1 + 2 * ( int ( args [ 2 ] . n ) > 0 ) elif isinstance ( args [ 1 ] , ast . Num ) and isinstance ( args [ 0 ] , ast . Num ) : order = - 1 + 2 * ( int ( args [ 1 ] . n ) > int ( args [ 0 ] . n ) ) else : order = 0 comparison = "{} < {}" if order == 1 else "{} > {}" comparison = comparison . format ( target , upper_bound ) return comparison
Handle comparison for real loops .
43,712
def gen_c_for ( self , node , local_iter , loop_body ) : args = node . iter . args step = "1L" if len ( args ) <= 2 else self . visit ( args [ 2 ] ) if len ( args ) == 1 : lower_bound = "0L" upper_arg = 0 else : lower_bound = self . visit ( args [ 0 ] ) upper_arg = 1 upper_type = iter_type = "long " upper_value = self . visit ( args [ upper_arg ] ) if is_simple_expr ( args [ upper_arg ] ) : upper_bound = upper_value else : upper_bound = "__target{0}" . format ( id ( node ) ) if node . target . id in self . scope [ node ] and not hasattr ( self , 'yields' ) : loop = list ( ) else : iter_type = "" loop = [ If ( "{} == {}" . format ( local_iter , upper_bound ) , Statement ( "{} -= {}" . format ( local_iter , step ) ) ) ] comparison = self . handle_real_loop_comparison ( args , local_iter , upper_bound ) forloop = For ( "{0} {1}={2}" . format ( iter_type , local_iter , lower_bound ) , comparison , "{0} += {1}" . format ( local_iter , step ) , loop_body ) loop . insert ( 0 , self . process_omp_attachements ( node , forloop ) ) if upper_bound is upper_value : header = [ ] else : assgnt = self . make_assign ( upper_type , upper_bound , upper_value ) header = [ Statement ( assgnt ) ] return header , loop
Create C For representation for Cxx generation .
43,713
def handle_omp_for ( self , node , local_iter ) : for directive in metadata . get ( node , OMPDirective ) : if any ( key in directive . s for key in ( ' parallel ' , ' task ' ) ) : directive . s += ' shared({})' directive . deps . append ( ast . Name ( local_iter , ast . Load ( ) , None ) ) directive . shared_deps . append ( directive . deps [ - 1 ] ) target = node . target assert isinstance ( target , ast . Name ) hasfor = 'for' in directive . s nodefault = 'default' not in directive . s noindexref = all ( isinstance ( x , ast . Name ) and x . id != target . id for x in directive . deps ) if ( hasfor and nodefault and noindexref and target . id not in self . scope [ node ] ) : directive . s += ' private({})' directive . deps . append ( ast . Name ( target . id , ast . Load ( ) , None ) ) directive . private_deps . append ( directive . deps [ - 1 ] )
Fix OpenMP directives on For loops .
43,714
def can_use_autofor ( self , node ) : auto_for = ( isinstance ( node . target , ast . Name ) and node . target . id in self . scope [ node ] and node . target . id not in self . openmp_deps ) auto_for &= not metadata . get ( node , OMPDirective ) auto_for &= node . target . id not in self . openmp_deps return auto_for
Check if given for Node can use autoFor syntax .
43,715
def can_use_c_for ( self , node ) : assert isinstance ( node . target , ast . Name ) if sys . version_info . major == 3 : range_name = 'range' else : range_name = 'xrange' pattern_range = ast . Call ( func = ast . Attribute ( value = ast . Name ( id = '__builtin__' , ctx = ast . Load ( ) , annotation = None ) , attr = range_name , ctx = ast . Load ( ) ) , args = AST_any ( ) , keywords = [ ] ) is_assigned = { node . target . id : False } [ is_assigned . update ( self . gather ( IsAssigned , stmt ) ) for stmt in node . body ] nodes = ASTMatcher ( pattern_range ) . search ( node . iter ) if ( node . iter not in nodes or is_assigned [ node . target . id ] ) : return False args = node . iter . args if len ( args ) < 3 : return True if isinstance ( args [ 2 ] , ast . Num ) : return True return False
Check if a for loop can use classic C syntax .
43,716
def visit_For ( self , node ) : if not isinstance ( node . target , ast . Name ) : raise PythranSyntaxError ( "Using something other than an identifier as loop target" , node . target ) target = self . visit ( node . target ) loop_body = Block ( [ self . visit ( stmt ) for stmt in node . body ] ) loop_body = self . process_locals ( node , loop_body , node . target . id ) iterable = self . visit ( node . iter ) if self . can_use_c_for ( node ) : header , loop = self . gen_c_for ( node , target , loop_body ) else : if self . can_use_autofor ( node ) : header = [ ] self . ldecls . remove ( node . target . id ) autofor = AutoFor ( target , iterable , loop_body ) loop = [ self . process_omp_attachements ( node , autofor ) ] else : local_iter = "__iter{0}" . format ( id ( node ) ) local_iter_decl = self . types . builder . Assignable ( self . types [ node . iter ] ) self . handle_omp_for ( node , local_iter ) asgnt = self . make_assign ( local_iter_decl , local_iter , iterable ) header = [ Statement ( asgnt ) ] loop = self . gen_for ( node , target , local_iter , local_iter_decl , loop_body ) for comp in metadata . get ( node , metadata . Comprehension ) : header . append ( Statement ( "pythonic::utils::reserve({0},{1})" . format ( comp . target , iterable ) ) ) return Block ( header + loop )
Create For representation for Cxx generation .
43,717
def visit_While ( self , node ) : test = self . visit ( node . test ) body = [ self . visit ( n ) for n in node . body ] stmt = While ( test , Block ( body ) ) return self . process_omp_attachements ( node , stmt )
Create While node for Cxx generation .
43,718
def visit_Break ( self , _ ) : if self . break_handlers and self . break_handlers [ - 1 ] : return Statement ( "goto {0}" . format ( self . break_handlers [ - 1 ] ) ) else : return Statement ( "break" )
Generate break statement in most case and goto for orelse clause .
43,719
def visit_Module ( self , node ) : deps = sorted ( self . dependencies ) headers = [ Include ( os . path . join ( "pythonic" , "include" , * t ) + ".hpp" ) for t in deps ] headers += [ Include ( os . path . join ( "pythonic" , * t ) + ".hpp" ) for t in deps ] decls_n_defns = [ self . visit ( stmt ) for stmt in node . body ] decls , defns = zip ( * [ s for s in decls_n_defns if s ] ) nsbody = [ s for ls in decls + defns for s in ls ] ns = Namespace ( pythran_ward + self . passmanager . module_name , nsbody ) self . result = CompilationUnit ( headers + [ ns ] )
Build a compilation unit .
43,720
def refine ( pm , node , optimizations ) : pm . apply ( ExpandGlobals , node ) pm . apply ( ExpandImportAll , node ) pm . apply ( NormalizeTuples , node ) pm . apply ( ExpandBuiltins , node ) pm . apply ( ExpandImports , node ) pm . apply ( NormalizeMethodCalls , node ) pm . apply ( NormalizeIsNone , node ) pm . apply ( SplitStaticExpression , node ) pm . apply ( NormalizeStaticIf , node ) pm . apply ( NormalizeTuples , node ) pm . apply ( NormalizeException , node ) pm . apply ( NormalizeMethodCalls , node ) pm . apply ( ComprehensionPatterns , node ) pm . apply ( RemoveLambdas , node ) pm . apply ( RemoveNestedFunctions , node ) pm . apply ( NormalizeCompare , node ) pm . gather ( ExtendedSyntaxCheck , node ) pm . apply ( ListCompToGenexp , node ) pm . apply ( RemoveComprehension , node ) pm . apply ( RemoveNamedArguments , node ) pm . apply ( NormalizeReturn , node ) pm . apply ( UnshadowParameters , node ) pm . apply ( FalsePolymorphism , node ) apply_optimisation = True while apply_optimisation : apply_optimisation = False for optimization in optimizations : apply_optimisation |= pm . apply ( optimization , node ) [ 0 ]
Refine node in place until it matches pythran s expectations .
43,721
def prepare ( self , node ) : super ( GlobalEffects , self ) . prepare ( node ) def register_node ( module ) : for v in module . values ( ) : if isinstance ( v , dict ) : register_node ( v ) else : fe = GlobalEffects . FunctionEffect ( v ) self . node_to_functioneffect [ v ] = fe self . result . add_node ( fe ) if isinstance ( v , intrinsic . Class ) : register_node ( v . fields ) register_node ( self . global_declarations ) for module in MODULES . values ( ) : register_node ( module ) self . node_to_functioneffect [ intrinsic . UnboundValue ] = GlobalEffects . FunctionEffect ( intrinsic . UnboundValue )
Initialise globals effects as this analyse is inter - procedural .
43,722
def prepare ( self , node ) : def register ( name , module ) : for fname , function in module . items ( ) : if isinstance ( function , dict ) : register ( name + "::" + fname , function ) else : tname = 'pythonic::{0}::functor::{1}' . format ( name , fname ) self . result [ function ] = self . builder . NamedType ( tname ) self . combiners [ function ] = function if isinstance ( function , Class ) : register ( name + "::" + fname , function . fields ) for mname , module in MODULES . items ( ) : register ( mname , module ) super ( Types , self ) . prepare ( node )
Initialise values to prepare typing computation .
43,723
def register ( self , ptype ) : if len ( self . typedefs ) < cfg . getint ( 'typing' , 'max_combiner' ) : self . typedefs . append ( ptype ) return True return False
register ptype as a local typedef
43,724
def isargument ( self , node ) : try : node_id , _ = self . node_to_id ( node ) return ( node_id in self . name_to_nodes and any ( [ isinstance ( n , ast . Name ) and isinstance ( n . ctx , ast . Param ) for n in self . name_to_nodes [ node_id ] ] ) ) except UnboundableRValue : return False
checks whether node aliases to a parameter .
43,725
def combine ( self , node , othernode , op = None , unary_op = None , register = False , aliasing_type = False ) : if self . result [ othernode ] is self . builder . UnknownType : if node not in self . result : self . result [ node ] = self . builder . UnknownType return if aliasing_type : self . combine_ ( node , othernode , op or operator . add , unary_op or ( lambda x : x ) , register ) for a in self . strict_aliases [ node ] : self . combine_ ( a , othernode , op or operator . add , unary_op or ( lambda x : x ) , register ) else : self . combine_ ( node , othernode , op or operator . add , unary_op or ( lambda x : x ) , register )
Change node typing with combination of node and othernode .
43,726
def visit_Return ( self , node ) : self . generic_visit ( node ) if not self . yield_points : assert node . value , "Values were added in each return statement." self . combine ( self . current , node . value )
Compute return type and merges with others possible return type .
43,727
def visit_Yield ( self , node ) : self . generic_visit ( node ) self . combine ( self . current , node . value )
Compute yield type and merges it with others yield type .
43,728
def visit_BoolOp ( self , node ) : self . generic_visit ( node ) [ self . combine ( node , value ) for value in node . values ]
Merge BoolOp operand type .
43,729
def visit_Num ( self , node ) : ty = type ( node . n ) sty = pytype_to_ctype ( ty ) if node in self . immediates : sty = "std::integral_constant<%s, %s>" % ( sty , node . n ) self . result [ node ] = self . builder . NamedType ( sty )
Set type for number .
43,730
def visit_Str ( self , node ) : self . result [ node ] = self . builder . NamedType ( pytype_to_ctype ( str ) )
Set the pythonic string type .
43,731
def visit_Attribute ( self , node ) : obj , path = attr_to_path ( node ) if obj . isliteral ( ) : typename = pytype_to_ctype ( obj . signature ) self . result [ node ] = self . builder . NamedType ( typename ) else : self . result [ node ] = self . builder . DeclType ( '::' . join ( path ) + '{}' )
Compute typing for an attribute node .
43,732
def visit_Slice ( self , node ) : self . generic_visit ( node ) if node . step is None or ( isinstance ( node . step , ast . Num ) and node . step . n == 1 ) : self . result [ node ] = self . builder . NamedType ( 'pythonic::types::contiguous_slice' ) else : self . result [ node ] = self . builder . NamedType ( 'pythonic::types::slice' )
Set slicing type using continuous information if provided .
43,733
def init_not_msvc ( self ) : paths = os . environ . get ( 'LD_LIBRARY_PATH' , '' ) . split ( ':' ) for gomp in ( 'libgomp.so' , 'libgomp.dylib' ) : if cxx is None : continue cmd = [ cxx , '-print-file-name=' + gomp ] try : path = os . path . dirname ( check_output ( cmd ) . strip ( ) ) if path : paths . append ( path ) except OSError : pass libgomp_path = find_library ( "gomp" ) for path in paths : if libgomp_path : break path = path . strip ( ) if os . path . isdir ( path ) : libgomp_path = find_library ( os . path . join ( str ( path ) , "libgomp" ) ) if not libgomp_path : raise ImportError ( "I can't find a shared library for libgomp," " you may need to install it or adjust the " "LD_LIBRARY_PATH environment variable." ) else : self . libomp = ctypes . CDLL ( libgomp_path ) self . version = 45
Find OpenMP library and try to load if using ctype interface .
43,734
def visit_FunctionDef ( self , node ) : if ( len ( node . body ) == 1 and isinstance ( node . body [ 0 ] , ( ast . Call , ast . Return ) ) ) : ids = self . gather ( Identifiers , node . body [ 0 ] ) if node . name not in ids : self . result [ node . name ] = copy . deepcopy ( node )
Determine this function definition can be inlined .
43,735
def pytype_to_deps_hpp ( t ) : if isinstance ( t , List ) : return { 'list.hpp' } . union ( pytype_to_deps_hpp ( t . __args__ [ 0 ] ) ) elif isinstance ( t , Set ) : return { 'set.hpp' } . union ( pytype_to_deps_hpp ( t . __args__ [ 0 ] ) ) elif isinstance ( t , Dict ) : tkey , tvalue = t . __args__ return { 'dict.hpp' } . union ( pytype_to_deps_hpp ( tkey ) , pytype_to_deps_hpp ( tvalue ) ) elif isinstance ( t , Tuple ) : return { 'tuple.hpp' } . union ( * [ pytype_to_deps_hpp ( elt ) for elt in t . __args__ ] ) elif isinstance ( t , NDArray ) : out = { 'ndarray.hpp' } if t . __args__ [ 1 ] . start == - 1 : out . add ( 'numpy_texpr.hpp' ) return out . union ( pytype_to_deps_hpp ( t . __args__ [ 0 ] ) ) elif isinstance ( t , Pointer ) : return { 'pointer.hpp' } . union ( pytype_to_deps_hpp ( t . __args__ [ 0 ] ) ) elif isinstance ( t , Fun ) : return { 'cfun.hpp' } . union ( * [ pytype_to_deps_hpp ( a ) for a in t . __args__ ] ) elif t in PYTYPE_TO_CTYPE_TABLE : return { '{}.hpp' . format ( t . __name__ ) } else : raise NotImplementedError ( "{0}:{1}" . format ( type ( t ) , t ) )
python - > pythonic type hpp filename .
43,736
def pytype_to_deps ( t ) : res = set ( ) for hpp_dep in pytype_to_deps_hpp ( t ) : res . add ( os . path . join ( 'pythonic' , 'types' , hpp_dep ) ) res . add ( os . path . join ( 'pythonic' , 'include' , 'types' , hpp_dep ) ) return res
python - > pythonic type header full path .
43,737
def prepare ( self , node ) : super ( TypeDependencies , self ) . prepare ( node ) for v in self . global_declarations . values ( ) : self . result . add_node ( v ) self . result . add_node ( TypeDependencies . NoDeps )
Add nodes for each global declarations in the result graph .
43,738
def visit_any_conditionnal ( self , node1 , node2 ) : true_naming = false_naming = None try : tmp = self . naming . copy ( ) for expr in node1 : self . visit ( expr ) true_naming = self . naming self . naming = tmp except KeyError : pass try : tmp = self . naming . copy ( ) for expr in node2 : self . visit ( expr ) false_naming = self . naming self . naming = tmp except KeyError : pass if true_naming and not false_naming : self . naming = true_naming elif false_naming and not true_naming : self . naming = false_naming elif true_naming and false_naming : self . naming = false_naming for k , v in true_naming . items ( ) : if k not in self . naming : self . naming [ k ] = v else : for dep in v : if dep not in self . naming [ k ] : self . naming [ k ] . append ( dep )
Set and restore the in_cond variable before visiting subnode .
43,739
def visit_FunctionDef ( self , node ) : assert self . current_function is None self . current_function = node self . naming = dict ( ) self . in_cond = False self . generic_visit ( node ) self . current_function = None
Initialize variable for the current function to add edges from calls .
43,740
def visit_Return ( self , node ) : if not node . value : return for dep_set in self . visit ( node . value ) : if dep_set : for dep in dep_set : self . result . add_edge ( dep , self . current_function ) else : self . result . add_edge ( TypeDependencies . NoDeps , self . current_function )
Add edge from all possible callee to current function .
43,741
def visit_Assign ( self , node ) : value_deps = self . visit ( node . value ) for target in node . targets : name = get_variable ( target ) if isinstance ( name , ast . Name ) : self . naming [ name . id ] = value_deps
In case of assignment assign value depend on r - value type dependencies .
43,742
def visit_AugAssign ( self , node ) : args = ( self . naming [ get_variable ( node . target ) . id ] , self . visit ( node . value ) ) merge_dep = list ( { frozenset . union ( * x ) for x in itertools . product ( * args ) } ) self . naming [ get_variable ( node . target ) . id ] = merge_dep
AugAssigned value depend on r - value type dependencies .
43,743
def visit_For ( self , node ) : body = node . body if node . target . id in self . naming : body = [ ast . Assign ( targets = [ node . target ] , value = node . iter ) ] + body self . visit_any_conditionnal ( body , node . orelse ) else : iter_dep = self . visit ( node . iter ) self . naming [ node . target . id ] = iter_dep self . visit_any_conditionnal ( body , body + node . orelse )
Handle iterator variable in for loops .
43,744
def visit_BoolOp ( self , node ) : return sum ( ( self . visit ( value ) for value in node . values ) , [ ] )
Return type may come from any boolop operand .
43,745
def visit_BinOp ( self , node ) : args = [ self . visit ( arg ) for arg in ( node . left , node . right ) ] return list ( { frozenset . union ( * x ) for x in itertools . product ( * args ) } )
Return type depend from both operand of the binary operation .
43,746
def visit_Call ( self , node ) : args = [ self . visit ( arg ) for arg in node . args ] func = self . visit ( node . func ) params = args + [ func or [ ] ] return list ( { frozenset . union ( * p ) for p in itertools . product ( * params ) } )
Function call depend on all function use in the call .
43,747
def visit_Name ( self , node ) : if node . id in self . naming : return self . naming [ node . id ] elif node . id in self . global_declarations : return [ frozenset ( [ self . global_declarations [ node . id ] ] ) ] elif isinstance ( node . ctx , ast . Param ) : deps = [ frozenset ( ) ] self . naming [ node . id ] = deps return deps else : raise PythranInternalError ( "Variable '{}' use before assignment" "" . format ( node . id ) )
Return dependencies for given variable .
43,748
def visit_List ( self , node ) : if node . elts : return list ( set ( sum ( [ self . visit ( elt ) for elt in node . elts ] , [ ] ) ) ) else : return [ frozenset ( ) ]
List construction depend on each elements type dependency .
43,749
def visit_ExceptHandler ( self , node ) : if node . name : self . naming [ node . name . id ] = [ frozenset ( ) ] for stmt in node . body : self . visit ( stmt )
Exception may declare a new variable .
43,750
def arc_distance ( theta_1 , phi_1 , theta_2 , phi_2 ) : temp = np . sin ( ( theta_2 - theta_1 ) / 2 ) ** 2 + np . cos ( theta_1 ) * np . cos ( theta_2 ) * np . sin ( ( phi_2 - phi_1 ) / 2 ) ** 2 distance_matrix = 2 * ( np . arctan2 ( np . sqrt ( temp ) , np . sqrt ( 1 - temp ) ) ) return distance_matrix
Calculates the pairwise arc distance between all points in vector a and b .
43,751
def visit_Module ( self , node ) : module_body = list ( ) symbols = set ( ) for stmt in node . body : if isinstance ( stmt , ( ast . Import , ast . ImportFrom ) ) : for alias in stmt . names : name = alias . asname or alias . name symbols . add ( name ) elif isinstance ( stmt , ast . FunctionDef ) : if stmt . name in symbols : raise PythranSyntaxError ( "Multiple top-level definition of %s." % stmt . name , stmt ) else : symbols . add ( stmt . name ) if not isinstance ( stmt , ast . Assign ) : continue for target in stmt . targets : if not isinstance ( target , ast . Name ) : raise PythranSyntaxError ( "Top-level assignment to an expression." , target ) if target . id in self . to_expand : raise PythranSyntaxError ( "Multiple top-level definition of %s." % target . id , target ) if isinstance ( stmt . value , ast . Name ) : if stmt . value . id in symbols : continue self . to_expand . add ( target . id ) for stmt in node . body : if isinstance ( stmt , ast . Assign ) : if all ( isinstance ( t , ast . Name ) and t . id not in self . to_expand for t in stmt . targets ) : module_body . append ( stmt ) continue self . local_decl = set ( ) cst_value = self . visit ( stmt . value ) for target in stmt . targets : assert isinstance ( target , ast . Name ) module_body . append ( ast . FunctionDef ( target . id , ast . arguments ( [ ] , None , [ ] , [ ] , None , [ ] ) , [ ast . Return ( value = cst_value ) ] , [ ] , None ) ) metadata . add ( module_body [ - 1 ] . body [ 0 ] , metadata . StaticReturn ( ) ) else : self . local_decl = self . gather ( LocalNameDeclarations , stmt ) module_body . append ( self . visit ( stmt ) ) self . update |= bool ( self . to_expand ) node . body = module_body return node
Turn globals assignment to functionDef and visit function defs .
43,752
def visit_Name ( self , node ) : if ( isinstance ( node . ctx , ast . Load ) and node . id not in self . local_decl and node . id in self . to_expand ) : self . update = True return ast . Call ( func = node , args = [ ] , keywords = [ ] ) return node
Turn global variable used not shadows to function call .
43,753
def visit_Module ( self , node ) : self . skip_functions = True self . generic_visit ( node ) self . skip_functions = False self . generic_visit ( node ) new_imports = self . to_import - self . globals imports = [ ast . Import ( names = [ ast . alias ( name = mod [ 17 : ] , asname = mod ) ] ) for mod in new_imports ] node . body = imports + node . body self . update |= bool ( imports ) return node
When we normalize call we need to add correct import for method to function transformation .
43,754
def renamer ( v , cur_module ) : mname = demangle ( v ) name = v + '_' if name in cur_module : return name , mname else : return v , mname
Rename function path to fit Pythonic naming .
43,755
def visit_Call ( self , node ) : node = self . generic_visit ( node ) if isinstance ( node . func , ast . Attribute ) : if node . func . attr in methods : obj = lhs = node . func . value while isinstance ( obj , ast . Attribute ) : obj = obj . value is_not_module = ( not isinstance ( obj , ast . Name ) or obj . id not in self . imports ) if is_not_module : self . update = True node . args . insert ( 0 , lhs ) mod = methods [ node . func . attr ] [ 0 ] self . to_import . add ( mangle ( mod [ 0 ] ) ) node . func = reduce ( lambda v , o : ast . Attribute ( v , o , ast . Load ( ) ) , mod [ 1 : ] + ( node . func . attr , ) , ast . Name ( mangle ( mod [ 0 ] ) , ast . Load ( ) , None ) ) if node . func . attr in methods or node . func . attr in functions : def rec ( path , cur_module ) : err = "Function path is chained attributes and name" assert isinstance ( path , ( ast . Name , ast . Attribute ) ) , err if isinstance ( path , ast . Attribute ) : new_node , cur_module = rec ( path . value , cur_module ) new_id , mname = self . renamer ( path . attr , cur_module ) return ( ast . Attribute ( new_node , new_id , ast . Load ( ) ) , cur_module [ mname ] ) else : new_id , mname = self . renamer ( path . id , cur_module ) if mname not in cur_module : raise PythranSyntaxError ( "Unbound identifier '{}'" . format ( mname ) , node ) return ( ast . Name ( new_id , ast . Load ( ) , None ) , cur_module [ mname ] ) node . func . value , _ = rec ( node . func . value , MODULES ) self . update = True return node
Transform call site to have normal function call .
43,756
def _extract_specs_dependencies ( specs ) : deps = set ( ) for signatures in specs . functions . values ( ) : for signature in signatures : for t in signature : deps . update ( pytype_to_deps ( t ) ) for signature in specs . capsules . values ( ) : for t in signature : deps . update ( pytype_to_deps ( t ) ) return sorted ( deps , key = lambda x : "include" not in x )
Extract types dependencies from specs for each exported signature .
43,757
def _parse_optimization ( optimization ) : splitted = optimization . split ( '.' ) if len ( splitted ) == 1 : splitted = [ 'pythran' , 'optimizations' ] + splitted return reduce ( getattr , splitted [ 1 : ] , __import__ ( splitted [ 0 ] ) )
Turns an optimization of the form my_optim my_package . my_optim into the associated symbol
43,758
def _write_temp ( content , suffix ) : with NamedTemporaryFile ( mode = 'w' , suffix = suffix , delete = False ) as out : out . write ( content ) return out . name
write content to a temporary XXX suffix file and return the filename . It is user s responsibility to delete when done .
43,759
def front_middle_end ( module_name , code , optimizations = None , module_dir = None ) : pm = PassManager ( module_name , module_dir ) ir , renamings , docstrings = frontend . parse ( pm , code ) if optimizations is None : optimizations = cfg . get ( 'pythran' , 'optimizations' ) . split ( ) optimizations = [ _parse_optimization ( opt ) for opt in optimizations ] refine ( pm , ir , optimizations ) return pm , ir , renamings , docstrings
Front - end and middle - end compilation steps
43,760
def generate_py ( module_name , code , optimizations = None , module_dir = None ) : pm , ir , _ , _ = front_middle_end ( module_name , code , optimizations , module_dir ) return pm . dump ( Python , ir )
python + pythran spec - > py code
43,761
def compile_cxxfile ( module_name , cxxfile , output_binary = None , ** kwargs ) : builddir = mkdtemp ( ) buildtmp = mkdtemp ( ) extension_args = make_extension ( python = True , ** kwargs ) extension = PythranExtension ( module_name , [ cxxfile ] , ** extension_args ) try : setup ( name = module_name , ext_modules = [ extension ] , cmdclass = { "build_ext" : PythranBuildExt } , script_name = 'setup.py' , script_args = [ '--verbose' if logger . isEnabledFor ( logging . INFO ) else '--quiet' , 'build_ext' , '--build-lib' , builddir , '--build-temp' , buildtmp ] ) except SystemExit as e : raise CompileError ( str ( e ) ) def copy ( src_file , dest_file ) : with open ( src_file , 'rb' ) as src : with open ( dest_file , 'wb' ) as dest : dest . write ( src . read ( ) ) ext = sysconfig . get_config_var ( 'SO' ) for f in glob . glob ( os . path . join ( builddir , module_name + "*" ) ) : if f . endswith ( ext ) : if not output_binary : output_binary = os . path . join ( os . getcwd ( ) , module_name + ext ) copy ( f , output_binary ) else : if not output_binary : output_directory = os . getcwd ( ) else : output_directory = os . path . dirname ( output_binary ) copy ( f , os . path . join ( output_directory , os . path . basename ( f ) ) ) shutil . rmtree ( builddir ) shutil . rmtree ( buildtmp ) logger . info ( "Generated module: " + module_name ) logger . info ( "Output: " + output_binary ) return output_binary
c ++ file - > native module Return the filename of the produced shared library Raises CompileError on failure
43,762
def compile_pythranfile ( file_path , output_file = None , module_name = None , cpponly = False , pyonly = False , ** kwargs ) : if not output_file : _ , basename = os . path . split ( file_path ) module_name = module_name or os . path . splitext ( basename ) [ 0 ] else : _ , basename = os . path . split ( output_file ) module_name = module_name or basename . split ( "." , 1 ) [ 0 ] module_dir = os . path . dirname ( file_path ) spec_file = os . path . splitext ( file_path ) [ 0 ] + '.pythran' if os . path . isfile ( spec_file ) : specs = load_specfile ( open ( spec_file ) . read ( ) ) kwargs . setdefault ( 'specs' , specs ) output_file = compile_pythrancode ( module_name , open ( file_path ) . read ( ) , output_file = output_file , cpponly = cpponly , pyonly = pyonly , module_dir = module_dir , ** kwargs ) return output_file
Pythran file - > c ++ file - > native module .
43,763
def nest_reducer ( x , g ) : def wrap_in_ifs ( node , ifs ) : return reduce ( lambda n , if_ : ast . If ( if_ , [ n ] , [ ] ) , ifs , node ) return ast . For ( g . target , g . iter , [ wrap_in_ifs ( x , g . ifs ) ] , [ ] )
Create a ast . For node from a comprehension and another node .
43,764
def inline ( self ) : tp_lines , tp_decl = self . get_decl_pair ( ) tp_lines = " " . join ( tp_lines ) if tp_decl is None : return tp_lines else : return "%s %s" % ( tp_lines , tp_decl )
Return the declarator as a single line .
43,765
def get_decl_pair ( self ) : def get_tp ( ) : decl = "struct " if self . tpname is not None : decl += self . tpname if self . inherit is not None : decl += " : " + self . inherit yield decl yield "{" for f in self . fields : for f_line in f . generate ( ) : yield " " + f_line yield "} " return get_tp ( ) , ""
See Declarator . get_decl_pair .
43,766
def make_control_flow_handlers ( self , cont_n , status_n , expected_return , has_cont , has_break ) : if expected_return : assign = cont_ass = [ ast . Assign ( [ ast . Tuple ( expected_return , ast . Store ( ) ) ] , ast . Name ( cont_n , ast . Load ( ) , None ) ) ] else : assign = cont_ass = [ ] if has_cont : cmpr = ast . Compare ( ast . Name ( status_n , ast . Load ( ) , None ) , [ ast . Eq ( ) ] , [ ast . Num ( LOOP_CONT ) ] ) cont_ass = [ ast . If ( cmpr , deepcopy ( assign ) + [ ast . Continue ( ) ] , cont_ass ) ] if has_break : cmpr = ast . Compare ( ast . Name ( status_n , ast . Load ( ) , None ) , [ ast . Eq ( ) ] , [ ast . Num ( LOOP_BREAK ) ] ) cont_ass = [ ast . If ( cmpr , deepcopy ( assign ) + [ ast . Break ( ) ] , cont_ass ) ] return cont_ass
Create the statements in charge of gathering control flow information for the static_if result and executes the expected control flow instruction
43,767
def visit ( self , node ) : if isinstance ( node , Placeholder ) : return self . placeholders [ node . id ] else : return super ( PlaceholderReplace , self ) . visit ( node )
Replace the placeholder if it is one or continue .
43,768
def visit ( self , node ) : for pattern , replace in know_pattern : check = Check ( node , dict ( ) ) if check . visit ( pattern ) : node = PlaceholderReplace ( check . placeholders ) . visit ( replace ( ) ) self . update = True return super ( PatternTransform , self ) . visit ( node )
Try to replace if node match the given pattern or keep going .
43,769
def visit_Name ( self , node ) : if isinstance ( node . ctx , ( ast . Store , ast . Param ) ) : self . result . add ( node . id )
Any node with Store or Param context is a new identifier .
43,770
def visit_FunctionDef ( self , node ) : self . result . add ( node . name ) self . generic_visit ( node )
Function name is a possible identifier .
43,771
def visit_If ( self , node ) : currs = ( node , ) raises = ( ) for n in node . body : self . result . add_node ( n ) for curr in currs : self . result . add_edge ( curr , n ) currs , nraises = self . visit ( n ) raises += nraises if is_true_predicate ( node . test ) : return currs , raises tcurrs = currs currs = ( node , ) for n in node . orelse : self . result . add_node ( n ) for curr in currs : self . result . add_edge ( curr , n ) currs , nraises = self . visit ( n ) raises += nraises return tcurrs + currs , raises
OUT = true branch U false branch RAISES = true branch U false branch
43,772
def visit_Try ( self , node ) : currs = ( node , ) raises = ( ) for handler in node . handlers : self . result . add_node ( handler ) for n in node . body : self . result . add_node ( n ) for curr in currs : self . result . add_edge ( curr , n ) currs , nraises = self . visit ( n ) for nraise in nraises : if isinstance ( nraise , ast . Raise ) : for handler in node . handlers : self . result . add_edge ( nraise , handler ) else : raises += ( nraise , ) for handler in node . handlers : ncurrs , nraises = self . visit ( handler ) currs += ncurrs raises += nraises return currs , raises
OUT = body s U handler s RAISES = handler s this equation is not has good has it could be ... but we need type information to be more accurate
43,773
def visit_ExceptHandler ( self , node ) : currs = ( node , ) raises = ( ) for n in node . body : self . result . add_node ( n ) for curr in currs : self . result . add_edge ( curr , n ) currs , nraises = self . visit ( n ) raises += nraises return currs , raises
OUT = body s RAISES = body s
43,774
def visit_Name ( self , node ) : if isinstance ( node . ctx , ast . Store ) : self . result [ node . id ] = True
Stored variable have new value .
43,775
def add ( self , variable , range_ ) : if variable not in self . result : self . result [ variable ] = range_ else : self . result [ variable ] = self . result [ variable ] . union ( range_ ) return self . result [ variable ]
Add a new low and high bound for a variable .
43,776
def visit_Assign ( self , node ) : assigned_range = self . visit ( node . value ) for target in node . targets : if isinstance ( target , ast . Name ) : self . add ( target . id , assigned_range ) else : self . visit ( target )
Set range value for assigned variable .
43,777
def visit_AugAssign ( self , node ) : self . generic_visit ( node ) if isinstance ( node . target , ast . Name ) : name = node . target . id res = combine ( node . op , self . result [ name ] , self . result [ node . value ] ) self . result [ name ] = self . result [ name ] . union ( res )
Update range value for augassigned variables .
43,778
def visit_For ( self , node ) : assert isinstance ( node . target , ast . Name ) , "For apply on variables." self . visit ( node . iter ) if isinstance ( node . iter , ast . Call ) : for alias in self . aliases [ node . iter . func ] : if isinstance ( alias , Intrinsic ) : self . add ( node . target . id , alias . return_range_content ( [ self . visit ( n ) for n in node . iter . args ] ) ) self . visit_loop ( node )
Handle iterate variable in for loops .
43,779
def visit_loop ( self , node , cond = None ) : for stmt in node . body : self . visit ( stmt ) old_range = self . result . copy ( ) for stmt in node . body : self . visit ( stmt ) for expr , range_ in old_range . items ( ) : self . result [ expr ] = self . result [ expr ] . widen ( range_ ) cond and self . visit ( cond ) for stmt in node . body : self . visit ( stmt ) for stmt in node . orelse : self . visit ( stmt )
Handle incremented variables in loop body .
43,780
def visit_BoolOp ( self , node ) : res = list ( zip ( * [ self . visit ( elt ) . bounds ( ) for elt in node . values ] ) ) return self . add ( node , Interval ( min ( res [ 0 ] ) , max ( res [ 1 ] ) ) )
Merge right and left operands ranges .
43,781
def visit_BinOp ( self , node ) : res = combine ( node . op , self . visit ( node . left ) , self . visit ( node . right ) ) return self . add ( node , res )
Combine operands ranges for given operator .
43,782
def visit_UnaryOp ( self , node ) : res = self . visit ( node . operand ) if isinstance ( node . op , ast . Not ) : res = Interval ( 0 , 1 ) elif ( isinstance ( node . op , ast . Invert ) and isinstance ( res . high , int ) and isinstance ( res . low , int ) ) : res = Interval ( ~ res . high , ~ res . low ) elif isinstance ( node . op , ast . UAdd ) : pass elif isinstance ( node . op , ast . USub ) : res = Interval ( - res . high , - res . low ) else : res = UNKNOWN_RANGE return self . add ( node , res )
Update range with given unary operation .
43,783
def visit_If ( self , node ) : self . visit ( node . test ) old_range = self . result self . result = old_range . copy ( ) for stmt in node . body : self . visit ( stmt ) body_range = self . result self . result = old_range . copy ( ) for stmt in node . orelse : self . visit ( stmt ) orelse_range = self . result self . result = body_range for k , v in orelse_range . items ( ) : if k in self . result : self . result [ k ] = self . result [ k ] . union ( v ) else : self . result [ k ] = v
Handle iterate variable across branches
43,784
def visit_IfExp ( self , node ) : self . visit ( node . test ) body_res = self . visit ( node . body ) orelse_res = self . visit ( node . orelse ) return self . add ( node , orelse_res . union ( body_res ) )
Use worst case for both possible values .
43,785
def visit_Compare ( self , node ) : if any ( isinstance ( op , ( ast . In , ast . NotIn , ast . Is , ast . IsNot ) ) for op in node . ops ) : self . generic_visit ( node ) return self . add ( node , Interval ( 0 , 1 ) ) curr = self . visit ( node . left ) res = [ ] for op , comparator in zip ( node . ops , node . comparators ) : comparator = self . visit ( comparator ) fake = ast . Compare ( ast . Name ( 'x' , ast . Load ( ) , None ) , [ op ] , [ ast . Name ( 'y' , ast . Load ( ) , None ) ] ) fake = ast . Expression ( fake ) ast . fix_missing_locations ( fake ) expr = compile ( ast . gast_to_ast ( fake ) , '<range_values>' , 'eval' ) res . append ( eval ( expr , { 'x' : curr , 'y' : comparator } ) ) if all ( res ) : return self . add ( node , Interval ( 1 , 1 ) ) elif any ( r . low == r . high == 0 for r in res ) : return self . add ( node , Interval ( 0 , 0 ) ) else : return self . add ( node , Interval ( 0 , 1 ) )
Boolean are possible index .
43,786
def visit_Call ( self , node ) : for alias in self . aliases [ node . func ] : if alias is MODULES [ '__builtin__' ] [ 'getattr' ] : attr_name = node . args [ - 1 ] . s attribute = attributes [ attr_name ] [ - 1 ] self . add ( node , attribute . return_range ( None ) ) elif isinstance ( alias , Intrinsic ) : alias_range = alias . return_range ( [ self . visit ( n ) for n in node . args ] ) self . add ( node , alias_range ) else : return self . generic_visit ( node ) return self . result [ node ]
Function calls are not handled for now .
43,787
def visit_Num ( self , node ) : if isinstance ( node . n , int ) : return self . add ( node , Interval ( node . n , node . n ) ) return UNKNOWN_RANGE
Handle literals integers values .
43,788
def visit_Name ( self , node ) : return self . add ( node , self . result [ node . id ] )
Get range for parameters for examples or false branching .
43,789
def generic_visit ( self , node ) : super ( RangeValues , self ) . generic_visit ( node ) return self . add ( node , UNKNOWN_RANGE )
Other nodes are not known and range value neither .
43,790
def compile_flags ( args ) : compiler_options = { 'define_macros' : args . defines , 'undef_macros' : args . undefs , 'include_dirs' : args . include_dirs , 'extra_compile_args' : args . extra_flags , 'library_dirs' : args . libraries_dir , 'extra_link_args' : args . extra_flags , } for param in ( 'opts' , ) : val = getattr ( args , param , None ) if val : compiler_options [ param ] = val return compiler_options
Build a dictionnary with an entry for cppflags ldflags and cxxflags .
43,791
def find_matching_builtin ( self , node ) : for path in EQUIVALENT_ITERATORS . keys ( ) : correct_alias = { path_to_node ( path ) } if self . aliases [ node . func ] == correct_alias : return path
Return matched keyword .
43,792
def visit_Module ( self , node ) : self . generic_visit ( node ) import_alias = ast . alias ( name = 'itertools' , asname = mangle ( 'itertools' ) ) if self . use_itertools : importIt = ast . Import ( names = [ import_alias ] ) node . body . insert ( 0 , importIt ) return node
Add itertools import for imap izip or ifilter iterator .
43,793
def visit_Call ( self , node ) : if node in self . potential_iterator : matched_path = self . find_matching_builtin ( node ) if matched_path is None : return self . generic_visit ( node ) if ( matched_path [ 1 ] == "map" and MODULES [ "__builtin__" ] [ "None" ] in self . aliases [ node . args [ 0 ] ] ) : return self . generic_visit ( node ) if matched_path [ 1 ] in ( 'array' , 'asarray' ) and len ( node . args ) != 1 : return self . generic_visit ( node ) path = EQUIVALENT_ITERATORS [ matched_path ] if path : node . func = path_to_attr ( path ) self . use_itertools |= path [ 0 ] == 'itertools' else : node = node . args [ 0 ] self . update = True return self . generic_visit ( node )
Replace function call by its correct iterator if it is possible .
43,794
def run ( xmin , ymin , xmax , ymax , step , range_ , range_x , range_y , t ) : X , Y = t . shape pt = np . zeros ( ( X , Y ) ) "omp parallel for" for i in range ( X ) : for j in range ( Y ) : for k in t : tmp = 6368. * np . arccos ( np . cos ( xmin + step * i ) * np . cos ( k [ 0 ] ) * np . cos ( ( ymin + step * j ) - k [ 1 ] ) + np . sin ( xmin + step * i ) * np . sin ( k [ 0 ] ) ) if tmp < range_ : pt [ i ] [ j ] += k [ 2 ] / ( 1 + tmp ) return pt
omp parallel for
43,795
def max_values ( args ) : return Interval ( max ( x . low for x in args ) , max ( x . high for x in args ) )
Return possible range for max function .
43,796
def min_values ( args ) : return Interval ( min ( x . low for x in args ) , min ( x . high for x in args ) )
Return possible range for min function .
43,797
def union ( self , other ) : return Interval ( min ( self . low , other . low ) , max ( self . high , other . high ) )
Intersect current range with other .
43,798
def widen ( self , other ) : if self . low < other . low : low = - float ( "inf" ) else : low = self . low if self . high > other . high : high = float ( "inf" ) else : high = self . high return Interval ( low , high )
Widen current range .
43,799
def handle_keywords ( self , func , node , offset = 0 ) : func_argument_names = { } for i , arg in enumerate ( func . args . args [ offset : ] ) : assert isinstance ( arg , ast . Name ) func_argument_names [ arg . id ] = i nargs = len ( func . args . args ) - offset defaults = func . args . defaults keywords = { func_argument_names [ kw . arg ] : kw . value for kw in node . keywords } node . args . extend ( [ None ] * ( 1 + max ( keywords . keys ( ) ) - len ( node . args ) ) ) replacements = { } for index , arg in enumerate ( node . args ) : if arg is None : if index in keywords : replacements [ index ] = deepcopy ( keywords [ index ] ) else : replacements [ index ] = deepcopy ( defaults [ index - nargs ] ) return replacements
Gather keywords to positional argument information