text:
#ifndef _SIGC_CONNECTION_HPP_
#define _SIGC_CONNECTION_HPP_
#include <sigc++config.h>
#include <sigc++/signal.h>

namespace sigc {

/** Convinience class for safe disconnection.
 * Iterators must not be used beyond the lifetime of the list
 * they work on. A connection object can be created from a
 * slot list iterator and may safely be used to disconnect
 * the referred slot at any time (disconnect()). If the slot
 * has already been destroyed, disconnect() does nothing. empty() or
 * operator bool() can be used to test whether the connection is
 * still active. The connection can be blocked (block(), unblock()).
 *
 * This is possible because the connection object gets notified
 * when the referred slot dies (notify()).
 *
 * @ingroup signal
 */
struct SIGC_API connection
{
  /** Constructs an empty connection object. */
  connection() noexcept;

  /** Constructs a connection object copying an existing one.
   * @param c The connection object to make a copy from.
   */
  connection(const connection& c);

  /** Constructs a connection object from a slot list iterator.
   * @param it The slot list iterator to take the slot from.
   */
  template <typename T_slot>
  connection(const slot_iterator<T_slot>& it) : slot_(&(*it))
    { if (slot_) slot_->add_destroy_notify_callback(this, &notify); }

  /** Constructs a connection object from a slot object.
   * This is only useful if you create your own slot list.
   * @param sl The slot to operate on.
   */
  explicit connection(slot_base& sl);

  /** Overrides this connection object copying another one.
   * @param c The connection object to make a copy from.
   */
  connection& operator=(const connection& c);

  /** Overrides this connection object with another slot list iterator.
   * @param it The new slot list iterator to take the slot from.
   */
  template <typename T_slot>
  connection& operator=(const slot_iterator<T_slot>& it)
    { set_slot(&(*it)); return *this; }

  ~connection();

  /** Returns whether the connection is still active.
   * @return @p false if the connection is still active.
   */
  bool empty() const noexcept;

  /** Returns whether the connection is still active.
   * @return @p true if the connection is still active.
   */
  bool connected() const noexcept;

  /** Returns whether the connection is blocked.
   * @return @p true if the connection is blocked.
   */
  bool blocked() const noexcept;

  /** Sets or unsets the blocking state of this connection.
   * See slot_base::block() for details.
   * @param should_block Indicates whether the blocking state should be set or unset.
   * @return @p true if the connection has been in blocking state before.
   */
  bool block(bool should_block = true) noexcept;

  /** Unsets the blocking state of this connection.
   * @return @p true if the connection has been in blocking state before.
   */
  bool unblock() noexcept;

  /// Disconnects the referred slot.
  void disconnect();

  //TODO: When we can break API and ABI, make operator bool() explicit and const
  /** Returns whether the connection is still active.
   * @return @p true if the connection is still active.
   */
  operator bool() noexcept;

  /** Callback that is executed when the referred slot is destroyed.
   * @param data The connection object notified (@p this).
   */
  static void* notify(void* data);

private:
  void set_slot(slot_base* sl);

  /* Referred slot. Set to zero from notify().
   * A value of zero indicates an "empty" connection.
   */
  slot_base* slot_;
};

} /* namespace sigc */

#endif /* _SIGC_TRACKABLE_HPP_ */


text:
<?php

class Blog_TextpicturesController extends Cms_Controller_AdminTree
{

}

redpajama_set_name: RedPajamaGithub


text:
insert into product_category values(1, "default", null);

insert into product values(1,1,'0001', 'ACME Product', 10, "Vaporware", "");
insert into product values(2,1,'0002', 'FooBar', 20, "Another Vaporware", "");

insert into client values(1, "John Public", "jp@example.com");

insert into "order" values(1, "123123", 1);


text:
<!DOCTYPE html><html><head><meta charset="UTF-8">
<style>
.target {
  width: 120px;
  height: 120px;
  display: inline-block;
  border: 2px solid black;
  background-repeat: no-repeat;
  background-image: radial-gradient(20px circle at 20px 20px, red 18px, transparent),
                    radial-gradient(20px circle at 20px 20px, yellow 18px, transparent),
                    radial-gradient(20px circle at 20px 20px, lime 18px, transparent),
                    radial-gradient(20px circle at 20px 20px, blue 18px, transparent);
}
.replica {
  margin-right: 10px;
}
</style>
</head><body>
<script src="../testharness/testharness.js"></script>
<script src="../testharness/testharnessreport.js"></script>
<script src="resources/interpolation-test.js"></script>
<script src="background-position-interpolation.html.0.js"></script>

</body></html>


text:
Play smart games!

These games will help you to learn new words in a fun way
 and increase your reading comprehension level by using your reading activity.

                Word Look-up Quiz

              Play now!

(Total game plays: {{stats.word_quiz}} times)

                Synonyma

              Play now!

(Total game plays: {{stats.synonyma}} times)

                More games
 coming soon..


text:
package org.uberfire.provisioning.build.maven;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.uberfire.java.nio.file.DirectoryStream;
import org.uberfire.java.nio.file.Files;
import org.uberfire.java.nio.file.Path;
import org.uberfire.provisioning.build.Project;

public class RepositoryVisitor {

    private Project project;
    private File rootFolder;
    private File projectFolder;
    private String buildRoot;

    public RepositoryVisitor( final Project project ) {
        this.project = project;
        this.buildRoot = System.getProperty( "java.io.tmpdir" ) + File.separatorChar + "guvnor" + File.separatorChar + project.getName();
        Path path = this.project.getRootPath();
        makeTempRootDirectory();
        makeTempDirectory( path );
        rootFolder = makeTempDirectory( path );
        projectFolder = new File( rootFolder.getAbsolutePath() + project.getPath().toAbsolutePath().toString() );
        try {
            visitPaths( Files.newDirectoryStream( this.project.getPath() ) );
        } catch ( IOException ex ) {
            throw new RuntimeException( ex );
        }
    }

    public File getRootFolder() {
        return rootFolder;
    }

    public File getProjectFolder() {
        return projectFolder;
    }

    public File getGuvnorTempFolder() {
        return new File( System.getProperty( "java.io.tmpdir" ) + File.separatorChar + "guvnor" );
    }

    public File getTargetFolder() {
        return new File( buildRoot + File.separatorChar + project.getRootPath().toAbsolutePath()
                + File.separatorChar + project.getPath().toAbsolutePath().toString() + File.separatorChar + "target" );
    }

    private void visitPaths( final DirectoryStream<Path> directoryStream ) throws IOException {
        for ( final org.uberfire.java.nio.file.Path path : directoryStream ) {
            if ( Files.isDirectory( path ) ) {
                makeTempDirectory( path );
                visitPaths( Files.newDirectoryStream( path ) );
            } else {
                makeTempFile( path );
            }
        }
    }

    private File makeTempDirectory( Path path ) {
        return makeTempDirectory( getFilePath( path ) );
    }

    private File makeTempDirectory( String filePath ) {
        File tempDirectory = new File( filePath );
        if ( !tempDirectory.isFile() ) {
            tempDirectory.mkdir();
        }
        return tempDirectory;
    }

    private void makeTempRootDirectory() {
        File tempDirectory = new File( buildRoot );
        tempDirectory.mkdirs();
    }

    private void makeTempFile( Path path ) throws IOException {

        final int BUFFER = 2048;
        byte data[] = new byte[BUFFER];

        BufferedInputStream origin = new BufferedInputStream( Files.newInputStream( path ), BUFFER );

        String filePath = getFilePath( path );
        File tempFile = new File( filePath );
        tempFile.createNewFile();

        FileOutputStream output = new FileOutputStream( tempFile );

        int count;
        while ( ( count = origin.read( data, 0, BUFFER ) ) != -1 ) {
            output.write( data, 0, count );
        }

        origin.close();
        output.close();
    }

    private String getFilePath( Path path ) {
        return buildRoot + path.toUri().getRawPath();
    }
}


text:
package schedule

func findOrder(numCourses int, prerequisites [][]int) []int {
	requires := make(map[int][]int, numCourses)
	for _, p := range prerequisites {
		requires[p[0]] = append(requires[p[0]], p[1])
	}

	const (
		white int = iota // course is planned
		grey             // completing prerequisites
		black            // complete
	)
	state := make(map[int]int, numCourses)

	stack := []int{}
	for c := 0; c < numCourses; c++ {
		state[c] = white
		stack = append(stack, c)
	}

	order := []int{}

	for len(stack) > 0 {
		top := len(stack) - 1
		c := stack[top]
		stack = stack[:top]

		switch state[c] {
		case white:
			state[c] = grey
			stack = append(stack, c)
			for _, r := range requires[c] {
				if state[r] == grey {
					return nil
				}
				stack = append(stack, r)
			}
		case grey:
			state[c] = black
			order = append(order, c)
		case black:
			// nothing to be done
		}
	}

	return order
}


text:
using Agrobook.Domain.Common;
using System.Net.Http;

namespace Agrobook.Domain.Archivos
{
    public class AgregarArchivoAColeccion : MensajeAuditable
    {
        public AgregarArchivoAColeccion(Firma metadatos, string idColeccion, ArchivoDescriptor descriptor, HttpContent fileContent) : base(metadatos)
        {
            this.idColeccion = idColeccion;
            this.Descriptor = descriptor;
            this.FileContent = fileContent;
        }

        public string idColeccion { get; }
        public ArchivoDescriptor Descriptor { get; }
        public HttpContent FileContent { get; }
    }

