🔨 shift NamedContent to plugin interface

This commit is contained in:
chfw 2020-10-06 23:12:24 +01:00
parent a923bce3be
commit c684c08efa
4 changed files with 13 additions and 12 deletions

View File

@ -1,7 +1,7 @@
Extend pyexcel-io Tutorial
================================================================================
You are welcome toextend pyexcel-io to read and write more tabular formats.
You are welcome to extend pyexcel-io to read and write more tabular formats.
No. 1 rule, your plugin must have a prefix 'pyexcel_' in its module path.
For example, `pyexcel-xls` has 'pyexcel_xls' as its module path. Otherwise,
pyexcel-io will not load your plugin.

View File

@ -1,3 +1,3 @@
from .abstract_sheet import ISheet, ISheetWriter # noqa: F401
from .abstract_sheet import ISheet, ISheetWriter, NamedContent # noqa: F401
from .abstract_reader import IReader # noqa: F401
from .abstract_writer import IWriter # noqa: F401

View File

@ -19,3 +19,13 @@ class ISheetWriter(object):
def close(self):
raise NotImplementedError("How would you close your file")
class NamedContent(object):
"""
Helper class for content that does not have a name
"""
def __init__(self, name, payload):
self.name = name
self.payload = payload

View File

@ -10,16 +10,7 @@
import pyexcel_io.constants as constants
from pyexcel_io.utils import _index_filter
from pyexcel_io._compact import irange
class NamedContent(object):
"""
Helper class for content that does not have a name
"""
def __init__(self, name, payload):
self.name = name
self.payload = payload
from pyexcel_io.plugin_api import NamedContent # noqa: F401
class SheetReader(object):