
AKc           @   s  y# d  d l  Z  e  j d d e  Wn n Xd  d l m Z d  d l Z d  d l Z d  d l Td  d l m Z d  d l	 Z	 d  d l
 m Z d  d l m Z m Z m Z d  d	 l m Z m Z d  d
 l m Z m Z d  d l m Z m Z d  d l m Z m Z d  d l m Z d6 Z d d   d  Z d   Z d   Z e d d d    Z e d d d    Z  e   Z d e f d     YZ! d e f d     YZ" d e f d      YZ# d! e$ f d"     YZ% d# e$ f d$     YZ& d% e& f d&     YZ' d' e& f d(     YZ( d) e& f d*     YZ) d+ e& f d,     YZ* d- e& f d.     YZ+ d/ e& f d0     YZ, d1   Z- d2   Z. d3   Z/ d4 e$ f d5     YZ0 d S(7   iNt   ignores   Python C API version mismatch(   t   join(   t   *(   t   environ(   t   __version__(   t   maint   FuseGetContextt   FuseInvalidate(   t	   FuseErrort   FuseAPIVersion(   t   SubOptsHivet   SubbedOptFormatter(   t   SubbedOptIndentedFormattert   SubbedOptParse(   t   SUPPRESS_HELPt   OptParseError(   t   seti    i   t   .c         C   s   |  S(   N(    (   t   x(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   <lambda>,   s    c         C   s   |  t  k r d St  |  } | } t | t t j d    sP t j |  } n  | j |  sy t d |  | f   n  | |  S(   s   
    Fetch enviroment variable and optionally transform it. Return `None` if
    variable is unset. Bail out if value of variable doesn't match (optional)
    regex pattern.
    t    s,   env var %s doesn't match required pattern %sN(   R   t   Nonet
   isinstancet   typet   ret   compilet   searcht   RuntimeError(   t   vart   patternt   transt   valt   rpat(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt
   __getenv__,   s    
c           C   s   t  r
 t  St r d Sd  S(   Ni    i   (   i    i   (   t   fuse_python_apit
   compat_0_1(    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   get_fuse_python_api>   s    c           C   s   t    d k S(   Ni    i   (   i    i   (   R$   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   get_compat_0_1E   s    t   FUSE_PYTHON_APIs   ^[\d.]+$c         C   s,   t  g  |  j d  D] } t |  ^ q  S(   NR   (   t   tuplet   splitt   int(   R   t   i(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   J   s    t   FUSE_PYTHON_COMPATs   ^(0.1|ALL)$c         C   s   t  S(   N(   t   True(   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   M   s    t   FuseArgsc           B   st   e  Z d  Z i d d 6d d 6d d 6Z d   Z d   Z d	   Z d
   Z d   Z d   Z	 d   Z
 d d  Z RS(   s1   
    Class representing a FUSE command line.
    s   -hot   showhelps   -Vt   showversions   -ft
   foregroundc         C   sD   t  j |   i  |  _ d  |  _ x |  j D] } t |  j | <q) Wd  S(   N(   R
   t   __init__t	   modifiersR   t
   mountpointt   fuse_modifierst   False(   t   selft   m(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1   b   s
    		c         C   sK   d j  d t |  j  d d t |  j  d g  d j  |  j    d S(   Ns   
s   < on t   :s     s     -o s   ,
     s    >(   R   t   strR3   R2   t	   _str_core(   R6   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   __str__l   s    Fc         C   s   |  j  | S(   N(   R2   (   R6   t   mod(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   getmodr   s    c         C   s   t  |  j | <d  S(   N(   R,   R2   (   R6   R<   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   setmodu   s    c         C   s   t  |  j | <d  S(   N(   R5   R2   (   R6   R<   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   unsetmodx   s    c         C   s*   |  j  d  r t S|  j  d  r& t St S(   NR.   R/   (   R=   R5   R,   (   R6   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   mount_expected{   s
    c         C   s   |  j    t j r  t j d p# d g } |  j rE | j |  j  n  x: |  j j   D]) \ } } | rU | j |  j |  qU qU Wg  } x2 |  j j   D]! \ } } | j | d |  q W| j	 |  j
  | r | j d d j |   n  | S(   s"   Mangle self into an argument arrayi    t   pythont   =s   -ot   ,(   t   canonifyt   syst   argvR3   t   appendR2   t	   iteritemsR4   t   optdictt   extendt   optlistR   (   R6   t   argsR7   t   vt   optat   o(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   assemble   s    
	c         C   s%   | s t  j   } n  t j |  |  S(   s   
        Same as for SubOptsHive, with the following difference:
        if other is not specified, `Fuse.fuseoptref()` is run and its result
        will be used.
        (   t   Fuset
   fuseoptrefR
   t   filter(   R6   t   other(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRS      s    N(   t   __name__t
   __module__t   __doc__R4   R1   R;   R=   R>   R?   R@   RP   R   RS   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR-   Y   s   

	
						t   FuseFormatterc           B   s   e  Z d    Z d   Z RS(   c         K   s-   d | k r d | d <n  t  j |  |  d  S(   Nt   indent_incrementi   (   R   R1   (   R6   t   kw(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1      s    c         C   s<   t  j |  |  t |  j d  |  _ |  j |  j |  _ d  S(   Ni   (   R   t   store_option_stringst   maxt   help_positiont   widtht
   help_width(   R6   t   parser(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR[      s    (   RU   RV   R1   R[   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRX      s   	t   FuseOptParsec           B   se   e  Z d  Z d   Z d d	 d  Z d   Z e j d  Z	 e j d  Z
 d	 d	 d  Z d   Z RS(
   s  
    This class alters / enhances `SubbedOptParse` so that it's
    suitable for usage with FUSE.

    - When adding options, you can use the `mountopt` pseudo-attribute which
      is equivalent with adding a subopt for option ``-o``
      (it doesn't require an option argument).

    - FUSE compatible help and version printing.

    - Error and exit callbacks are relaxed. In case of FUSE, the command
      line is to be treated as a DSL [#]_. You don't wanna this module to
      force an exit on you just because you hit a DSL syntax error.

    - Built-in support for conventional FUSE options (``-d``, ``-f`, ``-s``).
      The way of this can be tuned by keyword arguments, see below.

    .. [#] http://en.wikipedia.org/wiki/Domain-specific_programming_language

    Keyword arguments for initialization
    ------------------------------------

    standard_mods
      Boolean [default is `True`].
      Enables support for the usual interpretation of the ``-d``, ``-f``
      options.

    fetch_mp
      Boolean [default is `True`].
      If it's True, then the last (non-option) argument
      (if there is such a thing) will be used as the FUSE mountpoint.

    dash_s_do
      String: ``whine``, ``undef``, or ``setsingle`` [default is ``whine``].
      The ``-s`` option -- traditionally for asking for single-threadedness --
      is an oddball: single/multi threadedness of a fuse-py fs doesn't depend
      on the FUSE command line, we have direct control over it.

      Therefore we have two conflicting principles:

      - *Orthogonality*: option parsing shouldn't affect the backing `Fuse`
        instance directly, only via its `fuse_args` attribute.

      - *POLS*: behave like other FUSE based fs-es do. The stock FUSE help
        makes mention of ``-s`` as a single-threadedness setter.

      So, if we follow POLS and implement a conventional ``-s`` option, then
      we have to go beyond the `fuse_args` attribute and set the respective
      Fuse attribute directly, hence violating orthogonality.

      We let the fs authors make their choice: ``dash_s_do=undef`` leaves this
      option unhandled, and the fs author can add a handler as she desires.
      ``dash_s_do=setsingle`` enables the traditional behaviour.

      Using ``dash_s_do=setsingle`` is not problematic at all, but we want fs
      authors be aware of the particularity of ``-s``, therefore the default is
      the ``dash_s_do=whine`` setting which raises an exception for ``-s`` and
      suggests the user to read this documentation.

    dash_o_handler
      Argument should be a SubbedOpt instance (created with
      ``action="store_hive"`` if you want it to be useful).
      This lets you customize the handler of the ``-o`` option. For example,
      you can alter or suppress the generic ``-o`` entry in help output.
    c            s7  g    _  d | k r$ | j d  p* t     _ d | k rK | j d  pN d } d | k rx t | j d     _ n	 t   _ d | k r t | j d   } n t } d | k r | j d    _ n  d | k r t   | d <n  d | k o | j d  } t	 j
   | |  | r,  j |  n(   j d	 d
 d d   j d d d d | r  j d d
 d d   f d   d t   j d d
 d d   f d   d t n  | d k rd   } nF | d k r  f d   } n( | d k rd  } n t d t |   | r3  j d d
 d d | d t n  d  S(   Nt	   fuse_argst	   dash_s_dot   whinet   fetch_mpt   standard_modst   fuset	   formattert   dash_o_handlers   -ot   actiont
   store_hivet   subopts_hivet   helps   mount optionst   metavars   opt,[opt...]s   -ft   callbackc             s     j  j d  S(   NR0   (   Rb   R>   (   t   a(   R6   (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s    s   -dc             s     j  j d  S(   Nt   debug(   Rb   t   add(   Rp   (   R6   (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s    c         S   s   t  d  d  S(   Ns   

! If you want the "-s" option to work, pass
!
!   dash_s_do='setsingle'
!
! to the Fuse constructor. See docstring of the FuseOptParse class for an
! explanation why is it not set by default.
(   R   (   t   optiont   opt_strt   valueR`   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   dsdcb  s    t	   setsinglec            s   t    j _ d  S(   N(   R5   Rg   t   multithreaded(   Rs   Rt   Ru   R`   (   R6   (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRv   )  s    t   undefs%   key `dash_s_do': uninterpreted value s   -s(   t	   mountoptst   popR-   Rb   t   boolRe   R,   Rg   RX   R   R1   t
   add_optionR   R   t   ArgumentErrorR9   (   R6   RL   RZ   t   dsdt   smodst   dohRv   (    (   R6   s(   /usr/lib/python2.7/dist-packages/fuse.pyR1      sJ    	'!	
	i    c         C   s   | r t  j j |  n  d  S(   N(   RE   t   stderrt   write(   R6   t   statust   msg(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   exit6  s    c         C   s   t  j |  |  t |  d  S(   N(   R   t   errorR   (   R6   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   :  s    c         C   s(   t  j |  |  | J|  j j d  d  S(   NR.   (   R   t
   print_helpRb   R>   (   R6   t   file(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   >  s    c         C   s$   t  j |  |  |  j j d  d  S(   NR/   (   R   t   print_versionRb   R>   (   R6   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   C  s    c         C   sU   t  j |  | |  \ } } | rK |  j rK t j j | j    |  j _ n  | | f S(   N(	   R   t
   parse_argsRe   t   ost   patht   realpathR{   Rb   R3   (   R6   RL   t   valuesRO   Rp   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   G  s    !c         O   s}   d | k rf | s d | k r- t  d   n  d } | j d  | d <d | k rf | d | d <qf n  t j |  | |  d  S(   Nt   mountoptt   suboptsW   having options or specifying the `subopt' attribute conflicts with `mountopt' attributes   -ot   dest(   s   -o(   R   R{   R   R}   (   R6   t   optst   attrs(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR}   M  s    N(   RU   RV   RW   R1   R   R   R   RE   R   R   R   R   R}   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRa      s   A	@	t   ErrnoWrapperc           B   s   e  Z d    Z d   Z RS(   c         C   s   | |  _  d  S(   N(   t   func(   R6   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1   e  s    c         O   sT   y t  |  j | |  SWn6 t t f k
 rO } t | d  rJ | j } n  | SXd  S(   Nt   errno(   t   applyR   t   IOErrort   OSErrort   hasattrR   (   R6   RL   RZ   t   detail(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   __call__h  s     (   RU   RV   R1   R   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   c  s   	t
   FuseStructc           B   s   e  Z d    Z RS(   c         K   s)   x" | D] } t  |  | | |  q Wd  S(   N(   t   setattr(   R6   RZ   t   k(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1   u  s    (   RU   RV   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   s  s   t   Statc           B   s   e  Z d  Z d   Z RS(   sn   
    Auxiliary class which can be filled up stat attributes.
    The attributes are undefined by default.
    c         K   sn   d  |  _ d |  _ d |  _ d  |  _ d |  _ d |  _ d |  _ d |  _ d |  _	 d |  _
 t j |  |  d  S(   Ni    (   R   t   st_modet   st_inot   st_devt   st_nlinkt   st_uidt   st_gidt   st_sizet   st_atimet   st_mtimet   st_ctimeR   R1   (   R6   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s    										(   RU   RV   RW   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   z  s   t   StatVfsc           B   s   e  Z d  Z d   Z RS(   si   
    Auxiliary class which can be filled up statvfs attributes.
    The attributes are 0 by default.
    c         K   sn   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _	 t
 j |  |  d  S(   Ni    (   t   f_bsizet   f_frsizet   f_blockst   f_bfreet   f_bavailt   f_filest   f_ffreet   f_favailt   f_flagt	   f_namemaxR   R1   (   R6   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s    										(   RU   RV   RW   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s   t   Direntryc           B   s   e  Z d  Z d   Z RS(   s  
    Auxiliary class for carrying directory entry data.
    Initialized with `name`. Further attributes (each
    set to 0 as default):

    offset
        An integer (or long) parameter, used as a bookmark
        during directory traversal.
        This needs to be set it you want stateful directory
        reading.

    type
       Directory entry type, should be one of the stat type
       specifiers (stat.S_IFLNK, stat.S_IFBLK, stat.S_IFDIR,
       stat.S_IFCHR, stat.S_IFREG, stat.S_IFIFO, stat.S_IFSOCK).

    ino
       Directory entry inode number.

    Note that Python's standard directory reading interface is
    stateless and provides only names, so the above optional
    attributes doesn't make sense in that context.
    c         K   s8   | |  _  d |  _ d |  _ d |  _ t j |  |  d  S(   Ni    (   t   namet   offsetR   t   inoR   R1   (   R6   R   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s
    				(   RU   RV   RW   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s   t   Flockc           B   s   e  Z d  Z d d  Z RS(   s   
    Class for representing flock structures (cf. fcntl(3)).
    
    It makes sense to give values to the `l_type`, `l_start`,
    `l_len`, `l_pid` attributes (`l_whence` is not used by
    FUSE, see ``fuse.h``).
    c         K   sB   d  |  _ d  |  _ d  |  _ d  |  _ | | d <t j |  |  d  S(   NR   (   R   t   l_typet   l_startt   l_lent   l_pidR   R1   (   R6   R   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s    				
N(   RU   RV   RW   R   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s   t   Timespecc           B   s   e  Z d  Z d d  Z RS(   so   
    Cf. struct timespec in time.h:
    http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
    c         K   s0   d  |  _ d  |  _ | | d <t j |  |  d  S(   NR   (   R   t   tv_sect   tv_nsecR   R1   (   R6   R   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s    		
N(   RU   RV   RW   R   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s   t   FuseFileInfoc           B   s   e  Z d    Z RS(   c         K   s&   t  |  _ t  |  _ t j |  |  d  S(   N(   R5   t   keept	   direct_ioR   R1   (   R6   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s    		(   RU   RV   R1   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s   c             s   i d d 6d d 6d d 6d d 6d d 6d d 6d  d	 6d! d
 6d" d 6d# d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6  |  s   S  f d   } d g } x |  r t  | |  |   }  q W| d S($   s  
    Get info about the FUSE API version needed for the support of some features.

    This function takes a variable number of feature patterns.

    A feature pattern is either:

    -  an integer (directly referring to a FUSE API version number)
    -  a built-in feature specifier string (meaning defined by dictionary)
    -  a string of the form ``has_foo``, where ``foo`` is a filesystem method
       (refers to the API version where the method has been introduced)
    -  a list/tuple of other feature patterns (matches each of its members)
    -  a regexp (meant to be matched against the builtins plus ``has_foo``
       patterns; can also be given by a string of the from "re:*")
    -  a negated regexp (can be given by a string of the form "!re:*")

    If called with no arguments, then the list of builtins is returned, mapped
    to their meaning.

    Otherwise the function returns the smallest FUSE API version number which
    has all the matching features.

    Builtin specifiers worth to explicit mention:
    - ``stateful_files``: you want to use custom filehandles (eg. a file class).
    - ``*``: you want all features.
    - while ``has_foo`` makes sense for all filesystem method ``foo``, some
      of these can be found among the builtins, too (the ones which can be
      handled by the general rule).

    specifiers like ``has_foo`` refer to requirement that the library knows of
      the fs method ``foo``.
    i   t   stateful_filesi   t   stateful_dirst   stateful_iot   stateful_files_keep_cachet   stateful_files_direct_iot
   keep_cacheR   t   has_opendirt   has_releasedirt   has_fsyncdiri   t
   has_createt
   has_accesst   has_fgetattrt   has_ftruncatet   has_initt
   has_fsinitt   has_destroyt   has_fsdestroyi   t   has_lockt   has_utimenst   has_bmaps   !re:^\*$R   c      
   3   s  x|  D]} t  | t  r9 t | d |  | d <q n  t  | t  sW t  | t  rs x | D] } | Vq^ Wq n  t  | t  o t j d  j |  } t  | t	 t j d    s | r]t
 } | r | j   } t j | d  } t | d  } n  xX   j   g  t j D] } d | ^ qD], } | t t j | |   k r'| Vq'q'Wq n  t j d  j |  } | r| j   d t j k r|   k rd Vq n    | Vq Wd  S(   Ni    s   (!\s*|)re:(.*)R   i   t   has_s   has_(.*)i   (   R   R)   R\   t   listR'   R9   R   R   t   matchR   R5   t   groupsR|   t   keysRQ   t   _attrsR   (   RL   t   maxvat   fpt   ft   mat   negt   magRp   (   t   fmap(    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   resolve4  s0    	'$1+i    (   R   R   (   R   (   R   (   R   (   R   (   R   (   R   (   t   feasR   R   (    (   R   s(   /usr/lib/python2.7/dist-packages/fuse.pyt   feature_needs  s:    "

		c           C   s   t    S(   s/   Get the API version of your underlying FUSE lib(   R	   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt
   APIVersionV  s    c          G   sX   t    } xH |  D]@ } t |  } | | k  r t d | t |  | f   q q Wd S(   s  
    Takes some feature patterns (like in `feature_needs`).
    Raises a fuse.FuseError if your underlying FUSE lib fails
    to have some of the matching features.

    (Note: use a ``has_foo`` type feature assertion only if lib support
    for method ``foo`` is *necessary* for your fs. Don't use this assertion
    just because your fs implements ``foo``. The usefulness of ``has_foo``
    is limited by the fact that we can't guarantee that your FUSE kernel
    module also supports ``foo``.)
    sI   FUSE API version %d is required for feature `%s' but only %d is availableN(   R   R   R   R9   (   R   t   favt   feat   fn(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   feature_assert\  s    	RQ   c        %   B   sV  e  Z d  Z d d d d d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% g% Z d& Z d'   Z d(   Z d9 d)  Z d*   Z	 d+   Z
 d,   Z d-   Z e e  Z d. e f d/     YZ e j d0 d: d;  e j d1 d< d=  d2   Z d3   Z d4   Z d5   Z d6   Z d7   Z i d8 d 6Z RS(>   s   
    Python interface to FUSE.

    Basic usage:

    - instantiate

    - add options to `parser` attribute (an instance of `FuseOptParse`)

    - call `parse`

    - call `main`
    t   getattrt   readlinkt   readdirt   mknodt   mkdirt   unlinkt   rmdirt   symlinkt   renamet   linkt   chmodt   chownt   truncatet   utimet   opent   readR   t   releaset   statfst   fsynct   createt   opendirt
   releasedirt   fsyncdirt   flusht   fgetattrt	   ftruncatet   getxattrt	   listxattrt   setxattrt   removexattrt   accesst   lockt   utimenst   bmapt   fsinitt	   fsdestroys   %prog [mountpoint] [options]c         O   s  t  s/ t t d t d t d t d  n  d   } t t  t  sQ |   n  x4 t  D], } t | t  sz | d k  rX |   qX qX Wt  t k r t d t  d t d	  n  d
 | k r | j d
  p t   |  _	 t
   r |  j | |   St |  _ d | k r|  j | d <n  d
 | k r3|  j	 | d
 <n  |  | d <d | k rX| j d  p[t } | | |   |  _ |  j   |  _ d S(   si  
        Not much happens here apart from initializing the `parser` attribute.
        Arguments are forwarded to the constructor of the parser class almost
        unchanged.

        The parser class is `FuseOptParse` unless you specify one using the
        ``parser_class`` keyword. (See `FuseOptParse` documentation for
        available options.)
        s/   .fuse_python_api not defined.

! Please define s+   .fuse_python_api internally (eg.
! 
! (1)  s   .fuse_python_api = s   
! 
! ) or in the enviroment (eg. 
! 
! (2)  FUSE_PYTHON_API=0.1
! 
! ).
!
! If you are actually developing a filesystem, probably (1) is the way to go.
! If you are using a filesystem written before 2007 Q2, probably (2) is what
! you want."
c           S   s   t  d t  d  S(   Ns#   malformatted fuse_python_api value (   R   R"   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt	   malformed  s    i    s'   
! You require FUSE-Python API version s%   .
! However, the latest available is s   .
Rb   t   usageRg   t   parser_classN(   R"   R   RU   t   FUSE_PYTHON_API_VERSIONR   R'   R)   R{   R-   Rb   R%   t   __init_0_1__R,   Rx   t   fusageRa   R`   t	   Methproxyt	   methproxy(   R6   RL   RZ   R  R*   t   parserclass(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1     s4    
	

'		
!c         O   s   d | k o | j  d  } | r= t | t  r= t d  n  y |  j j | |   |  _ Wn* t k
 r | r t j	 |  n    n X|  j
 S(   s/   Parse command line, fill `fuse_args` attribute.t   errexs%   error exit value should be an integer(   R{   R   R)   t	   TypeErrorR`   R   t   cmdlineR   RE   R   Rb   (   R6   RL   RZ   t   ev(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   parse  s    c      
   C   sp  t    r |  j   } n  i |  j r* d p- d d 6} | pF |  j j   | d <xC d D]; } t |  |  rT t |  j d |  t |  |   qT qT Wx |  j D] } | } t    r | |  j	 k r |  j	 | } n  t |  |  r d } t    rt |  | d	  rd	 } n  t
 |  j | |   | | <q q Wy t |   Wn, t k
 rk| sb|  j j   rl  qln Xd
 S(   s   Enter filesystem service loop.i   i    Rx   Rb   t
   file_classt	   dir_classt   set_R   t   _compat_0_1N(   s
   file_classs	   dir_class(   R%   t   main_0_1_preambleRx   Rb   RP   R   R   R  R   t	   compatmapR   t   lowwrapR   R   R@   (   R6   RL   t   dt   tRp   t   bt   c(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR     s*    	*	$c            sU   t  |  |    | d k r-   f d   } n$ | d k rK   f d   } n   } | S(   s(  
        Wraps the fname method when the C code expects a different kind of
        callback than we have in the fusepy API. (The wrapper is usually for
        performing some checks or transfromations which could be done in C but
        is simpler if done in Python.)

        Currently `open` and `create` are wrapped: a boolean flag is added
        which indicates if the result is to be kept during the opened file's
        lifetime or can be thrown away. Namely, it's considered disposable
        if it's an instance of FuseFileInfo.
        R   R  c             sL     |  |   } | s. t  |  t  d  k r2 | S| t  |  t k f Sd  S(   Ni    (   R   R   (   Rp   RZ   t   res(   t   fun(    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   wrap	  s    R  c            s:   t  d | d |  } t  d | d |  }   |  | |  S(   NR   R   (   R   (   R   t   acc_sect   acc_nsect   mod_sect   mod_nsect   ts_acct   ts_mod(   R-  (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR.    s    (   s   openR  (   R   (   R6   t   fnameR.  (    (   R-  s(   /usr/lib/python2.7/dist-packages/fuse.pyR'    s    c         C   s
   t  |   S(   N(   R   (   R6   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt
   GetContext  s    c         C   s   t  |  |  S(   N(   R   (   R6   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt
   Invalidate  s    c         C   s  d d l  } d d l } | j   \ } } | j   } | d k r | j | d  | j |  |    } t   | _ | j j d  | j	   t
 j   n  | j |  t   } | j d  } | j |  }	 x |	 D] }
 | j |
  } | r | j   d } | g } | j d  } t |  d k r| \ } } | j d  } t |  d k r| \ } } | | | | | g } qn  x | D] } | j |  qWq q W|	 j   | S(	   s   
        Find out which options are recognized by the library.
        Result is a `FuseArgs` instance with the list of supported
        options, suitable for passing on to the `filter` method of
        another `FuseArgs` instance.
        iNi    i   R.   s   -o\s+([\w\[\]]+(?:=\w+)?)t   [t   ](   R   R   t   pipet   forkt   dup2t   closeR-   Rb   R>   R   RE   R   R   t   fdopenR   R   R(   t   lenRr   (   t   clsR   R   t   prt   pwt   pidt   fht   fat   oret   fprt   lR7   RO   t   oat   opat   o1t   oxt   oxpat   oot   o2(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRR     s>    	
		
R  c           B   s/   e  Z d    Z d   Z d   Z e e  Z RS(   c         C   s>   d t  f d     Y} | |  _ i  |  _ d  |  _ d  |  _ d  S(   Nt   mpxc           B   s   e  Z d    Z d   Z RS(   c         S   s   | |  _  d  S(   N(   R   (   R6   R   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1   U  s    c         _   s$   t  | d |  j  | d d !|   S(   Nii   (   R   R   (   R6   Rp   RZ   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   W  s    (   RU   RV   R1   R   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRP  T  s   	(   t   objectt
   proxyclasst   mdicR   R!  R"  (   R6   RP  (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR1   R  s
    			c         C   s    | |  j  k r |  j  | p d  S(   N(   RS  R   (   R6   t   meth(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR   _  s    c            s1       f d   } t  |  d  d |  d  S(   Nc            so   t  |   d |  x   D] } | |  j | <q Wx6  D]. } t | |  r9 |  j |  |  j | <q9 q9 Wd  S(   Nt   _class(   R   RS  R   RR  (   R6   t   xclsR7   (   t   initst   proxiedR   (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   setterd  s    R#  RU  (   R   (   R@  R   RW  RX  RY  (    (   RW  RX  R   s(   /usr/lib/python2.7/dist-packages/fuse.pyt   _add_class_typeb  s    (   RU   RV   R1   R   RZ  t   classmethod(    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR  P  s   			R   t   dirc         C   s*   |  j  |  } | r | St d |  d  S(   Ns#   Fuse instance has no attribute '%s'(   R  t   AttributeError(   R6   RT  R7   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   __getattr__z  s    c         O   s  d |  _  d } | d k r' g  |  _ n	 | |  _ | |  _ t |  j  d k ra |  j d |  _ n	 d  |  _ t j } t |  } | d k r | d |  _ n  | d k r| d } | j d  } xT | D]I } y) | j d d  \ }	 }
 |
 |  j |	 <Wq |  j j	 |  q Xq Wn  d  S(   Ni    i   i   RC   RB   (    (
   t   flagsRK   RI   R?  R3   R   RE   RF   R(   RG   (   R6   RL   RZ   Rx   RF   t   argct   optstrR   RO   R   RM   (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR    s,    					
c         C   s|   t    } |  j | _ t |  d  r4 | j d  n  t |  d  rS | j d  n  t |  d  rr | j d  n  | j   S(   NRq   t   allow_othert   kernel_cache(   R-   R3   R   Rr   RP   (   R6   t   cfargs(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyR%    s    	c         G   s#   d d l  m } | |  j |    S(   Ni(   t   stat_result(   R   Re  R   (   R6   Rp   Re  (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   getattr_compat_0_1  s    c         G   s   |  j  |   } t |  } t   } | d | _ | | d k rF d pI d | _ | d | _ | d | _ | d | _ | d | _ | d | _	 | d	 k r | d p d | _
 | d
 k r | d	 p d | _ | d | _ | S(   Ni    i   i   i   i   i   i   i   i	   i
   i   (   R   R?  R   R   R   R   R   R   R   R   R   R   R   (   R6   Rp   t   ooutt   lot   svf(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   statfs_compat_0_1  s    	c         g   s>   x7 |  j  |  D]& \ } } t |  } | | _ | Vq Wd  S(   N(   t   getdirR   R   (   R6   R   R   RD  R   R   t   de(    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   readdir_compat_0_1  s    	Rk  N(   s   opens   create(   s   reads   writes   fsyncs   releases   flushR  s	   ftruncateR  (   R  (   R   R  R  (   RU   RV   RW   R   R  R1   R   R   R   R'  R6  R7  RR   R[  RQ  R  RZ  R^  R  R%  Rf  Rj  Rm  R&  (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyRQ   u  s<   	?					.# 		'					(   i    i   (1   t   warningst   filterwarningst   RuntimeWarningt   stringR   RE   R   R   R   R   t	   fusepartsR   t   fuseparts._fuseR   R   R   R   R	   t   fuseparts.subbedoptsR
   R   R   R   R   R   t   fuseparts.setcompatwrapR   R  R!   R$   R%   R"   R#   R-   RX   Ra   RQ  R   R   R   R   R   R   R   R   R   R   R   RQ   (    (    (    s(   /usr/lib/python2.7/dist-packages/fuse.pyt   <module>   sT   	

				
L#	^		