text:
package com.auth0.android.lock;

import android.content.Intent;

import com.auth0.android.authentication.AuthenticationException;
import com.auth0.android.lock.LockCallback.LockEvent;
import com.auth0.android.lock.utils.MockLockCallback;
import com.auth0.android.result.Credentials;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.Date;

import static com.auth0.android.lock.utils.AuthenticationCallbackMatcher.hasAuthentication;
import static com.auth0.android.lock.utils.AuthenticationCallbackMatcher.hasError;
import static com.auth0.android.lock.utils.AuthenticationCallbackMatcher.hasNoError;
import static com.auth0.android.lock.utils.AuthenticationCallbackMatcher.isCanceled;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = 21)
public class AuthenticationCallbackTest {

    private MockLockCallback callback;

    @Before
    public void setUp() {
        callback = new MockLockCallback();
    }

    @Test
    public void shouldCallOnAuthentication() {
        Intent data = getAuthenticationData();
        callback.onEvent(LockEvent.AUTHENTICATION, data);

        assertThat(callback, hasAuthentication());
        assertThat(callback, hasNoError());
    }

    @Test
    public void shouldReturnAuthentication() {
        Intent data = getAuthenticationData();
        callback.onEvent(LockEvent.AUTHENTICATION, data);
        Credentials credentials = credentialsFromData(data);

        assertThat(callback.getCredentials().getAccessToken(), equalTo(credentials.getAccessToken()));
        assertThat(callback.getCredentials().getIdToken(), equalTo(credentials.getIdToken()));
        assertThat(callback.getCredentials().getRefreshToken(), equalTo(credentials.getRefreshToken()));
        assertThat(callback.getCredentials().getType(), equalTo(credentials.getType()));
        assertThat(callback.getCredentials().getExpiresAt(), equalTo(credentials.getExpiresAt()));
        assertThat(callback.getCredentials().getScope(), equalTo(credentials.getScope()));
        assertThat(callback, hasNoError());
    }

    @Test
    public void shouldReturnAuthenticationError() {
        Intent data = new Intent();
        AuthenticationException error = new AuthenticationException("err_code", "err description");
        data.putExtra(Constants.EXCEPTION_EXTRA, error);
        callback.onEvent(LockEvent.AUTHENTICATION, data);

        assertThat(callback, hasError());
    }

    @Test
    public void shouldCallOnCanceled() {
        Intent data = new Intent();
        callback.onEvent(LockEvent.CANCELED, data);

        assertThat(callback, isCanceled());
        assertThat(callback, hasError());
    }

    @Test
    public void shouldNotAuthenticateOrCancelWhenSignUp() {
        Intent data = new Intent();
        callback.onEvent(LockEvent.SIGN_UP, data);

        assertThat(callback, not(hasAuthentication()));
        assertThat(callback, not(isCanceled()));
        assertThat(callback, hasNoError());
    }

    @Test
    public void shouldNotAuthenticateOrCancelWhenResetPassword() {
        Intent data = new Intent();
        callback.onEvent(LockEvent.RESET_PASSWORD, data);

        assertThat(callback, not(hasAuthentication()));
        assertThat(callback, not(isCanceled()));
        assertThat(callback, hasNoError());
    }

    public Intent getAuthenticationData() {
        Intent i = new Intent(Constants.AUTHENTICATION_ACTION);
        i.putExtra(Constants.ID_TOKEN_EXTRA, "idToken");
        i.putExtra(Constants.ACCESS_TOKEN_EXTRA, "accessToken");
        i.putExtra(Constants.TOKEN_TYPE_EXTRA, "tokenType");
        i.putExtra(Constants.REFRESH_TOKEN_EXTRA, "refreshToken");
        i.putExtra(Constants.EXPIRES_AT_EXTRA, new Date());
        i.putExtra(Constants.SCOPE_EXTRA, "openid profile");
        return i;
    }

    public Credentials credentialsFromData(Intent data) {
        String idToken = data.getStringExtra(Constants.ID_TOKEN_EXTRA);
        String accessToken = data.getStringExtra(Constants.ACCESS_TOKEN_EXTRA);
        String tokenType = data.getStringExtra(Constants.TOKEN_TYPE_EXTRA);
        String refreshToken = data.getStringExtra(Constants.REFRESH_TOKEN_EXTRA);
        Date expiresAt = (Date) data.getSerializableExtra(Constants.EXPIRES_AT_EXTRA);
        String scope = data.getStringExtra(Constants.SCOPE_EXTRA);

        return new Credentials(idToken, accessToken, tokenType, refreshToken, expiresAt, scope);
    }

}

redpajama_set_name: RedPajamaGithub


text:
LogHandler::LogHandler(const std::string& name, qi::log::Handler handler, qi::LogLevel level)
  : name(name)
  , id(qi::log::addHandler(name, std::move(handler), level))
{
}

LogHandler::~LogHandler()
{
  qi::log::removeHandler(name);
}

MockLogHandler::MockLogHandler(const std::string& name)
  : handler(name, std::ref(*this))
{
  // TODO: Replace unit_t by void once we upgrade GoogleMock with the fix on mock methods returning
  // void crashing in optimized compilation on recent compilers.
  // See: https://github.com/google/googletest/issues/705
  using testing::_;
  ON_CALL(*this, log(_, _, _)).WillByDefault(testing::Return(ka::unit));
}

void MockLogHandler::operator()(qi::LogLevel level,
                                qi::Clock::time_point,
                                qi::SystemClock::time_point,
                                const char* category,
                                const char* message,
                                const char*,
                                const char*,
                                int)
{
  boost::string_ref catStrRef{ category };
  // remove log from the logger itself and the eventloop
  if (catStrRef == "qi.log" || catStrRef == "qi.eventloop")
    return;
  this->log(level, category, message);
}


text:
"""Unit tests for the SARIF JSON security warnings collector."""

from ..source_collector_test_case import SourceCollectorTestCase

