# 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/orbs.py
# class OrbModifier(str):
# 	"""Orb modifier type.
# 	
# 	Used to adjust orbs depending on the aspected planet.
# 	
# 	Either a float value, to add or substrat degrees (absolute),
# 	or a percentage value, to adjust the default orb (relative).
# 	
# 	"""
# 
# 	__slots__ = tuple()
# 	
# 	def __new__(cls, modifier):
# 		"""New orb modifier.
# 		
# 		:type modifier: str or numeric
# 		"""
# 		modifier = str(modifier)
# 		if _regexp_orbmod.search(modifier) == None:
# 			raise ValueError('Invalid orb modifier %s.' % modifier)
# 		return str.__new__(cls, modifier)
# 	
# 	def get_absolute(self, orb):
# 		"""Get orb absolute value, compared to base orb.
# 		
# 		:type orb: numeric
# 		:rtype: Decimal
# 		"""
# 		if not self.endswith('%'):
# 			return Decimal(self)
# 		else:
# 			return (orb/Decimal('100')) * Decimal(self[:-1])
# 	
# 	def __repr__(self):
# 		return "OrbModifier('%s')" % self


from oroboros.core import db
from oroboros.core import xmlutils
from oroboros.core.orbs import OrbModifier
	import doctest
		sql = """insert into _OrbsRestrictions select ?, _idx, ? from
			Planets where name = ?;"""
		for plt, val in self.items():
			db.execute(sql, (self._idx_, val, plt))
	
	def _delete_dict(self):
		"""Delete orbs restrictions filter dict in database."""
		sql = "delete from _OrbsRestrictions where filter_idx = ?;"
		db.execute(sql, (self._idx_,))
	
	def __len__(self):
		"""Return number of planets in orbs restrictions."""
		return len(self._dict_)
	
	def __getitem__(self, key):
		"""Return orb modifier identified by planet name.
		
		Raise KeyError if planet not found.
		
		"""
		return self._dict_[key]
	
	def __setitem__(self, key, value=False):
		"""Set planet orb modifier, identified by planet name.
		
		Raise KeyError if planet not found.
		
		"""
		for plt in self._dict_:
			if plt == key:

# 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/orbs.py
# class OrbModifier(str):
# 	"""Orb modifier type.
# 	
# 	Used to adjust orbs depending on the aspected planet.
# 	
# 	Either a float value, to add or substrat degrees (absolute),
# 	or a percentage value, to adjust the default orb (relative).
# 	
# 	"""
# 
# 	__slots__ = tuple()
# 	
# 	def __new__(cls, modifier):
# 		"""New orb modifier.
# 		
# 		:type modifier: str or numeric
# 		"""
# 		modifier = str(modifier)
# 		if _regexp_orbmod.search(modifier) == None:
# 			raise ValueError('Invalid orb modifier %s.' % modifier)
# 		return str.__new__(cls, modifier)
# 	
# 	def get_absolute(self, orb):
# 		"""Get orb absolute value, compared to base orb.
# 		
# 		:type orb: numeric
# 		:rtype: Decimal
# 		"""
# 		if not self.endswith('%'):
# 			return Decimal(self)
# 		else:
# 			return (orb/Decimal('100')) * Decimal(self[:-1])
# 	
# 	def __repr__(self):
# 		return "OrbModifier('%s')" % self


# Path: oroboros/core/orbsrestrictions.py
from oroboros.core import db
from oroboros.core import xmlutils
from oroboros.core.orbs import OrbModifier
	import doctest

		sql = """insert into _OrbsRestrictions select ?, _idx, ? from
			Planets where name = ?;"""
		for plt, val in self.items():
			db.execute(sql, (self._idx_, val, plt))
	
	def _delete_dict(self):
		"""Delete orbs restrictions filter dict in database."""
		sql = "delete from _OrbsRestrictions where filter_idx = ?;"
		db.execute(sql, (self._idx_,))
	
	def __len__(self):
		"""Return number of planets in orbs restrictions."""
		return len(self._dict_)
	
	def __getitem__(self, key):
		"""Return orb modifier identified by planet name.
		
		Raise KeyError if planet not found.
		
		"""
		return self._dict_[key]
	
	def __setitem__(self, key, value=False):
		"""Set planet orb modifier, identified by planet name.
		
		Raise KeyError if planet not found.
		
		"""
		for plt in self._dict_:
			if plt == key:

				self._dict_[plt] = OrbModifier(value)