tianyun před 2 roky
rodič
revize
4cbf1a5822
23 změnil soubory, kde provedl 44 přidání a 482 odebrání
  1. 0 39
      actuator_test.py
  2. 0 0
      back/__init__.py
  3. 0 0
      back/bookmarks.py
  4. 0 0
      back/catboost_test.py
  5. 0 0
      back/monitor_ip.py
  6. 0 44
      compare_dir.py
  7. 0 29
      index.html
  8. 0 12
      index1.html
  9. 0 25
      invoke.py
  10. 0 29
      notion.py
  11. 1 0
      project-test/Readme.md
  12. 1 0
      project/readme.md
  13. 30 0
      test_file_base64.py
  14. 0 1
      test_py_invoke.py
  15. 0 0
      tmp/gpt/__init__.py
  16. 0 0
      tmp/gpt/gpt.py
  17. 0 0
      tmp/redis/__init__.py
  18. 0 0
      tmp/redis/redis_cli.py
  19. 0 0
      tmp1.py
  20. 0 30
      tmp2.py
  21. 0 0
      tmp3.py
  22. 1 273
      tmp4.py
  23. 11 0
      touch_tmp.sh

+ 0 - 39
actuator_test.py

@@ -1,39 +0,0 @@
-def exec_def(cmd_str, obj):
-    import requests
-    json = requests.post("http://172.18.162.173:8000/exec", json={"function_str": cmd_str, "call_str": "exec(obj)", "param_dict": {"obj": obj}}).json()
-    print(json)
-
-
-# ================[ 自定义部分 Start ]===============
-exec_str = """
-def exec(obj):
-    return obj
-"""
-obj = {
-    "mail_type": "其他",
-    "establish_time": None,
-    "registcapi": "0.0",
-    "reccap": "",
-    "if_fest_phone": "是",
-    "industry": None,
-    "stockpercent": None,
-    "subindustry": None,
-    "credit_no": "111000000036931723",
-    "cn_stockname": None,
-    "province": "福建省",
-    "econkind": None,
-    "cn_change": None,
-    "last_day_faren_change": None
-}
-# ================[ 自定义部分 End ]===============
-
-
-exec_def(exec_str, obj)
-
-
-def exec(obj):
-    if 'name3' in obj:
-        obj['name3'] = 1
-    else:
-        obj['name3'] = 2
-    return obj

+ 0 - 0
back/__init__.py


+ 0 - 0
bookmarks.py → back/bookmarks.py


+ 0 - 0
catboost_test.py → back/catboost_test.py


+ 0 - 0
monitor_ip.py → back/monitor_ip.py


+ 0 - 44
compare_dir.py

@@ -1,44 +0,0 @@
-import zipfile
-import filecmp
-import os
-import shutil
-
-
-def extract_jar(jar_path, extract_path):
-    with zipfile.ZipFile(jar_path, 'r') as zip_ref:
-        zip_ref.extractall(extract_path)
-
-
-def compare_dirs(dir1, dir2):
-    comparison = filecmp.dircmp(dir1, dir2)
-    if comparison.left_only or comparison.right_only or comparison.diff_files:
-        return False
-    else:
-        for subdir in comparison.common_dirs:
-            if not compare_dirs(os.path.join(dir1, subdir), os.path.join(dir2, subdir)):
-                return False
-        return True
-
-
-def compare_jars(jar1, jar2):
-    temp_dir1 = 'temp_dir1'
-    temp_dir2 = 'temp_dir2'
-
-    # Extract jars
-    extract_jar(jar1, temp_dir1)
-    extract_jar(jar2, temp_dir2)
-
-    # Compare directories
-    are_same = compare_dirs(temp_dir1, temp_dir2)
-
-    # Clean up temp directories
-    shutil.rmtree(temp_dir1)
-    shutil.rmtree(temp_dir2)
-
-    return are_same
-
-
-# Test
-jar1 = '/Users/alvin/Downloads/tmp/rxdp-dm-tag-web.jar'
-jar2 = '/Users/alvin/Downloads/tmp/rxdp-dm-tag-web1.jar'
-print(compare_jars(jar1, jar2))  # If it prints True, jars are same; otherwise, jars are different.

