All of the magic together.
9075
def main(unusedargv):
    """"""
    del unusedargv

    bt_table = (bigtable
                .Client(FLAGS.cbt_project, admin=True)
                .instance(FLAGS.cbt_instance)
                .table(FLAGS.cbt_table))
    assert bt_table.exists(), "Table doesn't exist"

    # Get current game counter, updates are conditioned on this matching.
    last_game = latest_game_number(bt_table)
    print("eval_game_counter:", last_game)
    print()

    # Get existing SGF paths so we avoid uploading duplicates
    existing_paths = read_existing_paths(bt_table)
    print("Found {} existing".format(len(existing_paths)))
    if existing_paths:
        duplicates = Counter(existing_paths)
        existing_paths = set(existing_paths)

        for k, v in duplicates.most_common():
            if v == 1:
                break
            print("{}x{}".format(v, k))

        print("\tmin:", min(existing_paths))
        print("\tmax:", max(existing_paths))
        print()

    # Get all SGFs that match glob, skipping SGFs with existing records.
    data = read_games(FLAGS.sgf_glob, existing_paths)
    if data:
        write_eval_records(bt_table, data, last_game)
105619
def _bg_combine(self, bgs):
        """"""
        out = np.ones(self.h5["raw"].shape, dtype=float)
        # bg is an h5py.DataSet
        for bg in bgs:
            out *= bg[:]
        return out
160089
def get_combination_action(combination):
    
    accepted_actions = ('link', 'js')
    for action in accepted_actions:
        if action in combination:
            return {action: combination[action]}
    return {}
1080395
def combine(self, a, b):
        """"""

        for l in (a, b):
            for x in l:
                yield x
1117623
def init(self):
        ""

        self.length = 0L
        self.input = []

        # Load magic initialization constants.
        self.A = 0x67452301L
        self.B = 0xefcdab89L
        self.C = 0x98badcfeL
        self.D = 0x10325476L
908141
def is_magic(s):
    
    if not is_identifier(s):
        return False
    return len(s) > 4 and s.startswith('__') and s.endswith('__')
647489
function () {
      var el = this.el;
      var data = this.data;

      var quad = this.quad = document.createElement('a-entity');
      var self = this;

      quad.setAttribute('rotation', data.rotation);
      quad.setAttribute('text', {width: .25, color: '#fff', value: data.text, align: 'center'});
      el.appendChild(quad);

      // Line
      var material = this.material = new THREE.LineBasicMaterial({color: data.lineColor, opacity: data.opacity, transparent: data.opacity < 1});
      var geometry = this.geometry = new THREE.BufferGeometry();
      geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3));

      this.line = new THREE.Line(geometry, material);
      this.el.setObject3D('tooltip-line', this.line);

    }
54050
def complete(self):
        """"""
        if self._possible is None:
            self._possible = []
            for possible in self.names:
                c = Completion(self.context, self.names[possible], len(self.context.symbol))
                self._possible.append(c)

        return self._possible
21719
def all(self, data={}, **kwargs):
        "
        return super(Order, self).all(data, **kwargs)
404063
function(m) {
            // cache elements in local variables, for speedup:
            var this0 = this.elements[0];
            var this1 = this.elements[1];
            var this2 = this.elements[2];
            var this3 = this.elements[3];
            var this4 = this.elements[4];
            var this5 = this.elements[5];
            var this6 = this.elements[6];
            var this7 = this.elements[7];
            var this8 = this.elements[8];
            var this9 = this.elements[9];
            var this10 = this.elements[10];
            var this11 = this.elements[11];
            var this12 = this.elements[12];
            var this13 = this.elements[13];
            var this14 = this.elements[14];
            var this15 = this.elements[15];
            var m0 = m.elements[0];
            var m1 = m.elements[1];
            var m2 = m.elements[2];
            var m3 = m.elements[3];
            var m4 = m.elements[4];
            var m5 = m.elements[5];
            var m6 = m.elements[6];
            var m7 = m.elements[7];
            var m8 = m.elements[8];
            var m9 = m.elements[9];
            var m10 = m.elements[10];
            var m11 = m.elements[11];
            var m12 = m.elements[12];
            var m13 = m.elements[13];
            var m14 = m.elements[14];
            var m15 = m.elements[15];

            var result = [];
            result[0] = this0 * m0 + this1 * m4 + this2 * m8 + this3 * m12;
            result[1] = this0 * m1 + this1 * m5 + this2 * m9 + this3 * m13;
            result[2] = this0 * m2 + this1 * m6 + this2 * m10 + this3 * m14;
            result[3] = this0 * m3 + this1 * m7 + this2 * m11 + this3 * m15;
            result[4] = this4 * m0 + this5 * m4 + this6 * m8 + this7 * m12;
            result[5] = this4 * m1 + this5 * m5 + this6 * m9 + this7 * m13;
            result[6] = this4 * m2 + this5 * m6 + this6 * m10 + this7 * m14;
            result[7] = this4 * m3 + this5 * m7 + this6 * m11 + this7 * m15;
            result[8] = this8 * m0 + this9 * m4 + this10 * m8 + this11 * m12;
            result[9] = this8 * m1 + this9 * m5 + this10 * m9 + this11 * m13;
            result[10] = this8 * m2 + this9 * m6 + this10 * m10 + this11 * m14;
            result[11] = this8 * m3 + this9 * m7 + this10 * m11 + this11 * m15;
            result[12] = this12 * m0 + this13 * m4 + this14 * m8 + this15 * m12;
            result[13] = this12 * m1 + this13 * m5 + this14 * m9 + this15 * m13;
            result[14] = this12 * m2 + this13 * m6 + this14 * m10 + this15 * m14;
            result[15] = this12 * m3 + this13 * m7 + this14 * m11 + this15 * m15;
            return new CSG.Matrix4x4(result);
        }
12074
def get_magic_guesses(fullpath):
    
    if CFG_HAS_MAGIC == 1:
        magic_cookies = _get_magic_cookies()
        magic_result = []
        for key in magic_cookies.keys():
            magic_result.append(magic_cookies[key].file(fullpath))
        return tuple(magic_result)
    elif CFG_HAS_MAGIC == 2:
        magic_result = []
        for key in ({'mime': False, 'mime_encoding': False},
                    {'mime': True, 'mime_encoding': False},
                    {'mime': False, 'mime_encoding': True}):
            magic_result.append(_magic_wrapper(fullpath, **key))
        return tuple(magic_result)
1179395
def get_all_children(self):
        """"""
        all_children = set()
        for parent in self.children:
            all_children.add(parent.item_id)
            all_children |= parent.get_all_children()
        return all_children
631454
def Magic(self):

        #self.view.setFixedSize(self.width(), self.width())

        self.WholeData = []

        self.x_scale = self.width_plot / self.width_load

        self.y_scale = self.height_plot / self.height_load

        self.z_scale = self.depth_plot / self.depth_load


        # print(self.x_scale,' and ',self.x_scale)

        raw = self._df

        a = int(self.x_element.value())

        b = int(self.y_element.value())

        c = int(self.z_element.value())

        self.x_element_label.setText(self.items[a])
        self.y_element_label.setText(self.items[b])
        self.z_element_label.setText(self.items[c])


        if (self.Left != self.Right) and (self.Down != self.Up) and abs(self.Left) + abs(self.Right) + abs(
                self.Down) + abs(self.Up) != 0:
            self.extent = [self.Left, self.Right, self.Down, self.Up]
        elif (self.Left == self.Right and abs(self.Left) + abs(self.Right) != 0):
            reply = QMessageBox.warning(self, 'Warning', 'You set same value to Left and Right limits.')
            self.extent = 0

        elif (self.Down == self.Up and abs(self.Down) + abs(self.Up) != 0):
            reply = QMessageBox.warning(self, 'Warning', 'You set same value to Up and Down limits.')
            self.extent = 0
        else:
            self.extent = 0

        standardnamechosen = self.StandardsName[int(self.norm_slider.value())]
        standardchosen = self.Standards[standardnamechosen]

        self.norm_slider_label.setText(standardnamechosen)


        PointLabels = []
        XtoDraw = []
        YtoDraw = []
        ZtoDraw = []
        Colors=[]
        Alphas=[]
        Markers=[]
        Names=[]

        for i in range(len(raw)):
            # raw.at[i, 'DataType'] == 'User' or raw.at[i, 'DataType'] == 'user' or raw.at[i, 'DataType'] == 'USER'

            TmpLabel = ''

            #   self.WholeData.append(math.log(tmp, 10))

            if (raw.at[i, 'Label'] in PointLabels or raw.at[i, 'Label'] == ''):
                TmpLabel = ''
            else:
                PointLabels.append(raw.at[i, 'Label'])
                TmpLabel = raw.at[i, 'Label']

            x, y ,z = 0, 0, 0
            xuse, yuse,zuse = 0, 0, 0

            x, y,z = raw.at[i, self.items[a]], raw.at[i, self.items[b]],raw.at[i, self.items[c]]


            try:
                xuse = x
                yuse = y
                zuse = z

                self.xlabel = self.items[a]
                self.ylabel = self.items[b]
                self.zlabel = self.items[c]

                if (self.Normalize_cb.isChecked()):

                    self.xlabel = self.items[a] + ' Norm by ' + standardnamechosen
                    self.x_element_label.setText(self.xlabel)

                    self.ylabel = self.items[b] + ' Norm by ' + standardnamechosen
                    self.y_element_label.setText(self.ylabel)

                    self.zlabel = self.items[c] + ' Norm by ' + standardnamechosen
                    self.z_element_label.setText(self.zlabel)


                    if self.items[a] in self.Element:
                        xuse = xuse / standardchosen[self.items[a]]

                    if self.items[b] in self.Element:
                        yuse = yuse / standardchosen[self.items[b]]

                    if self.items[c] in self.Element:
                        zuse = zuse / standardchosen[self.items[c]]

                if (self.logx_cb.isChecked()):
                    xuse = math.log(x, 10)
                    self.xlabel = '$log10$ ' + self.xlabel


                if (self.logy_cb.isChecked()):
                    yuse = math.log(y, 10)

                    self.ylabel = '$log10$ ' + self.ylabel

                if (self.logz_cb.isChecked()):
                    zuse = math.log(z, 10)

                    self.zlabel = '$log10$ ' + self.zlabel

                XtoDraw.append(xuse)
                YtoDraw.append(yuse)
                ZtoDraw.append(zuse)
                Colors.append(raw.at[i, 'Color'])
                Alphas.append(raw.at[i, 'Alpha'])
                Names.append(raw.at[i, 'Label'])
                Markers.append(raw.at[i, 'Marker'])


            except(ValueError):
                pass


        if self.LimSet==False:
            self.Xleft, self.Xright, self.Ydown, self.Yup, self.Tail, self.Head = min(XtoDraw), max(XtoDraw), min(YtoDraw), max(YtoDraw), min(ZtoDraw), max(ZtoDraw)





        xmin, xmax = min(XtoDraw), max(XtoDraw)
        ymin, ymax = min(YtoDraw), max(YtoDraw)
        zmin, zmax = min(ZtoDraw), max(ZtoDraw)

        xmean = np.mean(XtoDraw)
        ymean = np.mean(YtoDraw)
        zmean = np.mean(ZtoDraw)

        Xoriginal = np.arange(xmin, xmax, (xmax - xmin) / 10)
        Yoriginal = np.arange(ymin, ymax, (ymax - ymin) / 10)
        Zoriginal = np.arange(zmin, zmax, (zmax - zmin) / 10)

        XonPlot = self.GetASequence(tail=self.ShapeGroups)
        YonPlot = self.GetASequence(tail=self.ShapeGroups)
        ZonPlot = self.GetASequence(tail=self.ShapeGroups)

        XonStick = []
        YonStick = []
        ZonStick = []

        for i in range(len(XonPlot)):
            XonStick.append([XonPlot[i], Xoriginal[i]])
            YonStick.append([YonPlot[i], Yoriginal[i]])
            ZonStick.append([ZonPlot[i], Zoriginal[i]])
            pass




        #print(XtoDraw,'\n', YtoDraw,'\n', ZtoDraw)

        toDf = {self.xlabel:XtoDraw,
                self.ylabel:YtoDraw,
                self.zlabel:ZtoDraw}




        newdf = pd.DataFrame(toDf)

        pos = newdf.as_matrix()

        print(pos)

        ThreeDimView = gl.GLScatterPlotItem(pos=pos, color=(100, 255, 255, 88), size=0.1, pxMode=False)


        print(xmean,'\n', ymean,'\n', zmean,'\n')

        self.view.pan(xmean, ymean, zmean)


        xgrid = gl.GLGridItem(size=QtGui.QVector3D(10, 10, 1), color=1)
        ygrid = gl.GLGridItem(size=QtGui.QVector3D(20, 20, 2), color=2)
        zgrid = gl.GLGridItem(size=QtGui.QVector3D(30, 30, 3), color=3)

        ## rotate x and y grids to face the correct direction
        xgrid.rotate(90, 0, 1, 0)
        ygrid.rotate(90, 1, 0, 0)



        xgrid.translate(xmean, ymean, zmean)
        ygrid.translate(xmean, ymean, zmean)
        zgrid.translate(xmean, ymean, zmean)


        ## scale each grid differently

        '''
        
        '''

        # xgrid.setTransform(xmean,ymean,zmean)

        self.view.addItem(xgrid)
        self.view.addItem(ygrid)
        self.view.addItem(zgrid)
        self.view.addItem(ThreeDimView)
933840
function () {
            var x3 = this.dpop();
            var x2 = this.dpop();
            var x1 = this.dpop();
            this.dpush(x2);
            this.dpush(x3);
            this.dpush(x1);
        }
156538
def collapse_all(self):
        """"""

        def aux(item):
            self.item(item, open=False)
            children = self.get_children(item)
            for c in children:
                aux(c)

        children = self.get_children("")
        for c in children:
            aux(c)
331435
function magic(buf, cb) {
  setTimeout(() => {
    const sampleLength = 24;
    const sample = buf.slice(0, sampleLength).toString('hex'); // lookup data

    const found = Object.keys(_magicDb2.default).find(it => {
      return sample.indexOf(it) != -1;
    });

    if (found) {
      cb(null, _magicDb2.default[found]);
    } else {
      cb(new Error('Magic number not found'));
    }
  }, 0);
}
1231246
def show(self):
        
        top = self.get_top_widget()
        if isinstance(top, (list, tuple)):
            for t in top:
                if t is not None:
                    t.show()
        elif top is not None:
            top.show_all()