mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	* added doc strings to urlopen and unquote_plus
* fixed type in doc string for quote
This commit is contained in:
		
							parent
							
								
									46dfa5f4ed
								
							
						
					
					
						commit
						79f1c1778d
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -53,6 +53,7 @@ else:
 | 
				
			||||||
# Shortcut for basic usage
 | 
					# Shortcut for basic usage
 | 
				
			||||||
_urlopener = None
 | 
					_urlopener = None
 | 
				
			||||||
def urlopen(url, data=None):
 | 
					def urlopen(url, data=None):
 | 
				
			||||||
 | 
					    """urlopen(url [, data]) -> open file-like object"""
 | 
				
			||||||
    global _urlopener
 | 
					    global _urlopener
 | 
				
			||||||
    if not _urlopener:
 | 
					    if not _urlopener:
 | 
				
			||||||
        _urlopener = FancyURLopener()
 | 
					        _urlopener = FancyURLopener()
 | 
				
			||||||
| 
						 | 
					@ -1003,6 +1004,7 @@ def unquote(s):
 | 
				
			||||||
    return string.join(res, "")
 | 
					    return string.join(res, "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def unquote_plus(s):
 | 
					def unquote_plus(s):
 | 
				
			||||||
 | 
					    """unquote('%7e/abc+def') -> '~/abc def'"""
 | 
				
			||||||
    if '+' in s:
 | 
					    if '+' in s:
 | 
				
			||||||
        # replace '+' with ' '
 | 
					        # replace '+' with ' '
 | 
				
			||||||
        s = string.join(string.split(s, '+'), ' ')
 | 
					        s = string.join(string.split(s, '+'), ' ')
 | 
				
			||||||
| 
						 | 
					@ -1010,7 +1012,7 @@ def unquote_plus(s):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
always_safe = string.letters + string.digits + '_,.-'
 | 
					always_safe = string.letters + string.digits + '_,.-'
 | 
				
			||||||
def quote(s, safe = '/'):
 | 
					def quote(s, safe = '/'):
 | 
				
			||||||
    """quote('abc def') -> 'abc%20def')."""
 | 
					    """quote('abc def') -> 'abc%20def'."""
 | 
				
			||||||
    # XXX Can speed this up an order of magnitude
 | 
					    # XXX Can speed this up an order of magnitude
 | 
				
			||||||
    safe = always_safe + safe
 | 
					    safe = always_safe + safe
 | 
				
			||||||
    res = list(s)
 | 
					    res = list(s)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue