This is the Alchemy Data Node
433053
function AlchemyFeatureExtractNode (config) {
    RED.nodes.createNode(this, config);
    var node = this;

    this.on('input', function (msg) {
      if (!msg.payload) {
        this.status({fill:'red', shape:'ring', text:'missing payload'});
        var message = 'Missing property: msg.payload';
        node.error(message, msg);
        return;
      }

      // If it is present the newly provided user entered key takes precedence over the existing one.
      apikey = s_apikey || this.credentials.apikey;
      this.status({});

      if (!apikey) {
        this.status({fill:'red', shape:'ring', text:'missing credentials'});
        var message = 'Missing Alchemy API service credentials';
        node.error(message, msg);
        return;
      }

      var alchemy_language = watson.alchemy_language( { api_key: apikey } );

      // Check which features have been requested.

      var enabled_features = Object.keys(FEATURES).filter(function (feature) {
        return config[feature]
      });


      if (!enabled_features.length) {
        this.status({fill:'red', shape:'ring', text:'no features selected'});
        var message = 'AlchemyAPI node must have at least one selected feature.';
        node.error(message, msg);
        return;
      }

      var params = buildParams(enabled_features, config, msg);

      // Splice in the additional options from msg.alchemy_options
      // eg. The user may have entered msg.alchemy_options = {maxRetrieve: 2};

      for (var key in msg.alchemy_options) { params[key] = msg.alchemy_options[key]; }

      alchemy_language.combined(params, function (err, response) {
        if (err || response.status === 'ERROR') {
          node.status({fill:'red', shape:'ring', text:'call to alchmeyapi language service failed'});
          console.log('Error:', msg, err);
          node.error(err, msg);
        }
        else {
          msg.features = {};
          //msg.features['all'] = response;

          Object.keys(FEATURES).forEach(function (feature) {
            var answer_feature = FEATURES[feature];

            msg.features[feature] = response[answer_feature] || {};
          });

          node.send(msg);
        }
      });

    });
  }
103771
def data(self, root):
        ''''''
        value = self.dict()
        children = [node for node in root if isinstance(node.tag, basestring)]
        for attr, attrval in root.attrib.items():
            attr = attr if self.attr_prefix is None else self.attr_prefix + attr
            value[attr] = self._fromstring(attrval)
        if root.text and self.text_content is not None:
            text = root.text.strip()
            if text:
                if self.simple_text and len(children) == len(root.attrib) == 0:
                    value = self._fromstring(text)
                else:
                    value[self.text_content] = self._fromstring(text)
        count = Counter(child.tag for child in children)
        for child in children:
            if count[child.tag] == 1:
                value.update(self.data(child))
            else:
                result = value.setdefault(child.tag, self.list())
                result += self.data(child).values()
        # if simple_text, elements with no children nor attrs become '', not {}
        if isinstance(value, dict) and not value and self.simple_text:
            value = ''
        return self.dict([(root.tag, value)])
762209
def _node_info(conn):
    '''
    
    '''
    raw = conn.getInfo()
    info = {'cpucores': raw[6],
            'cpumhz': raw[3],
            'cpumodel': six.text_type(raw[0]),
            'cpus': raw[2],
            'cputhreads': raw[7],
            'numanodes': raw[4],
            'phymemory': raw[1],
            'sockets': raw[5]}
    return info
1198901
def _data_keys(self):
        
        return [name for name, child in iteritems(self._children) if not isinstance(child, GroupNode)]
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);
}
1148464
function(){
    var block = this.parent = this.root;
    if (Parser.cache.has(this.hash)) {
      block = Parser.cache.get(this.hash);
      // normalize cached imports
      if ('block' == block.nodeName) block.constructor = nodes.Root;
    } else {
      while ('eos' != this.peek().type) {
        this.skipWhitespace();
        if ('eos' == this.peek().type) break;
        var stmt = this.statement();
        this.accept(';');
        if (!stmt) this.error('unexpected token {peek}, not allowed at the root level');
        block.push(stmt);
      }
      Parser.cache.set(this.hash, block);
    }
    return block;
  }
464970
def add_node_from_data(self, node: BaseEntity) -> BaseEntity:
        """"""
        assert isinstance(node, BaseEntity)

        if node in self:
            return node

        self.add_node(node)

        if VARIANTS in node:
            self.add_has_variant(node.get_parent(), node)

        elif MEMBERS in node:
            for member in node[MEMBERS]:
                self.add_has_component(node, member)

        elif PRODUCTS in node and REACTANTS in node:
            for reactant_tokens in node[REACTANTS]:
                self.add_has_reactant(node, reactant_tokens)
            for product_tokens in node[PRODUCTS]:
                self.add_has_product(node, product_tokens)

        return node
