Skip to content

Commit

Permalink
Removes inputRef / bookmark params from appendRecord (#3597)
Browse files Browse the repository at this point in the history
* Working on OPF model RST docstrings

* Updated snakecase opf_utils in RST docs

* Added RecordStreamIFace to RST cause OFP models need it

* Fully docced OPF Model

* Fully docced HTMPredictionModel

* Finished all OPF model docstrings

* Updated doc README

* Docced nupic.data.utils

* Docced RecordStream

* Docced stream reader

* Updated doc readme for nupic.data updates.

* Remove unused argument from appendRecord

* Fixed broken test after removing appendRecord param

* Missed a merge

* Fixing up links in RST docs

* Removed dangling references to inputRef / bookmark
  • Loading branch information
rhyolight authored May 9, 2017
1 parent 9690f5e commit e7cd8cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
11 changes: 3 additions & 8 deletions src/nupic/data/file_record_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def getNextRecord(self, useCache=True):
return record


def appendRecord(self, record, inputBookmark=None):
def appendRecord(self, record):
"""
Saves the record in the underlying csv file.
Expand Down Expand Up @@ -418,22 +418,17 @@ def appendRecord(self, record, inputBookmark=None):
self._recordCount += 1


def appendRecords(self, records, inputRef=None, progressCB=None):
def appendRecords(self, records, progressCB=None):
"""
Saves multiple records in the underlying storage.
:param records: array of records as in
:meth:`~.FileRecordStream.appendRecord`
:param inputRef: reference to the corresponding input (not applicable
in case of a file storage)
:param progressCB: (function) callback to report progress
"""

# input ref is not applicable in case of a file storage
inputRef = inputRef

for record in records:
self.appendRecord(record, None)
self.appendRecord(record)
if progressCB is not None:
progressCB()

Expand Down
13 changes: 7 additions & 6 deletions src/nupic/data/record_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,11 @@ def getAggregationMonthsAndSeconds(self):
If there is no aggregation associated with the stream, returns None.
Typically, a raw file or hbase stream will NOT have any aggregation info,
but subclasses of RecordStreamIface, like :class:`~nupic.data.StreamReader`,
will and will return the aggregation period from this call. This call is
used by the :meth:`getNextRecordDict` method to assign a record number to a
record given its timestamp and the aggregation interval
but subclasses of :class:`~nupic.data.record_stream.RecordStreamIface`, like
:class:`~nupic.data.stream_reader.StreamReader`, will and will return the
aggregation period from this call. This call is used by
:meth:`getNextRecordDict` to assign a record number to a record given its
timestamp and the aggregation interval.
:returns: ``None``
"""
Expand All @@ -303,7 +304,7 @@ def getNextRecordIdx(self):


@abstractmethod
def appendRecord(self, record, inputRef=None):
def appendRecord(self, record):
"""
Saves the record in the underlying storage. Should be implemented in
subclasses.
Expand All @@ -313,7 +314,7 @@ def appendRecord(self, record, inputRef=None):


@abstractmethod
def appendRecords(self, records, inputRef=None, progressCB=None):
def appendRecords(self, records, progressCB=None):
"""
Saves multiple records in the underlying storage. Should be implemented in
subclasses.
Expand Down
4 changes: 2 additions & 2 deletions src/nupic/data/stream_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ def getAggregationMonthsAndSeconds(self):
return self._aggMonthsAndSeconds


def appendRecord(self, record, inputRef=None):
def appendRecord(self, record):
raise RuntimeError("Not implemented in StreamReader")


def appendRecords(self, records, inputRef=None, progressCB=None):
def appendRecords(self, records, progressCB=None):
raise RuntimeError("Not implemented in StreamReader")


Expand Down

0 comments on commit e7cd8cb

Please sign in to comment.