Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.. py:attribute:: IGNORE
Keep the existing item and ignore the new item when a duplication is
encountered.
.. py:attribute:: ON_DUP_VAL
Used with *on_dup_kv* to specify that it should match whatever the
duplication behavior of *on_dup_val* is.
"""
DuplicationBehavior.RAISE = RAISE = DuplicationBehavior('RAISE')
DuplicationBehavior.OVERWRITE = OVERWRITE = DuplicationBehavior('OVERWRITE')
DuplicationBehavior.IGNORE = IGNORE = DuplicationBehavior('IGNORE')
DuplicationBehavior.ON_DUP_VAL = ON_DUP_VAL = DuplicationBehavior('ON_DUP_VAL')
_MISS = _Marker('MISSING')
def _proxied(methodname, attrname='_fwd', doc=None):
"""Make a func that calls the indicated method on the indicated attribute."""
def proxy(self, *args):
"""(__doc__ set dynamically below)"""
attr = getattr(self, attrname)
meth = getattr(attr, methodname)
return meth(*args)
proxy.__name__ = methodname
proxy.__doc__ = doc or "Like dict's ``%s``." % methodname
return proxy
Overwrite an existing item when a duplication is encountered.
.. py:attribute:: IGNORE
Keep the existing item and ignore the new item when a duplication is
encountered.
.. py:attribute:: ON_DUP_VAL
Used with *on_dup_kv* to specify that it should match whatever the
duplication behavior of *on_dup_val* is.
"""
DuplicationBehavior.RAISE = RAISE = DuplicationBehavior('RAISE')
DuplicationBehavior.OVERWRITE = OVERWRITE = DuplicationBehavior('OVERWRITE')
DuplicationBehavior.IGNORE = IGNORE = DuplicationBehavior('IGNORE')
DuplicationBehavior.ON_DUP_VAL = ON_DUP_VAL = DuplicationBehavior('ON_DUP_VAL')
_MISS = _Marker('MISSING')
def _proxied(methodname, attrname='_fwd', doc=None):
"""Make a func that calls the indicated method on the indicated attribute."""
def proxy(self, *args):
"""(__doc__ set dynamically below)"""
attr = getattr(self, attrname)
meth = getattr(attr, methodname)
return meth(*args)
proxy.__name__ = methodname
proxy.__doc__ = doc or "Like dict's ``%s``." % methodname
return proxy
.. py:attribute:: IGNORE
Keep the existing item and ignore the new item when a duplication is
encountered.
.. py:attribute:: ON_DUP_VAL
Used with *on_dup_kv* to specify that it should match whatever the
duplication behavior of *on_dup_val* is.
"""
DuplicationBehavior.RAISE = RAISE = DuplicationBehavior('RAISE')
DuplicationBehavior.OVERWRITE = OVERWRITE = DuplicationBehavior('OVERWRITE')
DuplicationBehavior.IGNORE = IGNORE = DuplicationBehavior('IGNORE')
DuplicationBehavior.ON_DUP_VAL = ON_DUP_VAL = DuplicationBehavior('ON_DUP_VAL')
_MISS = _Marker('MISSING')
def _proxied(methodname, attrname='_fwd', doc=None):
"""Make a func that calls the indicated method on the indicated attribute."""
def proxy(self, *args):
"""(__doc__ set dynamically below)"""
attr = getattr(self, attrname)
meth = getattr(attr, methodname)
return meth(*args)
proxy.__name__ = methodname
proxy.__doc__ = doc or "Like dict's ``%s``." % methodname
return proxy
class BidictBase(BidirectionalMapping):
Overwrite an existing item when a duplication is encountered.
.. py:attribute:: IGNORE
Keep the existing item and ignore the new item when a duplication is
encountered.
.. py:attribute:: ON_DUP_VAL
Used with *on_dup_kv* to specify that it should match whatever the
duplication behavior of *on_dup_val* is.
"""
DuplicationBehavior.RAISE = RAISE = DuplicationBehavior('RAISE')
DuplicationBehavior.OVERWRITE = OVERWRITE = DuplicationBehavior('OVERWRITE')
DuplicationBehavior.IGNORE = IGNORE = DuplicationBehavior('IGNORE')
DuplicationBehavior.ON_DUP_VAL = ON_DUP_VAL = DuplicationBehavior('ON_DUP_VAL')
_MISS = _Marker('MISSING')
def _proxied(methodname, attrname='_fwd', doc=None):
"""Make a func that calls the indicated method on the indicated attribute."""
def proxy(self, *args):
"""(__doc__ set dynamically below)"""
attr = getattr(self, attrname)
meth = getattr(attr, methodname)
return meth(*args)
proxy.__name__ = methodname
proxy.__doc__ = doc or "Like dict's ``%s``." % methodname
return proxy