The following issues were found
Lib/test/test_importlib/resources/util.py
60 issues
Line: 8
Column: 1
import types
from pathlib import Path, PurePath
from .. import data01
from .. import zipdata01
from importlib.abc import ResourceReader
from test.support import import_helper
Reported by Pylint.
Line: 9
Column: 1
from pathlib import Path, PurePath
from .. import data01
from .. import zipdata01
from importlib.abc import ResourceReader
from test.support import import_helper
from importlib.machinery import ModuleSpec
Reported by Pylint.
Line: 26
Column: 23
def open_resource(self, path):
self._path = path
if isinstance(self.file, Exception):
raise self.file
return self.file
def resource_path(self, path_):
self._path = path_
Reported by Pylint.
Line: 27
Column: 19
def open_resource(self, path):
self._path = path
if isinstance(self.file, Exception):
raise self.file
return self.file
def resource_path(self, path_):
self._path = path_
if isinstance(self.path, Exception):
Reported by Pylint.
Line: 28
Column: 16
self._path = path
if isinstance(self.file, Exception):
raise self.file
return self.file
def resource_path(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
Reported by Pylint.
Line: 32
Column: 23
def resource_path(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
return self.path
def is_resource(self, path_):
self._path = path_
Reported by Pylint.
Line: 33
Column: 19
def resource_path(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
return self.path
def is_resource(self, path_):
self._path = path_
if isinstance(self.path, Exception):
Reported by Pylint.
Line: 34
Column: 16
self._path = path_
if isinstance(self.path, Exception):
raise self.path
return self.path
def is_resource(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
Reported by Pylint.
Line: 38
Column: 23
def is_resource(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
def part(entry):
return entry.split('/')
Reported by Pylint.
Line: 39
Column: 19
def is_resource(self, path_):
self._path = path_
if isinstance(self.path, Exception):
raise self.path
def part(entry):
return entry.split('/')
return any(
Reported by Pylint.
Lib/stat.py
60 issues
Line: 78
Column: 14
"""Return True if mode is from a socket."""
return S_IFMT(mode) == S_IFSOCK
def S_ISDOOR(mode):
"""Return True if mode is from a door."""
return False
def S_ISPORT(mode):
"""Return True if mode is from an event port."""
Reported by Pylint.
Line: 82
Column: 14
"""Return True if mode is from a door."""
return False
def S_ISPORT(mode):
"""Return True if mode is from an event port."""
return False
def S_ISWHT(mode):
"""Return True if mode is from a whiteout."""
Reported by Pylint.
Line: 86
Column: 13
"""Return True if mode is from an event port."""
return False
def S_ISWHT(mode):
"""Return True if mode is from a whiteout."""
return False
# Names for permission bits
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Line: 193
Column: 5
# If available, use C implementation
try:
from _stat import *
except ImportError:
pass
Reported by Pylint.
Lib/test/test_http_cookies.py
60 issues
Line: 214
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(proto=proto):
C1 = pickle.loads(pickle.dumps(C, protocol=proto))
self.assertEqual(C1.output(), expected_output)
def test_illegal_chars(self):
rawdata = "a=b; c,d=e"
C = cookies.SimpleCookie()
Reported by Bandit.
Line: 242
Column: 41
self.assertIsNone(morsel.key)
self.assertIsNone(morsel.value)
self.assertIsNone(morsel.coded_value)
self.assertEqual(morsel.keys(), cookies.Morsel._reserved.keys())
for key, val in morsel.items():
self.assertEqual(val, '', key)
def test_reserved_keys(self):
M = cookies.Morsel()
Reported by Pylint.
Line: 249
Column: 18
def test_reserved_keys(self):
M = cookies.Morsel()
# tests valid and invalid reserved keys for Morsels
for i in M._reserved:
# Test that all valid keys are reported as reserved and set them
self.assertTrue(M.isReservedKey(i))
M[i] = '%s_value' % i
for i in M._reserved:
# Test that valid key values come out fine
Reported by Pylint.
Line: 253
Column: 18
# Test that all valid keys are reported as reserved and set them
self.assertTrue(M.isReservedKey(i))
M[i] = '%s_value' % i
for i in M._reserved:
# Test that valid key values come out fine
self.assertEqual(M[i], '%s_value' % i)
for i in "the holy hand grenade".split():
# Test that invalid keys raise CookieError
self.assertRaises(cookies.CookieError,
Reported by Pylint.
Line: 264
Column: 18
def test_setter(self):
M = cookies.Morsel()
# tests the .set method to set keys and their values
for i in M._reserved:
# Makes sure that all reserved keys can't be set this way
self.assertRaises(cookies.CookieError,
M.set, i, '%s_value' % i, '%s_value' % i)
for i in "thou cast _the- !holy! ^hand| +*grenade~".split():
# Try typical use case. Setting decent values.
Reported by Pylint.
Line: 437
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
})
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(proto=proto):
morsel_b = pickle.loads(pickle.dumps(morsel_a, proto))
self.assertIsInstance(morsel_b, cookies.Morsel)
self.assertEqual(morsel_b, morsel_a)
self.assertEqual(str(morsel_b), str(morsel_a))
def test_repr(self):
Reported by Bandit.
Line: 1
Column: 1
# Simple test suite for http/cookies.py
import copy
from test.support import run_unittest, run_doctest
import unittest
from http import cookies
import pickle
Reported by Pylint.
Line: 7
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle
from test.support import run_unittest, run_doctest
import unittest
from http import cookies
import pickle
class CookieTests(unittest.TestCase):
def test_basic(self):
Reported by Bandit.
Line: 10
Column: 1
import pickle
class CookieTests(unittest.TestCase):
def test_basic(self):
cases = [
{'data': 'chips=ahoy; vienna=finger',
'dict': {'chips':'ahoy', 'vienna':'finger'},
Reported by Pylint.
Line: 12
Column: 5
class CookieTests(unittest.TestCase):
def test_basic(self):
cases = [
{'data': 'chips=ahoy; vienna=finger',
'dict': {'chips':'ahoy', 'vienna':'finger'},
'repr': "<SimpleCookie: chips='ahoy' vienna='finger'>",
'output': 'Set-Cookie: chips=ahoy\nSet-Cookie: vienna=finger'},
Reported by Pylint.
Lib/idlelib/colorizer.py
59 issues
Line: 12
Column: 1
DEBUG = False
def any(name, alternates):
"Return a named group pattern matching list of alternates."
return "(?P<%s>" % name + "|".join(alternates) + ")"
def make_pat():
Reported by Pylint.
Line: 56
Column: 5
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
dq3string = stringprefix + r'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
prog = re.compile("|".join([
builtin, comment, string, kw,
match_softkw, case_default,
case_softkw_and_pattern,
any("SYNC", [r"\n"]),
]),
Reported by Pylint.
Line: 152
Column: 13
self.notify_range("1.0", "end")
else:
# No delegate - stop any colorizing.
self.stop_colorizing = True
self.allow_colorizing = False
def config_colors(self):
"Configure text widget tags with colors from tagdefs."
for tag, cnf in self.tagdefs.items():
Reported by Pylint.
Line: 153
Column: 13
else:
# No delegate - stop any colorizing.
self.stop_colorizing = True
self.allow_colorizing = False
def config_colors(self):
"Configure text widget tags with colors from tagdefs."
for tag, cnf in self.tagdefs.items():
self.tag_configure(tag, **cnf)
Reported by Pylint.
Line: 200
Column: 13
if DEBUG: print("colorizing already scheduled")
return
if self.colorizing:
self.stop_colorizing = True
if DEBUG: print("stop colorizing")
if self.allow_colorizing:
if DEBUG: print("schedule colorizing")
self.after_id = self.after(1, self.recolorize)
return
Reported by Pylint.
Line: 204
Column: 13
if DEBUG: print("stop colorizing")
if self.allow_colorizing:
if DEBUG: print("schedule colorizing")
self.after_id = self.after(1, self.recolorize)
return
def close(self):
if self.after_id:
after_id = self.after_id
Reported by Pylint.
Line: 210
Column: 13
def close(self):
if self.after_id:
after_id = self.after_id
self.after_id = None
if DEBUG: print("cancel scheduled recolorizer")
self.after_cancel(after_id)
self.allow_colorizing = False
self.stop_colorizing = True
Reported by Pylint.
Line: 213
Column: 9
self.after_id = None
if DEBUG: print("cancel scheduled recolorizer")
self.after_cancel(after_id)
self.allow_colorizing = False
self.stop_colorizing = True
def toggle_colorize_event(self, event=None):
"""Toggle colorizing on and off.
Reported by Pylint.
Line: 214
Column: 9
if DEBUG: print("cancel scheduled recolorizer")
self.after_cancel(after_id)
self.allow_colorizing = False
self.stop_colorizing = True
def toggle_colorize_event(self, event=None):
"""Toggle colorizing on and off.
When toggling off, if colorizing is scheduled or is in
Reported by Pylint.
Line: 216
Column: 37
self.allow_colorizing = False
self.stop_colorizing = True
def toggle_colorize_event(self, event=None):
"""Toggle colorizing on and off.
When toggling off, if colorizing is scheduled or is in
process, it will be cancelled and/or stopped.
Reported by Pylint.
Tools/demo/redemo.py
59 issues
Line: 5
Column: 1
"""Basic regular expression demonstration facility (Perl style syntax)."""
from tkinter import *
import re
class ReDemo:
def __init__(self, master):
Reported by Pylint.
Line: 13
Column: 30
def __init__(self, master):
self.master = master
self.promptdisplay = Label(self.master, anchor=W,
text="Enter a Perl-style regular expression:")
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
Reported by Pylint.
Line: 13
Column: 56
def __init__(self, master):
self.master = master
self.promptdisplay = Label(self.master, anchor=W,
text="Enter a Perl-style regular expression:")
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
Reported by Pylint.
Line: 15
Column: 48
self.promptdisplay = Label(self.master, anchor=W,
text="Enter a Perl-style regular expression:")
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
self.regexdisplay.focus_set()
Reported by Pylint.
Line: 15
Column: 38
self.promptdisplay = Label(self.master, anchor=W,
text="Enter a Perl-style regular expression:")
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
self.regexdisplay.focus_set()
Reported by Pylint.
Line: 17
Column: 29
text="Enter a Perl-style regular expression:")
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
self.regexdisplay.focus_set()
self.addoptions()
Reported by Pylint.
Line: 18
Column: 37
self.promptdisplay.pack(side=TOP, fill=X)
self.regexdisplay = Entry(self.master)
self.regexdisplay.pack(fill=X)
self.regexdisplay.focus_set()
self.addoptions()
self.statusdisplay = Label(self.master, text="", anchor=W)
Reported by Pylint.
Line: 23
Column: 30
self.addoptions()
self.statusdisplay = Label(self.master, text="", anchor=W)
self.statusdisplay.pack(side=TOP, fill=X)
self.labeldisplay = Label(self.master, anchor=W,
text="Enter a string to search:")
self.labeldisplay.pack(fill=X)
Reported by Pylint.
Line: 23
Column: 65
self.addoptions()
self.statusdisplay = Label(self.master, text="", anchor=W)
self.statusdisplay.pack(side=TOP, fill=X)
self.labeldisplay = Label(self.master, anchor=W,
text="Enter a string to search:")
self.labeldisplay.pack(fill=X)
Reported by Pylint.
Line: 24
Column: 38
self.addoptions()
self.statusdisplay = Label(self.master, text="", anchor=W)
self.statusdisplay.pack(side=TOP, fill=X)
self.labeldisplay = Label(self.master, anchor=W,
text="Enter a string to search:")
self.labeldisplay.pack(fill=X)
self.labeldisplay.pack(fill=X)
Reported by Pylint.
Parser/asdl.py
59 issues
Line: 68
Column: 24
return 'Constructor({0.name}, {0.fields})'.format(self)
class Field(AST):
def __init__(self, type, name=None, seq=False, opt=False):
self.type = type
self.name = name
self.seq = seq
self.opt = opt
Reported by Pylint.
Line: 158
Column: 25
for dfn in mod.dfns:
self.visit(dfn)
def visitType(self, type):
self.visit(type.value, str(type.name))
def visitSum(self, sum, name):
for t in sum.types:
self.visit(t, name)
Reported by Pylint.
Line: 161
Column: 24
def visitType(self, type):
self.visit(type.value, str(type.name))
def visitSum(self, sum, name):
for t in sum.types:
self.visit(t, name)
def visitConstructor(self, cons, name):
key = str(cons.name)
Reported by Pylint.
Line: 224
Column: 5
Token = namedtuple('Token', 'kind value lineno')
class ASDLSyntaxError(Exception):
def __init__(self, msg, lineno=None):
self.msg = msg
self.lineno = lineno or '<unknown>'
def __str__(self):
return 'Syntax error on line {0.lineno}: {0.msg}'.format(self)
Reported by Pylint.
Line: 250
Column: 21
try:
op_kind = TokenKind.operator_table[c]
except KeyError:
raise ASDLSyntaxError('Invalid operator %s' % c, lineno)
yield Token(op_kind, c, lineno)
class ASDLParser:
"""Parser for ASDL files.
Reported by Pylint.
Line: 289
Column: 13
while self.cur_token.kind == TokenKind.TypeId:
typename = self._advance()
self._match(TokenKind.Equals)
type = self._parse_type()
defs.append(Type(typename, type))
return defs
def _parse_type(self):
if self.cur_token.kind == TokenKind.LParen:
Reported by Pylint.
Line: 318
Column: 13
while self.cur_token.kind == TokenKind.TypeId:
typename = self._advance()
is_seq, is_opt = self._parse_optional_field_quantifier()
id = (self._advance() if self.cur_token.kind in self._id_kinds
else None)
fields.append(Field(typename, id, seq=is_seq, opt=is_opt))
if self.cur_token.kind == TokenKind.RParen:
break
elif self.cur_token.kind == TokenKind.Comma:
Reported by Pylint.
Line: 1
Column: 1
#-------------------------------------------------------------------------------
# Parser for ASDL [1] definition files. Reads in an ASDL description and parses
# it into an AST that describes it.
#
# The EBNF we're parsing here: Figure 1 of the paper [1]. Extended to support
# modules and attributes after a product. Words starting with Capital letters
# are terminals. Literal tokens are in "double quotes". Others are
# non-terminals. Id is either TokenId or ConstructorId.
#
Reported by Pylint.
Line: 38
Column: 1
builtin_types = {'identifier', 'string', 'int', 'constant'}
class AST:
def __repr__(self):
raise NotImplementedError
class Module(AST):
def __init__(self, name, dfns):
Reported by Pylint.
Line: 38
Column: 1
builtin_types = {'identifier', 'string', 'int', 'constant'}
class AST:
def __repr__(self):
raise NotImplementedError
class Module(AST):
def __init__(self, name, dfns):
Reported by Pylint.
Lib/test/test_importlib/test_windows.py
59 issues
Line: 1
Column: 1
from . import util as test_util
machinery = test_util.import_importlib('importlib.machinery')
import os
import re
import sys
import unittest
import warnings
from test import support
Reported by Pylint.
Line: 12
Column: 1
from test import support
from test.support import import_helper
from contextlib import contextmanager
from .util import temp_module
import_helper.import_module('winreg', required_on=['win'])
from winreg import (
CreateKey, HKEY_CURRENT_USER,
SetValue, REG_SZ, KEY_ALL_ACCESS,
Reported by Pylint.
Line: 15
Column: 1
from .util import temp_module
import_helper.import_module('winreg', required_on=['win'])
from winreg import (
CreateKey, HKEY_CURRENT_USER,
SetValue, REG_SZ, KEY_ALL_ACCESS,
EnumKey, CloseKey, DeleteKey, OpenKey
)
Reported by Pylint.
Line: 84
Column: 16
test_module = "spamham{}".format(os.getpid())
def test_find_spec_missing(self):
spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
self.assertIs(spec, None)
def test_find_module_missing(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
Reported by Pylint.
Line: 85
Column: 9
def test_find_spec_missing(self):
spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
self.assertIs(spec, None)
def test_find_module_missing(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module('spam')
Reported by Pylint.
Line: 90
Column: 22
def test_find_module_missing(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module('spam')
self.assertIs(loader, None)
def test_module_found(self):
with setup_module(self.machinery, self.test_module):
with warnings.catch_warnings():
Reported by Pylint.
Line: 91
Column: 9
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module('spam')
self.assertIs(loader, None)
def test_module_found(self):
with setup_module(self.machinery, self.test_module):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
Reported by Pylint.
Line: 94
Column: 27
self.assertIs(loader, None)
def test_module_found(self):
with setup_module(self.machinery, self.test_module):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNot(loader, None)
Reported by Pylint.
Line: 97
Column: 26
with setup_module(self.machinery, self.test_module):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNot(loader, None)
self.assertIsNot(spec, None)
def test_module_not_found(self):
Reported by Pylint.
Line: 98
Column: 20
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNot(loader, None)
self.assertIsNot(spec, None)
def test_module_not_found(self):
with setup_module(self.machinery, self.test_module, path="."):
Reported by Pylint.
Lib/test/pydocfodder.py
59 issues
Line: 5
Column: 1
import types
class A_classic:
"A classic class."
def A_method(self):
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
Reported by Pylint.
Line: 7
Column: 5
class A_classic:
"A classic class."
def A_method(self):
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
Reported by Pylint.
Line: 9
Column: 5
"A classic class."
def A_method(self):
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
def AD_method(self):
"Method defined in A and D."
Reported by Pylint.
Line: 11
Column: 5
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
def AD_method(self):
"Method defined in A and D."
def ABC_method(self):
"Method defined in A, B and C."
Reported by Pylint.
Line: 13
Column: 5
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
def AD_method(self):
"Method defined in A and D."
def ABC_method(self):
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
Reported by Pylint.
Line: 15
Column: 5
"Method defined in A and C."
def AD_method(self):
"Method defined in A and D."
def ABC_method(self):
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
Reported by Pylint.
Line: 17
Column: 5
"Method defined in A and D."
def ABC_method(self):
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
Reported by Pylint.
Line: 19
Column: 5
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
Reported by Pylint.
Line: 21
Column: 5
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
class B_classic(A_classic):
"A classic class, derived from A_classic."
Reported by Pylint.
Line: 25
Column: 1
"Method defined in A, B, C and D."
class B_classic(A_classic):
"A classic class, derived from A_classic."
def AB_method(self):
"Method defined in A and B."
def ABC_method(self):
"Method defined in A, B and C."
Reported by Pylint.
Lib/multiprocessing/queues.py
59 issues
Line: 25
Column: 1
import _multiprocessing
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
from .util import debug, info, Finalize, register_after_fork, is_exiting
Reported by Pylint.
Line: 26
Column: 1
import _multiprocessing
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
from .util import debug, info, Finalize, register_after_fork, is_exiting
#
Reported by Pylint.
Line: 29
Column: 1
from . import context
_ForkingPickler = context.reduction.ForkingPickler
from .util import debug, info, Finalize, register_after_fork, is_exiting
#
# Queue type using a pipe, buffer and thread
#
Reported by Pylint.
Line: 40
Column: 13
def __init__(self, maxsize=0, *, ctx):
if maxsize <= 0:
# Can raise ImportError (see issues #3770 and #23400)
from .synchronize import SEM_VALUE_MAX as maxsize
self._maxsize = maxsize
self._reader, self._writer = connection.Pipe(duplex=False)
self._rlock = ctx.Lock()
self._opid = os.getpid()
if sys.platform == 'win32':
Reported by Pylint.
Line: 73
Column: 13
def _reset(self, after_fork=False):
if after_fork:
self._notempty._at_fork_reinit()
else:
self._notempty = threading.Condition(threading.Lock())
self._buffer = collections.deque()
self._thread = None
self._jointhread = None
Reported by Pylint.
Line: 281
Column: 1
Private API hook called when feeding data in the background thread
raises an exception. For overriding by concurrent.futures.
"""
import traceback
traceback.print_exc()
_sentinel = object()
Reported by Pylint.
Line: 23
Column: 1
from queue import Empty, Full
import _multiprocessing
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
Reported by Pylint.
Line: 73
Column: 13
def _reset(self, after_fork=False):
if after_fork:
self._notempty._at_fork_reinit()
else:
self._notempty = threading.Condition(threading.Lock())
self._buffer = collections.deque()
self._thread = None
self._jointhread = None
Reported by Pylint.
Line: 126
Column: 32
def qsize(self):
# Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
return self._maxsize - self._sem._semlock._get_value()
def empty(self):
return not self._poll()
def full(self):
Reported by Pylint.
Line: 126
Column: 32
def qsize(self):
# Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
return self._maxsize - self._sem._semlock._get_value()
def empty(self):
return not self._poll()
def full(self):
Reported by Pylint.
Lib/test/test_importlib/extension/test_loader.py
58 issues
Line: 2
Column: 1
from warnings import catch_warnings
from .. import abc
from .. import util
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
Reported by Pylint.
Line: 3
Column: 1
from warnings import catch_warnings
from .. import abc
from .. import util
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
Reported by Pylint.
Line: 1
Column: 1
from warnings import catch_warnings
from .. import abc
from .. import util
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
Reported by Pylint.
Line: 14
Column: 1
import warnings
import importlib.util
import importlib
from test.support.script_helper import assert_python_failure
class LoaderTests(abc.LoaderTests):
"""Test load_module() for extension modules."""
Reported by Pylint.
Line: 96
Column: 9
def setUp(self):
self.name = '_testmultiphase'
finder = self.machinery.FileFinder(None)
self.spec = importlib.util.find_spec(self.name)
assert self.spec
self.loader = self.machinery.ExtensionFileLoader(
self.name, self.spec.origin)
Reported by Pylint.
Line: 135
Column: 17
('__package__', '')]:
self.assertEqual(getattr(module, attr), value)
with self.assertRaises(AttributeError):
module.__path__
self.assertIs(module, sys.modules[self.name])
self.assertIsInstance(module.__loader__,
self.machinery.ExtensionFileLoader)
def test_functionality(self):
Reported by Pylint.
Line: 149
Column: 17
self.assertEqual(ex.demo('abcd'), 'abcd')
self.assertEqual(ex.demo(), None)
with self.assertRaises(AttributeError):
ex.abc
ex.abc = 0
self.assertEqual(ex.abc, 0)
self.assertEqual(module.foo(9, 9), 18)
self.assertIsInstance(module.Str(), str)
self.assertEqual(module.Str(1) + '23', '123')
Reported by Pylint.
Line: 1
Column: 1
from warnings import catch_warnings
from .. import abc
from .. import util
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
Reported by Pylint.
Line: 7
Column: 1
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
import unittest
import warnings
import importlib.util
Reported by Pylint.
Line: 7
Column: 1
machinery = util.import_importlib('importlib.machinery')
import os.path
import sys
import types
import unittest
import warnings
import importlib.util
Reported by Pylint.