class SARIFJSONSecurityWarningsTest(SourceCollectorTestCase):
    """Unit tests for the security warning metric."""

    SOURCE_TYPE = "sarif_json"
    METRIC_TYPE = "security_warnings"
    VULNERABILITIES_JSON = dict(
        runs=[
            dict(
                tool=dict(
                    driver=dict(
                        rules=[
                            dict(
                                id="CVE-2019-18276",
                                shortDescription=dict(text="CVE-2019-18276"),
                                fullDescription=dict(text="An issue was discovered ..."),
                                helpUri="https://avd.aquasec.com/nvd/cve-2019-18276",
                            ),
                        ]
                    )
                ),
                results=[
                    dict(
                        ruleId="CVE-2019-18276",
                        ruleIndex=0,
                        level="warning",
                        message=dict(
                            text="Package: bash\nInstalled Version: 5.0-6ubuntu1.1\nVulnerability ...",
                        ),
                        locations=[
                            dict(
                                physicalLocation=dict(
                                    artifactLocation=dict(
                                        uri="docker.io/ictu/quality-time_database", uriBaseId="ROOTPATH"
                                    ),
                                    region=dict(startLine=1),
                                )
                            )
                        ],
                    ),
                    dict(
                        ruleId="CVE-2019-18276",
                        ruleIndex=0,
                        level="note",
                        message=dict(
                            text="Package: bash\nInstalled Version: 5.0-6ubuntu1.1\nVulnerability ...",
                        ),
                        locations=[
                            dict(
                                physicalLocation=dict(
                                    artifactLocation=dict(
                                        uri="docker.io/ictu/quality-time_server", uriBaseId="ROOTPATH"
                                    ),
                                    region=dict(startLine=1),
                                )
                            )
                        ],
                    ),
                ],
            )
        ]
    )

    async def test_warnings(self):
        """Test the number of security warnings."""
        run = self.VULNERABILITIES_JSON["runs"][0]
        rule = run["tool"]["driver"]["rules"][0]
        results = run["results"]
        expected_entities = [
            dict(
                key="CVE-2019-18276@docker_io-ictu-quality-time_database",
                message=results[0]["message"]["text"],
                level=results[0]["level"],
                locations=results[0]["locations"][0]["physicalLocation"]["artifactLocation"]["uri"],
                rule=rule["shortDescription"]["text"],
                description=rule["fullDescription"]["text"],
                url=rule["helpUri"],
            ),
            dict(
                key="CVE-2019-18276@docker_io-ictu-quality-time_server",
                message=results[1]["message"]["text"],
                level=results[1]["level"],
                locations=results[1]["locations"][0]["physicalLocation"]["artifactLocation"]["uri"],
                rule=rule["shortDescription"]["text"],
                description=rule["fullDescription"]["text"],
                url=rule["helpUri"],
            ),
        ]
        response = await self.collect(get_request_json_return_value=self.VULNERABILITIES_JSON)
        self.assert_measurement(response, value="2", entities=expected_entities)

    async def test_warning_levels(self):
        """Test the number of security warnings when specifying a level."""
        run = self.VULNERABILITIES_JSON["runs"][0]
        rule = run["tool"]["driver"]["rules"][0]
        result = run["results"][0]
        self.set_source_parameter("levels", ["warning", "error"])
        expected_entities = [
            dict(
                key="CVE-2019-18276@docker_io-ictu-quality-time_database",
                message=result["message"]["text"],
                level=result["level"],
                locations=result["locations"][0]["physicalLocation"]["artifactLocation"]["uri"],
                rule=rule["shortDescription"]["text"],
                description=rule["fullDescription"]["text"],
                url=rule["helpUri"],
            )
        ]
        response = await self.collect(get_request_json_return_value=self.VULNERABILITIES_JSON)
        self.assert_measurement(response, value="1", entities=expected_entities)


text:
using System;
using System.IO;
using System.Diagnostics;

using PHP.Core.Parsers;

namespace PHP.Core.AST
{
	/// <summary>
	/// Direct variable use - a variable or a field accessed by an identifier.
	/// </summary>
    [Serializable]
	public sealed class DirectVarUse : SimpleVarUse
	{
        public override Operations Operation { get { return Operations.DirectVarUse; } }

		public VariableName VarName { get { return varName; } set { varName = value; } }
		private VariableName varName;

		public DirectVarUse(Text.Span span, VariableName varName)
            : base(span)
		{
			this.varName = varName;
		}

		public DirectVarUse(Text.Span span, string/*!*/ varName)
            : base(span)
		{
			this.varName = new VariableName(varName);
		}

		/// <summary>
        /// Call the right Visit* method on the given Visitor object.
        /// </summary>
        /// <param name="visitor">Visitor to be called.</param>
        public override void VisitMe(TreeVisitor visitor)
        {
            visitor.VisitDirectVarUse(this);
        }
	}
}


text:
/**
 *
 */
import { Params, TransformFn } from './Transform/Types';

import { composeCacheKey, composeTransform, ConstTrue } from './Transform/Compose';

import * as Babel from './Transform/Babel';
import * as TypeScript from './Transform/TypeScript';

export * from './Transform/Types';
export { Babel };
export { TypeScript };
export { composeCacheKey, composeTransform, ConstTrue };

function typeScriptFilter({filename}: Params<{}>): boolean {
  return filename.endsWith('.ts') || filename.endsWith('.tsx');
}

export let transform = composeTransform(TypeScript.transform, Babel.transform, typeScriptFilter, ConstTrue);
export let getCacheKey = composeCacheKey(TypeScript.getCacheKey, Babel.getCacheKey);


text:
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_text_oarchive.hpp

// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for updates, documentation, and revision history.

#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#else

#include <boost/archive/text_woarchive.hpp>
#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>

namespace boost {
namespace archive {

typedef detail::polymorphic_oarchive_impl<
        text_woarchive_impl<text_woarchive>
> polymorphic_text_woarchive;

} // namespace archive
} // namespace boost

// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
    boost::archive::polymorphic_text_woarchive
)

#endif // BOOST_NO_STD_WSTREAMBUF
#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP


text:
#pragma once

#include <pcl/common/common.h>

#include <pcl/ml/dt/decision_tree.h>

#include <istream>
#include <ostream>

namespace pcl
{

  /** \brief Class representing a decision forest. */
  template <class NodeType>
  class PCL_EXPORTS DecisionForest
    : public std::vector<pcl::DecisionTree<NodeType> >
  {

    public:

      /** \brief Constructor. */
      DecisionForest () {}
      /** \brief Destructor. */
      virtual
      ~DecisionForest () {}

      /* \brief Adds the specified tree to the forest.
      * \param[in] tree The tree to be added to the forest. */
      //
      //void
      //addTree (DecisionTree<NodeType> & tree)
      //{
      //  trees_.push_back (tree);
      //}

      ///brief Returns the number of trees in the forest.
      //inline size_t

      /** \brief Serializes the decision tree.
        * \param[out] stream The destination for the serialization.
        */
      void
      serialize (::std::ostream &stream) const
      {
        const int num_of_trees = static_cast<int> (this->size ());
        stream.write (reinterpret_cast<const char*> (&num_of_trees), sizeof (num_of_trees));

        for (size_t tree_index = 0; tree_index < this->size (); ++tree_index)
        {
          (*this) [tree_index].serialize (stream);
        }

        //const int num_of_trees = static_cast<int> (trees_.size ());
        //stream.write (reinterpret_cast<const char*> (&num_of_trees), sizeof (num_of_trees));

        //for (size_t tree_index = 0; tree_index < trees_.size (); ++tree_index)
        //{
        //  tree_[tree_index].serialize (stream);
        //}
      }

      /** \brief Deserializes the decision tree.
        * \param[in] stream The source for the deserialization.
        */
      void
      deserialize (::std::istream & stream)
      {
        int num_of_trees;
        stream.read (reinterpret_cast<char*> (&num_of_trees), sizeof (num_of_trees));
        this->resize (num_of_trees);

        for (size_t tree_index = 0; tree_index < this->size (); ++tree_index)
        {
          (*this) [tree_index].deserialize (stream);
        }

        //int num_of_trees;
        //stream.read (reinterpret_cast<char*> (&num_of_trees), sizeof (num_of_trees));
        //trees_.resize (num_of_trees);

        //for (size_t tree_index = 0; tree_index < trees_.size (); ++tree_index)
        //{
        //  tree_[tree_index].deserialize (stream);
        //}
      }

    private:

      /** \brief The decision trees contained in the forest. */
      //std::vector<DecisionTree<NodeType> > trees_;

  };

}


