-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed By: jvillard Differential Revision: D67049773 fbshipit-source-id: 5f3b0f9247da9e69453f561cb54880e6495eafb8
- Loading branch information
1 parent
ad1cc2f
commit d34971a
Showing
5 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import asyncio | ||
|
||
|
||
class Car: | ||
def __init__(self, make, model): | ||
self.make = make | ||
self.model = model | ||
|
||
def drive(self): | ||
return 0 | ||
|
||
async def refuel(self): | ||
await asyncio.sleep(2) | ||
|
||
|
||
async def car_instance_ok(): | ||
my_car = Car("Fusca", "1999") | ||
my_car.drive() | ||
await my_car.refuel() | ||
|
||
|
||
async def fn_car_instance_bad(): | ||
my_car = Car("Fusca", "1999") | ||
my_car.drive() | ||
return my_car.refuel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import asyncio | ||
|
||
|
||
async def foo(): | ||
await asyncio.sleep(1) | ||
|
||
|
||
async def lambda_bad(): | ||
x = lambda: foo() | ||
x() | ||
|
||
|
||
async def lambda_good(): | ||
x = lambda: foo() | ||
await x() | ||
|
||
|
||
async def lambda_param_bad(f): | ||
f() | ||
|
||
|
||
async def lambda_param_bad_call_bad(): | ||
lambda_param_bad(lambda: foo()) | ||
|
||
|
||
lambda_param_bad(lambda: foo()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import asyncio | ||
|
||
|
||
async def fp_await_condition_typing_ok(): | ||
if type(5) == int: | ||
await asyncio.sleep(1) | ||
else: | ||
asyncio.sleep(1) | ||
|
||
|
||
async def await_condition_typing_bad(): | ||
if type(5) == str: | ||
await asyncio.sleep(1) | ||
else: | ||
asyncio.sleep(1) | ||
|
||
|
||
async def await_condition_typing_with_arg_bad(x): | ||
if type(x) == str: | ||
await asyncio.sleep(1) | ||
else: | ||
asyncio.sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters