Darktable2Piwigo
Loading...
Searching...
No Matches
transformer_base.TransformerBase Class Reference
Inheritance diagram for transformer_base.TransformerBase:
Inheritance graph
Collaboration diagram for transformer_base.TransformerBase:
Collaboration graph

Public Member Functions

None __init__ (self)
 

Static Public Member Functions

DataFrame calculate_hash (DataFrame df, list[str] hash_columns, str hash_name="hash")
 

Public Attributes

 transform
 
 transform_fastapi
 
 time_origin
 

Protected Member Functions

Callable[[Arg(DataFrame, "df"), KwArg(Any)], Union[DataFrame, List[Dict[Hashable, Any]]]] _create_transform_func (self, bool fastapi_output)
 
Union[DataFrame, List[Dict[Hashable, Any]]] _transform (self, DataFrame df, bool fastapi_output, **kwargs)
 

Static Protected Member Functions

str _hash (list[str] x)
 

Detailed Description

Implements the transformer base class, including the calculate_hash method

Constructor & Destructor Documentation

◆ __init__()

None transformer_base.TransformerBase.__init__ (   self)

Member Function Documentation

◆ _create_transform_func()

Callable[ [Arg(DataFrame, "df"), KwArg(Any)], Union[DataFrame, List[Dict[Hashable, Any]]] ] transformer_base.TransformerBase._create_transform_func (   self,
bool   fastapi_output 
)
protected
Creates a function that wraps the `_transform` method and returns a function
with the correct signature.

:param fastapi_output: Whether the output should be formatted for FastAPI
:return: A function that takes a DataFrame and keyword arguments and returns
    either a DataFrame or a list of dictionaries.

◆ _hash()

str transformer_base.TransformerBase._hash ( list[str]  x)
staticprotected
Hashes a list of strings using the MD5 algorithm. The MD5 algorithm
takes a list of strings and generates a 128-bit hash value. The hash
value is then converted to a hexadecimal string and returned.

:param x: The list of strings to be hashed
:return: The hash value as a hexadecimal string

◆ _transform()

Union[DataFrame, List[Dict[Hashable, Any]]] transformer_base.TransformerBase._transform (   self,
DataFrame  df,
bool  fastapi_output,
**  kwargs 
)
protected
Implements the transform method

◆ calculate_hash()

DataFrame transformer_base.TransformerBase.calculate_hash ( DataFrame  df,
list[str]  hash_columns,
str   hash_name = "hash" 
)
static
Calculates a hash value from the given list of input columns.

The hash value is calculated using the MD5 algorithm. The MD5 algorithm
takes a list of strings and generates a 128-bit hash value. The hash
value is then converted to a hexadecimal string.

:param df: The DataFrame to be transformed
:param hash_columns: The list of columns to be used for hashing
:param hash_name: The name of the column to store the hash value
:return: The DataFrame with the hash value added

Member Data Documentation

◆ time_origin

transformer_base.TransformerBase.time_origin

◆ transform

transformer_base.TransformerBase.transform

◆ transform_fastapi

transformer_base.TransformerBase.transform_fastapi

The documentation for this class was generated from the following file: