text:
package de.ailis.gramath;

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

import org.junit.Test;

/**
 * Tests the ImmutableDimension3f class.
 *
 * @author Klaus Reimer (k@ailis.de)
 */

public class ImmutableDimension3fTest
{
    /**
     * Tests constructor with float values.
     */

    @Test
    public void testValueConstructor()
    {
        final Dimension3f c = new ImmutableDimension3f(1, 2, 3);
        assertEquals(1, c.width, 0.001f);
        assertEquals(2, c.height, 0.001f);
        assertEquals(3, c.depth, 0.001f);
    }

    /**
     * Tests constructor with Dimension2d argument.
     */

    @Test
    public void testDimension2dConstructor()
    {
        final Dimension3f c = new ImmutableDimension3f(new MutableDimension2d(2, 1));
        assertEquals(2, c.width, 0.001f);
        assertEquals(1, c.height, 0.001f);
        assertEquals(0, c.depth, 0.001f);
    }

    /**
     * Tests constructor with Dimension2f argument.
     */

    @Test
    public void testDimension2fConstructor()
    {
        final Dimension3f c = new ImmutableDimension3f(new MutableDimension2f(2, 1));
        assertEquals(2, c.width, 0.001f);
        assertEquals(1, c.height, 0.001f);
        assertEquals(0, c.depth, 0.001f);
    }

    /**
     * Tests constructor with Dimension3d argument.
     */

    @Test
    public void testDimension3dConstructor()
    {
        final Dimension3f c = new ImmutableDimension3f(new MutableDimension3d(2, 1, 3));
        assertEquals(2, c.width, 0.001f);
        assertEquals(1, c.height, 0.001f);
        assertEquals(3, c.depth, 0.001f);
    }

    /**
     * Tests constructor with Dimension3f argument.
     */

    @Test
    public void testDimension3fConstructor()
    {
        final Dimension3f c = new ImmutableDimension3f(new MutableDimension3f(2, 1, 3));
        assertEquals(2, c.width, 0.001f);
        assertEquals(1, c.height, 0.001f);
        assertEquals(3, c.depth, 0.001f);
    }

    /**
     * Tests access to the color components
     */

    @Test
    public void testToString()
    {
        assertEquals("1.0x2.0x3.0", new ImmutableDimension3f(1, 2, 3).toString());
    }

    /**
     * Tests the clone method.
     */

    @Test
    public void testClone()
    {
        final ImmutableDimension3f c = new ImmutableDimension3f(1, 2, 3);
        final ImmutableDimension3f c2 = c.clone();
        assertNotSame(c, c2);
        assertEquals(c, c2);

        final Dimension3f c3 = new ImmutableDimension3f(1, 2, 3);
        final Object c4 = c3.clone();
        assertNotSame(c3, c4);
        assertEquals(c3, c4);
    }
}


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:background="@color/white"
             tools:context="hm.orz.chaos114.android.carnavimodoki.fragment.ArtistFragment">

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</FrameLayout>

redpajama_set_name: RedPajamaGithub


text:
//-------------
// <copyright file="IPodCastDownloader.cs" company="Uncas">
//     Copyright (c) Ole Lynge Sørensen. All rights reserved.
// </copyright>
//-------------

namespace Uncas.PodCastPlayer.Utility
{
    using System;
    using System.Collections.Generic;
    using Model;

    /// <summary>
    /// Handles download of pod cast.
    /// </summary>
    public interface IPodCastDownloader
    {
        /// <summary>
        /// Downloads the episode list.
        /// </summary>
        /// <param name="podCast">The pod cast.</param>
        /// <returns>A list of episodes.</returns>
        /// <exception cref="Uncas.PodCastPlayer.Utility.UtilityException"></exception>
        IList<Episode> DownloadEpisodeList(PodCast podCast);

        /// <summary>
        /// Downloads the pod cast info.
        /// </summary>
        /// <param name="podCastUrl">The pod cast URL.</param>
        /// <returns>Details about the pod cast.</returns>
        /// <exception cref="Uncas.PodCastPlayer.Utility.UtilityException"></exception>
        PodCast DownloadPodCastInfo(Uri podCastUrl);

        /// <summary>
        /// Gets the episode stream.
        /// </summary>
        /// <param name="mediaUrl">The media URL.</param>
        /// <returns>The episode stream.</returns>
        /// <exception cref="Uncas.PodCastPlayer.Utility.UtilityException"></exception>
        EpisodeMedia GetEpisodeStream(
            Uri mediaUrl);
    }
}


text:
package dummycache

import "testing"

func TestDummyCache(t *testing.T) {

	c, _ := New()

	account, err := c.Accounts().Get("account1")
	if err != nil {
		t.Fatal(err)
	}

	if account.ID != "account1" {
		t.Error("Wrong account returned")
	}

	if err := c.Config().Set("config", "abc123"); err != nil {
		t.Errorf("Dummy config should return nil")
	}

	cfg, err := c.Config().Get("config")
	if err != nil {
		t.Error("Dummy configs should be supported")
	}

	if cfg != "abc123" {
		t.Error("Dummy config did not return back expected string")
	}

}


text:
package org.wso2.am.integration.test.utils.webapp;

import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.am.admin.clients.webapp.WebAppAdminClient;
import org.wso2.am.integration.test.utils.APIManagerIntegrationTestException;
import org.wso2.am.integration.test.utils.base.APIMIntegrationConstants;
import org.wso2.carbon.automation.test.utils.http.client.HttpRequestUtil;
import org.wso2.carbon.automation.test.utils.http.client.HttpResponse;

import java.io.IOException;
import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.List;

/**
 * Util that is enabled the more utility methods for handling the WebApps
 */
public class WebAppDeploymentUtil {
    private static Log log = LogFactory.getLog(WebAppDeploymentUtil.class);
    private static int WEB_APP_DEPLOYMENT_DELAY = 90 * 1000;

    /**
     * Check whether the given web app is deployed correctly. This method will wait maximum 90 seconds
     * until it get deployed. check for the web app d
     *
     * @param backEndUrl     - Backend URL of the server where the web app is host.
     * @param sessionCookie  - valid session cookie of the server where the web app is host.
     * @param webAppFileName - File name of the web app that want to check for the deployment.
     * @return boolean - if WebAPp is get deployed withing 90 seconds or else return false.
     * @throws APIManagerIntegrationTestException - Exception throws when creating WebAppAdminClient object and calling
     *                                            methods of WebAppAdminClient class.
     */
    public static boolean isWebApplicationDeployed(String backEndUrl, String sessionCookie, String webAppFileName)
            throws APIManagerIntegrationTestException {
        log.info("waiting " + WEB_APP_DEPLOYMENT_DELAY + " millis for Service deployment " + webAppFileName);

        WebAppAdminClient webAppAdminClient;
        try {
            webAppAdminClient = new WebAppAdminClient(backEndUrl, sessionCookie);
        } catch (AxisFault axisFault) {
            throw new APIManagerIntegrationTestException("AxisFault Exception occurs when creating the WebAppAdminClient" +
                    " object ", axisFault);
        }

        List<String> webAppList;
        List<String> faultyWebAppList;
        String webAppName = webAppFileName + ".war";
        boolean isWebAppDeployed = false;
        Calendar startTime = Calendar.getInstance();
        long time;
        while ((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) <
                WEB_APP_DEPLOYMENT_DELAY) {
            try {
                webAppList = webAppAdminClient.getWebAppList(webAppFileName);
                faultyWebAppList = webAppAdminClient.getFaultyWebAppList(webAppFileName);
            } catch (RemoteException e) {
                throw new APIManagerIntegrationTestException("RemoteException occurs while retrieving the web app list" +
                        " from WebAppAdminClient.", e);
            }
            //check in the faulty WebApp list
            for (String faultWebAppName : faultyWebAppList) {
                if (webAppName.equalsIgnoreCase(faultWebAppName)) {
                    isWebAppDeployed = false;
                    log.info(webAppFileName + "- Web Application is faulty");
                    return isWebAppDeployed;
                }
            }
            //check in the successfully deployed WebApp list
            for (String name : webAppList) {
                if (webAppName.equalsIgnoreCase(name)) {
                    isWebAppDeployed = true;
                    log.info(webAppFileName + " Web Application deployed in " + time + " millis");
                    return isWebAppDeployed;
                }
            }

            try {
                //Sleeping 500 milliseconds before the next check of the deployment.
                Thread.sleep(500);
            } catch (InterruptedException ignored) {
                log.warn("InterruptedException occurs while waiting sleep for 500 milliseconds");
            }
        }
        return isWebAppDeployed;
    }

