text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic;
using System.Linq.Expressions;
using System.Net;
using System.Web.Mvc;
using BoC.Persistence;
using BoC.Services;
using BoC.Validation;
using BoC.Web.Mvc.Validation;

namespace BoC.Web.Mvc.Controllers
{
    public class DynamicScaffoldController<TEntity> : Controller where TEntity : IBaseEntity, new()
    {
        private readonly IModelService<TEntity> service;

        public DynamicScaffoldController(IModelService<TEntity> service)
        {
            this.service = service;
        }

        static Dictionary<String, bool> propCache = new Dictionary<string, bool>();
        private string getQuery(string propName, int propNum)
        {
            if (string.IsNullOrEmpty(propName))
                return null;

            string prop = propName;
            if (prop.Contains("."))
            {
                prop = prop.Substring(0, prop.IndexOf("."));
            }

            if (!propCache.ContainsKey(prop.ToLower()))
            {
                var propertyInfo = typeof(TEntity).GetProperty(prop);
                if (propertyInfo != null)
                {
                    var attrib = propertyInfo.GetCustomAttributes(typeof(ScaffoldColumnAttribute), true);
                    var scaffold = true;
                    if (attrib != null && attrib.Length > 0)
                    {
                        scaffold = ((ScaffoldColumnAttribute)attrib[0]).Scaffold;
                    }
                    propCache.Add(prop.ToLower(), scaffold);
                }
                else
                {
                    propCache.Add(prop.ToLower(), false);
                }
            }

            if (propCache[prop.ToLower()])
            {
                return propName + " == @" + propNum;
            }

            return null;
        }
        protected virtual ModelQuery<TEntity> EntitiesQuery
        {
            get
            {
                string query = null;
                List<object> values = new List<object>();
                int propNum = 0;
                foreach (string name in Request.QueryString)
                {
                    if (!String.IsNullOrEmpty(Request.QueryString[name]))
                    {
                        string newQuery = getQuery(name, propNum);
                        if (!String.IsNullOrEmpty(newQuery))
                        {
                            query = " && " + newQuery;
                            values.Add(RouteData.Values[name]);
                            propNum++;
                        }
                    }
                }

                foreach (string name in RouteData.Values.Keys)
                {
                    if (RouteData.Values[name] != null && RouteData.Values[name] != "")
                    {
                        string newQuery = getQuery(name, propNum);
                        if (!String.IsNullOrEmpty(newQuery))
                        {
                            query = " && " + newQuery;
                            values.Add(RouteData.Values[name]);
                            propNum++;
                        }
                    }
                }
                if (!String.IsNullOrEmpty(query))
                {
                    query = query.Substring(4);
                    return new ModelQuery<TEntity>() { Expression = DynamicExpressionParser.ParseLambda<TEntity, bool>(query, values.ToArray()) };
                }
                return null;
            }
        }

        [AcceptVerbs(HttpVerbs.Post | HttpVerbs.Delete)]
        public virtual ActionResult Delete(TEntity entity, string returnTo)
        {
            if (entity == null)
            {
                return this.HttpStatus(HttpStatusCode.NotFound);
            }

            return OnDelete(entity, returnTo);
        }

