Skip to content

Commit

Permalink
Merge pull request #567 from timothycrosley/feature/hotfix-issue-565
Browse files Browse the repository at this point in the history
Feature/hotfix issue 565
  • Loading branch information
timothycrosley authored Jun 6, 2017
2 parents c775044 + 5fc8213 commit 6f70cec
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 35 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Changelog
=========
### 4.2.13 - June 2, 2017 - hotfix release
### 4.2.14 - June 2, 2017 - hotfix release
IMPORTANT NOTE: This will be the last release with Python 2.6 support, subsequent releases will be 2.7+ only
- Fixed #559 & #565: Added missing standard library imports

### 4.2.13 - June 2, 2017 - hotfix release
- Fixed #553: Check only and --diff now work together again

### 4.2.12 - June 1, 2017 - hotfix release
Expand Down
78 changes: 45 additions & 33 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,51 @@
'sections': DEFAULT_SECTIONS,
'no_sections': False,
'known_future_library': ['__future__'],
'known_standard_library': ['BaseHTTPServer', 'ConfigParser', 'Cookie', 'EasyDialogs', 'Queue',
'SimpleXMLRPCServer', 'SocketServer', 'StringIO', '__builtin__', 'abc',
'aifc', 'anydbm', 'argparse', 'array', 'ast', 'asynchat', 'asyncio',
'asyncore', 'atexit', 'audioop', 'base64', 'bdb', 'binascii', 'binhex',
'bisect', 'builtins', 'bz2', 'cPickle', 'cProfile', 'cStringIO', 'calendar',
'cgi', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',
'collections', 'colorsys', 'commands', 'compileall', 'concurrent', 'configparser',
'contextlib', 'copy', 'copyreg', 'crypt', 'csv', 'ctypes', 'curses', 'datetime',
'dbhash', 'dbm', 'decimal', 'difflib', 'dircache', 'dis', 'distutils', 'doctest',
'dumbdbm', 'dummy_threading', 'email', 'encodings', 'ensurepip', 'enum', 'errno',
'exceptions', 'faulthandler', 'fcntl', 'filecmp', 'fileinput', 'fnmatch',
'formatter', 'fpectl', 'fractions', 'ftplib', 'functools', 'gc', 'gdbm', 'getopt',
'getpass', 'gettext', 'glob', 'grp', 'gzip', 'hashlib', 'heapq', 'hmac', 'html',
'http', 'imaplib', 'imghdr', 'imp', 'importlib', 'inspect', 'io', 'ipaddress',
'itertools', 'json', 'keyword', 'lib2to3', 'linecache', 'locale', 'logging',
'lzma', 'macpath', 'mailbox', 'mailcap', 'marshal', 'math', 'mhlib', 'mimetypes',
'mmap', 'modulefinder', 'msilib', 'msvcrt', 'multiprocessing', 'netrc', 'nis',
'nntplib', 'numbers', 'operator', 'optparse', 'os', 'ossaudiodev', 'parser',
'pathlib', 'pdb', 'pickle', 'pickletools', 'pipes', 'pkgutil', 'platform',
'plistlib', 'poplib', 'posix', 'pprint', 'profile', 'pstats', 'pty', 'pwd',
'py_compile', 'pyclbr', 'pydoc', 'queue', 'quopri', 'random', 're', 'readline',
'reprlib', 'resource', 'rlcompleter', 'robotparser', 'runpy', 'sched', 'secrets',
'select', 'selectors', 'shelve', 'shlex', 'shutil', 'signal', 'site',
'sitecustomize', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'socketserver',
'spwd', 'sqlite3', 'ssl', 'stat', 'statistics', 'string', 'stringprep',
'struct', 'subprocess', 'sunau', 'symbol', 'symtable', 'sys', 'sysconfig',
'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', 'test',
'textwrap', 'thread', 'threading', 'time', 'timeit', 'tkinter', 'token',
'tokenize', 'trace', 'traceback', 'tracemalloc', 'tty', 'turtle', 'turtledemo',
'types', 'typing', 'unicodedata', 'unittest', 'urllib', 'urllib2', 'urlparse',
'usercustomize', 'uu', 'uuid', 'venv', 'warnings', 'wave', 'weakref',
'webbrowser', 'whichdb', 'winreg', 'winsound', 'wsgiref', 'xdrlib',
'xml', 'xmlrpc', 'xmlrpclib', 'zipapp', 'zipfile', 'zipimport', 'zlib'],
'known_standard_library': ['AL', 'BaseHTTPServer', 'Bastion', 'CGIHTTPServer', 'Carbon', 'ColorPicker',
'ConfigParser', 'Cookie', 'DEVICE', 'DocXMLRPCServer', 'EasyDialogs', 'FL',
'FrameWork', 'GL', 'HTMLParser', 'MacOS', 'MimeWriter', 'MiniAEFrame', 'Nav',
'PixMapWrapper', 'Queue', 'SUNAUDIODEV', 'ScrolledText', 'SimpleHTTPServer',
'SimpleXMLRPCServer', 'SocketServer', 'StringIO', 'Tix', 'Tkinter', 'UserDict',
'UserList', 'UserString', 'W', '__builtin__', 'abc', 'aepack', 'aetools',
'aetypes', 'aifc', 'al', 'anydbm', 'applesingle', 'argparse', 'array', 'ast',
'asynchat', 'asyncio', 'asyncore', 'atexit', 'audioop', 'autoGIL', 'base64',
'bdb', 'binascii', 'binhex', 'bisect', 'bsddb', 'buildtools', 'builtins',
'bz2', 'cPickle', 'cProfile', 'cStringIO', 'calendar', 'cd', 'cfmfile', 'cgi',
'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', 'collections',
'colorsys', 'commands', 'compileall', 'compiler', 'concurrent', 'configparser',
'contextlib', 'cookielib', 'copy', 'copy_reg', 'copyreg', 'crypt', 'csv',
'ctypes', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'difflib',
'dircache', 'dis', 'distutils', 'dl', 'doctest', 'dumbdbm', 'dummy_thread',
'dummy_threading', 'email', 'encodings', 'ensurepip', 'enum', 'errno',
'exceptions', 'faulthandler', 'fcntl', 'filecmp', 'fileinput', 'findertools',
'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl', 'fpformat', 'fractions',
'ftplib', 'functools', 'future_builtins', 'gc', 'gdbm', 'gensuitemodule',
'getopt', 'getpass', 'gettext', 'gl', 'glob', 'grp', 'gzip', 'hashlib',
'heapq', 'hmac', 'hotshot', 'html', 'htmlentitydefs', 'htmllib', 'http',
'httplib', 'ic', 'icopen', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp',
'importlib', 'imputil', 'inspect', 'io', 'ipaddress', 'itertools', 'jpeg',
'json', 'keyword', 'lib2to3', 'linecache', 'locale', 'logging', 'lzma',
'macerrors', 'macostools', 'macpath', 'macresource', 'mailbox', 'mailcap',
'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'mimify', 'mmap',
'modulefinder', 'msilib', 'msvcrt', 'multifile', 'multiprocessing', 'mutex',
'netrc', 'new', 'nis', 'nntplib', 'numbers', 'operator', 'optparse', 'os',
'ossaudiodev', 'parser', 'pathlib', 'pdb', 'pickle', 'pickletools', 'pipes',
'pkgutil', 'platform', 'plistlib', 'popen2', 'poplib', 'posix', 'posixfile',
'pprint', 'profile', 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc',
'queue', 'quopri', 'random', 're', 'readline', 'reprlib', 'resource', 'rexec',
'rfc822', 'rlcompleter', 'robotparser', 'runpy', 'sched', 'secrets', 'select',
'selectors', 'sets', 'sgmllib', 'sha', 'shelve', 'shlex', 'shutil', 'signal',
'site', 'sitecustomize', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'socketserver',
'spwd', 'sqlite3', 'ssl', 'stat', 'statistics', 'statvfs', 'string', 'stringprep',
'struct', 'subprocess', 'sunau', 'sunaudiodev', 'symbol', 'symtable', 'sys',
'sysconfig', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',
'test', 'textwrap', 'this', 'thread', 'threading', 'time', 'timeit', 'tkinter',
'token', 'tokenize', 'trace', 'traceback', 'tracemalloc', 'ttk', 'tty', 'turtle',
'turtledemo', 'types', 'typing', 'unicodedata', 'unittest', 'urllib', 'urllib2',
'urlparse', 'user', 'usercustomize', 'uu', 'uuid', 'venv', 'videoreader',
'warnings', 'wave', 'weakref', 'webbrowser', 'whichdb', 'winreg', 'winsound',
'wsgiref', 'xdrlib', 'xml', 'xmlrpc', 'xmlrpclib', 'zipapp', 'zipfile',
'zipimport', 'zlib'],
'known_third_party': ['google.appengine.api'],
'known_first_party': [],
'multi_line_output': WrapModes.GRID,
Expand Down
6 changes: 5 additions & 1 deletion test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,16 @@ def test_default_section():

def test_first_party_overrides_standard_section():
"""Test to ensure changing the default section works as expected."""
test_input = ("import sys\n"
test_input = ("from HTMLParser import HTMLParseError, HTMLParser\n"
"import sys\n"
"import os\n"
"import this\n"
"import profile.test\n")
test_output = SortImports(file_contents=test_input, known_first_party=['profile']).output
assert test_output == ("import os\n"
"import sys\n"
"import this\n"
"from HTMLParser import HTMLParseError, HTMLParser\n"
"\n"
"import profile.test\n")

Expand Down

0 comments on commit 6f70cec

Please sign in to comment.