• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(10991)  |  Call(9558)  |  Derive(0)  |  Import(1433)
Deep copy operation on arbitrary Python objects.

See the module's __doc__ string for more info.

        def deepcopy(x, memo=None, _nil=[]):
    """Deep copy operation on arbitrary Python objects.

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

    if memo is None:
        memo = {}

    d = id(x)
    y = memo.get(d, _nil)
    if y is not _nil:
        return y

    cls = type(x)

    copier = _deepcopy_dispatch.get(cls)
    if copier:
        y = copier(x, memo)
    else:
        try:
            issc = issubclass(cls, type)
        except TypeError: # cls is not a class (old Boost; see SF #502085)
            issc = 0
        if issc:
            y = _deepcopy_atomic(x, memo)
        else:
            copier = getattr(x, "__deepcopy__", None)
            if copier:
                y = copier(memo)
            else:
                reductor = dispatch_table.get(cls)
                if reductor:
                    rv = reductor(x)
                else:
                    reductor = getattr(x, "__reduce_ex__", None)
                    if reductor:
                        rv = reductor(2)
                    else:
                        reductor = getattr(x, "__reduce__", None)
                        if reductor:
                            rv = reductor()
                        else:
                            raise Error(
                                "un(deep)copyable object of type %s" % cls)
                y = _reconstruct(x, rv, 1, memo)

    memo[d] = y
    _keep_alive(x, memo) # Make sure x lives at least as long as d
    return y
        


src/v/i/vizstack-HEAD/trunk/share/samples/display_setup/two-gpus-four-screens.py   vizstack(Download)
 
import vsapi
from pprint import pprint
from copy import deepcopy # deepcopy is python function we'll use to copy GPUs
import os
 
# Connect to the SSM
# Screen 0 drives a LP2065 monitor at default resolution, from port 0 of GPU0
scr0 = vsapi.Screen(0)
scr0.setFBProperty('position',[0,0])
gpu0_0 = deepcopy(gpu0) # Make a copy of the GPU so that we can assign display devices
gpu0_0.setScanout(port_index=0, display_device=ddName)
scr0.setGPU(gpu0_0)
srv.addScreen(scr0)
 
# Screen 1 drives a LP2065 monitor at default resolution, from port 1 of GPU0
scr1 = vsapi.Screen(1)
scr1.setFBProperty('position',[modeWidth,0])
gpu0_1 = deepcopy(gpu0)
# Screen 2 drives a LP2065 monitor at default resolution, from port 0 of GPU1
scr2 = vsapi.Screen(2)
scr2.setFBProperty('position',[0,modeHeight])
gpu1_0 = deepcopy(gpu1)
gpu1_0.setScanout(port_index=0, display_device=ddName)
scr2.setGPU(gpu1_0)
srv.addScreen(scr2)
 
# Screen 3 drives a LP2065 monitor at default resolution, from port 1 of GPU1
scr3 = vsapi.Screen(3)
scr3.setFBProperty('position',[modeWidth,modeHeight])
gpu1_1 = deepcopy(gpu1)

src/v/i/vizstack-HEAD/share/samples/display_setup/two-gpus-four-screens.py   vizstack(Download)
 
import vsapi
from pprint import pprint
from copy import deepcopy # deepcopy is python function we'll use to copy GPUs
import os
 
# Connect to the SSM
# Screen 0 drives a LP2065 monitor at default resolution, from port 0 of GPU0
scr0 = vsapi.Screen(0)
scr0.setFBProperty('position',[0,0])
gpu0_0 = deepcopy(gpu0) # Make a copy of the GPU so that we can assign display devices
gpu0_0.setScanout(port_index=0, display_device=ddName)
scr0.setGPU(gpu0_0)
srv.addScreen(scr0)
 
# Screen 1 drives a LP2065 monitor at default resolution, from port 1 of GPU0
scr1 = vsapi.Screen(1)
scr1.setFBProperty('position',[modeWidth,0])
gpu0_1 = deepcopy(gpu0)
# Screen 2 drives a LP2065 monitor at default resolution, from port 0 of GPU1
scr2 = vsapi.Screen(2)
scr2.setFBProperty('position',[0,modeHeight])
gpu1_0 = deepcopy(gpu1)
gpu1_0.setScanout(port_index=0, display_device=ddName)
scr2.setGPU(gpu1_0)
srv.addScreen(scr2)
 
# Screen 3 drives a LP2065 monitor at default resolution, from port 1 of GPU1
scr3 = vsapi.Screen(3)
scr3.setFBProperty('position',[modeWidth,modeHeight])
gpu1_1 = deepcopy(gpu1)

src/p/y/pypdflib-HEAD/samples/wiki2pdf/pyquery/pyquery.py   pypdflib(Download)
from cssselectpatch import selector_to_xpath
from lxml import etree
import lxml.html
from copy import deepcopy
from urlparse import urljoin
 
def fromstring(context, parser=None):
                    tag.text = ''
                tag.text += root_text
            if i > 0:
                root = deepcopy(list(root))
            tag.extend(root)
            root = tag[-len(root):]
        return self
            else:
                tag.text = root_text + tag.text
            if i > 0:
                root = deepcopy(list(root))
            tag[:0] = root
            root = tag[:len(root)]
        return self
                tag.tail = ''
            tag.tail += root_text
            if i > 0:
                root = deepcopy(list(root))
            parent = tag.getparent()
            index = parent.index(tag) + 1
            parent[index:index] = root
                    parent.text = ''
                parent.text += root_text
            if i > 0:
                root = deepcopy(list(root))
            parent = tag.getparent()
            index = parent.index(tag)
            parent[index:index] = root
        value = fromstring(value)[0]
        nodes = []
        for tag in self:
            wrapper = deepcopy(value)
            # FIXME: using iterchildren is probably not optimal
            if not wrapper.getchildren():
                wrapper.append(deepcopy(tag))
            else:
                childs = [c for c in wrapper.iterchildren()]
                child = childs[-1]
                child.append(deepcopy(tag))
 
        assert isinstance(value, basestring)
        value = fromstring(value)[0]
        wrapper = deepcopy(value)
        if not wrapper.getchildren():
            child = wrapper
        else:
 
        # add nodes to wrapper and check parent
        for tag in self:
            child.append(deepcopy(tag))
            if tag.getparent() is not parent:
                replace_childs = False
 
    def clone(self):
        """return a copy of nodes
        """
        self[:] = [deepcopy(tag) for tag in self]
        return self
 
    def empty(self):

src/n/i/nipy-HEAD/nipype/trunk/examples/spm_tutorial2.py   nipy(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/nipy-HEAD/nipype/trunk/examples/spm_tutorial.py   nipy(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/nipy-HEAD/nipype/trunk/examples/fsl_tutorial2.py   nipy(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/nipy-HEAD/nipype/trunk/examples/freesurfer_tutorial.py   nipy(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/NiPypeold-HEAD/examples/spm_tutorial2.py   NiPypeold(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/NiPypeold-HEAD/examples/spm_tutorial.py   NiPypeold(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

src/n/i/NiPypeold-HEAD/examples/fsl_tutorial2.py   NiPypeold(Download)
"""
 
from nipype.interfaces.base import Bunch
from copy import deepcopy
def subjectinfo(subject_id):
    print "Subject ID: %s\n"%str(subject_id)
    output = []
    names = ['Task-Odd','Task-Even']
    for r in range(4):
        onsets = [range(15,240,60),range(45,240,60)]
        output.insert(r,
                      Bunch(conditions=names,
                            onsets=deepcopy(onsets),

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next