+ 0 - 29
index.html

@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>下载页面</title>
-    <meta charset="UTF-8">
-</head>
-<body>
-<h1>下载文件</h1>
-<button onclick="downloadFile()">下载</button>
-<script>
-    function downloadFile() {
-        var xhr = new XMLHttpRequest();
-        xhr.open('GET', 'https://dip.rxdptest.k5.bigtree.tech/api/dip-file/file/download?remotePath=xlsx/3f64366cf2dd2bc7198855a9584d31ab.xlsx', true);
-        xhr.setRequestHeader('token', 'e95ba497940780fac84c4b04a065b685');
-        xhr.responseType = 'blob';
-        xhr.onload = function() {
-            if (this.status === 200) {
-                var blob = new Blob([this.response], {type: 'application/octet-stream'});
-                var link = document.createElement('a');
-                link.href = window.URL.createObjectURL(blob);
-                link.download = 'file.xlsx';
-                link.click();
-            }
-        };
-        xhr.send();
-    }
-</script>
-</body>
-</html>

+ 0 - 12
index1.html

@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Title</title>
-
-</head>
-<body>
-<input type="text" id="inputBox" readonly contenteditable="true">
-
-</body>
-</html>

+ 0 - 25
invoke.py

@@ -1,25 +0,0 @@
-import requests
-
-cmd_str = """
-def exec(obj):
-    obj['name2']=2
-    obj['name3']=2
-    return obj
-"""
-
-print(requests.post("http://172.18.176.53:8000/exec", json={
-    "function_str": cmd_str,
-    "call_str": "exec(obj)",
-    "param_dict": {
-        "obj": {
-            "name": 1
-        }
-    }
-}).json())
-
-# 第一个参数:函数字符串
-# 第二个参数:函数里的名字和参数
-# 第三个参数:入参,以dict形式传递
-
-# 返回值
-# {'code': 200, 'res': 6}

+ 0 - 29
notion.py

@@ -1,29 +0,0 @@
-from notion_client import Client
-
-# 首先设置环境变量 NOTION_API_SECRET,该值为你的 Notion API 密钥
-notion = Client(auth="secret_PvJWhkqlZJ7PMIqqPxWDhS736TjvUbkGojyrybjyxNh")
-
-# 填写你要创建文档的数据库 ID 和文档名称
-
-database_id = "0e213716cac641189939bf5c84662803"
-document_title = "YOUR_DOCUMENT_TITLE"
-
-try:
-    # 在指定数据库中创建一个空白文档
-    new_page = {
-        "Name": {
-            "title": [
-                {
-                    "text": {
-                        "content": document_title
-                    }
-                }]
-        }
-    }
-    created_page = notion.pages.create(parent={"database_id": database_id}, properties=new_page)
-
-    # 获取文档的公开 URL
-    page_url = created_page['url']
-    print("The URL of the created page is: ", page_url)
-except Exception as e:
-    print("Encountered an error:", e)

+ 1 - 0
project-test/Readme.md

@@ -0,0 +1 @@
+测试脚本

+ 1 - 0
project/readme.md

@@ -0,0 +1 @@
+已使用的python脚本项目

+ 30 - 0
test_file_base64.py

@@ -0,0 +1,30 @@
+import base64
+
+
+def file_to_base64(filename):
+    # 文件转base64
+    with open(filename, "rb") as file:
+        return base64.b64encode(file.read()).decode()
+
+
+# 使用示例
+fileStr = file_to_base64("/Users/alvin/Downloads/tmp.csv")
+
+
+def exec(obj):
+    import base64
+    import io
+    import csv
+    # 解析里面的file,把list存入obj
+    base64_file = obj.get("file")
+    if base64_file is not None:
+        base64_bytes = base64_file.encode()
+        decoded_bytes = base64.b64decode(base64_bytes)
+        file_like = io.StringIO(decoded_bytes.decode())
+        reader = csv.reader(file_like)
+        csv_list = list(reader)
+        obj['list'] = csv_list
+    return obj
+
+
+print(exec({"file": fileStr}))

+ 0 - 1
test_py_invoke.py

@@ -23,4 +23,3 @@ obj = {"b": 45}
 exec_def(exec_str, obj)
 
 