    public class RegistrarDescargaExitosa : MensajeAuditable
    {
        public RegistrarDescargaExitosa(Firma metadatos, string idColeccion, string nombreArchivo)
            : base(metadatos)
        {
            this.IdColeccion = idColeccion;
            this.NombreArchivo = nombreArchivo;
        }

        // Este es al que pertenece el archivo
        public string IdColeccion { get; }
        public string NombreArchivo { get; }
    }

    public class EliminarArchivo : MensajeAuditable
    {
        public EliminarArchivo(Firma metadatos, string idColeccion, string nombreArchivo)
            : base(metadatos)
        {
            this.IdColeccion = idColeccion;
            this.NombreArchivo = nombreArchivo;
        }

        // Este es al que pertenece el archivo
        public string IdColeccion { get; }
        public string NombreArchivo { get; }
    }

    public class RestaurarArchivo : MensajeAuditable
    {
        public RestaurarArchivo(Firma metadatos, string idColeccion, string nombreArchivo)
            : base(metadatos)
        {
            this.IdColeccion = idColeccion;
            this.NombreArchivo = nombreArchivo;
        }

        // Este es al que pertenece el archivo
        public string IdColeccion { get; }
        public string NombreArchivo { get; }
    }
}


text:
describe('API Documentation', function() {
  var ptor = protractor.getInstance();

  describe('request documentation', function() {
    raml = createRAML(
      'title: Example API',
      'baseUri: http://www.example.com',
      'schemas:',
      '  - an_xml_schema: |',
      '      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">',
      '        <xs:element type="xs:int" name="id"/>',
      '      </xs:schema>',
      '/resource:',
      '  post:',
      '    body:',
      '     text/xml:',
      '       schema: an_xml_schema',
      '       example: |',
      '         <?xml version="1.0" encoding="UTF-8" standalone="yes"?>',
      '         <id>1511685</id>',
      '/resource/{resourceId}:',
      '  get:',
      '    queryParameters:',
      '      chunk:',
      '        displayName: page',
      '        description: Which page?',
      '        type: integer',
      '        example: 1',
      '        minimum: 1',
      '        maximum: 100',
      '        required: true',
      '      query:',
      '        description: A query parameter',
      '        repeat: true',
      '    headers:',
      '      x-custom-header:',
      '        description: API Key',
      '        type: string',
      '        pattern: /^[0-9a-f]{32}$/',
      '        example: 0a724bfa133666c5041019ef5bf5a659',
      '  post:',
      '    body:',
      '      application/x-www-form-urlencoded:',
      '        formParameters:',
      '          name:',
      '            description: The name of the resource to create',
      '            type: string',
      '            example: Comment',
      '      multipart/form-data:',
      '        formParameters:',
      '          file:',
      '            description: The data to use',
      '            type: file'
    );

    loadRamlFixture(raml);

    it('displays information about query parameters and headers', function() {
      var resource = toggleResource(2);
      var method = openMethod(1, resource);

      method.$$('[role="parameter-group"]').then(function(parameterGroups) {
        var headers = parameterGroups[0];
        expect(headers.$("h2").getText()).toEqual("Headers");

        var header = headers.$('[role="parameter"]');
        var expectedText = new RegExp([
          "x-custom-header",
          "required,",
          "string matching /^[0-9a-f]{32}$/",
          "Example:",
          "0a724bfa133666c5041019ef5bf5a659",
          "API Key"
        ].map(escapeRegExp).join('\\s+'), "i");
        expect(header.getText()).toMatch(expectedText);

        var uriParameters = parameterGroups[1];
        expect(uriParameters.$("h2").getText()).toEqual("URI Parameters");

        var uriParam = uriParameters.$('[role="parameter"]');
        var expectedText = new RegExp([
          "resourceId",
        ].map(escapeRegExp).join('\\s+'), "i");
        expect(uriParam.getText()).toMatch(expectedText);

        var queryParameters = parameterGroups[2];
        expect(queryParameters.$("h2").getText()).toEqual("Query Parameters");

        var queryParam = queryParameters.$('[role="parameter"]');
        var expectedText = new RegExp([
          "page",
          "required,",
          "integer between 1-100",
          "Example:",
          "1",
          "Which page?"
        ].map(escapeRegExp).join('\\s+'), "i");
        expect(queryParam.getText()).toMatch(expectedText);
      });

      resource = toggleResource(1);
      method = openMethod(1, resource);

      expect(method.getText()).toMatch(new RegExp('text/xml'));
      expect(method.getText()).toMatch(new RegExp('<xs:element type="xs:int" name="id"/>'));
      expect(method.getText()).toMatch(new RegExp("<id>1511685</id>"));
    });
  });

  describe("responses tab", function() {
    raml = createRAML(
      'title: Example API',
      'baseUri: http://www.example.com',
      'schemas:',
      '  - an_xml_schema: |',
      '      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">',
      '        <xs:element type="xs:int" name="id"/>',
      '      </xs:schema>',
      '/resource:',
      '  get:',
      '    responses:',
      '      200:',
      '        description: |',
      '          *Success* description',
      '        headers:',
      '          SomeHeader:',
      '            type: integer',
      '            example: 5',
      '      404:',
      '        description: |',
      '          *Error* description',
      '        body:',
      '          text/xml:',
      '            example: |',
      '              <api-response><status>Error</status></api-response>',
      '            schema: an_xml_schema'
    );

    loadRamlFixture(raml);

    it("displays headers, formatted xml response examples and schemas, and response descriptions with markdown formatting", function() {
      var resource = toggleResource(1);
      var method = openMethod(1, resource);
      var documentation = openDocumentationTab(2, method);

      documentation.findElement(protractor.By.linkText('200')).click();
      documentation.findElement(protractor.By.linkText('404')).click();

      var header = documentation.$('[role="parameter"]');

      expect(header.getText()).toMatch('SomeHeader');
      expect(header.getText()).toMatch(/Example: 5/i);
      expect(documentation.getText()).toMatch(new RegExp('<xs:element type="xs:int" name="id"/>'));
      expect(documentation.getText()).toMatch(/<api-response>[\d\s]*<status>[\d\s]*Error[\d\s]*<\/status>[\d\s]*<\/api-response>/);

      expect(documentation.getInnerHtml()).toMatch(/Success<\/em> description/);
      expect(documentation.getInnerHtml()).toMatch(/Error<\/em> description/);
    });
  });
});


text:
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 * prof_get.c --- routines that expose the public interfaces for
 *      querying items from the profile.
 *
 */

#include "prof_int.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <errno.h>
#include <limits.h>

/*
 * These functions --- init_list(), end_list(), and add_to_list() are
 * internal functions used to build up a null-terminated char ** list
 * of strings to be returned by functions like profile_get_values.
 *
 * The profile_string_list structure is used for internal booking
 * purposes to build up the list, which is returned in *ret_list by
 * the end_list() function.
 *
 * The publicly exported interface for freeing char** list is
 * profile_free_list().
 */

struct profile_string_list {
    char    **list;
    unsigned int    num;
    unsigned int    max;
};

/*
 * Initialize the string list abstraction.
 */
static errcode_t init_list(struct profile_string_list *list)
{
    list->num = 0;
    list->max = 10;
    list->list = malloc(list->max * sizeof(char *));
    if (list->list == 0)
        return ENOMEM;
    list->list[0] = 0;
    return 0;
}

/*
 * Free any memory left over in the string abstraction, returning the
 * built up list in *ret_list if it is non-null.
 */
static void end_list(struct profile_string_list *list, char ***ret_list)
{
    char    **cp;

    if (list == 0)
        return;

    if (ret_list) {
        *ret_list = list->list;
        return;
    } else {
        for (cp = list->list; *cp; cp++)
            free(*cp);
        free(list->list);
    }
    list->num = list->max = 0;
    list->list = 0;
}

/*
 * Add a string to the list.
 */
static errcode_t add_to_list(struct profile_string_list *list, const char *str)
{
    char    *newstr, **newlist;
    unsigned int    newmax;

    if (list->num+1 >= list->max) {
        newmax = list->max + 10;
        newlist = realloc(list->list, newmax * sizeof(char *));
        if (newlist == 0)
            return ENOMEM;
        list->max = newmax;
        list->list = newlist;
    }
    newstr = strdup(str);
    if (newstr == 0)
        return ENOMEM;

    list->list[list->num++] = newstr;
    list->list[list->num] = 0;
    return 0;
}

/*
 * Return TRUE if the string is already a member of the list.
 */
static int is_list_member(struct profile_string_list *list, const char *str)
{
    char **cpp;

    if (!list->list)
        return 0;

    for (cpp = list->list; *cpp; cpp++) {
        if (!strcmp(*cpp, str))
            return 1;
    }
    return 0;
}

/*
 * This function frees a null-terminated list as returned by
 * profile_get_values.
 */
void KRB5_CALLCONV profile_free_list(char **list)
{
    char        **cp;

    if (list == 0)
        return;

    for (cp = list; *cp; cp++)
        free(*cp);
    free(list);
}

/* Look up a relation in a vtable profile. */
static errcode_t
get_values_vt(profile_t profile, const char *const *names, char ***ret_values)
{
    errcode_t               retval;
    char                    **vtvalues, **val;
    struct profile_string_list values;

    retval = profile->vt->get_values(profile->cbdata, names, &vtvalues);
    if (retval)
        return retval;

    /* Copy the result into memory we can free. */
    retval = init_list(&values);
    if (retval == 0) {
        for (val = vtvalues; *val; val++)
            add_to_list(&values, *val);
        end_list(&values, ret_values);
    }

    profile->vt->free_values(profile->cbdata, vtvalues);
    return retval;
}