    /**
     * Verify whether AM_MONITORING_WEB_APP is deployed or not
     * @param webAppURL - Backend URL of the webApp (not need to include webApp name or context)
     *
     */
    public static void isMonitoringAppDeployed(String webAppURL) {
        long currentTime = System.currentTimeMillis();
        long waitTime = currentTime + (WEB_APP_DEPLOYMENT_DELAY);
        HttpResponse response = null;

        while (waitTime > System.currentTimeMillis()) {
            try {
                response = HttpRequestUtil.sendGetRequest(
                        webAppURL + "/" + APIMIntegrationConstants.AM_MONITORING_WEB_APP_NAME +
                        "/web_app_status/webapp-info/" + APIMIntegrationConstants.AM_MONITORING_WEB_APP_NAME + ".war", null);

            } catch (IOException ignore) {
                log.info("WAIT for webapp deployment  :" + APIMIntegrationConstants.AM_MONITORING_WEB_APP_NAME +
                         " with expected response : " + APIMIntegrationConstants.IS_WEB_APP_EXISTS);
            }

            if (response != null) {
                if (response.getData().contains(APIMIntegrationConstants.IS_WEB_APP_EXISTS)) {
                    log.info("WEB_APP :" + APIMIntegrationConstants.AM_MONITORING_WEB_APP_NAME + " found");
                    break;
                } else {
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException ignored) {

                    }
                }
            }
        }
    }

}


text:
from typing import Union

import collections
import enum
import random
import string
import stellata.database
import stellata.index
import stellata.relations
import stellata.model

class Query:
    """Container class for a SQL query.

    A query is essentially a container for various Expression types, which serialize themselves to SQL.
    """

    def __init__(self, model: type, database=None, joins=None, where=None, order=None, limit=None, join_type=None):
        if joins is None:
            joins = []

        if joins and not isinstance(joins, list):
            joins = [joins]

        self.model = model
        self.database = database
        self.joins = joins
        self.where_expression = where
        self.order_expression = order
        self.limit_expression = limit
        self.join_type = join_type

    def _delete_query(self):
        query = 'delete from "%s" ' % self.model.__table__
        where_query, where_values = self.where_expression.to_query()
        query += 'where %s' % where_query

        return (query, where_values)

    def _field_aliases(self, model=None, alias=None):
        # use query model by default
        if not model:
            model = self.model

        if not alias:
            alias = model.__table__

        # return a list of fields with aliases that can be used in a SQL query
        return [
            '"%s"."%s" as "%s.%s"' % (alias, field.column, alias, field.column)
            for field in model.__fields__
        ]

    def _get_with_joins(self, one, join_order, join_map):
        result = []

        # each join has a unique string alias to prevent collisions, so create map we can use later
        alias_map = {}
        for join in self.joins:
            alias_map[join.relation.child().model.__table__] = join.alias

        query, values = self._select_query(alias_map)
        rows = self._pool().query(query, values)

        # iterate over joins in order from leaf nodes to root node
        data = {}
        parent_key = None
        for child_model in join_order:
            for join in join_map.get(child_model, []):
                parent_model = join.relation.parent().model
                parent_column = join.relation.parent().column
                parent_table = join.relation.parent().model.__table__
                parent_alias = alias_map.get(parent_table, parent_table)
                parent_key = '%s.id' % parent_alias

                child_model = join.relation.child().model
                child_column = join.relation.child().column
                child_table = join.relation.child().model.__table__
                child_alias = join.alias
                child_key = '%s.id' % child_alias

                many = isinstance(join.relation, stellata.relations.HasMany)
                visited = set()
                for row in rows:
                    # for each join, insert into a table that maps models to their descendents.
                    # the first key is a model name, which maps to each returned model value.
                    # so, for `A1 -> [B1, B2], A2 -> [B3], B1 -> [C1], B2 -> [C2]` we have:
                    # {'b.id': {B1: [C1], B2: [C2], B3: []}, 'a.id': [{A1: [B1.C1, B2.C2], A2: [B3]}]}
                    # the general approach here is that we build up this table backwards, ensuring that all
                    # referenced values are inserted first. then, for each model, we can replace any
                    # fields that are actually references to other models with data already stored in the table.
                    parent_value = row[parent_key]
                    data.setdefault(parent_key, {})
                    data[parent_key].setdefault(parent_value, None)

                    # convert row to model objects, since that's what we'll ultimately return
                    child_row = self._row_to_object(child_model, row, child_alias)
                    parent_row = self._row_to_object(parent_model, row, parent_alias)
                    if data.get(parent_key, {}).get(parent_value):
                        parent_row = data[parent_key][parent_value]

                    # get values stored for this row and alias
                    v = [] if many else None
                    if (
                        hasattr(data[parent_key][parent_value], join.relation.column) and \
                        getattr(data[parent_key][parent_value], join.relation.column) and \
                        not isinstance(
                            getattr(data[parent_key][parent_value], join.relation.column),
                            stellata.relation.Relation
                        )
                    ):
                        v = getattr(data[parent_key][parent_value], join.relation.column)

                    # since joins are left joins, skip rows that are empty for the current join
                    if child_row:
                        child_row_id = child_row.id

                        # if data for foreign key already exists, then use that
                        if child_key in data:
                            if many:
                                if child_row_id not in visited:
                                    v.append(data.get(child_key, {}).get(child_row_id, []))
                                    visited.add(child_row_id)
                            else:
                                v = data.get(child_key, {}).get(child_row_id, [])

                        # if no data exists, then we must be at a leaf node, so use the row value
                        else:
                            if many:
                                if child_row_id not in visited:
                                    v.append(child_row)
                                    visited.add(child_row_id)
                            else:
                                v = child_row

                    # insert data into table
                    if parent_row:
                        setattr(parent_row, join.relation.column, v)
                        data[parent_key][parent_value] = parent_row

        # if no rows are returned, then return an empty list
        if not parent_key or parent_key not in data:
            return []

        # final result is stored at the key representing the root model
        result = list(data[parent_key].values())
        if one:
            result = result[0]

        return result

    def _get_with_queries(self, one, join_order, join_map):
        result = {}
        data = {}
        query, values = self._select_query(use_joins=False)
        rows = self._pool().query(query, values)

        # instantiate model objects from rows in initial query
        for row in rows:
            row_object = self._row_to_object(self.model, row)
            data.setdefault(self.model, {})
            data[self.model][row_object.id] = row_object

        # for each join, store all rows in memory, then fetch all child rows for the join
        # we need to store both the actual data as well as the map from parents -> children
        for child_model in reversed(join_order):
            for join in join_map.get(child_model, []):
                belongs_to = isinstance(join.relation, stellata.relations.BelongsTo)
                related_ids = []
                related_field = None
                if belongs_to:
                    related_field = join.relation.child()
                    related_ids = [
                        getattr(row, join.relation.foreign_key().column)
                        for row in data.get(join.relation.parent().model, {}).values()
                    ]
                else:
                    related_field = join.relation.foreign_key()
                    related_ids = list(data.get(join.relation.parent().model, {}).keys())

                rows = join.relation.child().model.where(related_field << related_ids).get()
                row_ids = []
                for row in rows:
                    data.setdefault(join.relation.child().model, {})
                    data[join.relation.child().model][row.id] = row
                    row_ids.append(row.id)

        # now that all rows are in memory, associate children with their parents by aggregating children
        # by the foreign key and then setting attributes on the parents
        for child_model in join_order[:-1]:
            for join in join_map.get(child_model, []):
                many = isinstance(join.relation, stellata.relations.HasMany)
                belongs_to = isinstance(join.relation, stellata.relations.BelongsTo)

                # for belongs to, index into the child and set the value on the parent
                if belongs_to:
                    for parent in data.get(join.relation.parent().model, {}).values():
                        setattr(
                            parent,
                            join.relation.column,
                            data.get(join.relation.child().model, {}) \
                                .get(getattr(parent, join.relation.foreign_key().column))
                        )

                # for has many/one, aggregate children by their ID, then attach that to the parent
                else:
                    children_by_parent_id = {}
                    for child in data.get(join.relation.child().model, {}).values():
                        parent_id = getattr(child, join.relation.foreign_key().column)
                        if many:
                            children_by_parent_id.setdefault(parent_id, [])
                            children_by_parent_id[parent_id].append(child)
                        else:
                            children_by_parent_id[parent_id] = child

                    for parent_id in data.get(join.relation.parent().model, {}).keys():
                        parent = data[join.relation.parent().model][parent_id]
                        children = children_by_parent_id.get(parent_id, [] if many else None)
                        setattr(parent, join.relation.column, children)

        return list(data.get(join_order[-1], {}).values())

    def _insert_query(self, objects: list, unique=None, one=False):
        # construct list of field names and placeholders for escaped values
        data = [e.to_dict() for e in objects]
        columns = list(data[0].keys())
        fields = ' (%s)' % ','.join(sorted(columns))
        values = ' values ' + ','.join([
            '(%s)' % ','.join(['%s'] * len(data[0]))
        ] * len(data))
        args = [i[1] for j in data for i in sorted(j.items())]

        # handle unique indexes
        unique_string = ''
        if unique:
            # assume a list of fields is given by default
            unique_fields = unique

            # if a dictionary is given, then extract columns
            if isinstance(unique, dict):
                if 'columns' in unique:
                    unique_fields = unique['columns']
                if 'index' in unique:
                    unique_fields = unique['index']

            # if index is given, then expand to all columns in that index
            if isinstance(unique_fields, stellata.index.Index):
                assert unique_fields.unique
                unique_fields = unique_fields.fields()

            # if a single column is passed, then convert to a list
            elif isinstance(unique_fields, stellata.field.Field):
                unique_fields = [unique_fields]

            # if no columns are given, then update all columns
            update_columns = columns
            if isinstance(unique, dict):
                update_columns = unique.get('update', [])

            unique_string = ' on conflict (%s) do update set %s' % (
                ','.join([e.column for e in unique_fields]),
                ', '.join(['%s = excluded.%s' % (column, column) for column in update_columns])
            )

        # concatenate query parts and execute
        returning = ' returning %s' % ','.join(self._field_aliases())
        sql = 'insert into "' + self.model.__table__ + '"' + fields + values + unique_string + returning

        # convert enum values to scalars
        args = [e.value if isinstance(e, enum.Enum) else e for e in args]
        return (sql, args)

    def _pool(self):
        if self.database:
            return self.database

        return stellata.database.pool

    def _row_to_object(self, model: 'stellata.model.Model', row, alias=None):
        empty = True
        data = {}
        if not alias:
            alias = model.__table__

        # iterate over fields defined in the model and extract them from the row dict
        for field in model.__fields__:
            value = row['%s.%s' % (alias, field.column)]
            data[field.column] = value
            if value is not None:
                empty = False

        # don't return a dictionary where every column is null
        if empty:
            return None

        return model(**data)

    def _select_query(self, alias_map=None, use_joins=True):
        alias_map = alias_map or {}
        columns = self._field_aliases()

        # add each join to the list of columns to select
        if use_joins:
            for join in self.joins:
                child = join.relation.child()
                columns += self._field_aliases(child.model, join.alias)

        # base select query
        query = 'select %s from "%s" ' % (','.join(columns), self.model.__table__)

        # add each join clause
        if self.joins and use_joins:
            query += '%s ' % ' '.join(e.to_query(alias_map) for e in self.joins)

        # add where clause
        where_values = tuple()
        if self.where_expression:
            where_query, where_values = self.where_expression.to_query(alias_map)
            query += 'where %s' % where_query

        if self.order_expression:
            query += ' %s' % self.order_expression.to_query(alias_map)

        if self.limit_expression:
            query += ' %s' % self.limit_expression.to_query()

        # convert enum values to scalars
        where_values = [e.value if isinstance(e, enum.Enum) else e for e in where_values]
        return (query, where_values)

    def _update_query(self, data: 'stellata.model.Model'):
        values = []
        query = 'update "%s" ' % self.model.__table__

        update = ','.join([e + ' = %s' for e in data.to_dict().keys()])
        query += 'set %s ' % update
        values += list(data.to_dict().values())
        has_where = False

        if self.where_expression:
            where_query, where_values = self.where_expression.to_query()
            query += 'where %s returning ' % where_query
            values += where_values

            # return all data from updated objects, so caller can determine which rows where changed
            query += ','.join(self._field_aliases())
            has_where = True

        return (query, values, has_where)

    def create(self, data: Union['stellata.model.Model', list], unique=None):
        # accept both a list and single dictionary as an argument
        one = False
        if not isinstance(data, list):
            data = [data]
            one = True

        if len(data) == 0:
            return

        # run insert query and get result, which will have any defaults added as well
        query, values = self._insert_query(data, unique, one)
        result = [self._row_to_object(self.model, row) for row in self._pool().query(query, values)]

        if one and len(result) > 0:
            return result[0]
        return result

    def delete(self):
        query, values = self._delete_query()
        self._pool().execute(query, values)

    def get(self, one=False):
        # if we don't have any joins, then just grab rows and we're done
        if not self.joins:
            query, values = self._select_query()
            rows = self._pool().query(query, values)
            result = [self._row_to_object(self.model, row) for row in rows]
            if one and len(result) > 0:
                result = result[0]

            return result

        # build directed graph and reversed directed graph of joins so we can identify leaves and roots
        join_order = []
        adjacency_list = {}
        reversed_adjacency_list = {}
        join_map = {}
        for join in self.joins:
            parent = join.relation.parent().model
            child = join.relation.child().model

            adjacency_list.setdefault(parent, [])
            adjacency_list[parent].append(child)
            reversed_adjacency_list.setdefault(child, [])
            reversed_adjacency_list[child].append(parent)
            join_map.setdefault(child, [])
            join_map[child].append(join)

        # perform a DFS on the reversed directed graph to identify the root node
        root = None
        stack = collections.deque([list(reversed_adjacency_list.keys())[0]])
        explored = set()
        while len(stack) > 0:
            root = stack.pop()
            if root in explored:
                continue

            explored.add(root)
            if root not in reversed_adjacency_list:
                break

            for child in reversed_adjacency_list[root]:
                stack.append(child)

        # do a post-order DFS on the directed graph to order joins from leaf to root
        def _build_join_order(adjacency_list, root, join_order, explored):
            if root in adjacency_list and root not in explored:
                for child in adjacency_list[root]:
                    _build_join_order(adjacency_list, child, join_order, explored)

            if root not in explored:
                join_order.append(root)
            explored.add(root)

        explored = set()
        _build_join_order(adjacency_list, root, join_order, explored)

        if self.join_type == 'join' or (not self.join_type and stellata.model._join_type == 'join'):
            return self._get_with_joins(one, join_order, join_map)

        return self._get_with_queries(one, join_order, join_map)

    def get_one(self):
        return self.get(one=True)

    def join(self, relation: 'stellata.relation.Relation'):
        self.joins.append(JoinExpression(relation))
        return self

    def join_with(self, join_type):
        self.join_type = join_type
        return self

    def limit(self, n):
        self.limit_expression = LimitExpression(n)
        return self

    def on(self, database: 'stellata.database.Pool'):
        self.database = database
        return self

    def order(self, fields: list, order=None):
        self.order_expression = OrderByExpression(fields, order)
        return self

    def update(self, data: 'stellata.model.Model'):
        query, values, has_where = self._update_query(data)

        if has_where:
            rows = self._pool().query(query, values)
            return [self._row_to_object(self.model, row) for row in rows]

        return self._pool().execute(query, values)

    def where(self, expression: 'Expression'):
        self.where_expression = expression
        return self

class Expression:
    """Expression base class.

    Each expression subclass is responsible for serializing itself into a query string.
    """

    def to_query(self):
        """Serialize expression to a SQL query string."""
        raise NotImplementedError()

