A complete dos object which incorporates the total dos and all
        projected dos.
769944
def complete_dos(self):
        
        final_struct = self.final_structure
        pdoss = {final_struct[i]: pdos for i, pdos in enumerate(self.pdos)}
        return CompleteDos(self.final_structure, self.tdos, pdoss)
126586
public DataObjectModel view(Collection<? extends DataObject> dos)
    {
        DataObjectModel view = clone();
        view.propertyList = new ArrayList<String>();
        Set<String> propertySet = new HashSet<String>();
        for (DataObject dob : dos)
        {
            for (String property : propertyList)    // TODO performance
            {
                Object value = dob.get(property);
                if (value != null)
                {
                    propertySet.add(property);
                }
            }
        }
        for (String property : propertyList)
        {
            if (propertySet.contains(property))
            {
                view.propertyList.add(property);
            }
        }
        return view;
    }
1338247
def _pvalues_all(self):
        """"""
        return 2.0 * (1.0 - scs.t.cdf(np.abs(self._tstat_all), self.df_err))
320211
def collect(self):
        
        data_structure = {
            'extent_alloc': (
                'alloc_extent',
                'alloc_block',
                'free_extent',
                'free_block'
            ),
            'abt': (
                'lookup',
                'compare',
                'insrec',
                'delrec'
            ),
            'blk_map': (
                'read_ops',
                'write_ops',
                'unmap',
                'add_exlist',
                'del_exlist',
                'look_exlist',
                'cmp_exlist'
            ),
            'bmbt': (
                'lookup',
                'compare',
                'insrec',
                'delrec'
            ),
            'dir': (
                'lookup',
                'create',
                'remove',
                'getdents'
            ),
            'trans': (
                'sync',
                'async',
                'empty'
            ),
            'ig': (
                'ig_attempts',
                'ig_found',
                'ig_frecycle',
                'ig_missed',
                'ig_dup',
                'ig_reclaims',
                'ig_attrchg'
            ),
            'log': (
                'writes',
                'blocks',
                'noiclogs',
                'force',
                'force_sleep'
            ),
            'push_ail': (
                'try_logspace',
                'sleep_logspace',
                'pushes',
                'success',
                'pushbuf',
                'pinned',
                'locked',
                'flushing',
                'restarts',
                'flush'
            ),
            'xstrat': (
                'quick',
                'split'
            ),
            'rw': (
                'write_calls',
                'read_calls'
            ),
            'attr': (
                'get',
                'set',
                'remove',
                'list'
            ),
            'icluster': (
                'iflush_count',
                'icluster_flushcnt',
                'icluster_flushinode'
            ),
            'vnodes': (
                'vn_active',
                'vn_alloc',
                'vn_get',
                'vn_hold',
                'vn_rele',
                'vn_reclaim',
                'vn_remove',
                'vn_free'
            ),
            'buf': (
                'xb_get',
                'xb_create',
                'xb_get_locked',
                'xb_get_locked_waited',
                'xb_busy_locked',
                'xb_miss_locked',
                'xb_page_retries',
                'xb_page_found',
                'xb_get_read'
            ),
            'abtb2': (
                'xs_abtb_2_lookup',
                'xs_abtb_2_compare',
                'xs_abtb_2_insrec',
                'xs_abtb_2_delrec',
                'xs_abtb_2_newroot',
                'xs_abtb_2_killroot',
                'xs_abtb_2_increment',
                'xs_abtb_2_decrement',
                'xs_abtb_2_lshift',
                'xs_abtb_2_rshift',
                'xs_abtb_2_split',
                'xs_abtb_2_join',
                'xs_abtb_2_alloc',
                'xs_abtb_2_free',
                'xs_abtb_2_moves'
            ),
            'abtc2': (
                'xs_abtc_2_lookup',
                'xs_abtc_2_compare',
                'xs_abtc_2_insrec',
                'xs_abtc_2_delrec',
                'xs_abtc_2_newroot',
                'xs_abtc_2_killroot',
                'xs_abtc_2_increment',
                'xs_abtc_2_decrement',
                'xs_abtc_2_lshift',
                'xs_abtc_2_rshift',
                'xs_abtc_2_split',
                'xs_abtc_2_join',
                'xs_abtc_2_alloc',
                'xs_abtc_2_free',
                'xs_abtc_2_moves'
            ),
            'bmbt2': (
                'xs_bmbt_2_lookup',
                'xs_bmbt_2_compare',
                'xs_bmbt_2_insrec',
                'xs_bmbt_2_delrec',
                'xs_bmbt_2_newroot',
                'xs_bmbt_2_killroot',
                'xs_bmbt_2_increment',
                'xs_bmbt_2_decrement',
                'xs_bmbt_2_lshift',
                'xs_bmbt_2_rshift',
                'xs_bmbt_2_split',
                'xs_bmbt_2_join',
                'xs_bmbt_2_alloc',
                'xs_bmbt_2_free',
                'xs_bmbt_2_moves'
            ),
            'ibt2': (
                'lookup',
                'compare',
                'insrec',
                'delrec',
                'newroot',
                'killroot',
                'increment',
                'decrement',
                'lshift',
                'rshift',
                'split',
                'join',
                'alloc',
                'free',
                'moves'
            ),
            'fibt2': (
                'lookup',
                'compare',
                'insrec',
                'delrec',
                'newroot',
                'killroot',
                'increment',
                'decrement',
                'lshift',
                'rshift',
                'split',
                'join',
                'alloc',
                'free',
                'moves'
            ),
            'qm': (
                'xs_qm_dquot',
                'xs_qm_dquot_unused'
            ),

            'xpc': (
                'xs_xstrat_bytes',
                'xs_write_bytes',
                'xs_read_bytes'
            ),
            'debug': (
                'debug',
            )
        }

        f = open(self.PROC)
        new_stats = f.readlines()
        f.close()

        stats = {}
        for line in new_stats:
            items = line.rstrip().split()
            stats[items[0]] = [int(a) for a in items[1:]]

        for key in stats.keys():
            for item in enumerate(data_structure[key]):
                metric_name = '.'.join([key, item[1]])
                value = stats[key][item[0]]
                self.publish_counter(metric_name, value)
