The following issues were found

src/third_party/wiredtiger/test/suite/test_env01.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest

# test_priv01.py
#    Test privileged operations.
#    This is a variant of test_config02.py.  This test should be run as both
# normal and privileged (e.g. root) user, and should pass in both cases.

            

Reported by Pylint.

Parameters differ from overridden 'setUpConnectionOpen' method
Error

Line: 56 Column: 5

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Unused argument 'dir'
Error

Line: 56 Column: 35

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 56 Column: 35

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

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 (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest

# test_priv01.py
#    Test privileged operations.
#    This is a variant of test_config02.py.  This test should be run as both
# normal and privileged (e.g. root) user, and should pass in both cases.

            

Reported by Pylint.

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

Line: 36 Column: 1

              #    Test privileged operations.
#    This is a variant of test_config02.py.  This test should be run as both
# normal and privileged (e.g. root) user, and should pass in both cases.
class test_priv01(wttest.WiredTigerTestCase):
    """
    This tests privileged operations.
    The only part of WiredTiger that currently cares about privilege
    levels is the 'use_environment_priv' configuration option for
    wiredtiger_open, which by design, behaves differently depending on

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 52 Column: 9

                  def setUp(self):
        if os.name == 'nt':
            self.skipTest('Unix specific test skipped on Windows')
        super(test_priv01, self).setUp()

    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 80 Column: 5

                      self.assertEqual(i, self.nentries)
        cursor.close()

    def checkfiles(self, dirname):
        self.assertTrue(os.path.exists(dirname + os.sep + self.table_name1 + ".wt"))

    def checknofiles(self, dirname):
        nfiles = len([nm for nm in os.listdir(dirname) if os.path.isfile(nm)])
        self.assertEqual(nfiles, 0)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 83 Column: 5

                  def checkfiles(self, dirname):
        self.assertTrue(os.path.exists(dirname + os.sep + self.table_name1 + ".wt"))

    def checknofiles(self, dirname):
        nfiles = len([nm for nm in os.listdir(dirname) if os.path.isfile(nm)])
        self.assertEqual(nfiles, 0)

    def common_test(self, homearg, homeenv, configextra):
        """

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testscenarios-0.4/lib/testscenarios/testcase.py
19 issues
Unable to import 'testtools.testcase'
Error

Line: 24 Column: 1

              
import unittest

from testtools.testcase import clone_test_with_new_id

from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a

            

Reported by Pylint.

Super of 'WithScenarios' has no 'debug' member
Error

Line: 56 Column: 20

                          for test in generate_scenarios(self):
                test.debug()
        else:
            return super(WithScenarios, self).debug()

    def run(self, result=None):
        scenarios = self._get_scenarios()
        if scenarios:
            for test in generate_scenarios(self):

            

Reported by Pylint.

Super of 'WithScenarios' has no 'run' member
Error

Line: 65 Column: 20

                              test.run(result)
            return
        else:
            return super(WithScenarios, self).run(result)


class TestWithScenarios(WithScenarios, unittest.TestCase):
    __doc__ = """Unittest TestCase with support for declarative scenarios.
    """ + _doc

            

Reported by Pylint.

Unused clone_test_with_new_id imported from testtools.testcase
Error

Line: 24 Column: 1

              
import unittest

from testtools.testcase import clone_test_with_new_id

from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #  testscenarios: extensions to python unittest to allow declarative
#  dependency injection ('scenarios') by tests.
#
# Copyright (c) 2009, Robert Collins <robertc@robertcollins.net>
# 
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.

            

Reported by Pylint.

Trailing whitespace
Error

Line: 5 Column: 2

              #  dependency injection ('scenarios') by tests.
#
# Copyright (c) 2009, Robert Collins <robertc@robertcollins.net>
# 
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
# 

            

Reported by Pylint.

Trailing whitespace
Error

Line: 10 Column: 2

              # license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
# license you chose for the specific language governing permissions and
# limitations under that license.

            

Reported by Pylint.

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

Line: 28 Column: 1

              
from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a
    non-empty scenarios attribute on the object, the test is multiplied by the
    run method into one test per scenario. For this to work reliably the
    WithScenarios.run method must not be overriden in a subclass (or overridden
    compatibly with WithScenarios).

            

Reported by Pylint.

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

Line: 36 Column: 1

                  compatibly with WithScenarios).
    """

class WithScenarios(object):
    __doc__ = """A mixin for TestCase with support for declarative scenarios.
    """ + _doc

    def _get_scenarios(self):
        return getattr(self, 'scenarios', None)

            

Reported by Pylint.

Method name "countTestCases" doesn't conform to snake_case naming style
Error

Line: 43 Column: 5

                  def _get_scenarios(self):
        return getattr(self, 'scenarios', None)

    def countTestCases(self):
        scenarios = self._get_scenarios()
        if not scenarios:
            return 1
        else:
            return len(scenarios)

            

Reported by Pylint.

buildscripts/gdb/mongo.py
19 issues
Unable to import 'gdb'
Error

Line: 9 Column: 1

              import re
import sys

import gdb

# pylint: disable=invalid-name,wildcard-import,broad-except
try:
    # Try to find and load the C++ pretty-printer library.
    import glob

            

Reported by Pylint.

Unable to import 'libstdcxx.v6'
Error

Line: 19 Column: 5

                  printers = pp[0]
    path = os.path.dirname(os.path.dirname(os.path.dirname(printers)))
    sys.path.insert(0, path)
    from libstdcxx.v6 import register_libstdcxx_printers
    from libstdcxx.v6 import printers as stdlib_printers
    register_libstdcxx_printers(gdb.current_objfile())
    print("Loaded libstdc++ pretty printers from '%s'" % printers)
except Exception as e:
    print("Failed to load the libstdc++ pretty printers: " + str(e))

            

Reported by Pylint.

Unable to import 'libstdcxx.v6'
Error

Line: 20 Column: 5

                  path = os.path.dirname(os.path.dirname(os.path.dirname(printers)))
    sys.path.insert(0, path)
    from libstdcxx.v6 import register_libstdcxx_printers
    from libstdcxx.v6 import printers as stdlib_printers
    register_libstdcxx_printers(gdb.current_objfile())
    print("Loaded libstdc++ pretty printers from '%s'" % printers)
except Exception as e:
    print("Failed to load the libstdc++ pretty printers: " + str(e))
# pylint: enable=invalid-name,wildcard-import

            

Reported by Pylint.

TODO: Add a custom pretty printer for LogicalSessionId.
Error

Line: 303 Column: 3

                          # The Session is stored inside the SessionRuntimeInfo object.
            session_runtime_info = get_unique_ptr(sess_kv['second']).dereference()  # pylint: disable=undefined-variable
            session = session_runtime_info['session']
            # TODO: Add a custom pretty printer for LogicalSessionId.
            lsid_str = str(session['_sessionId']['_id'])

            # If we are only interested in a specific session, then we print out the entire Session
            # object, to aid more detailed debugging.
            if lsid_str == lsid_to_find:

            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 772
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                          print("Usage: mongodb-pprint-bson <ptr> <optional length>")
            return

        ptr = eval(args[0])  # pylint: disable=eval-used
        size = 20 * 1024
        if len(args) >= 2:
            size = int(args[1])
        print("Pretty printing bson object at %s (%d bytes)" % (ptr, size))


            

Reported by Bandit.

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

Line: 188 Column: 1

              ###################################################################################################


class RegisterMongoCommand(object):
    """Class to register mongo commands with GDB."""

    _MONGO_COMMANDS = {}  # type: ignore

    @classmethod

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 207 Column: 1

                          print("%s - %s" % (key, cls._MONGO_COMMANDS[key]))


class DumpGlobalServiceContext(gdb.Command):
    """Dump the Global Service Context."""

    def __init__(self):
        """Initialize DumpGlobalServiceContext."""
        RegisterMongoCommand.register(self, "mongodb-service-context", gdb.COMMAND_DATA)

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 223 Column: 1

              DumpGlobalServiceContext()


class GetMongoDecoration(gdb.Command):
    """
    Search for a decoration on an object by typename and print it e.g.

    (gdb) mongo-decoration opCtx ReadConcernArgs


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 258 Column: 1

              GetMongoDecoration()


