:param pcap_output_file: PCAP destination file for the capture
        :param pcap_data_link_type: PCAP data link type (DLT_*), default is DLT_EN10MB
195806
def startPacketCapture(self, pcap_output_file, pcap_data_link_type="DLT_EN10MB"):
        

        self._capturing = True
        self._pcap_output_file = pcap_output_file
        self._pcap_data_link_type = pcap_data_link_type
669189
def start_capture(self, port_number, output_file):
        

        if not self._ethernet_adapter.port_exists(port_number):
            raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
                                                                                           port_number=port_number))

        nio = self._ethernet_adapter.get_nio(0)

        if not nio:
            raise VPCSError("Port {} is not connected".format(port_number))

        if nio.capturing:
            raise VPCSError("Packet capture is already activated on port {port_number}".format(port_number=port_number))

        nio.startPacketCapture(output_file)

        if self.ubridge:
            yield from self._ubridge_send('bridge start_capture {name} "{output_file}"'.format(name="VPCS-{}".format(self._id),
                                                                                               output_file=output_file))

        log.info("VPCS '{name}' [{id}]: starting packet capture on port {port_number}".format(name=self.name,
                                                                                              id=self.id,
                                                                                              port_number=port_number))
820262
def download_uniprot_file(uniprot_id, filetype, outdir='', force_rerun=False):
    

    my_file = '{}.{}'.format(uniprot_id, filetype)
    url = 'http://www.uniprot.org/uniprot/{}'.format(my_file)
    outfile = op.join(outdir, my_file)

    if ssbio.utils.force_rerun(flag=force_rerun, outfile=outfile):
        urlretrieve(url, outfile)

    return outfile
1082620
def mavlink_packet(self, m):
        ''''''
        # can't use status.msgs as we need this filtered to our target system
        if (self.settings.target_system != 0 and
            self.settings.target_system != m.get_srcSystem()):
            return
        if m.get_type() == 'GPS_RAW_INT':
            self.fix_type = m.fix_type
        if m.get_type() == 'SYSTEM_TIME':
            self.time_boot_ms = m.time_boot_ms
891281
def data32_send(self, type, len, data, force_mavlink1=False):
                '''
                

                '''
                return self.send(self.data32_encode(type, len, data), force_mavlink1=force_mavlink1)
136935
def start_capture(self, port_number, output_file, data_link_type="DLT_EN10MB"):
        

        if not [port["port_number"] for port in self._ports_mapping if port_number == port["port_number"]]:
            raise NodeError("Port {port_number} doesn't exist on cloud '{name}'".format(name=self.name,
                                                                                        port_number=port_number))

        if port_number not in self._nios:
            raise NodeError("Port {} is not connected".format(port_number))

        nio = self._nios[port_number]

        if nio.capturing:
            raise NodeError("Packet capture is already activated on port {port_number}".format(port_number=port_number))
        nio.startPacketCapture(output_file)
        bridge_name = "{}-{}".format(self._id, port_number)
        yield from self._ubridge_send('bridge start_capture {name} "{output_file}"'.format(name=bridge_name,
                                                                                           output_file=output_file))
        log.info("Cloud '{name}' [{id}]: starting packet capture on port {port_number}".format(name=self.name,
                                                                                               id=self.id,
                                                                                               port_number=port_number))
575436
def _verify_output(self, submission_type):
    
    result = True
    if submission_type == 'defense':
      try:
        image_classification = load_defense_output(
            os.path.join(self._sample_output_dir, 'result.csv'))
        expected_keys = [IMAGE_NAME_PATTERN.format(i)
                         for i in range(BATCH_SIZE)]
        if set(image_classification.keys()) != set(expected_keys):
          logging.error('Classification results are not saved for all images')
          result = False
      except IOError as e:
        logging.error('Failed to read defense output file: %s', e)
        result = False
    else:
      for i in range(BATCH_SIZE):
        image_filename = os.path.join(self._sample_output_dir,
                                      IMAGE_NAME_PATTERN.format(i))
        try:
          img = np.array(Image.open(image_filename).convert('RGB'))
          if list(img.shape) != [299, 299, 3]:
            logging.error('Invalid image size %s for image %s',
                          str(img.shape), image_filename)
            result = False
        except IOError as e:
          result = False
    return result
71698
def start_capture(self, data_link_type="DLT_EN10MB", capture_file_name=None):
        
        if not capture_file_name:
            capture_file_name = self.default_capture_file_name()
        self._capture_node = self._choose_capture_side()
        data = {
            "capture_file_name": capture_file_name,
            "data_link_type": data_link_type
        }
        yield from self._capture_node["node"].post("/adapters/{adapter_number}/ports/{port_number}/start_capture".format(adapter_number=self._capture_node["adapter_number"], port_number=self._capture_node["port_number"]), data=data)
        yield from super().start_capture(data_link_type=data_link_type, capture_file_name=capture_file_name)
771596
def render_compressed_output(self, package, package_name, package_type):
        
        method = getattr(self, 'render_{0}'.format(package_type))

        return method(package, package.output_filename)
70231
def link_for_image(self, base_dir: str, conf: Config) -> int:
        """"""
        return self.link_types(
            base_dir,
            [ArtifactType.app, ArtifactType.binary, ArtifactType.gen_py],
            conf)
