The following issues were found

src/third_party/wiredtiger/bench/workgen/runner/example_prepare.py
47 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #

from runner import *
from wiredtiger import *
from workgen import *
import time

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 32 Column: 1

              
from runner import *
from wiredtiger import *
from workgen import *
import time

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 35 Column: 11

              from workgen import *
import time

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "table:test"
config = "key_format=S,value_format=S,"
s.create(tname, config)

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 41 Column: 9

              tname = "table:test"
config = "key_format=S,value_format=S,"
s.create(tname, config)
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 10

start_time = time.time()


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 47 Column: 16

              
start_time = time.time()

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 5000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 47 Column: 6

              
start_time = time.time()

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 5000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 48 Column: 10

              start_time = time.time()

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 5000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)

            

Reported by Pylint.

Undefined variable 'Workload'
Error

Line: 49 Column: 16

              
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 5000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
read_txn = txn(opread * 5, 'read_timestamp')

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 53 Column: 20

              print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
read_txn = txn(opread * 5, 'read_timestamp')
# read_timestamp_lag is the lag to the read_timestamp from current time
read_txn.transaction.read_timestamp_lag = 2
treader = Thread(read_txn)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 53 Column: 10

              print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
read_txn = txn(opread * 5, 'read_timestamp')
# read_timestamp_lag is the lag to the read_timestamp from current time
read_txn.transaction.read_timestamp_lag = 2
treader = Thread(read_txn)


            

Reported by Pylint.

site_scons/site_tools/dagger/graph_test.py
46 issues
Attempted relative import beyond top-level package
Error

Line: 30 Column: 1

              
import json
import unittest
from . import graph
from . import graph_consts


def generate_graph():
    """Generates our test graph"""

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 31 Column: 1

              import json
import unittest
from . import graph
from . import graph_consts


def generate_graph():
    """Generates our test graph"""


            

Reported by Pylint.

Access to a protected member _defined_symbols of a client class
Error

Line: 99 Column: 43

              
        if node1.type == graph_consts.NODE_LIB:
            if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):

            

Reported by Pylint.

Access to a protected member _defined_symbols of a client class
Error

Line: 99 Column: 17

              
        if node1.type == graph_consts.NODE_LIB:
            if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):

            

Reported by Pylint.

Access to a protected member _defined_files of a client class
Error

Line: 100 Column: 20

                      if node1.type == graph_consts.NODE_LIB:
            if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")

            

Reported by Pylint.

Access to a protected member _defined_files of a client class
Error

Line: 100 Column: 44

                      if node1.type == graph_consts.NODE_LIB:
            if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")

            

Reported by Pylint.

Access to a protected member _dependent_libs of a client class
Error

Line: 101 Column: 20

                          if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")


            

Reported by Pylint.

Access to a protected member _dependent_libs of a client class
Error

Line: 101 Column: 45

                          if (
                node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")


            

Reported by Pylint.

Access to a protected member _dependent_files of a client class
Error

Line: 102 Column: 20

                              node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")

        elif node1.type == graph_consts.NODE_SYM:

            

Reported by Pylint.

Access to a protected member _dependent_files of a client class
Error

Line: 102 Column: 46

                              node1._defined_symbols != node2._defined_symbols
                or node1._defined_files != node2._defined_files
                or node1._dependent_libs != node2._dependent_libs
                or node1._dependent_files != node2._dependent_files
                or node1._id != node2._id
            ):
                raise AssertionError("Nodes not equal")

        elif node1.type == graph_consts.NODE_SYM:

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_filesystem.py
46 issues
Instance of 'PathHelpers' has no 'addCleanup' member
Error

Line: 30 Column: 9

              
    def mkdtemp(self):
        directory = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, directory)
        return directory

    def create_file(self, filename, contents=''):
        fp = open(filename, 'w')
        try:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2008-2012 testtools developers. See LICENSE for details.

import os
import shutil
import tarfile
import tempfile

from testtools import TestCase
from testtools.matchers import (

            

Reported by Pylint.

Class 'PathHelpers' inherits from object, can be safely removed from bases in python3
Error

Line: 26 Column: 1

                  )


class PathHelpers(object):

    def mkdtemp(self):
        directory = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, directory)
        return directory

            

Reported by Pylint.

Missing class docstring
Error

Line: 26 Column: 1

                  )


