codeop - pydoc - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


codeop
NAME MODULE REFERENCE DESCRIPTION CLASSES FUNCTIONS DATA FILE
Help on module codeop:

NAME
    codeop - Utilities to compile possibly incomplete Python source code.

MODULE REFERENCE
    https://docs.python.org/3.10/library/codeop.html

    The following documentation is automatically generated from the Python
    source files.  It may be incomplete, incorrect or include features that
    are considered implementation detail and may vary between Python
    implementations.  When in doubt, consult the module reference at the
    location listed above.

DESCRIPTION
    This module provides two interfaces, broadly similar to the builtin
    function compile(), which take program text, a filename and a 'mode'
    and:

    - Return code object if the command is complete and valid
    - Return None if the command is incomplete
    - Raise SyntaxError, ValueError or OverflowError if the command is a
      syntax error (OverflowError and ValueError can be produced by
      malformed literals).

    The two interfaces are:

    compile_command(source, filename, symbol):

        Compiles a single command in the manner described above.

    CommandCompiler():

        Instances of this class have __call__ methods identical in
        signature to compile_command; the difference is that if the
        instance compiles program text containing a __future__ statement,
        the instance 'remembers' and compiles all subsequent program texts
        with the statement in force.

    The module also provides another class:

    Compile():

        Instances of this class act like the built-in function compile,
        but with 'memory' in the sense described above.

CLASSES
    builtins.object
        CommandCompiler
        Compile

    class CommandCompiler(builtins.object)
     |  Instances of this class have __call__ methods identical in
     |  signature to compile_command; the difference is that if the
     |  instance compiles program text containing a __future__ statement,
     |  the instance 'remembers' and compiles all subsequent program texts
     |  with the statement in force.
     |
     |  Methods defined here:
     |
     |  __call__(self, source, filename='<input>', symbol='single')
     |      Compile a command and determine whether it is incomplete.
     |
     |      Arguments:
     |
     |      source -- the source string; may contain \n characters
     |      filename -- optional filename from which source was read;
     |                  default "<input>"
     |      symbol -- optional grammar start symbol; "single" (default) or
     |                "eval"
     |
     |      Return value / exceptions raised:
     |
     |      - Return a code object if the command is complete and valid
     |      - Return None if the command is incomplete
     |      - Raise SyntaxError, ValueError or OverflowError if the command is a
     |        syntax error (OverflowError and ValueError can be produced by
     |        malformed literals).
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

    class Compile(builtins.object)
     |  Instances of this class behave much like the built-in compile
     |  function, but if one is used to compile text containing a future
     |  statement, it "remembers" and compiles all subsequent program texts
     |  with the statement in force.
     |
     |  Methods defined here:
     |
     |  __call__(self, source, filename, symbol)
     |      Call self as a function.
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

FUNCTIONS
    compile_command(source, filename='<input>', symbol='single')
        Compile a command and determine whether it is incomplete.

        Arguments:

        source -- the source string; may contain \n characters
        filename -- optional filename from which source was read; default
                    "<input>"
        symbol -- optional grammar start symbol; "single" (default), "exec"
                  or "eval"

        Return value / exceptions raised:

        - Return a code object if the command is complete and valid
        - Return None if the command is incomplete
        - Raise SyntaxError, ValueError or OverflowError if the command is a
          syntax error (OverflowError and ValueError can be produced by
          malformed literals).

DATA
    __all__ = ['compile_command', 'Compile', 'CommandCompiler']

FILE
    /usr/lib/python3.10/codeop.py



Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:13 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!

^_back to top