The following issues were found

Lib/idlelib/browser.py
25 issues
Method has no argument
Error

Line: 239 Column: 13

                      file = __file__
        # Add nested objects for htest.
        class Nested_in_func(TreeNode):
            def nested_in_class(): pass
        def closure():
            class Nested_in_closure: pass
    ModuleBrowser(parent, file, _htest=True)

if __name__ == "__main__":

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 89 Column: 21

                      self._utest = _utest
        self.init()

    def close(self, event=None):
        "Dismiss the window and the tree nodes."
        self.top.destroy()
        self.node.destroy()

    def init(self):

            

Reported by Pylint.

Using the global statement
Error

Line: 96 Column: 9

              
    def init(self):
        "Create browser tkinter widgets, including the tree."
        global file_open
        root = self.master
        flist = (pyshell.flist if not (self._htest or self._utest)
                 else pyshell.PyShellFileList(root))
        file_open = flist.open
        pyclbr._modules.clear()

            

Reported by Pylint.

Access to a protected member _modules of a client class
Error

Line: 101 Column: 9

                      flist = (pyshell.flist if not (self._htest or self._utest)
                 else pyshell.PyShellFileList(root))
        file_open = flist.open
        pyclbr._modules.clear()

        # create top
        self.top = top = ListedToplevel(root)
        top.protocol("WM_DELETE_WINDOW", self.close)
        top.bind("<Escape>", self.close)

            

Reported by Pylint.

__init__ method from base class 'TreeItem' is not called
Error

Line: 142 Column: 5

                  Used by both browsers.
    """

    def __init__(self, file):
        """Create a TreeItem for the file.

        Args:
            file: Full path and module name.
        """

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 176 Column: 9

              
    def listchildren(self):
        "Return sequenced classes and functions in the module."
        dir, base = os.path.split(self.file)
        name, ext = os.path.splitext(base)
        if os.path.normcase(ext) != ".py":
            return []
        try:
            tree = pyclbr.readmodule_ex(name, [dir] + sys.path)

            

Reported by Pylint.

__init__ method from base class 'TreeItem' is not called
Error

Line: 193 Column: 5

                  Uses TreeItem as the basis for the structure of the tree.
    """

    def __init__(self, obj):
        "Create a TreeItem for a pyclbr class/function object."
        self.obj = obj
        self.name = obj.name
        self.isfunction = isinstance(obj, pyclbr.Function)


            

Reported by Pylint.

Unused variable 'Nested_in_func'
Error

Line: 238 Column: 9

                  else:
        file = __file__
        # Add nested objects for htest.
        class Nested_in_func(TreeNode):
            def nested_in_class(): pass
        def closure():
            class Nested_in_closure: pass
    ModuleBrowser(parent, file, _htest=True)


            

Reported by Pylint.

Unused variable 'closure'
Error

Line: 240 Column: 9

                      # Add nested objects for htest.
        class Nested_in_func(TreeNode):
            def nested_in_class(): pass
        def closure():
            class Nested_in_closure: pass
    ModuleBrowser(parent, file, _htest=True)

if __name__ == "__main__":
    if len(sys.argv) == 1:  # If pass file on command line, unittest fails.

            

Reported by Pylint.

Unused variable 'Nested_in_closure'
Error

Line: 241 Column: 13

                      class Nested_in_func(TreeNode):
            def nested_in_class(): pass
        def closure():
            class Nested_in_closure: pass
    ModuleBrowser(parent, file, _htest=True)

if __name__ == "__main__":
    if len(sys.argv) == 1:  # If pass file on command line, unittest fails.
        from unittest import main

            

Reported by Pylint.

Doc/tools/rstlint.py
25 issues
TODO: - wrong versions in versionadded/changed
Error

Line: 9 Column: 3

              #
# 01/2009, Georg Brandl

# TODO: - wrong versions in versionadded/changed
#       - wrong markup after versionchanged directive

import os
import re
import sys

            

Reported by Pylint.

Unused argument 'fn'
Error

Line: 167 Column: 33

              

@checker('.rst', severity=2)
def check_suspicious_constructs(fn, lines):
    """Check for suspicious reST constructs."""
    inprod = False
    for lno, line in enumerate(lines, start=1):
        if seems_directive_re.search(line):
            yield lno, "comment seems to be intended as a directive"

            

Reported by Pylint.

Unused argument 'fn'
Error

Line: 188 Column: 22

              

@checker('.py', '.rst')
def check_whitespace(fn, lines):
    """Check for whitespace and line length issues."""
    for lno, line in enumerate(lines):
        if '\r' in line:
            yield lno+1, '\\r in line'
        if '\t' in line:

            

Reported by Pylint.

Unused argument 'fn'
Error

Line: 200 Column: 23

              

@checker('.rst', severity=0)
def check_line_length(fn, lines):
    """Check for line length; this checker is not run by default."""
    for lno, line in enumerate(lines):
        if len(line) > 81:
            # don't complain about tables, links and function signatures
            if line.lstrip()[0] not in '+|' and \

            

Reported by Pylint.

Unused argument 'fn'
Error

Line: 214 Column: 25

              

@checker('.html', severity=2, falsepositives=True)
def check_leaked_markup(fn, lines):
    """Check HTML files for leaked reST markup; this only works if
    the HTML files have been built.
    """
    for lno, line in enumerate(lines):
        if leaked_markup_re.search(line):

            

Reported by Pylint.

Unused argument 'fn'
Error

Line: 277 Column: 45

              

@checker(".rst", severity=2)
def check_missing_surrogate_space_on_plural(fn, lines):
    r"""Check for missing 'backslash-space' between a code sample a letter.

    Good: ``Point``\ s
    Bad: ``Point``s
    """

            

Reported by Pylint.

Redefining name 'checker' from outer scope (line 141)
Error

Line: 372 Column: 17

                              count[4] += 1
                continue

            for checker in checkerlist:
                if checker.falsepositives and not falsepos:
                    continue
                csev = checker.severity
                if csev >= severity:
                    for lno, msg in checker(fn, lines):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Check for stylistic and formal issues in .rst and .py
# files included in the documentation.
#
# 01/2009, Georg Brandl

# TODO: - wrong versions in versionadded/changed

            

Reported by Pylint.

Constant name "all_directives" doesn't conform to UPPER_CASE naming style
Error

Line: 101 Column: 1

                  ":2to3fixer:",
]

all_directives = "(" + "|".join(directives) + ")"
all_roles = "(" + "|".join(roles) + ")"

# Find comments that looks like a directive, like:
# .. versionchanged 3.6
# or

            

Reported by Pylint.

Constant name "all_roles" doesn't conform to UPPER_CASE naming style
Error

Line: 102 Column: 1

              ]

all_directives = "(" + "|".join(directives) + ")"
all_roles = "(" + "|".join(roles) + ")"

# Find comments that looks like a directive, like:
# .. versionchanged 3.6
# or
# .. versionchanged: 3.6

            

Reported by Pylint.

Lib/lib2to3/fixes/fix_tuple_params.py
25 issues
Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              # Author: Collin Winter

# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms

def is_docstring(stmt):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

              
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms

def is_docstring(stmt):
    return isinstance(stmt, pytree.Node) and \

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              # Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms

def is_docstring(stmt):
    return isinstance(stmt, pytree.Node) and \
           stmt.children[0].type == token.STRING

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

              from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms

def is_docstring(stmt):
    return isinstance(stmt, pytree.Node) and \
           stmt.children[0].type == token.STRING


            

Reported by Pylint.

TODO(cwinter): suite-cleanup
Error

Line: 54 Column: 3

                      suite = results["suite"]
        args = results["args"]
        # This crap is so "def foo(...): x = 5; y = 7" is handled correctly.
        # TODO(cwinter): suite-cleanup
        if suite[0].children[1].type == token.INDENT:
            start = 2
            indent = suite[0].children[1].value
            end = Newline()
        else:

            

Reported by Pylint.

