🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-08 10:32:33 | PHP 8.2.32
📂
/ (Root)
/
opt
/
alt
/
python38
/
lib
/
python3.8
/
site-packages
/
influxdb_client
/
client
/
write
/
__pycache__
📍 /opt/alt/python38/lib/python3.8/site-packages/influxdb_client/client/write/__pycache__
🔄 Refresh
✏️
Editing: point.cpython-38.pyc
Read Only
U v�i4 � @ sT d Z ddlZddlZddlmZ ddlmZmZmZ ddlm Z ddl mZ ddlm Z ddlmZ ejdejd �ZejZe�d ddd dd��Ze�d dddd dd��Ze�ddd��ZzddlZdZW n ek r� dZY nX G dd� de�Zdd� Z dd� Z!ed�dd�Z"d*ed�d d!�Z#ed�d"d#�Z$ed�d$d%�Z%efd&d'�Z&d(d)� Z'dS )+z/Point data structure to represent LineProtocol.� N)�int)�datetime� timedelta�timezone)�Decimal)�Integral)�get_date_helper)�WritePrecision)�tzz\,z\ z\nz\tz\r)�,� � � � z\=)r �=r r r r z\"z\\)�"�\TFc @ s� e Zd ZdZedd� �Zeefeed�dd��Z dd� Z efd d �Zdd� Zd d� Z ddd�Zedd� �Zedd� �Zdd� Zdd� ZdS )�Pointz� Point defines the values that will be written to the database. Ref: https://docs.influxdata.com/influxdb/latest/reference/key-concepts/data-elements/#point c C s t | �}|S )z3Create a new Point with specified measurement name.)r )�measurement�p� r �S/opt/alt/python38/lib/python3.8/site-packages/influxdb_client/client/write/point.pyr 6 s zPoint.measurement)� dictionary�write_precisionc K sJ |� dd�}|dkr$| |� dd� }t|�}|� dd�}|dk rd|D ]}|| krD|�|| | � qDn*d| kr�| d �� D ]\}}|�||� qx|� dd�}|dk r�|D ]} | | kr�|�| | | � q�n"| d �� D ]\} } |�| | � q�|� d d �}|| k�r|j| | |d� |� di �}d| k�r.| d }ttd d� |�� ��|_|S )a, Initialize point from 'dict' structure. The expected dict structure is: - measurement - tags - fields - time Example: .. code-block:: python # Use default dictionary structure dict_structure = { "measurement": "h2o_feet", "tags": {"location": "coyote_creek"}, "fields": {"water_level": 1.0}, "time": 1 } point = Point.from_dict(dict_structure, WritePrecision.NS) Example: .. code-block:: python # Use custom dictionary structure dictionary = { "name": "sensor_pt859", "location": "warehouse_125", "version": "2021.06.05.5874", "pressure": 125, "temperature": 10, "created": 1632208639, } point = Point.from_dict(dictionary, write_precision=WritePrecision.S, record_measurement_key="name", record_time_key="created", record_tag_keys=["location", "version"], record_field_keys=["pressure", "temperature"]) Int Types: The following example shows how to configure the types of integers fields. It is useful when you want to serialize integers always as ``float`` to avoid ``field type conflict`` or use ``unsigned 64-bit integer`` as the type for serialization. .. code-block:: python # Use custom dictionary structure dict_structure = { "measurement": "h2o_feet", "tags": {"location": "coyote_creek"}, "fields": { "water_level": 1.0, "some_counter": 108913123234 }, "time": 1 } point = Point.from_dict(dict_structure, field_types={"some_counter": "uint"}) :param dictionary: dictionary for serialize into data Point :param write_precision: sets the precision for the supplied time values :key record_measurement_key: key of dictionary with specified measurement :key record_measurement_name: static measurement name for data Point :key record_time_key: key of dictionary with specified timestamp :key record_tag_keys: list of dictionary keys to use as a tag :key record_field_keys: list of dictionary keys to use as a field :key field_types: optional dictionary to specify types of serialized fields. Currently, is supported customization for integer types. Possible integers types: - ``int`` - serialize integers as "**Signed 64-bit integers**" - ``9223372036854775807i`` (default behaviour) - ``uint`` - serialize integers as "**Unsigned 64-bit integers**" - ``9223372036854775807u`` - ``float`` - serialize integers as "**IEEE-754 64-bit floating-point numbers**". Useful for unify number types in your pipeline to avoid field type conflict - ``9223372036854775807`` The ``field_types`` can be also specified as part of incoming dictionary. For more info see an example above. :return: new data point Zrecord_measurement_nameNZrecord_measurement_keyr �record_tag_keys�tags�record_field_keys�fields�record_time_key�time)r �field_typesc S s, | d | d dkrdn| d dkr&dndfS )Nr � r �iZuint�u� r )�itemr r r �<lambda>� � z!Point.from_dict.<locals>.<lambda>) �getr �tag�items�fieldr �dict�map�_field_types) r r �kwargsZmeasurement_�pointr �tag_key� tag_valuer Z field_keyZfield_valuer r. r r r � from_dict<