graviti.utility.common
#
Common tools.
Module Contents#
Classes#
Raise import PIL error for data loader. |
Functions#
|
Normalized the input url by removing the trailing slash. |
|
The decorator to add threading lock for methods. |
|
Return the first 7 characters of the original string. |
|
Convert iso 8601 format string to datetime format time with local timezone. |
|
Convert datetime to gmt format string. |
Attributes#
- graviti.utility.common.urlnorm(url)[source]#
Normalized the input url by removing the trailing slash.
- Parameters
url (str) – the url needs to be normalized.
- Returns
The normalized url.
- Return type
str
- graviti.utility.common.locked(func)[source]#
The decorator to add threading lock for methods.
- Parameters
func (_CallableWithoutReturnValue) – The method needs to add threading lock.
- Returns
The method with theading locked.
- Return type
_CallableWithoutReturnValue
- graviti.utility.common.shorten(origin)[source]#
Return the first 7 characters of the original string.
- Parameters
origin (str) – The string needed to be shortened.
- Returns
A string of length 7.
- Return type
str
- graviti.utility.common.convert_iso_to_datetime(date_string)[source]#
Convert iso 8601 format string to datetime format time with local timezone.
- Parameters
date_string (str) – The iso 8601 format string.
- Returns
The datetime format time with local timezone.
- Return type
datetime.datetime