1290407
def compile(self, ops):
        

        def _compile():
            code = []

            for op in ops:
                if isinstance(op, SyscallInvoke):
                    code.extend(self.syscall(op))
                elif isinstance(op, LoadRegister):
                    code.extend(self.reg_load(op.register, op.value))
                elif isinstance(op, str):
                    code.extend(op.split('\n'))
                else:
                    raise ValueError('No idea how to assemble "%s"' % repr(op))
            return ['\t%s' % line for line in code]

        # We do 2 passes to make sure all data is allocated so buffers point at the right offset.
        _compile()
        return '\n'.join(self.finalize(self.data_finalizer(_compile(), self.data))) + '\n'
813006
def _load_all(self):
        '''
        
        '''
        with self._lock:
            for name in self.file_mapping:
                if name in self.loaded_files or name in self.missing_modules:
                    continue
                self._load_module(name)

            self.loaded = True
1310932
def complete_modules(text):
    ''''''
    import MAVProxy.modules, pkgutil
    modlist = [x[1] for x in pkgutil.iter_modules(MAVProxy.modules.__path__)]
    ret = []
    loaded = set(complete_loadedmodules(''))
    for m in modlist:
        if not m.startswith("mavproxy_"):
            continue
        name = m[9:]
        if not name in loaded:
            ret.append(name)
    return ret
98634
@Override
  public boolean complete()
  {
    OutputStream os = _os;
    _os = null;
    
    IoUtil.close(os);

    return true;
  }
