The following issues were found

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/install.py
85 issues
Bad except clauses order (OSError is an ancestor class of CopytreeError)
Error

Line: 91 Column: 16

                          errors.append((srcname, dstname, str(why)))
        # catch the CopytreeError from the recursive copytree so that we can
        # continue with other files
        except CopytreeError as err:
            errors.extend(err.args[0])
    try:
        shutil.copystat(src, dst)
    except SCons.Util.WinError:
        # can't copy file access times on Windows

            

Reported by Pylint.

Bad except clauses order (OSError is an ancestor class of CopytreeError)
Error

Line: 91 Column: 16

                          errors.append((srcname, dstname, str(why)))
        # catch the CopytreeError from the recursive copytree so that we can
        # continue with other files
        except CopytreeError as err:
            errors.extend(err.args[0])
    try:
        shutil.copystat(src, dst)
    except SCons.Util.WinError:
        # can't copy file access times on Windows

            

Reported by Pylint.

Unused import re
Error

Line: 37 Column: 1

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

import os
import re
import shutil
import stat

import SCons.Action
import SCons.Tool

            

Reported by Pylint.

XXX What about devices, sockets etc.?
Error

Line: 86 Column: 3

                              scons_copytree(srcname, dstname, symlinks)
            else:
                shutil.copy2(srcname, dstname)
            # XXX What about devices, sockets etc.?
        except (IOError, os.error) as why:
            errors.append((srcname, dstname, str(why)))
        # catch the CopytreeError from the recursive copytree so that we can
        # continue with other files
        except CopytreeError as err:

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 107 Column: 28

              #
# Functions doing the actual work of the Install Builder.
#
def copyFunc(dest, source, env):
    """Install a source file or directory into a destination by copying,
    (including copying permission/mode bits)."""

    if os.path.isdir(source):
        if os.path.exists(dest):

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 141 Column: 9

                      # remove the link if it is already there
        try:
            os.remove(dest)
        except:
            pass
        shutil.copy2(source, dest)
        st = os.stat(source)
        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
        installShlibLinks(dest, source, env)

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 182 Column: 9

                  try:
        install = env['INSTALL']
    except KeyError:
        raise SCons.Errors.UserError('Missing INSTALL construction variable.')

    assert len(target)==len(source), \
           "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target)))
    for t,s in zip(target,source):
        if install(t.get_path(),s.get_path(),env):

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 198 Column: 9

                  try:
        install = env['INSTALLVERSIONEDLIB']
    except KeyError:
        raise SCons.Errors.UserError('Missing INSTALLVERSIONEDLIB construction variable.')

    assert len(target)==len(source), \
           "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target)))
    for t,s in zip(target,source):
        if hasattr(t.attributes, 'shlibname'):

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 219 Column: 9

                  target = str(target[0])
    source = str(source[0])
    if os.path.isdir(source):
        type = 'directory'
    else:
        type = 'file'
    return 'Install %s: "%s" as "%s"' % (type, source, target)

#

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 227 Column: 52

              #
# Emitter functions
#
def add_targets_to_INSTALLED_FILES(target, source, env):
    """ An emitter that adds all target files to the list stored in the
    _INSTALLED_FILES global variable. This way all installed files of one
    scons call will be collected.
    """
    global _INSTALLED_FILES, _UNIQUE_INSTALLED_FILES

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Builder.py
84 issues
Dangerous default value [] as argument
Error

Line: 119 Column: 1

              
_null = _Null

def match_splitext(path, suffixes = []):
    if suffixes:
        matchsuf = [S for S in suffixes if path[-len(S):] == S]
        if matchsuf:
            suf = max([(len(_f),_f) for _f in matchsuf])[1]
            return [path[:-len(suf)], path[-len(suf):]]

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 134 Column: 24

                  to return the proper action based on the file suffix of
    the source file."""

    def __init__(self, dict=None, source_ext_match=1):
        SCons.Util.Selector.__init__(self, dict)
        self.source_ext_match = source_ext_match

    def src_suffixes(self):
        return list(self.keys())

            

Reported by Pylint.

Signature differs from overridden '__call__' method
Error

Line: 146 Column: 5

                      """
        self[suffix] = action

    def __call__(self, target, source, env, for_signature):
        if not source:
            return []

        if self.source_ext_match:
            suffixes = self.src_suffixes()

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 171 Column: 13

                      try:
            ret = SCons.Util.Selector.__call__(self, env, source, ext)
        except KeyError as e:
            raise UserError("Ambiguous suffixes after environment substitution: %s == %s == %s" % (e.args[0], e.args[1], e.args[2]))
        if ret is None:
            raise UserError("While building `%s' from `%s': Don't know how to build from a source file with suffix `%s'.  Expected a suffix in this list: %s." % \
                            (repr(list(map(str, target))), repr(list(map(str, source))), ext, repr(list(self.keys()))))
        return ret


            