1052428
def _get_output_nodes(self, output_path, error_path):
        
        from aiida.orm.data.array.trajectory import TrajectoryData
        import re

        state = None
        step = None
        scale = None
        with open(output_path) as f:
            lines = [x.strip('\n') for x in f.readlines()]

        result_dict = dict()
        trajectory = None
        for line in lines:
            if state is None and re.match('^\s*NWChem SCF Module\s*$',line):
                state = 'nwchem-scf-module'
                continue
            if state is None and re.match('^\s*NWChem Geometry Optimization\s*$',line):
                state = 'nwchem-geometry-optimisation'
                trajectory = TrajectoryData()
                continue
            if state == 'nwchem-scf-module' and re.match('^\s*Final RHF \s*results\s*$',line):
                state = 'final-rhf-results'
                continue
            if re.match('^\s*\-*\s*$',line):
                continue
            if state == 'final-rhf-results':
                result = re.match('^\s*([^=]+?)\s*=\s*([\-\d\.]+)$',line)
                if result:
                    key = re.sub('[^a-zA-Z0-9]+', '_', result.group(1).lower())
                    result_dict[key] = result.group(2)
                else:
                    state = 'nwchem-scf-module'
            if state == 'nwchem-geometry-optimisation' and re.match('^\s*Step\s+\d+\s*$',line):
                result = re.match('^\s*Step\s+(\d+)\s*$',line)
                step = result.group(1)
                continue
            if state == 'nwchem-geometry-optimisation' and \
                re.match('^\s*Output coordinates in a.u.',line):
                state = 'nwchem-geometry-optimisation-coordinates'
                result = re.match('scale by \s(*[\-\d\.]+)',line)
                scale = result.group(1)
                continue
        return [('parameters', ParameterData(dict=result_dict))]
913850
def node(name)
      assoc = associations[name]
      other = assoc.node
      other.eager_load(assoc)
    end
551310
def relation(self, node):
        
        return self.query(select_block=str(node.attributes),
                          from_block=node.name)