errcode_t KRB5_CALLCONV
profile_get_values(profile_t profile, const char *const *names,
                   char ***ret_values)
{
    errcode_t               retval;
    void                    *state;
    char                    *value;
    struct profile_string_list values;

    *ret_values = NULL;
    if (!profile)
        return PROF_NO_PROFILE;
    if (profile->vt)
        return get_values_vt(profile, names, ret_values);

    if ((retval = profile_node_iterator_create(profile, names,
                                               PROFILE_ITER_RELATIONS_ONLY,
                                               &state)))
        return retval;

    if ((retval = init_list(&values)))
        return retval;

    do {
        if ((retval = profile_node_iterator(&state, 0, 0, &value)))
            goto cleanup;
        if (value)
            add_to_list(&values, value);
    } while (state);

    if (values.num == 0) {
        retval = PROF_NO_RELATION;
        goto cleanup;
    }

    end_list(&values, ret_values);
    return 0;

cleanup:
    end_list(&values, 0);
    return retval;
}

/* Look up a relation in a vtable profile and return the first value in the
 * result. */
static errcode_t
get_value_vt(profile_t profile, const char *const *names, char **ret_value)
{
    errcode_t               retval;
    char                    **vtvalues;

    retval = profile->vt->get_values(profile->cbdata, names, &vtvalues);
    if (retval)
        return retval;
    *ret_value = strdup(*vtvalues);
    if (*ret_value == NULL)
        retval = ENOMEM;
    profile->vt->free_values(profile->cbdata, vtvalues);
    return retval;
}

/*
 * This function only gets the first value from the file; it is a
 * helper function for profile_get_string, profile_get_integer, etc.
 */
errcode_t profile_get_value(profile_t profile, const char **names,
                            char **ret_value)
{
    errcode_t               retval;
    void                    *state;
    char                    *value;

    *ret_value = NULL;
    if (!profile)
        return PROF_NO_PROFILE;
    if (profile->vt)
        return get_value_vt(profile, names, ret_value);

    retval = profile_iterator_create(profile, names,
                                     PROFILE_ITER_RELATIONS_ONLY, &state);
    if (retval)
        return retval;

    retval = profile_iterator(&state, NULL, &value);
    if (retval)
        goto cleanup;

    if (value)
        *ret_value = value;
    else
        retval = PROF_NO_RELATION;

cleanup:
    profile_iterator_free(&state);
    return retval;
}

errcode_t KRB5_CALLCONV
profile_get_string(profile_t profile, const char *name, const char *subname,
                   const char *subsubname, const char *def_val,
                   char **ret_string)
{
    char            *value;
    errcode_t       retval;
    const char      *names[4];

    if (profile) {
        names[0] = name;
        names[1] = subname;
        names[2] = subsubname;
        names[3] = 0;
        retval = profile_get_value(profile, names, &value);
        if (retval == 0) {
            *ret_string = value;
            return 0;
        } else if (retval != PROF_NO_SECTION && retval != PROF_NO_RELATION)
            return retval;
    }

    if (def_val) {
        *ret_string = strdup(def_val);
        if (*ret_string == NULL)
            return ENOMEM;
    } else
        *ret_string = NULL;
    return 0;
}

static errcode_t
parse_int(const char *value, int *ret_int)
{
    char            *end_value;
    long            ret_long;

    if (value[0] == 0)
        /* Empty string is no good.  */
        return PROF_BAD_INTEGER;
    errno = 0;
    ret_long = strtol(value, &end_value, 10);

    /* Overflow or underflow.  */
    if ((ret_long == LONG_MIN || ret_long == LONG_MAX) && errno != 0)
        return PROF_BAD_INTEGER;
    /* Value outside "int" range.  */
    if ((long) (int) ret_long != ret_long)
        return PROF_BAD_INTEGER;
    /* Garbage in string.  */
    if (end_value != value + strlen (value))
        return PROF_BAD_INTEGER;

    *ret_int = ret_long;
    return 0;
}

errcode_t KRB5_CALLCONV
profile_get_integer(profile_t profile, const char *name, const char *subname,
                    const char *subsubname, int def_val, int *ret_int)
{
    char            *value;
    errcode_t       retval;
    const char      *names[4];

    *ret_int = def_val;
    if (profile == 0)
        return 0;

    names[0] = name;
    names[1] = subname;
    names[2] = subsubname;
    names[3] = 0;
    retval = profile_get_value(profile, names, &value);
    if (retval == PROF_NO_SECTION || retval == PROF_NO_RELATION) {
        *ret_int = def_val;
        return 0;
    } else if (retval)
        return retval;

    retval = parse_int(value, ret_int);
    free(value);
    return retval;
}

static const char *const conf_yes[] = {
    "y", "yes", "true", "t", "1", "on",
    0,
};

static const char *const conf_no[] = {
    "n", "no", "false", "nil", "0", "off",
    0,
};

static errcode_t
profile_parse_boolean(const char *s, int *ret_boolean)
{
    const char *const *p;

    if (ret_boolean == NULL)
        return PROF_EINVAL;

    for(p=conf_yes; *p; p++) {
        if (!strcasecmp(*p,s)) {
            *ret_boolean = 1;
            return 0;
        }
    }

    for(p=conf_no; *p; p++) {
        if (!strcasecmp(*p,s)) {
            *ret_boolean = 0;
            return 0;
        }
    }

    return PROF_BAD_BOOLEAN;
}

errcode_t KRB5_CALLCONV
profile_get_boolean(profile_t profile, const char *name, const char *subname,
                    const char *subsubname, int def_val, int *ret_boolean)
{
    char            *value;
    errcode_t       retval;
    const char      *names[4];

    if (profile == 0) {
        *ret_boolean = def_val;
        return 0;
    }

    names[0] = name;
    names[1] = subname;
    names[2] = subsubname;
    names[3] = 0;
    retval = profile_get_value(profile, names, &value);
    if (retval == PROF_NO_SECTION || retval == PROF_NO_RELATION) {
        *ret_boolean = def_val;
        return 0;
    } else if (retval)
        return retval;

    retval = profile_parse_boolean(value, ret_boolean);
    free(value);
    return retval;
}

/*
 * This function will return the list of the names of subections in the
 * under the specified section name.
 */
errcode_t KRB5_CALLCONV
profile_get_subsection_names(profile_t profile, const char **names,
                             char ***ret_names)
{
    errcode_t               retval;
    void                    *state;
    char                    *name;
    struct profile_string_list values;

    if ((retval = profile_iterator_create(profile, names,
                                          PROFILE_ITER_LIST_SECTION |
                                          PROFILE_ITER_SECTIONS_ONLY,
                                          &state)))
        return retval;

    if ((retval = init_list(&values)))
        return retval;

    do {
        if ((retval = profile_iterator(&state, &name, NULL)))
            goto cleanup;
        if (name)
            add_to_list(&values, name);
        free(name);
    } while (state);

    end_list(&values, ret_names);
    return 0;

cleanup:
    end_list(&values, 0);
    return retval;
}

/*
 * This function will return the list of the names of relations in the
 * under the specified section name.
 */
errcode_t KRB5_CALLCONV
profile_get_relation_names(profile_t profile, const char **names,
                           char ***ret_names)
{
    errcode_t               retval;
    void                    *state;
    char                    *name;
    struct profile_string_list values;

    if ((retval = profile_iterator_create(profile, names,
                                          PROFILE_ITER_LIST_SECTION |
                                          PROFILE_ITER_RELATIONS_ONLY,
                                          &state)))
        return retval;

    if ((retval = init_list(&values)))
        return retval;

    do {
        if ((retval = profile_iterator(&state, &name, NULL)))
            goto cleanup;
        if (name && !is_list_member(&values, name))
            add_to_list(&values, name);
        free(name);
    } while (state);

    end_list(&values, ret_names);
    return 0;

cleanup:
    end_list(&values, 0);
    return retval;
}

struct profile_iterator {
    prf_magic_t magic;
    profile_t profile;
    void *idata;
};

errcode_t KRB5_CALLCONV
profile_iterator_create(profile_t profile, const char *const *names, int flags,
                        void **ret_iter)
{
    struct profile_iterator *iter;
    errcode_t retval;

    *ret_iter = NULL;
    if (!profile)
        return PROF_NO_PROFILE;

    iter = malloc(sizeof(*iter));
    if (iter == NULL)
        return ENOMEM;
    iter->magic = PROF_MAGIC_ITERATOR;
    iter->profile = profile;

    /* Create the underlying iterator representation using the vtable or the
     * built-in node iterator. */
    if (profile->vt) {
        if (!profile->vt->iterator_create)
            retval = PROF_UNSUPPORTED;
        else
            retval = profile->vt->iterator_create(profile->cbdata, names,
                                                  flags, &iter->idata);
    } else {
        retval = profile_node_iterator_create(profile, names, flags,
                                              &iter->idata);
    }
    if (retval) {
        free(iter);
        return retval;
    }

    *ret_iter = iter;
    return 0;
}

void KRB5_CALLCONV
profile_iterator_free(void **iter_p)
{
    struct profile_iterator *iter;
    profile_t profile;

    if (!iter_p)
        return;
    iter = *iter_p;
    if (!iter || iter->magic != PROF_MAGIC_ITERATOR)
        return;
    profile = iter->profile;
    if (profile->vt)
        profile->vt->iterator_free(profile->cbdata, iter->idata);
    else
        profile_node_iterator_free(&iter->idata);
    free(iter);
    *iter_p = NULL;
}

