This is an automated email from the ASF dual-hosted git repository. colinlee pushed a commit to branch colin_fix_config in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit a44d4f619a4824a55642d369e31aee029afc67c7 Author: colin <[email protected]> AuthorDate: Wed Apr 23 17:34:04 2025 +0800 fix code format. --- python/setup.py | 9 ++------- python/tests/test_write_and_read.py | 22 ++++++++-------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/python/setup.py b/python/setup.py index c25121f4..332c2a6e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -27,13 +27,13 @@ import os version = "2.1.0.dev" system = platform.system() + def copy_tsfile_lib(source_dir, target_dir, suffix): lib_file_name = f"libtsfile.{suffix}" source = os.path.join(source_dir, lib_file_name) target = os.path.join(target_dir, lib_file_name) if os.path.exists(source): - print("copy shared library from %s to %s" % (source, target)) shutil.copyfile(source, target) if system == "Linux": @@ -41,8 +41,6 @@ def copy_tsfile_lib(source_dir, target_dir, suffix): if os.path.exists(link_name): os.remove(link_name) os.symlink(lib_file_name, link_name) - print("create link %s" % link_name) - print("so exist:", os.path.exists(target)) elif system == "Darwin": link_name = os.path.join(target_dir, "libtsfile.dylib") if os.path.exists(link_name): @@ -62,7 +60,6 @@ shutil.copytree( ) - def copy_tsfile_header(source): for file in source: if os.path.exists(file): @@ -78,7 +75,6 @@ source_headers = [ copy_tsfile_header(source_headers) - ## Copy shared library tsfile_shared_source_dir = os.path.join(project_dir, "..", "cpp", "target", "build", "lib") tsfile_shared_dir = os.path.join(project_dir, "tsfile") @@ -90,8 +86,7 @@ elif system == "Linux": else: copy_tsfile_lib(tsfile_shared_source_dir, tsfile_shared_dir, "dll") -tsfile_include_dir=os.path.join(project_dir, "tsfile", "include") - +tsfile_include_dir = os.path.join(project_dir, "tsfile", "include") ext_modules_tsfile = [ # utils: from python to c or c to python. diff --git a/python/tests/test_write_and_read.py b/python/tests/test_write_and_read.py index ea84d898..161ca54b 100644 --- a/python/tests/test_write_and_read.py +++ b/python/tests/test_write_and_read.py @@ -202,7 +202,7 @@ def test_lower_case_name(): for i in range(100): tablet.add_timestamp(i, i) tablet.add_value_by_name("device", i, "device" + str(i)) - tablet.add_value_by_name("valuE", i, i * 1.1) + tablet.add_value_by_name("valuE", i, i * 1.1) writer.write_table(tablet) @@ -214,6 +214,7 @@ def test_lower_case_name(): assert data_frame.shape == (100, 3) assert data_frame["value"].sum() == 5445.0 + def test_tsfile_config(): from tsfile import get_tsfile_config, set_tsfile_config @@ -221,18 +222,18 @@ def test_tsfile_config(): assert config["chunk_group_size_threshold_"] == 0 table = TableSchema("tEst_Table", - [ColumnSchema("Device", TSDataType.STRING, ColumnCategory.TAG), - ColumnSchema("vAlue", TSDataType.DOUBLE, ColumnCategory.FIELD)]) + [ColumnSchema("Device", TSDataType.STRING, ColumnCategory.TAG), + ColumnSchema("vAlue", TSDataType.DOUBLE, ColumnCategory.FIELD)]) os.remove("test1.tsfile") with TsFileTableWriter("test1.tsfile", table) as writer: tablet = Tablet(["device", "VALUE"], [TSDataType.STRING, TSDataType.DOUBLE]) for i in range(100): tablet.add_timestamp(i, i) tablet.add_value_by_name("device", i, "device" + str(i)) - tablet.add_value_by_name("valuE", i, i * 1.1) + tablet.add_value_by_name("valuE", i, i * 1.1) writer.write_table(tablet) - + config_normal = get_tsfile_config() assert config_normal["chunk_group_size_threshold_"] == 128 * 1024 * 1024 @@ -242,7 +243,7 @@ def test_tsfile_config(): for i in range(100): tablet.add_timestamp(i, i) tablet.add_value_by_name("device", i, "device" + str(i)) - tablet.add_value_by_name("valuE", i, i * 1.1) + tablet.add_value_by_name("valuE", i, i * 1.1) writer.write_table(tablet) config_modified = get_tsfile_config() @@ -253,11 +254,4 @@ def test_tsfile_config(): with pytest.raises(TypeError): set_tsfile_config({"time_compress_type_": TSDataType.DOUBLE}) with pytest.raises(TypeError): - set_tsfile_config({'chunk_group_size_threshold_': -1 *100 * 20}) - - - - - - - + set_tsfile_config({'chunk_group_size_threshold_': -1 * 100 * 20})
