# Path: airy/utils/encoding.py
# def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a bytestring version of 's', encoded as specified in 'encoding'.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if strings_only and isinstance(s, (types.NoneType, int)):
#         return s
#     if isinstance(s, Promise):
#         return unicode(s).encode(encoding, errors)
#     elif not isinstance(s, basestring):
#         try:
#             return str(s)
#         except UnicodeEncodeError:
#             if isinstance(s, Exception):
#                 # An Exception subclass containing non-ASCII data that doesn't
#                 # know how to print itself properly. We shouldn't raise a
#                 # further exception.
#                 return ' '.join([smart_str(arg, encoding, strings_only,
#                         errors) for arg in s])
#             return unicode(s).encode(encoding, errors)
#     elif isinstance(s, unicode):
#         return s.encode(encoding, errors)
#     elif s and encoding != 'utf-8':
#         return s.decode('utf-8', errors).encode(encoding, errors)
#     else:
#         return s
# 
# def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a unicode object representing 's'. Treats bytestrings using the
#     'encoding' codec.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if isinstance(s, Promise):
#         # The input is the result of a gettext_lazy() call.
#         return s
#     return force_unicode(s, encoding, strings_only, errors)


import os
    from cStringIO import StringIO
    from StringIO import StringIO
from airy.utils.encoding import smart_str, smart_unicode
from airy.core.files.utils import FileProxyMixin
try:
except ImportError:


class File(FileProxyMixin):
    DEFAULT_CHUNK_SIZE = 64 * 2**10

    def __init__(self, file, name=None):
        self.file = file
        if name is None:
            name = getattr(file, 'name', None)

# Path: airy/utils/encoding.py
# def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a bytestring version of 's', encoded as specified in 'encoding'.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if strings_only and isinstance(s, (types.NoneType, int)):
#         return s
#     if isinstance(s, Promise):
#         return unicode(s).encode(encoding, errors)
#     elif not isinstance(s, basestring):
#         try:
#             return str(s)
#         except UnicodeEncodeError:
#             if isinstance(s, Exception):
#                 # An Exception subclass containing non-ASCII data that doesn't
#                 # know how to print itself properly. We shouldn't raise a
#                 # further exception.
#                 return ' '.join([smart_str(arg, encoding, strings_only,
#                         errors) for arg in s])
#             return unicode(s).encode(encoding, errors)
#     elif isinstance(s, unicode):
#         return s.encode(encoding, errors)
#     elif s and encoding != 'utf-8':
#         return s.decode('utf-8', errors).encode(encoding, errors)
#     else:
#         return s
# 
# def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a unicode object representing 's'. Treats bytestrings using the
#     'encoding' codec.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if isinstance(s, Promise):
#         # The input is the result of a gettext_lazy() call.
#         return s
#     return force_unicode(s, encoding, strings_only, errors)


# Path: airy/core/files/base.py
import os
    from cStringIO import StringIO
    from StringIO import StringIO
from airy.utils.encoding import smart_str, smart_unicode
from airy.core.files.utils import FileProxyMixin

try:
except ImportError:


class File(FileProxyMixin):
    DEFAULT_CHUNK_SIZE = 64 * 2**10

    def __init__(self, file, name=None):
        self.file = file
        if name is None:
            name = getattr(file, 'name', None)

        self.name = name