+
    Z4iä\  ã                   ó´   € R t ^ RIHt ^ RIHt  ! R R]4      t ! R R4      tR tR tR	 t	 ! R
 R4      t
 ! R R]
4      t ! R R]
4      t ! R R]
4      tR# )aò  Testing API allows fake data to be used in unit tests.

Testing launchpadlib code is tricky, because it depends so heavily on a
remote, unique webservice: Launchpad.  This module helps you write tests for
your launchpadlib application that can be run locally and quickly.

Say you were writing some code that needed to call out to Launchpad and get
the branches owned by the logged-in person, and then do something to them. For
example, something like this::

  def collect_unique_names(lp):
      names = []
      for branch in lp.me.getBranches():
          names.append(branch.unique_name)
      return names

To test it, you would first prepare a L{FakeLaunchpad} object, and give it
some sample data of your own devising::

  lp = FakeLaunchpad()
  my_branches = [dict(unique_name='~foo/bar/baz')]
  lp.me = dict(getBranches: lambda status: my_branches)

Then, in the test, call your own code and assert that it behaves correctly
given the data.

  names = collect_unique_names(lp)
  self.assertEqual(['~foo/bar/baz'], names)

And that's it.

The L{FakeLaunchpad} code uses a WADL file to type-check any objects created
or returned.  This means you can be sure that you won't accidentally store
sample data with misspelled attribute names.

The WADL file that we use by default is for version 1.0 of the Launchpad API.
If you want to work against a more recent version of the API, download the
WADL yourself (see <https://help.launchpad.net/API/Hacking>) and construct
your C{FakeLaunchpad} like this::

  from wadllib.application import Application
  lp = FakeLaunchpad(
      Application('https://api.launchpad.net/devel/',
                  '/path/to/wadl.xml'))

Where 'https://api.launchpad.net/devel/' is the URL for the WADL file, found
also in the WADL file itelf.
)ÚCallable)Údatetimec                   ó   € ] tR t^HtRtRtR# )ÚIntegrityErrorzERaised when bad sample data is used with a L{FakeLaunchpad} instance.© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú@/usr/lib/python3/dist-packages/launchpadlib/testing/launchpad.pyr   r   H   s   † ÝOr   r   c                   óv   a € ] tR t^Lt o RtR
R ltR tR t]RR l4       t	]RR l4       t
]RR l4       tR	tV tR# )ÚFakeLaunchpadz´A fake Launchpad API class for unit tests that depend on L{Launchpad}.

@param application: A C{wadllib.application.Application} instance for a
    Launchpad WADL definition file.
Nc                ó€   € Vf   ^ RI Hp V! 4       p\        V4      pV P                  P	                  RVRVRV/4       R # )N©Úget_applicationÚcredentialsÚ_applicationÚ_service_root)Úlaunchpadlib.testing.resourcesr   ÚFakeRootÚ__dict__Úupdate)	Úselfr   Úservice_rootÚcacheÚtimeoutÚ
proxy_infoÚapplicationr   Úroot_resources	   &&&&&&&  r   Ú__init__ÚFakeLaunchpad.__init__S   sE   € ð ÒÝFá)Ó+ˆKÜ  Ó-ˆØ�‰×Ñà˜{Ø Ø ðö	
r   c                ó6   € V P                   p\        W1V4       R# )z§Set sample data.

@param name: The name of the attribute.
@param values: A dict representing an object matching a resource
    defined in Launchpad's WADL definition.
N)r   Úsetattr)r   ÚnameÚvaluesr   s   &&& r   Ú__setattr__ÚFakeLaunchpad.__setattr__i   s   € ð ×)Ñ)ˆÜ� FÖ+r   c                ó.   € \        V P                  V4      # )ú:Get sample data.

@param name: The name of the attribute.
)Úgetattrr   )r   r'   s   &&r   Ú__getattr__ÚFakeLaunchpad.__getattr__s   s   € ô
 �t×)Ñ)¨4Ó0Ð0r   c                ó<   € ^ RI Hp V ! \        4       V! 4       R7      # )z.Convenience for setting up access credentials.r   ©r!   ©r   r   Úobject)	ÚclsÚconsumer_nameÚtoken_stringÚaccess_secretr   r   r   r    r   s	   &&&&&&&& r   ÚloginÚFakeLaunchpad.loginz   s   € õ 	Cá”6“8©Ó):Ô;Ð;r   c                ó<   € ^ RI Hp V ! \        4       V! 4       R7      # )z=Get credentials from Launchpad and log into the service root.r   r1   r2   )r4   r5   r   r   r   r    r   s   &&&&&& r   Úget_token_and_loginÚ!FakeLaunchpad.get_token_and_loginŠ   ó   € õ 	Cá”6“8©Ó):Ô;Ð;r   c                ó<   € ^ RI Hp V ! \        4       V! 4       R7      # )z5Log in to Launchpad with possibly cached credentials.r   r1   r2   )r4   r5   r   Úlaunchpadlib_dirr   r    r   s   &&&&&& r   Ú
login_withÚFakeLaunchpad.login_with˜   r=   r   r   )NNNNNN)NNNN)r   r	   r
   r   r   r#   r)   r.   Úclassmethodr8   r;   r@   r   Ú__classdictcell__©Ú__classdict__s   @r   r   r   L   sU   ø‡ € ñô
ò,,ò1ð ó<ó ð<ð ó<ó ð<ð ó<ó ö<r   r   c                ó^   € V  Uu. uF  q3P                  V4      V8X  g   K  VNK  	  up# u upi )z@Find children of element where attribute name is equal to value.)Úget)Úelementr'   ÚvalueÚchilds   &&& r   Úfind_by_attributerK   §   s)   € á&ÓC™w�e¯)©)°D«/¸UÑ*B�EˆE™wÑCÐCùÒCs   …*¡*c                 óR   € V P                  V4      '       d   V R \        V4      )  # V # ©N)ÚendswithÚlen)ÚstringÚsuffixs   &&r   Ústrip_suffixrR   ¬   s)   € Ø‡��v×ÒØ�nœ˜V›˜Ð%Ð%Ø€Mr   c                ó   € RV ,           # )z)Scope a tag name with the WADL namespace.z&{http://research.sun.com/wadl/2006/10}r   )Útag_names   &r   Úwadl_tagrU   ²   s   € à3°hÕ>Ð>r   c                   ó¤   a € ] tR t^·t o RtR.tRR ltR t]! 4       3R lt	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tRtV tR# )ÚFakeResourcea·  
Represents valid sample data on L{FakeLaunchpad} instances.

@ivar _children: A dictionary of child resources, each of type
    C{FakeResource}.
@ivar _values: A dictionary of values associated with this resource. e.g.
    "display_name" or "date_created".  The values of this dictionary will
    never be C{FakeResource}s.

Note that if C{_children} has a key, then C{_values} will not, and vice
versa. That is, they are distinct dicts.
Úlp_saveNc           
     óX   € Vf   / pV P                   P                  RVRVR/ RV/4       R# )a  Construct a FakeResource.

@param application: A C{waddlib.application.Application} instance.
@param resource_type: A C{wadllib.application.ResourceType} instance
    for this resource.
@param values: Optionally, a dict representing attribute key/value
    pairs for this resource.