text:
Unobtrusive Finite State Machine

##Code Example

Here's a complete example that shows how easy it is to get started:
(Please see the Wiki for more usage and project information.)

        using FSMLight;

        namespace FSMDemo
        {

            class Program
            {

                static void Main(string[] args)
                {
                    try
                    {
                        var machine = new MyMachine();

                        while (machine.SingleStep())
                        {
                            Console.WriteLine("tick");
                        }

                    }
                    catch(FSMException e)
                    {
                        Console.WriteLine("FSM Issue: " + e.Message);
                    }
                    Console.ReadLine();
                }

                public class MyMachine : FSM
                {

                    const int INITED = 1;
                    const int RUNNING = 2;
                    const int ERROR = 3;
                    const int DONE = 4;

                    Random rand;

                    public MyMachine()
                    {

                    }

                    [Outputs(RUNNING)]
                    public int Init()
                    {
                        if(rand==null)
                            rand = new Random();
                        return RUNNING;
                    }

                    [Inputs(RUNNING), Outputs(RUNNING,ERROR,DONE)]
                    public int DoIt()
                    {
                        if (!Console.KeyAvailable)
                            return RUNNING;
                        else
                        {
                            var key = Console.ReadKey(true);
                            if(key.Key == ConsoleKey.Escape)
                            {
                                return DONE;
                            }
                            else if(key.Key == ConsoleKey.E)
                                return ERROR;
                            else
                            {
                                Console.WriteLine("Got: " + key.Key.ToString());
                                return RUNNING;
                            }
                        }
                    }

                    [Inputs(ERROR)]
                    public int Err()
                    {
                        Console.WriteLine("Err()");
                        return DEFAULT;
                    }

                    [Inputs(DONE)]
                    public int Done()
                    {
                        Console.WriteLine("Done()");
                        return FINISHED;
                    }
                }
            }

        }


text:
<?php

namespace OC\Group;

use OC\Hooks\PublicEmitter;

/**
 * Class Manager
 *
 * Hooks available in scope \OC\Group:
 * - preAddUser(\OC\Group\Group $group, \OC\User\User $user)
 * - postAddUser(\OC\Group\Group $group, \OC\User\User $user)
 * - preRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
 * - postRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
 * - preDelete(\OC\Group\Group $group)
 * - postDelete(\OC\Group\Group $group)
 * - preCreate(string $groupId)
 * - postCreate(\OC\Group\Group $group)
 *
 * @package OC\Group
 */
class Manager extends PublicEmitter {
	/**
	 * @var \OC_Group_Backend[] | \OC_Group_Database[] $backends
	 */
	private $backends = array();

	/**
	 * @var \OC\User\Manager $userManager
	 */
	private $userManager;

	/**
	 * @var \OC\Group\Group[]
	 */
	private $cachedGroups;

	/**
	 * @param \OC\User\Manager $userManager
	 */
	public function __construct($userManager) {
		$this->userManager = $userManager;
		$cache = & $this->cachedGroups;
		$this->listen('\OC\Group', 'postDelete', function ($group) use (&$cache) {
			/**
			 * @var \OC\Group\Group $group
			 */
			unset($cache[$group->getGID()]);
		});
	}

	/**
	 * @param \OC_Group_Backend $backend
	 */
	public function addBackend($backend) {
		$this->backends[] = $backend;
	}

	public function clearBackends() {
		$this->backends = array();
		$this->cachedGroups = array();
	}

	/**
	 * @param string $gid
	 * @return \OC\Group\Group
	 */
	public function get($gid) {
		if (isset($this->cachedGroups[$gid])) {
			return $this->cachedGroups[$gid];
		}
		foreach ($this->backends as $backend) {
			if ($backend->groupExists($gid)) {
				return $this->getGroupObject($gid);
			}
		}
		return null;
	}

	protected function getGroupObject($gid) {
		$backends = array();
		foreach ($this->backends as $backend) {
			if ($backend->groupExists($gid)) {
				$backends[] = $backend;
			}
		}
		$this->cachedGroups[$gid] = new Group($gid, $backends, $this->userManager, $this);
		return $this->cachedGroups[$gid];
	}

	/**
	 * @param string $gid
	 * @return bool
	 */
	public function groupExists($gid) {
		return !is_null($this->get($gid));
	}

	/**
	 * @param string $gid
	 * @return \OC\Group\Group
	 */
	public function createGroup($gid) {
		if (!$gid) {
			return false;
		} else if ($this->groupExists($gid)) {
			return $this->get($gid);
		} else {
			$this->emit('\OC\Group', 'preCreate', array($gid));
			foreach ($this->backends as $backend) {
				if ($backend->implementsActions(OC_GROUP_BACKEND_CREATE_GROUP)) {
					$backend->createGroup($gid);
					$group = $this->getGroupObject($gid);
					$this->emit('\OC\Group', 'postCreate', array($group));
					return $group;
				}
			}
			return null;
		}
	}

	/**
	 * @param string $search
	 * @param int $limit
	 * @param int $offset
	 * @return \OC\Group\Group[]
	 */
	public function search($search, $limit = null, $offset = null) {
		$groups = array();
		foreach ($this->backends as $backend) {
			$groupIds = $backend->getGroups($search, $limit, $offset);
			foreach ($groupIds as $groupId) {
				$groups[$groupId] = $this->getGroupObject($groupId);
			}
			if (!is_null($limit) and $limit <= 0) {
				return array_values($groups);
			}
		}
		return array_values($groups);
	}

	/**
	 * @param \OC\User\User $user
	 * @return \OC\Group\Group[]
	 */
	public function getUserGroups($user) {
		$groups = array();
		foreach ($this->backends as $backend) {
			$groupIds = $backend->getUserGroups($user->getUID());
			foreach ($groupIds as $groupId) {
				$groups[$groupId] = $this->getGroupObject($groupId);
			}
		}
		return array_values($groups);
	}