class PathHelpers(object):

    def mkdtemp(self):
        directory = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, directory)
        return directory

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 5

              
class PathHelpers(object):

    def mkdtemp(self):
        directory = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, directory)
        return directory

    def create_file(self, filename, contents=''):

            

Reported by Pylint.

Method could be a function
Error

Line: 33 Column: 5

                      self.addCleanup(shutil.rmtree, directory)
        return directory

    def create_file(self, filename, contents=''):
        fp = open(filename, 'w')
        try:
            fp.write(contents)
        finally:
            fp.close()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 33 Column: 5

                      self.addCleanup(shutil.rmtree, directory)
        return directory

    def create_file(self, filename, contents=''):
        fp = open(filename, 'w')
        try:
            fp.write(contents)
        finally:
            fp.close()

            

Reported by Pylint.

Variable name "fp" doesn't conform to snake_case naming style
Error

Line: 34 Column: 9

                      return directory

    def create_file(self, filename, contents=''):
        fp = open(filename, 'w')
        try:
            fp.write(contents)
        finally:
            fp.close()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 40 Column: 5

                      finally:
            fp.close()

    def touch(self, filename):
        return self.create_file(filename)


class TestPathExists(TestCase, PathHelpers):


            

Reported by Pylint.

Missing class docstring
Error

Line: 44 Column: 1

                      return self.create_file(filename)


class TestPathExists(TestCase, PathHelpers):

    def test_exists(self):
        tempdir = self.mkdtemp()
        self.assertThat(tempdir, PathExists())


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/wtbackup.py
46 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import os, glob, shutil
import wttest, wiredtiger
from suite_subprocess import suite_subprocess
from helper import compare_files

# Shared base class used by backup tests.
class backup_base(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 125 Column: 44

                  #
    # Check that a URI doesn't exist, both the meta-data and the file names.
    #
    def confirmPathDoesNotExist(self, uri, dir):
        conn = self.wiredtiger_open(dir)
        session = conn.open_session()
        self.assertRaises(wiredtiger.WiredTigerError,
            lambda: session.open_cursor(uri, None, None))
        conn.close()

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 140 Column: 31

                  #
    # Copy a file into given directory.
    #
    def copy_file(self, file, dir):
        copy_from = file
        # If it is log file, prepend the path.
        if self.logpath and "WiredTigerLog" in file:
            copy_to = dir + '/' + self.logpath
        else:

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 307 Column: 49

                  # Optional arguments:
    #   consolidate: Add consolidate option to the cursor.
    #
    def take_incr_backup(self, backup_incr_dir, id=0, consolidate=False):
        self.assertTrue(id > 0 or self.bkup_id > 0)
        if id == 0:
            id = self.bkup_id
        # Open the backup data source for incremental backup.
        config = 'incremental=(src_id="ID' +  str(id - 1) + '",this_id="ID' + str(id) + '"'

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (os, glob, shutil)
Error

Line: 28 Column: 1

              # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import os, glob, shutil
import wttest, wiredtiger
from suite_subprocess import suite_subprocess
from helper import compare_files

# Shared base class used by backup tests.

            

Reported by Pylint.

Multiple imports on one line (wttest, wiredtiger)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import os, glob, shutil
import wttest, wiredtiger
from suite_subprocess import suite_subprocess
from helper import compare_files

# Shared base class used by backup tests.
class backup_base(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              from helper import compare_files

# Shared base class used by backup tests.
class backup_base(wttest.WiredTigerTestCase, suite_subprocess):
    data_cursor_config = None   # a config string for cursors.
    mult = 0                    # counter to have variance in data.
    nops = 100                  # number of operations added to uri.

    # We use counter to produce unique backup ids for multiple iterations

            

Reported by Pylint.

Class name "backup_base" doesn't conform to PascalCase naming style
Error

Line: 34 Column: 1

              from helper import compare_files

# Shared base class used by backup tests.
class backup_base(wttest.WiredTigerTestCase, suite_subprocess):
    data_cursor_config = None   # a config string for cursors.
    mult = 0                    # counter to have variance in data.
    nops = 100                  # number of operations added to uri.

    # We use counter to produce unique backup ids for multiple iterations

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 57 Column: 5

                  # Add data to the given uri.
    # Allows the option for doing a session checkpoint after adding data.
    #
    def add_data(self, uri, key, val, do_checkpoint=False):
        assert(self.nops != 0)
        c = self.session.open_cursor(uri, None, self.data_cursor_config)
        for i in range(0, self.nops):
            num = i + (self.mult * self.nops)
            k = key + str(num)

            

Reported by Pylint.

site_scons/site_tools/validate_cache_dir.py
46 issues
Unable to import 'SCons'
Error

Line: 32 Column: 1

              import traceback


import SCons

cache_debug_suffix = " (target: %s, cachefile: %s) "

class InvalidChecksum(SCons.Errors.BuildError):
    def __init__(self, src, dst, reason, cache_csig='', computed_csig=''):

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 98 Column: 69

                      src_file = cls.get_file_contents_path(src)

        if cls.get_bad_cachefile_path(src).exists():
            raise InvalidChecksum(cls.get_hash_path(src_file), dst, f"cachefile marked as bad checksum")

        csig = None
        try:
            with open(cls.get_hash_path(src_file), 'rb') as f_out:
                csig = f_out.read().decode().strip()

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 108 Column: 73

                          raise InvalidChecksum(cls.get_hash_path(src_file), dst, f"failed to read hash file: {ex}") from ex
        finally:
            if not csig:
                raise InvalidChecksum(cls.get_hash_path(src_file), dst, f"no content_hash data found")

        try:
            shutil.copy2(src_file, dst)
        except OSError as ex:
            raise CacheTransferFailed(src_file, dst, f"failed to copy from cache: {ex}") from ex

            

Reported by Pylint.

Unused variable 'cachedir'
Error

Line: 244 Column: 9

              

    def get_cachedir_csig(self, node):
        cachedir, cachefile = self.cachepath(node)
        if cachefile and os.path.exists(cachefile):
            with open(self.get_hash_path(self.get_file_contents_path(cachefile)), 'rb') as f_out:
                return f_out.read().decode()

    def cachepath(self, node):

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 250 Column: 9

                              return f_out.read().decode()

    def cachepath(self, node):
        dir, path = super().cachepath(node)
        if node.fs.exists(path):
            return dir, path
        return dir, str(self.get_cachedir_path(path))

def exists(env):

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 255 Column: 12

                          return dir, path
        return dir, str(self.get_cachedir_path(path))

def exists(env):
    return True

def generate(env):
    if not env.get('CACHEDIR_CLASS'):
        env['CACHEDIR_CLASS'] = CacheDirValidate

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright 2021 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:

            

Reported by Pylint.

Constant name "cache_debug_suffix" doesn't conform to UPPER_CASE naming style
Error

Line: 34 Column: 1

              
import SCons

cache_debug_suffix = " (target: %s, cachefile: %s) "

class InvalidChecksum(SCons.Errors.BuildError):
    def __init__(self, src, dst, reason, cache_csig='', computed_csig=''):
        self.message = f"ERROR: md5 checksum {reason} for {src} ({dst})"
        self.cache_csig = cache_csig

            

Reported by Pylint.

Missing class docstring
Error

Line: 36 Column: 1

              
cache_debug_suffix = " (target: %s, cachefile: %s) "

class InvalidChecksum(SCons.Errors.BuildError):
    def __init__(self, src, dst, reason, cache_csig='', computed_csig=''):
        self.message = f"ERROR: md5 checksum {reason} for {src} ({dst})"
        self.cache_csig = cache_csig
        self.computed_csig = computed_csig
    def __str__(self):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 36 Column: 1

              
cache_debug_suffix = " (target: %s, cachefile: %s) "

class InvalidChecksum(SCons.Errors.BuildError):
    def __init__(self, src, dst, reason, cache_csig='', computed_csig=''):
        self.message = f"ERROR: md5 checksum {reason} for {src} ({dst})"
        self.cache_csig = cache_csig
        self.computed_csig = computed_csig
    def __str__(self):

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/latency_metric.py
46 issues
Redefining built-in 'all'
Error

Line: 106 Column: 9

              class FileMetrics:
    def __init__(self, filename):
        self.filename = filename
        all = []

        # This is the average latency for all read operations.
        # Lower is better.
        self.latency_avg = m = Metric('Average latency reads us',
            'total latency of read ops divided by operations')

            

Reported by Pylint.

Redefining name 'm' from outer scope (line 256)
Error

Line: 110 Column: 28

              
        # This is the average latency for all read operations.
        # Lower is better.
        self.latency_avg = m = Metric('Average latency reads us',
            'total latency of read ops divided by operations')
        all.append(m)

        # This is the maximum latency over all read operations.
        # Lower is better.

            

Reported by Pylint.

Redefining name 'cols' from outer scope (line 251)
Error

Line: 223 Column: 25

                          self.read_ckpt.time_secs() /
            self.read_all.time_secs())

def table_line(leftcol, cols, spacer):
    return leftcol + spacer + spacer.join(cols) + '\n'

def make_len(value, l):
    return ('%%%ds' % l) % str(value)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (json, sys)
Error

Line: 32 Column: 1

              
# latency_metric.py
# Print latency metrics for workgen runs that generate monitor.json
import json, sys
from datetime import datetime

# A 'safe' divide shown as a string.
def divide(a, b):
    if b == 0.0:

            

Reported by Pylint.

Argument name "a" doesn't conform to snake_case naming style
Error

Line: 36 Column: 1

              from datetime import datetime

# A 'safe' divide shown as a string.
def divide(a, b):
    if b == 0.0:
        if a == 0.0:
            return '0.000  (no entries)'
        else:
            return 'infinite  (divide by zero)'

            

Reported by Pylint.

Argument name "b" doesn't conform to snake_case naming style
Error

Line: 36 Column: 1

              from datetime import datetime

# A 'safe' divide shown as a string.
def divide(a, b):
    if b == 0.0:
        if a == 0.0:
            return '0.000  (no entries)'
        else:
            return 'infinite  (divide by zero)'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 1

              from datetime import datetime

# A 'safe' divide shown as a string.
def divide(a, b):
    if b == 0.0:
        if a == 0.0:
            return '0.000  (no entries)'
        else:
            return 'infinite  (divide by zero)'

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 38 Column: 9

              # A 'safe' divide shown as a string.
def divide(a, b):
    if b == 0.0:
        if a == 0.0:
            return '0.000  (no entries)'
        else:
            return 'infinite  (divide by zero)'
    else:
        return '%.3f' % (float(a) / float(b))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 45 Column: 1

                  else:
        return '%.3f' % (float(a) / float(b))

def value_as_str(self):
    return '%.3f' % self.latency_average()

# A collection of statastics that are related to a specific condition
# during the run, for example during checkpoints or not during checkpoints.
class Digest:

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_fixturesupport.py
45 issues
Unable to import 'extras'
Error

Line: 5 Column: 1

              
import unittest

from extras import try_import

from testtools import (
    TestCase,
    content,
    content_type,

            

Reported by Pylint.

Unused argument 'ignored'
Error

Line: 40 Column: 20

              
    def test_useFixture_cleanups_raise_caught(self):
        calls = []
        def raiser(ignored):
            calls.append('called')
            raise Exception('foo')
        fixture = fixtures.FunctionFixture(lambda:None, raiser)
        class SimpleTest(TestCase):
            def test_foo(self):

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 71 Column: 40

                                  content.Content(content_type.UTF8_TEXT, lambda:[_b('foo')]))
        result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addSuccess', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['content', 'content-1'], sorted(details.keys()))
        self.assertEqual('foo', details['content'].as_text())
        self.assertEqual('content available until cleanUp',
            details['content-1'].as_text())

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 72 Column: 19

                      result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addSuccess', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['content', 'content-1'], sorted(details.keys()))
        self.assertEqual('foo', details['content'].as_text())
        self.assertEqual('content available until cleanUp',
            details['content-1'].as_text())


            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 90 Column: 40

                              self.useFixture(fixture)
        result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addSuccess', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['aaa', 'bbb'], sorted(details))
        self.assertEqual(_u('foo'), details['aaa'].as_text())
        self.assertEqual(_u('bar'), details['bbb'].as_text())


            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 91 Column: 19

                      result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addSuccess', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['aaa', 'bbb'], sorted(details))
        self.assertEqual(_u('foo'), details['aaa'].as_text())
        self.assertEqual(_u('bar'), details['bbb'].as_text())

    def test_useFixture_details_captured_from_setUp(self):

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 110 Column: 38

                              self.useFixture(fixture)
        result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addError', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['content', 'traceback'], sorted(details))
        self.assertEqual('foobar', ''.join(details['content'].iter_text()))



            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 111 Column: 19

                      result = ExtendedTestResult()
        SimpleTest('test_foo').run(result)
        self.assertEqual('addError', result._events[-2][0])
        details = result._events[-2][2]
        self.assertEqual(['content', 'traceback'], sorted(details))
        self.assertEqual('foobar', ''.join(details['content'].iter_text()))


def test_suite():

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2010-2011 testtools developers. See LICENSE for details.

import unittest

from extras import try_import

from testtools import (
    TestCase,
    content,

            

Reported by Pylint.

Missing class docstring
Error

Line: 21 Column: 1

              LoggingFixture = try_import('fixtures.tests.helpers.LoggingFixture')


class TestFixtureSupport(TestCase):

    def setUp(self):
        super(TestFixtureSupport, self).setUp()
        if fixtures is None or LoggingFixture is None:
            self.skipTest("Need fixtures")

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Script/Interactive.py
45 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 351
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

                          # http://mail.python.org/pipermail/python-dev/2008-August/081979.html "+
            # Doing the right thing with an argument list currently
            # requires different shell= values on Windows and Linux.
            p = subprocess.Popen(argv, shell=(sys.platform=='win32'))
        except EnvironmentError as e:
            sys.stderr.write('scons: %s: %s\n' % (argv[0], e.strerror))
        else:
            p.wait()


            

Reported by Bandit.

Instance of 'SConsInteractiveCmd' has no 'options' member
Error

Line: 164 Column: 33

                      import SCons.SConsign
        import SCons.Script.Main

        options = copy.deepcopy(self.options)

        options, targets = self.parser.parse_args(argv[1:], values=options)

        SCons.Script.COMMAND_LINE_TARGETS = targets


            

Reported by Pylint.

Instance of 'SConsInteractiveCmd' has no 'parser' member
Error

Line: 166 Column: 28

              
        options = copy.deepcopy(self.options)

        options, targets = self.parser.parse_args(argv[1:], values=options)

        SCons.Script.COMMAND_LINE_TARGETS = targets

        if targets:
            SCons.Script.BUILD_TARGETS = targets

            

Reported by Pylint.

Instance of 'SConsInteractiveCmd' has no 'fs' member
Error

Line: 177 Column: 50

                          # use the list of default targets.
            SCons.Script.BUILD_TARGETS = SCons.Script._build_plus_default

        nodes = SCons.Script.Main._build_targets(self.fs,
                                                 options,
                                                 targets,
                                                 self.target_top)

        if not nodes:

            

Reported by Pylint.

Instance of 'SConsInteractiveCmd' has no 'target_top' member
Error

Line: 180 Column: 50

                      nodes = SCons.Script.Main._build_targets(self.fs,
                                                 options,
                                                 targets,
                                                 self.target_top)

        if not nodes:
            return

        # Call each of the Node's alter_targets() methods, which may

            

Reported by Pylint.

Instance of 'SConsInteractiveCmd' has no 'parser' member
Error

Line: 361 Column: 26

                      """\
        version                 Prints SCons version information.
        """
        sys.stdout.write(self.parser.version + '\n')

def interact(fs, parser, options, targets, target_top):
    c = SConsInteractiveCmd(prompt = 'scons>>> ',
                            fs = fs,
                            parser = parser,

            

Reported by Pylint.

TODO:
Error

Line: 30 Column: 3

              SCons interactive mode
"""

# TODO:
#
# This has the potential to grow into something with a really big life
# of its own, which might or might not be a good thing.  Nevertheless,
# here are some enhancements that will probably be requested some day
# and are worth keeping in mind (assuming this takes off):

            

Reported by Pylint.

Unused import readline
Error

Line: 96 Column: 5

              import sys

try:
    import readline
except ImportError:
    pass

class SConsInteractiveCmd(cmd.Cmd):
    """\

            

Reported by Pylint.

Parameters differ from overridden 'default' method
Error

Line: 129 Column: 5

                      else:
            self.shell_variable = 'SHELL'

    def default(self, argv):
        print("*** Unknown command: %s" % argv[0])

    def onecmd(self, line):
        line = line.strip()
        if not line:

            

Reported by Pylint.

Access to a protected member _build_plus_default of a client class
Error

Line: 175 Column: 42

                      else:
            # If the user didn't specify any targets on the command line,
            # use the list of default targets.
            SCons.Script.BUILD_TARGETS = SCons.Script._build_plus_default

        nodes = SCons.Script.Main._build_targets(self.fs,
                                                 options,
                                                 targets,
                                                 self.target_top)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_import01.py
45 issues
Unable to import 'wiredtiger'
Error

Line: 35 Column: 1

              # - The source database and destination database are the same.

import os, random, re, shutil, string
import wiredtiger, wttest

# Shared base class used by import tests.
class test_import_base(wttest.WiredTigerTestCase):

    # Insert or update a key/value at the supplied timestamp.

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 35 Column: 1

              # - The source database and destination database are the same.

import os, random, re, shutil, string
import wiredtiger, wttest

# Shared base class used by import tests.
class test_import_base(wttest.WiredTigerTestCase):

    # Insert or update a key/value at the supplied timestamp.

            

Reported by Pylint.

Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
Error

Line: 80 Column: 24

                  # We know the ID can be different between configs, so just remove it from comparison.
    # Everything else should be the same.
    def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))

            

Reported by Pylint.

Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 81 Column: 31

                  # Everything else should be the same.
    def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 81 Column: 26

                  # Everything else should be the same.
    def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())

            

