The following issues were found
src/third_party/wiredtiger/test/3rdparty/discover-0.4.0/discover.py
63 issues
Line: 24
Column: 20
if hasattr(types, 'ClassType'):
class_types = (types.ClassType, type)
else:
# for Python 3.0 compatibility
class_types = type
def _CmpToKey(mycmp):
Reported by Pylint.
Line: 348
Column: 34
start_list = os.path.abspath(start).split(os.path.sep)
path_list = os.path.abspath(path).split(os.path.sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = os.path.splitunc(path)
unc_start, rest = os.path.splitunc(start)
if bool(unc_path) ^ bool(unc_start):
raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
% (path, start))
else:
Reported by Pylint.
Line: 348
Column: 34
start_list = os.path.abspath(start).split(os.path.sep)
path_list = os.path.abspath(path).split(os.path.sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = os.path.splitunc(path)
unc_start, rest = os.path.splitunc(start)
if bool(unc_path) ^ bool(unc_start):
raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
% (path, start))
else:
Reported by Pylint.
Line: 349
Column: 35
path_list = os.path.abspath(path).split(os.path.sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = os.path.splitunc(path)
unc_start, rest = os.path.splitunc(start)
if bool(unc_path) ^ bool(unc_start):
raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
% (path, start))
else:
raise ValueError("path is on drive %s, start on drive %s"
Reported by Pylint.
Line: 349
Column: 35
path_list = os.path.abspath(path).split(os.path.sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = os.path.splitunc(path)
unc_start, rest = os.path.splitunc(start)
if bool(unc_path) ^ bool(unc_start):
raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
% (path, start))
else:
raise ValueError("path is on drive %s, start on drive %s"
Reported by Pylint.
Line: 9
Column: 1
# Licensed under the BSD License
# See: http://pypi.python.org/pypi/discover
import optparse
import os
import re
import sys
import traceback
import types
Reported by Pylint.
Line: 99
Column: 5
loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
return loaded_suite
def loadTestsFromModule(self, module, use_load_tests=True):
"""Return a suite of all tests cases contained in the given module"""
tests = []
for name in dir(module):
obj = getattr(module, name)
if isinstance(obj, type) and issubclass(obj, unittest.TestCase):
Reported by Pylint.
Line: 112
Column: 13
if use_load_tests and load_tests is not None:
try:
return load_tests(self, tests, None)
except:
ExceptionClass, e = sys.exc_info()[:2]
if not isinstance(e, Exception):
# for BaseException exceptions
raise
return _make_failed_load_tests(module.__name__, e,
Reported by Pylint.
Line: 113
Column: 17
try:
return load_tests(self, tests, None)
except:
ExceptionClass, e = sys.exc_info()[:2]
if not isinstance(e, Exception):
# for BaseException exceptions
raise
return _make_failed_load_tests(module.__name__, e,
self.suiteClass)
Reported by Pylint.
Line: 273
Column: 5
# override this method to use alternative matching strategy
return fnmatch(path, pattern)
def _find_tests(self, start_dir, pattern):
"""Used by discovery. Yields test suites it loads."""
paths = os.listdir(start_dir)
for path in paths:
full_path = os.path.join(start_dir, path)
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_div.c
63 issues
Line: 137
CWE codes:
758
}
if (((y & INFINITY_MASK64) != INFINITY_MASK64)) {
if ((y & SPECIAL_ENCODING_MASK64) == SPECIAL_ENCODING_MASK64)
exponent_y = ((BID_UINT32) (y >> 51)) & 0x3ff;
else
exponent_y = ((BID_UINT32) (y >> 53)) & 0x3ff;
sign_y = y & 0x8000000000000000ull;
exponent_x = exponent_x - exponent_y + DECIMAL_EXPONENT_BIAS;
Reported by Cppcheck.
Line: 139
CWE codes:
758
if ((y & SPECIAL_ENCODING_MASK64) == SPECIAL_ENCODING_MASK64)
exponent_y = ((BID_UINT32) (y >> 51)) & 0x3ff;
else
exponent_y = ((BID_UINT32) (y >> 53)) & 0x3ff;
sign_y = y & 0x8000000000000000ull;
exponent_x = exponent_x - exponent_y + DECIMAL_EXPONENT_BIAS;
if (exponent_x > DECIMAL_MAX_EXPON_64)
exponent_x = DECIMAL_MAX_EXPON_64;
Reported by Cppcheck.
Line: 147
CWE codes:
758
exponent_x = DECIMAL_MAX_EXPON_64;
else if (exponent_x < 0)
exponent_x = 0;
BID_RETURN_VAL ((sign_x ^ sign_y) | (((BID_UINT64) exponent_x) << 53));
}
}
if (!valid_y) {
// y is Inf. or NaN
Reported by Cppcheck.
Line: 192
CWE codes:
758
temp_b.d = (double) B;
// compare A, B
DU = (A - B) >> 63;
ed1 = 15 + (int) DU;
ed2 = bid_estimate_decimal_digits[bin_index] + ed1;
T = bid_power10_table_128[ed1].w[0];
__mul_64x64_to_128 (CA, A, T);
Reported by Cppcheck.
Line: 196
CWE codes:
758
ed1 = 15 + (int) DU;
ed2 = bid_estimate_decimal_digits[bin_index] + ed1;
T = bid_power10_table_128[ed1].w[0];
__mul_64x64_to_128 (CA, A, T);
Q = 0;
diff_expon = diff_expon - ed2;
// adjust double precision db, to ensure that later A/B - (int)(da/db) > -1
Reported by Cppcheck.
Line: 223
CWE codes:
758
R = coefficient_x - coefficient_y * Q;
// will use to get number of dec. digits of Q
bin_expon_cx = (tempq.i >> 52) - 0x3ff;
// R<0 ?
D = ((BID_SINT64) R) >> 63;
Q += D;
R += (coefficient_y & D);
Reported by Cppcheck.
Line: 226
CWE codes:
758
bin_expon_cx = (tempq.i >> 52) - 0x3ff;
// R<0 ?
D = ((BID_SINT64) R) >> 63;
Q += D;
R += (coefficient_y & D);
// exact result ?
if (((BID_SINT64) R) <= 0) {
Reported by Cppcheck.
Line: 243
CWE codes:
758
}
// get decimal digits of Q
DU = bid_power10_index_binexp[bin_expon_cx] - Q - 1;
DU >>= 63;
ed2 = 16 - bid_estimate_decimal_digits[bin_expon_cx] - (int) DU;
T = bid_power10_table_128[ed2].w[0];
__mul_64x64_to_128 (CA, R, T);
Reported by Cppcheck.
Line: 248
CWE codes:
758
ed2 = 16 - bid_estimate_decimal_digits[bin_expon_cx] - (int) DU;
T = bid_power10_table_128[ed2].w[0];
__mul_64x64_to_128 (CA, R, T);
B = coefficient_y;
Q *= bid_power10_table_128[ed2].w[0];
diff_expon -= ed2;
Reported by Cppcheck.
Line: 279
CWE codes:
758
R = CA.w[0] - Q2 * B;
// R<0 ?
D = ((BID_SINT64) R) >> 63;
Q2 += D;
R += (B & D);
// now R<6*B
Reported by Cppcheck.
src/third_party/wiredtiger/bench/workgen/runner/insert_stress.py
63 issues
Line: 31
Column: 1
#
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn_config="create,cache_size=4GB,session_max=1000,eviction=(threads_min=4,threads_max=8),log=(enabled=false),transaction_sync=(enabled=false),checkpoint_sync=true,checkpoint=(wait=10),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"
Reported by Pylint.
Line: 32
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn_config="create,cache_size=4GB,session_max=1000,eviction=(threads_min=4,threads_max=8),log=(enabled=false),transaction_sync=(enabled=false),checkpoint_sync=true,checkpoint=(wait=10),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 = context.wiredtiger_open(conn_config)
Reported by Pylint.
Line: 34
Column: 11
from wiredtiger import *
from workgen import *
context = Context()
conn_config="create,cache_size=4GB,session_max=1000,eviction=(threads_min=4,threads_max=8),log=(enabled=false),transaction_sync=(enabled=false),checkpoint_sync=true,checkpoint=(wait=10),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 = context.wiredtiger_open(conn_config)
s = conn.open_session()
tname = "file:test.wt"
Reported by Pylint.
Line: 42
Column: 9
tname = "file:test.wt"
table_config="key_format=S,value_format=S,allocation_size=4k,memory_page_max=10MB,prefix_compression=false,split_pct=90,leaf_page_max=32k,leaf_value_max=64MB,internal_page_max=16k,type=file,block_compressor=snappy"
s.create(tname, table_config)
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 130 * 1024
table.options.range = 100000000 # 100 million
op = Operation(Operation.OP_INSERT, table)
Reported by Pylint.
Line: 47
Column: 6
table.options.value_size = 130 * 1024
table.options.range = 100000000 # 100 million
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 47
Column: 16
table.options.value_size = 130 * 1024
table.options.range = 100000000 # 100 million
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 48
Column: 10
table.options.range = 100000000 # 100 million
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(130 * 1024))
Reported by Pylint.
Line: 49
Column: 16
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(130 * 1024))
op2 = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(100))
Reported by Pylint.
Line: 53
Column: 73
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(130 * 1024))
op2 = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(100))
op3 = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_APPEND, 10), Value(130 * 1024))
t = Thread(op + 10 * op2 + op3)
read_op = Operation(Operation.OP_SEARCH, table, Key(Key.KEYGEN_UNIFORM, 10))
Reported by Pylint.
Line: 53
Column: 44
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(130 * 1024))
op2 = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_UNIFORM, 10), Value(100))
op3 = Operation(Operation.OP_INSERT, table, Key(Key.KEYGEN_APPEND, 10), Value(130 * 1024))
t = Thread(op + 10 * op2 + op3)
read_op = Operation(Operation.OP_SEARCH, table, Key(Key.KEYGEN_UNIFORM, 10))
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/wasm/WasmIonCompile.cpp
63 issues
Line: 778
Column: 47
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
// Only sets *mustAdd if it also returns true.
bool needAlignmentCheck(MemoryAccessDesc* access, MDefinition* base, bool* mustAdd) {
MOZ_ASSERT(!*mustAdd);
// asm.js accesses are always aligned and need no checks.
if (env_.isAsmJS() || !access->isAtomic())
return false;
Reported by FlawFinder.
Line: 796
Column: 61
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
return true;
}
void checkOffsetAndAlignmentAndBounds(MemoryAccessDesc* access, MDefinition** base)
{
MOZ_ASSERT(!inDeadCode());
// Fold a constant base into the offset (so the base is 0 in which case
// the codegen is optimized), if it doesn't wrap or trigger an
Reported by FlawFinder.
Line: 819
Column: 50
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
bool mustAdd = false;
bool alignmentCheck = needAlignmentCheck(access, *base, &mustAdd);
// If the offset is bigger than the guard region, a separate instruction
// is necessary to add the offset to the base and check for overflow.
//
// Also add the offset if we have a Wasm atomic access that needs
Reported by FlawFinder.
Line: 827
Column: 52
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// Also add the offset if we have a Wasm atomic access that needs
// alignment checking and the offset affects alignment.
if (access->offset() >= OffsetGuardLimit || mustAdd || !JitOptions.wasmFoldOffsets)
*base = computeEffectiveAddress(*base, access);
if (alignmentCheck) {
curBlock_->add(MWasmAlignmentCheck::New(alloc(), *base, access->byteSize(),
bytecodeOffset()));
}
Reported by FlawFinder.
Line: 843
Column: 72
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
}
bool isSmallerAccessForI64(ValType result, const MemoryAccessDesc* access) {
if (result == ValType::I64 && access->byteSize() <= 4) {
// These smaller accesses should all be zero-extending.
MOZ_ASSERT(!isSignedIntType(access->type()));
return true;
}
Reported by FlawFinder.
Line: 853
Column: 79
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
public:
MDefinition* computeEffectiveAddress(MDefinition* base, MemoryAccessDesc* access) {
MOZ_ASSERT(!access->isPlainAsmJS());
if (inDeadCode())
return nullptr;
if (!access->offset())
return base;
Reported by FlawFinder.
Line: 886
Column: 60
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
return true;
}
MDefinition* load(MDefinition* base, MemoryAccessDesc* access, ValType result)
{
if (inDeadCode())
return nullptr;
MWasmLoadTls* memoryBase = maybeLoadMemoryBase();
Reported by FlawFinder.
Line: 898
Column: 46
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MWasmLoadTls* boundsCheckLimit = maybeLoadBoundsCheckLimit();
load = MAsmJSLoadHeap::New(alloc(), memoryBase, base, boundsCheckLimit, access->type());
} else {
checkOffsetAndAlignmentAndBounds(access, &base);
load = MWasmLoad::New(alloc(), memoryBase, base, *access, ToMIRType(result));
}
if (!load)
return nullptr;
curBlock_->add(load);
Reported by FlawFinder.
Line: 899
Column: 63
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
load = MAsmJSLoadHeap::New(alloc(), memoryBase, base, boundsCheckLimit, access->type());
} else {
checkOffsetAndAlignmentAndBounds(access, &base);
load = MWasmLoad::New(alloc(), memoryBase, base, *access, ToMIRType(result));
}
if (!load)
return nullptr;
curBlock_->add(load);
return load;
Reported by FlawFinder.
Line: 907
Column: 53
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
return load;
}
void store(MDefinition* base, MemoryAccessDesc* access, MDefinition* v)
{
if (inDeadCode())
return;
MWasmLoadTls* memoryBase = maybeLoadMemoryBase();
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/devtools/rootAnalysis/analyze.py
62 issues
Line: 21
Column: 51
# Python 2/3 version independence polyfills
anystring_t = str if sys.version_info[0] > 2 else basestring
try:
execfile
except:
def execfile(thefile, globals):
Reported by Pylint.
Line: 25
Column: 1
try:
execfile
except:
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
def env(config):
e = dict(os.environ)
Reported by Pylint.
Line: 26
Column: 27
try:
execfile
except:
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
def env(config):
e = dict(os.environ)
e['PATH'] = ':'.join(p for p in (config.get('gcc_bin'), config.get('sixgill_bin'), e['PATH']) if p)
Reported by Pylint.
Line: 27
Column: 9
execfile
except:
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
def env(config):
e = dict(os.environ)
e['PATH'] = ':'.join(p for p in (config.get('gcc_bin'), config.get('sixgill_bin'), e['PATH']) if p)
e['XDB'] = '%(sixgill_bin)s/xdb.so' % config
Reported by Pylint.
Line: 27
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
execfile
except:
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
def env(config):
e = dict(os.environ)
e['PATH'] = ':'.join(p for p in (config.get('gcc_bin'), config.get('sixgill_bin'), e['PATH']) if p)
e['XDB'] = '%(sixgill_bin)s/xdb.so' % config
Reported by Bandit.
Line: 29
Column: 9
def execfile(thefile, globals):
exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
def env(config):
e = dict(os.environ)
e['PATH'] = ':'.join(p for p in (config.get('gcc_bin'), config.get('sixgill_bin'), e['PATH']) if p)
e['XDB'] = '%(sixgill_bin)s/xdb.so' % config
e['SOURCE'] = config['source']
e['ANALYZED_OBJDIR'] = config['objdir']
Reported by Pylint.
Line: 39
Column: 19
e['LD_LIBRARY_PATH'] = ':'.join(p for p in (e.get('LD_LIBRARY_PATH'), bindir) if p)
return e
def fill(command, config):
try:
return tuple(s % config for s in command)
except:
print("Substitution failed:")
problems = []
Reported by Pylint.
Line: 39
Column: 10
e['LD_LIBRARY_PATH'] = ':'.join(p for p in (e.get('LD_LIBRARY_PATH'), bindir) if p)
return e
def fill(command, config):
try:
return tuple(s % config for s in command)
except:
print("Substitution failed:")
problems = []
Reported by Pylint.
Line: 48
Column: 13
for fragment in command:
try:
fragment % config
except:
problems.append(fragment)
raise Exception("\n".join(["Substitution failed:"] + [ " %s" % s for s in problems ]))
def print_command(command, outfile=None, env=None):
output = ' '.join(command)
Reported by Pylint.
Line: 50
Column: 9
fragment % config
except:
problems.append(fragment)
raise Exception("\n".join(["Substitution failed:"] + [ " %s" % s for s in problems ]))
def print_command(command, outfile=None, env=None):
output = ' '.join(command)
if outfile:
output += ' > ' + outfile
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_basic.py
62 issues
Line: 371
Column: 32
describe_examples = [
("'c' does not match /a|b/", 'c', MatchesRegex('a|b')),
("'c' does not match /a\d/", 'c', MatchesRegex(r'a\d')),
("%r does not match /\\s+\\xa7/" % (_b('c'),),
_b('c'), MatchesRegex(_b("\\s+\xA7"))),
("%r does not match /\\s+\\xa7/" % (_u('c'),),
_u('c'), MatchesRegex(_u("\\s+\xA7"))),
]
Reported by Pylint.
Line: 1
Column: 1
# Copyright (c) 2008-2012 testtools developers. See LICENSE for details.
import re
from testtools import TestCase
from testtools.compat import (
text_repr,
_b,
_u,
Reported by Pylint.
Line: 32
Column: 1
from testtools.tests.matchers.helpers import TestMatchersInterface
class Test_BinaryMismatch(TestCase):
"""Mismatches from binary comparisons need useful describe output"""
_long_string = "This is a longish multiline non-ascii string\n\xa7"
_long_b = _b(_long_string)
_long_u = _u(_long_string)
Reported by Pylint.
Line: 39
Column: 5
_long_b = _b(_long_string)
_long_u = _u(_long_string)
class CustomRepr(object):
def __init__(self, repr_string):
self._repr_string = repr_string
def __repr__(self):
return _u('<object ') + _u(self._repr_string) + _u('>')
Reported by Pylint.
Line: 39
Column: 5
_long_b = _b(_long_string)
_long_u = _u(_long_string)
class CustomRepr(object):
def __init__(self, repr_string):
self._repr_string = repr_string
def __repr__(self):
return _u('<object ') + _u(self._repr_string) + _u('>')
Reported by Pylint.
Line: 39
Column: 5
_long_b = _b(_long_string)
_long_u = _u(_long_string)
class CustomRepr(object):
def __init__(self, repr_string):
self._repr_string = repr_string
def __repr__(self):
return _u('<object ') + _u(self._repr_string) + _u('>')
Reported by Pylint.
Line: 45
Column: 5
def __repr__(self):
return _u('<object ') + _u(self._repr_string) + _u('>')
def test_short_objects(self):
o1, o2 = self.CustomRepr('a'), self.CustomRepr('b')
mismatch = _BinaryMismatch(o1, "!~", o2)
self.assertEqual(mismatch.describe(), "%r !~ %r" % (o1, o2))
def test_short_mixed_strings(self):
Reported by Pylint.
Line: 46
Column: 9
return _u('<object ') + _u(self._repr_string) + _u('>')
def test_short_objects(self):
o1, o2 = self.CustomRepr('a'), self.CustomRepr('b')
mismatch = _BinaryMismatch(o1, "!~", o2)
self.assertEqual(mismatch.describe(), "%r !~ %r" % (o1, o2))
def test_short_mixed_strings(self):
b, u = _b("\xa7"), _u("\xa7")
Reported by Pylint.
Line: 46
Column: 13
return _u('<object ') + _u(self._repr_string) + _u('>')
def test_short_objects(self):
o1, o2 = self.CustomRepr('a'), self.CustomRepr('b')
mismatch = _BinaryMismatch(o1, "!~", o2)
self.assertEqual(mismatch.describe(), "%r !~ %r" % (o1, o2))
def test_short_mixed_strings(self):
b, u = _b("\xa7"), _u("\xa7")
Reported by Pylint.
Line: 50
Column: 5
mismatch = _BinaryMismatch(o1, "!~", o2)
self.assertEqual(mismatch.describe(), "%r !~ %r" % (o1, o2))
def test_short_mixed_strings(self):
b, u = _b("\xa7"), _u("\xa7")
mismatch = _BinaryMismatch(b, "!~", u)
self.assertEqual(mismatch.describe(), "%r !~ %r" % (b, u))
def test_long_bytes(self):
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/devtools/rootAnalysis/t/sixgill-tree/test.py
62 issues
Line: 3
Column: 1
import re
test.compile("source.cpp")
test.computeGCTypes()
body = test.process_body(test.load_db_entry("src_body", re.compile(r'root_arg'))[0])
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
Reported by Pylint.
Line: 4
Column: 1
import re
test.compile("source.cpp")
test.computeGCTypes()
body = test.process_body(test.load_db_entry("src_body", re.compile(r'root_arg'))[0])
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
Reported by Pylint.
Line: 5
Column: 8
test.compile("source.cpp")
test.computeGCTypes()
body = test.process_body(test.load_db_entry("src_body", re.compile(r'root_arg'))[0])
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
Reported by Pylint.
Line: 5
Column: 26
test.compile("source.cpp")
test.computeGCTypes()
body = test.process_body(test.load_db_entry("src_body", re.compile(r'root_arg'))[0])
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
Reported by Pylint.
Line: 9
Column: 1
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
equal(body.edge_from_point(body.assignment_point('u1'))['Exp'][1]['String'], '1')
equal(body.edge_from_point(body.assignment_point('u2'))['Exp'][1]['String'], '4294967295')
Reported by Pylint.
Line: 10
Column: 1
# Rendering positive and negative integers
marker1 = body.assignment_line('MARKER1')
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
equal(body.edge_from_point(body.assignment_point('u1'))['Exp'][1]['String'], '1')
equal(body.edge_from_point(body.assignment_point('u2'))['Exp'][1]['String'], '4294967295')
assert('obj' in body['Variables'])
Reported by Pylint.
Line: 12
Column: 1
equal(body.edge_from_line(marker1 + 2)['Exp'][1]['String'], '1')
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
equal(body.edge_from_point(body.assignment_point('u1'))['Exp'][1]['String'], '1')
equal(body.edge_from_point(body.assignment_point('u2'))['Exp'][1]['String'], '4294967295')
assert('obj' in body['Variables'])
assert('random' in body['Variables'])
assert('other1' in body['Variables'])
Reported by Pylint.
Line: 13
Column: 1
equal(body.edge_from_line(marker1 + 3)['Exp'][1]['String'], '-1')
equal(body.edge_from_point(body.assignment_point('u1'))['Exp'][1]['String'], '1')
equal(body.edge_from_point(body.assignment_point('u2'))['Exp'][1]['String'], '4294967295')
assert('obj' in body['Variables'])
assert('random' in body['Variables'])
assert('other1' in body['Variables'])
assert('other2' in body['Variables'])
Reported by Pylint.
Line: 21
Column: 27
assert('other2' in body['Variables'])
# Test function annotations
js_GC = test.process_body(test.load_db_entry("src_body", re.compile(r'js_GC'))[0])
annotations = js_GC['Variables']['void js_GC()']['Annotation']
assert(annotations)
found_call_tag = False
for annotation in annotations:
(annType, value) = annotation['Name']
Reported by Pylint.
Line: 21
Column: 9
assert('other2' in body['Variables'])
# Test function annotations
js_GC = test.process_body(test.load_db_entry("src_body", re.compile(r'js_GC'))[0])
annotations = js_GC['Variables']['void js_GC()']['Annotation']
assert(annotations)
found_call_tag = False
for annotation in annotations:
(annType, value) = annotation['Name']
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_join02.py
61 issues
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, suite_random
from wtscenario import make_scenarios
# test_join02.py
# Join operations
# Join several indices together, trying all comparison combinations
Reported by Pylint.
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, suite_random
from wtscenario import make_scenarios
# test_join02.py
# Join operations
# Join several indices together, trying all comparison combinations
Reported by Pylint.
Line: 74
Column: 9
return [i, s, x, rs, f]
def reinit_joinconfig(self):
self.rand = suite_random.suite_random(self.seed)
self.seed += 1
def get_joinconfig(self):
# When we're running the bloom scenario, make it so the
# bloom filters are often shared. Make the number of
Reported by Pylint.
Line: 108
Column: 13
# ' ' + str(curleft.low) + ')')
curleft.reset()
curleft.set_key(*curleft.low)
self.assertEquals(0, curleft.search())
self.session.join(jc, curleft, 'compare=' + c0 + joinconfig)
if c0 == 'eq':
mbr = mbr.intersection(curleft.eqmembers)
elif c0 == 'ge':
mbr = mbr.intersection(
Reported by Pylint.
Line: 123
Column: 13
# ' ' + str(curright.high) + ')')
curright.reset()
curright.set_key(*curright.high)
self.assertEquals(0, curright.search())
self.session.join(jc, curright, 'compare=' + c1 + joinconfig)
if c1 == 'le':
mbr = mbr.intersection(
set(curright.eqmembers.union(curright.ltmembers)))
elif c1 == 'lt':
Reported by Pylint.
Line: 144
Column: 17
i = int(str(k0[3:]))
elif self.keyformat == 'iS':
i = k0
self.assertEquals(i, int(str(k1[3:])))
else:
i = k0
#self.tty(' iteration got key: ' + str(k0) + ',' + str(k1))
#self.tty(' iteration got values: ' + str([v0,v1,v2,v3,v4]))
#self.tty(' iteration expects values: ' + str(self.gen_values(i)))
Reported by Pylint.
Line: 150
Column: 13
#self.tty(' iteration got key: ' + str(k0) + ',' + str(k1))
#self.tty(' iteration got values: ' + str([v0,v1,v2,v3,v4]))
#self.tty(' iteration expects values: ' + str(self.gen_values(i)))
self.assertEquals(self.gen_values(i), [v0,v1,v2,v3,v4])
if not i in mbr:
self.tty(' result ' + str(i) + ' is not in: ' + str(mbr))
self.assertTrue(i in mbr)
mbr.remove(i)
self.assertEquals(0, len(mbr))
Reported by Pylint.
Line: 155
Column: 9
self.tty(' result ' + str(i) + ' is not in: ' + str(mbr))
self.assertTrue(i in mbr)
mbr.remove(i)
self.assertEquals(0, len(mbr))
def mkmbr(self, expr):
return frozenset([x for x in self.range() if expr(x)])
def test_basic_join(self):
Reported by Pylint.
Line: 161
Column: 9
return frozenset([x for x in self.range() if expr(x)])
def test_basic_join(self):
self.seed = 1
if self.keyformat == 'iS':
keycols = 'k0,k1'
else:
keycols = 'k'
self.session.create('table:join02', 'key_format=' + self.keyformat +
Reported by Pylint.
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.
src/third_party/wiredtiger/test/suite/test_join01.py
61 issues
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_join01.py
# Join operations
# Basic tests for join
Reported by Pylint.
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_join01.py
# Join operations
# Basic tests for join
Reported by Pylint.
Line: 115
Column: 17
i = k - 1
if do_proj: # our projection reverses the values and adds the key
[v2,v1,v0,kproj] = jc.get_values()
self.assertEquals(k, kproj)
else:
[v0,v1,v2] = jc.get_values()
self.assertEquals(self.gen_values(i), [v0,v1,v2])
if len(expect) == 0 or i != expect[0]:
self.tty('ERROR: ' + str(i) + ' is not next in: ' +
Reported by Pylint.
Line: 118
Column: 13
self.assertEquals(k, kproj)
else:
[v0,v1,v2] = jc.get_values()
self.assertEquals(self.gen_values(i), [v0,v1,v2])
if len(expect) == 0 or i != expect[0]:
self.tty('ERROR: ' + str(i) + ' is not next in: ' +
str(expect))
self.tty('JOIN ORDER=' + str(join_order) + ', NESTED=' + str(do_nested))
self.assertTrue(i == expect[0])
Reported by Pylint.
Line: 125
Column: 9
self.tty('JOIN ORDER=' + str(join_order) + ', NESTED=' + str(do_nested))
self.assertTrue(i == expect[0])
expect.remove(i)
self.assertEquals(0, len(expect))
# Stats are collected twice: after iterating
# through the join cursor once, and secondly after resetting
# the join cursor and iterating again.
def stats(self, jc, which):
Reported by Pylint.
Line: 130
Column: 25
# Stats are collected twice: after iterating
# through the join cursor once, and secondly after resetting
# the join cursor and iterating again.
def stats(self, jc, which):
statcur = self.session.open_cursor('statistics:join', jc, None)
# pick a stat we always expect to see
statdesc = 'bloom filter false positives'
expectstats = [
'join: index:join01:index1: ' + statdesc,
Reported by Pylint.
Line: 148
Column: 30
self.check_stats(statcur, expectstats)
statcur.close()
def statstr_to_int(self, str):
"""
Convert a statistics value string, which may be in either form:
'12345' or '33M (33604836)'
"""
parts = str.rpartition('(')
Reported by Pylint.
Line: 165
Column: 13
statcursor.reset()
self.printVerbose(3, 'statistics:')
for id, desc, valstr, val in statcursor:
self.assertEqual(type(desc), stringclass)
self.assertEqual(type(valstr), stringclass)
self.assertEqual(type(val), intclass)
self.assertEqual(val, self.statstr_to_int(valstr))
self.printVerbose(3, ' stat: \'' + desc + '\', \'' +
Reported by Pylint.
Line: 165
Column: 13
statcursor.reset()
self.printVerbose(3, 'statistics:')
for id, desc, valstr, val in statcursor:
self.assertEqual(type(desc), stringclass)
self.assertEqual(type(valstr), stringclass)
self.assertEqual(type(val), intclass)
self.assertEqual(val, self.statstr_to_int(valstr))
self.printVerbose(3, ' stat: \'' + desc + '\', \'' +
Reported by Pylint.
Line: 246
Column: 9
# Adding a projection to a reference cursor should be allowed.
c2 = self.session.open_cursor('index:join01:index2(v1)', None, None)
c2.set_key(99) # skips all entries w/ primary key divisible by three
self.assertEquals(0, c2.search())
self.session_record_join(jc, c2, 'compare=gt', 0, joins)
# Then select all the numbers 0-99 whose string representation
# sort >= '60'.
if self.ref == 'index':
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/dpml_trig_reduce.c
61 issues
Line: 312
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
* In case anything goes horribly wrong...
*/
#define fatal(message) { \
printf( "Fatal error: " message \
"\n" "aborting at line " STR(__LINE__)); \
/* exit(-1) */ \
this_assignment = indicates_a_fatal_error; \
}
Reported by FlawFinder.
Line: 717
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
p = BITS_PER_DIGIT - b; /* position of low bit of t in MSD_OF_W */
i = DIGIT_BIT(p); /* to 'add 1' at position p */
m = DIGIT_MASK(t, p); /* mask of the t bits */
printf(
MAC2 "(((MSD_OF_W + 0x%..16i) & 0x%..16i) == 0)"
MAC3, i, m-i);
} else if (BITS_PER_DIGIT <= s && b < 2*BITS_PER_DIGIT) {
/*
Reported by FlawFinder.
Line: 728
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
p = 2*BITS_PER_DIGIT - b;
i = DIGIT_BIT(p);
m = DIGIT_MASK(t, p);
printf(
MAC2 "(((SECOND_MSD_OF_W + 0x%..16i) & 0x%..16i) == 0)"
MAC3, i, m-i);
} else if (b <= 2*BITS_PER_DIGIT) {
/*
Reported by FlawFinder.
Line: 740
Column: 2
CWE codes:
134
Suggestion:
Use a constant for the format specification
i = DIGIT_BIT(p);
m = DIGIT_MASK(BITS_PER_DIGIT - p, p);
printf("( ");
printf(MAC2);
if (m == i) printf("/* ");
printf(
"(((SECOND_MSD_OF_W + 0x%..16i) & 0x%..16i) == 0)",
i, m-i);
printf(" && ");
Reported by FlawFinder.
Line: 748
Column: 2
CWE codes:
134
Suggestion:
Use a constant for the format specification
printf(" && ");
if (m == i) printf(" */");
m = DIGIT_MASK(BITS_PER_DIGIT - s, 0);
printf(
MAC2 "(("
"( ((SIGNED_DIGIT_TYPE)SECOND_MSD_OF_W >> %i) - MSD_OF_W )"
" & 0x%..16i) == 0)",
p, m);
printf(" )" MAC3);
Reported by FlawFinder.
Line: 753
Column: 2
CWE codes:
134
Suggestion:
Use a constant for the format specification
"( ((SIGNED_DIGIT_TYPE)SECOND_MSD_OF_W >> %i) - MSD_OF_W )"
" & 0x%..16i) == 0)",
p, m);
printf(" )" MAC3);
} else {
fatal("bit_loss: s + t > 2*BITS_PER_DIGIT");
}
}
Reported by FlawFinder.
Line: 997
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (BITS_PER_F_TYPE < BITS_PER_DIGIT) {
printf(MAC2 "F0 = _u.i[0] & DIGIT_MASK(%i, 0);", BITS_PER_F_TYPE);
if (needs_pdp_shuffle) printf("_PDP_SHUFFLE(F0);");
} else {
# if (ENDIANESS == big_endian) || (VAX_FLOATING)
Reported by FlawFinder.
Line: 1011
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
# endif
for (i = num_f_digits - 1; i >= 0; i--) {
printf(MAC2 "F%i = _u.i[%i]; ", i, j);
if (needs_pdp_shuffle) printf("_PDP_SHUFFLE(F%i);", i);
j += j_inc;
}
}
Reported by FlawFinder.
Line: 1018
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
}
printf(MAC2 "}");
printf(MAC3);
/*
* GET_G_DIGITS_FROM_TABLE fetches the initial digits of g
Reported by FlawFinder.
Line: 1019
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
}
printf(MAC2 "}");
printf(MAC3);
/*
* GET_G_DIGITS_FROM_TABLE fetches the initial digits of g
* (and the extra_digit) from the table.
Reported by FlawFinder.