@@ -629,69 +629,50 @@ def help_targets(self):
629629 template = textwrap .dedent ("""
630630
631631 The list of comma-separated target expressions may consist of columns,
632- simple functions and aggregate functions. If you use any aggregate
633- function, you must also provide a GROUP-BY clause.
632+ simple functions and aggregate functions. You can use AS to determine
633+ the output column name, for example:
634634
635- Columns
636- -------
635+ SELECT yearmonth(date) AS month ....
637636
638- {columns}
637+ If you use any aggregate function, you must also provide a GROUP-BY
638+ clause.
639639
640- Functions
641- ---------
640+ See the online Beanquery documentation for the full list of columns,
641+ functions, and aggregates:
642642
643- {functions}
644-
645- Aggregate functions
646- -------------------
647-
648- {aggregates}
643+ https://beancount.github.io/beanquery/
649644
650645 """ )
651- print ( template . format ( ** _describe ( self . context . tables [ 'postings' ],
652- query_compile . FUNCTIONS )) , file = self .outfile )
646+
647+ print ( template , file = self .outfile )
653648
654649 def help_from (self ):
655650 template = textwrap .dedent ("""
656651
657652 A logical expression that consist of columns on directives (mostly
658653 transactions) and simple functions.
659654
660- Columns
661- -------
662-
663- {columns}
664-
665- Functions
666- ---------
655+ See the online Beanquery documentation for the full list of columns,
656+ functions, and aggregates:
667657
668- {functions}
658+ https://beancount.github.io/beanquery/
669659
670660 """ )
671- print (template .format (** _describe (self .context .tables ['entries' ],
672- query_compile .FUNCTIONS )),
673- file = self .outfile )
661+ print (template , file = self .outfile )
674662
675663 def help_where (self ):
676664 template = textwrap .dedent ("""
677665
678666 A logical expression that consist of columns on postings and simple
679667 functions.
680668
681- Columns
682- -------
669+ See the online Beanquery documentation for the full list of columns,
670+ functions, and aggregates:
683671
684- {columns}
685-
686- Functions
687- ---------
688-
689- {functions}
672+ https://beancount.github.io/beanquery/
690673
691674 """ )
692- print (template .format (** _describe (self .context .tables ['postings' ],
693- query_compile .FUNCTIONS )), file = self .outfile )
694-
675+ print (template , file = self .outfile )
695676
696677def _describe_columns (columns ):
697678 out = io .StringIO ()
@@ -702,35 +683,6 @@ def _describe_columns(columns):
702683 print (file = out )
703684 return out .getvalue ().rstrip ()
704685
705-
706- def _describe_functions (functions , aggregates = False ):
707- entries = []
708- for name , funcs in functions .items ():
709- if aggregates != issubclass (funcs [0 ], query_compile .EvalAggregator ):
710- continue
711- name = name .lower ()
712- for func in funcs :
713- args = ', ' .join (types .name (d ) for d in func .__intypes__ )
714- doc = re .sub (r'[ \n\t]+' , ' ' , func .__doc__ or '' )
715- entries .append ((name , doc , args ))
716- entries .sort ()
717- out = io .StringIO ()
718- wrapper = textwrap .TextWrapper (initial_indent = ' ' , subsequent_indent = ' ' , width = 80 )
719- for key , entries in itertools .groupby (entries , key = lambda x : x [:2 ]): # noqa: B020
720- for name , doc , args in entries :
721- print (f'{ name } ({ args } )' , file = out )
722- print (wrapper .fill (doc ), file = out )
723- print (file = out )
724- return out .getvalue ().rstrip ()
725-
726-
727- def _describe (table , functions ):
728- return dict (
729- columns = _describe_columns (table .columns ),
730- functions = _describe_functions (functions , aggregates = False ),
731- aggregates = _describe_functions (functions , aggregates = True ))
732-
733-
734686def summary_statistics (entries ):
735687 """Calculate basic summary statistics to output a brief welcome message.
736688
0 commit comments