parameters: (s, safe='/')
return_statement: return ''.join(map(quoter, s))
docstring: quote('abc def') -> 'abc%20def'
  
      Each part of a URL, e.g. the path info, the query, etc., has a
      different set of reserved characters that must be quoted.
  
      RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
      the following reserved characters.
  
      reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                    "$" | ","
  
      Each of these characters is reserved in some component of a URL,
      but not necessarily in all of them.
  
      By default, the quote function is intended for quoting the path
      section of a URL.  Thus, it will not encode '/'.  This character
      is reserved, but in typical usage the quote function is being
      called on a path where the existing slash characters are used as
      reserved characters.
docstring_summary: quote('abc def') -> 'abc%20def'
docstring_tokens: quote ( abc def ) - > abc%20def
function: def quote(s, safe='/'):
      """quote('abc def') -> 'abc%20def'
  
      Each part of a URL, e.g. the path info, the query, etc., has a
      different set of reserved characters that must be quoted.
  
      RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
      the following reserved characters.
  
      reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                    "$" | ","
  
      Each of these characters is reserved in some component of a URL,
      but not necessarily in all of them.
  
      By default, the quote function is intended for quoting the path
      section of a URL.  Thus, it will not encode '/'.  This character
      is reserved, but in typical usage the quote function is being
      called on a path where the existing slash characters are used as
      reserved characters.
      """
      # fastpath
      if not s:
          if s is None:
              raise TypeError('None object cannot be quoted')
          return s
      cachekey = (safe, always_safe)
      try:
          (quoter, safe) = _safe_quoters[cachekey]
      except KeyError:
          safe_map = _safe_map.copy()
          safe_map.update([(c, c) for c in safe])
          quoter = safe_map.__getitem__
          safe = always_safe + safe
          _safe_quoters[cachekey] = (quoter, safe)
      if not s.rstrip(safe):
          return s
      return ''.join(map(quoter, s))
function_tokens: def quote ( s , safe = '/' ) : # fastpath if not s : if s is None : raise TypeError ( 'None object cannot be quoted' ) return s cachekey = ( safe , always_safe ) try : ( quoter , safe ) = _safe_quoters [ cachekey ] except KeyError : safe_map = _safe_map . copy ( ) safe_map . update ( [ ( c , c ) for c in safe ] ) quoter = safe_map . __getitem__ safe = always_safe + safe _safe_quoters [ cachekey ] = ( quoter , safe ) if not s . rstrip ( safe ) : return s return '' . join ( map ( quoter , s ) )