Nr   Ú_resource_typeÚ	_childrenÚ_values)r   r   )r   r!   Úresource_typer(   s   &&&&r   r#   ÚFakeResource.__init__Ç   s9   € ð Š>ØˆFØ�‰×Ñà Ø  -Ø˜RØ˜6ð	ö	
r   c                ó  € \        V\        4      '       d!   V P                  W4      V P                  V&   R# / pVP	                  V P
                  4       W#V&   V P                  V P                  V4       W0P                  R&   R# )zöSet sample data.

C{value} can be a dict representing an object matching a resource
defined in the WADL definition.  Alternatively, C{value} could be a
resource itself.  Either way, it is checked for type correctness
against the WADL definition.
r\   N)	Ú
isinstanceÚdictÚ_create_child_resourcer[   r   r\   Ú_check_resource_typerZ   r   )r   r'   rI   r(   s   &&& r   r)   ÚFakeResource.__setattr__Û   sj   € ô �eœT×"Ò"Ø#'×#>Ñ#>¸tÓ#KˆD�N‰N˜4Ó àˆFØ�M‰M˜$Ÿ,™,Ô'Ø �4‰Lð ×%Ñ% d×&9Ñ&9¸6ÔBØ'-�M‰M˜)Ó$r   c                ó   € V P                   P                  W4      pW2J dC   V P                  P                  W4      p\        V\        4      '       d   V P                  W4      # WP                  9   d   R # W2J d   \        V : RV: R24      hV# )r,   c                  ó   € R # )Tr   r   r   r   Ú<lambda>Ú*FakeResource.__getattr__.<locals>.<lambda>ù   s   € ™4r   z has no attribute 'Ú')r[   rG   r\   r`   r   Ú_wrap_methodÚspecial_methodsÚAttributeError)r   r'   Ú_markerÚresults   &&& r   r.   ÚFakeResource.__getattr__î   s}   € ð
 —‘×#Ñ# DÓ2ˆØÓØ—\‘\×%Ñ% dÓ4ˆFÜ˜&¤(×+Ò+Ø×(Ñ(¨Ó6Ð6Ø×'Ñ'Ô'ÙÐØÓÜ »tÃTÐ!JÓKÐKØˆr   c                ó   a aa€ VVV 3R lpV# )zœWrapper around methods validates results when it's run.

@param name: The name of the method.
@param method: The callable to run when the method is called.
c                  ó2   <€ SP                   ! SS.V O5/ VB # rM   )Ú_run_method)ÚargsÚkwargsÚmethodr'   r   s   *,€€€r   ÚwrapperÚ*FakeResource._wrap_method.<locals>.wrapper  s    ø€ Ø×#Ò# D¨&ÐB°4ÒB¸6ÑBÐBr   r   )r   r'   ru   rv   s   fff r   rj   ÚFakeResource._wrap_methodþ   s   ú€ ÷	Cð ˆr   c                óB  € V P                  V P                  R4      pV P                  P                  V,          pVP	                  V4       Uu/ uF  pVP
                  VbK  	  ppRpVP                  VR,           4      pVf   RpVP                  VR,           4      pVf   \        V: R24      hV P                  V4      p	V'       d(   V P                  W’4       \        V P                  W’4      # V P                  W’4      w  r\        V P                  V	VVV
4      # u upi )aq  
Ensure that C{values} is a valid object for the C{name} attribute and
return a resource object to represent it as API data.

@param name: The name of the attribute to check the C{values} object
    against.
@param values: A dict with key/value pairs representing attributes and
    methods of an object matching the C{name} resource's definition.
@return: A L{FakeEntry} for an ordinary resource or a
    L{FakeCollection} for a resource that represents a collection.
@raises IntegrityError: Raised if C{name} isn't a valid attribute for
    this resource or if C{values} isn't a valid object for the C{name}
    attribute.
rG   FÚ_collection_linkTÚ_linkz isn't a valid property.)Ú_find_representation_idrZ   r   Úrepresentation_definitionsÚparamsr'   rG   r   Ú_get_resource_typerc   Ú	FakeEntryÚ_check_collection_typeÚFakeCollection)r   r'   r(   Úxml_idÚrepresentationrJ   r~   Úis_linkÚparamr]   Úchild_resource_types   &&&        r   rb   Ú#FakeResource._create_child_resource
  s%  € ð ×-Ñ-¨d×.AÑ.AÀ5ÓIˆØ×*Ñ*×EÑEÀfÕMˆð (×.Ñ.¨~Ô>ó
á>�ð �J‰J˜ÒÙ>ð 	ð 
ð ˆØ—
‘
˜4Ð"4Õ4Ó5ˆØŠ=ØˆGØ—J‘J˜t g�~Ó.ˆEØŠ=Ü ÃÐ!GÓHÐHØ×/Ñ/°Ó6ˆßØ×%Ñ% mÔ<Ü˜T×.Ñ.°ÓFÐFà(,×(CÑ(CØó)Ñ%ˆDô "Ø×!Ñ!ØØØØ#óð ùò'
s   ÁDc                ó¢   € VP                   P                  \        R4      4      pVP                  R4      pV P                  P                  V4      # )zÍGet the resource type for C{param}.

@param param: An object representing a C{_link} or C{_collection_link}
    parameter.
@return: The resource type for the parameter, or None if one isn't
    available.
Úlinkr]   )ÚtagÚfindrU   rG   r   Úget_resource_type)r   r†   rŠ   r'   s   &&  r   r   ÚFakeResource._get_resource_type6  s@   € ð �y‰y�~‰~œh vÓ.Ó/ˆØ�x‰x˜Ó(ˆØ× Ñ ×2Ñ2°4Ó8Ð8r   c                ó®   € VP                  4        F@  w  r4\        V\        4      '       d   V P                  W4       K.  V P	                  WV4       KB  	  R# )a3  
Ensure that attributes and methods defined for C{partial_object} match
attributes and methods defined for C{resource_type}.

@param resource_type: The resource type to check the attributes and
    methods against.
@param partial_object: A dict with key/value pairs representing
    attributes and methods.
N)Úitemsr`   r   Ú_get_methodÚ_check_attribute)r   r]   Úpartial_objectr'   rI   s   &&&  r   rc   Ú!FakeResource._check_resource_typeB  sD   € ð *×/Ñ/Ö1‰KˆDÜ˜%¤×*Ò*à× Ñ  Ö5à×%Ñ% m¸5ÖAó 2r   c                óð   € RpRpVP                  4        F\  w  r5VR8X  d   V P                  W4      w  r4K!  \        V\        4      '       d   V P	                  W4       KJ  V P                  WV4       K^  	  W43# )aò  
Ensure that attributes and methods defined for C{partial_object} match
attributes and methods defined for C{resource_type}.  Collection
entries are treated specially.

@param resource_type: The resource type to check the attributes and
    methods against.
@param partial_object: A dict with key/value pairs representing
    attributes and methods.
@return: (name, resource_type), where 'name' is the name of the child
    resource type and 'resource_type' is the corresponding resource
    type.
NÚentries)r�   Ú_check_entriesr`   r   r‘   r’   )r   r]   r“   r'   r‡   rI   s   &&&   r   r�   Ú#FakeResource._check_collection_typeS  s}   € ð ˆØ"ÐØ)×/Ñ/Ö1‰KˆDØ�yÔ Ø,0×,?Ñ,?Ø!ó-Ñ)�Ñ)ô ˜E¤8×,Ò,à× Ñ  Ö5à×%Ñ% m¸5ÖAñ 2ð Ð(Ð(r   c                ó´   € V P                  W4      pV F@  pV F7  pVP                  R4      pVf   K  V P                  P                  V4      u u # 	  KB  	  R# )zÂFind the WADL XML id for the representation of C{resource_type}.

Looks in the WADL for the first representiation associated with the
method for a resource type.

:return: An XML id (a string).
ÚhrefN)r‘   rG   r   Úlookup_xml_id)r   r]   r'   Ú
get_methodÚresponser„   Úrepresentation_urls   &&&    r   r|   Ú$FakeResource._find_representation_ido  sW   € ð ×%Ñ% mÓ:ˆ
Û"ˆHÛ"*�Ø%3×%7Ñ%7¸Ó%?Ð"Ø%Ô1Ø×,Ñ,×:Ñ:Ð;MÓNÔNó #+ó #r   c                óN   € V P                  VR4      pV P                  WBV4       R# )ag  
Ensure that C{value} is a valid C{name} attribute on C{resource_type}.

Does this by finding the representation for the default, canonical GET
method (as opposed to the many "named" GET methods that exist.)

@param resource_type: The resource type to check the attribute
    against.
@param name: The name of the attribute.
@param value: The value to check.
rG   N)r|   Ú_check_attribute_representation)r   r]   r'   rI   rƒ   s   &&&& r   r’   ÚFakeResource._check_attribute~  s&   € ð ×-Ñ-¨m¸UÓCˆØ×,Ñ,¨V¸5ÖAr   c                óÔ  € V P                   P                  V,          pVP                  V4       Uu/ uF  pVP                  VbK  	  ppVR,           V9   d4   V P	                  WbR,           ,          4      pV P                  Ws4      w  r‰R# VR,           V9   d2   V P	                  WbR,           ,          4      pV P                  Ws4       R# VP                  V4      p
V
f   \        RV,          4      hV
P                  f+   \        V\        4      '       g   \        V: RV: 24      hR# V
P                  R8X  d+   \        V\        4      '       g   \        V: RV: 24      hR# R# u upi )aŒ  
Ensure that C{value} is a valid value for C{name} with the
representation definition matching C{xml_id}.

@param xml_id: The XML ID for the representation to check the
    attribute against.
@param name: The name of the attribute.
@param value: The value to check.
@raises IntegrityError: Raised if C{name} is not a valid attribute
    name or if C{value}'s type is not valid for the attribute.
rz   r{   Nz%s not foundz is not a str or unicode for zxsd:dateTimez is not a datetime for )r   r}   r~   r'   r   r�   rc   rG   r   Útyper`   Ústrr   )r   rƒ   r'   rI   r„   rJ   r~   r]   Ú
child_namer‡   r†   s   &&&&       r   r¡   Ú,FakeResource._check_attribute_representation�  s]  € ð ×*Ñ*×EÑEÀfÕMˆð (×.Ñ.¨~Ô>ó
á>�ð �J‰J˜ÒÙ>ð 	ð 
ð Ð$Õ$¨Ô.Ø ×3Ñ3ØÐ0Õ0Õ1óˆMð /3×.IÑ.IØó/Ñ+ˆJÑ+ð �G�^˜vÔ%Ø ×3Ñ3°FÀ'½>Õ4JÓKˆMØ×%Ñ% mÖ;à—J‘J˜tÓ$ˆEØŠ}Ü$ ^°dÕ%:Ó;Ð;Ø�z‰zÒ!Ü! %¬×-Ò-Ü(Û?DÂdÐKóð ñ .ð —‘˜~Ô-Ü! %¬×2Ò2Ü(Û9>ÂÐEóð ñ 3ñ .ùò/
s   ±E%c                óè   € W P                   9   d   R# VP                  P                  R4      pV: RV: 2p \        VP                  RV4      w  pV#   \         d    \        T: RT: 24      hi ; i)a  Get the C{name} method on C{resource_type}.

@param resource_type: The method's resource type.
@param name: The name of the method.
@raises IntegrityError: Raised if a method called C{name} is not
    available on C{resource_type}.
@return: The XML element for the method from the WADL.
NÚidÚ-z is not a method of )rk   r‹   rG   rK   Ú
ValueErrorr   )r   r]   r'   Úresource_namerƒ   rœ   s   &&&   r   r‘   ÚFakeResource._get_method·  s|   € ð ×'Ñ'Ô'ÙØ%×)Ñ)×-Ñ-¨dÓ3ˆÛ)ª4Ð0ˆð	Ü,¨]×->Ñ->ÀÀfÓM‰LˆZð
 Ðøô	 ô 	Ü Û.2²MÐBóð ð	ús   ¸A ÁA1c                óv   € V! V/ VB pWP                   9   g   Vf   V# V P                  V P                  W4      # )aè  Run a method and convert its result into a L{FakeResource}.

If the result represents an object it is validated against the WADL
definition before being returned.

@param name: The name of the method.
@param method: A callable.
@param args: Arguments to pass to the callable.
@param kwargs: Keyword arguments to pass to the callable.
@return: A L{FakeResource} representing the result if it's an object.
@raises IntegrityError: Raised if the return value from the method
    isn't valid.
)rk   Ú_create_resourcerZ   )r   r'   ru   rs   rt   rn   s   &&&*, r   rr   ÚFakeResource._run_methodÌ  sA   € ñ ˜Ð( Ñ(ˆØ×'Ñ'Ô'¨6ª>ØˆMà×(Ñ(¨×)<Ñ)<¸dÓKÐKr   c                ó0  € VP                   P                  R4      pWB8X  d   RpV P                  W4      pVf   V# \        VR4      pWPP                  P
                  9  d
   VR,          pV P                  P
                  V,          pVP                  R4      '       d-   V P                  Wc4      w  r'\        V P                  VVVV4      # V P                  Wc4       \        V P                  V4      pVP                  4        F  w  rš\        W‰V
4       K  	  V# )aº  Create new L{FakeResource} for C{resource_type} method call result.

@param resource_type: The resource type of the method.
@param name: The name of the method on C{resource_type}.
@param result: The result of calling the method.
@raises IntegrityError: Raised if C{result} is an invalid return value
    for the method.
