转换成美音
        :param arpabet:
        :return:
9680
def convert_to_american_phonetic_alphabet(self, arpabet):
        '''
        
        '''

        word = self._convert_to_word(arpabet=arpabet)

        if not word:
            return None

        return word.translate_to_american_phonetic_alphabet()
859096
def arping(net, timeout=2, cache=0, verbose=None, **kargs):
    """"""
    if verbose is None:
        verbose = conf.verb
    ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=net), verbose=verbose,
                    filter="arp and arp[7] = 2", timeout=timeout, iface_hint=net, **kargs)
    ans = ARPingResult(ans.res)

    if cache and ans is not None:
        for pair in ans:
            conf.netcache.arp_cache[pair[1].psrc] = (pair[1].hwsrc, time.time())
    if verbose:
        ans.show()
    return ans,unans
452525
def _ar_matrix(self):
        

        X = np.ones(self.data_length-self.max_lag)

        if self.ar != 0:
            for i in range(0, self.ar):
                X = np.vstack((X,self.data[(self.max_lag-i-1):-i-1]))

        return X
800640
def rbeta(alpha, beta, size=None):
    
    from scipy.stats.distributions import beta as sbeta
    return sbeta.ppf(np.random.random(size), alpha, beta)
1312998
def get_abbr_impl():
    """"""
    impl = platform.python_implementation()
    if impl == 'PyPy':
        return 'pp'
    elif impl == 'Jython':
        return 'jy'
    elif impl == 'IronPython':
        return 'ip'
    elif impl == 'CPython':
        return 'cp'

    raise LookupError('Unknown Python implementation: ' + impl)
1220252
def bfx(value, msb, lsb):
    """"""
    mask = bitmask((msb, lsb))
    return (value & mask) >> lsb
1127949
function Converter(srcAlphabet, dstAlphabet) {
    if (!srcAlphabet || !dstAlphabet || !srcAlphabet.length || !dstAlphabet.length) {
        throw new Error('Bad alphabet');
    }
    this.srcAlphabet = srcAlphabet;
    this.dstAlphabet = dstAlphabet;
}
1282451
def mapzen_elevation_rgb(arr):
    
    arr = np.clip(arr + 32768.0, 0.0, 65535.0)
    r = arr / 256
    g = arr % 256
    b = (arr * 256) % 256
    return np.stack([r, g, b]).astype(np.uint8)
628295
def _get_a1_value(bbar, dbar, slip, beta, mmax):
        
        return ((dbar - bbar) / dbar) * (slip / beta) *\
            np.exp(-(dbar / 2.) * mmax)
1191664
def run_wang04():
    """"""
    x, y = build_sample_ace_problem_wang04(N=200)
    ace_solver = ace.ACESolver()
    ace_solver.specify_data_set(x, y)
    ace_solver.solve()
    try:
        ace.plot_transforms(ace_solver, 'ace_transforms_wang04.png')
        ace.plot_input(ace_solver, 'ace_input_wang04.png')
    except ImportError:
        pass

    return ace_solver
1003141
def arpleak(target, plen=255, hwlen=255, **kargs):
    
    # We want explicit packets
    pkts_iface = {}
    for pkt in ARP(pdst=target):
        # We have to do some of Scapy's work since we mess with
        # important values
        iface = conf.route.route(pkt.pdst)[0]
        psrc = get_if_addr(iface)
        hwsrc = get_if_hwaddr(iface)
        pkt.plen = plen
        pkt.hwlen = hwlen
        if plen == 4:
            pkt.psrc = psrc
        else:
            pkt.psrc = inet_aton(psrc)[:plen]
            pkt.pdst = inet_aton(pkt.pdst)[:plen]
        if hwlen == 6:
            pkt.hwsrc = hwsrc
        else:
            pkt.hwsrc = mac2str(hwsrc)[:hwlen]
        pkts_iface.setdefault(iface, []).append(
            Ether(src=hwsrc, dst=ETHER_BROADCAST) / pkt
        )
    ans, unans = SndRcvList(), PacketList(name="Unanswered")
    for iface, pkts in viewitems(pkts_iface):
        ans_new, unans_new = srp(pkts, iface=iface, filter="arp", **kargs)
        ans += ans_new
        unans += unans_new
        ans.listname = "Results"
        unans.listname = "Unanswered"
    for _, rcv in ans:
        if ARP not in rcv:
            continue
        rcv = rcv[ARP]
        psrc = rcv.get_field('psrc').i2m(rcv, rcv.psrc)
        if plen > 4 and len(psrc) > 4:
            print("psrc")
            hexdump(psrc[4:])
            print()
        hwsrc = rcv.get_field('hwsrc').i2m(rcv, rcv.hwsrc)
        if hwlen > 6 and len(hwsrc) > 6:
            print("hwsrc")
            hexdump(hwsrc[6:])
            print()
    return ans, unans
962851
def _get_a2_value(bbar, dbar, slip, beta, mmax):
        
        return ((dbar - bbar) / bbar) * (slip / beta) *\
            np.exp(-(dbar / 2.) * mmax)
637786
function getArc(rx, ry, angle, largeArc, sweep, p0, p1) {
            var result = a2c(p0.x, p0.y, p1.x, p1.y, largeArc, sweep, rx, ry, angle);
            var path = [];

            if (result.length) {
                path.push({
                    x: result[0][0],
                    y: result[0][1],
                    onCurve: true
                });

                // 将三次曲线转换成二次曲线
                result.forEach(function (c, index) {
                    var q2Array = bezierCubic2Q2({
                        x: c[0],
                        y: c[1]
                    }, {
                        x: c[2],
                        y: c[3]
                    }, {
                        x: c[4],
                        y: c[5]
                    }, {
                        x: c[6],
                        y: c[7]
                    });

                    q2Array[0][2].onCurve = true;
                    path.push(q2Array[0][1]);
                    path.push(q2Array[0][2]);
                    if (q2Array[1]) {
                        q2Array[1][2].onCurve = true;
                        path.push(q2Array[1][1]);
                        path.push(q2Array[1][2]);
                    }
                });
            }

            return path;
        }
281514
private static double dotProduct(
            final double pAX, final double pAY, final double pBX, final double pBY,
            final double pCX, final double pCY) {
        return (pBX - pAX) * (pCX - pAX) + (pBY - pAY) * (pCY - pAY);
    }
832549
def readRGBA(self):
        
        self.reset_bits_pending();
        r = self.readUI8()
        g = self.readUI8()
        b = self.readUI8()
        a = self.readUI8()
        return (a << 24) | (r << 16) | (g << 8) | b
841291
def do_pp(self, arg):
        
        obj = self._getval(arg)
        try:
            repr(obj)
        except Exception:
            self.message(bdb.safe_repr(obj))
        else:
            self.message(pprint.pformat(obj))
966229
def crc16(cmd, use_byte=False):
    
    crc = 0xFFFF

    # crc16 计算方法, 需要使用 byte
    if hasattr(cmd, 'encode'):
        cmd = bytes.fromhex(cmd)

    for _ in cmd:
        c = _ & 0x00FF
        crc ^= c
        for i in range(8):
            if crc & 0x0001 > 0:
                crc >>= 1
                crc ^= 0xA001
            else:
                crc >>= 1

    # modbus crc16计算时,需要高/低位倒置
    t = [(crc & 0x00FF), (crc >> 8 & 0xFF)]
    crc = '%02X%02X' % (t[0], t[1])
    if use_byte:
        crc = bytes.fromhex(crc)
    return crc