segadb.record

# Imports: Standard Library

 
Modules
       
PIL.Image
base64
io
math

 
Classes
       
builtins.object
Record
EncryptedRecord
ImageRecord
TextRecord
TimeSeriesRecord
VectorRecord

 
class EncryptedRecord(Record)
    EncryptedRecord(record_id, data)
 

 
 
Method resolution order:
EncryptedRecord
Record
builtins.object

Methods defined here:
__init__(self, record_id, data)
Initializes a new instance of the EncryptedRecord class.
Args:
    record_id (int): The unique identifier for the record.
    data (str): The data associated with the record. Must contain a 'data' and 'key' field.
decrypt(self, key)
Decrypts the data using the encryption key.
Args:
    key (str): The key used for decryption
Returns:
    str: The decrypted data.

Methods inherited from Record:
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties inherited from Record:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors inherited from Record:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class ImageRecord(Record)
    ImageRecord(record_id, image_path)
 

 
 
Method resolution order:
ImageRecord
Record
builtins.object

Methods defined here:
__init__(self, record_id, image_path)
Initializes a new instance of the ImageRecord class.
Args:
    record_id (int): The unique identifier for the record.
    image_path (str): The file path to the image.
get_image(self)
Converts the image data to a PIL Image object.
Returns:
    Image: The PIL Image object.
resize(self, percentage)
Resizes the image by a given percentage.
Args:
    percentage (float): The percentage to increase or decrease the size of the image.
Returns:
    Image: The resized PIL Image object.
to_dict(self)
Converts the ImageRecord to a dictionary, encoding image data to base64.
Returns:
    dict: The dictionary representation of the ImageRecord.

Readonly properties defined here:
image_data
image_path
image_size
Returns the size of the image in bytes.

Methods inherited from Record:
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties inherited from Record:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors inherited from Record:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class Record(builtins.object)
    Record(record_id, data)
 

 
  Methods defined here:
__init__(self, record_id, data)
Initializes a new instance of the class.
Args:
    record_id (int): The unique identifier for the record.
    data (dict): The data associated with the record.
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties defined here:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class TextRecord(Record)
    TextRecord(record_id, text)
 

 
 
Method resolution order:
TextRecord
Record
builtins.object

Methods defined here:
__init__(self, record_id, text)
Initializes a new instance of the TextRecord class.
Args:
    record_id (int): The unique identifier for the record.
    text (str): The text data associated with the record.
to_lowercase(self)
Converts the text to lowercase.
Returns:
    str: The text in lowercase.
to_uppercase(self)
Converts the text to uppercase.
Returns:
    str: The text in uppercase.
word_count(self)
Counts the number of words in the text.
Returns:
    int: The number of words in the text.

Readonly properties defined here:
text

Methods inherited from Record:
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties inherited from Record:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors inherited from Record:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class TimeSeriesRecord(Record)
    TimeSeriesRecord(record_id, time_series)
 

 
 
Method resolution order:
TimeSeriesRecord
Record
builtins.object

Methods defined here:
__init__(self, record_id, time_series)
Initializes a new instance of the class.
Args:
    record_id (int): The unique identifier for the record.
    data (dict): The data associated with the record.
moving_average(self, window_size)
Calculates the moving average of the time series.
Args:
    window_size (int): The window size for the moving average.
Returns:
    list: The moving average of the time series.

Readonly properties defined here:
time_series

Methods inherited from Record:
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties inherited from Record:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors inherited from Record:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class VectorRecord(Record)
    VectorRecord(record_id, vector)
 

 
 
Method resolution order:
VectorRecord
Record
builtins.object

Methods defined here:
__init__(self, record_id, vector)
Initializes a new instance of the VectorRecord class.
Args:
    record_id (int): The unique identifier for the record.
    vector (list): The vector data associated with the record.
dot_product(self, other_vector)
Calculates the dot product with another vector.
Args:
    other_vector (list): The other vector to calculate the dot product with.
Returns:
    float: The dot product of the two vectors.
magnitude(self)
Calculates the magnitude of the vector.
Returns:
    float: The magnitude of the vector.
normalize(self)
Normalizes the vector.
Returns:
    list: The normalized vector.

Readonly properties defined here:
vector

Methods inherited from Record:
add_to_index(self, key)
remove_from_index(self, key)

Readonly properties inherited from Record:
index
Returns the index of the record. 
@property decorator is used to make the method behave like an attribute. (Read-only)

Data descriptors inherited from Record:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object