File tree Expand file tree Collapse file tree 2 files changed +27
-23
lines changed
Expand file tree Collapse file tree 2 files changed +27
-23
lines changed Original file line number Diff line number Diff line change 66from .print_indicator_graph import print_base_data_graph , print_base_network_data_graph
77from .print_indicator_json import print_base_data_json , print_base_network_data_json
88from .print_indicator_table import print_base_data_table , print_base_network_data_table
9+ from .utils import print_failed_query
910
1011if t .TYPE_CHECKING :
1112 from opendigger_pycli .datatypes import (
@@ -24,29 +25,6 @@ def format_indicator_name(indicator_name: str) -> str:
2425 return indicator_name .replace ("_" , " " ).title ()
2526
2627
27- def print_failed_query (
28- indicator_name : str , failed_query : t .Optional ["IndicatorQuery" ]
29- ) -> None :
30- if failed_query is None :
31- return
32-
33- if failed_query .years :
34- CONSOLE .print (
35- f"[red]No { indicator_name } Indicator Data in years: "
36- f"{ list (failed_query .years )} "
37- )
38- if failed_query .months :
39- CONSOLE .print (
40- f"[red]No { indicator_name } Indicator Data in months: "
41- f"{ list (failed_query .months )} "
42- )
43- if failed_query .year_months :
44- CONSOLE .print (
45- f"[red]No { indicator_name } Indicator Data in year_months: "
46- f"{ [f'{ year_month [0 ]} -{ year_month [1 ]:02} ' for year_month in failed_query .year_months ]} "
47- )
48-
49-
5028def print_trivial_indicator (
5129 indicator_name : str ,
5230 indicator_data : "TrivialIndicatorData" ,
Original file line number Diff line number Diff line change 11import typing as t
22
3+ from . import CONSOLE
4+
35if t .TYPE_CHECKING :
46 from opendigger_pycli .datatypes import NameAndValue , NameNameAndValue
7+ from opendigger_pycli .datatypes .query import IndicatorQuery
58
69
710def if_prettey (value : t .Any ) -> bool :
@@ -13,3 +16,26 @@ def if_prettey(value: t.Any) -> bool:
1316 value = t .cast (t .List ["NameNameAndValue" ], value )
1417 return True
1518 return False
19+
20+
21+ def print_failed_query (
22+ indicator_name : str , failed_query : t .Optional ["IndicatorQuery" ]
23+ ) -> None :
24+ if failed_query is None :
25+ return
26+
27+ if failed_query .years :
28+ CONSOLE .print (
29+ f"[red]No { indicator_name } Indicator Data in years: "
30+ f"{ list (failed_query .years )} "
31+ )
32+ if failed_query .months :
33+ CONSOLE .print (
34+ f"[red]No { indicator_name } Indicator Data in months: "
35+ f"{ list (failed_query .months )} "
36+ )
37+ if failed_query .year_months :
38+ CONSOLE .print (
39+ f"[red]No { indicator_name } Indicator Data in year_months: "
40+ f"{ [f'{ year_month [0 ]} -{ year_month [1 ]:02} ' for year_month in failed_query .year_months ]} "
41+ )
You can’t perform that action at this time.
0 commit comments