TODO(cwinter) get rid of this when children becomes a smart list
Error

Line: 91 Column: 3

                          return

        # This isn't strictly necessary, but it plays nicely with other fixers.
        # TODO(cwinter) get rid of this when children becomes a smart list
        for line in new_lines:
            line.parent = suite[0]

        # TODO(cwinter) suite-cleanup
        after = start

            

Reported by Pylint.

TODO(cwinter) suite-cleanup
Error

Line: 95 Column: 3

                      for line in new_lines:
            line.parent = suite[0]

        # TODO(cwinter) suite-cleanup
        after = start
        if start == 0:
            new_lines[0].prefix = " "
        elif is_docstring(suite[0].children[start]):
            new_lines[0].prefix = indent

            

Reported by Pylint.

Unused argument 'node'
Error

Line: 110 Column: 32

                          suite[0].children[i].prefix = indent
        suite[0].changed()

    def transform_lambda(self, node, results):
        args = results["args"]
        body = results["body"]
        inner = simplify_args(results["inner"])

        # Replace lambda ((((x)))): x  with lambda x: x

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 157 Column: 1

                      return node.value
    return [find_params(c) for c in node.children if c.type != token.COMMA]

def map_to_index(param_list, prefix=[], d=None):
    if d is None:
        d = {}
    for i, obj in enumerate(param_list):
        trailer = [Subscript(Number(str(i)))]
        if isinstance(obj, list):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

              from .. import fixer_base
from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms

def is_docstring(stmt):
    return isinstance(stmt, pytree.Node) and \
           stmt.children[0].type == token.STRING

class FixTupleParams(fixer_base.BaseFix):
    run_order = 4 #use a lower order since lambda is part of other

            

Reported by Pylint.

Lib/idlelib/searchengine.py
25 issues
Access to a protected member _searchengine of a client class
Error

