A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-checkins/2000-April/010672.html below:

[Python-checkins] CVS: python/dist/src/Lib urlparse.py,1.22,1.23

[Python-checkins] CVS: python/dist/src/Lib urlparse.py,1.22,1.23Guido van Rossum python-dev@python.org
Mon, 10 Apr 2000 13:02:49 -0400 (EDT)
Update of /projects/cvsroot/python/dist/src/Lib
In directory eric:/projects/python/develop/guido/src/Lib

Modified Files:
	urlparse.py 
Log Message:
Some cleanup -- don't use splitfields/joinfields, standardize
indentation (tabs only), rationalize some code in urljoin...


Index: urlparse.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/urlparse.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** urlparse.py	2000/02/04 15:28:42	1.22
--- urlparse.py	2000/04/10 17:02:46	1.23
***************
*** 7,11 ****
  # Standard/builtin Python modules
  import string
! from string import joinfields, splitfields, rfind
  
  # A classification of schemes ('' means apply by default)
--- 7,11 ----
  # Standard/builtin Python modules
  import string
! from string import join, split, rfind
  
  # A classification of schemes ('' means apply by default)
***************
*** 38,44 ****
  
  def clear_cache():
!     """Clear the parse cache."""
!     global _parse_cache
!     _parse_cache = {}
  
  
--- 38,44 ----
  
  def clear_cache():
! 	"""Clear the parse cache."""
! 	global _parse_cache
! 	_parse_cache = {}
  
  
***************
*** 54,58 ****
  		return cached
  	if len(_parse_cache) >= MAX_CACHE_SIZE:	# avoid runaway growth
! 	    clear_cache()
  	find = string.find
  	netloc = path = params = query = fragment = ''
--- 54,58 ----
  		return cached
  	if len(_parse_cache) >= MAX_CACHE_SIZE:	# avoid runaway growth
! 		clear_cache()
  	find = string.find
  	netloc = path = params = query = fragment = ''
***************
*** 152,159 ****
  		return urlunparse((scheme, netloc, bpath,
  				   params, query or bquery, fragment))
! 	i = rfind(bpath, '/')
! 	if i >= 0:
! 		path = bpath[:i] + '/' + path
! 	segments = splitfields(path, '/')
  	if segments[-1] == '.':
  		segments[-1] = ''
--- 152,157 ----
  		return urlunparse((scheme, netloc, bpath,
  				   params, query or bquery, fragment))
! 	segments = split(bpath, '/')[:-1] + split(path, '/')
! 	# XXX The stuff below is bogus in various ways...
  	if segments[-1] == '.':
  		segments[-1] = ''
***************
*** 174,190 ****
  	elif len(segments) >= 2 and segments[-1] == '..':
  		segments[-2:] = ['']
! 	return urlunparse((scheme, netloc, joinfields(segments, '/'),
  			   params, query, fragment))
  
  def urldefrag(url):
!     """Removes any existing fragment from URL.
  
!     Returns a tuple of the defragmented URL and the fragment.  If
!     the URL contained no fragments, the second element is the
!     empty string.
!     """
!     s, n, p, a, q, frag = urlparse(url)
!     defrag = urlunparse((s, n, p, a, q, ''))
!     return defrag, frag
  
  
--- 172,188 ----
  	elif len(segments) >= 2 and segments[-1] == '..':
  		segments[-2:] = ['']
! 	return urlunparse((scheme, netloc, join(segments, '/'),
  			   params, query, fragment))
  
  def urldefrag(url):
! 	"""Removes any existing fragment from URL.
  
! 	Returns a tuple of the defragmented URL and the fragment.  If
! 	the URL contained no fragments, the second element is the
! 	empty string.
! 	"""
! 	s, n, p, a, q, frag = urlparse(url)
! 	defrag = urlunparse((s, n, p, a, q, ''))
! 	return defrag, frag
  
  




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4