# Path: rave/filesystem.py
# PATH_SEPARATOR = '/'
# ROOT = '/'
# BAD_PATH_PATTERN = re.compile(r'(?:{0}{{2,}}|(?:{0}|^)\.+(?:{0}|$))'.format(PATH_SEPARATOR))
# ENGINE_MOUNT = '/.rave'
# MODULE_MOUNT = '/.modules'
# GAME_MOUNT = '/'
# COMMON_MOUNT = '/.common'
# class FileSystemError(rave.common.raveError, IOError):
# class NativeError(FileSystemError):
# class FileNotFound(FileSystemError, FileNotFoundError):
# class AccessDenied(FileSystemError, PermissionError):
# class FileNotReadable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileNotWritable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileNotSeekable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileClosed(FileSystemError, BrokenPipeError):
# class NotAFile(FileSystemError, IsADirectoryError):
# class NotADirectory(FileSystemError, NotADirectoryError):
# class FileSystem:
# class File(io.IOBase):
# class FileSystemProvider:
#     def __init__(self, filename, message=None):
#     def __init__(self, filename, parent):
#     def __init__(self):
#     def __repr__(self):
#     def clear(self):
#     def _build_cache(self):
#     def _build_provider_cache(self, provider, root):
#     def _build_transformer_cache(self, transformer, pattern):
#     def _cache_directory(self, provider, root, path):
#     def _cache_file(self, provider, root, path):
#     def _cache_entry(self, provider, root, path):
#     def _cache_transformed_file(self, transformer, path, handle):
#     def _providers_for_file(self, path):
#     def _local_file(self, root, path):
#     def list(self, subdir=None):
#     def listdir(self, subdir=None):
#     def mount(self, path, provider):
#     def unmount(self, path, provider):
#     def transform(self, pattern, transformer):
#     def untransform(self, pattern, transformer):
#     def open(self, filename, *args, **kwargs):
#     def exists(self, filename):
#     def isdir(self, filename):
#     def isfile(self, filename):
#     def dirname(self, path):
#     def basename(self, path):
#     def join(self, *paths, normalized=True):
#     def split(self, path, *args, **kwargs):
#     def normalize(self, path):
#     def __del__(self):
#     def close(self):
#     def opened(self):
#     def readable(self):
#     def writable(self):
#     def seekable(self):
#     def read(self, amount=None):
#     def write(self, data):
#     def seek(self, position, mode=os.SEEK_CUR):
#     def tell(self):
#     def __init__(self, fs):
#     def __repr__(self):
#     def list(self):
#     def open(self, filename, *args, **kwargs):
#     def has(self, filename):
#     def isfile(self, filename):
#     def isdir(self, filename):
# def current():
# def list(subdir=None):
# def listdir(subdir=None):
# def mount(path, provider):
# def unmount(path, provider):
# def transform(pattern, transformer):
# def untransform(pattern, transformer):
# def open(filename, *args, **kwargs):
# def exists(filename):
# def isfile(filename):
# def isdir(filename):
# def dirname(path):
# def basename(path):
# def join(*paths, normalized=True):
# def split(path, *args, **kwargs):
# def normalize(path):


import os
import codecs
from io import StringIO
from pytest import fixture
from rave import filesystem
    def __init__(self, parent, filename, content='merry saltmas'):
        self.parent = parent
        self.filename = filename
        self._buffer = StringIO(content)
        self._closed = False

    def close(self):
        if self._closed:
            raise filesystem.FileClosed(self.filename)
        self._closed = True

    def opened(self):
        return not self._closed

    def readable(self):
        return True

    def writable(self):
        return True

    def seekable(self):
        return True

    def read(self, amount=None):
        if self.closed:
            raise filesystem.FileClosed(self.filename)
        return self._buffer.read(amount)

    def write(self, buffer):
        if self.closed:

# Path: rave/filesystem.py
# PATH_SEPARATOR = '/'
# ROOT = '/'
# BAD_PATH_PATTERN = re.compile(r'(?:{0}{{2,}}|(?:{0}|^)\.+(?:{0}|$))'.format(PATH_SEPARATOR))
# ENGINE_MOUNT = '/.rave'
# MODULE_MOUNT = '/.modules'
# GAME_MOUNT = '/'
# COMMON_MOUNT = '/.common'
# class FileSystemError(rave.common.raveError, IOError):
# class NativeError(FileSystemError):
# class FileNotFound(FileSystemError, FileNotFoundError):
# class AccessDenied(FileSystemError, PermissionError):
# class FileNotReadable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileNotWritable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileNotSeekable(FileSystemError, PermissionError, io.UnsupportedOperation):
# class FileClosed(FileSystemError, BrokenPipeError):
# class NotAFile(FileSystemError, IsADirectoryError):
# class NotADirectory(FileSystemError, NotADirectoryError):
# class FileSystem:
# class File(io.IOBase):
# class FileSystemProvider:
#     def __init__(self, filename, message=None):
#     def __init__(self, filename, parent):
#     def __init__(self):
#     def __repr__(self):
#     def clear(self):
#     def _build_cache(self):
#     def _build_provider_cache(self, provider, root):
#     def _build_transformer_cache(self, transformer, pattern):
#     def _cache_directory(self, provider, root, path):
#     def _cache_file(self, provider, root, path):
#     def _cache_entry(self, provider, root, path):
#     def _cache_transformed_file(self, transformer, path, handle):
#     def _providers_for_file(self, path):
#     def _local_file(self, root, path):
#     def list(self, subdir=None):
#     def listdir(self, subdir=None):
#     def mount(self, path, provider):
#     def unmount(self, path, provider):
#     def transform(self, pattern, transformer):
#     def untransform(self, pattern, transformer):
#     def open(self, filename, *args, **kwargs):
#     def exists(self, filename):
#     def isdir(self, filename):
#     def isfile(self, filename):
#     def dirname(self, path):
#     def basename(self, path):
#     def join(self, *paths, normalized=True):
#     def split(self, path, *args, **kwargs):
#     def normalize(self, path):
#     def __del__(self):
#     def close(self):
#     def opened(self):
#     def readable(self):
#     def writable(self):
#     def seekable(self):
#     def read(self, amount=None):
#     def write(self, data):
#     def seek(self, position, mode=os.SEEK_CUR):
#     def tell(self):
#     def __init__(self, fs):
#     def __repr__(self):
#     def list(self):
#     def open(self, filename, *args, **kwargs):
#     def has(self, filename):
#     def isfile(self, filename):
#     def isdir(self, filename):
# def current():
# def list(subdir=None):
# def listdir(subdir=None):
# def mount(path, provider):
# def unmount(path, provider):
# def transform(pattern, transformer):
# def untransform(pattern, transformer):
# def open(filename, *args, **kwargs):
# def exists(filename):
# def isfile(filename):
# def isdir(filename):
# def dirname(path):
# def basename(path):
# def join(*paths, normalized=True):
# def split(path, *args, **kwargs):
# def normalize(path):


# Path: tests/support/filesystem.py
import os
import codecs
from io import StringIO
from pytest import fixture
from rave import filesystem

    def __init__(self, parent, filename, content='merry saltmas'):
        self.parent = parent
        self.filename = filename
        self._buffer = StringIO(content)
        self._closed = False

    def close(self):
        if self._closed:
            raise filesystem.FileClosed(self.filename)
        self._closed = True

    def opened(self):
        return not self._closed

    def readable(self):
        return True

    def writable(self):
        return True

    def seekable(self):
        return True

    def read(self, amount=None):
        if self.closed:
            raise filesystem.FileClosed(self.filename)
        return self._buffer.read(amount)

    def write(self, buffer):
        if self.closed:

            raise filesystem.FileClosed(self.filename)