DiskHistory¶
-
class
bruty.history.DiskHistory(data_class, data_path, prefix='', postfix='')¶ Bases:
bruty.history.HistoryStore ‘data_class’ objects to disk located at ‘data_path’ and allow access to them like a list.

Attributes Summary
Gets the pattern to use to find valid files inside the self.data_path directory.
Methods Summary
append(value)S.append(value) – append value to the end of the sequence
clear()count(value)current()Gets the current object at the top of the stack (i.e.
Finds all the files in the data_path directory that would match the naming convention
extend(values)S.extend(iterable) – extend sequence by appending elements from the iterable
filename_from_index(key)Create a filename based on the number ‘key’
index(value, [start, [stop]])Raises ValueError if the value is not present.
insert(key, value)Insert an instance into the list of data_class objects.
pop([index])Raise IndexError if list is empty or index is out of range.
remove(value)S.remove(value) – remove first occurrence of value.
reverse()S.reverse() – reverse IN PLACE
set_metadata(meta)Attributes Documentation
-
filename_pattern¶ Gets the pattern to use to find valid files inside the self.data_path directory.
- Returns
- Return type
string to use with regular expression search
-
id¶
Methods Documentation
-
append(value)¶ S.append(value) – append value to the end of the sequence
-
clear() → None – remove all items from S¶
-
count(value) → integer – return number of occurrences of value¶
-
current()¶ Gets the current object at the top of the stack (i.e. index [-1] :returns: :rtype: Object at the last position
-
data_files()¶ Finds all the files in the data_path directory that would match the naming convention
- Returns
- Return type
list of string filepaths
-
extend(values)¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
filename_from_index(key)¶ Create a filename based on the number ‘key’
- Parameters
key – integer to use to make the file name
- Returns
- Return type
string of the full path to the file
-
get_metadata()¶
-
index(value[, start[, stop]]) → integer – return first index of value.¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
insert(key, value)¶ Insert an instance into the list of data_class objects. This will rename the existing files and then create a new file at the desired index.
- Parameters
key – position in the list to insert at
value – instance to put into the list.
- Returns
- Return type
None
-
pop([index]) → item – remove and return item at index (default last).¶ Raise IndexError if list is empty or index is out of range.
-
remove(value)¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
reverse()¶ S.reverse() – reverse IN PLACE
- Return type
None
-
set_metadata(meta)¶
-
__init__(data_class, data_path, prefix='', postfix='')¶ Setup to store data_class objects to disk using the prefix and postfix in the filenames and store them under the directory ‘data_path’. Files will be named something like <prefix>_0001_<postfix>.tif
- Parameters
data_class – Type of data to store, probably RasterData.
data_path – Location to store files. Files will be named numerically.
prefix – prefix the data files stored under data_path.
postfix – postfix for the files storyed under data_path.
-