# Path: web/core/compat.py

# 
# Path: web/core/util.py
# def safe_name(thing):
# 	"""Attempt to resolve the canonical name for an object, falling back on the `repr()` if unable to do so."""
# 	try:
# 		return name(thing)
# 	except:
# 		return repr(thing)


from io import IOBase
	from collections import Generator
from os.path import getmtime
from time import mktime, gmtime
from datetime import datetime
from mimetypes import init, add_type, guess_type
from collections import namedtuple
from webob import Request, Response
from web.core.compat import str, unicode, Path
from web.core.util import safe_name
		"""
		
		request = context.request
		
		if __debug__:
			log.debug("Handling dispatch event.", extra=dict(
					request = id(context),
					consumed = consumed,
					handler = safe_name(handler),
					endpoint = is_endpoint
				))
		
		# The leading path element (leading slash) requires special treatment.
		if not consumed and context.request.path_info_peek() == '':
			consumed = ['']
		
		nConsumed = 0
		if consumed:
			# Migrate path elements consumed from the `PATH_INFO` to `SCRIPT_NAME` WSGI environment variables.
			if not isinstance(consumed, (list, tuple)):
				consumed = consumed.split('/')
			
			for element in consumed:
				if element == context.request.path_info_peek():
					context.request.path_info_pop()
					nConsumed += 1
				else:
					break
		
		# Update the breadcrumb list.

# Path: web/core/compat.py

# 
# Path: web/core/util.py
# def safe_name(thing):
# 	"""Attempt to resolve the canonical name for an object, falling back on the `repr()` if unable to do so."""
# 	try:
# 		return name(thing)
# 	except:
# 		return repr(thing)


# Path: web/ext/base.py
from io import IOBase
	from collections import Generator
from os.path import getmtime
from time import mktime, gmtime
from datetime import datetime
from mimetypes import init, add_type, guess_type
from collections import namedtuple
from webob import Request, Response
from web.core.compat import str, unicode, Path
from web.core.util import safe_name

		"""
		
		request = context.request
		
		if __debug__:
			log.debug("Handling dispatch event.", extra=dict(
					request = id(context),
					consumed = consumed,
					handler = safe_name(handler),
					endpoint = is_endpoint
				))
		
		# The leading path element (leading slash) requires special treatment.
		if not consumed and context.request.path_info_peek() == '':
			consumed = ['']
		
		nConsumed = 0
		if consumed:
			# Migrate path elements consumed from the `PATH_INFO` to `SCRIPT_NAME` WSGI environment variables.
			if not isinstance(consumed, (list, tuple)):
				consumed = consumed.split('/')
			
			for element in consumed:
				if element == context.request.path_info_peek():
					context.request.path_info_pop()
					nConsumed += 1
				else:
					break
		
		# Update the breadcrumb list.

		context.path.append(Crumb(handler, Path(request.script_name)))