Reported by Pylint.

Signature differs from overridden '__call__' method
Error

Line: 180 Column: 5

              class CallableSelector(SCons.Util.Selector):
    """A callable dictionary that will, in turn, call the value it
    finds if it can."""
    def __call__(self, env, source):
        value = SCons.Util.Selector.__call__(self, env, source)
        if callable(value):
            value = value(env, source)
        return value


            

Reported by Pylint.

Signature differs from overridden '__call__' method
Error

Line: 194 Column: 5

                  for the suffix in its dictionary, the original target and source are
    returned.
    """
    def __call__(self, target, source, env):
        emitter = SCons.Util.Selector.__call__(self, env, source)
        if emitter:
            target, source = emitter(target, source, env)
        return (target, source)


            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 226 Column: 24

                  can actually invoke multiple builders.  This class only emits the
    warnings once, no matter how many Builders are invoked.
    """
    def __init__(self, dict):
        collections.UserDict.__init__(self, dict)
        if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.OverrideWarner')
        self.already_warned = None
    def warn(self):
        if self.already_warned:

            

Reported by Pylint.

TODO(batch): list constructed each time!
Error

Line: 319 Column: 3

                              if t.builder != builder:
                    msg = "Two different builders (%s and %s) were specified for the same target: %s" % (t.builder.get_name(env), builder.get_name(env), t)
                    raise UserError(msg)
                # TODO(batch):  list constructed each time!
                if t.get_executor().get_all_targets() != tlist:
                    msg = "Two different target lists have a target in common: %s  (from %s and from %s)" % (t, list(map(str, t.get_executor().get_all_targets())), list(map(str, tlist)))
                    raise UserError(msg)
            elif t.sources != slist:
                msg = "Multiple ways to build the same target were specified for: %s  (from %s and from %s)" % (t, list(map(str, t.sources)), list(map(str, slist)))

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 500 Column: 17

                          try:
                t_from_s = slist[0].target_from_source
            except AttributeError:
                raise UserError("Do not know how to create a target from source `%s'" % slist[0])
            except IndexError:
                tlist = []
            else:
                splitext = lambda S: self.splitext(S,env)
                tlist = [ t_from_s(pre, suf, splitext) ]

            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 545 Column: 5

              
        return tlist, slist

    def _execute(self, env, target, source, overwarn={}, executor_kw={}):
        # We now assume that target and source are lists or None.
        if self.src_builder:
            source = self.src_builder_sources(env, source, overwarn)

        if self.single_source and len(source) > 1 and target is None:

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_schema03.py
83 issues
Unable to import 'wiredtiger'
Error

Line: 36 Column: 1

              
import os
import suite_random
import wiredtiger, wtscenario, wttest
from wtscenario import make_scenarios

try:
    # Windows does not getrlimit/setrlimit so we must catch the resource
    # module load

            

Reported by Pylint.

Instance of 'tabconfig' has no 'recno' member
Error

Line: 87 Column: 29

                          elif format == 'i':
                keys.append(rev)
            elif format == 'r':
                keys.append(self.recno(i+1))
        return keys

    def gen_values(self, i):
        vals = []
        # ASSUME: each format is 1 char

            

Reported by Pylint.

Value 'self.SHOW_PYTHON_ONLY_TABLE' doesn't support membership test
Error

Line: 321 Column: 77

              
    def show_python(self, s):
        if self.SHOW_PYTHON:
            if self.SHOW_PYTHON_ONLY_TABLE == None or self.current_table in self.SHOW_PYTHON_ONLY_TABLE:
                if self.SHOW_PYTHON_ONLY_SCEN == None or self.scenario_number in self.SHOW_PYTHON_ONLY_SCEN:
                    print('        ' + s)

    def join_names(self, sep, prefix, list):
        return sep.join([prefix + str(val) for val in list])

            