Line: 14 Column: 9

                  If there is not a SearchEngine already, make one.
    '''
    if not hasattr(root, "_searchengine"):
        root._searchengine = SearchEngine(root)
        # This creates a cycle that persists until root is deleted.
    return root._searchengine


class SearchEngine:

            

Reported by Pylint.

Access to a protected member _searchengine of a client class
Error

Line: 16 Column: 12

                  if not hasattr(root, "_searchengine"):
        root._searchengine = SearchEngine(root)
        # This creates a cycle that persists until root is deleted.
    return root._searchengine


class SearchEngine:
    """Handles searching a text widget for Find, Replace, and Grep."""


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 37 Column: 5

              
    # Access methods

    def getpat(self):
        return self.patvar.get()

    def setpat(self, pat):
        self.patvar.set(pat)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 40 Column: 5

                  def getpat(self):
        return self.patvar.get()

    def setpat(self, pat):
        self.patvar.set(pat)

    def isre(self):
        return self.revar.get()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                  def setpat(self, pat):
        self.patvar.set(pat)

    def isre(self):
        return self.revar.get()

    def iscase(self):
        return self.casevar.get()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

                  def isre(self):
        return self.revar.get()

    def iscase(self):
        return self.casevar.get()

    def isword(self):
        return self.wordvar.get()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 49 Column: 5

                  def iscase(self):
        return self.casevar.get()

    def isword(self):
        return self.wordvar.get()

    def iswrap(self):
        return self.wrapvar.get()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 52 Column: 5

                  def isword(self):
        return self.wordvar.get()

    def iswrap(self):
        return self.wrapvar.get()

    def isback(self):
        return self.backvar.get()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 55 Column: 5

                  def iswrap(self):
        return self.wrapvar.get()

    def isback(self):
        return self.backvar.get()

    # Higher level access methods

    def setcookedpat(self, pat):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 67 Column: 5

                          pat = re.escape(pat)
        self.setpat(pat)

    def getcookedpat(self):
        pat = self.getpat()
        if not self.isre():  # if True, see setcookedpat
            pat = re.escape(pat)
        if self.isword():
            pat = r"\b%s\b" % pat

            

Reported by Pylint.

Lib/idlelib/calltip.py
25 issues
Unused argument 'event'
Error

Line: 36 Column: 37

                      # See __init__ for usage
        return calltip_w.CalltipWindow(self.text)

    def remove_calltip_window(self, event=None):
        if self.active_calltip:
            self.active_calltip.hidetip()
            self.active_calltip = None

    def force_open_calltip_event(self, event):

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 41 Column: 40

                          self.active_calltip.hidetip()
            self.active_calltip = None

    def force_open_calltip_event(self, event):
        "The user selected the menu entry or hotkey, open the tip."
        self.open_calltip(True)
        return "break"

    def try_open_calltip_event(self, event):

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 46 Column: 38

                      self.open_calltip(True)
        return "break"

    def try_open_calltip_event(self, event):
        """Happens when it would be nice to open a calltip, but not really
        necessary, for example after an opening bracket, so function calls
        won't be made.
        """
        self.open_calltip(False)

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 53 Column: 37

                      """
        self.open_calltip(False)

    def refresh_calltip_event(self, event):
        if self.active_calltip and self.active_calltip.tipwindow:
            self.open_calltip(False)

    def open_calltip(self, evalfuncs):
        """Maybe close an existing calltip and maybe open a new calltip.

            

Reported by Pylint.

Use of eval
Error

Line: 140 Column: 20

                  if expression:
        namespace = {**sys.modules, **__main__.__dict__}
        try:
            return eval(expression, namespace)  # Only protect user code.
        except BaseException:
            # An uncaught exception closes idle, and eval can raise any
            # exception, especially if user classes are involved.
            return None


            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 140
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                  if expression:
        namespace = {**sys.modules, **__main__.__dict__}
        try:
            return eval(expression, namespace)  # Only protect user code.
        except BaseException:
            # An uncaught exception closes idle, and eval can raise any
            # exception, especially if user classes are involved.
            return None


            

Reported by Bandit.

Catching too general exception BaseException
Error

Line: 141 Column: 16

                      namespace = {**sys.modules, **__main__.__dict__}
        try:
            return eval(expression, namespace)  # Only protect user code.
        except BaseException:
            # An uncaught exception closes idle, and eval can raise any
            # exception, especially if user classes are involved.
            return None

# The following are used in get_argspec and some in tests

            

Reported by Pylint.

Catching too general exception BaseException
Error

Line: 166 Column: 12

                  # Determine function object fob to inspect.
    try:
        ob_call = ob.__call__
    except BaseException:  # Buggy user object could raise anything.
        return ''  # No popup for non-callables.
    # For Get_argspecTest.test_buggy_getattr_class, CallA() & CallB().
    fob = ob_call if isinstance(ob_call, types.MethodType) else ob

    # Initialize argspec and wrap it to get lines.

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 174 Column: 12

                  # Initialize argspec and wrap it to get lines.
    try:
        argspec = str(inspect.signature(fob))
    except Exception as err:
        msg = str(err)
        if msg.startswith(_invalid_method):
            return _invalid_method
        else:
            argspec = ''

            

Reported by Pylint.

standard import "import inspect" should be placed before "import __main__"
Error

Line: 8 Column: 1

              which disappear when you type a closing parenthesis.
"""
import __main__
import inspect
import re
import sys
import textwrap
import types


            

Reported by Pylint.

Lib/idlelib/query.py
25 issues
Dangerous default value {} as argument
Error

Line: 38 Column: 5

              
    For this base class, accept any non-blank string.
    """
    def __init__(self, parent, title, message, *, text0='', used_names={},
                 _htest=False, _utest=False):
        """Create modal popup, return when destroyed.

        Additional subclass init must be done before this unless
        _utest=True is passed to suppress wait_window().

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 139 Column: 18

                          return None
        return entry

    def ok(self, event=None):  # Do not replace.
        '''If entry is valid, bind it to 'result' and destroy tk widget.

        Otherwise leave dialog open for user to correct entry or cancel.
        '''
        self.entry_error['text'] = ''

            

Reported by Pylint.

Attribute 'result' defined outside __init__
Error

Line: 147 Column: 13

                      self.entry_error['text'] = ''
        entry = self.entry_ok()
        if entry is not None:
            self.result = entry
            self.destroy()
        else:
            # [Ok] moves focus.  (<Return> does not.)  Move it back.
            self.entry.focus_set()


            

Reported by Pylint.

Unused argument 'event'
Error

Line: 153 Column: 22

                          # [Ok] moves focus.  (<Return> does not.)  Move it back.
            self.entry.focus_set()

    def cancel(self, event=None):  # Do not replace.
        "Set dialog result to None and destroy tk widget."
        self.result = None
        self.destroy()

    def destroy(self):

            

Reported by Pylint.

Attribute 'result' defined outside __init__
Error

Line: 155 Column: 9

              
    def cancel(self, event=None):  # Do not replace.
        "Set dialog result to None and destroy tk widget."
        self.result = None
        self.destroy()

    def destroy(self):
        self.grab_release()
        super().destroy()

            

Reported by Pylint.

XXX Ought to insert current file's directory in front of path.
Error

Line: 202 Column: 3

                      if not name:
            self.showerror('no name specified.')
            return None
        # XXX Ought to insert current file's directory in front of path.
        try:
            spec = importlib.util.find_spec(name)
        except (ValueError, ImportError) as msg:
            self.showerror(str(msg))
            return None

            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 249 Column: 5

                  "Get menu name and help source for Help menu."
    # Used in ConfigDialog.HelpListItemAdd/Edit, (941/9)

    def __init__(self, parent, title, *, menuitem='', filepath='',
                 used_names={}, _htest=False, _utest=False):
        """Get menu entry and url/local file for Additional Help.

        User enters a name for the Help resource and a web url or file
        name. The user can browse for the file.

            

Reported by Pylint.

Attribute 'pathvar' defined outside __init__
Error

Line: 267 Column: 9

                      frame = self.frame
        pathlabel = Label(frame, anchor='w', justify='left',
                          text='Help File Path: Enter URL or browse for file')
        self.pathvar = StringVar(self, self.filepath)
        self.path = Entry(frame, textvariable=self.pathvar, width=40)
        browse = Button(frame, text='Browse', width=8,
                        command=self.browse_file)
        self.path_error = Label(frame, text=' ', foreground='red',
                                font=self.error_font)

            

Reported by Pylint.

Attribute 'path' defined outside __init__
Error

Line: 268 Column: 9

                      pathlabel = Label(frame, anchor='w', justify='left',
                          text='Help File Path: Enter URL or browse for file')
        self.pathvar = StringVar(self, self.filepath)
        self.path = Entry(frame, textvariable=self.pathvar, width=40)
        browse = Button(frame, text='Browse', width=8,
                        command=self.browse_file)
        self.path_error = Label(frame, text=' ', foreground='red',
                                font=self.error_font)


            

Reported by Pylint.

Attribute 'path_error' defined outside __init__
Error

Line: 271 Column: 9

                      self.path = Entry(frame, textvariable=self.pathvar, width=40)
        browse = Button(frame, text='Browse', width=8,
                        command=self.browse_file)
        self.path_error = Label(frame, text=' ', foreground='red',
                                font=self.error_font)

        pathlabel.grid(column=0, row=10, columnspan=3, padx=5, pady=[10,0],
                       sticky=W)
        self.path.grid(column=0, row=11, columnspan=2, padx=5, sticky=W+E,

            

Reported by Pylint.

Lib/test/profilee.py
25 issues
Using the global statement
Error

Line: 28 Column: 5

              def testfunc():
    # 1 call
    # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions
    global TICKS
    TICKS += 99
    helper()                            # 300
    helper()                            # 300
    TICKS += 171
    factorial(14)                       # 130

            

Reported by Pylint.

Using the global statement
Error

Line: 40 Column: 5

                  # 170 ticks total, 150 ticks local
    # 3 primitive calls, 130, 20 and 20 ticks total
    # including 116, 17, 17 ticks local
    global TICKS
    if n > 0:
        TICKS += n
        return mul(n, factorial(n-1))
    else:
        TICKS += 11

            

Reported by Pylint.

Using the global statement
Error

Line: 51 Column: 5

              def mul(a, b):
    # 20 calls
    # 1 tick, local
    global TICKS
    TICKS += 1
    return a * b

def helper():
    # 2 calls

            

Reported by Pylint.

Using the global statement
Error

Line: 58 Column: 5

              def helper():
    # 2 calls
    # 300 ticks total: 20 ticks local, 260 ticks in subfunctions
    global TICKS
    TICKS += 1
    helper1()                           # 30
    TICKS += 2
    helper1()                           # 30
    TICKS += 6

            

Reported by Pylint.

Using the global statement
Error

Line: 76 Column: 5

              def helper1():
    # 4 calls
    # 30 ticks total: 29 ticks local, 1 tick in subfunctions
    global TICKS
    TICKS += 10
    hasattr(C(), "foo")                 # 1
    TICKS += 19
    lst = []
    lst.append(42)                      # 0

            

Reported by Pylint.

Using the global statement
Error

Line: 91 Column: 5

              def helper2():
    # 8 calls
    # 50 ticks local: 39 ticks local, 11 ticks in subfunctions
    global TICKS
    TICKS += 11
    hasattr(C(), "bar")                 # 1
    TICKS += 13
    subhelper()                         # 10
    TICKS += 15

            

Reported by Pylint.

Using the global statement
Error

Line: 101 Column: 5

              def subhelper():
    # 8 calls
    # 10 ticks total: 8 ticks local, 2 ticks in subfunctions
    global TICKS
    TICKS += 2
    for i in range(2):                  # 0
        try:
            C().foo                     # 1 x 2
        except AttributeError:

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 103 Column: 9

                  # 10 ticks total: 8 ticks local, 2 ticks in subfunctions
    global TICKS
    TICKS += 2
    for i in range(2):                  # 0
        try:
            C().foo                     # 1 x 2
        except AttributeError:
            TICKS += 3                  # 3 x 2


            

Reported by Pylint.

Using the global statement
Error

Line: 113 Column: 9

                  def __getattr__(self, name):
        # 28 calls
        # 1 tick, local
        global TICKS
        TICKS += 1
        raise AttributeError

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 1

              # included in the profile and would appear to consume all the time.)
TICKS = 42000

def timer():
    return TICKS

def testfunc():
    # 1 call
    # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions

            

Reported by Pylint.

Lib/test/test_importlib/abc.py
25 issues
Module 'abc' has no 'abstractmethod' member
Error

Line: 8 Column: 6

              
    """Basic tests for a finder to pass."""

    @abc.abstractmethod
    def test_module(self):
        # Test importing a top-level module.
        pass

    @abc.abstractmethod

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 13 Column: 6

                      # Test importing a top-level module.
        pass

    @abc.abstractmethod
    def test_package(self):
        # Test importing a package.
        pass

    @abc.abstractmethod

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 18 Column: 6

                      # Test importing a package.
        pass

    @abc.abstractmethod
    def test_module_in_package(self):
        # Test importing a module contained within a package.
        # A value for 'path' should be used if for a meta_path finder.
        pass


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 24 Column: 6

                      # A value for 'path' should be used if for a meta_path finder.
        pass

    @abc.abstractmethod
    def test_package_in_package(self):
        # Test importing a subpackage.
        # A value for 'path' should be used if for a meta_path finder.
        pass


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 30 Column: 6

                      # A value for 'path' should be used if for a meta_path finder.
        pass

    @abc.abstractmethod
    def test_package_over_module(self):
        # Test that packages are chosen over modules.
        pass

    @abc.abstractmethod

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 35 Column: 6

                      # Test that packages are chosen over modules.
        pass

    @abc.abstractmethod
    def test_failure(self):
        # Test trying to find a module that cannot be handled.
        pass



            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 43 Column: 6

              
class LoaderTests(metaclass=abc.ABCMeta):

    @abc.abstractmethod
    def test_module(self):
        """A module should load without issue.

        After the loader returns the module should be in sys.modules.


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 59 Column: 6

                      """
        pass

    @abc.abstractmethod
    def test_package(self):
        """Loading a package should work.

        After the loader returns the module should be in sys.modules.


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 76 Column: 6

                      """
        pass

    @abc.abstractmethod
    def test_lacking_parent(self):
        """A loader should not be dependent on it's parent package being
        imported."""
        pass


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 82 Column: 6

                      imported."""
        pass

    @abc.abstractmethod
    def test_state_after_failure(self):
        """If a module is already in sys.modules and a reload fails
        (e.g. a SyntaxError), the module should be in the state it was before
        the reload began."""
        pass

            

Reported by Pylint.

Lib/test/_test_embed_set_config.py
25 issues
Module '_testinternalcapi' has no 'get_config' member; maybe 'get_configs'?
Error

Line: 19 Column: 27

              
class SetConfigTests(unittest.TestCase):
    def setUp(self):
        self.old_config = _testinternalcapi.get_config()
        self.sys_copy = dict(sys.__dict__)

    def tearDown(self):
        _testinternalcapi.set_config(self.old_config)
        sys.__dict__.clear()

            

Reported by Pylint.

Module '_testinternalcapi' has no 'set_config' member
Error

Line: 23 Column: 9

                      self.sys_copy = dict(sys.__dict__)

    def tearDown(self):
        _testinternalcapi.set_config(self.old_config)
        sys.__dict__.clear()
        sys.__dict__.update(self.sys_copy)

    def set_config(self, **kwargs):
        _testinternalcapi.set_config(self.old_config | kwargs)

            

Reported by Pylint.

Module '_testinternalcapi' has no 'set_config' member
Error

Line: 28 Column: 9

                      sys.__dict__.update(self.sys_copy)

    def set_config(self, **kwargs):
        _testinternalcapi.set_config(self.old_config | kwargs)

    def check(self, **kwargs):
        self.set_config(**kwargs)
        for key, value in kwargs.items():
            self.assertEqual(getattr(sys, key), value,

            

Reported by Pylint.

Module '_testinternalcapi' has no 'set_config' member
Error

Line: 148 Column: 25

                              config = self.old_config | {key: value}
                with self.subTest(key=key, value=value, exc_type=exc_type):
                    with self.assertRaises(exc_type):
                        _testinternalcapi.set_config(config)

    def test_flags(self):
        for sys_attr, key, value in (
            ("debug", "parser_debug", 1),
            ("inspect", "inspect", 2),

            

Reported by Pylint.

Module 'sys' has no 'orig_argv' member
Error

Line: 248 Column: 26

                                      argv=['python_program', 'args'],
                        orig_argv=['orig', 'orig_args'])
        self.assertEqual(sys.argv, ['python_program', 'args'])
        self.assertEqual(sys.orig_argv, ['orig', 'orig_args'])

        self.set_config(parse_argv=0,
                        argv=[],
                        orig_argv=[])
        self.assertEqual(sys.argv, [''])

            

Reported by Pylint.

Module 'sys' has no 'orig_argv' member
Error

Line: 254 Column: 26

                                      argv=[],
                        orig_argv=[])
        self.assertEqual(sys.argv, [''])
        self.assertEqual(sys.orig_argv, [])

    def test_pycache_prefix(self):
        self.check(pycache_prefix=None)
        self.check(pycache_prefix="pycache_prefix")


            

Reported by Pylint.

Access to a protected member _xoptions of a client class
Error

Line: 205 Column: 26

                      self.check(warnoptions=["default", "ignore"])

        self.set_config(xoptions=[])
        self.assertEqual(sys._xoptions, {})
        self.set_config(xoptions=["dev", "tracemalloc=5"])
        self.assertEqual(sys._xoptions, {"dev": True, "tracemalloc": "5"})

    def test_pathconfig(self):
        self.check(

            

Reported by Pylint.

Access to a protected member _xoptions of a client class
Error

Line: 207 Column: 26

                      self.set_config(xoptions=[])
        self.assertEqual(sys._xoptions, {})
        self.set_config(xoptions=["dev", "tracemalloc=5"])
        self.assertEqual(sys._xoptions, {"dev": True, "tracemalloc": "5"})

    def test_pathconfig(self):
        self.check(
            executable='executable',
            prefix="prefix",

            

Reported by Pylint.

Access to a protected member _base_executable of a client class
Error

Line: 219 Column: 26

                          platlibdir="platlibdir")

        self.set_config(base_executable="base_executable")
        self.assertEqual(sys._base_executable, "base_executable")

        # When base_xxx is NULL, value is copied from xxxx
        self.set_config(
            executable='executable',
            prefix="prefix",

            

Reported by Pylint.

Access to a protected member _base_executable of a client class
Error

Line: 229 Column: 26

                          base_executable=None,
            base_prefix=None,
            base_exec_prefix=None)
        self.assertEqual(sys._base_executable, "executable")
        self.assertEqual(sys.base_prefix, "prefix")
        self.assertEqual(sys.base_exec_prefix, "exec_prefix")

    def test_path(self):
        self.set_config(module_search_paths_set=1,

            

Reported by Pylint.

Lib/test/test_ossaudiodev.py
25 issues
Access to a protected member _encoding of a client class
Error

Line: 32 Column: 20

                      au = sunau.open(fp)
        rate = au.getframerate()
        nchannels = au.getnchannels()
        encoding = au._encoding
        fp.seek(0)
        data = fp.read()

    if encoding != sunau.AUDIO_FILE_ENCODING_MULAW_8:
        raise RuntimeError("Expect .au file with 8-bit mu-law samples")

            

Reported by Pylint.

Unused variable 'err'
Error

Line: 142 Column: 13

              
            try:
                result = dsp.setparameters(fmt, channels, rate, True)
            except ossaudiodev.OSSAudioError as err:
                pass
            else:
                self.fail("expected OSSAudioError")

    def test_playback(self):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from test import support
from test.support import import_helper
support.requires('audio')

from test.support import findfile

ossaudiodev = import_helper.import_module('ossaudiodev')

import errno

            

Reported by Pylint.

Import "from test.support import findfile" should be placed at the top of the module
Error

Line: 5 Column: 1

              from test.support import import_helper
support.requires('audio')

from test.support import findfile

ossaudiodev = import_helper.import_module('ossaudiodev')

import errno
import sys

            

Reported by Pylint.

Import "import errno" should be placed at the top of the module
Error

Line: 9 Column: 1

              
ossaudiodev = import_helper.import_module('ossaudiodev')

import errno
import sys
import sunau
import time
import audioop
import unittest

            

Reported by Pylint.

Import "import sys" should be placed at the top of the module
Error

Line: 10 Column: 1

              ossaudiodev = import_helper.import_module('ossaudiodev')

import errno
import sys
import sunau
import time
import audioop
import unittest


            

Reported by Pylint.

Import "import sunau" should be placed at the top of the module
Error

Line: 11 Column: 1

              
import errno
import sys
import sunau
import time
import audioop
import unittest

# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a

            

Reported by Pylint.

Import "import time" should be placed at the top of the module
Error

Line: 12 Column: 1

              import errno
import sys
import sunau
import time
import audioop
import unittest

# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a
# fairly recent addition to OSS.

            

Reported by Pylint.

Import "import audioop" should be placed at the top of the module
Error

Line: 13 Column: 1

              import sys
import sunau
import time
import audioop
import unittest

# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a
# fairly recent addition to OSS.
try:

            

Reported by Pylint.

Import "import unittest" should be placed at the top of the module
Error

Line: 14 Column: 1

              import sunau
import time
import audioop
import unittest

# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a
# fairly recent addition to OSS.
try:
    from ossaudiodev import AFMT_S16_NE

            

Reported by Pylint.