Skip to content

Commit

Permalink
apply Black 2024 style in fbcode (8/16)
Browse files Browse the repository at this point in the history
Summary:
Formats the covered files with pyfmt.

paintitblack

Reviewed By: aleivag

Differential Revision: D54447737

fbshipit-source-id: 6c05d7941c6b4f1787b8da6cf810693f48a96c4e
  • Loading branch information
amyreese authored and facebook-github-bot committed Mar 3, 2024
1 parent 999a54e commit 080d2a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions folly/experimental/coro/scripts/co_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def print_async_stack_addrs(addrs: List[DebuggerValue]) -> None:
print("No async operation detected")
return
num_digits = len(str(len(addrs)))
for (i, addr) in enumerate(addrs):
for i, addr in enumerate(addrs):
func_name = addr.get_func_name()
if func_name is None:
func_name = "???"
Expand Down Expand Up @@ -442,7 +442,7 @@ def print_async_stack_root_addrs(addrs: List[DebuggerValue]) -> None:
print("No async stack roots detected")
return
num_digits = len(str(len(addrs)))
for (i, addr) in enumerate(addrs):
for i, addr in enumerate(addrs):
async_stack_root = AsyncStackRoot.from_addr(addr)
if not async_stack_root.stack_frame_ptr.is_nullptr():
stack_frame = StackFrame.from_addr(async_stack_root.stack_frame_ptr)
Expand Down Expand Up @@ -594,7 +594,9 @@ def to_hex(self) -> str:

def get_file_name_and_line(self) -> Optional[Tuple[str, int]]:
regex = re.compile(r"Line (\d+) of (.*) starts at.*")
output = GdbValue.execute(f"info line *{self.to_hex()}",).split(
output = GdbValue.execute(
f"info line *{self.to_hex()}",
).split(
"\n"
)[0]
groups = regex.match(output)
Expand All @@ -606,7 +608,9 @@ def get_file_name_and_line(self) -> Optional[Tuple[str, int]]:

def get_func_name(self) -> Optional[str]:
regex = re.compile(r"(.*) \+ \d+ in section.* of .*")
output = GdbValue.execute(f"info symbol {self.to_hex()}",).split(
output = GdbValue.execute(
f"info symbol {self.to_hex()}",
).split(
"\n"
)[0]
groups = regex.match(output)
Expand Down
1 change: 1 addition & 0 deletions folly/experimental/coro/scripts/test/co_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
import unittest


# mock lldb module
class Lldb:
class Command:
Expand Down
2 changes: 1 addition & 1 deletion folly/experimental/gdb/deadlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def get_mutex_owner_and_address_func_for_type(mutex_type):

def print_cycle(graph, lwp_to_thread_id, cycle):
"""Prints the threads and mutexes involved in the deadlock."""
for (m, n) in cycle:
for m, n in cycle:
print(
"Thread %d (LWP %d) is waiting on %s (0x%016x) held by "
"Thread %d (LWP %d)"
Expand Down
4 changes: 2 additions & 2 deletions folly/fibers/scripts/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def get_fiber_info(only=None, managers=False):

# first check if pre-cached
if mid in get_fiber_info.cache:
for (fid, info) in get_fiber_info.cache[mid].items():
for fid, info in get_fiber_info.cache[mid].items():
fiber_id = "{}.{}".format(mid, fid)
if not only or str(mid) in only or fiber_id in only:
yield ((mid, fid), info)
Expand Down Expand Up @@ -773,7 +773,7 @@ def get_fiber_managers(only=None):
"""
# first check if pre-cached
if get_fiber_managers.cache:
for (mid, manager) in get_fiber_managers.cache.items():
for mid, manager in get_fiber_managers.cache.items():
# output only if matching filter
if not only or str(mid) in only:
yield (mid, manager)
Expand Down

0 comments on commit 080d2a3

Please sign in to comment.