Reported by Pylint.

Value 'self.SHOW_PYTHON_ONLY_SCEN' doesn't support membership test
Error

Line: 322 Column: 82

                  def show_python(self, s):
        if self.SHOW_PYTHON:
            if self.SHOW_PYTHON_ONLY_TABLE == None or self.current_table in self.SHOW_PYTHON_ONLY_TABLE:
                if self.SHOW_PYTHON_ONLY_SCEN == None or self.scenario_number in self.SHOW_PYTHON_ONLY_SCEN:
                    print('        ' + s)

    def join_names(self, sep, prefix, list):
        return sep.join([prefix + str(val) for val in list])


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 36 Column: 1

              
import os
import suite_random
import wiredtiger, wtscenario, wttest
from wtscenario import make_scenarios

try:
    # Windows does not getrlimit/setrlimit so we must catch the resource
    # module load

            

Reported by Pylint.

Unused make_scenarios imported from wtscenario
Error

Line: 37 Column: 1

              import os
import suite_random
import wiredtiger, wtscenario, wttest
from wtscenario import make_scenarios

try:
    # Windows does not getrlimit/setrlimit so we must catch the resource
    # module load
    import resource

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 43 Column: 1

                  # Windows does not getrlimit/setrlimit so we must catch the resource
    # module load
    import resource
except:
    None

# test_schema03.py
#    Bigger, more 'randomly generated' schemas and data.
#    This test is complex.  If it fails, rerun with modified values for

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 44 Column: 5

                  # module load
    import resource
except:
    None

# test_schema03.py
#    Bigger, more 'randomly generated' schemas and data.
#    This test is complex.  If it fails, rerun with modified values for
# SHOW_PYTHON* variables.

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 50 Column: 36

              #    Bigger, more 'randomly generated' schemas and data.
#    This test is complex.  If it fails, rerun with modified values for
# SHOW_PYTHON* variables.
def extract_random_from_list(rand, list):
    pos = rand.rand_range(0, len(list))
    result = list[pos]
    list = list[:pos] + list[pos+1:]
    return (result, list)


            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 81 Column: 13

                      rev = int((str(addmod))[::-1])
        keys = []
        # ASSUME: each format is 1 char
        for format in self.keyformats:
            if format == 'S':
                keys.append(str(rev))
            elif format == 'i':
                keys.append(rev)
            elif format == 'r':

            

Reported by Pylint.

src/third_party/scons-3.1.2/sconsign.py
81 issues
Unable to import 'SCons.compat'
Error

Line: 184 Column: 1

              # END STANDARD SCons SCRIPT HEADER
##############################################################################

import SCons.compat

try:
    import whichdb

    whichdb = whichdb.whichdb

            

Reported by Pylint.

Unable to import 'SCons.SConsign'
Error

Line: 196 Column: 1

              import time
import pickle

import SCons.SConsign


def my_whichdb(filename):
    if filename[-7:] == ".dblite":
        return "SCons.dblite"

            

Reported by Pylint.

Unable to import 'SCons.dblite'
Error

Line: 635 Column: 17

                          if dbm_name != "SCons.dblite":
                dbm = my_import(dbm_name)
            else:
                import SCons.dblite

                dbm = SCons.dblite
                # Ensure that we don't ignore corrupt DB files,
                # this was handled by calling my_import('SCons.dblite')
                # again in earlier versions...

            

Reported by Pylint.

Unused argument 'entry'
Error

Line: 251 Column: 20

              Warns = 0


def default_mapper(entry, name):
    """
    Stringify an entry that doesn't have an explicit mapping.

    Args:
        entry:  entry

            

Reported by Pylint.

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

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

              
    """
    try:
        val = eval("entry." + name)
    except AttributeError:
        val = None
    if sys.version_info.major >= 3 and isinstance(val, bytes):
        # This is a dirty hack for py 2/3 compatibility. csig is a bytes object
        # in Python3 while Python2 bytes are str. Hence, we decode the csig to a

            

Reported by Bandit.

Use of eval
Error

