text:
"""Tests for V1 metrics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl.testing import parameterized

from tensorflow.contrib.distribute.python import combinations
from tensorflow.contrib.distribute.python import tpu_strategy
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.eager import test
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import metrics
from tensorflow.python.ops import variables

def _labeled_dataset_fn():
  # First four batches of x: labels, predictions -> (labels == predictions)
  #  0: 0, 0 -> True;   1: 1, 1 -> True;   2: 2, 2 -> True;   3: 3, 0 -> False
  #  4: 4, 1 -> False;  5: 0, 2 -> False;  6: 1, 0 -> False;  7: 2, 1 -> False
  #  8: 3, 2 -> False;  9: 4, 0 -> False; 10: 0, 1 -> False; 11: 1, 2 -> False
  # 12: 2, 0 -> False; 13: 3, 1 -> False; 14: 4, 2 -> False; 15: 0, 0 -> True
  return dataset_ops.Dataset.range(1000).map(
      lambda x: {"labels": x % 5, "predictions": x % 3}).batch(
          4, drop_remainder=True)

def _boolean_dataset_fn():
  # First four batches of labels, predictions: {TP, FP, TN, FN}
  # with a threshold of 0.5:
  #   T, T -> TP;  F, T -> FP;   T, F -> FN
  #   F, F -> TN;  T, T -> TP;   F, T -> FP
  #   T, F -> FN;  F, F -> TN;   T, T -> TP
  #   F, T -> FP;  T, F -> FN;   F, F -> TN
  return dataset_ops.Dataset.from_tensor_slices({
      "labels": [True, False, True, False],
      "predictions": [True, True, False, False]}).repeat().batch(
          3, drop_remainder=True)

def _threshold_dataset_fn():
  # First four batches of labels, predictions: {TP, FP, TN, FN}
  # with a threshold of 0.5:
  #   True, 1.0 -> TP;  False, .75 -> FP;   True, .25 -> FN
  #  False, 0.0 -> TN;   True, 1.0 -> TP;  False, .75 -> FP
  #   True, .25 -> FN;  False, 0.0 -> TN;   True, 1.0 -> TP
  #  False, .75 -> FP;   True, .25 -> FN;  False, 0.0 -> TN
  return dataset_ops.Dataset.from_tensor_slices({
      "labels": [True, False, True, False],
      "predictions": [1.0, 0.75, 0.25, 0.]}).repeat().batch(
          3, drop_remainder=True)

def _regression_dataset_fn():
  return dataset_ops.Dataset.from_tensor_slices({
      "labels": [1., .5, 1., 0.],
      "predictions": [1., .75, .25, 0.]}).repeat()

# TODO(priyag): Add TPU Strategy to this once metrics aggregate correctly using
# TowerLocalVariables on TPUs. Submit http://cl/208914352.
def all_combinations():
  return combinations.combine(
      distribution=[combinations.default_strategy,
                    combinations.one_device_strategy,
                    combinations.mirrored_strategy_with_gpu_and_cpu,
                    combinations.mirrored_strategy_with_two_gpus],
      mode=["graph"])

def tpu_combinations():
  return combinations.combine(distribution=[combinations.tpu_strategy_one_step,
                                            combinations.tpu_strategy],
                              mode=["graph"])

# TODO(josh11b): Test metrics.recall_at_top_k, metrics.average_precision_at_k,
# metrics.precision_at_k
class MetricsV1Test(test.TestCase, parameterized.TestCase):

  def _test_metric(self, distribution, dataset_fn, metric_fn, expected_fn):
    with ops.Graph().as_default(), distribution.scope():
      iterator = distribution.distribute_dataset(
          dataset_fn).make_one_shot_iterator()
      if isinstance(distribution, tpu_strategy.TPUStrategy):
        def step_fn(ctx, inputs):
          value, update = distribution.call_for_each_tower(
              metric_fn, inputs)
          ctx.set_non_tensor_output(name="value", output=value)
          return distribution.group(update)

        ctx = distribution.run_steps_on_dataset(
            step_fn, iterator, iterations=distribution.steps_per_run)
        update = ctx.run_op
        value = ctx.non_tensor_outputs["value"]
        # In each run, we run multiple steps, and each steps consumes as many
        # batches as number of towers.
        batches_per_update = (
            distribution.num_towers * distribution.steps_per_run)
      else:
        value, update = distribution.call_for_each_tower(
            metric_fn, iterator.get_next())
        update = distribution.group(update)
        # TODO(josh11b): Once we switch to using a global batch size for input,
        # replace "distribution.num_towers" with "1".
        batches_per_update = distribution.num_towers

      self.evaluate(distribution.initialize())
      self.evaluate(variables.local_variables_initializer())

      batches_consumed = 0
      for i in range(4):
        self.evaluate(update)
        batches_consumed += batches_per_update
        self.assertAllClose(expected_fn(batches_consumed),
                            self.evaluate(value),
                            0.001,
                            msg="After update #" + str(i+1))
        if batches_consumed >= 4:  # Consume 4 input batches in total.
          break

      self.evaluate(distribution.finalize())

  @combinations.generate(all_combinations() + tpu_combinations())
  def testMean(self, distribution):
    def _dataset_fn():
      return dataset_ops.Dataset.range(1000).map(math_ops.to_float).batch(
          4, drop_remainder=True)

    def _expected_fn(num_batches):
      # Mean(0..3) = 1.5, Mean(0..7) = 3.5, Mean(0..11) = 5.5, etc.
      return num_batches * 2 - 0.5

    self._test_metric(distribution, _dataset_fn, metrics.mean, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testAccuracy(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.accuracy(labels, predictions)

    def _expected_fn(num_batches):
      return [3./4, 3./8, 3./12, 4./16][num_batches - 1]

    self._test_metric(
        distribution, _labeled_dataset_fn, _metric_fn, _expected_fn)

  # TODO(priyag, jhseu): Enable TPU for this test once scatter_add is added
  # for TPUMirroredVariable.
  @combinations.generate(all_combinations())
  def testMeanPerClassAccuracy(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.mean_per_class_accuracy(
          labels, predictions, num_classes=5)

    def _expected_fn(num_batches):
      mean = lambda x: sum(x) / len(x)
      return [mean([1., 1., 1., 0., 0.]),
              mean([0.5, 0.5, 0.5, 0., 0.]),
              mean([1./3, 1./3, 0.5, 0., 0.]),
              mean([0.5, 1./3, 1./3, 0., 0.])][num_batches - 1]

    self._test_metric(
        distribution, _labeled_dataset_fn, _metric_fn, _expected_fn)

  # NOTE(priyag): This metric doesn't work on TPUs yet.
  @combinations.generate(all_combinations())
  def testMeanIOU(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.mean_iou(
          labels, predictions, num_classes=5)

    def _expected_fn(num_batches):
      mean = lambda x: sum(x) / len(x)
      return [mean([1./2, 1./1, 1./1, 0.]),  # no class 4 in first batch
              mean([1./4, 1./4, 1./3, 0., 0.]),
              mean([1./6, 1./6, 1./5, 0., 0.]),
              mean([2./8, 1./7, 1./7, 0., 0.])][num_batches - 1]

    self._test_metric(
        distribution, _labeled_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testMeanTensor(self, distribution):
    def _dataset_fn():
      dataset = dataset_ops.Dataset.range(1000).map(math_ops.to_float)
      # Want to produce a fixed, known shape, so drop remainder when batching.
      dataset = dataset.batch(4, drop_remainder=True)
      return dataset

    def _expected_fn(num_batches):
      # Mean(0, 4, ..., 4 * num_batches - 4) == 2 * num_batches - 2
      # Mean(1, 5, ..., 4 * num_batches - 3) == 2 * num_batches - 1
      # Mean(2, 6, ..., 4 * num_batches - 2) == 2 * num_batches
      # Mean(3, 7, ..., 4 * num_batches - 1) == 2 * num_batches + 1
      first = 2. * num_batches - 2.
      return [first, first + 1., first + 2., first + 3.]

    self._test_metric(
        distribution, _dataset_fn, metrics.mean_tensor, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testAUCROC(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.auc(labels, predictions, num_thresholds=8, curve="ROC",
                         summation_method="careful_interpolation")

    def _expected_fn(num_batches):
      return [0.5, 7./9, 0.8, 0.75][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testAUCPR(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.auc(labels, predictions, num_thresholds=8, curve="PR",
                         summation_method="careful_interpolation")

    def _expected_fn(num_batches):
      return [0.797267, 0.851238, 0.865411, 0.797267][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testFalseNegatives(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.false_negatives(labels, predictions)

    def _expected_fn(num_batches):
      return [1., 1., 2., 3.][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testFalseNegativesAtThresholds(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.false_negatives_at_thresholds(labels, predictions, [.5])

    def _expected_fn(num_batches):
      return [[1.], [1.], [2.], [3.]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testTrueNegatives(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.true_negatives(labels, predictions)

    def _expected_fn(num_batches):
      return [0., 1., 2., 3.][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testTrueNegativesAtThresholds(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.true_negatives_at_thresholds(labels, predictions, [.5])

    def _expected_fn(num_batches):
      return [[0.], [1.], [2.], [3.]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testFalsePositives(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.false_positives(labels, predictions)

    def _expected_fn(num_batches):
      return [1., 2., 2., 3.][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testFalsePositivesAtThresholds(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.false_positives_at_thresholds(labels, predictions, [.5])

    def _expected_fn(num_batches):
      return [[1.], [2.], [2.], [3.]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testTruePositives(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.true_positives(labels, predictions)

    def _expected_fn(num_batches):
      return [1., 2., 3., 3.][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testTruePositivesAtThresholds(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.true_positives_at_thresholds(labels, predictions, [.5])

    def _expected_fn(num_batches):
      return [[1.], [2.], [3.], [3.]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testPrecision(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.precision(labels, predictions)

    def _expected_fn(num_batches):
      return [0.5, 0.5, 0.6, 0.5][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testPrecisionAtThreshold(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.precision_at_thresholds(labels, predictions, [0.5])

    def _expected_fn(num_batches):
      return [[0.5], [0.5], [0.6], [0.5]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testRecall(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.recall(labels, predictions)

    def _expected_fn(num_batches):
      return [0.5, 2./3, 0.6, 0.5][num_batches - 1]

    self._test_metric(
        distribution, _boolean_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testRecallAtThreshold(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.recall_at_thresholds(labels, predictions, [0.5])

    def _expected_fn(num_batches):
      return [[0.5], [2./3], [0.6], [0.5]][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testMeanSquaredError(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.mean_squared_error(labels, predictions)

    def _expected_fn(num_batches):
      return [0., 1./32, 0.208333, 0.15625][num_batches - 1]

    self._test_metric(
        distribution, _regression_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations() + tpu_combinations())
  def testRootMeanSquaredError(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.root_mean_squared_error(labels, predictions)

    def _expected_fn(num_batches):
      return [0., 0.176777, 0.456435, 0.395285][num_batches - 1]

    self._test_metric(
        distribution, _regression_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations())
  def testSensitivityAtSpecificity(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.sensitivity_at_specificity(labels, predictions, 0.8)

    def _expected_fn(num_batches):
      return [0.5, 2./3, 0.6, 0.5][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

  @combinations.generate(all_combinations())
  def testSpecificityAtSensitivity(self, distribution):
    def _metric_fn(x):
      labels = x["labels"]
      predictions = x["predictions"]
      return metrics.specificity_at_sensitivity(labels, predictions, 0.95)

    def _expected_fn(num_batches):
      return [0., 1./3, 0.5, 0.5][num_batches - 1]

    self._test_metric(
        distribution, _threshold_dataset_fn, _metric_fn, _expected_fn)

if __name__ == "__main__":
  test.main()


text:
<?php

namespace OpenCrest\Exceptions;

class PostDataException extends Exception
{
    /**
     * @var int
     */
    protected $code = 415;

    /**
     * @return string
     */
    protected function errorMessage()
    {
        return "Wrong data supplied for POST method on: " . $this->response;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using TAPI;

namespace Avalon.NPCs.Normal
{
    /// <summary>
    /// The Armoured Crimislime.
    /// </summary>
    public sealed class ArmouredCrimslime : ModNPC
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="type"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public override bool CanSpawn(int x, int y, int type, Player p)
        {
            return Main.localPlayer.zoneBlood && Main.hardMode && Main.rand.Next(7) == 1;
        }

        /// <summary>
        ///
        /// </summary>
        public override void NPCLoot()
        {
            Gore.NewGore(npc.position, npc.velocity, GoreDef.gores["Avalon:Armoured Crimslime Gore 1"], 1f);
            Gore.NewGore(npc.position, npc.velocity, GoreDef.gores["Avalon:Armoured Crimslime Gore 2"], 1f);
        }
    }
}


text:
updateApis = function() {
  Apis.find({status: "OK"}).forEach(function(api) { Meteor.call("updateApi", api.keyID); });
};

if (!Meteor.settings.isDev) {
SyncedCron.add({
  name: "update apis",
  schedule: function(parser) {
    return parser.text('every 2 hours');
  },
  job: updateApis
});
}

updateAlliances = function() {
  var fut = new Future();
  ejs.fetch('eve:AllianceList', Meteor.bindEnvironment(function (err, res) {
    _.each(res.alliances, function(alliance) {
      Alliances.update({allianceID: alliance.allianceID}, alliance, {upsert: true});
    });
    fut.return();
  }));
  return fut.wait();
};
if (!Meteor.settings.isDev) {
SyncedCron.add({
  name: "update eve alliances",
  schedule: function(parser) {
    return parser.text('every 27 minutes');
  },
  job: updateAlliances
});
}

updateAccess = function() {
  if (!Meteor.settings.api || !Meteor.settings.access) {
    return new Meteor.Error("Please add a valid apis and access labels for contacts to your settings file");
  };
  var types = {
    "2": "Corporation",
    "1373": "Character",
    "1374": "Character",
    "1375": "Character",
    "1376": "Character",
    "1377": "Character",
    "1378": "Character",
    "1379": "Character",
    "1380": "Character",
    "1381": "Character",
    "1382": "Character",
    "1383": "Character",
    "1384": "Character",
    "1385": "Character",
    "1386": "Character",
    "16159": "Alliance"
  };
  var access=Meteor.settings.access;
  /*{
    AUTH_JABBER: 1,
    AUTH_VOICE: 2,
    AUTH_FORUM: 4
  };*/
  var cronID = Meteor.uuid();
  var fut = new Future();
  var corps={};
  ejs.fetch('char:ContactList', Meteor.settings.api, Meteor.bindEnvironment(function (err, res) {
    if (err) return fut.return();
    var labels=res.allianceContactLabels;
    _.each(res.allianceContactList, function(contact, key) {
      contact.labels = [];
      contact.accessMask = 0;
      _.each(labels, function(label) {
        if (contact.labelMask&label.labelID) {
          if (access[label.name]) {
            contact.accessMask=contact.accessMask+access[label.name];
          }
          contact.labels.push(label.name);
        }
      });
      contact.type=types[contact.contactTypeID];
      if (contact.type=="Corporation") {
        console.log("updating corporation", contact.contactName);
        corps[contact.contactID]={
          corporationID: contact.contactID,
          standing: contact.standing,
          labels: contact.labels,
          accessMask: contact.accessMask,
          inherited: false,
          type: "Allied"
        };
      } else if (contact.type=="Alliance") {
        var alliance = Alliance.findOne({allianceID: contact.contactID});
        console.log("updating alliance", contact.contactName, "found", _.size(alliance.memberCorporations), "member corps");
        _.each(alliance.memberCorporations, function(corporation) {
          console.log("updating alliance", contact.contactName, "pushing", corporation.corporationID);
          corps[corporation.corporationID]={
            corporationID: corporation.corporationID,
            standing: contact.standing,
            labels: contact.labels,
            accessMask: contact.accessMask,
            inherited: true,
            type: "Allied"
          };
        });
      }
    });
    if (Meteor.settings.allianceID) {
      var alliance = Alliance.findOne({allianceID: Meteor.settings.allianceID});
      console.log("updating own alliance", alliance.allianceName);
      _.each(alliance.memberCorporations, function(corporation) {
        corps[corporation.corporationID]={
          corporationID: corporation.corporationID,
          standing: 10,
          labels: ["Alliance"],
          accessMask: 7,
          inherited: true,
          type: "Alliance",
          deleteable: false
        };
      });
    }
    var upserted=0;
//    console.log("DEBUG CORP", corps["1585568229"]);
    async.forEachOfSeries(corps, function(corporation, id, cb) {
      hamster.fetch('corp:CorporationSheet', {corporationID: corporation.corporationID}, Meteor.bindEnvironment(function (err, res) {
        if (res && res.corporationID && corporation.accessMask) {  // only insert corps with access
          corporation=_.defaults(res, corporation);
          console.log("adding", corporation.corporationName, corporation.accessMask);
          corporation.cronID=cronID;
          console.log("updateCorp", "corp:CorporationSheet", corporation.corporationID, res.ticker, "cached untill", res.cachedUntil);
          var c=Corporations.upsert({corporationID: corporation.corporationID}, {$set: corporation});
          upserted++;
        }
        if (err) {
          console.log("ERROR WITH CORP", corporation, err);
          cb(err);
        }
        cb();
      }));
    }, function(err) {
      if (!err && upserted) {
        var c=Corporations.find({cronID: {$ne: cronID}}).fetch();
        console.log("DELETEING", c);
        Corporations.remove({cronID: {$ne: cronID}});
      }
      fut.return(err);
    });
  }));
  return fut.wait();
};
if (!Meteor.settings.isDev) {
SyncedCron.add({
  name: "update alliance contacts",
  schedule: function(parser) {
    return parser.text('every 30 minutes');
  },
  job: updateAccess
});
}
Meteor.methods({
  updateAccess: updateAccess
});


text:
var auth = require('../server/controllers/auth');
var api = require('../server/controllers/api');

module.exports = function(app) {
    app.get('/', function(req, res) {
        return res.render('index');
    });
    app.get('/api/getuser', api.getUser);
    app.get('/api/getsongs', api.getSongs);
    app.post('/api/checksong', api.checkSong);
    app.post('/api/user/signup', auth.signup);
    app.post('/api/user/signin', auth.signin);
    app.get('/api/user/active', auth.activeAccount);
    app.post('/api/user/forgotpass', auth.forgotPass);
    app.get('/api/user/logout', auth.logout);
}


text:
<!DOCTYPE html>
<html class="reftest-print" style="height: 0; overflow: hidden">
  This text should show up
</html>


text:
<?php

namespace ch\tebe\workertest\plugins\reader;

use ch\tebe\worker\AbstractReader;
use ch\tebe\workertest\services\CsvFile;

class Country extends AbstractReader
{
    /**
     * @return string
     */
    public function getId()
    {
        return 'countries';
    }

    /**
     * @return array
     */
    public function read()
    {
        $filepath = realpath(__DIR__ . '/../../data/countries.csv');
        /** @var CsvFile $csvFile */
        $csvFile = $this->getService('csvFile');
        $csv = [];
        foreach ($csvFile->read($filepath) as $line => $data) {
            $csv[$data[0]] = $data[1];
        }
        return $csv;
    }
}


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Web.Http.ExceptionHandling;
using System.Web.Http.Properties;

namespace System.Web.Http.Controllers
{
    // This is common to both per-controller and global config.
    // It facilitates sharing all the mutation operations between them.
    public abstract class ServicesContainer : IDisposable
    {
        // Wrapped/composite versions of the exception service interfaces designed for consumption in catch blocks.
        // See ExceptionServices.GetLogger/Handler for how these internal services are used.
        // These instances must be stored separately and not provided via GetService because existing stores for
        // GetService do not provide concurrency control and these two wrappers are potentially initialized late.
        internal readonly Lazy<IExceptionLogger> ExceptionServicesLogger;
        internal readonly Lazy<IExceptionHandler> ExceptionServicesHandler;

        /// <summary>Initializes a new instance of the <see cref="ServicesContainer"/> class.</summary>
        protected ServicesContainer()
        {
            ExceptionServicesLogger = new Lazy<IExceptionLogger>(CreateExceptionServicesLogger);
            ExceptionServicesHandler = new Lazy<IExceptionHandler>(CreateExceptionServicesHandler);
        }

        public abstract object GetService(Type serviceType);
        public abstract IEnumerable<object> GetServices(Type serviceType);

        // critical method for mutation operations (Add,Insert,Clear,Replace, etc)
        // This is used for multi-services.
        // There are other abstract methods to mutate the single services.
        [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "expose for mutation")]
        protected abstract List<object> GetServiceInstances(Type serviceType);

        protected virtual void ResetCache(Type serviceType)
        {
        }

        /// <summary>
        /// Determine whether the service type should be fetched with GetService or GetServices.
        /// </summary>
        /// <param name="serviceType">type of service to query</param>
        /// <returns>true iff the service is singular. </returns>
        public abstract bool IsSingleService(Type serviceType);

        /// <summary>
        /// Adds a service to the end of services list for the given service type.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="service">The service instance.</param>
        public void Add(Type serviceType, object service)
        {
            Insert(serviceType, Int32.MaxValue, service);
        }

        /// <summary>
        /// Adds the services of the specified collection to the end of the services list for
        /// the given service type.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="services">The services to add.</param>
        public void AddRange(Type serviceType, IEnumerable<object> services)
        {
            InsertRange(serviceType, Int32.MaxValue, services);
        }

        /// <summary>
        /// Removes all the service instances of the given service type.
        /// </summary>
        /// <param name="serviceType">The service type to clear from the services list.</param>
        public virtual void Clear(Type serviceType)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }

            if (IsSingleService(serviceType))
            {
                ClearSingle(serviceType);
            }
            else
            {
                ClearMultiple(serviceType);
            }
            ResetCache(serviceType);
        }

        protected abstract void ClearSingle(Type serviceType);

        protected virtual void ClearMultiple(Type serviceType)
        {
            List<object> instances = GetServiceInstances(serviceType);
            instances.Clear();
        }

        /// <summary>
        /// Searches for a service that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the first occurrence.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="match">The delegate that defines the conditions of the element
        /// to search for. </param>
        /// <returns>The zero-based index of the first occurrence, if found; otherwise, -1.</returns>
        public int FindIndex(Type serviceType, Predicate<object> match)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }
            if (match == null)
            {
                throw Error.ArgumentNull("match");
            }

            List<object> instances = GetServiceInstances(serviceType);
            return instances.FindIndex(match);
        }

        /// <summary>
        /// Inserts a service into the collection at the specified index.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="index">The zero-based index at which the service should be inserted.
        /// If <see cref="Int32.MaxValue"/> is passed, ensures the element is added to the end.</param>
        /// <param name="service">The service to insert.</param>
        public void Insert(Type serviceType, int index, object service)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }
            if (service == null)
            {
                throw Error.ArgumentNull("service");
            }
            if (!serviceType.IsAssignableFrom(service.GetType()))
            {
                throw Error.Argument("service", SRResources.Common_TypeMustDriveFromType, service.GetType().Name, serviceType.Name);
            }

            List<object> instances = GetServiceInstances(serviceType);
            if (index == Int32.MaxValue)
            {
                index = instances.Count;
            }

            instances.Insert(index, service);

            ResetCache(serviceType);
        }

        /// <summary>
        /// Inserts the elements of the collection into the service list at the specified index.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="index">The zero-based index at which the new elements should be inserted.
        /// If <see cref="Int32.MaxValue"/> is passed, ensures the elements are added to the end.</param>
        /// <param name="services">The collection of services to insert.</param>
        public void InsertRange(Type serviceType, int index, IEnumerable<object> services)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }
            if (services == null)
            {
                throw Error.ArgumentNull("services");
            }

            object[] filteredServices = services.Where(svc => svc != null).ToArray();
            object incorrectlyTypedService = filteredServices.FirstOrDefault(svc => !serviceType.IsAssignableFrom(svc.GetType()));
            if (incorrectlyTypedService != null)
            {
                throw Error.Argument("services", SRResources.Common_TypeMustDriveFromType, incorrectlyTypedService.GetType().Name, serviceType.Name);
            }

            List<object> instances = GetServiceInstances(serviceType);
            if (index == Int32.MaxValue)
            {
                index = instances.Count;
            }

            instances.InsertRange(index, filteredServices);

            ResetCache(serviceType);
        }

        /// <summary>
        /// Removes the first occurrence of the given service from the service list for the given service type.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="service">The service instance to remove.</param>
        /// <returns> <c>true</c> if the item is successfully removed; otherwise, <c>false</c>.</returns>
        public bool Remove(Type serviceType, object service)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }
            if (service == null)
            {
                throw Error.ArgumentNull("service");
            }

            List<object> instances = GetServiceInstances(serviceType);
            bool result = instances.Remove(service);

            ResetCache(serviceType);

            return result;
        }

        /// <summary>
        /// Removes all the elements that match the conditions defined by the specified predicate.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="match">The delegate that defines the conditions of the elements to remove.</param>
        /// <returns>The number of elements removed from the list.</returns>
        public int RemoveAll(Type serviceType, Predicate<object> match)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }
            if (match == null)
            {
                throw Error.ArgumentNull("match");
            }

            List<object> instances = GetServiceInstances(serviceType);
            int result = instances.RemoveAll(match);

            ResetCache(serviceType);

            return result;
        }

        /// <summary>
        /// Removes the service at the specified index.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="index">The zero-based index of the service to remove.</param>
        public void RemoveAt(Type serviceType, int index)
        {
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }

            List<object> instances = GetServiceInstances(serviceType);
            instances.RemoveAt(index);

            ResetCache(serviceType);
        }

        /// <summary>
        /// Replaces all existing services for the given service type with the given
        /// service instance. This works for both singular and plural services.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="service">The service instance.</param>
        /// <inheritdoc/>
        public void Replace(Type serviceType, object service)
        {
            // Check this early, so we don't call RemoveAll before Insert would catch the null service.
            if (serviceType == null)
            {
                throw Error.ArgumentNull("serviceType");
            }

            if ((service != null) && (!serviceType.IsAssignableFrom(service.GetType())))
            {
                throw Error.Argument("service", SRResources.Common_TypeMustDriveFromType, service.GetType().Name, serviceType.Name);
            }

            if (IsSingleService(serviceType))
            {
                ReplaceSingle(serviceType, service);
            }
            else
            {
                ReplaceMultiple(serviceType, service);
            }
            ResetCache(serviceType);
        }

        protected abstract void ReplaceSingle(Type serviceType, object service);

        protected virtual void ReplaceMultiple(Type serviceType, object service)
        {
            RemoveAll(serviceType, _ => true);
            Insert(serviceType, 0, service);
        }

        /// <summary>
        /// Replaces all existing services for the given service type with the given
        /// service instances.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <param name="services">The service instances.</param>
        public void ReplaceRange(Type serviceType, IEnumerable<object> services)
        {
            // Check this early, so we don't call RemoveAll before InsertRange would catch the null services.
            if (services == null)
            {
                throw Error.ArgumentNull("services");
            }

            RemoveAll(serviceType, _ => true);
            InsertRange(serviceType, 0, services);
        }

        /// <inheritdoc/>
        [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Although this class is not sealed, end users cannot set instances of it so in practice it is sealed.")]
        [SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly", Justification = "Although this class is not sealed, end users cannot set instances of it so in practice it is sealed.")]
        public virtual void Dispose()
        {
        }

        private IExceptionLogger CreateExceptionServicesLogger()
        {
            return ExceptionServices.CreateLogger(this);
        }

        private IExceptionHandler CreateExceptionServicesHandler()
        {
            return ExceptionServices.CreateHandler(this);
        }
    }
}


text:
<?php if ($expanded): ?>
    <div<?php echo $view['form']->attributes() ?>>
    <?php foreach ($form as $choice => $child): ?>
        <?php echo $view['form']->widget($child) ?>
        <?php echo $view['form']->label($child) ?>
    <?php endforeach ?>
    </div>
<?php else: ?>
    <select
        <?php echo $view['form']->attributes() ?>
        name="<?php echo $view->escape($name) ?>"
        <?php if ($read_only): ?> disabled="disabled"<?php endif ?>
        <?php if ($multiple): ?> multiple="multiple"<?php endif ?>
    >
        <?php if (!$multiple && !$required): ?><option value=""><?php echo $empty_value; ?></option><?php endif; ?>
        <?php if (count($preferred_choices) > 0): ?>
            <?php foreach ($preferred_choices as $choice => $label): ?>
                <?php if ($form->isChoiceGroup($label)): ?>
                    <optgroup label="<?php echo $view->escape($choice) ?>">
                        <?php foreach ($label as $nestedChoice => $nestedLabel): ?>
                            <option value="<?php echo $view->escape($nestedChoice) ?>"<?php if ($form->isChoiceSelected($nestedChoice)): ?> selected="selected"<?php endif?>><?php echo $view->escape($nestedLabel) ?></option>
                        <?php endforeach ?>
                    </optgroup>
                <?php else: ?>
                    <option value="<?php echo $view->escape($choice) ?>"<?php if ($form->isChoiceSelected($choice)): ?> selected="selected"<?php endif?>><?php echo $view->escape($label) ?></option>
                <?php endif ?>
            <?php endforeach ?>
            <option disabled="disabled"><?php echo $separator ?></option>
        <?php endif ?>
        <?php foreach ($choices as $choice => $label): ?>
            <?php if ($form->isChoiceGroup($label)): ?>
                <optgroup label="<?php echo $view->escape($choice) ?>">
                    <?php foreach ($label as $nestedChoice => $nestedLabel): ?>
                        <option value="<?php echo $view->escape($nestedChoice) ?>"<?php if ($form->isChoiceSelected($nestedChoice)): ?> selected="selected"<?php endif?>><?php echo $view->escape($nestedLabel) ?></option>
                    <?php endforeach ?>
                </optgroup>
            <?php else: ?>
                <option value="<?php echo $view->escape($choice) ?>"<?php if ($form->isChoiceSelected($choice)): ?> selected="selected"<?php endif?>><?php echo $view->escape($label) ?></option>
            <?php endif ?>
        <?php endforeach ?>
    </select>
<?php endif ?>


text:
//*****************************************************************************
//
//! \addtogroup peripheral_group
//! @{
//! \addtogroup ioc_api
//! @{
//
//*****************************************************************************

#ifndef __IOC_H__
#define __IOC_H__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
#include <inc/hw_ioc.h>
#include <inc/hw_ints.h>
#include <driverlib/interrupt.h>
#include <driverlib/debug.h>
#include <driverlib/gpio.h>

//*****************************************************************************
//
// Support for DriverLib in ROM:
// This section renames all functions that are not "static inline", so that
// calling these functions will default to implementation in flash. At the end
// of this file a second renaming will change the defaults to implementation in
// ROM for available functions.
//
// To force use of the implementation in flash, e.g. for debugging:
// - Globally: Define DRIVERLIB_NOROM at project level
// - Per function: Use prefix "NOROM_" when calling the function
//
//*****************************************************************************
#if !defined(DOXYGEN)
    #define IOCPortConfigureSet             NOROM_IOCPortConfigureSet
    #define IOCPortConfigureGet             NOROM_IOCPortConfigureGet
    #define IOCIOShutdownSet                NOROM_IOCIOShutdownSet
    #define IOCIOModeSet                    NOROM_IOCIOModeSet
    #define IOCIOIntSet                     NOROM_IOCIOIntSet
    #define IOCIOPortPullSet                NOROM_IOCIOPortPullSet
    #define IOCIOHystSet                    NOROM_IOCIOHystSet
    #define IOCIOInputSet                   NOROM_IOCIOInputSet
    #define IOCIOSlewCtrlSet                NOROM_IOCIOSlewCtrlSet
    #define IOCIODrvStrengthSet             NOROM_IOCIODrvStrengthSet
    #define IOCIOPortIdSet                  NOROM_IOCIOPortIdSet
    #define IOCIntEnable                    NOROM_IOCIntEnable
    #define IOCIntDisable                   NOROM_IOCIntDisable
    #define IOCPinTypeGpioInput             NOROM_IOCPinTypeGpioInput
    #define IOCPinTypeGpioOutput            NOROM_IOCPinTypeGpioOutput
    #define IOCPinTypeUart                  NOROM_IOCPinTypeUart
    #define IOCPinTypeSsiMaster             NOROM_IOCPinTypeSsiMaster
    #define IOCPinTypeSsiSlave              NOROM_IOCPinTypeSsiSlave
    #define IOCPinTypeI2c                   NOROM_IOCPinTypeI2c
    #define IOCPinTypeAux                   NOROM_IOCPinTypeAux
#endif

//*****************************************************************************
//
// Number of IOs (max. total of 32)
//
//*****************************************************************************
#define NUM_IO_MAX 32

//*****************************************************************************
//
// The following fields are IO Id for the IOC module
//
//*****************************************************************************
#define IOID_0                  0x00000000  // IO Id 0
#define IOID_1                  0x00000001  // IO Id 1
#define IOID_2                  0x00000002  // IO Id 2
#define IOID_3                  0x00000003  // IO Id 3
#define IOID_4                  0x00000004  // IO Id 4
#define IOID_5                  0x00000005  // IO Id 5
#define IOID_6                  0x00000006  // IO Id 6
#define IOID_7                  0x00000007  // IO Id 7
#define IOID_8                  0x00000008  // IO Id 8
#define IOID_9                  0x00000009  // IO Id 9
#define IOID_10                 0x0000000A  // IO Id 10
#define IOID_11                 0x0000000B  // IO Id 11
#define IOID_12                 0x0000000C  // IO Id 12
#define IOID_13                 0x0000000D  // IO Id 13
#define IOID_14                 0x0000000E  // IO Id 14
#define IOID_15                 0x0000000F  // IO Id 15
#define IOID_16                 0x00000010  // IO Id 16
#define IOID_17                 0x00000011  // IO Id 17
#define IOID_18                 0x00000012  // IO Id 18
#define IOID_19                 0x00000013  // IO Id 19
#define IOID_20                 0x00000014  // IO Id 20
#define IOID_21                 0x00000015  // IO Id 21
#define IOID_22                 0x00000016  // IO Id 22
#define IOID_23                 0x00000017  // IO Id 23
#define IOID_24                 0x00000018  // IO Id 24
#define IOID_25                 0x00000019  // IO Id 25
#define IOID_26                 0x0000001A  // IO Id 26
#define IOID_27                 0x0000001B  // IO Id 27
#define IOID_28                 0x0000001C  // IO Id 28
#define IOID_29                 0x0000001D  // IO Id 29
#define IOID_30                 0x0000001E  // IO Id 30
#define IOID_31                 0x0000001F  // IO Id 31
#define IOID_UNUSED             0xFFFFFFFF  // Unused IO Id

#define IOC_IOID_MASK           0x000000FF  // IOC IO Id bit mask

//*****************************************************************************
//
// Number of IO ports
//
//*****************************************************************************
#define NUM_IO_PORTS 56

//*****************************************************************************
//
// IOC Peripheral Port Mapping
//
//*****************************************************************************
#define IOC_PORT_GPIO             0x00000000  // Default general purpose IO usage
#define IOC_PORT_AON_CLK32K       0x00000007  // AON External 32kHz clock
#define IOC_PORT_AUX_IO           0x00000008  // AUX IO Pin
#define IOC_PORT_MCU_SSI0_RX      0x00000009  // MCU SSI0 Receive Pin
#define IOC_PORT_MCU_SSI0_TX      0x0000000A  // MCU SSI0 Transmit Pin
#define IOC_PORT_MCU_SSI0_FSS     0x0000000B  // MCU SSI0 FSS Pin
#define IOC_PORT_MCU_SSI0_CLK     0x0000000C  // MCU SSI0 Clock Pin
#define IOC_PORT_MCU_I2C_MSSDA    0x0000000D  // MCU I2C Data Pin
#define IOC_PORT_MCU_I2C_MSSCL    0x0000000E  // MCU I2C Clock Pin
#define IOC_PORT_MCU_UART0_RX     0x0000000F  // MCU UART0 Receive Pin
#define IOC_PORT_MCU_UART0_TX     0x00000010  // MCU UART0 Transmit Pin
#define IOC_PORT_MCU_UART0_CTS    0x00000011  // MCU UART0 Clear To Send Pin
#define IOC_PORT_MCU_UART0_RTS    0x00000012  // MCU UART0 Request To Send Pin
#define IOC_PORT_MCU_PORT_EVENT0  0x00000017  // MCU PORT EVENT 0
#define IOC_PORT_MCU_PORT_EVENT1  0x00000018  // MCU PORT EVENT 1
#define IOC_PORT_MCU_PORT_EVENT2  0x00000019  // MCU PORT EVENT 2
#define IOC_PORT_MCU_PORT_EVENT3  0x0000001A  // MCU PORT EVENT 3
#define IOC_PORT_MCU_PORT_EVENT4  0x0000001B  // MCU PORT EVENT 4
#define IOC_PORT_MCU_PORT_EVENT5  0x0000001C  // MCU PORT EVENT 5
#define IOC_PORT_MCU_PORT_EVENT6  0x0000001D  // MCU PORT EVENT 6
#define IOC_PORT_MCU_PORT_EVENT7  0x0000001E  // MCU PORT EVENT 7
#define IOC_PORT_MCU_SWV          0x00000020  // Serial Wire Viewer
#define IOC_PORT_MCU_SSI1_RX      0x00000021  // MCU SSI1 Receive Pin
#define IOC_PORT_MCU_SSI1_TX      0x00000022  // MCU SSI1 Transmit Pin
#define IOC_PORT_MCU_SSI1_FSS     0x00000023  // MCU SSI1 FSS Pin
#define IOC_PORT_MCU_SSI1_CLK     0x00000024  // MCU SSI1 Clock Pin
#define IOC_PORT_MCU_I2S_AD0      0x00000025  // MCU I2S Data Pin 0
#define IOC_PORT_MCU_I2S_AD1      0x00000026  // MCU I2S Data Pin 1
#define IOC_PORT_MCU_I2S_WCLK     0x00000027  // MCU I2S Frame/Word Clock
#define IOC_PORT_MCU_I2S_BCLK     0x00000028  // MCU I2S Bit Clock
#define IOC_PORT_MCU_I2S_MCLK     0x00000029  // MCU I2S Master clock 2
#define IOC_PORT_RFC_TRC          0x0000002E  // RF Core Tracer
#define IOC_PORT_RFC_GPO0         0x0000002F  // RC Core Data Out Pin 0
#define IOC_PORT_RFC_GPO1         0x00000030  // RC Core Data Out Pin 1
#define IOC_PORT_RFC_GPO2         0x00000031  // RC Core Data Out Pin 2
#define IOC_PORT_RFC_GPO3         0x00000032  // RC Core Data Out Pin 3
#define IOC_PORT_RFC_GPI0         0x00000033  // RC Core Data In Pin 0
#define IOC_PORT_RFC_GPI1         0x00000034  // RC Core Data In Pin 1

//*****************************************************************************
//
// Defines for enabling/disabling an IO
//
//*****************************************************************************
#define IOC_SLEW_ENABLE         0x00001000
#define IOC_SLEW_DISABLE        0x00000000
#define IOC_INPUT_ENABLE        0x20000000
#define IOC_INPUT_DISABLE       0x00000000
#define IOC_HYST_ENABLE         0x40000000
#define IOC_HYST_DISABLE        0x00000000

//*****************************************************************************
//
// Values that can be used to set the shutdown mode of an IO
//
//*****************************************************************************
#define IOC_NO_WAKE_UP          0x00000000
#define IOC_WAKE_ON_LOW         0x10000000
#define IOC_WAKE_ON_HIGH        0x18000000

//*****************************************************************************
//
// Values that can be used to set the IO Mode of an IO
//
//*****************************************************************************
#define IOC_IOMODE_NORMAL       0x00000000  // Normal Input/Output
#define IOC_IOMODE_INV          0x01000000  // Inverted Input/Output
#define IOC_IOMODE_OPEN_DRAIN_NORMAL \
                                0x04000000  // Open Drain, Normal Input/Output
#define IOC_IOMODE_OPEN_DRAIN_INV \
                                0x05000000  // Open Drain, Inverted
                                            // Input/Output
#define IOC_IOMODE_OPEN_SRC_NORMAL \
                                0x06000000  // Open Source, Normal Input/Output
#define IOC_IOMODE_OPEN_SRC_INV \
                                0x07000000  // Open Source, Inverted
                                            // Input/Output

//*****************************************************************************
//
// Values that can be used to set the edge detection on an IO
//
//*****************************************************************************
#define IOC_NO_EDGE             0x00000000  // No edge detection
#define IOC_FALLING_EDGE        0x00010000  // Edge detection on falling edge
#define IOC_RISING_EDGE         0x00020000  // Edge detection on rising edge
#define IOC_BOTH_EDGES          0x00030000  // Edge detection on both edges
#define IOC_INT_ENABLE          0x00040000  // Enable interrupt on edge detect
#define IOC_INT_DISABLE         0x00000000  // Disable interrupt on edge detect
#define IOC_INT_M               0x00070000  // Int config mask

//*****************************************************************************
//
// Values that be used to set pull on an IO
//
//*****************************************************************************
#define IOC_NO_IOPULL           0x00006000  // No IO pull
#define IOC_IOPULL_UP           0x00004000  // Pull up
#define IOC_IOPULL_DOWN         0x00002000  // Pull down
#define IOC_IOPULL_M            0x00006000  // Pull config mask
#define IOC_IOPULL_M            0x00006000

//*****************************************************************************
//
// Values that can be used to select the drive strength of an IO
//
//*****************************************************************************
#define IOC_CURRENT_2MA         0x00000000  // 2mA drive strength
#define IOC_CURRENT_4MA         0x00000400  // 4mA drive strength
#define IOC_CURRENT_8MA         0x00000800  // 4 or 8mA drive strength

#define IOC_STRENGTH_AUTO       0x00000000  // Automatic Drive Strength
                                            // (2/4/8 mA @ VVDS)
#define IOC_STRENGTH_MAX        0x00000300  // Maximum Drive Strength
                                            // (2/4/8 mA @ 1.8V)
#define IOC_STRENGTH_MED        0x00000200  // Medium Drive Strength
                                            // (2/4/8 mA @ 2.5V)
#define IOC_STRENGTH_MIN        0x00000100  // Minimum Drive Strength
                                            // (2/4/8 mA @ 3.3V)
//*****************************************************************************
//
// Defines for standard IO setup
//
//*****************************************************************************
#define IOC_STD_INPUT           (IOC_CURRENT_2MA | IOC_STRENGTH_AUTO |      \
                                 IOC_NO_IOPULL | IOC_SLEW_DISABLE |         \
                                 IOC_HYST_DISABLE | IOC_NO_EDGE |           \
                                 IOC_INT_DISABLE | IOC_IOMODE_NORMAL |      \
                                 IOC_NO_WAKE_UP | IOC_INPUT_ENABLE )
#define IOC_STD_OUTPUT          (IOC_CURRENT_2MA | IOC_STRENGTH_AUTO |      \
                                 IOC_NO_IOPULL | IOC_SLEW_DISABLE |         \
                                 IOC_HYST_DISABLE | IOC_NO_EDGE |           \
                                 IOC_INT_DISABLE | IOC_IOMODE_NORMAL |      \
                                 IOC_NO_WAKE_UP | IOC_INPUT_DISABLE )

//*****************************************************************************
//
// API Functions and prototypes
//
//*****************************************************************************

//*****************************************************************************
//
//! \brief Set the configuration of an IO port.
//!
//! This function is used to configure the functionality of an IO.
//!
//! The \c ui32IOId parameter specifies which IO to configure.
//!
//! The \c ui32PortId parameter specifies which functional peripheral to hook
//! up to this IO.
//!
//! The \c ui32IOConfig parameter consists of a bitwise OR'ed value of all
//! the available configuration modes
//!
//! \note All IO Ports are tied to a specific functionality in a sub module
//! except for the \ref IOC_PORT_AUX_IO. Each of the IOs in the AUX domain are
//! hardcoded to a specific IO. When enabling one or more pins for the AUX
//! domain, they should all be configured to using \ref IOC_PORT_AUX_IO.
//!
//! \param ui32IOId defines the IO to configure and must be one of the following:
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32PortId selects the functional IO port to connect.
//! The available IO ports are:
//! - \ref IOC_PORT_GPIO
//! - \ref IOC_PORT_AON_CLK32K
//! - \ref IOC_PORT_AUX_IO
//! - \ref IOC_PORT_MCU_SSI0_RX
//! - \ref IOC_PORT_MCU_SSI0_TX
//! - \ref IOC_PORT_MCU_SSI0_FSS
//! - \ref IOC_PORT_MCU_SSI0_CLK
//! - \ref IOC_PORT_MCU_I2C_MSSDA
//! - \ref IOC_PORT_MCU_I2C_MSSCL
//! - \ref IOC_PORT_MCU_UART0_RX
//! - \ref IOC_PORT_MCU_UART0_TX
//! - \ref IOC_PORT_MCU_UART0_CTS
//! - \ref IOC_PORT_MCU_UART0_RTS
//! - \ref IOC_PORT_MCU_PORT_EVENT0
//! - \ref IOC_PORT_MCU_PORT_EVENT1
//! - \ref IOC_PORT_MCU_PORT_EVENT2
//! - \ref IOC_PORT_MCU_PORT_EVENT3
//! - \ref IOC_PORT_MCU_PORT_EVENT4
//! - \ref IOC_PORT_MCU_PORT_EVENT5
//! - \ref IOC_PORT_MCU_PORT_EVENT6
//! - \ref IOC_PORT_MCU_PORT_EVENT7
//! - \ref IOC_PORT_MCU_SWV
//! - \ref IOC_PORT_MCU_SSI1_RX
//! - \ref IOC_PORT_MCU_SSI1_TX
//! - \ref IOC_PORT_MCU_SSI1_FSS
//! - \ref IOC_PORT_MCU_SSI1_CLK
//! - \ref IOC_PORT_MCU_I2S_AD0
//! - \ref IOC_PORT_MCU_I2S_AD1
//! - \ref IOC_PORT_MCU_I2S_WCLK
//! - \ref IOC_PORT_MCU_I2S_BCLK
//! - \ref IOC_PORT_MCU_I2S_MCLK
//! - \ref IOC_PORT_RFC_TRC
//! - \ref IOC_PORT_RFC_GPO0
//! - \ref IOC_PORT_RFC_GPO1
//! - \ref IOC_PORT_RFC_GPO2
//! - \ref IOC_PORT_RFC_GPO3
//! - \ref IOC_PORT_RFC_GPI0
//! - \ref IOC_PORT_RFC_GPI1
//! \param ui32IOConfig is the IO configuration consisting of
//! the bitwise OR of all configuration modes:
//! - Input/output mode:
//!   - \ref IOC_IOMODE_NORMAL
//!   - \ref IOC_IOMODE_INV
//!   - \ref IOC_IOMODE_OPEN_DRAIN_NORMAL
//!   - \ref IOC_IOMODE_OPEN_DRAIN_INV
//!   - \ref IOC_IOMODE_OPEN_SRC_NORMAL
//!   - \ref IOC_IOMODE_OPEN_SRC_INV
//! - Wake up mode:
//!   - \ref IOC_NO_WAKE_UP
//!   - \ref IOC_WAKE_ON_LOW
//!   - \ref IOC_WAKE_ON_HIGH
//! - Edge detection mode:
//!   - \ref IOC_NO_EDGE
//!   - \ref IOC_FALLING_EDGE
//!   - \ref IOC_RISING_EDGE
//!   - \ref IOC_BOTH_EDGES
//! - Interrupt mode on edge detection:
//!   - \ref IOC_INT_ENABLE
//!   - \ref IOC_INT_DISABLE
//! - Pull mode:
//!   - \ref IOC_NO_IOPULL
//!   - \ref IOC_IOPULL_UP
//!   - \ref IOC_IOPULL_DOWN
//! - Input mode:
//!   - \ref IOC_INPUT_ENABLE
//!   - \ref IOC_INPUT_DISABLE
//! - Hysteresis mode:
//!   - \ref IOC_HYST_ENABLE
//!   - \ref IOC_HYST_DISABLE
//! - Slew control mode:
//!   - \ref IOC_SLEW_ENABLE
//!   - \ref IOC_SLEW_DISABLE
//! - Maximum current mode:
//!   - \ref IOC_CURRENT_2MA
//!   - \ref IOC_CURRENT_4MA
//!   - \ref IOC_CURRENT_8MA
//! - Drive strength mode:
//!   - \ref IOC_STRENGTH_AUTO
//!   - \ref IOC_STRENGTH_MAX
//!   - \ref IOC_STRENGTH_MED
//!   - \ref IOC_STRENGTH_MIN
//!
//! \return None
//
//*****************************************************************************
extern void IOCPortConfigureSet(uint32_t ui32IOId, uint32_t ui32PortId,
                                uint32_t ui32IOConfig);

//*****************************************************************************
//
//! \brief Get the configuration of an IO port.
//!
//! This function is used for getting the configuration of an IO.
//!
//! Each IO port has a dedicated register for setting up the IO. This function
//! returns the current configuration for the given IO.
//!
//! \param ui32IOId selects the IO to return the configuration for.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return Returns the IO Port configuration.
//! See \ref IOCPortConfigureSet() for configuration options.
//
//*****************************************************************************
extern uint32_t IOCPortConfigureGet(uint32_t ui32IOId);

//*****************************************************************************
//
//! \brief Set wake-up on an IO port.
//!
//! This function is used to set the wake-up mode of an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32IOShutdown enables wake-up on LOW/HIGH by this IO port.
//! - \ref IOC_NO_WAKE_UP
//! - \ref IOC_WAKE_ON_LOW
//! - \ref IOC_WAKE_ON_HIGH
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOShutdownSet(uint32_t ui32IOId, uint32_t ui32IOShutdown);

//*****************************************************************************
//
//! \brief Set the IO Mode of an IO Port.
//!
//! This function is used to set the input/output mode of an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32IOMode sets the port IO Mode.
//! - \ref IOC_IOMODE_NORMAL
//! - \ref IOC_IOMODE_INV
//! - \ref IOC_IOMODE_OPEN_DRAIN_NORMAL
//! - \ref IOC_IOMODE_OPEN_DRAIN_INV
//! - \ref IOC_IOMODE_OPEN_SRC_NORMAL
//! - \ref IOC_IOMODE_OPEN_SRC_INV
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOModeSet(uint32_t ui32IOId, uint32_t ui32IOMode);

//*****************************************************************************
//
//! \brief Setup interrupt detection on an IO Port.
//!
//! This function is used to setup the interrupt detection on an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32Int enables/disables interrupt generation on this IO port.
//! - \ref IOC_INT_ENABLE
//! - \ref IOC_INT_DISABLE
//! \param ui32EdgeDet enables/disables edge detection events on this IO port.
//! - \ref IOC_NO_EDGE
//! - \ref IOC_FALLING_EDGE
//! - \ref IOC_RISING_EDGE
//! - \ref IOC_BOTH_EDGES
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOIntSet(uint32_t ui32IOId, uint32_t ui32Int,
                        uint32_t ui32EdgeDet);

//*****************************************************************************
//
//! \brief Set the pull on an IO port.
//!
//! This function is used to configure the pull on an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32Pull enables/disables pull on this IO port.
//! - \ref IOC_NO_IOPULL
//! - \ref IOC_IOPULL_UP
//! - \ref IOC_IOPULL_DOWN
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOPortPullSet(uint32_t ui32IOId, uint32_t ui32Pull);

//*****************************************************************************
//
//! \brief Configure hysteresis on and IO port.
//!
//! This function is used to enable/disable hysteresis on an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32Hysteresis enable/disable input hysteresis on IO.
//! - \ref IOC_HYST_ENABLE
//! - \ref IOC_HYST_DISABLE
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOHystSet(uint32_t ui32IOId, uint32_t ui32Hysteresis);

//*****************************************************************************
//
//! \brief Enable/disable IO port as input.
//!
//! This function is used to enable/disable input on an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32Input enable/disable input on IO.
//! - \ref IOC_INPUT_ENABLE
//! - \ref IOC_INPUT_DISABLE
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOInputSet(uint32_t ui32IOId, uint32_t ui32Input);

//*****************************************************************************
//
//! \brief Enable/disable the slew control on an IO port.
//!
//! This function is used to enable/disable slew control on an IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32SlewEnable enables/disables the slew control on an output.
//! - \ref IOC_SLEW_ENABLE
//! - \ref IOC_SLEW_DISABLE
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOSlewCtrlSet(uint32_t ui32IOId, uint32_t ui32SlewEnable);

//*****************************************************************************
//
//! \brief Configure the drive strength source and current mode of an IO port.
//!
//! The drive strength of an IO is configured by a combination of multiple settings
//! in several modules. The drive strength source \ti_code{ui32DrvStrength} is used for controlling
//! drive strength at different supply levels. When set to AUTO the battery monitor
//! (BATMON) adjusts the drive strength to compensate for changes in supply voltage
//! in order to keep IO current constant. Alternatively, drive strength source can
//! be controlled manually by selecting one of three options each of which is configurable
//! in the AON IOC by \ref AONIOCDriveStrengthSet().
//!
//! Each drive strength source has three current modes: Low-Current (LC), High-Current (HC), and
//! Extended-Current (EC), and typically drive strength doubles when selecting a higher mode.
//! I.e. EC = 2 x HC = 4 x LC.
//!
//! \note Not all IOs support Extended-Current mode. See datasheet for more information
//! on the specific device.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32IOCurrent selects the IO current mode.
//! - \ref IOC_CURRENT_2MA : Low-Current mode. Min 2 mA when \ti_code{ui32DrvStrength} is set to AUTO.
//! - \ref IOC_CURRENT_4MA : High-Current mode. Min 4 mA when \ti_code{ui32DrvStrength} is set to AUTO.
//! - \ref IOC_CURRENT_8MA : Extended-Current mode. Min 8 mA for double drive strength IOs (min 4 mA for normal IOs) when \ti_code{ui32DrvStrength} is set to AUTO.
//! \param ui32DrvStrength sets the source for drive strength control of the IO port.
//! - \ref IOC_STRENGTH_AUTO : Automatic drive strength, controlled by AON BATMON based on battery voltage (default).
//! - \ref IOC_STRENGTH_MAX : Maximum drive strength, used for low supply levels. Controlled by AON IOC (see \ref AONIOCDriveStrengthSet()).
//! - \ref IOC_STRENGTH_MED : Medium drive strength, used for medium supply levels. Controlled by AON IOC (see \ref AONIOCDriveStrengthSet()).
//! - \ref IOC_STRENGTH_MIN : Minimum drive strength, used for high supply levels. Controlled by AON IOC (see \ref AONIOCDriveStrengthSet()).
//!
//! \return None
//
//*****************************************************************************
extern void IOCIODrvStrengthSet(uint32_t ui32IOId, uint32_t ui32IOCurrent,
                                uint32_t ui32DrvStrength);

//*****************************************************************************
//
//! \brief Setup the Port ID for this IO.
//!
//! The \c ui32PortId specifies which functional peripheral to hook up to this
//! IO.
//!
//! \param ui32IOId defines the IO to configure.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! \param ui32PortId selects the port to map to the IO.
//! - \ref IOC_PORT_GPIO
//! - \ref IOC_PORT_AON_CLK32K
//! - \ref IOC_PORT_AUX_IO
//! - \ref IOC_PORT_MCU_SSI0_RX
//! - \ref IOC_PORT_MCU_SSI0_TX
//! - \ref IOC_PORT_MCU_SSI0_FSS
//! - \ref IOC_PORT_MCU_SSI0_CLK
//! - \ref IOC_PORT_MCU_I2C_MSSDA
//! - \ref IOC_PORT_MCU_I2C_MSSCL
//! - \ref IOC_PORT_MCU_UART0_RX
//! - \ref IOC_PORT_MCU_UART0_TX
//! - \ref IOC_PORT_MCU_UART0_CTS
//! - \ref IOC_PORT_MCU_UART0_RTS
//! - \ref IOC_PORT_MCU_PORT_EVENT0
//! - \ref IOC_PORT_MCU_PORT_EVENT1
//! - \ref IOC_PORT_MCU_PORT_EVENT2
//! - \ref IOC_PORT_MCU_PORT_EVENT3
//! - \ref IOC_PORT_MCU_PORT_EVENT4
//! - \ref IOC_PORT_MCU_PORT_EVENT5
//! - \ref IOC_PORT_MCU_PORT_EVENT6
//! - \ref IOC_PORT_MCU_PORT_EVENT7
//! - \ref IOC_PORT_MCU_SWV
//! - \ref IOC_PORT_MCU_SSI1_RX
//! - \ref IOC_PORT_MCU_SSI1_TX
//! - \ref IOC_PORT_MCU_SSI1_FSS
//! - \ref IOC_PORT_MCU_SSI1_CLK
//! - \ref IOC_PORT_MCU_I2S_AD0
//! - \ref IOC_PORT_MCU_I2S_AD1
//! - \ref IOC_PORT_MCU_I2S_WCLK
//! - \ref IOC_PORT_MCU_I2S_BCLK
//! - \ref IOC_PORT_MCU_I2S_MCLK
//! - \ref IOC_PORT_RFC_TRC
//! - \ref IOC_PORT_RFC_GPO0
//! - \ref IOC_PORT_RFC_GPO1
//! - \ref IOC_PORT_RFC_GPO2
//! - \ref IOC_PORT_RFC_GPO3
//! - \ref IOC_PORT_RFC_GPI0
//! - \ref IOC_PORT_RFC_GPI1
//!
//! \return None
//
//*****************************************************************************
extern void IOCIOPortIdSet(uint32_t ui32IOId, uint32_t ui32PortId);

//*****************************************************************************
//
//! \brief Register an interrupt handler for an IO edge interrupt.
//!
//! This function does the actual registering of the interrupt handler. This
//! function enables the global interrupt in the interrupt controller; specific
//! IO interrupts must be enabled via \ref IOCIntEnable(). It is the interrupt
//! handler's responsibility to clear the interrupt source.
//!
//! \param pfnHandler is a pointer to the function to be called when the
//! IOC interrupt occurs.
//!
//! \return None
//!
//! \sa \ref IntRegister() for important information about registering interrupt
//! handlers.
//
//*****************************************************************************
__STATIC_INLINE void
IOCIntRegister(void (*pfnHandler)(void))
{
    //
    // Register the interrupt handler.
    //
    IntRegister(INT_AON_GPIO_EDGE, pfnHandler);

    //
    // Enable the IO edge interrupt.
    //
    IntEnable(INT_AON_GPIO_EDGE);
}

//*****************************************************************************
//
//! \brief Unregisters an interrupt handler for a IO edge interrupt.
//!
//! This function does the actual unregistering of the interrupt handler.  It
//! clears the handler to be called when an IO edge interrupt occurs.
//!
//! \return None
//!
//! \sa \ref IntRegister() for important information about registering interrupt
//! handlers.
//
//*****************************************************************************
__STATIC_INLINE void
IOCIntUnregister(void)
{
    //
    // Disable the interrupts.
    //
    IntDisable(INT_AON_GPIO_EDGE);

    //
    // Unregister the interrupt handler.
    //
    IntUnregister(INT_AON_GPIO_EDGE);
}

//*****************************************************************************
//
//! \brief Enables individual IO edge detect interrupt.
//!
//! This function enables the indicated IO edge interrupt sources. Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! \param ui32IOId is the IO to enable edge detect interrupt for.
//!
//! \return None
//
//*****************************************************************************
extern void IOCIntEnable(uint32_t ui32IOId);

//*****************************************************************************
//
//! \brief Disables individual IO edge interrupt sources.
//!
//! This function disables the indicated IO edge interrupt source. Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! \param ui32IOId is the IO edge interrupt source to be disabled.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return None
//
//*****************************************************************************
extern void IOCIntDisable(uint32_t ui32IOId);

//*****************************************************************************
//
//! \brief Clears the IO edge interrupt source.
//!
//! The specified IO edge interrupt source is cleared, so that it no longer
//! asserts. This function must be called in the interrupt handler to keep the
//! interrupt from being recognized again immediately upon exit.
//!
//! \note Due to write buffers and synchronizers in the system it may take several
//! clock cycles from a register write clearing an event in a module and until the
//! event is actually cleared in the NVIC of the system CPU. It is recommended to
//! clear the event source early in the interrupt service routine (ISR) to allow
//! the event clear to propagate to the NVIC before returning from the ISR.
//! At the same time, an early event clear allows new events of the same type to be
//! pended instead of ignored if the event is cleared later in the ISR.
//! It is the responsibility of the programmer to make sure that enough time has passed
//! before returning from the ISR to avoid false re-triggering of the cleared event.
//! A simple, although not necessarily optimal, way of clearing an event before
//! returning from the ISR is:
//! -# Write to clear event (interrupt source). (buffered write)
//! -# Dummy read from the event source module. (making sure the write has propagated)
//! -# Wait two system CPU clock cycles (user code or two NOPs). (allowing cleared event to propagate through any synchronizers)
//!
//! \param ui32IOId is the IO causing the interrupt.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
IOCIntClear(uint32_t ui32IOId)
{
    //
    // Check the arguments.
    //
    ASSERT(ui32IOId <= IOID_31);

    //
    // Clear the requested interrupt source by clearing the event.
    //
    GPIO_clearEventDio(ui32IOId);
}

//*****************************************************************************
//
//! \brief Returns the status of the IO interrupts.
//!
//! \param ui32IOId is the IO to get the status for.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE uint32_t
IOCIntStatus(uint32_t ui32IOId)
{
    //
    // Check the arguments.
    //
    ASSERT(ui32IOId <= IOID_31);

    //
    // Get the event status.
    //
    return (GPIO_getEventDio(ui32IOId));
}

//*****************************************************************************
//
//! \brief Setup an IO for standard GPIO input.
//!
//! Setup an IO for standard GPIO input with the following configuration:
//! - Port ID:
//!   - \ref IOC_PORT_GPIO
//! - Configuration:
//!   - \ref IOC_CURRENT_2MA
//!   - \ref IOC_STRENGTH_AUTO
//!   - \ref IOC_NO_IOPULL
//!   - \ref IOC_SLEW_DISABLE
//!   - \ref IOC_HYST_DISABLE
//!   - \ref IOC_NO_EDGE
//!   - \ref IOC_INT_DISABLE
//!   - \ref IOC_IOMODE_NORMAL
//!   - \ref IOC_NO_WAKE_UP
//!   - \ref IOC_INPUT_ENABLE
//!
//! \param ui32IOId is the IO to setup for GPIO input
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeGpioInput(uint32_t ui32IOId);

//*****************************************************************************
//
//! \brief Setup an IO for standard GPIO output.
//!
//! Setup an IO for standard GPIO output with the following configuration:
//! - Port ID:
//!   - \ref IOC_PORT_GPIO
//! - Configuration:
//!   - \ref IOC_CURRENT_2MA
//!   - \ref IOC_STRENGTH_AUTO
//!   - \ref IOC_NO_IOPULL
//!   - \ref IOC_SLEW_DISABLE
//!   - \ref IOC_HYST_DISABLE
//!   - \ref IOC_NO_EDGE
//!   - \ref IOC_INT_DISABLE
//!   - \ref IOC_IOMODE_NORMAL
//!   - \ref IOC_NO_WAKE_UP
//!   - \ref IOC_INPUT_DISABLE
//!
//! \param ui32IOId is the IO to setup for GPIO output
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeGpioOutput(uint32_t ui32IOId);

//*****************************************************************************
//
//! \brief Configure a set of IOs for standard UART peripheral control.
//!
//! The UART pins must be properly configured for the UART peripheral to
//! function correctly. This function provides a typical configuration for
//! those pin(s). Other configurations may work as well depending upon the
//! board setup (for example, using the on-chip pull-ups).
//!
//! \note If a UART pin is not intended to be used, then the parameter in the
//! function should be \ref IOID_UNUSED.
//!
//! \param ui32Base is the base address of the UART module.
//! \param ui32Rx is the IO Id of the IO to use as UART Receive.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Tx is the IO Id of the IO to use as UART Transmit.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Cts is the IO Id of the IO to use for UART Clear to send.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Rts is the IO Id of the IO to use for UART Request to send.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeUart(uint32_t ui32Base, uint32_t ui32Rx,
                           uint32_t ui32Tx, uint32_t ui32Cts,
                           uint32_t ui32Rts);

//*****************************************************************************
//
//! \brief Configure a set of IOs for standard SSI peripheral master control.
//!
//! \param ui32Base is the base address of the SSI module to connect to the IOs
//! \param ui32Rx is the IO to connect to the SSI MISO line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Tx is the IO to connect to the SSI MOSI line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Fss is the IO to connect to the SSI FSS line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Clk is the IO to connect to the SSI Clock output line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeSsiMaster(uint32_t ui32Base, uint32_t ui32Rx,
                                uint32_t ui32Tx, uint32_t ui32Fss,
                                uint32_t ui32Clk);

//*****************************************************************************
//
//! \brief Configure a set of IOs for standard SSI peripheral slave control.
//!
//! \param ui32Base is the base address of the SSI module to connect to the IOs
//! \param ui32Rx is the IO to connect to the SSI MOSI line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Tx is the IO to connect to the SSI MISO line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Fss is the IO to connect to the SSI FSS line.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Clk is the IO to connect to the SSI Clock input line.
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeSsiSlave(uint32_t ui32Base, uint32_t ui32Rx,
                               uint32_t ui32Tx, uint32_t ui32Fss,
                               uint32_t ui32Clk);

//*****************************************************************************
//
//! \brief Configure a set of IOs for standard I2C peripheral control.
//!
//! \param ui32Base is the base address of the I2C module to connect to the IOs
//! \param ui32Data is the I2C data line
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//! \param ui32Clk is the I2C input clock
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeI2c(uint32_t ui32Base, uint32_t ui32Data,
                          uint32_t ui32Clk);

//*****************************************************************************
//
//! \brief Configure an IO for AUX control.
//!
//! Use this function to enable AUX to control a specific IO. Please note, that
//! when using AUX to control the IO, the input/output control in the IOC is
//! bypassed and completely controlled by AUX, so enabling or disabling input
//! in the IOC has no effect.
//!
//! \note The IOs available for AUX control can vary from device to device.
//!
//! \param ui32IOId is the IO to setup for AUX usage.
//! - \ref IOID_0
//! - ...
//! - \ref IOID_31
//! - \ref IOID_UNUSED
//!
//! \return None
//
//*****************************************************************************
extern void IOCPinTypeAux(uint32_t ui32IOId);

//*****************************************************************************
//
// Support for DriverLib in ROM:
// Redirect to implementation in ROM when available.
//
//*****************************************************************************
#if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
    #include <driverlib/rom.h>
    #ifdef ROM_IOCPortConfigureSet
        #undef  IOCPortConfigureSet
        #define IOCPortConfigureSet             ROM_IOCPortConfigureSet
    #endif
    #ifdef ROM_IOCPortConfigureGet
        #undef  IOCPortConfigureGet
        #define IOCPortConfigureGet             ROM_IOCPortConfigureGet
    #endif
    #ifdef ROM_IOCIOShutdownSet
        #undef  IOCIOShutdownSet
        #define IOCIOShutdownSet                ROM_IOCIOShutdownSet
    #endif
    #ifdef ROM_IOCIOModeSet
        #undef  IOCIOModeSet
        #define IOCIOModeSet                    ROM_IOCIOModeSet
    #endif
    #ifdef ROM_IOCIOIntSet
        #undef  IOCIOIntSet
        #define IOCIOIntSet                     ROM_IOCIOIntSet
    #endif
    #ifdef ROM_IOCIOPortPullSet
        #undef  IOCIOPortPullSet
        #define IOCIOPortPullSet                ROM_IOCIOPortPullSet
    #endif
    #ifdef ROM_IOCIOHystSet
        #undef  IOCIOHystSet
        #define IOCIOHystSet                    ROM_IOCIOHystSet
    #endif
    #ifdef ROM_IOCIOInputSet
        #undef  IOCIOInputSet
        #define IOCIOInputSet                   ROM_IOCIOInputSet
    #endif
    #ifdef ROM_IOCIOSlewCtrlSet
        #undef  IOCIOSlewCtrlSet
        #define IOCIOSlewCtrlSet                ROM_IOCIOSlewCtrlSet
    #endif
    #ifdef ROM_IOCIODrvStrengthSet
        #undef  IOCIODrvStrengthSet
        #define IOCIODrvStrengthSet             ROM_IOCIODrvStrengthSet
    #endif
    #ifdef ROM_IOCIOPortIdSet
        #undef  IOCIOPortIdSet
        #define IOCIOPortIdSet                  ROM_IOCIOPortIdSet
    #endif
    #ifdef ROM_IOCIntEnable
        #undef  IOCIntEnable
        #define IOCIntEnable                    ROM_IOCIntEnable
    #endif
    #ifdef ROM_IOCIntDisable
        #undef  IOCIntDisable
        #define IOCIntDisable                   ROM_IOCIntDisable
    #endif
    #ifdef ROM_IOCPinTypeGpioInput
        #undef  IOCPinTypeGpioInput
        #define IOCPinTypeGpioInput             ROM_IOCPinTypeGpioInput
    #endif
    #ifdef ROM_IOCPinTypeGpioOutput
        #undef  IOCPinTypeGpioOutput
        #define IOCPinTypeGpioOutput            ROM_IOCPinTypeGpioOutput
    #endif
    #ifdef ROM_IOCPinTypeUart
        #undef  IOCPinTypeUart
        #define IOCPinTypeUart                  ROM_IOCPinTypeUart
    #endif
    #ifdef ROM_IOCPinTypeSsiMaster
        #undef  IOCPinTypeSsiMaster
        #define IOCPinTypeSsiMaster             ROM_IOCPinTypeSsiMaster
    #endif
    #ifdef ROM_IOCPinTypeSsiSlave
        #undef  IOCPinTypeSsiSlave
        #define IOCPinTypeSsiSlave              ROM_IOCPinTypeSsiSlave
    #endif
    #ifdef ROM_IOCPinTypeI2c
        #undef  IOCPinTypeI2c
        #define IOCPinTypeI2c                   ROM_IOCPinTypeI2c
    #endif
    #ifdef ROM_IOCPinTypeAux
        #undef  IOCPinTypeAux
        #define IOCPinTypeAux                   ROM_IOCPinTypeAux
    #endif
#endif

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif // __IOC_H__

//*****************************************************************************
//
//! Close the Doxygen group.
//! @}
//! @}
//
//*****************************************************************************


text:
package net.sourceforge.plantuml.style;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CssVariables {

	private final Map<String, String> variables = new HashMap<>();

	private final Pattern learnPattern = Pattern.compile("^--([_\\w][-_\\w]+)[ :]+(.*?);?");
	private final Pattern retrieve = Pattern.compile("var\\(-*([_\\w][-_\\w]+)\\)");

	public void learn(String s) {
		final Matcher m = learnPattern.matcher(s);
		if (m.matches())
			variables.put(m.group(1), m.group(2));
	}

	public String value(String v) {
		if (v.startsWith("var(")) {
			final Matcher m = retrieve.matcher(v);
			if (m.matches()) {
				final String varname = m.group(1);
				final String result = variables.get(varname);
				if (result != null)
					return result;
			}
		}
		return v;
	}

}


text:
from __future__ import unicode_literals

from django.conf.urls import url
from django.contrib.auth.decorators import login_required

from .forms import AdvancedSearchForm
from . import views

urlpatterns = [
    url(r'^$', login_required(views.SearchView(
        template='spirit/search/search.html',
        form_class=AdvancedSearchForm)
    ), name='search'),
]


text:
<?php

namespace FooNamespace;

use function phpversion;

class Foo
{

	public function boo()
	{
		phpversion();
		\phpversion();
	}

}


text:
using System;
using System.Threading;

namespace Kirkin.Caching.Internal
{
    /// <summary>
    /// Thread-safe cache capable of holding a single key/value combination at any given time.
    /// </summary>
    internal sealed class SingleKeyValueCache<TKey, TValue>
        : IKeyValueCache<TKey, TValue>
    {
        // Immutable state.
        private readonly Func<TKey, TValue> ValueFactory;
        private readonly object CreateValueLock = new object();

        // Mutable state.
        private Box ValueBox;

        /// <summary>
        /// Creates a new instance of <see cref="SingleKeyValueCache{TKey, TValue}"/>
        /// with the given value-producting delegate.
        /// </summary>
        public SingleKeyValueCache(Func<TKey, TValue> valueFactory)
        {
            if (valueFactory == null) throw new ArgumentNullException(nameof(valueFactory));

            ValueFactory = valueFactory;
        }

        /// <summary>
        /// Returns the cached value appropriate for the given key initialising it if necessary.
        /// </summary>
        public TValue GetValue(TKey key)
        {
            return TryGetValue(key, out TValue value) ? value : GetValueSlow(key);
        }

        /// <summary>
        /// Retrieves the value associated with the given
        /// key if it exists, immediately, without locking.
        /// </summary>
        private bool TryGetValue(TKey key, out TValue value)
        {
            // Non-volatile read. Worst case scenario is we won't see
            // the latest value, lock on CreateValueLock and get it then.
            Box box = ValueBox;

            if (box != null && Equals(key, box.Key))
            {
                value = box.Value;
                return true;
            }

            value = default(TValue);
            return false;
        }

        /// <summary>
        /// Retrieves the value associated with the given
        /// key. Creates and stores the value if necessary.
        /// </summary>
        private TValue GetValueSlow(TKey key)
        {
            TValue value;

            lock (CreateValueLock)
            {
                if (TryGetValue(key, out value)) {
                    return value;
                }

                // Create and store value.
                value = ValueFactory(key);

                ValueBox = new Box {
                    Key = key,
                    Value = value
                };
            }

            return value;
        }

        /// <summary>
        /// Returns true if the cache contains a valid value for the given key.
        /// </summary>
        public bool IsValid(TKey key)
        {
            Box box = Volatile.Read(ref ValueBox);

            return box != null
                && Equals(key, box.Key);
        }

        /// <summary>
        /// Invalidates the cache causing it to be rebuilt.
        /// </summary>
        public void Invalidate(TKey key)
        {
            Box box = Volatile.Read(ref ValueBox);

            if (box != null && Equals(box.Key, key)) {
                Interlocked.CompareExchange(ref ValueBox, null, box);
            }
        }

        sealed class Box
        {
            internal TKey Key;
            internal TValue Value;
        }
    }
}


text:
package sample.profile.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

@Component
@Profile({ "generic" })
public class GenericService implements MessageService {

	@Value("${hello:Hello}")
	private String hello;

	@Value("${name:World}")
	private String name;

	@Override
	public String getMessage() {
		return this.hello + " " + this.name;
	}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
M-Index
</TITLE>

<META NAME="date" CONTENT="2011-06-07">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A C D E F G I K L M N O P R S T U V W X Y

M

main(String[]) -
Static method in class Asteroids

The main function.

MainSpace - Class in gui

MainSpace() -
Constructor for class gui.MainSpace

Default constructor of MainSpace.

makeMenu() -
Method in class gui.MainSpace

Creates the Menu bar and its components.

makeTimers() -
Method in class gui.AsteroidsSpace

Initializes the frame's timers.

menu -
Variable in class gui.AsteroidsSpace

menu -
Variable in class gui.MainSpace

menuPanel -
Variable in class gui.AsteroidsSpace

menuPanel -
Variable in class gui.MainSpace

moveEnemy(Enemy) -
Method in class Logic.Command

Moves the enemy by one.

moveEnemy() -
Method in class Test.AsteroidTest

moveShots(Shot) -
Method in class Logic.Command

Moves the current shots in-game.

moveSpaceShip(char, Spaceship, int) -
Method in class Logic.Command

Moves the Spaceship in the game.

moveSpaceShipLeft() -
Method in class Test.AsteroidTest

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A C D E F G I K L M N O P R S T U V W X Y


text:
#pragma once
#include <assert.h>
#include <string>

//#define MEMORY_LEAK_DEBUG

// -------------------------- USAGE INFO ----------------------------
/*

// T.h:
class T {
private:
	MEMORY_LEAK_DETECTOR(T);
};

// T.cpp:
MEMORY_LEAK_DETECTOR_INIT(T);

// stdafx.cpp:
MemoryLeakDetection::Tracker MemoryLeakTracker;

*/

namespace stlx::MemoryLeakDetection {
	struct Tracker {
		static const size_t MaxObjects = 256 * 128;
		~Tracker() {
			std::string str;
			for(size_t i = 0; i < NumObjects; i++)
			{
				if(Count[i] == 0)
					continue;

				//DebugBreak();
				str += format("\n{}: {}", Names[i], Count[i]);
			}

			if(!str.empty())
			{
				MessageBox(0, format("Detected memory leak for objects: {}",
											str).c_str(),
							  "Memory leak detected", MB_OK);
			}
		}

		const char * Names[MaxObjects];
		size_t Count[MaxObjects];
		size_t NumObjects;
#ifdef MEMORY_LEAK_DEBUG
		Vector<void*> * Ptrs[MaxObjects];
#endif
	};
};

extern stlx::MemoryLeakDetection::Tracker MemoryLeakTracker;

namespace stlx::MemoryLeakDetection {
	template <typename T>
	struct Instance {
		static size_t ID;
		T* ptr;

#ifdef MEMORY_LEAK_DEBUG
		Instance(T* ptr_)
			: ptr(ptr_)
		{
			Construct();
		}
		Instance(const Instance& rhs)
		{
			ptr = rhs.ptr;
			Construct();
		}
		Instance(Instance&& rhs)
		{
			ptr = rhs.ptr;
			Construct();
		}
		Instance& operator=(const Instance& rhs)
		{
			ptr = rhs.ptr;
			return *this;
		}
		Instance& operator=(Instance&& rhs)
		{
			ptr = rhs.ptr;
			return *this;
		}

		FORCEINLINE void Construct()
		{
			++MemoryLeakTracker.Count[ID];
			* MemoryLeakTracker.Ptrs[ID] += ptr;
		}
		~Instance()
		{
			* MemoryLeakTracker.Ptrs[ID] -= ptr;
			--MemoryLeakTracker.Count[ID];
		}
#else
		Instance()
		{
			Construct();
		}
		Instance(const Instance&)
		{
			Construct();
		}
		Instance(Instance&&)
		{
			Construct();
		}
		Instance& operator=(const Instance&)
		{
			return *this;
		}
		Instance& operator=(Instance&&)
		{
			return *this;
		}

		FORCEINLINE void Construct()
		{
			++MemoryLeakTracker.Count[ID];
		}
		~Instance()
		{
			--MemoryLeakTracker.Count[ID];
		}
#endif
	};

	template <typename T>
	struct Init {
		Init(const char * name)
		{
			Instance<T>::ID = MemoryLeakTracker.NumObjects;
			MemoryLeakTracker.Names[MemoryLeakTracker.NumObjects] = name;
#ifdef MEMORY_LEAK_DEBUG
			MemoryLeakTracker.Ptrs[MemoryLeakTracker.NumObjects] = new Vector<void*>();
#endif
			MemoryLeakTracker.NumObjects++;
			assert(MemoryLeakTracker.NumObjects < Tracker::MaxObjects);
		}
	};
};

#ifdef MEMORY_LEAK_DEBUG
#define MEMORY_LEAK_DETECTOR(T)	stlx::MemoryLeakDetection::Instance<T> __object_tracker{this};
#else
#define MEMORY_LEAK_DETECTOR(T)	stlx::MemoryLeakDetection::Instance<T> __object_tracker;
#endif

#define MEMORY_LEAK_DETECTOR_INIT(T) \
	size_t stlx::MemoryLeakDetection::Instance<T>::ID; \
	namespace stlx::MemoryLeakDetection{ \
		namespace { Init<T> __init(#T); }; \
		};
#define MEMORY_LEAK_DETECTOR_INIT_NS(T, ns) \
	size_t stlx::MemoryLeakDetection::Instance<T>::ID; \
	namespace stlx::MemoryLeakDetection{ \
		namespace ns { Init<T> __init(#T); }; \
		};


text:
'use strict';

var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;

var shorthand_for = {
  'border-bottom-width': require('./borderBottomWidth'),
  'border-bottom-style': require('./borderBottomStyle'),
  'border-bottom-color': require('./borderBottomColor'),
};

module.exports.definition = {
  set: shorthandSetter('border-bottom', shorthand_for),
  get: shorthandGetter('border-bottom', shorthand_for),
  enumerable: true,
  configurable: true,
};


text:
package com.wj.caidengmi2;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class SqlHelper {
	public  static final String DB_NAME = "data/data/com.game.zhongqiuguess/databases/dengmi.db";

	public void Insert(Context context,String table, ContentValues values){
		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(DB_NAME, null);
		try{
			db.insert(table, null, values);
		}catch(Exception e){
				e.getStackTrace();
		}
		db.close();
}

	public void CreateTable(Context context,String table){
		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(
				DB_NAME, null);
		String sql="CREATE TABLE " + table + " ( id text not null, type text not null, score text not null);";
		try{
			db.execSQL(sql);
		}catch(Exception e){
			e.getStackTrace();
		}
		db.close();
	}

	public void Update(Context context,String table, ContentValues values, String whereClause, String[] whereArgs){
		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(DB_NAME, null);
		try{
			db.update(table, values, whereClause, whereArgs);
		}catch(Exception e){
			e.getStackTrace();
		}
		db.close();
	}

	public Cursor Query(Context context,String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy){
		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(DB_NAME, null);
		Cursor cursor = null ;
		try{
			cursor=db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
			Log.i("wordroid=", "query");
			Log.i("countofcursor=",""+cursor.getCount());
		}catch(Exception e){
			e.getStackTrace();
		}
		db.close();
		return cursor;

	}

	public void Delete(Context context,String table, String whereClause, String[] whereArgs){
		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(
				DB_NAME, null);
		try{
			db.delete(table, whereClause, whereArgs);
			Log.i("wordroid=", "delete");
			}
			catch(Exception e){
				e.getStackTrace();
			}
		db.close();
	}

	public void DeleteTable(Context context,String table){

		SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(
				DB_NAME, null);
		String sql="drop table " + table;
		try{
		db.execSQL(sql);
		Log.i("wordroid=", sql);
		}
		catch(Exception e){
			e.getStackTrace();
		}
		db.close();
	}
}


text:
.. title:: Home

.. raw:: html

.. raw:: html

MNE is a community-driven software package designed for for **processing
electroencephalography (EEG) and magnetoencephalography (MEG) data**
providing comprehensive tools and workflows for:

1. Preprocessing
2. Source estimation
3. Time–frequency analysis
4. Statistical testing
5. Estimation of functional connectivity
6. Applying machine learning algorithms
7. Visualization of sensor- and source-space data

MNE includes a comprehensive Python package (provided under the simplified
BSD license), supplemented by tools compiled from C code for the LINUX and
Mac OSX operating systems, as well as a MATLAB toolbox.

**From raw data to source estimates in about 30 lines of code:**

.. code:: python

    >>> import mne
    >>> raw = mne.io.Raw('raw.fif', preload=True)  # load data
    >>> raw.info['bads'] = ['MEG 2443', 'EEG 053']  # mark bad channels
    >>> raw.filter(l_freq=None, h_freq=40.0)  # low-pass filter data
    >>> # Extract epochs and save them:
    >>> picks = mne.pick_types(raw.info, meg=True, eeg=True, eog=True,
    >>>                        exclude='bads')
    >>> events = mne.find_events(raw)
    >>> reject = dict(grad=4000e-13, mag=4e-12, eog=150e-6)
    >>> epochs = mne.Epochs(raw, events, event_id=1, tmin=-0.2, tmax=0.5,
    >>>                     proj=True, picks=picks, baseline=(None, 0),
    >>>                     preload=True, reject=reject)
    >>> # Compute evoked response and noise covariance
    >>> evoked = epochs.average()
    >>> cov = mne.compute_covariance(epochs, tmax=0)
    >>> evoked.plot()  # plot evoked
    >>> # Compute inverse operator:
    >>> fwd_fname = 'sample_audvis−meg−eeg−oct−6−fwd.fif'
    >>> fwd = mne.read_forward_solution(fwd_fname, surf_ori=True)
    >>> inv = mne.minimum_norm.make_inverse_operator(raw.info, fwd,
    >>>                                              cov, loose=0.2)
    >>> # Compute inverse solution:
    >>> stc = mne.minimum_norm.apply_inverse(evoked, inv, lambda2=1./9.,
    >>>                                      method='dSPM')
    >>> # Morph it to average brain for group study and plot it
    >>> stc_avg = mne.morph_data('sample', 'fsaverage', stc, 5, smooth=5)
    >>> stc_avg.plot()

The MNE development is supported by National Institute of Biomedical Imaging and Bioengineering
grants 5R01EB009048 and P41EB015896 (Center for Functional Neuroimaging Technologies) as well as
NSF awards 0958669 and 1042134. It has been supported by the
NCRR *Center for Functional Neuroimaging Technologies* P41RR14075-06, the
NIH grants 1R01EB009048-01, R01 EB006385-A101, 1R01 HD40712-A1, 1R01
NS44319-01, and 2R01 NS37462-05, ell as by Department of Energy
under Award Number DE-FG02-99ER62764 to The MIND Institute.

.. raw:: html

.. raw:: html

Documentation

.. toctree::
   :maxdepth: 1

   getting_started
   whats_new
   cite
   references
   tutorials
   auto_examples/index
   manual/index
   python_reference
   generated/commands
   faq
   advanced_setup
   mne_cpp

.. raw:: html

Community

* | Analysis talk: join the
  | `MNE mailing list <http://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis>`_

* | Feature requests and bug reports:
  | `GitHub issues <https://github.com/mne-tools/mne-python/issues/>`_

* | Chat with developers:
  | `Gitter <https://gitter.im/mne-tools/mne-python>`_

* :ref:`Contribute to MNE! <contributing>`

.. raw:: html

Versions

Stable

Development

       Tweets by @mne_python