class DumpMongoDSessionCatalog(gdb.Command):
    """Print out the mongod SessionCatalog, which maintains a table of all Sessions.

    Prints out interesting information from TransactionParticipants too, which are decorations on
    the Session. If no arguments are provided, dumps out all sessions. Can optionally provide a
    session id argument. In that case, will only print the session for the specified id, if it is

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 286 Column: 1

                      session_catalog = get_session_catalog()
        if session_catalog is None:
            print(
                "No SessionCatalog object was found on the ServiceContext. Not dumping any sessions."
            )
            return
        session_kv_pairs = get_session_kv_pairs()
        print("Dumping %d Session objects from the SessionCatalog" % len(session_kv_pairs))


            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/jit/x86/Lowering-x86.cpp
19 issues
access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 295 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
                                                    useRegister(base),
                                                    tempFixed(ecx),
                                                    tempFixed(ebx));
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 295 Column: 55 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
                                                    useRegister(base),
                                                    tempFixed(ecx),
                                                    tempFixed(ebx));
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 310 Column: 73 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  // pointer to a register only if that can't happen.

    LAllocation baseAlloc;
    if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
        baseAlloc = ins->type() == MIRType::Int64 ? useRegister(base) : useRegisterAtStart(base);

    if (ins->type() != MIRType::Int64) {
        auto* lir = new(alloc()) LWasmLoad(baseAlloc, useRegisterAtStart(memoryBase));
        define(lir, ins);

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 325 Column: 36 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              
    auto* lir = new(alloc()) LWasmLoadI64(baseAlloc, useRegister(memoryBase));

    Scalar::Type accessType = ins->access().type();
    if (accessType == Scalar::Int8 || accessType == Scalar::Int16 || accessType == Scalar::Int32) {
        // We use cdq to sign-extend the result and cdq demands these registers.
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),
                                                    LAllocation(AnyRegister(eax))));
        return;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 345 Column: 55 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
                                                     useRegister(base),
                                                     useInt64Fixed(ins->value(),
                                                                   Register64(ecx, ebx)),
                                                     tempFixed(edx),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 345 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
                                                     useRegister(base),
                                                     useInt64Fixed(ins->value(),
                                                                   Register64(ecx, ebx)),
                                                     tempFixed(edx),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 361 Column: 73 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  // pointer to a register only if that can't happen.

    LAllocation baseAlloc;
    if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
        baseAlloc = useRegisterAtStart(base);

    LAllocation valueAlloc;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 365 Column: 18 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      baseAlloc = useRegisterAtStart(base);

    LAllocation valueAlloc;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:
        // See comment for LIRGeneratorX86::useByteOpRegister.
        valueAlloc = useFixed(ins->value(), eax);
        break;
      case Scalar::Int16: case Scalar::Uint16:

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 444 Column: 18 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                                         : LAllocation();

    LAsmJSStoreHeap* lir = nullptr;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:
        // See comment for LIRGeneratorX86::useByteOpRegister.
        lir = new(alloc()) LAsmJSStoreHeap(baseAlloc, useFixed(ins->value(), eax),
                                           limitAlloc, useRegisterAtStart(memoryBase));
        break;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 480 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64) {
        auto* lir = new(alloc()) LWasmCompareExchangeI64(useRegister(memoryBase),
                                                         useRegister(base),
                                                         useInt64Fixed(ins->oldValue(),
                                                                       Register64(edx, eax)),
                                                         useInt64Fixed(ins->newValue(),

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/compat/__init__.py
19 issues
Undefined variable 'intern'
Error

Line: 114 Column: 18

              except AttributeError:
    # We must be using python 2.7.x so monkey patch
    # intern into the sys package
    sys.intern = intern

# UserDict, UserList, UserString are in # collections for 3.x,
# but standalone in 2.7.x. Monkey-patch into collections for 2.7.
import collections


            

Reported by Pylint.

Unable to import 'UserDict'
Error

Line: 123 Column: 5

              try:
    collections.UserDict
except AttributeError:
    from UserDict import UserDict as _UserDict
    collections.UserDict = _UserDict
    del _UserDict

try:
    collections.UserList

            

Reported by Pylint.

Unable to import 'UserList'
Error

Line: 130 Column: 5

              try:
    collections.UserList
except AttributeError:
    from UserList import UserList as _UserList
    collections.UserList = _UserList
    del _UserList

try:
    collections.UserString

            

Reported by Pylint.

Unable to import 'UserString'
Error

Line: 137 Column: 5

              try:
    collections.UserString
except AttributeError:
    from UserString import UserString as _UserString
    collections.UserString = _UserString
    del _UserString


import shutil

            

Reported by Pylint.

TODO: FIXME
Error

Line: 81 Column: 3

                      return False


# TODO: FIXME
# In 3.x, 'pickle' automatically loads the fast version if available.
rename_module('pickle', 'cPickle')

# Default pickle protocol. Higher protocols are more efficient/featureful
# but incompatible with older Python versions. On Python 2.7 this is 2.

            

Reported by Pylint.

TODO: FIXME
Error

Line: 94 Column: 3

              # Changed to 2 so py3.5+'s pickle will be compatible with py2.7.
PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL

# TODO: FIXME
# In 3.x, 'profile' automatically loads the fast version if available.
rename_module('profile', 'cProfile')

# TODO: FIXME
# Before Python 3.0, the 'queue' module was named 'Queue'.

            

Reported by Pylint.

TODO: FIXME
Error

Line: 98 Column: 3

              # In 3.x, 'profile' automatically loads the fast version if available.
rename_module('profile', 'cProfile')

# TODO: FIXME
# Before Python 3.0, the 'queue' module was named 'Queue'.
rename_module('queue', 'Queue')

# TODO: FIXME
# Before Python 3.0, the 'winreg' module was named '_winreg'

            

Reported by Pylint.

TODO: FIXME
Error

Line: 102 Column: 3

              # Before Python 3.0, the 'queue' module was named 'Queue'.
rename_module('queue', 'Queue')

# TODO: FIXME
# Before Python 3.0, the 'winreg' module was named '_winreg'
rename_module('winreg', '_winreg')

# Python 3 moved builtin intern() to sys package
# To make porting easier, make intern always live

            

Reported by Pylint.

Line too long (121/100)
Error

Line: 60 Column: 1

              rest of our code will find our pre-loaded compatibility module.
"""

