# Path: web/core/compat.py

# 
# Path: web/core/context.py
# class Context(MutableMapping):
# 	"""An attribute access dictionary, of a kind.
# 	
# 	This utility class is used to cooperatively construct the ApplicationContext (and subsequent RequestContext)
# 	from the contributions of multiple extensions. The concept of "promotion to a class" is needed in order to enable
# 	the use of descriptor protocol attributes; without promotion the protocol would not be utilized.
# 	"""
# 	
# 	# M-Morty! We're, *belch*, gonna have to go in deep, Morty!  Elbow deep!
# 	def _promote(self, name, instantiate=True):
# 		"""Create a new subclass of Context which incorporates instance attributes and new descriptors.
# 		
# 		This promotes an instance and its instance attributes up to being a class with class attributes, then
# 		returns an instance of that class.
# 		"""
# 		
# 		metaclass = type(self.__class__)
# 		contents = self.__dict__.copy()
# 		cls = metaclass(str(name), (self.__class__, ), contents)
# 		
# 		if instantiate:
# 			return cls()
# 		
# 		return cls
# 	
# 	def __init__(self, **kw):
# 		"""Construct a new Context instance.
# 		
# 		All keyword arguments are applied to the instance as attributes through direct assignment to `__dict__`.
# 		"""
# 		self.__dict__.update(kw)
# 		super(Context, self).__init__()
# 	
# 	def __len__(self):
# 		"""Get a list of the public data attributes."""
# 		return len([i for i in (set(dir(self)) - self._STANDARD_ATTRS) if i[0] != '_'])
# 	
# 	def __iter__(self):
# 		"""Iterate all valid (public) attributes/keys."""
# 		return (i for i in (set(dir(self)) - self._STANDARD_ATTRS) if i[0] != '_')
# 	
# 	def __getitem__(self, name):
# 		"""Retrieve an attribute through dictionary access."""
# 		try:
# 			return getattr(self, name)
# 		except AttributeError:
# 			pass
# 		
# 		# We do this here to avoid Python 3's nested exception support.
# 		raise KeyError(name)
# 	
# 	def __setitem__(self, name, value):
# 		"""Assign an attribute through dictionary access."""
# 		setattr(self, name, value)
# 	
# 	def __delitem__(self, name):
# 		"""Delete an attribute through dictionary access."""
# 		try:
# 			return delattr(self, name)
# 		except AttributeError:
# 			pass
# 		
# 		# We do this here to avoid Python 3's nested exception support.
# 		raise KeyError(name)


import pytest
from web.core.compat import py3
from web.core.context import Context
	from web.ext.annotation import AnnotationExtension
# encoding: utf-8




pytestmark = pytest.mark.skipif(not py3, reason="Python 3 required for annotation support.")
endpoint = None  # Correct mistaken linter.
Endpoint = None  # Correct mistaken linter.


if py3:
	
	# This trick hides the syntax error from Python 2.
	exec("def endpoint(a: int, b: int) -> 'int': return a * b")
	exec("class Endpoint:\n\tdef endpoint(a: int, b: int): return a * b")


def bare_endpoint(a, b): return a * b


def test_annotation_extension():
	ext = AnnotationExtension()

# Path: web/core/compat.py

# 
# Path: web/core/context.py
# class Context(MutableMapping):
# 	"""An attribute access dictionary, of a kind.
# 	
# 	This utility class is used to cooperatively construct the ApplicationContext (and subsequent RequestContext)
# 	from the contributions of multiple extensions. The concept of "promotion to a class" is needed in order to enable
# 	the use of descriptor protocol attributes; without promotion the protocol would not be utilized.
# 	"""
# 	
# 	# M-Morty! We're, *belch*, gonna have to go in deep, Morty!  Elbow deep!
# 	def _promote(self, name, instantiate=True):
# 		"""Create a new subclass of Context which incorporates instance attributes and new descriptors.
# 		
# 		This promotes an instance and its instance attributes up to being a class with class attributes, then
# 		returns an instance of that class.
# 		"""
# 		
# 		metaclass = type(self.__class__)
# 		contents = self.__dict__.copy()
# 		cls = metaclass(str(name), (self.__class__, ), contents)
# 		
# 		if instantiate:
# 			return cls()
# 		
# 		return cls
# 	
# 	def __init__(self, **kw):
# 		"""Construct a new Context instance.
# 		
# 		All keyword arguments are applied to the instance as attributes through direct assignment to `__dict__`.
# 		"""
# 		self.__dict__.update(kw)
# 		super(Context, self).__init__()
# 	
# 	def __len__(self):
# 		"""Get a list of the public data attributes."""
# 		return len([i for i in (set(dir(self)) - self._STANDARD_ATTRS) if i[0] != '_'])
# 	
# 	def __iter__(self):
# 		"""Iterate all valid (public) attributes/keys."""
# 		return (i for i in (set(dir(self)) - self._STANDARD_ATTRS) if i[0] != '_')
# 	
# 	def __getitem__(self, name):
# 		"""Retrieve an attribute through dictionary access."""
# 		try:
# 			return getattr(self, name)
# 		except AttributeError:
# 			pass
# 		
# 		# We do this here to avoid Python 3's nested exception support.
# 		raise KeyError(name)
# 	
# 	def __setitem__(self, name, value):
# 		"""Assign an attribute through dictionary access."""
# 		setattr(self, name, value)
# 	
# 	def __delitem__(self, name):
# 		"""Delete an attribute through dictionary access."""
# 		try:
# 			return delattr(self, name)
# 		except AttributeError:
# 			pass
# 		
# 		# We do this here to avoid Python 3's nested exception support.
# 		raise KeyError(name)


# Path: test/test_extension/test_annotation.py
import pytest
from web.core.compat import py3
from web.core.context import Context
	from web.ext.annotation import AnnotationExtension

# encoding: utf-8




pytestmark = pytest.mark.skipif(not py3, reason="Python 3 required for annotation support.")
endpoint = None  # Correct mistaken linter.
Endpoint = None  # Correct mistaken linter.


if py3:
	
	# This trick hides the syntax error from Python 2.
	exec("def endpoint(a: int, b: int) -> 'int': return a * b")
	exec("class Endpoint:\n\tdef endpoint(a: int, b: int): return a * b")


def bare_endpoint(a, b): return a * b


def test_annotation_extension():
	ext = AnnotationExtension()

	ctx = Context()