Reported by Pylint.

Anomalous backslash in string: '\w'. String constant might be missing an r prefix.
Error

Line: 81 Column: 22

                  # Everything else should be the same.
    def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 82 Column: 30

                  def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())


            

Reported by Pylint.

Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 82 Column: 35

                  def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())


            

Reported by Pylint.

Anomalous backslash in string: '\w'. String constant might be missing an r prefix.
Error

Line: 82 Column: 26

                  def config_compare(self, aconf, bconf):
        a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())


            

Reported by Pylint.

Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
Error

Line: 83 Column: 24

                      a = re.sub('id=\d+,?', '', aconf)
        a = (re.sub('\w+=\(.*?\)+,?', '', a).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', a))
        b = re.sub('id=\d+,?', '', bconf)
        b = (re.sub('\w+=\(.*?\)+,?', '', b).strip(',').split(',') +
             re.findall('\w+=\(.*?\)+', b))
        self.assertTrue(a.sort() == b.sort())

    # Populate a database with N tables, each having M rows.

            

Reported by Pylint.

src/third_party/abseil-cpp-master/abseil-cpp/create_lts.py
45 issues
Function name "ReplaceStringsInFile" doesn't conform to snake_case naming style
Error

Line: 24 Column: 1

              import sys


def ReplaceStringsInFile(filename, replacement_dict):
  """Performs textual replacements in a file.

  Rewrites filename with the keys in replacement_dict replaced with
  their values. This function assumes the file can fit in memory.


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 25 Column: 1

              

def ReplaceStringsInFile(filename, replacement_dict):
  """Performs textual replacements in a file.

  Rewrites filename with the keys in replacement_dict replaced with
  their values. This function assumes the file can fit in memory.

  Args:

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 38 Column: 3

                Raises:
    Exception: A failure occured
  """
  f = open(filename, 'r')
  content = f.read()
  f.close()

  for key, value in replacement_dict.items():
    original = content

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 38 Column: 1

                Raises:
    Exception: A failure occured
  """
  f = open(filename, 'r')
  content = f.read()
  f.close()

  for key, value in replacement_dict.items():
    original = content

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 39 Column: 1

                  Exception: A failure occured
  """
  f = open(filename, 'r')
  content = f.read()
  f.close()

  for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 40 Column: 1

                """
  f = open(filename, 'r')
  content = f.read()
  f.close()

  for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)
    if content == original:

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 42 Column: 1

                content = f.read()
  f.close()

  for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)
    if content == original:
      raise Exception('Failed to find {} in {}'.format(key, filename))


            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 43 Column: 1

                f.close()

  for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)
    if content == original:
      raise Exception('Failed to find {} in {}'.format(key, filename))

  f = open(filename, 'w')

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 44 Column: 1

              
  for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)
    if content == original:
      raise Exception('Failed to find {} in {}'.format(key, filename))

  f = open(filename, 'w')
  f.write(content)

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 45 Column: 1

                for key, value in replacement_dict.items():
    original = content
    content = content.replace(key, value)
    if content == original:
      raise Exception('Failed to find {} in {}'.format(key, filename))

  f = open(filename, 'w')
  f.write(content)
  f.close()

            

Reported by Pylint.