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/msilib/sequence.py | AdminExecuteSequence = [
('InstallInitialize', None, 1500),
('InstallFinalize', None, 6600),
('InstallFiles', None, 4000),
('InstallAdminPackage', None, 3900),
('FileCost', None, 900),
('CostInitialize', None, 800),
('CostFinalize', None, 1000),
('InstallValidate', None, 1400),
]
AdminUISequence = [
('FileCost', None,... | 3,929 | 127 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/msilib/text.py | import msilib,os;dirname=os.path.dirname(__file__)
ActionText = [
('InstallValidate', 'Validating install', None),
('InstallFiles', 'Copying new files', 'File: [1], Directory: [9], Size: [6]'),
('InstallAdminPackage', 'Copying network install files', 'File: [1], Directory: [9], Size: [6]'),
('FileCost', 'Computing s... | 9,018 | 130 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/msilib/schema.py | from . import Table
_Validation = Table('_Validation')
_Validation.add_field(1,'Table',11552)
_Validation.add_field(2,'Column',11552)
_Validation.add_field(3,'Nullable',3332)
_Validation.add_field(4,'MinValue',4356)
_Validation.add_field(5,'MaxValue',4356)
_Validation.add_field(6,'KeyTable',7679)
_Validation.add_field... | 81,580 | 1,008 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/msilib/__init__.py | # Copyright (C) 2005 Martin v. Löwis
# Licensed to PSF under a Contributor Agreement.
from _msi import *
import fnmatch
import os
import re
import string
import sys
AMD64 = "AMD64" in sys.version
Itanium = "Itanium" in sys.version
Win64 = AMD64 or Itanium
# Partially taken from Wine
datasizemask= 0x00ff
type_va... | 17,664 | 484 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/_bootstrap_external.py | """Core implementation of path-based import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public... | 53,245 | 1,414 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/_bootstrap.py | """Core implementation of import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing ver... | 38,151 | 1,097 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/abc.py | """Abstract base classes related to import."""
from . import _bootstrap
from . import _bootstrap_external
from . import machinery
try:
import _frozen_importlib
except ImportError as exc:
if exc.name != '_frozen_importlib':
raise
_frozen_importlib = None
try:
import _frozen_importlib_external
exc... | 10,782 | 330 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/util.py | """Utility code for constructing importers, etc."""
from . import abc
from ._bootstrap import module_from_spec
from ._bootstrap import _resolve_name
from ._bootstrap import spec_from_loader
from ._bootstrap import _find_spec
from ._bootstrap_external import MAGIC_NUMBER
from ._bootstrap_external import cache_from_sourc... | 10,883 | 289 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/machinery.py | """The machinery of importlib: finders, loaders, hooks, etc."""
import _imp
from ._bootstrap import ModuleSpec
from ._bootstrap import BuiltinImporter
from ._bootstrap import FrozenImporter
from ._bootstrap_external import (SOURCE_SUFFIXES, DEBUG_BYTECODE_SUFFIXES,
OPTIMIZED_BYTECODE_SUFFIXES, BY... | 844 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/importlib/__init__.py | """A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirect... | 5,870 | 174 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/_endian.py | import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
arrays and structures are suppo... | 2,000 | 62 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/util.py | import os
import shutil
import subprocess
import sys
# find_library(name) returns the pathname of a library, or None.
if os.name == "nt":
def _get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.ver... | 11,749 | 338 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/wintypes.py | # The most useful windows datatypes
import ctypes
BYTE = ctypes.c_byte
WORD = ctypes.c_ushort
DWORD = ctypes.c_ulong
#UCHAR = ctypes.c_uchar
CHAR = ctypes.c_char
WCHAR = ctypes.c_wchar
UINT = ctypes.c_uint
INT = ctypes.c_int
DOUBLE = ctypes.c_double
FLOAT = ctypes.c_float
BOOLEAN = BYTE
BOOL = ctypes.c_long
class ... | 5,628 | 203 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/__init__.py | """create and manipulate C data types in Python"""
import os as _os, sys as _sys
__version__ = "1.1.0"
from _ctypes import Union, Structure, Array
from _ctypes import _Pointer
from _ctypes import CFuncPtr as _CFuncPtr
from _ctypes import __version__ as _ctypes_version
from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
from... | 16,759 | 539 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/dyld.py | """
dyld emulation
"""
import os
from ctypes.macholib.framework import framework_info
from ctypes.macholib.dylib import dylib_info
from itertools import *
__all__ = [
'dyld_find', 'framework_find',
'framework_info', 'dylib_info',
]
# These are the defaults as per man dyld(1)
#
DEFAULT_FRAMEWORK_FALLBACK = [
... | 4,933 | 160 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/fetch_macholib | #!/bin/sh
svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ .
| 84 | 3 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/README.ctypes | Files in this directory come from Bob Ippolito's py2app.
License: Any components of the py2app suite may be distributed under
the MIT or PSF open source licenses.
This is version 1.0, SVN revision 789, from 2006/01/25.
The main repository is http://svn.red-bean.com/bob/macholib/trunk/macholib/ | 296 | 7 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/fetch_macholib.bat | svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ .
| 74 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/dylib.py | """
Generic dylib path manipulation
"""
import re
__all__ = ['dylib_info']
DYLIB_RE = re.compile(r"""(?x)
(?P<location>^.*)(?:^|/)
(?P<name>
(?P<shortname>\w+?)
(?:\.(?P<version>[^._]+))?
(?:_(?P<suffix>[^._]+))?
\.dylib$
)
""")
def dylib_info(filename):
"""
A dylib name can take one of the ... | 1,828 | 64 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/framework.py | """
Generic framework path manipulation
"""
import re
__all__ = ['framework_info']
STRICT_FRAMEWORK_RE = re.compile(r"""(?x)
(?P<location>^.*)(?:^|/)
(?P<name>
(?P<shortname>\w+).framework/
(?:Versions/(?P<version>[^/]+)/)?
(?P=shortname)
(?:_(?P<suffix>[^_]+))?
)$
""")
def framework_info(filename):... | 2,201 | 66 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/macholib/__init__.py | """
Enough Mach-O to make your head spin.
See the relevant header files in /usr/include/mach-o
And also Apple's documentation.
"""
__version__ = '1.0'
| 154 | 10 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_wintypes.py | import sys
import unittest
from ctypes import *
@unittest.skipUnless(sys.platform.startswith('win'), 'Windows-only test')
class WinTypesTest(unittest.TestCase):
def test_variant_bool(self):
from ctypes import wintypes
# reads 16-bits from memory, anything non-zero is True
for true_value in... | 1,466 | 42 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_bitfields.py | from ctypes import *
from ctypes.test import need_symbol
import unittest
import os
import _ctypes_test
class BITS(Structure):
_fields_ = [("A", c_int, 1),
("B", c_int, 2),
("C", c_int, 3),
("D", c_int, 4),
("E", c_int, 5),
("F", c_int... | 10,050 | 291 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_struct_fields.py | import unittest
from ctypes import *
class StructFieldsTestCase(unittest.TestCase):
# Structure/Union classes must get 'finalized' sooner or
# later, when one of these things happen:
#
# 1. _fields_ is set.
# 2. An instance is created.
# 3. The type is used as field of another Structure/Union.
... | 2,421 | 75 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_refcounts.py | import unittest
from test import support
import ctypes
import gc
MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int)
OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong)
import _ctypes_test
dll = ctypes.CDLL(_ctypes_test.__file__)
class RefcountTestCase(unittest.TestCase):
@sup... | 2,576 | 102 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_init.py | from ctypes import *
import unittest
class X(Structure):
_fields_ = [("a", c_int),
("b", c_int)]
new_was_called = False
def __new__(cls):
result = super().__new__(cls)
result.new_was_called = True
return result
def __init__(self):
self.a = 9
sel... | 1,039 | 41 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_funcptr.py | import unittest
from ctypes import *
try:
WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
WINFUNCTYPE = CFUNCTYPE
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
class CFuncPtrTestCase(unittest.TestCase):
def test_basic(self):
X = WINFUNCTYPE(c_int, c_int, c_int)
... | 4,026 | 133 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_objects.py | r'''
This tests the '_objects' attribute of ctypes instances. '_objects'
holds references to objects that must be kept alive as long as the
ctypes instance, to make sure that the memory buffer is valid.
WARNING: The '_objects' attribute is exposed ONLY for debugging ctypes itself,
it MUST NEVER BE MODIFIED!
'_object... | 1,677 | 68 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_unaligned_structures.py | import sys, unittest
from ctypes import *
structures = []
byteswapped_structures = []
if sys.byteorder == "little":
SwappedStructure = BigEndianStructure
else:
SwappedStructure = LittleEndianStructure
for typ in [c_short, c_int, c_long, c_longlong,
c_float, c_double,
c_ushort, c_uint... | 1,215 | 46 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_cfuncs.py | # A lot of failures in these tests on Mac OS X.
# Byte order related?
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class CFunctions(unittest.TestCase):
_dll = CDLL(_ctypes_test.__file__)
def S(self):
return c_longlong.in_dll(self._dll, "last_tf_arg_s")... | 7,680 | 213 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_find.py | import unittest
import os.path
import sys
import test.support
from ctypes import *
from ctypes.util import find_library
# On some systems, loading the OpenGL libraries needs the RTLD_GLOBAL mode.
class Test_OpenGL_libs(unittest.TestCase):
@classmethod
def setUpClass(cls):
lib_gl = lib_glu = lib_gle = N... | 3,948 | 117 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_buffers.py | from ctypes import *
from ctypes.test import need_symbol
import unittest
class StringBufferTestCase(unittest.TestCase):
def test_buffer(self):
b = create_string_buffer(32)
self.assertEqual(len(b), 32)
self.assertEqual(sizeof(b), 32 * sizeof(c_char))
self.assertIs(type(b[0]), bytes)... | 2,284 | 65 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_internals.py | # This tests the internal _objects attribute
import unittest
from ctypes import *
from sys import getrefcount as grc
# XXX This test must be reviewed for correctness!!!
# ctypes' types are container types.
#
# They have an internal memory block, which only consists of some bytes,
# but it has to keep references to ot... | 2,631 | 101 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_unicode.py | import unittest
import ctypes
from ctypes.test import need_symbol
import _ctypes_test
@need_symbol('c_wchar')
class UnicodeTestCase(unittest.TestCase):
def test_wcslen(self):
dll = ctypes.CDLL(_ctypes_test.__file__)
wcslen = dll.my_wcslen
wcslen.argtypes = [ctypes.c_wchar_p]
self.... | 1,761 | 57 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_delattr.py | import unittest
from ctypes import *
class X(Structure):
_fields_ = [("foo", c_int)]
class TestCase(unittest.TestCase):
def test_simple(self):
self.assertRaises(TypeError,
delattr, c_int(42), "value")
def test_chararray(self):
self.assertRaises(TypeError,
... | 533 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_callbacks.py | import functools
import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class Callbacks(unittest.TestCase):
functype = CFUNCTYPE
## def tearDown(self):
## import gc
## gc.collect()
def callback(self, *args):
self.got_args = args
return ar... | 9,536 | 294 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_anon.py | import unittest
import test.support
from ctypes import *
class AnonTest(unittest.TestCase):
def test_anon(self):
class ANON(Union):
_fields_ = [("a", c_int),
("b", c_int)]
class Y(Structure):
_fields_ = [("x", c_int),
("_", A... | 2,540 | 74 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_as_parameter.py | import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
import cosmo
dll = CDLL(_ctypes_test.__file__)
try:
CALLBACK_FUNCTYPE = WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
CALLBACK_FUNCTYPE = CFUNCTYPE
class POINT(Structure):
_fields_ = [("x"... | 7,003 | 233 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_incomplete.py | import unittest
from ctypes import *
################################################################
#
# The incomplete pointer example from the tutorial
#
class MyTestCase(unittest.TestCase):
def test_incomplete_example(self):
lpcell = POINTER("cell")
class cell(Structure):
_fields_... | 1,023 | 43 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_errno.py | import unittest, os, errno
from ctypes import *
from ctypes.util import find_library
try:
import threading
except ImportError:
threading = None
class Test(unittest.TestCase):
def test_open(self):
libc_name = find_library("c")
if libc_name is None:
raise unittest.SkipTest("Unable... | 2,302 | 80 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_bytes.py | """Test where byte objects are accepted"""
import unittest
import sys
from ctypes import *
class BytesTest(unittest.TestCase):
def test_c_char(self):
x = c_char(b"x")
self.assertRaises(TypeError, c_char, "x")
x.value = b"y"
with self.assertRaises(TypeError):
x.value = "y... | 1,987 | 67 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_varsize_struct.py | from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
self.assertEqual(sizeof(X), sizeof(c_int) * 2)
x = X()
x.item = 42
x.... | 1,842 | 51 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_cast.py | from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys
class Test(unittest.TestCase):
def test_array2pointer(self):
array = (c_int * 3)(42, 17, 2)
# casting an array to a pointer works.
ptr = cast(array, POINTER(c_int))
self.assertEqual([ptr[i] for i i... | 3,728 | 100 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_macholib.py | import os
import sys
import unittest
# Bob Ippolito:
#
# Ok.. the code to find the filename for __getattr__ should look
# something like:
#
# import os
# from macholib.dyld import dyld_find
#
# def find_lib(name):
# possible = ['lib'+name+'.dylib', name+'.dylib',
# name+'.framework/'+name]
# for dylib i... | 1,830 | 64 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_memfunctions.py | import sys
from test import support
import unittest
from ctypes import *
from ctypes.test import need_symbol
class MemFunctionsTest(unittest.TestCase):
@unittest.skip('test disabled')
def test_overflow(self):
# string_at and wstring_at must use the Python calling
# convention (which acquires th... | 3,293 | 80 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_returnfuncptrs.py | import unittest
from ctypes import *
import _ctypes_test
class ReturnFuncPtrTestCase(unittest.TestCase):
def test_with_prototype(self):
# The _ctypes_test shared lib/dll exports quite some functions for testing.
# The get_strchr function returns a *pointer* to the C strchr function.
dll =... | 2,893 | 67 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_numbers.py | from ctypes import *
import unittest
import struct
def valid_ranges(*types):
# given a sequence of numeric types, collect their _type_
# attribute, which is a single format character compatible with
# the struct module, use the struct module to calculate the
# minimum and maximum value allowed for this... | 9,292 | 291 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_parameters.py | import unittest
from ctypes.test import need_symbol
import test.support
class SimpleTypesTestCase(unittest.TestCase):
def setUp(self):
import ctypes
try:
from _ctypes import set_conversion_mode
except ImportError:
pass
else:
self.prev_conv_mode =... | 9,568 | 251 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_sizes.py | # Test specifically-sized containers.
from ctypes import *
import unittest
class SizesTestCase(unittest.TestCase):
def test_8(self):
self.assertEqual(1, sizeof(c_int8))
self.assertEqual(1, sizeof(c_uint8))
def test_16(self):
self.assertEqual(2, sizeof(c_int16))
self.assertEq... | 804 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_byteswap.py | import sys, unittest, struct, math, ctypes
from binascii import hexlify
from ctypes import *
def bin(s):
return hexlify(memoryview(s)).decode().upper()
# Each *simple* type that supports different byte orders has an
# __ctype_be__ attribute that specifies the same type in BIG ENDIAN
# byte order, and a __ctype_l... | 11,411 | 316 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/__main__.py | from ctypes.test import load_tests
import unittest
unittest.main()
| 68 | 5 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_checkretval.py | import unittest
from ctypes import *
from ctypes.test import need_symbol
class CHECKED(c_int):
def _check_retval_(value):
# Receives a CHECKED instance.
return str(value.value)
_check_retval_ = staticmethod(_check_retval_)
class Test(unittest.TestCase):
def test_checkretval(self):
... | 968 | 37 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_slicing.py | import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*range(1100, 1200))
b = list(range(1100, 1200))
self.assertEqual(a[0:2], b[0:2])
self.assertEqual(a[... | 6,025 | 168 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_simplesubclasses.py | import unittest
from ctypes import *
class MyInt(c_int):
def __eq__(self, other):
if type(other) != MyInt:
return NotImplementedError
return self.value == other.value
class Test(unittest.TestCase):
def test_compare(self):
self.assertEqual(MyInt(3), MyInt(3))
self.a... | 1,289 | 56 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_pickling.py | import unittest
import pickle
from ctypes import *
import _ctypes_test
dll = CDLL(_ctypes_test.__file__)
class X(Structure):
_fields_ = [("a", c_int), ("b", c_double)]
init_called = 0
def __init__(self, *args, **kw):
X.init_called += 1
self.x = 42
class Y(X):
_fields_ = [("str", c_char... | 2,218 | 82 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_functions.py | """
Here is probably the place to write the docs, since the test-cases
show how the type behave.
Later...
"""
from ctypes import *
from ctypes.test import need_symbol
import sys, unittest
try:
WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
WINFUNCTYPE = CFUNCTYPE
import _ctypes_test
d... | 12,555 | 403 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_frombuffer.py | from ctypes import *
import array
import gc
import unittest
class X(Structure):
_fields_ = [("c_int", c_int)]
init_called = False
def __init__(self):
self._init_called = True
class Test(unittest.TestCase):
def test_from_buffer(self):
a = array.array("i", range(16))
x = (c_int *... | 5,215 | 142 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_values.py | """
A testcase which accesses *values* in a dll.
"""
import unittest
import sys
from ctypes import *
import _ctypes_test
class ValuesTestCase(unittest.TestCase):
def test_an_integer(self):
# This test checks and changes an integer stored inside the
# _ctypes_test dll/shared lib.
ctdll = ... | 3,841 | 101 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_prototypes.py | from ctypes import *
from ctypes.test import need_symbol
import unittest
# IMPORTANT INFO:
#
# Consider this call:
# func.restype = c_char_p
# func(c_char_p("123"))
# It returns
# "123"
#
# WHY IS THIS SO?
#
# argument tuple (c_char_p("123"), ) is destroyed after the function
# func is called, but NOT before ... | 6,845 | 223 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_python_api.py | from ctypes import *
import unittest, sys
from test import support
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
from _ctypes import PyObj_FromPtr
################################################################
from sys imp... | 2,866 | 90 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_array_in_pointer.py | import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
return re.sub(r"(..)", r"\1-", h)[:-1]
class Value(Structure):
_fields_ = [("val", ... | 1,738 | 65 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_libc.py | import unittest
from ctypes import *
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
def three_way_cmp(x, y):
"""Return -1 if x < y, 0 if x == y and 1 if x > y"""
return (x > y) - (x < y)
class LibTest(unittest.TestCase):
def test_sqrt(self):
lib.my_sqrt.argtypes = c_double,
lib.my... | 1,005 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_keeprefs.py | from ctypes import *
import unittest
class SimpleTestCase(unittest.TestCase):
def test_cint(self):
x = c_int()
self.assertEqual(x._objects, None)
x.value = 42
self.assertEqual(x._objects, None)
x = c_int(99)
self.assertEqual(x._objects, None)
def test_ccharp(sel... | 4,058 | 154 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_arrays.py | import unittest
from test.support import bigmemtest, _2G
import sys
from ctypes import *
from ctypes.test import need_symbol
formats = "bBhHiIlLqQfd"
formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \
c_long, c_ulonglong, c_float, c_double, c_longdouble
class ArrayTestCase(unittest.TestCase):
... | 6,017 | 193 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_repr.py | from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
subclasses.append(X)
class X(c_char):
pass
# This test check... | 842 | 30 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_loading.py | from ctypes import *
import os
import sys
import unittest
import test.support
from ctypes.util import find_library
libc_name = None
def setUpModule():
global libc_name
if os.name == "nt":
libc_name = find_library("c")
elif sys.platform == "cygwin":
libc_name = "cygwin1.dll"
else:
... | 4,316 | 117 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_pep3118.py | import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
OTHER_ENDIAN = "<"
def normalize(format):
# Remove current endian specifier and white space from a format
# string
if format is None:
retur... | 8,516 | 234 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_pointers.py | import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
class PointersT... | 7,239 | 224 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_stringptr.py | import unittest
from test import support
from ctypes import *
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
class StringPtrTestCase(unittest.TestCase):
@support.refcount_test
def test__POINTER_c_char(self):
class X(Structure):
_fields_ = [("str", POINTER(c_char))]
x = X()... | 2,536 | 78 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_strings.py | import unittest
from ctypes import *
from ctypes.test import need_symbol
class StringArrayTestCase(unittest.TestCase):
def test(self):
BUF = c_char * 4
buf = BUF(b"a", b"b", b"c")
self.assertEqual(buf.value, b"abc")
self.assertEqual(buf.raw, b"abc\000")
buf.value = b"ABCD"... | 7,135 | 226 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/__init__.py | import os
import unittest
from test import support
# skip tests if _ctypes was not built
ctypes = support.import_module('ctypes')
ctypes_symbols = dir(ctypes)
def need_symbol(name):
return unittest.skipUnless(name in ctypes_symbols,
'{!r} is required'.format(name))
def load_tests(*... | 399 | 15 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_random_things.py | from ctypes import *
import unittest, sys
def callback_func(arg):
42 / arg
raise ValueError(arg)
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
class call_function_TestCase(unittest.TestCase):
# _ctypes.call_function is deprecated and private, but used by
# Gary Bishp's readlin... | 2,827 | 75 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_win32.py | # Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
# Only windows 32-bit has different calling conventions.
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int),
... | 6,102 | 166 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ctypes/test/test_structures.py | import unittest
from ctypes import *
from ctypes.test import need_symbol
from struct import calcsize
import _ctypes_test
import test.support
class SubclassesTest(unittest.TestCase):
def test_subclass(self):
class X(Structure):
_fields_ = [("a", c_int)]
class Y(X):
_fields_ ... | 17,152 | 514 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/idle.pyw | try:
import idlelib.pyshell
except ImportError:
# IDLE is not installed, but maybe pyshell is on sys.path:
from . import pyshell
import os
idledir = os.path.dirname(os.path.abspath(pyshell.__file__))
if idledir != os.getcwd():
# We're not in the IDLE directory, help the subprocess find r... | 570 | 18 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/calltip_w.py | """A call-tip window class for Tkinter/IDLE.
After tooltip.py, which uses ideas gleaned from PySol.
Used by calltip.py.
"""
from tkinter import Label, LEFT, SOLID, TclError
from idlelib.tooltip import TooltipBase
HIDE_EVENT = "<<calltipwindow-hide>>"
HIDE_SEQUENCES = ("<Key-Escape>", "<FocusOut>")
CHECKHIDE_EVENT = ... | 7,111 | 201 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/HISTORY.txt | IDLE History
============
This file contains the release messages for previous IDLE releases.
As you read on you go back to the dark ages of IDLE's history.
What's New in IDLEfork 0.8.1?
=============================
*Release date: 22-Jul-2001*
- New tarball released as a result of the 'revitalisation' of the IDLE... | 10,312 | 297 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/README.txt | README.txt: an index to idlelib files and the IDLE menu.
IDLE is Python's Integrated Development and Learning
Environment. The user documentation is part of the Library Reference and
is available in IDLE by selecting Help => IDLE Help. This README documents
idlelib for IDLE developers and curious users.
IDLELIB FIL... | 9,592 | 252 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/textview.py | """Simple text browser for IDLE
"""
from tkinter import Toplevel, Text, TclError,\
HORIZONTAL, VERTICAL, N, S, E, W
from tkinter.ttk import Frame, Scrollbar, Button
from tkinter.messagebox import showerror
from idlelib.colorizer import color_config
class AutoHiddenScrollbar(Scrollbar):
"""A scrollbar that i... | 6,121 | 176 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/idle.bat | @echo off
rem Start IDLE using the appropriate Python interpreter
set CURRDIR=%~dp0
start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9
| 173 | 5 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/searchengine.py | '''Define SearchEngine for search dialogs.'''
import re
from tkinter import StringVar, BooleanVar, TclError
import tkinter.messagebox as tkMessageBox
def get(root):
'''Return the singleton SearchEngine instance for the process.
The single SearchEngine saves settings between dialog instances.
If there is ... | 7,472 | 238 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/tooltip.py | """Tools for displaying tool-tips.
This includes:
* an abstract base-class for different kinds of tooltips
* a simple text-only Tooltip class
"""
from tkinter import *
class TooltipBase(object):
"""abstract base class for tooltips"""
def __init__(self, anchor_widget):
"""Create a tooltip.
... | 6,486 | 187 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/debugobj.py | # XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - more doc strings
# - tooltips
# object browser
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
from reprlib import Repr
from idlelib.tree import TreeItem, TreeNode, ScrolledCanvas
myrepr = Repr()
myrepr.maxstring = 100
... | 4,055 | 143 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/NEWS2x.txt | What's New in IDLE 2.7? (Merged into 3.1 before 2.7 release.)
=======================
*Release date: XX-XXX-2010*
- idle.py modified and simplified to better support developing experimental
versions of IDLE which are not installed in the standard location.
- OutputWindow/PyShell right click menu "Go to file/line" w... | 27,172 | 661 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/debugger.py | import bdb
import os
from tkinter import *
from tkinter.ttk import Scrollbar
from idlelib import macosx
from idlelib.scrolledlist import ScrolledList
from idlelib.window import ListedToplevel
class Idb(bdb.Bdb):
def __init__(self, gui):
self.gui = gui # An instance of Debugger or proxy of remote.
... | 19,097 | 551 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/help.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<ti... | 55,114 | 911 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/autocomplete_w.py | """
An auto-completion window for IDLE, used by the autocomplete extension
"""
import platform
from tkinter import *
from tkinter.ttk import Scrollbar
from idlelib.autocomplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES
from idlelib.multicall import MC_SHIFT
HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
HI... | 19,829 | 468 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/undo.py | import string
from idlelib.delegator import Delegator
# tkintter import not needed because module does not create widgets,
# although many methods operate on text widget arguments.
#$ event <<redo>>
#$ win <Control-y>
#$ unix <Alt-z>
#$ event <<undo>>
#$ win <Control-z>
#$ unix <Control-z>
#$ event <<dump-undo-sta... | 11,047 | 367 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/autocomplete.py | """Complete either attribute names or file names.
Either on demand or after a user-selected delay after a key character,
pop up a list of candidates.
"""
import os
import string
import sys
# These constants represent the two different types of completions.
# They must be defined here so autocomple_w can import them.
... | 9,324 | 232 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/config-highlight.def | # IDLE reads several config files to determine user preferences. This
# file is the default config file for idle highlight theme settings.
[IDLE Classic]
normal-foreground= #000000
normal-background= #ffffff
keyword-foreground= #ff7700
keyword-background= #ffffff
builtin-foreground= #900090
builtin-background= #fffff... | 2,687 | 100 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/pyparse.py | """Define partial Python code Parser used by editor and hyperparser.
Instances of ParseMap are used with str.translate.
The following bound search and match functions are defined:
_synchre - start of popular statement;
_junkre - whitespace or comment line;
_match_stringre: string, possibly without closer;
_itemre - l... | 20,118 | 599 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/delegator.py | class Delegator:
def __init__(self, delegate=None):
self.delegate = delegate
self.__cache = set()
# Cache is used to only remove added attributes
# when changing the delegate.
def __getattr__(self, name):
attr = getattr(self.delegate, name) # May raise AttributeError
... | 1,043 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/extend.txt | Writing an IDLE extension
=========================
An IDLE extension can define new key bindings and menu entries for IDLE
edit windows. There is a simple mechanism to load extensions when IDLE
starts up and to attach them to each edit window. (It is also possible
to make other changes to IDLE, but this must be done... | 3,642 | 84 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/browser.py | """Module browser.
XXX TO DO:
- reparse when source changed (maybe just a button would be OK?)
(or recheck on window popup)
- add popup menu with more options (e.g. doc strings, base classes, imports)
- add base classes to class browser tree
- finish removing limitation to x.py files (ModuleBrowserTreeItem)
"""
... | 8,281 | 249 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/scrolledlist.py | from tkinter import *
from tkinter.ttk import Scrollbar
from idlelib import macosx
class ScrolledList:
default = "(None)"
def __init__(self, master, **options):
# Create top frame, with scrollbar and listbox
self.master = master
self.frame = frame = Frame(master)
self.frame.... | 4,458 | 150 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/rpc.py | """RPC Implementation, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
only one client per server, this was not a limitation.
+---------------------------------+... | 21,137 | 637 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/hyperparser.py | """Provide advanced parsing abilities for ParenMatch and other extensions.
HyperParser uses PyParser. PyParser mostly gives information on the
proper indentation of code. HyperParser gives additional information on
the structure of code.
"""
from keyword import iskeyword
import string
from idlelib import pyparse
#... | 12,882 | 313 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/TODO.txt | Original IDLE todo, much of it now outdated:
============================================
TO DO:
- improve debugger:
- manage breakpoints globally, allow bp deletion, tbreak, cbreak etc.
- real object browser
- help on how to use it (a simple help button will do wonders)
- performance? (updates of lar... | 8,478 | 211 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/config-keys.def | # IDLE reads several config files to determine user preferences. This
# file is the default config file for idle key binding settings.
# Where multiple keys are specified for an action: if they are separated
# by a space (eg. action=<key1> <key2>) then the keys are alternatives, if
# there is no space (eg. action=<key... | 10,775 | 305 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/idlelib/zzdummy.py | "Example extension, also used for testing."
from idlelib.config import idleConf
ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
class ZzDummy:
## menudefs = [
## ('format', [
## ('Z in', '<<z-in>>'),
## ('Z out', '<<z-out>>'),
## ] )
## ]
def __init__(se... | 961 | 43 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.