class JoinExpression(Expression):
    """Expression containing a single join with another table.

    These expressions are chained via .join calls, so have no overloaded operators.
    """

    def __init__(self, relation: 'stellata.relation.Relation'):
        self.relation = relation
        self.alias = ''.join(random.choices(string.ascii_uppercase + string.ascii_lowercase, k=5))

    def to_query(self, alias_map=None):
        alias_map = alias_map or {}
        parent = self.relation.parent()
        child = self.relation.child()

        parent_table = alias_map.get(parent.model.__table__, parent.model.__table__)
        child_table = alias_map.get(child.model.__table__, child.model.__table__)

        return 'left join "%s" as "%s" on "%s"."%s" = "%s"."%s"' % (
            child.model.__table__,
            self.alias,
            parent_table,
            parent.column,
            self.alias,
            child.column
        )

class LimitExpression(Expression):
    def __init__(self, n):
        self.n = n

    def to_query(self):
        return 'limit %s' % self.n

class OrderByExpression(Expression):
    """Expression containing a list of ORDER BY clauses."""

    def __init__(self, fields: Union[list, 'stellata.field.Field'], order: str):
        if not isinstance(fields, list):
            fields = [fields]

        self.fields = fields
        self.order = order or 'asc'

    def to_query(self, alias_map=None):
        alias_map = alias_map or {}
        return 'order by %s %s' % (','.join([
            '"%s"."%s"' % (alias_map.get(field.model.__table__, field.model.__table__), field.column)
            for field in self.fields
        ]), self.order)

class SingleColumnExpression(Expression):
    """Expression containing a single column and value.

    Example SingleColumnExpressions are `id = 5` or `count > 3`.
    OR-ing or AND-ing two SingleColumnExpressions produces a MultiColumnExpression.
    """

    def __init__(self, model: 'stellata.model.Model', column: str, comparison: str, value: Union[int, str, bool]):
        if value is None:
            comparison = 'is' if comparison == '=' else 'is not'

        self.model = model
        self.column = column
        self.comparison = comparison
        self.value = value

    def __or__(self, value: Expression):
        return MultiColumnExpression(self.model, self, value, 'or')

    def __and__(self, value: Expression):
        return MultiColumnExpression(self.model, self, value, 'and')

    def to_query(self, alias_map=None):
        alias_map = alias_map or {}
        table = alias_map.get(self.model.__table__, self.model.__table__)
        if self.comparison == 'in':
            return (
                '"%s"."%s" %s (%s)' % (
                    table,
                    self.column,
                    self.comparison,
                    ','.join(['%s' for e in self.value])
                ),
                self.value
            )

        if self.value == None:
            return ('"%s"."%s" %s null' % (table, self.column, self.comparison), [])

        return ('"%s"."%s" %s %%s' % (table, self.column, self.comparison), [self.value])

class MultiColumnExpression(Expression):
    """Expression containing a two SingleColumnExpressions.

    Example SingleColumnExpressions are `id = 5 OR count > 3`.
    OR-ing or AND-ing two MultiColumnExpressions produces a MultiColumnExpression.
    """

    def __init__(self, model: 'stellata.model.Model', left: Expression, right: Expression, operator: str):
        self.model = model
        self.left = left
        self.right = right
        self.operator = operator

    def __or__(self, value: Expression):
        return MultiColumnExpression(self.model, self, value, 'or')

    def __and__(self, value: Expression):
        return MultiColumnExpression(self.model, self, value, 'and')

    def to_query(self, alias_map=None):
        alias_map = alias_map or {}
        left_query = ''
        left_values = []
        right_query = ''
        right_values = []

        if self.left:
            left_query, left_values = self.left.to_query(alias_map)
        if self.right:
            right_query, right_values = self.right.to_query(alias_map)

        # if either of the operands evaluates to None, then the operator is meaningless
        if not self.left or not self.right:
            self.operator = ''

        return (' (%s %s %s) ' % (left_query, self.operator, right_query), left_values + right_values)


text:
require 'rails_helper'

RSpec.describe KubernetesNamespace, type: :model do

  describe '#name' do
    it { is_expected.to allow_value('f').for(:name) }
    it { is_expected.to allow_value('foo').for(:name) }
    it { is_expected.to allow_value('foo-bar').for(:name) }
    it { is_expected.to allow_value('foo-1').for(:name) }
    it { is_expected.to allow_value('1').for(:name) }
    it { is_expected.to allow_value('1-foo').for(:name) }

    it { is_expected.not_to allow_value('foo_bar').for(:name) }
    it { is_expected.not_to allow_value('foo_1').for(:name) }
    it { is_expected.not_to allow_value('foo bar').for(:name) }
    it { is_expected.not_to allow_value('foo 1').for(:name) }
    it { is_expected.not_to allow_value('-foo').for(:name) }
    it { is_expected.not_to allow_value('foo-').for(:name) }
    it { is_expected.not_to allow_value('_foo').for(:name) }

    context 'for an existing namespace' do
      subject { create :kubernetes_namespace }

      it 'should only allow unique names per cluster' do
        expect { create :kubernetes_namespace, name: subject.name, service: subject.service, cluster: subject.cluster }.to raise_error(
          ActiveRecord::RecordInvalid,
          "Validation failed: Name already exists for the cluster"
        )
      end
    end
  end

  describe 'custom validations' do

    describe '#allowed_clusters_only' do
      let!(:service) { create :service }
      let!(:allocated_cluster) { create :kubernetes_cluster, allocate_to: service.project }
      let!(:unallocated_cluster) { create :kubernetes_cluster }
      let!(:other_allocated_cluster) { create :kubernetes_cluster, allocate_to: create(:project) }

      it 'allows using the allocated cluster' do
        namespace = build :kubernetes_namespace, service: service, cluster: allocated_cluster
        expect(namespace).to be_valid
      end

      it 'raises error when using unallocated cluster' do
        expect { create :kubernetes_namespace, service: service, cluster: unallocated_cluster }.to raise_error(
          ActiveRecord::RecordInvalid,
          "Validation failed: Cluster is not allowed for this namespace"
        )
      end

      it 'raises error when using other allocated cluster' do
        expect { create :kubernetes_namespace, service: service, cluster: other_allocated_cluster }.to raise_error(
          ActiveRecord::RecordInvalid,
          "Validation failed: Cluster is not allowed for this namespace"
        )
      end
    end

  end

end


text:
<?php
namespace common\modules\user;

use Yii;
use yii\base\BootstrapInterface;
use yii\web\User;

class Module extends \yii\base\Module implements BootstrapInterface{

	    public $enableGeneratingPassword = true;

	    /** @var bool Whether to show flash messages. */
	    public $enableFlashMessages = true;

	    /** @var bool Whether to enable registration. */
	    public $enableRegistration = true;

	    /** @var bool Whether user has to confirm his account. */
	    public $enableConfirmation = true;

	    /** @var bool Whether to allow logging in without confirmation. */
	    public $enableUnconfirmedLogin = false;

	    /** @var bool Whether to enable password recovery. */
	    public $enablePasswordRecovery = true;

	    /** @var bool Whether user can remove his account */
	    public $enableAccountDelete = false;

	    /**  @var string rbac默认管理员permission名 */
	    public $adminPermission = 'admin';

	    public $admins = [];

	    public $defaultPassword = '111111';

	    public $urlPrefix = 'user';

	    public $urlRules = [];

	 public function init(){
        parent::init();
        if (!isset(Yii::$app->i18n->translations['user'])) {
            Yii::$app->i18n->translations['user'] = [
                'class' => 'yii\i18n\PhpMessageSource',
                'basePath' => '@common/modules/user/messages'
            ];
        }
    }