Line: 263 Column: 15

              
    """
    try:
        val = eval("entry." + name)
    except AttributeError:
        val = None
    if sys.version_info.major >= 3 and isinstance(val, bytes):
        # This is a dirty hack for py 2/3 compatibility. csig is a bytes object
        # in Python3 while Python2 bytes are str. Hence, we decode the csig to a

            

Reported by Pylint.

Using the global statement
Error

Line: 332 Column: 9

                      return None

    if len(bkids) != len(bkidsigs):
        global Warns
        Warns += 1
        # add warning to result rather than direct print so it will line up
        msg = "Warning: missing information, {} ids but {} sigs"
        result = [msg.format(len(bkids), len(bkidsigs))]
    else:

            

Reported by Pylint.

Redefining name 'msg' from outer scope (line 54)
Error

Line: 335 Column: 9

                      global Warns
        Warns += 1
        # add warning to result rather than direct print so it will line up
        msg = "Warning: missing information, {} ids but {} sigs"
        result = [msg.format(len(bkids), len(bkidsigs))]
    else:
        result = []
    result += [nodeinfo_string(bkid, bkidsig, "        ")
               for bkid, bkidsig in zip(bkids, bkidsigs)]

            

Reported by Pylint.

Unused argument 'prefix'
Error

Line: 368 Column: 31

                  return val


def nodeinfo_raw(name, ninfo, prefix=""):
    # This just formats the dictionary, which we would normally use str()
    # to do, except that we want the keys sorted for deterministic output.
    d = ninfo.__getstate__()
    try:
        keys = ninfo.field_list + ['_version_id']

            

Reported by Pylint.

Redefining name 'd' from outer scope (line 100)
Error

Line: 371 Column: 5

              def nodeinfo_raw(name, ninfo, prefix=""):
    # This just formats the dictionary, which we would normally use str()
    # to do, except that we want the keys sorted for deterministic output.
    d = ninfo.__getstate__()
    try:
        keys = ninfo.field_list + ['_version_id']
    except AttributeError:
        keys = sorted(d.keys())
    l = []

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/test_test_protocol2.py
80 issues
Unable to import 'testtools'
Error

Line: 20 Column: 1

              from io import BytesIO
import datetime

from testtools import TestCase
from testtools.matchers import Contains, HasLength
from testtools.tests.test_testresult import TestStreamResultContract
from testtools.testresult.doubles import StreamResult

import subunit

            

Reported by Pylint.

Unable to import 'testtools.matchers'
Error

Line: 21 Column: 1

              import datetime

from testtools import TestCase
from testtools.matchers import Contains, HasLength
from testtools.tests.test_testresult import TestStreamResultContract
from testtools.testresult.doubles import StreamResult

import subunit
import subunit.iso8601 as iso8601

            

Reported by Pylint.

Unable to import 'testtools.tests.test_testresult'
Error

Line: 22 Column: 1

              
from testtools import TestCase
from testtools.matchers import Contains, HasLength
from testtools.tests.test_testresult import TestStreamResultContract
from testtools.testresult.doubles import StreamResult

import subunit
import subunit.iso8601 as iso8601


            

Reported by Pylint.

Unable to import 'testtools.testresult.doubles'
Error

Line: 23 Column: 1

              from testtools import TestCase
from testtools.matchers import Contains, HasLength
from testtools.tests.test_testresult import TestStreamResultContract
from testtools.testresult.doubles import StreamResult

import subunit
import subunit.iso8601 as iso8601

CONSTANT_ENUM = b'\xb3)\x01\x0c\x03foo\x08U_\x1b'

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 63 Column: 38

                  def test_numbers(self):
        result = subunit.StreamResultToBytes(BytesIO())
        packet = []
        self.assertRaises(Exception, result._write_number, -1, packet)
        self.assertEqual([], packet)
        result._write_number(0, packet)
        self.assertEqual([b'\x00'], packet)
        del packet[:]
        result._write_number(63, packet)

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 65 Column: 9

                      packet = []
        self.assertRaises(Exception, result._write_number, -1, packet)
        self.assertEqual([], packet)
        result._write_number(0, packet)
        self.assertEqual([b'\x00'], packet)
        del packet[:]
        result._write_number(63, packet)
        self.assertEqual([b'\x3f'], packet)
        del packet[:]

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 68 Column: 9

                      result._write_number(0, packet)
        self.assertEqual([b'\x00'], packet)
        del packet[:]
        result._write_number(63, packet)
        self.assertEqual([b'\x3f'], packet)
        del packet[:]
        result._write_number(64, packet)
        self.assertEqual([b'\x40\x40'], packet)
        del packet[:]

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 71 Column: 9

                      result._write_number(63, packet)
        self.assertEqual([b'\x3f'], packet)
        del packet[:]
        result._write_number(64, packet)
        self.assertEqual([b'\x40\x40'], packet)
        del packet[:]
        result._write_number(16383, packet)
        self.assertEqual([b'\x7f\xff'], packet)
        del packet[:]

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 74 Column: 9

                      result._write_number(64, packet)
        self.assertEqual([b'\x40\x40'], packet)
        del packet[:]
        result._write_number(16383, packet)
        self.assertEqual([b'\x7f\xff'], packet)
        del packet[:]
        result._write_number(16384, packet)
        self.assertEqual([b'\x80\x40', b'\x00'], packet)
        del packet[:]

            

Reported by Pylint.

Access to a protected member _write_number of a client class
Error

Line: 77 Column: 9

                      result._write_number(16383, packet)
        self.assertEqual([b'\x7f\xff'], packet)
        del packet[:]
        result._write_number(16384, packet)
        self.assertEqual([b'\x80\x40', b'\x00'], packet)
        del packet[:]
        result._write_number(4194303, packet)
        self.assertEqual([b'\xbf\xff', b'\xff'], packet)
        del packet[:]

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/msgmerge.py
80 issues
Unused argument 'kw'
Error

Line: 45 Column: 1

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

#############################################################################
def _POUpdateBuilder(env, **kw):
  """ Create an object of `POUpdate` builder """
  import SCons.Action
  from SCons.Tool.GettextCommon import _POFileBuilder
  action = SCons.Action.Action(_update_or_init_po_files, None)
  return _POFileBuilder(env, action=action, target_alias='$POUPDATE_ALIAS')

            

Reported by Pylint.

Access to a protected member _POUpdateBuilder of a client class
Error

Line: 66 Column: 10

                  else:
      domain = 'messages'
    source = [ domain ] # NOTE: Suffix shall be appended automatically
  return env._POUpdateBuilder(target, source, **kw)
#############################################################################

#############################################################################
def generate(env,**kw):
  """ Generate the `msgmerge` tool """

            

Reported by Pylint.

Unused argument 'kw'
Error

Line: 70 Column: 1

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

#############################################################################
def generate(env,**kw):
  """ Generate the `msgmerge` tool """
  import sys
  import os
  import SCons.Tool
  from SCons.Tool.GettextCommon import _detect_msgmerge

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 88 Column: 3

                        SCons.Warnings.Warning('msgmerge tool requested, but binary not found in ENV PATH')
  try:
    env['MSGMERGE'] = _detect_msgmerge(env)
  except:
    env['MSGMERGE'] = 'msgmerge'
  env.SetDefault(
    POTSUFFIX = ['.pot'],
    POSUFFIX = ['.po'],
    MSGMERGECOM = '$MSGMERGE  $MSGMERGEFLAGS --update $TARGET $SOURCE',

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 109 Column: 3

                from SCons.Tool.GettextCommon import _msgmerge_exists
  try:
    return  _msgmerge_exists(env)
  except:
    return False
#############################################################################

# Local Variables:
# tab-width:4

            

Reported by Pylint.

Trailing whitespace
Error

Line: 1 Column: 19

              """ msgmerget tool 