__revision__ = "src/engine/SCons/compat/__init__.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import os
import sys
import importlib


            

Reported by Pylint.

Consider possible security implications associated with pickle module.
Security blacklist

Line: 88
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle

              # Default pickle protocol. Higher protocols are more efficient/featureful
# but incompatible with older Python versions. On Python 2.7 this is 2.
# Negative numbers choose the highest available protocol.
import pickle

# Was pickle.HIGHEST_PROTOCOL
# Changed to 2 so py3.5+'s pickle will be compatible with py2.7.
PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL


            

Reported by Bandit.

src/third_party/wiredtiger/test/suite/test_bug025.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Unused copy_wiredtiger_home imported from helper
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Unused import shutil
Error

Line: 32 Column: 1

              from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.
# After a later access, we crash (null pointer access).
#

            

Reported by Pylint.

Unused variable 'pos'
Error

Line: 55 Column: 9

                      iname_suffix = iname[iname.rindex(':') + 1:]
        filename = 'test_bug025_' + iname_suffix + '.wti'
        self.close_conn()
        pos = os.path.getsize(filename) - 1024
        os.remove(filename)

        # We will get error output, but not always in the same API calls from run to run,
        # in particular the open connection doesn't always report the missing file, as
        # index files are usually lazily loaded. As long as the missing file is reported

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 72 Column: 20

                          # The insert fails, and the cursor remains open.
            try:
                cursor[newkey] = newval
            except Exception as e:
                self.pr('Exception in first access: ' + str(e))

            # The insert fails again.  Before the associated fix was made, the insert crashed.
            try:
                cursor[newkey] = newval    # point of crash

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 78 Column: 20

                          # The insert fails again.  Before the associated fix was made, the insert crashed.
            try:
                cursor[newkey] = newval    # point of crash
            except Exception as e:
                self.pr('Exception in second access: ' + str(e))

            cursor.close()