	/**
	 * @brief get a list of all display names in a group
	 * @param string $gid
	 * @param string $search
	 * @param int $limit
	 * @param int $offset
	 * @return array with display names (value) and user ids (key)
	 */
	public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
		$group = $this->get($gid);
		if(is_null($group)) {
			return array();
		}
		// only user backends have the capability to do a complex search for users
		$groupUsers  = $group->searchUsers('', $limit, $offset);
		$search = trim($search);
		if(!empty($search)) {
			//TODO: for OC 7 earliest: user backend should get a method to check selected users against a pattern
			$filteredUsers = $this->userManager->search($search);
			$testUsers = true;
		} else {
			$filteredUsers = array();
			$testUsers = false;
		}

		$matchingUsers = array();
		foreach($groupUsers as $user) {
			if(!$testUsers || isset($filteredUsers[$user->getUID()])) {
				$matchingUsers[$user->getUID()] = $user->getDisplayName();
			}
		}
		return $matchingUsers;
	}
}


text:
"""
@file gen_hdf5_feat.py
@brief dump handcrafted features into hdf5 format
@author ChenglongChen
"""

import sys
import csv
import h5py
import numpy as np
import pandas as pd
from string import atoi
import warnings
warnings.filterwarnings("ignore")

def genLabelMapper(sample_submission_file):
    """This function generates mapper for mapping fine-grained label to
    coarse-grained label using the sample submission and/or the tree"""

    # read in header
    header = csv.reader( file(sample_submission_file) ).next()
    header = header[1:]

    # make class map
    label_mapper = {}
    coarse_labels = [ header[0].split("_")[0] ]
    cnt = 0
    for i,h in enumerate(header):
        h2 = h.split("_")[0]
        if not h2 in coarse_labels:
            cnt += 1
            coarse_labels.append(h2)
        label_mapper[h] = cnt

    return label_mapper

def applyLabelMap(label_string, label_mapper):
    """This function applies mapping from fine-grained label to
    coarse-grained label using the given label mapper"""

    label = np.zeros( (label_string.shape[0],1), dtype="float32" )
    for i,f in enumerate(label_string):
        label[i] = label_mapper[ f.split("/")[0] ]

    return label

def main():
    """Main function"""

    # collect argvs
    sample_submission_file = sys.argv[1]
    feature_file = sys.argv[2]
    hdf5_out = sys.argv[3]
    chunksize = atoi(sys.argv[4])
    task = sys.argv[5]

    # generate label mapper
    label_mapper = genLabelMapper(sample_submission_file)

    # check the size of the feature matrix: num_sample x num_feat
    num_sample = len( open(feature_file, "rb").readlines() )
    num_feat = len( open(feature_file, "rb").readline().split('\t') ) - 1
    print "Convert HDF5] #Sample: %s" % num_sample
    print "Convert HDF5] #Feature: %s" % num_feat

    # read in feature matrix in chunk
    reader = pd.read_table( feature_file, sep='\t', chunksize=chunksize, header=None )
    cnt = 0
    h5py_files = []
    for i,chunk in enumerate( reader ):
        val = chunk.values
        num = val.shape[0]
        feat = np.asarray( val[:, 1:, np.newaxis, np.newaxis], dtype='float32' )
        if task == "test":
            label = np.zeros((num,1), dtype='float32' )
        else:
            label = np.asarray( applyLabelMap( val[:, 0], label_mapper ), dtype='float32' )
        # create HDF5 dataset
        file = hdf5_out + "_chunk" + str(i)
        h5py_files.append( file )
        with h5py.File(file, 'w') as f:
            f['data'] = feat
            f['label'] = label
        cnt += num
        print "Convert HDF5] Processed %s samples." % cnt

    # create HDF5 source file
    with open(hdf5_out + '.list', 'w') as f:
        for file in h5py_files:
            f.write(file + '\n')

if __name__ == "__main__":
   main()


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>monty.math — monty 3.0.2 documentation</title>
    <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />

  <link media="only screen and (max-device-width: 480px)" href="../../_static/small_flask.css" type= "text/css" rel="stylesheet" />
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

Navigation

          index

          modules |

monty 3.0.2 documentation »

Module code »

Source code for monty.math

# coding: utf-8

"""
Addition math functions.
"""

import math

[docs]def nCr(n, r):
    """
    Calculates nCr.

    Args:
        n (int): total number of items.
        r (int): items to choose

    Returns:
        nCr.
    """
    f = math.factorial
    return int(f(n) / f(r) / f(n-r))

[docs]def nPr(n, r):
    """
    Calculates nPr.

    Args:
        n (int): total number of items.
        r (int): items to permute

    Returns:
        nPr.
    """
    f = math.factorial
    return int(f(n) / f(n-r))

Related Topics

Documentation overview

Module code

Quick search

    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>

      © Copyright 2014, Shyue Ping Ong.


text:
{% extends 'base.html' %}

{% block content %}

Integrative QTL project

In a recent national study on maternal effects on seed quality, 165 homozygous recombinant lines of Arabidopsis thaliana grouped in a number of different growth conditions were genotyped based on 69 markers and transcript levels were measured. These lines were also extensively phenotyped, with the goal of performing generalized genetical genomics [1] correlating genotype with phenotype (expression) under a range of conditions. Levels of a number of primary metabolites were measured as well.

In this project, the goal is to develop methods to learn which genes influence which genotype, extending the QTL approach by incorporating expression and metabolic pathway information [2]. Prior knowledge on metabolic regulation and the relation between condition and metabolic activation can be used to refine the search and zoom in on possible mechanistic explanations of the observed phenotypes. The desired outcome is a method to optimally combine genetical genomics data with prior knowledge.

[1] Y. Li et al. (2008) Generalizing genetical genomics: getting added value from environmental perturbation. Trends Genetics 24(10):518-24.

[2] R.C. Jansen et al. (2009) Defining gene and QTL networks. Current Opinion in Plant Biology 2009, 12:16. 2009, 12:16.

{% endblock %}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Torrey bot. Club 27(2): 50 (1900)

#### Original name
Zygodesmus pubidus Ellis & Everh.

### Remarks
null


text:
define('cfdElLinks', [], function() {

    /**
     * CFD DOM elements
     */
    return {
        cfdEl: $('#cfd'),
        elementsEl: $('#cfd-elements-container'),
        canvasEl: $('#cfd-canvas-container'),
        propertyEl: $('#cfd-property-container'),
        dragEl: $('#cfd-drag'),
        selectEl: $('#cfd-select'),
        selectButtonsEl: $('#cfd-select .cfd-select-button')
    };

});


text:
namespace $ {

	/// Global storage of temporary state
	export var $mol_state_stack = new Map< string , any >()

}


text:
package com.legendshop.core.cache;

import net.sf.ehcache.Cache;

public abstract interface CacheCallBack<T>
{
  public abstract T doInCache(String paramString, Cache paramCache);
}


text:
/**
\defgroup i2c_interface_gr I2C Interface
\brief    Driver API for I2C Bus Peripheral (%Driver_I2C.h)
\details

I2C (Inter-Integrated Circuit, referred to as I-squared-C, I-two-C, or IIC) is a multi-master serial single-ended bus and is mostly used
on single boards, but can also connect to components which are linked via cable.

Most significant features of the I2C bus include:
 - Only two bus lines are required
 - I2C is a true multi-master bus. Simple master/slave relationships exist between all components
 - A baud rate is not required; the master device determines a bus clock
 - Each connected device is addressable by a unique address
 - Providing arbitration and collision detection

For more information about I2C refer to the following web pages:
  - Wikipedia: I2C
  - www.i2c-bus.org.

Devices can operation in Master or Slave mode:

 - To operate in Master mode call the functions \ref ARM_I2C_MasterTransmit or \ref ARM_I2C_MasterReceive. These functions get as argument a slave address.

 - To operate in Slave mode set the slave address using the function \ref ARM_I2C_Control. The functions \ref ARM_I2C_SlaveTransmit or \ref ARM_I2C_SlaveReceive are used to transfer data in Slave mode.

I2C Slave Address

Depending on the device, I2C supports 7-bit and 10-bit Slaves addresses.
The element address_10_bit in \ref ARM_I2C_CAPABILITIES indicates that the driver is able to handle 10-bit addresses.
A 10-bit Slave address is ORed with \ref ARM_I2C_ADDRESS_10BIT.

I2C also supports a General Call to all Slaves by using the slave address value \token{0}.
A General Call is recognized by Slaves have a slave address value \ref ARM_I2C_ADDRESS_GC registered with the
function \ref ARM_I2C_Control.

Block Diagram

The I2C driver allows you to connect low-speed peripherals to a motherboard, embedded system, cellphone, or other electronic device.

\image html I2C_BlockDiagram.png  "Master/Slave connected via I2C interface"

I2C API

The following header files define the Application Programming Interface (API) for the I2C interface:
  - \b %Driver_I2C.h : Driver API for I2C Bus Peripheral

The driver implementation is a typical part of the Device Family Pack (DFP) that supports the
peripherals of the microcontroller family.

Driver Functions

The driver functions are published in the access struct as explained in \ref DriverFunctions
  - \ref ARM_DRIVER_I2C : access struct for I2C driver functions

\anchor example Example Code

The following example code shows the usage of the I2C interface in Master mode.

\include I2C_Demo.c

The following example code shows the usage of the I2C interface in Slave mode.

\include I2C_SlaveDemo.c

@{
*/

/**
\struct     ARM_DRIVER_I2C
\details
The functions of the I2C interface are accessed by function pointers exposed by this structure. Refer to \ref DriverFunctions for
overview information.

Each instance of an I2C provides such an access structure. The instance is indicated by
a postfix in the symbol name of the access structure, for example:
 - \b Driver_I2C0 is the name of the access struct of the first instance (no. 0).
 - \b Driver_I2C1 is the name of the access struct of the second instance (no. 1).

A configuration setting in the middleware allows connecting the middleware to a specific driver instance %Driver_I2Cn.
The default is \token{0}, which connects a middleware to the first instance of a driver.
*******************************************************************************************************************/

/**
\struct     ARM_I2C_CAPABILITIES
\details
An I2C driver can be implemented with different capabilities.
The data fields of this struct encode the capabilities implemented by this driver.

The element \em address_10_bit indicates that the driver is able to handle 10-bit addressing natively.
User can still emulate the 10-bit addressing in software if the driver does not support it.

Returned by:
  - \ref ARM_I2C_GetCapabilities
*******************************************************************************************************************/

/**
\struct     ARM_I2C_STATUS
\details
Structure with information about the status of the I2C.

The flag \em busy indicates that the driver is busy executing Master/Slave Transmit/Receive operation.

It is set:
 - when Master operation starts: after calling \ref ARM_I2C_MasterTransmit or \ref ARM_I2C_MasterReceive
 - when Slave operation starts: after calling \ref ARM_I2C_SlaveTransmit or \ref ARM_I2C_SlaveReceive and after being addressed by a Master as the Slave

It is cleared when Master/Slave operation has finished.

The flag \em mode indicates the current mode which is Master when Master Transmit/Receive is active or Slave otherwise.

The flag \em direction indicates either Transmitter or Receiver mode. It is updated during Master/Slave operation when the Slave is addressed by a Master.

The flag \em general_call indicates a General call (address \token{0}) when in Slave mode.

The flag \em arbitration_lost indicates that the Master has lost arbitration. The current Master operation is aborted.

The flag \em bus_error indicates that a bus error has been detected. The current Master/Slave operation is aborted.

Returned by:
  - \ref ARM_I2C_GetStatus
*******************************************************************************************************************/

/**
\typedef    ARM_I2C_SignalEvent_t
\details
Provides the typedef for the callback function \ref ARM_I2C_SignalEvent.

Parameter for:
  - \ref ARM_I2C_Initialize
*******************************************************************************************************************/

/**
\defgroup I2C_events I2C Events
\ingroup i2c_interface_gr
\brief The I2C driver generates call back events that are notified via the function \ref ARM_I2C_SignalEvent.
\details
This section provides the event values for the \ref ARM_I2C_SignalEvent callback function.

The following call back notification events are generated:
@{
\def  ARM_I2C_EVENT_TRANSFER_DONE
\def  ARM_I2C_EVENT_TRANSFER_INCOMPLETE
\def  ARM_I2C_EVENT_SLAVE_TRANSMIT
\def  ARM_I2C_EVENT_SLAVE_RECEIVE
\def  ARM_I2C_EVENT_ADDRESS_NACK
\def  ARM_I2C_EVENT_GENERAL_CALL
\def  ARM_I2C_EVENT_ARBITRATION_LOST
\def  ARM_I2C_EVENT_BUS_ERROR
\def  ARM_I2C_EVENT_BUS_CLEAR
@}
*/

//
//  Functions
//

ARM_DRIVER_VERSION ARM_I2C_GetVersion (void)  {
  return { 0, 0 };
};
/**
\fn       ARM_DRIVER_VERSION ARM_I2C_GetVersion (void)
\details
The function \b ARM_I2C_GetVersion returns version information of the driver implementation in \ref ARM_DRIVER_VERSION
 - API version is the version of the CMSIS-Driver specification used to implement this driver.
 - Driver version is source code version of the actual driver implementation.

Example:
\code
extern ARM_DRIVER_I2C Driver_I2C0;
ARM_DRIVER_I2C *drv_info;

void setup_i2c (void)  {
  ARM_DRIVER_VERSION  version;

  drv_info = &Driver_I2C0;
  version = drv_info->GetVersion ();
  if (version.api < 0x10A)   {      // requires at minimum API version 1.10 or higher
    // error handling
    return;
  }
}
\endcode
*******************************************************************************************************************/

ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities (void)  {
  return { 0 };
};
/**
\fn       ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities (void)
\details
The function \b ARM_I2C_GetCapabilities returns information about capabilities of this driver implementation.
The data fields of the struct \ref ARM_I2C_CAPABILITIES encodes the driver capabilities.

Example:
\code
extern ARM_DRIVER_I2C Driver_I2C0;
ARM_DRIVER_I2C *drv_info;

void read_capabilities (void)  {
  ARM_I2C_CAPABILITIES drv_capabilities;

  drv_info = &Driver_I2C0;
  drv_capabilities = drv_info->GetCapabilities ();
  // interrogate capabilities

}
\endcode
*******************************************************************************************************************/

