The following issues were found

Doc/includes/mp_pool.py
32 issues
Unused argument 'x'
Error

Line: 34 Column: 10

              def pow3(x):
    return x ** 3

def noop(x):
    pass

#
# Test code
#

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import multiprocessing
import time
import random
import sys

#
# Functions used by test code
#


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              # Functions used by test code
#

def calculate(func, args):
    result = func(*args)
    return '%s says that %s%s = %s' % (
        multiprocessing.current_process().name,
        func.__name__, args, result
        )

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                      func.__name__, args, result
        )

def calculatestar(args):
    return calculate(*args)

def mul(a, b):
    time.sleep(0.5 * random.random())
    return a * b

            

Reported by Pylint.

Argument name "a" doesn't conform to snake_case naming style
Error

Line: 20 Column: 1

              def calculatestar(args):
    return calculate(*args)

def mul(a, b):
    time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())

            

Reported by Pylint.

Argument name "b" doesn't conform to snake_case naming style
Error

Line: 20 Column: 1

              def calculatestar(args):
    return calculate(*args)

def mul(a, b):
    time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 1

              def calculatestar(args):
    return calculate(*args)

def mul(a, b):
    time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())

            

Reported by Pylint.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                  return calculate(*args)

def mul(a, b):
    time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())
    return a + b

            

Reported by Bandit.

Argument name "b" doesn't conform to snake_case naming style
Error

Line: 24 Column: 1

                  time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())
    return a + b

def f(x):
    return 1.0 / (x - 5.0)

            

Reported by Pylint.

Argument name "a" doesn't conform to snake_case naming style
Error

Line: 24 Column: 1

                  time.sleep(0.5 * random.random())
    return a * b

def plus(a, b):
    time.sleep(0.5 * random.random())
    return a + b

def f(x):
    return 1.0 / (x - 5.0)

            

Reported by Pylint.

Lib/email/contentmanager.py
32 issues
Redefining name 'maintype' from outer scope (line 73)
Error

Line: 20 Column: 9

                      content_type = msg.get_content_type()
        if content_type in self.get_handlers:
            return self.get_handlers[content_type](msg, *args, **kw)
        maintype = msg.get_content_maintype()
        if maintype in self.get_handlers:
            return self.get_handlers[maintype](msg, *args, **kw)
        if '' in self.get_handlers:
            return self.get_handlers[''](msg, *args, **kw)
        raise KeyError(content_type)

            

Reported by Pylint.

XXX: is this error a good idea or not? We can remove it later,
Error

Line: 32 Column: 3

              
    def set_content(self, msg, obj, *args, **kw):
        if msg.get_content_maintype() == 'multipart':
            # XXX: is this error a good idea or not?  We can remove it later,
            # but we can't add it later, so do it for now.
            raise TypeError("set_content not valid on multipart")
        handler = self._find_set_handler(msg, obj)
        msg.clear_content()
        handler(msg, obj, *args, **kw)

            

Reported by Pylint.

Unused argument 'msg'
Error

Line: 39 Column: 33

                      msg.clear_content()
        handler(msg, obj, *args, **kw)

    def _find_set_handler(self, msg, obj):
        full_path_for_error = None
        for typ in type(obj).__mro__:
            if typ in self.set_handlers:
                return self.set_handlers[typ]
            qname = typ.__qualname__

            

Reported by Pylint.

Redefining name 'typ' from outer scope (line 247)
Error

Line: 41 Column: 13

              
    def _find_set_handler(self, msg, obj):
        full_path_for_error = None
        for typ in type(obj).__mro__:
            if typ in self.set_handlers:
                return self.set_handlers[typ]
            qname = typ.__qualname__
            modname = getattr(typ, '__module__', '')
            full_path = '.'.join((modname, qname)) if modname else qname

            

Reported by Pylint.

Redefining name 'maintype' from outer scope (line 73)
Error

Line: 95 Column: 23

                                               get_and_fixup_unknown_message_content)


def _prepare_set(msg, maintype, subtype, headers):
    msg['Content-Type'] = '/'.join((maintype, subtype))
    if headers:
        if not hasattr(headers[0], 'name'):
            mp = msg.policy
            headers = [mp.header_factory(*mp.header_source_parse([header]))

            

Reported by Pylint.

Redefining name 'subtype' from outer scope (line 79)
Error

Line: 95 Column: 33

                                               get_and_fixup_unknown_message_content)


def _prepare_set(msg, maintype, subtype, headers):
    msg['Content-Type'] = '/'.join((maintype, subtype))
    if headers:
        if not hasattr(headers[0], 'name'):
            mp = msg.policy
            headers = [mp.header_factory(*mp.header_source_parse([header]))

            

Reported by Pylint.

XXX: This is a cleaned-up version of base64mime.body_encode (including a bug
Error

Line: 129 Column: 3

                          msg.set_param(key, value)


# XXX: This is a cleaned-up version of base64mime.body_encode (including a bug
# fix in the calculation of unencoded_bytes_per_line).  It would be nice to
# drop both this and quoprimime.body_encode in favor of enhanced binascii
# routines that accepted a max_line_length parameter.
def _encode_base64(data, max_line_length):
    encoded_lines = []

            

Reported by Pylint.

Redefining name 'subtype' from outer scope (line 79)
Error

Line: 181 Column: 35

                  return cte, data


def set_text_content(msg, string, subtype="plain", charset='utf-8', cte=None,
                     disposition=None, filename=None, cid=None,
                     params=None, headers=None):
    _prepare_set(msg, 'text', subtype, headers)
    cte, payload = _encode_text(string, charset, cte, msg.policy)
    msg.set_payload(payload)

            

Reported by Pylint.

Redefining name 'subtype' from outer scope (line 79)
Error

Line: 195 Column: 39

              raw_data_manager.add_set_handler(str, set_text_content)


def set_message_content(msg, message, subtype="rfc822", cte=None,
                       disposition=None, filename=None, cid=None,
                       params=None, headers=None):
    if subtype == 'partial':
        raise ValueError("message/partial is not supported for Message objects")
    if subtype == 'rfc822':

            

Reported by Pylint.

Redefining name 'subtype' from outer scope (line 79)
Error

Line: 228 Column: 44

              raw_data_manager.add_set_handler(email.message.Message, set_message_content)


def set_bytes_content(msg, data, maintype, subtype, cte='base64',
                     disposition=None, filename=None, cid=None,
                     params=None, headers=None):
    _prepare_set(msg, maintype, subtype, headers)
    if cte == 'base64':
        data = _encode_base64(data, max_line_length=msg.policy.max_line_length)

            

Reported by Pylint.

Lib/distutils/tests/test_cmd.py
32 issues
Attribute 'not_string_list' defined outside __init__
Error

Line: 24 Column: 9

                  def test_ensure_string_list(self):

        cmd = self.cmd
        cmd.not_string_list = ['one', 2, 'three']
        cmd.yes_string_list = ['one', 'two', 'three']
        cmd.not_string_list2 = object()
        cmd.yes_string_list2 = 'ok'
        cmd.ensure_string_list('yes_string_list')
        cmd.ensure_string_list('yes_string_list2')

            

Reported by Pylint.

Attribute 'yes_string_list' defined outside __init__
Error

Line: 25 Column: 9

              
        cmd = self.cmd
        cmd.not_string_list = ['one', 2, 'three']
        cmd.yes_string_list = ['one', 'two', 'three']
        cmd.not_string_list2 = object()
        cmd.yes_string_list2 = 'ok'
        cmd.ensure_string_list('yes_string_list')
        cmd.ensure_string_list('yes_string_list2')


            

Reported by Pylint.

Attribute 'not_string_list2' defined outside __init__
Error

Line: 26 Column: 9

                      cmd = self.cmd
        cmd.not_string_list = ['one', 2, 'three']
        cmd.yes_string_list = ['one', 'two', 'three']
        cmd.not_string_list2 = object()
        cmd.yes_string_list2 = 'ok'
        cmd.ensure_string_list('yes_string_list')
        cmd.ensure_string_list('yes_string_list2')

        self.assertRaises(DistutilsOptionError,

            

Reported by Pylint.

Attribute 'yes_string_list2' defined outside __init__
Error

Line: 27 Column: 9

                      cmd.not_string_list = ['one', 2, 'three']
        cmd.yes_string_list = ['one', 'two', 'three']
        cmd.not_string_list2 = object()
        cmd.yes_string_list2 = 'ok'
        cmd.ensure_string_list('yes_string_list')
        cmd.ensure_string_list('yes_string_list2')

        self.assertRaises(DistutilsOptionError,
                          cmd.ensure_string_list, 'not_string_list')

            

Reported by Pylint.

Attribute 'option1' defined outside __init__
Error

Line: 37 Column: 9

                      self.assertRaises(DistutilsOptionError,
                          cmd.ensure_string_list, 'not_string_list2')

        cmd.option1 = 'ok,dok'
        cmd.ensure_string_list('option1')
        self.assertEqual(cmd.option1, ['ok', 'dok'])

        cmd.option2 = ['xxx', 'www']
        cmd.ensure_string_list('option2')

            

Reported by Pylint.

Attribute 'option2' defined outside __init__
Error

Line: 41 Column: 9

                      cmd.ensure_string_list('option1')
        self.assertEqual(cmd.option1, ['ok', 'dok'])

        cmd.option2 = ['xxx', 'www']
        cmd.ensure_string_list('option2')

        cmd.option3 = ['ok', 2]
        self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
                          'option3')

            

Reported by Pylint.

Attribute 'option3' defined outside __init__
Error

Line: 44 Column: 9

                      cmd.option2 = ['xxx', 'www']
        cmd.ensure_string_list('option2')

        cmd.option3 = ['ok', 2]
        self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
                          'option3')


    def test_make_file(self):

            

Reported by Pylint.

Unused argument 'level'
Error

Line: 58 Column: 44

                                        infiles=1, outfile='', func='func', args=())

        # making sure execute gets called properly
        def _execute(func, args, exec_msg, level):
            self.assertEqual(exec_msg, 'generating out from in')
        cmd.force = True
        cmd.execute = _execute
        cmd.make_file(infiles='in', outfile='out', func='func', args=())


            

Reported by Pylint.

Unused argument 'func'
Error

Line: 58 Column: 22

                                        infiles=1, outfile='', func='func', args=())

        # making sure execute gets called properly
        def _execute(func, args, exec_msg, level):
            self.assertEqual(exec_msg, 'generating out from in')
        cmd.force = True
        cmd.execute = _execute
        cmd.make_file(infiles='in', outfile='out', func='func', args=())


            

Reported by Pylint.

Unused argument 'args'
Error

Line: 58 Column: 28

                                        infiles=1, outfile='', func='func', args=())

        # making sure execute gets called properly
        def _execute(func, args, exec_msg, level):
            self.assertEqual(exec_msg, 'generating out from in')
        cmd.force = True
        cmd.execute = _execute
        cmd.make_file(infiles='in', outfile='out', func='func', args=())


            

Reported by Pylint.

Lib/idlelib/idle_test/test_grep.py
31 issues
Access to a protected member _pat of a client class
Error

Line: 124 Column: 9

                  # from incomplete replacement, so 'later'.

    def report(self, pat):
        _grep.engine._pat = pat
        with captured_stdout() as s:
            _grep.grep_it(re.compile(pat), __file__)
        lines = s.getvalue().split('\n')
        lines.pop()  # remove bogus '' after last \n
        return lines

            

Reported by Pylint.

Attribute '_pat' defined outside __init__
Error

Line: 124 Column: 9

                  # from incomplete replacement, so 'later'.

    def report(self, pat):
        _grep.engine._pat = pat
        with captured_stdout() as s:
            _grep.grep_it(re.compile(pat), __file__)
        lines = s.getvalue().split('\n')
        lines.pop()  # remove bogus '' after last \n
        return lines

            

Reported by Pylint.

standard import "import unittest" should be placed before "from idlelib import grep"
Error

Line: 9 Column: 1

              Currently only test grep_it, coverage 51%.
"""
from idlelib import grep
import unittest
from test.support import captured_stdout
from idlelib.idle_test.mock_tk import Var
import os
import re


            

Reported by Pylint.

standard import "from test.support import captured_stdout" should be placed before "from idlelib import grep"
Error

Line: 10 Column: 1

              """
from idlelib import grep
import unittest
from test.support import captured_stdout
from idlelib.idle_test.mock_tk import Var
import os
import re



            

Reported by Pylint.

standard import "import os" should be placed before "from idlelib import grep"
Error

Line: 12 Column: 1

              import unittest
from test.support import captured_stdout
from idlelib.idle_test.mock_tk import Var
import os
import re


class Dummy_searchengine:
    '''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the

            

Reported by Pylint.

standard import "import re" should be placed before "from idlelib import grep"
Error

Line: 13 Column: 1

              from test.support import captured_stdout
from idlelib.idle_test.mock_tk import Var
import os
import re


class Dummy_searchengine:
    '''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the
    passed in SearchEngine instance as attribute 'engine'. Only a few of the

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 16 Column: 1

              import re


class Dummy_searchengine:
    '''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the
    passed in SearchEngine instance as attribute 'engine'. Only a few of the
    many possible self.engine.x attributes are needed here.
    '''
    def getpat(self):

            

Reported by Pylint.

Class name "Dummy_searchengine" doesn't conform to PascalCase naming style
Error

Line: 16 Column: 1

              import re


class Dummy_searchengine:
    '''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the
    passed in SearchEngine instance as attribute 'engine'. Only a few of the
    many possible self.engine.x attributes are needed here.
    '''
    def getpat(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 5

                  passed in SearchEngine instance as attribute 'engine'. Only a few of the
    many possible self.engine.x attributes are needed here.
    '''
    def getpat(self):
        return self._pat

searchengine = Dummy_searchengine()



            

Reported by Pylint.

Class name "Dummy_grep" doesn't conform to PascalCase naming style
Error

Line: 27 Column: 1

              searchengine = Dummy_searchengine()


class Dummy_grep:
    # Methods tested
    #default_command = GrepDialog.default_command
    grep_it = grep.GrepDialog.grep_it
    # Other stuff needed
    recvar = Var(False)

            

Reported by Pylint.

Lib/asyncio/subprocess.py
31 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
import subprocess

from . import events
from . import protocols
from . import streams
from . import tasks
from .log import logger


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              import subprocess

from . import events
from . import protocols
from . import streams
from . import tasks
from .log import logger



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from . import events
from . import protocols
from . import streams
from . import tasks
from .log import logger


PIPE = subprocess.PIPE

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              from . import events
from . import protocols
from . import streams
from . import tasks
from .log import logger


PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from . import protocols
from . import streams
from . import tasks
from .log import logger


PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
DEVNULL = subprocess.DEVNULL

            

Reported by Pylint.

Module import itself
Error

Line: 3 Column: 1

              __all__ = 'create_subprocess_exec', 'create_subprocess_shell'

import subprocess

from . import events
from . import protocols
from . import streams
from . import tasks
from .log import logger

            

Reported by Pylint.

Access to a protected member _wait of a client class
Error

Line: 134 Column: 22

              
    async def wait(self):
        """Wait until the process exit and return the process return code."""
        return await self._transport._wait()

    def send_signal(self, signal):
        self._transport.send_signal(signal)

    def terminate(self):

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 145 Column: 33

                  def kill(self):
        self._transport.kill()

    async def _feed_stdin(self, input):
        debug = self._loop.get_debug()
        self.stdin.write(input)
        if debug:
            logger.debug(
                '%r communicate: feed stdin (%s bytes)', self, len(input))

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 182 Column: 33

                      transport.close()
        return output

    async def communicate(self, input=None):
        if input is not None:
            stdin = self._feed_stdin(input)
        else:
            stdin = self._noop()
        if self.stdout is not None:

            

Reported by Pylint.

Access to a protected member _DEFAULT_LIMIT of a client class
Error

Line: 201 Column: 41

              

async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
                                  limit=streams._DEFAULT_LIMIT, **kwds):
    loop = events.get_running_loop()
    protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
                                                        loop=loop)
    transport, protocol = await loop.subprocess_shell(
        protocol_factory,

            

Reported by Pylint.

Lib/distutils/tests/test_register.py
31 issues
Unused argument 'data'
Error

Line: 63 Column: 25

                  def __call__(self, *args):
        return self

    def open(self, req, data=None, timeout=None):
        self.reqs.append(req)
        return self

    def read(self):
        return b'xxx'

            

Reported by Pylint.

Unused argument 'timeout'
Error

Line: 63 Column: 36

                  def __call__(self, *args):
        return self

    def open(self, req, data=None, timeout=None):
        self.reqs.append(req)
        return self

    def read(self):
        return b'xxx'

            

Reported by Pylint.

Unused argument 'prompt'
Error

Line: 82 Column: 22

                      super(RegisterTestCase, self).setUp()
        # patching the password prompt
        self._old_getpass = getpass.getpass
        def _getpass(prompt):
            return 'password'
        getpass.getpass = _getpass
        urllib.request._opener = None
        self.old_opener = urllib.request.build_opener
        self.conn = urllib.request.build_opener = FakeOpener()

            

Reported by Pylint.

Access to a protected member _opener of a client class
Error

Line: 85 Column: 9

                      def _getpass(prompt):
            return 'password'
        getpass.getpass = _getpass
        urllib.request._opener = None
        self.old_opener = urllib.request.build_opener
        self.conn = urllib.request.build_opener = FakeOpener()

    def tearDown(self):
        getpass.getpass = self._old_getpass

            

Reported by Pylint.

Access to a protected member _opener of a client class
Error

Line: 91 Column: 9

              
    def tearDown(self):
        getpass.getpass = self._old_getpass
        urllib.request._opener = None
        urllib.request.build_opener = self.old_opener
        super(RegisterTestCase, self).tearDown()

    def _get_cmd(self, metadata=None):
        if metadata is None:

            

Reported by Pylint.

Unused variable 'pkg_info'
Error

Line: 100 Column: 9

                          metadata = {'url': 'xxx', 'author': 'xxx',
                        'author_email': 'xxx',
                        'name': 'xxx', 'version': 'xxx'}
        pkg_info, dist = self.create_dist(**metadata)
        return register(dist)

    def test_create_pypirc(self):
        # this test makes sure a .pypirc file
        # is created when requested.

            

Reported by Pylint.

Access to a protected member _set_config of a client class
Error

Line: 164 Column: 9

              
        self.write_file(self.rc, PYPIRC_NOPASSWORD)
        cmd = self._get_cmd()
        cmd._set_config()
        cmd.finalize_options()
        cmd.send_metadata()

        # dist.password should be set
        # therefore used afterwards by other commands

            

Reported by Pylint.

Using deprecated method check_metadata()
Error

Line: 295 Column: 13

                      cmd = self._get_cmd()
        with check_warnings() as w:
            warnings.simplefilter("always")
            cmd.check_metadata()
            self.assertEqual(len(w.warnings), 1)

    def test_list_classifiers(self):
        cmd = self._get_cmd()
        cmd.list_classifiers = 1

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 43 Column: 1

              password:password
"""

class Inputs(object):
    """Fakes user inputs."""
    def __init__(self, *answers):
        self.answers = answers
        self.index = 0


            

Reported by Pylint.

Class 'Inputs' inherits from object, can be safely removed from bases in python3
Error

Line: 43 Column: 1

              password:password
"""

class Inputs(object):
    """Fakes user inputs."""
    def __init__(self, *answers):
        self.answers = answers
        self.index = 0


            

Reported by Pylint.

Lib/idlelib/macosx.py
31 issues
Using the global statement
Error

Line: 21 Column: 5

                  Initializes OS X Tk variant values for
    isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
    """
    global _tk_type
    if platform == 'darwin':
        root = tkinter.Tk()
        ws = root.tk.call('tk', 'windowingsystem')
        if 'x11' in ws:
            _tk_type = "xquartz"

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 199 Column: 22

                      window.add_windows_to_menu(menu)
    window.register_callback(postwindowsmenu)

    def about_dialog(event=None):
        "Handle Help 'About IDLE' event."
        # Synchronize with editor.EditorWindow.about_dialog.
        from idlelib import help_about
        help_about.AboutDialog(root)


            

Reported by Pylint.

Unused argument 'event'
Error

Line: 205 Column: 23

                      from idlelib import help_about
        help_about.AboutDialog(root)

    def config_dialog(event=None):
        "Handle Options 'Configure IDLE' event."
        # Synchronize with editor.EditorWindow.config_dialog.
        from idlelib import configdialog

        # Ensure that the root object has an instance_dict attribute,

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 217 Column: 21

                      root.instance_dict = flist.inversedict
        configdialog.ConfigDialog(root, 'Settings')

    def help_dialog(event=None):
        "Handle Help 'IDLE Help' event."
        # Synchronize with editor.EditorWindow.help_dialog.
        from idlelib import help
        help.show_idlehelp(root)


            

Reported by Pylint.

Redefining built-in 'help'
Error

Line: 220 Column: 9

                  def help_dialog(event=None):
        "Handle Help 'IDLE Help' event."
        # Synchronize with editor.EditorWindow.help_dialog.
        from idlelib import help
        help.show_idlehelp(root)

    root.bind('<<about-idle>>', about_dialog)
    root.bind('<<open-config-dialog>>', config_dialog)
    root.createcommand('::tk::mac::ShowPreferences', config_dialog)

            

Reported by Pylint.

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

Line: 14 Column: 1

              ## Define functions that query the Mac graphics type.
## _tk_type and its initializer are private to this section.

_tk_type = None

def _init_tk_type():
    """
    Initializes OS X Tk variant values for
    isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().

            

Reported by Pylint.

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

Line: 21 Column: 5

                  Initializes OS X Tk variant values for
    isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
    """
    global _tk_type
    if platform == 'darwin':
        root = tkinter.Tk()
        ws = root.tk.call('tk', 'windowingsystem')
        if 'x11' in ws:
            _tk_type = "xquartz"

            

Reported by Pylint.

Variable name "ws" doesn't conform to snake_case naming style
Error

Line: 24 Column: 9

                  global _tk_type
    if platform == 'darwin':
        root = tkinter.Tk()
        ws = root.tk.call('tk', 'windowingsystem')
        if 'x11' in ws:
            _tk_type = "xquartz"
        elif 'aqua' not in ws:
            _tk_type = "other"
        elif 'AppKit' in root.tk.call('winfo', 'server', '.'):

            

Reported by Pylint.

Function name "isAquaTk" doesn't conform to snake_case naming style
Error

Line: 37 Column: 1

                  else:
        _tk_type = "other"

def isAquaTk():
    """
    Returns True if IDLE is using a native OS X Tk (Cocoa or Carbon).
    """
    if not _tk_type:
        _init_tk_type()

            

Reported by Pylint.

Consider merging these comparisons with "in" to "_tk_type in ('cocoa', 'carbon')"
Error

Line: 43 Column: 12

                  """
    if not _tk_type:
        _init_tk_type()
    return _tk_type == "cocoa" or _tk_type == "carbon"

def isCarbonTk():
    """
    Returns True if IDLE is using a Carbon Aqua Tk (instead of the
    newer Cocoa Aqua Tk).

            

Reported by Pylint.

Doc/includes/mp_newtype.py
31 issues
Instance of 'MyManager' has no 'Foo1' member
Error

Line: 57 Column: 10

              
    print('-' * 20)

    f1 = manager.Foo1()
    f1.f()
    f1.g()
    assert not hasattr(f1, '_h')
    assert sorted(f1._exposed_) == sorted(['f', 'g'])


            

Reported by Pylint.

Instance of 'MyManager' has no 'Foo2' member
Error

Line: 65 Column: 10

              
    print('-' * 20)

    f2 = manager.Foo2()
    f2.g()
    f2._h()
    assert not hasattr(f2, 'f')
    assert sorted(f2._exposed_) == sorted(['g', '_h'])


            

Reported by Pylint.

Instance of 'MyManager' has no 'baz' member
Error

Line: 73 Column: 10

              
    print('-' * 20)

    it = manager.baz()
    for i in it:
        print('<%d>' % i, end=' ')
    print()

    print('-' * 20)

            

Reported by Pylint.

Instance of 'MyManager' has no 'operator' member
Error

Line: 80 Column: 10

              
    print('-' * 20)

    op = manager.operator()
    print('op.add(23, 45) =', op.add(23, 45))
    print('op.pow(2, 94) =', op.pow(2, 94))
    print('op._exposed_ =', op._exposed_)

##

            

Reported by Pylint.

Access to a protected member _exposed_ of a client class
Error

Line: 61 Column: 19

                  f1.f()
    f1.g()
    assert not hasattr(f1, '_h')
    assert sorted(f1._exposed_) == sorted(['f', 'g'])

    print('-' * 20)

    f2 = manager.Foo2()
    f2.g()

            

Reported by Pylint.

Access to a protected member _h of a client class
Error

Line: 67 Column: 5

              
    f2 = manager.Foo2()
    f2.g()
    f2._h()
    assert not hasattr(f2, 'f')
    assert sorted(f2._exposed_) == sorted(['g', '_h'])

    print('-' * 20)


            

Reported by Pylint.

Access to a protected member _exposed_ of a client class
Error

Line: 69 Column: 19

                  f2.g()
    f2._h()
    assert not hasattr(f2, 'f')
    assert sorted(f2._exposed_) == sorted(['g', '_h'])

    print('-' * 20)

    it = manager.baz()
    for i in it:

            

Reported by Pylint.

Access to a protected member _exposed_ of a client class
Error

Line: 83 Column: 29

                  op = manager.operator()
    print('op.add(23, 45) =', op.add(23, 45))
    print('op.pow(2, 94) =', op.pow(2, 94))
    print('op._exposed_ =', op._exposed_)

##

if __name__ == '__main__':
    freeze_support()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from multiprocessing import freeze_support
from multiprocessing.managers import BaseManager, BaseProxy
import operator

##

class Foo:
    def f(self):
        print('you called Foo.f()')

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              
##

class Foo:
    def f(self):
        print('you called Foo.f()')
    def g(self):
        print('you called Foo.g()')
    def _h(self):

            

Reported by Pylint.

Lib/email/header.py
31 issues
Access to a protected member _max_append of a client class
Error

Line: 57 Column: 15

              

# Helpers
_max_append = email.quoprimime._max_append



def decode_header(header):
    """Decode a message header value without converting charset.

            

Reported by Pylint.

Access to a protected member _encode of a client class
Error

Line: 77 Column: 18

                  """
    # If it is a Header object, we can just return the encoded chunks.
    if hasattr(header, '_chunks'):
        return [(_charset._encode(string, str(charset)), str(charset))
                    for string, charset in header._chunks]
    # If no encoding, just return the header with no charset.
    if not ecre.search(header):
        return [(header, None)]
    # First step is to parse all the encoded parts into triplets of the form

            

Reported by Pylint.

Access to a protected member _chunks of a client class
Error

Line: 78 Column: 44

                  # If it is a Header object, we can just return the encoded chunks.
    if hasattr(header, '_chunks'):
        return [(_charset._encode(string, str(charset)), str(charset))
                    for string, charset in header._chunks]
    # If no encoding, just return the header with no charset.
    if not ecre.search(header):
        return [(header, None)]
    # First step is to parse all the encoded parts into triplets of the form
    # (encoded_string, encoding, charset).  For unencoded strings, the last

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 128 Column: 17

                          try:
                word = email.base64mime.decode(encoded_string)
            except binascii.Error:
                raise HeaderParseError('Base64 decoding error')
            else:
                decoded_words.append((word, charset))
        else:
            raise AssertionError('Unexpected encoding: ' + encoding)
    # Now convert all words to bytes and collapse consecutive runs of

            

Reported by Pylint.

Access to a protected member _str of a client class
Error

Line: 387 Column: 17

                              formatter.newline()
        if self._chunks:
            formatter.add_transition()
        value = formatter._str(linesep)
        if _embedded_header.search(value):
            raise HeaderParseError("header value appears to contain "
                "an embedded header: {!r}".format(value))
        return value


            

Reported by Pylint.

Unused argument 'splitchars'
Error

Line: 486 Column: 41

                      while True:
            yield self._maxlen - self._continuation_ws_len

    def _ascii_split(self, fws, string, splitchars):
        # The RFC 2822 header folding algorithm is simple in principle but
        # complex in practice.  Lines may be folded any place where "folding
        # white space" appears by inserting a linesep character in front of the
        # FWS.  The complication is that not all spaces or tabs qualify as FWS,
        # and we are also supposed to prefer to break at "higher level

            

Reported by Pylint.

Access to a protected member _initial_size of a client class
Error

Line: 527 Column: 20

                              break
            else:
                fws, part = self._current_line.pop()
                if self._current_line._initial_size > 0:
                    # There will be a header, so leave it on a line by itself.
                    self.newline()
                    if not fws:
                        # We don't use continuation_ws here because the whitespace
                        # after a header should always be a space.

            

Reported by Pylint.

Too many branches (24/12)
Error

Line: 61 Column: 1

              


def decode_header(header):
    """Decode a message header value without converting charset.

    Returns a list of (string, charset) pairs containing each of the decoded
    parts of the header.  Charset is None for non-encoded parts of the header,
    otherwise a lower-case string containing the name of the character set

            

Reported by Pylint.

Too many statements (55/50)
Error

Line: 61 Column: 1

              


def decode_header(header):
    """Decode a message header value without converting charset.

    Returns a list of (string, charset) pairs containing each of the decoded
    parts of the header.  Charset is None for non-encoded parts of the header,
    otherwise a lower-case string containing the name of the character set

            

Reported by Pylint.

Too many local variables (20/15)
Error

Line: 61 Column: 1

              


def decode_header(header):
    """Decode a message header value without converting charset.

    Returns a list of (string, charset) pairs containing each of the decoded
    parts of the header.  Charset is None for non-encoded parts of the header,
    otherwise a lower-case string containing the name of the character set

            

Reported by Pylint.

Mac/Tools/plistlib_generate_testdata.py
31 issues
Unable to import 'Cocoa'
Error

Line: 3 Column: 1

              #!/usr/bin/env python3

from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver


            

Reported by Pylint.

Unable to import 'Cocoa'
Error

Line: 4 Column: 1

              #!/usr/bin/env python3

from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver


            

Reported by Pylint.

Unable to import 'Cocoa'
Error

Line: 5 Column: 1

              
from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime

            

Reported by Pylint.

Unable to import 'Cocoa'
Error

Line: 6 Column: 1

              from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict

            

Reported by Pylint.

Unable to import 'Cocoa'
Error

Line: 7 Column: 1

              from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict
import binascii

            

Reported by Pylint.

Unable to import 'Cocoa'
Error

Line: 8 Column: 1

              from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict
import binascii


            

Reported by Pylint.

Unused NSPropertyListOpenStepFormat imported from Cocoa
Error

Line: 4 Column: 1

              #!/usr/bin/env python3

from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver


            

Reported by Pylint.

Unused NSUUID imported from Cocoa
Error

Line: 6 Column: 1

              from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict

            

Reported by Pylint.

Unused CFPropertyListCreateData imported from Cocoa
Error

Line: 6 Column: 1

              from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict

            

Reported by Pylint.

Unused CFUUIDCreateFromString imported from Cocoa
Error

Line: 6 Column: 1

              from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL
from Cocoa import NSKeyedArchiver

import datetime
from collections import OrderedDict

            

Reported by Pylint.