Hive.decorators
chunks(lst, n)
metodo per suddividere una lista madre in una nuova lista composta di sotto liste piu piccole
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lst |
list
|
lista da suddividere |
required |
n |
int
|
numero di componenti dentro ogni sotto suddivisione |
required |
Returns:
Name | Type | Description |
---|---|---|
chunked_list |
list[list]
|
lista di liste, ogni elemento e' una lista con il numero di oggetti indicati provenienti dalla lista madre |
Source code in hive/decorators.py
warmstart(func=None, active=True, args_ex=None, kwargs_ex=None, verbose=False)
decoratore che permette di scaricare in locale il risutato di una funzione o metodo e se ne gli argomenti ne il corpo della funzione cambiano vengono restituiti i risultati locali invece di calcolare la funzione. Se ci sono argomenti della funzione chiamata che cambiano ad ogni run ma non modificano il risultato, questi argomenti possono essere esclusi con i parametri args_ex e kwargs_ex.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
waste key, it is not to be filled |
None
|
|
active |
bool
|
if False the decorator does nothing, Default to True |
True
|
args_ex |
list
|
list of indexes of the function *args to be excluded for the evaluation of the rerun. Default to None. |
None
|
kwargs_ex |
list
|
list of keys of the function **kwargs to be excluded for the evaluation of the rerun. Default to None. |
None
|
verbose |
bool
|
if True print the status of the warm_start. Default to False |
False
|
Returns: func result
Source code in hive/decorators.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|