Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(63)  |  Call(54)  |  Derive(0)  |  Import(9)
class StringIO([buffer])

When a StringIO object is created, it can be initialized to an existing
string by passing the string to the constructor. If no string is given,
the StringIO will start empty.

The StringIO object can accept either Unicode or 8-bit strings, but
mixing the two may take some care. If both are used, 8-bit strings that
cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause
a UnicodeError to be raised when getvalue() is called.

src/f/j/fjord-HEAD/vendor/packages/Babel/tests/messages/test_pofile.py   fjord(Download)
from babel.messages import pofile
from babel.util import FixedOffsetTimezone
from babel._compat import StringIO, BytesIO
 
 
class ReadPoTestCase(unittest.TestCase):
 
    def test_preserve_locale(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
    def test_preserve_domain(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
        catalog = pofile.read_po(buf, domain='mydomain')
        self.assertEqual('mydomain', catalog.domain)
" throw us into an infinite "
"loop\n"
msgstr ""''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(catalog))
#
#, fuzzy
''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(list(catalog)))

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/tests/messages/test_pofile.py   ZenPacks.zenoss.OpenStack(Download)
from babel.messages import pofile
from babel.util import FixedOffsetTimezone
from babel._compat import StringIO, BytesIO
 
 
class ReadPoTestCase(unittest.TestCase):
 
    def test_preserve_locale(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
    def test_preserve_domain(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
        catalog = pofile.read_po(buf, domain='mydomain')
        self.assertEqual('mydomain', catalog.domain)
" throw us into an infinite "
"loop\n"
msgstr ""''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(catalog))
#
#, fuzzy
''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(list(catalog)))

src/b/a/Babel-1.3/tests/messages/test_pofile.py   Babel(Download)
from babel.messages import pofile
from babel.util import FixedOffsetTimezone
from babel._compat import StringIO, BytesIO
 
 
class ReadPoTestCase(unittest.TestCase):
 
    def test_preserve_locale(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
    def test_preserve_domain(self):
        buf = StringIO(r'''msgid "foo"
msgstr "Voh"''')
        catalog = pofile.read_po(buf, domain='mydomain')
        self.assertEqual('mydomain', catalog.domain)
" throw us into an infinite "
"loop\n"
msgstr ""''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(catalog))
#
#, fuzzy
''')
        catalog = pofile.read_po(buf)
        self.assertEqual(1, len(list(catalog)))

src/f/j/fjord-HEAD/vendor/packages/Babel/tests/messages/test_frontend.py   fjord(Download)
from babel.util import LOCALTZ
from babel.messages.pofile import read_po
from babel._compat import StringIO
 
 
        self.orig_stderr = sys.stderr
        sys.argv = ['pybabel']
        sys.stdout = StringIO()
        sys.stderr = StringIO()
        os.chdir(self.datadir)
    def test_frontend_can_log_to_predefined_handler(self):
        custom_stream = StringIO()
        log = logging.getLogger('babel')
        log.addHandler(logging.StreamHandler(custom_stream))
 
def test_parse_mapping():
    buf = StringIO(
        '[extractors]\n'
        'custom = mypackage.module:myfunc\n'
        '\n'

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/tests/messages/test_frontend.py   ZenPacks.zenoss.OpenStack(Download)
from babel.util import LOCALTZ
from babel.messages.pofile import read_po
from babel._compat import StringIO
 
 
        self.orig_stderr = sys.stderr
        sys.argv = ['pybabel']
        sys.stdout = StringIO()
        sys.stderr = StringIO()
        os.chdir(self.datadir)
    def test_frontend_can_log_to_predefined_handler(self):
        custom_stream = StringIO()
        log = logging.getLogger('babel')
        log.addHandler(logging.StreamHandler(custom_stream))
 
def test_parse_mapping():
    buf = StringIO(
        '[extractors]\n'
        'custom = mypackage.module:myfunc\n'
        '\n'

src/b/a/Babel-1.3/tests/messages/test_frontend.py   Babel(Download)
from babel.util import LOCALTZ
from babel.messages.pofile import read_po
from babel._compat import StringIO
 
 
        self.orig_stderr = sys.stderr
        sys.argv = ['pybabel']
        sys.stdout = StringIO()
        sys.stderr = StringIO()
        os.chdir(self.datadir)
    def test_frontend_can_log_to_predefined_handler(self):
        custom_stream = StringIO()
        log = logging.getLogger('babel')
        log.addHandler(logging.StreamHandler(custom_stream))
 
def test_parse_mapping():
    buf = StringIO(
        '[extractors]\n'
        'custom = mypackage.module:myfunc\n'
        '\n'

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/tests/messages/test_extract.py   ZenPacks.zenoss.OpenStack(Download)
 
from babel.messages import extract
from babel._compat import BytesIO, StringIO
 
 
""")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try:
            messages = \
    def test_warn_if_empty_string_msgid_found_in_context_aware_extraction_method(self):
        buf = BytesIO(b"\nmsg = pgettext('ctxt', '')\n")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try:

src/f/j/fjord-HEAD/vendor/packages/Babel/tests/messages/test_extract.py   fjord(Download)
 
from babel.messages import extract
from babel._compat import BytesIO, StringIO
 
 
""")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try:
            messages = \
    def test_warn_if_empty_string_msgid_found_in_context_aware_extraction_method(self):
        buf = BytesIO(b"\nmsg = pgettext('ctxt', '')\n")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try:

src/b/a/Babel-1.3/tests/messages/test_extract.py   Babel(Download)
 
from babel.messages import extract
from babel._compat import BytesIO, StringIO
 
 
""")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try:
            messages = \
    def test_warn_if_empty_string_msgid_found_in_context_aware_extraction_method(self):
        buf = BytesIO(b"\nmsg = pgettext('ctxt', '')\n")
        stderr = sys.stderr
        sys.stderr = StringIO()
        try: