Generated by Cython 0.29.30
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: ilp.c
+001: ################################################################################
__pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
002: ## ___ _ ____ ____
003: ## / _ \ _ _ ___ ___| |_| _ \| __ )
004: ## | | | | | | |/ _ \/ __| __| | | | _ \
005: ## | |_| | |_| | __/\__ \ |_| |_| | |_) |
006: ## \__\_\\__,_|\___||___/\__|____/|____/
007: ##
008: ## Copyright (c) 2014-2019 Appsicle
009: ## Copyright (c) 2019-2022 QuestDB
010: ##
011: ## Licensed under the Apache License, Version 2.0 (the "License");
012: ## you may not use this file except in compliance with the License.
013: ## You may obtain a copy of the License at
014: ##
015: ## http://www.apache.org/licenses/LICENSE-2.0
016: ##
017: ## Unless required by applicable law or agreed to in writing, software
018: ## distributed under the License is distributed on an "AS IS" BASIS,
019: ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020: ## See the License for the specific language governing permissions and
021: ## limitations under the License.
022: ##
023: ################################################################################
024:
025: # distutils: language=c
026: # cython: language_level=3
027: # cython: binding=True
028:
029: from libc.stdint cimport uint8_t, int64_t
030: from cpython.datetime cimport datetime
031: from cpython.bool cimport bool, PyBool_Check
032:
033: from .line_sender cimport *
034:
035: cdef extern from "Python.h":
036: ctypedef uint8_t Py_UCS1 # unicodeobject.h
037:
038: ctypedef unsigned int uint
039:
040: cdef enum PyUnicode_Kind:
041: PyUnicode_1BYTE_KIND
042: PyUnicode_2BYTE_KIND
043: PyUnicode_4BYTE_KIND
044:
045: object PyUnicode_FromKindAndData(
046: int kind, const void* buffer, Py_ssize_t size)
047:
048: str PyUnicode_FromStringAndSize(
049: const char* u, Py_ssize_t size)
050:
051: # Must be called before accessing data or is compact check.
052: int PyUnicode_READY(object o) except -1
053:
054: # Is UCS1 and ascii (and therefore valid UTF-8).
055: bint PyUnicode_IS_COMPACT_ASCII(object o)
056:
057: # Get length.
058: Py_ssize_t PyUnicode_GET_LENGTH(object o)
059:
060: # Zero-copy access to buffer.
061: Py_UCS1* PyUnicode_1BYTE_DATA(object o)
062:
063: Py_ssize_t PyBytes_GET_SIZE(object o)
064:
065: char* PyBytes_AsString(object o)
066:
067:
+068: from enum import Enum
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Enum); __Pyx_GIVEREF(__pyx_n_s_Enum); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Enum); __pyx_t_2 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_1) < 0) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+069: from typing import List, Tuple, Dict, Union, Any, Optional, Callable, Iterable
__pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_List); __Pyx_INCREF(__pyx_n_s_Tuple); __Pyx_GIVEREF(__pyx_n_s_Tuple); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Tuple); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Dict); __Pyx_INCREF(__pyx_n_s_Union); __Pyx_GIVEREF(__pyx_n_s_Union); PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Union); __Pyx_INCREF(__pyx_n_s_Any); __Pyx_GIVEREF(__pyx_n_s_Any); PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_Any); __Pyx_INCREF(__pyx_n_s_Optional); __Pyx_GIVEREF(__pyx_n_s_Optional); PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_Optional); __Pyx_INCREF(__pyx_n_s_Callable); __Pyx_GIVEREF(__pyx_n_s_Callable); PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_Callable); __Pyx_INCREF(__pyx_n_s_Iterable); __Pyx_GIVEREF(__pyx_n_s_Iterable); PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_Iterable); __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_List); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Callable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+070: import pathlib
__pyx_t_1 = __Pyx_Import(__pyx_n_s_pathlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathlib, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
071:
+072: import sys
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
073:
+074: class IlpErrorCode(Enum):
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_IlpErrorCode, __pyx_n_s_IlpErrorCode, (PyObject *) NULL, __pyx_n_s_questdb_ilp, __pyx_kp_s_Category_of_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_IlpErrorCode, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IlpErrorCode, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
075: """Category of Error."""
+076: CouldNotResolveAddr = line_sender_error_could_not_resolve_addr
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_could_not_resolve_addr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CouldNotResolveAddr, __pyx_t_4) < 0) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+077: InvalidApiCall = line_sender_error_invalid_api_call
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_api_call); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidApiCall, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+078: SocketError = line_sender_error_socket_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_socket_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SocketError, __pyx_t_4) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+079: InvalidUtf8 = line_sender_error_invalid_utf8
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_utf8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidUtf8, __pyx_t_4) < 0) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+080: InvalidName = line_sender_error_invalid_name
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidName, __pyx_t_4) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+081: InvalidTimestamp = line_sender_error_invalid_timestamp
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_timestamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidTimestamp, __pyx_t_4) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+082: AuthError = line_sender_error_auth_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_auth_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_AuthError, __pyx_t_4) < 0) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+083: TlsError = line_sender_error_tls_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_tls_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TlsError, __pyx_t_4) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
084:
+085: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_12IlpErrorCode_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_12IlpErrorCode_1__str__ = {"__str__", (PyCFunction)__pyx_pw_7questdb_3ilp_12IlpErrorCode_1__str__, METH_O, 0}; static PyObject *__pyx_pw_7questdb_3ilp_12IlpErrorCode_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_12IlpErrorCode___str__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_12IlpErrorCode___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.IlpErrorCode.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* … */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_12IlpErrorCode_1__str__, 0, __pyx_n_s_IlpErrorCode___str, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_str_2, __pyx_t_4) < 0) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_str_2, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 85, __pyx_L1_error)
+086: return self.name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
087:
088:
+089: class IlpError(Exception):
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_IlpError, __pyx_n_s_IlpError, (PyObject *) NULL, __pyx_n_s_questdb_ilp, __pyx_kp_s_An_error_whilst_using_the_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* … */ __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_IlpError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_5) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_IlpError, __pyx_t_5) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
090: """
091: An error whilst using the line sender or constructing its buffer.
092: """
+093: def __init__(self, code, msg):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_8IlpError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_8IlpError_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_8IlpError_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_8IlpError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_code = 0; PyObject *__pyx_v_msg = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_code,&__pyx_n_s_msg,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_code)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 93, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msg)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 93, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 93, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_self = values[0]; __pyx_v_code = values[1]; __pyx_v_msg = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.IlpError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_8IlpError___init__(__pyx_self, __pyx_v_self, __pyx_v_code, __pyx_v_msg); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_8IlpError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_code, PyObject *__pyx_v_msg) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ilp.IlpError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_code, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_8IlpError_1__init__, 0, __pyx_n_s_IlpError___init, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_5); PyList_Append(__pyx_t_4, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_init, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 93, __pyx_L1_error)
+094: super().__init__(msg)
__pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 94, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+095: self._code = code
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code_2, __pyx_v_code) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
096:
+097: @property
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_code, __pyx_t_5) < 0) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+098: def code(self) -> IlpErrorCode:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_8IlpError_3code(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_8IlpError_3code = {"code", (PyCFunction)__pyx_pw_7questdb_3ilp_8IlpError_3code, METH_O, 0}; static PyObject *__pyx_pw_7questdb_3ilp_8IlpError_3code(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("code (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_8IlpError_2code(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_8IlpError_2code(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("code", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.IlpError.code", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); /* … */ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_8IlpError_3code, 0, __pyx_n_s_IlpError_code, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_code, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 98, __pyx_L1_error)
+099: return self._code
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
100:
101:
+102: cdef inline object c_err_code_to_py(line_sender_error_code code):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_c_err_code_to_py(enum line_sender_error_code __pyx_v_code) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_code_to_py", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.c_err_code_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+103: if code == line_sender_error_could_not_resolve_addr:
switch (__pyx_v_code) { case line_sender_error_could_not_resolve_addr: /* … */ break; case line_sender_error_invalid_api_call:
+104: return IlpErrorCode.CouldNotResolveAddr
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CouldNotResolveAddr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+105: elif code == line_sender_error_invalid_api_call:
break; case line_sender_error_socket_error:
+106: return IlpErrorCode.InvalidApiCall
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+107: elif code == line_sender_error_socket_error:
break; case line_sender_error_invalid_utf8:
+108: return IlpErrorCode.SocketError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+109: elif code == line_sender_error_invalid_utf8:
break; case line_sender_error_invalid_name:
+110: return IlpErrorCode.InvalidUtf8
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidUtf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+111: elif code == line_sender_error_invalid_name:
break; case line_sender_error_invalid_timestamp:
+112: return IlpErrorCode.InvalidName
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InvalidName); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+113: elif code == line_sender_error_invalid_timestamp:
break; case line_sender_error_auth_error:
+114: return IlpErrorCode.InvalidTimestamp
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+115: elif code == line_sender_error_auth_error:
break; case line_sender_error_tls_error:
+116: return IlpErrorCode.AuthError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AuthError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+117: elif code == line_sender_error_tls_error:
break; default:
+118: return IlpErrorCode.TlsError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TlsError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
119: else:
+120: raise ValueError('Internal error converting error code.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 120, __pyx_L1_error) break; } /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Internal_error_converting_error); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
121:
122:
+123: cdef inline object c_err_to_py(line_sender_error* err):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_c_err_to_py(struct line_sender_error *__pyx_v_err) { enum line_sender_error_code __pyx_v_code; size_t __pyx_v_c_len; char const *__pyx_v_c_msg; PyObject *__pyx_v_py_msg = 0; PyObject *__pyx_v_py_code = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_to_py", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ilp.c_err_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_msg); __Pyx_XDECREF(__pyx_v_py_code); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
124: """Construct a ``SenderError`` from a C error, which will also be freed."""
+125: cdef line_sender_error_code code = line_sender_error_get_code(err)
__pyx_v_code = line_sender_error_get_code(__pyx_v_err);
+126: cdef size_t c_len = 0
__pyx_v_c_len = 0;
+127: cdef const char* c_msg = line_sender_error_msg(err, &c_len)
__pyx_v_c_msg = line_sender_error_msg(__pyx_v_err, (&__pyx_v_c_len));
128: cdef object py_err
129: cdef object py_msg
130: cdef object py_code
+131: try:
/*try:*/ {
+132: py_code = c_err_code_to_py(code)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_code_to_py(__pyx_v_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_code = __pyx_t_1; __pyx_t_1 = 0;
+133: py_msg = PyUnicode_FromKindAndData(
__pyx_t_1 = PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, __pyx_v_c_msg, ((Py_ssize_t)__pyx_v_c_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_msg = __pyx_t_1; __pyx_t_1 = 0;
134: PyUnicode_1BYTE_KIND,
135: c_msg,
136: <Py_ssize_t>c_len)
+137: return IlpError(py_code, py_msg)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_code, __pyx_v_py_msg}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_code, __pyx_v_py_msg}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_py_code); __Pyx_GIVEREF(__pyx_v_py_code); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_py_code); __Pyx_INCREF(__pyx_v_py_msg); __Pyx_GIVEREF(__pyx_v_py_msg); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_py_msg); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L3_return; }
138: finally:
+139: line_sender_error_free(err)
/*finally:*/ { __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __pyx_t_4 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename; { line_sender_error_free(__pyx_v_err); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); } __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10); __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_13 = __pyx_r; __pyx_r = 0; line_sender_error_free(__pyx_v_err); __pyx_r = __pyx_t_13; __pyx_t_13 = 0; goto __pyx_L0; } }
140:
141:
+142: cdef bytes str_to_utf8(str string, line_sender_utf8* utf8_out):
static PyObject *__pyx_f_7questdb_3ilp_str_to_utf8(PyObject *__pyx_v_string, struct line_sender_utf8 *__pyx_v_utf8_out) { PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_utf8", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.str_to_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
143: """
144: Init the `utf8_out` object from the `string`.
145: If the string is held as a UCS1 and is purely ascii, then
146: the memory is borrowed.
147: Otherwise the string is first encoded to UTF-8 into a bytes object
148: and such bytes object is returned to transfer ownership and extend
149: the lifetime of the buffer pointed to by `utf8_out`.
150: """
151: # Note that we bypass `line_sender_utf8_init`.
+152: cdef bytes owner = None
__Pyx_INCREF(Py_None);
__pyx_v_owner = ((PyObject*)Py_None);
153: # PyUnicode_READY(string)
154: # if PyUnicode_IS_COMPACT_ASCII(string):
155: # utf8_out.len = <size_t>(PyUnicode_GET_LENGTH(string))
156: # utf8_out.buf = <const char*>(PyUnicode_1BYTE_DATA(string))
157: # return owner
158: # else:
+159: owner = string.encode('utf-8')
if (unlikely(__pyx_v_string == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 159, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_owner, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+160: utf8_out.len = <size_t>(PyBytes_GET_SIZE(owner))
__pyx_v_utf8_out->len = ((size_t)PyBytes_GET_SIZE(__pyx_v_owner));
+161: utf8_out.buf = <const char*>(PyBytes_AsString(owner))
__pyx_v_utf8_out->buf = ((char const *)PyBytes_AsString(__pyx_v_owner));
+162: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
163:
164:
+165: cdef bytes str_to_table_name(str string, line_sender_table_name* name_out):
static PyObject *__pyx_f_7questdb_3ilp_str_to_table_name(PyObject *__pyx_v_string, struct line_sender_table_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_table_name", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.str_to_table_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
166: """
167: Python string to borrowed C table name.
168: Also see `str_to_utf8`.
169: """
+170: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
171: cdef line_sender_utf8 utf8
+172: cdef bytes owner = str_to_utf8(string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_string, (&__pyx_v_utf8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+173: if not line_sender_table_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = ((!(line_sender_table_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+174: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 174, __pyx_L1_error)
+175: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
176:
177:
+178: cdef bytes str_to_column_name(str string, line_sender_column_name* name_out):
static PyObject *__pyx_f_7questdb_3ilp_str_to_column_name(PyObject *__pyx_v_string, struct line_sender_column_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_column_name", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.str_to_column_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
179: """
180: Python string to borrowed C column name.
181: Also see `str_to_utf8`.
182: """
+183: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
184: cdef line_sender_utf8 utf8
+185: cdef bytes owner = str_to_utf8(string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_string, (&__pyx_v_utf8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+186: if not line_sender_column_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = ((!(line_sender_column_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+187: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 187, __pyx_L1_error)
+188: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
189:
190:
+191: cdef int64_t datetime_to_micros(datetime dt):
static int64_t __pyx_f_7questdb_3ilp_datetime_to_micros(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("datetime_to_micros", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("questdb.ilp.datetime_to_micros", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
192: """
193: Convert a `datetime.datetime` to microseconds since the epoch.
194: """
195: return (
+196: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+197: <int64_t>(1000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0xF4240)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+198: <int64_t>(dt.microsecond))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_microsecond); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
199:
200:
+201: cdef int64_t datetime_to_nanos(datetime dt):
static int64_t __pyx_f_7questdb_3ilp_datetime_to_nanos(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("datetime_to_nanos", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("questdb.ilp.datetime_to_nanos", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
202: """
203: Convert a `datetime.datetime` to nanoseconds since the epoch.
204: """
205: return (
+206: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+207: <int64_t>(1000000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0x3B9ACA00)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+208: <int64_t>(dt.microsecond * 1000))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_microsecond); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_1000); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
209:
210:
+211: cdef class TimestampMicros:
struct __pyx_obj_7questdb_3ilp_TimestampMicros { PyObject_HEAD int64_t _value; };
212: """A timestamp in microseconds since the UNIX epoch."""
213: cdef int64_t _value
214:
+215: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_3ilp_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_3ilp_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_value = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 215, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_15TimestampMicros___cinit__(((struct __pyx_obj_7questdb_3ilp_TimestampMicros *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_3ilp_15TimestampMicros___cinit__(struct __pyx_obj_7questdb_3ilp_TimestampMicros *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+216: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+217: raise ValueError('value must positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 217, __pyx_L1_error) /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_value_must_positive_integer); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
+218: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
219:
+220: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros->tp_dict, __pyx_n_s_from_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_TimestampMicros);
+221: def from_datetime(cls, dt: datetime):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt); /*proto*/ static char __pyx_doc_7questdb_3ilp_15TimestampMicros_2from_datetime[] = "\n Construct a `TimestampMicros` from a `datetime` object.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_15TimestampMicros_3from_datetime = {"from_datetime", (PyCFunction)__pyx_pw_7questdb_3ilp_15TimestampMicros_3from_datetime, METH_O, __pyx_doc_7questdb_3ilp_15TimestampMicros_2from_datetime}; static PyObject *__pyx_pw_7questdb_3ilp_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 1, "dt", 0))) __PYX_ERR(0, 221, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_3ilp_15TimestampMicros_2from_datetime(((PyTypeObject*)__pyx_v_cls), ((PyDateTime_DateTime *)__pyx_v_dt)); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_15TimestampMicros_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ilp.TimestampMicros.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_dt); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dt, __pyx_n_u_datetime) < 0) __PYX_ERR(0, 221, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_15TimestampMicros_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampMicros_from_datetime, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros->tp_dict, __pyx_n_s_from_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_TimestampMicros); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_from_datetime, 221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 221, __pyx_L1_error)
222: """
223: Construct a `TimestampMicros` from a `datetime` object.
224: """
+225: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (unlikely(__pyx_t_2)) {
/* … */
}
+226: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 226, __pyx_L1_error) /* … */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_dt_must_be_a_datetime_object); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3);
+227: return cls(datetime_to_micros(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_f_7questdb_3ilp_datetime_to_micros(__pyx_v_dt)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
228:
229: @property
+230: def value(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_3ilp_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_15TimestampMicros_5value___get__(((struct __pyx_obj_7questdb_3ilp_TimestampMicros *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_15TimestampMicros_5value___get__(struct __pyx_obj_7questdb_3ilp_TimestampMicros *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.TimestampMicros.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
231: """Number of microseconds."""
+232: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
233:
234:
+235: cdef class TimestampNanos:
struct __pyx_obj_7questdb_3ilp_TimestampNanos { PyObject_HEAD int64_t _value; };
236: """A timestamp in nanoseconds since the UNIX epoch."""
237: cdef int64_t _value
238:
+239: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_3ilp_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_3ilp_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 239, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_value = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 239, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_14TimestampNanos___cinit__(((struct __pyx_obj_7questdb_3ilp_TimestampNanos *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_3ilp_14TimestampNanos___cinit__(struct __pyx_obj_7questdb_3ilp_TimestampNanos *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+240: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+241: raise ValueError('value must positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 241, __pyx_L1_error)
+242: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
243:
+244: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos->tp_dict, __pyx_n_s_from_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_TimestampNanos);
+245: def from_datetime(cls, dt: datetime):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt); /*proto*/ static char __pyx_doc_7questdb_3ilp_14TimestampNanos_2from_datetime[] = "\n Construct a `TimestampNanos` from a `datetime` object.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_14TimestampNanos_3from_datetime = {"from_datetime", (PyCFunction)__pyx_pw_7questdb_3ilp_14TimestampNanos_3from_datetime, METH_O, __pyx_doc_7questdb_3ilp_14TimestampNanos_2from_datetime}; static PyObject *__pyx_pw_7questdb_3ilp_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 1, "dt", 0))) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_3ilp_14TimestampNanos_2from_datetime(((PyTypeObject*)__pyx_v_cls), ((PyDateTime_DateTime *)__pyx_v_dt)); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_14TimestampNanos_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ilp.TimestampNanos.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_dt); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dt, __pyx_n_u_datetime) < 0) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_14TimestampNanos_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampNanos_from_datetime, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos->tp_dict, __pyx_n_s_from_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_TimestampNanos); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_from_datetime, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 245, __pyx_L1_error)
246: """
247: Construct a `TimestampNanos` from a `datetime` object.
248: """
+249: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (unlikely(__pyx_t_2)) {
/* … */
}
+250: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 250, __pyx_L1_error)
+251: return cls(datetime_to_nanos(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_f_7questdb_3ilp_datetime_to_nanos(__pyx_v_dt)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
252:
253: @property
+254: def value(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_3ilp_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_14TimestampNanos_5value___get__(((struct __pyx_obj_7questdb_3ilp_TimestampNanos *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_14TimestampNanos_5value___get__(struct __pyx_obj_7questdb_3ilp_TimestampNanos *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.TimestampNanos.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
255: """Number of nanoseconds."""
+256: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
257:
258:
+259: ctypedef bint (*row_complete_cb)(
typedef int (*__pyx_t_7questdb_3ilp_row_complete_cb)(struct line_sender_buffer *, void *, struct line_sender_error **);
260: line_sender_buffer*,
261: void* ctx,
262: line_sender_error**)
263:
264:
+265: cdef class Buffer:
struct __pyx_obj_7questdb_3ilp_Buffer { PyObject_HEAD struct __pyx_vtabstruct_7questdb_3ilp_Buffer *__pyx_vtab; struct line_sender_buffer *_impl; __pyx_t_7questdb_3ilp_row_complete_cb _row_complete_cb; void *_row_complete_ctx; }; /* … */ struct __pyx_vtabstruct_7questdb_3ilp_Buffer { PyObject *(*_cinit_impl)(struct __pyx_obj_7questdb_3ilp_Buffer *, size_t, size_t); PyObject *(*_to_str)(struct __pyx_obj_7questdb_3ilp_Buffer *); int (*_set_marker)(struct __pyx_obj_7questdb_3ilp_Buffer *); int (*_rewind_to_marker)(struct __pyx_obj_7questdb_3ilp_Buffer *); PyObject *(*_clear_marker)(struct __pyx_obj_7questdb_3ilp_Buffer *); int (*_table)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *); int (*_symbol)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *, PyObject *); int (*_column_bool)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, int); int (*_column_i64)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, int); int (*_column_f64)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, float); int (*_column_str)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, PyObject *); int (*_column_ts)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, struct __pyx_obj_7questdb_3ilp_TimestampMicros *); int (*_column_dt)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, PyDateTime_DateTime *); int (*_column)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *, PyObject *); int (*_may_trigger_row_complete)(struct __pyx_obj_7questdb_3ilp_Buffer *); int (*_at_ts)(struct __pyx_obj_7questdb_3ilp_Buffer *, struct __pyx_obj_7questdb_3ilp_TimestampNanos *); int (*_at_dt)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyDateTime_DateTime *); int (*_at_now)(struct __pyx_obj_7questdb_3ilp_Buffer *); int (*_at)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *); int (*_row)(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *, struct __pyx_opt_args_7questdb_3ilp_6Buffer__row *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_3ilp_Buffer *__pyx_vtabptr_7questdb_3ilp_Buffer; static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__cinit_impl(struct __pyx_obj_7questdb_3ilp_Buffer *, size_t, size_t); static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__to_str(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__set_marker(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__rewind_to_marker(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__clear_marker(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__table(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__symbol(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *, PyObject *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_bool(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, int); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_i64(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, int); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_f64(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, float); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_str(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, PyObject *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_ts(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, struct __pyx_obj_7questdb_3ilp_TimestampMicros *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_dt(struct __pyx_obj_7questdb_3ilp_Buffer *, struct line_sender_column_name, PyDateTime_DateTime *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *, PyObject *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__may_trigger_row_complete(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_ts(struct __pyx_obj_7questdb_3ilp_Buffer *, struct __pyx_obj_7questdb_3ilp_TimestampNanos *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_dt(struct __pyx_obj_7questdb_3ilp_Buffer *, PyDateTime_DateTime *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_now(struct __pyx_obj_7questdb_3ilp_Buffer *); static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at(struct __pyx_obj_7questdb_3ilp_Buffer *, PyObject *);
266: """
267: Construct QuestDB-flavored InfluxDB Line Protocol (ILP) messages.
268:
269: .. code-block:: python
270:
271: from questdb.ilp import Buffer
272:
273: buf = Buffer()
274: buf.row(
275: 'table_name',
276: symbols={'s1', 'v1', 's2', 'v2'},
277: columns={'c1': True, 'c2': 0.5})
278:
279: # Append any additional rows then, once ready,
280: # call `sender.flush(buffer)` on a `Sender` instance.
281:
282: Refer to the
283: `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to
284: understand the difference between the ``SYMBOL`` and ``STRING`` types
285: (TL;DR: symbols are interned strings).
286:
287: Appending data:
288: * The ``row`` method appends one row at a time.
289: * The ``tabular`` method appends multiple rows for a single table.
290:
291: Buffer inspection:
292: * For the number of bytes in the buffer, call ``len(buffer)``.
293: * To see the contents, call ``str(buffer)``.
294: """
295: cdef line_sender_buffer* _impl
296: cdef row_complete_cb _row_complete_cb
297: cdef void* _row_complete_ctx
298:
+299: def __cinit__(self, init_capacity: int=65536, max_name_len: int=127):
/* Python wrapper */ static int __pyx_pw_7questdb_3ilp_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_3ilp_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_init_capacity = 0; PyObject *__pyx_v_max_name_len = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_init_capacity,&__pyx_n_s_max_name_len,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)__pyx_int_65536); values[1] = ((PyObject *)__pyx_int_127); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_capacity); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_name_len); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 299, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_init_capacity = values[0]; __pyx_v_max_name_len = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 299, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer___cinit__(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self), __pyx_v_init_capacity, __pyx_v_max_name_len); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_3ilp_6Buffer___cinit__(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_init_capacity, PyObject *__pyx_v_max_name_len) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ilp.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
300: """
301: Create a new buffer with the an initial capacity and max name length.
302: :param int init_capacity: Initial capacity of the buffer in bytes.
303: :param int max_name_len: Maximum length of a table or column name.
304: """
+305: self._cinit_impl(init_capacity, max_name_len)
__pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_init_capacity); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_v_max_name_len); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__cinit_impl(__pyx_v_self, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
306:
+307: cdef inline _cinit_impl(self, size_t init_capacity, size_t max_name_len):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__cinit_impl(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, size_t __pyx_v_init_capacity, size_t __pyx_v_max_name_len) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_cinit_impl", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+308: self._impl = line_sender_buffer_with_max_name_len(max_name_len)
__pyx_v_self->_impl = line_sender_buffer_with_max_name_len(__pyx_v_max_name_len);
+309: line_sender_buffer_reserve(self._impl, init_capacity)
line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_v_init_capacity);
+310: self._row_complete_cb = NULL
__pyx_v_self->_row_complete_cb = NULL;
+311: self._row_complete_ctx = NULL
__pyx_v_self->_row_complete_ctx = NULL;
312:
+313: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_3ilp_6Buffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_3ilp_6Buffer_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7questdb_3ilp_6Buffer_2__dealloc__(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_3ilp_6Buffer_2__dealloc__(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+314: self._row_complete_cb = NULL
__pyx_v_self->_row_complete_cb = NULL;
+315: self._row_complete_ctx = NULL
__pyx_v_self->_row_complete_ctx = NULL;
+316: line_sender_buffer_free(self._impl)
line_sender_buffer_free(__pyx_v_self->_impl);
317:
+318: def reserve(self, additional: int):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_5reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_additional); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Buffer_4reserve[] = "\n Ensure the buffer has at least `additional` bytes of future capacity.\n\n :param int additional: Additional bytes to reserve.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_6Buffer_5reserve = {"reserve", (PyCFunction)__pyx_pw_7questdb_3ilp_6Buffer_5reserve, METH_O, __pyx_doc_7questdb_3ilp_6Buffer_4reserve}; static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_5reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_additional) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reserve (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_4reserve(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self), ((PyObject *)__pyx_v_additional)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Buffer_4reserve(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_additional) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reserve", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_additional); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_additional, __pyx_n_u_int) < 0) __PYX_ERR(0, 318, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Buffer_5reserve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_reserve, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer->tp_dict, __pyx_n_s_reserve, __pyx_t_1) < 0) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Buffer); __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_reserve, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 318, __pyx_L1_error)
319: """
320: Ensure the buffer has at least `additional` bytes of future capacity.
321:
322: :param int additional: Additional bytes to reserve.
323: """
+324: if additional < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_additional, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+325: raise ValueError('additional must be non-negative.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 325, __pyx_L1_error) /* … */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_additional_must_be_non_negative); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8);
+326: line_sender_buffer_reserve(self._impl, additional)
__pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_additional); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error) line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_t_3);
327:
+328: def capacity(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_7capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Buffer_6capacity[] = "The current buffer capacity."; static PyMethodDef __pyx_mdef_7questdb_3ilp_6Buffer_7capacity = {"capacity", (PyCFunction)__pyx_pw_7questdb_3ilp_6Buffer_7capacity, METH_NOARGS, __pyx_doc_7questdb_3ilp_6Buffer_6capacity}; static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_7capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("capacity (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_6capacity(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Buffer_6capacity(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("capacity", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* … */ __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 328, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Buffer_7capacity, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_capacity, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer->tp_dict, __pyx_n_s_capacity, __pyx_t_2) < 0) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Buffer); __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_capacity, 328, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 328, __pyx_L1_error)
329: """The current buffer capacity."""
+330: return line_sender_buffer_capacity(self._impl)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(line_sender_buffer_capacity(__pyx_v_self->_impl)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
331:
+332: def clear(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Buffer_8clear[] = "\n Reset the buffer.\n\n Note that flushing a buffer will (unless otherwise specified)\n also automatically clear it.\n\n This method is designed to be called only in conjunction with\n ``sender.flush(buffer, clear=False)``.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_6Buffer_9clear = {"clear", (PyCFunction)__pyx_pw_7questdb_3ilp_6Buffer_9clear, METH_NOARGS, __pyx_doc_7questdb_3ilp_6Buffer_8clear}; static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_8clear(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Buffer_8clear(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Buffer_9clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_clear, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer->tp_dict, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Buffer); __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_clear, 332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 332, __pyx_L1_error)
333: """
334: Reset the buffer.
335:
336: Note that flushing a buffer will (unless otherwise specified)
337: also automatically clear it.
338:
339: This method is designed to be called only in conjunction with
340: ``sender.flush(buffer, clear=False)``.
341: """
+342: line_sender_buffer_clear(self._impl)
line_sender_buffer_clear(__pyx_v_self->_impl);
343:
+344: def __len__(self):
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_3ilp_6Buffer_11__len__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Buffer_10__len__[] = "\n The current number of bytes currently in the buffer.\n "; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_3ilp_6Buffer_10__len__; #endif static Py_ssize_t __pyx_pw_7questdb_3ilp_6Buffer_11__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_10__len__(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_3ilp_6Buffer_10__len__(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
345: """
346: The current number of bytes currently in the buffer.
347: """
+348: return line_sender_buffer_size(self._impl)
__pyx_r = line_sender_buffer_size(__pyx_v_self->_impl); goto __pyx_L0;
349:
+350: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_13__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_13__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_12__str__(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Buffer_12__str__(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+351: return self._to_str()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_7questdb_3ilp_6Buffer__to_str(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
352:
+353: cdef inline object _to_str(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__to_str(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { size_t __pyx_v_size; char const *__pyx_v_utf8; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_to_str", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+354: cdef size_t size = 0
__pyx_v_size = 0;
+355: cdef const char* utf8 = line_sender_buffer_peek(self._impl, &size)
__pyx_v_utf8 = line_sender_buffer_peek(__pyx_v_self->_impl, (&__pyx_v_size));
+356: return PyUnicode_FromStringAndSize(utf8, <Py_ssize_t>size)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_utf8, ((Py_ssize_t)__pyx_v_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
357:
+358: cdef inline int _set_marker(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__set_marker(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_marker", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._set_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+359: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+360: if not line_sender_buffer_set_marker(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_set_marker(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+361: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 361, __pyx_L1_error)
362:
+363: cdef inline int _rewind_to_marker(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__rewind_to_marker(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rewind_to_marker", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._rewind_to_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+364: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+365: if not line_sender_buffer_rewind_to_marker(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_rewind_to_marker(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+366: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 366, __pyx_L1_error)
367:
+368: cdef inline _clear_marker(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_3ilp_6Buffer__clear_marker(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_clear_marker", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+369: line_sender_buffer_clear_marker(self._impl)
line_sender_buffer_clear_marker(__pyx_v_self->_impl);
370:
+371: cdef inline int _table(self, str table_name) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__table(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name) { struct line_sender_error *__pyx_v_err; struct line_sender_table_name __pyx_v_c_table_name; CYTHON_UNUSED PyObject *__pyx_v_owner = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_table", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+372: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
373: cdef line_sender_table_name c_table_name
+374: cdef bytes owner = str_to_table_name(table_name, &c_table_name)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_table_name(__pyx_v_table_name, (&__pyx_v_c_table_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+375: if not line_sender_buffer_table(self._impl, c_table_name, &err):
__pyx_t_2 = ((!(line_sender_buffer_table(__pyx_v_self->_impl, __pyx_v_c_table_name, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+376: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 376, __pyx_L1_error)
+377: return 0
__pyx_r = 0; goto __pyx_L0;
378:
+379: cdef inline int _symbol(self, str name, str value) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__symbol(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_column_name __pyx_v_c_name; struct line_sender_utf8 __pyx_v_c_value; CYTHON_UNUSED PyObject *__pyx_v_owner_name = 0; CYTHON_UNUSED PyObject *__pyx_v_owner_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_symbol", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_name); __Pyx_XDECREF(__pyx_v_owner_value); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+380: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
381: cdef line_sender_column_name c_name
382: cdef line_sender_utf8 c_value
+383: cdef bytes owner_name = str_to_column_name(name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_column_name(__pyx_v_name, (&__pyx_v_c_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+384: cdef bytes owner_value = str_to_utf8(value, &c_value)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_value, (&__pyx_v_c_value)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+385: if not line_sender_buffer_symbol(self._impl, c_name, c_value, &err):
__pyx_t_2 = ((!(line_sender_buffer_symbol(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+386: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 386, __pyx_L1_error)
+387: return 0
__pyx_r = 0; goto __pyx_L0;
388:
+389: cdef inline int _column_bool(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_bool(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_bool", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._column_bool", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
390: self, line_sender_column_name c_name, bint value) except -1:
+391: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+392: if not line_sender_buffer_column_bool(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_bool(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+393: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 393, __pyx_L1_error)
+394: return 0
__pyx_r = 0; goto __pyx_L0;
395:
+396: cdef inline int _column_i64(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_i64(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_i64", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._column_i64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
397: self, line_sender_column_name c_name, int value) except -1:
398: # TODO: Generally audit for int overflows this in the whole codebase.
399: # We pretty certainly have one here :-).
+400: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+401: if not line_sender_buffer_column_i64(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_i64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+402: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 402, __pyx_L1_error)
+403: return 0
__pyx_r = 0; goto __pyx_L0;
404:
+405: cdef inline int _column_f64(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_f64(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, float __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_f64", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._column_f64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
406: self, line_sender_column_name c_name, float value) except -1:
+407: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+408: if not line_sender_buffer_column_f64(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_f64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+409: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 409, __pyx_L1_error)
+410: return 0
__pyx_r = 0; goto __pyx_L0;
411:
+412: cdef inline int _column_str(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_str(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_c_value; CYTHON_UNUSED PyObject *__pyx_v_owner_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_str", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._column_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_value); __Pyx_RefNannyFinishContext(); return __pyx_r; }
413: self, line_sender_column_name c_name, str value) except -1:
+414: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
415: cdef line_sender_utf8 c_value
+416: cdef bytes owner_value = str_to_utf8(value, &c_value)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_value, (&__pyx_v_c_value)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+417: if not line_sender_buffer_column_str(self._impl, c_name, c_value, &err):
__pyx_t_2 = ((!(line_sender_buffer_column_str(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+418: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 418, __pyx_L1_error)
+419: return 0
__pyx_r = 0; goto __pyx_L0;
420:
+421: cdef inline int _column_ts(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_ts(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, struct __pyx_obj_7questdb_3ilp_TimestampMicros *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_ts", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._column_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
422: self, line_sender_column_name c_name, TimestampMicros ts) except -1:
+423: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+424: if not line_sender_buffer_column_ts(self._impl, c_name, ts.value, &err):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ts), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(line_sender_buffer_column_ts(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_t_2, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+425: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 425, __pyx_L1_error)
+426: return 0
__pyx_r = 0; goto __pyx_L0;
427:
+428: cdef inline int _column_dt(
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column_dt(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyDateTime_DateTime *__pyx_v_dt) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_dt", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._column_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
429: self, line_sender_column_name c_name, datetime dt) except -1:
+430: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+431: if not line_sender_buffer_column_ts(
__pyx_t_1 = ((!(line_sender_buffer_column_ts(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_f_7questdb_3ilp_datetime_to_micros(__pyx_v_dt), (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
432: self._impl, c_name, datetime_to_micros(dt), &err):
+433: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 433, __pyx_L1_error)
+434: return 0
__pyx_r = 0; goto __pyx_L0;
435:
+436: cdef inline int _column(self, str name, object value) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__column(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_column_name __pyx_v_c_name; CYTHON_UNUSED PyObject *__pyx_v_owner_name = 0; PyObject *__pyx_v_valid = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("questdb.ilp.Buffer._column", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_name); __Pyx_XDECREF(__pyx_v_valid); __Pyx_RefNannyFinishContext(); return __pyx_r; }
437: cdef line_sender_column_name c_name
+438: cdef bytes owner_name = str_to_column_name(name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_3ilp_str_to_column_name(__pyx_v_name, (&__pyx_v_c_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+439: if PyBool_Check(value):
__pyx_t_2 = (PyBool_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+440: return self._column_bool(c_name, value)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__column_bool(__pyx_v_self, __pyx_v_c_name, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 440, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+441: elif isinstance(value, int):
__pyx_t_2 = PyInt_Check(__pyx_v_value);
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+442: return self._column_i64(c_name, value)
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_6Buffer__column_i64(__pyx_v_self, __pyx_v_c_name, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 442, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+443: elif isinstance(value, float):
__pyx_t_4 = PyFloat_Check(__pyx_v_value);
__pyx_t_2 = (__pyx_t_4 != 0);
if (__pyx_t_2) {
/* … */
}
+444: return self._column_f64(c_name, value)
__pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_6Buffer__column_f64(__pyx_v_self, __pyx_v_c_name, __pyx_t_6); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 444, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+445: elif isinstance(value, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_value);
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+446: return self._column_str(c_name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 446, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_6Buffer__column_str(__pyx_v_self, __pyx_v_c_name, ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 446, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+447: elif isinstance(value, TimestampMicros):
__pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7questdb_3ilp_TimestampMicros);
__pyx_t_2 = (__pyx_t_4 != 0);
if (__pyx_t_2) {
/* … */
}
+448: return self._column_ts(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7questdb_3ilp_TimestampMicros))))) __PYX_ERR(0, 448, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_6Buffer__column_ts(__pyx_v_self, __pyx_v_c_name, ((struct __pyx_obj_7questdb_3ilp_TimestampMicros *)__pyx_v_value)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 448, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+449: elif isinstance(value, datetime):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_4 = (__pyx_t_2 != 0);
if (likely(__pyx_t_4)) {
/* … */
}
+450: return self._column_dt(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 450, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_6Buffer__column_dt(__pyx_v_self, __pyx_v_c_name, ((PyDateTime_DateTime *)__pyx_v_value)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 450, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
451: else:
+452: valid = ', '.join((
/*else*/ { /* … */ __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__9, __pyx_tuple__10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_valid = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+453: 'bool',
__pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_u_bool, __pyx_n_u_int, __pyx_n_u_float, __pyx_n_u_str, __pyx_n_u_TimestampMicros, __pyx_kp_u_datetime_datetime); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10);
454: 'int',
455: 'float',
456: 'str',
457: 'TimestampMicros',
458: 'datetime.datetime'))
+459: raise TypeError(
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 459, __pyx_L1_error) }
+460: f'Unsupported type: {type(value)}. Must be one of: {valid}')
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Unsupported_type); __pyx_t_9 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_v_valid); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
461:
+462: cdef inline int _may_trigger_row_complete(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__may_trigger_row_complete(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_may_trigger_row_complete", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._may_trigger_row_complete", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+463: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+464: if self._row_complete_cb != NULL:
__pyx_t_1 = ((__pyx_v_self->_row_complete_cb != NULL) != 0); if (__pyx_t_1) { /* … */ }
+465: if not self._row_complete_cb(
__pyx_t_1 = ((!(__pyx_v_self->_row_complete_cb(__pyx_v_self->_impl, __pyx_v_self->_row_complete_ctx, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
466: self._impl,
467: self._row_complete_ctx,
468: &err):
+469: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 469, __pyx_L1_error)
470:
+471: cdef inline int _at_ts(self, TimestampNanos ts) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_ts(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, struct __pyx_obj_7questdb_3ilp_TimestampNanos *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_ts", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Buffer._at_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+472: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+473: if not line_sender_buffer_at(self._impl, ts.value, &err):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ts), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(line_sender_buffer_at(__pyx_v_self->_impl, __pyx_t_2, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+474: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 474, __pyx_L1_error)
+475: self._may_trigger_row_complete()
__pyx_t_4 = __pyx_f_7questdb_3ilp_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 475, __pyx_L1_error)
+476: return 0
__pyx_r = 0; goto __pyx_L0;
477:
+478: cdef inline int _at_dt(self, datetime dt) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_dt(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_v_value; struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_dt", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._at_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+479: cdef int64_t value = datetime_to_nanos(dt)
__pyx_v_value = __pyx_f_7questdb_3ilp_datetime_to_nanos(__pyx_v_dt);
+480: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+481: if not line_sender_buffer_at(self._impl, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_at(__pyx_v_self->_impl, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+482: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 482, __pyx_L1_error)
+483: self._may_trigger_row_complete()
__pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 483, __pyx_L1_error)
+484: return 0
__pyx_r = 0; goto __pyx_L0;
485:
+486: cdef inline int _at_now(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at_now(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_now", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Buffer._at_now", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+487: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+488: if not line_sender_buffer_at_now(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_at_now(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+489: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 489, __pyx_L1_error)
+490: self._may_trigger_row_complete()
__pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 490, __pyx_L1_error)
+491: return 0
__pyx_r = 0; goto __pyx_L0;
492:
+493: cdef inline int _at(self, object ts) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_3ilp_6Buffer__at(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_ts) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ilp.Buffer._at", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+494: if ts is None:
__pyx_t_1 = (__pyx_v_ts == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+495: return self._at_now()
__pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__at_now(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 495, __pyx_L1_error)
__pyx_r = __pyx_t_3;
goto __pyx_L0;
+496: elif isinstance(ts, TimestampNanos):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7questdb_3ilp_TimestampNanos);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
}
+497: return self._at_ts(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7questdb_3ilp_TimestampNanos))))) __PYX_ERR(0, 497, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__at_ts(__pyx_v_self, ((struct __pyx_obj_7questdb_3ilp_TimestampNanos *)__pyx_v_ts)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 497, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+498: elif isinstance(ts, datetime):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = (__pyx_t_1 != 0);
if (likely(__pyx_t_2)) {
/* … */
}
+499: return self._at_dt(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 499, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_3ilp_6Buffer__at_dt(__pyx_v_self, ((PyDateTime_DateTime *)__pyx_v_ts)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 499, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
500: else:
+501: raise TypeError(
/*else*/ { /* … */ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 501, __pyx_L1_error) }
+502: f'Unsupported type: {type(ts)}. Must be one of: ' +
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_5 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Unsupported_type); __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_ts)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_5 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_7, __pyx_kp_u_TimestampNanos_datetime_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
503: 'TimestampNanos, datetime, None')
504:
+505: cdef int _row(
static int __pyx_f_7questdb_3ilp_6Buffer__row(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name, struct __pyx_opt_args_7questdb_3ilp_6Buffer__row *__pyx_optional_args) { /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("questdb.ilp.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_name); __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ struct __pyx_opt_args_7questdb_3ilp_6Buffer__row { int __pyx_n; PyObject *symbols; PyObject *columns; PyObject *at; };
506: self,
507: str table_name,
+508: dict symbols=None,
PyObject *__pyx_v_symbols = ((PyObject*)Py_None);
+509: dict columns=None,
PyObject *__pyx_v_columns = ((PyObject*)Py_None);
+510: object at=None) except -1:
PyObject *__pyx_v_at = ((PyObject *)Py_None); PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_value = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_row", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_symbols = __pyx_optional_args->symbols; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_columns = __pyx_optional_args->columns; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_at = __pyx_optional_args->at; } } } }
511: """
512: Add a row to the buffer.
513: """
+514: self._set_marker()
__pyx_t_1 = __pyx_f_7questdb_3ilp_6Buffer__set_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 514, __pyx_L1_error)
+515: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L1_error; __pyx_L8_try_end:; }
+516: self._table(table_name)
__pyx_t_1 = __pyx_f_7questdb_3ilp_6Buffer__table(__pyx_v_self, __pyx_v_table_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 516, __pyx_L3_error)
+517: if not (symbols or columns):
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_symbols); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 517, __pyx_L3_error) if (!__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L10_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_columns); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 517, __pyx_L3_error) __pyx_t_5 = __pyx_t_6; __pyx_L10_bool_binop_done:; __pyx_t_6 = ((!__pyx_t_5) != 0); if (unlikely(__pyx_t_6)) { /* … */ }
+518: raise IlpError(
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_IlpError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 518, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8);
+519: IlpErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 519, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 519, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; __pyx_t_1 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_1 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_kp_u_Must_specify_at_least_one_symbol}; __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 518, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_kp_u_Must_specify_at_least_one_symbol}; __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 518, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif { __pyx_t_11 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 518, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_kp_u_Must_specify_at_least_one_symbol); __Pyx_GIVEREF(__pyx_kp_u_Must_specify_at_least_one_symbol); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_1, __pyx_kp_u_Must_specify_at_least_one_symbol); __pyx_t_10 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 518, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 518, __pyx_L3_error)
520: 'Must specify at least one symbol or column')
+521: if symbols is not None:
__pyx_t_6 = (__pyx_v_symbols != ((PyObject*)Py_None)); __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { /* … */ }
+522: for name, value in symbols.items():
__pyx_t_12 = 0; if (unlikely(__pyx_v_symbols == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 522, __pyx_L3_error) } __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_symbols, 1, __pyx_n_s_items, (&__pyx_t_13), (&__pyx_t_1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 522, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_8; __pyx_t_8 = 0; while (1) { __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_13, &__pyx_t_12, &__pyx_t_8, &__pyx_t_11, NULL, __pyx_t_1); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 522, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); __pyx_t_11 = 0;
+523: self._symbol(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 523, __pyx_L3_error) if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 523, __pyx_L3_error) __pyx_t_14 = __pyx_f_7questdb_3ilp_6Buffer__symbol(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 523, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+524: if columns is not None:
__pyx_t_5 = (__pyx_v_columns != ((PyObject*)Py_None)); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+525: for name, value in columns.items():
__pyx_t_13 = 0; if (unlikely(__pyx_v_columns == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 525, __pyx_L3_error) } __pyx_t_11 = __Pyx_dict_iterator(__pyx_v_columns, 1, __pyx_n_s_items, (&__pyx_t_12), (&__pyx_t_1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 525, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_11; __pyx_t_11 = 0; while (1) { __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_12, &__pyx_t_13, &__pyx_t_11, &__pyx_t_8, NULL, __pyx_t_1); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 525, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); __pyx_t_8 = 0;
+526: self._column(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 526, __pyx_L3_error) __pyx_t_14 = __pyx_f_7questdb_3ilp_6Buffer__column(__pyx_v_self, ((PyObject*)__pyx_v_name), __pyx_v_value); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 526, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+527: self._at(at)
__pyx_t_1 = __pyx_f_7questdb_3ilp_6Buffer__at(__pyx_v_self, __pyx_v_at); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 527, __pyx_L3_error)
+528: self._clear_marker()
__pyx_t_7 = __pyx_f_7questdb_3ilp_6Buffer__clear_marker(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 528, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+529: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ilp.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_11) < 0) __PYX_ERR(0, 529, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_11);
+530: self._rewind_to_marker()
__pyx_t_1 = __pyx_f_7questdb_3ilp_6Buffer__rewind_to_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 530, __pyx_L5_except_error)
+531: raise
__Pyx_GIVEREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_11); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_11 = 0; __PYX_ERR(0, 531, __pyx_L5_except_error) } __pyx_L5_except_error:;
532:
+533: def row(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_15row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Buffer_14row[] = "\n Add a single row (line) to the buffer.\n\n At least one ``symbols`` or ``columns`` must be specified.\n\n .. code-block:: python\n\n # All fields specified.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def'},\n columns={\n 'col1': True,\n 'col2': 123,\n 'col3': 3.14,\n 'col4': 'xyz',\n 'col5': TimestampMicros(123456789),\n 'col6': datetime(2019, 1, 1, 12, 0, 0)},\n at=TimestampNanos(123456789))\n\n # Only symbols specified. Designated timestamp assigned by the db.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def'})\n\n # Float columns and timestamp specified as `datetime.datetime`.\n # Pay special attention to the timezone, which if unspecified is\n # assumed to be the local timezone (and not UTC).\n buffer.row(\n 'sensor data',\n columns={\n 'temperature': 24.5,\n 'humidity': 0.5},\n at=datetime.datetime.utcnow())\n\n :param table_name: The name of the table to which the row belongs.\n :param symbols: A dictionary of symbol column names to ``str`` values.\n :param columns: A dictionary of column names to ``bool``, ``int``,\n ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.\n :param at: The timestamp of the row. If ``None``, timestamp is assigned\n by the server. If ``datetime``, the timestamp is converted to\n nanoseconds. A nanosecond unix epoch timestamp can be passed\n explicitly as a ``TimestampNanos`` object.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_6Buffer_15row = {"row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_6Buffer_15row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_3ilp_6Buffer_14row}; static PyObject *__pyx_pw_7questdb_3ilp_6Buffer_15row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,&__pyx_n_s_symbols,&__pyx_n_s_columns,&__pyx_n_s_at,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Buffer_14row(struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("questdb.ilp.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__39 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_table_name, __pyx_n_s_symbols, __pyx_n_s_columns, __pyx_n_s_at); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_table_name, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 533, __pyx_L1_error) /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Buffer_15row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_row, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer->tp_dict, __pyx_n_s_row, __pyx_t_5) < 0) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Buffer); __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 3, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_row, 533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 533, __pyx_L1_error)
534: self,
535: table_name: str,
536: *,
+537: symbols: Optional[Dict[str, str]]=None,
values[1] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyUnicode_Type))); __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_symbols, __pyx_t_5) < 0) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+538: columns: Optional[Dict[
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* … */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_columns, __pyx_t_3) < 0) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
539: str,
+540: Union[bool, int, float, str, TimestampMicros, datetime]]]=None,
values[2] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_INCREF(((PyObject *)(&PyInt_Type))); __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)(&PyInt_Type))); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)(&PyFloat_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros)); PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampMicros)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+541: at: Union[None, TimestampNanos, datetime]=None):
values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_table_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (kw_args > 0 && likely(kw_args <= 3)) { Py_ssize_t index; for (index = 1; index < 4 && kw_args > 0; index++) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]); if (value) { values[index] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "row") < 0)) __PYX_ERR(0, 533, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_table_name = ((PyObject*)values[0]); __pyx_v_symbols = values[1]; __pyx_v_columns = values[2]; __pyx_v_at = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 533, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 535, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_3ilp_6Buffer_14row(((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_v_self), __pyx_v_table_name, __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_6, 0, Py_None); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos)); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_ptype_7questdb_3ilp_TimestampNanos)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_at, __pyx_t_5) < 0) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
542: """
543: Add a single row (line) to the buffer.
544:
545: At least one ``symbols`` or ``columns`` must be specified.
546:
547: .. code-block:: python
548:
549: # All fields specified.
550: buffer.row(
551: 'table_name',
552: symbols={'sym1': 'abc', 'sym2': 'def'},
553: columns={
554: 'col1': True,
555: 'col2': 123,
556: 'col3': 3.14,
557: 'col4': 'xyz',
558: 'col5': TimestampMicros(123456789),
559: 'col6': datetime(2019, 1, 1, 12, 0, 0)},
560: at=TimestampNanos(123456789))
561:
562: # Only symbols specified. Designated timestamp assigned by the db.
563: buffer.row(
564: 'table_name',
565: symbols={'sym1': 'abc', 'sym2': 'def'})
566:
567: # Float columns and timestamp specified as `datetime.datetime`.
568: # Pay special attention to the timezone, which if unspecified is
569: # assumed to be the local timezone (and not UTC).
570: buffer.row(
571: 'sensor data',
572: columns={
573: 'temperature': 24.5,
574: 'humidity': 0.5},
575: at=datetime.datetime.utcnow())
576:
577: :param table_name: The name of the table to which the row belongs.
578: :param symbols: A dictionary of symbol column names to ``str`` values.
579: :param columns: A dictionary of column names to ``bool``, ``int``,
580: ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.
581: :param at: The timestamp of the row. If ``None``, timestamp is assigned
582: by the server. If ``datetime``, the timestamp is converted to
583: nanoseconds. A nanosecond unix epoch timestamp can be passed
584: explicitly as a ``TimestampNanos`` object.
585: """
+586: self._row(table_name, symbols, columns, at)
if (!(likely(PyDict_CheckExact(__pyx_v_symbols))||((__pyx_v_symbols) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_symbols)->tp_name), 0))) __PYX_ERR(0, 586, __pyx_L1_error) if (!(likely(PyDict_CheckExact(__pyx_v_columns))||((__pyx_v_columns) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_columns)->tp_name), 0))) __PYX_ERR(0, 586, __pyx_L1_error) __pyx_t_2.__pyx_n = 3; __pyx_t_2.symbols = ((PyObject*)__pyx_v_symbols); __pyx_t_2.columns = ((PyObject*)__pyx_v_columns); __pyx_t_2.at = __pyx_v_at; __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_3ilp_Buffer *)__pyx_v_self->__pyx_vtab)->_row(__pyx_v_self, __pyx_v_table_name, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 586, __pyx_L1_error)
+587: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
588:
589: # def tabular(
590: # self,
591: # table_name: str,
592: # data: Iterable[Iterable[Union[
593: # bool, int, float, str,
594: # TimestampMicros, TimestampNanos, datetime]]],
595: # *,
596: # header: Optional[List[Optional[str]]]=None,
597: # symbols: Union[bool, List[int]]=False,
598: # at: Union[None, TimestampNanos, datetime]=None):
599: # """
600: # Add multiple rows as an iterable of iterables (e.g. list of lists) to
601: # the buffer.
602:
603: # **Data and header**
604:
605: # The ``data`` argument specifies rows which must all be for the same
606: # table. Column names are provided as the ``header``.
607:
608: # .. code-block:: python
609:
610: # buffer.tabular(
611: # 'table_name',
612: # [[True, 123, 3.14, 'xyz'],
613: # [False, 456, 6.28, 'abc'],
614: # [True, 789, 9.87, 'def']],
615: # header=['col1', 'col2', 'col3', 'col4'])
616:
617: # **Designated Timestamp Column**
618:
619: # QuestDB supports a special `designated timestamp
620: # <https://questdb.io/docs/concept/designated-timestamp/>`_ column that it
621: # uses to sort the rows by timestamp.
622:
623: # If the data section contains the same number of columns as the header,
624: # then the designated is going to be
625: # assigned by the server, unless specified for all columns the `at`
626: # argument as either an integer wrapped in a ``TimestampNanos`` object
627: # representing nanoseconds since unix epoch (1970-01-01 00:00:00 UTC) or
628: # as a ``datetime.datetime`` object.
629:
630: # .. code-block:: python
631:
632: # buffer.tabular(
633: # 'table_name',
634: # [[True, 123, 3.14, 'xyz'],
635: # [False, 456, 6.28, 'abc'],
636: # [True, 789, 9.87, 'def']],
637: # header=['col1', 'col2', 'col3', 'col4'],
638: # at=datetime.datetime.utcnow())
639:
640: # # or ...
641: # # at=TimestampNanos(1657386397157631000))
642:
643: # If the rows need different `designated timestamp
644: # <https://questdb.io/docs/concept/designated-timestamp/>`_ values across
645: # different rows, you can provide them as an additional unlabeled column.
646: # An unlabled column is one that has its name set to ``None``.
647:
648: # .. code-block:: python
649:
650: # ts1 = datetime.datetime.utcnow()
651: # ts2 = (
652: # datetime.datetime.utcnow() +
653: # datetime.timedelta(microseconds=1))
654: # buffer.tabular(
655: # 'table_name',
656: # [[True, 123, ts1],
657: # [False, 456, ts2]],
658: # header=['col1', 'col2', None])
659:
660: # Like the ``at`` argument, the designated timestamp column may also be
661: # specified as ``TimestampNanos`` objects.
662:
663: # .. code-block:: python
664:
665: # buffer.tabular(
666: # 'table_name',
667: # [[True, 123, TimestampNanos(1657386397157630000)],
668: # [False, 456, TimestampNanos(1657386397157631000)]],
669: # header=['col1', 'col2', None])
670:
671: # The designated timestamp column may appear anywhere positionally.
672:
673: # .. code-block:: python
674:
675: # ts1 = datetime.datetime.utcnow()
676: # ts2 = (
677: # datetime.datetime.utcnow() +
678: # datetime.timedelta(microseconds=1))
679: # buffer.tabular(
680: # 'table_name',
681: # [[1000, ts1, 123],
682: # [2000, ts2, 456]],
683: # header=['col1', None, 'col2'])
684:
685: # **Other timestamp columns**
686:
687: # Other columns may also contain timestamps. These columns can take
688: # ``datetime.datetime`` objects or ``TimestampMicros`` (*not nanos*)
689: # objects.
690:
691: # .. code-block:: python
692:
693: # ts1 = datetime.datetime.utcnow()
694: # ts2 = (
695: # datetime.datetime.utcnow() +
696: # datetime.timedelta(microseconds=1))
697: # buffer.tabular(
698: # 'table_name',
699: # [[1000, ts1, 123],
700: # [2000, ts2, 456]],
701: # header=['col1', 'col2', 'col3'],
702: # at=datetime.datetime.utcnow())
703:
704: # **Symbol Columns**
705:
706: # QuestDB can represent strings via the ``STRING`` or ``SYMBOL`` types.
707:
708: # If all the columns of type ``str`` are to be treated as ``STRING``, then
709: # specify ``symbols=False`` (default - see exaples above).
710:
711: # If all need to be treated as ``SYMBOL`` specify ``symbols=True``.
712:
713: # .. code-block:: python
714:
715: # buffer.tabular(
716: # 'table_name',
717: # [['abc', 123, 3.14, 'xyz'],
718: # ['def', 456, 6.28, 'abc'],
719: # ['ghi', 789, 9.87, 'def']],
720: # header=['col1', 'col2', 'col3', 'col4'],
721: # symbols=True) # `col1` and `col4` are SYMBOL columns.
722:
723: # Whilst if only a select few are to be treated as ``SYMBOL``, specify a
724: # list of column indices to the ``symbols`` arg.
725:
726: # .. code-block:: python
727:
728: # buffer.tabular(
729: # 'table_name',
730: # [['abc', 123, 3.14, 'xyz'],
731: # ['def', 456, 6.28, 'abc'],
732: # ['ghi', 789, 9.87, 'def']],
733: # header=['col1', 'col2', 'col3', 'col4'],
734: # symbols=[0]) # `col1` is SYMBOL; 'col4' is STRING.
735:
736: # Note that column indices are 0-based and negative indices are counted
737: # from the end.
738: # """
739: # raise ValueError('nyi')
740:
741: # def pandas(
742: # self,
743: # table_name: str,
744: # data: pd.DataFrame,
745: # *,
746: # symbols: Union[bool, List[int]]=False,
747: # at: Union[None, TimestampNanos, datetime]=None):
748: # """
749: # Add a pandas DataFrame to the buffer.
750: # """
751: # raise ValueError('nyi')
752:
753:
+754: cdef class Sender:
struct __pyx_obj_7questdb_3ilp_Sender { PyObject_HEAD struct __pyx_vtabstruct_7questdb_3ilp_Sender *__pyx_vtab; struct line_sender_opts *_opts; struct line_sender *_impl; struct __pyx_obj_7questdb_3ilp_Buffer *_buffer; int _auto_flush_enabled; size_t _auto_flush_watermark; PyObject *_init_capacity; PyObject *_max_name_len; }; /* … */ struct __pyx_vtabstruct_7questdb_3ilp_Sender { PyObject *(*flush)(struct __pyx_obj_7questdb_3ilp_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_3ilp_6Sender_flush *__pyx_optional_args); PyObject *(*_close)(struct __pyx_obj_7questdb_3ilp_Sender *); PyObject *(*close)(struct __pyx_obj_7questdb_3ilp_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_3ilp_6Sender_close *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_3ilp_Sender *__pyx_vtabptr_7questdb_3ilp_Sender;
755: cdef line_sender_opts* _opts
756: cdef line_sender* _impl
757: cdef Buffer _buffer
758: cdef bint _auto_flush_enabled
759: cdef size_t _auto_flush_watermark
760: cdef object _init_capacity
761: cdef object _max_name_len
762:
+763: def __cinit__(
/* Python wrapper */ static int __pyx_pw_7questdb_3ilp_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_3ilp_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_host = 0; PyObject *__pyx_v_port = 0; PyObject *__pyx_v_interface = 0; PyObject *__pyx_v_auth = 0; PyObject *__pyx_v_tls = 0; PyObject *__pyx_v_read_timeout = 0; int __pyx_v_init_capacity; int __pyx_v_max_name_len; PyObject *__pyx_v_auto_flush = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,&__pyx_n_s_interface,&__pyx_n_s_auth,&__pyx_n_s_tls,&__pyx_n_s_read_timeout,&__pyx_n_s_init_capacity,&__pyx_n_s_max_name_len,&__pyx_n_s_auto_flush,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_3ilp_6Sender___cinit__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_interface, PyObject *__pyx_v_auth, PyObject *__pyx_v_tls, PyObject *__pyx_v_read_timeout, int __pyx_v_init_capacity, int __pyx_v_max_name_len, PyObject *__pyx_v_auto_flush) { CYTHON_UNUSED struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_host_utf8; CYTHON_UNUSED PyObject *__pyx_v_host_owner = 0; PyObject *__pyx_v_port_str = 0; struct line_sender_utf8 __pyx_v_port_utf8; CYTHON_UNUSED PyObject *__pyx_v_port_owner = 0; struct line_sender_utf8 __pyx_v_interface_utf8; CYTHON_UNUSED PyObject *__pyx_v_interface_owner = 0; PyObject *__pyx_v_a_key_id = 0; CYTHON_UNUSED PyObject *__pyx_v_a_key_id_owner = 0; struct line_sender_utf8 __pyx_v_a_key_id_utf8; PyObject *__pyx_v_a_priv_key = 0; CYTHON_UNUSED PyObject *__pyx_v_a_priv_key_owner = 0; struct line_sender_utf8 __pyx_v_a_priv_key_utf8; PyObject *__pyx_v_a_pub_key_x = 0; CYTHON_UNUSED PyObject *__pyx_v_a_pub_key_x_owner = 0; struct line_sender_utf8 __pyx_v_a_pub_key_x_utf8; PyObject *__pyx_v_a_pub_key_y = 0; CYTHON_UNUSED PyObject *__pyx_v_a_pub_key_y_owner = 0; struct line_sender_utf8 __pyx_v_a_pub_key_y_utf8; CYTHON_UNUSED PyObject *__pyx_v_ca_owner = 0; struct line_sender_utf8 __pyx_v_ca_utf8; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_tls); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ilp.Sender.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_host_owner); __Pyx_XDECREF(__pyx_v_port_str); __Pyx_XDECREF(__pyx_v_port_owner); __Pyx_XDECREF(__pyx_v_interface_owner); __Pyx_XDECREF(__pyx_v_a_key_id); __Pyx_XDECREF(__pyx_v_a_key_id_owner); __Pyx_XDECREF(__pyx_v_a_priv_key); __Pyx_XDECREF(__pyx_v_a_priv_key_owner); __Pyx_XDECREF(__pyx_v_a_pub_key_x); __Pyx_XDECREF(__pyx_v_a_pub_key_x_owner); __Pyx_XDECREF(__pyx_v_a_pub_key_y); __Pyx_XDECREF(__pyx_v_a_pub_key_y_owner); __Pyx_XDECREF(__pyx_v_ca_owner); __Pyx_XDECREF(__pyx_v_tls); __Pyx_RefNannyFinishContext(); return __pyx_r; }
764: self,
765: str host,
766: object port,
767: *,
+768: str interface=None,
values[2] = ((PyObject*)Py_None);
+769: tuple auth=None,
values[3] = ((PyObject*)Py_None);
+770: object tls=False,
values[4] = ((PyObject *)Py_False);
+771: object read_timeout=None,
values[5] = ((PyObject *)Py_None); values[8] = ((PyObject *)__pyx_int_32768); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 763, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 7)) { Py_ssize_t index; for (index = 2; index < 9 && kw_args > 0; index++) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]); if (value) { values[index] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 763, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_host = ((PyObject*)values[0]); __pyx_v_port = values[1]; __pyx_v_interface = ((PyObject*)values[2]); __pyx_v_auth = ((PyObject*)values[3]); __pyx_v_tls = values[4]; __pyx_v_read_timeout = values[5]; if (values[6]) { __pyx_v_init_capacity = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_init_capacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) } else { __pyx_v_init_capacity = ((int)0x10000); } if (values[7]) { __pyx_v_max_name_len = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_max_name_len == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 773, __pyx_L3_error) } else { __pyx_v_max_name_len = ((int)0x7F); } __pyx_v_auto_flush = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 763, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Sender.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_host), (&PyUnicode_Type), 1, "host", 1))) __PYX_ERR(0, 765, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interface), (&PyUnicode_Type), 1, "interface", 1))) __PYX_ERR(0, 768, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_auth), (&PyTuple_Type), 1, "auth", 1))) __PYX_ERR(0, 769, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_3ilp_6Sender___cinit__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_interface, __pyx_v_auth, __pyx_v_tls, __pyx_v_read_timeout, __pyx_v_init_capacity, __pyx_v_max_name_len, __pyx_v_auto_flush);
772: int init_capacity=65536,
773: int max_name_len=127,
774: object auto_flush=32768):
+775: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
776:
777: cdef line_sender_utf8 host_utf8
778: cdef bytes host_owner
779:
780: cdef str port_str
781: cdef line_sender_utf8 port_utf8
782: cdef bytes port_owner
783:
784: cdef str interface_str
785: cdef line_sender_utf8 interface_utf8
786: cdef bytes interface_owner
787:
788: cdef str a_key_id
789: cdef bytes a_key_id_owner
790: cdef line_sender_utf8 a_key_id_utf8
791:
792: cdef str a_priv_key
793: cdef bytes a_priv_key_owner
794: cdef line_sender_utf8 a_priv_key_utf8
795:
796: cdef str a_pub_key_x
797: cdef bytes a_pub_key_x_owner
798: cdef line_sender_utf8 a_pub_key_x_utf8
799:
800: cdef str a_pub_key_y
801: cdef bytes a_pub_key_y_owner
802: cdef line_sender_utf8 a_pub_key_y_utf8
803:
804: cdef bytes ca_owner
805: cdef line_sender_utf8 ca_utf8
806:
+807: self._opts = NULL
__pyx_v_self->_opts = NULL;
+808: self._impl = NULL
__pyx_v_self->_impl = NULL;
+809: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)Py_None);
810:
+811: if isinstance(port, int):
__pyx_t_1 = PyInt_Check(__pyx_v_port);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
goto __pyx_L3;
}
+812: port_str = str(port)
__pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_port); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_port_str = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+813: elif isinstance(port, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_port);
__pyx_t_1 = (__pyx_t_2 != 0);
if (likely(__pyx_t_1)) {
/* … */
goto __pyx_L3;
}
+814: port_str = port
if (!(likely(PyUnicode_CheckExact(__pyx_v_port))||((__pyx_v_port) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_port)->tp_name), 0))) __PYX_ERR(0, 814, __pyx_L1_error) __pyx_t_3 = __pyx_v_port; __Pyx_INCREF(__pyx_t_3); __pyx_v_port_str = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
815: else:
+816: raise TypeError(
/*else*/ { /* … */ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 816, __pyx_L1_error) } __pyx_L3:;
+817: f'port must be an integer or a string, not {type(port)}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_port)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_port_must_be_an_integer_or_a_str, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
818:
+819: host_owner = str_to_utf8(host, &host_utf8)
__pyx_t_3 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_host, (&__pyx_v_host_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_host_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+820: port_owner = str_to_utf8(port_str, &port_utf8)
__pyx_t_3 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_port_str, (&__pyx_v_port_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_port_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+821: self._opts = line_sender_opts_new_service(host_utf8, port_utf8)
__pyx_v_self->_opts = line_sender_opts_new_service(__pyx_v_host_utf8, __pyx_v_port_utf8);
822:
+823: if interface is not None:
__pyx_t_1 = (__pyx_v_interface != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+824: interface_owner = str_to_utf8(interface, &interface_utf8)
__pyx_t_3 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_interface, (&__pyx_v_interface_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_interface_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+825: line_sender_opts_net_interface(self._opts, interface_utf8)
line_sender_opts_net_interface(__pyx_v_self->_opts, __pyx_v_interface_utf8);
826:
+827: if auth is not None:
__pyx_t_2 = (__pyx_v_auth != ((PyObject*)Py_None)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+828: (a_key_id,
if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 828, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 828, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 828, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 828, __pyx_L1_error) __pyx_v_a_key_id = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_a_priv_key = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; __pyx_v_a_pub_key_x = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; __pyx_v_a_pub_key_y = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
829: a_priv_key,
830: a_pub_key_x,
+831: a_pub_key_y) = auth
if (likely(__pyx_v_auth != Py_None)) { PyObject* sequence = __pyx_v_auth; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 828, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else { Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6}; for (i=0; i < 4; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 828, __pyx_L1_error) }
+832: a_key_id_owner = str_to_utf8(a_key_id, &a_key_id_utf8)
__pyx_t_6 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_a_key_id, (&__pyx_v_a_key_id_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_key_id_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+833: a_priv_key_owner = str_to_utf8(a_priv_key, &a_priv_key_utf8)
__pyx_t_6 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_a_priv_key, (&__pyx_v_a_priv_key_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 833, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_priv_key_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+834: a_pub_key_x_owner = str_to_utf8(a_pub_key_x, &a_pub_key_x_utf8)
__pyx_t_6 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_a_pub_key_x, (&__pyx_v_a_pub_key_x_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_x_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+835: a_pub_key_y_owner = str_to_utf8(a_pub_key_y, &a_pub_key_y_utf8)
__pyx_t_6 = __pyx_f_7questdb_3ilp_str_to_utf8(__pyx_v_a_pub_key_y, (&__pyx_v_a_pub_key_y_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_y_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+836: line_sender_opts_auth(
line_sender_opts_auth(__pyx_v_self->_opts, __pyx_v_a_key_id_utf8, __pyx_v_a_priv_key_utf8, __pyx_v_a_pub_key_x_utf8, __pyx_v_a_pub_key_y_utf8);
837: self._opts,
838: a_key_id_utf8,
839: a_priv_key_utf8,
840: a_pub_key_x_utf8,
841: a_pub_key_y_utf8)
842:
+843: if tls:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tls); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 843, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+844: if tls is True:
__pyx_t_1 = (__pyx_v_tls == Py_True); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ goto __pyx_L7; }
+845: line_sender_opts_tls(self._opts)
line_sender_opts_tls(__pyx_v_self->_opts);
+846: elif isinstance(tls, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_tls);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
goto __pyx_L7;
}
+847: if tls == 'insecure_skip_verify':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_tls, __pyx_n_u_insecure_skip_verify, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 847, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L8; }
+848: line_sender_opts_tls_insecure_skip_verify(self._opts)
line_sender_opts_tls_insecure_skip_verify(__pyx_v_self->_opts);
849: else:
+850: ca_owner = str_to_utf8(tls, &ca_utf8)
/*else*/ { if (!(likely(PyUnicode_CheckExact(__pyx_v_tls))||((__pyx_v_tls) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_tls)->tp_name), 0))) __PYX_ERR(0, 850, __pyx_L1_error) __pyx_t_6 = __pyx_f_7questdb_3ilp_str_to_utf8(((PyObject*)__pyx_v_tls), (&__pyx_v_ca_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 850, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_ca_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+851: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8); } __pyx_L8:;
+852: elif isinstance(tls, pathlib.Path):
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = PyObject_IsInstance(__pyx_v_tls, __pyx_t_5); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 852, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = (__pyx_t_1 != 0); if (likely(__pyx_t_2)) { /* … */ goto __pyx_L7; }
+853: tls = str(tls)
__pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_tls); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_tls, __pyx_t_5); __pyx_t_5 = 0;
+854: ca_owner = str_to_utf8(tls, &ca_utf8)
if (!(likely(PyUnicode_CheckExact(__pyx_v_tls))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_tls)->tp_name), 0))) __PYX_ERR(0, 854, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_3ilp_str_to_utf8(((PyObject*)__pyx_v_tls), (&__pyx_v_ca_utf8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_ca_owner = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
+855: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8);
856: else:
+857: raise TypeError(
/*else*/ { /* … */ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 857, __pyx_L1_error) } __pyx_L7:;
+858: 'tls must be a bool, a path or string pointing to CA file '
__pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_tls_must_be_a_bool_a_path_or_str, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 858, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+859: f'or "insecure_skip_verify", not {type(tls)}')
__pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_tls)), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5);
860:
+861: if read_timeout is not None:
__pyx_t_2 = (__pyx_v_read_timeout != Py_None); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+862: line_sender_opts_read_timeout(self._opts, read_timeout)
__pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_v_read_timeout); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L1_error) line_sender_opts_read_timeout(__pyx_v_self->_opts, __pyx_t_7);
863:
+864: self._init_capacity = init_capacity
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_init_capacity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->_init_capacity); __Pyx_DECREF(__pyx_v_self->_init_capacity); __pyx_v_self->_init_capacity = __pyx_t_5; __pyx_t_5 = 0;
+865: self._max_name_len = max_name_len
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_max_name_len); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 865, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->_max_name_len); __Pyx_DECREF(__pyx_v_self->_max_name_len); __pyx_v_self->_max_name_len = __pyx_t_5; __pyx_t_5 = 0;
866:
+867: self._buffer = Buffer(
__pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_t_6); __pyx_t_6 = 0;
+868: init_capacity=init_capacity,
__pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_init_capacity); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_init_capacity, __pyx_t_6) < 0) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+869: max_name_len=max_name_len)
__pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_max_name_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 869, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_max_name_len, __pyx_t_6) < 0) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
870:
+871: self._auto_flush_enabled = auto_flush is not None
__pyx_t_1 = (__pyx_v_auto_flush != Py_None); __pyx_v_self->_auto_flush_enabled = __pyx_t_1;
+872: self._auto_flush_watermark = int(auto_flush) \
__pyx_t_6 = __Pyx_PyNumber_Int(__pyx_v_auto_flush); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = __pyx_t_9; } else { __pyx_t_8 = 0; } __pyx_v_self->_auto_flush_watermark = __pyx_t_8;
+873: if self._auto_flush_enabled else 0
if ((__pyx_v_self->_auto_flush_enabled != 0)) {
874:
+875: def new_buffer(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_3new_buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_3ilp_6Sender_2new_buffer[] = "\n Make a new configured buffer.\n\n The buffer is set up with the configured `init_capacity` and\n `max_name_len`.\n "; static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_3new_buffer = {"new_buffer", (PyCFunction)__pyx_pw_7questdb_3ilp_6Sender_3new_buffer, METH_NOARGS, __pyx_doc_7questdb_3ilp_6Sender_2new_buffer}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_3new_buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_buffer (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_2new_buffer(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_2new_buffer(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_buffer", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Sender.new_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_3new_buffer, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_new_buffer, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_new_buffer, __pyx_t_5) < 0) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_new_buffer, 875, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 875, __pyx_L1_error)
876: """
877: Make a new configured buffer.
878:
879: The buffer is set up with the configured `init_capacity` and
880: `max_name_len`.
881: """
+882: self._buffer = Buffer(
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_3ilp_Buffer), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)__pyx_t_2); __pyx_t_2 = 0;
+883: init_capacity=self._init_capacity,
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_init_capacity, __pyx_v_self->_init_capacity) < 0) __PYX_ERR(0, 883, __pyx_L1_error)
+884: max_name_len=self._max_name_len)
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_name_len, __pyx_v_self->_max_name_len) < 0) __PYX_ERR(0, 883, __pyx_L1_error)
885:
+886: def connect(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_5connect = {"connect", (PyCFunction)__pyx_pw_7questdb_3ilp_6Sender_5connect, METH_NOARGS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("connect (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_4connect(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_4connect(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { struct line_sender_error *__pyx_v_err; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("connect", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ilp.Sender.connect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_5connect, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_connect, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_connect, __pyx_t_5) < 0) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_connect, 886, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 886, __pyx_L1_error)
+887: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+888: if self._opts == NULL:
__pyx_t_1 = ((__pyx_v_self->_opts == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+889: raise IlpError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IlpError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+890: IlpErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_connect_can_t_be_called_after_cl}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_connect_can_t_be_called_after_cl}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_kp_u_connect_can_t_be_called_after_cl); __Pyx_GIVEREF(__pyx_kp_u_connect_can_t_be_called_after_cl); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_kp_u_connect_can_t_be_called_after_cl); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 889, __pyx_L1_error)
891: 'connect() can\'t be called after close().')
+892: self._impl = line_sender_connect(self._opts, &err)
__pyx_v_self->_impl = line_sender_connect(__pyx_v_self->_opts, (&__pyx_v_err));
+893: if self._impl == NULL:
__pyx_t_1 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+894: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 894, __pyx_L1_error)
+895: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+896: self._opts = NULL
__pyx_v_self->_opts = NULL;
897: # self._buffer._row_complete_cb = may_flush_on_row_complete
898: # self._buffer._row_complete_ctx = self
899:
+900: def __enter__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_7__enter__ = {"__enter__", (PyCFunction)__pyx_pw_7questdb_3ilp_6Sender_7__enter__, METH_NOARGS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_6__enter__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_6__enter__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ilp.Sender.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_7__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___enter, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_enter, __pyx_t_5) < 0) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_enter, 900, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 900, __pyx_L1_error)
+901: self.connect()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_connect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+902: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
903:
+904: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_9__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_9__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_8__str__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_8__str__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Sender.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+905: return str(self._buffer)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self->_buffer)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
906:
+907: def __len__(self):
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_3ilp_6Sender_11__len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pw_7questdb_3ilp_6Sender_11__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_10__len__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_3ilp_6Sender_10__len__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Sender.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+908: return len(self._buffer)
__pyx_t_1 = ((PyObject *)__pyx_v_self->_buffer); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
909:
+910: def row(self, *args, **kwargs):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_13row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_13row = {"row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_6Sender_13row, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_13row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "row", 1))) return NULL; __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_12row(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_12row(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ilp.Sender.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 910, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__51); __Pyx_GIVEREF(__pyx_tuple__51); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_13row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_row, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_row, __pyx_t_5) < 0) __PYX_ERR(0, 910, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_row, 910, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 910, __pyx_L1_error)
+911: self._buffer.row(*args, **kwargs)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_buffer), __pyx_n_s_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
912:
+913: cpdef flush(self, Buffer buffer=None, bint clear=True):
static PyObject *__pyx_pw_7questdb_3ilp_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7questdb_3ilp_6Sender_flush(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_3ilp_6Sender_flush *__pyx_optional_args) { struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)Py_None); int __pyx_v_clear = ((int)1); struct line_sender_error *__pyx_v_err; struct line_sender_buffer *__pyx_v_c_buf; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_buffer = __pyx_optional_args->buffer; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_clear = __pyx_optional_args->clear; } } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7questdb_3ilp_6Sender_15flush)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_buffer), __pyx_t_3}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_buffer), __pyx_t_3}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_v_buffer)); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_buffer)); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ilp.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_15flush = {"flush", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_6Sender_15flush, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_buffer = 0; int __pyx_v_clear; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_clear,0}; PyObject* values[2] = {0,0}; values[0] = (PyObject *)((struct __pyx_obj_7questdb_3ilp_Buffer *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clear); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flush") < 0)) __PYX_ERR(0, 913, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)values[0]); if (values[1]) { __pyx_v_clear = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_clear == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 913, __pyx_L3_error) } else { __pyx_v_clear = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("flush", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 913, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_7questdb_3ilp_Buffer, 1, "buffer", 0))) __PYX_ERR(0, 913, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_14flush(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self), __pyx_v_buffer, __pyx_v_clear); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_14flush(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, struct __pyx_obj_7questdb_3ilp_Buffer *__pyx_v_buffer, int __pyx_v_clear) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.buffer = __pyx_v_buffer; __pyx_t_2.clear = __pyx_v_clear; __pyx_t_1 = __pyx_vtabptr_7questdb_3ilp_Sender->flush(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__53 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buffer, __pyx_n_s_clear); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_15flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_flush, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_flush, __pyx_t_5) < 0) __PYX_ERR(0, 913, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_flush, 913, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 913, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_3ilp_6Sender_flush { int __pyx_n; struct __pyx_obj_7questdb_3ilp_Buffer *buffer; int clear; };
+914: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+915: cdef line_sender_buffer* c_buf = NULL
__pyx_v_c_buf = NULL;
+916: if self._impl == NULL:
__pyx_t_8 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_8)) { /* … */ }
+917: raise IlpError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IlpError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+918: IlpErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IlpErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_u_flush_can_t_be_called_Not_connec}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_u_flush_can_t_be_called_Not_connec}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_kp_u_flush_can_t_be_called_Not_connec); __Pyx_GIVEREF(__pyx_kp_u_flush_can_t_be_called_Not_connec); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_kp_u_flush_can_t_be_called_Not_connec); __pyx_t_7 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 917, __pyx_L1_error)
919: 'flush() can\'t be called: Not connected.')
+920: if buffer is not None:
__pyx_t_8 = (((PyObject *)__pyx_v_buffer) != Py_None); __pyx_t_9 = (__pyx_t_8 != 0); if (__pyx_t_9) { /* … */ goto __pyx_L4; }
+921: c_buf = buffer._impl
__pyx_t_10 = __pyx_v_buffer->_impl; __pyx_v_c_buf = __pyx_t_10;
922: else:
+923: c_buf = self._buffer._impl
/*else*/ { __pyx_t_10 = __pyx_v_self->_buffer->_impl; __pyx_v_c_buf = __pyx_t_10; } __pyx_L4:;
+924: if line_sender_buffer_size(c_buf) == 0:
__pyx_t_9 = ((line_sender_buffer_size(__pyx_v_c_buf) == 0) != 0); if (__pyx_t_9) { /* … */ }
+925: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
926:
+927: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L11_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); goto __pyx_L1_error; __pyx_L11_try_end:; }
+928: if clear:
__pyx_t_9 = (__pyx_v_clear != 0); if (__pyx_t_9) { /* … */ goto __pyx_L12; }
+929: if not line_sender_flush(self._impl, c_buf, &err):
__pyx_t_9 = ((!(line_sender_flush(__pyx_v_self->_impl, __pyx_v_c_buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_9)) { /* … */ }
+930: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 930, __pyx_L6_error)
931: else:
+932: if not line_sender_flush_and_keep(self._impl, c_buf, &err):
/*else*/ { __pyx_t_9 = ((!(line_sender_flush_and_keep(__pyx_v_self->_impl, __pyx_v_c_buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_9)) { /* … */ } } __pyx_L12:;
+933: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_3ilp_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 933, __pyx_L6_error)
+934: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ilp.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 934, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
935: # Prevent a follow-up call to `.close(flush=True)` (as is usually
936: # called from `__exit__`) to raise after the sender entered an error
937: # state following a failed call to `.flush()`.
+938: if c_buf == self._buffer._impl:
__pyx_t_9 = ((__pyx_v_c_buf == __pyx_v_self->_buffer->_impl) != 0); if (__pyx_t_9) { /* … */ }
+939: line_sender_buffer_clear(c_buf)
line_sender_buffer_clear(__pyx_v_c_buf);
+940: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __PYX_ERR(0, 940, __pyx_L8_except_error) } __pyx_L8_except_error:;
941:
+942: cdef _close(self):
static PyObject *__pyx_f_7questdb_3ilp_6Sender__close(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_close", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+943: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)Py_None);
+944: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+945: self._opts = NULL
__pyx_v_self->_opts = NULL;
+946: line_sender_close(self._impl)
line_sender_close(__pyx_v_self->_impl);
+947: self._impl = NULL
__pyx_v_self->_impl = NULL;
948:
+949: cpdef close(self, bint flush=True):
static PyObject *__pyx_pw_7questdb_3ilp_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7questdb_3ilp_6Sender_close(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_3ilp_6Sender_close *__pyx_optional_args) { int __pyx_v_flush = ((int)1); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_flush = __pyx_optional_args->flush; } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7questdb_3ilp_6Sender_17close)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_flush); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ilp.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_17close = {"close", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_6Sender_17close, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_flush; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flush,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flush); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "close") < 0)) __PYX_ERR(0, 949, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } if (values[0]) { __pyx_v_flush = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flush == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error) } else { __pyx_v_flush = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 949, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_16close(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self), __pyx_v_flush); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_16close(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, int __pyx_v_flush) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.flush = __pyx_v_flush; __pyx_t_1 = __pyx_vtabptr_7questdb_3ilp_Sender->close(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ilp.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_flush); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_17close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_close, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_close, __pyx_t_5) < 0) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_close, 949, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 949, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_3ilp_6Sender_close { int __pyx_n; int flush; };
+950: try:
/*try:*/ {
+951: if (flush and (self._impl != NULL) and
__pyx_t_7 = (__pyx_v_flush != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_self->_impl != NULL) != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } /* … */ if (__pyx_t_6) { /* … */ } }
+952: (not line_sender_must_close(self._impl))):
__pyx_t_7 = ((!(line_sender_must_close(__pyx_v_self->_impl) != 0)) != 0); __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:;
+953: self.flush(None, True)
__pyx_t_8.__pyx_n = 2; __pyx_t_8.buffer = ((struct __pyx_obj_7questdb_3ilp_Buffer *)Py_None); __pyx_t_8.clear = 1; __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_3ilp_Sender *)__pyx_v_self->__pyx_vtab)->flush(__pyx_v_self, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
954: finally:
+955: self._close()
/*finally:*/ { /*normal exit:*/{ __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_3ilp_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; { __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_3ilp_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; goto __pyx_L1_error; __pyx_L11_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; goto __pyx_L1_error; } __pyx_L5:; }
956:
+957: def __exit__(self, exc_type, _exc_val, _exc_tb):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_3ilp_6Sender_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_3ilp_6Sender_19__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_3ilp_6Sender_19__exit__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_3ilp_6Sender_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_exc_type = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_val = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_tb = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_val)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 957, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_tb)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 957, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 957, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_exc_type = values[0]; __pyx_v__exc_val = values[1]; __pyx_v__exc_tb = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 957, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ilp.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_3ilp_6Sender_18__exit__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self), __pyx_v_exc_type, __pyx_v__exc_val, __pyx_v__exc_tb); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_3ilp_6Sender_18__exit__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v__exc_val, CYTHON_UNUSED PyObject *__pyx_v__exc_tb) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ilp.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_val, __pyx_n_s_exc_tb); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__57); __Pyx_GIVEREF(__pyx_tuple__57); /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_3ilp_6Sender_19__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___exit, NULL, __pyx_n_s_questdb_ilp, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_3ilp_Sender->tp_dict, __pyx_n_s_exit, __pyx_t_5) < 0) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_7questdb_3ilp_Sender); __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ilp_pyx, __pyx_n_s_exit, 957, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 957, __pyx_L1_error)
+958: self.close(not exc_type)
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc_type); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 958, __pyx_L1_error) __pyx_t_3.__pyx_n = 1; __pyx_t_3.flush = (!__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_7questdb_3ilp_Sender *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
959:
+960: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_3ilp_6Sender_21__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_3ilp_6Sender_21__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7questdb_3ilp_6Sender_20__dealloc__(((struct __pyx_obj_7questdb_3ilp_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_3ilp_6Sender_20__dealloc__(struct __pyx_obj_7questdb_3ilp_Sender *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("questdb.ilp.Sender.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+961: self._close()
__pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_3ilp_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
962:
963:
964: # cdef int may_flush_on_row_complete(
965: # line_sender_buffer* buf,
966: # void* ctx) except -1:
967: # pass