-round(357-128*math.log(float(param["p"])/(1-float(param["p"]))))

+ 0 - 0
tmp/gpt/__init__.py


+ 0 - 0
gpt.py → tmp/gpt/gpt.py


+ 0 - 0
tmp/redis/__init__.py


+ 0 - 0
redis_cli.py → tmp/redis/redis_cli.py


+ 0 - 0
tmp1.py


+ 0 - 30
tmp2.py

@@ -1,30 +0,0 @@
-import base64
-
-
-def file_to_base64(filename):
-    # 文件转base64
-    with open(filename, "rb") as file:
-        return base64.b64encode(file.read()).decode()
-
-
-# 使用示例
-fileStr = file_to_base64("/Users/alvin/Downloads/tmp.csv")
-
-
-def exec(obj):
-    import base64
-    import io
-    import csv
-    # 解析里面的file,把list存入obj
-    base64_file = obj.get("file")
-    if base64_file is not None:
-        base64_bytes = base64_file.encode()
-        decoded_bytes = base64.b64decode(base64_bytes)
-        file_like = io.StringIO(decoded_bytes.decode())
-        reader = csv.reader(file_like)
-        csv_list = list(reader)
-        obj['list'] = csv_list
-    return obj
-
-
-print(exec({"file": fileStr}))

+ 0 - 0
tmp3.py


+ 1 - 273
tmp4.py

