summaryrefslogtreecommitdiff
path: root/buildscripts/gdb
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2018-04-11 16:20:54 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2018-04-11 16:29:32 -0400
commit68005e0ffcc50c9260a162b717aaa5c2225096da (patch)
tree9c490d8588efcf41702d0a61a5f418e4d1cb4418 /buildscripts/gdb
parentd91bc3cde8d453919fe00a6bd89357d41e79bb19 (diff)
downloadmongo-68005e0ffcc50c9260a162b717aaa5c2225096da.tar.gz
SERVER-23312 Enable Python formatting/linting for buildscripts & pytests files
Diffstat (limited to 'buildscripts/gdb')
-rw-r--r--buildscripts/gdb/mongo.py6
-rw-r--r--buildscripts/gdb/mongo_lock.py10
2 files changed, 8 insertions, 8 deletions
diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py
index ea3a6baf129..cfc28867639 100644
--- a/buildscripts/gdb/mongo.py
+++ b/buildscripts/gdb/mongo.py
@@ -37,7 +37,7 @@ def get_thread_id():
def get_current_thread_name():
- """Returns the name of the current GDB thread"""
+ """Return the name of the current GDB thread."""
fallback_name = '"%s"' % (gdb.selected_thread().name or '')
try:
# This goes through the pretty printer for StringData which adds "" around the name.
@@ -176,8 +176,8 @@ class MongoDBUniqueStack(gdb.Command):
if current_thread and current_thread.is_valid():
current_thread.switch()
-
- def _process_thread_stack(self, arg, stacks, thread):
+ @staticmethod
+ def _process_thread_stack(arg, stacks, thread):
"""Process the thread stack."""
thread_info = {} # thread dict to hold per thread data
thread_info['pthread'] = get_thread_id()
diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py
index a183f44809d..78d2778e07b 100644
--- a/buildscripts/gdb/mongo_lock.py
+++ b/buildscripts/gdb/mongo_lock.py
@@ -197,7 +197,7 @@ class Graph(object):
def find_thread(thread_dict, search_thread_id):
"""Find thread."""
- for (lwpid, thread) in thread_dict.items():
+ for (_, thread) in thread_dict.items():
if thread.thread_id == search_thread_id:
return thread
return None
@@ -262,13 +262,13 @@ def find_mutex_holder(graph, thread_dict, show):
mutex_waiter = thread_dict[mutex_waiter_lwpid]
if show:
print("Mutex at {} held by {} waited on by {}".format(mutex_value, mutex_holder,
- mutex_waiter))
+ mutex_waiter))
if graph:
graph.add_edge(mutex_waiter, Lock(long(mutex_value), "Mutex"))
graph.add_edge(Lock(long(mutex_value), "Mutex"), mutex_holder)
-def find_lock_manager_holders(graph, thread_dict, show):
+def find_lock_manager_holders(graph, thread_dict, show): # pylint: disable=too-many-locals
"""Find lock manager holders."""
frame = find_frame(r'mongo::LockerImpl\<.*\>::')
if not frame:
@@ -293,8 +293,8 @@ def find_lock_manager_holders(graph, thread_dict, show):
lock_holder_id = int(locker["_threadId"]["_M_thread"])
lock_holder = find_thread(thread_dict, lock_holder_id)
if show:
- print("MongoDB Lock at {} ({}) held by {} waited on by {}".format(lock_head,
- lock_request["mode"], lock_holder, lock_waiter))
+ print("MongoDB Lock at {} ({}) held by {} waited on by {}".format(
+ lock_head, lock_request["mode"], lock_holder, lock_waiter))
if graph:
graph.add_edge(lock_waiter, Lock(long(lock_head), "MongoDB lock"))
graph.add_edge(Lock(long(lock_head), "MongoDB lock"), lock_holder)