Query for some pointings, given a block name
430943
def get_pointings(self):
        """"""
	import MOPdbaccess,ephem,math
        import tkSimpleDialog
        result = tkSimpleDialog.askstring("Block Load", "Which Block do you want to plot?")
        db = MOPdbaccess.connect('bucket','cfhls',dbSystem='MYSQL')
        SQL = """SELECT object,ra,`dec`,status,ccd FROM blocks b 
			JOIN cfeps.triple_members m ON m.expnum=b.expnum
			JOIN cfeps.discovery d ON d.triple=m.triple
			JOIN exposure e ON e.expnum=b.expnum
                        LEFT JOIN cfeps.processing p ON p.triple=m.triple
		WHERE p.process='plant' and b.block RLIKE '%s' GROUP BY m.triple,p.ccd """ % (result)
	points=[]
	c = db.cursor()
	r = c.execute(SQL)
	rows=c.fetchall()

        print len(rows)
        geo = camera.geometry['MEGACAM_36']
        main_pointing=''
	for row in rows:
            if main_pointing != row[0]:
                # put down the 'full MP FOV' here
                c=camera(camera='MEGACAM_1')
                if row[4]!= "NULL":
                    color='pale green'
                else:
                    color='gray'
                label={'text': row[0]}
                c.ra=ephem.hours(math.radians(float(row[1])))
                c.dec=ephem.degrees(math.radians(float(row[2])))
                self.pointings.append({"label": label,
                                       "camera": c,
                                       "color": color})
                main_pointing=row[0]
            if int(row[3]) < 0:
                # Create a 'red' box for this CCD
                c=camera(camera='MP_CCD')
                c.ra = ephem.hours(math.radians(float(row[1])-geo[int(row[4])]["ra"]/math.cos(math.radians(float(row[2])))))
                c.dec =ephem.degrees(math.radians(float(row[2])-geo[int(row[4])]["dec"]))
                color='red'
                label={'text': str(row[4])}
                self.pointings.append({"label": label, "camera": c,"color":color})
                                       
        self.plot_pointings()

        return
582657
def get_all_names( self, offset=None, count=None, include_expired=False ):
        
        if offset is not None and offset < 0:
            offset = None

        if count is not None and count < 0:
            count = None 

        cur = self.db.cursor()
        names = namedb_get_all_names( cur, self.lastblock, offset=offset, count=count, include_expired=include_expired )
        return names
832637
def get(self, block, name):
        
        return self._kvs.get(self._key(block, name))
789458
def namedb_get_names_in_namespace( cur, namespace_id, current_block, offset=None, count=None ):
    

    unexpired_query, unexpired_args = namedb_select_where_unexpired_names( current_block )

    query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id WHERE name_records.namespace_id = ? AND " + unexpired_query + " ORDER BY name "
    args = (namespace_id,) + unexpired_args

    offset_count_query, offset_count_args = namedb_offset_count_predicate( offset=offset, count=count )
    query += offset_count_query + ";"
    args += offset_count_args

    name_rows = namedb_query_execute( cur, query, tuple(args) )
    ret = []
    for name_row in name_rows:
        rec = {}
        rec.update( name_row )
        ret.append( rec['name'] )

    return ret
1317891
def get_block_name(self, index):
        """"""
        meta = self.GetMetaData(index)
        if meta is not None:
            return meta.Get(vtk.vtkCompositeDataSet.NAME())
        return None
1362151
def get_block_indentation(self, block_nb):
        """"""
        text = to_text_string(self.document().findBlockByNumber(block_nb).text())
        text = text.replace("\t", " "*self.tab_stop_width_spaces)
        return len(text)-len(text.lstrip())
