]> git.cworth.org Git - turbot/commitdiff
Remove the util code
authorCarl Worth <cworth@cworth.org>
Sat, 8 Jan 2022 00:36:14 +0000 (16:36 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 8 Jan 2022 00:36:14 +0000 (16:36 -0800)
This was getting in the way of deployment, (since it's not flake8-clean).

Instead of fixing it, just nuke it. We weren't certain we'd ever use it
anyway, (and it's now at least in git revision history if needed).

turbot/util/blocks-test.py [deleted file]
turbot/util/hunt-channel-topic-tweak.py [deleted file]
turbot/util/sheets-test.py [deleted file]

diff --git a/turbot/util/blocks-test.py b/turbot/util/blocks-test.py
deleted file mode 100755 (executable)
index 2e09c0e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-
-from blocks import (
-    multi_select_block, accessory_block, section_block, text_block
-)
-
-def new_multi_select_block(label, name, placeholder, options, default=None):
-
-    multi_select = {
-        "action_id": name,
-        "type": "multi_static_select",
-        "placeholder": {
-            "type": "plain_text",
-            "text": placeholder
-        },
-        "options": [
-            {
-                "text": {
-                    "type": "plain_text",
-                    "text": option
-                },
-                "value": option
-            } for option in options
-        ]
-    }
-
-    return accessory_block(
-        section_block(text_block("*{}*".format(label))),
-        multi_select
-    )
-
-blocks = multi_select_block("Label", "Name", "Placeholder",
-                            ["Foo", "Bar", "Baz"])
-
-blocks_str = str(blocks)
-
-new_blocks = new_multi_select_block("Label", "Name", "Placeholder",
-                                    ["Foo", "Bar", "Baz"])
-
-new_blocks_str = str(new_blocks)
-
-print("In main, blocks is: {}".format(blocks_str))
-
-print("Also new_blocks is: {}".format(new_blocks_str))
-
-if blocks_str == new_blocks_str:
-    print("Perfect match!")
-else:
-    print("No match.")
diff --git a/turbot/util/hunt-channel-topic-tweak.py b/turbot/util/hunt-channel-topic-tweak.py
deleted file mode 100755 (executable)
index 2951894..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python3
-
-from urllib.parse import parse_qs
-from slack import WebClient
-import base64
-import boto3
-import requests
-import json
-import pickle
-import os
-import sys
-from types import SimpleNamespace
-from google.auth.transport.requests import Request
-from googleapiclient.discovery import build
-
-# Note: Late import here to have the environment variable above available
-
-if 'SLACK_BOT_TOKEN' in os.environ:
-    slack_bot_token = os.environ['SLACK_BOT_TOKEN']
-else:
-    print("Please set SLACK_BOT_TOKEN in environment variable")
-    sys.exit(1)
-slack_client = WebClient(slack_bot_token)
-
-channel_id='C01K8FJJMR7'
-puzzle_url="https://perpendicular.institute/puzzle/%E2%9C%8F/"
-sheet_url='https://docs.google.com/spreadsheets/d/1951ZTGLvSq5PqHPQ1ygqddRjennsedkNtCaOGH__dMo/edit#gid=2097467701'
-title="(See `/puzzle` for title)"
-topic="(<{}|Puzzle>,<{}|Sheet>) {}".format(puzzle_url, sheet_url, title)
-
-slack_client.conversations_setTopic(channel=channel_id,
-                                    topic=topic)
diff --git a/turbot/util/sheets-test.py b/turbot/util/sheets-test.py
deleted file mode 100755 (executable)
index 09a268e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python3
-
-from types import SimpleNamespace
-from google.auth.transport.requests import Request
-from googleapiclient.discovery import build
-import sys
-import os
-import base64
-import pickle
-
-from sheets import (
-    sheets_create_folder, sheets_create, spreadsheet_update_data,
-    sheets_create_for_puzzle
-)
-
-if 'GSHEETS_PICKLE_BASE64' not in os.environ:
-    print("Error. Need GSHEETS_PICKLE_BASE64 in environment")
-    sys.exit(1)
-
-gsheets_pickle_base64 = os.environ['GSHEETS_PICKLE_BASE64']
-gsheets_pickle = base64.b64decode(gsheets_pickle_base64)
-gsheets_creds = pickle.loads(gsheets_pickle)
-
-if gsheets_creds:
-    if gsheets_creds.valid:
-        print("Loaded valid GSheets credentials from environment")
-    else:
-        gsheets_creds.refresh(Request())
-        gsheets_pickle = pickle.dumps(gsheets_creds)
-        gsheets_pickle_base64_bytes = base64.b64encode(gsheets_pickle)
-        gsheets_pickle_base64 = gsheets_pickle_base64_bytes.decode('us-ascii')
-        print("Refreshed GSheets credentials to be put into environment:")
-        print("GSHEETS_PICKLE_BASE64={}".format(gsheets_pickle_base64))
-
-service = build('sheets',
-                'v4',
-                credentials=gsheets_creds,
-                cache_discovery=False)
-sheets = service.spreadsheets()
-service = build('drive',
-                'v3',
-                credentials=gsheets_creds,
-                cache_discovery=False)
-files = service.files()
-permissions = service.permissions()
-
-turb = SimpleNamespace()
-turb.sheets = sheets
-turb.files = files
-turb.permissions = permissions
-
-folder_id="1ImWL0g50HSwRHC1UjJvYTHhi1_RsPJrI"
-spreadsheet_id="1sO4NWDmUDa8H2_lDNsgXz-5Gy6Qr55trV_-J9dLyIjA"
-
-if not folder_id:
-    folder_id = sheets_create_folder(turb, "sheet-testing")
-    print("Created folder with folder_id=\"{}\"".format(folder_id))
-
-if not spreadsheet_id:
-    puzzle={
-        "name": "Test puzzle",
-        "url": "https://cworth.org",
-        "channel_url": "slack://something-or-other",
-    }
-    spreadsheet = sheets_create_for_puzzle(turb, puzzle, folder_id)
-    spreadsheet_id = spreadsheet['id']
-    print("Created spreadsheet with spreadsheet_id=\"{}\"".format(
-        spreadsheet_id))
-
-spreadsheet_update_data(turb, spreadsheet_id, 'B2:B2', "B2")