Changeset 3842:3b41dc3e0bc8 in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/17/09 17:24:08 (10 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Change the examples in docstrings, so that they produce shorter output.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/xfind.py

    r3802 r3842  
    101101        >>> doc = parsers.parseurl("http://www.python.org", tidy=True) 
    102102        >>> for node in doc.walknode(html.a): 
    103         ...     print node.bytes() 
    104         ...  
    105         <a id="logolink" accesskey="1" href="http://www.python.org/"><img src="http://www.python.org/images/python-logo.gif" id="logo" border="0" alt="homepage" /></a> 
    106         <a accesskey="2" href="http://www.python.org/#left%2dhand%2dnavigation"><img id="skiptonav" src="http://www.python.org/images/trans.gif" border="0" alt="skip to navigation" /></a> 
    107         <a accesskey="3" href="http://www.python.org/#content%2dbody"><img id="skiptocontent" src="http://www.python.org/images/trans.gif" border="0" alt="skip to content" /></a> 
    108         <a class="reference" href="http://www.python.org/search">Advanced Search</a> 
    109         <a title="About The Python Language" href="http://www.python.org/about/">About</a> 
     103        ...     print node.attrs.href, node.attrs.title 
     104        ...  
     105        http://www.python.org/  
     106        http://www.python.org/#left%2Dhand%2Dnavigation  
     107        http://www.python.org/#content%2Dbody  
     108        http://www.python.org/search  
     109        http://www.python.org/about/ About The Python Language 
     110        http://www.python.org/news/ Major Happenings Within the Python Community 
     111        http://www.python.org/doc/ Tutorials, Library Reference, C API 
     112        http://www.python.org/download/ Start Running Python Under Windows, Mac, Linux and Others 
    110113        ... 
    111114    """ 
     
    394397        >>> doc = parsers.parseurl("http://www.python.org", tidy=True) 
    395398        >>> for node in doc.walknode(xfind.attrhasvalue("rel", "stylesheet")): 
    396         ...     print repr(node) 
    397         ...  
    398         <a media="screen" type="text/css" href="http://www.python.org/styles/screen-switcher-default.css" rel="stylesheet" id="screen-switcher-stylesheet" /> 
    399         <a media="scReen" type="text/css" rel="stylesheet" href="http://www.python.org/styles/netscape4.css" /> 
    400         <a media="print" type="text/css" rel="stylesheet" href="http://www.python.org/styles/print.css" /> 
     399        ...     print node.attrs.href 
     400        ...  
     401        http://www.python.org/styles/screen-switcher-default.css 
     402        http://www.python.org/styles/netscape4.css 
     403        http://www.python.org/styles/print.css 
    401404    """ 
    402405 
     
    455458        >>> doc = parsers.parseurl("http://www.python.org", tidy=True) 
    456459        >>> for node in doc.walknode(xfind.attrcontains("rel", "stylesheet")): 
    457         ...     print repr(node) 
    458         ...  
    459         <a type="text/css" id="screen-switcher-stylesheet" media="screen" rel="stylesheet" href="http://www.python.org/styles/screen-switcher-default.css" /> 
    460         <a type="text/css" media="scReen" rel="stylesheet" href="http://www.python.org/styles/netscape4.css" /> 
    461         <a type="text/css" media="print" rel="stylesheet" href="http://www.python.org/styles/print.css" /> 
    462         <a type="text/css" title="large text" media="screen" rel="alternate stylesheet" href="http://www.python.org/styles/largestyles.css" /> 
    463         <a type="text/css" title="default fonts" media="screen" rel="alternate stylesheet" href="http://www.python.org/styles/defaultfonts.css" /> 
     460        ...     print node.attrs.rel, node.attrs.href 
     461        ...  
     462 
     463        stylesheet http://www.python.org/styles/screen-switcher-default.css 
     464        stylesheet http://www.python.org/styles/netscape4.css 
     465        stylesheet http://www.python.org/styles/print.css 
     466        alternate stylesheet http://www.python.org/styles/largestyles.css 
     467        alternate stylesheet http://www.python.org/styles/defaultfonts.css 
    464468    """ 
    465469 
     
    578582        >>> doc = parsers.parseurl("http://www.python.org", tidy=True) 
    579583        >>> for node in doc.walknode(xfind.attrendswith("href", ".css")): 
    580         ...     print repr(node) 
    581         ...  
    582         <a href="http://www.python.org/styles/screen-switcher-default.css" type="text/css" rel="stylesheet" id="screen-switcher-stylesheet" media="screen" /> 
    583         <a type="text/css" rel="stylesheet" href="http://www.python.org/styles/netscape4.css" media="scReen" /> 
    584         <a type="text/css" rel="stylesheet" href="http://www.python.org/styles/print.css" media="print" /> 
    585         <a title="large text" type="text/css" rel="alternate stylesheet" href="http://www.python.org/styles/largestyles.css" media="screen" /> 
    586         <a title="default fonts" type="text/css" rel="alternate stylesheet" href="http://www.python.org/styles/defaultfonts.css" media="screen" /> 
     584        ...     print node.attrs.href 
     585        ...  
     586        http://www.python.org/styles/screen-switcher-default.css 
     587        http://www.python.org/styles/netscape4.css 
     588        http://www.python.org/styles/print.css 
     589        http://www.python.org/styles/largestyles.css 
     590        http://www.python.org/styles/defaultfonts.css 
    587591    """ 
    588592 
     
    723727class Combinator(Selector): 
    724728    """ 
    725     <p>A :class:`Combinator` is a selector that transforms one or combines 
    726     two or more other selectors in a certain way.</p> 
     729    A :class:`Combinator` is a selector that transforms one or combines two or 
     730    more other selectors in a certain way. 
    727731    """ 
    728732 
     
    925929        >>> doc = parsers.parseurl("http://www.python.org", tidy=True) 
    926930        >>> for node in doc.walknode(xfind.hasattr("href") | xfind.hasattr("src")): 
    927         ...     print node.bytes() 
    928         ...  
    929         <a type="application/rss+xml" title="RSS" rel="alternate" href="http://www.python.org/channews.rdf" /> 
    930         <a media="screen" type="text/css" id="screen-switcher-stylesheet" rel="stylesheet" href="http://www.python.org/styles/screen-switcher-default.css" /> 
    931         <a media="scReen" type="text/css" rel="stylesheet" href="http://www.python.org/styles/netscape4.css" /> 
    932         <a media="print" type="text/css" rel="stylesheet" href="http://www.python.org/styles/print.css" /> 
    933         <a media="screen" type="text/css" title="large text" rel="alternate stylesheet" href="http://www.python.org/styles/largestyles.css" /> 
    934         <a media="screen" type="text/css" title="default fonts" rel="alternate stylesheet" href="http://www.python.org/styles/defaultfonts.css" /> 
    935         <script src="http://www.python.org/js/iotbs2-key-directors-load.js" type="text/javascript"></script> 
    936         <script src="http://www.python.org/js/iotbs2-directors.js" type="text/javascript"></script> 
    937         <script src="http://www.python.org/js/iotbs2-core.js" type="text/javascript"></script> 
    938         <a accesskey="1" id="logolink" href="http://www.python.org/"><img alt="homepage" src="http://www.python.org/images/python-logo.gif" id="logo" border="0" /></a> 
     931        ...     print node.attrs.href if "href" in node.Attrs else node.attrs.src 
     932        ...  
     933        http://www.python.org/channews.rdf 
     934        http://aspn.activestate.com/ASPN/Cookbook/Python/index_rss 
     935        http://python-groups.blogspot.com/feeds/posts/default 
     936        http://www.showmedo.com/latestVideoFeed/rss2.0?tag=python 
     937        http://www.awaretek.com/python/index.xml 
     938        http://pyfound.blogspot.com/feeds/posts/default 
     939        http://www.python.org/dev/peps/peps.rss 
     940        http://www.python.org/community/jobs/jobs.rss 
     941        http://www.reddit.com/r/Python/.rss 
     942        http://www.python.org/styles/screen-switcher-default.css 
     943        http://www.python.org/styles/netscape4.css 
     944        http://www.python.org/styles/print.css 
     945        http://www.python.org/styles/largestyles.css 
     946        http://www.python.org/styles/defaultfonts.css 
    939947        ... 
    940948    """ 
     
    10791087class nthoftype(Selector): 
    10801088    """ 
    1081     An :class:`nthchild` object is a selector that selects every node that is 
     1089    An :class:`nthoftype` object is a selector that selects every node that is 
    10821090    the n-th node of a specified type among its siblings. Similar to 
    10831091    :class:`nthchild` :class:`nthoftype` supports negative and positive indices