Changeset 584
- Timestamp:
- 07/28/08 00:46:25 (4 months ago)
- Files:
-
- cly/trunk/cly/builder.py (modified) (8 diffs)
- cly/trunk/cly/console.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cly/trunk/cly/builder.py
r583 r584 431 431 default is to use the content of self.help(). 432 432 433 Arguments: 434 435 :text: Text entered so far. 433 :param text: Text entered so far. 436 434 437 435 >>> grammar = Grammar(one=Node(), two=Node()) … … 448 446 """Find a Node by path rooted at this node. 449 447 450 Arguments: 451 452 :path: "Path" to the node, or a label. 448 :param path: "Path" to the node, or a label. 449 :returns: Found node. 453 450 454 451 >>> top = Node(name='top', one=Node(), … … 494 491 will be preserved and the merging nodes children merged. 495 492 496 Arguments: 497 498 :node: Node to merge into this. 493 :param node: Node to merge into this. 499 494 """ 500 495 self.__anonymous_children += node.__anonymous_children … … 520 515 :param value: Value to cast. 521 516 522 :r type: Tuple of (value, options) where options is a dictionary of523 extra Node constructor arguments.517 :returns: Tuple of (value, options) where options is a dictionary of 518 extra Node constructor arguments. 524 519 """ 525 520 casts = { … … 647 642 """Group subnodes under a single group ID. 648 643 649 Arguments: 650 :id: Group ID. 644 :param id: Group ID. 651 645 """ 652 646 def __init__(self, id=None, *args, **kwargs): … … 666 660 are supported. 667 661 668 Arguments: 669 670 :target: 671 Relative or absolute path to the aliased node. If the alias contains 672 glob characters (``*`` or ``?``) all matching nodes are aliased. 662 :param target: 663 Relative or absolute path to the aliased node. If the alias contains 664 glob characters (``*`` or ``?``) all matching nodes are aliased. 673 665 674 666 >>> from cly.parser import Parser, Context … … 739 731 A node that masquerades as its children, if a condition is true. 740 732 741 Arguments: 742 743 :test: A callable with the signature ``test(context)``. 744 Returns ``True`` if masqueraded nodes are accessible. 733 :param test: A callable with the signature ``test(context)``. 734 Returns ``True`` if masqueraded nodes are accessible. 745 735 746 736 All other arguments are passed through to the default :class:`Node` constructor. … … 809 799 """Matches EOL and executes ``callback``. 810 800 811 Arguments: 812 813 :callback: Callback to execute when the action is chosen. 814 815 Attributes: 816 817 .. attribute:: with_context 818 819 If True, passes the current parse :class:`~cly.parser.Context` as the 820 first argument. 801 :param callback: Callback to execute when the action is chosen. 802 803 :var with_context: 804 If True, passes the current parse :class:`~cly.parser.Context` as the 805 first argument. 821 806 822 807 >>> from cly.parser import Parser, Context cly/trunk/cly/console.py
r583 r584 479 479 """Print a list of lists as a table, so that columns line up nicely. 480 480 481 Arguments: 482 :header: List of column headings. Will be printed as the first row. 483 484 :table: List of lists for the table body. 485 :sep: The column separator. 486 :indent: Table indentation as a string. 487 :header_format: Formatting to use for header. 488 :row_format: A tuple specifying cycling formatting colours to use for 489 each row. 490 :expand_to_fit: If a boolean, signifies whether print_table should 491 expand the table to the width of the terminal or 492 compact it as much as possible. If an integer, 493 specifies the width to expand to. 494 :min_widths: Columns will be guaranteed to be at least the width of 495 each element in this list. May also be a dictionary of 496 column indices to widths. 497 :term_width: Specify the terminal width. 498 499 :returns: 500 Stuff. 481 :param header: List of column headings. Will be printed as the first row. 482 :param table: List of lists for the table body. 483 :param sep: The column separator. 484 :param indent: Table indentation as a string. 485 :param header_format: Formatting to use for header. 486 :param row_format: A tuple specifying cycling formatting colours to use for 487 each row. 488 :param expand_to_fit: If a boolean, signifies whether print_table should 489 expand the table to the width of the terminal or 490 compact it as much as possible. If an integer, 491 specifies the width to expand to. 492 :param min_widths: Columns will be guaranteed to be at least the width of 493 each element in this list. May also be a dictionary of 494 column indices to widths. 495 :param term_width: Override terminal width detection. 496 497 :returns: List of strings, one per line. 501 498 502 499 Note: In addition to the normal formatting codes supported by :func:`cprint`,
