pygame / msysio.py

Lenard Lindstrom 8a7d9b2 








Lenard Lindstrom 50193a7 







Lenard Lindstrom ebd5456 
Lenard Lindstrom 50193a7 
Lenard Lindstrom ebd5456 
Lenard Lindstrom 50193a7 





illume 9f910ed 
Lenard Lindstrom 50193a7 
illume 9f910ed 
Lenard Lindstrom 8a7d9b2 






























Lenard Lindstrom 32f4900 

Lenard Lindstrom 8a7d9b2 
Lenard Lindstrom ebd5456 
# module msysio.py
# Requires Python 2.2 or better.

"""Provide helpful routines for interactive IO on the MSYS console"""

# Output needs to be flushed to be seen. It is especially important
# when prompting for user input.

import sys
import os

__all__ = ['raw_input_', 'print_', 'is_msys']

# 2.x/3.x compatibility stuff
try:
    raw_input
except NameError:
    raw_input = input

# Exported functions
__all__ = ['raw_input_', 'print_', 'is_msys']

# 2.x/3.x compatibility stuff
try:
    raw_input
except NameError:
    raw_input = input

# Exported functions
def raw_input_(prompt=None):
    """Prompt for user input in an MSYS console friendly way"""
    if prompt is None:
        prompt = ''
    print_(prompt, end='')
    return raw_input()

def print_(*args, **kwds):
    """Print arguments in an MSYS console friendly way

    Keyword arguments:
        file, sep, end
    """

    stream = kwds.get('file', sys.stdout)
    sep = kwds.get('sep', ' ')
    end = kwds.get('end', '\n')

    if args:
        stream.write(sep.join([str(arg) for arg in args]))
    if end:
        stream.write(end)
    try:
        stream.flush()
    except AttributeError:
        pass

def is_msys():
    """Return true if the execution environment is MSYS"""

    try:
        # Unfortunately there is no longer an MSYS specific identifier.
        return os.environ['TERM'] == 'cygwin'
    except KeyError:
        return False
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.