path
stringlengths
14
112
content
stringlengths
0
6.32M
size
int64
0
6.32M
max_lines
int64
1
100k
repo_name
stringclasses
2 values
autogenerated
bool
1 class
cosmopolitan/third_party/python/Lib/distutils/tests/test_bdist_msi.py
"""Tests for distutils.command.bdist_msi.""" import sys import unittest from test.support import run_unittest from distutils.tests import support @unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows') class BDistMSITestCase(support.TempdirManager, support.LoggingSilencer, ...
728
26
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_sysconfig.py
"""Tests for distutils.sysconfig.""" import os import shutil import subprocess import sys import textwrap import unittest from distutils import sysconfig from distutils.ccompiler import get_default_compiler from distutils.tests import support from test.support import TESTFN, run_unittest, check_warnings class Sysconf...
7,966
199
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/Setup.sample
# Setup file from the pygame project #--StartConfig SDL = -I/usr/include/SDL -D_REENTRANT -lSDL FONT = -lSDL_ttf IMAGE = -lSDL_image MIXER = -lSDL_mixer SMPEG = -lsmpeg PNG = -lpng JPEG = -ljpeg SCRAP = -lX11 PORTMIDI = -lportmidi PORTTIME = -lporttime #--EndConfig #DEBUG = -C-W -C-Wall DEBUG = #the following modul...
2,249
68
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_register.py
"""Tests for distutils.command.register.""" import os import unittest import getpass import urllib import warnings from test.support import check_warnings, run_unittest from distutils.command import register as register_module from distutils.command.register import register from distutils.errors import DistutilsSetup...
9,765
324
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_text_file.py
"""Tests for distutils.text_file.""" import os import unittest from distutils.text_file import TextFile from distutils.tests import support from test.support import run_unittest TEST_DATA = """# test file line 3 \\ # intervening comment continues on next line """ class TextFileTestCase(support.TempdirManager, unit...
3,436
108
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_bdist_rpm.py
"""Tests for distutils.command.bdist_rpm.""" import unittest import sys import os from test.support import run_unittest, requires_zlib from distutils.core import Distribution from distutils.command.bdist_rpm import bdist_rpm from distutils.tests import support from distutils.spawn import find_executable SETUP_PY = "...
5,008
136
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_file_util.py
"""Tests for distutils.file_util.""" import unittest import os import errno from unittest.mock import patch from distutils.file_util import move_file, copy_file from distutils import log from distutils.tests import support from distutils.errors import DistutilsFileError from test.support import run_unittest class Fil...
4,103
115
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_msvc9compiler.py
"""Tests for distutils.msvc9compiler.""" import sys import unittest import os from distutils.errors import DistutilsPlatformError from distutils.tests import support from test.support import run_unittest # A manifest with the only assembly reference being the msvcrt assembly, so # should have the assembly completely ...
6,038
185
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_util.py
"""Tests for distutils.util.""" import os import sys import unittest from copy import copy from test.support import run_unittest from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError from distutils.util import (get_platform, convert_path, change_root, check_environ,...
11,250
301
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_cygwinccompiler.py
"""Tests for distutils.cygwinccompiler.""" import unittest import sys import os from io import BytesIO from test.support import run_unittest from distutils import cygwinccompiler from distutils.cygwinccompiler import (check_config_h, CONFIG_H_OK, CONFIG_H_NOTOK, ...
5,636
155
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_upload.py
"""Tests for distutils.command.upload.""" import os import unittest import unittest.mock as mock from urllib.request import HTTPError from test.support import run_unittest from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution from distut...
6,535
208
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_filelist.py
"""Tests for distutils.filelist.""" import os import re import unittest from distutils import debug from distutils.log import WARN from distutils.errors import DistutilsTemplateError from distutils.filelist import glob_to_re, translate_pattern, FileList from distutils import filelist import test.support from test.supp...
11,475
341
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/support.py
"""Support code for distutils test cases.""" import os import sys import shutil import tempfile import unittest import sysconfig from copy import deepcopy from distutils import log from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL from distutils.core import Distribution class LoggingSilencer(object): de...
6,533
211
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_archive_util.py
# -*- coding: utf-8 -*- """Tests for distutils.archive_util.""" import unittest import os import sys import tarfile from os.path import splitdrive import warnings from distutils import archive_util from distutils.archive_util import (check_archive_formats, make_tarball, make_zipfile...
14,296
395
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_config_cmd.py
"""Tests for distutils.command.config.""" import unittest import os import sys from test.support import run_unittest, missing_compiler_executable from distutils.command.config import dump_file, config from distutils.tests import support from distutils import log class ConfigTestCase(support.LoggingSilencer, ...
2,782
93
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_versionpredicate.py
"""Tests harness for distutils.versionpredicate. """ import distutils.versionpredicate import doctest from test.support import run_unittest def test_suite(): return doctest.DocTestSuite(distutils.versionpredicate) if __name__ == '__main__': run_unittest(test_suite())
280
14
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_dep_util.py
"""Tests for distutils.dep_util.""" import unittest import os from distutils.dep_util import newer, newer_pairwise, newer_group from distutils.errors import DistutilsFileError from distutils.tests import support from test.support import run_unittest class DepUtilTestCase(support.TempdirManager, unittest.TestCase): ...
2,820
81
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_install_lib.py
"""Tests for distutils.command.install_data.""" import sys import os import importlib.util import unittest from distutils.command.install_lib import install_lib from distutils.extension import Extension from distutils.tests import support from distutils.errors import DistutilsOptionError from test.support import run_u...
3,974
116
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_log.py
"""Tests for distutils.log""" import io import sys import unittest from test.support import swap_attr, run_unittest from distutils import log class TestLog(unittest.TestCase): def test_non_ascii(self): # Issues #8663, #34421: test that non-encodable text is escaped with # backslashreplace error h...
1,864
47
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_check.py
"""Tests for distutils.command.check.""" import textwrap import unittest from test.support import run_unittest from distutils.command.check import check, HAS_DOCUTILS from distutils.tests import support from distutils.errors import DistutilsSetupError try: import pygments except ImportError: pygments = None ...
5,256
150
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_core.py
"""Tests for distutils.core.""" import io import distutils.core import os import shutil import sys import test.support from test.support import captured_stdout, run_unittest import unittest from distutils.tests import support from distutils import log # setup script that uses __file__ setup_using___file__ = """\ __f...
4,077
141
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_config.py
"""Tests for distutils.pypirc.pypirc.""" import os import unittest from distutils.core import PyPIRCCommand from distutils.core import Distribution from distutils.log import set_threshold from distutils.log import WARN from distutils.tests import support from test.support import run_unittest PYPIRC = """\ [distutils...
3,843
141
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_bdist.py
"""Tests for distutils.command.bdist.""" import os import unittest from test.support import run_unittest from distutils.command.bdist import bdist from distutils.tests import support class BuildTestCase(support.TempdirManager, unittest.TestCase): def test_formats(self): # let's creat...
1,680
54
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_cmd.py
"""Tests for distutils.cmd.""" import unittest import os from test.support import captured_stdout, run_unittest from distutils.cmd import Command from distutils.dist import Distribution from distutils.errors import DistutilsOptionError from distutils import debug class MyCmd(Command): def initialize_options(self)...
3,835
127
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_extension.py
"""Tests for distutils.extension.""" import unittest import os import warnings from test.support import check_warnings, run_unittest from distutils.extension import read_setup_file, Extension class ExtensionTestCase(unittest.TestCase): def test_read_setup_file(self): # trying to read a Setup file ...
2,768
70
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_clean.py
"""Tests for distutils.command.clean.""" import os import unittest from distutils.command.clean import clean from distutils.tests import support from test.support import run_unittest class cleanTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase): d...
1,441
50
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_unixccompiler.py
"""Tests for distutils.unixccompiler.""" import sys import unittest from test.support import EnvironmentVarGuard, run_unittest from distutils import sysconfig from distutils.unixccompiler import UnixCCompiler class UnixCCompilerTestCase(unittest.TestCase): def setUp(self): self._backup_platform = sys.pla...
4,862
150
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_build_ext.py
import sys import os from io import StringIO import textwrap from distutils.core import Distribution from distutils.command.build_ext import build_ext from distutils import sysconfig from distutils.tests.support import (TempdirManager, LoggingSilencer, copy_xxmodule_c, fixup_build_...
19,446
522
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_dist.py
"""Tests for distutils.dist.""" import os import io import sys import unittest import warnings import textwrap from unittest import mock from distutils.dist import Distribution, fix_help_options, DistributionMetadata from distutils.cmd import Command from test.support import TESTFN, captured_stdout, run_unittest fro...
16,050
457
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_bdist_wininst.py
"""Tests for distutils.command.bdist_wininst.""" import unittest from test.support import run_unittest from distutils.command.bdist_wininst import bdist_wininst from distutils.tests import support @unittest.skipIf(getattr(bdist_wininst, '_unsupported', False), 'bdist_wininst is not supported in this install') cla...
1,158
34
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_dir_util.py
"""Tests for distutils.dir_util.""" import unittest import os import stat import sys from unittest.mock import patch from distutils import dir_util, errors from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree, ensure_relative) from distutils import log from distu...
4,654
140
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_build_py.py
"""Tests for distutils.command.build_py.""" import os import sys import unittest from distutils.command.build_py import build_py from distutils.core import Distribution from distutils.errors import DistutilsFileError from distutils.tests import support from test.support import run_unittest class BuildPyTestCase(su...
6,335
180
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_build_scripts.py
"""Tests for distutils.command.build_scripts.""" import os import unittest from distutils.command.build_scripts import build_scripts from distutils.core import Distribution from distutils import sysconfig from distutils.tests import support from test.support import run_unittest class BuildScriptsTestCase(support.T...
3,593
113
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_install.py
"""Tests for distutils.command.install.""" import os import sys import unittest import site from test.support import captured_stdout, run_unittest from distutils import sysconfig from distutils.command.install import install from distutils.command import install as install_module from distutils.command.build_ext imp...
8,535
249
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_version.py
"""Tests for distutils.version.""" import unittest from distutils.version import LooseVersion from distutils.version import StrictVersion from test.support import run_unittest class VersionTestCase(unittest.TestCase): def test_prerelease(self): version = StrictVersion('1.2.3a1') self.assertEqual(v...
2,614
72
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_install_scripts.py
"""Tests for distutils.command.install_scripts.""" import os import unittest from distutils.command.install_scripts import install_scripts from distutils.core import Distribution from distutils.tests import support from test.support import run_unittest class InstallScriptsTestCase(support.TempdirManager, ...
2,625
83
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_msvccompiler.py
"""Tests for distutils._msvccompiler.""" import sys import unittest import os from distutils.errors import DistutilsPlatformError from distutils.tests import support from test.support import run_unittest SKIP_MESSAGE = (None if sys.platform == "win32" else "These tests are only for win32") @unittest...
4,872
133
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_spawn.py
"""Tests for distutils.spawn.""" import os import stat import sys import unittest from unittest import mock from test.support import run_unittest, unix_shell from test import support as test_support from distutils.spawn import find_executable from distutils.spawn import _nt_quote_args from distutils.spawn import spawn...
3,587
104
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_bdist_dumb.py
"""Tests for distutils.command.bdist_dumb.""" import os import sys import zipfile import unittest from test.support import run_unittest from distutils.core import Distribution from distutils.command.bdist_dumb import bdist_dumb from distutils.tests import support SETUP_PY = """\ from distutils.core import setup impo...
2,905
98
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_build.py
"""Tests for distutils.command.build.""" import unittest import os import sys from test.support import run_unittest from distutils.command.build import build from distutils.tests import support from sysconfig import get_platform class BuildTestCase(support.TempdirManager, support.LoggingSilencer, ...
1,965
57
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/__init__.py
"""Test suite for distutils. This test suite consists of a collection of test modules in the distutils.tests package. Each test module has a name starting with 'test' and contains a function test_suite(). The function is expected to return an initialized unittest.TestSuite instance. Tests for the command classes in...
1,060
37
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_install_headers.py
"""Tests for distutils.command.install_headers.""" import os import unittest from distutils.command.install_headers import install_headers from distutils.tests import support from test.support import run_unittest class InstallHeadersTestCase(support.TempdirManager, support.LoggingSilencer...
1,238
40
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_install_data.py
"""Tests for distutils.command.install_data.""" import os import unittest from distutils.command.install_data import install_data from distutils.tests import support from test.support import run_unittest class InstallDataTestCase(support.TempdirManager, support.LoggingSilencer, ...
2,577
76
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/distutils/tests/test_build_clib.py
"""Tests for distutils.command.build_clib.""" import unittest import os import sys from test.support import run_unittest, missing_compiler_executable from distutils.command.build_clib import build_clib from distutils.errors import DistutilsSetupError from distutils.tests import support from distutils.spawn import fin...
4,675
136
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/headers.py
"""Manage HTTP Response Headers Much of this module is red-handedly pilfered from email.message in the stdlib, so portions are Copyright (C) 2001,2002 Python Software Foundation, and were written by Barry Warsaw. """ # Regular expression that matches `special' characters in parameters, the # existence of which force ...
6,766
185
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/simple_server.py
"""BaseHTTPServer that implements the Python WSGI protocol (PEP 3333) This is both an example of how WSGI can be implemented, and a basis for running simple web applications on a local machine, such as might be done when testing or debugging an application. It has not been reviewed for security issues, however, and w...
5,139
165
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/util.py
"""Miscellaneous WSGI-related Utilities""" import posixpath __all__ = [ 'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri', 'shift_path_info', 'setup_testing_defaults', ] class FileWrapper: """Wrapper to convert file-like objects to iterables""" def __init__(self, filelike, blksize=819...
5,634
166
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/handlers.py
"""Base classes for server/gateway implementations""" from .util import FileWrapper, guess_scheme, is_hop_by_hop from .headers import Headers import sys, os, time __all__ = [ 'BaseHandler', 'SimpleHandler', 'BaseCGIHandler', 'CGIHandler', 'IISCGIHandler', 'read_environ' ] # Weekday and month names for HTTP ...
21,001
558
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/validate.py
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # Also licenced under the Apache License, 2.0: http://opensource.org/licenses/apache2.0.php # Licensed to PSF under a Contributor Agreement """ Middlew...
15,163
444
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/wsgiref/__init__.py
"""wsgiref -- a WSGI (PEP 3333) Reference Library Current Contents: * util -- Miscellaneous useful functions and wrappers * headers -- Manage response headers * handlers -- base classes for server/gateway implementations * simple_server -- a simple BaseHTTPServer that supports WSGI * validate -- validation wrappe...
587
24
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/dump.py
# Mimic the sqlite3 console shell's .dump command # Author: Paul Kippes <kippesp@gmail.com> """SQLite Python Dump Module Every identifier in sql is quoted based on a comment in sqlite documentation "SQLite adds new keywords from time to time when it takes on new features. So to prevent your code from being broken by ...
2,849
74
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/dbapi2.py
# pysqlite2/dbapi2.py: the DB-API 2.0 interface # # Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this so...
2,729
93
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/__init__.py
# pysqlite2/__init__.py: the pysqlite2 package. # # Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this softwar...
2,803
105
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/regression.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/regression.py: pysqlite regression tests # # Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any dama...
16,401
456
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/dump.py
# Author: Paul Kippes <kippesp@gmail.com> import unittest import sqlite3 as sqlite class DumpTests(unittest.TestCase): def setUp(self): self.cx = sqlite.connect(":memory:") self.cu = self.cx.cursor() def tearDown(self): self.cx.close() def CheckTableDump(self): expected_s...
2,840
82
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/dbapi.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages...
35,076
940
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/types.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/types.py: tests for type conversion and detection # # Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any ...
15,489
422
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/factory.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/factory.py: tests for the various factories in pysqlite # # Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liab...
11,350
294
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/hooks.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/hooks.py: tests for various SQLite-specific hooks # # Copyright (C) 2006-2007 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for...
9,784
265
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/userfunctions.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/userfunctions.py: tests for user-defined functions and # aggregates. # # Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warran...
15,125
474
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/transactions.py
#-*- coding: iso-8859-1 -*- # pysqlite2/test/transactions.py: tests transactions # # Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages #...
7,855
215
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/sqlite3/test/__init__.py
0
1
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/Grammar.txt
# Grammar for 2to3. This grammar supports Python 2.x and 3.x. # NOTE WELL: You should also follow all the steps listed at # https://devguide.python.org/grammar/ # Start symbols for the grammar: # file_input is a module or sequence of commands read from an input file; # single_input is a single interactive statement; ...
6,562
155
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/pytree.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """ Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. """ __autho...
28,052
855
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/fixer_util.py
"""Utility functions, node construction macros, etc.""" # Author: Collin Winter # Local imports from .pgen2 import token from .pytree import Leaf, Node from .pygram import python_symbols as syms from . import patcomp ########################################################### ### Common node-construction "macros" ##...
15,207
454
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/PatternGrammar.txt
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # A grammar to describe tree matching patterns. # Not shown here: # - 'TOKEN' stands for any token (leaf node) # - 'any' stands for any node (leaf or interior) # With 'any' we can still specify the sub-structure. # The...
793
29
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/__main__.py
import sys from .main import main sys.exit(main("lib2to3.fixes"))
67
5
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/main.py
""" Main program for 2to3. """ from __future__ import with_statement, print_function import sys import os import difflib import logging import shutil import optparse from . import refactor def diff_texts(a, b, filename): """Return a unified diff of two strings.""" a = a.splitlines() b = b.splitlines() ...
11,653
269
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/patcomp.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Pattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. """ __author__ = "Guido van Rossum <guido@python.org>" # Python imports import io # ...
7,044
205
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/pygram.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Export the Python grammar and symbols.""" # Python imports import os # Local imports from .pgen2 import token from .pgen2 import driver from . import pytree # The grammar file _GRAMMAR_FILE = os.path.join(os.path....
1,154
41
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/fixer_base.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Base class for fixers (optional, but recommended).""" # Python imports import itertools # Local imports from .patcomp import PatternCompiler from . import pygram from .fixer_util import does_tree_import class Base...
6,690
187
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/btm_matcher.py
"""A bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes ...
6,833
169
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/__init__.py
#empty
7
2
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/btm_utils.py
"Utility functions used by the btm_matcher module" from . import pytree from .pgen2 import grammar, token from .pygram import pattern_symbols, python_symbols syms = pattern_symbols pysyms = python_symbols tokens = grammar.opmap token_labels = token TYPE_ANY = -1 TYPE_ALTERNATIVES = -2 TYPE_GROUP = -3 class MinNode(...
9,966
282
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/refactor.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Refactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring too...
27,965
745
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_all_fixers.py
"""Tests that run all fixer modules over an input stream. This has been broken out into its own test module because of its running time. """ # Author: Collin Winter # Python imports import unittest import test.support # Local imports from . import support @test.support.requires_resource('cpu') class Test_all(suppo...
595
28
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/pytree_idempotency.py
#!/usr/bin/env python3 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Main program for testing the infrastructure.""" from __future__ import print_function __author__ = "Guido van Rossum <guido@python.org>" # Support imports (need to be imported first) from . ...
2,453
95
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_util.py
""" Test suite for the code in fixer_util """ # Testing imports from . import support # Local imports from lib2to3.pytree import Node, Leaf from lib2to3 import fixer_util from lib2to3.fixer_util import Attr, Name, Call, Comma from lib2to3.pgen2 import token def parse(code, strip_levels=0): # The topmost node is ...
21,207
592
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/support.py
"""Support code for test_*.py files""" # Author: Collin Winter # Python imports import unittest import os import os.path from textwrap import dedent # Local imports from lib2to3 import pytree, refactor from lib2to3.pgen2 import driver as pgen2_driver test_dir = os.path.dirname(__file__) proj_dir = os.path.normpath(o...
1,948
59
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/__main__.py
from . import load_tests import unittest unittest.main()
58
5
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_parser.py
"""Test suite for 2to3's parser and grammar files. This is the place to add tests for changes to 2to3's grammar, such as those merging the grammars for Python 2 and 3. In addition to specific tests for parts of the grammar we've changed, we also make sure we can parse the test_grammar.py files from both Python 2 and P...
20,334
621
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_fixers.py
""" Test suite for the fixer modules """ # Python imports import os from itertools import chain from operator import itemgetter # Local imports from lib2to3 import pygram, fixer_util from lib2to3.tests import support class FixerTestCase(support.TestCase): # Other test cases can subclass this class and replace ...
122,488
4,641
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_pytree.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Unit tests for pytree.py. NOTE: Please *don't* add doc strings to individual test methods! In verbose mode, printing of the module, class and method name is much more helpful than printing of (the first line of) the...
16,382
473
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_refactor.py
""" Unit tests for refactor.py. """ import sys import os import codecs import io import re import tempfile import shutil import unittest from lib2to3 import refactor, pygram, fixer_base from lib2to3.pgen2 import token TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") FIXER_DIR = os.path.join(TEST_DATA...
11,772
317
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/test_main.py
# -*- coding: utf-8 -*- import codecs import io import logging import os import re import shutil import sys import tempfile import unittest from lib2to3 import main TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") PY2_TEST_MODULE = os.path.join(TEST_DATA_DIR, "py2_test_grammar.py") class TestMain(un...
5,740
140
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/__init__.py
# Author: Collin Winter import os import unittest from test.support import load_package_tests def load_tests(*args): return load_package_tests(os.path.dirname(__file__), *args)
184
10
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/different_encoding.py
#!/usr/bin/env python # -*- coding: utf-8 -*- print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ' def f(x): print '%s\t-> α(%2i):%s β(%s)'
230
7
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/bom.py
# coding: utf-8 print "BOM BOOM!"
37
3
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/crlf.py
print "hi" print "Like bad Windows newlines?"
47
4
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/README
In this directory: - py2_test_grammar.py -- test file that exercises most/all of Python 2.x's grammar. - py3_test_grammar.py -- test file that exercises most/all of Python 3.x's grammar. - infinite_recursion.py -- test file that causes lib2to3's faster recursive pattern matching scheme to fail, but passes when lib2to...
404
7
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/false_encoding.py
#!/usr/bin/env python print '#coding=0'
40
3
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/infinite_recursion.py
# This file is used to verify that 2to3 falls back to a slower, iterative pattern matching # scheme in the event that the faster recursive system fails due to infinite recursion. from ctypes import * STRING = c_char_p OSUnknownByteOrder = 0 UIT_PROMPT = 1 P_PGID = 2 P_PID = 1 UIT_ERROR = 5 UIT_INFO = 4 UIT_NONE = 0 P...
93,071
2,670
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/py3_test_grammar.py
# Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. # NOTE: When you run this test as a script from the command line, you # get warnings about certain hex/oct constants. Since those are # issued by the parser, you can't suppress them by adding a # filterwarnings() call to this...
30,777
946
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/py2_test_grammar.py
# Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. # NOTE: When you run this test as a script from the command line, you # get warnings about certain hex/oct constants. Since those are # issued by the parser, you can't suppress them by adding a # filterwarnings() call to this...
30,980
975
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/no_fixer_cls.py
# This is empty so trying to fetch the fixer class gives an AttributeError
75
2
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/bad_order.py
from lib2to3.fixer_base import BaseFix class FixBadOrder(BaseFix): order = "crazy"
89
6
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/parrot_example.py
def parrot(): pass
23
3
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/myfixes/fix_last.py
from lib2to3.fixer_base import BaseFix class FixLast(BaseFix): run_order = 10 def match(self, node): return False
125
8
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py
from lib2to3.fixer_base import BaseFix from lib2to3.fixer_util import Name class FixParrot(BaseFix): """ Change functions named 'parrot' to 'cheese'. """ PATTERN = """funcdef < 'def' name='parrot' any* >""" def transform(self, node, results): name = results["name"] name.replace(Na...
347
14
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/lib2to3/tests/data/fixers/myfixes/fix_explicit.py
from lib2to3.fixer_base import BaseFix class FixExplicit(BaseFix): explicit = True def match(self): return False
123
7
jart/cosmopolitan
false