diff options
-rwxr-xr-x | buildscripts/evergreen_run_tests.py | 2 | ||||
-rw-r--r-- | buildscripts/gdb/mongo.py | 6 | ||||
-rw-r--r-- | buildscripts/gdb/mongo_lock.py | 10 | ||||
-rwxr-xr-x | buildscripts/pylinters.py | 9 | ||||
-rwxr-xr-x | buildscripts/resmoke.py | 4 | ||||
-rw-r--r-- | buildscripts/resmokelib/parser.py | 2 | ||||
-rw-r--r-- | buildscripts/sha256sum.py | 7 |
7 files changed, 23 insertions, 17 deletions
diff --git a/buildscripts/evergreen_run_tests.py b/buildscripts/evergreen_run_tests.py index cec88b86d0f..78f208b6c90 100755 --- a/buildscripts/evergreen_run_tests.py +++ b/buildscripts/evergreen_run_tests.py @@ -145,6 +145,6 @@ class Main(resmoke.Resmoke): if __name__ == "__main__": - main = Main() + main = Main() # pylint: disable=invalid-name main.configure_from_command_line() main.run() 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) diff --git a/buildscripts/pylinters.py b/buildscripts/pylinters.py index 9ddce0a2c30..87d785d7231 100755 --- a/buildscripts/pylinters.py +++ b/buildscripts/pylinters.py @@ -57,9 +57,12 @@ def get_py_linter(linter_filter): def is_interesting_file(file_name): # type: (str) -> bool """Return true if this file should be checked.""" - return file_name.endswith(".py") and (file_name.startswith("buildscripts/idl") - or file_name.startswith("buildscripts/linter") - or file_name.startswith("buildscripts/pylinters.py")) + file_blacklist = ["buildscripts/cpplint.py"] + directory_blacklist = ["src/third_party"] + if file_name in file_blacklist or file_name.startswith(tuple(directory_blacklist)): + return False + directory_list = ["buildscripts", "pytests"] + return file_name.endswith(".py") and file_name.startswith(tuple(directory_list)) def _lint_files(linters, config_dict, file_names): diff --git a/buildscripts/resmoke.py b/buildscripts/resmoke.py index 0d57e3ff6f2..82b6bcbec00 100755 --- a/buildscripts/resmoke.py +++ b/buildscripts/resmoke.py @@ -153,7 +153,7 @@ class Resmoke(object): self._get_suite_summary(suite)) def _execute_suite(self, suite): - """Execute a suite and return True if interrupted, False otherwise. """ + """Execute a suite and return True if interrupted, False otherwise.""" self._shuffle_tests(suite) if not suite.tests: self._exec_logger.info("Skipping %s, no tests to run", suite.test_kind) @@ -235,7 +235,7 @@ class Resmoke(object): def main(): - """Main function for resmoke.""" + """Execute Main function for resmoke.""" resmoke = Resmoke() resmoke.configure_from_command_line() resmoke.run() diff --git a/buildscripts/resmokelib/parser.py b/buildscripts/resmokelib/parser.py index 9dc464d8129..6533b981997 100644 --- a/buildscripts/resmokelib/parser.py +++ b/buildscripts/resmokelib/parser.py @@ -299,7 +299,7 @@ def _make_parser(): # pylint: disable=too-many-statements def parse_command_line(): - """Parses the command line arguments passed to resmoke.py.""" + """Parse the command line arguments passed to resmoke.py.""" parser = _make_parser() options, args = parser.parse_args() diff --git a/buildscripts/sha256sum.py b/buildscripts/sha256sum.py index 5d48c15a788..90c2c06b768 100644 --- a/buildscripts/sha256sum.py +++ b/buildscripts/sha256sum.py @@ -1,11 +1,14 @@ #!/usr/bin/env python2 """ Computes a SHA256 sum of a file. + Accepts a file path, prints the hex encoded hash to stdout. """ +from __future__ import print_function + import sys from hashlib import sha256 -with open(sys.argv[1], 'rb') as f: - print(sha256(f.read()).hexdigest()) +with open(sys.argv[1], 'rb') as fh: + print(sha256(fh.read()).hexdigest()) |