The following issues were found
Lib/ctypes/test/test_slicing.py
98 issues
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
Reported by Pylint.
Lib/ctypes/test/test_random_things.py
98 issues
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import contextlib
from test import support
import unittest
import sys
def callback_func(arg):
42 / arg
Reported by Pylint.
Lib/idlelib/rpc.py
98 issues
Line: 42
Column: 1
import struct
import sys
import threading
import traceback
import types
def unpickle_code(ms):
"Return code object from marshal string ms."
co = marshal.loads(ms)
Reported by Pylint.
Line: 106
Column: 13
"""
try:
raise
except SystemExit:
raise
except:
erf = sys.__stderr__
print('\n' + '-'*40, file=erf)
Reported by Pylint.
Line: 156
Column: 13
def debug(self, *args):
if not self.debugging:
return
s = self.location + " " + str(threading.current_thread().name)
for a in args:
s = s + " " + str(a)
print(s, file=sys.__stderr__)
def register(self, oid, object):
Reported by Pylint.
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b302-marshal
def unpickle_code(ms):
"Return code object from marshal string ms."
co = marshal.loads(ms)
assert isinstance(co, types.CodeType)
return co
def pickle_code(co):
"Return unpickle function and tuple with marshalled co code object."
Reported by Bandit.
Line: 82
Column: 9
def server_bind(self):
"Override TCPServer method, no bind() phase for connecting entity"
pass
def server_activate(self):
"""Override TCPServer method, connect() instead of listen()
Due to the reversed connection, self.server_address is actually the
Reported by Pylint.
Line: 109
Column: 9
raise
except SystemExit:
raise
except:
erf = sys.__stderr__
print('\n' + '-'*40, file=erf)
print('Unhandled server exception!', file=erf)
print('Thread: %s' % threading.current_thread().name, file=erf)
print('Client Address: ', client_address, file=erf)
Reported by Pylint.
Line: 119
Column: 13
traceback.print_exc(file=erf)
print('\n*** Unrecoverable, server exiting!', file=erf)
print('-'*40, file=erf)
os._exit(0)
#----------------- end class RPCServer --------------------
objecttable = {}
request_queue = queue.Queue(0)
Reported by Pylint.
Line: 151
Column: 9
def exithook(self):
"override for specific exit action"
os._exit(0)
def debug(self, *args):
if not self.debugging:
return
s = self.location + " " + str(threading.current_thread().name)
Reported by Pylint.
Line: 161
Column: 29
s = s + " " + str(a)
print(s, file=sys.__stderr__)
def register(self, oid, object):
self.objtable[oid] = object
def unregister(self, oid):
try:
del self.objtable[oid]
Reported by Pylint.
Line: 207
Column: 16
raise
except OSError:
raise
except Exception as ex:
return ("CALLEXC", ex)
except:
msg = "*** Internal Error: rpc.py:SocketIO.localcall()\n\n"\
" Object: %s \n Method: %s \n Args: %s\n"
print(msg % (oid, method, args), file=sys.__stderr__)
Reported by Pylint.
Lib/ctypes/test/test_cast.py
98 issues
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
Reported by Pylint.
Lib/wsgiref/validate.py
98 issues
Line: 149
Column: 9
"""
def lint_app(*args, **kw):
assert_(len(args) == 2, "Two arguments required")
assert_(not kw, "No keyword arguments allowed")
environ, start_response = args
check_environ(environ)
Reported by Pylint.
Line: 150
Column: 9
def lint_app(*args, **kw):
assert_(len(args) == 2, "Two arguments required")
assert_(not kw, "No keyword arguments allowed")
environ, start_response = args
check_environ(environ)
# We use this to check if the application returns without
Reported by Pylint.
Line: 160
Column: 13
start_response_started = []
def start_response_wrapper(*args, **kw):
assert_(len(args) == 2 or len(args) == 3, (
"Invalid number of arguments: %s" % (args,)))
assert_(not kw, "No keyword arguments allowed")
status = args[0]
headers = args[1]
if len(args) == 3:
Reported by Pylint.
Line: 162
Column: 13
def start_response_wrapper(*args, **kw):
assert_(len(args) == 2 or len(args) == 3, (
"Invalid number of arguments: %s" % (args,)))
assert_(not kw, "No keyword arguments allowed")
status = args[0]
headers = args[1]
if len(args) == 3:
exc_info = args[2]
else:
Reported by Pylint.
Line: 182
Column: 9
environ['wsgi.errors'] = ErrorWrapper(environ['wsgi.errors'])
iterator = application(environ, start_response_wrapper)
assert_(iterator is not None and iterator != False,
"The application must return an iterator, if only an empty list")
check_iterator(iterator)
return IteratorWrapper(iterator, start_response_started)
Reported by Pylint.
Line: 197
Column: 9
self.input = wsgi_input
def read(self, *args):
assert_(len(args) == 1)
v = self.input.read(*args)
assert_(type(v) is bytes)
return v
def readline(self, *args):
Reported by Pylint.
Line: 199
Column: 9
def read(self, *args):
assert_(len(args) == 1)
v = self.input.read(*args)
assert_(type(v) is bytes)
return v
def readline(self, *args):
assert_(len(args) <= 1)
v = self.input.readline(*args)
Reported by Pylint.
Line: 203
Column: 9
return v
def readline(self, *args):
assert_(len(args) <= 1)
v = self.input.readline(*args)
assert_(type(v) is bytes)
return v
def readlines(self, *args):
Reported by Pylint.
Line: 205
Column: 9
def readline(self, *args):
assert_(len(args) <= 1)
v = self.input.readline(*args)
assert_(type(v) is bytes)
return v
def readlines(self, *args):
assert_(len(args) <= 1)
lines = self.input.readlines(*args)
Reported by Pylint.
Line: 209
Column: 9
return v
def readlines(self, *args):
assert_(len(args) <= 1)
lines = self.input.readlines(*args)
assert_(type(lines) is list)
for line in lines:
assert_(type(line) is bytes)
return lines
Reported by Pylint.
Tools/scripts/which.py
98 issues
Line: 51
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
else:
msg(filename + ': not executable')
if longlist:
sts = os.system('ls ' + longlist + ' ' + filename)
sts = os.waitstatus_to_exitcode(sts)
if sts: msg('"ls -l" exit status: ' + repr(sts))
if not ident:
msg(prog + ': not found')
sts = 1
Reported by Bandit.
Line: 52
Column: 23
msg(filename + ': not executable')
if longlist:
sts = os.system('ls ' + longlist + ' ' + filename)
sts = os.waitstatus_to_exitcode(sts)
if sts: msg('"ls -l" exit status: ' + repr(sts))
if not ident:
msg(prog + ': not found')
sts = 1
Reported by Pylint.
Line: 10
Column: 1
import sys
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Line: 11
Column: 1
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
Reported by Pylint.
Modules/_decimal/tests/randfloat.py
97 issues
Line: 20
Column: 13
lower = -(-2**53//5**k)
if lower % 2 == 0:
lower += 1
for i in range(10 * TEST_SIZE):
# Select a random odd n in [2**53/5**k,
# 2**54/5**k). Then n * 10**k gives a halfway case
# with small number of significant digits.
n, e = random.randrange(lower, upper, 2), k
Reported by Pylint.
Line: 56
Column: 9
def test_halfway_cases():
# test halfway cases for the round-half-to-even rule
for i in range(1000):
for j in range(TEST_SIZE):
# bit pattern for a random finite positive (or +0.0) float
bits = random.randrange(2047*2**52)
# convert bit pattern to a number of the form m * 2**e
Reported by Pylint.
Line: 57
Column: 13
def test_halfway_cases():
# test halfway cases for the round-half-to-even rule
for i in range(1000):
for j in range(TEST_SIZE):
# bit pattern for a random finite positive (or +0.0) float
bits = random.randrange(2047*2**52)
# convert bit pattern to a number of the form m * 2**e
e, m = divmod(bits, 2**52)
Reported by Pylint.
Line: 92
Column: 13
(0, -327, 4941), # zero
]
for n, e, u in boundaries:
for j in range(1000):
for i in range(TEST_SIZE):
digits = n + random.randrange(-3*u, 3*u)
exponent = e
s = '{}e{}'.format(digits, exponent)
yield s
Reported by Pylint.
Line: 93
Column: 17
]
for n, e, u in boundaries:
for j in range(1000):
for i in range(TEST_SIZE):
digits = n + random.randrange(-3*u, 3*u)
exponent = e
s = '{}e{}'.format(digits, exponent)
yield s
n *= 10
Reported by Pylint.
Line: 108
Column: 13
# with n
for exponent in range(-400, -320):
base = 10**-exponent // 2**1075
for j in range(TEST_SIZE):
digits = base + random.randrange(-1000, 1000)
s = '{}e{}'.format(digits, exponent)
yield s
def test_bigcomp():
Reported by Pylint.
Line: 116
Column: 13
def test_bigcomp():
for ndigs in 5, 10, 14, 15, 16, 17, 18, 19, 20, 40, 41, 50:
dig10 = 10**ndigs
for i in range(100 * TEST_SIZE):
digits = random.randrange(dig10)
exponent = random.randrange(-400, 400)
s = '{}e{}'.format(digits, exponent)
yield s
Reported by Pylint.
Line: 129
Column: 9
# put together random short valid strings
# \d*[.\d*]?e
for i in range(1000):
for j in range(TEST_SIZE):
s = random.choice(signs)
intpart_len = random.randrange(5)
s += ''.join(random.choice(digits) for _ in range(intpart_len))
if random.choice([True, False]):
Reported by Pylint.
Line: 130
Column: 13
# put together random short valid strings
# \d*[.\d*]?e
for i in range(1000):
for j in range(TEST_SIZE):
s = random.choice(signs)
intpart_len = random.randrange(5)
s += ''.join(random.choice(digits) for _ in range(intpart_len))
if random.choice([True, False]):
s += '.'
Reported by Pylint.
Line: 233
Column: 9
]
def un_randfloat():
for i in range(1000):
l = random.choice(TESTCASES[:6])
yield random.choice(l)
for v in test_particular:
yield v
Reported by Pylint.
Lib/ctypes/test/test_simplesubclasses.py
97 issues
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
Reported by Pylint.
Lib/test/test_tuple.py
97 issues
Line: 25
Column: 13
t = ()
msg = "tuple indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
t['a']
def test_constructors(self):
super().test_constructors()
# calling built-in types without argument must return empty
self.assertEqual(tuple(), ())
Reported by Pylint.
Line: 25
Column: 13
t = ()
msg = "tuple indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
t['a']
def test_constructors(self):
super().test_constructors()
# calling built-in types without argument must return empty
self.assertEqual(tuple(), ())
Reported by Pylint.
Line: 353
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
itorg = iter(data)
d = pickle.dumps(itorg, proto)
it = pickle.loads(d)
self.assertEqual(type(itorg), type(it))
self.assertEqual(self.type2test(it), self.type2test(data))
it = pickle.loads(d)
next(it)
Reported by Bandit.
Line: 357
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
self.assertEqual(type(itorg), type(it))
self.assertEqual(self.type2test(it), self.type2test(data))
it = pickle.loads(d)
next(it)
d = pickle.dumps(it, proto)
self.assertEqual(self.type2test(it), self.type2test(data)[1:])
def test_reversed_pickle(self):
Reported by Bandit.
Line: 367
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
itorg = reversed(data)
d = pickle.dumps(itorg, proto)
it = pickle.loads(d)
self.assertEqual(type(itorg), type(it))
self.assertEqual(self.type2test(it), self.type2test(reversed(data)))
it = pickle.loads(d)
next(it)
Reported by Bandit.
Line: 371
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
self.assertEqual(type(itorg), type(it))
self.assertEqual(self.type2test(it), self.type2test(reversed(data)))
it = pickle.loads(d)
next(it)
d = pickle.dumps(it, proto)
self.assertEqual(self.type2test(it), self.type2test(reversed(data))[1:])
def test_no_comdat_folding(self):
Reported by Bandit.
Line: 382
Column: 13
# function addresses.
class T(tuple): pass
with self.assertRaises(TypeError):
[3,] + T((1,2))
def test_lexicographic_ordering(self):
# Issue 21100
a = self.type2test([1, 2])
b = self.type2test([1, 2, 0])
Reported by Pylint.
Line: 1
Column: 1
from test import support, seq_tests
import unittest
import gc
import pickle
# For tuple hashes, we normally only run a test to ensure that we get
# the same results across platforms in a handful of cases. If that's
# so, there's no real point to running more. Set RUN_ALL_HASH_TESTS to
Reported by Pylint.
Line: 5
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle
import unittest
import gc
import pickle
# For tuple hashes, we normally only run a test to ensure that we get
# the same results across platforms in a handful of cases. If that's
# so, there's no real point to running more. Set RUN_ALL_HASH_TESTS to
# run more anyway. That's usually of real interest only when analyzing,
Reported by Bandit.
Line: 18
Column: 1
RUN_ALL_HASH_TESTS = False
JUST_SHOW_HASH_RESULTS = False # if RUN_ALL_HASH_TESTS, just display
class TupleTest(seq_tests.CommonTest):
type2test = tuple
def test_getitem_error(self):
t = ()
msg = "tuple indices must be integers or slices"
Reported by Pylint.
Lib/wave.py
97 issues
Line: 246
Column: 20
if self._sampwidth != 1 and sys.byteorder == 'big':
data = audioop.byteswap(data, self._sampwidth)
if self._convert and data:
data = self._convert(data)
self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
return data
#
# Internal methods.
Reported by Pylint.
Line: 429
Column: 20
self._ensure_header_written(len(data))
nframes = len(data) // (self._sampwidth * self._nchannels)
if self._convert:
data = self._convert(data)
if self._sampwidth != 1 and sys.byteorder == 'big':
data = audioop.byteswap(data, self._sampwidth)
self._file.write(data)
self._datawritten += len(data)
self._nframeswritten = self._nframeswritten + nframes
Reported by Pylint.
Line: 185
Column: 9
return self._file
def rewind(self):
self._data_seek_needed = 1
self._soundpos = 0
def close(self):
self._file = None
file = self._i_opened_the_file
Reported by Pylint.
Line: 186
Column: 9
def rewind(self):
self._data_seek_needed = 1
self._soundpos = 0
def close(self):
self._file = None
file = self._i_opened_the_file
if file:
Reported by Pylint.
Line: 189
Column: 9
self._soundpos = 0
def close(self):
self._file = None
file = self._i_opened_the_file
if file:
self._i_opened_the_file = None
file.close()
Reported by Pylint.
Line: 224
Column: 23
def getmarkers(self):
return None
def getmark(self, id):
raise Error('no marks')
def setpos(self, pos):
if pos < 0 or pos > self._nframes:
raise Error('position not in range')
Reported by Pylint.
Line: 230
Column: 9
def setpos(self, pos):
if pos < 0 or pos > self._nframes:
raise Error('position not in range')
self._soundpos = pos
self._data_seek_needed = 1
def readframes(self, nframes):
if self._data_seek_needed:
self._data_chunk.seek(0, 0)
Reported by Pylint.
Line: 231
Column: 9
if pos < 0 or pos > self._nframes:
raise Error('position not in range')
self._soundpos = pos
self._data_seek_needed = 1
def readframes(self, nframes):
if self._data_seek_needed:
self._data_chunk.seek(0, 0)
pos = self._soundpos * self._framesize
Reported by Pylint.
Line: 239
Column: 13
pos = self._soundpos * self._framesize
if pos:
self._data_chunk.seek(pos, 0)
self._data_seek_needed = 0
if nframes == 0:
return b''
data = self._data_chunk.read(nframes * self._framesize)
if self._sampwidth != 1 and sys.byteorder == 'big':
data = audioop.byteswap(data, self._sampwidth)
Reported by Pylint.
Line: 247
Column: 9
data = audioop.byteswap(data, self._sampwidth)
if self._convert and data:
data = self._convert(data)
self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
return data
#
# Internal methods.
#
Reported by Pylint.