Repository navigation
Add typing to aiidalab.registry module - #511
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #511 +/- ##
==========================================
+ Coverage 72.47% 72.67% +0.20%
==========================================
Files 18 18
Lines 1653 1669 +16
==========================================
+ Hits 1198 1213 +15
- Misses 455 456 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
LGTM! Left a few comments/questions.
| safe_yaml = YAML(typ="safe") | ||
|
|
||
| def __call__(self, uri, **kwargs): | ||
| def __call__(self, uri: str, **kwargs: Any) -> Any: |
There was a problem hiding this comment.
Is it worth typing kwargs, or rather, is it standard practice?
There was a problem hiding this comment.
mypy would otherwise complained about untyped function definition (and more importantly, unless the function definition is fully typed, mypy doesn't check it at all by default 10000 )
| def __init__(self, calls_per_second: int = 1): | ||
| self.calls_per_second = calls_per_second | ||
| self.last_start = defaultdict(lambda: -1) # type: ignore | ||
| self.last_start = defaultdict(lambda: -1.0) # type: ignore |
There was a problem hiding this comment.
Is the type ignore still required then? I guess it's for something else?
There was a problem hiding this comment.
Mypy wanted an explicit type annotation, so I added one and removed the type ignore
There was a problem hiding this comment.
I'm confused. Looks like the type ignore is still there? And no type annotation?
This adds a minimum-effort typing to the
aiidalab.registrymodule, hopefully making future changes a bit safer.