这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@schuylermartin45
Copy link
Contributor

Description

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

- Adds type hinting discussed in Issue conda#13380
- Also adds type hints for `InvalidVersionSpec` and related exceptions
@schuylermartin45 schuylermartin45 requested a review from a team as a code owner December 1, 2023 15:37
@conda-bot
Copy link
Contributor

We require contributors to sign our Contributor License Agreement and we don't have one on file for @schuylermartin45.

In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#857), and ping the bot to refresh the PR.

@schuylermartin45
Copy link
Contributor Author

I've signed the CLA. Not sure if I have the permissions to retry that check.

@travishathaway
Copy link
Contributor

@conda-bot check

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Dec 1, 2023
return True

def __eq__(self, other):
def __eq__(self, other: object) -> bool:
Copy link
Contributor

@travishathaway travishathaway Dec 1, 2023

Choose a reason for hiding this comment

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

Wouldn't Any be better choice here? I'm wondering why you went with object here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what was suggested from a StackOverflow post I saw a while back. I think it was this one: https://stackoverflow.com/questions/37557411/why-does-defining-the-argument-types-for-eq-throw-a-mypy-type-error

I think I've seen object used in a number of other posts as well, but upon further Googling, some people use Any. On my projects I have the "No explicit Any" rule enabled in mypy so using object also prevents triggering that rule.

Of course, I'm not using the NotImplemented suggestion either and just return False.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM as the input and not the return type: https://stackoverflow.com/questions/39817081/typing-any-vs-object

Copy link
Contributor

Choose a reason for hiding this comment

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

hm interesting, well I'm all for replacing Any with object throughout conda, one less import

@schuylermartin45
Copy link
Contributor Author

Current build failures seemed to be caused by an unrelated HTTP error

@jezdez jezdez merged commit e80a07a into conda:main Dec 5, 2023
@schuylermartin45 schuylermartin45 deleted the smartin_VersionOrder_type_hints branch December 5, 2023 13:15
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Dec 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants