text:
The `MdDialog` service can be used to open modal dialogs with Material Design styling and
animations.

<!-- example(dialog-overview) -->

A dialog is opened by calling the `open` method with a component to be loaded and an optional
config object. The `open` method will return an instance of `MdDialogRef`:

```ts
let dialogRef = dialog.open(UserProfileComponent, {
  height: '400px',
  width: '600px',
});
```

The `MdDialogRef` provides a handle on the opened dialog. It can be used to close the dialog and to
receive notification when the dialog has been closed.

```ts
dialogRef.afterClosed().subscribe(result => {
  console.log(`Dialog result: ${result}`); // Pizza!
});

dialogRef.close('Pizza!');

```

Components created via `MdDialog` can _inject_ `MdDialogRef` and use it to close the dialog
in which they are contained. When closing, an optional result value can be provided. This result
value is forwarded as the result of the `afterClosed` promise.

### Sharing data with the Dialog component.
If you want to share data with your dialog, you can use the `data` option to pass information to the dialog component.

```ts
let dialogRef = dialog.open(YourDialog, {
  data: 'your data',
});
```

To access the data in your dialog component, you have to use the MD_DIALOG_DATA injection token:
```ts
import {Component, Inject} from '@angular/core';
import {MD_DIALOG_DATA} from '@angular/material';

@Component({
  selector: 'your-dialog',
  template: 'passed in {{ data }}',
})

export class YourDialog {
  constructor(@Inject(MD_DIALOG_DATA) public data: any) { }
}
```

### Dialog content
Several directives are available to make it easier to structure your dialog content:

| Name                  | Description                                                                                |
|-----------------------|---------------------------------------------------------------------------------------------------------------|
| `md-dialog-title`     | \[Attr] Dialog title, applied to a heading element (e.g., `<h1>`, `<h2>`)                                     |
| `<md-dialog-content>` | Primary scrollable content of the dialog                                                                      |
| `<md-dialog-actions>` | Container for action buttons at the bottom of the dialog                                                      |
| `md-dialog-close`     | \[Attr] Added to a `<button>`, makes the button close the dialog with an optional result from the bound value.|

For example:
```html
<h2 md-dialog-title>Delete all</h2>
<md-dialog-content>Are you sure?</md-dialog-content>
<md-dialog-actions>
  <button md-button md-dialog-close>No</button>
  <!-- Can optionally provide a result for the closing dialog. -->
  <button md-button [md-dialog-close]="true">Yes</button>
</md-dialog-actions>
```

Once a dialog opens, the dialog will automatically focus the first tabbable element.

You can control which elements are tab stops with the `tabindex` attribute

```html
<button md-button tabindex="-1">Not Tabbable</button>
```

### AOT Compilation

Due to the dynamic nature of the `MdDialog`, and its usage of `ViewContainerRef#createComponent()`
to create the component on the fly, the AOT compiler will not know to create the proper
`ComponentFactory` for your dialog component by default.

You must include your dialog class in the list of `entryComponents` in your module definition so
that the AOT compiler knows to create the `ComponentFactory` for it.

```ts
@NgModule({
  imports: [
    // ...
    MdDialogModule
  ],

  declarations: [
    AppComponent,
    ExampleDialogComponent
  ],

  entryComponents: [
    ExampleDialogComponent
  ]

  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule() {}
```


text:
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal

from astropy import units as u
from astropy.modeling.fitting import DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter, TRFLSQFitter
from astropy.modeling.models import Gaussian1D, Identity, Mapping, Rotation2D, Shift, UnitsMapping
from astropy.utils import NumpyRNGContext
from astropy.utils.compat.optional_deps import HAS_SCIPY

fitters = [LevMarLSQFitter, TRFLSQFitter, LMLSQFitter, DogBoxLSQFitter]

def test_swap_axes():
    x = np.zeros((2, 3))
    y = np.ones((2, 3))

    mapping = Mapping((1, 0))
    assert mapping(1, 2) == (2.0, 1.0)
    assert mapping.inverse(2, 1) == (1, 2)
    assert_array_equal(mapping(x, y), (y, x))
    assert_array_equal(mapping.inverse(y, x), (x, y))

def test_duplicate_axes():
    mapping = Mapping((0, 1, 0, 1))
    assert mapping(1, 2) == (1.0, 2., 1., 2)
    assert mapping.inverse(1, 2, 1, 2) == (1, 2)
    assert mapping.inverse.n_inputs == 4
    assert mapping.inverse.n_outputs == 2

def test_drop_axes_1():
    mapping = Mapping((0,), n_inputs=2)
    assert mapping(1, 2) == (1.)

def test_drop_axes_2():
    mapping = Mapping((1, ))
    assert mapping(1, 2) == (2.)
    MESSAGE = r"Mappings such as .* that drop one or more of their inputs are not invertible at this time"
    with pytest.raises(NotImplementedError, match=MESSAGE):
        mapping.inverse

def test_drop_axes_3():
    mapping = Mapping((1,), n_inputs=2)
    assert mapping.n_inputs == 2
    rotation = Rotation2D(60)
    model = rotation | mapping
    assert_allclose(model(1, 2), 1.86602540378)

@pytest.mark.parametrize('name', [None, 'test_name'])
def test_bad_inputs(name):
    mapping = Mapping((1, 0), name=name)

    if name is None:
        name = "Mapping"

    x = [np.ones((2, 3))*idx for idx in range(5)]
    for idx in range(1, 6):
        if idx == 2:
            continue

        MESSAGE = f"{name} expects 2 inputs; got {idx}"
        with pytest.raises(TypeError, match=MESSAGE):
            mapping.evaluate(*x[:idx])

def test_identity():
    x = np.zeros((2, 3))
    y = np.ones((2, 3))

    ident1 = Identity(1)
    shift = Shift(1)
    rotation = Rotation2D(angle=60)
    model = ident1 & shift | rotation
    assert_allclose(model(1, 2), (-2.098076211353316, 2.3660254037844393))
    res_x, res_y = model(x, y)
    assert_allclose((res_x, res_y),
                    (np.array([[-1.73205081, -1.73205081, -1.73205081],
                               [-1.73205081, -1.73205081, -1.73205081]]),
                     np.array([[1., 1., 1.],
                               [1., 1., 1.]])))
    assert_allclose(model.inverse(res_x, res_y), (x, y), atol=1.e-10)

# https://github.com/astropy/astropy/pull/6018
@pytest.mark.skipif(not HAS_SCIPY, reason='requires scipy')
@pytest.mark.parametrize('fitter', fitters)
def test_fittable_compound(fitter):
    fitter = fitter()

    m = Identity(1) | Mapping((0, )) | Gaussian1D(1, 5, 4)
    x = np.arange(10)
    y_real = m(x)
    dy = 0.005
    with NumpyRNGContext(1234567):
        n = np.random.normal(0., dy, x.shape)
    y_noisy = y_real + n
    new_model = fitter(m, x, y_noisy)
    y_fit = new_model(x)
    assert_allclose(y_fit, y_real, atol=dy)

def test_identity_repr():
    m = Identity(1, name='foo')
    assert repr(m) == "<Identity(1, name='foo')>"

    m = Identity(1)
    assert repr(m) == "<Identity(1)>"

def test_mapping_repr():
    m = Mapping([0, 1], name='foo')
    assert repr(m) == "<Mapping([0, 1], name='foo')>"

    m = Mapping([0, 1])
    assert repr(m) == "<Mapping([0, 1])>"

class TestUnitsMapping:
    def test___init__(self):
        # Set values
        model = UnitsMapping(((u.m, None),),
                             input_units_equivalencies='test_eqiv',
                             input_units_allow_dimensionless=True,
                             name='test')
        assert model._mapping == ((u.m, None),)
        assert model._input_units_strict == {'x': True}
        assert model.input_units_equivalencies == 'test_eqiv'
        assert model.input_units_allow_dimensionless == {'x': True}
        assert model.name == 'test'
        assert model._input_units == {'x': u.m}

        # Default values
        model = UnitsMapping(((u.K, None),))
        assert model._mapping == ((u.K, None),)
        assert model._input_units_strict == {'x': True}
        assert model.input_units_equivalencies is None
        assert model.input_units_allow_dimensionless == {'x': False}
        assert model.name is None
        assert model._input_units == {'x': u.K}

        # Error
        MESSAGE = r"If one return unit is None, then all must be None"
        with pytest.raises(ValueError, match=MESSAGE):
            UnitsMapping(((u.m, None), (u.m, u.K)))

    def test_evaluate(self):
        model = UnitsMapping(((u.m, None),))
        assert model(10*u.m) == 10

        model = UnitsMapping(((u.m, u.K),))
        assert model(10*u.m) == 10 * u.K

        model = UnitsMapping(((u.m, None), (u.K, None)),)
        assert model(10*u.m, 20*u.K) == (10, 20)

        model = UnitsMapping(((u.m, u.K), (u.K, u.m)),)
        assert model(10*u.m, 20*u.K) == (10*u.K, 20*u.m)

    def test_repr(self):
        model = UnitsMapping(((u.m, None),), name='foo')
        assert repr(model) == f"<UnitsMapping((({repr(u.m)}, None),), name='foo')>"

        model = UnitsMapping(((u.m, None),))
        assert repr(model) == f"<UnitsMapping((({repr(u.m)}, None),))>"

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

    <title>Installing MNE-Python — MNE 1.3.dev0 documentation</title>

  <link href="../_static/styles/theme.css?digest=1e1de1a1873e13ef5536" rel="stylesheet">
<link href="../_static/styles/pydata-sphinx-theme.css?digest=1e1de1a1873e13ef5536" rel="stylesheet">

  <link rel="stylesheet"
    href="../_static/vendor/fontawesome/6.1.2/css/all.min.css">
  <link rel="preload" as="font" type="font/woff2" crossorigin
    href="../_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2">
  <link rel="preload" as="font" type="font/woff2" crossorigin
    href="../_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2">
  <link rel="preload" as="font" type="font/woff2" crossorigin
    href="../_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2">

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../_static/copybutton.css" />
    <link rel="stylesheet" type="text/css" href="../_static/sg_gallery.css" />
    <link rel="stylesheet" type="text/css" href="../_static/sg_gallery-binder.css" />
    <link rel="stylesheet" type="text/css" href="../_static/sg_gallery-dataframe.css" />
    <link rel="stylesheet" type="text/css" href="../_static/sg_gallery-rendered-html.css" />
    <link rel="stylesheet" type="text/css" href="../_static/design-style.4045f2051d55cab465a707391d5b2007.min.css" />
    <link rel="stylesheet" type="text/css" href="../_static/style.css" />

  <link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=1e1de1a1873e13ef5536">

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="MNE-Python installers" href="installers.html" />
    <link rel="prev" title="MNE-Python Homepage" href="../index.html" />
    <link rel="canonical" href="https://mne.tools/stable/index.html" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="docsearch:language" content="en">

  <input type="checkbox" class="sidebar-toggle" name="__primary" id="__primary">

  <input type="checkbox" class="sidebar-toggle" name="__secondary" id="__secondary">

<form class="bd-search d-flex align-items-center" action="../search.html" method="get">

  <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
  Ctrl+K
</form>

        Site Navigation

                    Install

                    Documentation

                    API Reference

                    Get help

                    Development

<button class="btn btn-sm navbar-btn search-button search-button__button" title="Search" data-toggle="tooltip">

</button>

    <button type="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-toggle="dropdown">
        dev

    </button>

            GitHub

            Twitter

            Discourse

            Discord

<button class="btn btn-sm navbar-btn search-button search-button__button" title="Search" data-toggle="tooltip">

</button>

        Site Navigation

                    Install

                    Documentation

                    API Reference

                    Get help

                    Development

    <button type="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-toggle="dropdown">
        dev

    </button>

            GitHub

            Twitter

            Discourse

            Discord

    Section Navigation

MNE-Python installers

Install via pip or conda

Advanced setup

Testing your installation

Updating MNE-Python

Installing FreeSurfer

Overview of the MNE tools suite

Installing MNE-Python#

Standalone installers

For Beginners

New to Python? Use our standalone installers that include
everything to get you started!

Download Installers

Install via pip or conda

For Advanced Users

Already familiar with Python?
Follow our advanced setup instructions for pip and conda!

Setup Instructions

previous

MNE-Python Homepage

next

MNE-Python installers

© Copyright 2012–2022, MNE Developers. Last updated <time datetime="2022-11-23T06:23:19.548865+00:00" class="localized">2022-11-23 06:23 UTC</time>


text:
import { Component } from '@angular/core';
import { SidebarConfig, SidebarjsService } from 'ng-sidebarjs';
import { SidebarPosition } from 'sidebarjs';

@Component({
  selector: 'example-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  public sidebarConfig: SidebarConfig = {
    nativeSwipe: true,
    position: SidebarPosition.Right,
  };

  constructor(
    public readonly sidebarjsService: SidebarjsService
  ) {
    console.log(this.sidebarjsService);
  }

  onEvent(e: any) {
    console.log(e);
  }
}


text:
'use strict';
/*global FB:false */

/**
 * This factory is handles all site visitor logins to Facebook in the modal.
 *
 * @author Jeffrey Chan
 */

angular.module('fbCal').factory('modalFbLogin', function ($q) {
  var grantedPermissions = [];

  /**
   * Checks if the given permission has been granted.
   *
   * @param  {String} permission  Permission to check
   * @return {Boolean}            If permission was granted or not
   */
  var checkPermission = function(permission) {
    return grantedPermissions.indexOf(permission) >= 0;
  };

  /**
   * Checks if user is first time user of the app.
   *
   * @return {Boolean} If user is first time user of the app
   */
  var checkFirstTime = function() {
    return grantedPermissions === [];
  };

  /**
   * Checks whether or not the user is logged in.
   *
   * @return {Object} Promise to log in the user if she is not logged in
   */
  var checkLoginState = function() {
    var deferred = $q.defer();
    FB.getLoginStatus(function(response) {
      loginCallback(response, deferred);
    }, true);
    return deferred.promise;
  };

  /**
   * Verifies the login status of the user. If the user is logged in, it
   * checks permissions. Otherwise, it logs in the user.
   *
   * @param  {Object} response Response from Facebook on user's login status
   * @param  {Object} deferred Promise object
   */
  var loginCallback = function(response, deferred) {
    if (response.status === 'connected') {
      checkPermissions(deferred, false);
    } else {
      login(deferred);
    }
  };

  /**
   * Checks the permissions granted by the user. Stores them into array. If
   * a specfic permission is provided, it also returns whether or not this
   * permission was granted.
   *
   * @param  {Object} deferred           Promise Object
   * @param  {String} specificPermission The permission to check if any
   */
  var checkPermissions = function(deferred, specificPermission) {
    FB.api('/me/permissions', function(response) {
      if (!response || response.error) {
        deferred.reject('unknown');
      } else {
        for (var i = 0; i < response.data.length; i++) {
          var permission = response.data[i];
          if (permission.status === 'granted') {
            grantedPermissions.push(permission.permission);
          }
        }
        if (specificPermission) {
          if (checkPermission(specificPermission)) {
            deferred.resolve();
          } else {
            deferred.reject('declined permission');
          }
        } else {
          deferred.resolve();
        }
      }
    });
  };

  /**
   * Logins in the user, specifically asking for certain permissions.
   * If logged in succesfully, it checks permissions. Else it returns the
   * reason for the login failure (whether it's the user's fault of Facebook's).
   *
   * @param  {Object} deferred Promise Object
   */
  var login = function(deferred) {
    FB.login(function(response) {
      if (!response.error) {
        if (response.status === 'connected') {
          checkPermissions(deferred, false);
        } else if (response.status === 'not_authorized') {
          deferred.reject('declined');
        } else {
          deferred.reject('not logged in');
        }
      } else {
        deferred.reject('unknown');
      }
    }, {scope: 'public_profile, publish_actions, rsvp_event'});
  };

  /**
   * Logins the user while asking for a specific permission.
   *
   * @param  {String} permission Permission to request
   * @param  {Boolean} rejected  If true, it lets Facebook know that this is a
   *                             rerequest for a permission. Otherwise, Facebook
   *                             protcts against asking users for permissions
   *                             multiple times.
   * @return {Object}            Promise to log the user in asking for the
   *                             specific permission
   */
  var loginWithPermission = function(permission, rejected) {
    var params;
    if (rejected) {
      params = {scope: permission, auth_type: 'rerequest'};
    } else {
      params = {scope: permission};
    }
    var deferred = $q.defer();
    FB.login(function(response) {
      if (!response.error) {
        if (response.status === 'connected') {
          checkPermissions(deferred, permission);
        } else if (response.status === 'not_authorized') {
          deferred.reject('declined');
        } else {
          deferred.reject('not logged in');
        }
      } else {
        deferred.reject('unknown');
      }
    }, params);
    return deferred.promise;
  };

  return {
    checkLoginState: checkLoginState,
    checkPermission: checkPermission,
    checkFirstTime: checkFirstTime,
    loginWithPermission: loginWithPermission
  };
});


text:
package jdk.nashorn.internal.runtime;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;

import jdk.nashorn.internal.codegen.types.Type;

/**
 * An version of a JavaScript function, native or JavaScript.
 * Supports lazily generating a constructor version of the invocation.
 */
final class CompiledFunction implements Comparable<CompiledFunction> {

    /** The method type may be more specific than the invoker, if. e.g.
     *  the invoker is guarded, and a guard with a generic object only
     *  fallback, while the target is more specific, we still need the
     *  more specific type for sorting */
    private final MethodType   type;
    private final MethodHandle invoker;
    private MethodHandle constructor;

    CompiledFunction(final MethodType type, final MethodHandle invoker) {
        this(type, invoker, null);
    }

    CompiledFunction(final MethodType type, final MethodHandle invoker, final MethodHandle constructor) {
        assert type != null;
        this.type        = type;
        this.invoker     = invoker;
        this.constructor = constructor;
    }

    @Override
    public String toString() {
        return "<callSiteType= " + type + " invoker=" + invoker + " ctor=" + constructor + ">";
    }

    MethodHandle getInvoker() {
        return invoker;
    }

    MethodHandle getConstructor() {
        return constructor;
    }

    void setConstructor(final MethodHandle constructor) {
        this.constructor = constructor;
    }

    boolean hasConstructor() {
        return constructor != null;
    }

    MethodType type() {
        return type;
    }

    @Override
    public int compareTo(final CompiledFunction o) {
        return compareMethodTypes(type(), o.type());
    }

    private static int compareMethodTypes(final MethodType ownType, final MethodType otherType) {
        // Comparable interface demands that compareTo() should only return 0 if objects are equal.
        // Failing to meet this requirement causes same weight functions to replace each other in TreeSet,
        // so we go some lengths to come up with an ordering between same weight functions,
        // first falling back to parameter count and then to hash code.
        if (ownType.equals(otherType)) {
            return 0;
        }

        final int diff = weight(ownType) - weight(otherType);
        if (diff != 0) {
            return diff;
        }
        if (ownType.parameterCount() != otherType.parameterCount()) {
            return ownType.parameterCount() - otherType.parameterCount();
        }
        // We're just interested in not returning 0 here, not correct ordering
        return ownType.hashCode() - otherType.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof CompiledFunction && type().equals(((CompiledFunction)obj).type());
    }

    @Override
    public int hashCode() {
        return type().hashCode();
    }

    private int weight() {
        return weight(type());
    }

    private static int weight(final MethodType type) {
        if (isVarArgsType(type)) {
            return Integer.MAX_VALUE; //if there is a varargs it should be the heavist and last fallback
        }

        int weight = Type.typeFor(type.returnType()).getWeight();
        for (final Class<?> paramType : type.parameterArray()) {
            final int pweight = Type.typeFor(paramType).getWeight() * 2; //params are more important than call types as return values are always specialized
            weight += pweight;
        }
        return weight;
    }

    private static boolean isVarArgsType(final MethodType type) {
        assert type.parameterCount() >= 1 : type;
        return type.parameterType(type.parameterCount() - 1) == Object[].class;
    }

    boolean moreGenericThan(final CompiledFunction o) {
        return weight() > o.weight();
    }

    boolean moreGenericThan(final MethodType mt) {
        return weight() > weight(mt);
    }

    /**
     * Check whether a given method descriptor is compatible with this invocation.
     * It is compatible if the types are narrower than the invocation type so that
     * a semantically equivalent linkage can be performed.
     *
     * @param mt type to check against
     * @return true if types are compatible
     */
    boolean typeCompatible(final MethodType mt) {
        final int wantedParamCount   = mt.parameterCount();
        final int existingParamCount = type.parameterCount();

        //if we are not examining a varargs type, the number of parameters must be the same
        if (wantedParamCount != existingParamCount && !isVarArgsType(mt)) {
            return false;
        }

        //we only go as far as the shortest array. the only chance to make this work if
        //parameters lengths do not match is if our type ends with a varargs argument.
        //then every trailing parameter in the given callsite can be folded into it, making
        //us compatible (albeit slower than a direct specialization)
        final int lastParamIndex = Math.min(wantedParamCount, existingParamCount);
        for (int i = 0; i < lastParamIndex; i++) {
            final Type w = Type.typeFor(mt.parameterType(i));
            final Type e = Type.typeFor(type.parameterType(i));

            //don't specialize on booleans, we have the "true" vs int 1 ambiguity in resolution
            //we also currently don't support boolean as a javascript function callsite type.
            //it will always box.
            if (w.isBoolean()) {
                return false;
            }

            //This callsite type has a vararg here. it will swallow all remaining args.
            //for consistency, check that it's the last argument
            if (e.isArray()) {
                return true;
            }

            //Our arguments must be at least as wide as the wanted one, if not wider
            if (Type.widest(w, e) != e) {
                //e.g. this invocation takes double and callsite says "object". reject. won't fit
                //but if invocation takes a double and callsite says "int" or "long" or "double", that's fine
                return false;
            }
        }

        return true; // anything goes for return type, take the convenient one and it will be upcasted thru dynalink magic.
    }

}


text:
package org.apache.tika.io;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.junit.Test;

import static org.junit.Assert.assertEquals;;

/**
 * Test cases for the {@link LookaheadInputStream} class.
 */
public class LookaheadInputStreamTest {

    @Test
    public void testNullStream() throws IOException {
        InputStream lookahead = new LookaheadInputStream(null, 100);
        assertEquals(-1, lookahead.read());
    }

    @Test
    public void testEmptyStream() throws IOException {
        InputStream stream = new ByteArrayInputStream(new byte[0]);
        InputStream lookahead = new LookaheadInputStream(stream, 100);
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals(-1, stream.read());
    }

    @Test
    public void testBasicLookahead() throws IOException {
        InputStream stream =
            new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' });
        InputStream lookahead = new LookaheadInputStream(stream, 2);
        assertEquals('a', lookahead.read());
        assertEquals('b', lookahead.read());
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals('a', stream.read());
        assertEquals('b', stream.read());
        assertEquals('c', stream.read());
        assertEquals(-1, stream.read());
    }

    @Test
    public void testZeroLookahead() throws IOException {
        InputStream stream =
            new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' });
        InputStream lookahead = new LookaheadInputStream(stream, 0);
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals('a', stream.read());
        assertEquals('b', stream.read());
        assertEquals('c', stream.read());
        assertEquals(-1, stream.read());
    }

    @Test
    public void testMarkLookahead() throws IOException {
        InputStream stream =
            new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' });
        InputStream lookahead = new LookaheadInputStream(stream, 2);
        lookahead.mark(1);
        assertEquals('a', lookahead.read());
        lookahead.reset();
        assertEquals('a', lookahead.read());
        lookahead.mark(2);
        assertEquals('b', lookahead.read());
        assertEquals(-1, lookahead.read());
        lookahead.reset();
        assertEquals('b', lookahead.read());
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals('a', stream.read());
        assertEquals('b', stream.read());
        assertEquals('c', stream.read());
        assertEquals(-1, stream.read());
    }

    @Test
    public void testSkipLookahead() throws IOException {
        InputStream stream =
            new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' });
        InputStream lookahead = new LookaheadInputStream(stream, 2);
        assertEquals(1, lookahead.skip(1));
        assertEquals('b', lookahead.read());
        assertEquals(0, lookahead.skip(1));
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals('a', stream.read());
        assertEquals('b', stream.read());
        assertEquals('c', stream.read());
        assertEquals(-1, stream.read());
    }

}


text:
A node module to control Milight LED bulbs and OEM equivalents auch as Rocket LED, Limitless LED Applamp,
 Easybulb, s`luce, iLight, iBulb, and Kreuzer. This library use Promises to automatically synchronize the command
 sequences. So there is no need for nesting commands using callback. Of course, each API call returns a promise which
 can be used to wait for the call to be resolved or rejected.

## Introduction

Milight uses a very primitive three-byte-sequence one-way communication proptocol where each command must be sent in a
 single UDP packet. It is fire & forget really similar to simply RF protocols fro garage door openers and such.
 Compared to other Milight libraries I am using a more more aggressive timing for the delay between sending UDP command
 packets (```delayBetweenCommands``` property).
 Generally, the delay is to reduce the chances of UDP package loss on the network. A longer delay may lower the risk of
 data loss, however, data loss is likely to occur occasionally on a wireless network. Keep in mind, that apart from your
 Wifi network there is another lossy communications channel between the Milight Controller and the bulbs. My strategy
 against loss is to repeat each command send three times (```commandRepeat``` property).

## Usage Example

    var Milight = require('../src/index').MilightController;
    var commands = require('../src/index').commands;

    var light = new Milight({
            ip: "255.255.255.255",
            delayBetweenCommands: 35,
            commandRepeat: 3
        }),
        zone = 1;

    light.sendCommands(commands.rgbw.on(zone), commands.rgbw.brightness(100));
    for (var x=0; x<256; x++) {
        light.sendCommands( commands.rgbw.on(zone), commands.rgbw.hue(x));
    }
    light.pause(1000);
    light.sendCommands(commands.rgbw.on(zone), commands.rgbw.whiteMode(zone));

    light.close();

Instead of providing the broadcast IP address which is the default, you should provide the IP address
 of the Milight Controller for unicast mode.

## History

* 20150426, V0.0.1
    * Initial Version

* 20150510, V0.0.2
    * Improved and simplified synchronization of command sequences
    * Added repeat mode to send each sequences multiple times


text:
package com.intellij.execution.junit2.ui.actions;

import javax.annotation.Nonnull;

import com.intellij.execution.Executor;
import com.intellij.execution.actions.JavaRerunFailedTestsAction;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.junit.JUnitConfiguration;
import com.intellij.execution.junit.TestMethods;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.testframework.TestConsoleProperties;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.ui.ComponentContainer;

public class RerunFailedTestsAction extends JavaRerunFailedTestsAction
{
	public RerunFailedTestsAction(@Nonnull ComponentContainer componentContainer, @Nonnull TestConsoleProperties consoleProperties)
	{
		super(componentContainer, consoleProperties);
	}

	@Override
	protected MyRunProfile getRunProfile(@Nonnull ExecutionEnvironment environment)
	{
		//noinspection ConstantConditions
		final JUnitConfiguration configuration = (JUnitConfiguration) myConsoleProperties.getConfiguration();
		final TestMethods testMethods = new TestMethods(configuration, environment, getFailedTests(configuration.getProject()));
		return new MyRunProfile(configuration)
		{
			@Override
			@Nonnull
			public Module[] getModules()
			{
				return testMethods.getModulesToCompile();
			}

			@Override
			public RunProfileState getState(@Nonnull Executor executor, @Nonnull ExecutionEnvironment env)
			{
				testMethods.clear();
				return testMethods;
			}
		};
	}
}


text:
<?php
return array (
  'Authentication mode' => 'Authenticatiemodus',
  'Created At' => 'Aangemaakt op',
  'Created by' => 'Aangemaakt door',
  'Email' => 'E-mail',
  'Group' => 'Groep',
  'Guid' => 'Guid',
  'ID' => 'ID',
  'Invalid language!' => 'Ongeldige taal',
  'Language' => 'Taal',
  'New user needs approval' => 'Nieuwe gebruiker vereist goedkeuring',
  'Tags' => 'Labels',
  'Updated at' => 'Aangepast op',
  'Updated by' => 'Aangepast door',
  'Username' => 'Gebruikersnaam',
  'Username can contain only letters, numbers, spaces and special characters (+-._)' => 'Gebruikersnaam mag enkel letters, cijfers, spaties en speciale tekens (+-._) bevatten',
  'Visibility' => 'Zichtbaarheid',
  'Wall' => 'Muur',
);


text:
DROP SEQUENCE IF EXISTS app.users_id_seq CASCADE;
CREATE SEQUENCE app.users_id_seq;

DROP TABLE IF EXISTS app.users;
CREATE TABLE app.users
(
  id INT PRIMARY KEY NOT NULL DEFAULT NEXTVAL('app.users_id_seq'),
  username VARCHAR(30) NOT NULL,
  password BYTEA NOT NULL,
  verified SMALLINT NOT NULL DEFAULT 0,
  disabled SMALLINT NOT NULL DEFAULT 0,
  email VARCHAR(255) NOT NULL
);

DROP INDEX IF EXISTS udx_user_username;
CREATE UNIQUE INDEX udx_user_username
  ON app.users (username);

DROP INDEX IF EXISTS udx_user_email;
CREATE UNIQUE INDEX udx_user_email
  ON app.users (email);

DROP TABLE IF EXISTS app.user_verifications;
CREATE TABLE app.user_verifications
(
  user_id INT PRIMARY KEY NOT NULL,
  hash BYTEA NOT NULL,
  expires_at TIMESTAMP NOT NULL DEFAULT NOW() + INTERVAL '1 day'
);

DROP INDEX IF EXISTS udx_user_verification_hash;
CREATE UNIQUE INDEX udx_user_verification_hash
  ON app.user_verifications (hash);

DROP TABLE IF EXISTS app.user_sessions;
CREATE TABLE app.user_sessions
(
  user_id INT PRIMARY KEY NOT NULL,
  character_id INT NOT NULL DEFAULT 0,
  key BYTEA NOT NULL,
  created_at TIMESTAMP NOT NULL DEFAULT NOW(),
  last_seen_at TIMESTAMP NOT NULL DEFAULT NOW()
);

DROP INDEX IF EXISTS idx_user_sessions_key;
CREATE INDEX idx_user_sessions_key
  ON app.user_sessions (key);

DROP TABLE IF EXISTS app.user_authorizations;
CREATE TABLE app.user_authorizations
(
  user_id INT NOT NULL,
  character_id INT NOT NULL,
  role INT NOT NULL,
  token BYTEA NOT NULL,
  created_at TIMESTAMP NOT NULL DEFAULT NOW(),
  PRIMARY KEY(user_id, role)
);


text:
/* eslint-disable @typescript-eslint/no-explicit-any */
import React, { Children, isValidElement } from 'react';

export type As<Props = any> = React.ElementType<Props>;

export type PropsWithAs<Props = any, Type extends As = As> = Props &
  Omit<React.ComponentProps<Type>, 'as' | keyof Props> & {
    as?: Type;
  };

export interface ComponentWithAs<Props, DefaultType extends As> {
  <Type extends As>(props: PropsWithAs<Props, Type> & { as: Type }): JSX.Element;
  (props: PropsWithAs<Props, DefaultType>): JSX.Element;
}

type ReactRef<T> = React.Ref<T> | React.RefObject<T> | React.MutableRefObject<T>;

export function setRef<T = any>(ref: React.Ref<T> = null, value: T): void {
  if (!ref) {
    return;
  }

  if (typeof ref === 'function') {
    ref(value);
  } else {
    // eslint-disable-next-line no-param-reassign
    (ref as React.MutableRefObject<T>).current = value;
  }
}

/**
 * Get a list of all valid React child elements
 * @param children
 */
export function cleanChildren(children: React.ReactChildren | React.ReactNode): React.ReactElement[] {
  return Children.toArray(children).filter((child) => isValidElement(child)) as React.ReactElement[];
}

export function assignRef(ref: React.Ref<HTMLElement>, value: HTMLElement | null): ReturnType<typeof setRef> {
  if (ref == null || value == null) {
    return;
  }

  try {
    setRef(ref, value);
  } catch (error) {
    throw new Error('Cannot assign value to ref');
  }
}

/**
 * Combine multiple React refs into a single ref function.
 * This is used mostly when you need to allow consumers forward refs to
 * internal components
 *
 * @param refs refs to assign to value to
 */
export function mergeRefs(...refs: Array<ReactRef<HTMLElement> | undefined>) {
  return (value: HTMLElement | null) => {
    refs.forEach((ref) => ref && assignRef(ref, value));
  };
}

export function forwardRefWithAs<Props, DefaultType extends As>(
  component: React.ForwardRefRenderFunction<any, any>,
): ComponentWithAs<Props, DefaultType> {
  return (React.forwardRef(component) as unknown) as ComponentWithAs<Props, DefaultType>;
}


text:
import { LitElement, property, html, customElement } from '@polymer/lazy-lit-element';
import './npm-package.js';

@customElement('async-io-demo' as any)
export class AsyncIoDemo extends LitElement {

  @property()
  name?: string;

  render() {
    return html`

Async I/O Demo

        Package Name:
        <input .value=${this.name === undefined ? '' : this.name} @change=${this._onChange}>

      <npm-package .name=${this.name}></npm-package>
    `;
  }

  _onChange(e: Event) {
    this.name = (e.target as HTMLInputElement).value;
  }
}


text:
\documentclass{article}

\usepackage{amsmath}

\title{Notes about creating confidence bands for receiver operating characteristic curves}

\author{Yuriy Sverchkov}

\begin{document}
\maketitle

We follow Tilbury et al.(2000) in estimating confidence bands for receiver operating characteristic (ROC) curves.
Their methods computes an probability surface for each ROC curve point.
The idea is, for each point $\hat x, \hat y$ on the ROC curve, for each point $x, y$ on the ROC axes, to compute the exact probability of getting the $\hat x$ false positive rate (FPR) and $\hat y$ true positive rate (TPR) given true values $x, y$.

Particularly, they show that the FPR and TPR can be treated as independent, given that, for the FPR, if we observed $a_1$ true negatives and $a_0$ false positives, the probability of the observation given that the true FPR is $x: q < x < r$, is proportional to:
\begin{equation}
 \int_q^r x^{a_0} (1-x)^{a_1} dx = \int_0^r x^{a_0} (1-x)^{a_1} dx - \int_0^r x^{a_0} (1-x)^{a_1} dx
\end{equation}
and
\begin{equation}
\int_0^s x^{a_0} (1-x)^{a_1} dx = \Gamma(a_0+1) \Gamma(a_1+1) \sum_{k=0}^{a_1} \frac{(1-s)^k s^{a_0 + a_1 + 1 - k}}{\Gamma(k+1) \Gamma(a_0 + a_1 + 2 - k)}
\end{equation}
where the normalization constant for this distribution is clearly
\begin{equation}
\int_0^1 x^{a_0} (1-x)^{a_1} dx = B(a_0+1, a_1+1) = \frac{\Gamma(a_0+1) \Gamma(a_1+1)}{\Gamma(a_0+a_1+2)} \text{.}
\end{equation}
Therefore,
\begin{equation}
P(a_0, a_1 | x<s) = \Gamma(a_0+a_1+2) \sum_{k=0}^{a_1} \frac{(1-s)^k s^{a_0 + a_1 + 1 - k}}{\Gamma(k+1) \Gamma(a_0 + a_1 + 2 - k)}
\end{equation}
\end{document}


text:
<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>hu.popcornmaci</groupId>
		<artifactId>debt-calc</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>debt-calc-dao</artifactId>
	<dependencies>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>5.1.0.Final</version>
		</dependency>

		<dependency>
			<groupId>com.oracle.jdbc</groupId>
			<artifactId>ojdbc7</artifactId>
			<version>12.1.0.2</version>
		</dependency>
	</dependencies>
</project>


text:
{{ partial "header.html" . }}

    {{ partial "navbar.html" . }}
    {{ partial "main/banner.html" . }}

    {{ partial "main/summary.html" . }}

    {{ partial "main/what-we-are-doing.html" . }}

    {{ partial "main/parallax.html" . }}

{{ partial "dreamland-footer.html" . }}
{{ partial "footer.html" . }}


text:
Version: 1.0.6.0

**NOTE:** This theme is not supported anymore, to get started with building a Publii theme, you can try out the [Blank](https://github.com/GetPublii/theme-Blank) theme.

![Starter theme screenshot](starter-publii-theme.png)

The Starter theme for Publii. A flexible, CSS Grid Layout based expandable template that's perfect for users looking to get a headstart on their Publii theme development adventure, with all you need to craft your very own custom layouts and styles.

**Live demo:** [https://getpublii.com/themes/demo/starter/](https://getpublii.com/themes/demo/starter/)

### Usage

To install all dependencies run inside the theme directory:

```
npm install
```

To compile SASS->CSS and minify JS run:

```
gulp watch
```

The above command will automatically detect all changes inside `*.scss` and `*.js` files.

You can also run:

```
gulp sass
gulp js
```

To render `*.scss` and `*.js` files only once.

### Author:

Bob Mitro TidyCustoms ([@tidycustoms](http://twitter.com/tidycustoms) - [https://tidycustoms.net/](https://tidycustoms.net/))

### Documentation

Dev documentation is available at [https://getpublii.com/dev/](https://getpublii.com/dev/)

### Contributors:

- [dziudek](https://github.com/dziudek)

### Credits

* [Modular Scale](https://github.com/modularscale/modularscale-sass)
* [Mappy Breakpoints](https://github.com/zellwk/mappy-breakpoints)

### License

MIT


text:
package com.streamsets.datacollector.definition;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.io.Resources;
import com.streamsets.datacollector.config.ConfigDefinition;
import com.streamsets.datacollector.el.ElConstantDefinition;
import com.streamsets.datacollector.el.ElFunctionDefinition;
import com.streamsets.pipeline.api.ConfigDef;
import com.streamsets.pipeline.api.ConfigDefBean;
import com.streamsets.pipeline.api.Dependency;
import com.streamsets.pipeline.api.ElConstant;
import com.streamsets.pipeline.api.ElFunction;
import com.streamsets.pipeline.api.ElParam;
import com.streamsets.pipeline.api.FieldSelectorModel;
import com.streamsets.pipeline.api.ListBeanModel;
import com.streamsets.pipeline.api.PredicateModel;

import com.streamsets.pipeline.api.credential.CredentialValue;
import com.streamsets.pipeline.api.impl.ErrorMessage;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class TestConfigDefinitionExtractor {

  public static class Empty {
  }

  public static class ELs {

    @ElFunction(prefix = "p", name = "f", description = "ff")
    public static String f(@ElParam("x") int x) {
      return null;
    }

    @ElConstant(name = "C", description = "CC")
    public static final String C = "c";

  }

  public static class ImplicitOnlyEls {
    @ElFunction(prefix = "p", name = "fi", description = "ff", implicitOnly = true)
    public static String fi() {
      return null;
    }
  }

  public static class Ok1 {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.NUMBER,
        defaultValue = "10",
        required = true,
        group = "G",
        displayPosition = 1,
        lines = 2,
        min = 3,
        max = 4,
        evaluation = ConfigDef.Evaluation.EXPLICIT,
        mode = ConfigDef.Mode.JAVA,
        elDefs = {ELs.class }
    )
    public int config;
  }

  public static class Ok2 {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.BOOLEAN,
        required = true,
        group = "G",
        displayPosition = 1,
        lines = 2,
        evaluation = ConfigDef.Evaluation.EXPLICIT,
        mode = ConfigDef.Mode.JAVA,
        elDefs = ELs.class,
        displayMode = ConfigDef.DisplayMode.ADVANCED
    )
    public String config;
  }

  public static class Ok3 {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.MODEL,
        required = true,
        elDefs = {ELs.class, ImplicitOnlyEls.class }
    )
    @PredicateModel
    public List<String> predicates;
  }

  public static class Ok4 {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.MODEL,
        required = true,
        elDefs = ELs.class
    )
    @FieldSelectorModel
    public String selector;
  }

  @Test
  public void testStringConfigOk() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Ok1.class, Collections.<String>emptyList(),
                                                                             "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals("config", config.getName());
    Assert.assertEquals("config", config.getFieldName());
    Assert.assertEquals(ConfigDef.Type.NUMBER, config.getType());
    Assert.assertEquals("L", config.getLabel());
    Assert.assertEquals("D", config.getDescription());
    Assert.assertEquals(10, config.getDefaultValue());
    Assert.assertEquals(true, config.isRequired());
    Assert.assertEquals("G", config.getGroup());
    Assert.assertEquals(1, config.getDisplayPosition());
    Assert.assertEquals(2, config.getLines());
    Assert.assertEquals(3, config.getMin());
    Assert.assertEquals(4, config.getMax());
    Assert.assertEquals(ConfigDef.Evaluation.EXPLICIT, config.getEvaluation());
    Assert.assertEquals("text/x-java", config.getMode());
    Assert.assertTrue(containsF(config.getElFunctionDefinitions(), "p:f"));
    Assert.assertTrue(containsC(config.getElConstantDefinitions(), "C"));
    Assert.assertNull(config.getModel());
    Assert.assertEquals("", config.getDependsOn());
    Assert.assertNull(config.getTriggeredByValues());
    Assert.assertEquals(ConfigDef.DisplayMode.BASIC, config.getDisplayMode());
  }

  @Test
  public void testTypeNoELConfigOk() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Ok2.class, Collections.<String>emptyList(),
                                                                             "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals(ConfigDef.Type.BOOLEAN, config.getType());
    Assert.assertNull(config.getDefaultValue());
    Assert.assertTrue(config.getElFunctionDefinitions().isEmpty());
    Assert.assertTrue(config.getElConstantDefinitions().isEmpty());

    Assert.assertEquals(ConfigDef.DisplayMode.ADVANCED, config.getDisplayMode());
  }

  @Test
  public void testModelNoELConfigOk() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Ok4.class, Collections.<String>emptyList(),
                                                                             "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals(ConfigDef.Type.MODEL, config.getType());
    Assert.assertTrue(config.getElFunctionDefinitions().isEmpty());
    Assert.assertTrue(config.getElConstantDefinitions().isEmpty());
  }

  public static class ListBeanDefaultEmptyString {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.MODEL,
        defaultValue = "",
        required = true,
        elDefs = ELs.class
    )
    @ListBeanModel
    public List<Ok4> inner;
  }
  @Test
  public void testDefaultExtractionOfListBeanModelWithEmptyString() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(ListBeanDefaultEmptyString.class, Collections.emptyList(), "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);

    Assert.assertEquals(ConfigDef.Type.MODEL, config.getType());
    Assert.assertEquals(null, config.getDefaultValue());
  }

  public static class ListBeanDefaultEmptyArray {

    @ConfigDef(
        label = "L",
        description = "D",
        type = ConfigDef.Type.MODEL,
        defaultValue = "[]",
        required = true,
        elDefs = ELs.class
    )
    @ListBeanModel
    public List<Ok4> inner;
  }
  @Test
  public void testDefaultExtractionOfListBeanModelWithEmptyArray() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(ListBeanDefaultEmptyArray.class, Collections.emptyList(), "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);

    Assert.assertEquals(ConfigDef.Type.MODEL, config.getType());
    Assert.assertEquals(Collections.emptyList(), config.getDefaultValue());
  }
  @Test
  public void testModelELConfigOk() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Ok3.class, Collections.<String>emptyList(),
                                                                             "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals(ConfigDef.Type.MODEL, config.getType());
    Assert.assertFalse(config.getElFunctionDefinitions().isEmpty());
    Assert.assertFalse(config.getElConstantDefinitions().isEmpty());
  }

  private boolean containsF(List<ElFunctionDefinition> defs, String name) {
    for (ElFunctionDefinition def : defs) {
      if (def.getName().equals(name)) {
        return true;
      }
    }
    return false;
  }

  private boolean containsC(List<ElConstantDefinition> defs, String name) {
    for (ElConstantDefinition def : defs) {
      if (def.getName().equals(name)) {
        return true;
      }
    }
    return false;
  }

  public static class Model {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.MODEL,
        required = true
    )
    @FieldSelectorModel
    public String config;
  }

  @Test
  public void testModel() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Model.class, Collections.<String>emptyList(),
                                                                             "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals(ConfigDef.Type.MODEL, config.getType());
    Assert.assertNotNull(config.getModel());
  }

  public static class Fail2 {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = false
    )
    public static String config;
  }

  @Test(expected = IllegalArgumentException.class)
  public void testStringConfigFail2() {
    ConfigDefinitionExtractor.get().extract(Fail2.class, Collections.<String>emptyList(), "x");
  }

  public static class Fail3 {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = false,
        min = 0
    )
    public static String config;
  }

  @Test(expected = IllegalArgumentException.class)
  public void testStringConfigFail3() {
    ConfigDefinitionExtractor.get().extract(Fail3.class, Collections.<String>emptyList(), "x");
  }

  public static class DependsOn {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "b",
        triggeredByValue = "B"
    )
    public String a;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true
    )
    public String b;
  }

  public static class Fail4 {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = false,
        min = 0,
        evaluation = ConfigDef.Evaluation.EXPLICIT,
        elDefs = ImplicitOnlyEls.class
    )
    public static String config;
  }

  @Test(expected = IllegalArgumentException.class)
  public void testStringConfigFail4() {
    ConfigDefinitionExtractor.get().extract(Fail4.class, Collections.<String>emptyList(), "x");
  }

  @Test
  public void testDependsOn() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(DependsOn.class,
                                                                             Collections.<String>emptyList(),"x");
    Assert.assertEquals(2, configs.size());
    ConfigDefinition cd1 = configs.get(0);
    ConfigDefinition cd2 = configs.get(1);
    ConfigDefinition a;
    ConfigDefinition b;
    if (cd1.getName().equals("a")) {
      a = cd1;
      b = cd2;
    } else {
      a = cd2;
      b = cd1;
    }
    Assert.assertEquals(1, a.getDependsOnMap().size());
    Assert.assertEquals(ImmutableSet.of("B"), new HashSet<>(a.getDependsOnMap().get("b")));
    Assert.assertEquals("", b.getDependsOn());
    Assert.assertNull(b.getTriggeredByValues());
  }

  public static class MultipleDependsOn {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "b", triggeredByValues = {"B", "C"}),
            @Dependency(configName = "e", triggeredByValues = {"E", "F"})
        }
    )
    public String a;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true
    )
    public String b;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true
    )
    public String e;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "a",
        triggeredByValue = "A"
    )
    public String f;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "a", triggeredByValues = {"A"}),
            @Dependency(configName = "e", triggeredByValues = {"G"}),
            @Dependency(configName = "f", triggeredByValues = {"F", "FF"})
        }
    )
    public String g;
  }

  @Test
  public void testMultipleDependsOn() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(MultipleDependsOn.class,
        Collections.<String>emptyList(),"x");
    Assert.assertEquals(5, configs.size());
    ConfigDefinition a = null;
    ConfigDefinition b = null;
    ConfigDefinition e = null;
    ConfigDefinition f = null;
    ConfigDefinition g = null;

    for (ConfigDefinition config : configs) {
        switch (config.getName()) {
          case ("a"):
            a = config;
            break;
          case ("b"):
            b = config;
            break;
          case ("e"):
            e = config;
            break;
          case ("f"):
            f = config;
            break;
          default:
            g = config;
        }
    }
    Assert.assertEquals(2, a.getDependsOnMap().size());
    Assert.assertEquals(ImmutableSet.of("B", "C"), new HashSet<>(a.getDependsOnMap().get("b")));
    Assert.assertEquals(ImmutableSet.of("E", "F"), new HashSet<>(a.getDependsOnMap().get("e")));
    Assert.assertEquals(3, f.getDependsOnMap().size());
    Assert.assertEquals(ImmutableSet.of("A"), new HashSet<>(f.getDependsOnMap().get("a")));
    Assert.assertEquals(ImmutableSet.of("B", "C"), new HashSet<>(f.getDependsOnMap().get("b")));
    Assert.assertEquals(ImmutableSet.of("E", "F"), new HashSet<>(f.getDependsOnMap().get("e")));
    Assert.assertEquals(4, g.getDependsOnMap().size());
    Assert.assertEquals(ImmutableSet.of("A"), new HashSet<>(g.getDependsOnMap().get("a")));
    Assert.assertEquals(ImmutableSet.of("B", "C"), new HashSet<>(g.getDependsOnMap().get("b")));
    Assert.assertEquals(ImmutableSet.of("F", "FF"), new HashSet<>(g.getDependsOnMap().get("f")));
    Assert.assertTrue(b.getDependsOnMap().isEmpty());
    Assert.assertTrue(e.getDependsOnMap().isEmpty());
  }

  public static class DependsOnChain {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "b",
        triggeredByValue = "B"
    )
    public String a;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "c",
        triggeredByValue = "C"
    )
    public String b;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true
    )
    public String c;
  }

  @Test
  public void testDependsOnChain() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(DependsOnChain.class,
                                                                             Collections.<String>emptyList(), "x");
    Assert.assertEquals(3, configs.size());
    ConfigDefinition a = null;
    for (ConfigDefinition cd : configs) {
      if (cd.getName().equals("a")) {
        a = cd;
      }
    }
    Assert.assertNotNull(a);
    Assert.assertEquals(2, a.getDependsOnMap().size());
    Assert.assertEquals(ImmutableSet.of("B"), new HashSet<>(a.getDependsOnMap().get("b")));
    Assert.assertEquals(ImmutableSet.of("C"), new HashSet<>(a.getDependsOnMap().get("c")));
  }

  public static class CycleDependencies {

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "c", triggeredByValues = {"anything"}),
        }
    )
    public String a;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "t",
        triggeredByValue = "f"
    )
    public String c;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "f",
        triggeredByValue = "o"
    )
    public String b;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "g", triggeredByValues = "random")
        },
        dependsOn = "b",
        triggeredByValue = "really don't care"
    )
    public String e;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "b", triggeredByValues = "random"),
            @Dependency(configName = "e", triggeredByValues = "dds"),
            @Dependency(configName = "f", triggeredByValues = "f"),
            @Dependency(configName = "g", triggeredByValues = "g")
        }
    )
    public String f;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependencies = {
            @Dependency(configName = "a", triggeredByValues = {"A"}),
            @Dependency(configName = "c", triggeredByValues = {"A"}),
        }
    )
    public String g;

    @ConfigDef(
        label = "L",
        type = ConfigDef.Type.STRING,
        required = true,
        dependsOn = "g",
        triggeredByValue = "y"
    )
    public String t;
  }

  @Test
  public void testDependsOnCycle() {
    try {
      ConfigDefinitionExtractor.get().extract(CycleDependencies.class, Collections.<String>emptyList(), "x");
      Assert.fail();
    } catch (IllegalStateException ex) {
      Set<String> cycles = ConfigDefinitionExtractor.get().getCycles();
      Assert.assertEquals(5, cycles.size());
      Assert.assertTrue(cycles.contains("a -> c -> t -> g -> a"));
      Assert.assertTrue(cycles.contains("b -> f -> e -> b"));
      Assert.assertTrue(cycles.contains("c -> t -> g -> c"));
      Assert.assertTrue(cycles.contains("b -> f -> b"));
      Assert.assertTrue(cycles.contains("f -> f"));
    }
  }

  public static class SubSubBean {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER    )
    public long prop5;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER,
        dependsOn = "prop5",
        triggeredByValue = "1",
        group = "foo"
    )
    public long prop6;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER,
        dependsOn = "^prop2.prop3",
        triggeredByValue = "2",
        group = "#1"
    )
    public long prop7;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER,
        dependsOn = "prop1^^",
        triggeredByValue = "3"
    )
    public long prop8;

  }

  public static class SubBean {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER,
        group = "foo"
    )
    public long prop3;

    @ConfigDefBean
    public SubSubBean prop4;

  }

  public static class Bean {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop1;

    @ConfigDefBean(groups = { "foo", "#0"})
    public SubBean prop2;
  }

  @Test
  public void testConfigDefBean() {
    List<ErrorMessage> errors = ConfigDefinitionExtractor.get().validate(Bean.class, ImmutableList.of("bar", "foo"),
        "x");
    Assert.assertTrue(errors.isEmpty());
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Bean.class,
                                                                             ImmutableList.of("bar", "foo"), "x");
    Assert.assertEquals(6, configs.size());
    Set<String> expectedNames = ImmutableSet.of("prop1", "prop2.prop3", "prop2.prop4.prop5", "prop2.prop4.prop6",
                                                "prop2.prop4.prop7", "prop2.prop4.prop8");
    Set<String> expectedFieldNames = ImmutableSet.of("prop1", "prop3", "prop5", "prop6", "prop7", "prop8");
    Set<String> gotNames = new HashSet<>();
    Set<String> gotFieldNames = new HashSet<>();
    for (ConfigDefinition cd : configs) {
      gotNames.add(cd.getName());
      gotFieldNames.add(cd.getFieldName());
    }
    Assert.assertEquals(expectedNames, gotNames);
    Assert.assertEquals(expectedFieldNames, gotFieldNames);
  }

  public static class BeanA {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop;

  }

  public static class BeanASubClass extends BeanA {

    @ConfigDef(
        label = "LShadow",
        required = false,
        type = ConfigDef.Type.STRING
    )
    public String prop;
  }

  @Test
  public void testConfigBeanSubclassPropertyShadowing() {
    List<ErrorMessage> errors = ConfigDefinitionExtractor.get().validate(BeanASubClass.class, ImmutableList.of(), "x");
    Assert.assertTrue(errors.isEmpty());
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(
        BeanASubClass.class,
        ImmutableList.of(),
        "x"
    );
    Assert.assertEquals(1, configs.size());
    Assert.assertEquals("prop", configs.get(0).getFieldName());
    Assert.assertEquals("LShadow", configs.get(0).getLabel());
    Assert.assertEquals(false, configs.get(0).isRequired());
  }

  @Test
  public void testGroupsResolution() {
    Assert.assertTrue(ConfigDefinitionExtractor.get().validate(Bean.class, ImmutableList.of("bar", "foo"),
                                                               "x").isEmpty());
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Bean.class,
                                                                             ImmutableList.of("bar", "foo"), "x");
    Map<String, ConfigDefinition> configMap = new HashMap<>();
    for (ConfigDefinition config : configs) {
      configMap.put(config.getName(), config);
    }
    Assert.assertEquals("", configMap.get("prop1").getGroup());
    Assert.assertEquals("foo", configMap.get("prop2.prop3").getGroup());
    Assert.assertEquals("", configMap.get("prop2.prop4.prop5").getGroup());
    Assert.assertEquals("foo", configMap.get("prop2.prop4.prop6").getGroup());
    Assert.assertEquals("bar", configMap.get("prop2.prop4.prop7").getGroup());
  }

  public static class SubBean1 {

    public String prop4;

  }

  public static class Bean1 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop1;

    @ConfigDefBean
    public SubBean1 prop2;
  }

  @Test
  public void testConfigDefBeanInvalidBeanWithoutConfig() {
    Assert.assertEquals(1, ConfigDefinitionExtractor.get().validate(Bean1.class, Collections.<String>emptyList(),
                                                                    "x").size());
  }

  public static class SubBean2 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependsOn = "props^^"
    )
    public String prop3;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependsOn = "^props^^"
    )
    public String prop4;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependsOn = "props^3^"
    )
    public String prop5;
  }

  public static class Bean2 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop1;

    @ConfigDefBean
    public SubBean2 prop2;
  }

  @Test
  public void testConfigDefBeanInvalidDependsOn() {
    List<ErrorMessage> errorMessages = ConfigDefinitionExtractor.get().validate(Bean2.class, Collections.<String>emptyList(),
        "x");
    Assert.assertEquals(3, errorMessages.size());
  }

  public static class SubBean3 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependsOn = "props^"
    )
    public String prop3;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependencies = {
            @Dependency(configName = "props3", triggeredByValues = {"someval1"}),
            @Dependency(configName = "props6", triggeredByValues = {"someval2"})
        }
    )
    public String prop6;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependencies = {
            @Dependency(configName = "propInt^", triggeredByValues = {"testing"})
        }
    )
    public String prop7;

  }

  public static class Bean3 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop1;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.NUMBER
    )
    public int propInt;

    @ConfigDefBean
    public SubBean3 prop2;
  }

  @Test
  public void testConfigDefBeanNonExistentDependsOn() {
    List<ErrorMessage> errorMessages =
        ConfigDefinitionExtractor.get().validate(Bean3.class, Collections.<String>emptyList(), "x");
    Assert.assertEquals(4, errorMessages.size());
  }

  public static class Bean4 {

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.CREDENTIAL,
        upload = ConfigDef.Upload.BASE64
    )
    public CredentialValue credential;

  }

  @Test
  public void testCredentialValue() {
    List<ConfigDefinition> defs = ConfigDefinitionExtractor.get().extract(Bean4.class, Collections.<String>emptyList(), "x");
    Assert.assertEquals(1, defs.size());
    ConfigDefinition def = defs.get(0);
    Assert.assertEquals(ConfigDef.Upload.BASE64, def.getUpload());
    List<ElFunctionDefinition> fDefs = def.getElFunctionDefinitions();
    Set<String> fNames = ImmutableSet.copyOf(Lists.transform(fDefs, input -> input.getName()));
    Assert.assertTrue(fNames.contains("credential:get"));
    Assert.assertTrue(fNames.contains("credential:getWithOptions"));
  }

  public static class DefaultFromResourceClass {
    @ConfigDef(
        defaultValueFromResource = "test-default-value-from-resources.txt",
        type = ConfigDef.Type.STRING,
        required = true,
        label = "L"
    )
    public String stringConfig;
  }

  @Test
  public void testDefaultValueFromResources() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(DefaultFromResourceClass.class,
        Collections.<String>emptyList(), "x");
    Assert.assertEquals(1, configs.size());
    ConfigDefinition config = configs.get(0);
    Assert.assertEquals("This was read from test-default-value-from-resources.txt", config.getDefaultValue());
  }

  public static class InvalidDefaultFromResourceClass {
    @ConfigDef(
        defaultValueFromResource = "not-a-real-filepath.whatever",
        type = ConfigDef.Type.STRING,
        required = true,
        label = "L"
    )
    public String stringConfig;
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidDefaultValueFromResources() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(InvalidDefaultFromResourceClass.class,
        Collections.<String>emptyList(), "x");
  }

  public static class BothDefaultAndDefaultFromResourceClass {
    @ConfigDef(
        defaultValue = "thisDefault",
        defaultValueFromResource = "test-default-value-from-resources.txt",
        type = ConfigDef.Type.STRING,
        required = true,
        label = "L"
    )
    public String stringConfig;
  }

  @Test(expected = IllegalArgumentException.class)
  public void testBothDefaultAndDefaultValueFromResources() {
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(
        BothDefaultAndDefaultFromResourceClass.class,
        Collections.<String>emptyList(),
        "x"
    );
  }

  public static class SubSubBean5 {
    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop4;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependsOn = "prop4",
        triggeredByValue = "abc"
    )
    public String prop5;

    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING,
        dependencies = {
            @Dependency(configName = "prop4", triggeredByValues = {"xyz"})
        }
    )
    public String prop6;
  }

  public static class SubBean5 {
    @ConfigDefBean()
    public SubSubBean5 prop3;
  }

  public static class Bean5 {
    @ConfigDef(
        label = "L",
        required = true,
        type = ConfigDef.Type.STRING
    )
    public String prop1;

    @ConfigDefBean(
        dependencies = {
            @Dependency(configName = "prop1", triggeredByValues = {"trigger"})
        })
    public SubBean5 prop2;
  }

  @Test
  public void testMultipleLevelsConfigDefBeanDependency() {
    List<ErrorMessage> errors = ConfigDefinitionExtractor.get().validate(Bean5.class, ImmutableList.of("bar", "foo"),
            "x");
    Assert.assertTrue(errors.isEmpty());
    List<ConfigDefinition> configs = ConfigDefinitionExtractor.get().extract(Bean5.class,
            ImmutableList.of("bar", "foo"), "x");
    Assert.assertEquals(4, configs.size());
    configs.sort(Comparator.comparing(ConfigDefinition::getName)); // Ensure consistent ordering for retrieval

    Assert.assertEquals("prop1", configs.get(0).getName());
    Assert.assertEquals(0, configs.get(0).getDependsOnMap().size());

    Assert.assertEquals("prop2.prop3.prop4", configs.get(1).getName());
    Map<String, List<Object>> dependsOnMap1 = configs.get(1).getDependsOnMap();
    Assert.assertEquals(1, dependsOnMap1.size());
    Assert.assertEquals(Lists.newArrayList("trigger"), dependsOnMap1.get("prop1"));

    Assert.assertEquals("prop2.prop3.prop5", configs.get(2).getName());
    Map<String, List<Object>> dependsOnMap2 = configs.get(2).getDependsOnMap();
    Assert.assertEquals(2, dependsOnMap2.size());
    Assert.assertEquals(Lists.newArrayList("trigger"), dependsOnMap2.get("prop1"));
    Assert.assertEquals(Lists.newArrayList("abc"), dependsOnMap2.get("prop2.prop3.prop4"));

    Assert.assertEquals("prop2.prop3.prop6", configs.get(3).getName());
    Map<String, List<Object>> dependsOnMap3 = configs.get(3).getDependsOnMap();
    Assert.assertEquals(2, dependsOnMap3.size());
    Assert.assertEquals(Lists.newArrayList("trigger"), dependsOnMap3.get("prop1"));
    Assert.assertEquals(Lists.newArrayList("xyz"), dependsOnMap3.get("prop2.prop3.prop4"));
  }

  public static class Bean6 {

    @ConfigDef(
      label = "L",
      required = true,
      type = ConfigDef.Type.STRING,
      connectionType = "FOO"
    )
    public String connectionSelection;

  }

  @Test
  public void testConnectionType() {
    List<ConfigDefinition> defs = ConfigDefinitionExtractor.get().extract(Bean6.class, Collections.emptyList(), "x");
    Assert.assertEquals(1, defs.size());
    ConfigDefinition def = defs.get(0);
    Assert.assertEquals("FOO", def.getConnectionType());
  }
}


text:
package net.sereneproject.collector.domain;

import java.net.URI;
import java.net.URISyntaxException;

import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.json.RooJson;
import org.springframework.roo.addon.tostring.RooToString;

/**
 * Instance of a plugin, configured for a specific {@link Probe}.
 *
 * @author gehel
 */
@RooJavaBean
@RooToString
@RooJpaActiveRecord
@RooJson
public class Plugin {

    /** URL of the plugin. */
    @Size(min = 6, max = 255)
    private String url;

    /**
     * Saved state of the plugin.
     *
     * This state is sent to the plugin each time it is called and updated with
     * the response from the plugin.
     */
    private String savedState;

    /** The {@link Probe} for which this plugin is configured. */
    @NotNull
    @ManyToOne
    private Probe probe;

    /**
     * Get the {@link URI} of the plugin from its internal representation.
     *
     * @return the {@link URI}
     */
    public final URI getUri() {
        try {
            return new URI(this.url);
        } catch (URISyntaxException e) {
            throw new IllegalStateException(
                    "URL is invalid [" + this.url + "]", e);
        }
    }
}


text:
  Merle-Leignec est
       un village
       localisé dans le département de Loire en Rhône-Alpes. On dénombrait 296 habitants en 2008.

À proximité de Merle-Leignec sont positionnées géographiquement les communes de
Pommiers à 1 km, 383 habitants,
La Tourette située à 4 km, 485 habitants,
Estivareilles située à 2 km, 629 habitants,
Saint-Hilaire-Cusson-la-Valmitte à 3 km, 309 habitants,
Rozier-Côtes-d'Aurec située à 6 km, 399 habitants,
Saint-Nizier-de-Fornas située à 4 km, 618 habitants,
 entre autres. De plus, Merle-Leignec est située à seulement 28 km de Saint-Étienne.

Le nombre d'habitations, à Merle-Leignec, se décomposait en 2011 en 26 appartements et 223 maisons soit
 un marché relativement équilibré.

Si vous envisagez de emmenager à Merle-Leignec, vous pourrez aisément trouver une maison à vendre.

La ville propose quelques  équipements sportifs, elle dispose, entre autres, de une boucle de randonnée.


text:
<ion-view>
  <ion-content>
    <strabo-other-features-tab-directive></strabo-other-features-tab-directive>
  </ion-content>
</ion-view>


text:
import Node, {READY} from './Node';
import Input from './InputPort';
import Output from './OutputPort';
import {inputsToArray, outputsToArray} from './pipelineUtils';

class MapLoop extends Node {
    loopNode: Node;

    constructor(node: Node) {
        super();

        if (!node.hasDefaultInput()) {
            throw new Error(`node ${node.id} has no default input`);
        }
        if (!node.hasDefaultOutput()) {
            throw new Error(`node ${node.id} has no default output`);
        }

        this.loopNode = node;
        this.title = 'MapLoop';

        const input = new Input(this, {name: '@@input', type: 'array', required: true});
        this.inputs.set('@@input', input);
        this.defaultInput = input;

        const output = new Output(this, {name: '@@output', type: 'array', required: true});
        this.outputs.set('@@output', output);
        this.defaultOutput = output;

        for (let [key, val] of node.inputs.entries()) {
            if (val !== node.defaultInput) {
                const input = new Input(this, val);
                this.inputs.set(key, input);
            }
        }

        node.on('change', () => {
            this.emit('child-change', node);
            this.emit('deep-child-change', node);
        });
        node.on('deep-child-change', (node) => {
            this.emit('deep-child-change', node);
        });
    }

    get kind(): string {
        return 'map-loop';
    }

    _canRun() {
        return true;
    }

    async _run() {
        const thisOutput = this.defaultOutput;
        const thisInput = this.defaultInput;
        const loopNodeOutput = this.loopNode.defaultOutput;
        const loopNodeInput = this.loopNode.defaultInput;
        if (!thisOutput || !thisInput || !loopNodeOutput || !loopNodeInput) throw new Error('default ports should exist');
        const values = thisInput.getValue();
        const result = [];
        for (const input of this.inputs.values()) {
            if (input !== thisInput) {
                const innerInput = this.loopNode.inputs.get(input.name);
                if (!innerInput) throw new Error('unreachable');
                innerInput.setValue(input.getValue());
            }
        }

        for (const val of values) {
            this.loopNode.resetInput(loopNodeInput);
            loopNodeInput.setValue(val);
            await this.loopNode.run();
            result.push(loopNodeOutput.getValue());
        }

        thisOutput.setValue(result);
    }

    _computeStatus() {
        return READY;
    }

    inspect() {
        return {
            status: this.status,
            node: this.toJSON(),
        };
    }

    toJSON() {
        return {
            kind: 'map-loop',
            id: this.id,
            title: this.title,
            inputs: inputsToArray(this.inputs),
            outputs: outputsToArray(this.outputs),
            loopNode: this.loopNode.toJSON()
        };
    }
}

export default MapLoop;


text:
import { expect } from 'chai';
import * as fs from 'fs-extra';
import * as path from 'path';

const DIST = path.resolve(__dirname, '..', 'dist');

describe(`@sample/secondary/feature-a`, () => {
  let ESM2020_CONTENTS: string;

  beforeAll(() => {
    ESM2020_CONTENTS = fs.readFileSync(path.resolve(DIST, 'fesm2020', 'sample-secondary-feature-a.mjs'), {
      encoding: 'utf-8',
    });
  });

  it(`should 'import .. from '@sample/secondary/shared';' (FESM2020)`, () => {
    expect(ESM2020_CONTENTS).to.contain(`import { SHARED_FEATURE } from '@sample/secondary/shared';`);
  });
});


text:
package com.jgeppert.struts2.jquery.views.freemarker.tags;

import com.opensymphony.xwork2.util.ValueStack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Johannes Geppert
 */
public class JqueryModels {
    protected DatePickerModel datePicker;
    protected TabbedPanelModel tabbedPanel;
    protected DivModel div;
    protected DialogModel dialog;
    protected AccordionModel accordion;
    protected AccordionItemModel accordionItem;
    protected TabModel tab;
    protected AnchorModel a;
    protected SubmitModel submit;
    protected HeadModel head;
    protected ProgressbarModel progessbar;
    protected SliderModel slider;
    protected SpinnerModel spinner;
    protected TextareaModel textarea;
    protected TextfieldModel textfield;
    protected SelectModel select;
    protected AutocompleterModel autocompleter;
    protected RadioModel radio;
    protected CheckboxListModel checkboxlist;
    protected MenuModel menu;
    protected MenuItemModel menuItem;

    private ValueStack stack;
    private HttpServletRequest req;
    private HttpServletResponse res;

    public JqueryModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        this.stack = stack;
        this.req = req;
        this.res = res;
    }

    public MenuModel getMenu() {
        if (menu == null) {
            menu = new MenuModel(stack, req, res);
        }

        return menu;
    }

    public MenuItemModel getMenuItem() {
        if (menuItem == null) {
            menuItem = new MenuItemModel(stack, req, res);
        }

        return menuItem;
    }

    public AccordionItemModel getAccordionItem() {
        if (accordionItem == null) {
            accordionItem = new AccordionItemModel(stack, req, res);
        }

        return accordionItem;
    }

    public AutocompleterModel getAutocompleter() {
        if (autocompleter == null) {
            autocompleter = new AutocompleterModel(stack, req, res);
        }

        return autocompleter;
    }

    public HeadModel getHead() {
        if (head == null) {
            head = new HeadModel(stack, req, res);
        }

        return head;
    }

    public DatePickerModel getDatepicker() {
        if (datePicker == null) {
            datePicker = new DatePickerModel(stack, req, res);
        }

        return datePicker;
    }

    public TabbedPanelModel getTabbedpanel() {
        if (tabbedPanel == null) {
            tabbedPanel = new TabbedPanelModel(stack, req, res);
        }

        return tabbedPanel;
    }

    public TabModel getTab() {
        if (tab == null) {
            tab = new TabModel(stack, req, res);
        }

        return tab;
    }

    public DivModel getDiv() {
        if (div == null) {
            div = new DivModel(stack, req, res);
        }

        return div;
    }

    public AnchorModel getA() {
        if (a == null) {
            a = new AnchorModel(stack, req, res);
        }

        return a;
    }

    public SubmitModel getSubmit() {
        if (submit == null) {
            submit = new SubmitModel(stack, req, res);
        }

        return submit;
    }

    public DialogModel getDialog() {
        if (dialog == null) {
            dialog = new DialogModel(stack, req, res);
        }

        return dialog;
    }

    public AccordionModel getAccordion() {
        if (accordion == null) {
            accordion = new AccordionModel(stack, req, res);
        }

        return accordion;
    }

    public ProgressbarModel getProgressbar() {
        if (progessbar == null) {
            progessbar = new ProgressbarModel(stack, req, res);
        }

        return progessbar;
    }

    public SliderModel getSlider() {
        if (slider == null) {
            slider = new SliderModel(stack, req, res);
        }

        return slider;
    }

    public SpinnerModel getSpinner() {
        if (spinner == null) {
            spinner = new SpinnerModel(stack, req, res);
        }

        return spinner;
    }

    public TextareaModel getTextarea() {
        if (textarea == null) {
            textarea = new TextareaModel(stack, req, res);
        }

        return textarea;
    }

    public TextfieldModel getTextfield() {
        if (textfield == null) {
            textfield = new TextfieldModel(stack, req, res);
        }

        return textfield;
    }

    public SelectModel getSelect() {
        if (select == null) {
            select = new SelectModel(stack, req, res);
        }

        return select;
    }

    public RadioModel getRadio() {
        if (radio == null) {
            radio = new RadioModel(stack, req, res);
        }

        return radio;
    }

    public CheckboxListModel getCheckboxlist() {
        if (checkboxlist == null) {
            checkboxlist = new CheckboxListModel(stack, req, res);
        }

        return checkboxlist;
    }
}


text:
  Peille est
      une ville localisée dans le département des Alpes-Maritimes en Provence-Alpes-Côte d'Azur. Elle totalisait 2 243 habitants en 2008.

À coté de Peille sont localisées les villes de
Berre-les-Alpes à 6 km, 1 257 habitants,
Castillon située à 6 km, 327 habitants,
Blausasc située à 3 km, 1 374 habitants,
Gorbio localisée à 3 km, 1 279 habitants,
L'Escarène à 5 km, 2 259 habitants,
Sainte-Agnès localisée à 4 km, 1 179 habitants,
 entre autres. De plus, Peille est située à seulement 15 km de Nice.

À Peille le salaire moyen par mois par habitant est situé à environ 2 129 €  net. C'est équivalent à la moyenne nationale.

Le parc d'habitations, à Peille, se décomposait en 2011 en 435 appartements et 1 087 maisons soit
 un marché plutôt équilibré.

La ville propose quelques  équipements, elle propose entre autres un terrain de tennis, un parcours de golf et un terrain de sport.

À Peille, la valorisation moyenne à la vente d'un appartement se situe à 3 200 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 5 157 € du m². À la location la valorisation moyenne se situe à 0 € du m² par mois.


text:
namespace Google.Cloud.Logging.V2.Snippets
{
    // [START logging_v2_generated_ConfigServiceV2_GetSink_sync]
    using Google.Cloud.Logging.V2;

    public sealed partial class GeneratedConfigServiceV2ClientSnippets
    {
        /// <summary>Snippet for GetSink</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void GetSinkRequestObject()
        {
            // Create client
            ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create();
            // Initialize request argument(s)
            GetSinkRequest request = new GetSinkRequest
            {
                SinkNameAsLogSinkName = LogSinkName.FromProjectSink("[PROJECT]", "[SINK]"),
            };
            // Make the request
            LogSink response = configServiceV2Client.GetSink(request);
        }
    }
    // [END logging_v2_generated_ConfigServiceV2_GetSink_sync]
}


text:
package de.peeeq.wurstio;

import de.peeeq.wurstio.utils.FileUtils;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

public class Checksums {

    public static void main(String[] args) {
        if (args.length != 2) {
            throw new RuntimeException("usage: 1. folder, 2. output file");
        }
        File dir = new File(args[0]);
        File outFile = new File(args[1]);
        List<Data> data = getData(dir);
        String out = printData(data);
        try {
            FileUtils.write(out, outFile);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static String printData(List<Data> data) {
        StringBuilder sb = new StringBuilder();
        for (Data d : data) {
            sb.append(d.filePath);
            sb.append("\n");
            sb.append(d.md5);
            sb.append("\n");
        }
        return sb.toString();
    }

    private static List<Data> getData(File f) {
        List<Data> result = new ArrayList<>();
        for (File p : f.listFiles()) {
            getDataRec(result, "", p);
        }
        return result;
    }

    private static void getDataRec(List<Data> result, String path, File f) {
        if (f.isDirectory()) {
            for (File p : f.listFiles()) {
                getDataRec(result, path + "/" + f.getName(), p);
            }
        } else {
            result.add(new Data(path + "/" + f.getName(), md5(f)));
        }
    }

    // stolen from http://stackoverflow.com/a/304350/303637
    private static String md5(File f) {
        try {
            byte[] buf = new byte[1024];
            MessageDigest md = MessageDigest.getInstance("MD5");
            try (InputStream is = java.nio.file.Files.newInputStream(f.toPath());
                 DigestInputStream dis = new DigestInputStream(is, md)) {
                while (dis.read(buf) >= 0) ;
            }
            byte[] digest = md.digest();
            return bytesToHex(digest);
        } catch (NoSuchAlgorithmException | IOException e) {
            throw new RuntimeException(e);
        }
    }

    // stolen from http://stackoverflow.com/a/9855338/303637
    final protected static char[] hexArray = "0123456789abcdef".toCharArray();

    public static String bytesToHex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        int v;
        for (int j = 0; j < bytes.length; j++) {
            v = bytes[j] & 0xFF;
            hexChars[j * 2] = hexArray[v >>> 4];
            hexChars[j * 2 + 1] = hexArray[v & 0x0F];
        }
        return new String(hexChars);
    }

}

class Data {
    final String filePath;
    final String md5;

    public Data(String filePath, String md5) {
        this.filePath = filePath;
        this.md5 = md5;
    }
}


text:
What is Nanocut?
================

Nanocut is a program designed to cut out various objects from three dimensional
crystal structures. It is aimed to be helpful when creating geometry input for
atomistic simulations. Currently it can create following objects:

* Spherical cluster
* Polyhedral cluster
* Cylindrical cluster
* Spherical wire (1D periodic)
* Polyhedral wire (1D periodic)
* Plain slab (2D periodic)
* Supercells (3D periodic)

The program is available under the 2-clause BSD license (see
:ref:`sec-license`). It is an open source project, so feel free to join it;
especially if you think that some additional features are needed or something
could be implemented in a more user friendly way. The project is currently
hosted under

 `http://bitbucket.org/aradi/nanocut <http://bitbucket.org/aradi/nanocut>`_

If you find the program useful, please recommend it to others who may be also
interested in using it.


text:
package burlap.behavior.stochasticgames.agents;

import burlap.behavior.policy.Policy;
import burlap.mdp.core.action.Action;
import burlap.mdp.core.state.State;
import burlap.mdp.stochasticgames.JointAction;
import burlap.mdp.stochasticgames.SGDomain;
import burlap.mdp.stochasticgames.agent.AgentFactory;
import burlap.mdp.stochasticgames.agent.SGAgent;
import burlap.mdp.stochasticgames.agent.SGAgentBase;
import burlap.mdp.stochasticgames.agent.SGAgentType;
import burlap.mdp.stochasticgames.world.World;

/**
 * A class for an agent who makes decisions by following a specified strategy and does not respond to the other player's actions.
 * The policy object that determines actions can leave the actingAgent field empty/null, because this the {@link #action(State)} method
 * will automatically replace it with whatever this agent's name is.
 * @author James MacGlashan
 *
 */
public class SetStrategySGAgent extends SGAgentBase {

	/**
	 * The policy encoding the strategy this agent will follow
	 */
	protected Policy		policy;

	/**
	 * Initializes for the given domain in which the agent will play and the strategy that they will follow.
	 * @param domain the domain in which the agent will play
	 * @param policy the strategy that the agent will follow
	 * @param agentName the name of the agent
	 * @param type the {@link SGAgentType} for the agent defining its action space
	 */
	public SetStrategySGAgent(SGDomain domain, Policy policy, String agentName, SGAgentType type){
		this.init(domain, agentName, type);
		this.policy = policy;
	}

