Files
galaxy/test/functional/tools/parameters/gx_drill_down_code.py
T
Nicola Soranzo 7f89e0eab9 Code cleanups from pyupgrade
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.
2025-07-31 11:17:22 +01:00

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