/* Make copies of name and value into *ret_name and *ret_value.  Handle null
 * values of any argument. */
static errcode_t
set_results(const char *name, const char *value, char **ret_name,
            char **ret_value)
{
    char *name_copy = NULL, *value_copy = NULL;

    if (ret_name && name) {
        name_copy = strdup(name);
        if (name_copy == NULL)
            goto oom;
    }
    if (ret_value && value) {
        value_copy = strdup(value);
        if (value_copy == NULL)
            goto oom;
    }
    if (ret_name)
        *ret_name = name_copy;
    if (ret_value)
        *ret_value = value_copy;
    return 0;
oom:
    free(name_copy);
    free(value_copy);
    return ENOMEM;
}

errcode_t KRB5_CALLCONV
profile_iterator(void **iter_p, char **ret_name, char **ret_value)
{
    char *name, *value;
    errcode_t       retval;
    struct profile_iterator *iter = *iter_p;
    profile_t profile;

    if (ret_name)
        *ret_name = NULL;
    if (ret_value)
        *ret_value = NULL;
    if (iter->magic != PROF_MAGIC_ITERATOR)
        return PROF_MAGIC_ITERATOR;
    profile = iter->profile;

    if (profile->vt) {
        retval = profile->vt->iterator(profile->cbdata, iter->idata, &name,
                                       &value);
        if (retval)
            return retval;
        if (name == NULL) {
            profile->vt->iterator_free(profile->cbdata, iter->idata);
            free(iter);
            *iter_p = NULL;
        }
        retval = set_results(name, value, ret_name, ret_value);
        if (name)
            profile->vt->free_string(profile->cbdata, name);
        if (value)
            profile->vt->free_string(profile->cbdata, value);
        return retval;
    }

    retval = profile_node_iterator(&iter->idata, 0, &name, &value);
    if (iter->idata == NULL) {
        free(iter);
        *iter_p = NULL;
    }
    if (retval)
        return retval;
    return set_results(name, value, ret_name, ret_value);
}

void KRB5_CALLCONV
profile_release_string(char *str)
{
    free(str);
}


text:
""" Module to interface with Gerrit. """

def from_json(json_data, key):
    """ Helper method to extract values from JSON data.

    :arg dict json_data: The JSON data
    :arg str key: Key to get data for.

    :Returns: The value of `key` from `json_data`, or None if `json_data`
        does not contain `key`.

    """
    if key in json_data:
        return json_data[key]
    return None

def escape_string(string):
    """ Escape a string for use in Gerrit commands.

    :arg str string: The string to escape.

    :returns: The string with necessary escapes and surrounding double quotes
        so that it can be passed to any of the Gerrit commands that require
        double-quoted strings.

    """

    result = string
    result = result.replace('\\', '\\\\')
    result = result.replace('"', '\\"')
    return '"' + result + '"'

class GerritReviewMessageFormatter(object):

    """ Helper class to format review messages that are sent to Gerrit.

    :arg str header: (optional) If specified, will be prepended as the first
        paragraph of the output message.
    :arg str footer: (optional) If specified, will be appended as the last
        paragraph of the output message.

    """

    def __init__(self, header=None, footer=None):
        self.paragraphs = []
        if header:
            self.header = header.strip()
        else:
            self.header = ""
        if footer:
            self.footer = footer.strip()
        else:
            self.footer = ""

    def append(self, data):
        """ Append the given `data` to the output.

        :arg data: If a list, it is formatted as a bullet list with each
            entry in the list being a separate bullet.  Otherwise if it is a
            string, the string is added as a paragraph.

        :raises: ValueError if `data` is not a list or a string.

        """
        if not data:
            return

        if isinstance(data, list):
            # First we need to clean up the data.
            #
            # Gerrit creates new bullet items when it gets newline characters
            # within a bullet list paragraph, so unless we remove the newlines
            # from the texts the resulting bullet list will contain multiple
            # bullets and look crappy.
            #
            # We add the '*' character on the beginning of each bullet text in
            # the next step, so we strip off any existing leading '*' that the
            # caller has added, and then strip off any leading or trailing
            # whitespace.
            _items = [x.replace("\n", " ").strip().lstrip('*').strip()
                      for x in data]

            # Create the bullet list only with the items that still have any
            # text in them after cleaning up.
            _paragraph = "\n".join(["* %s" % x for x in _items if x])
            if _paragraph:
                self.paragraphs.append(_paragraph)
        elif isinstance(data, str):
            _paragraph = data.strip()
            if _paragraph:
                self.paragraphs.append(_paragraph)
        else:
            raise ValueError('Data must be a list or a string')

    def is_empty(self):
        """ Check if the formatter is empty.

        :Returns: True if empty, i.e. no paragraphs have been added.

        """
        return not self.paragraphs

    def format(self):
        """ Format the message parts to a string.

        :Returns: A string of all the message parts separated into paragraphs,
            with header and footer paragraphs if they were specified in the
            constructor.

        """
        message = ""
        if self.paragraphs:
            if self.header:
                message += (self.header + '\n\n')
            message += "\n\n".join(self.paragraphs)
            if self.footer:
                message += ('\n\n' + self.footer)
        return message


text:
// ****************************************************************************
// <copyright file="BooleanToIntConverter.cs" company="Pedro Lamas">
// Copyright © Pedro Lamas 2013
// </copyright>
// ****************************************************************************
// <author>Pedro Lamas</author>
// <email>pedrolamas@gmail.com</email>
// <date>17-03-2013</date>
// <project>Cimbalino.Phone.Toolkit</project>
// <web>http://www.pedrolamas.com</web>
// <license>
// See license.txt in this solution or http://www.pedrolamas.com/license_MIT.txt
// </license>
// ****************************************************************************

using System.Windows.Data;

namespace Cimbalino.Phone.Toolkit.Converters
{
    /// <summary>
    /// An <see cref="IValueConverter"/> which converts a <see cref="bool"/> value to a <see cref="int"/> value.
    /// </summary>
    public class BooleanToIntConverter : BooleanToValueConverterBase<int>
    {
    }
}


text:
/******************************************************************************
 * Definiciones generales y prototipo de funciones:
 *  -I2C
 *  -BH1750
 *  -DHT22
 *  -USART
 ******************************************************************************/

#ifndef NODESENSOR
#define NODESENSOR
#define _XTAL_FREQ      4000000

//#ifdef I2C_COMM
//definiciones y prototipo de funciones I2C
#define SDA_TRIS        TRISAbits.TRISA4
#define SCL_TRIS        TRISAbits.TRISA5
#define SDA             PORTAbits.RA4
#define SCL             PORTAbits.RA5
#define ACK             0x00
#define NACK            0x80

void i2c_start(void);
void i2c_stop(void);
void bit_out(unsigned char data);
void bit_in(unsigned char *data);
unsigned char i2c_wr(unsigned char i2c_data);
unsigned char i2c_rd(unsigned char ack);
//#endif //I2C_COMM

//#ifdef BH1750_COMM
//definiciones sensor y prototipo de funciones BH1750
#define ACK             0x00
#define NACK            0x80
#define ADDR_WR         0x46
#define ADDR_RD         0x47
#define ONE_H_MODE      0x20
#define C_H_MODE        0x10

void bh1750_inicio(unsigned char modo);
unsigned int lecturaRaw(void);
unsigned int lecturaLux(unsigned char modo);
//#endif //BH1750_COMM

//#ifdef DHT22_COMM
//definiciones sensor y prototipo de funciones DHT22
#define OK 3
#define TIMEOUT 5
#define CHECKSUM 7

unsigned char DHT22_start(void);
void DHT22_expect(unsigned char);
unsigned char DHT22_read (void);
int datos_temp (void);
unsigned int datos_hum (void);
//#endif //DHT22_COM

//#ifdef USART_COMM
//definiciones sensor y prototipo de funciones USART
void USARTinicio(void);
void putch(unsigned char);
//#endif //USART_COMM
#endif


text:
import {HMQ_SEARCH, START, SUCCESS, FAIL, CLEAN} from 'store/constants'
import mapper from './mapper'

const hmqSearchInit = {
  loading: false,
  loaded: false,
  entities: [],
  searchTerm: ''
}

export default (hmqSearch = hmqSearchInit, {type, data}) => {

  switch (type) {
    case HMQ_SEARCH + START:
      return {...hmqSearch, loading: true, request: data}
    case HMQ_SEARCH + SUCCESS:

      return {
        ...hmqSearch,
        loading: false,
        loaded: true,
        request: data.initdata,
        entities: mapper(data.searchResults),
      }
    case HMQ_SEARCH + FAIL:
      return {...hmqSearch, loading: false}
    case CLEAN + HMQ_SEARCH:
      return {...hmqSearchInit}
  }
  return hmqSearch;
};


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>inet_dns_extension: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

inet_dns_extension

OmnetPPDNSExtension

Main Page

Related Pages

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

Enumerations

Enumerator

_

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

w

z

~

Here is a list of all class members with links to the classes they belong to:

- d -

data
: INETDNS::TimeEvent
, zone_entry

delivery
: INETDNS::MDNSProbeJob
, INETDNS::MDNSQueryJob
, INETDNS::MDNSResponseJob

device_map
: MDNSNetworkConfigurator

displayString_var
: DNSPacket

distribution
: MDNSNetworkConfigurator

Distributions
: MDNSNetworkConfigurator

dns_servers
: DNSClient

DNSCache()
: INETDNS::DNSCache

DNSClientTraffGen()
: DNSClientTraffGen

DNSPacket()
: DNSPacket

