@@ -25,6 +25,17 @@ def is_expression(tool, schema):
25
25
# type: (Union[CommentedMap, Any], avro.schema.Schema) -> bool
26
26
return isinstance (schema , avro .schema .EnumSchema ) and schema .name == "Expression" and isinstance (tool , (str , Text ))
27
27
28
+ class SuppressLog (logging .Filter ):
29
+ def __init__ (self , name ): # type: (Text) -> None
30
+ name = str (name )
31
+ super (SuppressLog , self ).__init__ (name )
32
+
33
+ def filter (self , record ):
34
+ return False
35
+
36
+ _logger_validation_warnings = logging .getLogger ("cwltool.validation_warnings" )
37
+ _logger_validation_warnings .addFilter (SuppressLog ("cwltool.validation_warnings" ))
38
+
28
39
def get_expressions (tool , schema , source_line = None ):
29
40
# type: (Union[CommentedMap, Any], avro.schema.Schema, SourceLine) -> List[Tuple[Text, SourceLine]]
30
41
if is_expression (tool , schema ):
@@ -35,7 +46,7 @@ def get_expressions(tool, schema, source_line=None):
35
46
for possible_schema in schema .schemas :
36
47
if is_expression (tool , possible_schema ):
37
48
return [(tool , source_line )]
38
- elif validate_ex (possible_schema , tool , raise_ex = False ):
49
+ elif validate_ex (possible_schema , tool , raise_ex = False , logger = _logger_validation_warnings ):
39
50
valid_schema = possible_schema
40
51
41
52
return get_expressions (tool , valid_schema , source_line )
0 commit comments