mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-01 11:14:34 +08:00
Found by running: ``` make pyupgrade ruff check --fix . ruff check --preview --unsafe-fixes --select=F401 --fix . make format make update-client-api-schema ``` The bulk of the changes are replacements of typing deprecated aliases such as `Dict` and `List` with the standard library classes. These aliases became redundant in Python 3.9 when the corresponding pre-existing classes were enhanced to support `[]`, see https://docs.python.org/3/library/typing.html#deprecated-aliases Also: - Update the `pyupgrade` Makefile target to use `--py38-plus` for the packages needed by Pulsar, including the new galaxy-tool-util-models package.
25 lines
1004 B
Python
25 lines
1004 B
Python
def collate_table(path: str) -> list:
|
|
with open(path) as f:
|
|
contents = f.read()
|
|
first_options = []
|
|
second_options = []
|
|
values = [
|
|
{"name": "First Column", "value": "first", "selected": False, "options": first_options},
|
|
{"name": "Second Column", "value": "second", "selected": False, "options": second_options},
|
|
]
|
|
seen_in_column_1 = set()
|
|
seen_in_column_2 = set()
|
|
for line in contents.splitlines():
|
|
parts = line.split("\t")
|
|
if len(parts) >= 1:
|
|
val = parts[0]
|
|
if val not in seen_in_column_1:
|
|
first_options.append({"name": val.upper(), "value": val, "selected": False, "options": []})
|
|
seen_in_column_1.add(val)
|
|
if len(parts) >= 2:
|
|
val = parts[1]
|
|
if val not in seen_in_column_2:
|
|
second_options.append({"name": val.upper(), "value": val, "selected": False, "options": []})
|
|
seen_in_column_2.add(val)
|
|
return values
|