Exemple #1
0
import types
import traceback
import itertools
import inspect
from functools import wraps

from future.builtins import zip

from ._exception import DuplicateRegistrationError, InvalidRegistrationError
from . import (UnrecognizedFormatError, ArgumentOverrideWarning,
               FormatIdentificationWarning)
from .util import _resolve_file, open_file, open_files, _d as _open_kwargs
from skbio.util._misc import make_sentinel, find_sentinels
from skbio.util._decorator import stable, classonlymethod

FileSentinel = make_sentinel("FileSentinel")


class IORegistry(object):
    """Create a registry of formats and implementations which map to classes.

    """
    @stable(as_of="0.4.0")
    def __init__(self):
        # This seperation of binary and text formats is useful because there
        # are many situations where we may have recieved a text-file. When this
        # happens, the binary data fundamentally does not exist. We could
        # assume encoding should be interpreted in reverse, however this misses
        # the bigger point: why would the user ever want text to be treated as
        # binary? They already went through the effort to hand us text.
        # Therefore, during format resolution, we should skip the binary
Exemple #2
0
import types
import traceback
import itertools
import inspect
from functools import wraps

from future.builtins import zip

from ._exception import DuplicateRegistrationError, InvalidRegistrationError
from . import (UnrecognizedFormatError, ArgumentOverrideWarning,
               FormatIdentificationWarning)
from .util import _resolve_file, open_file, open_files, _d as _open_kwargs
from skbio.util._misc import make_sentinel, find_sentinels
from skbio.util._decorator import stable, classonlymethod

FileSentinel = make_sentinel("FileSentinel")


class IORegistry(object):
    """Create a registry of formats and implementations which map to classes.

    """

    @stable(as_of="0.4.0")
    def __init__(self):
        # This seperation of binary and text formats is useful because there
        # are many situations where we may have recieved a text-file. When this
        # happens, the binary data fundamentally does not exist. We could
        # assume encoding should be interpreted in reverse, however this misses
        # the bigger point: why would the user ever want text to be treated as
        # binary? They already went through the effort to hand us text.