Skip to content

Commit

Permalink
replacing some logging.warning's with logging.info
Browse files Browse the repository at this point in the history
  • Loading branch information
Masara committed Aug 27, 2024
1 parent f9940ba commit baac3d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/safeds_stubgen/api_analyzer/_ast_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def enter_funcdef(self, node: mp_nodes.FuncDef) -> None:
and self.type_source_warning == TypeSourceWarning.WARN
):
msg = f"Different type hint and docstring types for '{function_id}'."
logging.warning(msg)
logging.info(msg)

if doc_type is not None and (
code_type is None or self.type_source_preference == TypeSourcePreference.DOCSTRING
Expand Down Expand Up @@ -330,7 +330,7 @@ def enter_funcdef(self, node: mp_nodes.FuncDef) -> None:
and self.type_source_warning == TypeSourceWarning.WARN
):
msg = f"Different type hint and docstring types for the result of '{function_id}'."
logging.warning(msg)
logging.info(msg)

if result_doc_type is not None:
if result_type is None:
Expand Down Expand Up @@ -952,7 +952,7 @@ def _create_attribute(
if unanalyzed_type is not None and hasattr(unanalyzed_type, "args"):
attribute_type.args = unanalyzed_type.args
else: # pragma: no cover
logging.warning("Could not get argument information for attribute.")
logging.info("Could not get argument information for attribute.")
attribute_type = None
type_ = sds_types.UnknownType()
elif not unanalyzed_type: # pragma: no cover
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def _parse_parameter_data(self, node: mp_nodes.FuncDef, function_id: str) -> lis
# Get type information for parameter
if mypy_type is None:
msg = f"Could not parse the type for parameter {argument.variable.name} of function {node.fullname}."
logging.warning(msg)
logging.info(msg)
arg_type = sds_types.UnknownType()
elif isinstance(mypy_type, mp_types.AnyType) and not has_correct_type_of_any(mypy_type.type_of_any):
# We try to infer the type through the default value later, if possible
Expand Down Expand Up @@ -1081,7 +1081,7 @@ def _get_parameter_type_and_default_value(
f"Could not parse parameter type for function {function_id}: Safe-DS does not support call "
f"expressions as types."
)
logging.warning(msg)
logging.info(msg)
# Safe-DS does not support call expressions as types
return default_value, default_is_none
elif isinstance(initializer, mp_nodes.UnaryExpr):
Expand All @@ -1097,7 +1097,7 @@ def _get_parameter_type_and_default_value(
f"Received the parameter {value} with an unexpected operator {initializer.op} for function "
f"{function_id}. This parameter could not be parsed."
)
logging.warning(msg)
logging.info(msg)
return UnknownValue(), default_is_none
elif isinstance(
initializer,
Expand Down Expand Up @@ -1158,7 +1158,7 @@ def mypy_type_to_abstract_type(

return sds_types.FinalType(type_=sds_types.LiteralType(literals=all_literals))

logging.warning("Final type has no type arguments.") # pragma: no cover
logging.info("Final type has no type arguments.") # pragma: no cover
return sds_types.FinalType(type_=sds_types.UnknownType()) # pragma: no cover
return sds_types.FinalType(type_=sds_types.UnionType(types=types))
elif unanalyzed_type_name in {"list", "set"}:
Expand Down Expand Up @@ -1221,7 +1221,7 @@ def mypy_type_to_abstract_type(
# If the Any type is generated b/c of from_unimported_type, then we can parse the type
# from the import information
if mypy_type.missing_import_name is None: # pragma: no cover
logging.warning("Could not parse a type, added unknown type instead.")
logging.info("Could not parse a type, added unknown type instead.")
return sds_types.UnknownType()

missing_import_name = mypy_type.missing_import_name.split(".")[-1] # type: ignore[union-attr]
Expand All @@ -1237,7 +1237,7 @@ def mypy_type_to_abstract_type(
qname = unanalyzed_type.name.replace(missing_import_name, qname)

if not qname: # pragma: no cover
logging.warning("Could not parse a type, added unknown type instead.")
logging.info("Could not parse a type, added unknown type instead.")
return sds_types.UnknownType()

return sds_types.NamedType(name=name, qname=qname)
Expand Down Expand Up @@ -1274,7 +1274,7 @@ def mypy_type_to_abstract_type(
name, qname = self._find_alias(mypy_type.name)

if not qname: # pragma: no cover
logging.warning("Could not parse a type, added unknown type instead.")
logging.info("Could not parse a type, added unknown type instead.")
return sds_types.UnknownType()

return sds_types.NamedType(name=name, qname=qname)
Expand Down Expand Up @@ -1311,7 +1311,7 @@ def mypy_type_to_abstract_type(
return sds_types.NamedSequenceType(name=type_name, qname=mypy_type.type.fullname, types=types)
return sds_types.NamedType(name=type_name, qname=mypy_type.type.fullname)

logging.warning("Could not parse a type, added unknown type instead.") # pragma: no cover
logging.info("Could not parse a type, added unknown type instead.") # pragma: no cover
return sds_types.UnknownType() # pragma: no cover

def _find_alias(self, type_name: str) -> tuple[str, str]:
Expand Down
2 changes: 1 addition & 1 deletion src/safeds_stubgen/api_analyzer/_get_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _get_aliases(result_types: dict, package_name: str) -> dict[str, set[str]]:
fullname = key.node.fullname
else: # pragma: no cover
msg = f"Received unexpected type while searching for aliases. Skipping for '{name}'."
logging.warning(msg)
logging.info(msg)
continue

aliases[name].add(fullname)
Expand Down
2 changes: 1 addition & 1 deletion src/safeds_stubgen/api_analyzer/_mypy_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def mypy_expression_to_sds_type(expr: mp_nodes.Expression) -> sds_types.Abstract
):
return sds_types.NamedType(name="bool", qname="builtins.bool")

logging.warning(
logging.info(
"Could not parse a parameter or return type for a function: Safe-DS does not support "
"types such as call expressions. Added 'unknown' instead.",
)
Expand Down

0 comments on commit baac3d9

Please sign in to comment.