From 54da0ce8248b26a6bbffccde1a6f87c5fb7ee35b Mon Sep 17 00:00:00 2001 From: sarad Date: Thu, 26 Aug 2021 18:48:46 +0530 Subject: [PATCH 1/3] fix: backslash escaping in serialization to Line protocol --- influxdb/line_protocol.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/influxdb/line_protocol.py b/influxdb/line_protocol.py index 25dd2ad7..ab129fea 100644 --- a/influxdb/line_protocol.py +++ b/influxdb/line_protocol.py @@ -60,8 +60,6 @@ def _convert_timestamp(timestamp, precision=None): def _escape_tag(tag): tag = _get_unicode(tag, force=True) return tag.replace( - "\\", "\\\\" - ).replace( " ", "\\ " ).replace( ",", "\\," @@ -82,7 +80,6 @@ def _escape_tag_value(value): def quote_ident(value): """Indent the quotes.""" return "\"{}\"".format(value - .replace("\\", "\\\\") .replace("\"", "\\\"") .replace("\n", "\\n")) @@ -90,7 +87,6 @@ def quote_ident(value): def quote_literal(value): """Quote provided literal.""" return "'{}'".format(value - .replace("\\", "\\\\") .replace("'", "\\'")) From 4ebd133c01c6999450c6490fe587ef70134d9694 Mon Sep 17 00:00:00 2001 From: sarad Date: Thu, 26 Aug 2021 18:52:27 +0530 Subject: [PATCH 2/3] fixing test --- .gitignore | 1 + influxdb/__init__.py | 2 +- influxdb/tests/test_line_protocol.py | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d970c44c..9b70e41a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ docs/build/ .coverage cover env +.idea/ diff --git a/influxdb/__init__.py b/influxdb/__init__.py index 59916c26..e66f80ea 100644 --- a/influxdb/__init__.py +++ b/influxdb/__init__.py @@ -18,4 +18,4 @@ ] -__version__ = '5.3.1' +__version__ = '5.3.2' diff --git a/influxdb/tests/test_line_protocol.py b/influxdb/tests/test_line_protocol.py index 5b344990..1e3a4825 100644 --- a/influxdb/tests/test_line_protocol.py +++ b/influxdb/tests/test_line_protocol.py @@ -44,7 +44,7 @@ def test_make_lines(self): self.assertEqual( line_protocol.make_lines(data), - 'test,backslash_tag=C:\\\\,integer_tag=2,string_tag=hello ' + 'test,backslash_tag=C:\\,integer_tag=2,string_tag=hello ' 'bool_val=True,float_val=1.1,int_val=1i,string_val="hello!"\n' ) @@ -160,14 +160,14 @@ def test_quote_ident(self): """Test quote indentation in TestLineProtocol object.""" self.assertEqual( line_protocol.quote_ident(r"""\foo ' bar " Örf"""), - r'''"\\foo ' bar \" Örf"''' + r'''"\foo ' bar \" Örf"''' ) def test_quote_literal(self): """Test quote literal in TestLineProtocol object.""" self.assertEqual( line_protocol.quote_literal(r"""\foo ' bar " Örf"""), - r"""'\\foo \' bar " Örf'""" + r"""'\foo \' bar " Örf'""" ) def test_float_with_long_decimal_fraction(self): From 23a3a45f07305f90595e2525b4f4acb34d4f8229 Mon Sep 17 00:00:00 2001 From: sarad Date: Thu, 26 Aug 2021 18:55:45 +0530 Subject: [PATCH 3/3] minor revert --- .gitignore | 1 - influxdb/__init__.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9b70e41a..d970c44c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,3 @@ docs/build/ .coverage cover env -.idea/ diff --git a/influxdb/__init__.py b/influxdb/__init__.py index e66f80ea..59916c26 100644 --- a/influxdb/__init__.py +++ b/influxdb/__init__.py @@ -18,4 +18,4 @@ ] -__version__ = '5.3.2' +__version__ = '5.3.1'