Skip to content

Conversation

@fjosw
Copy link
Owner

@fjosw fjosw commented Dec 25, 2024

As a first step towards adding type hints, I added automatic type hints with monkeytype. Hints for the more complicated methods will need additional manual work but for the simpler methods this seems to have worked quite well.

@fjosw fjosw marked this pull request as ready for review January 3, 2025 18:12
@fjosw
Copy link
Owner Author

fjosw commented Jan 3, 2025

Not quite done but already in decent shape for a review @s-kuberski @jkuhl-uni:

  • Most of the changes are just type annotations
  • I changed a few lines to help mypy with understanding the type annotations
  • I fixed a few smaller bugs in which explicit type checks were not consistent or did not cover certain edge cases

For now I ignored the input/* modules and most of correlators.py, the remaining modules only raise a few smaller mypy errors which I wasn't able to fix right away.

@s-kuberski
Copy link
Collaborator

Great, thanks a lot for all of your work! I'll have a look in the upcoming week.

__slots__ = ["content", "N", "T", "tag", "prange"]

def __init__(self, data_input, padding=[0, 0], prange=None):
def __init__(self, data_input: Any, padding: list[int]=[0, 0], prange: Optional[list[int]]=None):
Copy link
Collaborator

@jkuhl-uni jkuhl-uni Jan 9, 2025

Choose a reason for hiding this comment

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

Shouldn't this be list[Obs]? Alternatively, in the list, there could be something Obs-like, I suppose, such as list[CObs]?

@jkuhl-uni
Copy link
Collaborator

Hey @fjosw,
thanks for all the work, I am looking through it right now, it looks excellent to me. I hope it was okay that I pushed a few small changes. If not, feel free to revert them, as you please :)

@fjosw
Copy link
Owner Author

fjosw commented May 5, 2025

I resolved the merge conflicts and fixed a few smaller issues but now one of the tests test_rwms is failing. Can you have a look @jkuhl-uni ?

@jkuhl-uni
Copy link
Collaborator

I had a look and found a solution for now, there are a few minor things to figure out. I hope to get it done today :)

@jkuhl-uni
Copy link
Collaborator

... well that was easy.
I'd like to disentangle some of the openQCD tests (in test_rwms we are testing the read_rwms, extract_t0 and extract_w0 methods), but I'll do that in a different PR.

@fjosw
Copy link
Owner Author

fjosw commented May 7, 2025

Thanks a lot @jkuhl-uni ! As we have accumulated quite a few changes I would suggest that we all do a thorough review and then merge this first version with type hints which we can refine later @s-kuberski @jkuhl-uni .

@fjosw fjosw requested review from jkuhl-uni and s-kuberski May 7, 2025 15:28
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.

4 participants