Skip to content

Commit

Permalink
use in dict
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor committed Oct 24, 2024
1 parent 61c918d commit 22552f3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions flytekit/core/type_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,9 +1566,7 @@ async def async_to_literal(
asyncio.create_task(TypeEngine.async_to_literal(ctx, x, t, expected.collection_type))
for x in python_val
]
print("About to run!")
with timeit("run coros"):
lit_list = await _run_coros_in_chunks(lit_list)
lit_list = await _run_coros_in_chunks(lit_list)

Check warning on line 1569 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L1569

Added line #L1569 was not covered by tests

return Literal(collection=LiteralCollection(literals=lit_list))

Expand Down Expand Up @@ -1599,7 +1597,7 @@ async def async_to_python_value( # type: ignore
else:
st = self.get_sub_type(expected_python_type)
result = [TypeEngine.async_to_python_value(ctx, x, st) for x in lits]
result = await asyncio.gather(*result)
result = await _run_coros_in_chunks(result)

Check warning on line 1600 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L1600

Added line #L1600 was not covered by tests
return result # type: ignore # should be a list, thinks its a tuple

def guess_python_type(self, literal_type: LiteralType) -> list: # type: ignore
Expand Down Expand Up @@ -2005,7 +2003,7 @@ async def async_to_literal(
TypeEngine.async_to_literal(ctx, v, cast(type, v_type), expected.map_value_type)
)

await asyncio.gather(*lit_map.values())
await _run_coros_in_chunks([c for c in lit_map.values()])

Check warning on line 2006 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L2006

Added line #L2006 was not covered by tests
for k, v in lit_map.items():
lit_map[k] = v.result()

Expand All @@ -2031,7 +2029,7 @@ async def async_to_python_value(self, ctx: FlyteContext, lv: Literal, expected_p
fut = asyncio.create_task(TypeEngine.async_to_python_value(ctx, v, cast(Type, tp[1])))
py_map[k] = fut

await asyncio.gather(*py_map.values())
await _run_coros_in_chunks([c for c in py_map.values()])

Check warning on line 2032 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L2032

Added line #L2032 was not covered by tests
for k, v in py_map.items():
py_map[k] = v.result()

Expand Down

0 comments on commit 22552f3

Please sign in to comment.