int32_t ARM_I2C_Initialize (ARM_I2C_SignalEvent_t cb_event) {
  return ARM_DRIVER_OK;
};
/**
\fn       int32_t ARM_I2C_Initialize (ARM_I2C_SignalEvent_t cb_event)
\details
The function \b ARM_I2C_Initialize initializes the I2C interface.
It is called when the middleware component starts operation.

The function performs the following operations:
  - Initializes and the I/O resources for the I2C interface.
  - Registers the \ref ARM_I2C_SignalEvent callback function.

The parameter \em cb_event is a pointer to the \ref ARM_I2C_SignalEvent callback function.
Use a NULL pointer when no callback events are required.

Can be called multiple times. If the peripheral is already initialized the function performs no operation and
returns with \ref ARM_DRIVER_OK. Refer to \ref CallSequence for more information.

\sa ARM_I2C_PowerControl
\sa ARM_I2C_Uninitialize

\b Example:
 - refer to \ref example "Example Code"

*******************************************************************************************************************/

int32_t ARM_I2C_Uninitialize (void)  {
  return ARM_DRIVER_OK;
};
/**
\fn       int32_t ARM_I2C_Uninitialize (void)
\details
The function \b ARM_I2C_Uninitialize releases the I/O resources of I2C interface.

It is called when the middleware component stops operation and releases the I/O resources used by the I2C interface.
Refer to \ref CallSequence for more information.

\sa ARM_I2C_Initialize
\sa ARM_I2C_PowerControl

*******************************************************************************************************************/

int32_t ARM_I2C_PowerControl (ARM_POWER_STATE state)  {
  return ARM_DRIVER_OK;
};
/**
\fn int32_t ARM_I2C_PowerControl (ARM_POWER_STATE state)
\details
The function \b ARM_I2C_PowerControl operates the power modes of the I2C interface.

The parameter \em state can have the following values:
  - \ref ARM_POWER_FULL : set-up peripheral for data transfers, enable interrupts (NVIC) and optionally DMA.
                          Can be called multiple times. If the peripheral is already in this mode,
						  then the function performs no operation and returns with \ref ARM_DRIVER_OK.
  - \ref ARM_POWER_LOW : may use power saving. Returns \ref ARM_DRIVER_ERROR_UNSUPPORTED when not implemented.
  - \ref ARM_POWER_OFF : terminates any pending data transfers, disables peripheral, disables related interrupts and DMA.

Refer to \ref CallSequence for more information.

\sa ARM_I2C_Initialize
\sa ARM_I2C_Uninitialize

*******************************************************************************************************************/

int32_t ARM_I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)  {
  return ARM_DRIVER_OK;
};
/**
\fn int32_t ARM_I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
\details
This function \b ARM_I2C_MasterTransmit transmits data as Master to the selected Slave.

The operation consists of:
 - Master generates START condition
 - Master addresses the Slave as Master Transmitter
 - Master transmits data to the addressed Slave
 - Master generates STOP condition (if \em xfer_pending is "false")

The parameter \em addr is the address of the slave to transmit the data to. The value can be ORed with \ref ARM_I2C_ADDRESS_10BIT to
identify a 10-bit address value. \n
The parameter \em data and \em num specify the address of a data buffer and the number of bytes to transmit. \n
Set the parameter \em xfer_pending to 'true' if another transfer operation follows. With \em xfer_pending set to 'false' a STOP condition is generated.

The function is non-blocking and returns as soon as the driver has started the operation.
During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated and the contents of data must not be modified.
When transmit operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.

Number of data bytes transmitted and acknowledged is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.

The operation is aborted in the following cases (\ref ARM_I2C_EVENT_TRANSFER_DONE event is generated together with):
 - selected slave has not acknowledged the address: \ref ARM_I2C_EVENT_ADDRESS_NACK event
 - arbitration has been lost: \ref ARM_I2C_EVENT_ARBITRATION_LOST event
 - bus error has been detected: \ref ARM_I2C_EVENT_BUS_ERROR event

Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.

Transmit operation can be aborted also by calling \ref ARM_I2C_Control with the parameter \em control \ref ARM_I2C_ABORT_TRANSFER.
*******************************************************************************************************************/

int32_t ARM_I2C_MasterReceive (uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)  {
  return ARM_DRIVER_OK;
};
/**
\fn int32_t ARM_I2C_MasterReceive (uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
\details
This function \b ARM_I2C_MasterReceive is used to receive data as Master from the selected Slave.

The operation consists of:
 - Master generates START condition
 - Master addresses the Slave as Master Receiver
 - Master receives data from the addressed Slave
 - Master generates STOP condition (if \em xfer_pending is "false")

The parameter \em addr is the address of the slave to receive the data from. The value can be ORed with \ref ARM_I2C_ADDRESS_10BIT to
identify a 10-bit address value. \n
The parameter \em data and \em num specify the address of a data buffer and the number of bytes to receive. \n
Set the parameter \em xfer_pending to 'true' if another transfer operation follows. With \em xfer_pending set to 'false' a STOP condition is generated.

The function is non-blocking and returns as soon as the driver has started the operation.
During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated.
When receive operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.

Number of data bytes received is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.

The operation is aborted in the following cases (\ref ARM_I2C_EVENT_TRANSFER_DONE event is generated together with):
 - selected slave has not acknowledged the address: \ref ARM_I2C_EVENT_ADDRESS_NACK event
 - arbitration has been lost: \ref ARM_I2C_EVENT_ARBITRATION_LOST event
 - bus error has been detected: \ref ARM_I2C_EVENT_BUS_ERROR event

Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.

Receive operation can be aborted also by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
*******************************************************************************************************************/

int32_t ARM_I2C_SlaveTransmit (const uint8_t *data, uint32_t num)  {
  return ARM_DRIVER_OK;
};
/**
\fn int32_t ARM_I2C_SlaveTransmit (const uint8_t *data, uint32_t num)
\details
This function \b ARM_I2C_SlaveTransmit is used to transmit data as Slave to the Master.

The parameter \em data is a pointer to the data to transmit. \n
The parameter \em num specifies the number of bytes to transmit.

The function is non-blocking and returns as soon as the driver has registered the operation.
The actual operation will start after being addressed by the master as a Slave Transmitter. If the operation has not been registered at that point the \ref ARM_I2C_EVENT_SLAVE_TRANSMIT event is generated.
The same event is also generated if the operation has finished (specified number of bytes transmitted) but more data is requested by the master.

It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated and the contents of data must not be modified.
When transmit operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.

Number of data bytes transmitted is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.

In case that a General call has been detected the \ref ARM_I2C_EVENT_GENERAL_CALL flag is indicated together with the \ref ARM_I2C_EVENT_TRANSFER_DONE event (also with \ref ARM_I2C_EVENT_SLAVE_TRANSMIT event).

In case that bus error has been detected then the operation is aborted and the \ref ARM_I2C_EVENT_BUS_ERROR event is generated together with \ref ARM_I2C_EVENT_TRANSFER_DONE.

Slave will only respond to its own address (or General call if enabled) that is specified by calling \ref ARM_I2C_Control with \ref ARM_I2C_OWN_ADDRESS as control parameter.
Using address \token{0} disables the slave.

Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.

Transmit operation can be canceled or aborted by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
*******************************************************************************************************************/