    public function bootstrap($app){
        if ($app->id == 'app-frontend') {
            $this->attachBehavior('frontend', 'common\modules\user\filters\FrontendFilter');	//动态加载行为
        }
        if ($app->id == 'app-backend') {
            $this->attachBehavior('backend', 'common\modules\user\filters\BackendFilter');
            Yii::$app->set('user', [
                'class' => 'yii\web\User',
                'identityClass' => 'common\modules\user\models\User',
                'loginUrl' => ['/user/admin/login'],
                'enableAutoLogin' => true,
                'on afterLogin' => function($event) {
                    $event->identity->touch('login_at');
                },
                'idParam' => '__idBackend',
                'identityCookie' => ['name' => '_identityBackend', 'httpOnly' => true]
            ]);
            $app->urlManager->addRules([
                'user/<action:\S+>' => 'user/admin/<action>',
            ], false);
        } else {
            Yii::$app->set('user', [
                'class' => 'yii\web\User',
                'identityClass' => 'common\modules\user\models\User',
                'loginUrl' => ['/user/security/login'],
                'enableAutoLogin' => true,
                'on afterLogin' => function($event) {
                    $event->identity->touch('login_at');
                },
                'as userBehavior' => [
                    'class' => UserBehaviorBehavior::className(),
                    'eventName' => User::EVENT_AFTER_LOGIN,
                    'name' => 'login',
                    'rule' => [
                        'cycle' => 24,
                        'max' => 1,
                        'counter' => 10,
                    ],
                    'content' => '{user.username}在{extra.time}登录了系统',
                    'data' => [
                        'extra' => [
                            'time' => date('Y-m-d H:i:s')
                        ]
                    ]
                ]
            ]);
            $this->urlRules = [
                '<id:\d+>' => 'default/index',
                '<action:(login|logout)>' => 'security/<action>',
                '<action:(signup)>' => 'registration/<action>',
                '<action:(up|article-list|create-article|update-article|notice|favourite)>' => 'default/<action>',
            ];
        }

        $configUrlRule = [
            'prefix' => $this->urlPrefix,
            'rules'  => $this->urlRules,
        ];

        if ($this->urlPrefix != 'user') {
            $configUrlRule['routePrefix'] = 'user';
        }

        $configUrlRule['class'] = 'yii\web\GroupUrlRule';
        $rule = Yii::createObject($configUrlRule);

        $app->urlManager->addRules([$rule], false);
    }
}


text:
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="shortcut icon" href="">
    <meta charset="UTF-8">
    <title>Youtube Angular</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>

<body>

<app></app>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://apis.google.com/js/client.js?onload=googleApiClientReady">   </script>

</body>
</html>


text:
namespace autofill_private = extensions::api::autofill_private;

namespace {

// Get the multi-valued element for |type| and return it as a |vector|.
// TODO(khorimoto): remove this function since multi-valued types are
// deprecated.
std::unique_ptr<std::vector<std::string>> GetValueList(
    const autofill::AutofillProfile& profile,
    autofill::ServerFieldType type) {
  std::unique_ptr<std::vector<std::string>> list(new std::vector<std::string>);

  std::vector<base::string16> values;
  if (autofill::AutofillType(type).group() == autofill::NAME) {
    values.push_back(
        profile.GetInfo(autofill::AutofillType(type),
                        g_browser_process->GetApplicationLocale()));
  } else {
    values.push_back(profile.GetRawInfo(type));
  }

  // |Get[Raw]MultiInfo()| always returns at least one, potentially empty, item.
  // If this is the case, there is no info to return, so return an empty vector.
  if (values.size() == 1 && values.front().empty())
    return list;

  for (const base::string16& value16 : values)
    list->push_back(base::UTF16ToUTF8(value16));

  return list;
}

// Gets the string corresponding to |type| from |profile|.
std::unique_ptr<std::string> GetStringFromProfile(
    const autofill::AutofillProfile& profile,
    const autofill::ServerFieldType& type) {
  return base::MakeUnique<std::string>(
      base::UTF16ToUTF8(profile.GetRawInfo(type)));
}

autofill_private::AddressEntry ProfileToAddressEntry(
    const autofill::AutofillProfile& profile,
    const base::string16& label) {
  autofill_private::AddressEntry address;

  // Add all address fields to the entry.
  address.guid.reset(new std::string(profile.guid()));
  address.full_names = GetValueList(profile, autofill::NAME_FULL);
  address.company_name.reset(
      GetStringFromProfile(profile, autofill::COMPANY_NAME).release());
  address.address_lines.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_STREET_ADDRESS)
          .release());
  address.address_level1.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_STATE).release());
  address.address_level2.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_CITY).release());
  address.address_level3.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_DEPENDENT_LOCALITY)
          .release());
  address.postal_code.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_ZIP).release());
  address.sorting_code.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_SORTING_CODE)
          .release());
  address.country_code.reset(
      GetStringFromProfile(profile, autofill::ADDRESS_HOME_COUNTRY).release());
  address.phone_numbers =
      GetValueList(profile, autofill::PHONE_HOME_WHOLE_NUMBER);
  address.email_addresses = GetValueList(profile, autofill::EMAIL_ADDRESS);
  address.language_code.reset(new std::string(profile.language_code()));

  // Parse |label| so that it can be used to create address metadata.
  base::string16 separator =
      l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR);
  std::vector<base::string16> label_pieces = base::SplitStringUsingSubstr(
      label, separator, base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);

  // Create address metadata and add it to |address|.
  std::unique_ptr<autofill_private::AutofillMetadata> metadata(
      new autofill_private::AutofillMetadata);
  metadata->summary_label = base::UTF16ToUTF8(label_pieces[0]);
  metadata->summary_sublabel.reset(new std::string(base::UTF16ToUTF8(
      label.substr(label_pieces[0].size()))));
  metadata->is_local.reset(new bool(
      profile.record_type() == autofill::AutofillProfile::LOCAL_PROFILE));
  address.metadata = std::move(metadata);

  return address;
}

autofill_private::CountryEntry CountryToCountryEntry(
    autofill::AutofillCountry* country) {
  autofill_private::CountryEntry entry;

  // A null |country| means "insert a space here", so we add a country w/o a
  // |name| or |country_code| to the list and let the UI handle it.
  if (country) {
    entry.name.reset(new std::string(base::UTF16ToUTF8(country->name())));
    entry.country_code.reset(new std::string(country->country_code()));
  }

  return entry;
}

autofill_private::CreditCardEntry CreditCardToCreditCardEntry(
    const autofill::CreditCard& credit_card) {
  autofill_private::CreditCardEntry card;

  // Add all credit card fields to the entry.
  card.guid.reset(new std::string(credit_card.guid()));
  card.name.reset(new std::string(base::UTF16ToUTF8(
      credit_card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL))));
  card.card_number.reset(new std::string(
      base::UTF16ToUTF8(credit_card.GetRawInfo(autofill::CREDIT_CARD_NUMBER))));
  card.expiration_month.reset(new std::string(base::UTF16ToUTF8(
      credit_card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH))));
  card.expiration_year.reset(new std::string(base::UTF16ToUTF8(
      credit_card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR))));

  // Create address metadata and add it to |address|.
  std::unique_ptr<autofill_private::AutofillMetadata> metadata(
      new autofill_private::AutofillMetadata);
  std::pair<base::string16, base::string16> label_pieces =
      credit_card.LabelPieces();
  metadata->summary_label = base::UTF16ToUTF8(label_pieces.first);
  metadata->summary_sublabel.reset(new std::string(base::UTF16ToUTF8(
      label_pieces.second)));
  metadata->is_local.reset(new bool(
      credit_card.record_type() == autofill::CreditCard::LOCAL_CARD));
  metadata->is_cached.reset(new bool(
      credit_card.record_type() == autofill::CreditCard::FULL_SERVER_CARD));
  card.metadata = std::move(metadata);

  return card;
}

}  // namespace