@return: A L{FakeResource} for C{result}, or just C{result} if no
    response representation is defined for the method.
r©   rG   z-fullz	-resourcez-page-resource)r‹   rG   r|   rR   r   Úresource_typesrN   r�   r‚   rc   r€   r�   r&   )r   r]   r'   rn   r¬   rƒ   Úresult_resource_typer‡   Úresourcer¦   Úchild_values   &&&&       r   r¯   ÚFakeResource._create_resourceà  s  € ð &×)Ñ)×-Ñ-¨dÓ3ˆØÔ ØˆDØ×-Ñ-¨mÓBˆØŠ>ØˆMÜ˜f gÓ.ˆØ×*Ñ*×9Ñ9Ô9Ø�kÕ!ˆFØ#×0Ñ0×?Ñ?ÀÕGÐØ�?‰?Ð+×,Ò,Ø(,×(CÑ(CØ$ó)Ñ%ˆDô "Ø×!Ñ!Ø$ØØØ#óð ð ×%Ñ%Ð&:ÔCÜ  ×!2Ñ!2Ð4HÓIˆHØ+1¯<©<®>Ñ'�
Ü˜¨kÖ:ñ ,:àˆOr   c                ó8  € V P                  VR4      pV P                  P                  V,          p\        VP                  RR4      w  p\        V4      w  pVP                  R4      pVP                  R4      ^,          pVV P                  P                  V4      3# )a  Get the name and resource type for the entries in a collection.

@param resource_type: The resource type for a collection.
@return: (name, resource_type), where 'name' is the name of the child
    resource type and 'resource_type' is the corresponding resource
    type.
rG   r'   Úentry_linksr]   Ú#)	r|   r   r}   rK   r‹   ÚlistrG   Úsplitr�   )r   r]   rƒ   Úrepresentation_definitionr¸   Úresource_type_urlÚresource_type_names   &&     r   Ú_get_child_resource_typeÚ%FakeResource._get_child_resource_type  s¡   € ð ×-Ñ-¨m¸UÓCˆà×Ñ×8Ñ8¸Õ@ð 	"ô *Ø%×)Ñ)¨6°=ó
‰ˆô ˜{Ó+‰ˆØ)×-Ñ-¨oÓ>ÐØ.×4Ñ4°SÓ9¸!Õ<ÐàØ×Ñ×/Ñ/Ð0AÓBð
ð 	
r   c                ób   € V P                  V4      w  r4V F  pV P                  WE4       K  	  W43# )aw  Ensure that C{entries} are valid for a C{resource_type} collection.

@param resource_type: The resource type of the collection the entries
    are in.
@param entries: A list of dicts representing objects in the
    collection.
@return: (name, resource_type), where 'name' is the name of the child
    resource type and 'resource_type' is the corresponding resource
    type.
)r¿   rc   )r   r]   r–   r'   r‡   Úentrys   &&&   r   r—   ÚFakeResource._check_entries  s>   € ð %)×$AÑ$AØó%
Ñ!ˆó ˆEØ×%Ñ%Ð&9ÖAñ àÐ(Ð(r   c                ó2  € V P                   P                  P                  R4      pRpV P                  P                  RV4      pV P                  P                  RV4      pRV P                  P
                  : RV: RV: R\        \        V 4      4      : R2	# )z}
The resource type, identifier if available, and memory address are
used to generate a representation of this fake resource.
r©   r3   r'   Ú<Ú z at Ú>)rZ   r‹   rG   r\   Ú	__class__r   Úhexr©   )r   r'   Úkeys   &  r   Ú__repr__ÚFakeResource.__repr__1  sy   € ð
 ×"Ñ"×&Ñ&×*Ñ*¨4Ó0ˆØˆØ�l‰l×Ñ˜t SÓ)ˆØ�l‰l×Ñ˜v sÓ+‰à�N‰N×#Ô#ÛÛÜ”�4“ŽMð	
ð 	
r   r   rM   )r   r	   r
   r   r   rk   r#   r)   r3   r.   rj   rb   r   rc   r�   r|   r’   r¡   r‘   rr   r¯   r¿   r—   rË   r   rC   rD   s   @r   rW   rW   ·   s{   ø‡ € ñð !�k€Oô