DNSQuestion()
: INETDNS::DNSQuestion

DNSRecord()
: INETDNS::DNSRecord

dnsRecordPriorityCache
: INETDNS::DNSTTLCache

DNSSimpleCache()
: INETDNS::DNSSimpleCache

DNSTimeRecord()
: INETDNS::DNSTimeRecord

DNSTimeRecordComparator()
: INETDNS::DNSTimeRecordComparator

DNSTTLCache()
: INETDNS::DNSTTLCache

DNSZoneConfig()
: DNSZoneConfig

domain
: zone_entry

done
: INETDNS::MDNSProbeJob
, INETDNS::MDNSProbeScheduler
, INETDNS::MDNSQueryJob
, INETDNS::MDNSQueryScheduler
, INETDNS::MDNSResponseJob
, INETDNS::MDNSResponseScheduler

dup()
: DNSPacket

Generated on Wed Jun 3 2015 12:38:03 for inet_dns_extension by

     1.8.9.1


text:
using System;
using System.ComponentModel;

namespace Azure.Analytics.Synapse.Artifacts.Models
{
    /// <summary> Enumerates possible state of Triggers. </summary>
    public readonly partial struct TriggerRuntimeState : IEquatable<TriggerRuntimeState>
    {
        private readonly string _value;

        /// <summary> Determines if two <see cref="TriggerRuntimeState"/> values are the same. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public TriggerRuntimeState(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string StartedValue = "Started";
        private const string StoppedValue = "Stopped";
        private const string DisabledValue = "Disabled";

        /// <summary> Started. </summary>
        public static TriggerRuntimeState Started { get; } = new TriggerRuntimeState(StartedValue);
        /// <summary> Stopped. </summary>
        public static TriggerRuntimeState Stopped { get; } = new TriggerRuntimeState(StoppedValue);
        /// <summary> Disabled. </summary>
        public static TriggerRuntimeState Disabled { get; } = new TriggerRuntimeState(DisabledValue);
        /// <summary> Determines if two <see cref="TriggerRuntimeState"/> values are the same. </summary>
        public static bool operator ==(TriggerRuntimeState left, TriggerRuntimeState right) => left.Equals(right);
        /// <summary> Determines if two <see cref="TriggerRuntimeState"/> values are not the same. </summary>
        public static bool operator !=(TriggerRuntimeState left, TriggerRuntimeState right) => !left.Equals(right);
        /// <summary> Converts a string to a <see cref="TriggerRuntimeState"/>. </summary>
        public static implicit operator TriggerRuntimeState(string value) => new TriggerRuntimeState(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is TriggerRuntimeState other && Equals(other);
        /// <inheritdoc />
        public bool Equals(TriggerRuntimeState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}


text:
<?php

namespace Zimbra\Admin\Tests\Request;

use Zimbra\Admin\Tests\ZimbraAdminApiTestCase;
use Zimbra\Admin\Request\Auth;
use Zimbra\Enum\AccountBy;
use Zimbra\Struct\AccountSelector;

/**
 * Testcase class for Auth.
 */
class AuthTest extends ZimbraAdminApiTestCase
{
    public function testAuthRequest()
    {
        $name = $this->faker->word;
        $password = $this->faker->sha1;
        $authToken = $this->faker->sha1;
        $virtualHost = $this->faker->word;
        $twoFactorCode = $this->faker->word;

        $account = new AccountSelector(AccountBy::NAME(), $name);
        $req = new Auth(
            $name, $password, $authToken, $account, $virtualHost, $twoFactorCode, false, false
        );
        $this->assertInstanceOf('Zimbra\Admin\Request\Base', $req);

        $this->assertSame($name, $req->getName());
        $this->assertSame($password, $req->getPassword());
        $this->assertSame($authToken, $req->getAuthToken());
        $this->assertSame($account, $req->getAccount());
        $this->assertSame($virtualHost, $req->getVirtualHost());
        $this->assertSame($twoFactorCode, $req->getTwoFactorCode());
        $this->assertFalse($req->getPersistAuthTokenCookie());
        $this->assertFalse($req->getCsrfSupported());

        $req = new Auth();
        $req->setName($name)
            ->setPassword($password)
            ->setAuthToken($authToken)
            ->setAccount($account)
            ->setVirtualHost($virtualHost)
            ->setTwoFactorCode($twoFactorCode)
            ->setPersistAuthTokenCookie(true)
            ->setCsrfSupported(true);
        $this->assertSame($name, $req->getName());
        $this->assertSame($password, $req->getPassword());
        $this->assertSame($authToken, $req->getAuthToken());
        $this->assertSame($account, $req->getAccount());
        $this->assertSame($virtualHost, $req->getVirtualHost());
        $this->assertSame($twoFactorCode, $req->getTwoFactorCode());
        $this->assertTrue($req->getPersistAuthTokenCookie());
        $this->assertTrue($req->getCsrfSupported());

        $xml = '<?xml version="1.0"?>' . "\n"
            . '<AuthRequest name="' . $name . '" password="' . $password . '" persistAuthTokenCookie="true" csrfSupported="true">'
                . '<authToken>' . $authToken . '</authToken>'
                . '<account by="' . AccountBy::NAME() . '">' . $name . '</account>'
                . '<virtualHost>' . $virtualHost . '</virtualHost>'
                . '<twoFactorCode>' . $twoFactorCode . '</twoFactorCode>'
            . '</AuthRequest>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $req);

        $array = [
            'AuthRequest' => [
                '_jsns' => 'urn:zimbraAdmin',
                'name' => $name,
                'password' => $password,
                'authToken' => $authToken,
                'account' => [
                    'by' => AccountBy::NAME()->value(),
                    '_content' => $name,
                ],
                'virtualHost' => $virtualHost,
                'twoFactorCode' => $twoFactorCode,
                'persistAuthTokenCookie' => true,
                'csrfSupported' => true,
            ],
        ];
        $this->assertEquals($array, $req->toArray());
    }

    public function testAuthApi()
    {
        $name = $this->faker->word;
        $password = $this->faker->sha1;
        $authToken = $this->faker->sha1;
        $virtualHost = $this->faker->word;
        $twoFactorCode = $this->faker->word;

        $account = new AccountSelector(AccountBy::NAME(), $name);
        $this->api->auth(
            $name, $password, $authToken, $account, $virtualHost, $twoFactorCode, true, true
        );

        $client = $this->api->getClient();
        $req = $client->lastRequest();
        $xml = '<?xml version="1.0"?>' . "\n"
            . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraAdmin">'
                . '<env:Body>'
                    . '<urn1:AuthRequest name="' . $name . '" password="' . $password . '" persistAuthTokenCookie="true" csrfSupported="true">'
                        . '<urn1:authToken>' . $authToken . '</urn1:authToken>'
                        . '<urn1:account by="' . AccountBy::NAME() . '">' . $name . '</urn1:account>'
                        . '<urn1:virtualHost>' . $virtualHost . '</urn1:virtualHost>'
                        . '<urn1:twoFactorCode>' . $twoFactorCode . '</urn1:twoFactorCode>'
                    . '</urn1:AuthRequest>'
                . '</env:Body>'
            . '</env:Envelope>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $req);
    }

    public function testAuthByName()
    {
        $name = $this->faker->word;
        $password = $this->faker->word;
        $virtualHost = $this->faker->word;
        $this->api->authByName(
            $name, $password, $virtualHost
        );

        $client = $this->api->getClient();
        $req = $client->lastRequest();
        $xml = '<?xml version="1.0"?>' . "\n"
            . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraAdmin">'
                . '<env:Body>'
                    . '<urn1:AuthRequest name="' . $name . '" password="' . $password . '" persistAuthTokenCookie="true">'
                        . '<urn1:virtualHost>' . $virtualHost . '</urn1:virtualHost>'
                    . '</urn1:AuthRequest>'
                . '</env:Body>'
            . '</env:Envelope>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $req);
    }

    public function testAuthByAccount()
    {
        $name = $this->faker->word;
        $password = $this->faker->sha1;
        $virtualHost = $this->faker->word;
        $account = new \Zimbra\Struct\AccountSelector(AccountBy::NAME(), $name);

        $this->api->authByAccount(
            $account, $password, $virtualHost
        );

        $client = $this->api->getClient();
        $req = $client->lastRequest();
        $xml = '<?xml version="1.0"?>' . "\n"
            . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraAdmin">'
                . '<env:Body>'
                    . '<urn1:AuthRequest password="' . $password . '" persistAuthTokenCookie="true">'
                        . '<urn1:account by="' . AccountBy::NAME() . '">' . $name . '</urn1:account>'
                        . '<urn1:virtualHost>' . $virtualHost . '</urn1:virtualHost>'
                    . '</urn1:AuthRequest>'
                . '</env:Body>'
            . '</env:Envelope>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $req);
    }

    public function testAuthByToken()
    {
        $authToken = $this->faker->sha1;
        $this->api->authByToken(
            $authToken
        );

        $client = $this->api->getClient();
        $req = $client->lastRequest();
        $xml = '<?xml version="1.0"?>' . "\n"
            . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraAdmin">'
                . '<env:Body>'
                    . '<urn1:AuthRequest persistAuthTokenCookie="true">'
                        . '<urn1:authToken>' . $authToken . '</urn1:authToken>'
                    . '</urn1:AuthRequest>'
                . '</env:Body>'
            . '</env:Envelope>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $req);
    }
}


text:
import abc
import os
import shutil
import sys
import tempfile
import uuid

from muranoclient.common import exceptions as muranoclient_exc
import six

from murano.common import config
from murano.common.i18n import _LE
from murano.dsl import exceptions
from murano.engine import yaql_yaml_loader
from murano.openstack.common import log as logging
from murano.packages import exceptions as pkg_exc
from murano.packages import load_utils

LOG = logging.getLogger(__name__)

class PackageLoader(six.with_metaclass(abc.ABCMeta)):
    @abc.abstractmethod
    def get_package(self, name):
        pass

    @abc.abstractmethod
    def get_package_by_class(self, name):
        pass

class ApiPackageLoader(PackageLoader):
    def __init__(self, murano_client_factory, tenant_id):
        self._cache_directory = self._get_cache_directory()
        self._murano_client_factory = murano_client_factory
        self.tenant_id = tenant_id

    def get_package_by_class(self, name):
        filter_opts = {'class_name': name}
        try:
            package_definition = self._get_definition(filter_opts)
        except LookupError:
            exc_info = sys.exc_info()
            raise exceptions.NoPackageForClassFound(name), None, exc_info[2]
        return self._get_package_by_definition(package_definition)

    def get_package(self, name):
        filter_opts = {'fqn': name}
        try:
            package_definition = self._get_definition(filter_opts)
        except LookupError:
            exc_info = sys.exc_info()
            raise exceptions.NoPackageFound(name), None, exc_info[2]
        return self._get_package_by_definition(package_definition)

    @staticmethod
    def _get_cache_directory():
        base_directory = (
            config.CONF.packages_opts.packages_cache or
            os.path.join(tempfile.gettempdir(), 'murano-packages-cache')
        )
        directory = os.path.abspath(os.path.join(base_directory,
                                                 str(uuid.uuid4())))
        os.makedirs(directory)

        LOG.debug('Cache for package loader is located at: %s' % directory)
        return directory

    def _get_definition(self, filter_opts):
        filter_opts['catalog'] = True
        try:
            packages = list(self._murano_client_factory().packages.filter(
                **filter_opts))
            if len(packages) > 1:
                LOG.debug('Ambiguous package resolution: '
                          'more then 1 package found for query "{0}", '
                          'will resolve based on the ownership'.
                          format(filter_opts))
                return get_best_package_match(packages, self.tenant_id)
            elif len(packages) == 1:
                return packages[0]
            else:
                LOG.debug('There are no packages matching filter '
                          '{0}'.format(filter_opts))
                raise LookupError()
        except muranoclient_exc.HTTPException:
            LOG.debug('Failed to get package definition from repository')
            raise LookupError()

    def _get_package_by_definition(self, package_def):
        package_id = package_def.id
        package_name = package_def.fully_qualified_name
        package_directory = os.path.join(self._cache_directory, package_name)

        if os.path.exists(package_directory):
            try:
                return load_utils.load_from_dir(
                    package_directory, preload=True,
                    loader=yaql_yaml_loader.YaqlYamlLoader)
            except pkg_exc.PackageLoadError:
                LOG.exception(_LE(
                    'Unable to load package from cache. Clean-up...'))
                shutil.rmtree(package_directory, ignore_errors=True)
        try:
            package_data = self._murano_client_factory().packages.download(
                package_id)
        except muranoclient_exc.HTTPException as e:
            msg = 'Error loading package id {0}: {1}'.format(
                package_id, str(e)
            )
            exc_info = sys.exc_info()
            raise pkg_exc.PackageLoadError(msg), None, exc_info[2]
        package_file = None
        try:
            with tempfile.NamedTemporaryFile(delete=False) as package_file:
                package_file.write(package_data)

            return load_utils.load_from_file(
                package_file.name,
                target_dir=package_directory,
                drop_dir=False,
                loader=yaql_yaml_loader.YaqlYamlLoader
            )
        except IOError:
            msg = 'Unable to extract package data for %s' % package_id
            exc_info = sys.exc_info()
            raise pkg_exc.PackageLoadError(msg), None, exc_info[2]
        finally:
            try:
                if package_file:
                    os.remove(package_file.name)
            except OSError:
                pass

    def cleanup(self):
        shutil.rmtree(self._cache_directory, ignore_errors=True)

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.cleanup()
        return False

class DirectoryPackageLoader(PackageLoader):
    def __init__(self, base_path):
        self._base_path = base_path
        self._processed_entries = set()
        self._packages_by_class = {}
        self._packages_by_name = {}

        self._build_index()

    def get_package(self, name):
        return self._packages_by_name.get(name)

    def get_package_by_class(self, name):
        return self._packages_by_class.get(name)

    def _build_index(self):
        for entry in os.listdir(self._base_path):
            folder = os.path.join(self._base_path, entry)
            if not os.path.isdir(folder) or entry in self._processed_entries:
                continue

            try:
                package = load_utils.load_from_dir(
                    folder, preload=True,
                    loader=yaql_yaml_loader.YaqlYamlLoader)
            except pkg_exc.PackageLoadError:
                LOG.exception(_LE('Unable to load package from path: '
                                  '{0}').format(entry))
                continue

            for c in package.classes:
                self._packages_by_class[c] = package
            self._packages_by_name[package.full_name] = package

            self._processed_entries.add(entry)

def get_best_package_match(packages, tenant_id):
    public = None
    other = []
    for package in packages:
        if package.owner_id == tenant_id:
            return package
        elif package.is_public:
            public = package
        else:
            other.append(package)
    if public is not None:
        return public
    elif other:
        return other[0]


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../sdl2/struct.HapticSubsystem.html">

Redirecting to ../../sdl2/struct.HapticSubsystem.html...


text:
package rkt

import (
	"bufio"
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"os/exec"
	"strconv"
	"strings"
	"sync"
	"time"

	"github.com/golang/glog"

	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/api/unversioned"
	kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
)

const (
	// The layout of the time format that satisfies the `--since` option for journalctl.
	// See man journalctl for more details.
	journalSinceLayout = "2006-01-02 15:04:05"
)

var journalNoEntriesLine = []byte(`"-- No entries --"`)

// pipeLog reads and parses the journal json object from r,
// and writes the logs line by line to w.
func pipeLog(wg *sync.WaitGroup, logOptions *api.PodLogOptions, r io.ReadCloser, w io.Writer) {
	defer func() {
		r.Close()
		wg.Done()
	}()

	scanner := bufio.NewScanner(r)
	for scanner.Scan() {
		var data interface{}
		b := scanner.Bytes()
		if bytes.Equal(b, journalNoEntriesLine) {
			continue
		}

		if err := json.Unmarshal(b, &data); err != nil {
			glog.Warningf("rkt: Cannot unmarshal journal log %q, skipping line: %v", string(b), err)
			continue
		}

		// Decode the json object as a map so we don't have to create a struct for it.
		m := data.(map[string]interface{})
		msg := m["MESSAGE"].(string)
		tss := m["__REALTIME_TIMESTAMP"].(string)

		ts, err := strconv.ParseInt(tss, 0, 64)
		if err != nil {
			glog.Warningf("rkt: Cannot parse timestamp of journal log, skipping line: %v", err)
			continue
		}

		// '_REALTIME_TIMESTAMP' is the microseconds since epoch.
		// http://www.freedesktop.org/software/systemd/man/sd_journal_get_realtime_usec.html#Description
		micros := time.Duration(ts) * time.Microsecond
		t := time.Unix(int64(micros.Seconds()), 0)

		var result string
		if logOptions.Timestamps {
			// Use the same time format as docker.
			result = fmt.Sprintf("%s %s\n", t.Format(time.RFC3339), msg)
		} else {
			result = fmt.Sprintf("%s\n", msg)
		}

		// When user interrupts the 'kubectl logs $POD -f' with 'Ctrl-C', this write will fail.
		// We need to close the reader to force the journalctl process to exit, also we need to
		// return here to avoid goroutine leak.
		if _, err := io.WriteString(w, result); err != nil {
			glog.Warningf("rkt: Cannot write log to output: %v, data: %s", err, result)
			return
		}
	}

	if err := scanner.Err(); err != nil {
		glog.Warningf("rkt: Cannot read journal logs", err)
	}
}

// GetContainerLogs uses journalctl to get the logs of the container.
// By default, it returns a snapshot of the container log. Set |follow| to true to
// stream the log. Set |follow| to false and specify the number of lines (e.g.
// "100" or "all") to tail the log.
//
// In rkt runtime's implementation, per container log is get via 'journalctl -m _MACHINE_ID=[MACHINE_ID] -u [APP_NAME]'.
// Where MACHINE_ID is the rkt id without dash.
// See https://github.com/coreos/rkt/blob/master/Documentation/commands.md#logging for more details.
//
// TODO(yifan): If the rkt is using lkvm as the stage1 image, then this function will fail.
func (r *Runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.ContainerID, logOptions *api.PodLogOptions, stdout, stderr io.Writer) error {
	id, err := parseContainerID(containerID)
	if err != nil {
		return err
	}

	cmd := exec.Command("journalctl", "-m", fmt.Sprintf("_MACHINE_ID=%s", strings.Replace(id.uuid, "-", "", -1)), "-u", id.appName, "-a")
	// Get the json structured logs.
	cmd.Args = append(cmd.Args, "-o", "json")

	if logOptions.Follow {
		cmd.Args = append(cmd.Args, "-f")
	}

	if logOptions.TailLines != nil {
		cmd.Args = append(cmd.Args, "-n", strconv.FormatInt(*logOptions.TailLines, 10))
	}

	var since int64
	if logOptions.SinceSeconds != nil {
		t := unversioned.Now().Add(-time.Duration(*logOptions.SinceSeconds) * time.Second)
		since = t.Unix()
	}
	if logOptions.SinceTime != nil {
		since = logOptions.SinceTime.Unix()
	}

	if since > 0 {
		// Need to add '-r' flag if we include '--since' and '-n' at the both time,
		// see https://github.com/systemd/systemd/issues/1477
		cmd.Args = append(cmd.Args, "--since", time.Unix(since, 0).Format(journalSinceLayout))
		if logOptions.TailLines != nil {
			cmd.Args = append(cmd.Args, "-r")
		}
	}

	glog.V(4).Infof("rkt: gettings logs with command %q", cmd.Args)
	outPipe, err := cmd.StdoutPipe()
	if err != nil {
		glog.Errorf("rkt: cannot create pipe for journalctl's stdout: %v", err)
		return err
	}
	errPipe, err := cmd.StderrPipe()
	if err != nil {
		glog.Errorf("rkt: cannot create pipe for journalctl's stderr: %v", err)
		return err
	}

	if err := cmd.Start(); err != nil {
		return err
	}

	var wg sync.WaitGroup

	wg.Add(2)

	go pipeLog(&wg, logOptions, outPipe, stdout)
	go pipeLog(&wg, logOptions, errPipe, stderr)

	// Wait until the logs are fed to stdout, stderr.
	wg.Wait()
	cmd.Wait()

	return nil
}


text:
<?php

namespace umi\form\element\html5;

use umi\form\element\Text;

/**
 * HTML5 элемент формы - Число (number).
 * @example <input type="number" />
 */
class Number extends Text
{
    /**
     * Тип элемента.
     */
    const TYPE_NAME = 'number';

    /**
     * @var array $attributes аттрибуты
     */
    protected $attributes = [
        'type' => self::TYPE_NAME
    ];
}


text:
namespace base {
class TimeDelta;
}

namespace net {
class ProxyConfig;
class ProxyServer;
class URLRequest;
}

namespace data_reduction_proxy {

class TestDataReductionProxyParams : public DataReductionProxyParams {
 public:
  // Used to emulate having constants defined by the preprocessor.
  enum HasNames {
    HAS_NOTHING = 0x0,
    HAS_DEV_ORIGIN = 0x1,
    HAS_ORIGIN = 0x2,
    HAS_FALLBACK_ORIGIN = 0x4,
    HAS_SSL_ORIGIN = 0x08,
    HAS_ALT_ORIGIN = 0x10,
    HAS_ALT_FALLBACK_ORIGIN = 0x20,
    HAS_PROBE_URL = 0x40,
    HAS_DEV_FALLBACK_ORIGIN = 0x80,
    HAS_EVERYTHING = 0xff,
  };

  TestDataReductionProxyParams(int flags,
                               unsigned int has_definitions);
  bool init_result() const;

  // Overrides from DataReductionProxyParams.
  bool IsBypassedByDataReductionProxyLocalRules(
      const net::URLRequest& request,
      const net::ProxyConfig& data_reduction_proxy_config) const override;
  bool AreDataReductionProxiesBypassed(
      const net::URLRequest& request,
      const net::ProxyConfig& data_reduction_proxy_config,
      base::TimeDelta* min_retry_delay) const override;

  // Once called, the mocked method will repeatedly return |return_value|.
  void MockIsBypassedByDataReductionProxyLocalRules(bool return_value);
  void MockAreDataReductionProxiesBypassed(bool return_value);

  // Test values to replace the values specified in preprocessor defines.
  static std::string DefaultDevOrigin();
  static std::string DefaultDevFallbackOrigin();
  static std::string DefaultOrigin();
  static std::string DefaultFallbackOrigin();
  static std::string DefaultSSLOrigin();
  static std::string DefaultAltOrigin();
  static std::string DefaultAltFallbackOrigin();
  static std::string DefaultProbeURL();

  static std::string FlagOrigin();
  static std::string FlagFallbackOrigin();
  static std::string FlagSSLOrigin();
  static std::string FlagAltOrigin();
  static std::string FlagAltFallbackOrigin();
  static std::string FlagProbeURL();

  void set_origin(const net::ProxyServer& origin);
  void set_fallback_origin(const net::ProxyServer& fallback_origin);

 protected:
  std::string GetDefaultDevOrigin() const override;

  std::string GetDefaultDevFallbackOrigin() const override;

  std::string GetDefaultOrigin() const override;

  std::string GetDefaultFallbackOrigin() const override;

  std::string GetDefaultSSLOrigin() const override;

  std::string GetDefaultAltOrigin() const override;

  std::string GetDefaultAltFallbackOrigin() const override;

  std::string GetDefaultProbeURL() const override;

 private:
  std::string GetDefinition(unsigned int has_def,
                            const std::string& definition) const;

  unsigned int has_definitions_;
  bool init_result_;

  bool mock_is_bypassed_by_data_reduction_proxy_local_rules_;
  bool mock_are_data_reduction_proxies_bypassed_;
  bool is_bypassed_by_data_reduction_proxy_local_rules_return_value_;
  bool are_data_reduction_proxies_bypassed_return_value_;
};
}  // namespace data_reduction_proxy
#endif  // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS_TEST_UTILS_H_


text:
package com.jkoolcloud.tnt4j.streams.configure;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.Map;

import org.junit.Test;

import com.jkoolcloud.tnt4j.core.OpCompCode;
import com.jkoolcloud.tnt4j.streams.inputs.HttpServletStream;

/**
 * @author akausinis
 * @version 1.0
 */
public class GeneralResponseTemplateTest {

	@Test
	public void testResponseTemplateLoadDefault() {
		HttpResponseTemplate rt = new GeneralResponseTemplate(HttpServletStream.DEFAULT_RESPONSE_TEMPLATE);

		String errorMsg = "This is test error message"; // NON-NLS
		String bodyStr = rt.fillBody(null, errorMsg, OpCompCode.ERROR);

		assertNotNull("Response body is null", bodyStr); // NON-NLS
		assertTrue("Response does not contain provided message", bodyStr.contains(errorMsg)); // NON-NLS
		assertTrue("Response does not contain wrapping html", bodyStr.contains("<body>")); // NON-NLS
	}

	@Test
	public void testResponseTemplateLoadCustomLine() {
		String template = "" //
				+ "\"$headers\": {\n" //
				+ "    \"content-type\": \"application/json\"\n" //
				+ "},\n" //
				+ "\"$body\": {\n" //
				+ "    \"type\": \"TEXT\",\n" //
				+ "    \"payload\": \"Status message: ${message}\"\n" //
				+ "}";

		HttpResponseTemplate rt = new GeneralResponseTemplate(template);

		String errorMsg = "This is test error message"; // NON-NLS
		String bodyStr = rt.fillBody(null, errorMsg, OpCompCode.ERROR);

		assertNotNull("Response body is null", bodyStr); // NON-NLS
		assertTrue("Response does not contain provided message", bodyStr.contains(errorMsg)); // NON-NLS
		assertTrue("Response does not contain wrapping text", bodyStr.startsWith("Status message:")); // NON-NLS
	}

	@Test
	public void testResponseTemplateLoadCustomMap() {
		String template = "" //
				+ "\"$headers\": {\n" //
				+ "    \"content-type\": \"application/json\"\n" //
				+ "},\n" //
				+ "\"$body\": {\n" //
				+ "    \"type\": \"JSON\",\n" //
				+ "    \"payload\": {\n" //
				+ "        \"requestId\": \"${header:x-amz-firehose-request-id}\",\n" //
				+ "        \"timestamp\": \"${now}\",\n" //
				+ "        \"$optional\": {\n" //
				+ "            \"errorMessage\": \"${errorMessage}\"\n" //
				+ "        }\n" //
				+ "    }\n" //
				+ "}";

		HttpResponseTemplate rt = new GeneralResponseTemplate(template);

		Map<String, ?> headersMap = rt.fillHeaders(null);

		String errorMsg = "This is test error message"; // NON-NLS
		String successMsg = "This is test success message"; // NON-NLS

		String bodyStrErr = rt.fillBody(null, errorMsg, OpCompCode.ERROR);
		String bodyStrScs = rt.fillBody(null, successMsg, OpCompCode.SUCCESS);

		assertNotNull("Headers map is null", headersMap); // NON-NLS
		assertTrue("Unexpected headers map size", headersMap.size() == 1); // NON-NLS
		assertTrue("Map does not contain expected entry", headersMap.get("content-type") != null); // NON-NLS

		assertNotNull("Error response body is null", bodyStrErr); // NON-NLS
		assertTrue("Error response does not contain provided message", bodyStrErr.contains(errorMsg)); // NON-NLS
		assertTrue("Error response does not contain wrapping text", bodyStrErr.contains("errorMessage")); // NON-NLS
		assertTrue("Error response does not contain required fields",
				bodyStrErr.contains("requestId") && bodyStrErr.contains("timestamp")); // NON-NLS

		assertNotNull("Success response body is null", bodyStrScs); // NON-NLS
		assertTrue("Success response does contains message", !bodyStrScs.contains(successMsg)); // NON-NLS
		assertTrue("Success response does contains error message", !bodyStrScs.contains("errorMessage")); // NON-NLS
		assertTrue("Success response does not contain required fields",
				bodyStrScs.contains("requestId") && bodyStrScs.contains("timestamp")); // NON-NLS
	}
}


text:
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace Topppro.WebSite
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Preload cached resources
            ProductAssets.Preload();

            // Custom View Engine
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new CultureViewEngine());
        }
    }
}