int32_t ARM_I2C_SlaveReceive (uint8_t *data, uint32_t num)  {
  return ARM_DRIVER_OK;
};
/**
\fn int32_t ARM_I2C_SlaveReceive (uint8_t *data, uint32_t num)
\details
This function \b ARM_I2C_SlaveReceive receives data as Slave from the Master.

The parameter \em data is a pointer to the data to receive. \n
The parameter \em num specifies the number of bytes to receive.

The function is non-blocking and returns as soon as the driver has registered the operation.
The actual operation will start after being addressed by the master as a Slave Receiver. If the operation has not been registered at that point the \ref ARM_I2C_EVENT_SLAVE_RECEIVE event is generated.

It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated.
When receive operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.

Number of data bytes received and acknowledged is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.

In case that a General call has been detected the \ref ARM_I2C_EVENT_GENERAL_CALL flag is indicated together with the \ref ARM_I2C_EVENT_TRANSFER_DONE event (also with \ref ARM_I2C_EVENT_SLAVE_RECEIVE event).

In case that bus error has been detected then the operation is aborted and the \ref ARM_I2C_EVENT_BUS_ERROR event is generated together with \ref ARM_I2C_EVENT_TRANSFER_DONE.

Slave will only respond to its own address (or General call if enabled) that is specified by calling \ref ARM_I2C_Control with \ref ARM_I2C_OWN_ADDRESS as control parameter.
Using address \token{0} disables the slave.

Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.

Receive operation can be canceled or aborted by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
*******************************************************************************************************************/

int32_t ARM_I2C_GetDataCount (void)  {
  return 0;
}
/**
\fn int32_t ARM_I2C_GetDataCount (void)
\details
The function \b ARM_I2C_GetDataCount returns the number of currently transferred data bytes during and after:
 - \ref ARM_I2C_MasterTransmit : number of data bytes transmitted and acknowledged
 - \ref ARM_I2C_MasterReceive : number of data bytes received
 - \ref ARM_I2C_SlaveTransmit : number of data bytes transmitted
 - \ref ARM_I2C_SlaveReceive : number of data bytes received and acknowledged

When the Slave is not yet addressed by the Master then \token{-1} is returned.
*****************************************************************************************************************/

int32_t ARM_I2C_Control (uint32_t control, uint32_t arg)  {
  return ARM_DRIVER_OK;
}
/**
\fn int32_t ARM_I2C_Control (uint32_t control, uint32_t arg)
\details
The function \b ARM_I2C_Control operates the I2C interface and executes various operations.

The parameter \em control specifies various operations as listed in the table below.  \n
The parameter \em arg provides, depending on the operation,  additional information. \n

Parameter \em control            | Operation
:--------------------------------|:--------------------------------------------
\ref ARM_I2C_OWN_ADDRESS         | Set Own Slave Address; \em arg = slave address
\ref ARM_I2C_BUS_SPEED           | Set Bus Speed; \em arg = bus speed
\ref ARM_I2C_BUS_CLEAR           | Clear the bus by sending nine clock pulses
\ref ARM_I2C_ABORT_TRANSFER      | Aborts the data transfer between Master and Slave for Transmit or Receive

Set Own Slave Address

After initialization, the I2C Device has no slave address assigned and does not accept any requests from
an I2C Master.

The \em control operation \ref ARM_I2C_OWN_ADDRESS sets the slave address with the parameter \em arg.
The slave address can be ORed with \ref ARM_I2C_ADDRESS_10BIT to indicate a 10-bit address.

The slave address can be ORed with \ref ARM_I2C_ADDRESS_GC to indicate that the slave accepts a General Call.
If the slave address value is only \ref ARM_I2C_ADDRESS_GC, then the slave only accepts a General Call.

The slave address value \token{0} disables Slave mode and clears any assigned slave address.

**Examples:**

Set the Slave address value \token{0x45} as 7-bit address.
\code
  I2Cdrv->Control      (ARM_I2C_OWN_ADDRESS, 0x45);
\endcode

Set the Slave address value \token{0x135} as 10-bit address and accept a General Call.
\code
  I2Cdrv->Control      (ARM_I2C_OWN_ADDRESS, 0x135 | ARM_I2C_ADDRESS_10BIT | ARM_I2C_ADDRESS_GC);
\endcode

Bus Speed

The \em control operation \ref ARM_I2C_BUS_SPEED sets the bus speed using the parameter \em arg.

Parameter \em arg                | Bus Speed
:--------------------------------|:--------------------------------------------
\ref ARM_I2C_BUS_SPEED_STANDARD  | Standard Speed to (\token{100 kHz})
\ref ARM_I2C_BUS_SPEED_FAST      | Fast Speed  (\token{400kHz})
\ref ARM_I2C_BUS_SPEED_FAST_PLUS | Fast + Speed (\token{1MHz})
\ref ARM_I2C_BUS_SPEED_HIGH      | High Speed  (\token{3.4MHz})

**Example:**

\code
  I2Cdrv->Control      (ARM_I2C_BUS_SPEED, I2C_BUS_SPEED_FAST);
\endcode
*****************************************************************************************************************/

ARM_I2C_STATUS ARM_I2C_GetStatus (void)  {
  return { 0 };
}
/**
\fn ARM_I2C_STATUS ARM_I2C_GetStatus (void)
\details
The function \b ARM_I2C_GetStatus returns the current I2C interface status.

Refer to \ref ARM_I2C_STATUS for details.
*****************************************************************************************************************/