namespace extensions {

namespace autofill_util {

AddressEntryList GenerateAddressList(
    const autofill::PersonalDataManager& personal_data) {
  const std::vector<autofill::AutofillProfile*>& profiles =
      personal_data.GetProfiles();
  std::vector<base::string16> labels;
  autofill::AutofillProfile::CreateDifferentiatingLabels(
      profiles,
      g_browser_process->GetApplicationLocale(),
      &labels);
  DCHECK_EQ(labels.size(), profiles.size());

  AddressEntryList list;
  for (size_t i = 0; i < profiles.size(); ++i)
    list.push_back(ProfileToAddressEntry(*profiles[i], labels[i]));

  return list;
}

CountryEntryList GenerateCountryList(
    const autofill::PersonalDataManager& personal_data) {
  autofill::CountryComboboxModel model;
  model.SetCountries(personal_data, base::Callback<bool(const std::string&)>());
  const std::vector<std::unique_ptr<autofill::AutofillCountry>>& countries =
      model.countries();

  CountryEntryList list;

  for (const auto& country : countries)
    list.push_back(CountryToCountryEntry(country.get()));

  return list;
}

CreditCardEntryList GenerateCreditCardList(
    const autofill::PersonalDataManager& personal_data) {
  const std::vector<autofill::CreditCard*>& cards =
      personal_data.GetCreditCards();

  CreditCardEntryList list;
  for (const autofill::CreditCard* card : cards)
    list.push_back(CreditCardToCreditCardEntry(*card));

  return list;
}

}  // namespace autofill_util

}  // namespace extensions


text:
require "pathname"
require "terminal-table"
require "colorize"

module JpStringsFinder
  class Printer
    attr_reader :list

    def initialize(list)
      @list = list
    end

    def print_table
      table = Terminal::Table.new do |t|
        t.headings = ['File', 'Type', 'Strings']
        list.each_with_index do |hash, index|
          t.add_row(
            [
              to_relative_path(Dir.pwd, hash[:file]),
              hash[:type].upcase,
              hash[:strings].join("\n")
            ]
          )
          t.add_separator unless index == list.count - 1
        end
      end
      puts table
      strings_count = list.inject(0) { |acc, elem| acc + elem[:strings].count }
      STDERR.puts "There are #{strings_count} Japanese strings in #{list.count} files".colorize(:yellow)
    end

    private

    def to_relative_path(root, path)
      Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
    end
  end
end


text:
/// <summary>
/// Almost the same task as from programming basics exam on 18-Mar-2017
/// </summary>
using System;
public class GameOfNumbers
{
    public static void Main()
    {
        int firstNumber = int.Parse(Console.ReadLine());
        int secondNumber = int.Parse(Console.ReadLine());
        int magicNumber = int.Parse(Console.ReadLine());
        int combinationNumber = 0;
        bool magicFound = false;

        for (int i = firstNumber; i <= secondNumber; i++)
        {
            for (int j = firstNumber; j <= secondNumber; j++)
            {
                combinationNumber++;
                if (i + j == magicNumber && magicFound == false)
                {
                    magicFound = true;
                    Console.Write($"Number found! {j} + {i} = {i + j}");
                }
            }
        }

        if (magicFound == false)
        {
            Console.WriteLine($"{combinationNumber} combinations - neither equals {magicNumber}");
        }
    }
}


text:
cask "cleanshot" do
  version "3.3.8"
  sha256 "e59e82fa037b6738d5b7262881e69bfe7d4f619bce4a93c9ee7cee5a6c8b7faa"

  url "https://updates.getcleanshot.com/v#{version.major}/CleanShot-X-#{version}.dmg"
  appcast "https://updates.getcleanshot.com/v#{version.major}/appcast.xml"
  name "CleanShot"
  homepage "https://getcleanshot.com/"

  auto_updates true

  app "CleanShot X.app"

  uninstall quit: "pl.maketheweb.cleanshotx"

  zap trash: [
    "~/Library/Application Support/CleanShot",
    "~/Library/Caches/SentryCrash/CleanShot X",
    "~/Library/Caches/pl.maketheweb.cleanshotx",
    "~/Library/Preferences/pl.maketheweb.cleanshotx.plist",
  ]
end


text:
require 'delayed_job'
require 'rails'

module Delayed
  class Railtie < Rails::Railtie
    initializer :after_initialize do
      Delayed::Worker.logger ||= if defined?(Rails)
        Rails.logger
      elsif defined?(RAILS_DEFAULT_LOGGER)
        RAILS_DEFAULT_LOGGER
      end
    end

    rake_tasks do
      load 'delayed/tasks.rb'
    end
  end
end


text:
<?php

namespace GoalioForgotPassword\Mapper;

//use Laminas\Hydrator\ClassMethods;
use Laminas\Hydrator\ClassMethodsHydrator;
use GoalioForgotPassword\Entity\Password as Entity;

class PasswordHydrator extends ClassMethodsHydrator
{
    /**
     * Extract values from an object
     *
     * @param  object $object
     * @return array
     * @throws Exception\InvalidArgumentException
     */
    public function extract(object $object):array
    {
        if (!$object instanceof Entity) {
            throw new \InvalidArgumentException('$object must be an instance of EmailVerification entity');
        }
        /* @var $object Entity*/
        $data = parent::extract($object);
        if ( $data['request_time'] instanceof \DateTime ) {
            $data['request_time'] = $data['request_time']->format('Y-m-d H:i:s');
        }
        return $data;
    }

    /**
     * Hydrate $object with the provided $data.
     *
     * @param  array $data
     * @param  object $object
     * @return UserInterface
     * @throws Exception\InvalidArgumentException
     */
    public function hydrate(array $data, $object)
    {
        if (!$object instanceof Entity) {
            throw new \InvalidArgumentException('$object must be an instance of Password entity');
        }
        if ( ! $data['request_time'] instanceof \DateTime ) {
            $data['request_time'] = new \DateTime($data['request_time']);
        }
        return parent::hydrate($data, $object);
    }

    protected function mapField($keyFrom, $keyTo, array $array)
    {
        $array[$keyTo] = $array[$keyFrom];
        unset($array[$keyFrom]);
        return $array;
    }
}


text:
"Cert Tools, pyOpenSSL version"

__author__ = 'phoenix'
__version__ = '0.1'

CA = "CA.crt"
CERTDIR = "Certs"
# Temp list for generating certs
workingList = set()

import os
import time
import OpenSSL

def create_CA(capath):
    key = OpenSSL.crypto.PKey()
    key.generate_key(OpenSSL.crypto.TYPE_RSA, 2048)
    ca = OpenSSL.crypto.X509()
    ca.set_serial_number(0)
    ca.set_version(2)
    subj = ca.get_subject()
    subj.countryName = 'CN'
    subj.organizationName = 'ProxHTTPSProxy'
    subj.organizationalUnitName = 'pyOpenSSL'
    subj.commonName = 'ProxHTTPSProxy CA'
    ca.gmtime_adj_notBefore(0)
    ca.gmtime_adj_notAfter(24 * 60 * 60 * 3652)
    ca.set_issuer(ca.get_subject())
    ca.set_pubkey(key)
    ca.add_extensions(
        [OpenSSL.crypto.X509Extension(b"basicConstraints", True, b"CA:TRUE"),
         # mozilla::pkix doesn't handle the Netscape Cert Type extension (which is problematic when it's marked critical)
         # https://bugzilla.mozilla.org/show_bug.cgi?id=1009161
         OpenSSL.crypto.X509Extension(b"nsCertType", False, b"sslCA"),
         OpenSSL.crypto.X509Extension(b"extendedKeyUsage", True, b"serverAuth,clientAuth,emailProtection,timeStamping,msCodeInd,msCodeCom,msCTLSign,msSGC,msEFS,nsSGC"),
         OpenSSL.crypto.X509Extension(b"keyUsage", False, b"keyCertSign, cRLSign"),
         OpenSSL.crypto.X509Extension(b"subjectKeyIdentifier", False, b"hash", subject=ca)])
    ca.sign(key, 'sha1')
    with open(capath, 'wb') as fp:
        fp.write(OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, ca))
        fp.write(OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, key))

def get_cert(name, cafile=CA, certdir=CERTDIR):
    """Return cert file path. Create it if it doesn't exist.

    cafile: the CA file to create dummpy cert files
    certdir: the path where cert files are looked for or created
    """
    certfile = os.path.join(certdir, name + '.crt')
    if not os.path.exists(certfile):
        dummy_cert(cafile, certfile, name)
    return certfile

