onetick-py 1.162.2__tar.gz → 1.164.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {onetick_py-1.162.2 → onetick_py-1.164.0}/PKG-INFO +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/pyproject.toml +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/actions.py +10 -14
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/common.py +13 -10
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/io.py +6 -4
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/locator.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/doc_utilities/ot_doctest.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/doc_utilities/snippets.py +1 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/lib/instance.py +7 -4
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/__init__.py +5 -9
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/_version.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/_base.py +7 -4
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/_docs.py +22 -7
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/other.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/cache.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/callback/callback.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_proxy_node.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_state_objects.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/aggregations.py +8 -9
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/applyers.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/debugs.py +16 -14
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/drops.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/fields.py +5 -5
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/filters.py +4 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/joins.py +6 -6
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/misc.py +84 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/renames.py +3 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/switches.py +3 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/writes.py +279 -10
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/tmp_otq.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/_methods/_internal.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/_methods/methods.py +8 -7
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/_methods/op_types.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/dt_accessor.py +4 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/base.py +5 -5
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/cut_builder.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/eval_query.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/lambda_object.py +2 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/per_tick_script.py +6 -5
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/query_inspector.py +6 -7
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/source.py +11 -8
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/db/_inspection.py +4 -8
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/db/db.py +4 -100
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/docs/docstring_parser.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/functions.py +48 -11
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/license.py +2 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/math.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/otq.py +1 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/run.py +8 -7
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/servers.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/session.py +8 -6
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/common.py +6 -4
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/data_source.py +25 -35
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/query.py +7 -7
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/symbols.py +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/ticks.py +3 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/state.py +1 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/types.py +27 -25
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/config.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/perf.py +2 -3
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/temp.py +2 -2
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/PKG-INFO +1 -1
- {onetick_py-1.162.2 → onetick_py-1.164.0}/LICENSE +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/README.md +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/requirements.strict.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/requirements.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/setup.cfg +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/setup.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/locator_parser/acl.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/doc_utilities/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/doc_utilities/napoleon.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/lib/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/_stack_info.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/compute.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/functions.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/generic.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/high_low.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/num_distinct.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/aggregations/order_book.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/backports.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/callback/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/callback/callbacks.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/compatibility.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/configuration.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_csv_inspector.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_manually_bound_value.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_nodes_history.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_op_utils/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_op_utils/every_operand.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_op_utils/is_const.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_per_tick_scripts/tick_list_sort_template.script +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_internal/_state_vars.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/_symbol_param.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/schema.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/columns.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/data_quality.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/merges.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/pandases.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/sorts.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/symbols.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/times.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/symbol.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/_methods/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/_methods/conversions.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/_accessor.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/decimal_accessor.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/float_accessor.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/column_operations/accessors/str_accessor.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/db_constants.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/multi_output_source.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/db/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/db/utils.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/docs/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/docs/utils.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/log.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/misc.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/oqd/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/oqd/eps.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/oqd/sources.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/pyomd_mock.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/cache.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/csv.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/custom.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/data_file.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/empty.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/odbc.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/order_book.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/parquet.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/pit.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/snapshots.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/split_query_output_by_symbol.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sources/symbology_mapping.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/sql.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/__init__.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/acl.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/default.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/file.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/helpers.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/locator.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/query.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/render.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/script.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/types.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/utils/tz.py +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/SOURCES.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/dependency_links.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/entry_points.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/requires.txt +0 -0
- {onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick_py.egg-info/top_level.txt +0 -0
|
@@ -14,7 +14,7 @@ class Add(Action):
|
|
|
14
14
|
def __init__(self, obj):
|
|
15
15
|
self.what_to_add = obj.to_lines()
|
|
16
16
|
|
|
17
|
-
super(
|
|
17
|
+
super().__init__()
|
|
18
18
|
|
|
19
19
|
if obj.__class__.PARENT is not Entity:
|
|
20
20
|
self._add_conditions[(obj.__class__.PARENT.TAG.lower(), None, None)] = False
|
|
@@ -36,7 +36,7 @@ class Modify(Action):
|
|
|
36
36
|
|
|
37
37
|
def __init__(self, **kwargs):
|
|
38
38
|
if len(kwargs) > 1:
|
|
39
|
-
raise
|
|
39
|
+
raise ValueError("It is not supported to set multiple keys yet!")
|
|
40
40
|
|
|
41
41
|
field, value = "", ""
|
|
42
42
|
delete = False
|
|
@@ -49,7 +49,7 @@ class Modify(Action):
|
|
|
49
49
|
|
|
50
50
|
self.init(field, value, delete)
|
|
51
51
|
|
|
52
|
-
super(
|
|
52
|
+
super().__init__()
|
|
53
53
|
|
|
54
54
|
def init(self, field, value, delete):
|
|
55
55
|
self.field = field.lower()
|
|
@@ -58,7 +58,7 @@ class Modify(Action):
|
|
|
58
58
|
|
|
59
59
|
def do(self, obj, all_lines, properties_lines, writer):
|
|
60
60
|
if not obj.__class__.HAS_PROPERTIES:
|
|
61
|
-
raise
|
|
61
|
+
raise AttributeError("Entity with tag '" + obj.__class__.TAG + "' does not expect to have properties!")
|
|
62
62
|
|
|
63
63
|
new_properties = list(properties_lines)
|
|
64
64
|
|
|
@@ -69,12 +69,10 @@ class Modify(Action):
|
|
|
69
69
|
if end_pos != -1:
|
|
70
70
|
if line.find("/>") != -1 and line.find("/>") < end_pos:
|
|
71
71
|
end_pos = line.find("/>")
|
|
72
|
-
# if
|
|
73
72
|
|
|
74
73
|
line = line[:end_pos] + " %s=%s" % (self.field, self.value) + line[end_pos:]
|
|
74
|
+
new_properties[-1] = line
|
|
75
75
|
break
|
|
76
|
-
|
|
77
|
-
new_properties[-1] = line
|
|
78
76
|
else:
|
|
79
77
|
for inx, line in enumerate(new_properties):
|
|
80
78
|
pos = line.lower().find(self.field + "=")
|
|
@@ -90,11 +88,9 @@ class Modify(Action):
|
|
|
90
88
|
line[pos: pos + len(self.field) + 1] + t_line,
|
|
91
89
|
line[pos: pos + len(self.field) + 1] + self.value,
|
|
92
90
|
)
|
|
93
|
-
|
|
91
|
+
new_properties[inx] = line
|
|
94
92
|
break
|
|
95
93
|
|
|
96
|
-
new_properties[inx] = line
|
|
97
|
-
|
|
98
94
|
writer.modify(len(all_lines), properties_lines, new_properties)
|
|
99
95
|
|
|
100
96
|
|
|
@@ -134,7 +130,7 @@ class Get(Action):
|
|
|
134
130
|
double_quotes_count = 0
|
|
135
131
|
single_quotes_count = 0
|
|
136
132
|
|
|
137
|
-
for token in filter(lambda x: x
|
|
133
|
+
for token in filter(lambda x: x not in ("", "<", "/>", ">"), properties_lines.split()[1:]):
|
|
138
134
|
# ---------------------
|
|
139
135
|
# Logic to combine values in quotes are separated
|
|
140
136
|
# by space
|
|
@@ -165,10 +161,10 @@ class Get(Action):
|
|
|
165
161
|
|
|
166
162
|
key, value = t_list[0], t_list[1]
|
|
167
163
|
|
|
168
|
-
if value
|
|
164
|
+
if value.endswith("/>"):
|
|
169
165
|
value = value[:-2]
|
|
170
166
|
|
|
171
|
-
if value
|
|
167
|
+
if value.endswith(">") or value.endswith("/"):
|
|
172
168
|
value = value[:-1]
|
|
173
169
|
|
|
174
170
|
properties_dict[key.lower()] = value.replace('"', "")
|
|
@@ -183,7 +179,7 @@ class Get(Action):
|
|
|
183
179
|
class GetAll(Action):
|
|
184
180
|
|
|
185
181
|
def __init__(self):
|
|
186
|
-
super(
|
|
182
|
+
super().__init__()
|
|
187
183
|
self.result = []
|
|
188
184
|
|
|
189
185
|
def do(self, obj, all_lines, properties_lines, writer):
|
|
@@ -23,7 +23,7 @@ def get_properties(declaration):
|
|
|
23
23
|
return properties
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
class Generator
|
|
26
|
+
class Generator:
|
|
27
27
|
|
|
28
28
|
def __iter__(self):
|
|
29
29
|
return self
|
|
@@ -105,14 +105,12 @@ class Action(ABC):
|
|
|
105
105
|
return True
|
|
106
106
|
|
|
107
107
|
def add_where(self, tag, **kwargs):
|
|
108
|
-
if
|
|
109
|
-
tag = tag
|
|
110
|
-
else:
|
|
108
|
+
if not isinstance(tag, str):
|
|
111
109
|
# for case when it's class name
|
|
112
110
|
tag = tag.TAG
|
|
113
111
|
|
|
114
112
|
if len(kwargs) > 1:
|
|
115
|
-
raise
|
|
113
|
+
raise ValueError("It is not support to set multiple keys yet!")
|
|
116
114
|
|
|
117
115
|
if len(kwargs) == 0:
|
|
118
116
|
self.conditions[(tag.lower(), None, None)] = False
|
|
@@ -120,10 +118,13 @@ class Action(ABC):
|
|
|
120
118
|
self.conditions[(tag.lower(), list(kwargs.keys())[0].lower(), list(kwargs.values())[0])] = False
|
|
121
119
|
|
|
122
120
|
|
|
123
|
-
def apply_actions(func, reader, writer, actions=
|
|
121
|
+
def apply_actions(func, reader, writer, actions=None, flush=False):
|
|
124
122
|
from locator_parser.io import LinesReader
|
|
125
123
|
from locator_parser.actions import DoNothing
|
|
126
124
|
|
|
125
|
+
if actions is None:
|
|
126
|
+
actions = []
|
|
127
|
+
|
|
127
128
|
if len(actions) == 0:
|
|
128
129
|
actions.append(DoNothing())
|
|
129
130
|
|
|
@@ -173,7 +174,7 @@ class Writer(ABC):
|
|
|
173
174
|
elif msg_type == Writer.NEW_MSG:
|
|
174
175
|
lines = yield
|
|
175
176
|
|
|
176
|
-
assert
|
|
177
|
+
assert isinstance(lines, list)
|
|
177
178
|
|
|
178
179
|
self.lines = self.lines[:-1] + lines + self.lines[-1:]
|
|
179
180
|
elif msg_type == Writer.MODIFY_MSG:
|
|
@@ -316,9 +317,11 @@ class Entity(Generator, ABC):
|
|
|
316
317
|
self.finish(writer, action)
|
|
317
318
|
return
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
try:
|
|
321
|
+
line = next(reader)
|
|
322
|
+
yield line
|
|
323
|
+
except StopIteration:
|
|
324
|
+
return
|
|
322
325
|
|
|
323
326
|
def finish(self, writer, action):
|
|
324
327
|
if self.__do:
|
|
@@ -7,12 +7,12 @@ class FileWriter(Writer):
|
|
|
7
7
|
def __init__(self, file_path):
|
|
8
8
|
self.__path = file_path
|
|
9
9
|
|
|
10
|
-
super(
|
|
10
|
+
super().__init__()
|
|
11
11
|
|
|
12
12
|
def flush(self):
|
|
13
13
|
with open(self.__path, "w") as fout:
|
|
14
14
|
for line in self.lines:
|
|
15
|
-
if line
|
|
15
|
+
if not line.endswith("\n"):
|
|
16
16
|
line += "\n"
|
|
17
17
|
|
|
18
18
|
fout.write(line)
|
|
@@ -27,10 +27,12 @@ class PrintWriter(Writer):
|
|
|
27
27
|
class FileReader(Reader):
|
|
28
28
|
|
|
29
29
|
def __init__(self, file_path):
|
|
30
|
+
# pylint: disable-next=consider-using-with
|
|
30
31
|
self.iterable_object = open(file_path.replace('"', ""), "r")
|
|
32
|
+
# pylint: disable-next=unused-private-member
|
|
31
33
|
self.__finalizer = weakref.finalize(self, lambda x: x.close(), self.iterable_object)
|
|
32
34
|
|
|
33
|
-
super(
|
|
35
|
+
super().__init__()
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
class LinesReader(Reader):
|
|
@@ -38,4 +40,4 @@ class LinesReader(Reader):
|
|
|
38
40
|
def __init__(self, lines):
|
|
39
41
|
self.iterable_object = lines.split("\n")
|
|
40
42
|
|
|
41
|
-
super(
|
|
43
|
+
super().__init__()
|
|
@@ -18,7 +18,7 @@ class Include(Entity):
|
|
|
18
18
|
# env variable found in the path
|
|
19
19
|
if matched:
|
|
20
20
|
if matched.group(0)[2:-1] not in os.environ:
|
|
21
|
-
raise
|
|
21
|
+
raise RuntimeError("Includes use not defined environment variable: % s" % matched.group(0))
|
|
22
22
|
|
|
23
23
|
path = path.replace(matched.group(0), os.environ[matched.group(0)[2:-1]])
|
|
24
24
|
|
|
@@ -3,7 +3,6 @@ import re
|
|
|
3
3
|
import inspect
|
|
4
4
|
|
|
5
5
|
from typing import Union, Optional
|
|
6
|
-
from onetick.py.backports import Literal
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
def snippet_name(example: Union[doctest.Example, str], value):
|
|
@@ -24,6 +23,7 @@ def skip_example(example, value, caller=None):
|
|
|
24
23
|
if isinstance(example, doctest.Example):
|
|
25
24
|
example.skip = True
|
|
26
25
|
return example
|
|
26
|
+
return None
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
OT_DIRECTIVES = {'skip-example': skip_example,
|
|
@@ -76,8 +76,8 @@ class OneTickLib:
|
|
|
76
76
|
if log_file:
|
|
77
77
|
self.set_log_file(log_file)
|
|
78
78
|
elif args != OneTickLib.__args and args:
|
|
79
|
-
raise
|
|
80
|
-
|
|
79
|
+
raise ValueError("OneTickLib was already initialized with different "
|
|
80
|
+
"parameters: Was: {} Now: {}".format(OneTickLib.__args, args))
|
|
81
81
|
|
|
82
82
|
def __eq__(self, otl):
|
|
83
83
|
return self.__dict__ == otl.__dict__
|
|
@@ -134,5 +134,8 @@ class OneTickLib:
|
|
|
134
134
|
:param config_parameter_value: new value of the param
|
|
135
135
|
"""
|
|
136
136
|
if OneTickLib.__instance:
|
|
137
|
-
raise
|
|
138
|
-
|
|
137
|
+
raise RuntimeError('This method should be called before OneTickLib object is constructed to have effect.')
|
|
138
|
+
try:
|
|
139
|
+
pyomd.OneTickLib.override_config_value(config_parameter_name, config_parameter_value) # noqa
|
|
140
|
+
except NameError:
|
|
141
|
+
raise RuntimeError('This method is not available in WebAPI mode')
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import os
|
|
3
3
|
from . import _version
|
|
4
4
|
__version__ = _version.VERSION
|
|
5
|
-
__webapi__: bool = bool(os.getenv("OTP_WEBAPI"
|
|
5
|
+
__webapi__: bool = bool(os.getenv("OTP_WEBAPI"))
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def __validate_onetick_query_integration(): # noqa
|
|
@@ -13,10 +13,9 @@ def __validate_onetick_query_integration(): # noqa
|
|
|
13
13
|
before raising an exception, we check if onetick.query_webapi is installed.
|
|
14
14
|
If it is installed, we set OTP_WEBAPI environment variable and avoid raising any exception/warning.
|
|
15
15
|
"""
|
|
16
|
-
import os
|
|
17
16
|
global __webapi__
|
|
18
17
|
|
|
19
|
-
if os.getenv("OTP_SKIP_OTQ_VALIDATION"
|
|
18
|
+
if os.getenv("OTP_SKIP_OTQ_VALIDATION"):
|
|
20
19
|
return
|
|
21
20
|
|
|
22
21
|
_otq_import_ex = None
|
|
@@ -86,7 +85,7 @@ def __validate_onetick_query_integration(): # noqa
|
|
|
86
85
|
except ImportError:
|
|
87
86
|
print('onetick.query_webapi is not available')
|
|
88
87
|
|
|
89
|
-
if
|
|
88
|
+
if isinstance(_otq_import_ex, ImportError):
|
|
90
89
|
raise ImportError(
|
|
91
90
|
'The above exception is probably raised '
|
|
92
91
|
'because your python version is unsupported in this OneTick build'
|
|
@@ -127,7 +126,6 @@ def __validate_onetick_query_integration(): # noqa
|
|
|
127
126
|
|
|
128
127
|
|
|
129
128
|
def __get_missed_paths(env, *paths, found_callback=None):
|
|
130
|
-
import os
|
|
131
129
|
from pathlib import Path
|
|
132
130
|
|
|
133
131
|
missed_paths = []
|
|
@@ -147,9 +145,7 @@ def __get_missed_paths(env, *paths, found_callback=None):
|
|
|
147
145
|
|
|
148
146
|
|
|
149
147
|
def __set_onetick_path_variables():
|
|
150
|
-
|
|
151
|
-
global __webapi__
|
|
152
|
-
if __webapi__ or os.getenv("OTP_SKIP_OTQ_VALIDATION", False):
|
|
148
|
+
if __webapi__ or os.getenv("OTP_SKIP_OTQ_VALIDATION"):
|
|
153
149
|
return
|
|
154
150
|
import warnings
|
|
155
151
|
import onetick.query as otq
|
|
@@ -157,6 +153,7 @@ def __set_onetick_path_variables():
|
|
|
157
153
|
|
|
158
154
|
onetick_query_init = Path(otq.__file__)
|
|
159
155
|
|
|
156
|
+
# pylint: disable=global-variable-undefined
|
|
160
157
|
global __main_one_tick_dir__, __one_tick_bin_dir__, __one_tick_python_dir__
|
|
161
158
|
__one_tick_python_dir__ = str(onetick_query_init.parents[2])
|
|
162
159
|
__one_tick_bin_dir__ = str(onetick_query_init.parents[3])
|
|
@@ -196,7 +193,6 @@ from onetick.py.sources import (Tick, TTicks, Ticks, Orders, Trades, NBBO, Quote
|
|
|
196
193
|
by_symbol, ODBC, SplitQueryOutputBySymbol, DataFile, PointInTime,
|
|
197
194
|
ReadSnapshot, ShowSnapshotList, FindSnapshotSymbols)
|
|
198
195
|
from onetick.py.utils import adaptive, range, perf
|
|
199
|
-
from onetick.py.core.eval_query import eval
|
|
200
196
|
from onetick.py.session import Session, TestSession, Config, Locator, HTTPSession
|
|
201
197
|
from onetick.py.servers import RemoteTS, LoadBalancing, FaultTolerance
|
|
202
198
|
from onetick.py.db import DB, RefDB
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# This file was generated automatically. DO NOT CHANGE.
|
|
2
|
-
VERSION = '1.
|
|
2
|
+
VERSION = '1.164.0'
|
|
@@ -78,6 +78,7 @@ def operation_replacer(method):
|
|
|
78
78
|
aggs = aggrs.values()
|
|
79
79
|
else:
|
|
80
80
|
name = args[0] if args else kwargs.get('name')
|
|
81
|
+
# pylint: disable-next=unidiomatic-typecheck
|
|
81
82
|
if type(obj.column_name) is _Operation and name is None:
|
|
82
83
|
raise ValueError('Output field name must be specified when aggregating operation')
|
|
83
84
|
aggs = [obj]
|
|
@@ -85,6 +86,7 @@ def operation_replacer(method):
|
|
|
85
86
|
# Add operation from each aggregation object to source `res` as column
|
|
86
87
|
# and replace *column_name* property in each aggregation object with this column's name.
|
|
87
88
|
for i, agg in enumerate(aggs):
|
|
89
|
+
# pylint: disable-next=unidiomatic-typecheck
|
|
88
90
|
if type(agg.column_name) is _Operation:
|
|
89
91
|
tmp_name = f'__TMP_AGG_COLUMN_{i}__'
|
|
90
92
|
res[tmp_name] = agg.column_name
|
|
@@ -242,7 +244,7 @@ class _Aggregation(ABC):
|
|
|
242
244
|
"""
|
|
243
245
|
Abstract method that implements common logic for aggregations
|
|
244
246
|
"""
|
|
245
|
-
if
|
|
247
|
+
if isinstance(column, list):
|
|
246
248
|
column = ','.join(map(str, column))
|
|
247
249
|
|
|
248
250
|
column_name: Union[str, _Operation] = str(column)
|
|
@@ -251,6 +253,7 @@ class _Aggregation(ABC):
|
|
|
251
253
|
# TODO: need to understand how to better work with alias
|
|
252
254
|
column_name = "TIMESTAMP"
|
|
253
255
|
|
|
256
|
+
# pylint: disable-next=unidiomatic-typecheck
|
|
254
257
|
if type(column) is _Operation:
|
|
255
258
|
column_name = column
|
|
256
259
|
|
|
@@ -314,7 +317,7 @@ class _Aggregation(ABC):
|
|
|
314
317
|
self.end_condition_per_group = end_condition_per_group
|
|
315
318
|
self.boundary_tick_bucket = boundary_tick_bucket
|
|
316
319
|
self.large_ints = False
|
|
317
|
-
if isinstance(group_by, _Operation
|
|
320
|
+
if isinstance(group_by, (_Operation, str)):
|
|
318
321
|
group_by = [group_by]
|
|
319
322
|
self.group_by = group_by or []
|
|
320
323
|
self.groups_to_display = groups_to_display
|
|
@@ -327,7 +330,7 @@ class _Aggregation(ABC):
|
|
|
327
330
|
def _attr2str(value) -> str:
|
|
328
331
|
if isinstance(value, bool):
|
|
329
332
|
return 'true' if value else 'false'
|
|
330
|
-
if
|
|
333
|
+
if isinstance(value, list):
|
|
331
334
|
return ','.join(value)
|
|
332
335
|
return str(value)
|
|
333
336
|
|
|
@@ -436,7 +439,7 @@ class _Aggregation(ABC):
|
|
|
436
439
|
@staticmethod
|
|
437
440
|
def validate_output_name(schema: Dict, name: Union[List, str]):
|
|
438
441
|
"""checks that aggregation won't output columns with same names"""
|
|
439
|
-
if
|
|
442
|
+
if not isinstance(name, list):
|
|
440
443
|
name = [name]
|
|
441
444
|
|
|
442
445
|
same_fields = []
|
|
@@ -31,7 +31,9 @@ _column_doc = param_doc(
|
|
|
31
31
|
_running_doc = param_doc(
|
|
32
32
|
name='running',
|
|
33
33
|
desc='''
|
|
34
|
-
Aggregation
|
|
34
|
+
See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
|
|
35
|
+
|
|
36
|
+
Specifies if the aggregation will be calculated as a sliding window.
|
|
35
37
|
``running`` and ``bucket_interval`` parameters determines when new buckets are created.
|
|
36
38
|
|
|
37
39
|
* ``running`` = True
|
|
@@ -45,10 +47,10 @@ _running_doc = param_doc(
|
|
|
45
47
|
|
|
46
48
|
* ``bucket_interval`` = 0
|
|
47
49
|
|
|
48
|
-
Left boundary of window will be
|
|
49
|
-
[start_time; tick_t].
|
|
50
|
+
Left boundary of window will be set to query start time. For each tick aggregation will be calculated in
|
|
51
|
+
the interval [start_time; tick_t] from query start time to the tick's timestamp (inclusive).
|
|
50
52
|
|
|
51
|
-
* ``running`` = False
|
|
53
|
+
* ``running`` = False (default)
|
|
52
54
|
|
|
53
55
|
buckets partition the [query start time, query end time) interval into non-overlapping intervals
|
|
54
56
|
of size ``bucket_interval`` (with the last interval possibly of a smaller size).
|
|
@@ -68,6 +70,8 @@ _running_doc = param_doc(
|
|
|
68
70
|
_all_fields_doc = param_doc(
|
|
69
71
|
name='all_fields',
|
|
70
72
|
desc="""
|
|
73
|
+
See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
|
|
74
|
+
|
|
71
75
|
* ``all_fields`` = True
|
|
72
76
|
|
|
73
77
|
output ticks include all fields from the input ticks
|
|
@@ -95,15 +99,25 @@ _all_fields_doc = param_doc(
|
|
|
95
99
|
_all_fields_with_policy_doc = param_doc(
|
|
96
100
|
name='all_fields',
|
|
97
101
|
desc="""
|
|
102
|
+
See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
|
|
103
|
+
|
|
98
104
|
- If ``all_fields`` False - output tick will have only aggregation fields.
|
|
99
105
|
|
|
106
|
+
- If ``all_fields`` is True and ``running`` is False - additional fields will be copied from the first
|
|
107
|
+
tick in the bucket to the output tick.
|
|
108
|
+
|
|
100
109
|
- If ``all_fields`` False and ``running`` True - output ticks are created when a tick enters or leaves the
|
|
101
110
|
sliding window.
|
|
102
111
|
|
|
103
|
-
- If ``all_fields`` True - an output tick is generated only for arrival events,
|
|
112
|
+
- If ``all_fields`` True and ``running`` True - an output tick is generated only for arrival events,
|
|
104
113
|
but all attributes from the input tick causing an arrival event are copied over to the output tick
|
|
105
114
|
and the aggregation is added as another attribute.
|
|
106
115
|
|
|
116
|
+
- If ``all_fields`` True and ``running`` "when_ticks_exit_window" -
|
|
117
|
+
an output tick is generated only for exit events,
|
|
118
|
+
but all attributes from the exiting tick are copied over to the output tick
|
|
119
|
+
and the aggregation is added as another attribute.
|
|
120
|
+
|
|
107
121
|
- If ``all_fields`` set to "first", "last", "high", or "low" - explicitly set tick selection policy for all
|
|
108
122
|
fields values. For "high" and "low" "PRICE" field will be selected as an input.
|
|
109
123
|
Otherwise, you will get the runtime error.
|
|
@@ -114,7 +128,8 @@ _all_fields_with_policy_doc = param_doc(
|
|
|
114
128
|
first parameter.
|
|
115
129
|
""",
|
|
116
130
|
default=False,
|
|
117
|
-
|
|
131
|
+
str_annotation=("True, False, 'when_ticks_exit_window', 'first', 'last', 'high', 'low', "
|
|
132
|
+
":py:func:`~onetick.py.agg.high_tick`, :py:func:`~onetick.py.agg.low_tick`"),
|
|
118
133
|
)
|
|
119
134
|
_bucket_interval_doc = param_doc(
|
|
120
135
|
name='bucket_interval',
|
|
@@ -887,7 +902,7 @@ def copy_method(obj, mimic=True, drop_examples=False):
|
|
|
887
902
|
return _decorator
|
|
888
903
|
|
|
889
904
|
|
|
890
|
-
def copy_signature(obj, add_self=False, drop_parameters=
|
|
905
|
+
def copy_signature(obj, add_self=False, drop_parameters=None, return_annotation='Source'):
|
|
891
906
|
"""
|
|
892
907
|
Decorator that copies signature of the callable ``obj`` to the decorated function.
|
|
893
908
|
"""
|
|
@@ -227,7 +227,7 @@ class Distinct(_AggregationTSSelection):
|
|
|
227
227
|
keys: Union[str, List[str], _Column, List[_Column]],
|
|
228
228
|
key_attrs_only: bool = True,
|
|
229
229
|
*args, **kwargs):
|
|
230
|
-
keys = keys if
|
|
230
|
+
keys = keys if isinstance(keys, list) else [keys] # type: ignore
|
|
231
231
|
super().__init__(column=keys, *args, **kwargs) # type: ignore
|
|
232
232
|
self.key_attrs_only = key_attrs_only
|
|
233
233
|
|
|
@@ -26,6 +26,7 @@ def _convert_dt_to_str(dt: Union[str, datetime, otp_datetime]):
|
|
|
26
26
|
return dt
|
|
27
27
|
elif isinstance(dt, (datetime, otp_datetime)):
|
|
28
28
|
return dt.strftime('%Y%m%d%H%M%S.%f')
|
|
29
|
+
raise ValueError(f"Unsupported value for 'dt' parameter: {type(dt)}")
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
def _convert_time_intervals(
|
|
@@ -383,7 +383,7 @@ class _TickSequence(_StateBase):
|
|
|
383
383
|
return isinstance(self._owner, _EmulateInputObject)
|
|
384
384
|
|
|
385
385
|
def _default_schema(self):
|
|
386
|
-
return
|
|
386
|
+
return dict(self._owner.schema.items())
|
|
387
387
|
|
|
388
388
|
@property
|
|
389
389
|
def schema(self) -> dict:
|
|
@@ -391,7 +391,7 @@ class _TickSequence(_StateBase):
|
|
|
391
391
|
Get schema of the tick sequence.
|
|
392
392
|
"""
|
|
393
393
|
fields = None
|
|
394
|
-
if
|
|
394
|
+
if isinstance(self._schema, list):
|
|
395
395
|
fields = self._schema
|
|
396
396
|
self._schema = None
|
|
397
397
|
if not self._schema:
|
{onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/aggregations.py
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import warnings
|
|
2
|
-
from
|
|
3
|
-
from typing import TYPE_CHECKING, Optional, Tuple, Union
|
|
2
|
+
from typing import TYPE_CHECKING, Tuple, Union
|
|
4
3
|
|
|
5
4
|
from onetick import py as otp
|
|
6
5
|
from onetick.py import aggregations
|
|
@@ -397,8 +396,8 @@ def distinct(self: 'Source', *args, **kwargs):
|
|
|
397
396
|
"""
|
|
398
397
|
if 'bucket_interval_units' in kwargs:
|
|
399
398
|
kwargs['bucket_units'] = kwargs.pop('bucket_interval_units')
|
|
400
|
-
|
|
401
|
-
return
|
|
399
|
+
aggr = aggregations.functions.distinct(*args, **kwargs)
|
|
400
|
+
return aggr.apply(self)
|
|
402
401
|
|
|
403
402
|
|
|
404
403
|
# mimic=False for backward compatibility
|
|
@@ -421,8 +420,8 @@ def high_time(self: 'Source', *args, **kwargs):
|
|
|
421
420
|
FutureWarning,
|
|
422
421
|
stacklevel=2,
|
|
423
422
|
)
|
|
424
|
-
|
|
425
|
-
return
|
|
423
|
+
aggr = aggregations.functions.high_time(*args, **kwargs)
|
|
424
|
+
return aggr.apply(self, 'VALUE')
|
|
426
425
|
|
|
427
426
|
|
|
428
427
|
# mimic=False for backward compatibility
|
|
@@ -445,8 +444,8 @@ def low_time(self: 'Source', *args, **kwargs):
|
|
|
445
444
|
FutureWarning,
|
|
446
445
|
stacklevel=2,
|
|
447
446
|
)
|
|
448
|
-
|
|
449
|
-
return
|
|
447
|
+
aggr = aggregations.functions.low_time(*args, **kwargs)
|
|
448
|
+
return aggr.apply(self, 'VALUE')
|
|
450
449
|
|
|
451
450
|
|
|
452
451
|
@copy_method(aggregations.functions.ob_snapshot)
|
|
@@ -800,7 +799,7 @@ def process_by_group(
|
|
|
800
799
|
output_schema[field] = input_schema[field]
|
|
801
800
|
for field, field_type in output_schema.items():
|
|
802
801
|
output_source.schema[field] = field_type
|
|
803
|
-
output_source = output_source[
|
|
802
|
+
output_source = output_source[list(output_schema)]
|
|
804
803
|
output_source._merge_tmp_otq(main_source)
|
|
805
804
|
output_sources.append(output_source)
|
|
806
805
|
|
{onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/applyers.py
RENAMED
|
@@ -174,7 +174,7 @@ def apply(self: 'Source', obj) -> Union['otp.Column', 'Source']:
|
|
|
174
174
|
return apply_lambda(obj, _EmulateObject(self))
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
def _extract_columns_from_script(
|
|
177
|
+
def _extract_columns_from_script(script_text):
|
|
178
178
|
result = {}
|
|
179
179
|
supported_types = {
|
|
180
180
|
'byte',
|
|
@@ -199,7 +199,7 @@ def _extract_columns_from_script(script):
|
|
|
199
199
|
length = r"(\[(?P<length>\d+)\])?"
|
|
200
200
|
name = r"\s+(?P<name>\w+)\s*=\s*"
|
|
201
201
|
pattern = re.compile(types + length + name)
|
|
202
|
-
for p in re.finditer(pattern,
|
|
202
|
+
for p in re.finditer(pattern, script_text):
|
|
203
203
|
groupdict = p.groupdict()
|
|
204
204
|
type_ = ott.str2type(groupdict["type"]) if groupdict["type"] in supported_types else None
|
|
205
205
|
if type_:
|
{onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/debugs.py
RENAMED
|
@@ -236,23 +236,25 @@ def dump(
|
|
|
236
236
|
if label:
|
|
237
237
|
self_c['_OUT_LABEL_'] = label
|
|
238
238
|
|
|
239
|
-
self_c.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
239
|
+
self_c.write_text(
|
|
240
|
+
formats_of_fields={'TIMESTAMP': f'%|{configuration.config.tz}|%d-%m-%Y %H:%M:%S.%J'},
|
|
241
|
+
prepend_timestamp=True,
|
|
242
|
+
prepend_symbol_name=False,
|
|
243
|
+
propagate_ticks=True,
|
|
244
|
+
inplace=True,
|
|
246
245
|
)
|
|
247
246
|
|
|
248
247
|
# print <no data> in case there are 0 ticks
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
if hasattr(otq, 'InsertAtEnd'):
|
|
249
|
+
self_c.sink(otq.InsertAtEnd(delimiter_name='AT_END'))
|
|
250
|
+
self_c.schema['AT_END'] = int
|
|
251
|
+
self_c.state_vars['COUNT'] = otp.state.var(0, scope='branch')
|
|
252
|
+
self_c.state_vars['COUNT'] += 1
|
|
253
|
+
self_c, _ = self_c[(self_c['AT_END'] == 1) & (self_c.state_vars['COUNT'] == 1)]
|
|
254
|
+
self_c['NO_DATA'] = '<no data>'
|
|
255
|
+
self_c = self_c[['NO_DATA']]
|
|
256
|
+
self_c.write_text(output_headers=False, prepend_timestamp=False, prepend_symbol_name=False,
|
|
257
|
+
propagate_ticks=False, inplace=True)
|
|
256
258
|
|
|
257
259
|
# Do not propagate ticks then, because we want just to write them into
|
|
258
260
|
# the std::out. We have to do that, because otherwise these ticks would
|
{onetick_py-1.162.2 → onetick_py-1.164.0}/src/onetick/py/core/_source/source_methods/drops.py
RENAMED
|
@@ -111,7 +111,7 @@ def drop(self: 'Source', columns: List[Any], inplace=False) -> Optional['Source'
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
def __delitem__(self: 'Source', obj):
|
|
114
|
-
if isinstance(obj, list
|
|
114
|
+
if isinstance(obj, (list, tuple)):
|
|
115
115
|
objs = obj
|
|
116
116
|
else:
|
|
117
117
|
objs = (obj,)
|