text:
'use strict';
/* global it, describe, before, beforeEach */
let chai            = require('chai');
let chaiAsPromised  = require('chai-as-promised');
let proxyquire      = require('proxyquire').noPreserveCache();
let Promise         = require('bluebird');
let sinon           = require('sinon');

let mockApiKey = 'mockApiKey';
let mockProjectId = 'mockProjectId';
let expect = chai.expect;

chai.use(chaiAsPromised);
let stubs = {
    'request-promise': {}
};

let supportedLocales;

describe('Supported Locales', () => {
    describe('When request is successfull', () => {
        before(() => {
            stubs['request-promise'].get = sinon.stub().returns(Promise.resolve(goodResponse()));
            supportedLocales = proxyquire('../src/supported-locales', stubs)(mockApiKey, mockProjectId);
        });

        it('should retrieve locales from smartling', () => {
            let expectedResult = [ 'en-AU', 'en-GB', 'fr-CA', 'de-DE', 'ja-JP', 'es-MX' ];
            let result = supportedLocales();
            return expect(result).to.eventually.eql(expectedResult);
        });
    });

    describe('When request fails', () => {
        beforeEach(() => {
            stubs['request-promise'].get = sinon.stub().returns(Promise.reject(invalidCredentials()));
            supportedLocales = proxyquire('../src/supported-locales', stubs)(mockApiKey, mockProjectId);
        });

        it('should return an empty array', () => {
            let expectedResult = [];
            let result = supportedLocales();
            return expect(result).to.eventually.eql(expectedResult);
        });
    });
});

/*eslint-disable quotes*/
function goodResponse() {
    return '{"response":{"code":"SUCCESS","messages":[],"data":{"locales":[{"locale":"en-AU","name":"English' +
        ' (Australia)","translated":"English (Australia)"},{"locale":"en-GB","name":"English (United Kingdom)",' +
        '"translated":"English (United Kingdom)"},{"locale":"fr-CA","name":"French (Canada)","translated":"Franç' +
        'ais (Canada)"},{"locale":"de-DE","name":"German (Germany)","translated":"Deutsch"},{"locale":"ja-JP","' +
        'name":"Japanese","translated":"日本語"},{"locale":"es-MX","name":"Spanish (Mexico)","translated":"Spani' +
        'sh (Mexico)"}]}}}';
}

function invalidCredentials() {
    return '{"response":{"code":"AUTHENTICATION_ERROR","messages":["Bad credentials"],"data":null}}';
}
/*eslint-enable quotes*/


text:
package com.jivesoftware.os.amza.service.ring;

/**
 *
 */
public class CacheId<T> {

    public volatile long currentCacheId = 0;
    public volatile T entry;

    public CacheId(T entry) {
        this.entry = entry;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.jboss.resteasy.test.providers.jaxb.resource;

import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

@Provider
@Produces("text/x-vcard")
public class CustomOverrideWriter implements MessageBodyWriter<CustomOverrideFoo> {
    @Override
    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return true;
    }

    @Override
    public long getSize(CustomOverrideFoo foo, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return -1;
    }

    @Override
    public void writeTo(CustomOverrideFoo foo, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
        String msg = "---" + foo.getName() + "---";
        entityStream.write(msg.getBytes());
    }
}


text:
package net.sf.jasperreports.engine.util.xml;

/**
 * {@link XalanXPathExecuter Apache Xalan XPath executers} factory.
 *
 * @author Lucian Chirita (lucianc@users.sourceforge.net)
 * @version $Id: XalanXPathExecuterFactory.java 7199 2014-08-27 13:58:10Z teodord $
 */
public class XalanXPathExecuterFactory implements JRXPathExecuterFactory
{

	public JRXPathExecuter getXPathExecuter()
	{
		return new XalanXPathExecuter();
	}

}


text:
package com.intuit.wasabi.experimentobjects;

import com.google.common.collect.Sets;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

/**
 * This class is testing the functionality of the {@link ExperimentBatch}
 */
public class ExperimentBatchTest {

    private Set<Experiment.Label> labels = Sets.newHashSet(Experiment.Label.valueOf("a"),
            Experiment.Label.valueOf("b"), Experiment.Label.valueOf("c"));

    private static Map<String, Object> profile;

    private static Map<String, Object> personalizationParameters;

    static {
        profile = new HashMap<>();
        profile.put("a.b.c", 42);
        profile.put("d.e.f", 84);

        personalizationParameters = new HashMap<>();
        personalizationParameters.put("g.h.i", 42);
        personalizationParameters.put("j.k.l", 84);
    }

    private ExperimentBatch expBatch = ExperimentBatch.newInstance()
            .withLabels(labels)
            .withProfile(profile)
            .withPersonalizationParameters(personalizationParameters)
            .build();

    @Test
    public void testBuilder() {
        ExperimentBatch expBatchCopy = ExperimentBatch.from(expBatch).build();
        assertEquals(expBatch, expBatchCopy);

        assertEquals(expBatch.getLabels(), labels);
        assertEquals(expBatch.getProfile(), profile);
        assertEquals(expBatch.getPersonalizationParameters(), personalizationParameters);
    }

    @Test
    public void testEquals() {
        ExperimentBatch expBatchCopy = ExperimentBatch.from(expBatch).build();
        expBatchCopy.getProfile().remove("a.b.c");

        assertNotEquals(expBatch, expBatchCopy);
        assertNotEquals(expBatch, null);
        assertNotEquals(expBatch, 42);

        assertEquals(expBatch, expBatch);
    }

    @Test
    public void testHashCode() {
        ExperimentBatch expBatchCopy = ExperimentBatch.from(expBatch).build();

        assertEquals(expBatch.hashCode(), expBatchCopy.hashCode());
        expBatchCopy.setProfile(new HashMap<String, Object>());
        assertNotEquals(expBatch.hashCode(), expBatchCopy.hashCode());

    }

    @Test
    public void testToString() {
        String out = "ExperimentBatch labels=" + labels
                + ", profile=" + profile
                + ", personalizationParameters=" + personalizationParameters;
        assertEquals(expBatch.toString(), out);

    }

}


text:
#ifndef MEDIA_CDM_PPAPI_EXTERNAL_OPEN_CDM_COM_CDM_RPC_RPC_CDM_PLATFORM_HANDLER_H_
#define MEDIA_CDM_PPAPI_EXTERNAL_OPEN_CDM_COM_CDM_RPC_RPC_CDM_PLATFORM_HANDLER_H_

#include <rpc/rpc.h>
#include <string>

#include "media/cdm/ppapi/external_open_cdm/src/cdm/open_cdm_platform_common.h"
#include "media/cdm/ppapi/external_open_cdm/src/cdm/open_cdm_platform_com.h"
#include "media/cdm/ppapi/external_open_cdm/src/cdm/open_cdm_platform_com_callback_receiver.h"
#include "media/cdm/ppapi/external_open_cdm/src/com/common/rpc/opencdm_callback.h"

namespace media {

class RpcCdmPlatformHandler : public OpenCdmPlatformCom {
 public:
  // NEW EME based interface
  // on errors tear down media keys and media key session objects

  // EME equivalent: new MediaKeys()
  MediaKeysResponse MediaKeys(std::string key_system) override;

  // EME equivalent: media_keys_.createSession()
  MediaKeysCreateSessionResponse MediaKeysCreateSession(
      const std::string& init_data_type, const uint8_t* init_data,
      int init_data_length) override;

  // EME equivalent: media_keys_.loadSession()
  MediaKeysLoadSessionResponse MediaKeysLoadSession(
      char *session_id_val, uint32_t session_id_len) override;

  // EME equivalent: media_key_session_.update()
  MediaKeySessionUpdateResponse MediaKeySessionUpdate(
      const uint8 *pbKey, uint32 cbKey, char *session_id_val,
      uint32_t session_id_len) override;

  // EME equivalent: media_key_session_.release()
  MediaKeySessionReleaseResponse MediaKeySessionRelease(
      char *session_id_val, uint32_t session_id_len) override;

  ~RpcCdmPlatformHandler() override {
  }
  RpcCdmPlatformHandler(OpenCdmPlatformComCallbackReceiver *callback_receiver);

  // RPC specific behavior
  static void * DelegateRpcInit(void *call_params);
  static void DelegateRpcCallback(struct svc_req *rqstp,
                                  register SVCXPRT *transp);
  static void OnMessage1SvcDelegate(rpc_cb_message *kmm,
                                  struct svc_req *rqstp, RpcCdmPlatformHandler *p_instance);
  static void OnReady1SvcDelegate(rpc_cb_ready *keyready_param,
                                  struct svc_req *rqstp, RpcCdmPlatformHandler *p_instance);
  static void OnError1SvcDelegate(rpc_cb_error *err_param,
                                  struct svc_req *rqstp, RpcCdmPlatformHandler *p_instance);
  static void OnKeyStatusUpdate1SvcDelegate(
      rpc_cb_key_status_update *kmm, struct svc_req *rqstp,
      RpcCdmPlatformHandler *p_instance);

 private:
  OpenCdmPlatformComCallbackReceiver *callback_receiver_;
  // TODO(ska): remove, when this gets available in callbacks

  void *RpcInitPrivate(void *thread_parm);
  void RpcCallbackPrivate(struct svc_req *rqstp, register SVCXPRT *transp);
  void OnMessage1Svc(rpc_cb_message *, struct svc_req *);
  void OnReady1Svc(rpc_cb_ready *, struct svc_req *);
  void OnError1Svc(rpc_cb_error *err_param, struct svc_req *rqstp);

  std::string rpc_server_host;
  CLIENT *rpc_client;
  int rpc_prog;
};
}  // namespace media

#endif  // MEDIA_CDM_PPAPI_EXTERNAL_OPEN_CDM_COM_CDM_RPC_RPC_CDM_PLATFORM_HANDLER_H_


text:
namespace TrelloNet.Internal
{
	internal class BoardsForOrganizationRequest : OrganizationsRequest
	{
		public BoardsForOrganizationRequest(IOrganizationId organization, BoardFilter filter)
			: base(organization, "boards")
		{
			this.AddFilter(filter);
		}
	}
}


text:
<?php

namespace Webfactory\Doctrine\ORMTestInfrastructure;

use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManagerDecorator;

/**
 * Object manager that detaches entities after storing them.
 *
 * This decorator is mainly useful for imports, as entities are not populated
 * with database contents when they are already attached.
 * This may lead to tests that pass because of object identity without noticing
 * that the real reading from the database does not work as expected.
 *
 * @deprecated Will be removed in 2.0.
 * @see MemorizingObjectManagerDecorator
 * @internal
 */
class DetachingObjectManagerDecorator extends ObjectManagerDecorator
{

