diff --git a/pyexcel_io/_compact.py b/pyexcel_io/_compact.py index 1e0fa18..dd75146 100644 --- a/pyexcel_io/_compact.py +++ b/pyexcel_io/_compact.py @@ -27,7 +27,7 @@ PY2 = sys.version[0] == 2 def isstream(instance): - """ check if a instance is a stream """ + """check if a instance is a stream""" try: import mmap diff --git a/pyexcel_io/database/common.py b/pyexcel_io/database/common.py index f074609..1008c1b 100644 --- a/pyexcel_io/database/common.py +++ b/pyexcel_io/database/common.py @@ -10,7 +10,7 @@ class DjangoModelExportAdapter(object): - """ django export parameter holder """ + """django export parameter holder""" def __init__(self, model, export_columns=None): self.model = model @@ -18,19 +18,19 @@ class DjangoModelExportAdapter(object): @property def name(self): - """ get database table name """ + """get database table name""" return self.get_name() def get_name(self): - """ get database table name """ + """get database table name""" return self.model._meta.model_name class DjangoModelImportAdapter(DjangoModelExportAdapter): - """ parameter holder for django data import """ + """parameter holder for django data import""" class InOutParameter(object): - """ local class to manipulate variable io """ + """local class to manipulate variable io""" def __init__(self): self.output = None @@ -45,34 +45,34 @@ class DjangoModelImportAdapter(DjangoModelExportAdapter): @property def row_initializer(self): - """ contructor for a database table entry """ + """contructor for a database table entry""" return self._row_initializer.output @property def column_names(self): - """ the desginated database column names """ + """the desginated database column names""" return self._column_names.output @property def column_name_mapping_dict(self): - """ if not the same, a mapping dictionary is looked up""" + """if not the same, a mapping dictionary is looked up""" return self._column_name_mapping_dict.output @row_initializer.setter def row_initializer(self, a_function): - """ set the contructor """ + """set the contructor""" self._row_initializer.input = a_function self._process_parameters() @column_names.setter def column_names(self, column_names): - """ set the column names """ + """set the column names""" self._column_names.input = column_names self._process_parameters() @column_name_mapping_dict.setter def column_name_mapping_dict(self, mapping_dict): - """ set the mapping dict """ + """set the mapping dict""" self._column_name_mapping_dict.input = mapping_dict self._process_parameters() @@ -101,33 +101,33 @@ class DjangoModelImportAdapter(DjangoModelExportAdapter): class DjangoModelExporter(object): - """ public interface for django model export """ + """public interface for django model export""" def __init__(self): self.adapters = [] def append(self, import_adapter): - """ store model parameter for more than one model """ + """store model parameter for more than one model""" self.adapters.append(import_adapter) class DjangoModelImporter(object): - """ public interface for django model import """ + """public interface for django model import""" def __init__(self): self._adapters = {} def append(self, import_adapter): - """ store model parameter for more than one model """ + """store model parameter for more than one model""" self._adapters[import_adapter.get_name()] = import_adapter def get(self, name): - """ get a parameter out """ + """get a parameter out""" return self._adapters.get(name, None) class SQLTableExportAdapter(DjangoModelExportAdapter): - """ parameter holder for sql table data export """ + """parameter holder for sql table data export""" def __init__(self, model, export_columns=None): DjangoModelExportAdapter.__init__(self, model, export_columns) @@ -138,7 +138,7 @@ class SQLTableExportAdapter(DjangoModelExportAdapter): class SQLTableImportAdapter(DjangoModelImportAdapter): - """ parameter holder for sqlalchemy table import """ + """parameter holder for sqlalchemy table import""" def __init__(self, model): DjangoModelImportAdapter.__init__(self, model) @@ -149,7 +149,7 @@ class SQLTableImportAdapter(DjangoModelImportAdapter): class SQLTableExporter(DjangoModelExporter): - """ public interface for sql table export """ + """public interface for sql table export""" def __init__(self, session): DjangoModelExporter.__init__(self) @@ -157,7 +157,7 @@ class SQLTableExporter(DjangoModelExporter): class SQLTableImporter(DjangoModelImporter): - """ public interface to do data import via sqlalchemy """ + """public interface to do data import via sqlalchemy""" def __init__(self, session): DjangoModelImporter.__init__(self) diff --git a/pyexcel_io/database/exporters/django.py b/pyexcel_io/database/exporters/django.py index d642c5f..018481a 100644 --- a/pyexcel_io/database/exporters/django.py +++ b/pyexcel_io/database/exporters/django.py @@ -28,7 +28,7 @@ class DjangoModelReader(QuerysetsReader): class DjangoBookReader(IReader): - """ read django models """ + """read django models""" def __init__(self, exporter, _, **keywords): self.exporter = exporter diff --git a/pyexcel_io/database/exporters/sqlalchemy.py b/pyexcel_io/database/exporters/sqlalchemy.py index 1e084b8..dbdc4c7 100644 --- a/pyexcel_io/database/exporters/sqlalchemy.py +++ b/pyexcel_io/database/exporters/sqlalchemy.py @@ -32,7 +32,7 @@ class SQLTableReader(QuerysetsReader): class SQLBookReader(IReader): - """ read a table via sqlalchemy """ + """read a table via sqlalchemy""" def __init__(self, exporter, _, **keywords): self.__exporter = exporter diff --git a/pyexcel_io/database/importers/django.py b/pyexcel_io/database/importers/django.py index 49ee14c..1c30f3d 100644 --- a/pyexcel_io/database/importers/django.py +++ b/pyexcel_io/database/importers/django.py @@ -17,7 +17,7 @@ log = logging.getLogger(__name__) class DjangoModelWriter(ISheetWriter): - """ import data into a django model """ + """import data into a django model""" def __init__(self, importer, adapter, batch_size=None, bulk_save=True): self.batch_size = batch_size @@ -61,7 +61,7 @@ class DjangoModelWriter(ISheetWriter): class DjangoBookWriter(IWriter): - """ write data into django models """ + """write data into django models""" def __init__(self, exporter, _, **keywords): self.importer = exporter diff --git a/pyexcel_io/database/importers/sqlalchemy.py b/pyexcel_io/database/importers/sqlalchemy.py index cf2705a..2cb0c30 100644 --- a/pyexcel_io/database/importers/sqlalchemy.py +++ b/pyexcel_io/database/importers/sqlalchemy.py @@ -74,7 +74,7 @@ class SQLTableWriter(ISheetWriter): class SQLBookWriter(IWriter): - """ write data into database tables via sqlalchemy """ + """write data into database tables via sqlalchemy""" def __init__(self, file_content, _, auto_commit=True, **keywords): self.__importer = file_content diff --git a/pyexcel_io/database/querysets.py b/pyexcel_io/database/querysets.py index d30ae05..6dfc6dd 100644 --- a/pyexcel_io/database/querysets.py +++ b/pyexcel_io/database/querysets.py @@ -15,7 +15,7 @@ from pyexcel_io.plugin_api.abstract_sheet import ISheet class QuerysetsReader(ISheet): - """ turn querysets into an array """ + """turn querysets into an array""" def __init__(self, query_sets, column_names): self.name = DEFAULT_SHEET_NAME @@ -56,7 +56,7 @@ class QuerysetsReader(ISheet): def get_complex_attribute(row, attribute): - """ recursively get an attribute """ + """recursively get an attribute""" attributes = attribute.split("__") value = row try: @@ -68,7 +68,7 @@ def get_complex_attribute(row, attribute): def get_simple_attribute(row, attribute): - """ get dotted attribute """ + """get dotted attribute""" value = getattr(row, attribute) if isinstance(value, (datetime.date, datetime.time)): value = value.isoformat() diff --git a/pyexcel_io/plugins.py b/pyexcel_io/plugins.py index 7e6625a..2a6b12c 100644 --- a/pyexcel_io/plugins.py +++ b/pyexcel_io/plugins.py @@ -32,7 +32,7 @@ class IOPluginInfo(PluginInfo): class IOPluginInfoChain(PluginInfoChain): - """provide custom functions to add a reader and a writer """ + """provide custom functions to add a reader and a writer""" def add_a_reader( self, @@ -40,7 +40,7 @@ class IOPluginInfoChain(PluginInfoChain): file_types=None, stream_type=None, ): - """ add pyexcle-io reader plugin info """ + """add pyexcle-io reader plugin info""" a_plugin_info = IOPluginInfo( READER_PLUGIN, self._get_abs_path(relative_plugin_class_path), @@ -55,7 +55,7 @@ class IOPluginInfoChain(PluginInfoChain): file_types=None, stream_type=None, ): - """ add pyexcle-io writer plugin info """ + """add pyexcle-io writer plugin info""" a_plugin_info = IOPluginInfo( WRITER_PLUGIN, self._get_abs_path(relative_plugin_class_path), @@ -66,7 +66,7 @@ class IOPluginInfoChain(PluginInfoChain): class IOPluginInfoChainV2(PluginInfoChain): - """provide custom functions to add a reader and a writer """ + """provide custom functions to add a reader and a writer""" def add_a_reader( self, @@ -75,7 +75,7 @@ class IOPluginInfoChainV2(PluginInfoChain): file_types=None, stream_type=None, ): - """ add pyexcle-io reader plugin info """ + """add pyexcle-io reader plugin info""" a_plugin_info = IOPluginInfo( READER_PLUGIN_V2, self._get_abs_path(relative_plugin_class_path), @@ -95,7 +95,7 @@ class IOPluginInfoChainV2(PluginInfoChain): file_types=(), stream_type=None, ): - """ add pyexcle-io writer plugin info """ + """add pyexcle-io writer plugin info""" a_plugin_info = IOPluginInfo( WRITER_PLUGIN_V2, self._get_abs_path(relative_plugin_class_path), @@ -124,7 +124,7 @@ class IOManager(PluginManager): _do_additional_registration(plugin_info) def register_a_plugin(self, cls, plugin_info): - """ for dynamically loaded plugin """ + """for dynamically loaded plugin""" PluginManager.register_a_plugin(self, cls, plugin_info) _do_additional_registration(plugin_info) @@ -158,7 +158,7 @@ class IOManager(PluginManager): ) def get_all_formats(self): - """ return all supported formats """ + """return all supported formats""" all_formats = set( list(self.registry.keys()) + list(self.known_plugins.keys()) ) @@ -174,7 +174,7 @@ class NewIOManager(IOManager): _do_additional_registration_for_new_plugins(plugin_info) def register_a_plugin(self, cls, plugin_info): - """ for dynamically loaded plugin """ + """for dynamically loaded plugin""" PluginManager.register_a_plugin(self, cls, plugin_info) _do_additional_registration_for_new_plugins(plugin_info) @@ -206,7 +206,7 @@ class NewIOManager(IOManager): ) def get_all_formats(self): - """ return all supported formats """ + """return all supported formats""" all_formats = set( [x.split("-")[1] for x in self.registry.keys()] + list(self.known_plugins.keys()) diff --git a/pyexcel_io/readers/csv_sheet.py b/pyexcel_io/readers/csv_sheet.py index 8ab6608..bac6f95 100644 --- a/pyexcel_io/readers/csv_sheet.py +++ b/pyexcel_io/readers/csv_sheet.py @@ -93,7 +93,7 @@ class CSVMemoryMapIterator(object): class CSVSheetReader(ISheet): - """ generic csv file reader""" + """generic csv file reader""" def __init__( self, @@ -121,7 +121,7 @@ class CSVSheetReader(ISheet): self._keywords = keywords def get_file_handle(self): - """ return me unicde reader for csv """ + """return me unicde reader for csv""" raise NotImplementedError("Please implement get_file_handle()") def row_iterator(self): @@ -166,7 +166,7 @@ class CSVSheetReader(ISheet): class CSVFileReader(CSVSheetReader): - """ read csv from phyical file """ + """read csv from phyical file""" def get_file_handle(self): unicode_reader = open( @@ -176,7 +176,7 @@ class CSVFileReader(CSVSheetReader): class CSVinMemoryReader(CSVSheetReader): - """ read csv file from memory """ + """read csv file from memory""" def get_file_handle(self): if isinstance(self._native_sheet.payload, compact.BytesIO): diff --git a/pyexcel_io/utils.py b/pyexcel_io/utils.py index 65477a0..f9f7950 100644 --- a/pyexcel_io/utils.py +++ b/pyexcel_io/utils.py @@ -69,10 +69,10 @@ def is_empty_array(array): def swap_empty_string_for_none(array): - """ replace empty string fields with None """ + """replace empty string fields with None""" def swap(value): - """ change empty string to None """ + """change empty string to None""" if value == "": return None diff --git a/pyexcel_io/writers/csv_sheet.py b/pyexcel_io/writers/csv_sheet.py index 3c2185f..f82a67c 100644 --- a/pyexcel_io/writers/csv_sheet.py +++ b/pyexcel_io/writers/csv_sheet.py @@ -75,7 +75,7 @@ class CSVFileWriter(ISheetWriter): class CSVMemoryWriter(CSVFileWriter): - """ Write csv to a memory stream """ + """Write csv to a memory stream""" def get_writer(self): self.file_handle = self._native_book diff --git a/pyexcel_io/writers/csvz_sheet.py b/pyexcel_io/writers/csvz_sheet.py index 26685cd..05fd4fd 100644 --- a/pyexcel_io/writers/csvz_sheet.py +++ b/pyexcel_io/writers/csvz_sheet.py @@ -14,7 +14,7 @@ from pyexcel_io.writers.csv_sheet import CSVFileWriter class CSVZipSheetWriter(CSVFileWriter): - """ handle the zipfile interface """ + """handle the zipfile interface""" def __init__(self, zipfile, sheetname, file_extension, **keywords): self.file_extension = file_extension