From 49dfd9eae78d96957c8f0df749a8e73058d29b3f Mon Sep 17 00:00:00 2001 From: Tynan Ford Date: Wed, 24 Sep 2025 18:39:27 -0700 Subject: [PATCH] switch type hints to be py36 compatible and add py36 and py37 to CI --- .github/workflows/server.yml | 14 +++++++++++++- server/recceiver/cfstore.py | 9 +++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index b074a1fe..52769528 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -14,15 +14,27 @@ on: jobs: build-server: runs-on: ubuntu-latest + container: ${{ matrix.container }} strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + include: + - python-version: "3.6" + container: "python:3.6" + - python-version: "3.7" + container: "python:3.7" + - python-version: "3.8" + - python-version: "3.9" + - python-version: "3.10" + - python-version: "3.11" + - python-version: "3.12" + - python-version: "3.13" defaults: run: working-directory: server steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} + if: ${{ !matrix.container }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/server/recceiver/cfstore.py b/server/recceiver/cfstore.py index da6bcfa9..1b68990d 100755 --- a/server/recceiver/cfstore.py +++ b/server/recceiver/cfstore.py @@ -8,6 +8,7 @@ import time from collections import defaultdict from operator import itemgetter +from typing import Dict, List, Set from channelfinder import ChannelFinderClient from requests import ConnectionError, RequestException @@ -397,7 +398,7 @@ def dict_to_file(dict, iocs, conf): json.dump(list, f) -def create_channel(name: str, owner: str, properties: list[dict[str, str]]): +def create_channel(name: str, owner: str, properties: List[Dict[str, str]]): return { "name": name, "owner": owner, @@ -405,7 +406,7 @@ def create_channel(name: str, owner: str, properties: list[dict[str, str]]): } -def create_property(owner: str, name: str, value: str): +def create_property(owner: str, name: str, value: str) -> Dict[str, str]: return { "name": name, "owner": owner, @@ -741,8 +742,8 @@ def create_default_properties(owner, iocTime, recceiverid, channels_dict, iocs, def __merge_property_lists( - newProperties: list[dict[str, str]], channel: dict[str, list[dict[str, str]]], managed_properties=set() -) -> list[dict[str, str]]: + newProperties: List[Dict[str, str]], channel: Dict[str, List[Dict[str, str]]], managed_properties: Set[str] = set() +) -> List[Dict[str, str]]: """ Merges two lists of properties ensuring that there are no 2 properties with the same name In case of overlap between the new and old property lists the