amazon-braket / amazon-braket-build-tools

Apache License 2.0
5 stars 3 forks source link

bug: error when parameter with type hint `Any` has a default value of `None` #21

Closed rmshaffer closed 2 months ago

rmshaffer commented 5 months ago

Describe the bug A parameter with type hint of Any and a default value of None results in linter error BCS023. (This is related to the new functionality from #17.) However, None is a valid value for a type hint of Any and therefore this should be allowed.

To reproduce Define a function parameter with a type hint of Any and a default value of None, e.g. previous_value here:

def assign_stmt(target_name: str, value: Any, previous_value: Any = None) -> Any:

results in this error:

BCS023 - Argument 'previous_value' defaults to None but type hint doesn't end with '| None'.

Expected behavior No error.

Screenshots or logs If applicable, add screenshots or logs to help explain your problem.

System information A description of your system. Please provide:

Additional context Add any other context about the problem here.