Python copy.error() Examples

The following are code examples for showing how to use copy.error(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: ConfigNOW   Author: Integral-Technology-Solutions   File: copy.py    MIT License 6 votes vote down vote up
def copy(x):
    """Shallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """

    try:
        copierfunction = _copy_dispatch[type(x)]
    except KeyError:
        try:
            copier = x.__copy__
        except AttributeError:
            raise error, \
                  "un(shallow)copyable object of type %s" % type(x)
        y = copier()
    else:
        y = copierfunction(x)
    return y 
Example 2
Project: ConfigNOW   Author: Integral-Technology-Solutions   File: copy.py    MIT License 6 votes vote down vote up
def deepcopy(x, memo = None):
    """Deep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """

    if memo is None:
        memo = {}
    d = id(x)
    if memo.has_key(d):
        return memo[d]
    try:
        copierfunction = _deepcopy_dispatch[type(x)]
    except KeyError:
        try:
            copier = x.__deepcopy__
        except AttributeError:
            raise error, \
                  "un-deep-copyable object of type %s" % type(x)
        y = copier(memo)
    else:
        y = copierfunction(x, memo)
    memo[d] = y
    return y 
Example 3
Project: pyblish-win   Author: pyblish   File: test_copy.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertTrue(copy.Error is copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method 
Example 4
Project: NiujiaoDebugger   Author: MrSrc   File: test_copy.py    GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertIs(copy.Error, copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method 
Example 5
Project: ironpython2   Author: IronLanguages   File: test_copy.py    Apache License 2.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertTrue(copy.Error is copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method 
Example 6
Project: oss-ftp   Author: aliyun   File: test_copy.py    MIT License 5 votes vote down vote up
def test_exceptions(self):
        self.assertTrue(copy.Error is copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method 
Example 7
Project: Hot   Author: dsolimando   File: test_copy.py    GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assert_(copy.Error is copy.error)
        self.assert_(issubclass(copy.Error, Exception))

    # The copy() method 
Example 8
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_copy.py    GNU General Public License v3.0 5 votes vote down vote up
def test_exceptions(self):
        self.assertIs(copy.Error, copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method 
Example 9
Project: cells   Author: AlesTsurko   File: test_copy.py    MIT License 5 votes vote down vote up
def test_exceptions(self):
        self.assertIs(copy.Error, copy.error)
        self.assertTrue(issubclass(copy.Error, Exception))

    # The copy() method