text:
package org.apache.flink.streaming.connectors.elasticsearch;

import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.runtime.client.JobExecutionException;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.connectors.elasticsearch.testutils.ElasticsearchResource;
import org.apache.flink.streaming.connectors.elasticsearch.testutils.SourceSinkDataTestKit;
import org.apache.flink.test.util.AbstractTestBase;

import org.elasticsearch.client.Client;
import org.junit.ClassRule;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import static org.junit.Assert.fail;

/**
 * Environment preparation and suite of tests for version-specific {@link ElasticsearchSinkBase} implementations.
 *
 * @param <C> Elasticsearch client type
 * @param <A> The address type to use
 */
public abstract class ElasticsearchSinkTestBase<C extends AutoCloseable, A> extends AbstractTestBase {

	protected static final String CLUSTER_NAME = "test-cluster";

	@ClassRule
	public static ElasticsearchResource elasticsearchResource = new ElasticsearchResource(CLUSTER_NAME);

	/**
	 * Tests that the Elasticsearch sink works properly with json.
	 */
	public void runElasticsearchSinkTest() throws Exception {
		runElasticSearchSinkTest(SourceSinkDataTestKit::getJsonSinkFunction);
	}

	/**
	 * Tests that the Elasticsearch sink works properly with cbor.
	 */
	public void runElasticsearchSinkCborTest() throws Exception {
		runElasticSearchSinkTest(SourceSinkDataTestKit::getCborSinkFunction);
	}

