bblocks.import_tools.common =========================== .. py:module:: bblocks.import_tools.common Classes ------- .. autoapisummary:: bblocks.import_tools.common.ImportData Functions --------- .. autoapisummary:: bblocks.import_tools.common.append_new_data bblocks.import_tools.common.get_response bblocks.import_tools.common.unzip Module Contents --------------- .. py:class:: ImportData Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: _data :type: dict[str, pandas.DataFrame] .. py:attribute:: _raw_data :type: pandas.DataFrame | None :value: None .. py:method:: load_data(**kwargs) -> ImportData :abstractmethod: Load the _data saved on disk .. py:method:: update_data(**kwargs) -> ImportData :abstractmethod: Update object _data .. py:method:: get_data(indicators: str | list = 'all', **kwargs) -> pandas.DataFrame Get the _data as a Pandas DataFrame .. py:function:: append_new_data(new_data: pandas.DataFrame, existing_data_path: str | pathlib.Path, parse_dates: list[str] | None) -> pandas.DataFrame Append new _data to an existing dataframe .. py:function:: get_response(url: str) -> requests.Response Get the response from a url This function is used to get the response from a url. It will raise an error if the url is invalid or if the response is not 200. :param url: url to get the response from :returns: response from the url .. py:function:: unzip(file: str | io.BytesIO) -> zipfile.ZipFile Unzip a file Create a ZipFile object from a file on disk or a file-like object from a requests response. :param file: path to zipfile or file-like object. If zipfile is extracted from a url, :param the file like object can be obtained by calling `io.BytesIO: :type the file like object can be obtained by calling `io.BytesIO: response.content :returns: object containing unzipped folder :rtype: ZipFile