        private ActionResult HttpStatus(HttpStatusCode status)
        {
            return new HttpStatusCodeResult((HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), status.ToString()));
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public virtual ActionResult Edit(TEntity entity)
        {
            if (entity == null)
            {
                return this.HttpStatus(HttpStatusCode.NotFound);
            }

            return OnEdit(entity);
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public virtual ActionResult Update(TEntity entity)
        {
            if (entity == null)
            {
                return this.HttpStatus(HttpStatusCode.NotFound);
            }
            return OnUpdate(entity);
        }

        public virtual ActionResult List(string sort, int? show, int? page)
        {
            var query = EntitiesQuery;

            if (sort != null)
            {
                if (sort.StartsWith("-"))
                {
                    query.OrderBy(sort.Substring(1) + " desc");
                }
                else
                {
                    query.OrderBy(sort);
                }
            }
            if (show != null)
            {
                query.Take(show.Value);
            }
            if (page != null)
            {
                query.Skip(page.Value*query.ItemsToTake);
            }

            return OnList(service.Find(query), sort);
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public virtual ActionResult New()
        {
            return OnNew(new TEntity());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public virtual ActionResult New(TEntity entity)
        {
            return OnInsert(entity);
        }

        public virtual ActionResult Show(TEntity entity)
        {
            if (entity == null)
            {
                return this.HttpStatus(HttpStatusCode.NotFound);
            }

            return OnShow(entity);
        }

        // Overrides for performing the specific actions for the controller

        protected virtual ActionResult OnDelete(TEntity entity, string returnTo)
        {
            service.Delete(entity);
            if (String.IsNullOrEmpty(returnTo))
            {
                return RedirectToAction("list");
            }
            return Redirect(returnTo);
        }

        protected virtual ActionResult OnEdit(TEntity entity)
        {
            return View("PageTemplates/Edit", entity);
        }

        protected virtual ActionResult OnInsert(TEntity entity)
        {
            if (!ViewData.ModelState.IsValid) //input validation errors (eg cannot convert to int)
            {
                return OnNew(entity);
            }

            try
            {
                service.Insert(entity);
            }
            catch (RulesException rules)
            {
                rules.AddModelStateErrors(ViewData.ModelState);
            }
            catch (Exception exc)
            {
                ViewData.ModelState.AddModelError("_FORM", exc);
            }

            if (!ViewData.ModelState.IsValid) //entity validation errors
            {
                return OnNew(entity);
            }

            return this.RedirectToAction("List");
        }

        protected virtual ActionResult OnList(IEnumerable<TEntity> entities, string sort)
        {
            ViewData["sort"] = sort;
            return View("PageTemplates/List", entities);
        }

        protected virtual ViewResult OnNew(TEntity entity)
        {
            return View("PageTemplates/New", entity);
        }

        protected virtual ActionResult OnShow(TEntity entity)
        {
            return View("PageTemplates/Show", entity);
        }

        protected virtual ActionResult OnUpdate(TEntity entity)
        {
            if (!ViewData.ModelState.IsValid) //input validation errors (eg cannot convert to int)
            {
                return OnEdit(entity);
            }

            service.SaveOrUpdate(entity);

            if (!ViewData.ModelState.IsValid)
            {
                return OnEdit(entity);
            }

            return this.RedirectToAction("List");
        }
    }
}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace VkApi.Wrapper.Objects
{
    public class GroupsGroupBanInfo
    {
        ///
        /// Ban comment
        ///
        [JsonProperty("comment")]
        public String Comment { get; set; }

        ///
        /// End date of ban in Unixtime
        ///
        [JsonProperty("end_date")]
        public int EndDate { get; set; }
        [JsonProperty("reason")]
        public GroupsBanInfoReason Reason { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<resources>
    <string name="app_name">O-snap</string>

    <string name="dummy_button">Dummy Button</string>
    <string name="dummy_content">DUMMY\nCONTENT</string>
</resources>


text:
CREATE SCHEMA [PowerBI]
AUTHORIZATION [dbo]
GO
EXEC sp_addextendedproperty N'Description', N'Views and stored procedures that provide the only access for the Power BI dashboard system', 'SCHEMA', N'PowerBI', NULL, NULL, NULL, NULL
GO


text:
<!doctype html>

    <link rel="stylesheet" href="style.css">

title 1 floated right

        Lorem ipsum dolor sit amet, consectetur adipiscing
        elit. Curabitur porta nulla nec volutpat
        iaculis. Vivamus sed tellus sed tortor ultrices
        posuere. Praesent porta, felis at congue tincidunt,
        eros dui hendrerit massa, vitae tincidunt enim diam
        a diam. Vivamus ultrices nibh dolor, et accumsan
        nisl tincidunt et. Mauris ornare tellus quis enim
        gravida, id tempor augue porta. Nunc ultrices felis
        rhoncus vulputate egestas. Etiam nisi magna,
        bibendum ut facilisis ornare, suscipit a
        risus. Maecenas semper lacinia arcu, eu convallis
        turpis. Etiam pharetra elementum gravida. In vitae
        aliquet odio, non ultricies risus. Quisque ut urna
        sit amet velit pharetra vestibulum et sed tellus.

title 2

        Lorem ipsum dolor sit amet, consectetur adipiscing
        elit. Curabitur porta nulla nec volutpat
        iaculis. Vivamus sed tellus sed tortor ultrices
        posuere. Praesent porta, felis at congue tincidunt,
        eros dui hendrerit massa, vitae tincidunt enim diam
        a diam. Vivamus ultrices nibh dolor, et accumsan
        nisl tincidunt et. Mauris ornare tellus quis enim
        gravida, id tempor augue porta. Nunc ultrices felis
        rhoncus vulputate egestas. Etiam nisi magna,
        bibendum ut facilisis ornare, suscipit a
        risus. Maecenas semper lacinia arcu, eu convallis
        turpis. Etiam pharetra elementum gravida. In vitae
        aliquet odio, non ultricies risus. Quisque ut urna
        sit amet velit pharetra vestibulum et sed tellus.

        Lorem ipsum dolor sit amet, consectetur adipiscing
        elit. Curabitur porta nulla nec volutpat
        iaculis. Vivamus sed tellus sed tortor ultrices
        posuere. Praesent porta, felis at congue tincidunt,
        eros dui hendrerit massa, vitae tincidunt enim diam
        a diam. Vivamus ultrices nibh dolor, et accumsan
        nisl tincidunt et. Mauris ornare tellus quis enim
        gravida, id tempor augue porta. Nunc ultrices felis
        rhoncus vulputate egestas. Etiam nisi magna,
        bibendum ut facilisis ornare, suscipit a
        risus. Maecenas semper lacinia arcu, eu convallis
        turpis. Etiam pharetra elementum gravida. In vitae
        aliquet odio, non ultricies risus. Quisque ut urna
        sit amet velit pharetra vestibulum et sed tellus.

title 3

        content 3


text:
// $OpenLDAP$

#include <iostream>
#include <sstream>
#include "LDAPConnection.h"
#include "LDAPConstraints.h"
#include "LDAPSearchReference.h"
#include "LDAPSearchResults.h"
#include "LDAPAttribute.h"
#include "LDAPAttributeList.h"
#include "LDAPEntry.h"
#include "LDAPException.h"
#include "LDAPModification.h"

#include "debug.h"

int main(){
    LDAPConstraints* cons=new LDAPConstraints;
    LDAPControlSet* ctrls=new LDAPControlSet;
    ctrls->add(LDAPCtrl(LDAP_CONTROL_MANAGEDSAIT));
    cons->setServerControls(ctrls);
    LDAPConnection *lc=new LDAPConnection("localhost",9009);
    lc->setConstraints(cons);
    std::cout << "----------------------doing bind...." << std::endl;
    try{
        lc->bind("cn=Manager,o=Organisation,c=DE" , "secret",cons);
        std::cout << lc->getHost() << std::endl;
        bool result = lc->compare("cn=Manager,o=Organisation,c=DE",
                LDAPAttribute("cn","Manaer"));
        std::cout << "Compare: " << result << std::endl;

        LDAPAttributeList* attrs=new LDAPAttributeList();
        StringList values;
        StringList s2;
        values.add("top");
        values.add("Person");
        attrs->addAttribute(LDAPAttribute("objectClass",values));
        attrs->addAttribute(LDAPAttribute("cn","Peter"));
        attrs->addAttribute(LDAPAttribute("sn","Peter,hallo"));
        LDAPEntry* entry=new LDAPEntry(
                "cn=Peter , o=Organisation, c=DE", attrs);
//        lc->add(entry);

//        lc->del("ou=Groups,o=Organisation,c=DE");

        LDAPSearchResults* entries = lc->search("o=Organisation,c=DE",
                LDAPConnection::SEARCH_ONE);
        if (entries != 0){
            LDAPEntry* entry = entries->getNext();
            if(entry != 0){
                std::cout << *(entry) << std::endl;
            }
            while(entry){
                try{
                    entry = entries->getNext();
                    if(entry != 0){
                        std::cout << *(entry) << std::endl;
                    }
                    delete entry;
                }catch(LDAPReferralException e){
                    std::cout << "Caught Referral" << std::endl;
                }
            }
        }

        lc->unbind();
        delete lc;
   }catch (LDAPException &e){
        std::cout << "-------------- caught Exception ---------"<< std::endl;
        std::cout << e << std::endl;
    }

    /*
    std::cout << "--------------------starting search" << std::endl;
    LDAPAttributeList* attrs=new LDAPAttributeList();
    StringList values;
    values.add("top");
    values.add("organizationalUnit");
    attrs->addAttribute(LDAPAttribute("objectClass",values));
    attrs->addAttribute(LDAPAttribute("ou","Groups"));
    LDAPEntry* entry=new LDAPEntry(
            "ou=Groups, o=Organisation, c=DE", attrs);

    LDAPAttribute newattr("description");
    LDAPModification::mod_op op = LDAPModification::OP_DELETE;
    LDAPModList *mod=new LDAPModList();
    mod->addModification(LDAPModification(newattr,op));
    LDAPMessageQueue* q=0;
    try{
        q=lc->search("o=Organisation,c=de",LDAPAsynConnection::SEARCH_SUB,
         "objectClass=*",StringList());
//        q=lc->add(entry);
//        q=lc->modify("cn=Manager,o=Organisation,c=DE",
//                mod);
        LDAPMsg *res=q->getNext();
        bool cont=true;
        while( cont  ) {
            switch(res->getMessageType()){
                LDAPSearchResult *res2;
                const LDAPEntry *entry;
                case LDAP_RES_SEARCH_ENTRY :
                    res2= (LDAPSearchResult*)res;
                    entry=  res2->getEntry();
                    std::cout << "Entry:            " << *entry << std::endl;
                    delete res;
                    res=q->getNext();
                break;
                case LDAP_RES_SEARCH_REFERENCE :
                    std::cout << "Reference:         "  << std::endl;
                    delete res;
                    res=q->getNext();
                break;
                default :
                    std::cout << ( *(LDAPResult*) res) << std::endl;
                    delete res;
                    std::cout  << "-----------------search done" << std::endl;
                    cont=false;
                break;
            }
        }
        delete q;
    }catch (LDAPException e){
        std::cout << "----------------error during search" << std::endl;
        delete q;
        std::cout << e << std::endl;
    }
    lc->unbind();
    */
}


text:
var common = require('./common');
var fs = require('fs');
var path = require('path');

// XP's system default value for PATHEXT system variable, just in case it's not
// set on Windows.
var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh';

// Cross-platform method for splitting environment PATH variables
function splitPath(p) {
  if (!p)
    return [];

  if (common.platform === 'win')
    return p.split(';');
  else
    return p.split(':');
}

function checkPath(path) {
  return fs.existsSync(path) && !fs.statSync(path).isDirectory();
}

//@
//@ ### which(command)
//@
//@ Examples:
//@
//@ ```javascript
//@ var nodeExec = which('node');
//@ ```
//@
//@ Searches for `command` in the system's PATH. On Windows, this uses the
//@ `PATHEXT` variable to append the extension if it's not already executable.
//@ Returns string containing the absolute path to the command.
function _which(options, cmd) {
  if (!cmd)
    common.error('must specify command');

  var pathEnv = process.env.path || process.env.Path || process.env.PATH,
      pathArray = splitPath(pathEnv),
      where = null;

  // No relative/absolute paths provided?
  if (cmd.search(/\//) === -1) {
    // Search for command in PATH
    pathArray.forEach(function(dir) {
      if (where)
        return; // already found it

      var attempt = path.resolve(dir, cmd);

      if (common.platform === 'win') {
        attempt = attempt.toUpperCase();

        // In case the PATHEXT variable is somehow not set (e.g.
        // child_process.spawn with an empty environment), use the XP default.
        var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
        var pathExtArray = splitPath(pathExtEnv.toUpperCase());
        var i;

        // If the extension is already in PATHEXT, just return that.
        for (i = 0; i < pathExtArray.length; i++) {
          var ext = pathExtArray[i];
          if (attempt.slice(-ext.length) === ext && checkPath(attempt)) {
            where = attempt;
            return;
          }
        }

        // Cycle through the PATHEXT variable
        var baseAttempt = attempt;
        for (i = 0; i < pathExtArray.length; i++) {
          attempt = baseAttempt + pathExtArray[i];
          if (checkPath(attempt)) {
            where = attempt;
            return;
          }
        }
      } else {
        // Assume it's Unix-like
        if (checkPath(attempt)) {
          where = attempt;

        }
      }
    });
  }

  // Command not found anywhere?
  if (!checkPath(cmd) && !where)
    return null;

  where = where || path.resolve(cmd);

  return common.ShellString(where);
}
module.exports = _which;


text:
<?php
/**
 * [RO] Listeaza toate conturile de curieri (https://github.com/celdotro/marketplace/wiki/Listeaza-conturile-de-curieri)
 * [EN] Lists all couriers accounts (https://github.com/celdotro/marketplace/wiki/List-courier-accounts)
 */
include __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'api_include.php';

use celmarket\Admin\AdminCouriers;

#0#
#FUNCTION#
function getAccounts(){
    $object = new AdminCouriers();

    try{
        $response = $object->getAccounts();
        print_r($response);
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}

#EXAMPLE#
getAccounts();


text:
using System;
using System.IO;
using System.Runtime.Serialization;
using ZTn.BNet.D3.Helpers;

namespace ZTn.BNet.D3.Artisans
{
    [DataContract]
    public class Artisan : D3Object
    {
        #region >> Fields

        [DataMember(Name = "slug")]
        public String Slug;

        [DataMember(Name = "level")]
        public int Level;

        [DataMember(Name = "stepCurrent")]
        public int StepCurrent;

        [DataMember(Name = "stepMax")]
        public int StepMax;

        #endregion

        public static Artisan CreateFromSlug(String slug)
        {
            return D3Api.GetArtisanFromSlug(slug);
        }

        public static Artisan CreateFromJSonStream(Stream stream)
        {
            return stream.CreateFromJsonStream<Artisan>();
        }

        public static Artisan CreateFromJSonString(String json)
        {
            return json.CreateFromJsonString<Artisan>();
        }

        #region >> Object

        /// <inheritdoc />
        public override string ToString()
        {
            return "[" + Slug + "]";
        }

        #endregion
    }
}


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [@cucumber/cucumber](./cucumber.md) > [IRunConfiguration](./cucumber.irunconfiguration.md) > [formats](./cucumber.irunconfiguration.formats.md)

## IRunConfiguration.formats property

<b>Signature:</b>

```typescript
formats: IRunOptionsFormats;
```


text:
class CefAppCToCpp
    : public CefCToCpp<CefAppCToCpp, CefApp, cef_app_t> {
 public:
  explicit CefAppCToCpp(cef_app_t* str)
      : CefCToCpp<CefAppCToCpp, CefApp, cef_app_t>(str) {}
  virtual ~CefAppCToCpp() {}

  // CefApp methods
  virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
      CefRefPtr<CefCommandLine> command_line) OVERRIDE;
  virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE;
  virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler(
      ) OVERRIDE;
  virtual CefRefPtr<CefProxyHandler> GetProxyHandler() OVERRIDE;
};

#endif  // BUILDING_CEF_SHARED
#endif  // CEF_LIBCEF_DLL_CTOCPP_APP_CTOCPP_H_


text:
<?php

namespace Drupal\Tests\system\Functional\Update;

use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\system\Entity\Action;

/**
 * Tests upgrading comment and node actions to generic entity ones.
 *
 * @group Update
 */
class UpdateActionsWithEntityPluginsTest extends UpdatePathTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [__DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz'];
  }

  /**
   * Tests upgrading comment and node actions to generic entity ones.
   *
   * @see system_post_update_change_action_plugins()
   */
  public function testUpdateActionsWithEntityPlugins() {
    $old_new_action_id_map = [
      'comment_publish_action' => ['comment_publish_action', 'entity:publish_action:comment'],
      'comment_unpublish_action' => ['comment_unpublish_action', 'entity:unpublish_action:comment'],
      'comment_save_action' => ['comment_save_action', 'entity:save_action:comment'],
      'node_publish_action' => ['node_publish_action', 'entity:publish_action:node'],
      'node_unpublish_action' => ['node_unpublish_action', 'entity:unpublish_action:node'],
      'node_save_action' => ['node_save_action', 'entity:save_action:node'],
    ];

    foreach ($old_new_action_id_map as $key => list($before, $after)) {
      $config = \Drupal::configFactory()->get('system.action.' . $key);
      $this->assertSame($before, $config->get('plugin'));
    }

    $this->runUpdates();

    foreach ($old_new_action_id_map as $key => list($before, $after)) {
      /** @var \Drupal\system\Entity\Action $action */
      $action = Action::load($key);
      $this->assertSame($after, $action->getPlugin()->getPluginId());
      $config = \Drupal::configFactory()->get('system.action.' . $key);
      $this->assertSame($after, $config->get('plugin'));

      // Check that the type the action is based on will be a module dependency.
      $this->assertArraySubset(['module' => [$action->getPluginDefinition()['type']]], $action->getDependencies());
    }
  }

}


text:
"""Compatibility module defining operations on duck numpy-arrays.

Currently, this means Dask or NumPy arrays. None of these functions should
accept or return xarray objects.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from functools import partial
import contextlib
import inspect
import warnings

import numpy as np
import pandas as pd

from . import npcompat
from . import dtypes
from .pycompat import dask_array_type
from .nputils import nanfirst, nanlast

try:
    import bottleneck as bn
    has_bottleneck = True
except ImportError:
    # use numpy methods instead
    bn = np
    has_bottleneck = False

try:
    import dask.array as da
    has_dask = True
except ImportError:
    has_dask = False

def _dask_or_eager_func(name, eager_module=np, list_of_args=False,
                        n_array_args=1):
    """Create a function that dispatches to dask for dask array inputs."""
    if has_dask:
        def f(*args, **kwargs):
            if list_of_args:
                dispatch_args = args[0]
            else:
                dispatch_args = args[:n_array_args]
            if any(isinstance(a, da.Array) for a in dispatch_args):
                module = da
            else:
                module = eager_module
            return getattr(module, name)(*args, **kwargs)
    else:
        def f(data, *args, **kwargs):
            return getattr(eager_module, name)(data, *args, **kwargs)
    return f

def fail_on_dask_array_input(values, msg=None, func_name=None):
    if isinstance(values, dask_array_type):
        if msg is None:
            msg = '%r is not yet a valid method on dask arrays'
        if func_name is None:
            func_name = inspect.stack()[1][3]
        raise NotImplementedError(msg % func_name)

around = _dask_or_eager_func('around')
isclose = _dask_or_eager_func('isclose')
notnull = _dask_or_eager_func('notnull', pd)
_isnull = _dask_or_eager_func('isnull', pd)

def isnull(data):
    # GH837, GH861
    # isnull fcn from pandas will throw TypeError when run on numpy structured
    # array therefore for dims that are np structured arrays we assume all
    # data is present
    try:
        return _isnull(data)
    except TypeError:
        return np.zeros(data.shape, dtype=bool)

transpose = _dask_or_eager_func('transpose')
where = _dask_or_eager_func('where', n_array_args=3)
insert = _dask_or_eager_func('insert')
take = _dask_or_eager_func('take')
broadcast_to = _dask_or_eager_func('broadcast_to')

concatenate = _dask_or_eager_func('concatenate', list_of_args=True)
stack = _dask_or_eager_func('stack', list_of_args=True)

array_all = _dask_or_eager_func('all')
array_any = _dask_or_eager_func('any')

tensordot = _dask_or_eager_func('tensordot', n_array_args=2)

def asarray(data):
    return data if isinstance(data, dask_array_type) else np.asarray(data)

def as_like_arrays(*data):
    if all(isinstance(d, dask_array_type) for d in data):
        return data
    else:
        return tuple(np.asarray(d) for d in data)

def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8):
    """Like np.allclose, but also allows values to be NaN in both arrays
    """
    arr1, arr2 = as_like_arrays(arr1, arr2)
    if arr1.shape != arr2.shape:
        return False
    return bool(
        isclose(arr1, arr2, rtol=rtol, atol=atol, equal_nan=True).all())

def array_equiv(arr1, arr2):
    """Like np.array_equal, but also allows values to be NaN in both arrays
    """
    arr1, arr2 = as_like_arrays(arr1, arr2)
    if arr1.shape != arr2.shape:
        return False

    flag_array = (arr1 == arr2)
    flag_array |= (isnull(arr1) & isnull(arr2))

    return bool(flag_array.all())

def array_notnull_equiv(arr1, arr2):
    """Like np.array_equal, but also allows values to be NaN in either or both
    arrays
    """
    arr1, arr2 = as_like_arrays(arr1, arr2)
    if arr1.shape != arr2.shape:
        return False

    flag_array = (arr1 == arr2)
    flag_array |= isnull(arr1)
    flag_array |= isnull(arr2)

    return bool(flag_array.all())

def count(data, axis=None):
    """Count the number of non-NA in this array along the given axis or axes
    """
    return sum(~isnull(data), axis=axis)

def where_method(data, cond, other=dtypes.NA):
    if other is dtypes.NA:
        other = dtypes.get_fill_value(data.dtype)
    return where(cond, data, other)

def fillna(data, other):
    return where(isnull(data), other, data)

@contextlib.contextmanager
def _ignore_warnings_if(condition):
    if condition:
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            yield
    else:
        yield

def _create_nan_agg_method(name, numeric_only=False, np_compat=False,
                           no_bottleneck=False, coerce_strings=False,
                           keep_dims=False):
    def f(values, axis=None, skipna=None, **kwargs):
        # ignore keyword args inserted by np.mean and other numpy aggregators
        # automatically:
        kwargs.pop('dtype', None)
        kwargs.pop('out', None)

        values = asarray(values)

        if coerce_strings and values.dtype.kind in 'SU':
            values = values.astype(object)

        if skipna or (skipna is None and values.dtype.kind in 'cf'):
            if values.dtype.kind not in ['u', 'i', 'f', 'c']:
                raise NotImplementedError(
                    'skipna=True not yet implemented for %s with dtype %s'
                    % (name, values.dtype))
            nanname = 'nan' + name
            if (isinstance(axis, tuple) or not values.dtype.isnative or
                    no_bottleneck):
                # bottleneck can't handle multiple axis arguments or non-native
                # endianness
                if np_compat:
                    eager_module = npcompat
                else:
                    eager_module = np
            else:
                eager_module = bn
            func = _dask_or_eager_func(nanname, eager_module)
            using_numpy_nan_func = (eager_module is np or
                                    eager_module is npcompat)
        else:
            func = _dask_or_eager_func(name)
            using_numpy_nan_func = False
        with _ignore_warnings_if(using_numpy_nan_func):
            try:
                return func(values, axis=axis, **kwargs)
            except AttributeError:
                if isinstance(values, dask_array_type):
                    msg = '%s is not yet implemented on dask arrays' % name
                else:
                    assert using_numpy_nan_func
                    msg = ('%s is not available with skipna=False with the '
                           'installed version of numpy; upgrade to numpy 1.12 '
                           'or newer to use skipna=True or skipna=None' % name)
                raise NotImplementedError(msg)
    f.numeric_only = numeric_only
    f.keep_dims = keep_dims
    f.__name__ = name
    return f

argmax = _create_nan_agg_method('argmax', coerce_strings=True)
argmin = _create_nan_agg_method('argmin', coerce_strings=True)
max = _create_nan_agg_method('max', coerce_strings=True)
min = _create_nan_agg_method('min', coerce_strings=True)
sum = _create_nan_agg_method('sum', numeric_only=True)
mean = _create_nan_agg_method('mean', numeric_only=True)
std = _create_nan_agg_method('std', numeric_only=True)
var = _create_nan_agg_method('var', numeric_only=True)
median = _create_nan_agg_method('median', numeric_only=True)
prod = _create_nan_agg_method('prod', numeric_only=True, no_bottleneck=True)
cumprod = _create_nan_agg_method('cumprod', numeric_only=True, np_compat=True,
                                 no_bottleneck=True, keep_dims=True)
cumsum = _create_nan_agg_method('cumsum', numeric_only=True, np_compat=True,
                                no_bottleneck=True, keep_dims=True)

_fail_on_dask_array_input_skipna = partial(
    fail_on_dask_array_input,
    msg='%r with skipna=True is not yet implemented on dask arrays')

def first(values, axis, skipna=None):
    """Return the first non-NA elements in this array along the given axis
    """
    if (skipna or skipna is None) and values.dtype.kind not in 'iSU':
        # only bother for dtypes that can hold NaN
        _fail_on_dask_array_input_skipna(values)
        return nanfirst(values, axis)
    return take(values, 0, axis=axis)

def last(values, axis, skipna=None):
    """Return the last non-NA elements in this array along the given axis
    """
    if (skipna or skipna is None) and values.dtype.kind not in 'iSU':
        # only bother for dtypes that can hold NaN
        _fail_on_dask_array_input_skipna(values)
        return nanlast(values, axis)
    return take(values, -1, axis=axis)


text:
// Imports
import OfferListController from './offer_list.controller';
import TabHeaderController from '../../layout/tab-header/tab-header.controller';
import UserRoles from '../../core/auth/constants/userRoles';
import { offers } from './offer_list.resolve';
import Tab from '../../entities/tab';

/**
 * @ngInject
 * @param RouterHelper
 */
export default function routing(RouterHelper) {
  const states = [{
    state: 'modules.offerList',
    config: {
      url: '/tarjoukset',
      title: 'Tarjoukset',
      data: {
        access: UserRoles.ROLE_ANON,
      },
      views: {
        'content@': {
          template: require('./offer_list.html'),
          controller: OfferListController,
          controllerAs: 'vm',
          resolve: {
            _offers: offers,
          },
        },
        'header@': {
          template: require('../../layout/tab-header/tab-header.html'),
          controller: TabHeaderController,
          controllerAs: 'vm',
          resolve: {
            _tabs() {
              return [
                new Tab({ label: 'PALVELUT', state: 'modules.home' }),
                new Tab({ label: 'TARJOUKSET', state: 'modules.offerList' }),
              ];
            },
          },
        },
      },
    },
  }];

  RouterHelper.configureStates(states);
}


text:
from .datasets import *
from .layers import *
from .models import *
#from .trainers import *
from .utils import *


text:
package com.hughes.android.dictionary.parser.wiktionary;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;

public class WiktionaryLangs {

    public static final Map<String,String> isoCodeToEnWikiName = new LinkedHashMap<>();
    static {
        isoCodeToEnWikiName.put("AF", "Afrikaans");
        isoCodeToEnWikiName.put("SQ", "Albanian");
        isoCodeToEnWikiName.put("AR", "Arabic");
        isoCodeToEnWikiName.put("HY", "Armenian");
        isoCodeToEnWikiName.put("BE", "Belarusian");
        isoCodeToEnWikiName.put("BN", "Bengali");
        isoCodeToEnWikiName.put("BG", "Bulgarian");
        isoCodeToEnWikiName.put("CA", "Catalan");
        isoCodeToEnWikiName.put("SH", "Serbo-Croatian");
        isoCodeToEnWikiName.put("CS", "Czech");
        isoCodeToEnWikiName.put("ZH", "Chinese");
        isoCodeToEnWikiName.put("cmn", "Mandarin");
        isoCodeToEnWikiName.put("yue", "Cantonese");
        isoCodeToEnWikiName.put("DA", "Danish");
        isoCodeToEnWikiName.put("NL", "Dutch");
        isoCodeToEnWikiName.put("EN", "English");
        isoCodeToEnWikiName.put("EO", "Esperanto");
        isoCodeToEnWikiName.put("ET", "Estonian");
        isoCodeToEnWikiName.put("FI", "Finnish");
        isoCodeToEnWikiName.put("FR", "French");
        // Note: must be before German since matcher
        // simply takes first match instead of best.
        isoCodeToEnWikiName.put("nds", "Low German");
        isoCodeToEnWikiName.put("pdc", "Pennsylvania German");
        isoCodeToEnWikiName.put("DE", "German");
        isoCodeToEnWikiName.put("grc", "Ancient Greek");
        isoCodeToEnWikiName.put("EL", "Greek");
        isoCodeToEnWikiName.put("haw", "Hawaiian");
        isoCodeToEnWikiName.put("HE", "Hebrew");
        isoCodeToEnWikiName.put("HI", "Hindi");
        isoCodeToEnWikiName.put("HU", "Hungarian");
        isoCodeToEnWikiName.put("IS", "Icelandic");
        isoCodeToEnWikiName.put("ID", "Indonesian");
        isoCodeToEnWikiName.put("GA", "Irish");
        isoCodeToEnWikiName.put("GD", "Gaelic");
        isoCodeToEnWikiName.put("GV", "Manx");
        isoCodeToEnWikiName.put("IT", "Italian");
        isoCodeToEnWikiName.put("LA", "Latin");
        isoCodeToEnWikiName.put("LV", "Latvian");
        isoCodeToEnWikiName.put("LT", "Lithuanian");
        isoCodeToEnWikiName.put("JA", "Japanese");
        isoCodeToEnWikiName.put("KO", "Korean");
        isoCodeToEnWikiName.put("KU", "Kurdish");
        isoCodeToEnWikiName.put("LO", "Lao");
        isoCodeToEnWikiName.put("ML", "Malayalam");
        isoCodeToEnWikiName.put("MS", "Malay");
        isoCodeToEnWikiName.put("MI", "Maori");
        isoCodeToEnWikiName.put("MN", "Mongolian");
        isoCodeToEnWikiName.put("NE", "Nepali");
        isoCodeToEnWikiName.put("NO", "Norwegian");
        isoCodeToEnWikiName.put("FA", "Persian");
        isoCodeToEnWikiName.put("PL", "Polish");
        isoCodeToEnWikiName.put("PT", "Portuguese");
        isoCodeToEnWikiName.put("PA", "Punjabi");
        isoCodeToEnWikiName.put("RO", "Romanian");
        isoCodeToEnWikiName.put("RU", "Russian");
        isoCodeToEnWikiName.put("SA", "Sanskrit");
        isoCodeToEnWikiName.put("SK", "Slovak");
        isoCodeToEnWikiName.put("SL", "Slovene|Slovenian");
        isoCodeToEnWikiName.put("SO", "Somali");
        isoCodeToEnWikiName.put("ES", "Spanish");
        isoCodeToEnWikiName.put("SW", "Swahili");
        isoCodeToEnWikiName.put("SV", "Swedish");
        isoCodeToEnWikiName.put("TL", "Tagalog");
        isoCodeToEnWikiName.put("TG", "Tajik");
        isoCodeToEnWikiName.put("TA", "Tamil");
        isoCodeToEnWikiName.put("TH", "Thai");
        isoCodeToEnWikiName.put("BO", "Tibetan");
        isoCodeToEnWikiName.put("TR", "Turkish");
        isoCodeToEnWikiName.put("UK", "Ukrainian");
        isoCodeToEnWikiName.put("UR", "Urdu");
        isoCodeToEnWikiName.put("VI", "Vietnamese");
        isoCodeToEnWikiName.put("CI", "Welsh");
        isoCodeToEnWikiName.put("YI", "Yiddish");
        isoCodeToEnWikiName.put("ZU", "Zulu");
        isoCodeToEnWikiName.put("AZ", "Azeri");
        isoCodeToEnWikiName.put("EU", "Basque");
        isoCodeToEnWikiName.put("BR", "Breton");
        isoCodeToEnWikiName.put("MR", "Marathi");
        isoCodeToEnWikiName.put("FO", "Faroese");
        isoCodeToEnWikiName.put("GL", "Galician");
        isoCodeToEnWikiName.put("KA", "Georgian");
        isoCodeToEnWikiName.put("HT", "Haitian Creole");
        isoCodeToEnWikiName.put("LB", "Luxembourgish");
        isoCodeToEnWikiName.put("MK", "Macedonian");
        isoCodeToEnWikiName.put("scn", "Sicilian");
        isoCodeToEnWikiName.put("cu", "Old Church Slavonic");
        isoCodeToEnWikiName.put("rom", "Romani");

        // No longer exists in EN:
        // isoCodeToEnWikiName.put("BS", "Bosnian");
        // isoCodeToEnWikiName.put("SR", "Serbian");
        // isoCodeToEnWikiName.put("HR", "Croatian");

        // Font doesn't work:
        //isoCodeToEnWikiName.put("MY", "Burmese");

        {
            //Set<String> missing = new LinkedHashSet<String>(isoCodeToEnWikiName.keySet());
            //missing.removeAll(Language.isoCodeToResources.keySet());
            //System.out.println(missing);
        }
        //assert Language.isoCodeToResources.keySet().containsAll(isoCodeToEnWikiName.keySet());
    }

    public static final Map<String,Map<String,String>> wikiCodeToIsoCodeToWikiName = new LinkedHashMap<>();
    static {
        Map<String,String> isoCodeToWikiName;

        // en
        wikiCodeToIsoCodeToWikiName.put("en", isoCodeToEnWikiName);

        // egrep -o '\{\{Wortart[^}]+\}\}' dewiktionary-pages-articles.xml | cut -d \| -f3 | sort | uniq -c | sort -nr
        isoCodeToWikiName = new LinkedHashMap<>();
        wikiCodeToIsoCodeToWikiName.put("de", isoCodeToWikiName);
        isoCodeToWikiName.put("nds", "Niederdeutsch");
        isoCodeToWikiName.put("DE", "Deutsch");
        isoCodeToWikiName.put("EN", "Englisch");
        isoCodeToWikiName.put("IT", "Italienisch");
        isoCodeToWikiName.put("PL", "Polnisch");
        isoCodeToWikiName.put("FR", "Französisch");
        isoCodeToWikiName.put("EO", "Esperanto");
        isoCodeToWikiName.put("CA", "Katalanisch");
        isoCodeToWikiName.put("LA", "Latein");
        isoCodeToWikiName.put("CS", "Tschechisch");
        isoCodeToWikiName.put("HU", "Ungarisch");
        isoCodeToWikiName.put("SV", "Schwedisch");
        isoCodeToWikiName.put("ES", "Spanisch");
        isoCodeToWikiName.put("RO", "Rumänisch");

        // egrep -o '== *\{\{langue\|[a-zA-Z]+\}\} *==' frwiktionary-pages-articles.xml | sort | uniq -c | sort -nr
        isoCodeToWikiName = new LinkedHashMap<>();
        wikiCodeToIsoCodeToWikiName.put("fr", isoCodeToWikiName);
        isoCodeToWikiName.put("FR", Pattern.quote("{{langue|fr}}"));
        isoCodeToWikiName.put("RU", Pattern.quote("{{langue|ru}}"));
        isoCodeToWikiName.put("AR", Pattern.quote("{{langue|ar}}"));  // Arabic
        isoCodeToWikiName.put("BG", Pattern.quote("{{langue|bg}}"));  // Bulgarian
        isoCodeToWikiName.put("EL", Pattern.quote("{{langue|el}}"));
        isoCodeToWikiName.put("EN", Pattern.quote("{{langue|en}}"));
        //isoCodeToWikiName.put("", Pattern.quote("{{langue|sl}}"));
        isoCodeToWikiName.put("LA", Pattern.quote("{{langue|la}}"));
        isoCodeToWikiName.put("IT", Pattern.quote("{{langue|it}}"));
        isoCodeToWikiName.put("EO", Pattern.quote("{{langue|eo}}"));
        isoCodeToWikiName.put("CS", Pattern.quote("{{langue|cs}}"));  // Czech
        isoCodeToWikiName.put("NL", Pattern.quote("{{langue|nl}}"));  // Dutch
        //isoCodeToWikiName.put("", Pattern.quote("{{langue|mg}}"));
        //isoCodeToWikiName.put("", Pattern.quote("{{langue|hsb}}"));
        isoCodeToWikiName.put("ZH", Pattern.quote("{{langue|zh}}"));
        isoCodeToWikiName.put("cmn", Pattern.quote("{{langue|cmn}}"));
        isoCodeToWikiName.put("yue", Pattern.quote("{{langue|yue}}"));
        isoCodeToWikiName.put("JA", Pattern.quote("{{langue|ja}}"));
        isoCodeToWikiName.put("DE", Pattern.quote("{{langue|de}}"));
        isoCodeToWikiName.put("IS", Pattern.quote("{{langue|is}}"));  // Icelandic
        isoCodeToWikiName.put("ES", Pattern.quote("{{langue|es}}"));
        isoCodeToWikiName.put("UK", Pattern.quote("{{langue|uk}}"));
        isoCodeToWikiName.put("PT", Pattern.quote("{{langue|pt}}"));
        isoCodeToWikiName.put("SV", Pattern.quote("{{langue|sv}}"));

        // egrep -o '= *\{\{-[a-z]+-\}\} *=' itwiktionary-pages-articles.xml | sort | uniq -c | sort -n
        isoCodeToWikiName = new LinkedHashMap<>();
        wikiCodeToIsoCodeToWikiName.put("it", isoCodeToWikiName);
        isoCodeToWikiName.put("IT", "\\{\\{-(it|scn|nap|cal|lmo)-\\}\\}");  // scn, nap, cal, lmo
        isoCodeToWikiName.put("EN", Pattern.quote("{{-en-}}"));
        isoCodeToWikiName.put("FR", Pattern.quote("{{-fr-}}"));
        isoCodeToWikiName.put("DE", Pattern.quote("{{-de-}}"));
        isoCodeToWikiName.put("ES", Pattern.quote("{{-es-}}"));
        isoCodeToWikiName.put("JA", Pattern.quote("{{-ja-}}"));
        isoCodeToWikiName.put("PL", Pattern.quote("{{-pl-}}"));
        isoCodeToWikiName.put("NL", Pattern.quote("{{-nl-}}"));
        isoCodeToWikiName.put("LV", Pattern.quote("{{-lv-}}"));
        isoCodeToWikiName.put("LA", Pattern.quote("{{-la-}}"));
        isoCodeToWikiName.put("HU", Pattern.quote("{{-hu-}}"));
        isoCodeToWikiName.put("EL", Pattern.quote("{{-grc-}}"));
        isoCodeToWikiName.put("SV", Pattern.quote("{{-sv-}}"));
        isoCodeToWikiName.put("RU", Pattern.quote("{{-ru-}}"));

        // egrep -o '== *\{\{lengua\|[a-zA-Z]+\}\} *==' frwiktionary-pages-articles.xml | sort | uniq -c | sort -nr
        isoCodeToWikiName = new LinkedHashMap<>();
        wikiCodeToIsoCodeToWikiName.put("es", isoCodeToWikiName);
        isoCodeToWikiName.put("AR", Pattern.quote("{{lengua|ar}}"));
        isoCodeToWikiName.put("ES", Pattern.quote("{{lengua|es}}"));
        isoCodeToWikiName.put("EN", Pattern.quote("{{lengua|en}}"));
        isoCodeToWikiName.put("FR", Pattern.quote("{{lengua|fr}}"));
        isoCodeToWikiName.put("IT", Pattern.quote("{{lengua|it}}"));

        // Pattern seems to match Italian one
        isoCodeToWikiName = new LinkedHashMap<>();
        wikiCodeToIsoCodeToWikiName.put("pt", isoCodeToWikiName);
        isoCodeToWikiName.put("PT", Pattern.quote("{{-pt-}}"));
        isoCodeToWikiName.put("EN", Pattern.quote("{{-en-}}"));
        isoCodeToWikiName.put("ES", Pattern.quote("{{-es-}}"));
    }
    public static String getEnglishName(String langCode) {
        String name = isoCodeToEnWikiName.get(langCode);
        if (name == null) {
            name = isoCodeToEnWikiName.get(langCode.toUpperCase());
        }
        if (name == null) {
            return null;
        }
        if (name.indexOf('|') != -1) {
            return name.substring(0, name.indexOf('|'));
        }
        if (name.indexOf('$') != -1) {
            return name.substring(0, name.indexOf('$'));
        }
        return name;  // can be null.
    }

}


text:
package io.snappydata.benchmark.LoadPerformance

import java.io.{PrintStream, FileOutputStream, File}

import com.typesafe.config.Config
import io.snappydata.benchmark.TPCHColumnPartitionedTable

import org.apache.spark.sql._

/**
 * Created by kishor on 29/8/16.
 */
object BulkLoad_Snappy extends SnappySQLJob{

  var tpchDataPath: String = _
  var buckets_Order_Lineitem: String = _

  override def runSnappyJob(snSession: SnappySession, jobConfig: Config): Any = {
    val snc = snSession.sqlContext

    var loadPerfFileStream: FileOutputStream = new FileOutputStream(new File(s"BulkLoadPerf.out"))
    var loadPerfPrintStream:PrintStream = new PrintStream(loadPerfFileStream)

    val isSnappy = true
    val dbName = "TPCH"

    val usingOptionString = s"""
           USING row
           OPTIONS ()"""

    snc.sql("DROP TABLE IF EXISTS " + "LINEITEM")
    snc.sql("DROP TABLE IF EXISTS " + "ORDERS")

    TPCHColumnPartitionedTable.testLoadOrderTablePerformance(snc, tpchDataPath, isSnappy,
      buckets_Order_Lineitem,loadPerfPrintStream)
    TPCHColumnPartitionedTable.testLoadLineItemTablePerformance(snc, tpchDataPath, isSnappy,
      buckets_Order_Lineitem,loadPerfPrintStream)

    loadPerfPrintStream.close()
    loadPerfFileStream.close()
  }

  override def isValidJob(snSession: SnappySession, config: Config): SnappyJobValidation = {

    tpchDataPath = if (config.hasPath("dataLocation")) {
      config.getString("dataLocation")
    } else {
      "/QASNAPPY/TPCH/DATA/1"
    }

    buckets_Order_Lineitem = if (config.hasPath("Buckets_Order_Lineitem")) {
      config.getString("Buckets_Order_Lineitem")
    } else {
      "15"
    }

    if (!(new File(tpchDataPath)).exists()) {
      return new SnappyJobInvalid("Incorrect tpch data path. " +
          "Specify correct location")
    }

    SnappyJobValid()
  }
}


text:
<?php
namespace Mopa\Bundle\RemoteUpdateBundle\Command;

use Mopa\Bundle\RemoteUpdateBundle\Model\Exceptions\HavingJobPendingException;

use Mopa\Bundle\RemoteUpdateBundle\Entity\UpdateJob;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class RemoteUpdateCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
        ->setName('mopa:update:remote')
        ->setDescription('update remote installation')
        ->addArgument('remote', InputArgument::REQUIRED, 'Which remote to use?')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $remote = $input->getArgument('remote');
        $output->writeln("Starting remote update on $remote ... ");
        try{
            $job = $this->getContainer()
                        ->get('mopa_remote_update_service')
                        ->update($remote);
            $output->writeln("Status: " . ($job->getStatusMessage()));
            if ( $output->getVerbosity() > 1) {
                $output->writeln("Got from Remote $remote:");
                $output->writeln($job->getMessage());
            }
        }
        catch(HavingJobPendingException $e) {
            $output->writeln("<comment>" . $e->getMessage() . "</comment>");
        }

    }
}


text:
module.exports = function(grunt) {
	grunt.initConfig({
		meta: {
			package: grunt.file.readJSON('package.json'),
			src: {
				main: 'src/main',
				test: 'src/test',
			},
			bin: {
				coverage: 'bin/coverage'
			},
			temp: {
				integration: '.grunt/integration',
				outfile: '.grunt/outfile'
			},
			doc: 'doc'
		},
		// test template functionality
		nodeunit: {
			template: '<%= meta.src.test %>/js/template.js',
			reporter: '<%= meta.src.test %>/js/reporter.js',
			integration: '<%= meta.src.test %>/js/integration.js',
			outfile: '<%= meta.src.test %>/js/outfile.js',
			threshold: '<%= meta.src.test %>/js/threshold.js'
		},
		jasmine: {
			// test common use-case
			integration: {
				src: ['<%= meta.src.test %>/js/Generator.js'],
				options: {
					specs: ['<%= meta.src.test %>/js/GeneratorTest.js'],
					template: require('./'),
					templateOptions: {
						coverage: '<%= meta.temp.integration %>/coverage.json',
						report: [
							{
								type: 'html',
								options: {
									dir: '<%= meta.temp.integration %>/html'
								}
							},
							{
								type: 'cobertura',
								options: {
									dir: '<%= meta.temp.integration %>/cobertura'
								}
							},
							{
								type: 'text-summary'
							}
						],
						thresholds: {
							lines: 100,
							statements: 100,
							branches: 100,
							functions: 100
						},
						template: '<%= meta.src.test %>/html/integration.tmpl',
						templateOptions: {
							helpers: ['<%= meta.src.test %>/js/integration-helper.js']
						}
					}
				}
			},
			// test that coverage is still collected when outfile is specified, see #33
			outfile: {
				src: ['<%= meta.src.test %>/js/Generator.js'],
				options: {
					specs: ['<%= meta.src.test %>/js/GeneratorTest.js'],
					outfile: '.grunt/runner.html',
					template: require('./'),
					templateOptions: {
						coverage: '<%= meta.temp.outfile %>/coverage.json',
						report: {
							type: 'text-summary'
						},
						template: '<%= meta.src.test %>/html/integration.tmpl',
						templateOptions: {
							helpers: ['<%= meta.src.test %>/js/integration-helper.js']
						}
					}
				}
			},
			// test that threshold can fail the build
			threshold: {
				src: ['<%= meta.src.test %>/js/Generator.js'],
				options: {
					specs: ['<%= meta.src.test %>/js/GeneratorTest.js'],
					template: require('./'),
					templateOptions: {
						coverage: '<%= meta.temp.integration %>/coverage.json',
						report: {
							type: 'text-summary'
						},
						thresholds: {
							lines: 101
						},
						template: '<%= meta.src.test %>/html/integration.tmpl',
						templateOptions: {
							helpers: ['<%= meta.src.test %>/js/integration-helper.js']
						}
					}
				}
			}
		},
		clean: {
			temp: ['.grunt'],
			bin: ['bin']
		},
		yuidoc: {
			compile: {
				name: '<%= meta.package.name %>',
				description: '<%= meta.package.description %>',
				version: '<%= meta.package.version %>',
				options: {
					paths: '<%= meta.src.main %>',
					outdir: '<%= meta.doc %>'
				}
			}
		},
		eslint: {
			target: ['<%= meta.src.main %>/js/*.js', '<%= meta.src.test %>/js/*.js'],
			options: {
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-jasmine');
	grunt.loadNpmTasks('grunt-contrib-nodeunit');
	grunt.loadNpmTasks('grunt-contrib-yuidoc');
	grunt.loadNpmTasks('gruntify-eslint');

	grunt.registerTask('report', 'Write coverage report', function () {
		var istanbul = require('istanbul');
		var collector = new istanbul.Collector();
		var reporter = istanbul.Report.create('html', {
			dir: grunt.config.process('<%= meta.bin.coverage %>')
		});
		grunt.file.expand(grunt.config.process('<%= meta.bin.coverage %>/coverage-*.json')).forEach(function (file) {
			collector.add(grunt.file.readJSON(file));
		});
		reporter.writeReport(collector, true);
	});

	var WARN = grunt.warn;

	grunt.registerTask('mock:warn:install', 'Install mock for grunt.warn()', function () {
		grunt.warn = function(message) {
			grunt.warn.message = message;
		};
	});
	grunt.registerTask('mock:warn:uninstall', 'Uninstall mock for grunt.warn()', function () {
		grunt.warn = WARN;
	});

	grunt.registerTask('check', ['eslint']);
	grunt.registerTask('doc', 'yuidoc');
	grunt.registerTask('test:template', ['nodeunit:template']);
	grunt.registerTask('test:reporter', ['nodeunit:reporter']);
	grunt.registerTask('test:integration', ['clean:temp', 'jasmine:integration', 'nodeunit:integration']);
	grunt.registerTask('test:outfile', ['clean:temp', 'jasmine:outfile', 'nodeunit:outfile']);
	grunt.registerTask('test:threshold', ['clean:temp', 'mock:warn:install', 'jasmine:threshold', 'nodeunit:threshold', 'mock:warn:uninstall']);
	grunt.registerTask('test', ['test:template', 'test:reporter', 'test:integration', 'test:outfile', 'test:threshold']);
	grunt.registerTask('test:coverage', ['clean:bin', 'test', 'report']);

};


text:
using Martijn.HouseInsight.Core.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Martijn.HouseInsight.EntityFramework
{
    public class HouseInsightContext : DbContext
    {
        public HouseInsightContext() { }

        public HouseInsightContext(DbContextOptions<HouseInsightContext> options) : base(options) { }

        public DbSet<GeoPosition> GeoPositions { get; set; }

        public DbSet<ItemGroup> ItemGroups { get; set; }

        public DbSet<ItemPriority> ItemPriorities { get; set; }

        public DbSet<ItemType> ItemTypes { get; set; }

        public DbSet<Product> Products { get; set; }

        public DbSet<Room> Rooms { get; set; }

        public DbSet<Retail> Retails { get; set; }

        public DbSet<RetailProduct> RetailProducts { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            ConfigureGeoPosition(modelBuilder.Entity<GeoPosition>());
            ConfigureItemGroup(modelBuilder.Entity<ItemGroup>());
            ConfigureItemPriority(modelBuilder.Entity<ItemPriority>());
            ConfigureItemType(modelBuilder.Entity<ItemType>());
            ConfigureItemTypeRoom(modelBuilder.Entity<ItemTypeRoom>());
            ConfigureProduct(modelBuilder.Entity<Product>());
            ConfigureRoom(modelBuilder.Entity<Room>());
            ConfigureStoreChain(modelBuilder.Entity<Retail>());
            ConfigureStoreChainProduct(modelBuilder.Entity<RetailProduct>());
        }

        protected virtual void ConfigureGeoPosition(EntityTypeBuilder<GeoPosition> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Latitude).HasColumnType("decimal(15,12)").IsRequired();
            builder.Property(x => x.Longitude).HasColumnType("decimal(15,12)").IsRequired();
            builder.HasOne(x => x.Retail).WithMany(x => x.Locations);
        }

        protected virtual void ConfigureItemGroup(EntityTypeBuilder<ItemGroup> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
        }

        protected virtual void ConfigureItemPriority(EntityTypeBuilder<ItemPriority> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
        }

        protected virtual void ConfigureItemType(EntityTypeBuilder<ItemType> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
            builder.Property(x => x.Description).HasMaxLength(256);
            builder.Property(x => x.RequiredAmount).HasDefaultValue(1);
            builder.Property(x => x.Obtained).HasDefaultValue(false);
            builder.HasOne(x => x.Group).WithMany(x => x.ItemTypes);
            builder.HasOne(x => x.Priority).WithMany(x => x.ItemTypes);
        }

        protected virtual void ConfigureItemTypeRoom(EntityTypeBuilder<ItemTypeRoom> builder)
        {
            builder.HasKey(x => new { x.ItemTypeId, x.RoomId });
            builder.HasOne(x => x.ItemType).WithMany(x => x.Rooms).HasForeignKey(x => x.ItemTypeId);
            builder.HasOne(x => x.Room).WithMany(x => x.ItemTypes).HasForeignKey(x => x.RoomId);
        }

        protected virtual void ConfigureProduct(EntityTypeBuilder<Product> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
            builder.HasOne(x => x.ItemType).WithMany(x => x.Products);
        }

        protected virtual void ConfigureRoom(EntityTypeBuilder<Room> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
        }

        protected virtual void ConfigureStoreChain(EntityTypeBuilder<Retail> builder)
        {
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Name).HasMaxLength(128).IsRequired();
        }

        protected virtual void ConfigureStoreChainProduct(EntityTypeBuilder<RetailProduct> builder)
        {
            builder.HasKey(x => new { StoreChainId = x.RetailId, x.ProductId });
            builder.Property(x => x.Price).HasColumnType("money").IsRequired();
            builder.Property(x => x.Link).IsRequired();
            builder.Property(x => x.LastUpdated).HasDefaultValue("getutcdate()").IsRequired();
            builder.Property(x => x.IsDiscount).HasDefaultValue(false);
            builder.HasOne(x => x.Retail).WithMany(x => x.RetailProducts).HasForeignKey(x => x.RetailId);
            builder.HasOne(x => x.Product).WithMany(x => x.RetailProducts).HasForeignKey(x => x.ProductId);
        }
    }
}