1143502
def get_spd_dos(self):
        
        spd_dos = {}
        for atom_dos in self.pdos.values():
            for orb, pdos in atom_dos.items():
                orbital_type = _get_orb_type(orb)
                if orbital_type not in spd_dos:
                    spd_dos[orbital_type] = pdos
                else:
                    spd_dos[orbital_type] = \
                        add_densities(spd_dos[orbital_type], pdos)
        return {orb: Dos(self.efermi, self.energies, densities)
                for orb, densities in spd_dos.items()}
168386
public void doScript(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        _doScript(req, rsp, "_script.jelly");
    }
247222
def recon_all(subj_id,anatomies):
    ''''''
    if not environ_setup:
        setup_freesurfer()
    if isinstance(anatomies,basestring):
        anatomies = [anatomies]
    nl.run([os.path.join(freesurfer_home,'bin','recon-all'),'-all','-subjid',subj_id] + [['-i',anat] for anat in anatomies])
651403
def _prepare_smoove_bams(full_bams, sr_bams, disc_bams, items, tx_work_dir):
    
    input_dir = utils.safe_makedir(tx_work_dir)
    out = []
    for full, sr, disc, data in zip(full_bams, sr_bams, disc_bams, items):
        if sr and disc:
            new_full = os.path.join(input_dir, "%s.bam" % dd.get_sample_name(data))
            new_sr = os.path.join(input_dir, "%s.split.bam" % dd.get_sample_name(data))
            new_disc = os.path.join(input_dir, "%s.disc.bam" % dd.get_sample_name(data))
            utils.symlink_plus(full, new_full)
            utils.symlink_plus(sr, new_sr)
            utils.symlink_plus(disc, new_disc)
            out.append(new_full)
        else:
            out.append(full)
    return out
1251876
private Collection<ClassDoc> implementingClasses(ClassDoc cd) {
        Collection<ClassDoc> ret = classToImplementingClass.get(cd.qualifiedName());
        if (ret == null) {
            ret = new TreeSet<ClassDoc>();
            List<ClassDoc> impl = classtree.implementingclasses(cd);
            if (impl != null) {
                ret.addAll(impl);
                for (Iterator<ClassDoc> it = impl.iterator(); it.hasNext();) {
                    ret.addAll(subclasses(it.next()));
                }
            }
            for (Iterator<ClassDoc> it = subinterfaces(cd).iterator(); it.hasNext();) {
                ret.addAll(implementingClasses(it.next()));
            }
            addAll(classToImplementingClass, cd, ret);
        }
        return ret;
    }
409460
def get_partial_doses(self, tdos, npts_mu, T):
        
        spin = self.data.spin if isinstance(self.data.spin,int) else 1

        if not isinstance(self.data.proj,np.ndarray):
            raise BoltztrapError("No projections loaded.")

        bkp_data_ebands = np.copy(self.data.ebands)

        pdoss = {}
        # for spin in self.data.proj:
        for isite, site in enumerate(self.data.structure.sites):
            if site not in pdoss:
                pdoss[site] = {}
            for iorb, orb in enumerate(Orbital):
                if iorb == self.data.proj.shape[-1]: break

                if orb not in pdoss[site]:
                    pdoss[site][orb] = {}

                self.data.ebands = self.data.proj[:, :, isite, iorb].T
                coeffs = fite.fitde3D(self.data, self.equivalences)
                proj, vvproj, cproj = fite.getBTPbands(self.equivalences,
                                                       coeffs, self.data.lattvec)

                edos, pdos = BL.DOS(self.eband, npts=npts_mu, weights=np.abs(proj.real))

                if T is not None:
                    pdos = BL.smoothen_DOS(edos, pdos, T)

                pdoss[site][orb][Spin(spin)] = pdos

        self.data.ebands = bkp_data_ebands

        return CompleteDos(self.data.structure, total_dos=tdos, pdoss=pdoss)
905222
def stage_all(self):
        
        LOGGER.info('Staging all files')
        self.repo.git.add(A=True)
