Skip to content

Conversation

@Fokko
Copy link
Contributor

@Fokko Fokko commented May 9, 2022

Mypy complaints about the config file:

No [mypy] section in config file

Also enabled some additional checks on unreachable code

@github-actions github-actions bot added the python label May 9, 2022
raise NotImplementedError()

def apply(self, value: S) -> Optional[int]:
if value is None:
Copy link
Contributor Author

@Fokko Fokko May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have S, it can never be None, otherwise, the signature should be Optional[S]. If we want, we can still check if it None, "" or [] using:

if not value:

I've removed it for now, because according to the current definition it is unreachable code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, looking at the tests, we might expect a None there. I've changed the code the other way around.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, transforms can be applied to optional columns so this should be Optional[S].

@Fokko Fokko changed the title Remove mypy error Python: Remove mypy error May 9, 2022
@Fokko Fokko force-pushed the fd-fd-tox-error branch 2 times, most recently from c615ced to 1320903 Compare May 9, 2022 08:04
@Fokko Fokko mentioned this pull request May 9, 2022
Mypy complaints about:

No [mypy] section in config file

Also enabled some additional checks on unreachable code
@Fokko Fokko force-pushed the fd-fd-tox-error branch from 1320903 to 94b4347 Compare May 9, 2022 08:08
return "null"
return str(value)
def to_human_string(self, value: Optional[S]) -> str:
return str(value) if value is not None else "null"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change necessary for this PR? We generally try to avoid code churn that isn't making functional changes.

@rdblue rdblue merged commit d602f2f into apache:master May 10, 2022
@rdblue
Copy link
Contributor

rdblue commented May 10, 2022

Thanks, @Fokko!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants