The following issues were found
src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/test_details.py
24 issues
Line: 19
Column: 1
import unittest
from testtools.compat import _b, StringIO
import subunit.tests
from subunit import content, content_type, details
Reported by Pylint.
Line: 19
Column: 1
import unittest
from testtools.compat import _b, StringIO
import subunit.tests
from subunit import content, content_type, details
Reported by Pylint.
Line: 21
Column: 1
from testtools.compat import _b, StringIO
import subunit.tests
from subunit import content, content_type, details
class TestSimpleDetails(unittest.TestCase):
Reported by Pylint.
Line: 31
Column: 44
parser = details.SimpleDetailsParser(None)
parser.lineReceived(_b("foo\n"))
parser.lineReceived(_b("bar\n"))
self.assertEqual(_b("foo\nbar\n"), parser._message)
def test_lineReceived_escaped_bracket(self):
parser = details.SimpleDetailsParser(None)
parser.lineReceived(_b("foo\n"))
parser.lineReceived(_b(" ]are\n"))
Reported by Pylint.
Line: 38
Column: 50
parser.lineReceived(_b("foo\n"))
parser.lineReceived(_b(" ]are\n"))
parser.lineReceived(_b("bar\n"))
self.assertEqual(_b("foo\n]are\nbar\n"), parser._message)
def test_get_message(self):
parser = details.SimpleDetailsParser(None)
self.assertEqual(_b(""), parser.get_message())
Reported by Pylint.
Line: 46
Column: 9
def test_get_details(self):
parser = details.SimpleDetailsParser(None)
traceback = ""
expected = {}
expected['traceback'] = content.Content(
content_type.ContentType("text", "x-traceback",
{'charset': 'utf8'}),
lambda:[_b("")])
Reported by Pylint.
Line: 61
Column: 9
def test_get_details_skip(self):
parser = details.SimpleDetailsParser(None)
traceback = ""
expected = {}
expected['reason'] = content.Content(
content_type.ContentType("text", "plain"),
lambda:[_b("")])
found = parser.get_details("skip")
Reported by Pylint.
Line: 71
Column: 9
def test_get_details_success(self):
parser = details.SimpleDetailsParser(None)
traceback = ""
expected = {}
expected['message'] = content.Content(
content_type.ContentType("text", "plain"),
lambda:[_b("")])
found = parser.get_details("success")
Reported by Pylint.
Line: 1
Column: 1
#
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
#
Reported by Pylint.
Line: 9
Column: 2
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# license you chose for the specific language governing permissions and
# limitations under that license.
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h
24 issues
Line: 63
Column: 5
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
using H = typename TypeParam::hasher;
using E = typename TypeParam::key_equal;
H hasher;
E equal;
TypeParam m(123, hasher, equal);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_TRUE(m.empty());
EXPECT_THAT(m, ::testing::UnorderedElementsAre());
Reported by FlawFinder.
Line: 64
Column: 28
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
using E = typename TypeParam::key_equal;
H hasher;
E equal;
TypeParam m(123, hasher, equal);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_TRUE(m.empty());
EXPECT_THAT(m, ::testing::UnorderedElementsAre());
EXPECT_GE(m.bucket_count(), 123);
Reported by FlawFinder.
Line: 66
Column: 25
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
E equal;
TypeParam m(123, hasher, equal);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_TRUE(m.empty());
EXPECT_THAT(m, ::testing::UnorderedElementsAre());
EXPECT_GE(m.bucket_count(), 123);
}
Reported by FlawFinder.
Line: 77
Column: 5
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
using E = typename TypeParam::key_equal;
using A = typename TypeParam::allocator_type;
H hasher;
E equal;
A alloc(0);
TypeParam m(123, hasher, equal, alloc);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_EQ(m.get_allocator(), alloc);
Reported by FlawFinder.
Line: 79
Column: 28
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
H hasher;
E equal;
A alloc(0);
TypeParam m(123, hasher, equal, alloc);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_EQ(m.get_allocator(), alloc);
EXPECT_TRUE(m.empty());
EXPECT_THAT(m, ::testing::UnorderedElementsAre());
Reported by FlawFinder.
Line: 81
Column: 25
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
A alloc(0);
TypeParam m(123, hasher, equal, alloc);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_EQ(m.get_allocator(), alloc);
EXPECT_TRUE(m.empty());
EXPECT_THAT(m, ::testing::UnorderedElementsAre());
EXPECT_GE(m.bucket_count(), 123);
}
Reported by FlawFinder.
Line: 178
Column: 5
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
using E = typename TypeParam::key_equal;
using A = typename TypeParam::allocator_type;
H hasher;
E equal;
A alloc(0);
std::vector<T> values;
std::generate_n(std::back_inserter(values), 10,
hash_internal::Generator<T>());
TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc);
Reported by FlawFinder.
Line: 183
Column: 58
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
std::vector<T> values;
std::generate_n(std::back_inserter(values), 10,
hash_internal::Generator<T>());
TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_EQ(m.get_allocator(), alloc);
EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
EXPECT_GE(m.bucket_count(), 123);
Reported by FlawFinder.
Line: 185
Column: 25
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
hash_internal::Generator<T>());
TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc);
EXPECT_EQ(m.hash_function(), hasher);
EXPECT_EQ(m.key_eq(), equal);
EXPECT_EQ(m.get_allocator(), alloc);
EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
EXPECT_GE(m.bucket_count(), 123);
}
Reported by FlawFinder.
Line: 242
Column: 5
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
using E = typename TypeParam::key_equal;
using A = typename TypeParam::allocator_type;
H hasher;
E equal;
A alloc(0);
TypeParam m(123, hasher, equal, alloc);
for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
TypeParam n(m);
EXPECT_EQ(m.hash_function(), n.hash_function());
Reported by FlawFinder.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_higherorder.py
24 issues
Line: 89
Column: 5
class TestAfterPreprocessing(TestCase, TestMatchersInterface):
def parity(x):
return x % 2
matches_matcher = AfterPreprocessing(parity, Equals(1))
matches_matches = [3, 5]
matches_mismatches = [2]
Reported by Pylint.
Line: 1
Column: 1
# Copyright (c) 2008-2011 testtools developers. See LICENSE for details.
from testtools import TestCase
from testtools.matchers import (
DocTestMatches,
Equals,
LessThan,
MatchesStructure,
Mismatch,
Reported by Pylint.
Line: 28
Column: 1
from testtools.tests.matchers.helpers import TestMatchersInterface
class TestAllMatch(TestCase, TestMatchersInterface):
matches_matcher = AllMatch(LessThan(10))
matches_matches = [
[9, 9, 9],
(9, 9),
Reported by Pylint.
Line: 55
Column: 1
]
class TestAnyMatch(TestCase, TestMatchersInterface):
matches_matcher = AnyMatch(Equals('elephant'))
matches_matches = [
['grass', 'cow', 'steak', 'milk', 'elephant'],
(13, 'elephant'),
Reported by Pylint.
Line: 87
Column: 1
]
class TestAfterPreprocessing(TestCase, TestMatchersInterface):
def parity(x):
return x % 2
matches_matcher = AfterPreprocessing(parity, Equals(1))
Reported by Pylint.
Line: 89
Column: 5
class TestAfterPreprocessing(TestCase, TestMatchersInterface):
def parity(x):
return x % 2
matches_matcher = AfterPreprocessing(parity, Equals(1))
matches_matches = [3, 5]
matches_mismatches = [2]
Reported by Pylint.
Line: 89
Column: 5
class TestAfterPreprocessing(TestCase, TestMatchersInterface):
def parity(x):
return x % 2
matches_matcher = AfterPreprocessing(parity, Equals(1))
matches_matches = [3, 5]
matches_mismatches = [2]
Reported by Pylint.
Line: 108
Column: 1
AfterPreprocessing(parity, Equals(1), annotate=False)),
]
class TestMatchersAnyInterface(TestCase, TestMatchersInterface):
matches_matcher = MatchesAny(DocTestMatches("1"), DocTestMatches("2"))
matches_matches = ["1", "2"]
matches_mismatches = ["3"]
Reported by Pylint.
Line: 134
Column: 1
"3", MatchesAny(DocTestMatches("1"), DocTestMatches("2")))]
class TestMatchesAllInterface(TestCase, TestMatchersInterface):
matches_matcher = MatchesAll(NotEquals(1), NotEquals(2))
matches_matches = [3, 4]
matches_mismatches = [1, 2]
Reported by Pylint.
Line: 154
Column: 1
]
class TestAnnotate(TestCase, TestMatchersInterface):
matches_matcher = Annotate("foo", Equals(1))
matches_matches = [1]
matches_mismatches = [2]
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_impl.py
24 issues
Line: 100
Column: 22
if str_is_unicode:
actual = str(e)
else:
actual = unicode(e)
# Using str() should still work, and return ascii only
self.assertEqual(
expected.replace(matchee, matchee.encode("unicode-escape")),
str(e).decode("ascii"))
self.assertEqual(expected, actual)
Reported by Pylint.
Line: 27
Column: 1
from testtools.tests.helpers import FullStackRunTest
# Silence pyflakes.
Matcher
class TestMismatch(TestCase):
run_tests_with = FullStackRunTest
Reported by Pylint.
Line: 30
Column: 1
Matcher
class TestMismatch(TestCase):
run_tests_with = FullStackRunTest
def test_constructor_arguments(self):
mismatch = Mismatch("some description", {'detail': "things"})
Reported by Pylint.
Line: 34
Column: 5
run_tests_with = FullStackRunTest
def test_constructor_arguments(self):
mismatch = Mismatch("some description", {'detail': "things"})
self.assertEqual("some description", mismatch.describe())
self.assertEqual({'detail': "things"}, mismatch.get_details())
def test_constructor_no_arguments(self):
Reported by Pylint.
Line: 39
Column: 5
self.assertEqual("some description", mismatch.describe())
self.assertEqual({'detail': "things"}, mismatch.get_details())
def test_constructor_no_arguments(self):
mismatch = Mismatch()
self.assertThat(mismatch.describe,
Raises(MatchesException(NotImplementedError)))
self.assertEqual({}, mismatch.get_details())
Reported by Pylint.
Line: 46
Column: 1
self.assertEqual({}, mismatch.get_details())
class TestMismatchError(TestCase):
def test_is_assertion_error(self):
# MismatchError is an AssertionError, so that most of the time, it
# looks like a test failure, rather than an error.
def raise_mismatch_error():
Reported by Pylint.
Line: 48
Column: 5
class TestMismatchError(TestCase):
def test_is_assertion_error(self):
# MismatchError is an AssertionError, so that most of the time, it
# looks like a test failure, rather than an error.
def raise_mismatch_error():
raise MismatchError(2, Equals(3), Equals(3).match(2))
self.assertRaises(AssertionError, raise_mismatch_error)
Reported by Pylint.
Line: 55
Column: 5
raise MismatchError(2, Equals(3), Equals(3).match(2))
self.assertRaises(AssertionError, raise_mismatch_error)
def test_default_description_is_mismatch(self):
mismatch = Equals(3).match(2)
e = MismatchError(2, Equals(3), mismatch)
self.assertEqual(mismatch.describe(), str(e))
def test_default_description_unicode(self):
Reported by Pylint.
Line: 57
Column: 9
def test_default_description_is_mismatch(self):
mismatch = Equals(3).match(2)
e = MismatchError(2, Equals(3), mismatch)
self.assertEqual(mismatch.describe(), str(e))
def test_default_description_unicode(self):
matchee = _u('\xa7')
matcher = Equals(_u('a'))
Reported by Pylint.
Line: 60
Column: 5
e = MismatchError(2, Equals(3), mismatch)
self.assertEqual(mismatch.describe(), str(e))
def test_default_description_unicode(self):
matchee = _u('\xa7')
matcher = Equals(_u('a'))
mismatch = matcher.match(matchee)
e = MismatchError(matchee, matcher, mismatch)
self.assertEqual(mismatch.describe(), str(e))
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_overwrite.py
24 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 wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import filter_scenarios, make_scenarios
# test_overwrite.py
Reported by Pylint.
Line: 67
Column: 55
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(5))
cursor.set_value(ds.value(1000))
self.assertRaises(wiredtiger.WiredTigerError, lambda: cursor.insert())
# One additional test for the insert method: duplicate the cursor with
# overwrite configured and then the insert should succeed. This test
# is only for the insert method because the remove and update method
# failure modes are for non-existent records, and you cannot duplicate
Reported by Pylint.
Line: 78
Column: 9
cursor.set_key(ds.key(5))
dupc = self.session.open_cursor(None, cursor, "overwrite=true")
dupc.set_value(ds.value(1001))
self.assertEquals(dupc.insert(), 0)
# Insert of an existing record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(6))
cursor.set_value(ds.value(1002))
Reported by Pylint.
Line: 84
Column: 9
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(6))
cursor.set_value(ds.value(1002))
self.assertEquals(cursor.insert(), 0)
# Insert of a non-existent record with overwrite off succeeds.
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(200))
cursor.set_value(ds.value(1003))
Reported by Pylint.
Line: 90
Column: 9
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(200))
cursor.set_value(ds.value(1003))
self.assertEquals(cursor.insert(), 0)
# Insert of a non-existent record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(201))
cursor.set_value(ds.value(1004))
Reported by Pylint.
Line: 96
Column: 9
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(201))
cursor.set_value(ds.value(1004))
self.assertEquals(cursor.insert(), 0)
def test_overwrite_remove(self):
uri = self.uri + self.name
ds = self.ds(self, uri, 100, key_format=self.keyfmt)
ds.populate()
Reported by Pylint.
Line: 106
Column: 9
# Remove of an existing record with overwrite off succeeds.
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(5))
self.assertEquals(cursor.remove(), 0)
# Remove of an existing record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(6))
self.assertEquals(cursor.remove(), 0)
Reported by Pylint.
Line: 111
Column: 9
# Remove of an existing record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(6))
self.assertEquals(cursor.remove(), 0)
# Remove of a non-existent record with overwrite off fails.
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(200))
self.assertEquals(cursor.remove(), wiredtiger.WT_NOTFOUND)
Reported by Pylint.
Line: 116
Column: 9
# Remove of a non-existent record with overwrite off fails.
cursor = self.session.open_cursor(uri, None, "overwrite=false")
cursor.set_key(ds.key(200))
self.assertEquals(cursor.remove(), wiredtiger.WT_NOTFOUND)
# Remove of a non-existent record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(201))
self.assertEquals(cursor.remove(), 0)
Reported by Pylint.
Line: 121
Column: 9
# Remove of a non-existent record with overwrite on succeeds.
cursor = self.session.open_cursor(uri, None)
cursor.set_key(ds.key(201))
self.assertEquals(cursor.remove(), 0)
def test_overwrite_update(self):
uri = self.uri + self.name
ds = self.ds(self, uri, 100, key_format=self.keyfmt)
ds.populate()
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Memoize.py
24 issues
Line: 142
Column: 1
the class's methods that memoizes its return value by simply storing
the return value in its _memo dictionary.
"""
def count(self, *args, **kw):
""" Counts whether the memoized value has already been
set (a hit) or not (a miss).
"""
obj = args[0]
if self.method_name in obj._memo:
Reported by Pylint.
Line: 147
Column: 32
set (a hit) or not (a miss).
"""
obj = args[0]
if self.method_name in obj._memo:
self.hit = self.hit + 1
else:
self.miss = self.miss + 1
class CountDict(Counter):
Reported by Pylint.
Line: 173
Column: 25
"""
obj = args[0]
try:
memo_dict = obj._memo[self.method_name]
except KeyError:
self.miss = self.miss + 1
else:
key = self.keymaker(*args, **kw)
if key in memo_dict:
Reported by Pylint.
Line: 193
Column: 5
CounterList[counter].display()
def EnableMemoization():
global use_memoizer
use_memoizer = 1
def CountMethodCall(fn):
""" Decorator for counting memoizer hits/misses while retrieving
a simple value in a class method. It wraps the given method
Reported by Pylint.
Line: 205
Column: 13
"""
if use_memoizer:
def wrapper(self, *args, **kwargs):
global CounterList
key = self.__class__.__name__+'.'+fn.__name__
if key not in CounterList:
CounterList[key] = CountValue(self.__class__.__name__, fn.__name__)
CounterList[key].count(self, *args, **kwargs)
return fn(self, *args, **kwargs)
Reported by Pylint.
Line: 229
Column: 17
def decorator(fn):
if use_memoizer:
def wrapper(self, *args, **kwargs):
global CounterList
key = self.__class__.__name__+'.'+fn.__name__
if key not in CounterList:
CounterList[key] = CountDict(self.__class__.__name__, fn.__name__, keyfunc)
CounterList[key].count(self, *args, **kwargs)
return fn(self, *args, **kwargs)
Reported by Pylint.
Line: 1
Column: 1
#
# 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
# permit persons to whom the Software is furnished to do so, subject to
Reported by Pylint.
Line: 25
Column: 1
#
from __future__ import print_function
__revision__ = "src/engine/SCons/Memoize.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
__doc__ = """Memoizer
A decorator-based implementation to count hits and misses of the computed
values that various methods cache in memory.
Reported by Pylint.
Line: 104
Column: 1
"""
# A flag controlling whether or not we actually use memoization.
use_memoizer = None
# Global list of counter objects
CounterList = {}
class Counter(object):
Reported by Pylint.
Line: 109
Column: 1
# Global list of counter objects
CounterList = {}
class Counter(object):
"""
Base class for counting memoization hits and misses.
We expect that the initialization in a matching decorator will
fill in the correct class name and method name that represents
Reported by Pylint.
src/third_party/wiredtiger/test/suite/helper.py
24 issues
Line: 31
Column: 1
#
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently. To make sure we get byte for byte comparison,
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
#
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
Reported by Pylint.
Line: 33
Column: 1
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently. To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):
Reported by Pylint.
Line: 33
Column: 1
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently. To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):
Reported by Pylint.
Line: 33
Column: 1
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently. To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):
Reported by Pylint.
Line: 58
Column: 20
return True
# Iterate over a set of tables, ensuring that they have identical contents
def compare_tables(testcase, session, uris, config=None):
cursors = list()
for next_uri in uris:
cursors.append(session.open_cursor(next_uri, None, config))
try:
Reported by Pylint.
Line: 95
Column: 13
testcase.pr('confirm_empty: ' + uri)
cursor = testcase.session.open_cursor(uri, None)
if cursor.value_format == '8t':
for key,val in cursor:
testcase.assertEqual(val, 0)
else:
testcase.assertEqual(cursor.next(), wiredtiger.WT_NOTFOUND)
cursor.close()
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.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
#
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
Reported by Pylint.
Line: 30
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
# OTHER DEALINGS IN THE SOFTWARE.
#
import glob, os, shutil, string, subprocess
import wiredtiger
from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet
# Python has a filecmp.cmp function, but different versions of python approach
Reported by Bandit.
src/third_party/IntelRDFPMathLib20U1/TESTS/readtest.h
24 issues
Line: 6058
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
Q32 = bid_strtod32("", &endptr);
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q32 = bid_strtod32(istr1, &endptr);
} else {
Q32 = bid_strtod32(istr1, &endptr);
Reported by FlawFinder.
Line: 6059
Column: 6
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q32 = bid_strtod32(istr1, &endptr);
} else {
Q32 = bid_strtod32(istr1, &endptr);
}
Reported by FlawFinder.
Line: 6060
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q32 = bid_strtod32(istr1, &endptr);
} else {
Q32 = bid_strtod32(istr1, &endptr);
}
fpsf_0 = 0;
Reported by FlawFinder.
Line: 6079
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
Q64 = bid_strtod64("", &endptr);
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q64 = bid_strtod64(istr1, &endptr);
} else {
Q64 = bid_strtod64(istr1, &endptr);
Reported by FlawFinder.
Line: 6080
Column: 6
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q64 = bid_strtod64(istr1, &endptr);
} else {
Q64 = bid_strtod64(istr1, &endptr);
}
Reported by FlawFinder.
Line: 6081
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q64 = bid_strtod64(istr1, &endptr);
} else {
Q64 = bid_strtod64(istr1, &endptr);
}
fpsf_0 = 0;
Reported by FlawFinder.
Line: 6100
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
Q = bid_strtod128("", &endptr);
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q = bid_strtod128(istr1, &endptr);
} else {
Q = bid_strtod128(istr1, &endptr);
Reported by FlawFinder.
Line: 6101
Column: 6
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q = bid_strtod128(istr1, &endptr);
} else {
Q = bid_strtod128(istr1, &endptr);
}
Reported by FlawFinder.
Line: 6102
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
Q = bid_strtod128(istr1, &endptr);
} else {
Q = bid_strtod128(istr1, &endptr);
}
fpsf_0 = 0;
Reported by FlawFinder.
Line: 6123
Column: 6
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
Q32 = bid_wcstod32(wistr1, &wendptr);
} else if (str_prefix[0] !=0) {
char strtmp[STRMAX];
strcpy(strtmp, str_prefix);
strcat(strtmp, istr1);
strcpy(istr1, strtmp);
copy_str_to_wstr();
Q32 = bid_wcstod32(wistr1, &wendptr);
} else {
Reported by FlawFinder.
src/third_party/wiredtiger/bench/workgen/runner/runner/latency.py
24 issues
Line: 62
Column: 13
pos = 0
for x in range(0, width):
t = 0
for i in range(0, merge):
t += arr[pos]
pos += 1
nch = scale * t
y = 0
while nch > 0.0:
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.
Line: 34
Column: 1
from __future__ import print_function
import sys
def _show_buckets(fh, title, mult, buckets, n):
shown = False
s = title + ': '
for count in range(0, n):
val = buckets[count]
if val != 0:
Reported by Pylint.
Line: 34
Column: 1
from __future__ import print_function
import sys
def _show_buckets(fh, title, mult, buckets, n):
shown = False
s = title + ': '
for count in range(0, n):
val = buckets[count]
if val != 0:
Reported by Pylint.
Line: 36
Column: 5
def _show_buckets(fh, title, mult, buckets, n):
shown = False
s = title + ': '
for count in range(0, n):
val = buckets[count]
if val != 0:
if shown:
s += ','
Reported by Pylint.
Line: 41
Column: 17
val = buckets[count]
if val != 0:
if shown:
s += ','
s += str(count*mult) + '=' + str(val)
shown = True
print(s, file=fh)
def _latency_preprocess(arr, merge):
Reported by Pylint.
Line: 42
Column: 13
if val != 0:
if shown:
s += ','
s += str(count*mult) + '=' + str(val)
shown = True
print(s, file=fh)
def _latency_preprocess(arr, merge):
mx = 0
Reported by Pylint.
Line: 47
Column: 5
print(s, file=fh)
def _latency_preprocess(arr, merge):
mx = 0
cur = 0
# SWIG arrays have a clunky interface
for i in range(0, arr.__len__()):
if i % merge == 0:
cur = 0
Reported by Pylint.
Line: 55
Column: 13
cur = 0
cur += arr[i]
if cur > mx:
mx = cur
arr.height = mx
def _latency_plot(box, ch, left, width, arr, merge, scale):
pos = 0
for x in range(0, width):
Reported by Pylint.
Line: 58
Column: 1
mx = cur
arr.height = mx
def _latency_plot(box, ch, left, width, arr, merge, scale):
pos = 0
for x in range(0, width):
t = 0
for i in range(0, merge):
t += arr[pos]
Reported by Pylint.
src/third_party/wiredtiger/lang/python/wiredtiger/packing.py
24 issues
Line: 52
Column: 1
u bytes raw byte array
"""
from wiredtiger.packutil import _chr, _is_string, _ord, _string_result, \
empty_pack, x00
from wiredtiger.intpacking import pack_int, unpack_int
def __get_type(fmt):
if not fmt:
Reported by Pylint.
Line: 54
Column: 1
from wiredtiger.packutil import _chr, _is_string, _ord, _string_result, \
empty_pack, x00
from wiredtiger.intpacking import pack_int, unpack_int
def __get_type(fmt):
if not fmt:
return None, fmt
# Variable-sized encoding is the default (and only supported format in v1)
Reported by Pylint.
Line: 121
Column: 17
s = s[1:]
elif f in 'Bb':
# byte type
for i in range(size):
v = _ord(s[0])
if f != 'B':
v -= 0x80
result.append(v)
s = s[1:]
Reported by Pylint.
Line: 129
Column: 17
s = s[1:]
else:
# integral type
for j in range(size):
v, s = unpack_int(s)
result.append(v)
return result
def __pack_iter_fmt(fmt, values):
Reported by Pylint.
Line: 144
Column: 17
index += 1
else: # integral type
size = size if havesize else 1
for i in range(size):
value = values[index]
yield offset, havesize, 1, char, value
index = index + 1
def pack(fmt, *values):
Reported by Pylint.
Line: 156
Column: 5
if tfmt != '.':
raise ValueError('Only variable-length encoding is currently supported')
result = empty_pack
i = 0
for offset, havesize, size, f, val in __pack_iter_fmt(fmt, values):
if f == 'x':
if not havesize:
result += x00
else:
Reported by Pylint.
Line: 81
Column: 1
size = 0
havesize = 0
def unpack(fmt, s):
tfmt, fmt = __get_type(fmt)
if not fmt:
return ()
if tfmt != '.':
raise ValueError('Only variable-length encoding is currently supported')
Reported by Pylint.
Line: 81
Column: 1
size = 0
havesize = 0
def unpack(fmt, s):
tfmt, fmt = __get_type(fmt)
if not fmt:
return ()
if tfmt != '.':
raise ValueError('Only variable-length encoding is currently supported')
Reported by Pylint.
Line: 81
Column: 1
size = 0
havesize = 0
def unpack(fmt, s):
tfmt, fmt = __get_type(fmt)
if not fmt:
return ()
if tfmt != '.':
raise ValueError('Only variable-length encoding is currently supported')
Reported by Pylint.
Line: 88
Column: 33
if tfmt != '.':
raise ValueError('Only variable-length encoding is currently supported')
result = []
for offset, havesize, size, f in __unpack_iter_fmt(fmt):
if f == 'x':
s = s[size:]
# Note: no value, don't increment i
elif f in 'SsUu':
if not havesize:
Reported by Pylint.