Tool specific initialization for `msgmerge` tool.
"""

# Copyright (c) 2001 - 2019 The SCons Foundation
# 
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the

            

Reported by Pylint.

Trailing whitespace
Error

Line: 7 Column: 2

              """

# Copyright (c) 2001 - 2019 The SCons Foundation
# 
# 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

            

Reported by Pylint.

Trailing whitespace
Error

Line: 15 Column: 2

              # 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:
# 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

            

Reported by Pylint.

Trailing whitespace
Error

Line: 18 Column: 2

              # 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION

            

Reported by Pylint.

Line too long (119/100)
Error

Line: 27 Column: 1

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

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

#############################################################################
def _update_or_init_po_files(target, source, env):
  """ Action function for `POUpdate` builder """
  import SCons.Action

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_add.c
80 issues
Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 663 CWE codes: 758

              	  if (C2_lo >= 0x0020000000000000ull) {	// y >= 2^53
	    // split the 64-bit value in two 32-bit halves to avoid 
	    // rounding errors
            tmp2.d = (double) (C2_lo >> 32);	// exact conversion
            y_nr_bits = 
                32 + ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);
	  } else {	// if y < 2^53
	    tmp2.d = (double) C2_lo;	// exact conversion
	    y_nr_bits =

            

Reported by Cppcheck.

Shifting 32-bit value by 52 bits is undefined behaviour
Error

Line: 665 CWE codes: 758

              	    // rounding errors
            tmp2.d = (double) (C2_lo >> 32);	// exact conversion
            y_nr_bits = 
                32 + ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);
	  } else {	// if y < 2^53
	    tmp2.d = (double) C2_lo;	// exact conversion
	    y_nr_bits =
	      ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);
	  }

            

Reported by Cppcheck.

Shifting 32-bit value by 52 bits is undefined behaviour
Error

Line: 669 CWE codes: 758

              	  } else {	// if y < 2^53
	    tmp2.d = (double) C2_lo;	// exact conversion
	    y_nr_bits =
	      ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);
	  }
	} else {	// C2_hi != 0 => nr. bits = 64 + nr_bits (C2_hi)
	  tmp2.d = (double) C2_hi;	// exact conversion
	  y_nr_bits =
	    64 + ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);

            

Reported by Cppcheck.

Shifting 32-bit value by 52 bits is undefined behaviour
Error

Line: 674 CWE codes: 758

              	} else {	// C2_hi != 0 => nr. bits = 64 + nr_bits (C2_hi)
	  tmp2.d = (double) C2_hi;	// exact conversion
	  y_nr_bits =
	    64 + ((((unsigned int) (tmp2.ui64 >> 52)) & 0x7ff) - 0x3ff);
	}
	q2 = bid_nr_digits[y_nr_bits].digits;
	if (q2 == 0) {
	  q2 = bid_nr_digits[y_nr_bits].digits1;
	  if (C2_hi > bid_nr_digits[y_nr_bits].threshold_hi ||

            

Reported by Cppcheck.

Shifting 32-bit value by 49 bits is undefined behaviour
Error

Line: 687 CWE codes: 758

              	// return (C2 * 10^scale) * 10^(y_exp - scale)
	// where scale = min (P34-q2, y_exp-x_exp)
	scale = P34 - q2;
	ind = (y_exp - x_exp) >> 49;
	if (ind < scale)
	  scale = ind;
	if (scale == 0) {
	  res.w[1] = y.w[1];
	  res.w[0] = y.w[0];

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 696 CWE codes: 758

              	} else if (q2 <= 19) {	// y fits in 64 bits 
	  if (scale <= 19) {	// 10^scale fits in 64 bits
	    // 64 x 64 C2_lo * bid_ten2k64[scale]
	    __mul_64x64_to_128MACH (res, C2_lo, bid_ten2k64[scale]);
	  } else {	// 10^scale fits in 128 bits
	    // 64 x 128 C2_lo * bid_ten2k128[scale - 20]
	    __mul_128x64_to_128 (res, C2_lo, bid_ten2k128[scale - 20]);
	  }
	} else {	// y fits in 128 bits, but 10^scale must fit in 64 bits 

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 699 CWE codes: 758

              	    __mul_64x64_to_128MACH (res, C2_lo, bid_ten2k64[scale]);
	  } else {	// 10^scale fits in 128 bits
	    // 64 x 128 C2_lo * bid_ten2k128[scale - 20]
	    __mul_128x64_to_128 (res, C2_lo, bid_ten2k128[scale - 20]);
	  }
	} else {	// y fits in 128 bits, but 10^scale must fit in 64 bits 
	  // 64 x 128 bid_ten2k64[scale] * C2
	  C2.w[1] = C2_hi;
	  C2.w[0] = C2_lo;

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 705 CWE codes: 758

              	  // 64 x 128 bid_ten2k64[scale] * C2
	  C2.w[1] = C2_hi;
	  C2.w[0] = C2_lo;
	  __mul_128x64_to_128 (res, bid_ten2k64[scale], C2);
	}
	// subtract scale from the exponent
	y_exp = y_exp - ((BID_UINT64) scale << 49);
	res.w[1] = res.w[1] | y_sign | y_exp;
      }

            

Reported by Cppcheck.

Shifting 32-bit value by 49 bits is undefined behaviour
Error

Line: 708 CWE codes: 758

              	  __mul_128x64_to_128 (res, bid_ten2k64[scale], C2);
	}
	// subtract scale from the exponent
	y_exp = y_exp - ((BID_UINT64) scale << 49);
	res.w[1] = res.w[1] | y_sign | y_exp;
      }
    }
    BID_SWAP128 (res);
    BID_RETURN (res);

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 729 CWE codes: 758

              	if (C1_lo >= 0x0020000000000000ull) {	// x >= 2^53
	  // split the 64-bit value in two 32-bit halves to avoid 
	  // rounding errors
          tmp1.d = (double) (C1_lo >> 32);	// exact conversion
          x_nr_bits =
            32 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) -
	    0x3ff);
	} else {	// if x < 2^53
	  tmp1.d = (double) C1_lo;	// exact conversion

            

Reported by Cppcheck.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/msgfmt.py
79 issues
Unused argument 'env'
Error

Line: 63 Column: 29

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

#############################################################################
def _create_mo_file_builder(env, **kw):
  """ Create builder object for `MOFiles` builder """
  import SCons.Action
  # FIXME: What factory use for source? Ours or their?
  kw['action'] = SCons.Action.Action('$MSGFMTCOM','$MSGFMTCOMSTR')
  kw['suffix'] = '$MOSUFFIX'

            

Reported by Pylint.

FIXME: What factory use for source? Ours or their?
Error

Line: 66 Column: 3

              def _create_mo_file_builder(env, **kw):
  """ Create builder object for `MOFiles` builder """
  import SCons.Action
  # FIXME: What factory use for source? Ours or their?
  kw['action'] = SCons.Action.Action('$MSGFMTCOM','$MSGFMTCOMSTR')
  kw['suffix'] = '$MOSUFFIX'
  kw['src_suffix'] = '$POSUFFIX'
  kw['src_builder'] = '_POUpdateBuilder'
  kw['single_source'] = True 

            

Reported by Pylint.

Unused argument 'kw'
Error

Line: 76 Column: 1

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

#############################################################################
def generate(env,**kw):
  """ Generate `msgfmt` tool """
  import sys
  import os
  import SCons.Util
  import SCons.Tool

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 96 Column: 3

              
  try:
    env['MSGFMT'] = _detect_msgfmt(env)
  except:
    env['MSGFMT'] = 'msgfmt'
  env.SetDefault(
    MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ],
    MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE',
    MSGFMTCOMSTR = '',

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 114 Column: 3

                from SCons.Tool.GettextCommon import _msgfmt_exists
  try:
    return _msgfmt_exists(env)
  except:
    return False
#############################################################################

# Local Variables:
# tab-width:4

            

Reported by Pylint.

Trailing whitespace
Error

Line: 4 Column: 2

              """ msgfmt tool """

# Copyright (c) 2001 - 2019 The SCons Foundation
# 
# 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

            

Reported by Pylint.

Trailing whitespace
Error

Line: 12 Column: 2

              # 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:
# 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

            

Reported by Pylint.

Trailing whitespace
Error

Line: 15 Column: 2

              # 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION

            

Reported by Pylint.

Line too long (117/100)
Error

Line: 24 Column: 1

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

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

from SCons.Builder import BuilderBase
#############################################################################
class _MOFileBuilder(BuilderBase):
  """ The builder class for `MO` files.

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 29 Column: 1

              from SCons.Builder import BuilderBase
#############################################################################
class _MOFileBuilder(BuilderBase):
  """ The builder class for `MO` files.
  
  The reason for this builder to exists and its purpose is quite simillar 
  as for `_POFileBuilder`. This time, we extend list of sources, not targets,
  and call `BuilderBase._execute()` only once (as we assume single-target
  here).

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/multi_btree_heavy_stress.py
79 issues
Unable to import 'wiredtiger'
Error

Line: 41 Column: 1

              # Run time, #ops, #threads are ratcheted way down for testing.
#
from runner import *
from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 42 Column: 1

              #
from runner import *
from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op
    else:

            

Reported by Pylint.

function already defined line 40
Error

Line: 44 Column: 1

              from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op
    else:
        ops += op
    return ops

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 53 Column: 16

              
def make_op(optype, table, key, value = None):
    if value == None:
        return Operation(optype, table, key)
    else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 55 Column: 16

                  if value == None:
        return Operation(optype, table, key)
    else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None

            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 57 Column: 10

                  else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None
    nops = 0
    for table in tables:

            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 57 Column: 14

                  else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None
    nops = 0
    for table in tables:

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 78 Column: 11

                          ops = op_append(ops, t)
    return ops

context = Context()
## cache_size=20GB
conn_config="create,cache_size=1GB,session_max=1000,eviction=(threads_min=4,threads_max=8),log=(enabled=false),transaction_sync=(enabled=false),checkpoint_sync=true,checkpoint=(wait=60),statistics=(fast),statistics_log=(json,wait=1)"
table_config="allocation_size=4k,memory_page_max=10MB,prefix_compression=false,split_pct=90,leaf_page_max=32k,internal_page_max=16k,type=file,block_compressor=snappy"
conn_config += extensions_config(['compressors/snappy'])
conn = context.wiredtiger_open(conn_config)

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 90 Column: 19

              for i in range(0, 8):
    tname = "table:test" + str(i)
    s.create(tname, 'key_format=S,value_format=S,' + table_config)
    tables.append(Table(tname))
tname = "table:log"
# TODO: use table_config for the log file?
s.create(tname, 'key_format=S,value_format=S,' + table_config)
logtable = Table(tname)


            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 94 Column: 12

              tname = "table:log"
# TODO: use table_config for the log file?
s.create(tname, 'key_format=S,value_format=S,' + table_config)
logtable = Table(tname)

##icount=200000000 // 8
icount=20000
ins_ops = operations(Operation.OP_INSERT, tables, Key(Key.KEYGEN_APPEND, 20), Value(500))
thread = Thread(ins_ops * icount)

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/maintain_low_dirty_cache.py
78 issues
Unable to import 'wiredtiger'
Error

Line: 43 Column: 1

              # run on.
#
from runner import *
from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 44 Column: 1

              #
from runner import *
from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op
    else:

            

Reported by Pylint.

function already defined line 42
Error

Line: 46 Column: 1

              from wiredtiger import *
from workgen import *

def op_append(ops, op):
    if ops == None:
        ops = op
    else:
        ops += op
    return ops

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 55 Column: 16

              
def make_op(optype, table, key, value = None):
    if value == None:
        return Operation(optype, table, key)
    else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 57 Column: 16

                  if value == None:
        return Operation(optype, table, key)
    else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None

            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 59 Column: 10

                  else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None
    nops = 0
    for table in tables:

            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 59 Column: 14

                  else:
        return Operation(optype, table, key, value)

logkey = Key(Key.KEYGEN_APPEND, 8)  ## should be 8 bytes format 'Q'
def operations(optype, tables, key, value = None, ops_per_txn = 0, logtable = None):
    txn_list = []
    ops = None
    nops = 0
    for table in tables:

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 80 Column: 11

                          ops = op_append(ops, t)
    return ops

context = Context()
conn_config="create,cache_size=2GB,session_max=1000,eviction=(threads_min=4,threads_max=8),log=(enabled=false),transaction_sync=(enabled=false),checkpoint_sync=true,checkpoint=(wait=8),statistics=(fast),statistics_log=(json,wait=1)"
table_config="allocation_size=4k,memory_page_max=10MB,prefix_compression=false,split_pct=90,leaf_page_max=32k,internal_page_max=16k,type=file,block_compressor=snappy"
conn_config += extensions_config(['compressors/snappy'])
conn = context.wiredtiger_open(conn_config)
s = conn.open_session()

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 91 Column: 19

              for i in range(0, 8):
    tname = "table:test" + str(i)
    s.create(tname, 'key_format=S,value_format=S,' + table_config)
    tables.append(Table(tname))
tname = "table:log"
s.create(tname, 'key_format=S,value_format=S,' + table_config)
logtable = Table(tname)

icount=1000000

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 94 Column: 12

                  tables.append(Table(tname))
tname = "table:log"
s.create(tname, 'key_format=S,value_format=S,' + table_config)
logtable = Table(tname)

icount=1000000
ins_ops = operations(Operation.OP_INSERT, tables, Key(Key.KEYGEN_APPEND, 20), Value(500))
thread = Thread(ins_ops * icount)
pop_workload = Workload(context, thread)

            

Reported by Pylint.