ò(.ñ& )/«ô ò 
ò*òX
9òBò")ò8OòBò(òTò*Lò(%òN
ò0)÷$
ð 
r   rW   c                   ó6   a a€ ] tR tRt oRtV 3R ltRtVtV ;t# )r   iB  z$Fake root object for an application.c                ój   <€ VP                  VP                  R,           4      p\        SV `  W4       R# )z…Create a L{FakeResource} for the service root of C{application}.

@param application: A C{wadllib.application.Application} instance.
z#service-rootN)r�   Ú
markup_urlÚsuperr#   )r   r!   r]   rÈ   s   && €r   r#   ÚFakeRoot.__init__E  s2   ø€ ð
 $×5Ñ5Ø×"Ñ" _Õ4ó
ˆô 	‰Ñ˜Ö4r   r   )	r   r	   r
   r   r   r#   r   rC   Ú__classcell__©rÈ   rE   s   @@r   r   r   B  s   ù‡ € Ù.÷5õ 5r   r   c                   ó   € ] tR tRtRtRtR# )r€   iP  zA fake resource for an entry.r   Nr   r   r   r   r€   r€   P  s   † Ý'r   r€   c                   óF   a a€ ] tR tRt oRtRV 3R lltR tR tRtVt	V ;t
# )r‚   iT  z!A fake resource for a collection.c                óf   <€ \         SV `  WV4       V P                  P                  R VRV/4       R# )Ú_nameÚ_child_resource_typeN)rÐ   r#   r   r   )r   r!   r]   r(   r'   r‡   rÈ   s   &&&&&&€r   r#   ÚFakeCollection.__init__W  s4   ø€ ô 	‰Ñ˜°VÔ<Ø�‰×ÑØ�dÐ2Ð4GÐHö	
r   c              #  óª   "  € V P                   P                  RR4      pV F,  pV P                  V P                  V P                  V4      x € K.  	  R# 5i)z;Iterate items if this resource has an C{entries} attribute.r–   Nr   )r\   rG   r¯   rØ   r×   )r   r–   rÂ   s   &  r   Ú__iter__ÚFakeCollection.__iter__d  sI   é € à—,‘,×"Ñ" 9¨bÓ1ˆÛˆEØ×'Ñ'Ø×)Ñ)¨4¯:©:°uóô ó ùs   ‚AAc                óV  € \        V 4      p\        V\        4      '       dX   VP                  ;'       g    ^ pVP                  pV^ 8  d   \        R4      hV^ 8  d   \        R4      hVP                  V4      # \        V\        4      '       d   VP                  V4      # \        R4      h)zçLook up a slice, or a subordinate resource by index.

@param key: An individual object key or a C{slice}.
@raises IndexError: Raised if an invalid key is provided.
@return: A L{FakeResource} instance for the entry matching C{key}.
z6Collection slices must have a nonnegative start point.z>Collection slices must have a definite, nonnegative end point.z!Do not support index lookups yet.)	rº   r`   ÚsliceÚstartÚstopr«   Ú__getitem__ÚintÚ
IndexError)r   rÊ   r–   rß   rà   s   &&   r   rá   ÚFakeCollection.__getitem__l  s¡   € ô �t“*ˆÜ�cœ5×!Ò!Ø—I‘I—N�N ˆEØ—8‘8ˆDØ�qŒyÜ ØOóð ð �aŒxÜ ð-óð ð ×&Ñ& sÓ+Ð+Ü˜œS×!Ò!Ø×&Ñ& sÓ+Ð+äÐ@ÓAÐAr   r   )NNN)r   r	   r
   r   r   r#   rÛ   rá   r   rC   rÒ   rÓ   s   @@r   r‚   r‚   T  s   ù‡ € Ù+÷
ò÷Bò Br   r‚   N)r   Úcollections.abcr   r   Ú	Exceptionr   r   rK   rR   rU   rW   r   r€   r‚   r   r   r   Ú<module>rç      sq   ðñ&/õb %Ý ôP�Yô P÷X<ñ X<òvDò
ò?÷
H
ñ H
ôV5ˆ|ô 5ô(�ô (ô0B�\ö 0Br   