    /**
     * Contains all entities that will be detached on the next flush.
     *
     * @var array(object)
     */
    protected $entitiesToDetach = array();

    /**
     * Creates a decorator that encapsulates the provided object manager.
     *
     * @param ObjectManager $objectManager
     */
    public function __construct(ObjectManager $objectManager)
    {
        $this->wrapped = $objectManager;
    }

    /**
     * {@inheritdoc}
     *
     * @param object $object
     */
    public function persist($object): void
    {
        $this->entitiesToDetach[] = $object;
        $this->wrapped->persist($object);
    }

    /**
     * {@inheritdoc}
     */
    public function flush(): void
    {
        $this->wrapped->flush();
        $this->detachPersistedEntities();
    }

    /**
     * Detaches all entities that have been passed to persist.
     */
    protected function detachPersistedEntities()
    {
        foreach ($this->entitiesToDetach as $entity) {
            /* @var $entity object */
            $this->wrapped->detach($entity);
        }
        $this->entitiesToDetach = array();
    }
}


text:
package com.twu.biblioteca.options;

public interface Option {
    void onSelect();
}


text:
.leaflet_div {
  background: #eee;
  border: 1px solid #ddd;
  border-radius: 4pxt;
  box-shadow: 0 1px 1px #fff inset, 0 -1px 0px #ccc inset;
  margin-right: 1em;
}

.leaflet_div.align-left {
  float: left;
}

.leaflet_div.align-right {
  float: right;
}

.leaflet_div.align-center {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

.cke_widget_wrapper:hover>.cke_widget_element {
  outline: 3px solid yellow !important;
}


text:
var express    = require('express'),
    htmlEscape = require('html-escape'),
    bodyParser = require('body-parser');

var app = express();

var serveHelloWorld = function(req, res){
  res.send('Hello world!');
}

app.use(/\/sloths$/, function(req, res){
  res.send('Sloths rule!');
});

app.use('/images', express.static(__dirname+'/public/images'));

app.use('/tea/:flavor', function(req, res){
  var tea = req.params.flavor + ' tea';
  var html = '
'+
             '
I could use some ' + htmlEscape(tea) + '!
';
  res.send(html);
});

app.use(/\/(coffee)+/, function(req, res){
  var html = '
'+
             '
Lemurs = sloths that had too much coffee!
';
  res.send(html);
});

app.get('/coffee-shop', function(req, res){
  res.send('<form action="/order" method="POST">'+
             'Your name <input type="text" name="name" />
'+
             'Your beverage order <input type="text" name="beverage" />
'+
             '<input type="submit" value="Submit"/>'+
           '</form>');
});

app.post('/order', bodyParser.urlencoded({extended:true}), function(req, res){
  var name     = htmlEscape(req.body.name),
      beverage = htmlEscape(req.body.beverage);
  res.send('
One '+ beverage + ' coming right up ' + name + '!
');
});

app.use('/', serveHelloWorld);
app.listen(1123);


text:
package consulo.csharp.ide.highlight.check.impl;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.intellij.psi.PsiElement;
import consulo.annotation.access.RequiredReadAction;
import consulo.csharp.ide.highlight.CSharpHighlightContext;
import consulo.csharp.ide.highlight.check.CompilerCheck;
import consulo.csharp.lang.psi.CSharpMethodDeclaration;
import consulo.csharp.lang.psi.CSharpNamespaceDeclaration;
import consulo.csharp.lang.psi.CSharpTypeDeclaration;
import consulo.csharp.module.extension.CSharpLanguageVersion;
import consulo.dotnet.psi.DotNetQualifiedElement;

/**
 * @author VISTALL
 * @since 2020-02-07
 */
public class CS0116 extends CompilerCheck<DotNetQualifiedElement>
{
	@RequiredReadAction
	@Nullable
	@Override
	public HighlightInfoFactory checkImpl(@Nonnull CSharpLanguageVersion languageVersion, @Nonnull CSharpHighlightContext highlightContext, @Nonnull DotNetQualifiedElement element)
	{
		if(element instanceof CSharpTypeDeclaration ||
				element instanceof CSharpNamespaceDeclaration ||
				element instanceof CSharpMethodDeclaration && ((CSharpMethodDeclaration) element).isDelegate())
		{
			return null;
		}

		PsiElement parent = element.getParent();
		if(parent instanceof CSharpNamespaceDeclaration)
		{
			return newBuilder(getNameIdentifier(element));
		}
		return null;
	}
}


text:
/* jshint node: true, esnext: true */
'use strict';

var React = require('react');

var CommitBox = require('./commit-box');

module.exports = React.createClass({

  getInitialState : function () {
    return this._getState();
  },

  componentDidMount: function() {
    this.props.objects.onChange(this._onChange);
    this.props.config.onChange(this._onChange);
  },

  componentWillUnmount: function() {
    this.props.objects.offChange(this._onChange);
    this.props.config.offChange(this._onChange);
  },

  _onChange : function (counter) {
    this.replaceState(this._getState());
  },

  _getState : function () {
    var ref = this.props.config.getReference();
    var commit;
    if (ref) {
      commit = this.props.objects.getRef(ref);
      if (!commit) {
        this.props.objectActions.requestReference(this.props.config.getStore(), ref);
      }
    }
    return { commit };
  },

  render : function () {
    if (!this.state.commit || this.state.commit.loading) {
      return React.DOM.div(null, 'Loading...');
    }
    return React.createElement(CommitBox, {
      objects : this.props.objects,
      config : this.props.config,
      objectActions : this.props.objectActions,
      display : this.props.display,
      dispatch : this.props.dispatch,
      commit : this.state.commit.hash
    });
  }
});


text:
use pin_project_lite::pin_project;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};

pin_project! {
    /// Future for the [`unconstrained`](unconstrained) method.
    #[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
    #[must_use = "Unconstrained does nothing unless polled"]
    pub struct Unconstrained<F> {
        #[pin]
        inner: F,
    }
}

impl<F> Future for Unconstrained<F>
where
    F: Future,
{
    type Output = <F as Future>::Output;

    cfg_coop! {
        fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
            let inner = self.project().inner;
            crate::runtime::coop::with_unconstrained(|| inner.poll(cx))
        }
    }

    cfg_not_coop! {
        fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
            let inner = self.project().inner;
            inner.poll(cx)
        }
    }
}

/// Turn off cooperative scheduling for a future. The future will never be forced to yield by
/// Tokio. Using this exposes your service to starvation if the unconstrained future never yields
/// otherwise.
///
/// See also the usage example in the [task module](index.html#unconstrained).
#[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
pub fn unconstrained<F>(inner: F) -> Unconstrained<F> {
    Unconstrained { inner }
}


text:
package com.intel.hadoop.graphbuilder.idnormalize.mapreduce;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.TextOutputFormat;
import org.apache.log4j.Logger;

import com.intel.hadoop.graphbuilder.graph.Edge;
import com.intel.hadoop.graphbuilder.parser.FieldParser;
import com.intel.hadoop.graphbuilder.parser.GraphParser;

/**
 * This class partition the edge list input by the hash of the source vertex.
 *
 */
public class SortEdgeMR {
  private static final Logger LOG = Logger.getLogger(SortEdgeMR.class);

  /**
   * This mapper class maps each edge into (h(edge.source), edge). The hash
   * function depends on "numChunks" passed through the {@code JobConf}.
   *
   * @author Haijie Gu
   */
  public static class SortEdgeMapper extends MapReduceBase implements
      Mapper<LongWritable, Text, IntWritable, Text> {

    public void configure(JobConf conf) {
      super.configure(conf);
      numChunks = conf.getInt("numChunks", 256);
      try {
        this.graphparser = (GraphParser) Class.forName(conf.get("GraphParser"))
            .newInstance();
        this.vidparser = (FieldParser) Class.forName(conf.get("VidParser"))
            .newInstance();
        this.edataparser = (FieldParser) Class.forName(conf.get("EdataParser"))
            .newInstance();
      } catch (InstantiationException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      }
    }

    @Override
    public void map(LongWritable key, Text val,
        OutputCollector<IntWritable, Text> out, Reporter arg3)
        throws IOException {
      Edge e = graphparser.parseEdge(val.toString(), vidparser, edataparser);
      int hash = e.source().hashCode() % numChunks;
      if (hash < 0)
        hash += numChunks;
      out.collect(new IntWritable(hash), val);
    }

    private int numChunks;
    private GraphParser graphparser;
    private FieldParser vidparser;
    private FieldParser edataparser;
  }

  /**
   * This reducer class takes the input (hashval, edge) from mapper and outputs
   * edge directly.
   *
   * @author Haijie Gu
   */
  public static class SortEdgeReducer extends MapReduceBase implements
      Reducer<IntWritable, Text, IntWritable, Text> {

    @Override
    public void reduce(IntWritable key, Iterator<Text> iter,
        OutputCollector<IntWritable, Text> out, Reporter reporter)
        throws IOException {
      while (iter.hasNext()) {
        out.collect(null, iter.next());
      }
    }
  }

  public SortEdgeMR(int numChunks, GraphParser graphparser,
      FieldParser vidparser, FieldParser edataparser) {
    this.numChunks = numChunks;
    this.graphparser = graphparser;
    this.vidparser = vidparser;
    this.edataparser = edataparser;
  }