	@Override
	public void gameStarting(World w, int agentNum) {
	}

	@Override
	public Action action(State s) {
		Action actSelection = this.policy.action(s);
		return actSelection;
	}

	@Override
	public void observeOutcome(State s, JointAction jointAction,
			double[] jointReward, State sprime, boolean isTerminal) {
	}

	@Override
	public void gameTerminated() {
	}

	public static class SetStrategyAgentFactory implements AgentFactory{

		/**
		 * The strategy this agent will follow
		 */
		protected Policy		policy;

		/**
		 * The domain in which the agent will play
		 */
		protected SGDomain		domain;

		public SetStrategyAgentFactory(SGDomain domain, Policy policy){
			this.policy = policy;
			this.domain = domain;
		}

		@Override
		public SGAgent generateAgent(String agentName, SGAgentType type) {
			return new SetStrategySGAgent(domain, policy, agentName, type);
		}

	}

}


text:
package nlgo

import (
	"syscall"
	"unsafe"
)

const (
	GENL_ADMIN_PERM = 1 << iota
	GENL_CMD_CAP_DO
	GENL_CMD_CAP_DUMP
	GENL_CMD_CAP_HASPOL
)

// GenlConnect is same with libnl genl_connect.
func GenlConnect(sk *NlSock) error {
	return NlConnect(sk, syscall.NETLINK_GENERIC)
}