589861
def _prepare(self):
        """"""
        names = []

        added_directories = set()

        def add_directory(short_path):
            # Do not continue if this directory has already been added
            if short_path in added_directories:
                return

            # Scan for first super-directory that has already been added
            dir_base  = short_path
            dir_parts = []
            while dir_base:
                dir_base, dir_name = os.path.split(dir_base)
                dir_parts.append(dir_name)
                if dir_base in added_directories:
                    break

            # Add missing intermediate directory nodes in the right order
            while dir_parts:
                dir_base = os.path.join(dir_base, dir_parts.pop())

                # Create an empty, fake file to represent the directory
                mock_file = io.StringIO()
                mock_file.write(u'')
                # Add this directory to those that will be sent
                names.append(('files',
                             (dir_base.replace(os.sep, '/'), mock_file, 'application/x-directory')))
                # Remember that this directory has already been sent
                added_directories.add(dir_base)

        def add_file(short_path, full_path):
            try:
                # Always add files in wildcard directories
                names.append(('files', (short_name.replace(os.sep, '/'),
                                        open(full_path, 'rb'),
                                        'application/octet-stream')))
            except OSError:
                # File might have disappeared between `os.walk()` and `open()`
                pass

        def match_short_path(short_path):
            # Remove initial path component so that all files are based in
            # the target directory itself (not one level above)
            if os.sep in short_path:
                path = short_path.split(os.sep, 1)[1]
            else:
                return False

            # Convert all path seperators to POSIX style
            path = path.replace(os.sep, '/')

            # Do the matching and the simplified path
            for pattern in self.patterns:
                if pattern.match(path):
                    return True
            return False

        # Identify the unecessary portion of the relative path
        truncate = os.path.dirname(self.directory)
        # Traverse the filesystem downward from the target directory's uri
        # Errors: `os.walk()` will simply return an empty generator if the
        #         target directory does not exist.
        wildcard_directories = set()
        for curr_dir, _, files in os.walk(self.directory):
            # find the path relative to the directory being added
            if len(truncate) > 0:
                _, _, short_path = curr_dir.partition(truncate)
            else:
                short_path = curr_dir
            # remove leading / or \ if it is present
            if short_path.startswith(os.sep):
                short_path = short_path[1:]

            wildcard_directory = False
            if os.path.split(short_path)[0] in wildcard_directories:
                # Parent directory has matched a pattern, all sub-nodes should
                # be added too
                wildcard_directories.add(short_path)
                wildcard_directory = True
            else:
                # Check if directory path matches one of the patterns
                if match_short_path(short_path):
                    # Directory matched pattern and it should therefor
                    # be added along with all of its contents
                    wildcard_directories.add(short_path)
                    wildcard_directory = True

            # Always add directories within wildcard directories - even if they
            # are empty
            if wildcard_directory:
                add_directory(short_path)

            # Iterate across the files in the current directory
            for filename in files:
                # Find the filename relative to the directory being added
                short_name = os.path.join(short_path, filename)
                filepath = os.path.join(curr_dir, filename)

                if wildcard_directory:
                    # Always add files in wildcard directories
                    add_file(short_name, filepath)
                else:
                    # Add file (and all missing intermediary directories)
                    # if it matches one of the patterns
                    if match_short_path(short_name):
                        add_directory(short_path)
                        add_file(short_name, filepath)
        # Send the request and present the response body to the user
        req = requests.Request("POST", 'http://localhost', files=names)
        prep = req.prepare()
        return prep
1108411
def get_site_t2g_eg_resolved_dos(self, site):
        
        t2g_dos = []
        eg_dos = []
        for s, atom_dos in self.pdos.items():
            if s == site:
                for orb, pdos in atom_dos.items():
                    if orb in (Orbital.dxy, Orbital.dxz, Orbital.dyz):
                        t2g_dos.append(pdos)
                    elif orb in (Orbital.dx2, Orbital.dz2):
                        eg_dos.append(pdos)
        return {"t2g": Dos(self.efermi, self.energies,
                           functools.reduce(add_densities, t2g_dos)),
                "e_g": Dos(self.efermi, self.energies,
                           functools.reduce(add_densities, eg_dos))}