/opt/alt/python37/lib/python3.7/site-packages/paste/util/looper
Edit: /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyc (7140B)
Ñò
Zä]c @ sU d Z d g Z d e f d YZ d e f d YZ d e f d YZ d S( s
Helper for looping over sequences, particular in templates.
Often in a loop in a template it's handy to know what's next up,
previously up, if this is the first or last item in the sequence, etc.
These can be awkward to manage in a normal Python loop, but using the
looper you can get a better sense of the context. Use like::
>>> for loop, item in looper(['a', 'b', 'c']):
... print loop.number, item
... if not loop.last:
... print '---'
1 a
---
2 b
---
3 c
t looperc B s) e Z d Z d Z d Z d Z RS( sĴ
Helper for looping (particularly in templates)
Use this like::
for loop, item in looper(seq):
if loop.first:
...
c C s
| | _ d S( N( t seq( t selfR ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt __init__" s c C s
t | i S( N( t looper_iterR ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt __iter__% s c C s d | i i | i f S( Ns <%s for %r>( t __class__t __name__R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt __repr__( s ( R t
__module__t __doc__R R R ( ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR s R c B s# e Z d Z d Z d Z RS( c C s t | | _ d | _ d S( Ni ( t listR t pos( R R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR . s c C s | S( N( ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR 2 s c C s[ | i t | i j o
t n t | i | i | i | i f } | i d 7_ | S( Ni ( R t lenR t
StopIterationt loop_pos( R t result( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt next5 s
%( R R R R R ( ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR , s R c B s
e Z d Z d Z d Z e e Z d Z e e Z d Z e e Z d Z e e Z d Z e e Z d Z
e e
Z
d Z e e Z d Z e e Z d
Z
e e
Z
d Z e e Z d d Z d d
Z d Z RS( c C s | | _ | | _ d S( N( R R ( R R R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR > s c C s d | i t t f S( Ns
( R R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR B s c C s | i S( N( R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt indexF s c C s | i d S( Ni ( R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt numberJ s c C s | i | i S( N( R R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt itemN s c C s1 y | i | i d SWn t j
o d SXd S( Ni ( R R t
IndexErrort None( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR R s c C s' | i d j o d S| i | i d S( Ni i ( R R R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt previousY s c C s | i d S( Ni ( R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt odd_ s c C s | i d S( Ni ( R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt evenc s c C s
| i d j S( Ni ( R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt firstg s c C s | i t | i d j S( Ni ( R R
R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt lastk s c C s
t | i S( N( R
R ( R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt lengtho s c C s( | i o t S| i | i | i | S( s
Returns true if this item is the start of a new group,
where groups mean that some attribute has changed. The getter
can be None (the item itself changes), an attribute name like
``'.attr'``, a function, or a dict key or list index.
( R t Truet _compare_groupR R ( R t getter( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt first_groups s
c C s( | i o t S| i | i | i | S( s
Returns true if this item is the end of a new group,
where groups mean that some attribute has changed. The getter
can be None (the item itself changes), an attribute name like
``'.attr'``, a function, or a dict key or list index.
( R R R R R ( R R ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyt
last_group~ s
c C sÙ | d j o | | j St | t ow | i d og | d } | i d o- | d } t | | t | | j St | | t | | j Sn7 t | o | | | | j S| | | | j Sd S( Nt .i s ()iŝ˙˙˙( R t
isinstancet
basestringt
startswitht endswitht getattrt callable( R R t otherR ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR s
#
N( R R R R R t propertyR R R R R R R R R R R R! R ( ( ( sJ /opt/alt/python37/lib/python3.7/site-packages/paste/util/looper/_looper.pyR <