Returns a docco section for the given interface.

    :Parameters:
      iface
        Parsed IDL interface dict. Keys: 'comment', 'name', 'returns', 'params'
338291
def parse_interface(iface):
    
    sections = [ ]
    docs = iface['comment']
    code = '<span class="k">interface</span> <span class="gs">%s</span> {\n' % iface['name']
    for v in iface["functions"]:
        func_code = '    <span class="nf">%s</span>(' % v['name']
        i = 0
        for p in v["params"]:
            if i == 0: i = 1
            else: func_code += ", "
            func_code += '<span class="na">%s</span> <span class="kt">%s</span>' % (p['name'], format_type(p))
        func_code += ') <span class="kt">%s</span>\n' % format_type(v['returns'])
        if v.has_key('comment') and v['comment']:
            if code:
                sections.append(to_section(docs, code))
            docs = v['comment']
            code = func_code
        else:
            code += func_code
    code += "}"

    sections.append(to_section(docs, code))
    return sections
452062
def _guess_iface_name(netif):
    
    with os.popen('%s -l' % conf.prog.ifconfig) as fdesc:
        ifaces = fdesc.readline().strip().split(' ')
    matches = [iface for iface in ifaces if iface.startswith(netif)]
    if len(matches) == 1:
        return matches[0]
    return None
76358
def interface_type(self, ift):
        
        if not isinstance(ift, str):
            ift = str(ift)
        self._attributes["if"] = ift
756801
def get_key_section_header(self, key, spaces):
        
        header = super(NumpydocTools, self).get_key_section_header(key, spaces)
        header = spaces + header + '\n' + spaces + '-' * len(header) + '\n'
        return header
482787
def get_embedded_yara(self, iocid):
        
        ioc_obj = self.iocs[iocid]
        ids_to_process = set([])
        signatures = ''
        for elem in ioc_obj.top_level_indicator.xpath('.//IndicatorItem[Context/@search = "Yara/Yara"]'):
            signature = elem.findtext('Content')
            signatures = signatures + '\n' + signature
        if signatures:
            signatures += '\n'
        return signatures
574538
private static function normalizeInterface($iface)
    {
        if (!is_string($iface)) {
            throw new \Erebot\InvalidValueException('Not an interface name');
        }

        $ifaceName = str_replace('!', '\\Erebot\\Interfaces\\', $iface);
        if (interface_exists($ifaceName, true)) {
            return strtolower($ifaceName);
        }

        $ifaceName = str_replace('!', '\\Erebot\\', $iface) . 'Interface';
        if (interface_exists($ifaceName, true)) {
            return strtolower($ifaceName);
        }
        throw new \Erebot\InvalidValueException('No such interface ('.$iface.')');
    }
580845
def _get_section(self, name, type):
        
        for section in self.sections:
            if section['name'] == name and section['type'] == type:
                return section
        return None
924665
def parse_pandoc(self, attrs):
        """"""
        id = attrs[0]
        classes = attrs[1]
        kvs = OrderedDict(attrs[2])

        return id, classes, kvs
1133563
def _get_embeddable_interpretation_doc(indent = 0):
    

    output_rows = []

    # Pull out the doc string and put it in a table.
    for name in sorted(dir(_interpretations)):
        if name.startswith("_") or "__" not in name:
            continue

        interpretation, type_str = name.split("__")

        func = getattr(_interpretations, name)

        output_rows.append("%s (%s type):" % (interpretation, type_str))
        output_rows += [("  " + line) for line in _textwrap.dedent(func.__doc__).strip().split("\n")]

        output_rows.append("")

    return "\n".join(" "*indent + line for line in output_rows)
495369
def find_by_id(self, section, params={}, **options): 
        
        path = "/sections/%s" % (section)
        return self.client.get(path, params, **options)
1088438
def get_working_ifaces():
    

    # Only root is allowed to perform the following ioctl() call
    if os.getuid() != 0:
        return []

    # Test all network interfaces
    interfaces = []
    for ifname in get_if_list():

        # Unlike pcap_findalldevs(), we do not care of loopback interfaces.
        if ifname == LOOPBACK_NAME:
            continue

        # Get interface flags
        try:
            result = get_if(ifname, SIOCGIFFLAGS)
        except IOError:
            warning("ioctl(SIOCGIFFLAGS) failed on %s !", ifname)
            continue

        # Convert flags
        ifflags = struct.unpack("16xH14x", result)[0]
        if ifflags & 0x1:  # IFF_UP

            # Get a BPF handle
            fd = get_dev_bpf()[0]
            if fd is None:
                raise Scapy_Exception("No /dev/bpf are available !")

            # Check if the interface can be used
            try:
                fcntl.ioctl(fd, BIOCSETIF, struct.pack("16s16x",
                                                       ifname.encode()))
            except IOError:
                pass
            else:
                ifnum, ifab = _IFNUM.search(ifname).groups()
                interfaces.append((ifname, int(ifnum) if ifnum else -1, ifab))
            finally:
                # Close the file descriptor
                os.close(fd)

    # Sort to mimic pcap_findalldevs() order
    interfaces.sort(key=lambda elt: (elt[1], elt[2], elt[0]))

    return [iface[0] for iface in interfaces]
506360
def parse(self, parent):
        
        for iface in self.RE_INTERFACE.finditer(parent.preamble):
            name = iface.group("name")
            symbol = iface.group("symbol")
            contents = iface.group("contents")
            result = Interface(name, [], parent, symbol)
            self._parse_procedures(contents, result)

            #Set the regex start and end char indices
            result.start, result.end = parent.absolute_charindex(iface.string, iface.start(),
                                                                 iface.end())
            self.update_docs(result, parent)
            parent.interfaces[name.lower()] = result
174908
def get_key_section_header(self, key, spaces):
        
        if key in self.section_headers:
            header = self.section_headers[key]
        else:
            return ''

        return header
383962
def get_interface(iface):
    '''
    
    '''

    adapters = _parse_interfaces()
    if iface in adapters:
        try:
            if iface == 'source':
                template = JINJA.get_template('debian_source.jinja')
            else:
                template = JINJA.get_template('debian_eth.jinja')
        except jinja2.exceptions.TemplateNotFound:
            log.error('Could not load template debian_eth.jinja')
            return ''

        ifcfg = template.render({'name': iface, 'data': adapters[iface]})

        # ensure lines in list end with newline, so difflib works
        return [item + '\n' for item in ifcfg.split('\n')]
    else:
        return []
550837
def iter_doc_objs(self, **kwargs):
        
        _LOG = get_logger('TypeAwareGitShard')
        try:
            for doc_id, fp in self.iter_doc_filepaths(**kwargs):
                if not self._is_alias(doc_id):
                    # TODO:hook for type-specific parser?
                    with codecs.open(fp, 'r', 'utf-8') as fo:
                        try:
                            nex_obj = anyjson.loads(fo.read())
                            yield (doc_id, nex_obj)
                        except Exception:
                            pass
        except Exception as x:
            f = 'iter_doc_filepaths FAILED with this error:\n{}'
            f = f.format(str(x))
            _LOG.warn(f)
1255351
def doc_id(self):
        
        if self.id:
            return '%s_%s' % (self.doc_type, self.id.lower())
        return self._hashed_key
273340
def get_bond(iface):
    '''
    
    '''
    path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface))
    return _read_file(path)