Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/influxdb/influxdb08/__pycache__/dataframe_client.cpython-39.pyc
Ðазад
a p�h{ � @ sd d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlm Z G d d � d e �Z dS )z#DataFrame client for InfluxDB v0.8.� )�absolute_import)�division)�print_function)�unicode_literalsN� )�InfluxDBClientc sf e Zd ZdZd� fdd� Zdd� Zddd �Zddd�Zed d� �Z ddd�Z dd� Zddd�Z� Z S )�DataFrameClienta Primary defintion of the DataFrameClient for v0.8. The ``DataFrameClient`` object holds information necessary to connect to InfluxDB. Requests can be made to InfluxDB directly through the client. The client reads and writes from pandas DataFrames. Tc sr t t| �j|i |�� zddlaW n8 tyZ } z tdjt|�d���W Y d}~n d}~0 0 t�d�| _ || _ dS )z.Initialize an instance of the DataFrameClient.r Nz9DataFrameClient requires Pandas, "{ex}" problem importing��exz1970-01-01 00:00:00.000+00:00)�superr �__init__Zpandas�pd�ImportError�format�str� Timestamp�EPOCH� ignore_nan)�selfr �args�kwargsr �� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/influxdb/influxdb08/dataframe_client.pyr s �zDataFrameClient.__init__c s� |� d�}|� dd��|r�|�d� |�� D ]~\}}tt�t|�t|� ��}t|�D ]R}|| } |d | } � j ||j | | � �� �d�g}tj � |g|�R i |�� qVq,dS � �fdd�|�� D �}tj � |g|�R i |��S ) a� Write to multiple time series names. :param data: A dictionary mapping series names to pandas DataFrames :param time_precision: [Optional, default 's'] Either 's', 'm', 'ms' or 'u'. :param batch_size: [Optional] Value to write the points in batches instead of all at one time. Useful for when doing data dumps from one database to another or when doing a massive write operation :type batch_size: int � batch_size�time_precision�sr ��name� dataframer Tc s g | ]\}}� j ||�d ��qS )r )�_convert_dataframe_to_json)�.0�keyr �r r r r � <listcomp>C s ��z0DataFrameClient.write_points.<locals>.<listcomp>)�get�pop�items�int�math�ceil�len�float�ranger! Ziloc�copyr �write_points)r �datar r r r# Z data_frameZnumber_batches�batch�start_indexZ end_indexZoutdatar r$ r r0 % s2 �����zDataFrameClient.write_pointsr c C s t �dt� | j|dd�S )zAWrite to multiple time series names. DEPRECATED z�write_points_with_precision is deprecated, and will be removed in future versions. Please use ``DataFrameClient.write_points(time_precision='..')`` instead.r )r )�warnings�warn� FutureWarningr0 )r r1 r r r r �write_points_with_precisionI s �z+DataFrameClient.write_points_with_precisionFc C sh t j| |||d�}t|�dkr"|S t|�dkr>| �|d |�S i }|D ]}| �||�||d <