if __name__ == '__main__':

            

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.

third party import "import wiredtiger, wttest" should be placed before "from helper import copy_wiredtiger_home"
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_encrypt07.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):


            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 52 Column: 5

                      extlist.skip_if_missing = True
        extlist.extension('encryptors', self.sys_encrypt)

    def conn_config(self):
        return 'encryption=(name={0}{1}),'.format(
            self.sys_encrypt, self.sys_encrypt_args)

    def rot13(self, s):
        return codecs.encode(s, 'rot_13')

            

Reported by Pylint.

Unused import string
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import run
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import os
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 34 Column: 1

              #

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):


            

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, run, string, codecs)
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

standard import "import os, run, string, codecs" should be placed before "import os, run, string, codecs"
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

standard import "import os, run, string, codecs" should be placed before "import os, run, string, codecs"
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py
19 issues
Unable to import 'networkx'
Error

Line: 34 Column: 1

              from collections import namedtuple, OrderedDict

import flask
import networkx

from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

            

Reported by Pylint.

Unable to import 'flask_socketio'
Error

Line: 36 Column: 1

              import flask
import networkx

from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph

            

Reported by Pylint.

Unable to import 'flask_session'
Error

Line: 38 Column: 1

              
from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph
import libdeps.analyzer


            

Reported by Pylint.

Unable to import 'lxml'
Error

Line: 39 Column: 1

              from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph
import libdeps.analyzer



            

Reported by Pylint.

Unable to import 'libdeps.graph'
Error

Line: 41 Column: 1

              from flask_session import Session
from lxml import etree

import libdeps.graph
import libdeps.analyzer


class BackendServer:
    """Create small class for storing variables and state of the backend."""

            

Reported by Pylint.

Unable to import 'libdeps.analyzer'
Error

Line: 42 Column: 1

              from lxml import etree

import libdeps.graph
import libdeps.analyzer


class BackendServer:
    """Create small class for storing variables and state of the backend."""


            