void ARM_I2C_SignalEvent (uint32_t event)  {
  // function body
}
/**
\fn void ARM_I2C_SignalEvent (uint32_t event)
\details
The function \b ARM_I2C_SignalEvent is a callback function registered by the function \ref ARM_I2C_Initialize..
It is called by the I2C driver to notify the application about \ref I2C_events occured during operation.

The parameter \a event indicates one or more events that occurred during driver operation.
Each event is encoded in a separate bit and therefore it is possible to signal multiple events within the same call.

The following events can be generated:

Parameter \em event                       |     Bit   | Description
:---------------------------------------- |:---------:|:----------------------------------------------------------
\ref ARM_I2C_EVENT_TRANSFER_DONE          | 1UL << 0  | Occurs after Master/Slave Transmit/Receive operation has finished.
\ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE    | 1UL << 1  | Occurs together with \ref ARM_I2C_EVENT_TRANSFER_DONE when less data is transferred then requested.
\ref ARM_I2C_EVENT_SLAVE_TRANSMIT         | 1UL << 2  | Occurs when addressed as Slave Transmitter and \ref ARM_I2C_SlaveTransmit has not been started.
\ref ARM_I2C_EVENT_SLAVE_RECEIVE          | 1UL << 3  | Occurs when addressed as Slave Receiver and \ref ARM_I2C_SlaveReceive has not been started.
\ref ARM_I2C_EVENT_ADDRESS_NACK           | 1UL << 4  | Occurs in master mode when address is not acknowledged from slave.
\ref ARM_I2C_EVENT_GENERAL_CALL           | 1UL << 5  | Indicates General Call in slave mode together with \ref ARM_I2C_EVENT_TRANSFER_DONE, \ref ARM_I2C_EVENT_SLAVE_TRANSMIT and \ref ARM_I2C_EVENT_SLAVE_RECEIVE.
\ref ARM_I2C_EVENT_ARBITRATION_LOST       | 1UL << 6  | Occurs in master mode when arbitration is lost.
\ref ARM_I2C_EVENT_BUS_ERROR              | 1UL << 7  | Occurs when bus error is detected.
\ref ARM_I2C_EVENT_BUS_CLEAR              | 1UL << 8  | Occurs after \ref ARM_I2C_BUS_CLEAR Control operation has finished.

**************************************************************************************************************************/

/**
\defgroup i2c_control_gr I2C Control Codes
\ingroup i2c_interface_gr
\brief Many parameters of the I2C driver are configured using the \ref ARM_I2C_Control function.
@{
\details
The various I2C control codes define:
  - \ref i2c_control_codes           specify operation parameters and various controls
  - \ref i2c_bus_speed_ctrls         specify the I2C bus speed

Refer to the \ref ARM_I2C_Control function for further details.
*/

/**
\defgroup i2c_control_codes I2C Control Codes
\ingroup i2c_control_gr
\brief Specify operation parameters and various controls.
\details
@{
\def ARM_I2C_OWN_ADDRESS
\sa ARM_I2C_Control
\def ARM_I2C_BUS_SPEED
Speed is specified using the following values: \ref i2c_bus_speed_ctrls
\sa ARM_I2C_Control
\def ARM_I2C_BUS_CLEAR
\sa ARM_I2C_Control
\def ARM_I2C_ABORT_TRANSFER
\sa ARM_I2C_Control
@}
*/

/**
\defgroup i2c_bus_speed_ctrls I2C Bus Speed
\ingroup i2c_control_gr
\brief Specify the I2C bus speed.
\details
@{
\def ARM_I2C_BUS_SPEED_STANDARD
\sa ARM_I2C_Control
\def ARM_I2C_BUS_SPEED_FAST
\sa ARM_I2C_Control
\def ARM_I2C_BUS_SPEED_FAST_PLUS
\sa ARM_I2C_Control
\def ARM_I2C_BUS_SPEED_HIGH
\sa ARM_I2C_Control
@}
*/
/**
@}
*/

/**
\defgroup i2c_address_flags I2C Address Flags
\ingroup i2c_interface_gr
\brief Specify address flags
\details
Specifies the address type for the functions \ref ARM_I2C_MasterReceive, \ref ARM_I2C_MasterTransmit and \ref ARM_I2C_OWN_ADDRESS.
@{
\def ARM_I2C_ADDRESS_10BIT
\sa ARM_I2C_OWN_ADDRESS
\sa ARM_I2C_MasterTransmit
\sa ARM_I2C_MasterReceive
\def ARM_I2C_ADDRESS_GC
\sa ARM_I2C_OWN_ADDRESS
@}
*/

/**
@}
*/
// End I2C Interface


text:
==================================================================================================
HostMountMode
==================================================================================================

.. describe:: HostMountMode

    Defines the access mode of the datastore.

    .. py:data:: HostMountMode.readOnly

        The host system has read-only access to the file system.

    .. py:data:: HostMountMode.readWrite

        The host system has read/write access to the file system.


text:
<!doctype html>

		<meta charset="utf-8">
		<meta http-equiv="x-ua-compatible" content="ie=edge">
		<title>AngularJS Boilerplate</title>
		<meta name="description" content="Simple AngularJS Boilerplate to kick start your new project with SASS support and Gulp watch/build tasks">

		<meta name="HandheldFriendly" content="True">
		<meta name="MobileOptimized" content="320">
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">

		<meta name="msapplication-TileColor" content="#f01d4f">

		<link rel="stylesheet" href="bower_components/OwlCarousel/owl-carousel/owl.carousel.css" />
		<link rel="stylesheet" type="text/css" href="styles/style.css" />


text:
"""
Receivers for use in tests.
"""
from twisted.positioning import base, ipositioning

class MockPositioningReceiver(base.BasePositioningReceiver):
    """
    A mock positioning receiver.

    Mocks all the L{IPositioningReceiver} methods with stubs that don't do
    anything but register that they were called.

    @ivar called: A mapping of names of callbacks that have been called to
        C{True}.
    @type called: C{dict}
    """
    def __init__(self):
        self.clear()

        for methodName in ipositioning.IPositioningReceiver:
            self._addCallback(methodName)

    def clear(self):
        """
        Forget all the methods that have been called on this receiver, by
        emptying C{self.called}.
        """
        self.called = {}

    def _addCallback(self, name):
        """
        Adds a callback of the given name, setting C{self.called[name]} to
        C{True} when called.
        """
        def callback(*a, **kw):
            self.called[name] = True

        setattr(self, name, callback)


text:
package com.example.holywood.domain;

public abstract class Film {

	private int id = 0;
	private String title = "-required-";
	private int year = 0;
	protected double IMDBRating;
	private Rating filmRating;

	public Film(int id, String title, int year) {
		this.id = id;
		this.title = title;
		this.year = year;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public double getIMDBRating() {
		return IMDBRating;
	}

	public void setIMDBRating(double iMDBRating) {
		IMDBRating = iMDBRating;
	}

	public Rating getFilmRating() {
		return filmRating;
	}

	public void setFilmRating(Rating filmRating) {
		this.filmRating = filmRating;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Film [id=");
		builder.append(id);
		builder.append(", title=");
		builder.append(title);
		builder.append(", year=");
		builder.append(year);
		builder.append(", IMDBRating=");
		builder.append(IMDBRating);
		builder.append(", filmRating=");
		builder.append(filmRating);
		builder.append("]");
		return builder.toString();
	}

}


text:
actions :create, :delete
default_action :create

attribute :filter_name, :kind_of => String, :name_attribute => true, :required => true
attribute :type, :kind_of => String, :required => true
attribute :tag, :kind_of => String, :required => true
attribute :params