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/operator.py | """
Operator Interface
This module exports a set of functions corresponding to the intrinsic
operators of Python. For example, operator.add(x, y) is equivalent
to the expression x+y. The function names are those used for special
methods; variants without leading and trailing '__' are also provided
for convenience.
... | 10,963 | 471 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/sre_constants.py | #
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | 8,227 | 294 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/lzma.py | """Interface to the liblzma compression library.
This module provides a class for reading and writing compressed files,
classes for incremental (de)compression, and convenience functions for
one-shot (de)compression.
These classes and functions support both the XZ and legacy LZMA
container formats, as well as raw com... | 12,983 | 348 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/enum.py | import sys
from types import MappingProxyType, DynamicClassAttribute
from functools import reduce
from operator import or_ as _or_
# try _collections first to reduce startup cost
try:
from _collections import OrderedDict
except ImportError:
from collections import OrderedDict
__all__ = [
'EnumMeta',
... | 33,606 | 878 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/ntpath.py | # Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
# strings representing various path-related bits and pieces
# These are primarily for export; internally... | 22,988 | 689 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/io.py | """The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; impl... | 3,480 | 98 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/smtpd.py | #! /usr/bin/env python3
"""An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.
Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]
Options:
--nosetuid
-n
This program generally tries to setuid `nobody', unless this flag is
set. The setuid call will f... | 34,717 | 966 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/_weakrefset.py | # Access WeakSet through the weakref module.
# This code is separated-out because it is needed
# by abc.py to load everything else at startup.
from _weakref import ref
__all__ = ['WeakSet']
class _IterationGuard:
# This context manager registers itself in the current iterators of the
# weak container, such ... | 5,705 | 197 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/socketserver.py | """Generic socket server classes.
This module tries to capture the various aspects of defining a server:
For socket-based servers:
- address family:
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
- AF_UNIX: Unix domain sockets
- others, e.g. AF_DECNET are conceivable (see <socket.h>
... | 27,010 | 822 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/mailbox.py | """Read/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes."""
# Notes for authors of new mailbox subclasses:
#
# Remember to fsync() changes to disk before closing a modified file
# or returning from a flush() method. See functions _sync_flush() and
# _sync_close().
import os
import time
import calendar... | 78,677 | 2,148 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/base64.py | #! /usr/bin/env python3
"""Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
# Modified 22-May-2007 by Guido van Rossum to use bytes everywhere
import re
import struc... | 20,380 | 596 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/macurl2path.py | """Macintosh-specific module for conversion between pathnames and URLs.
Do not import directly; use urllib instead."""
import urllib.parse
import os
__all__ = ["url2pathname","pathname2url"]
def url2pathname(pathname):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path;... | 2,732 | 78 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/chunk.py | """Simple class to read IFF chunks.
An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:
+----------------+
| ID (4 bytes) |
+----------------+
| size (4 bytes) |
+----------------+
| data |
| ... |
+----------------+
The ID is a 4-byte s... | 5,425 | 170 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/webbrowser.py | #! /usr/bin/env python3
"""Interfaces for launching and remotely controlling Web browsers."""
# Maintained by Georg Brandl.
import os
import shlex
import shutil
import sys
import subprocess
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
class Error(Exception):
pass
_browsers = {} ... | 21,759 | 664 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/crypt.py | """Wrapper to the POSIX crypt library call and associated functionality."""
import _crypt
import string as _string
from random import SystemRandom as _SystemRandom
from collections import namedtuple as _namedtuple
_saltchars = _string.ascii_letters + _string.digits + './'
_sr = _SystemRandom()
class _Method(_named... | 1,864 | 62 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/subprocess.py | # subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324.
#
# Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
#
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/2.4/license for licensing details.
r"""Subprocesses with ... | 62,367 | 1,604 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/wave.py | """Stuff to parse WAVE files.
Usage.
Reading WAVE files:
f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not necessary.
This ... | 17,709 | 506 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/contextlib.py | """Utilities for with-statement contexts. See PEP 343."""
import abc
import sys
import _collections_abc
from collections import deque
from functools import wraps
__all__ = ["contextmanager", "closing", "AbstractContextManager",
"ContextDecorator", "ExitStack", "redirect_stdout",
"redirect_stderr... | 13,162 | 385 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/calendar.py | """Calendar printing functions
Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday)."""
import sys
import da... | 23,333 | 719 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/queue.py | '''A multi-producer, multi-consumer queue.'''
try:
import threading
except ImportError:
import dummy_threading as threading
from collections import deque
from heapq import heappush, heappop
from time import monotonic as time
__all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']
class Empty(Excep... | 8,780 | 247 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/fileinput.py | """Helper class to quickly write a loop over all standard input files.
Typical use is:
import fileinput
for line in fileinput.input():
process(line)
This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty. If a filename is '-' it
is also replace... | 14,471 | 426 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/code.py | """Utilities needed to emulate Python's interactive interpreter.
"""
# Inspired by similar code by Jeff Epler and Fredrik Lundh.
import sys
import traceback
import argparse
from codeop import CommandCompiler, compile_command
__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
"compile... | 10,614 | 315 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/struct.py | __all__ = [
# Functions
'calcsize', 'pack', 'pack_into', 'unpack', 'unpack_from',
'iter_unpack',
# Classes
'Struct',
# Exceptions
'error'
]
from _struct import Struct, calcsize, error, iter_unpack, pack, pack_into, unpack, unpack_from
from _struct import _clearcache
try:
from _struc... | 364 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/genericpath.py | """
Path operations common to more than one OS
Do not use directly. The OS specific modules import the appropriate
functions from this module themselves.
"""
import os
import stat
__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
'getsize', 'isdir', 'isfile', 'samefile', 'sameopenfil... | 4,756 | 152 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/antigravity.py |
import webbrowser
import hashlib
webbrowser.open("https://xkcd.com/353/")
def geohash(latitude, longitude, datedow):
'''Compute geohash() using the Munroe algorithm.
>>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
37.857713 -122.544543
'''
# https://xkcd.com/426/
h = hashlib.md5... | 477 | 18 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/typing.py | import abc
from abc import abstractmethod, abstractproperty
import collections
import contextlib
import functools
import re as stdlib_re # Avoid confusion with the re we export.
import sys
import types
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc # F... | 80,274 | 2,413 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/__init__.py | """Core XML support for Python.
This package contains four sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Megginso... | 558 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/parsers/expat.py | """Interface to the Expat non-validating XML parser."""
__all__ = [
'EXPAT_VERSION',
'ErrorString',
'ExpatError',
'ParserCreate',
'XMLParserType',
'XML_PARAM_ENTITY_PARSING_ALWAYS',
'XML_PARAM_ENTITY_PARSING_NEVER',
'XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE',
'error',
'errors'... | 868 | 29 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/parsers/__init__.py | """Python interfaces to XML parsers.
This package contains one module:
expat -- Python wrapper for James Clark's Expat parser, with namespace
support.
"""
| 167 | 9 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/xmlreader.py | """An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. """
from . import handler
from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException
# ===== XMLREADER =====
class XMLReader:
"""Interface for reading an XML document using callbacks.
XMLReade... | 12,684 | 381 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/handler.py | """
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id$
"""
version ... | 13,922 | 343 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/saxutils.py | """\
A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os, urllib.parse, urllib.request
import io
import codecs
from . import handler
from . import xmlreader
def __dict_replace(s, d):
"""Replace substrings of a string using a dictionary."""
... | 12,205 | 369 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/_exceptions.py | """Different kinds of SAX Exceptions"""
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XML parser or
the application: you can subclass it to provide additional
functionality, or... | 4,699 | 128 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/__init__.py | """Simple API for XML (SAX) implementation for Python.
This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/. The Python version of the interface is
documented at <...>.
This package contains the following modu... | 3,679 | 110 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/sax/expatreader.py | """
SAX driver for the pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_... | 15,704 | 447 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/etree/ElementTree.py | """Lightweight XML support for Python.
XML is an inherently hierarchical data format, and the most natural way to
represent it is with a tree. This module has two classes for this purpose:
1. ElementTree represents the whole XML document as a tree and
2. Element represents a single node in this tree.
In... | 57,029 | 1,657 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/etree/cElementTree.py | # Deprecated alias for xml.etree.ElementTree
from xml.etree.ElementTree import *
if __name__ == 'PYOBJ.COM':
Comment = 0
Element = 0
ElementTree = 0
PI = 0
ParseError = 0
ProcessingInstruction = 0
QName = 0
SubElement = 0
TreeBuilder = 0
VERSION = 0
XML = 0
XMLID = 0
... | 528 | 29 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/etree/ElementPath.py | #
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
# 2007-09-10 fl new selection engine
# 2007-09-12 fl fix... | 9,935 | 315 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/etree/ElementInclude.py | #
# ElementTree
# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xinclude support for element trees
#
# history:
# 2003-08-15 fl created
# 2003-11-14 fl fixed default loader
#
# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware... | 5,151 | 144 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/etree/__init__.py | # $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $
# elementtree package
# --------------------------------------------------------------------
# The ElementTree toolkit is
#
# Copyright (c) 1999-2008 by Fredrik Lundh
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you ... | 1,604 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/expatbuilder.py | """Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | 35,756 | 966 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/NodeFilter.py | # This is the Python mapping for interface NodeFilter from
# DOM2-Traversal-Range. It contains only constants.
class NodeFilter:
"""
This is the DOM2 NodeFilter interface. It contains only constants.
"""
FILTER_ACCEPT = 1
FILTER_REJECT = 2
FILTER_SKIP = 3
SHOW_ALL = 0x... | 936 | 28 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/pulldom.py | import xml.sax
import xml.sax.handler
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"
IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE"
CHARACTERS = "CHARACTERS"
class PullDOM(... | 11,761 | 343 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/domreg.py | """Registration facilities for DOM. This module should not be used
directly. Instead, the functions getDOMImplementation and
registerDOMImplementation should be imported from xml.dom."""
# This is a list of well-known implementations. Well-known names
# should be published by posting to xml-sig@python.org, and are
# ... | 3,451 | 100 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/minicompat.py | """Python version compatibility support for minidom.
This module contains internal implementation details and
should not be imported; use xml.dom.minidom instead.
"""
# This module should only be imported using "import *".
#
# The following names are defined:
#
# NodeList -- lightest possible NodeList implemen... | 3,367 | 110 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/xmlbuilder.py | """Implementation of the DOM Level 3 'LS-Load' feature."""
import copy
import warnings
import xml.dom
from xml.dom.NodeFilter import NodeFilter
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
class Options:
"""Features object that has variables set for each DOMBuilder feature.
The DOMBuil... | 12,996 | 411 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/__init__.py | """W3C Document Object Model implementation for Python.
The Python mapping of the Document Object Model is documented in the
Python Library Reference in the section on the xml.dom package.
This package contains the following modules:
minidom -- A simple implementation of the Level 1 DOM with namespace
sup... | 4,019 | 141 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/xml/dom/minidom.py | """Simple implementation of the Level 1 DOM.
Namespaces and other minor Level 2 features are also supported.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
... | 66,819 | 1,982 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/collections/abc.py | from _collections_abc import *
from _collections_abc import __all__
if __name__ == 'PYOBJ.COM':
AsyncGenerator = 0
AsyncIterable = 0
AsyncIterator = 0
Awaitable = 0
ByteString = 0
Callable = 0
Collection = 0
Container = 0
Coroutine = 0
Generator = 0
Hashable = 0
ItemsVie... | 560 | 30 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/collections/__init__.py | '''This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
* namedtuple factory function for creating tuple subclasses with named fields
* deque list-like container with fast appends and pops on either end
* Cha... | 45,980 | 1,251 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/concurrent/__init__.py | # This directory is a Python package.
| 38 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/concurrent/futures/_base.py | # Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
import collections
import logging
import threading
import time
FIRST_COMPLETED = 'FIRST_COMPLETED'
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
ALL_COMPLETED = 'ALL_COMPLETED... | 21,235 | 613 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/concurrent/futures/thread.py | # Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Implements ThreadPoolExecutor."""
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
import atexit
from concurrent.futures import _base
import itertools
import queue
import threading
import weakref
import os
# Wo... | 5,511 | 154 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/concurrent/futures/process.py | # Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Implements ProcessPoolExecutor.
The follow diagram and text describe the data-flow through the system:
|======================= In-process =====================|== Out-of-process ==|
+----------+ +----------... | 20,492 | 516 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/concurrent/futures/__init__.py | # Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Execute computations asynchronously using threads or processes."""
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
from concurrent.futures._base import (FIRST_COMPLETED,
FI... | 800 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/case.py | """Test case implementation"""
import sys
import functools
import difflib
import logging
import pprint
import re
import warnings
import collections
import contextlib
import traceback
from . import result
from .util import (strclass, safe_repr, _count_diff_all_purpose,
_count_diff_hashable, _common_... | 56,986 | 1,430 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/signals.py | import signal
import weakref
from functools import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.original_handler = default_handler
if isinstance(default_handler, int):
if default_handler == signal.SIG_D... | 2,403 | 72 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/loader.py | """Loading unittests."""
import os
import re
import sys
import traceback
import types
import functools
import warnings
from fnmatch import fnmatch
from . import case, suite, util
__unittest = True
# what about .pyc (etc)
# we would need to avoid loading the same tests multiple times
# from '.py', *and* '.pyc'
VALI... | 22,410 | 511 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/runner.py | """Running tests"""
import sys
import time
import warnings
from . import result
from .signals import registerResult
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like objects with a handy 'writeln' method"""
def __init__(self,stream):
self.stream = stream
def __ge... | 7,751 | 222 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/_main.py | """Unittest main program"""
import sys
import argparse
import os
from . import loader, runner
from .signals import installHandler
__unittest = True
MAIN_EXAMPLES = """\
Examples:
%(prog)s test_module - run tests from test_module
%(prog)s module.TestClass - run tests from module.TestClass
... | 10,552 | 261 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/__main__.py | """Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
import os.path
# We change sys.argv[0] to make help message more useful
# use executable without path, unquoted
# (it's just a hint anyway)
# (if you have spaces in your executable you get what you deserve!)
executable = ... | 486 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/mock.py | # mock.py
# Test tools for mocking and patching.
# Maintained by Michael Foord
# Backport for other versions of Python available from
# https://pypi.org/project/mock
__all__ = (
'Mock',
'MagicMock',
'patch',
'sentinel',
'DEFAULT',
'ANY',
'call',
'create_autospec',
'FILTER_DIR',
... | 79,741 | 2,411 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/util.py | """Various utility functions."""
from collections import namedtuple, OrderedDict
from os.path import commonprefix
__unittest = True
_MAX_LENGTH = 80
_PLACEHOLDER_LEN = 12
_MIN_BEGIN_LEN = 5
_MIN_END_LEN = 5
_MIN_COMMON_LEN = 5
_MIN_DIFF_LEN = _MAX_LENGTH - \
(_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_C... | 5,433 | 178 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/result.py | """Test result object"""
import io
import sys
import traceback
from . import util
from functools import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
return method(self, *args, **kw)
... | 7,442 | 217 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/suite.py | """TestSuite"""
import sys
from . import case
from . import util
__unittest = True
def _call_if_exists(parent, attr):
func = getattr(parent, attr, lambda: None)
func()
class BaseTestSuite(object):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
_cleanup = True... | 10,479 | 322 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/__init__.py | """
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework (used with permission).
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the tests... | 3,081 | 77 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_case.py | import contextlib
import difflib
import pprint
import pickle
import re
import sys
import logging
import warnings
import weakref
import inspect
from copy import deepcopy
from test import support
import unittest
from unittest.test.support import (
TestEquality, TestHashing, LoggingResult, LegacyLoggingResult,
... | 72,998 | 1,848 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_break.py | import gc
import io
import os
import sys
import signal
import weakref
import unittest
@unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
@unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
"if threa... | 9,945 | 289 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/dummy.py | # Empty module for testing the loading of modules
| 50 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_setups.py | import io
import sys
import unittest
def resultFactory(*_):
return unittest.TestResult()
class TestSetups(unittest.TestCase):
def getRunner(self):
return unittest.TextTestRunner(resultclass=resultFactory,
stream=io.StringIO())
def runTests(self, *cases... | 16,503 | 508 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_loader.py | import sys
import types
import warnings
import unittest
# Decorator used in the deprecation tests to reset the warning registry for
# test isolation and reproducibility.
def warningregistry(func):
def wrapper(*args, **kws):
missing = []
saved = getattr(warnings, '__warningregistry__', missing).cop... | 60,769 | 1,530 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_assertions.py | import datetime
import warnings
import weakref
import unittest
from itertools import product
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
... | 17,030 | 412 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_functiontestcase.py | import unittest
from unittest.test.support import LoggingResult
class Test_FunctionTestCase(unittest.TestCase):
# "Return the number of tests represented by the this test object. For
# TestCase instances, this will always be 1"
def test_countTestCases(self):
test = unittest.FunctionTestCase(lamb... | 5,540 | 149 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/support.py | import unittest
class TestEquality(object):
"""Used as a mixin for TestCase"""
# Check for a valid __eq__ implementation
def test_eq(self):
for obj_1, obj_2 in self.eq_pairs:
self.assertEqual(obj_1, obj_2)
self.assertEqual(obj_2, obj_1)
# Check for a valid __ne__ impl... | 3,752 | 139 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/_test_warnings.py | # helper module for test_runner.Test_TextTestRunner.test_warnings
"""
This module has a number of tests that raise different kinds of warnings.
When the tests are run, the warnings are caught and their messages are printed
to stdout. This module also accepts an arg that is then passed to
unittest.main to affect the b... | 2,304 | 74 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/__main__.py | import os
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test_*.py"
# We are inside unittest.test, so the top-level is two notches up
top_level_dir = os.path.dirname(os.path... | 596 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_suite.py | import unittest
import gc
import sys
import weakref
from unittest.test.support import LoggingResult, TestEquality
### Support code for Test_TestSuite
################################################################
class Test(object):
class Foo(unittest.TestCase):
def test_1(self): pass
def test... | 15,184 | 448 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_program.py | import io
import os
import sys
from test import support
import unittest
import unittest.test
class Test_TestProgram(unittest.TestCase):
def test_discovery_from_dotted_path(self):
loader = unittest.TestLoader()
tests = [self]
expectedPath = os.path.abspath(os.path.dirname(unittest.test._... | 13,721 | 415 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_skipping.py | import unittest
from unittest.test.support import LoggingResult
class Test_TestSkipping(unittest.TestCase):
def test_skipping(self):
class Foo(unittest.TestCase):
def test_skip_me(self):
self.skipTest("skip")
events = []
result = LoggingResult(events)
... | 9,316 | 261 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_result.py | import io
import sys
import textwrap
from test import support
import traceback
import unittest
class MockTraceback(object):
class TracebackException:
def __init__(self, *args, **kwargs):
self.capture_locals = kwargs.get('capture_locals', False)
def format(self):
result = ... | 24,497 | 696 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_runner.py | import io
import os
import sys
import pickle
import subprocess
import unittest
from unittest.case import _Outcome
from unittest.test.support import (LoggingResult,
ResultWithNoStartTestRunStopTestRun)
class TestCleanUp(unittest.TestCase):
def testCleanUp(self):
class ... | 12,013 | 354 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/test_discovery.py | import os.path
from os.path import abspath
import re
import sys
import types
import pickle
from test import support
import test.test_importlib.util
import unittest
import unittest.mock
import unittest.test
class TestableTestProgram(unittest.TestProgram):
module = None
exit = True
defaultTest = failfast =... | 33,693 | 874 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/__init__.py | import os
import sys
import unittest
here = os.path.dirname(__file__)
loader = unittest.defaultTestLoader
def suite():
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test." + fn[:-3]
__import__(modn... | 584 | 23 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testhelpers.py | import time
import types
import unittest
from unittest.mock import (
call, _Call, create_autospec, MagicMock,
Mock, ANY, _CallList, patch, PropertyMock
)
from datetime import datetime
class SomeClass(object):
def one(self, a, b):
pass
def two(self):
pass
def three(self, a=None):
... | 28,210 | 963 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testpatch.py | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
import os
import sys
import unittest
from unittest.test.testmock import support
from unittest.test.testmock.support import SomeClass, is_instance
from test.test_importlib.... | 55,727 | 1,859 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/support.py | def is_instance(obj, klass):
"""Version of is_instance that doesn't access __class__"""
return issubclass(type(obj), klass)
class SomeClass(object):
class_attribute = None
def wibble(self):
pass
class X(object):
pass
def examine_warnings(func):
def wrapper():
with catch_wa... | 387 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/__main__.py | import os
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test*.py"
# We are inside unittest.test.testmock, so the top-level is three notches up
top_level_dir = os.path.dirna... | 623 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testmock.py | import copy
import sys
import tempfile
import unittest
from unittest.test.testmock.support import is_instance
from unittest import mock
from unittest.mock import (
call, DEFAULT, patch, sentinel,
MagicMock, Mock, NonCallableMock,
NonCallableMagicMock, _Call, _CallList,
create_autospec
)
class Iter(ob... | 56,946 | 1,767 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testcallable.py | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
import unittest
from unittest.test.testmock.support import is_instance, X, SomeClass
from unittest.mock import (
Mock, MagicMock, NonCallableMagicMock,
NonCallableM... | 4,283 | 152 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testmagicmethods.py | import unittest
import sys
from unittest.mock import Mock, MagicMock, _magics
class TestMockingMagicMethods(unittest.TestCase):
def test_deleting_magic_methods(self):
mock = Mock()
self.assertFalse(hasattr(mock, '__getitem__'))
mock.__getitem__ = Mock()
self.assertTrue(hasattr(m... | 14,412 | 469 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testsentinel.py | import unittest
from unittest.mock import sentinel, DEFAULT
class SentinelTest(unittest.TestCase):
def testSentinels(self):
self.assertEqual(sentinel.whatever, sentinel.whatever,
'sentinel not stored')
self.assertNotEqual(sentinel.whatever, sentinel.whateverelse,
... | 824 | 29 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/testwith.py | import unittest
from warnings import catch_warnings
from unittest.test.testmock.support import is_instance
from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call
something = sentinel.Something
something_else = sentinel.SomethingElse
class WithTest(unittest.TestCase):
def test_with_sta... | 10,415 | 302 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/unittest/test/testmock/__init__.py | import os
import sys
import unittest
here = os.path.dirname(__file__)
loader = unittest.defaultTestLoader
def load_tests(*args):
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test.testmock." + fn[:-3]
... | 465 | 18 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/encoders.py | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Encodings and related functions."""
__all__ = [
'encode_7or8bit',
'encode_base64',
'encode_noop',
'encode_quopri',
]
from base64 import encodebytes as _bencode
from quopri import encode... | 1,786 | 70 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/_policybase.py | """Policy framework for the email package.
Allows fine grained feature control of how the package parses and emits data.
"""
import abc
from email import header
from email import charset as _charset
from email.utils import _has_surrogates
__all__ = [
'Policy',
'Compat32',
'compat32',
]
class _Polic... | 15,073 | 375 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/architecture.rst | :mod:`email` Package Architecture
=================================
Overview
--------
The email package consists of three major components:
Model
An object structure that represents an email message, and provides an
API for creating, querying, and modifying a message.
Parser
Takes a ... | 9,561 | 217 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/headerregistry.py | """Representing and manipulating email headers via custom objects.
This module provides an implementation of the HeaderRegistry API.
The implementation is designed to flexibly follow RFC5322 rules.
Eventually HeaderRegistry will be a public API, but it isn't yet,
and will probably change some before that happens.
""... | 20,447 | 595 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/generator.py | # Copyright (C) 2001-2010 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Classes to generate plain text from a message object tree."""
__all__ = ['Generator', 'DecodedGenerator', 'BytesGenerator']
import re
import sys
import time
import random
from copy import deepcopy
from io ... | 19,975 | 509 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/feedparser.py | # Copyright (C) 2004-2006 Python Software Foundation
# Authors: Baxter, Wouters and Warsaw
# Contact: email-sig@python.org
"""FeedParser - An email feed parser.
The feed parser implements an interface for incrementally parsing an email
message, line by line. This has advantages for certain applications, such as
thos... | 22,775 | 537 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/email/quoprimime.py | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Ben Gertzfield
# Contact: email-sig@python.org
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode US ASCII-like 8-bit data called `quoted-printable'. It... | 9,858 | 300 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.