	/**
	 * Tests that the Elasticsearch sink works properly with smile.
	 */
	public void runElasticsearchSinkSmileTest() throws Exception {
		runElasticSearchSinkTest(SourceSinkDataTestKit::getSmileSinkFunction);
	}

	/**
	 * Tests that the Elasticsearch sink works properly with yaml.
	 */
	public void runElasticsearchSinkYamlTest() throws Exception {
		runElasticSearchSinkTest(SourceSinkDataTestKit::getYamlSinkFunction);
	}

	private void runElasticSearchSinkTest(Function<String, ElasticsearchSinkFunction<Tuple2<Integer, String>>> functionFactory) throws Exception {
		final String index = "elasticsearch-sink-test-index";

		final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

		DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction());

		source.addSink(createElasticsearchSinkForEmbeddedNode(
				1,
				CLUSTER_NAME,
				functionFactory.apply(index)));

		env.execute("Elasticsearch Sink Test");

		// verify the results
		Client client = elasticsearchResource.getClient();
		SourceSinkDataTestKit.verifyProducedSinkData(client, index);

		client.close();
	}

	/**
	 * Tests that the Elasticsearch sink fails eagerly if the provided list of addresses is {@code null}.
	 */
	public void runNullAddressesTest() throws Exception {
		try {
			createElasticsearchSink(
					1,
					CLUSTER_NAME,
					null,
					SourceSinkDataTestKit.getJsonSinkFunction("test"));
		} catch (IllegalArgumentException | NullPointerException expectedException) {
			// test passes
			return;
		}

		fail();
	}

	/**
	 * Tests that the Elasticsearch sink fails eagerly if the provided list of addresses is empty.
	 */
	public void runEmptyAddressesTest() throws Exception {
		try {
			createElasticsearchSink(
					1,
					CLUSTER_NAME,
					Collections.emptyList(),
					SourceSinkDataTestKit.getJsonSinkFunction("test"));
		} catch (IllegalArgumentException expectedException) {
			// test passes
			return;
		}

		fail();
	}

	/**
	 * Tests whether the Elasticsearch sink fails when there is no cluster to connect to.
	 */
	public void runInvalidElasticsearchClusterTest() throws Exception {
		final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

		DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction());

		source.addSink(createElasticsearchSinkForNode(
				1,
				"invalid-cluster-name",
				SourceSinkDataTestKit.getJsonSinkFunction("test"),
				"123.123.123.123")); // incorrect ip address

		try {
			env.execute("Elasticsearch Sink Test");
		} catch (JobExecutionException expectedException) {
			// every ES version throws a different exception in case of timeouts, so don't bother asserting on the exception
			// test passes
			return;
		}

		fail();
	}

	/**
	 * Utility method to create a user config map.
	 */
	protected Map<String, String> createUserConfig(int bulkFlushMaxActions, String clusterName) {
		Map<String, String> userConfig = new HashMap<>();
		userConfig.put("cluster.name", clusterName);
		userConfig.put(ElasticsearchSinkBase.CONFIG_KEY_BULK_FLUSH_MAX_ACTIONS, String.valueOf(bulkFlushMaxActions));
		userConfig.put("transport.tcp.connect_timeout", "5s");

		return userConfig;
	}

	/** Creates a version-specific Elasticsearch sink, using arbitrary transport addresses. */
	protected abstract ElasticsearchSinkBase<Tuple2<Integer, String>, C> createElasticsearchSink(
			int bulkFlushMaxActions,
			String clusterName,
			List<A> addresses,
			ElasticsearchSinkFunction<Tuple2<Integer, String>> elasticsearchSinkFunction);

	/**
	 * Creates a version-specific Elasticsearch sink to connect to a local embedded Elasticsearch node.
	 *
	 * <p>This case is singled out from {@link ElasticsearchSinkTestBase#createElasticsearchSink(int, String, List, ElasticsearchSinkFunction)}
	 * because the Elasticsearch Java API to do so is incompatible across different versions.
	 */
	protected abstract ElasticsearchSinkBase<Tuple2<Integer, String>, C> createElasticsearchSinkForEmbeddedNode(
			int bulkFlushMaxActions,
			String clusterName,
			ElasticsearchSinkFunction<Tuple2<Integer, String>> elasticsearchSinkFunction) throws Exception;

	/**
	 * Creates a version-specific Elasticsearch sink to connect to a specific Elasticsearch node.
	 */
	protected abstract ElasticsearchSinkBase<Tuple2<Integer, String>, C> createElasticsearchSinkForNode(
			int bulkFlushMaxActions,
			String clusterName,
			ElasticsearchSinkFunction<Tuple2<Integer, String>> elasticsearchSinkFunction,
			String ipAddress) throws Exception;
}


