I managed to make it work by changing Hamilton's c...
# hamilton-help
e
I managed to make it work by changing Hamilton's code. If there is no alternative, may I submit a pull request?
e
Hey! So parallelizable is actually just a iterable, not a list. The annotation type is here. I What’s hte specific error you’re seeing? You can just do a union, but my guess is it should work for what you’re trying to do… And curious — what’s the change you made?
e
Hi! Yes, it is, but I would like to specify in the annotation that this iterable will always be a list[some_type]. If not, when I do
Copy code
def hello() -> Parallizable[str]:
  return ["h", "a", "b"]

a = hello()
b = a[0]
The linter can't identify that "a" has the methods of a list, nor that "b" is a str
I created
Copy code
def is_parallelizable(type:Type) -> bool:
    print(type, type.__bases__, Parallelizable in type.__bases__)
    return type == Parallelizable or Parallelizable in type.__bases__
e
So yeah, I’d recommending just turning the iterabke into a list — the linter should be able to figure it out? E.g. list(hello())
e
And in "htypes.custom_subclass_check" and in "node.from_fn" I changed for checking is_parallelizable(type_to_check) instead of type_to_check == Parallelizable
Yes, I could just turn it a list. But it would be more direct and usable if I could direct annotate it as a list.
e
Hmm — can’t visualize the changes easily do you have a diff file? Or open up a PR?
e
I will open the request
e
Thanks! No guarentees — need to grok it better and this will help :)
e
e
Thanks! Will take a look today
Ok, think I grok it, will figure out a good way to proceed/comment tomorrow. Thanks for the use-case!