def dummy_cert(cafile, certfile, commonname):
    """Generates and writes a certificate to certfile
    commonname: Common name for the generated certificate
    Ref: https://github.com/mitmproxy/netlib/blob/master/netlib/certutils.py
    """
    if certfile in workingList:
        # Another thread is working on it, wait until it finish
        while True:
            time.sleep(0.2)
            if certfile not in workingList: break
    else:
        workingList.add(certfile)
        with open(cafile, "rb") as file:
            content = file.read()
            ca = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, content)
            key = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, content)
        cert = OpenSSL.crypto.X509()
        cert.gmtime_adj_notBefore(0)
        cert.gmtime_adj_notAfter(60 * 60 * 24 * 3652)
        cert.set_issuer(ca.get_subject())
        cert.get_subject().CN = '*' + commonname if commonname.startswith('.') else commonname
        cert.set_serial_number(int(time.time()*10000))
        cert.set_pubkey(ca.get_pubkey())
        cert.sign(key, "sha1")
        with open(certfile, 'wb') as fp:
            fp.write(OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, cert))
            fp.write(OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, key))
        workingList.remove(certfile)

def startup_check():
    if not os.path.exists(CERTDIR):
        os.mkdir(CERTDIR)
        if not os.path.exists(CERTDIR):
            print("%s directory does not exist!")
            print("Please create it and restart the program!")
            input()
            raise SystemExit

    if not os.path.exists(CA):
        print("Creating CA ...")
        create_CA(CA)
        if not os.path.exists(CA):
            print("Failed to create CA :(")
        else:
            print("* Please import created %s to your client's store of trusted certificate authorities." % CA)
            print("* Please delete all files under %s directory!" % CERTDIR)
            print("* Then restart the program!")
        input()
        raise SystemExit

startup_check()

if __name__ == "__main__":
    print("All Good!")


text:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AjRools.Expert.Tests
{
    [TestClass]
    public class ContextTests
    {
        private Context context;

        [TestInitialize]
        public void Setup()
        {
            this.context = new Context();
        }

        [TestMethod]
        public void GetUndefinedValueAsNull()
        {
            Assert.IsNull(this.context.GetValue("Foo"));
        }

        [TestMethod]
        public void SetAndGetValue()
        {
            this.context.SetValue("One", 1);
            Assert.AreEqual(1, this.context.GetValue("One"));
        }
    }
}


text:
'use strict';

const {
    BaseConfigurationOptimizer,
} = require('./resol-vbus');

const expect = require('./expect');
const _ = require('./lodash');

let TestConfigurationOptimizer = undefined;

describe('BaseConfigurationOptimizer', () => {

    describe('constructor', () => {

        it('should be a constructor', () => {
            expect(BaseConfigurationOptimizer).a('function');
        });

    });

    describe('#completeConfiguration', () => {

        it('should be a method', () => {
            expect(BaseConfigurationOptimizer.prototype).property('completeConfiguration').a('function');
        });

    });

    describe('#optimizeLoadConfiguration', () => {

        it('should be a method', () => {
            expect(BaseConfigurationOptimizer.prototype).property('optimizeLoadConfiguration').a('function');
        });

    });

    describe('#optimizeSaveConfiguration', () => {

        it('should be a method', () => {
            expect(BaseConfigurationOptimizer.prototype).property('optimizeSaveConfiguration').a('function');
        });

    });

    describe('_getAdjustableValues', () => {

        it('should be a method', () => {
            expect(BaseConfigurationOptimizer.prototype).property('_getAdjustableValues').a('function');
        });

        it('should work correctly', () => {
            const optimizer = new TestConfigurationOptimizer();

            const values = optimizer._getAdjustableValues();

            const ids = _.map(values, 'id');

            expect(ids).eql([
                'LowestPriorityValue',
                'StructSubValue',
                'PrefsValue',
                'CompoundPrefsValue',
                'BooleanValue',
                'ValueTextsValue',
                'KnownOptionValue',
                'DependsOnKnownOptionValue',
                'UnknownOptionValue',
                'DependsOnUnknownOptionValue',
                'TestValue1',
                'TestValue2',
                'TestValue3',
                'TestValue4',
                'TestValue5',
                'TestValue6',
                'TestValue7',
                'TestValue8',
                'TestValueA',
                'TestValueB',
                'TestValueC',
                'HighestPriorityValue',
            ]);

            let value = _.find(values, { id: 'BooleanValue' });
            expect(value).property('valueTextById').eql({
                False: 0,
                True: 1,
            });

            value = _.find(values, { id: 'ValueTextsValue' });
            expect(value).property('valueTextById').eql({
                FourtyTwo: 42,
            });
        });
    });

    describe('_optimizeConfiguration', () => {

        it('should be a method', () => {
            expect(BaseConfigurationOptimizer.prototype).property('_optimizeConfiguration').a('function');
        });

        it('should work correctly', () => {
            const optimizer = new TestConfigurationOptimizer();

            let values = optimizer._getAdjustableValues();

            const config = _.map(values, (value) => {
                const configValue = {
                    valueId: value.id,
                    valueIndex: value.index,
                    priority: value.priority,
                    valueTextById: value.valueTextById,
                };

                return configValue;
            });

            let value = _.find(config, { valueId: 'PrefsValue' });
            value.value = 1;
            value.previousValue = 0;

            value = _.find(config, { valueId: 'KnownOptionValue' });
            value.value = 1;

            optimizer.optimizeConfiguration = function($) {
                let values = $('^PrefsValue$');
                expect(values.length).equal(1);

                values = $(/^PrefsValue$/);
                expect(values.length).equal(1);

                values = $(/PrefsValue$/);
                expect(values.length).equal(2);

                values = values.$('^C');
                expect(values.length).equal(1);

                expect(() => {
                    values = values.$('NotHere');
                }).throw(Error, 'WARNING: No values matching /NotHere/i found');
            };

            values = optimizer._optimizeConfiguration(config, values);

            const ids = _.reduce(values, (memo, value) => {
                if (value.ignored) {
                    memo.push(value.valueId);
                }
                return memo;
            }, []);

            expect(ids).eql([
                'DependsOnUnknownOptionValue',
            ]);

            value = _.find(values, { valueId: 'BooleanValue' });

            expect(value.valueTextById).eql({
                False: 0,
                True: 1,
            });

            // expect(values).eql([1]);
        });

    });

});