@@ -1,273 +1 @@
-def exec(obj):
-    def data_pretreatment(map):
-        def get_value(str):
-            end = len(str)
-            if '.' in str:
-                end = str.index('.')
-            return int(str[:end])
-
-        parameters = {k: get_value(v) for k, v in map.items()}
-        scores = []
-
-        for k, v in parameters.items():
-            result = 0
-            if k == 'bh10006':
-                if v == 0:
-                    result = 100
-                elif 0 < v <= 15:
-                    result = 80
-                elif 15 < v <= 25:
-                    result = 60
-                elif 25 < v <= 35:
-                    result = 40
-                elif 35 < v <= 50:
-                    result = 20
-                elif v > 50:
-                    result = 0
-                scores.append((0.069857492, result))
-
-            elif k == 'bh10018':
-                if v == 0:
-                    result = 85
-                elif v == 1:
-                    result = 100
-                elif v == 2:
-                    result = 50
-                elif v == 3:
-                    result = 10
-                scores.append((0.048865349, result))
-
-            elif k == 'bh10025':
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 90
-                elif v == 2:
-                    result = 80
-                elif v == 3:
-                    result = 50
-                elif v == 4:
-                    result = 40
-                elif v == 5:
-                    result = 30
-                elif v == 6:
-                    result = 10
-                elif v > 6:
-                    result = 0
-                scores.append((0.0467602, result))
-
-            elif k == "bh10022":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 70
-                elif v == 2:
-                    result = 35
-                elif v == 3:
-                    result = 5
-                scores.append((0.039446769, result))
-            elif k == "bh10019":
-                if v == 0:
-                    result = 80
-                elif v == 1:
-                    result = 100
-                elif v == 2:
-                    result = 40
-                elif v == 3:
-                    result = 5
-                scores.append((0.045120359, result))
-            elif k == "bh10023":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 70
-                elif v == 2:
-                    result = 40
-                elif v == 3:
-                    result = 10
-                scores.append((0.043568957, result))
-            elif k == "bh10009":
-                if v == 0:
-                    result = 100
-                elif 0 < v <= 15:
-                    result = 80
-                elif 15 < v <= 25:
-                    result = 60
-                elif 25 < v <= 35:
-                    result = 40
-                elif 35 < v <= 50:
-                    result = 20
-                elif v > 50:
-                    result = 0
-                scores.append((0.092601792, result))
-            elif k == "bh10016":
-                if v == 0:
-                    result = 85
-                elif v == 1:
-                    result = 100
-                elif v == 2:
-                    result = 50
-                elif v == 3:
-                    result = 8
-                scores.append((0.056671171, result))
-            elif k == "bh10024":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 70
-                elif v == 2:
-                    result = 50
-                elif v == 3:
-                    result = 25
-                elif v == 4:
-                    result = 5
-                scores.append((0.049505696, result))
-            elif k == "bh10017":
-                if v == 0:
-                    result = 75
-                elif v == 1:
-                    result = 100
-                elif v == 2:
-                    result = 40
-                elif v == 3:
-                    result = 10
-                scores.append((0.052926182, result))
-            elif k == "bh10027":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 60
-                elif v > 1:
-                    result = 0
-                scores.append((0.054838899, result))
-            elif k == "cnName":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 90
-                elif v == 2:
-                    result = 85
-                elif v == 3:
-                    result = 80
-                elif 4 <= v <= 8:
-                    result = 70
-                elif 8 < v <= 12:
-                    result = 50
-                elif 12 < v <= 15:
-                    result = 30
-                elif v > 15:
-                    result = 0
-                scores.append((0.071630387, result))
-            elif k == "cnNameLM":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 90
-                elif v == 2:
-                    result = 85
-                elif v == 3:
-                    result = 80
-                elif 4 <= v <= 8:
-                    result = 70
-                elif 8 < v <= 12:
-                    result = 50
-                elif 12 < v <= 15:
-                    result = 30
-                elif v > 15:
-                    result = 0
-                scores.append((0.066097986, result))
-            elif k == "cnRuleType":
-                if v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 90
-                elif v == 2:
-                    result = 70
-                elif v == 3:
-                    result = 40
-                elif v == 4:
-                    result = 0
-                scores.append((0.072776513, result))
-            elif k == "personCheatIndices":
-                if v == -1:
-                    result = -1
-                elif v == 0:
-                    result = 100
-                elif v == 1:
-                    result = 80
-                elif v == 2:
-                    result = 60
-                elif v == 3:
-                    result = 40
-                elif v > 3:
-                    result = 0
-                scores.append((0.0736, result))
-
-        return scores
-
-    def coalesce(scores):
-        hb_score = 0
-        flag = False
-
-        for p in scores:
-            coefficient = p[0]
-            score = p[1]
-            if score == -1:
-                flag = True
-            hb_score += coefficient * score / 0.884267752
-            hb_score = round(hb_score, 10)
-
-        if flag:
-            return 70
-        else:
-            return hb_score
-
-    def is_numeric(value):
-        try:
-            float(value)
-            return True
-        except ValueError:
-            return False
-
-    keys = ['bh10022', 'cnRuleType', 'bh10025', 'bh10024', 'bh10023', 'bh10019', 'personCheatIndices', 'bh10018', 'bh10006', 'cnNameLM', 'bh10017', 'bh10016', 'bh10027', 'huhhuhuhuhuResult', 'cnName', 'bh10009']
-
-    obj = {key: obj[key] for key in keys if key in keys}
-
-    for key in obj.keys():
-        if not is_numeric(obj[key]):
-            obj['abc'] = 70
-            break
-
-    if obj["personCheatIndices"] == "-1":
-        obj['abc'] = 70
-    else:
-        result = coalesce(data_pretreatment(obj))
-        obj['abc'] = result
-    return obj
-
-
-print(exec({
-    "bh10022": "1",
-    "cnRuleType": "2",
-    "child_flow_base_url": "http://rxdp-flow:8080",
-    "bh10025": "1.38",
-    "bh10024": "3",
-    "bh10023": "2",
-    "bh10019": "3",
-    "personCheatIndices": "0",
-    "bh10018": "2",
-    "flow_reused_global_flag": "0.0",
-    "bh10006": "14",
-    "cnNameLM": "21",
-    "bh10017": "3",
-    "bh10016": "2",
-    "bh10027": "0",
-    "huhhuhuhuhuResult": "50.9627708497",
-    "current_flow_ip_address": "172.16.45.34",
-    "cnName": "21",
-    "bh10009": "23",
-    "flow_process_trace": {
-        "20014": []
-    },
-    "abc": "70.0"
-}))
+123

+ 11 - 0
touch_tmp.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+files="tmp1.py tmp2.py tmp3.py tmp4.py tmp5.py"
+
+for file in $files
+do
+  if [ ! -f "$file" ]; then
+    touch "$file"
+    git add "$file"
+  fi
+done