Reported by Pylint.

Unused Session imported from flask_session
Error

Line: 38 Column: 1

              
from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph
import libdeps.analyzer


            

Reported by Pylint.

third party import "import networkx" should be placed before "import flask"
Error

Line: 34 Column: 1

              from collections import namedtuple, OrderedDict

import flask
import networkx

from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

            

Reported by Pylint.

third party import "from flask_socketio import SocketIO, emit" should be placed before "import flask"
Error

Line: 36 Column: 1

              import flask
import networkx

from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph

            

Reported by Pylint.

third party import "from flask_cors import CORS" should be placed before "import flask"
Error

Line: 37 Column: 1

              import networkx

from flask_socketio import SocketIO, emit
from flask_cors import CORS
from flask_session import Session
from lxml import etree

import libdeps.graph
import libdeps.analyzer

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_pack.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

Unused import sys
Error

Line: 34 Column: 1

              #

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'

    def dump_cursor(self, cursor, name):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 68 Column: 9

                      #self.dump_cursor(forw_idx, 'index')

        forw.set_key(1234)
        self.assertEquals(forw.search(), 0)
        got = forw.get_value()
        if nargs == 1:  # API does not return a list, we want one for comparing
            got = [got]
        self.assertEquals(got, v)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 72 Column: 9

                      got = forw.get_value()
        if nargs == 1:  # API does not return a list, we want one for comparing
            got = [got]
        self.assertEquals(got, v)

        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 75 Column: 9

                      self.assertEquals(got, v)

        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()
        forw_idx.close()

    def test_packing(self):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 76 Column: 9

              
        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()
        forw_idx.close()

    def test_packing(self):
        self.check('iii', 0, 101, -99)

            

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 (wiredtiger, wttest)
Error

Line: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

standard import "import re, sys" should be placed before "import wiredtiger, wttest"
Error

Line: 34 Column: 1

              #

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'

    def dump_cursor(self, cursor, name):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_join10.py
19 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 wiredtiger, wttest
from wtscenario import make_scenarios

# test_join10.py
#    Test modeled on the C example for join.
class test_join10(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused 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 wiredtiger, wttest
from wtscenario import make_scenarios

# test_join10.py
#    Test modeled on the C example for join.
class test_join10(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused make_scenarios imported from wtscenario
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_join10.py
#    Test modeled on the C example for join.
class test_join10(wttest.WiredTigerTestCase):


            

Reported by Pylint.

Unused variable 'valstr'
Error

Line: 41 Column: 23

              
    def check_stats(self, jc, expect):
        statcursor = self.session.open_cursor('statistics:join', jc, None)
        for id, desc, valstr, val in statcursor:
            if desc in expect:
                expect_val = expect.pop(desc)
                self.assertEqual(val, expect_val)
        self.assertTrue(len(expect) == 0,
                        'missing expected values in stats: ' + str(expect))

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 41 Column: 13

              
    def check_stats(self, jc, expect):
        statcursor = self.session.open_cursor('statistics:join', jc, None)
        for id, desc, valstr, val in statcursor:
            if desc in expect:
                expect_val = expect.pop(desc)
                self.assertEqual(val, expect_val)
        self.assertTrue(len(expect) == 0,
                        'missing expected values in stats: ' + str(expect))

            

Reported by Pylint.

Unused variable 'id'
Error

Line: 41 Column: 13

              
    def check_stats(self, jc, expect):
        statcursor = self.session.open_cursor('statistics:join', jc, None)
        for id, desc, valstr, val in statcursor:
            if desc in expect:
                expect_val = expect.pop(desc)
                self.assertEqual(val, expect_val)
        self.assertTrue(len(expect) == 0,
                        'missing expected values in stats: ' + str(expect))

            

Reported by Pylint.

Unused variable 'recno'
Error

Line: 95 Column: 13

                      # Check results
        expect = [[c,y,p] for c,y,p in pop_data if c == "AU" and y > 1900]
        got = []
        for recno, country, year, population in join_cursor:
            got.append([country, year, population])
        self.assertEqual(expect, got)

        # Check statistics
        # It may seem odd to encode specific values to check against, but each of these

            

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 (wiredtiger, wttest)
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 wiredtiger, wttest
from wtscenario import make_scenarios

# test_join10.py
#    Test modeled on the C example for join.
class test_join10(wttest.WiredTigerTestCase):

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_join10.py
#    Test modeled on the C example for join.
class test_join10(wttest.WiredTigerTestCase):

    # We need statistics for these tests.
    conn_config = 'statistics=(all)'

    def check_stats(self, jc, expect):

            

Reported by Pylint.