Skip to content

Commit

Permalink
Updated Loader/Parser API naming
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Dec 5, 2020
1 parent e38f31b commit a82a94e
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions frictionless/loader.py
Expand Up @@ -249,7 +249,7 @@ def write_byte_stream(self, path):
any: result of writing e.g. resulting path
"""
byte_stream = self.write_byte_stream_create(path)
result = self.write_byte_stream_record(byte_stream)
result = self.write_byte_stream_save(byte_stream)
return result

def write_byte_stream_create(self, path):
Expand All @@ -265,7 +265,7 @@ def write_byte_stream_create(self, path):
file = open(path, "rb")
return file

def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
"""Store byte stream"""
raise NotImplementedError()

Expand Down
4 changes: 2 additions & 2 deletions frictionless/parser.py
Expand Up @@ -143,13 +143,13 @@ def write_row_stream(self, read_row_stream):
read_row_stream (gen<Row[]>): row stream factory
"""
read_row_stream = self.write_row_stream_create(read_row_stream)
result = self.write_row_stream_record(read_row_stream)
result = self.write_row_stream_save(read_row_stream)
return result

def write_row_stream_create(self, read_row_stream):
return read_row_stream

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
raise NotImplementedError()


Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/aws.py
Expand Up @@ -109,7 +109,7 @@ def read_byte_stream_create(self):

# Write

def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
error = errors.Error(note="Writing to S3 is not supported")
raise FrictionlessException(error)

Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/bigquery.py
Expand Up @@ -155,7 +155,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
dialect = self.resource.dialect
schema = self.resource.schema
storage = BigqueryStorage(
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/ckan.py
Expand Up @@ -141,7 +141,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
dialect = self.resource.dialect
schema = self.resource.schema
storage = CkanStorage(
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/csv.py
Expand Up @@ -260,7 +260,7 @@ def read_data_stream_infer_dialect(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
options = {}
for name in vars(self.resource.dialect.to_python()):
value = getattr(self.resource.dialect, name, None)
Expand Down
4 changes: 2 additions & 2 deletions frictionless/plugins/excel.py
Expand Up @@ -263,7 +263,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
openpyxl = helpers.import_from_plugin("openpyxl", plugin="excel")
dialect = self.resource.dialect
helpers.ensure_dir(self.resource.source)
Expand Down Expand Up @@ -375,7 +375,7 @@ def type_value(ctype, value):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
xlwt = helpers.import_from_plugin("xlwt", plugin="excel")
dialect = self.resource.dialect
helpers.ensure_dir(self.resource.source)
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/filelike.py
Expand Up @@ -70,5 +70,5 @@ def read_byte_stream_create(self):

# Write

def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
return byte_stream
2 changes: 1 addition & 1 deletion frictionless/plugins/gsheet.py
Expand Up @@ -83,6 +83,6 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
error = errors.Error(note="Writing to Google Sheets is not supported")
raise FrictionlessException(error)
2 changes: 1 addition & 1 deletion frictionless/plugins/html.py
Expand Up @@ -145,7 +145,7 @@ def read_data_stream_create(self):

# NOTE: rebase on proper pyquery
# NOTE: take dialect into account
def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
html = "<html><body><table>\n"
for row in read_row_stream():
if row.row_number == 1:
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/inline.py
Expand Up @@ -178,7 +178,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
data = []
dialect = self.resource.dialect
for row in read_row_stream():
Expand Down
4 changes: 2 additions & 2 deletions frictionless/plugins/json.py
Expand Up @@ -172,7 +172,7 @@ def read_data_stream_create(self, dialect=None):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
data = []
dialect = self.resource.dialect
for row in read_row_stream():
Expand Down Expand Up @@ -225,7 +225,7 @@ def read_data_stream_create(self, dialect=None):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
jsonlines = helpers.import_from_plugin("jsonlines", plugin="json")
dialect = self.resource.dialect
with tempfile.NamedTemporaryFile(delete=False) as file:
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/multipart.py
Expand Up @@ -73,7 +73,7 @@ def read_byte_stream_create(self):
# Write

# TODO: review
def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
error = errors.Error(note="Writing to Multipart Target is not supported")
raise FrictionlessException(error)

Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/ods.py
Expand Up @@ -170,7 +170,7 @@ def type_value(cell):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
ezodf = helpers.import_from_plugin("ezodf", plugin="ods")
dialect = self.resource.dialect
helpers.ensure_dir(self.resource.source)
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/pandas.py
Expand Up @@ -96,7 +96,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
schema = self.resource.schema
storage = PandasStorage()
resource = Resource(name=self.resource.name, data=read_row_stream, schema=schema)
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/remote.py
Expand Up @@ -147,7 +147,7 @@ def read_byte_stream_create(self):

# Write

def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
error = errors.Error(note="Writing to Remote is not supported")
raise FrictionlessException(error)

Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/spss.py
Expand Up @@ -87,7 +87,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
name = os.path.basename(self.resource.path)
basepath = os.path.dirname(self.resource.path)
schema = self.resource.schema
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/sql.py
Expand Up @@ -142,7 +142,7 @@ def read_data_stream_create(self):

# Write

def write_row_stream_record(self, read_row_stream):
def write_row_stream_save(self, read_row_stream):
sa = helpers.import_from_plugin("sqlalchemy", plugin="sql")
engine = sa.create_engine(self.resource.source)
dialect = self.resource.dialect
Expand Down
2 changes: 1 addition & 1 deletion frictionless/plugins/text.py
Expand Up @@ -75,7 +75,7 @@ def read_byte_stream_create(self):

# Write

def write_byte_stream_record(self, byte_stream):
def write_byte_stream_save(self, byte_stream):
# TODO: review
error = errors.Error(note="Writing to Text is not supported")
raise FrictionlessException(error)

0 comments on commit a82a94e

Please sign in to comment.