The following issues were found
Lib/bdb.py
106 issues
Line: 6
Column: 1
import fnmatch
import sys
import os
from inspect import CO_GENERATOR, CO_COROUTINE, CO_ASYNC_GENERATOR
__all__ = ["BdbQuit", "Bdb", "Breakpoint"]
GENERATOR_AND_COROUTINE_FLAGS = CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR
Reported by Pylint.
Line: 6
Column: 1
import fnmatch
import sys
import os
from inspect import CO_GENERATOR, CO_COROUTINE, CO_ASYNC_GENERATOR
__all__ = ["BdbQuit", "Bdb", "Breakpoint"]
GENERATOR_AND_COROUTINE_FLAGS = CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR
Reported by Pylint.
Line: 6
Column: 1
import fnmatch
import sys
import os
from inspect import CO_GENERATOR, CO_COROUTINE, CO_ASYNC_GENERATOR
__all__ = ["BdbQuit", "Bdb", "Breakpoint"]
GENERATOR_AND_COROUTINE_FLAGS = CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR
Reported by Pylint.
Line: 60
Column: 9
"""Set values of attributes as ready to start debugging."""
import linecache
linecache.checkcache()
self.botframe = None
self._set_stopinfo(None, None)
def trace_dispatch(self, frame, event, arg):
"""Dispatch a trace function for debugged frames based on the event.
Reported by Pylint.
Line: 125
Column: 3
self.user_call(). Raise BdbQuit if self.quitting is set.
Return self.trace_dispatch to continue tracing in this scope.
"""
# XXX 'arg' is no longer used
if self.botframe is None:
# First call of dispatch since reset()
self.botframe = frame.f_back # (CT) Note that this may also be None!
return self.trace_dispatch
if not (self.stop_here(frame) or self.break_anywhere(frame)):
Reported by Pylint.
Line: 128
Column: 13
# XXX 'arg' is no longer used
if self.botframe is None:
# First call of dispatch since reset()
self.botframe = frame.f_back # (CT) Note that this may also be None!
return self.trace_dispatch
if not (self.stop_here(frame) or self.break_anywhere(frame)):
# No need to trace this function
return # None
# Ignore call events in generator except when stepping.
Reported by Pylint.
Line: 237
Column: 13
# flag says ok to delete temp. bp
(bp, flag) = effective(filename, lineno, frame)
if bp:
self.currentbp = bp.number
if (flag and bp.temporary):
self.do_clear(str(bp.number))
return True
else:
return False
Reported by Pylint.
Line: 261
Column: 9
def user_call(self, frame, argument_list):
"""Called if we might stop in a function."""
pass
def user_line(self, frame):
"""Called when we stop or break at a line."""
pass
Reported by Pylint.
Line: 265
Column: 9
def user_line(self, frame):
"""Called when we stop or break at a line."""
pass
def user_return(self, frame, return_value):
"""Called when a return trap is set here."""
pass
Reported by Pylint.
Line: 269
Column: 9
def user_return(self, frame, return_value):
"""Called when a return trap is set here."""
pass
def user_exception(self, frame, exc_info):
"""Called when we stop on an exception."""
pass
Reported by Pylint.
PC/layout/support/appxmanifest.py
106 issues
Line: 18
Column: 1
from pathlib import Path, PureWindowsPath
from xml.etree import ElementTree as ET
from .constants import *
__all__ = ["get_appx_layout"]
APPX_DATA = dict(
Reported by Pylint.
Line: 24
Column: 54
APPX_DATA = dict(
Name="PythonSoftwareFoundation.Python.{}".format(VER_DOT),
Version="{}.{}.{}.0".format(VER_MAJOR, VER_MINOR, VER_FIELD3),
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Reported by Pylint.
Line: 25
Column: 33
APPX_DATA = dict(
Name="PythonSoftwareFoundation.Python.{}".format(VER_DOT),
Version="{}.{}.{}.0".format(VER_MAJOR, VER_MINOR, VER_FIELD3),
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
Reported by Pylint.
Line: 25
Column: 44
APPX_DATA = dict(
Name="PythonSoftwareFoundation.Python.{}".format(VER_DOT),
Version="{}.{}.{}.0".format(VER_MAJOR, VER_MINOR, VER_FIELD3),
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
Reported by Pylint.
Line: 25
Column: 55
APPX_DATA = dict(
Name="PythonSoftwareFoundation.Python.{}".format(VER_DOT),
Version="{}.{}.{}.0".format(VER_MAJOR, VER_MINOR, VER_FIELD3),
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
Reported by Pylint.
Line: 29
Column: 36
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
)
APPX_PLATFORM_DATA = dict(
_keys=("ProcessorArchitecture",),
Reported by Pylint.
Line: 30
Column: 61
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
)
APPX_PLATFORM_DATA = dict(
_keys=("ProcessorArchitecture",),
win32=("x86",),
Reported by Pylint.
Line: 42
Column: 36
)
PYTHON_VE_DATA = dict(
DisplayName="Python {}".format(VER_DOT),
Description="Python interactive console",
Square150x150Logo="_resources/pythonx150.png",
Square44x44Logo="_resources/pythonx44.png",
BackgroundColor="transparent",
)
Reported by Pylint.
Line: 50
Column: 47
)
PYTHONW_VE_DATA = dict(
DisplayName="Python {} (Windowed)".format(VER_DOT),
Description="Python windowed app launcher",
Square150x150Logo="_resources/pythonwx150.png",
Square44x44Logo="_resources/pythonwx44.png",
BackgroundColor="transparent",
AppListEntry="none",
Reported by Pylint.
Line: 59
Column: 42
)
PIP_VE_DATA = dict(
DisplayName="pip (Python {})".format(VER_DOT),
Description="pip package manager for Python {}".format(VER_DOT),
Square150x150Logo="_resources/pythonx150.png",
Square44x44Logo="_resources/pythonx44.png",
BackgroundColor="transparent",
AppListEntry="none",
Reported by Pylint.
Lib/tkinter/test/test_ttk/test_functions.py
106 issues
Line: 318
Column: 9
"ttk::style element create thing image {name {state1 state2} val} "
"-opt 30")
image['thing']['element create'][-1]['opt'] = [MockTclObj(3),
MockTclObj('2m')]
self.assertEqual(ttk._script_from_settings(image),
"ttk::style element create thing image {name {state1 state2} val} "
"-opt {3 2m}")
Reported by Pylint.
Line: 46
Column: 26
self.fail("result still got elements: %s" % result)
# passing an empty dict should return an empty object (tuple here)
self.assertFalse(ttk._format_optdict({}))
# check list formatting
check_against(
ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}),
{'-fg': 'blue', '-padding': '1 2 3 4'})
Reported by Pylint.
Line: 50
Column: 13
# check list formatting
check_against(
ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}),
{'-fg': 'blue', '-padding': '1 2 3 4'})
# check tuple formatting (same as list)
check_against(
ttk._format_optdict({'test': (1, 2, '', 0)}),
Reported by Pylint.
Line: 55
Column: 13
# check tuple formatting (same as list)
check_against(
ttk._format_optdict({'test': (1, 2, '', 0)}),
{'-test': '1 2 {} 0'})
# check untouched values
check_against(
ttk._format_optdict({'test': {'left': 'as is'}}),
Reported by Pylint.
Line: 60
Column: 13
# check untouched values
check_against(
ttk._format_optdict({'test': {'left': 'as is'}}),
{'-test': {'left': 'as is'}})
# check script formatting
check_against(
ttk._format_optdict(
Reported by Pylint.
Line: 65
Column: 13
# check script formatting
check_against(
ttk._format_optdict(
{'test': [1, -1, '', '2m', 0], 'test2': 3,
'test3': '', 'test4': 'abc def',
'test5': '"abc"', 'test6': '{}',
'test7': '} -spam {'}, script=True),
{'-test': '{1 -1 {} 2m 0}', '-test2': '3',
Reported by Pylint.
Line: 78
Column: 23
opts = {'αβγ': True, 'á': False}
orig_opts = opts.copy()
# check if giving unicode keys is fine
check_against(ttk._format_optdict(opts), {'-αβγ': True, '-á': False})
# opts should remain unchanged
self.assertEqual(opts, orig_opts)
# passing values with spaces inside a tuple/list
check_against(
Reported by Pylint.
Line: 84
Column: 13
# passing values with spaces inside a tuple/list
check_against(
ttk._format_optdict(
{'option': ('one two', 'three')}),
{'-option': '{one two} three'})
check_against(
ttk._format_optdict(
{'option': ('one\ttwo', 'three')}),
Reported by Pylint.
Line: 88
Column: 13
{'option': ('one two', 'three')}),
{'-option': '{one two} three'})
check_against(
ttk._format_optdict(
{'option': ('one\ttwo', 'three')}),
{'-option': '{one\ttwo} three'})
# passing empty strings inside a tuple/list
check_against(
Reported by Pylint.
Line: 94
Column: 13
# passing empty strings inside a tuple/list
check_against(
ttk._format_optdict(
{'option': ('', 'one')}),
{'-option': '{} one'})
# passing values with braces inside a tuple/list
check_against(
Reported by Pylint.
Lib/xml/dom/xmlbuilder.py
106 issues
Line: 72
Column: 27
def _get_filter(self):
return self.filter
def _set_filter(self, filter):
self.filter = filter
def setFeature(self, name, state):
if self.supportsFeature(name):
state = state and 1 or 0
Reported by Pylint.
Line: 178
Column: 13
or options.create_entity_ref_nodes
or options.entities
or options.cdata_sections))
raise xml.dom.NotFoundErr("feature %s not known" % repr(name))
def parseURI(self, uri):
if self.entityResolver:
input = self.entityResolver.resolveEntity(None, uri)
else:
Reported by Pylint.
Line: 182
Column: 13
def parseURI(self, uri):
if self.entityResolver:
input = self.entityResolver.resolveEntity(None, uri)
else:
input = DOMEntityResolver().resolveEntity(None, uri)
return self.parse(input)
def parse(self, input):
Reported by Pylint.
Line: 187
Column: 21
input = DOMEntityResolver().resolveEntity(None, uri)
return self.parse(input)
def parse(self, input):
options = copy.copy(self._options)
options.filter = self.filter
options.errorHandler = self.errorHandler
fp = input.byteStream
if fp is None and options.systemId:
Reported by Pylint.
Line: 194
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen
fp = input.byteStream
if fp is None and options.systemId:
import urllib.request
fp = urllib.request.urlopen(input.systemId)
return self._parse_bytestream(fp, options)
def parseWithContext(self, input, cnode, action):
if action not in self._legal_actions:
raise ValueError("not a legal action")
Reported by Bandit.
Line: 197
Column: 39
fp = urllib.request.urlopen(input.systemId)
return self._parse_bytestream(fp, options)
def parseWithContext(self, input, cnode, action):
if action not in self._legal_actions:
raise ValueError("not a legal action")
raise NotImplementedError("Haven't written this yet...")
def _parse_bytestream(self, stream, options):
Reported by Pylint.
Line: 197
Column: 32
fp = urllib.request.urlopen(input.systemId)
return self._parse_bytestream(fp, options)
def parseWithContext(self, input, cnode, action):
if action not in self._legal_actions:
raise ValueError("not a legal action")
raise NotImplementedError("Haven't written this yet...")
def _parse_bytestream(self, stream, options):
Reported by Pylint.
Line: 197
Column: 32
fp = urllib.request.urlopen(input.systemId)
return self._parse_bytestream(fp, options)
def parseWithContext(self, input, cnode, action):
if action not in self._legal_actions:
raise ValueError("not a legal action")
raise NotImplementedError("Haven't written this yet...")
def _parse_bytestream(self, stream, options):
Reported by Pylint.
Line: 203
Column: 9
raise NotImplementedError("Haven't written this yet...")
def _parse_bytestream(self, stream, options):
import xml.dom.expatbuilder
builder = xml.dom.expatbuilder.makeBuilder(options)
return builder.parseFile(stream)
def _name_xform(name):
Reported by Pylint.
Line: 229
Column: 3
import posixpath, urllib.parse
parts = urllib.parse.urlparse(systemId)
scheme, netloc, path, params, query, fragment = parts
# XXX should we check the scheme here as well?
if path and not path.endswith("/"):
path = posixpath.dirname(path) + "/"
parts = scheme, netloc, path, params, query, fragment
source.baseURI = urllib.parse.urlunparse(parts)
Reported by Pylint.
Tools/peg_generator/pegen/sccutils.py
106 issues
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Line: 3
Column: 1
# Adapted from mypy (mypy/build.py) under the MIT license.
from typing import *
def strongly_connected_components(
vertices: AbstractSet[str], edges: Dict[str, AbstractSet[str]]
) -> Iterator[AbstractSet[str]]:
"""Compute Strongly Connected Components of a directed graph.
Reported by Pylint.
Lib/test/test_difflib.py
105 issues
Line: 82
Column: 9
def test_matching_blocks_cache(self):
# Issue #21635
s = difflib.SequenceMatcher(None, "abxcd", "abcd")
first = s.get_matching_blocks()
second = s.get_matching_blocks()
self.assertEqual(second[0].size, 2)
self.assertEqual(second[1].size, 2)
self.assertEqual(second[2].size, 0)
Reported by Pylint.
Line: 105
Column: 18
def test_mdiff_catch_stop_iteration(self):
# Issue #33224
self.assertEqual(
list(difflib._mdiff(["2"], ["3"], 1)),
[((1, '\x00-2\x01'), (1, '\x00+3\x01'), True)],
)
patch914575_from1 = """
Reported by Pylint.
Line: 299
Column: 9
def test_range_format_unified(self):
# Per the diff spec at http://www.unix.org/single_unix_specification/
spec = '''\
Each <range> field shall be of the form:
%1d", <beginning line number> if the range contains exactly one line,
and:
"%1d,%1d", <beginning line number>, <number of lines> otherwise.
If a range is empty, its beginning line number shall be the number of
Reported by Pylint.
Line: 307
Column: 15
If a range is empty, its beginning line number shall be the number of
the line just before the range, or 0 if the empty range starts the file.
'''
fmt = difflib._format_range_unified
self.assertEqual(fmt(3,3), '3,0')
self.assertEqual(fmt(3,4), '4')
self.assertEqual(fmt(3,5), '4,2')
self.assertEqual(fmt(3,6), '4,3')
self.assertEqual(fmt(0,0), '0,0')
Reported by Pylint.
Line: 316
Column: 9
def test_range_format_context(self):
# Per the diff spec at http://www.unix.org/single_unix_specification/
spec = '''\
The range of lines in file1 shall be written in the following format
if the range contains two or more lines:
"*** %d,%d ****\n", <beginning line number>, <ending line number>
and the following format otherwise:
"*** %d ****\n", <ending line number>
Reported by Pylint.
Line: 331
Column: 15
and the following format otherwise:
"--- %d ----\n", <ending line number>
'''
fmt = difflib._format_range_context
self.assertEqual(fmt(3,3), '3')
self.assertEqual(fmt(3,4), '4')
self.assertEqual(fmt(3,5), '4,5')
self.assertEqual(fmt(3,6), '4,6')
self.assertEqual(fmt(0,0), '0')
Reported by Pylint.
Line: 551
Column: 5
def test_main():
difflib.HtmlDiff._default_prefix = 0
Doctests = doctest.DocTestSuite(difflib)
run_unittest(
TestWithAscii, TestAutojunk, TestSFpatches, TestSFbugs,
TestOutputFormat, TestBytes, TestJunkAPIs, TestFindLongest, Doctests)
Reported by Pylint.
Line: 1
Column: 1
import difflib
from test.support import run_unittest, findfile
import unittest
import doctest
import sys
class TestWithAscii(unittest.TestCase):
def test_one_insert(self):
Reported by Pylint.
Line: 8
Column: 1
import sys
class TestWithAscii(unittest.TestCase):
def test_one_insert(self):
sm = difflib.SequenceMatcher(None, 'b' * 100, 'a' + 'b' * 100)
self.assertAlmostEqual(sm.ratio(), 0.995, places=3)
self.assertEqual(list(sm.get_opcodes()),
[ ('insert', 0, 0, 0, 1),
Reported by Pylint.
Line: 9
Column: 5
class TestWithAscii(unittest.TestCase):
def test_one_insert(self):
sm = difflib.SequenceMatcher(None, 'b' * 100, 'a' + 'b' * 100)
self.assertAlmostEqual(sm.ratio(), 0.995, places=3)
self.assertEqual(list(sm.get_opcodes()),
[ ('insert', 0, 0, 0, 1),
('equal', 0, 100, 1, 101)])
Reported by Pylint.
Lib/xml/sax/expatreader.py
105 issues
Line: 8
Column: 1
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_ges, feature_external_pes
from xml.sax.handler import feature_string_interning
from xml.sax.handler import property_xml_string, property_interning_dict
Reported by Pylint.
Line: 8
Column: 1
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_ges, feature_external_pes
from xml.sax.handler import feature_string_interning
from xml.sax.handler import property_xml_string, property_interning_dict
Reported by Pylint.
Line: 8
Column: 1
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_ges, feature_external_pes
from xml.sax.handler import feature_string_interning
from xml.sax.handler import property_xml_string, property_interning_dict
Reported by Pylint.
Line: 8
Column: 1
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_ges, feature_external_pes
from xml.sax.handler import feature_string_interning
from xml.sax.handler import property_xml_string, property_interning_dict
Reported by Pylint.
Line: 24
Column: 5
try:
from xml.parsers import expat
except ImportError:
raise SAXReaderNotAvailable("expat not supported", None)
else:
if not hasattr(expat, "ParserCreate"):
raise SAXReaderNotAvailable("expat not supported", None)
from xml.sax import xmlreader, saxutils, handler
Reported by Pylint.
Line: 62
Column: 12
def getColumnNumber(self):
parser = self._ref
if parser._parser is None:
return None
return parser._parser.ErrorColumnNumber
def getLineNumber(self):
parser = self._ref
Reported by Pylint.
Line: 64
Column: 16
parser = self._ref
if parser._parser is None:
return None
return parser._parser.ErrorColumnNumber
def getLineNumber(self):
parser = self._ref
if parser._parser is None:
return 1
Reported by Pylint.
Line: 68
Column: 12
def getLineNumber(self):
parser = self._ref
if parser._parser is None:
return 1
return parser._parser.ErrorLineNumber
def getPublicId(self):
parser = self._ref
Reported by Pylint.
Line: 70
Column: 16
parser = self._ref
if parser._parser is None:
return 1
return parser._parser.ErrorLineNumber
def getPublicId(self):
parser = self._ref
if parser is None:
return None
Reported by Pylint.
Line: 125
Column: 33
# Redefined setContentHandler to allow changing handlers during parsing
def setContentHandler(self, handler):
xmlreader.IncrementalParser.setContentHandler(self, handler)
if self._parsing:
self._reset_cont_handler()
def getFeature(self, name):
Reported by Pylint.
Lib/test/test_json/test_enum.py
105 issues
Line: 38
Column: 13
def test_floats(self):
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
Reported by Pylint.
Line: 38
Column: 30
def test_floats(self):
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
Reported by Pylint.
Line: 39
Column: 36
def test_floats(self):
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
Reported by Pylint.
Line: 39
Column: 13
def test_floats(self):
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
Reported by Pylint.
Line: 40
Column: 41
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
Reported by Pylint.
Line: 40
Column: 13
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
Reported by Pylint.
Line: 40
Column: 30
for enum in FloatNum:
self.assertEqual(self.dumps(enum), repr(enum.value))
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
Reported by Pylint.
Line: 44
Column: 30
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
else:
self.assertTrue(isnan(float(self.dumps(enum))))
Reported by Pylint.
Line: 44
Column: 13
def test_weird_floats(self):
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
else:
self.assertTrue(isnan(float(self.dumps(enum))))
Reported by Pylint.
Line: 46
Column: 40
for enum, expected in zip(WierdNum, ('Infinity', '-Infinity', 'NaN')):
self.assertEqual(self.dumps(enum), expected)
if not isnan(enum):
self.assertEqual(float(self.dumps(enum)), enum)
self.assertEqual(self.loads(self.dumps(enum)), enum)
else:
self.assertTrue(isnan(float(self.dumps(enum))))
self.assertTrue(isnan(self.loads(self.dumps(enum))))
Reported by Pylint.
Lib/threading.py
105 issues
Line: 273
Column: 5
def __repr__(self):
return "<Condition(%s, %d)>" % (self._lock, len(self._waiters))
def _release_save(self):
self._lock.release() # No state to save
def _acquire_restore(self, x):
self._lock.acquire() # Ignore saved state
Reported by Pylint.
Line: 276
Column: 5
def _release_save(self):
self._lock.release() # No state to save
def _acquire_restore(self, x):
self._lock.acquire() # Ignore saved state
def _is_owned(self):
# Return True if lock is owned by current_thread.
# This method is called only if _lock doesn't have _is_owned().
Reported by Pylint.
Line: 279
Column: 5
def _acquire_restore(self, x):
self._lock.acquire() # Ignore saved state
def _is_owned(self):
# Return True if lock is owned by current_thread.
# This method is called only if _lock doesn't have _is_owned().
if self._lock.acquire(False):
self._lock.release()
return False
Reported by Pylint.
Line: 1230
Column: 1
_ExceptHookArgs as ExceptHookArgs)
except ImportError:
# Simple Python implementation if _thread._excepthook() is not available
from traceback import print_exception as _print_exception
from collections import namedtuple
_ExceptHookArgs = namedtuple(
'ExceptHookArgs',
'exc_type exc_value exc_traceback thread')
Reported by Pylint.
Line: 36
Column: 17
# Rename some stuff so "from threading import *" is safe
_start_new_thread = _thread.start_new_thread
_allocate_lock = _thread.allocate_lock
_set_sentinel = _thread._set_sentinel
get_ident = _thread.get_ident
try:
get_native_id = _thread.get_native_id
_HAVE_THREAD_NATIVE_ID = True
__all__.append('get_native_id')
Reported by Pylint.
Line: 65
Column: 5
run() method is called.
"""
global _profile_hook
_profile_hook = func
def getprofile():
"""Get the profiler function as set by threading.setprofile()."""
return _profile_hook
Reported by Pylint.
Line: 79
Column: 5
method is called.
"""
global _trace_hook
_trace_hook = func
def gettrace():
"""Get the trace function as set by threading.settrace()."""
return _trace_hook
Reported by Pylint.
Line: 134
Column: 9
)
def _at_fork_reinit(self):
self._block._at_fork_reinit()
self._owner = None
self._count = 0
def acquire(self, blocking=True, timeout=-1):
"""Acquire a lock, blocking or non-blocking.
Reported by Pylint.
Line: 236
Column: 24
"""
def __init__(self, lock=None):
if lock is None:
lock = RLock()
self._lock = lock
# Export the lock's acquire() and release() methods
self.acquire = lock.acquire
Reported by Pylint.
Line: 261
Column: 9
self._waiters = _deque()
def _at_fork_reinit(self):
self._lock._at_fork_reinit()
self._waiters.clear()
def __enter__(self):
return self._lock.__enter__()
Reported by Pylint.
Lib/idlelib/idle_test/test_config.py
105 issues
Line: 197
Column: 25
with open(config_path, 'r') as f:
cls.config_string[ctype] = f.read()
cls.orig_warn = config._warn
config._warn = Func()
@classmethod
def tearDownClass(cls):
config._warn = cls.orig_warn
Reported by Pylint.
Line: 198
Column: 9
cls.config_string[ctype] = f.read()
cls.orig_warn = config._warn
config._warn = Func()
@classmethod
def tearDownClass(cls):
config._warn = cls.orig_warn
Reported by Pylint.
Line: 202
Column: 9
@classmethod
def tearDownClass(cls):
config._warn = cls.orig_warn
def new_config(self, _utest=False):
return config.IdleConf(_utest=_utest)
def mock_config(self):
Reported by Pylint.
Line: 376
Column: 3
'background': '#171717'})
def test_get_theme_dict(self):
# TODO: finish.
conf = self.mock_config()
# These two should be the same
self.assertEqual(
conf.GetThemeDict('default', 'IDLE Classic'),
Reported by Pylint.
Line: 519
Column: 3
self.assertEqual(conf.GetKeySet('IDLE Modern Unix')['<<newfoo>>'], '')
def test_is_core_binding(self):
# XXX: Should move out the core keys to config file or other place
conf = self.mock_config()
self.assertTrue(conf.IsCoreBinding('copy'))
self.assertTrue(conf.IsCoreBinding('cut'))
self.assertTrue(conf.IsCoreBinding('del-word-right'))
Reported by Pylint.
Line: 766
Column: 3
changes.add_option('main', 'Indent', 'use-spaces', '1')
# save_option returns False; cfg_type_changed remains False.
# TODO: test that save_all calls usercfg Saves.
def test_delete_section(self):
changes = self.load()
changes.delete_section('main', 'fake') # Test no exception.
self.assertEqual(changes, self.loaded) # Test nothing deleted.
Reported by Pylint.
Line: 776
Column: 17
testcfg[cfgtype].SetOption(section, 'name', 'value')
changes.delete_section(cfgtype, section)
with self.assertRaises(KeyError):
changes[cfgtype][section] # Test section gone from changes
testcfg[cfgtype][section] # and from mock userCfg.
# TODO test for save call.
def test_clear(self):
changes = self.load()
Reported by Pylint.
Line: 777
Column: 17
changes.delete_section(cfgtype, section)
with self.assertRaises(KeyError):
changes[cfgtype][section] # Test section gone from changes
testcfg[cfgtype][section] # and from mock userCfg.
# TODO test for save call.
def test_clear(self):
changes = self.load()
changes.clear()
Reported by Pylint.
Line: 778
Column: 3
with self.assertRaises(KeyError):
changes[cfgtype][section] # Test section gone from changes
testcfg[cfgtype][section] # and from mock userCfg.
# TODO test for save call.
def test_clear(self):
changes = self.load()
changes.clear()
self.assertEqual(changes, self.empty)
Reported by Pylint.
Line: 790
Column: 9
def test_warn(self):
Equal = self.assertEqual
config._warned = set()
with captured_stderr() as stderr:
config._warn('warning', 'key')
Equal(config._warned, {('warning','key')})
Equal(stderr.getvalue(), 'warning'+'\n')
with captured_stderr() as stderr:
Reported by Pylint.