The following issues were found
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Defaults.py
91 issues
Line: 62
Column: 1
# Lazily instantiate the default environment so the overhead of creating
# it doesn't apply when it's not needed.
def _fetch_DefaultEnvironment(*args, **kw):
"""
Returns the already-created default construction environment.
"""
global _default_env
return _default_env
Reported by Pylint.
Line: 62
Column: 1
# Lazily instantiate the default environment so the overhead of creating
# it doesn't apply when it's not needed.
def _fetch_DefaultEnvironment(*args, **kw):
"""
Returns the already-created default construction environment.
"""
global _default_env
return _default_env
Reported by Pylint.
Line: 66
Column: 5
"""
Returns the already-created default construction environment.
"""
global _default_env
return _default_env
def DefaultEnvironment(*args, **kw):
"""
Initial public entry point for creating the default construction
Reported by Pylint.
Line: 85
Column: 5
having the name originally be a something that *only* creates the
construction environment and then overwrites the name.)
"""
global _default_env
if not _default_env:
import SCons.Util
_default_env = SCons.Environment.Environment(*args, **kw)
if SCons.Util.md5:
_default_env.Decider('MD5')
Reported by Pylint.
Line: 87
Column: 9
"""
global _default_env
if not _default_env:
import SCons.Util
_default_env = SCons.Environment.Environment(*args, **kw)
if SCons.Util.md5:
_default_env.Decider('MD5')
else:
_default_env.Decider('timestamp-match')
Reported by Pylint.
Line: 93
Column: 9
_default_env.Decider('MD5')
else:
_default_env.Decider('timestamp-match')
global DefaultEnvironment
DefaultEnvironment = _fetch_DefaultEnvironment
_default_env._CacheDir_path = None
return _default_env
# Emitters for setting the shared attribute on object files,
Reported by Pylint.
Line: 95
Column: 9
_default_env.Decider('timestamp-match')
global DefaultEnvironment
DefaultEnvironment = _fetch_DefaultEnvironment
_default_env._CacheDir_path = None
return _default_env
# Emitters for setting the shared attribute on object files,
# and an action for checking that all of the source files
# going into a shared library are, in fact, shared.
Reported by Pylint.
Line: 101
Column: 41
# Emitters for setting the shared attribute on object files,
# and an action for checking that all of the source files
# going into a shared library are, in fact, shared.
def StaticObjectEmitter(target, source, env):
for tgt in target:
tgt.attributes.shared = None
return (target, source)
def SharedObjectEmitter(target, source, env):
Reported by Pylint.
Line: 106
Column: 41
tgt.attributes.shared = None
return (target, source)
def SharedObjectEmitter(target, source, env):
for tgt in target:
tgt.attributes.shared = 1
return (target, source)
def SharedFlagChecker(source, target, env):
Reported by Pylint.
Line: 191
Column: 5
}
def chmod_func(dest, mode):
import SCons.Util
from string import digits
SCons.Node.FS.invalidate_node_memos(dest)
if not SCons.Util.is_List(dest):
dest = [dest]
if SCons.Util.is_String(mode) and 0 not in [i in digits for i in mode]:
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/jit/Recover.cpp
91 issues
Line: 165
Column: 34
CWE codes:
120
20
bool
RBitNot::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue operand(cx, iter.read());
int32_t result;
if (!js::BitNot(cx, operand, &result))
return false;
Reported by FlawFinder.
Line: 190
Column: 30
CWE codes:
120
20
bool
RBitAnd::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitAnd(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 191
Column: 30
CWE codes:
120
20
RBitAnd::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitAnd(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 217
Column: 30
CWE codes:
120
20
bool
RBitOr::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitOr(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 218
Column: 30
CWE codes:
120
20
RBitOr::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitOr(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 244
Column: 30
CWE codes:
120
20
bool
RBitXor::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
if (!js::BitXor(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 245
Column: 30
CWE codes:
120
20
RBitXor::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
if (!js::BitXor(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 270
Column: 30
CWE codes:
120
20
bool
RLsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitLsh(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 271
Column: 30
CWE codes:
120
20
RLsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitLsh(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 297
Column: 30
CWE codes:
120
20
bool
RRsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
int32_t result;
if (!js::BitRsh(cx, lhs, rhs, &result))
Reported by FlawFinder.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_to_uint64.c
90 issues
Line: 109
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 110
CWE codes:
758
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 114
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 119
CWE codes:
758
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
q = bid_nr_digits[x_nr_bits - 1].digits;
if (q == 0) {
q = bid_nr_digits[x_nr_bits - 1].digits1;
if (C1.w[1] > bid_nr_digits[x_nr_bits - 1].threshold_hi
Reported by Cppcheck.
Line: 129
CWE codes:
758
&& C1.w[0] >= bid_nr_digits[x_nr_bits - 1].threshold_lo))
q++;
}
exp = (x_exp >> 49) - 6176;
if ((q + exp) > 20) { // x >= 10^20 ~= 2^66.45... (cannot fit in 64 bits)
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 178
CWE codes:
758
// <=> C * 10^(21-q) >= 0x9fffffffffffffffb, 1<=q<=34
if (q == 1) {
// C * 10^20 >= 0x9fffffffffffffffb
__mul_128x64_to_128 (C, C1.w[0], bid_ten2k128[0]); // 10^20 * C
if (C.w[1] > 0x09 || (C.w[1] == 0x09
&& C.w[0] >= 0xfffffffffffffffbull)) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 191
CWE codes:
758
// to '1 <= q + exp <= 20'
} else if (q <= 19) {
// C * 10^(21-q) >= 0x9fffffffffffffffb
__mul_64x64_to_128MACH (C, C1.w[0], bid_ten2k64[21 - q]);
if (C.w[1] > 0x09 || (C.w[1] == 0x09
&& C.w[0] >= 0xfffffffffffffffbull)) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 234
CWE codes:
758
// C >= 10^(q-21) * 0x9fffffffffffffffb max 44 bits x 68 bits
C.w[1] = 0x09;
C.w[0] = 0xfffffffffffffffbull;
__mul_128x64_to_128 (C, bid_ten2k64[q - 21], C);
if (C1.w[1] > C.w[1]
|| (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 316
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 21) { // 0 <= ind - 1 <= 21
Cstar.w[1] = P256.w[3];
Cstar.w[0] = P256.w[2];
fstar.w[3] = 0;
fstar.w[2] = P256.w[2] & bid_maskhigh128[ind - 1];
Reported by Cppcheck.
Line: 459
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
site_scons/site_tools/dagger/graph.py
90 issues
Line: 29
Column: 1
import json
import copy
from . import graph_consts
class Graph(object):
"""Graph class for storing the build dependency graph. The graph stores the
directed edges as a nested dict of { RelationshipType: {From_Node: Set of
Reported by Pylint.
Line: 230
Column: 21
else:
setattr(self, k, v)
except AttributeError as e:
logging.error("found something bad, {0}, {1}", e, type(e))
should_fail = True
if should_fail:
raise Exception("Problem setting attribute for NodeLib")
else:
self._id = id
Reported by Pylint.
Line: 353
Column: 21
else:
setattr(self, k, v)
except AttributeError as e:
logging.error("found something bad, {0}, {1}", e, type(e))
should_fail = True
if should_fail:
raise Exception("Problem setting attribute for NodeLib")
else:
Reported by Pylint.
Line: 480
Column: 21
else:
setattr(self, k, v)
except AttributeError as e:
logging.error("found something bad, {0}, {1}", e, type(e))
should_fail = True
if should_fail:
raise Exception("Problem setting attribute for NodeLib")
else:
self._id = id
Reported by Pylint.
Line: 599
Column: 21
else:
setattr(self, k, v)
except AttributeError as e:
logging.error("found something bad, {0}, {1}", e, type(e))
should_fail = True
if should_fail:
raise Exception("Problem setting attribute for NodeExe")
else:
self._id = id
Reported by Pylint.
Line: 23
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import sys
import logging
import abc
import json
import copy
Reported by Pylint.
Line: 39
Column: 24
imported from a pickle or JSON file.
"""
def __init__(self, input=None):
"""
A graph can be initialized with a .json file, graph object, or with no args
"""
if isinstance(input, str):
if input.endswith(".json"):
Reported by Pylint.
Line: 51
Column: 21
should_fail = False
for node in data["nodes"]:
id = str(node["id"])
try:
nodes[id] = node_factory(
id, int(node["node"]["type"]), dict_source=node["node"]
)
except Exception as e:
Reported by Pylint.
Line: 56
Column: 21
nodes[id] = node_factory(
id, int(node["node"]["type"]), dict_source=node["node"]
)
except Exception as e:
logging.warning("Malformed Data: " + id)
should_fail = True
if should_fail is True:
raise ValueError("json nodes are malformed")
Reported by Pylint.
Line: 56
Column: 28
nodes[id] = node_factory(
id, int(node["node"]["type"]), dict_source=node["node"]
)
except Exception as e:
logging.warning("Malformed Data: " + id)
should_fail = True
if should_fail is True:
raise ValueError("json nodes are malformed")
Reported by Pylint.
jstests/ssl/x509/mkcert.py
89 issues
Line: 9
Column: 1
"""
import argparse
import binascii
import datetime
import os
import random
import subprocess
import tempfile
from typing import Any, Dict
Reported by Pylint.
Line: 126
Column: 3
"""Set validity range for the certificate."""
not_before = idx(cert, 'not_before', None)
if not_before:
# TODO: Parse human readable dates and/or datedeltas
not_before = int(not_before)
else:
# Default last week.
not_before = -7 * 24 * 60 * 60
x509.gmtime_adj_notBefore(not_before)
Reported by Pylint.
Line: 135
Column: 3
not_after = idx(cert, 'not_after', None)
if not_after:
# TODO: Parse human readable dates and/or datedeltas
not_after = int(not_after)
else:
# Default 20 years hence.
not_after = 20 * 365 * 24 * 60 * 60
x509.gmtime_adj_notAfter(not_after)
Reported by Pylint.
Line: 371
Column: 5
def get_header_comment(cert):
if not cert.get('include_header', True):
return ''
"""Header comment for every generated file."""
comment = "# Autogenerated file, do not edit.\n"
comment = comment + '# Generate using jstests/ssl/x509/mkcert.py --config ' + CONFIGFILE
comment = comment + ' ' + cert['name'] + "\n#\n"
comment = comment + "# " + cert.get('description', '').replace("\n", "\n# ")
comment = comment + "\n"
Reported by Pylint.
Line: 525
Column: 24
pkcs8args = ['openssl', 'pkcs8', '-topk8', '-nocrypt', '-in', ec_key_file, '-out', pkcs8_key_file]
subprocess.check_call(pkcs8args)
def process_ecdsa_cert(cert, pem, key, dest, filename, split_pem=True):
"""Convert the ECDSA key and write the public/private key pair key into a .pem file, optionally writing the
public key to a .crt file and private key to a .key file"""
# copy the public key to a temp crt file
temp_cert_filename = tempfile.mkstemp()[1]
Reported by Pylint.
Line: 584
Column: 35
if "ocsp" in cert['name']:
# given foo.pem, we'll generate foo.crt and foo.key as well
filename = re.search('(.*)\.pem', cert['name']).group(1)
process_ecdsa_cert(cert, pem, key, dest, filename)
else:
open(dest, 'wt').write(get_header_comment(cert) + "\n" + open(pem, 'rt').read() + open(key, 'rt').read())
os.remove(key)
Reported by Pylint.
Line: 642
Column: 34
if 'responder' in cert.get('tags', []):
# given foo.crt, we'll generate foo.pem and foo.key
filename = re.search('(.*)\.crt', cert['name']).group(1)
process_ecdsa_cert(cert, pem, key, dest, filename)
elif "ocsp" in cert.get('tags', []):
# given foo.pem, we'll regenerate foo.pem and delete foo.crt and foo.key
filename = re.search('(.*)\.pem', cert['name']).group(1)
process_ecdsa_cert(cert, pem, key, dest, filename, split_pem=False)
Reported by Pylint.
Line: 646
Column: 34
process_ecdsa_cert(cert, pem, key, dest, filename)
elif "ocsp" in cert.get('tags', []):
# given foo.pem, we'll regenerate foo.pem and delete foo.crt and foo.key
filename = re.search('(.*)\.pem', cert['name']).group(1)
process_ecdsa_cert(cert, pem, key, dest, filename, split_pem=False)
else:
open(dest, 'wt').write(get_header_comment(cert) + "\n" + open(pem, 'rt').read() + open(key, 'rt').read())
os.remove(key)
Reported by Pylint.
Line: 780
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b506_yaml_load.html
global CONFIG
items_to_process = parse_command_line()
CONFIG = yaml.load(open(CONFIGFILE, 'r'), Loader=yaml.FullLoader)
validate_config()
items = select_items(items_to_process)
items = sort_items(items)
for item in items:
process_cert(item)
Reported by Bandit.
Line: 12
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import datetime
import os
import random
import subprocess
import tempfile
from typing import Any, Dict
import yaml
import OpenSSL
import re
Reported by Bandit.
src/third_party/abseil-cpp-master/abseil-cpp/absl/strings/str_cat_test.cc
88 issues
Line: 69
EXPECT_EQ(answer, "130");
}
TEST(StrCat, Enums) {
enum SmallNumbers { One = 1, Ten = 10 } e = Ten;
EXPECT_EQ("10", absl::StrCat(e));
EXPECT_EQ("-5", absl::StrCat(SmallNumbers(-5)));
enum class Option { Boxers = 1, Briefs = -1 };
Reported by Cppcheck.
Line: 39
Column: 6
CWE codes:
120
namespace {
// Test absl::StrCat of ints and longs of various sizes and signdedness.
TEST(StrCat, Ints) {
const short s = -1; // NOLINT(runtime/int)
const uint16_t us = 2;
const int i = -3;
const unsigned int ui = 4;
const long l = -5; // NOLINT(runtime/int)
Reported by FlawFinder.
Line: 53
Column: 18
CWE codes:
120
const intptr_t intptr = -12;
const uintptr_t uintptr = 13;
std::string answer;
answer = absl::StrCat(s, us);
EXPECT_EQ(answer, "-12");
answer = absl::StrCat(i, ui);
EXPECT_EQ(answer, "-34");
answer = absl::StrCat(l, ul);
EXPECT_EQ(answer, "-56");
Reported by FlawFinder.
Line: 55
Column: 18
CWE codes:
120
std::string answer;
answer = absl::StrCat(s, us);
EXPECT_EQ(answer, "-12");
answer = absl::StrCat(i, ui);
EXPECT_EQ(answer, "-34");
answer = absl::StrCat(l, ul);
EXPECT_EQ(answer, "-56");
answer = absl::StrCat(ll, ull);
EXPECT_EQ(answer, "-78");
Reported by FlawFinder.
Line: 57
Column: 18
CWE codes:
120
EXPECT_EQ(answer, "-12");
answer = absl::StrCat(i, ui);
EXPECT_EQ(answer, "-34");
answer = absl::StrCat(l, ul);
EXPECT_EQ(answer, "-56");
answer = absl::StrCat(ll, ull);
EXPECT_EQ(answer, "-78");
answer = absl::StrCat(ptrdiff, size);
EXPECT_EQ(answer, "-910");
Reported by FlawFinder.
Line: 59
Column: 18
CWE codes:
120
EXPECT_EQ(answer, "-34");
answer = absl::StrCat(l, ul);
EXPECT_EQ(answer, "-56");
answer = absl::StrCat(ll, ull);
EXPECT_EQ(answer, "-78");
answer = absl::StrCat(ptrdiff, size);
EXPECT_EQ(answer, "-910");
answer = absl::StrCat(ptrdiff, intptr);
EXPECT_EQ(answer, "-9-12");
Reported by FlawFinder.
Line: 61
Column: 18
CWE codes:
120
EXPECT_EQ(answer, "-56");
answer = absl::StrCat(ll, ull);
EXPECT_EQ(answer, "-78");
answer = absl::StrCat(ptrdiff, size);
EXPECT_EQ(answer, "-910");
answer = absl::StrCat(ptrdiff, intptr);
EXPECT_EQ(answer, "-9-12");
answer = absl::StrCat(uintptr, 0);
EXPECT_EQ(answer, "130");
Reported by FlawFinder.
Line: 63
Column: 18
CWE codes:
120
EXPECT_EQ(answer, "-78");
answer = absl::StrCat(ptrdiff, size);
EXPECT_EQ(answer, "-910");
answer = absl::StrCat(ptrdiff, intptr);
EXPECT_EQ(answer, "-9-12");
answer = absl::StrCat(uintptr, 0);
EXPECT_EQ(answer, "130");
}
Reported by FlawFinder.
Line: 65
Column: 18
CWE codes:
120
EXPECT_EQ(answer, "-910");
answer = absl::StrCat(ptrdiff, intptr);
EXPECT_EQ(answer, "-9-12");
answer = absl::StrCat(uintptr, 0);
EXPECT_EQ(answer, "130");
}
TEST(StrCat, Enums) {
enum SmallNumbers { One = 1, Ten = 10 } e = Ten;
Reported by FlawFinder.
Line: 69
Column: 6
CWE codes:
120
EXPECT_EQ(answer, "130");
}
TEST(StrCat, Enums) {
enum SmallNumbers { One = 1, Ten = 10 } e = Ten;
EXPECT_EQ("10", absl::StrCat(e));
EXPECT_EQ("-5", absl::StrCat(SmallNumbers(-5)));
enum class Option { Boxers = 1, Briefs = -1 };
Reported by FlawFinder.
src/third_party/wiredtiger/bench/workgen/runner/read_write_storms.py
86 issues
Line: 34
Column: 1
# Create waves of extra read and write activity (storms).
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json),io_capacity=(total=30M)" # explicitly added
Reported by Pylint.
Line: 35
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json),io_capacity=(total=30M)" # explicitly added
conn = context.wiredtiger_open("create," + conn_config)
Reported by Pylint.
Line: 37
Column: 11
from wiredtiger import *
from workgen import *
context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json),io_capacity=(total=30M)" # explicitly added
conn = context.wiredtiger_open("create," + conn_config)
s = conn.open_session("")
Reported by Pylint.
Line: 52
Column: 13
table_count = 100
for i in range(0, table_count):
tname = "table:test" + str(i)
table = Table(tname)
s.create(tname, wtperf_table_config +\
compress_table_config + table_config)
table.options.key_size = 20
table.options.value_size = 7000
tables.append(table)
Reported by Pylint.
Line: 63
Column: 21
icount = 4000000
# There are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
Reported by Pylint.
Line: 63
Column: 11
icount = 4000000
# There are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
Reported by Pylint.
Line: 66
Column: 14
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
print('populate complete')
# Log like file, requires that logging be enabled in the connection config.
Reported by Pylint.
Line: 67
Column: 16
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
print('populate complete')
# Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"
Reported by Pylint.
Line: 74
Column: 13
# Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"
s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," + compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)
ops = Operation(Operation.OP_UPDATE, tables[0])
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)
Reported by Pylint.
Line: 76
Column: 7
s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," + compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)
ops = Operation(Operation.OP_UPDATE, tables[0])
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)
# These operations include log_like operations, which will increase the number
# of insert/update operations by a factor of 2.0. This may cause the
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_compat.py
85 issues
Line: 470
Column: 53
def _assert_exception_format(self, eclass, evalue, expected):
actual = _format_exception_only(eclass, evalue)
self.assertThat(actual, Equals(expected))
self.assertThat(''.join(actual), IsInstance(unicode))
def test_supports_string_exception(self):
self._assert_exception_format(
"String_Exception",
None,
Reported by Pylint.
Line: 27
Column: 1
text_repr,
unicode_output_stream,
)
from testtools.matchers import (
Equals,
Is,
IsInstance,
MatchesException,
Not,
Reported by Pylint.
Line: 27
Column: 1
text_repr,
unicode_output_stream,
)
from testtools.matchers import (
Equals,
Is,
IsInstance,
MatchesException,
Not,
Reported by Pylint.
Line: 143
Column: 9
def setUp(self):
testtools.TestCase.setUp(self)
dir = tempfile.mkdtemp()
self.addCleanup(os.rmdir, dir)
self.filename = os.path.join(dir, self.id().rsplit(".", 1)[1] + ".py")
self._written = False
def put_source(self, text):
Reported by Pylint.
Line: 161
Column: 9
def test_nonexistant_file_as_ascii(self):
"""When file can't be found, the encoding should default to ascii"""
self.assertEquals("ascii", _get_source_encoding(self.filename))
def test_encoding_is_cached(self):
"""The encoding should stay the same if the cache isn't invalidated"""
self.put_source(
"# coding: iso-8859-13\n"
Reported by Pylint.
Line: 168
Column: 9
self.put_source(
"# coding: iso-8859-13\n"
"import os\n")
self.assertEquals("iso-8859-13", _get_source_encoding(self.filename))
self.put_source(
"# coding: rot-13\n"
"vzcbeg bf\n")
self.assertEquals("iso-8859-13", _get_source_encoding(self.filename))
Reported by Pylint.
Line: 172
Column: 9
self.put_source(
"# coding: rot-13\n"
"vzcbeg bf\n")
self.assertEquals("iso-8859-13", _get_source_encoding(self.filename))
def test_traceback_rechecks_encoding(self):
"""A traceback function checks the cache and resets the encoding"""
self.put_source(
"# coding: iso-8859-8\n"
Reported by Pylint.
Line: 179
Column: 9
self.put_source(
"# coding: iso-8859-8\n"
"import os\n")
self.assertEquals("iso-8859-8", _get_source_encoding(self.filename))
self.put_source(
"# coding: utf-8\n"
"import os\n")
try:
exec (compile("raise RuntimeError\n", self.filename, "exec"))
Reported by Pylint.
Line: 184
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
"# coding: utf-8\n"
"import os\n")
try:
exec (compile("raise RuntimeError\n", self.filename, "exec"))
except RuntimeError:
traceback.extract_tb(sys.exc_info()[2])
else:
self.fail("RuntimeError not raised")
self.assertEquals("utf-8", _get_source_encoding(self.filename))
Reported by Bandit.
Line: 184
Column: 13
"# coding: utf-8\n"
"import os\n")
try:
exec (compile("raise RuntimeError\n", self.filename, "exec"))
except RuntimeError:
traceback.extract_tb(sys.exc_info()[2])
else:
self.fail("RuntimeError not raised")
self.assertEquals("utf-8", _get_source_encoding(self.filename))
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/install.py
85 issues
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.
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.
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.
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.
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.
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.
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.
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.
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.
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/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_runtest.py
85 issues
Line: 44
Column: 29
def _run_test_method(self, result):
log.append(result)
case = Case('_run_test_method')
run = RunTest(case, lambda x: log.append(x))
result = TestResult()
run.run(result)
self.assertEqual(1, len(log))
self.assertEqual(result, log[0].decorated)
Reported by Pylint.
Line: 60
Column: 9
case = self.make_case()
log = []
run = RunTest(case, lambda x: x)
run._run_core = lambda: log.append('foo')
run.run()
self.assertEqual(['foo'], log)
def test__run_user_does_not_catch_keyboard(self):
case = self.make_case()
Reported by Pylint.
Line: 70
Column: 33
raise KeyboardInterrupt("yo")
run = RunTest(case, None)
run.result = ExtendedTestResult()
self.assertThat(lambda: run._run_user(raises),
Raises(MatchesException(KeyboardInterrupt)))
self.assertEqual([], run.result._events)
def test__run_user_calls_onException(self):
case = self.make_case()
Reported by Pylint.
Line: 72
Column: 30
run.result = ExtendedTestResult()
self.assertThat(lambda: run._run_user(raises),
Raises(MatchesException(KeyboardInterrupt)))
self.assertEqual([], run.result._events)
def test__run_user_calls_onException(self):
case = self.make_case()
log = []
def handler(exc_info):
Reported by Pylint.
Line: 88
Column: 18
raise e
run = RunTest(case, [(KeyError, None)])
run.result = ExtendedTestResult()
status = run._run_user(raises)
self.assertEqual(run.exception_caught, status)
self.assertEqual([], run.result._events)
self.assertEqual(["got it"], log)
def test__run_user_can_catch_Exception(self):
Reported by Pylint.
Line: 90
Column: 30
run.result = ExtendedTestResult()
status = run._run_user(raises)
self.assertEqual(run.exception_caught, status)
self.assertEqual([], run.result._events)
self.assertEqual(["got it"], log)
def test__run_user_can_catch_Exception(self):
case = self.make_case()
e = Exception('Yo')
Reported by Pylint.
Line: 101
Column: 18
log = []
run = RunTest(case, [(Exception, None)])
run.result = ExtendedTestResult()
status = run._run_user(raises)
self.assertEqual(run.exception_caught, status)
self.assertEqual([], run.result._events)
self.assertEqual([], log)
def test__run_user_uncaught_Exception_raised(self):
Reported by Pylint.
Line: 103
Column: 30
run.result = ExtendedTestResult()
status = run._run_user(raises)
self.assertEqual(run.exception_caught, status)
self.assertEqual([], run.result._events)
self.assertEqual([], log)
def test__run_user_uncaught_Exception_raised(self):
case = self.make_case()
e = KeyError('Yo')
Reported by Pylint.
Line: 112
Column: 21
def raises():
raise e
log = []
def log_exc(self, result, err):
log.append((result, err))
run = RunTest(case, [(ValueError, log_exc)])
run.result = ExtendedTestResult()
self.assertThat(lambda: run._run_user(raises),
Raises(MatchesException(KeyError)))
Reported by Pylint.
Line: 116
Column: 33
log.append((result, err))
run = RunTest(case, [(ValueError, log_exc)])
run.result = ExtendedTestResult()
self.assertThat(lambda: run._run_user(raises),
Raises(MatchesException(KeyError)))
self.assertEqual([], run.result._events)
self.assertEqual([], log)
def test__run_user_uncaught_Exception_from_exception_handler_raised(self):
Reported by Pylint.