# Path: oroboros/core/db.py
# class Object(object):
# 	def _get_idx(self):
# 	def _set_idx(self, idx):
# def _connect(dsn=_dsn):
# def _cursor(conn):
# def connect(dsn=_dsn):
# def execute(sql, var=None):
# def close():
# def autoconnect(dsn=_dsn):
# def _execute_file(path):
# def install(path=_dsn):
# def _check_version():
# def _create_functions(cnx):
# 	def regexp_search(pattern, string):
# def _test():
# 
# Path: oroboros/core/xmlutils.py
# def _serialize(obj):
# 	def _get_elem(self):
# 	def _set_elem(self, elem):
# 	def _get_tag(self):
# 	def _set_tag(self, tag):
# 	def _get_attributes(self):
# 	def _set_attributes(self, attrdict):
# 	def _get_text(self):
# 	def _set_text(self, text):
# 	def _get_tail(self):
# 	def _set_tail(self, tail):
# 	def __init__(self, tag=None, attributes={}, text='', tail='',
# 		_etree_elem=None):
# 	def has_attr(self, attribute):
# 	def get_attr(self, attribute):
# 	def set_attr(self, attribute, value):
# 	def append(self, elem=None, attributes={}, text='', tail='',
# 		_etree_elem=None):
# 	def insert(self, elem, attributes={}, text='', tail='', idx=0,
# 		_etree_elem=None):
# 	def prepend(self, elem, attributes={}, text='', tail='', _etree_elem=None):
# 	def get_child(self, idx=0, tag=None):
# 	def get_children(self, tag=None):
# 	def get_child_text(self, idx=0, tag=None):
# 	def get_child_attr(self, attr, idx=0, tag=None):
# 	def remove_child(self, idx=0, tag=None):
# 	def remove_children(self, tag):
# 	def clear(self):
# 	def __len__(self):
# 	def write(self, path, encoding='UTF-8'):
# 	def dump(self):
# 	def __str__(self, encoding='UTF-8'):
# 	def __iter__(self):
# 	def get_iterator(self, tag):
# 	def __contains__(self, tag):
# def parse(path):
# def comment(text):
# def _test():
# class Element(object):


from oroboros.core import db
from oroboros.core import xmlutils
	import doctest
	
	def _select(self, filt):
		"""Select aspects restrictions in database.
		
		:raise TypeError: invalid filter
		"""
		if isinstance(filt, int):
			return self._select_by_idx(filt)
		elif isinstance(filt, basestring): # str in py3
			return self._select_by_name(filt)
		raise TypeError('Invalid filter %s.' % filt)
	
	def _select_by_idx(self, idx):
		"""Select aspects restrictions in database, by idx.
		
		:raise ValueError: not found
		"""
		sql = "select * from AspectsRestrictions where _idx = ?;"
		res = db.execute(sql, (idx,)).fetchall()
		if len(res) == 0:
			raise ValueError('Invalid idx %s.' % idx)
		self.set(*res[0])
		self._select_dict()
	
	def _select_by_name(self, filt):
		"""Select aspects restrictions filter in database, by name.
		
		:raise ValueError: not found
		"""
		sql = "select * from AspectsRestrictions where name = ?;"

# Path: oroboros/core/db.py
# class Object(object):
# 	def _get_idx(self):
# 	def _set_idx(self, idx):
# def _connect(dsn=_dsn):
# def _cursor(conn):
# def connect(dsn=_dsn):
# def execute(sql, var=None):
# def close():
# def autoconnect(dsn=_dsn):
# def _execute_file(path):
# def install(path=_dsn):
# def _check_version():
# def _create_functions(cnx):
# 	def regexp_search(pattern, string):
# def _test():
# 
# Path: oroboros/core/xmlutils.py
# def _serialize(obj):
# 	def _get_elem(self):
# 	def _set_elem(self, elem):
# 	def _get_tag(self):
# 	def _set_tag(self, tag):
# 	def _get_attributes(self):
# 	def _set_attributes(self, attrdict):
# 	def _get_text(self):
# 	def _set_text(self, text):
# 	def _get_tail(self):
# 	def _set_tail(self, tail):
# 	def __init__(self, tag=None, attributes={}, text='', tail='',
# 		_etree_elem=None):
# 	def has_attr(self, attribute):
# 	def get_attr(self, attribute):
# 	def set_attr(self, attribute, value):
# 	def append(self, elem=None, attributes={}, text='', tail='',
# 		_etree_elem=None):
# 	def insert(self, elem, attributes={}, text='', tail='', idx=0,
# 		_etree_elem=None):
# 	def prepend(self, elem, attributes={}, text='', tail='', _etree_elem=None):
# 	def get_child(self, idx=0, tag=None):
# 	def get_children(self, tag=None):
# 	def get_child_text(self, idx=0, tag=None):
# 	def get_child_attr(self, attr, idx=0, tag=None):
# 	def remove_child(self, idx=0, tag=None):
# 	def remove_children(self, tag):
# 	def clear(self):
# 	def __len__(self):
# 	def write(self, path, encoding='UTF-8'):
# 	def dump(self):
# 	def __str__(self, encoding='UTF-8'):
# 	def __iter__(self):
# 	def get_iterator(self, tag):
# 	def __contains__(self, tag):
# def parse(path):
# def comment(text):
# def _test():
# class Element(object):


# Path: oroboros/core/aspectsrestrictions.py
from oroboros.core import db
from oroboros.core import xmlutils
	import doctest

	
	def _select(self, filt):
		"""Select aspects restrictions in database.
		
		:raise TypeError: invalid filter
		"""
		if isinstance(filt, int):
			return self._select_by_idx(filt)
		elif isinstance(filt, basestring): # str in py3
			return self._select_by_name(filt)
		raise TypeError('Invalid filter %s.' % filt)
	
	def _select_by_idx(self, idx):
		"""Select aspects restrictions in database, by idx.
		
		:raise ValueError: not found
		"""
		sql = "select * from AspectsRestrictions where _idx = ?;"
		res = db.execute(sql, (idx,)).fetchall()
		if len(res) == 0:
			raise ValueError('Invalid idx %s.' % idx)
		self.set(*res[0])
		self._select_dict()
	
	def _select_by_name(self, filt):
		"""Select aspects restrictions filter in database, by name.
		
		:raise ValueError: not found
		"""
		sql = "select * from AspectsRestrictions where name = ?;"

		res = db.execute(sql, (filt,)).fetchall()