text:
The open file dialog for opening
local saved files lies in the module
"open_dialog.py" and provides the
neede methods.

## How does it work? ##
If the "Open" button in the Dropdown-
menu is clicked, a popup window will
be opened and will ask the user for
the filename of the desired file-to-open.

If there is a file whith such a name,
it will be opened and the content will
be pasted to the main entry-field,
otherwise a IOError will be raised.

## Notes ##
The filename have to be entered WITH
the file extension, e.g.:
    hello.dat


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/save_menu"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black_pulp"
    android:orientation="vertical"
    android:visibility="visible" >

    <EditText
        android:id="@+id/save_menu_entryfield"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:hint="@string/hint_save_input"
        android:inputType="textCapSentences"
        android:orientation="horizontal"
        android:visibility="visible" />

</RelativeLayout>


text:
require "language/node"

class Serverless < Formula
  desc "Build applications with serverless architectures"
  homepage "https://www.serverless.com/"
  url "https://github.com/serverless/serverless/archive/v3.23.0.tar.gz"
  sha256 "4f05e15e551e0bad12315f2cfff30b425db03f83ee63dd8fd07f720665d82e5f"
  license "MIT"
  head "https://github.com/serverless/serverless.git", branch: "main"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_ventura:  "7b009b336e297b9ade60479ef070fae6f7b67d7ab2dc0168c6418b5f8a94db5e"
    sha256 cellar: :any_skip_relocation, arm64_monterey: "02a9e8c6ac85f6b46c50884526e8adbe4135d2bcc6a0ab5acf0f17a194b34be5"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "02a9e8c6ac85f6b46c50884526e8adbe4135d2bcc6a0ab5acf0f17a194b34be5"
    sha256 cellar: :any_skip_relocation, monterey:       "e658ca5841dcae1d2f7c31cbda6c91dacf163dfe83d84e3012bbe2792c6ed99c"
    sha256 cellar: :any_skip_relocation, big_sur:        "e658ca5841dcae1d2f7c31cbda6c91dacf163dfe83d84e3012bbe2792c6ed99c"
    sha256 cellar: :any_skip_relocation, catalina:       "e658ca5841dcae1d2f7c31cbda6c91dacf163dfe83d84e3012bbe2792c6ed99c"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "c76872204db9209a4aae0fd240c59798032f8c94557c237d79d899b31e09cc82"
  end

  depends_on "node"

  def install
    system "npm", "install", *Language::Node.std_npm_install_args(libexec)
    bin.install_symlink Dir[libexec/"bin/*"]

    # Delete incompatible Linux CPython shared library included in dependency package.
    # Raise an error if no longer found so that the unused logic can be removed.
    (libexec/"lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin")
      .glob("sdk-py/serverless_sdk/vendor/wrapt/_wrappers.cpython-*-linux-gnu.so")
      .map(&:unlink)
      .empty? && raise("Unable to find wrapt shared library to delete.")

    # Replace universal binaries with their native slices
    deuniversalize_machos libexec/"lib/node_modules/serverless/node_modules/fsevents/fsevents.node"
  end

  test do
    (testpath/"serverless.yml").write <<~EOS
      service: homebrew-test
      provider:
        name: aws
        runtime: python3.6
        stage: dev
        region: eu-west-1
    EOS

    system("#{bin}/serverless", "config", "credentials", "--provider", "aws", "--key", "aa", "--secret", "xx")
    output = shell_output("#{bin}/serverless package 2>&1")
    assert_match "Packaging homebrew-test for stage dev", output
  end
end