// GenlSendSimple is same with libnl genl_send_simple.
func GenlSendSimple(sk *NlSock, family uint16, cmd, version uint8, flags uint16) error {
	hdr := (*[SizeofGenlMsghdr]byte)(unsafe.Pointer(&GenlMsghdr{
		Cmd:     cmd,
		Version: version,
	}))
	return NlSendSimple(sk, family, flags, hdr[:])
}

const (
	GENL_ID_GENERATE = 0
	GENL_ID_CTRL     = 0x10
)

const CTRL_VERSION = 0x0001

const (
	CTRL_CMD_UNSPEC = iota
	CTRL_CMD_NEWFAMILY
	CTRL_CMD_DELFAMILY
	CTRL_CMD_GETFAMILY
	CTRL_CMD_NEWOPS
	CTRL_CMD_DELOPS
	CTRL_CMD_GETOPS
	CTRL_CMD_NEWMCAST_GRP
	CTRL_CMD_DELMCAST_GRP
	CTRL_CMD_GETMCAST_GRP
)

// CTRL

const (
	CTRL_ATTR_UNSPEC = iota
	CTRL_ATTR_FAMILY_ID
	CTRL_ATTR_FAMILY_NAME
	CTRL_ATTR_VERSION
	CTRL_ATTR_HDRSIZE
	CTRL_ATTR_MAXATTR
	CTRL_ATTR_OPS
	CTRL_ATTR_MCAST_GROUPS
)

const (
	CTRL_ATTR_OP_UNSPEC = iota
	CTRL_ATTR_OP_ID
	CTRL_ATTR_OP_FLAGS // GENL_CMD_CAP_DUMP, etc.,
)

const (
	CTRL_ATTR_MCAST_GRP_UNSPEC = iota
	CTRL_ATTR_MCAST_GRP_NAME
	CTRL_ATTR_MCAST_GRP_ID
)

var CtrlPolicy MapPolicy = MapPolicy{
	Prefix: "CTRL_ATTR",
	Names:  CTRL_ATTR_itoa,
	Rule: map[uint16]Policy{
		CTRL_ATTR_FAMILY_ID:   U16Policy,
		CTRL_ATTR_FAMILY_NAME: NulStringPolicy,
		CTRL_ATTR_VERSION:     U32Policy,
		CTRL_ATTR_HDRSIZE:     U32Policy,
		CTRL_ATTR_MAXATTR:     U32Policy,
		CTRL_ATTR_OPS: ListPolicy{
			Nested: MapPolicy{
				Prefix: "OP",
				Names:  CTRL_ATTR_OP_itoa,
				Rule: map[uint16]Policy{
					CTRL_ATTR_OP_ID:    U32Policy,
					CTRL_ATTR_OP_FLAGS: U32Policy,
				},
			},
		},
		CTRL_ATTR_MCAST_GROUPS: ListPolicy{
			Nested: MapPolicy{
				Prefix: "MCAST_GRP",
				Names:  CTRL_ATTR_MCAST_GRP_itoa,
				Rule: map[uint16]Policy{
					CTRL_ATTR_MCAST_GRP_NAME: NulStringPolicy,
					CTRL_ATTR_MCAST_GRP_ID:   U32Policy,
				},
			},
		},
	},
}


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:id="@+id/header_primary_text"
        android:textSize="20sp"
        android:textStyle="bold"
        android:textColor="@color/text_primary"
        tools:text="Search Results"
        android:layout_marginTop="16dp"
        android:layout_marginLeft="24dp"
        android:layout_marginRight="24dp"
        app:layout_constraintHorizontal_bias="0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:id="@+id/header_secondary_text"
        tools:text="15 results for found for \'yennefer\'. Here is some more text that ends up on 2 lines !!!"
        android:textColor="@color/text_secondary"
        android:layout_marginLeft="24dp"
        android:layout_marginRight="24dp"
        app:layout_constraintHorizontal_bias="0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/header_primary_text"
        android:layout_marginBottom="8dp" />

</androidx.constraintlayout.widget.ConstraintLayout>


text:
/*
 * uart.h
 *
 *  Created on: 2012-4-25
 *      Author: Benn Huang (benn@allwinnertech.com)
 */

#ifndef UART_H_
#define UART_H_

/*
 * UART
 */
#define AW_UART_RBR                 0x00 /* Receive Buffer Register */
#define AW_UART_THR                 0x00 /* Transmit Holding Register */
#define AW_UART_DLL                 0x00 /* Divisor Latch Low Register */
#define AW_UART_DLH                 0x04 /* Diviso Latch High Register */
#define AW_UART_IER                 0x04 /* Interrupt Enable Register */
#define AW_UART_IIR                 0x08 /* Interrrupt Identity Register */
#define AW_UART_FCR                 0x08 /* FIFO Control Register */
#define AW_UART_LCR                 0x0c /* Line Control Register */
#define AW_UART_MCR                 0x10 /* Modem Control Register */
#define AW_UART_LSR                 0x14 /* Line Status Register */
#define AW_UART_MSR                 0x18 /* Modem Status Register */
#define AW_UART_SCH                 0x1c /* Scratch Register */
#define AW_UART_USR                 0x7c /* Status Register */
#define AW_UART_TFL                 0x80 /* Transmit FIFO Level */
#define AW_UART_RFL                 0x84 /* RFL */
#define AW_UART_HALT                0xa4 /* Halt TX Register */

#endif /* UART_H_ */