The following issues were found
Lib/turtledemo/bytedesign.py
26 issues
Line: 25
Column: 1
mode as fast as possible.
"""
from turtle import Turtle, mainloop
from time import perf_counter as clock
# wrapper for any additional drawing routines
# that need to know about each other
class Designer(Turtle):
Reported by Pylint.
Line: 34
Column: 13
def design(self, homePos, scale):
self.up()
for i in range(5):
self.forward(64.65 * scale)
self.down()
self.wheel(self.position(), scale)
self.up()
self.backward(64.65 * scale)
Reported by Pylint.
Line: 52
Column: 13
def wheel(self, initpos, scale):
self.right(54)
for i in range(4):
self.pentpiece(initpos, scale)
self.down()
self.left(36)
for i in range(5):
self.tripiece(initpos, scale)
Reported by Pylint.
Line: 90
Column: 13
self.up()
self.forward(29 * scale)
self.down()
for i in range(5):
self.forward(18 * scale)
self.right(72)
self.pentr(18 * scale, 75, scale)
self.up()
self.goto(initpos)
Reported by Pylint.
Line: 30
Column: 1
# wrapper for any additional drawing routines
# that need to know about each other
class Designer(Turtle):
def design(self, homePos, scale):
self.up()
for i in range(5):
self.forward(64.65 * scale)
Reported by Pylint.
Line: 32
Column: 5
# that need to know about each other
class Designer(Turtle):
def design(self, homePos, scale):
self.up()
for i in range(5):
self.forward(64.65 * scale)
self.down()
self.wheel(self.position(), scale)
Reported by Pylint.
Line: 32
Column: 5
# that need to know about each other
class Designer(Turtle):
def design(self, homePos, scale):
self.up()
for i in range(5):
self.forward(64.65 * scale)
self.down()
self.wheel(self.position(), scale)
Reported by Pylint.
Line: 50
Column: 5
self.centerpiece(46 * scale, 143.4, scale)
self.getscreen().tracer(True)
def wheel(self, initpos, scale):
self.right(54)
for i in range(4):
self.pentpiece(initpos, scale)
self.down()
self.left(36)
Reported by Pylint.
Line: 68
Column: 5
self.left(54)
self.getscreen().update()
def tripiece(self, initpos, scale):
oldh = self.heading()
self.down()
self.backward(2.5 * scale)
self.tripolyr(31.5 * scale, scale)
self.up()
Reported by Pylint.
Line: 85
Column: 5
self.left(72)
self.getscreen().update()
def pentpiece(self, initpos, scale):
oldh = self.heading()
self.up()
self.forward(29 * scale)
self.down()
for i in range(5):
Reported by Pylint.
Lib/test/test_xml_dom_minicompat.py
26 issues
Line: 8
Column: 1
import unittest
import xml.dom
from xml.dom.minicompat import *
class EmptyNodeListTestCase(unittest.TestCase):
"""Tests for the EmptyNodeList class."""
Reported by Pylint.
Line: 8
Column: 1
import unittest
import xml.dom
from xml.dom.minicompat import *
class EmptyNodeListTestCase(unittest.TestCase):
"""Tests for the EmptyNodeList class."""
Reported by Pylint.
Line: 8
Column: 1
import unittest
import xml.dom
from xml.dom.minicompat import *
class EmptyNodeListTestCase(unittest.TestCase):
"""Tests for the EmptyNodeList class."""
Reported by Pylint.
Line: 22
Column: 13
self.assertIsNone(node_list.item(-1)) # invalid item
with self.assertRaises(IndexError):
node_list[0]
with self.assertRaises(IndexError):
node_list[-1]
def test_emptynodelist_length(self):
node_list = EmptyNodeList()
Reported by Pylint.
Line: 24
Column: 13
with self.assertRaises(IndexError):
node_list[0]
with self.assertRaises(IndexError):
node_list[-1]
def test_emptynodelist_length(self):
node_list = EmptyNodeList()
# Reading
self.assertEqual(node_list.length, 0)
Reported by Pylint.
Line: 55
Column: 13
self.assertIsNone(node_list.item(-1))
with self.assertRaises(IndexError):
node_list[0]
with self.assertRaises(IndexError):
node_list[-1]
# Now, use a NodeList with items.
node_list.append(111)
Reported by Pylint.
Line: 57
Column: 13
with self.assertRaises(IndexError):
node_list[0]
with self.assertRaises(IndexError):
node_list[-1]
# Now, use a NodeList with items.
node_list.append(111)
node_list.append(999)
Reported by Pylint.
Line: 92
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
# Empty NodeList.
node_list = NodeList()
pickled = pickle.dumps(node_list, proto)
unpickled = pickle.loads(pickled)
self.assertIsNot(unpickled, node_list)
self.assertEqual(unpickled, node_list)
# Non-empty NodeList.
node_list.append(1)
Reported by Bandit.
Line: 100
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
node_list.append(1)
node_list.append(2)
pickled = pickle.dumps(node_list, proto)
unpickled = pickle.loads(pickled)
self.assertIsNot(unpickled, node_list)
self.assertEqual(unpickled, node_list)
def test_nodelist_copy(self):
# Empty NodeList.
Reported by Bandit.
Line: 1
Column: 1
# Tests for xml.dom.minicompat
import copy
import pickle
import unittest
import xml.dom
from xml.dom.minicompat import *
Reported by Pylint.
Lib/test/test_userlist.py
26 issues
Line: 1
Column: 1
# Check every path through every method of UserList
from collections import UserList
from test import list_tests
import unittest
class UserListTest(list_tests.CommonTest):
type2test = UserList
Reported by Pylint.
Line: 7
Column: 1
from test import list_tests
import unittest
class UserListTest(list_tests.CommonTest):
type2test = UserList
def test_getslice(self):
super().test_getslice()
l = [0, 1, 2, 3, 4]
Reported by Pylint.
Line: 12
Column: 9
def test_getslice(self):
super().test_getslice()
l = [0, 1, 2, 3, 4]
u = self.type2test(l)
for i in range(-3, 6):
self.assertEqual(u[:i], l[:i])
self.assertEqual(u[i:], l[i:])
for j in range(-3, 6):
Reported by Pylint.
Line: 13
Column: 9
def test_getslice(self):
super().test_getslice()
l = [0, 1, 2, 3, 4]
u = self.type2test(l)
for i in range(-3, 6):
self.assertEqual(u[:i], l[:i])
self.assertEqual(u[i:], l[i:])
for j in range(-3, 6):
self.assertEqual(u[i:j], l[i:j])
Reported by Pylint.
Line: 20
Column: 5
for j in range(-3, 6):
self.assertEqual(u[i:j], l[i:j])
def test_slice_type(self):
l = [0, 1, 2, 3, 4]
u = UserList(l)
self.assertIsInstance(u[:], u.__class__)
self.assertEqual(u[:],u)
Reported by Pylint.
Line: 21
Column: 9
self.assertEqual(u[i:j], l[i:j])
def test_slice_type(self):
l = [0, 1, 2, 3, 4]
u = UserList(l)
self.assertIsInstance(u[:], u.__class__)
self.assertEqual(u[:],u)
def test_add_specials(self):
Reported by Pylint.
Line: 22
Column: 9
def test_slice_type(self):
l = [0, 1, 2, 3, 4]
u = UserList(l)
self.assertIsInstance(u[:], u.__class__)
self.assertEqual(u[:],u)
def test_add_specials(self):
u = UserList("spam")
Reported by Pylint.
Line: 26
Column: 5
self.assertIsInstance(u[:], u.__class__)
self.assertEqual(u[:],u)
def test_add_specials(self):
u = UserList("spam")
u2 = u + "eggs"
self.assertEqual(u2, list("spameggs"))
def test_radd_specials(self):
Reported by Pylint.
Line: 27
Column: 9
self.assertEqual(u[:],u)
def test_add_specials(self):
u = UserList("spam")
u2 = u + "eggs"
self.assertEqual(u2, list("spameggs"))
def test_radd_specials(self):
u = UserList("eggs")
Reported by Pylint.
Line: 28
Column: 9
def test_add_specials(self):
u = UserList("spam")
u2 = u + "eggs"
self.assertEqual(u2, list("spameggs"))
def test_radd_specials(self):
u = UserList("eggs")
u2 = "spam" + u
Reported by Pylint.
Tools/c-analyzer/c_parser/preprocessor/__main__.py
26 issues
Line: 17
Column: 1
get_prog,
main_for_filenames,
)
from . import (
errors as _errors,
get_preprocessor as _get_preprocessor,
)
Reported by Pylint.
Line: 46
Column: 9
def process_args(args, *, argv):
ns = vars(args)
process_fail_arg(args, argv)
ignore_exc = ns.pop('ignore_exc')
# We later pass ignore_exc to _get_preprocessor().
args.get_file_preprocessor = get_preprocessor(
file_macros=ns.pop('macros'),
Reported by Pylint.
Line: 4
Column: 1
import logging
import sys
from c_common.scriptutil import (
CLIArgSpec as Arg,
add_verbosity_cli,
add_traceback_cli,
add_kind_filtering_cli,
add_files_cli,
Reported by Pylint.
Line: 98
Column: 23
if 'get_file_preprocessor' not in kwargs:
kwargs['get_file_preprocessor'] = _get_preprocessor()
if raw:
def show_file(filename, lines):
for line in lines:
print(line)
#print(line.raw)
else:
def show_file(filename, lines):
Reported by Pylint.
Line: 105
Column: 17
else:
def show_file(filename, lines):
for line in lines:
linefile = ''
if line.filename != filename:
linefile = f' ({line.filename})'
text = line.data
if line.kind == 'comment':
text = '/* ' + line.data.splitlines()[0]
Reported by Pylint.
Line: 120
Column: 15
show_file(filename, lines)
def _cli_data(parser):
...
return None
Reported by Pylint.
Line: 129
Column: 3
def cmd_data(filenames,
**kwargs
):
# XXX
raise NotImplementedError
COMMANDS = {
'preprocess': (
Reported by Pylint.
Line: 150
Column: 1
#######################################
# the script
def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *,
subset='preprocess',
excluded=None,
**prepr_kwargs
):
import argparse
Reported by Pylint.
Line: 150
Column: 1
#######################################
# the script
def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *,
subset='preprocess',
excluded=None,
**prepr_kwargs
):
import argparse
Reported by Pylint.
Line: 152
Column: 16
def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *,
subset='preprocess',
excluded=None,
**prepr_kwargs
):
import argparse
parser = argparse.ArgumentParser(
prog=prog or get_prog(),
Reported by Pylint.
Lib/distutils/command/bdist_dumb.py
26 issues
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Line: 11
Column: 1
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
class bdist_dumb(Command):
Reported by Pylint.
Lib/lib2to3/pgen2/parse.py
26 issues
Line: 14
Column: 1
"""
# Local imports
from . import token
class ParseError(Exception):
"""Exception to signal the parser is stuck."""
def __init__(self, msg, type, value, context):
Reported by Pylint.
Line: 19
Column: 29
class ParseError(Exception):
"""Exception to signal the parser is stuck."""
def __init__(self, msg, type, value, context):
Exception.__init__(self, "%s: type=%r, value=%r, context=%r" %
(msg, type, value, context))
self.msg = msg
self.type = type
self.value = value
Reported by Pylint.
Line: 112
Column: 9
# where children is a list of nodes or None, and context may be None.
newnode = (start, None, None, [])
stackentry = (self.grammar.dfas[start], 0, newnode)
self.stack = [stackentry]
self.rootnode = None
self.used_names = set() # Aliased to self.rootnode.used_names in pop()
def addtoken(self, type, value, context):
"""Add a token; return True iff this is the end of the program."""
Reported by Pylint.
Line: 113
Column: 9
newnode = (start, None, None, [])
stackentry = (self.grammar.dfas[start], 0, newnode)
self.stack = [stackentry]
self.rootnode = None
self.used_names = set() # Aliased to self.rootnode.used_names in pop()
def addtoken(self, type, value, context):
"""Add a token; return True iff this is the end of the program."""
# Map from token to label
Reported by Pylint.
Line: 114
Column: 9
stackentry = (self.grammar.dfas[start], 0, newnode)
self.stack = [stackentry]
self.rootnode = None
self.used_names = set() # Aliased to self.rootnode.used_names in pop()
def addtoken(self, type, value, context):
"""Add a token; return True iff this is the end of the program."""
# Map from token to label
ilabel = self.classify(type, value, context)
Reported by Pylint.
Line: 116
Column: 24
self.rootnode = None
self.used_names = set() # Aliased to self.rootnode.used_names in pop()
def addtoken(self, type, value, context):
"""Add a token; return True iff this is the end of the program."""
# Map from token to label
ilabel = self.classify(type, value, context)
# Loop until the token is shifted; may raise exceptions
while True:
Reported by Pylint.
Line: 122
Column: 25
ilabel = self.classify(type, value, context)
# Loop until the token is shifted; may raise exceptions
while True:
dfa, state, node = self.stack[-1]
states, first = dfa
arcs = states[state]
# Look for a state with this label
for i, newstate in arcs:
t, v = self.grammar.labels[i]
Reported by Pylint.
Line: 123
Column: 21
# Loop until the token is shifted; may raise exceptions
while True:
dfa, state, node = self.stack[-1]
states, first = dfa
arcs = states[state]
# Look for a state with this label
for i, newstate in arcs:
t, v = self.grammar.labels[i]
if ilabel == i:
Reported by Pylint.
Line: 127
Column: 20
arcs = states[state]
# Look for a state with this label
for i, newstate in arcs:
t, v = self.grammar.labels[i]
if ilabel == i:
# Look it up in the list of labels
assert t < 256
# Shift a token; we're done with it
self.shift(type, value, newstate, context)
Reported by Pylint.
Line: 147
Column: 21
elif t >= 256:
# See if it's a symbol and if we're in its first set
itsdfa = self.grammar.dfas[t]
itsstates, itsfirst = itsdfa
if ilabel in itsfirst:
# Push a symbol
self.push(t, self.grammar.dfas[t], newstate, context)
break # To continue the outer while loop
else:
Reported by Pylint.
Lib/asynchat.py
26 issues
Line: 75
Column: 35
use_encoding = 0
encoding = 'latin-1'
def __init__(self, sock=None, map=None):
# for string terminator matching
self.ac_in_buffer = b''
# we use a list here rather than io.BytesIO for a few reasons...
# del lst[:] is faster than bio.truncate(0)
Reported by Pylint.
Line: 112
Column: 9
term = bytes(term, self.encoding)
elif isinstance(term, int) and term < 0:
raise ValueError('the number of received bytes must be positive')
self.terminator = term
def get_terminator(self):
return self.terminator
# grab some more data from the socket,
Reported by Pylint.
Line: 154
Column: 21
if lb < n:
self.collect_incoming_data(self.ac_in_buffer)
self.ac_in_buffer = b''
self.terminator = self.terminator - lb
else:
self.collect_incoming_data(self.ac_in_buffer[:n])
self.ac_in_buffer = self.ac_in_buffer[n:]
self.terminator = 0
self.found_terminator()
Reported by Pylint.
Line: 158
Column: 21
else:
self.collect_incoming_data(self.ac_in_buffer[:n])
self.ac_in_buffer = self.ac_in_buffer[n:]
self.terminator = 0
self.found_terminator()
else:
# 3 cases:
# 1) end of buffer matches terminator exactly:
# collect data, transition
Reported by Pylint.
Line: 202
Column: 13
def push(self, data):
if not isinstance(data, (bytes, bytearray, memoryview)):
raise TypeError('data argument must be byte-ish (%r)',
type(data))
sabs = self.ac_out_buffer_size
if len(data) > sabs:
for i in range(0, len(data), sabs):
self.producer_fifo.append(data[i:i+sabs])
Reported by Pylint.
Line: 60
Column: 1
class async_chat(asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
the two methods collect_incoming_data() and found_terminator()"""
# these are overridable defaults
Reported by Pylint.
Line: 89
Column: 5
self.producer_fifo = deque()
asyncore.dispatcher.__init__(self, sock, map)
def collect_incoming_data(self, data):
raise NotImplementedError("must be implemented in subclass")
def _collect_incoming_data(self, data):
self.incoming.append(data)
Reported by Pylint.
Line: 96
Column: 9
self.incoming.append(data)
def _get_data(self):
d = b''.join(self.incoming)
del self.incoming[:]
return d
def found_terminator(self):
raise NotImplementedError("must be implemented in subclass")
Reported by Pylint.
Line: 100
Column: 5
del self.incoming[:]
return d
def found_terminator(self):
raise NotImplementedError("must be implemented in subclass")
def set_terminator(self, term):
"""Set the input delimiter.
Reported by Pylint.
Line: 114
Column: 5
raise ValueError('the number of received bytes must be positive')
self.terminator = term
def get_terminator(self):
return self.terminator
# grab some more data from the socket,
# throw it to the collector method,
# check for the terminator,
Reported by Pylint.
Lib/distutils/version.py
26 issues
Line: 40
Column: 13
def __init__ (self, vstring=None):
if vstring:
self.parse(vstring)
def __repr__ (self):
return "%s ('%s')" % (self.__class__.__name__, str(self))
def __eq__(self, other):
Reported by Pylint.
Line: 46
Column: 13
return "%s ('%s')" % (self.__class__.__name__, str(self))
def __eq__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c == 0
def __lt__(self, other):
Reported by Pylint.
Line: 52
Column: 13
return c == 0
def __lt__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c < 0
def __le__(self, other):
Reported by Pylint.
Line: 58
Column: 13
return c < 0
def __le__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c <= 0
def __gt__(self, other):
Reported by Pylint.
Line: 64
Column: 13
return c <= 0
def __gt__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c > 0
def __ge__(self, other):
Reported by Pylint.
Line: 70
Column: 13
return c > 0
def __ge__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c >= 0
Reported by Pylint.
Line: 143
Column: 13
match.group(1, 2, 4, 5, 6)
if patch:
self.version = tuple(map(int, [major, minor, patch]))
else:
self.version = tuple(map(int, [major, minor])) + (0,)
if prerelease:
self.prerelease = (prerelease[0], int(prerelease_num))
Reported by Pylint.
Line: 145
Column: 13
if patch:
self.version = tuple(map(int, [major, minor, patch]))
else:
self.version = tuple(map(int, [major, minor])) + (0,)
if prerelease:
self.prerelease = (prerelease[0], int(prerelease_num))
else:
self.prerelease = None
Reported by Pylint.
Line: 148
Column: 13
self.version = tuple(map(int, [major, minor])) + (0,)
if prerelease:
self.prerelease = (prerelease[0], int(prerelease_num))
else:
self.prerelease = None
def __str__ (self):
Reported by Pylint.
Line: 150
Column: 13
if prerelease:
self.prerelease = (prerelease[0], int(prerelease_num))
else:
self.prerelease = None
def __str__ (self):
if self.version[2] == 0:
Reported by Pylint.
Doc/conf.py
26 issues
Line: 35
Column: 1
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import patchlevel
version, release = patchlevel.get_version_info()
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
today = ''
Reported by Pylint.
Line: 31
Column: 1
# General substitutions.
project = 'Python'
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import patchlevel
version, release = patchlevel.get_version_info()
Reported by Pylint.
Line: 1
Column: 1
#
# Python documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
import sys, os, time
Reported by Pylint.
Line: 9
Column: 1
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
import sys, os, time
sys.path.append(os.path.abspath('tools/extensions'))
sys.path.append(os.path.abspath('includes'))
# General configuration
# ---------------------
Reported by Pylint.
Line: 20
Column: 1
'pyspecific', 'c_annotations', 'escape4chm',
'asdl_highlight', 'peg_highlight', 'glossary_search']
doctest_global_setup = '''
try:
import _tkinter
except ImportError:
_tkinter = None
'''
Reported by Pylint.
Line: 27
Column: 1
_tkinter = None
'''
manpages_url = 'https://manpages.debian.org/{path}'
# General substitutions.
project = 'Python'
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
Reported by Pylint.
Line: 30
Column: 1
manpages_url = 'https://manpages.debian.org/{path}'
# General substitutions.
project = 'Python'
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import patchlevel
Reported by Pylint.
Line: 35
Column: 1
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import patchlevel
version, release = patchlevel.get_version_info()
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
today = ''
Reported by Pylint.
Line: 40
Column: 1
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# By default, highlight as Python 3.
highlight_language = 'python3'
Reported by Pylint.
Line: 42
Column: 1
# non-false value, then it is used:
today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# By default, highlight as Python 3.
highlight_language = 'python3'
# Minimum version of sphinx required
Reported by Pylint.
Lib/json/decoder.py
25 issues
Line: 69
Column: 1
msg = "Invalid \\uXXXX escape"
raise JSONDecodeError(msg, s, pos)
def py_scanstring(s, end, strict=True,
_b=BACKSLASH, _m=STRINGCHUNK.match):
"""Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
Unescapes all valid JSON string escape sequences and raises ValueError
on attempt to decode an invalid string. If strict is False then literal
Reported by Pylint.
Line: 114
Column: 17
char = _b[esc]
except KeyError:
msg = "Invalid \\escape: {0!r}".format(esc)
raise JSONDecodeError(msg, s, end)
end += 1
else:
uni = _decode_uXXXX(s, end)
end += 5
if 0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u':
Reported by Pylint.
Line: 59
Column: 1
'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t',
}
def _decode_uXXXX(s, pos):
esc = s[pos + 1:pos + 5]
if len(esc) == 4 and esc[1] not in 'xX':
try:
return int(esc, 16)
except ValueError:
Reported by Pylint.
Line: 59
Column: 1
'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t',
}
def _decode_uXXXX(s, pos):
esc = s[pos + 1:pos + 5]
if len(esc) == 4 and esc[1] not in 'xX':
try:
return int(esc, 16)
except ValueError:
Reported by Pylint.
Line: 69
Column: 1
msg = "Invalid \\uXXXX escape"
raise JSONDecodeError(msg, s, pos)
def py_scanstring(s, end, strict=True,
_b=BACKSLASH, _m=STRINGCHUNK.match):
"""Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
Unescapes all valid JSON string escape sequences and raises ValueError
on attempt to decode an invalid string. If strict is False then literal
Reported by Pylint.
Line: 69
Column: 1
msg = "Invalid \\uXXXX escape"
raise JSONDecodeError(msg, s, pos)
def py_scanstring(s, end, strict=True,
_b=BACKSLASH, _m=STRINGCHUNK.match):
"""Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
Unescapes all valid JSON string escape sequences and raises ValueError
on attempt to decode an invalid string. If strict is False then literal
Reported by Pylint.
Line: 93
Column: 9
_append(content)
# Terminator is the end of string, a literal control character,
# or a backslash denoting that an escape sequence follows
if terminator == '"':
break
elif terminator != '\\':
if strict:
#msg = "Invalid control character %r at" % (terminator,)
msg = "Invalid control character {0!r} at".format(terminator)
Reported by Pylint.
Line: 96
Column: 13
if terminator == '"':
break
elif terminator != '\\':
if strict:
#msg = "Invalid control character %r at" % (terminator,)
msg = "Invalid control character {0!r} at".format(terminator)
raise JSONDecodeError(msg, s, end)
else:
_append(terminator)
Reported by Pylint.
Line: 136
Column: 1
WHITESPACE_STR = ' \t\n\r'
def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
memo=None, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
s, end = s_and_end
pairs = []
pairs_append = pairs.append
# Backwards compatibility
Reported by Pylint.
Line: 136
Column: 1
WHITESPACE_STR = ' \t\n\r'
def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
memo=None, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
s, end = s_and_end
pairs = []
pairs_append = pairs.append
# Backwards compatibility
Reported by Pylint.