Skip to content

Commit f2c1bb0

Browse files
authored
Fix use of license and provider in converter list (#11)
* Fix various lint/type checking issues (#10) * Fix use of license and provider in converter list
1 parent d30dc9a commit f2c1bb0

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
## [Unreleased]
99

1010
- Converters: `column_filters` allows to inverse the mask
11+
- Fix use of license and provider in converter list
1112
- Various small bug fixes and type hint fixes
1213

1314
## [v0.2.8] - 2025-09-13

tests/test_converters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_list_ids_other_module():
3535
def test_list_all():
3636
Registry.ignored_datasets = []
3737
c = Converters()
38-
result = c.list_all()
38+
result = c.list_all(("short_name", "license", "provider"))
3939
assert isinstance(result, dict)
4040
assert len(result.keys()) == 1
4141
assert "template" in result
@@ -44,6 +44,8 @@ def test_list_all():
4444
assert result["template"]["short_name"] == "Country, Region, etc."
4545
assert "license" in result["template"]
4646
assert result["template"]["license"] == "CC-BY-4.0"
47+
assert "provider" in result["template"]
48+
assert result["template"]["provider"] == "ABC Corp"
4749

4850

4951
def test_load():

vecorel_cli/converters.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .cli.util import display_pandas_unrestricted
1111
from .conversion.base import BaseConverter
1212
from .registry import Registry
13+
from .vecorel.util import parse_link_str
1314

1415

1516
class Converters(BaseCommand):
@@ -59,7 +60,7 @@ def converters(self, providers=False, sources=False, verbose=False, py_package=N
5960

6061
columns = {"short_name": "Short Title", "license": "License"}
6162
if providers:
62-
columns["providers"] = "Provider(s)"
63+
columns["provider"] = "Provider"
6364
if sources:
6465
columns["sources"] = "Source(s)"
6566

@@ -71,7 +72,7 @@ def converters(self, providers=False, sources=False, verbose=False, py_package=N
7172
display_pandas_unrestricted(None if verbose else self.default_max_colwidth)
7273

7374
if not df.empty:
74-
self.info(df)
75+
self.info(df.to_string())
7576
else:
7677
self.warning("No converters found.")
7778

@@ -124,10 +125,8 @@ def list_all(self, keys: Sequence[str] = ("short_name", "license")) -> dict:
124125

125126
if key == "sources" and isinstance(value, dict):
126127
value = ", ".join(list(value.keys()))
127-
elif key == "license" and isinstance(value, dict):
128-
value = value["href"]
129-
elif key == "providers" and isinstance(value, list):
130-
value = ", ".join(list(map(lambda x: x["name"], value)))
128+
elif key in ["license", "provider"] and isinstance(value, str):
129+
value, _ = parse_link_str(value)
131130

132131
obj[key] = value
133132

0 commit comments

Comments
 (0)