  public void run(String inputpath, String outputpath) throws IOException {

    JobConf conf = new JobConf(SortEdgeMR.class);

    conf.setOutputKeyClass(Text.class);
    conf.setOutputValueClass(Text.class);

    conf.setOutputKeyClass(IntWritable.class);
    conf.setOutputValueClass(Text.class);

    conf.setMapperClass(SortEdgeMapper.class);
    conf.setReducerClass(SortEdgeReducer.class);

    conf.setInputFormat(TextInputFormat.class);
    conf.setOutputFormat(TextOutputFormat.class);

    conf.setInt("numChunks", numChunks);
    conf.set("GraphParser", graphparser.getClass().getName());
    conf.set("VidParser", vidparser.getClass().getName());
    conf.set("EdataParser", edataparser.getClass().getName());

    FileInputFormat.setInputPaths(conf, new Path(inputpath));
    FileOutputFormat.setOutputPath(conf, new Path(outputpath));

    LOG.info("==== Job: Partition the input edges by hash(sourceid) =========");
    LOG.info("Input = " + inputpath);
    LOG.info("Output = " + outputpath);
    LOG.debug("numChunks = " + numChunks);
    LOG.debug("GraphParser = " + graphparser.getClass().getName());
    LOG.debug("VidParser = " + vidparser.getClass().getName());
    LOG.debug("EdataParser = " + edataparser.getClass().getName());
    LOG.info("===============================================================");

    JobClient.runJob(conf);
    LOG.info("=================== Done ====================================\n");
  }

  private int numChunks;
  private GraphParser graphparser;
  private FieldParser vidparser;
  private FieldParser edataparser;

}


text:
from __future__ import absolute_import, division, print_function, unicode_literals

import os
import unittest
from builtins import str

from pants.util.contextutil import environment_as
from pants.util.process_handler import subprocess
from pants_test.subsystem.subsystem_util import global_subsystem_instance
from pants_test.testutils.py2_compat import assertRegex

from pants.contrib.go.subsystems.go_distribution import GoDistribution

class GoDistributionTest(unittest.TestCase):

  @staticmethod
  def _generate_go_command_regex(gopath, final_value):
    goroot_env = r'GOROOT=[^ ]+'
    gopath_env = r'GOPATH={}'.format(gopath)
    # order of env values varies by interpreter and platform
    env_values = r'({goroot_env} {gopath_env}|{gopath_env} {goroot_env})'.format(goroot_env=goroot_env, gopath_env=gopath_env)
    return r'^{env_values} .*/go env {final_value}$'.format(env_values=env_values, final_value=final_value)

  def distribution(self):
    return global_subsystem_instance(GoDistribution)

  def test_bootstrap(self):
    go_distribution = self.distribution()
    go_cmd = go_distribution.create_go_cmd(cmd='env', args=['GOROOT'])
    output = go_cmd.check_output().decode('utf-8').strip()
    self.assertEqual(go_distribution.goroot, output)

  def assert_no_gopath(self):
    go_distribution = self.distribution()

    go_env = go_distribution.go_env()

    # As of go 1.8, when GOPATH is unset (set to ''), it defaults to ~/go (assuming HOME is set -
    # and we can't unset that since it might legitmately be used by the subcommand) - so we manually
    # fetch the "unset" default value here as our expected value for tests below.
    # The key thing to note here is this default value is used only when `gopath` passed to
    # `GoDistribution` is None, implying the command to be run does not need or use a GOPATH.
    cmd = [os.path.join(go_distribution.goroot, 'bin', 'go'), 'env', 'GOPATH']
    env = os.environ.copy()
    env.update(go_env)
    default_gopath = subprocess.check_output(cmd, env=env).decode('utf-8').strip()

    go_cmd = go_distribution.create_go_cmd(cmd='env', args=['GOPATH'])

    self.assertEqual(go_env, go_cmd.env)
    self.assertEqual('go', os.path.basename(go_cmd.cmdline[0]))
    self.assertEqual(['env', 'GOPATH'], go_cmd.cmdline[1:])
    self.assertEqual(default_gopath, go_cmd.check_output().decode('utf-8').strip())

    regex = GoDistributionTest._generate_go_command_regex(gopath=default_gopath, final_value='GOPATH')
    assertRegex(self, str(go_cmd), regex)

  def test_go_command_no_gopath(self):
    self.assert_no_gopath()

  def test_go_command_no_gopath_overrides_user_gopath_issue2321(self):
    # Without proper GOPATH scrubbing, this bogus entry leads to a `go env` failure as explained
    # here: https://github.com/pantsbuild/pants/issues/2321
    # Before that fix, the `go env` command would raise.
    with environment_as(GOPATH=':/bogus/first/entry'):
      self.assert_no_gopath()

  def test_go_command_gopath(self):
    go_distribution = self.distribution()
    go_cmd = go_distribution.create_go_cmd(cmd='env', gopath='/tmp/fred', args=['GOROOT'])

    self.assertEqual({'GOROOT': go_distribution.goroot,
                      'GOPATH': '/tmp/fred'}, go_cmd.env)
    self.assertEqual('go', os.path.basename(go_cmd.cmdline[0]))
    self.assertEqual(['env', 'GOROOT'], go_cmd.cmdline[1:])

    regex = GoDistributionTest._generate_go_command_regex(gopath='/tmp/fred', final_value='GOROOT')
    assertRegex(self, str(go_cmd), regex)


text:
package ru.mirea.oop.practice.coursej.s131226.impl.parsers;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.mirea.oop.practice.coursej.s131226.impl.Parser;
import ru.mirea.oop.practice.coursej.s131226.entities.Item;
import ru.mirea.oop.practice.coursej.s131226.entities.Snapshot;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

final class FissmanInfoParser implements Parser {
    public static final String TABLE_NAME = "fissmaninfo";
    private static final Logger logger = LoggerFactory.getLogger(FissmanInfoParser.class);

    public List<String> parseLinks() {
        List<String> categoryLinks = new ArrayList<>();
        Document document = null;
        try {
            document = Jsoup.connect("http://fissman.info/shop/index.php?route=common/home").timeout(10000).get();
        } catch (IOException e) {
            logger.error("Ошибка при получении данных с сайта.");
        }
        Elements catLinksElem;
        if (document != null) {
            catLinksElem = document.select("#menu").select("a");
            for (Element catLink : catLinksElem) {
                categoryLinks.add(catLink.attr("href") + "#limit=500");
            }
        }
        return categoryLinks;
    }

    @Override
    public Snapshot parsePrices() {
        Snapshot snapshot = new Snapshot(TABLE_NAME);
        for (String link : parseLinks()) {
            try {
                Document documentForCategory = Jsoup.connect(link).timeout(15000).get();
                Elements elements = documentForCategory.select("div");
                for (Element element : elements) {
                    int price = formatPrice(element.select(".price").text());
                    int article = formatArticle(element.select(".name").text());
                    if (article != 0 && price != 0 && price < 80000) {
                        snapshot.add(new Item(article, price));
                    }
                }
            } catch (IOException e) {
                logger.error("Ошибка при получении данных с сайта.");
            }
        }
        return snapshot;
    }

    private static int formatArticle(String articleStr) {
        if (!articleStr.equals("") && articleStr.length() < 200) {
            articleStr = articleStr.substring(0, 4);
            articleStr = articleStr.replaceAll("\\D", "");
            if (!articleStr.equals("")) {
                return Integer.parseInt(articleStr);
            } else return 0;
        } else {
            return 0;
        }
    }

    private static int formatPrice(String priceStr) {

        if (!priceStr.equals("") && priceStr.length() < 20) {
            priceStr = priceStr.replaceAll(" ", "");
            priceStr = priceStr.replaceAll("...Руб.", "");
            priceStr = priceStr.replaceAll("\\D", "");
            return Integer.parseInt(priceStr);

        } else {
            return 0;
        }
    }
}


text:
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
require 'clippie/cucumber'

require 'spec/expectations'

EXAMPLE_APP_ROOT = File.join(File.dirname(__FILE__), '..', '..', 'example_app', 'features','step_definitions')
Clippie::Cucumber::STEP_DEFINITIONS_ROOT = EXAMPLE_APP_ROOT
CREATED_STEP_FILE = File.join(EXAMPLE_APP_ROOT, "clippie_steps.rb")

Before do
  File.delete(CREATED_STEP_FILE) if File.exists? CREATED_STEP_FILE
end

After do
  File.delete(CREATED_STEP_FILE) if File.exists? CREATED_STEP_FILE
end


text:
For rendering components in the Pattern Library first you should create a YAML in your `PatternLibrary` folder for the
desired item to render. It is recommended to have separated folders inside PatternLibrary folder for separating
different kind of  components.

For example:
```yaml
status: 2
description: '<p>This is the button atom description.</p>'
renderer:
    type: twig
    options:
        template: 'atoms/button.html.twig'
        preview_parameters:
            primary:
                content: Hola
            link:
                content: Hola 2
                modifier: orange
                href: test
                tag: a
```

Then, reference it in `index.yml` on the desired section with the corresponding slug based on directory structure:
```yaml
status: 0
description: '<p>This is the icon card component description.</p>'
renderer:
    type: homepage
    options:
        sections:
            -
                title: 'Atoms'
                description: 'These are the atoms'
                items:
                    -
                        slug: 'architecture/atoms/button'
```

The component to render must exists in the current views folder of your application.


text:
<action>
    <field name="string">Account Summary</field>
    <field name="view_cls">report</field>
    <field name="model">report.account.sum</field>
    <field name="report_template">report_account_sum</field>
    <field name="report_template_xls">account_sum</field>
    <field name="menu">account_menu</field>
</action>


text:
<?xml version="1.0" encoding="UTF-8"?>
<sponge xmlns="https://sponge.openksavi.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://sponge.openksavi.org https://sponge.openksavi.org/schema/config.xsd">

    <knowledgeBases>
        <knowledgeBase name="kb" class="org.openksavi.sponge.kotlin.examples.KnowledgeBaseLibrary" />
    </knowledgeBases>
</sponge>


text:
import _dom from "../../../utils/dom-utils.js";

import _net from "../../../utils/net-utils.js";

import utils from "../../utils.js"

import jsonForms from "../../../editor/json-forms.js"

import validationHandler from "../../../editor/validation-handler.js"

import clusterEditor from "./cluster-edit.js"
import serviceEdit from "./service-edit.js"
import settingsEdit from "./settings-editor.js"

export const lifeEditor = life_editor();

export default lifeEditor

