| 1 |
from typing import Any, get_type_hints |
| 2 |
|
| 3 |
import hypothesis |
| 4 |
from hypothesis import strategies as st |
| 5 |
|
| 6 |
import isort |
| 7 |
|
| 8 |
|
| 9 |
def _as_config(kw: dict[str, Any]) -> isort.Config: |
| 10 |
kw["atomic"] = False |
| 11 |
if "wrap_length" in kw and "line_length" in kw: |
| 12 |
kw["wrap_length"], kw["line_length"] = sorted([kw["wrap_length"], kw["line_length"]]) |
| 13 |
try: |
| 14 |
return isort.Config(**kw) |
| 15 |
except ValueError: |
| 16 |
kw["wrap_length"] = 0 |
| 17 |
return isort.Config(**kw) |
| 18 |
|
| 19 |
|
| 20 |
def configs() -> st.SearchStrategy: |
| 21 |
"""Generate arbitrary Config objects.""" |
| 22 |
skip = { |
| 23 |
"line_ending", |
| 24 |
"sections", |
| 25 |
"known_standard_library", |
| 26 |
"known_future_library", |
| 27 |
"known_third_party", |
| 28 |
"known_first_party", |
| 29 |
"known_local_folder", |
| 30 |
"extra_standard_library", |
| 31 |
"forced_separate", |
| 32 |
"lines_before_imports", |
| 33 |
"lines_after_imports", |
| 34 |
"add_imports", |
| 35 |
"lines_between_sections", |
| 36 |
"lines_between_types", |
| 37 |
"sources", |
| 38 |
"virtual_env", |
| 39 |
"conda_env", |
| 40 |
"directory", |
| 41 |
"formatter", |
| 42 |
"formatting_function", |
| 43 |
"comment_prefix", |
| 44 |
"atomic", |
| 45 |
"skip", |
| 46 |
"src_paths", |
| 47 |
} |
| 48 |
inferred_kwargs = { |
| 49 |
k: st.from_type(v) |
| 50 |
for k, v in get_type_hints(isort.settings._Config).items() |
| 51 |
if k not in skip |
| 52 |
} |
| 53 |
specific = { |
| 54 |
"line_length": st.integers(0, 200), |
| 55 |
"wrap_length": st.integers(0, 200), |
| 56 |
"indent": st.integers(0, 20).map(lambda n: n * " "), |
| 57 |
"default_section": st.sampled_from(sorted(isort.settings.KNOWN_SECTION_MAPPING)), |
| 58 |
"force_grid_wrap": st.integers(0, 20), |
| 59 |
"profile": st.sampled_from(sorted(isort.settings.profiles)), |
| 60 |
"sort_order": st.sampled_from(sorted(("native", "natural", "natural_plus"))), |
| 61 |
"py_version": st.sampled_from(("auto", *isort.settings.VALID_PY_TARGETS)), |
| 62 |
} |
| 63 |
kwargs = {**inferred_kwargs, **specific} |
| 64 |
return st.fixed_dictionaries({}, optional=kwargs).map(_as_config) |
| 65 |
|
| 66 |
|
| 67 |
st.register_type_strategy(isort.Config, configs()) |
| 68 |
|
| 69 |
CODE_SNIPPET = """ |
| 70 |
'''Taken from bottle.py |
| 71 |
|
| 72 |
Copyright (c) 2009-2018, Marcel Hellkamp. |
| 73 |
License: MIT (see LICENSE for details) |
| 74 |
''' |
| 75 |
# Lots of stdlib and builtin differences. |
| 76 |
if py3k: |
| 77 |
import http.client as httplib |
| 78 |
import _thread as thread |
| 79 |
from urllib.parse import urljoin, SplitResult as UrlSplitResult |
| 80 |
from urllib.parse import urlencode, quote as urlquote, unquote as urlunquote |
| 81 |
urlunquote = functools.partial(urlunquote, encoding='latin1') |
| 82 |
from http.cookies import SimpleCookie, Morsel, CookieError |
| 83 |
from collections.abc import MutableMapping as DictMixin |
| 84 |
import pickle # comment number 2 |
| 85 |
from io import BytesIO |
| 86 |
import configparser |
| 87 |
|
| 88 |
basestring = str |
| 89 |
unicode = str |
| 90 |
json_loads = lambda s: json_lds(touni(s)) |
| 91 |
callable = lambda x: hasattr(x, '__call__') |
| 92 |
imap = map |
| 93 |
|
| 94 |
def _raise(*a): |
| 95 |
raise a[0](a[1]).with_traceback(a[2]) |
| 96 |
else: # 2.x |
| 97 |
import httplib |
| 98 |
import thread |
| 99 |
from urlparse import urljoin, SplitResult as UrlSplitResult |
| 100 |
from urllib import urlencode, quote as urlquote, unquote as urlunquote |
| 101 |
from Cookie import SimpleCookie, Morsel, CookieError |
| 102 |
from itertools import imap |
| 103 |
import cPickle as pickle |
| 104 |
from StringIO import StringIO as BytesIO |
| 105 |
import ConfigParser as configparser # commentnumberone |
| 106 |
from collections import MutableMapping as DictMixin |
| 107 |
unicode = unicode |
| 108 |
json_loads = json_lds |
| 109 |
exec(compile('def _raise(*a): raise a[0], a[1], a[2]', '<py3fix>', 'exec')) |
| 110 |
""" |
| 111 |
SHOULD_RETAIN = [ |
| 112 |
"""'''Taken from bottle.py |
| 113 |
|
| 114 |
Copyright (c) 2009-2018, Marcel Hellkamp. |
| 115 |
License: MIT (see LICENSE for details) |
| 116 |
'''""", |
| 117 |
"# Lots of stdlib and builtin differences.", |
| 118 |
"if py3k:", |
| 119 |
"http.client", |
| 120 |
"_thread", |
| 121 |
"urllib.parse", |
| 122 |
"urlencode", |
| 123 |
"urlunquote = functools.partial(urlunquote, encoding='latin1')", |
| 124 |
"http.cookies", |
| 125 |
"SimpleCookie", |
| 126 |
"collections.abc", |
| 127 |
"pickle", |
| 128 |
"comment number 2", |
| 129 |
"io", |
| 130 |
"configparser", |
| 131 |
"""basestring = str |
| 132 |
unicode = str |
| 133 |
json_loads = lambda s: json_lds(touni(s)) |
| 134 |
callable = lambda x: hasattr(x, '__call__') |
| 135 |
imap = map |
| 136 |
|
| 137 |
def _raise(*a): |
| 138 |
raise a[0](a[1]).with_traceback(a[2]) |
| 139 |
else: # 2.x |
| 140 |
""", |
| 141 |
"httplib", |
| 142 |
"thread", |
| 143 |
"urlparse", |
| 144 |
"urllib", |
| 145 |
"Cookie", |
| 146 |
"itertools", |
| 147 |
"cPickle", |
| 148 |
"StringIO", |
| 149 |
"ConfigParser", |
| 150 |
"commentnumberone", |
| 151 |
"collections", |
| 152 |
"""unicode = unicode |
| 153 |
json_loads = json_lds |
| 154 |
exec(compile('def _raise(*a): raise a[0], a[1], a[2]', '<py3fix>', 'exec'))""", |
| 155 |
] |
| 156 |
|
| 157 |
|
| 158 |
@hypothesis.example( |
| 159 |
config=isort.Config( |
| 160 |
py_version="all", |
| 161 |
force_to_top=frozenset(), |
| 162 |
skip=frozenset( |
| 163 |
{ |
| 164 |
".svn", |
| 165 |
".venv", |
| 166 |
"build", |
| 167 |
"dist", |
| 168 |
".bzr", |
| 169 |
".tox", |
| 170 |
".hg", |
| 171 |
".mypy_cache", |
| 172 |
".nox", |
| 173 |
"_build", |
| 174 |
"buck-out", |
| 175 |
"node_modules", |
| 176 |
".git", |
| 177 |
".eggs", |
| 178 |
".pants.d", |
| 179 |
"venv", |
| 180 |
".direnv", |
| 181 |
} |
| 182 |
), |
| 183 |
skip_glob=frozenset(), |
| 184 |
skip_gitignore=True, |
| 185 |
line_length=79, |
| 186 |
wrap_length=0, |
| 187 |
line_ending="", |
| 188 |
sections=("FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"), |
| 189 |
no_sections=False, |
| 190 |
known_future_library=frozenset({"__future__"}), |
| 191 |
known_third_party=frozenset(), |
| 192 |
known_first_party=frozenset(), |
| 193 |
known_local_folder=frozenset(), |
| 194 |
known_standard_library=frozenset( |
| 195 |
{ |
| 196 |
"pwd", |
| 197 |
"types", |
| 198 |
"nntplib", |
| 199 |
"jpeg", |
| 200 |
"pyclbr", |
| 201 |
"encodings", |
| 202 |
"ctypes", |
| 203 |
"macerrors", |
| 204 |
"filecmp", |
| 205 |
"dbm", |
| 206 |
"mimetypes", |
| 207 |
"statvfs", |
| 208 |
"msvcrt", |
| 209 |
"spwd", |
| 210 |
"codecs", |
| 211 |
"SimpleHTTPServer", |
| 212 |
"compiler", |
| 213 |
"pickletools", |
| 214 |
"tkinter", |
| 215 |
"pickle", |
| 216 |
"fm", |
| 217 |
"bsddb", |
| 218 |
"contextvars", |
| 219 |
"dummy_thread", |
| 220 |
"pipes", |
| 221 |
"heapq", |
| 222 |
"dircache", |
| 223 |
"commands", |
| 224 |
"unicodedata", |
| 225 |
"ntpath", |
| 226 |
"marshal", |
| 227 |
"fpformat", |
| 228 |
"linecache", |
| 229 |
"calendar", |
| 230 |
"pty", |
| 231 |
"MimeWriter", |
| 232 |
"inspect", |
| 233 |
"mmap", |
| 234 |
"ic", |
| 235 |
"tty", |
| 236 |
"nis", |
| 237 |
"new", |
| 238 |
"wave", |
| 239 |
"HTMLParser", |
| 240 |
"anydbm", |
| 241 |
"tracemalloc", |
| 242 |
"pdb", |
| 243 |
"sunau", |
| 244 |
"GL", |
| 245 |
"parser", |
| 246 |
"winsound", |
| 247 |
"dbhash", |
| 248 |
"zlib", |
| 249 |
"MacOS", |
| 250 |
"pprint", |
| 251 |
"crypt", |
| 252 |
"aetools", |
| 253 |
"DEVICE", |
| 254 |
"fl", |
| 255 |
"gettext", |
| 256 |
"asyncore", |
| 257 |
"copyreg", |
| 258 |
"queue", |
| 259 |
"resource", |
| 260 |
"turtledemo", |
| 261 |
"fnmatch", |
| 262 |
"hotshot", |
| 263 |
"trace", |
| 264 |
"string", |
| 265 |
"plistlib", |
| 266 |
"gzip", |
| 267 |
"functools", |
| 268 |
"aepack", |
| 269 |
"hashlib", |
| 270 |
"imp", |
| 271 |
"MiniAEFrame", |
| 272 |
"getpass", |
| 273 |
"shutil", |
| 274 |
"ttk", |
| 275 |
"multifile", |
| 276 |
"operator", |
| 277 |
"reprlib", |
| 278 |
"subprocess", |
| 279 |
"cgi", |
| 280 |
"select", |
| 281 |
"SimpleXMLRPCServer", |
| 282 |
"audioop", |
| 283 |
"macresource", |
| 284 |
"stringprep", |
| 285 |
"wsgiref", |
| 286 |
"SUNAUDIODEV", |
| 287 |
"atexit", |
| 288 |
"lzma", |
| 289 |
"asyncio", |
| 290 |
"datetime", |
| 291 |
"binhex", |
| 292 |
"autoGIL", |
| 293 |
"doctest", |
| 294 |
"thread", |
| 295 |
"enum", |
| 296 |
"tempfile", |
| 297 |
"posixfile", |
| 298 |
"mhlib", |
| 299 |
"html", |
| 300 |
"itertools", |
| 301 |
"exceptions", |
| 302 |
"sgmllib", |
| 303 |
"array", |
| 304 |
"test", |
| 305 |
"imputil", |
| 306 |
"shlex", |
| 307 |
"flp", |
| 308 |
"uu", |
| 309 |
"gdbm", |
| 310 |
"urlparse", |
| 311 |
"msilib", |
| 312 |
"termios", |
| 313 |
"modulefinder", |
| 314 |
"ossaudiodev", |
| 315 |
"timeit", |
| 316 |
"binascii", |
| 317 |
"popen2", |
| 318 |
"ConfigParser", |
| 319 |
"poplib", |
| 320 |
"zipfile", |
| 321 |
"cfmfile", |
| 322 |
"pstats", |
| 323 |
"AL", |
| 324 |
"contextlib", |
| 325 |
"code", |
| 326 |
"zipimport", |
| 327 |
"base64", |
| 328 |
"platform", |
| 329 |
"ast", |
| 330 |
"fileinput", |
| 331 |
"locale", |
| 332 |
"buildtools", |
| 333 |
"stat", |
| 334 |
"quopri", |
| 335 |
"readline", |
| 336 |
"collections", |
| 337 |
"aetypes", |
| 338 |
"concurrent", |
| 339 |
"runpy", |
| 340 |
"copy_reg", |
| 341 |
"rexec", |
| 342 |
"cmath", |
| 343 |
"optparse", |
| 344 |
"dummy_threading", |
| 345 |
"ColorPicker", |
| 346 |
"sched", |
| 347 |
"netrc", |
| 348 |
"sunaudiodev", |
| 349 |
"socketserver", |
| 350 |
"logging", |
| 351 |
"PixMapWrapper", |
| 352 |
"sysconfig", |
| 353 |
"Nav", |
| 354 |
"copy", |
| 355 |
"cmd", |
| 356 |
"csv", |
| 357 |
"chunk", |
| 358 |
"multiprocessing", |
| 359 |
"warnings", |
| 360 |
"weakref", |
| 361 |
"py_compile", |
| 362 |
"sre", |
| 363 |
"sre_parse", |
| 364 |
"curses", |
| 365 |
"threading", |
| 366 |
"re", |
| 367 |
"FrameWork", |
| 368 |
"_thread", |
| 369 |
"imgfile", |
| 370 |
"cd", |
| 371 |
"sre_constants", |
| 372 |
"xdrlib", |
| 373 |
"dataclasses", |
| 374 |
"urllib2", |
| 375 |
"StringIO", |
| 376 |
"configparser", |
| 377 |
"importlib", |
| 378 |
"UserList", |
| 379 |
"posixpath", |
| 380 |
"mailbox", |
| 381 |
"rfc822", |
| 382 |
"grp", |
| 383 |
"pydoc", |
| 384 |
"sets", |
| 385 |
"textwrap", |
| 386 |
"numbers", |
| 387 |
"W", |
| 388 |
"gl", |
| 389 |
"htmllib", |
| 390 |
"macostools", |
| 391 |
"tarfile", |
| 392 |
"ipaddress", |
| 393 |
"xmlrpc", |
| 394 |
"icopen", |
| 395 |
"traceback", |
| 396 |
"_winreg", |
| 397 |
"random", |
| 398 |
"CGIHTTPServer", |
| 399 |
"dis", |
| 400 |
"sha", |
| 401 |
"selectors", |
| 402 |
"statistics", |
| 403 |
"DocXMLRPCServer", |
| 404 |
"imghdr", |
| 405 |
"venv", |
| 406 |
"keyword", |
| 407 |
"xmlrpclib", |
| 408 |
"ftplib", |
| 409 |
"getopt", |
| 410 |
"posix", |
| 411 |
"smtpd", |
| 412 |
"profile", |
| 413 |
"sndhdr", |
| 414 |
"signal", |
| 415 |
"EasyDialogs", |
| 416 |
"dumbdbm", |
| 417 |
"fcntl", |
| 418 |
"SocketServer", |
| 419 |
"distutils", |
| 420 |
"symbol", |
| 421 |
"pathlib", |
| 422 |
"cStringIO", |
| 423 |
"imaplib", |
| 424 |
"unittest", |
| 425 |
"al", |
| 426 |
"cProfile", |
| 427 |
"robotparser", |
| 428 |
"BaseHTTPServer", |
| 429 |
"os", |
| 430 |
"pkgutil", |
| 431 |
"socket", |
| 432 |
"fractions", |
| 433 |
"shelve", |
| 434 |
"aifc", |
| 435 |
"cgitb", |
| 436 |
"xml", |
| 437 |
"decimal", |
| 438 |
"sre_compile", |
| 439 |
"ssl", |
| 440 |
"user", |
| 441 |
"Bastion", |
| 442 |
"formatter", |
| 443 |
"time", |
| 444 |
"abc", |
| 445 |
"winreg", |
| 446 |
"difflib", |
| 447 |
"FL", |
| 448 |
"bz2", |
| 449 |
"asynchat", |
| 450 |
"gc", |
| 451 |
"gensuitemodule", |
| 452 |
"symtable", |
| 453 |
"secrets", |
| 454 |
"Carbon", |
| 455 |
"mailcap", |
| 456 |
"sys", |
| 457 |
"bdb", |
| 458 |
"fpectl", |
| 459 |
"httplib", |
| 460 |
"webbrowser", |
| 461 |
"smtplib", |
| 462 |
"Cookie", |
| 463 |
"whichdb", |
| 464 |
"turtle", |
| 465 |
"tokenize", |
| 466 |
"UserString", |
| 467 |
"tabnanny", |
| 468 |
"site", |
| 469 |
"struct", |
| 470 |
"codeop", |
| 471 |
"email", |
| 472 |
"typing", |
| 473 |
"cookielib", |
| 474 |
"Queue", |
| 475 |
"rlcompleter", |
| 476 |
"errno", |
| 477 |
"macpath", |
| 478 |
"videoreader", |
| 479 |
"md5", |
| 480 |
"cPickle", |
| 481 |
"Tix", |
| 482 |
"io", |
| 483 |
"faulthandler", |
| 484 |
"Tkinter", |
| 485 |
"glob", |
| 486 |
"syslog", |
| 487 |
"telnetlib", |
| 488 |
"_dummy_thread", |
| 489 |
"hmac", |
| 490 |
"uuid", |
| 491 |
"imageop", |
| 492 |
"future_builtins", |
| 493 |
"json", |
| 494 |
"htmlentitydefs", |
| 495 |
"lib2to3", |
| 496 |
"UserDict", |
| 497 |
"mutex", |
| 498 |
"sqlite3", |
| 499 |
"findertools", |
| 500 |
"bisect", |
| 501 |
"builtins", |
| 502 |
"urllib", |
| 503 |
"http", |
| 504 |
"compileall", |
| 505 |
"argparse", |
| 506 |
"ScrolledText", |
| 507 |
"token", |
| 508 |
"dl", |
| 509 |
"applesingle", |
| 510 |
"math", |
| 511 |
"ensurepip", |
| 512 |
"mimify", |
| 513 |
"mimetools", |
| 514 |
"colorsys", |
| 515 |
"zipapp", |
| 516 |
"__builtin__", |
| 517 |
} |
| 518 |
), |
| 519 |
extra_standard_library=frozenset(), |
| 520 |
known_other={"other": frozenset({"", "\x10\x1bm"})}, |
| 521 |
multi_line_output=0, |
| 522 |
forced_separate=(), |
| 523 |
indent=" ", |
| 524 |
comment_prefix=" #", |
| 525 |
length_sort=True, |
| 526 |
length_sort_straight=False, |
| 527 |
length_sort_sections=frozenset(), |
| 528 |
add_imports=frozenset(), |
| 529 |
remove_imports=frozenset( |
| 530 |
{ |
| 531 |
"", |
| 532 |
"\U00076fe7þs\x0c\U000c8b75v\U00106541", |
| 533 |
"𥒒>\U0001960euj𒎕\x9e", |
| 534 |
"\x15\x9b", |
| 535 |
"\x02l", |
| 536 |
"\U000b71ef.\x1c", |
| 537 |
"\x7f?\U000ec91c", |
| 538 |
"\x7f,ÞoÀP8\x1b\x1e»3\x86\x94¤ÁÓ~\U00066b1a,O\U0010ab28\x90«", |
| 539 |
"Y\x06ºZ\x04Ýì\U00078ce1.\U0010c1f9[EK\x83EÖø", |
| 540 |
";À¨|\x1b 𑐒🍸V", |
| 541 |
} |
| 542 |
), |
| 543 |
append_only=False, |
| 544 |
reverse_relative=True, |
| 545 |
force_single_line=False, |
| 546 |
single_line_exclusions=( |
| 547 |
"Y\U000347d9g\x957K", |
| 548 |
"", |
| 549 |
"Ê\U000e8ad2\U0008fa72ùÏ\x19ç\U000eaecc𤎪.", |
| 550 |
"·o\U000d00e5\U000b36de+\x8f\U000b5953´\x08oÜ", |
| 551 |
"", |
| 552 |
":sI¶", |
| 553 |
"", |
| 554 |
), |
| 555 |
default_section="THIRDPARTY", |
| 556 |
import_headings={}, |
| 557 |
import_footers={}, |
| 558 |
balanced_wrapping=False, |
| 559 |
use_parentheses=True, |
| 560 |
order_by_type=True, |
| 561 |
atomic=False, |
| 562 |
lines_before_imports=-1, |
| 563 |
lines_after_imports=-1, |
| 564 |
lines_between_sections=1, |
| 565 |
lines_between_types=0, |
| 566 |
combine_as_imports=True, |
| 567 |
combine_star=False, |
| 568 |
include_trailing_comma=False, |
| 569 |
from_first=False, |
| 570 |
verbose=False, |
| 571 |
quiet=False, |
| 572 |
force_adds=False, |
| 573 |
force_alphabetical_sort_within_sections=False, |
| 574 |
force_alphabetical_sort=False, |
| 575 |
force_grid_wrap=0, |
| 576 |
force_sort_within_sections=False, |
| 577 |
lexicographical=False, |
| 578 |
ignore_whitespace=False, |
| 579 |
no_lines_before=frozenset( |
| 580 |
{ |
| 581 |
"uøø", |
| 582 |
"¢", |
| 583 |
"&\x8c5Ï\U000e5f01Ø", |
| 584 |
"\U0005d415\U000a3df2h\U000f24e5\U00104d7b34¹ÒÀ", |
| 585 |
"\U000e374c8", |
| 586 |
"w", |
| 587 |
} |
| 588 |
), |
| 589 |
no_inline_sort=False, |
| 590 |
ignore_comments=False, |
| 591 |
case_sensitive=False, |
| 592 |
sources=( |
| 593 |
{ |
| 594 |
"py_version": "py3", |
| 595 |
"force_to_top": frozenset(), |
| 596 |
"skip": frozenset( |
| 597 |
{ |
| 598 |
".svn", |
| 599 |
".venv", |
| 600 |
"build", |
| 601 |
"dist", |
| 602 |
".bzr", |
| 603 |
".tox", |
| 604 |
".hg", |
| 605 |
".mypy_cache", |
| 606 |
".nox", |
| 607 |
"_build", |
| 608 |
"buck-out", |
| 609 |
"node_modules", |
| 610 |
".git", |
| 611 |
".eggs", |
| 612 |
".pants.d", |
| 613 |
"venv", |
| 614 |
".direnv", |
| 615 |
} |
| 616 |
), |
| 617 |
"skip_glob": frozenset(), |
| 618 |
"skip_gitignore": False, |
| 619 |
"line_length": 79, |
| 620 |
"wrap_length": 0, |
| 621 |
"line_ending": "", |
| 622 |
"sections": ("FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"), |
| 623 |
"no_sections": False, |
| 624 |
"known_future_library": frozenset({"__future__"}), |
| 625 |
"known_third_party": frozenset(), |
| 626 |
"known_first_party": frozenset(), |
| 627 |
"known_local_folder": frozenset(), |
| 628 |
"known_standard_library": frozenset( |
| 629 |
{ |
| 630 |
"pwd", |
| 631 |
"copy", |
| 632 |
"cmd", |
| 633 |
"csv", |
| 634 |
"chunk", |
| 635 |
"multiprocessing", |
| 636 |
"warnings", |
| 637 |
"types", |
| 638 |
"weakref", |
| 639 |
"nntplib", |
| 640 |
"pyclbr", |
| 641 |
"encodings", |
| 642 |
"py_compile", |
| 643 |
"sre", |
| 644 |
"ctypes", |
| 645 |
"sre_parse", |
| 646 |
"filecmp", |
| 647 |
"curses", |
| 648 |
"threading", |
| 649 |
"dbm", |
| 650 |
"re", |
| 651 |
"_thread", |
| 652 |
"sre_constants", |
| 653 |
"xdrlib", |
| 654 |
"dataclasses", |
| 655 |
"mimetypes", |
| 656 |
"configparser", |
| 657 |
"importlib", |
| 658 |
"msvcrt", |
| 659 |
"spwd", |
| 660 |
"posixpath", |
| 661 |
"mailbox", |
| 662 |
"codecs", |
| 663 |
"grp", |
| 664 |
"pickletools", |
| 665 |
"tkinter", |
| 666 |
"pickle", |
| 667 |
"contextvars", |
| 668 |
"pydoc", |
| 669 |
"textwrap", |
| 670 |
"numbers", |
| 671 |
"pipes", |
| 672 |
"heapq", |
| 673 |
"tarfile", |
| 674 |
"unicodedata", |
| 675 |
"ntpath", |
| 676 |
"ipaddress", |
| 677 |
"marshal", |
| 678 |
"xmlrpc", |
| 679 |
"traceback", |
| 680 |
"linecache", |
| 681 |
"calendar", |
| 682 |
"pty", |
| 683 |
"random", |
| 684 |
"dis", |
| 685 |
"selectors", |
| 686 |
"statistics", |
| 687 |
"imghdr", |
| 688 |
"venv", |
| 689 |
"inspect", |
| 690 |
"mmap", |
| 691 |
"keyword", |
| 692 |
"ftplib", |
| 693 |
"tty", |
| 694 |
"nis", |
| 695 |
"getopt", |
| 696 |
"posix", |
| 697 |
"smtpd", |
| 698 |
"wave", |
| 699 |
"profile", |
| 700 |
"sndhdr", |
| 701 |
"signal", |
| 702 |
"tracemalloc", |
| 703 |
"pdb", |
| 704 |
"sunau", |
| 705 |
"winsound", |
| 706 |
"parser", |
| 707 |
"zlib", |
| 708 |
"fcntl", |
| 709 |
"pprint", |
| 710 |
"distutils", |
| 711 |
"crypt", |
| 712 |
"symbol", |
| 713 |
"gettext", |
| 714 |
"pathlib", |
| 715 |
"asyncore", |
| 716 |
"copyreg", |
| 717 |
"imaplib", |
| 718 |
"unittest", |
| 719 |
"queue", |
| 720 |
"resource", |
| 721 |
"turtledemo", |
| 722 |
"fnmatch", |
| 723 |
"cProfile", |
| 724 |
"os", |
| 725 |
"pkgutil", |
| 726 |
"socket", |
| 727 |
"trace", |
| 728 |
"fractions", |
| 729 |
"string", |
| 730 |
"shelve", |
| 731 |
"plistlib", |
| 732 |
"aifc", |
| 733 |
"gzip", |
| 734 |
"functools", |
| 735 |
"cgitb", |
| 736 |
"xml", |
| 737 |
"hashlib", |
| 738 |
"decimal", |
| 739 |
"imp", |
| 740 |
"sre_compile", |
| 741 |
"ssl", |
| 742 |
"formatter", |
| 743 |
"winreg", |
| 744 |
"time", |
| 745 |
"getpass", |
| 746 |
"shutil", |
| 747 |
"abc", |
| 748 |
"difflib", |
| 749 |
"bz2", |
| 750 |
"operator", |
| 751 |
"reprlib", |
| 752 |
"subprocess", |
| 753 |
"cgi", |
| 754 |
"select", |
| 755 |
"asynchat", |
| 756 |
"audioop", |
| 757 |
"gc", |
| 758 |
"secrets", |
| 759 |
"symtable", |
| 760 |
"mailcap", |
| 761 |
"sys", |
| 762 |
"bdb", |
| 763 |
"fpectl", |
| 764 |
"stringprep", |
| 765 |
"webbrowser", |
| 766 |
"smtplib", |
| 767 |
"wsgiref", |
| 768 |
"atexit", |
| 769 |
"lzma", |
| 770 |
"asyncio", |
| 771 |
"datetime", |
| 772 |
"binhex", |
| 773 |
"doctest", |
| 774 |
"turtle", |
| 775 |
"enum", |
| 776 |
"tempfile", |
| 777 |
"tokenize", |
| 778 |
"tabnanny", |
| 779 |
"site", |
| 780 |
"html", |
| 781 |
"struct", |
| 782 |
"itertools", |
| 783 |
"codeop", |
| 784 |
"email", |
| 785 |
"array", |
| 786 |
"test", |
| 787 |
"typing", |
| 788 |
"shlex", |
| 789 |
"uu", |
| 790 |
"msilib", |
| 791 |
"termios", |
| 792 |
"rlcompleter", |
| 793 |
"modulefinder", |
| 794 |
"ossaudiodev", |
| 795 |
"timeit", |
| 796 |
"binascii", |
| 797 |
"poplib", |
| 798 |
"errno", |
| 799 |
"macpath", |
| 800 |
"zipfile", |
| 801 |
"io", |
| 802 |
"faulthandler", |
| 803 |
"pstats", |
| 804 |
"contextlib", |
| 805 |
"code", |
| 806 |
"glob", |
| 807 |
"zipimport", |
| 808 |
"base64", |
| 809 |
"syslog", |
| 810 |
"platform", |
| 811 |
"ast", |
| 812 |
"fileinput", |
| 813 |
"telnetlib", |
| 814 |
"locale", |
| 815 |
"_dummy_thread", |
| 816 |
"hmac", |
| 817 |
"stat", |
| 818 |
"uuid", |
| 819 |
"quopri", |
| 820 |
"readline", |
| 821 |
"collections", |
| 822 |
"json", |
| 823 |
"concurrent", |
| 824 |
"lib2to3", |
| 825 |
"sqlite3", |
| 826 |
"runpy", |
| 827 |
"cmath", |
| 828 |
"optparse", |
| 829 |
"bisect", |
| 830 |
"builtins", |
| 831 |
"urllib", |
| 832 |
"dummy_threading", |
| 833 |
"http", |
| 834 |
"compileall", |
| 835 |
"argparse", |
| 836 |
"token", |
| 837 |
"sched", |
| 838 |
"netrc", |
| 839 |
"math", |
| 840 |
"ensurepip", |
| 841 |
"socketserver", |
| 842 |
"colorsys", |
| 843 |
"zipapp", |
| 844 |
"logging", |
| 845 |
"sysconfig", |
| 846 |
} |
| 847 |
), |
| 848 |
"extra_standard_library": frozenset(), |
| 849 |
"known_other": {}, |
| 850 |
"multi_line_output": 0, |
| 851 |
"forced_separate": (), |
| 852 |
"indent": " ", |
| 853 |
"comment_prefix": " #", |
| 854 |
"length_sort": False, |
| 855 |
"length_sort_straight": False, |
| 856 |
"length_sort_sections": frozenset(), |
| 857 |
"add_imports": frozenset(), |
| 858 |
"remove_imports": frozenset(), |
| 859 |
"append_only": False, |
| 860 |
"reverse_relative": False, |
| 861 |
"force_single_line": False, |
| 862 |
"single_line_exclusions": (), |
| 863 |
"default_section": "THIRDPARTY", |
| 864 |
"import_headings": {}, |
| 865 |
"import_footers": {}, |
| 866 |
"balanced_wrapping": False, |
| 867 |
"use_parentheses": False, |
| 868 |
"order_by_type": True, |
| 869 |
"atomic": False, |
| 870 |
"lines_before_imports": -1, |
| 871 |
"lines_after_imports": -1, |
| 872 |
"lines_between_sections": 1, |
| 873 |
"lines_between_types": 0, |
| 874 |
"combine_as_imports": False, |
| 875 |
"combine_star": False, |
| 876 |
"include_trailing_comma": False, |
| 877 |
"from_first": False, |
| 878 |
"verbose": False, |
| 879 |
"quiet": False, |
| 880 |
"force_adds": False, |
| 881 |
"force_alphabetical_sort_within_sections": False, |
| 882 |
"force_alphabetical_sort": False, |
| 883 |
"force_grid_wrap": 0, |
| 884 |
"force_sort_within_sections": False, |
| 885 |
"lexicographical": False, |
| 886 |
"ignore_whitespace": False, |
| 887 |
"no_lines_before": frozenset(), |
| 888 |
"no_inline_sort": False, |
| 889 |
"ignore_comments": False, |
| 890 |
"case_sensitive": False, |
| 891 |
"sources": (), |
| 892 |
"virtual_env": "", |
| 893 |
"conda_env": "", |
| 894 |
"ensure_newline_before_comments": False, |
| 895 |
"directory": "", |
| 896 |
"profile": "", |
| 897 |
"honor_noqa": False, |
| 898 |
"src_paths": frozenset(), |
| 899 |
"remove_redundant_aliases": False, |
| 900 |
"float_to_top": False, |
| 901 |
"filter_files": False, |
| 902 |
"formatter": "", |
| 903 |
"formatting_function": None, |
| 904 |
"color_output": False, |
| 905 |
"treat_comments_as_code": frozenset(), |
| 906 |
"treat_all_comments_as_code": False, |
| 907 |
"supported_extensions": frozenset({"py", "pyx", "pyi"}), |
| 908 |
"blocked_extensions": frozenset({"pex"}), |
| 909 |
"constants": frozenset(), |
| 910 |
"classes": frozenset(), |
| 911 |
"variables": frozenset(), |
| 912 |
"dedup_headings": False, |
| 913 |
"source": "defaults", |
| 914 |
}, |
| 915 |
{ |
| 916 |
"classes": frozenset( |
| 917 |
{ |
| 918 |
"\U000eb6c6\x9eÑ\U0008297dâhï\x8eÆ", |
| 919 |
"C", |
| 920 |
"\x8e\U000422ac±\U000b5a1f\U000c4166", |
| 921 |
"ùÚ", |
| 922 |
} |
| 923 |
), |
| 924 |
"single_line_exclusions": ( |
| 925 |
"Y\U000347d9g\x957K", |
| 926 |
"", |
| 927 |
"Ê\U000e8ad2\U0008fa72ùÏ\x19ç\U000eaecc𤎪.", |
| 928 |
"·o\U000d00e5\U000b36de+\x8f\U000b5953´\x08oÜ", |
| 929 |
"", |
| 930 |
":sI¶", |
| 931 |
"", |
| 932 |
), |
| 933 |
"indent": " ", |
| 934 |
"no_lines_before": frozenset( |
| 935 |
{ |
| 936 |
"uøø", |
| 937 |
"¢", |
| 938 |
"&\x8c5Ï\U000e5f01Ø", |
| 939 |
"\U0005d415\U000a3df2h\U000f24e5\U00104d7b34¹ÒÀ", |
| 940 |
"\U000e374c8", |
| 941 |
"w", |
| 942 |
} |
| 943 |
), |
| 944 |
"quiet": False, |
| 945 |
"honor_noqa": False, |
| 946 |
"dedup_headings": True, |
| 947 |
"known_other": { |
| 948 |
"\x10\x1bm": frozenset({"\U000682a49\U000e1a63²KǶ4", "", "\x1a", "©"}), |
| 949 |
"": frozenset({"íå\x94Ì", "\U000cf258"}), |
| 950 |
}, |
| 951 |
"treat_comments_as_code": frozenset({""}), |
| 952 |
"length_sort": True, |
| 953 |
"reverse_relative": True, |
| 954 |
"combine_as_imports": True, |
| 955 |
"py_version": "all", |
| 956 |
"use_parentheses": True, |
| 957 |
"skip_gitignore": True, |
| 958 |
"remove_imports": frozenset( |
| 959 |
{ |
| 960 |
"", |
| 961 |
"\U00076fe7þs\x0c\U000c8b75v\U00106541", |
| 962 |
"𥒒>\U0001960euj𒎕\x9e", |
| 963 |
"\x15\x9b", |
| 964 |
"\x02l", |
| 965 |
"\U000b71ef.\x1c", |
| 966 |
"\x7f?\U000ec91c", |
| 967 |
"\x7f,ÞoÀP8\x1b\x1e»3\x86\x94¤ÁÓ~\U00066b1a,O\U0010ab28\x90«", |
| 968 |
"Y\x06ºZ\x04Ýì\U00078ce1.\U0010c1f9[EK\x83EÖø", |
| 969 |
";À¨|\x1b 𑐒🍸V", |
| 970 |
} |
| 971 |
), |
| 972 |
"atomic": False, |
| 973 |
"source": "runtime", |
| 974 |
}, |
| 975 |
), |
| 976 |
virtual_env="", |
| 977 |
conda_env="", |
| 978 |
ensure_newline_before_comments=False, |
| 979 |
directory="/home/abuild/rpmbuild/BUILD/isort-5.11.0", |
| 980 |
profile="", |
| 981 |
honor_noqa=False, |
| 982 |
remove_redundant_aliases=False, |
| 983 |
float_to_top=False, |
| 984 |
filter_files=False, |
| 985 |
formatting_function=None, |
| 986 |
color_output=False, |
| 987 |
treat_comments_as_code=frozenset({""}), |
| 988 |
treat_all_comments_as_code=False, |
| 989 |
supported_extensions=frozenset({"py", "pyx", "pyi"}), |
| 990 |
blocked_extensions=frozenset({"pex"}), |
| 991 |
constants=frozenset(), |
| 992 |
classes=frozenset( |
| 993 |
{"\U000eb6c6\x9eÑ\U0008297dâhï\x8eÆ", "C", "\x8e\U000422ac±\U000b5a1f\U000c4166", "ùÚ"} |
| 994 |
), |
| 995 |
variables=frozenset(), |
| 996 |
dedup_headings=True, |
| 997 |
), |
| 998 |
disregard_skip=True, |
| 999 |
) |
| 1000 |
@hypothesis.example( |
| 1001 |
config=isort.Config( |
| 1002 |
py_version="2", |
| 1003 |
combine_straight_imports=True, |
| 1004 |
), |
| 1005 |
disregard_skip=True, |
| 1006 |
) |
| 1007 |
@hypothesis.given( |
| 1008 |
config=st.from_type(isort.Config), |
| 1009 |
disregard_skip=st.booleans(), |
| 1010 |
) |
| 1011 |
@hypothesis.settings(deadline=None) |
| 1012 |
def test_isort_is_idempotent(config: isort.Config, disregard_skip: bool) -> None: |
| 1013 |
try: |
| 1014 |
result = isort.code(CODE_SNIPPET, config=config, disregard_skip=disregard_skip) |
| 1015 |
result = isort.code(result, config=config, disregard_skip=disregard_skip) |
| 1016 |
assert result == isort.code(result, config=config, disregard_skip=disregard_skip) |
| 1017 |
except ValueError: |
| 1018 |
pass |
| 1019 |
|
| 1020 |
|
| 1021 |
@hypothesis.example( |
| 1022 |
config=isort.Config( |
| 1023 |
py_version="all", |
| 1024 |
force_to_top=frozenset(), |
| 1025 |
skip=frozenset( |
| 1026 |
{ |
| 1027 |
".svn", |
| 1028 |
".venv", |
| 1029 |
"build", |
| 1030 |
"dist", |
| 1031 |
".bzr", |
| 1032 |
".tox", |
| 1033 |
".hg", |
| 1034 |
".mypy_cache", |
| 1035 |
".nox", |
| 1036 |
"_build", |
| 1037 |
"buck-out", |
| 1038 |
"node_modules", |
| 1039 |
".git", |
| 1040 |
".eggs", |
| 1041 |
".pants.d", |
| 1042 |
"venv", |
| 1043 |
".direnv", |
| 1044 |
} |
| 1045 |
), |
| 1046 |
skip_glob=frozenset(), |
| 1047 |
skip_gitignore=True, |
| 1048 |
line_length=79, |
| 1049 |
wrap_length=0, |
| 1050 |
line_ending="", |
| 1051 |
sections=("FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"), |
| 1052 |
no_sections=False, |
| 1053 |
known_future_library=frozenset({"__future__"}), |
| 1054 |
known_third_party=frozenset(), |
| 1055 |
known_first_party=frozenset(), |
| 1056 |
known_local_folder=frozenset(), |
| 1057 |
known_standard_library=frozenset( |
| 1058 |
{ |
| 1059 |
"pwd", |
| 1060 |
"types", |
| 1061 |
"nntplib", |
| 1062 |
"jpeg", |
| 1063 |
"pyclbr", |
| 1064 |
"encodings", |
| 1065 |
"ctypes", |
| 1066 |
"macerrors", |
| 1067 |
"filecmp", |
| 1068 |
"dbm", |
| 1069 |
"mimetypes", |
| 1070 |
"statvfs", |
| 1071 |
"msvcrt", |
| 1072 |
"spwd", |
| 1073 |
"codecs", |
| 1074 |
"SimpleHTTPServer", |
| 1075 |
"compiler", |
| 1076 |
"pickletools", |
| 1077 |
"tkinter", |
| 1078 |
"pickle", |
| 1079 |
"fm", |
| 1080 |
"bsddb", |
| 1081 |
"contextvars", |
| 1082 |
"dummy_thread", |
| 1083 |
"pipes", |
| 1084 |
"heapq", |
| 1085 |
"dircache", |
| 1086 |
"commands", |
| 1087 |
"unicodedata", |
| 1088 |
"ntpath", |
| 1089 |
"marshal", |
| 1090 |
"fpformat", |
| 1091 |
"linecache", |
| 1092 |
"calendar", |
| 1093 |
"pty", |
| 1094 |
"MimeWriter", |
| 1095 |
"inspect", |
| 1096 |
"mmap", |
| 1097 |
"ic", |
| 1098 |
"tty", |
| 1099 |
"nis", |
| 1100 |
"new", |
| 1101 |
"wave", |
| 1102 |
"HTMLParser", |
| 1103 |
"anydbm", |
| 1104 |
"tracemalloc", |
| 1105 |
"pdb", |
| 1106 |
"sunau", |
| 1107 |
"GL", |
| 1108 |
"parser", |
| 1109 |
"winsound", |
| 1110 |
"dbhash", |
| 1111 |
"zlib", |
| 1112 |
"MacOS", |
| 1113 |
"pprint", |
| 1114 |
"crypt", |
| 1115 |
"aetools", |
| 1116 |
"DEVICE", |
| 1117 |
"fl", |
| 1118 |
"gettext", |
| 1119 |
"asyncore", |
| 1120 |
"copyreg", |
| 1121 |
"queue", |
| 1122 |
"resource", |
| 1123 |
"turtledemo", |
| 1124 |
"fnmatch", |
| 1125 |
"hotshot", |
| 1126 |
"trace", |
| 1127 |
"string", |
| 1128 |
"plistlib", |
| 1129 |
"gzip", |
| 1130 |
"functools", |
| 1131 |
"aepack", |
| 1132 |
"hashlib", |
| 1133 |
"imp", |
| 1134 |
"MiniAEFrame", |
| 1135 |
"getpass", |
| 1136 |
"shutil", |
| 1137 |
"ttk", |
| 1138 |
"multifile", |
| 1139 |
"operator", |
| 1140 |
"reprlib", |
| 1141 |
"subprocess", |
| 1142 |
"cgi", |
| 1143 |
"select", |
| 1144 |
"SimpleXMLRPCServer", |
| 1145 |
"audioop", |
| 1146 |
"macresource", |
| 1147 |
"stringprep", |
| 1148 |
"wsgiref", |
| 1149 |
"SUNAUDIODEV", |
| 1150 |
"atexit", |
| 1151 |
"lzma", |
| 1152 |
"asyncio", |
| 1153 |
"datetime", |
| 1154 |
"binhex", |
| 1155 |
"autoGIL", |
| 1156 |
"doctest", |
| 1157 |
"thread", |
| 1158 |
"enum", |
| 1159 |
"tempfile", |
| 1160 |
"posixfile", |
| 1161 |
"mhlib", |
| 1162 |
"html", |
| 1163 |
"itertools", |
| 1164 |
"exceptions", |
| 1165 |
"sgmllib", |
| 1166 |
"array", |
| 1167 |
"test", |
| 1168 |
"imputil", |
| 1169 |
"shlex", |
| 1170 |
"flp", |
| 1171 |
"uu", |
| 1172 |
"gdbm", |
| 1173 |
"urlparse", |
| 1174 |
"msilib", |
| 1175 |
"termios", |
| 1176 |
"modulefinder", |
| 1177 |
"ossaudiodev", |
| 1178 |
"timeit", |
| 1179 |
"binascii", |
| 1180 |
"popen2", |
| 1181 |
"ConfigParser", |
| 1182 |
"poplib", |
| 1183 |
"zipfile", |
| 1184 |
"cfmfile", |
| 1185 |
"pstats", |
| 1186 |
"AL", |
| 1187 |
"contextlib", |
| 1188 |
"code", |
| 1189 |
"zipimport", |
| 1190 |
"base64", |
| 1191 |
"platform", |
| 1192 |
"ast", |
| 1193 |
"fileinput", |
| 1194 |
"locale", |
| 1195 |
"buildtools", |
| 1196 |
"stat", |
| 1197 |
"quopri", |
| 1198 |
"readline", |
| 1199 |
"collections", |
| 1200 |
"aetypes", |
| 1201 |
"concurrent", |
| 1202 |
"runpy", |
| 1203 |
"copy_reg", |
| 1204 |
"rexec", |
| 1205 |
"cmath", |
| 1206 |
"optparse", |
| 1207 |
"dummy_threading", |
| 1208 |
"ColorPicker", |
| 1209 |
"sched", |
| 1210 |
"netrc", |
| 1211 |
"sunaudiodev", |
| 1212 |
"socketserver", |
| 1213 |
"logging", |
| 1214 |
"PixMapWrapper", |
| 1215 |
"sysconfig", |
| 1216 |
"Nav", |
| 1217 |
"copy", |
| 1218 |
"cmd", |
| 1219 |
"csv", |
| 1220 |
"chunk", |
| 1221 |
"multiprocessing", |
| 1222 |
"warnings", |
| 1223 |
"weakref", |
| 1224 |
"py_compile", |
| 1225 |
"sre", |
| 1226 |
"sre_parse", |
| 1227 |
"curses", |
| 1228 |
"threading", |
| 1229 |
"re", |
| 1230 |
"FrameWork", |
| 1231 |
"_thread", |
| 1232 |
"imgfile", |
| 1233 |
"cd", |
| 1234 |
"sre_constants", |
| 1235 |
"xdrlib", |
| 1236 |
"dataclasses", |
| 1237 |
"urllib2", |
| 1238 |
"StringIO", |
| 1239 |
"configparser", |
| 1240 |
"importlib", |
| 1241 |
"UserList", |
| 1242 |
"posixpath", |
| 1243 |
"mailbox", |
| 1244 |
"rfc822", |
| 1245 |
"grp", |
| 1246 |
"pydoc", |
| 1247 |
"sets", |
| 1248 |
"textwrap", |
| 1249 |
"numbers", |
| 1250 |
"W", |
| 1251 |
"gl", |
| 1252 |
"htmllib", |
| 1253 |
"macostools", |
| 1254 |
"tarfile", |
| 1255 |
"ipaddress", |
| 1256 |
"xmlrpc", |
| 1257 |
"icopen", |
| 1258 |
"traceback", |
| 1259 |
"_winreg", |
| 1260 |
"random", |
| 1261 |
"CGIHTTPServer", |
| 1262 |
"dis", |
| 1263 |
"sha", |
| 1264 |
"selectors", |
| 1265 |
"statistics", |
| 1266 |
"DocXMLRPCServer", |
| 1267 |
"imghdr", |
| 1268 |
"venv", |
| 1269 |
"keyword", |
| 1270 |
"xmlrpclib", |
| 1271 |
"ftplib", |
| 1272 |
"getopt", |
| 1273 |
"posix", |
| 1274 |
"smtpd", |
| 1275 |
"profile", |
| 1276 |
"sndhdr", |
| 1277 |
"signal", |
| 1278 |
"EasyDialogs", |
| 1279 |
"dumbdbm", |
| 1280 |
"fcntl", |
| 1281 |
"SocketServer", |
| 1282 |
"distutils", |
| 1283 |
"symbol", |
| 1284 |
"pathlib", |
| 1285 |
"cStringIO", |
| 1286 |
"imaplib", |
| 1287 |
"unittest", |
| 1288 |
"al", |
| 1289 |
"cProfile", |
| 1290 |
"robotparser", |
| 1291 |
"BaseHTTPServer", |
| 1292 |
"os", |
| 1293 |
"pkgutil", |
| 1294 |
"socket", |
| 1295 |
"fractions", |
| 1296 |
"shelve", |
| 1297 |
"aifc", |
| 1298 |
"cgitb", |
| 1299 |
"xml", |
| 1300 |
"decimal", |
| 1301 |
"sre_compile", |
| 1302 |
"ssl", |
| 1303 |
"user", |
| 1304 |
"Bastion", |
| 1305 |
"formatter", |
| 1306 |
"time", |
| 1307 |
"abc", |
| 1308 |
"winreg", |
| 1309 |
"difflib", |
| 1310 |
"FL", |
| 1311 |
"bz2", |
| 1312 |
"asynchat", |
| 1313 |
"gc", |
| 1314 |
"gensuitemodule", |
| 1315 |
"symtable", |
| 1316 |
"secrets", |
| 1317 |
"Carbon", |
| 1318 |
"mailcap", |
| 1319 |
"sys", |
| 1320 |
"bdb", |
| 1321 |
"fpectl", |
| 1322 |
"httplib", |
| 1323 |
"webbrowser", |
| 1324 |
"smtplib", |
| 1325 |
"Cookie", |
| 1326 |
"whichdb", |
| 1327 |
"turtle", |
| 1328 |
"tokenize", |
| 1329 |
"UserString", |
| 1330 |
"tabnanny", |
| 1331 |
"site", |
| 1332 |
"struct", |
| 1333 |
"codeop", |
| 1334 |
"email", |
| 1335 |
"typing", |
| 1336 |
"cookielib", |
| 1337 |
"Queue", |
| 1338 |
"rlcompleter", |
| 1339 |
"errno", |
| 1340 |
"macpath", |
| 1341 |
"videoreader", |
| 1342 |
"md5", |
| 1343 |
"cPickle", |
| 1344 |
"Tix", |
| 1345 |
"io", |
| 1346 |
"faulthandler", |
| 1347 |
"Tkinter", |
| 1348 |
"glob", |
| 1349 |
"syslog", |
| 1350 |
"telnetlib", |
| 1351 |
"_dummy_thread", |
| 1352 |
"hmac", |
| 1353 |
"uuid", |
| 1354 |
"imageop", |
| 1355 |
"future_builtins", |
| 1356 |
"json", |
| 1357 |
"htmlentitydefs", |
| 1358 |
"lib2to3", |
| 1359 |
"UserDict", |
| 1360 |
"mutex", |
| 1361 |
"sqlite3", |
| 1362 |
"findertools", |
| 1363 |
"bisect", |
| 1364 |
"builtins", |
| 1365 |
"urllib", |
| 1366 |
"http", |
| 1367 |
"compileall", |
| 1368 |
"argparse", |
| 1369 |
"ScrolledText", |
| 1370 |
"token", |
| 1371 |
"dl", |
| 1372 |
"applesingle", |
| 1373 |
"math", |
| 1374 |
"ensurepip", |
| 1375 |
"mimify", |
| 1376 |
"mimetools", |
| 1377 |
"colorsys", |
| 1378 |
"zipapp", |
| 1379 |
"__builtin__", |
| 1380 |
} |
| 1381 |
), |
| 1382 |
extra_standard_library=frozenset(), |
| 1383 |
known_other={"other": frozenset({"", "\x10\x1bm"})}, |
| 1384 |
multi_line_output=0, |
| 1385 |
forced_separate=(), |
| 1386 |
indent=" ", |
| 1387 |
comment_prefix=" #", |
| 1388 |
length_sort=True, |
| 1389 |
length_sort_straight=False, |
| 1390 |
length_sort_sections=frozenset(), |
| 1391 |
add_imports=frozenset(), |
| 1392 |
remove_imports=frozenset( |
| 1393 |
{ |
| 1394 |
"", |
| 1395 |
"\U00076fe7þs\x0c\U000c8b75v\U00106541", |
| 1396 |
"𥒒>\U0001960euj𒎕\x9e", |
| 1397 |
"\x15\x9b", |
| 1398 |
"\x02l", |
| 1399 |
"\U000b71ef.\x1c", |
| 1400 |
"\x7f?\U000ec91c", |
| 1401 |
"\x7f,ÞoÀP8\x1b\x1e»3\x86\x94¤ÁÓ~\U00066b1a,O\U0010ab28\x90«", |
| 1402 |
"Y\x06ºZ\x04Ýì\U00078ce1.\U0010c1f9[EK\x83EÖø", |
| 1403 |
";À¨|\x1b 𑐒🍸V", |
| 1404 |
} |
| 1405 |
), |
| 1406 |
append_only=False, |
| 1407 |
reverse_relative=True, |
| 1408 |
force_single_line=False, |
| 1409 |
single_line_exclusions=( |
| 1410 |
"Y\U000347d9g\x957K", |
| 1411 |
"", |
| 1412 |
"Ê\U000e8ad2\U0008fa72ùÏ\x19ç\U000eaecc𤎪.", |
| 1413 |
"·o\U000d00e5\U000b36de+\x8f\U000b5953´\x08oÜ", |
| 1414 |
"", |
| 1415 |
":sI¶", |
| 1416 |
"", |
| 1417 |
), |
| 1418 |
default_section="THIRDPARTY", |
| 1419 |
import_headings={}, |
| 1420 |
import_footers={}, |
| 1421 |
balanced_wrapping=False, |
| 1422 |
use_parentheses=True, |
| 1423 |
order_by_type=True, |
| 1424 |
atomic=False, |
| 1425 |
lines_before_imports=-1, |
| 1426 |
lines_after_imports=-1, |
| 1427 |
lines_between_sections=1, |
| 1428 |
lines_between_types=0, |
| 1429 |
combine_as_imports=True, |
| 1430 |
combine_star=False, |
| 1431 |
include_trailing_comma=False, |
| 1432 |
from_first=False, |
| 1433 |
verbose=False, |
| 1434 |
quiet=False, |
| 1435 |
force_adds=False, |
| 1436 |
force_alphabetical_sort_within_sections=False, |
| 1437 |
force_alphabetical_sort=False, |
| 1438 |
force_grid_wrap=0, |
| 1439 |
force_sort_within_sections=False, |
| 1440 |
lexicographical=False, |
| 1441 |
ignore_whitespace=False, |
| 1442 |
no_lines_before=frozenset( |
| 1443 |
{ |
| 1444 |
"uøø", |
| 1445 |
"¢", |
| 1446 |
"&\x8c5Ï\U000e5f01Ø", |
| 1447 |
"\U0005d415\U000a3df2h\U000f24e5\U00104d7b34¹ÒÀ", |
| 1448 |
"\U000e374c8", |
| 1449 |
"w", |
| 1450 |
} |
| 1451 |
), |
| 1452 |
no_inline_sort=False, |
| 1453 |
ignore_comments=False, |
| 1454 |
case_sensitive=False, |
| 1455 |
sources=( |
| 1456 |
{ |
| 1457 |
"py_version": "py3", |
| 1458 |
"force_to_top": frozenset(), |
| 1459 |
"skip": frozenset( |
| 1460 |
{ |
| 1461 |
".svn", |
| 1462 |
".venv", |
| 1463 |
"build", |
| 1464 |
"dist", |
| 1465 |
".bzr", |
| 1466 |
".tox", |
| 1467 |
".hg", |
| 1468 |
".mypy_cache", |
| 1469 |
".nox", |
| 1470 |
"_build", |
| 1471 |
"buck-out", |
| 1472 |
"node_modules", |
| 1473 |
".git", |
| 1474 |
".eggs", |
| 1475 |
".pants.d", |
| 1476 |
"venv", |
| 1477 |
".direnv", |
| 1478 |
} |
| 1479 |
), |
| 1480 |
"skip_glob": frozenset(), |
| 1481 |
"skip_gitignore": False, |
| 1482 |
"line_length": 79, |
| 1483 |
"wrap_length": 0, |
| 1484 |
"line_ending": "", |
| 1485 |
"sections": ("FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"), |
| 1486 |
"no_sections": False, |
| 1487 |
"known_future_library": frozenset({"__future__"}), |
| 1488 |
"known_third_party": frozenset(), |
| 1489 |
"known_first_party": frozenset(), |
| 1490 |
"known_local_folder": frozenset(), |
| 1491 |
"known_standard_library": frozenset( |
| 1492 |
{ |
| 1493 |
"pwd", |
| 1494 |
"copy", |
| 1495 |
"cmd", |
| 1496 |
"csv", |
| 1497 |
"chunk", |
| 1498 |
"multiprocessing", |
| 1499 |
"warnings", |
| 1500 |
"types", |
| 1501 |
"weakref", |
| 1502 |
"nntplib", |
| 1503 |
"pyclbr", |
| 1504 |
"encodings", |
| 1505 |
"py_compile", |
| 1506 |
"sre", |
| 1507 |
"ctypes", |
| 1508 |
"sre_parse", |
| 1509 |
"filecmp", |
| 1510 |
"curses", |
| 1511 |
"threading", |
| 1512 |
"dbm", |
| 1513 |
"re", |
| 1514 |
"_thread", |
| 1515 |
"sre_constants", |
| 1516 |
"xdrlib", |
| 1517 |
"dataclasses", |
| 1518 |
"mimetypes", |
| 1519 |
"configparser", |
| 1520 |
"importlib", |
| 1521 |
"msvcrt", |
| 1522 |
"spwd", |
| 1523 |
"posixpath", |
| 1524 |
"mailbox", |
| 1525 |
"codecs", |
| 1526 |
"grp", |
| 1527 |
"pickletools", |
| 1528 |
"tkinter", |
| 1529 |
"pickle", |
| 1530 |
"contextvars", |
| 1531 |
"pydoc", |
| 1532 |
"textwrap", |
| 1533 |
"numbers", |
| 1534 |
"pipes", |
| 1535 |
"heapq", |
| 1536 |
"tarfile", |
| 1537 |
"unicodedata", |
| 1538 |
"ntpath", |
| 1539 |
"ipaddress", |
| 1540 |
"marshal", |
| 1541 |
"xmlrpc", |
| 1542 |
"traceback", |
| 1543 |
"linecache", |
| 1544 |
"calendar", |
| 1545 |
"pty", |
| 1546 |
"random", |
| 1547 |
"dis", |
| 1548 |
"selectors", |
| 1549 |
"statistics", |
| 1550 |
"imghdr", |
| 1551 |
"venv", |
| 1552 |
"inspect", |
| 1553 |
"mmap", |
| 1554 |
"keyword", |
| 1555 |
"ftplib", |
| 1556 |
"tty", |
| 1557 |
"nis", |
| 1558 |
"getopt", |
| 1559 |
"posix", |
| 1560 |
"smtpd", |
| 1561 |
"wave", |
| 1562 |
"profile", |
| 1563 |
"sndhdr", |
| 1564 |
"signal", |
| 1565 |
"tracemalloc", |
| 1566 |
"pdb", |
| 1567 |
"sunau", |
| 1568 |
"winsound", |
| 1569 |
"parser", |
| 1570 |
"zlib", |
| 1571 |
"fcntl", |
| 1572 |
"pprint", |
| 1573 |
"distutils", |
| 1574 |
"crypt", |
| 1575 |
"symbol", |
| 1576 |
"gettext", |
| 1577 |
"pathlib", |
| 1578 |
"asyncore", |
| 1579 |
"copyreg", |
| 1580 |
"imaplib", |
| 1581 |
"unittest", |
| 1582 |
"queue", |
| 1583 |
"resource", |
| 1584 |
"turtledemo", |
| 1585 |
"fnmatch", |
| 1586 |
"cProfile", |
| 1587 |
"os", |
| 1588 |
"pkgutil", |
| 1589 |
"socket", |
| 1590 |
"trace", |
| 1591 |
"fractions", |
| 1592 |
"string", |
| 1593 |
"shelve", |
| 1594 |
"plistlib", |
| 1595 |
"aifc", |
| 1596 |
"gzip", |
| 1597 |
"functools", |
| 1598 |
"cgitb", |
| 1599 |
"xml", |
| 1600 |
"hashlib", |
| 1601 |
"decimal", |
| 1602 |
"imp", |
| 1603 |
"sre_compile", |
| 1604 |
"ssl", |
| 1605 |
"formatter", |
| 1606 |
"winreg", |
| 1607 |
"time", |
| 1608 |
"getpass", |
| 1609 |
"shutil", |
| 1610 |
"abc", |
| 1611 |
"difflib", |
| 1612 |
"bz2", |
| 1613 |
"operator", |
| 1614 |
"reprlib", |
| 1615 |
"subprocess", |
| 1616 |
"cgi", |
| 1617 |
"select", |
| 1618 |
"asynchat", |
| 1619 |
"audioop", |
| 1620 |
"gc", |
| 1621 |
"secrets", |
| 1622 |
"symtable", |
| 1623 |
"mailcap", |
| 1624 |
"sys", |
| 1625 |
"bdb", |
| 1626 |
"fpectl", |
| 1627 |
"stringprep", |
| 1628 |
"webbrowser", |
| 1629 |
"smtplib", |
| 1630 |
"wsgiref", |
| 1631 |
"atexit", |
| 1632 |
"lzma", |
| 1633 |
"asyncio", |
| 1634 |
"datetime", |
| 1635 |
"binhex", |
| 1636 |
"doctest", |
| 1637 |
"turtle", |
| 1638 |
"enum", |
| 1639 |
"tempfile", |
| 1640 |
"tokenize", |
| 1641 |
"tabnanny", |
| 1642 |
"site", |
| 1643 |
"html", |
| 1644 |
"struct", |
| 1645 |
"itertools", |
| 1646 |
"codeop", |
| 1647 |
"email", |
| 1648 |
"array", |
| 1649 |
"test", |
| 1650 |
"typing", |
| 1651 |
"shlex", |
| 1652 |
"uu", |
| 1653 |
"msilib", |
| 1654 |
"termios", |
| 1655 |
"rlcompleter", |
| 1656 |
"modulefinder", |
| 1657 |
"ossaudiodev", |
| 1658 |
"timeit", |
| 1659 |
"binascii", |
| 1660 |
"poplib", |
| 1661 |
"errno", |
| 1662 |
"macpath", |
| 1663 |
"zipfile", |
| 1664 |
"io", |
| 1665 |
"faulthandler", |
| 1666 |
"pstats", |
| 1667 |
"contextlib", |
| 1668 |
"code", |
| 1669 |
"glob", |
| 1670 |
"zipimport", |
| 1671 |
"base64", |
| 1672 |
"syslog", |
| 1673 |
"platform", |
| 1674 |
"ast", |
| 1675 |
"fileinput", |
| 1676 |
"telnetlib", |
| 1677 |
"locale", |
| 1678 |
"_dummy_thread", |
| 1679 |
"hmac", |
| 1680 |
"stat", |
| 1681 |
"uuid", |
| 1682 |
"quopri", |
| 1683 |
"readline", |
| 1684 |
"collections", |
| 1685 |
"json", |
| 1686 |
"concurrent", |
| 1687 |
"lib2to3", |
| 1688 |
"sqlite3", |
| 1689 |
"runpy", |
| 1690 |
"cmath", |
| 1691 |
"optparse", |
| 1692 |
"bisect", |
| 1693 |
"builtins", |
| 1694 |
"urllib", |
| 1695 |
"dummy_threading", |
| 1696 |
"http", |
| 1697 |
"compileall", |
| 1698 |
"argparse", |
| 1699 |
"token", |
| 1700 |
"sched", |
| 1701 |
"netrc", |
| 1702 |
"math", |
| 1703 |
"ensurepip", |
| 1704 |
"socketserver", |
| 1705 |
"colorsys", |
| 1706 |
"zipapp", |
| 1707 |
"logging", |
| 1708 |
"sysconfig", |
| 1709 |
} |
| 1710 |
), |
| 1711 |
"extra_standard_library": frozenset(), |
| 1712 |
"known_other": {}, |
| 1713 |
"multi_line_output": 0, |
| 1714 |
"forced_separate": (), |
| 1715 |
"indent": " ", |
| 1716 |
"comment_prefix": " #", |
| 1717 |
"length_sort": False, |
| 1718 |
"length_sort_straight": False, |
| 1719 |
"length_sort_sections": frozenset(), |
| 1720 |
"add_imports": frozenset(), |
| 1721 |
"remove_imports": frozenset(), |
| 1722 |
"append_only": False, |
| 1723 |
"reverse_relative": False, |
| 1724 |
"force_single_line": False, |
| 1725 |
"single_line_exclusions": (), |
| 1726 |
"default_section": "THIRDPARTY", |
| 1727 |
"import_headings": {}, |
| 1728 |
"import_footers": {}, |
| 1729 |
"balanced_wrapping": False, |
| 1730 |
"use_parentheses": False, |
| 1731 |
"order_by_type": True, |
| 1732 |
"atomic": False, |
| 1733 |
"lines_before_imports": -1, |
| 1734 |
"lines_after_imports": -1, |
| 1735 |
"lines_between_sections": 1, |
| 1736 |
"lines_between_types": 0, |
| 1737 |
"combine_as_imports": False, |
| 1738 |
"combine_star": False, |
| 1739 |
"include_trailing_comma": False, |
| 1740 |
"from_first": False, |
| 1741 |
"verbose": False, |
| 1742 |
"quiet": False, |
| 1743 |
"force_adds": False, |
| 1744 |
"force_alphabetical_sort_within_sections": False, |
| 1745 |
"force_alphabetical_sort": False, |
| 1746 |
"force_grid_wrap": 0, |
| 1747 |
"force_sort_within_sections": False, |
| 1748 |
"lexicographical": False, |
| 1749 |
"ignore_whitespace": False, |
| 1750 |
"no_lines_before": frozenset(), |
| 1751 |
"no_inline_sort": False, |
| 1752 |
"ignore_comments": False, |
| 1753 |
"case_sensitive": False, |
| 1754 |
"sources": (), |
| 1755 |
"virtual_env": "", |
| 1756 |
"conda_env": "", |
| 1757 |
"ensure_newline_before_comments": False, |
| 1758 |
"directory": "", |
| 1759 |
"profile": "", |
| 1760 |
"honor_noqa": False, |
| 1761 |
"src_paths": frozenset(), |
| 1762 |
"remove_redundant_aliases": False, |
| 1763 |
"float_to_top": False, |
| 1764 |
"filter_files": False, |
| 1765 |
"formatter": "", |
| 1766 |
"formatting_function": None, |
| 1767 |
"color_output": False, |
| 1768 |
"treat_comments_as_code": frozenset(), |
| 1769 |
"treat_all_comments_as_code": False, |
| 1770 |
"supported_extensions": frozenset({"py", "pyx", "pyi"}), |
| 1771 |
"blocked_extensions": frozenset({"pex"}), |
| 1772 |
"constants": frozenset(), |
| 1773 |
"classes": frozenset(), |
| 1774 |
"variables": frozenset(), |
| 1775 |
"dedup_headings": False, |
| 1776 |
"source": "defaults", |
| 1777 |
}, |
| 1778 |
{ |
| 1779 |
"classes": frozenset( |
| 1780 |
{ |
| 1781 |
"\U000eb6c6\x9eÑ\U0008297dâhï\x8eÆ", |
| 1782 |
"C", |
| 1783 |
"\x8e\U000422ac±\U000b5a1f\U000c4166", |
| 1784 |
"ùÚ", |
| 1785 |
} |
| 1786 |
), |
| 1787 |
"single_line_exclusions": ( |
| 1788 |
"Y\U000347d9g\x957K", |
| 1789 |
"", |
| 1790 |
"Ê\U000e8ad2\U0008fa72ùÏ\x19ç\U000eaecc𤎪.", |
| 1791 |
"·o\U000d00e5\U000b36de+\x8f\U000b5953´\x08oÜ", |
| 1792 |
"", |
| 1793 |
":sI¶", |
| 1794 |
"", |
| 1795 |
), |
| 1796 |
"indent": " ", |
| 1797 |
"no_lines_before": frozenset( |
| 1798 |
{ |
| 1799 |
"uøø", |
| 1800 |
"¢", |
| 1801 |
"&\x8c5Ï\U000e5f01Ø", |
| 1802 |
"\U0005d415\U000a3df2h\U000f24e5\U00104d7b34¹ÒÀ", |
| 1803 |
"\U000e374c8", |
| 1804 |
"w", |
| 1805 |
} |
| 1806 |
), |
| 1807 |
"quiet": False, |
| 1808 |
"honor_noqa": False, |
| 1809 |
"dedup_headings": True, |
| 1810 |
"known_other": { |
| 1811 |
"\x10\x1bm": frozenset({"\U000682a49\U000e1a63²KǶ4", "", "\x1a", "©"}), |
| 1812 |
"": frozenset({"íå\x94Ì", "\U000cf258"}), |
| 1813 |
}, |
| 1814 |
"treat_comments_as_code": frozenset({""}), |
| 1815 |
"length_sort": True, |
| 1816 |
"reverse_relative": True, |
| 1817 |
"combine_as_imports": True, |
| 1818 |
"py_version": "all", |
| 1819 |
"use_parentheses": True, |
| 1820 |
"skip_gitignore": True, |
| 1821 |
"remove_imports": frozenset( |
| 1822 |
{ |
| 1823 |
"", |
| 1824 |
"\U00076fe7þs\x0c\U000c8b75v\U00106541", |
| 1825 |
"𥒒>\U0001960euj𒎕\x9e", |
| 1826 |
"\x15\x9b", |
| 1827 |
"\x02l", |
| 1828 |
"\U000b71ef.\x1c", |
| 1829 |
"\x7f?\U000ec91c", |
| 1830 |
"\x7f,ÞoÀP8\x1b\x1e»3\x86\x94¤ÁÓ~\U00066b1a,O\U0010ab28\x90«", |
| 1831 |
"Y\x06ºZ\x04Ýì\U00078ce1.\U0010c1f9[EK\x83EÖø", |
| 1832 |
";À¨|\x1b 𑐒🍸V", |
| 1833 |
} |
| 1834 |
), |
| 1835 |
"atomic": False, |
| 1836 |
"source": "runtime", |
| 1837 |
}, |
| 1838 |
), |
| 1839 |
virtual_env="", |
| 1840 |
conda_env="", |
| 1841 |
ensure_newline_before_comments=False, |
| 1842 |
directory="/home/abuild/rpmbuild/BUILD/isort-5.11.0", |
| 1843 |
profile="", |
| 1844 |
honor_noqa=False, |
| 1845 |
remove_redundant_aliases=False, |
| 1846 |
float_to_top=False, |
| 1847 |
filter_files=False, |
| 1848 |
formatting_function=None, |
| 1849 |
color_output=False, |
| 1850 |
treat_comments_as_code=frozenset({""}), |
| 1851 |
treat_all_comments_as_code=False, |
| 1852 |
supported_extensions=frozenset({"py", "pyx", "pyi"}), |
| 1853 |
blocked_extensions=frozenset({"pex"}), |
| 1854 |
constants=frozenset(), |
| 1855 |
classes=frozenset( |
| 1856 |
{"\U000eb6c6\x9eÑ\U0008297dâhï\x8eÆ", "C", "\x8e\U000422ac±\U000b5a1f\U000c4166", "ùÚ"} |
| 1857 |
), |
| 1858 |
variables=frozenset(), |
| 1859 |
dedup_headings=True, |
| 1860 |
), |
| 1861 |
disregard_skip=True, |
| 1862 |
) |
| 1863 |
@hypothesis.given( |
| 1864 |
config=st.from_type(isort.Config), |
| 1865 |
disregard_skip=st.booleans(), |
| 1866 |
) |
| 1867 |
@hypothesis.settings(deadline=None) |
| 1868 |
def test_isort_doesnt_lose_imports_or_comments(config: isort.Config, disregard_skip: bool) -> None: |
| 1869 |
result = isort.code(CODE_SNIPPET, config=config, disregard_skip=disregard_skip) |
| 1870 |
for should_be_retained in SHOULD_RETAIN: |
| 1871 |
if should_be_retained not in result: |
| 1872 |
if config.ignore_comments and should_be_retained.startswith("comment"): |
| 1873 |
continue |
| 1874 |
|
| 1875 |
assert should_be_retained in result |