Skip to content

Commit

Permalink
Remove default typing argument in PACKAGE file] [batch:82/416] [shard…
Browse files Browse the repository at this point in the history
…:4/N]

Reviewed By: MaggieMoss

Differential Revision: D64864989

fbshipit-source-id: 32b31635419c4facf9211bae85bf1dc5cfc685f8
  • Loading branch information
generatedunixname89002005307016 authored and facebook-github-bot committed Oct 26, 2024
1 parent 52e1242 commit d5e10f9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions folly/coro/scripts/co_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ def backtrace_command(
print_async_stack_addrs(addrs)
except Exception:
print("Error collecting async stack trace:")
# pyre-fixme[6]: For 1st argument expected `BaseException` but got
# `Union[None, Type[BaseException], BaseException, TracebackType]`.
traceback.print_exception(*sys.exc_info())


Expand Down Expand Up @@ -532,13 +534,15 @@ class DebuggerType(enum.Enum):
debugger_type: DebuggerType | None = None
if debugger_type is None: # noqa: C901
try:
# pyre-fixme[21]: Could not find module `gdb`.
import gdb

class GdbValue(DebuggerValue):
"""
GDB implementation of a debugger value
"""

# pyre-fixme[11]: Annotation `Value` is not defined as a type.
value: gdb.Value

def __init__(self, value: gdb.Value) -> None:
Expand Down Expand Up @@ -619,6 +623,7 @@ def get_func_name(self) -> str | None:
def __eq__(self, other) -> bool:
return self.int_value() == other.int_value()

# pyre-fixme[11]: Annotation `Command` is not defined as a type.
class GdbCoroBacktraceCommand(gdb.Command):
def __init__(self):
print(co_bt_info())
Expand All @@ -641,15 +646,18 @@ def invoke(self, arg: str, from_tty: bool):

if debugger_type is None: # noqa: C901
try:
# pyre-fixme[21]: Could not find module `lldb`.
import lldb

class LldbValue(DebuggerValue):
"""
LLDB implementation of a debugger value
"""

# pyre-fixme[11]: Annotation `SBExecutionContext` is not defined as a type.
exe_ctx: ClassVar[lldb.SBExecutionContext | None] = None
next_name_num: ClassVar[int] = 0
# pyre-fixme[11]: Annotation `SBValue` is not defined as a type.
value: lldb.SBValue

def __init__(self, value: lldb.SBValue) -> None:
Expand Down Expand Up @@ -742,6 +750,7 @@ def to_hex(self) -> str:

# Type must be in quotes because it breaks parsing
# with conditional imports
# pyre-fixme[11]: Annotation `SBSymbolContext` is not defined as a type.
def _get_symbol_context(self) -> "lldb.SBSymbolContext":
address = lldb.SBAddress(
self.int_value(), LldbValue.exe_ctx.GetTarget()
Expand Down
1 change: 1 addition & 0 deletions folly/coro/scripts/test/co_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def parse_and_eval(self, b):

class CoBt(unittest.TestCase):
def setUp(self) -> None:
# pyre-fixme[6]: For 2nd argument expected `ModuleType` but got `Lldb`.
sys.modules["lldb"] = Lldb()

def test_null_eq(self) -> None:
Expand Down
1 change: 1 addition & 0 deletions folly/python/test/coro.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import asyncio
import unittest

# pyre-fixme[21]: Could not find name `simplebridgecoro` in `folly.python.test`.
from . import simplebridgecoro


Expand Down
1 change: 1 addition & 0 deletions folly/python/test/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import unittest
from sys import platform

# pyre-fixme[21]: Could not find name `simplebridge` in `folly.python.test`.
from . import simplebridge


Expand Down
4 changes: 4 additions & 0 deletions folly/python/test/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import asyncio
import unittest

# pyre-fixme[21]: Could not find module `folly.python.test.simplegenerator`.
from .simplegenerator import SimpleGenerator


Expand All @@ -24,6 +25,7 @@ def test_iter_generator(self) -> None:
loop = asyncio.get_event_loop()

async def wrapper() -> None:
# pyre-fixme[16]: Module `test` has no attribute `simplegenerator`.
gen = SimpleGenerator("normal")
expected = 1
async for v in gen:
Expand All @@ -37,6 +39,7 @@ def test_iter_generator_empty(self) -> None:
loop = asyncio.get_event_loop()

async def wrapper() -> None:
# pyre-fixme[16]: Module `test` has no attribute `simplegenerator`.
gen = SimpleGenerator("empty")
async for _ in gen: # noqa: F841
self.assertFalse(True, "this should never run")
Expand All @@ -51,6 +54,7 @@ def test_iter_generator_error(self) -> None:
loop = asyncio.get_event_loop()

async def wrapper() -> None:
# pyre-fixme[16]: Module `test` has no attribute `simplegenerator`.
gen = SimpleGenerator("error")
async for v in gen:
self.assertEqual(v, 42)
Expand Down
4 changes: 4 additions & 0 deletions folly/python/test/teardown.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import unittest
from sys import platform

# pyre-fixme[21]: Could not find name `simplebridge` in `folly.python.test`.
# pyre-fixme[21]: Could not find name `simplebridgecoro` in `folly.python.test`.
from . import simplebridge, simplebridgecoro


Expand Down Expand Up @@ -47,9 +49,11 @@ def test_drive_on_teardown(self):

async def test() -> None:
# Sanity check
# pyre-fixme[16]: Module `test` has no attribute `simplebridgecoro`.
self.assertEqual(123, await simplebridgecoro.sleep_then_echo(1, 123))

# Schedule a sleep for 1s and the immediately exit
# pyre-fixme[16]: Module `test` has no attribute `simplebridgecoro`.
asyncio.ensure_future(simplebridgecoro.sleep_then_echo(10, 0))

loop = asyncio.new_event_loop()
Expand Down
1 change: 1 addition & 0 deletions folly/python/test/test_set_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import unittest

# pyre-fixme[21]: Could not find name `test_set_executor_cython` in `folly.python.test`.
from . import test_set_executor_cython


Expand Down

0 comments on commit d5e10f9

Please sign in to comment.