1324360
public void main() {

        fMain = new Frame("HSQLDB Database Manager for Zaurus");
        imgEmpty = createImage(new MemoryImageSource(2, 2, new int[4 * 4], 2,
                2));

        fMain.setIconImage(imgEmpty);
        fMain.addWindowListener(this);

        MenuBar bar = new MenuBar();

        // no shortcuts used
        String[] fitems = {
            "-Connect...", "--", "-Open Script...", "-Save Script...",
            "-Save Result...", "--", "-Exit"
        };

        addMenu(bar, "File", fitems);

        String[] vitems = {
            "-Refresh Tree", "--", "-View Tree", "-View Command",
            "-View Result", "-View Editor", "--", "-Results in Grid",
            "-Results in Text"
        };

        addMenu(bar, "View", vitems);

        String[] sitems = {
            "-SELECT", "-INSERT", "-UPDATE", "-DELETE", "--", "-CREATE TABLE",
            "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-SCRIPT",
            "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "SQL", sitems);

        Menu recent = new Menu("Recent");

        mRecent = new Menu("Recent");

        bar.add(mRecent);

        String[] soptions = {
            "-AutoCommit on", "-AutoCommit off", "-Commit", "-Rollback", "--",
            "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on",
            "-Logging off", "--",
            "-Insert test data"    // , "-Transfer"
        };

        addMenu(bar, "Options", soptions);

        String[] shelp = { "-Show HTML-Help in browser" };

        addMenu(bar, "?", shelp);
        fMain.setMenuBar(bar);
        fMain.setSize(defWidth, defHeight);
        fMain.add("Center", this);
        initGUI();

        sRecent = new String[iMaxRecent];

        Dimension d    = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension size = fMain.getSize();

        // (ulrivo): arguments from command line or
        // full size on screen with less than 640 width
        if (d.width > 640) {
            fMain.setLocation((d.width - size.width) / 2,
                              (d.height - size.height) / 2);
        } else if (defWidth > 0 && defHeight > 0) {
            fMain.setLocation(defLocX, defLocY);
            fMain.setSize(defWidth, defHeight);
        } else {
            fMain.setLocation(0, 0);
            fMain.setSize(d);
        }

        fMain.show();

        // (ulrivo): load query from command line
        if (defQuery != null) {
            txtCommand.setText(DatabaseManagerCommon.readFile(defQuery));
        }

        txtCommand.requestFocus();
    }
1219477
function data( $schema = false, $tableNameList = false, $params = array() )
    {
        return $this->OtherSchema->data( $schema, $tableNameList, $params );
    }
1117467
async def main():
    
    # Create Client from endpoint string in Duniter format
    client = Client(BMAS_ENDPOINT)

    # Get the node summary infos by dedicated method (with json schema validation)
    print("\nCall bma.node.summary:")
    response = await client(bma.node.summary)
    print(response)

    # Get the money parameters located in the first block
    print("\nCall bma.blockchain.parameters:")
    response = await client(bma.blockchain.parameters)
    print(response)

    # Get the current block
    print("\nCall bma.blockchain.current:")
    response = await client(bma.blockchain.current)
    print(response)

    # Get the block number 10
    print("\nCall bma.blockchain.block(10):")
    response = await client(bma.blockchain.block, 10)
    print(response)

    # jsonschema validator
    summary_schema = {
        "type": "object",
        "properties": {
            "duniter": {
                "type": "object",
                "properties": {
                    "software": {
                        "type": "string"
                    },
                    "version": {
                        "type": "string",
                    },
                    "forkWindowSize": {
                        "type": "number"
                    }
                },
                "required": ["software", "version"]
            },
        },
        "required": ["duniter"]
    }

    # Get the node summary infos (direct REST GET request)
    print("\nCall direct get on node/summary")
    response = await client.get('node/summary', rtype=RESPONSE_AIOHTTP, schema=summary_schema)
    print(response)

    # Close client aiohttp session
    await client.close()
1077482
def as_dict(self):
        

        d = {"@module": self.__class__.__module__,
             "@class": self.__class__.__name__,
             "molecule": self.molecule.as_dict(),
             "graphs": json_graph.adjacency_data(self.graph)}

        return d
1194249
def as_dict(self):
        
        data = get_dict_for_attrs(self, ['id', 'raw_id', 'short_id',
            'revision', 'date', 'message'])
        data['author'] = {'name': self.author_name, 'email': self.author_email}
        data['added'] = [node.path for node in self.added]
        data['changed'] = [node.path for node in self.changed]
        data['removed'] = [node.path for node in self.removed]
        return data
1138886
def etree(self, data, root=None):
        ''''''
        result = self.list() if root is None else root
        if isinstance(data, (self.dict, dict)):
            for key, value in data.items():
                if isinstance(value, (self.dict, dict)):
                    elem = self.element(key)
                    if elem is None:
                        continue
                    result.append(elem)

                    if 'attributes' in value:
                        for k, v in value['attributes'].items():
                            elem.set(k, self._tostring(v))
                    # else:
                    #     raise ValueError('Cobra requires "attributes" key for each element')

                    if 'children' in value:
                        for v in value['children']:
                            self.etree(v, root=elem)
                else:
                    elem = self.element(key)
                    if elem is None:
                        continue
                    elem.text = self._tostring(value)
                    result.append(elem)
        else:
            if root is not None:
                root.text = self._tostring(data)
            else:
                elem = self.element(self._tostring(data))
                if elem is not None:
                    result.append(elem)

        return result
342054
def altcore_data(self):
        
        ret = []
        for symbol in self.supported_currencies(project='altcore', level="address"):
            data = crypto_data[symbol]
            priv = data.get('private_key_prefix')
            pub = data.get('address_version_byte')
            hha = data.get('header_hash_algo')
            shb = data.get('script_hash_byte')

            supported = collections.OrderedDict()
            supported['name'] = data['name']
            supported['alias'] = symbol

            if pub is not None:
                supported['pubkeyhash'] = int(pub)
            if priv:
                supported['privatekey'] = priv
            supported['scripthash'] = shb if shb else 5
            if 'transaction_form' in data:
                supported['transactionForm'] = data['transaction_form']
            if 'private_key_form' in data:
                supported['privateKeyForm'] = data['private_key_form']
            #if 'message_magic' in data and data['message_magic']:
            #    supported['networkMagic'] = '0x%s' % binascii.hexlify(data['message_magic'])
            supported['port'] = data.get('port') or None
            if hha not in (None, 'double-sha256'):
                supported['headerHashAlgo'] = hha
            if data.get('script_hash_algo', 'double-sha256') not in (None, 'double-sha256'):
                supported['scriptHashAlgo'] = data['script_hash_algo']
            if data.get('transaction_hash_algo', 'double-sha256') not in (None, 'double-sha256'):
                supported['transactionHashAlgo'] = data['transaction_hash_algo']
            if data.get('seed_nodes'):
                supported['dnsSeeds'] = data['seed_nodes']

            ret.append(supported)

        return ret