3434 OpenMLRegressionTask ,
3535)
3636
37+ logger = logging .getLogger (__name__ )
38+
3739
3840if sys .version_info >= (3 , 5 ):
3941 from json .decoder import JSONDecodeError
@@ -271,9 +273,8 @@ def _deserialize_sklearn(
271273 mixed
272274 """
273275
274- logging .info ('-%s flow_to_sklearn START o=%s, components=%s, '
275- 'init_defaults=%s' % ('-' * recursion_depth , o , components ,
276- initialize_with_defaults ))
276+ logger .info ('-%s flow_to_sklearn START o=%s, components=%s, init_defaults=%s'
277+ % ('-' * recursion_depth , o , components , initialize_with_defaults ))
277278 depth_pp = recursion_depth + 1 # shortcut var, depth plus plus
278279
279280 # First, we need to check whether the presented object is a json string.
@@ -376,8 +377,7 @@ def _deserialize_sklearn(
376377 )
377378 else :
378379 raise TypeError (o )
379- logging .info ('-%s flow_to_sklearn END o=%s, rval=%s'
380- % ('-' * recursion_depth , o , rval ))
380+ logger .info ('-%s flow_to_sklearn END o=%s, rval=%s' % ('-' * recursion_depth , o , rval ))
381381 return rval
382382
383383 def model_to_flow (self , model : Any ) -> 'OpenMLFlow' :
@@ -537,16 +537,16 @@ def match_format(s):
537537 s = "{}..." .format (s [:char_lim - 3 ])
538538 return s .strip ()
539539 except ValueError :
540- logging .warning ("'Read more' not found in descriptions. "
541- "Trying to trim till 'Parameters' if available in docstring." )
540+ logger .warning ("'Read more' not found in descriptions. "
541+ "Trying to trim till 'Parameters' if available in docstring." )
542542 pass
543543 try :
544544 # if 'Read more' doesn't exist, trim till 'Parameters'
545545 pattern = "Parameters"
546546 index = s .index (match_format (pattern ))
547547 except ValueError :
548548 # returning full docstring
549- logging .warning ("'Parameters' not found in docstring. Omitting docstring trimming." )
549+ logger .warning ("'Parameters' not found in docstring. Omitting docstring trimming." )
550550 index = len (s )
551551 s = s [:index ]
552552 # trimming docstring to be within char_lim
@@ -580,7 +580,7 @@ def match_format(s):
580580 index1 = s .index (match_format ("Parameters" ))
581581 except ValueError as e :
582582 # when sklearn docstring has no 'Parameters' section
583- logging .warning ("{} {}" .format (match_format ("Parameters" ), e ))
583+ logger .warning ("{} {}" .format (match_format ("Parameters" ), e ))
584584 return None
585585
586586 headings = ["Attributes" , "Notes" , "See also" , "Note" , "References" ]
@@ -590,7 +590,7 @@ def match_format(s):
590590 index2 = s .index (match_format (h ))
591591 break
592592 except ValueError :
593- logging .warning ("{} not available in docstring" .format (h ))
593+ logger .warning ("{} not available in docstring" .format (h ))
594594 continue
595595 else :
596596 # in the case only 'Parameters' exist, trim till end of docstring
@@ -975,7 +975,7 @@ def _deserialize_model(
975975 recursion_depth : int ,
976976 strict_version : bool = True
977977 ) -> Any :
978- logging .info ('-%s deserialize %s' % ('-' * recursion_depth , flow .name ))
978+ logger .info ('-%s deserialize %s' % ('-' * recursion_depth , flow .name ))
979979 model_name = flow .class_name
980980 self ._check_dependencies (flow .dependencies ,
981981 strict_version = strict_version )
@@ -993,8 +993,7 @@ def _deserialize_model(
993993
994994 for name in parameters :
995995 value = parameters .get (name )
996- logging .info ('--%s flow_parameter=%s, value=%s' %
997- ('-' * recursion_depth , name , value ))
996+ logger .info ('--%s flow_parameter=%s, value=%s' % ('-' * recursion_depth , name , value ))
998997 rval = self ._deserialize_sklearn (
999998 value ,
1000999 components = components_ ,
@@ -1010,8 +1009,7 @@ def _deserialize_model(
10101009 if name not in components_ :
10111010 continue
10121011 value = components [name ]
1013- logging .info ('--%s flow_component=%s, value=%s'
1014- % ('-' * recursion_depth , name , value ))
1012+ logger .info ('--%s flow_component=%s, value=%s' % ('-' * recursion_depth , name , value ))
10151013 rval = self ._deserialize_sklearn (
10161014 value ,
10171015 recursion_depth = recursion_depth + 1 ,
0 commit comments