602237
function _capture(type, successCallback, errorCallback, options) {
    var win = function(pluginResult) {
        var mediaFiles = [];
        var i;
        for (i = 0; i < pluginResult.length; i++) {
            var mediaFile = new MediaFile();
            mediaFile.name = pluginResult[i].name;
            mediaFile.fullPath = pluginResult[i].fullPath;
            mediaFile.type = pluginResult[i].type;
            mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate;
            mediaFile.size = pluginResult[i].size;
            mediaFiles.push(mediaFile);
        }
        successCallback(mediaFiles);
    };
    exec(win, errorCallback, "Capture", type, [options]);
}
358730
def _decompress_dicom(dicom_file, output_file):
    
    gdcmconv_executable = _get_gdcmconv()

    subprocess.check_output([gdcmconv_executable, '-w', dicom_file, output_file])
963308
def dump
      out = "\n"
      out += "Type            : #{@bs['desc_type']}\n"
      out += "Record ID       : #{@bs['id']}\n"
      out += "Version         : #{@bs['version']}\n"
      out += "System ID       : #{@bs['system_id'].strip}\n"
      out += "Volume ID       : #{@volName}\n"
      out += "Vol space size  : #{@bs["vol_space_size#{@suff}"]} (sectors)\n"
      out += "Vol set size    : #{@bs["vol_set_size#{@suff}"]}\n"
      out += "Vol sequence num: #{@bs["vol_seq_number#{@suff}"]}\n"
      out += "Logical blk size: #{@bs["log_block_size#{@suff}"]} (sector size)\n"
      out += "Path table size : #{@bs["path_table_size#{@suff}"]}\n"
      out += "Type 1 path tbl : #{@bs["type_1_path_table#{@suff}"]}\n"
      out += "Opt type 1 pth  : #{@bs["opt_type_1_path_table#{@suff}"]}\n"
      out += "Type M path tbl : #{@bs["type_m_path_table#{@suff}"]}\n"
      out += "Opt type M pth  : #{@bs["opt_type_m_path_table#{@suff}"]}\n"
      out += "Vol set ID      : #{@bs['vol_set_id'].strip}\n"
      out += "Publisher ID    : #{@bs['publisher_id'].strip}\n"
      out += "Preparer ID     : #{@bs['preparer_id'].strip}\n"
      out += "Application ID  : #{@bs['application_id'].strip}\n"
      out += "Copyright       : #{@bs['copyright_file_id'].strip}\n"
      out += "Abstract        : #{@bs['abstract_file_id'].strip}\n"
      out += "Biblographic    : #{@bs['biblographic_file_id'].strip}\n"
      out += "Creation date   : #{@bs['creation_date'].strip} (#{@cTime}, tz = #{Util.GetTimezone(@bs['creation_date'])})\n"
      out += "Mod date        : #{@bs['modification_date'].strip} (#{@mTime}, tz = #{Util.GetTimezone(@bs['modification_date'])})\n"
      out += "Expiration date : #{@bs['experation_date'].strip} (#{@expirationDate}, tz = #{Util.GetTimezone(@bs['experation_date'])})\n"
      out += "Effective date  : #{@bs['effective_date'].strip} (#{@effectiveDate}, tz = #{Util.GetTimezone(@bs['effective_date'])})\n"
      out += "File strct ver  : #{@bs['file_structure_version']}\n"
      out += "Application data: #{@bs['application_data'].strip}\n"
    end
938553
def _save_payload(self, files, directories, links):
        '''
        
        '''

        idx = 0
        for p_type, p_list in (('f', files), ('d', directories), ('l', links,),):
            for p_obj in p_list:
                stats = os.stat(p_obj)

                payload = PayloadFile()
                payload.id = idx
                payload.path = p_obj
                payload.p_type = p_type
                payload.mode = stats.st_mode
                payload.uid = stats.st_uid
                payload.gid = stats.st_gid
                payload.p_size = stats.st_size
                payload.atime = stats.st_atime
                payload.mtime = stats.st_mtime
                payload.ctime = stats.st_ctime

                idx += 1
                self.db.store(payload)
407480
def outputZip(self,figtype='png'):
        
        from zipfile import ZipFile
        with ZipFile(self.outfile+'.zip', 'w') as zipcontainer:
            zipcontainer.writestr(
                'summary.txt',
                '# {}\n\n{}\n{}'.format(
                    self.title,
                    self.p,
                    ('\n## Conclusion\n' if self.conclusion else '')+self.conclusion
                ).encode()
            )
            c = count(1)
            for section in self.sections:
                section.sectionOutZip(zipcontainer,'s{}_{}/'.format(next(c),section.title.replace(' ','_')),
                                      figtype=figtype)
467584
def output_links(self):
        """"""
        output_links = []

        pm_dict = self.get_dict()
        output_links.append('surface_sample')
        if pm_dict['target_volume'] != 0.0:
            output_links.append('cell')

        return output_links
2790
def symlink_to_bytes(symlink_target):
    # type: (str) -> bytes
    '''
    
    '''
    symlink_data = bytearray()
    for comp in symlink_target.split('/'):
        if comp == '':
            # If comp is empty, then we know this is the leading slash
            # and we should make an absolute entry (double slashes and
            # such are weeded out by the earlier utils.normpath).
            symlink_data.extend(b'\x02\x00\x00\x00')
        elif comp == '.':
            symlink_data.extend(b'\x04\x00\x00\x00')
        elif comp == '..':
            symlink_data.extend(b'\x03\x00\x00\x00')
        else:
            symlink_data.extend(b'\x05')
            ostaname = _ostaunicode(comp)
            symlink_data.append(len(ostaname))
            symlink_data.extend(b'\x00\x00')
            symlink_data.extend(ostaname)

    return symlink_data