function life_editor() {

    _dom.logHead( "Module loaded" );

    const $targetContainer = $( "#lifeEditor" );
    let $clusterFilter, _clusterFilterTimer;

    let _lastEnvironmentSelected = null, _lastRelase = null, _lastFilter;

    let initialized = false;

    let _refreshFunction = function () {
        console.log( "_refreshFunction: Reloading summary view" );
        setTimeout( function () {
            loadEnvironmentTemplate( _lastEnvironmentSelected, _lastRelase );
        }, 500 )
    };

    let _lastSummary = null;

    return {
        //
        showSummaryView: function ( environment, container, project ) {

            //$targetContainer = container ;
            utils.setServiceEditorFunction( launchServiceEditor );
            if ( !initialized ) {
                initialize();
            }
            loadEnvironmentTemplate( environment, project );

        },
    }

    function initialize() {

        $( "#include-csap-templates-checkbox" ).change( function () {
            initialized = true;
            loadEnvironmentTemplate( _lastEnvironmentSelected, _lastRelase );
        } );
    }

    function loadEnvironmentTemplate( environment, releasePackage ) {
        // alertify.notify( "Loading: " + life );

        utils.loading( "loading environment" );

        if ( !environment ) {

            if ( _lastEnvironmentSelected ) {
                environment = _lastEnvironmentSelected;
            } else {
                environment = utils.getActiveEnvironment();
            }
        }

        _lastEnvironmentSelected = environment, _lastRelase = releasePackage;

        if ( $clusterFilter ) {
            _lastFilter = $clusterFilter.val();
        }

        let includeTemplates = $( "#include-csap-templates-checkbox" ).is( ":checked" );

        let params = {
            lifeToEdit: environment,
            project: releasePackage,
            includeTemplates: includeTemplates
        };

        console.log( `loading environment: '${ environment }', url: ${ lifeEditUrl }` );
        $.get( lifeEditUrl,
            params,
            function ( lifeDialogHtml ) {
                showSummaryView( lifeDialogHtml );
                $( "#include-csap-templates-checkbox" ).prop( "checked", includeTemplates );
            },
            'html' );
    }

    function showSummaryView( lifeEditView ) {

        _lastSummary = lifeEditView;

        let $batchContent = $( "" ).html( lifeEditView ).find( '#lifeEditorWrapper' );
        console.log( "showSummaryView(): content Length: " + $batchContent.text().length );

        $targetContainer.html( $batchContent );

        // note event registration is done each time as the contents are replaced
        let $lifeTable = $( "#editLifeTable", $targetContainer );
        $clusterFilter = $( "#clusterFilter", $lifeTable );

        console.log( "clusterHostName width: ", $( ".clusterHostName" ).first().outerWidth( true ) );

        console.log( `initialize() Registering Events ${ $clusterFilter.length }` );
        $clusterFilter.off().keyup( applyClusterFilter );

        if ( _lastFilter ) {
            $clusterFilter.val( _lastFilter );
            $clusterFilter.trigger( "keyup" );
        }

        utils.loadingComplete();

        $( ".lifeSelection" ).selectmenu( {
            change: function () {
                console.log( "showLifeEditor editing env: " + $( this ).val() );
                loadEnvironmentTemplate( $( this ).val(), utils.getActiveProject() );
            }
        } );

        registerLifeOperations();

        // console.log("showSummaryView: hostName: " + hostName + " serviceName: " + serviceName);
        serviceEdit.setRefresh( _refreshFunction );
        $( '.editServiceButton' ).click( function () {
            let serviceName = $( this ).text().trim();
            launchServiceEditor( serviceName );
            return false;
        } );

        $( ".addServiceClusterButton", $targetContainer ).click( function () {
            console.log( "Adding servicex" );
            alertify.prompt( "Add a new service", 'Enter the name', "my-new-service",
                function ( evt, newServiceName ) {
                    console.log( 'newServiceName: ' + newServiceName );
                    let params = {
                        project: utils.getActiveProject(),
                        serviceName: newServiceName,
                        "newService": "newService",
                        hostName: "*"
                    }
                    $.get( serviceEditUrl,
                        params,
                        function ( dialogHtml ) {
                            serviceEdit.showServiceDialog( newServiceName, dialogHtml )
                        },
                        'html' );
                },
                function () {
                    console.log( "canceled" );
                }
            );
            return false;
        } );

        $( '#editSettingsButton' ).click( function () {

            let lifeEdit = $( "#lifeEdit" ).val();

            console.log( "\n\nshowSummaryView(): launching: " + settingsEditUrl + " lifeEdit: " + lifeEdit );

            let params = {
                lifeToEdit: lifeEdit,
                project: utils.getActiveProject()
            }

            utils.loading( `Loading Settings...` );

            $.get( settingsEditUrl,
                params,
                function ( htmlPage ) {
                    utils.loadingComplete();
                    settingsEdit.showSettingsDialog( htmlPage );
                },
                'html' );

            //}
        } );

        $( '.editClusterButton' ).click( function () {

            let lifeEdit = $( "#lifeEdit" ).val();
            let clusterName = $( this ).text().trim();
            let relPkg = utils.getActiveProject();

            console.log( "\n\nshowSummaryView(): launching: " + clusterEditUrl
                + " lifeEdit: " + lifeEdit + " clusterName: " + clusterName + " project: " + relPkg );

            let includeTemplates = $( "#include-csap-templates-checkbox" ).is( ":checked" );
            let params = {
                project: relPkg,
                lifeToEdit: lifeEdit,
                clusterName: clusterName,
                includeTemplates: includeTemplates
            }

            launchClusterEditor( params );

            return false;

        } );

        $( ".addNewClusterButton" ).click( function () {
            console.log( "Adding cluster" );
            alertify.prompt( "New service cluster", 'Enter the name', "your-new-cluster",
                function ( evt, newClusterName ) {

                    let lifeEdit = $( "#lifeEdit" ).val();
                    let clusterName = $( this ).text().trim();
                    let relPkg = utils.getActiveProject();

                    let params = {
                        project: relPkg,
                        lifeToEdit: lifeEdit,
                        "newService": "newService",
                        clusterName: newClusterName
                    }

                    launchClusterEditor( params );

                },
                function () {
                    console.log( "canceled" );
                }
            );
            return false;
        } );
    }

    function applyClusterFilter() {

        clearTimeout( _clusterFilterTimer );

        _clusterFilterTimer = setTimeout( function () {

            let filter = $clusterFilter.val();
            let $lifeTable = $( "#editLifeTable", $targetContainer );

            console.log( "Need to filter: " + filter );
            $( "tbody tr", $lifeTable ).each( function () {
                let numberMatches = 0;
                $( "a", $( this ) ).each( function () {
                    if ( $( this ).text().toLowerCase().contains( filter.toLowerCase() ) ) {
                        numberMatches += 1;
                        $( this ).addClass( "svcHighlight" );
                    } else {
                        $( this ).removeClass( "svcHighlight" );
                    }
                } );
                $( "div.clusterHostName", $( this ) ).each( function () {
                    if ( $( this ).text().toLowerCase().contains( filter.toLowerCase() ) ) {
                        numberMatches += 1;
                        $( this ).addClass( "svcHighlight" );
                    } else {
                        $( this ).removeClass( "svcHighlight" );
                    }
                } );

                console.log( "Filter matches: " + numberMatches + " filter.length: " + filter.length );
                if ( numberMatches == 0 ) {
                    $( this ).hide();
                } else {
                    $( this ).show();
                }
            } );

            if ( filter.length == 0 ) {
                $( ".svcHighlight", $lifeTable ).removeClass( "svcHighlight" );
            }

        }, 200 );

    }

    function launchServiceEditor( serviceName ) {
        console.log( "\n\nshowSummaryView(): launching: " + serviceEditUrl + " serviceName: " + serviceName );

        let includeTemplates = $( "#include-csap-templates-checkbox" ).is( ":checked" );

        let params = {
            project: utils.getActiveProject(),
            serviceName: serviceName,
            hostName: "*",
            includeTemplates: includeTemplates
        }

        utils.loading( "Loading service definition" );
        $.get( serviceEditUrl,
            params,
            function ( dialogHtml ) {
                serviceEdit.showServiceDialog( serviceName, dialogHtml );
                utils.loadingComplete();
            },
            'html' );
    }

    function launchClusterEditor( params ) {

        console.log( `launchClusterEditor(): launching: ${ clusterEditUrl } params ${ params } _lastLife: ${ _lastEnvironmentSelected }` );

        clusterEditor.setRefresh( _refreshFunction );

        utils.loading( `Loading cluster...` );
        $.get( clusterEditUrl,
            params,
            function ( htmlTemplate ) {
                utils.loadingComplete();
                clusterEditor.show( htmlTemplate );
            }
            ,
            'html' );
    }

    function registerLifeOperations() {

        $( ".addNewLifeButton" ).click( function () {
            //alertify.notify( "Adding life" );
            alertify.prompt( "Add a new runtime environment", 'Enviroment name must be lowercase, host compliant. Eg. dev, dev-1, test-2, lt, prod', "dev-sandbox-1",
                function ( evt, newName ) {
                    console.log( 'newName: ' + newName );
                    if ( newName.includes( "desktop" ) || newName.includes( "agent" ) || newName.includes( "desktop" ) ) {
                        alertify.csapWarning( "lifecycle name cannot be desktop, agent, or admin. Select another name" );
                        return;
                    }
                    let params = {
                        project: utils.getActiveProject(),
                        newName: newName,
                        lifeToEdit: $( ".lifeSelection" ).val(),
                        "operation": "add"
                    }

                    _lastEnvironmentSelected = newName;

                    $.post( lifeUpdateUrl,
                        params,
                        showLifeOperationResults,
                        'json' );
                },
                function () {
                    console.log( "canceled" );
                }
            );
            return false;

        } );

        $( ".removeLifeButton" ).click( function () {
            alertify.confirm( "Life cycle Removal", 'Click ok to continue',
                function ( evt, newName ) {
                    console.log( 'newName: ' + newName );
                    let params = {
                        project: utils.getActiveProject(),
                        lifeToEdit: $( ".lifeSelection" ).val(),
                        "operation": "delete"
                    }
                    $( ".lifeSelection option[value='" + _lastEnvironmentSelected + "']" ).remove();
                    _lastEnvironmentSelected = $( ".lifeSelection" ).val();
                    $.post( lifeUpdateUrl,
                        params,
                        showLifeOperationResults,
                        'json' );
                },
                function () {
                    console.log( "canceled" );
                }
            );
            return false;
        } );

    }

    function showLifeOperationResults( updatesResult ) {

        console.log( "showLifeOperationResults()", updatesResult );

        let $userMessage = validationHandler.processValidationResults( updatesResult.validationResults );

        let $debugInfo = jQuery( '
', {
            class: "debugInfo",
            text: "*details...." + JSON.stringify( updatesResult, null, "\t" )
        } );

        let okFunction = function () {
            console.log( "Closed results" );
            _refreshFunction();
        }

        $userMessage.append( $debugInfo );
        if ( updatesResult.updatedHost ) {
            let $moreInfo = $( "#dialogResult" ).clone().css( "display", "block" );
            $( ".noteAlt", $moreInfo ).text( updatesResult.updatedHost );
            $userMessage.append( $moreInfo );

        }

        if ( updatesResult.message ) {
            $userMessage.append( "

" + updatesResult.message );
        }

        jsonForms.showUpateResponseDialog( "Life cycle Results", $userMessage.html(), okFunction );

        if ( updatesResult.validationResults.success ) {
            console.log( "showLifeOperationResults() triggering definition reload" );
            jsonForms.runUpdateFunction();
        }
    }
    ;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.
  ~
  ~ Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>build-parent</artifactId>
    <version>2018.1.0-SNAPSHOT</version>
    <relativePath>../../build-parent/pom.xml</relativePath>
  </parent>

  <groupId>org.wildfly.swarm</groupId>
  <artifactId>swagger-webapp</artifactId>

  <name>Swagger Webapp</name>
  <description>UI for Swagger to visualize the generated swagger.json</description>

  <packaging>jar</packaging>

  <properties>
    <swarm.fraction.tags>Web,Management</swarm.fraction.tags>
  </properties>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>swagger-ui</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeGroupIds>org.webjars</includeGroupIds>
              <outputDirectory>${project.build.directory}/classes/modules/org/webjars/swagger-ui/main/</outputDirectory>
              <stripVersion>true</stripVersion>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>container</artifactId>
    </dependency>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>spi</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss</groupId>
      <artifactId>staxmapper</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>undertow</artifactId>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>swagger-ui</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging-annotations</artifactId>
      <!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
            projects that depend on this project.-->
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging-processor</artifactId>
      <!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
            projects that depend on this project.-->
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
  </dependencies>

</project>


text:
namespace moss
{
    class Debugger;

    class DebugConfig
    {
        public:
            DebugConfig();

            void breakpoint_line(const std::string &filename, uint32_t line_number, bool set);
            bool breakpoint_line(const std::string &filename, uint32_t line_number) const;

            void apply_to_debugger(Debugger *debugger);

            const std::vector<std::string> &filenames() const;

            void to_stream(std::ostream &ss);
            void from_stream(std::istream &ss);
        private:
            enum DeserialiseState
            {
                READ_NONE,
                READ_FILENAMES,
                READ_DATA
            };

            void breakpoint_line(uint32_t filename_index, uint32_t line_number, bool set);
            bool breakpoint_line(uint32_t filename_index, uint32_t line_number) const;

            std::vector<std::string> _filenames;
            std::map<uint32_t, std::map<uint32_t, bool> > _file_breakpoints;

            DeserialiseState _deserialise_state;

            uint32_t find_filename(const std::string &filename) const;

            void read_data(const std::vector<std::string> &line);

    };
}


text:
layout: post
microblog: true
audio:
photo:
date: 2012-07-27 08:37:58 -0600
guid: http://craigmcclellan.micro.blog/2012/07/27/t228861795320860672.html
---
#Crossroads2012 is officially in the books. Thankful for an amazing summer, and that I get to see my wife tonight.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - coverage.info - test/core/Registry.cpp - functions</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">

LCOV - code coverage report

            Current view:
            top level - test/core - Registry.cpp (source / functions)

            Hit
            Total
            Coverage

            Test:
            coverage.info

            Lines:
            230
            232
            99.1 %

            Date:
            2016-11-16 18:44:36

            Functions:
            81
            82
            98.8 %

      Function Name
      Hit count

              _ZN12RegistryTestD0Ev
              0

              _GLOBAL__sub_I__ZN13MockComponent8finalizeERKSt6vectorIPN7theoria4core9ComponentESaIS4_EE
              1

              _Z41__static_initialization_and_destruction_0ii
              1

              _ZN22RegistryTest_Dump_Test8TestBodyEv
              1

              _ZN22RegistryTest_Dump_TestC2Ev
              1

              _ZN22RegistryTest_Dump_TestD0Ev
              1

              _ZN22RegistryTest_Dump_TestD2Ev
              1

              _ZN31RegistryTest_ComponentById_Test8TestBodyEv
              1

              _ZN31RegistryTest_ComponentById_TestC2Ev
              1

              _ZN31RegistryTest_ComponentById_TestD0Ev
              1

              _ZN31RegistryTest_ComponentById_TestD2Ev
              1

              _ZN32RegistryTest_ComponentByDep_Test8TestBodyEv
              1

              _ZN32RegistryTest_ComponentByDep_TestC2Ev
              1

              _ZN32RegistryTest_ComponentByDep_TestD0Ev
              1

              _ZN32RegistryTest_ComponentByDep_TestD2Ev
              1

              _ZN33RegistryTest_ComponentByType_Test8TestBodyEv
              1

              _ZN33RegistryTest_ComponentByType_TestC2Ev
              1

              _ZN33RegistryTest_ComponentByType_TestD0Ev
              1

              _ZN33RegistryTest_ComponentByType_TestD2Ev
              1

              _ZN36RegistryTest_LockingWithTimeOut_Test8TestBodyEv
              1

              _ZN36RegistryTest_LockingWithTimeOut_TestC2Ev
              1

              _ZN36RegistryTest_LockingWithTimeOut_TestD0Ev
              1

              _ZN36RegistryTest_LockingWithTimeOut_TestD2Ev
              1

              _ZN39RegistryTest_CreateByDepNoMatching_Test8TestBodyEv
              1

              _ZN39RegistryTest_CreateByDepNoMatching_TestC2Ev
              1

              _ZN39RegistryTest_CreateByDepNoMatching_TestD0Ev
              1

              _ZN39RegistryTest_CreateByDepNoMatching_TestD2Ev
              1

              _ZN40RegistryTest_ComponentByTypeSubType_Test8TestBodyEv
              1

              _ZN40RegistryTest_ComponentByTypeSubType_TestC2Ev
              1

              _ZN40RegistryTest_ComponentByTypeSubType_TestD0Ev
              1

              _ZN40RegistryTest_ComponentByTypeSubType_TestD2Ev
              1

              _ZN42RegistryTest_CreateByDepTwoRegistered_Test8TestBodyEv
              1

              _ZN42RegistryTest_CreateByDepTwoRegistered_TestC2Ev
              1

              _ZN42RegistryTest_CreateByDepTwoRegistered_TestD0Ev
              1

              _ZN42RegistryTest_CreateByDepTwoRegistered_TestD2Ev
              1

              _ZN44RegistryTest_CreateByDepOnlyOneRegister_Test8TestBodyEv
              1

              _ZN44RegistryTest_CreateByDepOnlyOneRegister_TestC2Ev
              1

              _ZN44RegistryTest_CreateByDepOnlyOneRegister_TestD0Ev
              1

              _ZN44RegistryTest_CreateByDepOnlyOneRegister_TestD2Ev
              1

              _ZN47RegistryTest_FactoryMapIteratorWithLocking_Test8TestBodyEv
              1

              _ZN47RegistryTest_FactoryMapIteratorWithLocking_TestC2Ev
              1

              _ZN47RegistryTest_FactoryMapIteratorWithLocking_TestD0Ev
              1

              _ZN47RegistryTest_FactoryMapIteratorWithLocking_TestD2Ev
              1

              _ZN47RegistryTest_RegisterFactoryByTypenameOnly_Test8TestBodyEv
              1

              _ZN47RegistryTest_RegisterFactoryByTypenameOnly_TestC2Ev
              1

              _ZN47RegistryTest_RegisterFactoryByTypenameOnly_TestD0Ev
              1

              _ZN47RegistryTest_RegisterFactoryByTypenameOnly_TestD2Ev
              1

              _ZN49RegistryTest_CreateByTypenameOnlyOneRegister_Test8TestBodyEv
              1

              _ZN49RegistryTest_CreateByTypenameOnlyOneRegister_TestC2Ev
              1

              _ZN49RegistryTest_CreateByTypenameOnlyOneRegister_TestD0Ev
              1

              _ZN49RegistryTest_CreateByTypenameOnlyOneRegister_TestD2Ev
              1

              _ZN53RegistryTest_CreateByTypenameTwoRegisterUseFirst_Test8TestBodyEv
              1

              _ZN53RegistryTest_CreateByTypenameTwoRegisterUseFirst_TestC2Ev
              1

              _ZN53RegistryTest_CreateByTypenameTwoRegisterUseFirst_TestD0Ev
              1

              _ZN53RegistryTest_CreateByTypenameTwoRegisterUseFirst_TestD2Ev
              1

              _ZN53RegistryTest_RegisterFactoryByTypenameAndSubType_Test8TestBodyEv
              1

              _ZN53RegistryTest_RegisterFactoryByTypenameAndSubType_TestC2Ev
              1

              _ZN53RegistryTest_RegisterFactoryByTypenameAndSubType_TestD0Ev
              1

              _ZN53RegistryTest_RegisterFactoryByTypenameAndSubType_TestD2Ev
              1

              _ZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_Test8TestBodyEv
              1

              _ZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_TestC2Ev
              1

              _ZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_TestD0Ev
              1

              _ZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_TestD2Ev
              1

              _ZN56RegistryTest_TestCreateComponentNotRegisteredThrows_Test8TestBodyEv
              1

              _ZN56RegistryTest_TestCreateComponentNotRegisteredThrows_TestC2Ev
              1

              _ZN56RegistryTest_TestCreateComponentNotRegisteredThrows_TestD0Ev
              1

              _ZN56RegistryTest_TestCreateComponentNotRegisteredThrows_TestD2Ev
              1

              _ZN59RegistryTest_CreateByTypenameTwoRegisterUseAlreadyUsed_Test8TestBodyEv
              1

              _ZN59RegistryTest_CreateByTypenameTwoRegisterUseAlreadyUsed_TestC2Ev
              1

              _ZN59RegistryTest_CreateByTypenameTwoRegisterUseAlreadyUsed_TestD0Ev
              1

              _ZN59RegistryTest_CreateByTypenameTwoRegisterUseAlreadyUsed_TestD2Ev
              1

              _ZN66RegistryTest_CreateByTypenameTwoRegisterErrorDueToNoAmbiguity_Test8TestBodyEv
              1

              _ZN66RegistryTest_CreateByTypenameTwoRegisterErrorDueToNoAmbiguity_TestC2Ev
              1

              _ZN66RegistryTest_CreateByTypenameTwoRegisterErrorDueToNoAmbiguity_TestD0Ev
              1

              _ZN66RegistryTest_CreateByTypenameTwoRegisterErrorDueToNoAmbiguity_TestD2Ev
              1

              _ZZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_Test8TestBodyEvENKUlT_E_cvPFDTcldtLPv0Eclfp_EES0_EIRSt4pairIKS7_ISsSsEPFPN7theoria4core9ComponentEiEEEEv
              1

              _ZZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_Test8TestBodyEvENKUlT_E_clISt4pairIKS3_ISsSsEPFPN7theoria4core9ComponentEiEEEEDaS0_
              2

              _ZZN55RegistryTest_CreateByTypenameTwoRegisterUseDefault_Test8TestBodyEvENUlT_E_4_FUNIRSt4pairIKS3_ISsSsEPFPN7theoria4core9ComponentEiEEEEDTcldtLPv0Eclfp_EES0_
              2

              _ZN12_GLOBAL__N_18containsERKSsS1_
              4

              _ZN12RegistryTest8TearDownEv
              18

              _ZN12RegistryTestC2Ev
              18

              _ZN12RegistryTestD2Ev
              18

Generated by: LCOV version 1.11


text:
import __ from './__';

// methods
import add from './add';
import always from './always';
import append from './append';
import apply from './apply';
import arity from './arity';
import ascend from './ascend';
import bind from './bind';
import compose from './compose';
import curry from './curry';
import descend from './descend';
import divide from './divide';
import empty from './empty';
import endsWith from './endsWith';
import entries from './entries';
import equals from './equals';
import equalsBy from './equalsBy';
import every from './every';
import filter from './filter';
import find from './find';
import findIndex from './findIndex';
import findKey from './findKey';
import findLast from './findLast';
import findLastIndex from './findLastIndex';
import findLastKey from './findLastKey';
import flatten from './flatten';
import forEach from './forEach';
import get from './get';
import gt from './gt';
import gte from './gte';
import has from './has';
import identity from './identity';
import includes from './includes';
import insert from './insert';
import instanceOf from './instanceOf';
import is from './is';
import lt from './lt';
import lte from './lte';
import map from './map';
import max from './max';
import merge from './merge';
import mergeDeep from './mergeDeep';
import min from './min';
import modulo from './modulo';
import multiply from './multiply';
import not from './not';
import notBy from './notBy';
import omit from './omit';
import partial from './partial';
import partialRight from './partialRight';
import partition from './partition';
import pick from './pick';
import pipe from './pipe';
import pluck from './pluck';
import prepend from './prepend';
import reduce from './reduce';
import reduceRight from './reduceRight';
import reject from './reject';
import remainder from './remainder';
import rest from './rest';
import set from './set';
import some from './some';
import sort from './sort';
import sortBy from './sortBy';
import sortWith from './sortWith';
import startsWith from './startsWith';
import subtract from './subtract';
import take from './take';
import tap from './tap';
import tryCatch from './tryCatch';
import typeOf from './typeOf';
import uncurry from './uncurry';
import unique from './unique';
import uniqueBy from './uniqueBy';

export {
  // eslint-disable-next-line
  __,
  add,
  always,
  append,
  apply,
  arity,
  ascend,
  bind,
  compose,
  curry,
  descend,
  divide,
  empty,
  endsWith,
  entries,
  equals,
  equalsBy,
  every,
  filter,
  find,
  findIndex,
  findKey,
  findLast,
  findLastIndex,
  findLastKey,
  flatten,
  forEach,
  get,
  gt,
  gte,
  has,
  identity,
  includes,
  insert,
  instanceOf,
  is,
  lt,
  lte,
  map,
  max,
  merge,
  mergeDeep,
  min,
  modulo,
  multiply,
  not,
  notBy,
  omit,
  partial,
  partialRight,
  partition,
  pick,
  pipe,
  pluck,
  prepend,
  reduce,
  reduceRight,
  reject,
  remainder,
  rest,
  set,
  some,
  sort,
  sortBy,
  sortWith,
  startsWith,
  subtract,
  take,
  tap,
  tryCatch,
  typeOf,
  uncurry,
  unique,
  uniqueBy,
};

export default {
  // eslint-disable-next-line
  __,
  add,
  always,
  append,
  apply,
  arity,
  ascend,
  bind,
  compose,
  curry,
  descend,
  divide,
  empty,
  endsWith,
  entries,
  equals,
  equalsBy,
  every,
  filter,
  find,
  findIndex,
  findKey,
  findLast,
  findLastIndex,
  findLastKey,
  flatten,
  forEach,
  get,
  gt,
  gte,
  has,
  identity,
  includes,
  insert,
  instanceOf,
  is,
  lt,
  lte,
  map,
  max,
  merge,
  mergeDeep,
  min,
  modulo,
  multiply,
  not,
  notBy,
  omit,
  partial,
  partialRight,
  partition,
  pick,
  pipe,
  pluck,
  prepend,
  reduce,
  reduceRight,
  reject,
  remainder,
  rest,
  set,
  some,
  sort,
  sortBy,
  sortWith,
  startsWith,
  subtract,
  take,
  tap,
  tryCatch,
  typeOf,
  uncurry,
  unique,
  uniqueBy,
};


text:
const channels = require("../../modules/channels.js");
module.exports = async (member, newChannel, oldChannel) => {
	let channelOwnerNew = await channels.memberFromChannel(newChannel);
	let channelOwnerOld = await channels.memberFromChannel(oldChannel);
	if(channelOwnerNew && typeof channelOwnerNew === "object" && !member.bot) {
		if(newChannel.deleteTimeout) {
			clearTimeout(newChannel.deleteTimeout);
			delete newChannel.deleteTimeout;
		}
	}

	if(channelOwnerOld && typeof channelOwnerOld === "object" &&
		!oldChannel.voiceMembers.filter(voiceMember => !voiceMember.bot).length) {
		oldChannel.deleteTimeout = setTimeout(() => channels.delete(channelOwnerOld), 300000);
	}
};


text:
/*
 * Programmer:  Quincey Koziol <koziol@hdfgroup.org>
 *              Apr 17, 2007
 *
 * Purpose:     This program is run to generate an HDF5 data file with several
 *              datasets that have "bogus" messages in their object header.
 */

#include "H5private.h"
#include "hdf5.h"
#include "H5Oprivate.h"

#ifdef H5O_ENABLE_BOGUS
#define FILENAME "tbogus.h5"
#endif /* H5O_ENABLE_BOGUS */

#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */

int main(void)
{
#ifdef H5O_ENABLE_BOGUS
    hid_t fid = -1;             /* File ID */
    hid_t sid = -1;             /* Dataspace ID */
    hid_t dcpl = -1;            /* Dataset creation property list ID */
    hid_t did = -1;             /* Dataset ID */
    uint8_t bogus_flags = 0;    /* Flags for bogus message */

    /* Create file for test datasets */
    if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;

    /* Create dataspace for datasets */
    if((sid = H5Screate(H5S_SCALAR)) < 0) goto error;

    /* Create dataset creation property list */
    if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;

    /* Add property for bogus message flags */
    if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;

    /* Create dataset with "bogus" message, but no message flags */
    if((did = H5Dcreate2(fid, "/Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
    if(H5Dclose(did) < 0) goto error;

    /* Set "fail if unknown" message flag for bogus message */
    bogus_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE;
    if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;

    /* Create second dataset, with "fail if unknown" message flag */
    if((did = H5Dcreate2(fid, "/Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
    if(H5Dclose(did) < 0) goto error;

    /* Set "mark if unknown" message flag for bogus message */
    bogus_flags = H5O_MSG_FLAG_MARK_IF_UNKNOWN;
    if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;

    /* Create second dataset, with "mark if unknown" message flag */
    if((did = H5Dcreate2(fid, "/Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
    if(H5Dclose(did) < 0) goto error;

    /* Close dataset creation property list */
    if(H5Pclose(dcpl) < 0) goto error;

    /* Close dataspace */
    if(H5Sclose(sid) < 0) goto error;

    /* Close file */
    if(H5Fclose(fid) < 0) goto error;

    return 0;

error:
    H5E_BEGIN_TRY {
        H5Dclose(did);
        H5Sclose(sid);
        H5Pclose(dcpl);
        H5Fclose(fid);
    } H5E_END_TRY;
#else /* H5O_ENABLE_BOGUS */
    HDputs("H5O_ENABLE_BOGUS compiler macro not defined!");
#endif /* H5O_ENABLE_BOGUS */
    return 1;
}


text:
Originally published: 2005-12-27 10:19:59
Last updated: 2006-11-15 16:58:11
Author: Michael Palmer

An enhanced version of yaptu, with the following changes
- separated parsing from execution
- added caching of parsed templates
- added some error reporting
- added a choice of template syntaxes
- added comment syntax
- added Cheetah-style variable substitution with optional caching of the equivalent Python expression
- limited flow control to 'for' and 'if'
Reasonably small, no external dependencies, pretty fast.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

	<TITLE>
	The libsndfile API
	</TITLE>
	<META NAME="Author"      CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
	<META NAME="Description" CONTENT="The libsndfile API.">
	<META NAME="Keywords"    CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
	<LINK REL="stylesheet" HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
	<LINK REL="stylesheet" HREF="print.css" TYPE="text/css" MEDIA="print">

libsndfile

	Libsndfile is a library designed to allow the reading and writing of many
	different sampled sound file formats (such as MS Windows WAV and the Apple/SGI
	AIFF format) through one standard library interface.

	During read and write operations, formats are seamlessly converted between the
	format the application program has requested or supplied and the file's data
	format. The application programmer can remain blissfully unaware of issues
	such as file endian-ness and data format. See Note 1 and
	Note 2.

	Every effort is made to keep these documents up-to-date, error free and
	unambiguous.
	However, since maintaining the documentation is the least fun part of working
	on libsndfile, these docs can and do fall behind the behaviour of library.
	If any errors, omissions or ambiguities are found, please notify

	Erik de Castro Lopo.

	To supplement this reference documentation, there are simple example programs
	included in the source code tarball.
	The test suite which is also part of the source code tarball is also a good
	place to look for the correct usage of the library functions.

	 Finally, if you think there is some feature missing from libsndfile, check that
	it isn't already implemented (and documented)
		here.

Synopsis

The functions of libsndfile are defined as follows:

      #include <stdio.h>
      #include <sndfile.h>

      SNDFILE*    sf_open          (const char *path, int mode, SF_INFO *sfinfo) ;
      SNDFILE*    sf_open_fd       (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;

      int         sf_format_check  (const SF_INFO *info) ;

      sf_count_t  sf_seek          (SNDFILE *sndfile, sf_count_t frames, int whence) ;

      int         sf_command       (SNDFILE *sndfile, int cmd, void *data, int datasize) ;

      int         sf_error         (SNDFILE *sndfile) ;
      const char* sf_strerror      (SNDFILE *sndfile) ;
      const char* sf_error_number  (int errnum) ;

      int         sf_perror        (SNDFILE *sndfile) ;
      int         sf_error_str     (SNDFILE *sndfile, char* str, size_t len) ;

      int         sf_close         (SNDFILE *sndfile) ;
      void        sf_write_sync    (SNDFILE *sndfile) ;

      sf_count_t  sf_read_short    (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
      sf_count_t  sf_read_int      (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
      sf_count_t  sf_read_float    (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
      sf_count_t  sf_read_double   (SNDFILE *sndfile, double *ptr, sf_count_t items) ;

      sf_count_t  sf_readf_short   (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_int     (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_float   (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_double  (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;

      sf_count_t  sf_write_short   (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
      sf_count_t  sf_write_int     (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
      sf_count_t  sf_write_float   (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
      sf_count_t  sf_write_double  (SNDFILE *sndfile, double *ptr, sf_count_t items) ;

      sf_count_t  sf_writef_short  (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_int    (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_float  (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;

      sf_count_t  sf_read_raw      (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
      sf_count_t  sf_write_raw     (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;

      const char* sf_get_string    (SNDFILE *sndfile, int str_type) ;
      int         sf_set_string    (SNDFILE *sndfile, int str_type, const char* str) ;

SNDFILE* is an anonymous pointer to data which is private to the library.

File Open Function

      SNDFILE*  sf_open    (const char *path, int mode, SF_INFO *sfinfo) ;

The SF_INFO structure is for passing data between the calling function and the library
when opening a file for reading or writing. It is defined in sndfile.h as follows:

      typedef struct
      {    sf_count_t  frames ;     /* Used to be called samples. */
           int         samplerate ;
           int         channels ;
           int         format ;
           int         sections ;
           int         seekable ;
       } SF_INFO ;

The mode parameter for this function can be any one of the following three values:

      SFM_READ    - read only mode
      SFM_WRITE   - write only mode
      SFM_RDWR    - read/write mode

When opening a file for read, the format field should be set to zero before
calling sf_open().
The only exception to this is the case of RAW files where the caller has to set
the samplerate, channels and format fields to valid values.
All other fields of the structure are filled in by the library.

When opening a file for write, the caller must fill in structure members samplerate,
channels, and format.

The format field in the above SF_INFO structure is made up of the bit-wise OR of a
major format type (values between 0x10000 and 0x08000000), a minor format type
(with values less than 0x10000) and an optional endian-ness value.
The currently understood formats are listed in sndfile.h as follows and also include
bitmasks for separating major and minor file types.
Not all combinations of endian-ness and major and minor file types are valid.

      enum
      {   /* Major formats. */
          SF_FORMAT_WAV          = 0x010000,     /* Microsoft WAV format (little endian). */
          SF_FORMAT_AIFF         = 0x020000,     /* Apple/SGI AIFF format (big endian). */
          SF_FORMAT_AU           = 0x030000,     /* Sun/NeXT AU format (big endian). */
          SF_FORMAT_RAW          = 0x040000,     /* RAW PCM data. */
          SF_FORMAT_PAF          = 0x050000,     /* Ensoniq PARIS file format. */
          SF_FORMAT_SVX          = 0x060000,     /* Amiga IFF / SVX8 / SV16 format. */
          SF_FORMAT_NIST         = 0x070000,     /* Sphere NIST format. */
          SF_FORMAT_VOC          = 0x080000,     /* VOC files. */
          SF_FORMAT_IRCAM        = 0x0A0000,     /* Berkeley/IRCAM/CARL */
          SF_FORMAT_W64          = 0x0B0000,     /* Sonic Foundry's 64 bit RIFF/WAV */
          SF_FORMAT_MAT4         = 0x0C0000,     /* Matlab (tm) V4.2 / GNU Octave 2.0 */
          SF_FORMAT_MAT5         = 0x0D0000,     /* Matlab (tm) V5.0 / GNU Octave 2.1 */
          SF_FORMAT_PVF          = 0x0E0000,     /* Portable Voice Format */
          SF_FORMAT_XI           = 0x0F0000,     /* Fasttracker 2 Extended Instrument */
          SF_FORMAT_HTK          = 0x100000,     /* HMM Tool Kit format */
          SF_FORMAT_SDS          = 0x110000,     /* Midi Sample Dump Standard */
          SF_FORMAT_AVR          = 0x120000,     /* Audio Visual Research */
          SF_FORMAT_WAVEX        = 0x130000,     /* MS WAVE with WAVEFORMATEX */
          SF_FORMAT_SD2          = 0x160000,     /* Sound Designer 2 */
          SF_FORMAT_FLAC         = 0x170000,     /* FLAC lossless file format */
          SF_FORMAT_CAF          = 0x180000,     /* Core Audio File format */

          /* Subtypes from here on. */

          SF_FORMAT_PCM_S8       = 0x0001,       /* Signed 8 bit data */
          SF_FORMAT_PCM_16       = 0x0002,       /* Signed 16 bit data */
          SF_FORMAT_PCM_24       = 0x0003,       /* Signed 24 bit data */
          SF_FORMAT_PCM_32       = 0x0004,       /* Signed 32 bit data */

          SF_FORMAT_PCM_U8       = 0x0005,       /* Unsigned 8 bit data (WAV and RAW only) */

          SF_FORMAT_FLOAT        = 0x0006,       /* 32 bit float data */
          SF_FORMAT_DOUBLE       = 0x0007,       /* 64 bit float data */

          SF_FORMAT_ULAW         = 0x0010,       /* U-Law encoded. */
          SF_FORMAT_ALAW         = 0x0011,       /* A-Law encoded. */
          SF_FORMAT_IMA_ADPCM    = 0x0012,       /* IMA ADPCM. */
          SF_FORMAT_MS_ADPCM     = 0x0013,       /* Microsoft ADPCM. */

          SF_FORMAT_GSM610       = 0x0020,       /* GSM 6.10 encoding. */
          SF_FORMAT_VOX_ADPCM    = 0x0021,       /* Oki Dialogic ADPCM encoding. */

          SF_FORMAT_G721_32      = 0x0030,       /* 32kbs G721 ADPCM encoding. */
          SF_FORMAT_G723_24      = 0x0031,       /* 24kbs G723 ADPCM encoding. */
          SF_FORMAT_G723_40      = 0x0032,       /* 40kbs G723 ADPCM encoding. */

          SF_FORMAT_DWVW_12      = 0x0040,       /* 12 bit Delta Width Variable Word encoding. */
          SF_FORMAT_DWVW_16      = 0x0041,       /* 16 bit Delta Width Variable Word encoding. */
          SF_FORMAT_DWVW_24      = 0x0042,       /* 24 bit Delta Width Variable Word encoding. */
          SF_FORMAT_DWVW_N       = 0x0043,       /* N bit Delta Width Variable Word encoding. */

          SF_FORMAT_DPCM_8       = 0x0050,       /* 8 bit differential PCM (XI only) */
          SF_FORMAT_DPCM_16      = 0x0051,       /* 16 bit differential PCM (XI only) */

          /* Endian-ness options. */

          SF_ENDIAN_FILE         = 0x00000000,   /* Default file endian-ness. */
          SF_ENDIAN_LITTLE       = 0x10000000,   /* Force little endian-ness. */
          SF_ENDIAN_BIG          = 0x20000000,   /* Force big endian-ness. */
          SF_ENDIAN_CPU          = 0x30000000,   /* Force CPU endian-ness. */

          SF_FORMAT_SUBMASK      = 0x0000FFFF,
          SF_FORMAT_TYPEMASK     = 0x0FFF0000,
          SF_FORMAT_ENDMASK      = 0x30000000
      } ;

Every call to sf_open() should be matched with a call to sf_close() to free up
memory allocated during the call to sf_open().

On success, the sf_open function returns a non-NULL pointer which should be
passed as the first parameter to all subsequent libsndfile calls dealing with
that audio file.
On fail, the sf_open function returns a NULL pointer.

File Descriptor Open

      SNDFILE*  sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;

The second open function takes a file descriptor of a file that has already been
opened.
Care should be taken to ensure that the mode of the file represented by the
descriptor matches the mode argument.
This function is useful in the following circumstances:

Opening temporary files securely (ie use the tmpfile() to return a
		FILE* pointer and then using fileno() to retrieve the file descriptor
		which is then passed to libsndfile).

Opening files with file names using OS specific character encodings
		and then passing the file descriptor to sf_open_fd().

Opening sound files embedded within larger files.
			More info.

Every call to sf_open_fd() should be matched with a call to sf_close() to free up
memory allocated during the call to sf_open().

When sf_close() is called, the file descriptor is only closed if the close_desc
parameter was TRUE when the sf_open_fd() function was called.

On success, the sf_open_fd function returns a non-NULL pointer which should be
passed as the first parameter to all subsequent libsndfile calls dealing with
that audio file.
On fail, the sf_open_fd function returns a NULL pointer.

Format Check Function

      int  sf_format_check (const SF_INFO *info) ;

This function allows the caller to check if a set of parameters in the SF_INFO struct
is valid before calling sf_open (SFM_WRITE).

sf_format_check returns TRUE if the parameters are valid and FALSE otherwise.

File Seek Functions

      sf_count_t  sf_seek  (SNDFILE *sndfile, sf_count_t frames, int whence) ;

The file seek functions work much like lseek in unistd.h with the exception that
the non-audio data is ignored and the seek only moves within the audio data section of
the file.
In addition, seeks are defined in number of (multichannel) frames.
Therefore, a seek in a stereo file from the current position forward with an offset
of 1 would skip forward by one sample of both channels.

like lseek(), the whence parameter can be any one of the following three values:

      SEEK_SET  - The offset is set to the start of the audio data plus offset (multichannel) frames.
      SEEK_CUR  - The offset is set to its current location plus offset (multichannel) frames.
      SEEK_END  - The offset is set to the end of the data plus offset (multichannel) frames.

Internally, libsndfile keeps track of the read and write locations using separate
read and write pointers.
If a file has been opened with a mode of SFM_RDWR, bitwise OR-ing the standard whence
values above with either SFM_READ or SFM_WRITE allows the read and write pointers to
be modified separately.
If the SEEK_* values are used on their own, the read and write pointers are
both modified.

Note that the frames offset can be negative and in fact should be when SEEK_END is used for the
whence parameter.

sf_seek will return the offset in (multichannel) frames from the start of the audio data
or -1 if an error occured (ie an attempt is made to seek beyond the start or end of the file).

Error Reporting Functions

      int         sf_error        (SNDFILE *sndfile) ;

This function returns the current error number for the given SNDFILE.
The error number may be one of the following:

        enum
        {   SF_ERR_NO_ERROR             = 0,
            SF_ERR_UNRECOGNISED_FORMAT  = 1,
            SF_ERR_SYSTEM               = 2,
            SF_ERR_MALFORMED_FILE       = 3,
            SF_ERR_UNSUPPORTED_ENCODING = 4
        } ;

or any one of many other internal error values.
Applications should only test the return value against error values defined in
<sndfile.h> as the internal error values are subject to change at any
time.
For errors not in the above list, the function sf_error_number() can be used to
convert it to an error string.

      const char* sf_strerror     (SNDFILE *sndfile) ;
      const char* sf_error_number (int errnum) ;

The error functions sf_strerror() and sf_error_number() convert the library's internal
error enumerations into text strings.

      int         sf_perror     (SNDFILE *sndfile) ;
      int         sf_error_str  (SNDFILE *sndfile, char* str, size_t len) ;

The functions sf_perror() and sf_error_str() are deprecated and will be dropped
from the library at some later date.

File Close Function

      int  sf_close  (SNDFILE *sndfile) ;

The close function closes the file, deallocates its internal buffers and returns
0 on success or an error value otherwise.

Write Sync Function

      void  sf_write_sync  (SNDFILE *sndfile) ;

If the file is opened SFM_WRITE or SFM_RDWR, call the operating system's function
to force the writing of all file cache buffers to disk. If the file is opened
SFM_READ no action is taken.

File Read Functions (Items)

      sf_count_t  sf_read_short   (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
      sf_count_t  sf_read_int     (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
      sf_count_t  sf_read_float   (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
      sf_count_t  sf_read_double  (SNDFILE *sndfile, double *ptr, sf_count_t items) ;

The file read items functions fill the array pointed to by ptr with the requested
number of items. The items parameter must be an integer product of the number
of channels or an error will occur.

It is important to note that the data type used by the calling program and the data
format of the file do not need to be the same. For instance, it is possible to open
a 16 bit PCM encoded WAV file and read the data using sf_read_float(). The library
seamlessly converts between the two formats on-the-fly. See
Note 1.

The sf_read_XXXX functions return the number of items read.
Unless the end of the file was reached during the read, the return value should
equal the number of items requested.
Attempts to read beyond the end of the file will not result in an error but will
cause the sf_read_XXXX functions to return less than the number of items requested
or 0 if already at the end of the file.

File Read Functions (Frames)

      sf_count_t  sf_readf_short   (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_int     (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_float   (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
      sf_count_t  sf_readf_double  (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;

The file read frames functions fill the array pointed to by ptr with the requested
number of frames of data. The array must be large enough to hold the product of
frames and the number of channels.

Care must be taken to ensure that there is enough space in the array pointed to by
ptr, to take (frames * channels) number of items (shorts, ints, floats or doubles).

The sf_readf_XXXX functions return the number of frames read.
Unless the end of the file was reached during the read, the return value should equal
the number of frames requested.
Attempts to read beyond the end of the file will not result in an error but will cause
the sf_readf_XXXX functions to return less than the number of frames requested or 0 if
already at the end of the file.

File Write Functions (Items)

      sf_count_t  sf_write_short   (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
      sf_count_t  sf_write_int     (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
      sf_count_t  sf_write_float   (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
      sf_count_t  sf_write_double  (SNDFILE *sndfile, double *ptr, sf_count_t items) ;

The file write items functions write the data in the array pointed to by ptr to the file.
The items parameter must be an integer product of the number of channels or an error
will occur.

It is important to note that the data type used by the calling program and the data
format of the file do not need to be the same. For instance, it is possible to open
a 16 bit PCM encoded WAV file and write the data using sf_write_float(). The library
seamlessly converts between the two formats on-the-fly. See
Note 1.

The sf_write_XXXX functions return the number of items written (which should be the
same as the items parameter).

File Write Functions (Frames)

      sf_count_t  sf_writef_short  (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_int    (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_float  (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
      sf_count_t  sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;

The file write frames functions write the data in the array pointed to by ptr to the file.
The array must be large enough to hold the product of frames and the number of channels.

The sf_writef_XXXX functions return the number of frames written (which should be the
same as the frames parameter).

Raw File Read and Write Functions

      sf_count_t  sf_read_raw     (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
      sf_count_t  sf_write_raw    (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;

The raw read and write functions read raw audio data from the audio file (not to be
confused with reading RAW header-less PCM files). The number of bytes read or written
must always be an integer multiple of the number of channels multiplied by the number
of bytes required to represent one sample from one channel.

The raw read and write functions return the number of bytes read or written (which
should be the same as the bytes parameter).

Note : The result of using of both regular reads/writes and raw reads/writes on
compressed file formats other than SF_FORMAT_ALAW and SF_FORMAT_ULAW is undefined.

See also : SFC_RAW_NEEDS_ENDSWAP

Functions for Reading and Writing String Data

      const char* sf_get_string   (SNDFILE *sndfile, int str_type) ;
      int         sf_set_string   (SNDFILE *sndfile, int str_type, const char* str) ;

These functions allow strings to be set on files opened for write and to be
retrieved from files opened for read where supported by the given file type.
The str_type parameter can be any one of the following string types:

          enum
          {   SF_STR_TITLE,
              SF_STR_COPYRIGHT,
              SF_STR_SOFTWARE,
              SF_STR_ARTIST,
              SF_STR_COMMENT,
              SF_STR_DATE
          } ;

The sf_get_string() function returns the specified string if it exists and a
NULL pointer otherwise.
In addition to the string ids above, SF_STR_FIRST (== SF_STR_TITLE) and
SF_STR_LAST (always the same as the highest numbers string id) are also
available to allow iteration over all the available string ids.

The sf_set_string() function sets the string data.
It returns zero on success and non-zero on error.
The error code can be converted to a string using sf_error_number().

Note 1

When converting between integer PCM formats of differing size (ie using sf_read_int()
to read a 16 bit PCM encoded WAV file) libsndfile obeys one simple rule:

Whenever integer data is moved from one sized container to another sized container,
the most significant bit in the source container will become the most significant bit
in the destination container.

When converting between integer data and floating point data, different rules apply.
The default behaviour when reading floating point data (sf_read_float() or
sf_read_double ()) from a file with integer data is normalisation. Regardless of
whether data in the file is 8, 16, 24 or 32 bit wide, the data will be read as
floating point data in the range [-1.0, 1.0]. Similarly, data in the range [-1.0, 1.0]
will be written to an integer PCM file so that a data value of 1.0 will be the largest
allowable integer for the given bit width. This normalisation can be turned on or off
using the sf_command interface.

Note 2

Reading a file containg floating point data (allowable with WAV, AIFF, AU and other
file formats) using integer read methods (sf_read_short() or sf_read_int()) can
produce unexpected results.
For instance the data in the file may have a maximum absolute value < 1.0 which
would mean that all sample values read from the file will be zero.
In order to read these files correctly using integer read methods, it is recommended
that you use the
     sf_command
interface, a command of
     SFC_SET_SCALE_FLOAT_INT_READ
and a parameter of SF_TRUE to force correct scaling.

	The libsndfile home page is
		here.

Version : 1.0.21


text:
require 'volt/page/targets/dom_template'

module Volt
  # Class to describe the interface for sections
  class BaseSection
    @@template_cache = {}

    def remove
      fail 'not implemented'
    end

    def remove_anchors
      fail 'not implemented'
    end

    def insert_anchor_before_end
      fail 'not implemented'
    end

    def set_content_to_template(page, template_name)
      if self.is_a?(DomSection)
        dom_template = (@@template_cache[template_name] ||= DomTemplate.new(page, template_name))

        set_template(dom_template)
      else
        template = page.templates[template_name]

        if template
          html     = template['html']
          bindings = template['bindings']
        else
          html     = "<div>-- < missing template #{template_name.inspect.html_inspect}, make sure it's component is included in dependencies.rb > --</div>"
          bindings = {}
        end

        set_content_and_rezero_bindings(html, bindings)
      end
    end
  end
end


text:
'''
Created on Nov 3, 2016

@author: Admin

'''
from Window import *
class MSWindowWidgetFactory:

    @staticmethod
    def make_diagram(width, height):
        return MSWindow()

class MacOSXWindowWidgetFactory:

    @staticmethod
    def make_diagram(width, height):
        return MacOSXWindow()


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 9: 814 (1891)

#### Original name
Trematosphaeria lunaria Curr.

### Remarks
null


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Kongl. Svenska Vetensk. Akad. Handl. ser. 2, 46:37. 1911

#### Original name
null

### Remarks
null