987943
def tryCondition(self, block):
        
        currentBlock = self._prevNonEmptyBlock(block)
        if not currentBlock.isValid():
            return None

        # found non-empty line
        currentText = currentBlock.text()
        if currentText.rstrip().endswith(';') and \
           re.search(r'^\s*(if\b|[}]?\s*else|do\b|while\b|for)', currentText) is None:
            # idea: we had something like:
            #   if/while/for (expression)
            #       statement();  <-- we catch this trailing ';'
            # Now, look for a line that starts with if/for/while, that has one
            # indent level less.
            currentIndentation = self._lineIndent(currentText)
            if not currentIndentation:
                return None

            for block in self.iterateBlocksBackFrom(currentBlock.previous()):
                if block.text().strip(): # not empty
                    indentation = self._blockIndent(block)

                    if len(indentation) < len(currentIndentation):
                        if re.search(r'^\s*(if\b|[}]?\s*else|do\b|while\b|for)[^{]*$', block.text()) is not None:
                            dbg("tryCondition: success in line %d" % block.blockNumber())
                            return indentation
                        break

        return None
94322
def _scope_lookup(self, node, name, offset=0):
        """"""
        try:
            stmts = node._filter_stmts(self.locals[name], self, offset)
        except KeyError:
            stmts = ()
        if stmts:
            return self, stmts
        if self.parent:  # i.e. not Module
            # nested scope: if parent scope is a function, that's fine
            # else jump to the module
            pscope = self.parent.scope()
            if not pscope.is_function:
                pscope = pscope.root()
            return pscope.scope_lookup(node, name)
        return builtin_lookup(name)
830777
function checkKeyframesBlocks(i) {
  if (i >= tokensLength) return 0;

  const blockEnd = tokens[i].block_end;
  const start = i;
  let l;

  if (!blockEnd) return 0;

  if (l = checkSC(i)) i += l;

  if (l = checkKeyframesBlock(i)) i += l;

  while (i < blockEnd) {
    if (l = checkSC(i)) i += l;
    else if (l = checkKeyframesBlock(i)) i += l;
    else if (l = checkAtrule(i)) i += l;
    else break;
  }

  if (i !== blockEnd + 1) return 0;

  return blockEnd + 1 - start;
}
765311
def _query(options, collection_name, num_to_skip,
           num_to_return, query, field_selector, opts, check_keys):
    """"""
    encoded = _dict_to_bson(query, check_keys, opts)
    if field_selector:
        efs = _dict_to_bson(field_selector, False, opts)
    else:
        efs = b""
    max_bson_size = max(len(encoded), len(efs))
    return b"".join([
        _pack_int(options),
        _make_c_string(collection_name),
        _pack_int(num_to_skip),
        _pack_int(num_to_return),
        encoded,
        efs]), max_bson_size
905154
def method_missing(name, *args, &block)
      if queries.key?(name.to_sym)
        query = queries[name.to_sym]
        query.proc = block if block_given?
        query.options = args.extract_options!
        return query
      end

      super
    end
48225
function (blockName) {
            if (self.blockList.indexOf(blockName) > -1) {
                throw new Error('block<' + blockName + '> is already defined!');
            }
            self.blockList.push(blockName);
            return MARK.define(blockName);
        }
105177
function listShortcuts(blocks, filePath) {
    var parser = parsers.getForFile(filePath);

    if (!parser) {
        return Immutable.List();
    }

    return blocks
        .map(function(block) {
            return block.getShortcuts();
        })
        .filter(function(shortcuts) {
            return (
                shortcuts &&
                shortcuts.acceptParser(parser.getName())
            );
        });
}
1172030
def get_query_kwargs(**kwargs):
    """"""
    query_kwargs = {}

    query = kwargs.pop("query")
    if query:
        query_kwargs["query"] = query

    return query_kwargs
427515
def has(self, block, name):
        
        try:
            self.get(block, name)
            return True
        except KeyError:
            return False
800188
def bpoints(self):
        """"""
        return self.start, self.control1, self.control2, self.end
252304
function getOptTypesFrom(block, name) {
  var types = getTypesFrom_(block, name);
  if (types.length == 0) {
    return undefined;
  } else if (types.indexOf('null') != -1) {
    return 'null';
  } else if (types.length == 1) {
    return types[0];
  } else {
    return '[' + types.join(', ') + ']';
  }
}