describe('ValuesWrapper', () => {

    const testValuesWrapper = function(optimize) {
        const optimizer = new TestConfigurationOptimizer();

        let values = optimizer._getAdjustableValues();

        const config = _.map(values, (value) => {
            const configValue = {
                valueId: value.id,
                valueIndex: value.index,
                priority: value.priority,
                valueTextById: value.valueTextById,
            };

            return configValue;
        });

        optimizer.optimizeConfiguration = function($) {
            const allValues = $(/.*/);

            const setValue = function(id, value) {
                const configValue = _.find(allValues.values, { valueId: id });
                configValue.value = value;
                configValue.changed = true;
            };

            return optimize($, setValue);
        };

        values = optimizer._optimizeConfiguration(config, values);

        return values;
    };

    describe('#_check', () => {

        it('should be a function', () => {
            testValuesWrapper(($, setValue) => {
                const values = $(/^TestValue[1-5]$/);

                expect(values._check).a('function');
            });
        });

        it('should work correctly for ignored values', () => {
            testValuesWrapper(($, setValue) => {
                const values = $(/^TestValue1$/);

                values.values [0].ignored = true;

                const checker = sinon.spy((value) => {
                    return true;
                });

                const action = sinon.spy();

                const actionWrapper = function(value) {
                    return action.apply(this, arguments);
                };

                const result = values._check(actionWrapper, checker);

                expect(result).equal(values);

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(0);
            });
        });

        it('should work correctly for undefined values', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);

                const values = $(/^TestValue1$/);

                const checker = sinon.spy((value) => {
                    return false;
                });

                const action = sinon.spy();

                const actionWrapper = function(value) {
                    return action.apply(this, arguments);
                };

                values._check(actionWrapper, checker);

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(1);
                expect(action.getCall(0).args [0].md [0]).equal('TestValue1');

                checker.resetHistory();
                action.resetHistory();

                values._check(actionWrapper, checker, {
                    includeUndefined: false,
                });

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(0);
            });
        });

        it('should work correctly for failed values', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', null);

                const values = $(/^TestValue1$/);

                const checker = sinon.spy((value) => {
                    return false;
                });

                const action = sinon.spy();

                const actionWrapper = function(value) {
                    return action.apply(this, arguments);
                };

                values._check(actionWrapper, checker);

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(1);
                expect(action.getCall(0).args [0].md [0]).equal('TestValue1');

                checker.resetHistory();
                action.resetHistory();

                values._check(actionWrapper, checker, {
                    includeFailed: false,
                });

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(0);
            });
        });

        it('should work correctly for checker approved values', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', 7353);
                setValue('TestValue2', 1337);

                const values = $(/^TestValue[1-2]$/);

                const checker = sinon.spy((value) => {
                    return (value === 1337);
                });

                const action = sinon.spy();

                const actionWrapper = function(value) {
                    return action.apply(this, arguments);
                };

                values._check(actionWrapper, checker);

                expect(checker.callCount).equal(2);
                expect(checker.getCall(0).args [0]).equal(7353);
                expect(checker.getCall(1).args [0]).equal(1337);

                expect(action.callCount).equal(1);
                expect(action.getCall(0).args [0].md [0]).equal('TestValue2');
            });
        });

        it('should work correctly with argument-less action callback', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);

                const values = $(/^TestValue1$/);

                const checker = sinon.spy((value) => {
                    return false;
                });

                const action = sinon.spy();

                const actionWrapper = function() {
                    return action.apply(this, arguments);
                };

                values._check(actionWrapper, checker);

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(1);
                expect(action.getCall(0).args [0]).equal(undefined);
            });
        });

        it('should work correctly with argument-having action callback', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);

                const values = $(/^TestValue(1)$/);

                const checker = sinon.spy((value) => {
                    return false;
                });

                const action = sinon.spy();

                const actionWrapper = function(value) {
                    return action.apply(this, arguments);
                };

                values._check(actionWrapper, checker);

                expect(checker.callCount).equal(0);

                expect(action.callCount).equal(1);
                expect(action.getCall(0).args [0]).an('object');
                expect(action.getCall(0).args [0].md).an('array');
                expect(action.getCall(0).args [0].md [0]).equal('TestValue1');
                expect(action.getCall(0).args [0].md [1]).equal('1');
            });
        });

    });

    describe('#check', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                const values = $(/^TestValue1$/);

                const checker = 'CHECKER';
                const action = 'ACTION';
                const options = 'OPTIONS';

                values._check = sinon.spy();

                values.check(checker, action, options);

                expect(values._check.callCount).equal(1);
                expect(values._check.getCall(0).args [0]).equal(action);
                expect(values._check.getCall(0).args [1]).equal(checker);
                expect(values._check.getCall(0).args [2]).equal(options);
            });
        });

    });

    describe('#forEach', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                let count = 0;

                $(/^TestValue[\d]$/).forEach(() => {
                    count++;
                });

                expect(count).equal(8);
            });
        });

    });

    describe('#isFalse', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).isFalse((value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                ]);
            });
        });

    });

    describe('#isTrue', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).isTrue((value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue4',
                ]);
            });
        });

    });

    describe('#eql', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).eql(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue4',
                ]);
            });
        });

        it('should work correctly for valid strings', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).eql('#False', (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                ]);
            });
        });

        it('should work correctly for invalid strings', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).eql('#Unknown', (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(2).eql([
                    'TestValue1',
                    'TestValue2',
                ]);
            });
        });

    });

    describe('#notEql', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).notEql(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                ]);
            });
        });

        it('should work correctly for valid strings', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).notEql('#False', (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue4',
                ]);
            });
        });

        it('should work correctly for invalid strings', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);

                const valueIds = [];

                $(/^TestValue[1-4]$/).notEql('#Unknown', (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(4).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                    'TestValue4',
                ]);
            });
        });

    });

    describe('#lt', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);

                const valueIds = [];

                $(/^TestValue[1-5]$/).lt(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                ]);
            });
        });

    });

    describe('#lte', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);

                const valueIds = [];

                $(/^TestValue[1-5]$/).lte(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(4).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                    'TestValue4',
                ]);
            });
        });

    });

    describe('#gt', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);

                const valueIds = [];

                $(/^TestValue[1-5]$/).gt(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(3).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue5',
                ]);
            });
        });

    });

    describe('#gte', () => {

        it('should work correctly for numbers', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);

                const valueIds = [];

                $(/^TestValue[1-5]$/).gte(1, (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(4).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue4',
                    'TestValue5',
                ]);
            });
        });

    });

    describe('#in', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);
                setValue('TestValue6', 3);

                const valueIds = [];

                $(/^TestValue[1-6]$/).in([ '#True', 3, 4, 5 ], (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(4).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue4',
                    'TestValue6',
                ]);
            });
        });

    });

    describe('#notIn', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);
                setValue('TestValue4', 1);
                setValue('TestValue5', 2);
                setValue('TestValue6', 3);

                const valueIds = [];

                $(/^TestValue[1-6]$/).notIn([ '#True', 3, 4, 5 ], (value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(4).eql([
                    'TestValue1',
                    'TestValue2',
                    'TestValue3',
                    'TestValue5',
                ]);
            });
        });

    });

    describe('#isChanged', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);

                const valueIds = [];

                $(/^TestValue[1-3]$/).isChanged((value) => {
                    valueIds.push(value.md [0]);
                });

                expect(valueIds).lengthOf(1).eql([
                    'TestValue3',
                ]);
            });
        });

    });

    describe('#ignore', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);

                const values = $(/^TestValue[1-3]$/);

                _.forEach(values.values, (value) => {
                    expect(value.ignored).equal(false);
                });

                const result = values.ignore();

                expect(result).equal(values);

                _.forEach(values.values, (value) => {
                    expect(value.ignored).equal(true);
                });
            });
        });

    });

    describe('#invalidate', () => {

        it('should work correctly', () => {
            testValuesWrapper(($, setValue) => {
                setValue('TestValue1', undefined);
                setValue('TestValue2', null);
                setValue('TestValue3', 0);

                const values = $(/^TestValue[1-3]$/);

                _.forEach(values.values, (value) => {
                    expect(value.invalidated).equal(false);
                });

                const result = values.invalidate();

                expect(result).equal(values);

                _.forEach(values.values, (value) => {
                    expect(value.invalidated).equal(true);
                });
            });
        });

    });

});

TestConfigurationOptimizer  = BaseConfigurationOptimizer.extend({

}, {

    configurationData: {

        types: [{
            id: 'Boolean',
            valueTexts: [{
                id: 'False',
            }, {
                id: 'True',
            }]
        }],

        values: [{
            id: 'LowestPriorityValue',
            priority: -20,
        }, {
            id: 'AbstractValue',
            storage: 'abstract',
        }, {
            id: 'StructValue',
            storage: 'struct',
        }, {
            id: 'StructSubValue',
            structValueRef: 'StructValue',
        }, {
            id: 'VolatileValue',
            storage: 'volatile',
        }, {
            id: 'PrefsValue',
        }, {
            id: 'PersistentValue',
            storage: 'persistent',
        }, {
            id: 'CompoundPrefsValue',
            storage: 'abstract',
        }, {
            id: 'CompoundPrefsSubValue1',
            compoundValueRef: 'CompoundPrefsValue',
        }, {
            id: 'CompoundVolatileValue',
            storage: 'abstract',
        }, {
            id: 'CompoundVolatileSubValue1',
            storage: 'volatile',
            compoundValueRef: 'CompoundValue',
        }, {
            id: 'BooleanValue',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'ValueTextsValue',
            type: {
                valueTexts: [{
                    id: 'FourtyTwo',
                    value: 42,
                }],
            },
        }, {
            id: 'KnownOptionValue',
        }, {
            id: 'DependsOnKnownOptionValue',
            type: {
                selectorValueRef: 'KnownOptionValue',
            },
        }, {
            id: 'UnknownOptionValue',
        }, {
            id: 'DependsOnUnknownOptionValue',
            type: {
                selectorValueRef: 'UnknownOptionValue',
            },
        }, {
            id: 'TestValue1',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue2',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue3',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue4',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue5',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue6',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue7',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValue8',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValueA',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValueB',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'TestValueC',
            type: {
                base: 'Boolean',
            },
        }, {
            id: 'HighestPriorityValue',
            priority: 20,
        }]

    }

});