summaryrefslogtreecommitdiffstats
path: root/library/python/testing
diff options
context:
space:
mode:
authorvitalyisaev <[email protected]>2023-06-29 10:00:50 +0300
committervitalyisaev <[email protected]>2023-06-29 10:00:50 +0300
commit6ffe9e53658409f212834330e13564e4952558f6 (patch)
tree85b1e00183517648b228aafa7c8fb07f5276f419 /library/python/testing
parent726057070f9c5a91fc10fde0d5024913d10f1ab9 (diff)
YQ Connector: support managed ClickHouse
Со стороны dqrun можно обратиться к инстансу коннектора, который работает на streaming стенде, и извлечь данные из облачного CH.
Diffstat (limited to 'library/python/testing')
-rw-r--r--library/python/testing/style/rules.py40
-rw-r--r--library/python/testing/style/ya.make11
2 files changed, 51 insertions, 0 deletions
diff --git a/library/python/testing/style/rules.py b/library/python/testing/style/rules.py
new file mode 100644
index 00000000000..1f4d283769d
--- /dev/null
+++ b/library/python/testing/style/rules.py
@@ -0,0 +1,40 @@
+import os
+import six
+
+
+def style_required(path, data, skip_links=True):
+ if get_skip_reason(path, data, skip_links):
+ return False
+ return True
+
+
+def get_skip_reason(path, data, skip_links=True):
+ return _path_skip_reason(path, skip_links) or _content_skip_reason(path, data)
+
+
+def _path_skip_reason(path, skip_links=True):
+ if '/generated/' in path:
+ return "path '{}' contains '/generated/'".format(path)
+
+ if path and '/contrib/' in path:
+ return "path '{}' contains '/contrib/'".format(path)
+
+ if path and '/vendor/' in path:
+ return "path '{}' contains '/vendor/'".format(path)
+
+ if skip_links and os.path.islink(path):
+ return "path '{}' is a symlink".format(path)
+
+
+def _content_skip_reason(path, data):
+ if not isinstance(data, six.string_types):
+ data = data.decode()
+
+ for substr in [
+ '# DO_NOT_STYLE',
+ '// DO_NOT_STYLE',
+ 'THIS SOFTWARE',
+ 'WITHOUT WARRANTY',
+ ]:
+ if substr in data:
+ return "file '{}' contains '{}'".format(path, substr)
diff --git a/library/python/testing/style/ya.make b/library/python/testing/style/ya.make
new file mode 100644
index 00000000000..7d3e9efd6b0
--- /dev/null
+++ b/library/python/testing/style/ya.make
@@ -0,0 +1,11 @@
+PY23_LIBRARY()
+
+PY_SRCS(
+ rules.py
+)
+
+PEERDIR(
+ contrib/python/six
+)
+
+END()