Skip to content

Add some more type signatures #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

pjonsson
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.82%. Comparing base (43a39d0) to head (52af1ba).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #227   +/-   ##
========================================
  Coverage    94.82%   94.82%           
========================================
  Files           32       32           
  Lines         5678     5679    +1     
========================================
+ Hits          5384     5385    +1     
  Misses         294      294           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -33,14 +33,14 @@ def patch_version_lines(lines, build_number):
yield line


def patch_file(fname, build_number):
Copy link
Member

Choose a reason for hiding this comment

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

this is some CI only script, not sure we need types 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.

I don't think it costs much to have the types that are easy though, and having them enables at least some checking from MyPy.

Copy link
Member

Choose a reason for hiding this comment

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

what's the point of return only type annotation on a file only used on CI? You are changing script that has NO types at all, to a script with VERY PARTIAL types, to me this is worse than the prior state. Please revert this part.

odc/geo/roi.py Outdated
@@ -77,7 +77,7 @@ def chunks(self) -> Chunks2d: ...

def locate(self, pix: SomeIndex2d) -> Tuple[int, int]: ...

def __dask_tokenize__(self): ...
def __dask_tokenize__(self) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

pretty sure this function is supposed to return something

Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/dask/dask/blob/3a810721c0d6bba760cbf472f9ae907e809de92c/dask/typing.py#L215-L218

    @abc.abstractmethod
    def __dask_tokenize__(self) -> Hashable:
        """Value that must fully represent the object."""
        raise NotImplementedError("Inheriting class must implement this method.")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the return type, but I would have expected an @override on the method so I think there's something more that should be fixed in this area. That is a separate issue though, I have no idea how these things are supposed to be stringed together.

Copy link
Member

Choose a reason for hiding this comment

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

Does @override even makes sense on a Protocol type? It's really just formalizing duck-typing expected by your code.

Copy link
Member

@Kirill888 Kirill888 left a comment

Choose a reason for hiding this comment

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

see comments for what needs fixing

@pjonsson pjonsson force-pushed the more-types branch 2 times, most recently from d36b9c7 to 0486430 Compare April 27, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants