text:
"""Description: Modify bedGraph file

This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""

# ------------------------------------
# python modules
# ------------------------------------
import sys
import os
import logging
from MACS2.IO import BedGraphIO
from MACS2.OptValidator import opt_validate_bdgopt as opt_validate

# ------------------------------------
# constants
# ------------------------------------
logging.basicConfig(level=20,
                    format='%(levelname)-5s @ %(asctime)s: %(message)s ',
                    datefmt='%a, %d %b %Y %H:%M:%S',
                    stream=sys.stderr,
                    filemode="w"
                    )

# ------------------------------------
# Misc functions
# ------------------------------------
error   = logging.critical		# function alias
warn    = logging.warning
debug   = logging.debug
info    = logging.info
# ------------------------------------
# Classes
# ------------------------------------

# ------------------------------------
# Main function
# ------------------------------------
def run( options ):
    options = opt_validate( options )
    info("Read and build bedGraph...")
    bio = BedGraphIO.bedGraphIO(options.ifile)
    btrack = bio.build_bdgtrack(baseline_value=0)

    info("Modify bedGraph...")
    if options.method.lower() == "p2q":
        btrack.p2q()

    else:
        extraparam = float(options.extraparam[0])
        if options.method.lower() == "multiply":
            btrack.apply_func( lambda x: x * extraparam)
        elif options.method.lower() == "add":
            btrack.apply_func( lambda x: x + extraparam)
        elif options.method.lower() == "max":
            btrack.apply_func( lambda x: x if x> extraparam else extraparam )
        elif options.method.lower() == "min":
            btrack.apply_func( lambda x: x if x< extraparam else extraparam )

    ofile = os.path.join( options.outdir, options.ofile )
    info("Write bedGraph of modified scores...")
    ofhd = open(ofile,"w")
    btrack.write_bedGraph(ofhd,name="%s_modified_scores" % (options.method.upper()),description="Scores calculated by %s" % (options.method.upper()))
    info("Finished '%s'! Please check '%s'!" % (options.method, ofile))

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace Oblqo
{
    public interface IDriveFile
    {
        string Id { get; }
        bool IsImage { get; }
        bool IsFolder { get; }
        string Name { get; }
        bool HasChildren { get; }
        long Size { get; }
        DateTime ModifiedDate { get; }
        DateTime CreatedDate { get; }
        int OriginalImageWidth { get; set; }
        int OriginalImageHeight { get; set; }
        long OriginalSize { get; set; }
        int ImageWidth { get; }
        int ImageHeight { get; }
        bool IsRoot { get; }
        string MimeType { get; }
        string StorageFileId { get; }
        XElement ToXml();
        //Task ScaleImageAsync();
        string GetAttribute(string name);
        Task SetAttributeAsync(string name, string value, CancellationToken token);

        /// <summary>
        /// Generate unique ID for new source.
        /// </summary>
        /// <param name="sources">Existing source IDs.</param>
        /// <returns></returns>
        string GetNewSource(List<string> sources);

        Task<Stream> ReadFileAsync(CancellationToken token);

        Task SetStorageFileIdAsync(string value, CancellationToken token);
    }
}


text:
import { Component } from '@angular/core';

// part 3: added Hero import
// note that this could be used to create the Colonist class
// and the Alien class
// TODO: rename to colonists. Then make one for Aliens
// We can add additional properties here to match up with the
// Mars Project right away (they won't be used...yet)
// const COLONISTS: Colonist
// (also... const ALIENS: Alien)

import { Hero } from './models/Hero';

// refactor Heroes constant out to its own file
import { HEROES } from './data/Heroes'
import {HeroService} from "./hero.service";
import {Alien} from "./models/Alien";
// For extending the service lesson, get Alien data
import {AlienService} from "./alien.service";
import {AlienHorde} from "./models/AlienHorde";

import { ColonistService } from './colonist.service'
import { Colony } from './models/Colony'

@Component({
  selector: 'my-app',
  template: `

{{title}}

My Heroes

        {{hero.id}} {{hero.name}}

    <my-hero-detail [hero]="selectedHero"></my-hero-detail>

Test Aliens

        {{alien.type}} - {{alien.description}}

Test Colonists

       <span *ngIf="i<10">

        {{colonist.name}} - {{colonist.job.description}}

  `,
  styles: [`
    .selected {
      background-color: #CFD8DC !important;
      color: white;
    }
    .heroes {
      margin: 0 0 2em 0;
      list-style-type: none;
      padding: 0;
      width: 15em;
    }
    .heroes li {
      cursor: pointer;
      position: relative;
      left: 0;
      background-color: #EEE;
      margin: .5em;
      padding: .3em 0;
      height: 1.6em;
      border-radius: 4px;
    }
    .heroes li.selected:hover {
      background-color: #BBD8DC !important;
      color: white;
    }
    .heroes li:hover {
      color: #607D8B;
      background-color: #DDD;
      left: .1em;
    }
    .heroes .text {
      position: relative;
      top: -3px;
    }
    .heroes .badge {
      display: inline-block;
      font-size: small;
      color: white;
      padding: 0.8em 0.7em 0 0.7em;
      background-color: #607D8B;
      line-height: 1em;
      position: relative;
      left: -1px;
      top: -4px;
      height: 1.8em;
      margin-right: .8em;
      border-radius: 4px 0 0 4px;
    }
  `],
  providers: [HeroService,AlienService,ColonistService]
})
export class AppComponent {
  title = 'Tour of Heroes';
  // heroes = HEROES;
  // pt 5. services
  heroes: Hero[];
  // Mars Project: add a sample "aliens" collection to test service
  aliens: AlienHorde;
  // Mars Project: add a sample "colony" collection to test service
  colonists: Colony;

  selectedHero: Hero;

  ngOnInit(): void{
    this.getHeroes();
    this.getAliens();
    this.getColonists();

  }

  // pt 5 toh add constructor
  constructor(private heroService: HeroService,
              private alienService: AlienService,
              private colonistService: ColonistService){}

  getHeroes(): void{
    // pt 5 toh - refactor this.heroes into their own method
    // note how we cast the fat arrow function
    // argument in parentheses, and cast the getHeroes() method
    // call as <Promise<Hero[]>>
    <Promise<Hero[]>>(this.heroService.getHeroes()).then( (heroes:Hero[]) => this.heroes = heroes);
  }

  getAliens(): void {
    console.log("test retrieving aliens");

    // this was to test locally
    // this.alienService.getAliens().then((a:Aliens) => {console.log(a);this.aliens = <Aliens>a;});

    // this is to test the remote service
    let aliensPromise:Promise<AlienHorde> = this.alienService.getAliens();
    aliensPromise.then( (a:AlienHorde) => {this.aliens = a; } );
  }

  getColonists(): void {

    let colonistsPromise:Promise<Colony> = this.colonistService.getColonists();
    colonistsPromise.then( (c:Colony) => { (this.colonists) = c; console.log(this.colonists)}  );

  }

  onSelect(hero: Hero): void {
    this.selectedHero = hero;
  }
}


text:
package org.scijava.ui;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.scijava.Context;
import org.scijava.display.Display;
import org.scijava.ui.headless.HeadlessUI;
import org.scijava.ui.viewer.DisplayWindow;

/**
 * Tests for {@link DefaultUIService}.
 *
 * @author Richard Domander (Royal Veterinary College, London)
 * @author Curtis Rueden
 */
public class UIServiceTest {

	private Context context;
	private UIService uiService;

	@Before
	public void setUp() {
		context = new Context(UIService.class);
		uiService = context.service(UIService.class);
	}

	@After
	public void tearDown() {
		context.dispose();
	}

	@Test
	public void testDefaultUI() {
		assertTrue(uiService.getDefaultUI() instanceof HeadlessUI);
	}

	@Test
	public void testAvailableUIs() {
		final List<UserInterface> uiList = uiService.getAvailableUIs();
		assertEquals(1, uiList.size());
		assertTrue(uiList.get(0) instanceof HeadlessUI);
	}

	@Test
	public void testHeadlessUI() {
		final MockUserInterface mockUI = new MockUserInterface();
		uiService.setDefaultUI(mockUI);

		// test non-headless behavior
		uiService.setHeadless(false);
		assertFalse(uiService.isHeadless());
		assertTrue(uiService.getDefaultUI() instanceof MockUserInterface);

		// test headless behavior
		uiService.setHeadless(true);
		assertTrue(uiService.isHeadless());
		assertTrue("UIService should return HeadlessUI when running \"headless\"",
			uiService.getDefaultUI() instanceof HeadlessUI);
	}

	private static final class MockUserInterface extends AbstractUserInterface {

		@Override
		public DisplayWindow createDisplayWindow(final Display<?> display) {
			return null;
		}

		@Override
		public DialogPrompt dialogPrompt(final String message, final String title,
			final DialogPrompt.MessageType messageType,
			final DialogPrompt.OptionType optionType)
		{
			return null;
		}

		@Override
		public void showContextMenu(final String menuRoot, final Display<?> display,
			final int x, final int y)
		{}

		@Override
		public boolean requiresEDT() {
			return false;
		}

		@Override
		public void dispose() {}
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

001package com.teamupnext.robot.commands;
002
003/*
004 * To change this template, choose Tools | Templates
005 * and open the template in the editor.
006 */
007
008import com.teamupnext.robot.RobotMap;
009import edu.wpi.first.wpilibj.command.CommandGroup;
010
011/**
012 *
013 * @author jousley
014 */
015public class Autonomous extends CommandGroup {
016
017    public Autonomous() {
018        // Add Commands here:
019        // e.g. addSequential(new Command1());
020        //      addSequential(new Command2());
021        // these will run in order.
022
023        // To run multiple commands at the same time,
024        // use addParallel()
025        // e.g. addParallel(new Command1());
026        //      addSequential(new Command2());
027        // Command1 and Command2 will run in parallel.
028
029        // A command group will require all of the subsystems that each member
030        // would require.
031        // e.g. if Command1 requires chassis, and Command2 requires arm,
032        // a CommandGroup containing them would require both the chassis and the
033        // arm.
034
035
036        addParallel(new BigHopShooter());
037        addSequential(new TiltShooter(-7.9));
038        addSequential(new DriveByTime(RobotMap.AUTO_DRIVE_POWER, RobotMap.AUTO_DRIVE_POWER, RobotMap.AUTO_REVERSE_TIME));//addSequential(new ReverseDriveTrainByTime(5));
039        addSequential(new Fire());
040        //addSequential(new Fire());
041        //addSequential(new Fire());
042        //addSequential(new LowerArm());
043        //addSequential(new TurnSweeperOn());
044        //addSequential(new DriveByTime(-RobotMap.AUTO_DRIVE_POWER, -RobotMap.AUTO_DRIVE_POWER, RobotMap.AUTO_FORWARD_TIME));
045        //addParallel(new TurnSweeperOff());
046        //addSequential(new RaiseArm());
047        //addSequential(new TurnSweeperOn());
048        //addSequential(new Wait(.5));
049        //addSequential(new TurnSweeperOff());
050
051    }
052}


text:
{- |

At the ZuriHac 2016 I worked on the new parsec-based parser for the *.cabal files.
The obvious test case is to compare new and old parser results for all of Hackage.
Traversing the Hackage is quite trivial. The difficult part is inspecting
the result 'GenericPackageDescription's to spot the difference.

In the same event, Andres Löh showed his library @generics-sop@. Obvious choice
to quickly put something together for the repetetive task. After all you can
compare records field-wise. And if sum constructors are different, that's
enough for our case as well!

Generic programming ftw.
-}

{-# LANGUAGE CPP                   #-}
{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DefaultSignatures     #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE GADTs                 #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds             #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE UndecidableInstances  #-}
-- | TODO: package as a library? is this useful elsewhere?
module StructDiff where

import           Control.Applicative  (liftA2)
import           Data.Align.Key       (AlignWithKey (..))
import           Data.Foldable        (Foldable, fold, traverse_)
import           Data.Key             (Key)
import           Data.List            (intercalate)
import           Data.Map             (Map)
import           Data.Monoid          (Monoid (..), (<>))
import           Data.Singletons.Bool (SBool (..), SBoolI (..), eqToRefl)
import           Data.These           (These (..))
import           Data.Type.Equality
import           Generics.SOP

-- | Because @'Data.Proxy.Proxy' :: 'Data.Proxy.Proxy' a@ is so long.
data P a = P

-------------------------------------------------------------------------------
-- Structure diffs
-------------------------------------------------------------------------------

-- | Each thunk has a path, removed and added "stuff"
data DiffThunk = DiffThunk { dtPath :: [String], dtA :: String, dtB :: String }
    deriving Show

-- | Diff result is a collection of thunks
data DiffResult = DiffResult [DiffThunk]
    deriving Show

prefixThunk :: String -> DiffThunk -> DiffThunk
prefixThunk pfx (DiffThunk path a b) = DiffThunk (pfx : path) a b

prefixResult :: String -> DiffResult -> DiffResult
prefixResult name (DiffResult thunks) = DiffResult $ map (prefixThunk name) thunks

-- | Pretty print a result
prettyResultIO :: DiffResult -> IO ()
prettyResultIO (DiffResult []) = putStrLn "Equal"
prettyResultIO (DiffResult xs) = traverse_ p xs
  where
    p (DiffThunk paths a b) = do
        putStrLn $ intercalate " " paths ++ " : "
        putStrLn $ "- " ++ a
        putStrLn $ "+ " ++ b

-- | We can join diff results
instance Monoid DiffResult where
    mempty = DiffResult mempty
    mappend (DiffResult x) (DiffResult y) = DiffResult (mappend x y)

-- | And we have a class for things we can diff
class Diff a where
    diff :: a -> a -> DiffResult
    default diff
        :: (Generic a, HasDatatypeInfo a, All2 Diff (Code a))
        => a -> a -> DiffResult
    diff = gdiff

-- | And generic implementation!
gdiff :: forall a. (Generic a, HasDatatypeInfo a, All2 Diff (Code a)) => a -> a -> DiffResult
gdiff x y  = gdiffS (constructorInfo (P :: P a)) (unSOP $ from x) (unSOP $ from y)

gdiffS :: All2 Diff xss => NP ConstructorInfo xss -> NS (NP I) xss -> NS (NP I) xss -> DiffResult
gdiffS (c :* _) (Z xs) (Z ys) = mconcat $ hcollapse $ hczipWith3 (P :: P Diff) f (fieldNames c) xs ys
  where
    f :: Diff a => K FieldName a -> I a -> I a -> K DiffResult a
    f (K fieldName) x y = K . prefixResult fieldName . unI $ liftA2 diff x y
gdiffS (_ :* cs) (S xss) (S yss) = gdiffS cs xss yss
gdiffS cs xs ys = DiffResult [DiffThunk [] (constructorNameOf cs xs) (constructorNameOf cs ys)]

eqDiff :: (Eq a, Show a) => a -> a -> DiffResult
eqDiff x y
    | x == y    = DiffResult []
    | otherwise = DiffResult [DiffThunk [] (show x) (show y)]

alignDiff
    :: (Show (Key f), Show a, Diff a, AlignWithKey f, Foldable f)
    => f a -> f a -> DiffResult
alignDiff x y = fold $ alignWithKey (\k -> prefixResult (show k) . f) x y
  where
    f (These a b) = diff a b
    f (This a)    = DiffResult [DiffThunk [] (show a) "<none>"]
    f (That b)    = DiffResult [DiffThunk [] "<none>" (show b)]

instance Diff Char where diff = eqDiff
instance Diff Bool
instance Diff a => Diff (Maybe a)
instance Diff Int where diff = eqDiff
instance (Diff a, Diff b) => Diff (Either a b)

instance (Diff a, Diff b) => Diff (a, b) where
    diff (a, b) (a', b') =
        prefixResult "_1" (diff a a') <>
        prefixResult "_2" (diff b b')

instance (Diff a, Diff b, Diff c) => Diff (a, b, c) where
    diff (a, b, c) (a', b', c') =
        prefixResult "_1" (diff a a') <>
        prefixResult "_2" (diff b b') <>
        prefixResult "_3" (diff c c')

instance (SBoolI (a == Char), Show a, Diff a) => Diff [a] where
    diff = case sbool :: SBool (a == Char) of
        STrue  -> case eqToRefl :: a :~: Char of
            Refl -> eqDiff
        SFalse -> alignDiff

instance (Ord k, Show k, Diff v, Show v) => Diff (Map k v) where diff = alignDiff

-------------------------------------------------------------------------------
-- SOP helpers
-------------------------------------------------------------------------------

constructorInfo :: (HasDatatypeInfo a, xss ~ Code a) => proxy a -> NP ConstructorInfo xss
constructorInfo p = case datatypeInfo p of
    ADT _ _ cs    -> cs
    Newtype _ _ c -> c :* Nil

constructorNameOf :: NP ConstructorInfo xss -> NS f xss -> ConstructorName
constructorNameOf (c :* _)  (Z _)  = constructorName c
constructorNameOf (_ :* cs) (S xs) = constructorNameOf cs xs
#if __GLASGOW_HASKELL__ < 800
constructorNameOf _ _ = error "Should never happen"
#endif

constructorName :: ConstructorInfo xs -> ConstructorName
constructorName (Constructor name) = name
constructorName (Infix name _ _)   = "(" ++ name ++ ")"
constructorName (Record name _)    = name

-- | This is a little lie.
fieldNames :: ConstructorInfo xs -> NP (K FieldName) xs
fieldNames (Constructor name) = hpure (K name) -- TODO: add .1 .2 etc.
fieldNames (Infix name _ _) = K ("-(" ++ name ++ ")") :* K ("(" ++ name ++ ")-") :* Nil
fieldNames (Record _ fis) = hmap (\(FieldInfo fieldName) -> K fieldName) fis


text:
package eu.cloudwave.wp5.feedback.eclipse.base.ui.dialogs;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

/**
 * Provides methods to create and show {@link MessageBox}'s.
 */
public class MessageBoxes {

  private MessageBoxes() {} // prevents instantiation

  /**
   * Creates a {@link MessageBox}.
   *
   * @param parent
   *          the parent {@link Shell} of the {@link MessageBox}
   * @param title
   *          the title
   * @param message
   *          the message
   * @return the created {@link MessageBox}.
   */
  public static MessageBox create(final Shell parent, final String title, final String message) {
    final MessageBox messageBox = new MessageBox(parent, SWT.ICON_ERROR | SWT.OK);
    messageBox.setText(title);
    messageBox.setMessage(message);
    return messageBox;
  }

  /**
   * Creates and displays a {@link MessageBox}.
   *
   * @param parent
   *          the parent {@link Shell} of the {@link MessageBox}
   * @param title
   *          the title
   * @param message
   *          the message
   */
  public static void createAndShow(final Shell parent, final String title, final String message) {
    create(parent, title, message).open();
  }

}


text:
package com.gs.collections.api.bimap;

import java.util.Map;

import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function2;
import com.gs.collections.api.block.predicate.Predicate;
import com.gs.collections.api.block.predicate.Predicate2;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.map.MutableMapIterable;
import com.gs.collections.api.multimap.set.MutableSetMultimap;
import com.gs.collections.api.partition.set.PartitionMutableSet;
import com.gs.collections.api.set.MutableSet;
import com.gs.collections.api.tuple.Pair;

/**
 * A {@link BiMap} whose contents can be altered after initialization.
 *
 * @since 4.2
 */
public interface MutableBiMap<K, V> extends BiMap<K, V>, MutableMapIterable<K, V>, Cloneable
{
    MutableBiMap<K, V> newEmpty();

    MutableBiMap<V, K> inverse();

    MutableBiMap<V, K> flipUniqueValues();

    MutableSetMultimap<V, K> flip();

    /**
     * Similar to {@link Map#put(Object, Object)}, except that it throws on the addition of a duplicate value.
     *
     * @throws IllegalArgumentException if the value already exists in the bimap.
     */
    V put(K key, V value);

    /**
     * Similar to {@link #put(Object, Object)}, except that it quietly removes any existing entry with the same
     * value before putting the key-value pair.
     */
    V forcePut(K key, V value);

    MutableBiMap<K, V> asSynchronized();

    MutableBiMap<K, V> asUnmodifiable();

    MutableBiMap<K, V> clone();

    MutableBiMap<K, V> tap(Procedure<? super V> procedure);

    MutableBiMap<K, V> select(Predicate2<? super K, ? super V> predicate);

    MutableBiMap<K, V> reject(Predicate2<? super K, ? super V> predicate);

    <K2, V2> MutableBiMap<K2, V2> collect(Function2<? super K, ? super V, Pair<K2, V2>> function);

    <R> MutableBiMap<K, R> collectValues(Function2<? super K, ? super V, ? extends R> function);

    MutableSet<V> select(Predicate<? super V> predicate);

    <P> MutableSet<V> selectWith(Predicate2<? super V, ? super P> predicate, P parameter);

    MutableSet<V> reject(Predicate<? super V> predicate);

    <P> MutableSet<V> rejectWith(Predicate2<? super V, ? super P> predicate, P parameter);

    PartitionMutableSet<V> partition(Predicate<? super V> predicate);

    <P> PartitionMutableSet<V> partitionWith(Predicate2<? super V, ? super P> predicate, P parameter);

    <S> MutableSet<S> selectInstancesOf(Class<S> clazz);

    <S> MutableSet<Pair<V, S>> zip(Iterable<S> that);

    MutableSet<Pair<V, Integer>> zipWithIndex();

    <V1> MutableSetMultimap<V1, V> groupBy(Function<? super V, ? extends V1> function);

    <V1> MutableSetMultimap<V1, V> groupByEach(Function<? super V, ? extends Iterable<V1>> function);

    <VV> MutableBiMap<VV, V> groupByUniqueKey(Function<? super V, ? extends VV> function);

    MutableBiMap<K, V> withKeyValue(K key, V value);

    MutableBiMap<K, V> withAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValues);

    MutableBiMap<K, V> withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs);

    MutableBiMap<K, V> withoutKey(K key);

    MutableBiMap<K, V> withoutAllKeys(Iterable<? extends K> keys);
}


text:
[![Build Status](https://travis-ci.org/UKHomeOffice/docker-elasticsearch.svg?branch=master)](https://travis-ci.org/UKHomeOffice/docker-elasticsearch)
[![Docker Repository on Quay](https://quay.io/repository/ukhomeofficedigital/elasticsearch/status "Docker Repository on Quay")](https://quay.io/repository/ukhomeofficedigital/elasticsearch)

ElasticSearch 6.8.1.

### Configuration
Configuration is done via environment variables.

The following configuration defaults may not necessarily be set to the same
values in [kube/](kube/) example files.

* `CLUSTER_NAME`: ElasticSearch cluster name. Default: `elasticsearch`.
* `NODE_NAME`: Node name. Default: `${HOSTNAME}` (kubernetes assigned pod name by default).
* `PATH_DATA`: Path where ES stores its data. Default: `/data`.
* `ELASTIC_SEARCH_HEAP_SIZE`: JVM heap size. Default: `450m`. If you adjust this parameter,
  make sure to increase container limits as well.
* `INDEX_AUTO_EXPAND_REPLICAS`: Whether to automatically expand index replicas
  across data nodes. Default: `false`.
* `INDEX_NUMBER_OF_SHARDS`: The default number of primary shards for each index. Default: `5`.
* `INDEX_NUMBER_OF_REPLICAS`: The number of replicas per shard that an index should create. Default `1`.
* `INDEX_REFRESH_INTERVAL`: How often to refresh indexes. Default: `1s`.
* `GATEWAY_EXPECTED_MASTER_NODES` - See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html
* `GATEWAY_EXPECTED_DATA_NODES` - See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html
* `MEM_LOCK` - Whether to enable bootstrap.memory_lock. Default: `true`.
* `NODE_MASTER`: Whether this node can be a master node. Default: `true`.
* `NODE_DATA`: Whether this node can be a data node. Default: `true`.
* `NODE_INGEST`: Whether this node can be a data ingesting node. Default: `true`.
* `HTTP_BIND_HOST`: http bind address.. Default: `0.0.0.0`.
* `THREAD_POOL_WRITE_QUEUE_SIZE` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html
* `DISCOVERY_ZEN_FD_PING_INTERVAL` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#fault-detection
* `DISCOVERY_ZEN_FD_PING_TIMEOUT` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#fault-detection
* `DISCOVERY_ZEN_FD_PING_RETRIES` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#fault-detection
* `DISCOVERY_ZEN_PUBLISH_TIMEOUT` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#_cluster_state_updates
* `DISCOVERY_ZEN_UNICAST_HOST` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#fault-detection. Default `elasticsearch`
* `DISCOVERY_ZEN_MINIMUM_MASTER_NODES` - see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#master-election. Default: `1`
* `INDEX_BUFFER_SIZE` - see https://www.elastic.co/guide/en/elasticsearch/reference/5.1/indexing-buffer.html
* `CLOUD_AWS_S3_ACCESS_KEY` - Cloud AWS S3 access key for repository-s3 plugin. See https://www.elastic.co/guide/en/elasticsearch/plugins/6.8/repository-s3-client.html
* `CLOUD_AWS_S3_SECRET_KEY` - Cloud AWS S3 secret key for repository-s3 plugin. See https://www.elastic.co/guide/en/elasticsearch/plugins/6.8/repository-s3-client.html
* `CLOUD_AWS_S3_ENDPOINT` - Cloud AWS S3 endpoint for repository-s3 plugin. See https://www.elastic.co/guide/en/elasticsearch/plugins/6.8/repository-s3-client.html
* `XPACK_SECURITY_ENABLE` - Whether X-Pack security plugin is enabled. Default: `false`
* `XPACK_SSL_VERIFY_MODE` - Level of verification on TLS comms. Default: `certificate`
* `XPACK_SECURITY_AUDIT_ENABLE` - Whether to enable auditing to keep track of attempted and successful interactions with Elasticsearch cluster. The default output is now `logfile`. Default: `false`.
* `XPACK_SECURITY_AUDIT_LOGFILE_EVENTS_EXCLUDE` - Excludes the specified events from log output. By default, no events are excluded. Accepts a string value with comma separated events. See https://www.elastic.co/guide/en/elasticsearch/reference/5.5/auditing-settings.html#event-audit-settings
* `XPACK_SECURITY_TRANSPORT_SSL_ENABLE` - Whether to enable transport SSL. Default: `false`
* `XPACK_SECURITY_HTTP_SSL_ENABLE` - Whether to enable HTTP SSL. Default: `false`
* `XPACK_SSL_KEY_PATH` - The full path to the node key file. This must be a location within the Elasticsearch configuration directory.
* `XPACK_SSL_CERT_PATH` - The full path to the node certificate. This must be a location within the Elasticsearch configuration directory.
* `XPACK_SSL_CA_CERT_PATH` -  Path to the CA certificate that should be trusted. This path must be a location within the Elasticsearch configuration directory.
* `XPACK_MONITORING_ENABLE` - Whether to enable X-Pack monitoring features. Default: `false`.
* `XPACK_MONITORING_COLLECTION_ENABLE` - Whether to use X-Pack monitoring features. Default: `false`.
* `XPACK_ML_ENABLE` - Whether to enable X-Pack machine learning features. Default: `false`.
* `XPACK_WATCHER_ENABLE` - Whether to enable X-Pack Watcher. Default: `false`.
* `XPACK_EMAIL_DEFAULTS_FROM` - The default FROM email address to be configured for all watches
* `XPACK_EMAIL_SMTP_AUTH` - Whether auth is required for email
* `XPACK_EMAIL_SMTP_STARTTLS_ENABLE` - TLS is enabled for the smtp host
* `XPACK_EMAIL_SMTP_STARTTLS_REQUIRED` - Require TLS communications with the smtp host
* `XPACK_EMAIL_SMTP_HOST` - The SMTP host address
* `XPACK_EMAIL_SMTP_PORT` - The SMTP host port to communicate on (e.g. 25, 587)
* `XPACK_EMAIL_SMTP_USER` - The username for auth with the SMTP host
* `XPACK_EMAIL_SMTP_PASS` - The password for auth with the SMTP host
* `BOOTSTRAP_PASSWORD`  - Optional bootstrap password for elastic user. No Default.

### Plugins

### Deployment
By default if you start the docker container, ElasticSearch will start in
standalone mode.

Deploying onto a Kubernetes cluster is fairly easy. There are example
kubernetes controller and service files in [kube/](kube/) directory.

#### Deploy Master Node
First of all we need to deploy master service for ES master nodes to find each
other and other communications between nodes. Then we can create the master
replication controller.

```bash
$ kubectl create -f kube/es-master-svc.yaml
$ kubectl create -f kube/es-master-rc.yaml
```

Wait a few seconds and verify whether it is up and running. You can also scale
the master nodes to 3.

```bash
$ kubectl logs -f es-master-fdfw -c elasticsearch
$ kubectl scale --replicas=3 rc/es-master
```

#### Deploy Client and Data Nodes
Once the master node is up and running, you can start deploying the rest of the cluster.

```bash
$ kubectl create -f kube/es-svc.yaml
$ kubectl create -f kube/es-client-rc.yaml
$ kubectl create -f kube/es-data-rc.yaml
```


text:
require 'spec_helper'

describe "Cancelling inventory" do
  stub_authorization!

  let!(:order) do
    create(
      :order_ready_to_ship,
      number: "R100",
      state: "complete",
      line_items_count: 1
    )
  end

  def visit_order
    visit spree.admin_path
    click_link "Orders"
    within_row(1) do
      click_link "R100"
    end
  end

  context "when some inventory is cancelable" do
    it "can cancel the inventory" do
      visit_order

      click_link 'Cancel Inventory'

      within_row(1) do
        check 'inventory_unit_ids[]'
      end

      click_button "Cancel Inventory"
      expect(page).to have_content("Inventory canceled")
      expect(page).to have_content("1 x canceled")
    end
  end

  context "when all inventory is not cancelable" do
    before { order.inventory_units.each(&:cancel!) }

    it "does not display the link to cancel inventory" do
      visit_order

      expect(page).to have_no_content('Cancel Inventory')
    end
  end
end


text:
.DynarchCalendar,.DynarchCalendar table {
	font-size: 10px;
}

.DynarchCalendar-dayNames {
	padding: 0;
}

.DynarchCalendar-body {
	padding: 0;
}

.DynarchCalendar-animBody-back {
	top: 0;
}

.DynarchCalendar-animBody-fwd {
	top: 0;
}

.DynarchCalendar-animBody-now {
	top: 0;
}

.DynarchCalendar-first-col {
	padding-left: 0;
}

.DynarchCalendar-last-col {
	padding-right: 0;
}

.DynarchCalendar-weekNumber {
	margin-right: 0;
	padding-right: 4px !important;
}

.DynarchCalendar-dayNames div,.DynarchCalendar-day,.DynarchCalendar-weekNumber
	{
	padding: 1px 2px;
}

.DynarchCalendar-menu-year {
	font-size: 12px;
}

.DynarchCalendar-hover-date {
	padding: 0px 1px;
}

.DynarchCalendar-day-selected {
	padding: 0px 1px;
}

.DynarchCalendar-menu table td div {
	padding: 2px 4px;
}

.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
	padding: 1px 3px;
}


text:
<?php

namespace Behat\Testwork\Tester\Setup;

/**
 * Represents a result of test tearDown action.
 *
 * @author Konstantin Kudryashov <ever.zet@gmail.com>
 */
interface Teardown
{
    /**
     * Returns true if fixtures have been handled successfully.
     *
     * @return bool
     */
    public function isSuccessful();

    /**
     * Checks if tear down has produced any output.
     *
     * @return bool
     */
    public function hasOutput();
}


text:
use super::*;
use block::{Block, RcBlock};
use std::mem;

#[cfg(feature = "dispatch_queue")]
use dispatch;

type MTLSharedEventNotificationBlock<'a> = RcBlock<(&'a SharedEventRef, u64), ()>;

pub enum MTLEvent {}

foreign_obj_type! {
    type CType = MTLEvent;
    pub struct Event;
    pub struct EventRef;
}

impl EventRef {
    pub fn device(&self) -> &DeviceRef {
        unsafe { msg_send![self, device] }
    }
}

pub enum MTLSharedEvent {}

foreign_obj_type! {
    type CType = MTLSharedEvent;
    pub struct SharedEvent;
    pub struct SharedEventRef;
    type ParentType = EventRef;
}

impl SharedEventRef {
    pub fn signaled_value(&self) -> u64 {
        unsafe { msg_send![self, signaledValue] }
    }

    pub fn set_signaled_value(&self, new_value: u64) {
        unsafe { msg_send![self, setSignaledValue: new_value] }
    }

    /// Schedules a notification handler to be called after the shareable event's signal value
    /// equals or exceeds a given value.
    pub fn notify(
        &self,
        listener: &SharedEventListenerRef,
        value: u64,
        block: MTLSharedEventNotificationBlock,
    ) {
        unsafe {
            // If the block doesn't have a signature, this segfaults.
            // Taken from https://github.com/servo/pathfinder/blob/e858c8dc1d8ff02a5b603e21e09a64d6b3e11327/metal/src/lib.rs#L2327
            let block = mem::transmute::<
                MTLSharedEventNotificationBlock,
                *mut BlockBase<(&SharedEventRef, u64), ()>,
            >(block);
            (*block).flags |= BLOCK_HAS_SIGNATURE | BLOCK_HAS_COPY_DISPOSE;
            (*block).extra = &BLOCK_EXTRA;
            let () = msg_send![self, notifyListener:listener atValue:value block:block];
            mem::forget(block);
        }

        extern "C" fn dtor(_: *mut BlockBase<(&SharedEventRef, u64), ()>) {}

        const SIGNATURE: &[u8] = b"v16@?0Q8\0";
        const SIGNATURE_PTR: *const i8 = &SIGNATURE[0] as *const u8 as *const i8;
        static mut BLOCK_EXTRA: BlockExtra<(&SharedEventRef, u64), ()> = BlockExtra {
            unknown0: 0 as *mut i32,
            unknown1: 0 as *mut i32,
            unknown2: 0 as *mut i32,
            dtor,
            signature: &SIGNATURE_PTR,
        };
    }
}

pub enum MTLSharedEventListener {}

foreign_obj_type! {
    type CType = MTLSharedEventListener;
    pub struct SharedEventListener;
    pub struct SharedEventListenerRef;
}

impl SharedEventListener {
    pub unsafe fn from_queue_handle(queue: dispatch_queue_t) -> Self {
        let listener: SharedEventListener = msg_send![class!(MTLSharedEventListener), alloc];
        let ptr: *mut Object = msg_send![listener.as_ref(), initWithDispatchQueue: queue];
        if ptr.is_null() {
            panic!("[MTLSharedEventListener alloc] initWithDispatchQueue failed");
        }
        listener
    }

    #[cfg(feature = "dispatch")]
    pub fn from_queue(queue: &dispatch::Queue) -> Self {
        unsafe {
            let raw_queue = std::mem::transmute::<&dispatch::Queue, *const dispatch_queue_t>(queue);
            Self::from_queue_handle(*raw_queue)
        }
    }
}

pub enum MTLFence {}

foreign_obj_type! {
    type CType = MTLFence;
    pub struct Fence;
    pub struct FenceRef;
}

impl FenceRef {
    pub fn device(&self) -> &DeviceRef {
        unsafe { msg_send![self, device] }
    }

    pub fn label(&self) -> &str {
        unsafe {
            let label = msg_send![self, label];
            crate::nsstring_as_str(label)
        }
    }

    pub fn set_label(&self, label: &str) {
        unsafe {
            let nslabel = crate::nsstring_from_str(label);
            let () = msg_send![self, setLabel: nslabel];
        }
    }
}

bitflags! {
    /// The render stages at which a synchronization command is triggered.
    ///
    /// Render stages provide finer control for specifying when synchronization must occur,
    /// allowing for vertex and fragment processing to overlap in execution.
    ///
    /// See <https://developer.apple.com/documentation/metal/mtlrenderstages>
    pub struct MTLRenderStages: NSUInteger {
        /// The vertex rendering stage.
        const Vertex = 1 << 0;
        /// The fragment rendering stage.
        const Fragment = 1 << 1;
        /// The tile rendering stage.
        const Tile = 1 << 2;
    }
}

const BLOCK_HAS_COPY_DISPOSE: i32 = 0x02000000;
const BLOCK_HAS_SIGNATURE: i32 = 0x40000000;

#[repr(C)]
struct BlockBase<A, R> {
    isa: *const std::ffi::c_void,                             // 0x00
    flags: i32,                                               // 0x08
    _reserved: i32,                                           // 0x0c
    invoke: unsafe extern "C" fn(*mut Block<A, R>, ...) -> R, // 0x10
    extra: *const BlockExtra<A, R>,                           // 0x18
}

type BlockExtraDtor<A, R> = extern "C" fn(*mut BlockBase<A, R>);

#[repr(C)]
struct BlockExtra<A, R> {
    unknown0: *mut i32,          // 0x00
    unknown1: *mut i32,          // 0x08
    unknown2: *mut i32,          // 0x10
    dtor: BlockExtraDtor<A, R>,  // 0x18
    signature: *const *const i8, // 0x20
}


text:
package controllers

import (
	"net/http"
	"strconv"

	"models"
)

func HandlerView(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()
	ArticleId, _ := strconv.ParseInt(r.Form["id"][0], 10, 32)
	ArticleID := int(ArticleId)

	myContent, err := models.GetContent(r, ArticleID)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	RenderContent(w, r, myContent, "content")
}


text:
export function getNewVersion() {
  return require('../../package.json').version;
}


text:
<?php
if( basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME']) )
	die( 'This page cannot be called directly.' );

function scoper_object_roles_list( $viewing_user, $args = array() ) {

$html = '';

if ( ! USER_ROLES_RS && ! GROUP_ROLES_RS )
	wp_die(__awp('Cheatin’ uh?'));

$defaults = array( 'enforce_duration_limits' => true, 'is_user_profile' => false, 'echo' => true );
$args = array_merge( $defaults, (array) $args );
extract($args);

global $scoper, $wpdb, $current_user;

if ( $viewing_user ) {
	if ( ! is_object($viewing_user) ) {
		global $current_rs_user;
		if ( $viewing_user == $current_rs_user->ID )
			$viewing_user = $current_rs_user;
		else
			$viewing_user = new WP_Scoped_User($viewing_user);
	}
}

$all_roles = array();
$role_display = array();
foreach ( $scoper->role_defs->get_all_keys() as $role_handle ) {
	if ( $viewing_user )
		$role_display[$role_handle] = $scoper->role_defs->get_display_name( $role_handle, OBJECT_UI_RS );
	else
		$role_display[$role_handle] = $scoper->role_defs->get_abbrev( $role_handle, OBJECT_UI_RS );
}

if ( ! $is_user_profile ) {
	$require_blogwide_editor = scoper_get_option('role_admin_blogwide_editor_only');

	if ( ( 'admin' === $require_blogwide_editor ) && ! is_user_administrator_rs() )
		return false;

	if ( ( 'admin_content' === $require_blogwide_editor ) && ! is_content_administrator_rs() )
		return false;
} else
	$require_blogwide_editor = false;

foreach ( $scoper->data_sources->get_all() as $src_name => $src) {
	$otype_count = 0;

	if ( ! empty($src->taxonomy_only) || ( ($src_name == 'group') && ! $viewing_user ) )
		continue;

	$strict_objects = $scoper->get_restrictions(OBJECT_SCOPE_RS, $src_name);

	foreach ( $src->object_types as $object_type => $otype ) {
		$otype_count++;

		$disable_role_admin = false;
		if ( $require_blogwide_editor ) {
			if ( ! $scoper->user_can_edit_blogwide( 'post', $object_type, array( 'require_others_cap' => true ) ) )
				$disable_role_admin = true;
		}

		if ( ! empty($src->cols->type) && ! empty($otype->name) ) {
			$col_type = $src->cols->type;
			$otype_clause = "AND $src->table.$col_type = '$otype->name'";
		} elseif ( $otype_count < 2 )
			$otype_clause = '';
		else
			continue;

		$col_id = $src->cols->id;
		$col_name = $src->cols->name;

		$ug_clause_for_user_being_viewed = ( $viewing_user ) ? $viewing_user->get_user_clause('uro') : '';

		// TODO: replace join with uro subselect

		$qry = "SELECT DISTINCT $src->table.$col_name, $src->table.$col_id, uro.role_name, uro.date_limited, uro.start_date_gmt, uro.end_date_gmt"
			. " FROM $src->table ";

		$join = " INNER JOIN $wpdb->user2role2object_rs AS uro"
			. " ON uro.obj_or_term_id = $src->table.$col_id"
			. " AND uro.src_or_tx_name = '$src_name'"
			. " AND uro.scope = 'object' AND uro.role_type = 'rs'";

		$duration_clause = ( $enforce_duration_limits ) ? scoper_get_duration_clause( "{$src->table}.{$src->cols->date}" ) : '';

		$status_clause = ( 'post' == $src_name ) ? "AND post_status != 'auto-draft'" : '';	 // TODO: version update script to delete post roles on auto-drafts (stored via default roles)

		$where = " WHERE 1=1 $status_clause $otype_clause $duration_clause $ug_clause_for_user_being_viewed";
		$orderby = " ORDER BY $src->table.$col_name ASC, uro.role_name ASC";

		$qry .= $join . $where . $orderby;

		$results = scoper_get_results( $qry );

		if ( ! is_user_administrator_rs() ) {  // no need to filter admins - just query the assignments

			// only list role assignments which the logged-in user can administer
			$args['required_operation'] = OP_EDIT_RS;

			// Possible TODO: re-implement OP_ADMIN distinction with admin-specific capabilities
			/*
			if ( cr_get_reqd_caps( $src_name, OP_ADMIN_RS, $object_type ) {
				$args['required_operation'] = OP_ADMIN_RS;
			} else {
				$reqd_caps = array();
				foreach (array_keys($src->statuses) as $status_name) {
					$admin_caps = $scoper->cap_defs->get_matching($src_name, $object_type, OP_ADMIN_RS, $status_name);
					$delete_caps = $scoper->cap_defs->get_matching($src_name, $object_type, OP_DELETE_RS, $status_name);
					$reqd_caps[$object_type][$status_name] = array_merge(array_keys($admin_caps), array_keys($delete_caps));
				}
				$args['force_reqd_caps'] = $reqd_caps;
			}
			*/

			$qry = "SELECT $src->table.$col_id FROM $src->table WHERE 1=1";

			$args['require_full_object_role'] = true;
			$qry_flt = apply_filters('objects_request_rs', $qry, $src_name, $object_type, $args);
			$cu_admin_results = scoper_get_col( $qry_flt );

			if ( empty($viewing_user) || ( $current_user->ID != $viewing_user->ID ) ) {
				foreach ( $results as $key => $row )
					if ( ! in_array( $row->$col_id, $cu_admin_results) )
						unset($results[$key]);
			} else {
				// for current user's view of their own user profile, just de-link unadminable objects
				$link_roles = array();
				$link_objects = array();

				if ( ! $disable_role_admin ) {
					foreach ( $results as $key => $row )
						if ( in_array( $row->$col_id, $cu_admin_results) )
							$link_roles[$row->$col_id] = true;

					$args['required_operation'] = OP_EDIT_RS;
					$args['require_full_object_role'] = false;
					if ( isset($args['force_reqd_caps']) ) unset($args['force_reqd_caps']);
					$qry_flt = apply_filters('objects_request_rs', $qry, $src_name, $object_type, $args);
					$cu_edit_results = scoper_get_col( $qry_flt );

					foreach ( $results as $key => $row )
						if ( in_array( $row->$col_id, $cu_edit_results) )
							$link_objects[$row->$col_id] = true;
				}
			}
		}

		$object_roles = array();
		$objnames = array();

		if ( $results ) {
			$got_object_roles = true;

			foreach ( $results as $row ) {
				if ( ! isset($objnames[ $row->$col_id ]) ) {
					if ( 'post' == $src->name )
						$objnames[ $row->$col_id ] = apply_filters( 'the_title', $row->$col_name, $row->$col_id);
					else
						$objnames[ $row->$col_id ] = $row->$col_name;
				}

				$role_handle = 'rs_' . $row->role_name;

				if ( $row->date_limited )
					$duration_key = serialize( array( 'start_date_gmt' => $row->start_date_gmt, 'end_date_gmt' => $row->end_date_gmt ) );
				else
					$duration_key = '';

				$object_roles[$duration_key][ $row->$col_id ] [ $role_handle ] = true;
			}
		} else
			continue;
		?>

		<?php
		$title_roles = __('edit roles', 'scoper');

		foreach ( array_keys($object_roles) as $duration_key ) {
			$date_caption = '';
			$limit_class = '';
			$limit_style = '';
			$link_class = '';

			if ( $duration_key ) {
				$html .= "
$date_caption
";

				$duration_limits = unserialize( $duration_key );
				$duration_limits[ 'date_limited' ] = true;

				ScoperAdminUI::set_agent_formatting( $duration_limits, $date_caption, $limit_class, $link_class, $limit_style );
				$title = "title='$date_caption'";
				$date_caption = ' ' . trim($date_caption) . '';
			} else
				$title = "title='$title_roles'";

			if ( ! $disable_role_admin && ( is_user_administrator_rs() || $cu_admin_results ) ) {
				//if ( ( $src_name != $object_type ) && ( 'post' != $object_type ) ) {  // menu links currently assume unique object type names
				//	$roles_page = "rs-roles-{$object_type}_{$src_name}";
				//} else {
					$roles_page = "rs-{$object_type}-roles";
				//}

				$url = "admin.php?page=$roles_page";
				$html .= "
" . sprintf( __('%1$s Roles%2$s:', 'scoper'), $otype->labels->singular_name, '' . $date_caption) . "
";
			} else
				$html .= "
" . sprintf( __('%1$s Roles%2$s:', 'scoper'), $otype->labels->singular_name, $date_caption) . "
";

			$html .=
			"

"

			. "
"
			. "
"
			. "
"
			. "	" . __('ID') . "	"
			. "	" . __awp('Name') . "	"
			. "	" . __('Role Assignments', 'scoper') . "	"
			. "
"
			. "
";

			$id_clause = ( isset( $role_codes[$role_handle] ) ) ? "id='roles-{$role_codes[$role_handle]}'" : '';
			$html .= "
";

			$style = ' class="rs-backwhite"';

			$title_item = sprintf( __('edit %s', 'scoper'), agp_strtolower( $otype->labels->singular_name ) );

			foreach ( $object_roles[$duration_key] as $obj_id => $roles ) {
				$object_name = esc_attr($objnames[$obj_id]);

				$html .= "\n\t
";

				$link_this_object = ( ! isset($link_objects) || isset($link_objects[$obj_id]) );

				// link from object ID to the object type's default editor, if defined
				if ( $link_this_object && ! empty($src->edit_url) ) {
					$src_edit_url = sprintf($src->edit_url, $obj_id);
					$html .= "$obj_id	";
				} else
					$html .= "$obj_id	";

				$name = ( ! empty($objnames[$obj_id]) ) ? $objnames[$obj_id] : __( '(untitled)', 'scoper' );

				// link from object name to our "Edit Object Role Assignment" interface
				$link_this_role = ( ! isset($link_roles) || isset($link_roles[$obj_id]) );

				if ( $link_this_role ) {
					if ( 'group' == $object_type )
						$rs_edit_url = sprintf($src->edit_url, $obj_id);
					else
						$rs_edit_url = "admin.php?page=rs-object_role_edit&src_name=$src_name&object_type=$object_type&object_id=$obj_id&object_name=$object_name";

					$html .= "\n\t$name	";
				} else
					$html .= "\n\t$name	";

				$html .= "";

				$role_list = array();
				foreach ( array_keys($roles) as $role_handle ) {
					// roles which require object assignment are asterisked (bolding would contradict the notation of term roles list, where propogating roles are bolded)
					if ( isset($strict_objects['restrictions'][$role_handle][$obj_id])
					|| ( isset($strict_objects['unrestrictions'][$role_handle]) && is_array($strict_objects['unrestrictions'][$role_handle]) && ! isset($strict_objects['unrestrictions'][$role_handle][$obj_id]) ) )
						$role_list[] = "" . $role_display[$role_handle] . '';
					else
						$role_list[] = $role_display[$role_handle];
				}

				$html .=( implode(', ', $role_list) );
				$html .= '
';

				$style = ( ' class="alternate"' == $style ) ? ' class="rs-backwhite"' : ' class="alternate"';
			} // end foreach object_roles

			$html .= '

';
			$html .= '

';

		} // end foreach role date range

	} // end foreach object_types

} // end foreach data source

if ( $echo )
	echo $html;
else
	return $html;

} // end wrapper function

?>


text:
using Base.Order: Forward, Ordering, lt

const DefaultReverseOrdering = Base.ReverseOrdering{Base.ForwardOrdering}

# Heap operations on flat arrays
# ------------------------------

# Binary heap indexing
heapleft(i::Integer) = 2i
heapright(i::Integer) = 2i + 1
heapparent(i::Integer) = div(i, 2)

# Binary min-heap percolate down.
function percolate_down!(xs::AbstractArray, i::Integer, x=xs[i], o::Ordering=Forward, len::Integer=length(xs))
    @inbounds while (l = heapleft(i)) <= len
        r = heapright(i)
        j = r > len || lt(o, xs[l], xs[r]) ? l : r
        lt(o, xs[j], x) || break
        xs[i] = xs[j]
        i = j
    end
    xs[i] = x
end

percolate_down!(xs::AbstractArray, i::Integer, o::Ordering, len::Integer=length(xs)) = percolate_down!(xs, i, xs[i], o, len)

# Binary min-heap percolate up.
function percolate_up!(xs::AbstractArray, i::Integer, x=xs[i], o::Ordering=Forward)
    @inbounds while (j = heapparent(i)) >= 1
        lt(o, x, xs[j]) || break
        xs[i] = xs[j]
        i = j
    end
    xs[i] = x
end

@inline percolate_up!(xs::AbstractArray, i::Integer, o::Ordering) = percolate_up!(xs, i, xs[i], o)

"""
    heappop!(v, [ord])

Given a binary heap-ordered array, remove and return the lowest ordered element.
For efficiency, this function does not check that the array is indeed heap-ordered.
"""
function heappop!(xs::AbstractArray, o::Ordering=Forward)
    x = xs[1]
    y = pop!(xs)
    if !isempty(xs)
        percolate_down!(xs, 1, y, o)
    end
    return x
end

"""
    heappush!(v, x, [ord])

Given a binary heap-ordered array, push a new element `x`, preserving the heap property.
For efficiency, this function does not check that the array is indeed heap-ordered.
"""
@inline function heappush!(xs::AbstractArray, x, o::Ordering=Forward)
    push!(xs, x)
    percolate_up!(xs, length(xs), o)
    return xs
end

# Turn an arbitrary array into a binary min-heap (by default) in linear time.
"""
    heapify!(v, ord::Ordering=Forward)

In-place [`heapify`](@ref).
"""
function heapify!(xs::AbstractArray, o::Ordering=Forward)
    for i in heapparent(length(xs)):-1:1
        percolate_down!(xs, i, o)
    end
    return xs
end

"""
    heapify(v, ord::Ordering=Forward)

Returns a new vector in binary heap order, optionally using the given ordering.
```jldoctest
julia> a = [1,3,4,5,2];

julia> heapify(a)
5-element Array{Int64,1}:
 1
 2
 4
 5
 3

julia> heapify(a, Base.Order.Reverse)
5-element Array{Int64,1}:
 5
 3
 4
 1
 2
```
"""
# Todo, benchmarking shows copy(xs) outperforms copyto!(similar(xs), xs) for 10^6 Float64
heapify(xs::AbstractArray, o::Ordering=Forward) = heapify!(copyto!(similar(xs), xs), o)

"""
    isheap(v, ord::Ordering=Forward)

Return `true` if an array is heap-ordered according to the given order.

```jldoctest
julia> a = [1,2,3]
3-element Vector{Int64}:
 1
 2
 3

julia> isheap(a,Base.Order.Forward)
true

julia> isheap(a,Base.Order.Reverse)
false
```
"""
function isheap(xs::AbstractArray, o::Ordering=Forward)
    for i in 1:div(length(xs), 2)
        if lt(o, xs[heapleft(i)], xs[i]) ||
           (heapright(i) <= length(xs) && lt(o, xs[heapright(i)], xs[i]))
            return false
        end
    end
    return true
end


text:
`podex` is a command line tool to bootstrap a kubernetes container manifests from docker image metadata.

Manifests can then be edited by a human to match deployment needs.

## Usage
```
$ podex [-json|-yaml] [-id PODNAME] IMAGES...

$ podex -json [-id PODNAME] IMAGES... > pod.json
$ podex -yaml [-id PODNAME] IMAGES... > pod.yaml
```

### Options
- `id`: set the pod name (required with multiple images, optional with single image: default to image base name)
- `json`: puts the container manifest into JSON format
- `yaml`: puts the container manifest into YAML format

### Examples
```
$ podex -json google/nodejs-hello > pod.yaml
$ podex -yaml -id nodejs-nginx google/nodejs-hello nginx > pod.yaml
```

## TODOs
- [ ] option generate a full pod manifest (w/ `desired state`)
- [ ] option to merge multiple container manifest into one pod
- [ ] docker run flags support
- [ ] option to generate service bindings from links


text:
from datetime import datetime

from django.test import TestCase
from django.contrib.auth.models import User

from actstream.models import Action
from actstream.signals import action

class TestAppTests(TestCase):

    def setUp(self):
        self.user = User.objects.create(username='test')
        action.send(self.user, verb='was created')

    def test_accessor(self):
        self.assertEqual(len(Action.objects.testfoo(self.user)), 1)
        self.assertEqual(len(Action.objects.testfoo(self.user, datetime(1970, 1, 1))), 0)

    def test_mystream(self):
        self.assertEqual(len(self.user.actor_actions.testbar('was created')), 1)
        self.assertEqual(len(self.user.action_object_actions.testbar('was created')), 0)

    def test_jsonfield(self):
        action.send(self.user, verb='said', text='foobar', tags=['sayings'],
                    more_data={'pk': self.user.pk})
        newaction = Action.objects.filter(verb='said')[0]
        self.assertEqual(newaction.data['text'], 'foobar')
        self.assertEqual(newaction.data['tags'], ['sayings'])
        self.assertEqual(newaction.data['more_data'], {'pk': self.user.pk})


text:
package org.spongepowered.api.util.event.factory;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.closeTo;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertThat;

import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.SpongeEventFactory;
import org.spongepowered.api.scoreboard.objective.Objective;
import org.spongepowered.api.util.annotation.TransformResult;
import org.spongepowered.api.util.annotation.TransformWith;

import static org.mockito.Mockito.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import javax.annotation.Nullable;

public class ClassGeneratorProviderTest {

    private static final double ERROR = 0.03;

    private ClassGeneratorProvider createProvider() {
        return new ClassGeneratorProvider("org.spongepowered.test");
    }

    @Test
    public void testCreate_ModifierMethodInterface() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<ModifiedMethodInterface> factory = provider.create(ModifiedMethodInterface.class, Object.class);

        Map<String, Object> values = Maps.newHashMap();

        ModifiedMethodInterface result = factory.apply(values);

        assertNotSame(result.getNewModifierClass(), result);
        assertNotSame(result.getOtherModifierClass(), result);
    }

    @Test
    public void testCreate_Primitives() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<PrimitiveContainer> factory = provider.create(PrimitiveContainer.class, Object.class);
        Map<String, Object> values = Maps.newHashMap();
        values.put("byte", (byte) 10);
        values.put("short", (short) 11);
        values.put("int", 12);
        values.put("long", 13L);
        values.put("float", (float) 14.5);
        values.put("double", 15.5);
        values.put("boolean", true);
        values.put("char", (char) 17);

        PrimitiveContainer result = factory.apply(values);

        assertThat(result.getByte(), is((byte) 10));
        assertThat(result.getShort(), is((short) 11));
        assertThat(result.getInt(), is(12));
        assertThat(result.getLong(), is(13L));
        assertThat((double) result.getFloat(), is(closeTo(14.5, ERROR)));
        assertThat(result.getDouble(), is(closeTo(15.5, ERROR)));
        assertThat(result.getBoolean(), is(true));
        assertThat(result.getChar(), is((char) 17));

        result.setByte((byte) 20);
        result.setShort((short) 21);
        result.setInt(22);
        result.setLong(23L);
        result.setFloat((float) 24.5);
        result.setDouble(25.5);
        result.setBoolean(false);
        result.setChar((char) 27);

        assertThat(result.getByte(), is((byte) 20));
        assertThat(result.getShort(), is((short) 21));
        assertThat(result.getInt(), is(22));
        assertThat(result.getLong(), is(23L));
        assertThat((double) result.getFloat(), is(closeTo(24.5, ERROR)));
        assertThat(result.getDouble(), is(closeTo(25.5, ERROR)));
        assertThat(result.getBoolean(), is(false));
        assertThat(result.getChar(), is((char) 27));
    }

    @Test
    public void testCreate_UnsetPrimitives() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<PrimitiveContainer> factory = provider.create(PrimitiveContainer.class, Object.class);
        PrimitiveContainer result = factory.apply(Collections.<String, Object>emptyMap());

        assertThat(result.getByte(), is((byte) 0));
        assertThat(result.getShort(), is((short) 0));
        assertThat(result.getInt(), is(0));
        assertThat(result.getLong(), is(0L));
        assertThat((double) result.getFloat(), is(closeTo(0, ERROR)));
        assertThat(result.getDouble(), is(closeTo(0, ERROR)));
        assertThat(result.getBoolean(), is(false));
        assertThat(result.getChar(), is((char) 0));
    }

    @Test(expected = NullPointerException.class)
    public void testCreate_UnsetPrimitivesWithNonNull() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        provider.setNullPolicy(NullPolicy.NON_NULL_BY_DEFAULT);
        EventFactory<PrimitiveContainer> factory = provider.create(PrimitiveContainer.class, Object.class);
        factory.apply(Collections.<String, Object>emptyMap());
    }

    @Test
    public void testCreate_BoxedPrimitives() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<BoxedPrimitiveContainer> factory = provider.create(BoxedPrimitiveContainer.class, Object.class);
        Map<String, Object> values = Maps.newHashMap();
        values.put("byte", (byte) 10);
        values.put("short", (short) 11);
        values.put("int", 12);
        values.put("long", 13L);
        values.put("float", (float) 14.5);
        values.put("double", 15.5);
        values.put("boolean", true);
        values.put("char", (char) 17);

        BoxedPrimitiveContainer result = factory.apply(values);

        assertThat(result.getByte(), is((byte) 10));
        assertThat(result.getShort(), is((short) 11));
        assertThat(result.getInt(), is(12));
        assertThat(result.getLong(), is(13L));
        assertThat((double) result.getFloat(), is(closeTo(14.5, ERROR)));
        assertThat(result.getDouble(), is(closeTo(15.5, ERROR)));
        assertThat(result.getBoolean(), is(true));
        assertThat(result.getChar(), is((char) 17));

        result.setByte((byte) 20);
        result.setShort((short) 21);
        result.setInt(22);
        result.setLong(23L);
        result.setFloat((float) 24.5);
        result.setDouble(25.5);
        result.setBoolean(false);
        result.setChar((char) 27);

        assertThat(result.getByte(), is((byte) 20));
        assertThat(result.getShort(), is((short) 21));
        assertThat(result.getInt(), is(22));
        assertThat(result.getLong(), is(23L));
        assertThat((double) result.getFloat(), is(closeTo(24.5, ERROR)));
        assertThat(result.getDouble(), is(closeTo(25.5, ERROR)));
        assertThat(result.getBoolean(), is(false));
        assertThat(result.getChar(), is((char) 27));

        result.setByte(null);
        result.setShort(null);
        result.setInt(null);
        result.setLong(null);
        result.setFloat(null);
        result.setDouble(null);
        result.setBoolean(null);
        result.setChar(null);

        assertThat(result.getByte(), is(nullValue()));
        assertThat(result.getShort(), is(nullValue()));
        assertThat(result.getInt(), is(nullValue()));
        assertThat(result.getLong(), is(nullValue()));
        assertThat(result.getFloat(), is(nullValue()));
        assertThat(result.getDouble(), is(nullValue()));
        assertThat(result.getBoolean(), is(nullValue()));
        assertThat(result.getChar(), is(nullValue()));
    }

    @Test
    public void testCreate_Arrays() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<ArrayContainer> factory = provider.create(ArrayContainer.class, Object.class);

        Object object = new Object();

        Map<String, Object> values = Maps.newHashMap();
        values.put("bytes", new byte[]{1});
        values.put("shorts", new short[]{2});
        values.put("ints", new int[]{3});
        values.put("longs", new long[]{4});
        values.put("floats", new float[0]);
        values.put("doubles", new double[0]);
        values.put("booleans", new boolean[]{true});
        values.put("chars", new char[]{'a'});
        values.put("objects", new Object[]{object});

        ArrayContainer result = factory.apply(values);

        assertThat(result.getBytes(), is(new byte[]{1}));
        assertThat(result.getShorts(), is(new short[]{2}));
        assertThat(result.getInts(), is(new int[]{3}));
        assertThat(result.getLongs(), is(new long[]{4}));
        assertThat(result.getFloats(), is(new float[0]));
        assertThat(result.getDoubles(), is(new double[0]));
        assertThat(result.getBooleans(), is(new boolean[]{true}));
        assertThat(result.getChars(), is(new char[]{'a'}));
        assertThat(result.getObjects(), is(new Object[]{object}));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreate_ExcessParameters() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<ExcessParametersContainer> factory = provider.create(ExcessParametersContainer.class, Object.class);

        Map<String, Object> values = Maps.newHashMap();
        values.put("name", "Jon");
        values.put("age", 8);

        factory.apply(values);
    }

    @Test
    public void testCreate_Inheritance() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<ChildContainer> factory = provider.create(ChildContainer.class, Object.class);

        Map<String, Object> values = Maps.newHashMap();
        values.put("name", "Eduardo");
        values.put("age", 25);
        values.put("heatCapacity", 20);
        values.put("height", 6);
        values.put("temperature", 99);

        ChildContainer result = factory.apply(values);

        assertThat(result.getName(), is(equalTo("Eduardo")));
        assertThat(result.getAge(), is(25));
        assertThat(result.getHeatCapacity(), is(20));
        assertThat(result.getHeight(), is(6));
        assertThat(result.getTemperature(), is(99));

        result.setName("Brandon");
        result.setAge(30);

        assertThat(result.getName(), is(equalTo("Brandon")));
        assertThat(result.getAge(), is(30));
        assertThat(result.getHeatCapacity(), is(20));
        assertThat(result.getHeight(), is(6));
        assertThat(result.getTemperature(), is(99));
    }

    @Test(expected = AbstractMethodError.class)
    public void testCreate_NonConformingAccessor() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<NonConformingAccessorContainer> factory = provider.create(NonConformingAccessorContainer.class, Object.class);

        NonConformingAccessorContainer result = factory.apply(Collections.<String, Object>emptyMap());
        result.setName("Joey");
        assertThat(result.getName(0), is(Matchers.nullValue())); // Nonconforming method
    }

    @Test(expected = AbstractMethodError.class)
    public void testCreate_NonConformingMutator() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<NonConformingMutatorContainer> factory = provider.create(NonConformingMutatorContainer.class, Object.class);

        NonConformingMutatorContainer result = factory.apply(Collections.<String, Object>emptyMap());
        assertThat(result.getName(), is(Matchers.nullValue()));
        result.setName("Joey"); // Nonconforming method
    }

    @Test(expected = AbstractMethodError.class)
    public void testCreate_IncorrectMutator() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<IncorrectMutatorContainer> factory = provider.create(IncorrectMutatorContainer.class, Object.class);

        IncorrectMutatorContainer result = factory.apply(Collections.<String, Object>emptyMap());
        assertThat(result.getAddress(), is(Matchers.nullValue()));
        result.setAddress(new ArrayList<Object>()); // Nonconforming method
    }

    @Test
    public void testCreate_AbstractImpl() throws Exception {
        ClassGeneratorProvider provider = createProvider();
        EventFactory<AbstractImplContainer> factory = provider.create(AbstractImplContainer.class, AbstractImpl.class);

        Map<String, Object> values = Maps.newHashMap();
        values.put("age", 56);

        AbstractImplContainer result = factory.apply(values);

        assertThat(result.getName(), is(equalTo("Bobby")));
        assertThat(result.getAge(), is(56));
        assertThat(((AbstractImpl) result).isCool(), is(true));

        result.setName("Nathaniel");

        assertThat(result.getName(), is(equalTo("Nathaniel Iceman")));
        assertThat(result.getAge(), is(56));
        assertThat(((AbstractImpl) result).isCool(), is(true));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreate_AbstractImplAndExcessParams() throws Exception {
        Map<String, Object> values = Maps.newHashMap();
        values.put("name", "Vincent");
        values.put("age", 56);
        values.put("cool", false);

        ClassGeneratorProvider provider = createProvider();
        EventFactory<AbstractImplContainer> factory = provider.create(AbstractImplContainer.class, AbstractImpl.class);
        factory.apply(values);
    }

    @Test
    public void testCreate_OptionalGetter() {
        Map<String, Object> values = Maps.newHashMap();
        values.put("name", Optional.fromNullable("MyName"));

        ClassGeneratorProvider provider = createProvider();
        EventFactory<OptionalGetter> factory = provider.create(OptionalGetter.class, Object.class);
        OptionalGetter getter = factory.apply(values);

        assertThat(getter.getName().isPresent(), is(true));
        assertThat(getter.getName().get(), is(Matchers.equalTo("MyName")));

        getter.setName(null);
        assertThat(getter.getName().isPresent(), is(false));

        getter.setName("Aaron");

        assertThat(getter.getName().isPresent(), is(true));
        assertThat(getter.getName().get(), is(Matchers.equalTo("Aaron")));
    }

    public interface OptionalGetter {

        Optional<String> getName();

        void setName(@Nullable String name);
    }

    public interface PrimitiveContainer {

        byte getByte();

        void setByte(byte v);

        short getShort();

        void setShort(short v);

        int getInt();

        void setInt(int v);

        long getLong();

        void setLong(long v);

        float getFloat();

        void setFloat(float v);

        double getDouble();

        void setDouble(double v);

        boolean getBoolean();

        void setBoolean(boolean v);

        char getChar();

        void setChar(char v);
    }

    public interface BoxedPrimitiveContainer {

        Byte getByte();

        void setByte(Byte v);

        Short getShort();

        void setShort(Short v);

        Integer getInt();

        void setInt(Integer v);

        Long getLong();

        void setLong(Long v);

        Float getFloat();

        void setFloat(Float v);

        Double getDouble();

        void setDouble(Double v);

        Boolean getBoolean();

        void setBoolean(Boolean v);

        Character getChar();

        void setChar(Character v);
    }

    public interface ArrayContainer {

        byte[] getBytes();

        void setBytes(byte[] v);

        short[] getShorts();

        void setShorts(short[] v);

        int[] getInts();

        void setInts(int[] v);

        long[] getLongs();

        void setLongs(long[] v);

        float[] getFloats();

        void setFloats(float[] v);

        double[] getDoubles();

        void setDoubles(double[] v);

        boolean[] getBooleans();

        void setBooleans(boolean[] v);

        char[] getChars();

        void setChars(char[] v);

        Object[] getObjects();

        void setObjects(Object[] v);
    }

    public interface ExcessParametersContainer {

        String getName();

        String setName(String name);
    }

    public interface Parent1AContainer {

        String getName();

        void setName(String name);
    }

    public interface Parent1BContainer {

        int getAge();

        int getHeatCapacity();
    }

    public interface Parent2AContainer extends Parent1AContainer {

        int getAge();

        int getHeight();
    }

    public interface Parent2BContainer extends Parent1AContainer {

        void setAge(int age);
    }

    public interface ChildContainer extends Parent2AContainer, Parent2BContainer, Parent1BContainer {

        int getTemperature();
    }

    public interface NonConformingAccessorContainer {

        String getName(int index);

        void setName(String name);
    }

    public interface NonConformingMutatorContainer {

        String getName();

        String setName(String name);
    }

    public interface IncorrectMutatorContainer {

        List<?> getAddress();

        void setAddress(ArrayList<?> address);
    }

    public interface AbstractImplContainer {

        String getName();

        void setName(String name);

        int getAge();

        void setAge(int age);
    }

    public static class AbstractImpl {

        private String name = "Bobby";

        public String getName() {
            return this.name;
        }

        public void setName(String name) {
            this.name = name + " Iceman";
        }

        public boolean isCool() {
            return true;
        }
    }

    public interface ModifiedMethodInterface {

        @TransformResult
        ModifierClass getNewModifierClass();

        @TransformResult("foo")
        ModifierClass getOtherModifierClass();

    }

    public class ModifierClass {

        @TransformWith
        public ModifierClass copy() {
            return new ModifierClass();
        }

        @TransformWith("foo")
        public ModifierClass copy2() {
            return new ModifierClass();
        }
    }

}


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>get_filename_component — CMake 3.7.2 Documentation</title>

    <link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
    <link rel="top" title="CMake 3.7.2 Documentation" href="../index.html" />
    <link rel="up" title="cmake-commands(7)" href="../manual/cmake-commands.7.html" />
    <link rel="next" title="get_property" href="get_property.html" />
    <link rel="prev" title="get_directory_property" href="get_directory_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.7.2 Documentation »

cmake-commands(7) »

get_filename_component¶

Get a specific component of a full filename.

get_filename_component(<VAR> <FileName> <COMP> [CACHE])

Set <VAR> to a component of <FileName>, where <COMP> is one of:

DIRECTORY = Directory without file name
NAME      = File name without directory
EXT       = File name longest extension (.b.c from d/a.b.c)
NAME_WE   = File name without directory or longest extension
PATH      = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)

Paths are returned with forward slashes and have no trailing slashes.
The longest file extension is always considered.  If the optional
CACHE argument is specified, the result variable is added to the
cache.

get_filename_component(<VAR> <FileName>
                       <COMP> [BASE_DIR <BASE_DIR>]
                       [CACHE])

Set <VAR> to the absolute path of <FileName>, where <COMP> is one
of:

ABSOLUTE  = Full path to file
REALPATH  = Full path to existing file with symlinks resolved

If the provided <FileName> is a relative path, it is evaluated relative
to the given base directory <BASE_DIR>.  If no base directory is
provided, the default base directory will be
CMAKE_CURRENT_SOURCE_DIR.

Paths are returned with forward slashes and have no trailing slahes.  If the
optional CACHE argument is specified, the result variable is added to the
cache.

get_filename_component(<VAR> <FileName>
                       PROGRAM [PROGRAM_ARGS <ARG_VAR>]
                       [CACHE])

The program in <FileName> will be found in the system search path or
left as a full path.  If PROGRAM_ARGS is present with PROGRAM, then
any command-line arguments present in the <FileName> string are split
from the program name and stored in <ARG_VAR>.  This is used to
separate a program name from its arguments in a command line string.

Previous topic

get_directory_property

Next topic

get_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          next |

          previous |

    CMake »

    3.7.2 Documentation »

cmake-commands(7) »

        © Copyright 2000-2016 Kitware, Inc. and Contributors.
      Created using Sphinx 1.4a0+.


text:
from scipy.io import savemat
import numpy, glob, sys, os
from PIL import Image

def generate_dataset(folder,target):
  print folder
  max_count = 0
  for (root, dirs, files) in os.walk(folder):
    for f in files:
      if f.endswith('.png'):
          max_count+=1

  print 'Found %s files'%(max_count,)
  data = numpy.zeros((28,28,max_count))
  labels = numpy.zeros((max_count,))
  count = 0
  for (root, dirs, files) in os.walk(folder):
    for f in files:
      if f.endswith('.png'):
        try:
          img = Image.open(os.path.join(root,f));
          data[:,:,count]=numpy.asarray(img)
          surround_folder = os.path.split(root)[-1]
          assert len(surround_folder)==1
          labels[count]=ord(surround_folder)-ord('A')
          count+=1
        except:
          pass

  print 'Saving to '+target
  savemat(target,{'images':data[:,:,:count],'labels':labels[:count]})

def main(argv):
  generate_dataset(argv[1],argv[2])

if __name__=='__main__':
  main(sys.argv)


text:
default: help

help:
	@echo make install - Install the scripts to $(HOME)/bin
	@echo make clean - Remove the scripts

clean:
	rm -f "$(HOME)/bin/git-state"
	rm -f "$(HOME)/bin/git-ps1.sh"

install:
	@PWD=`pwd`
	ln -s "$(PWD)/bin/git-state" "$(HOME)/bin/git-state"
	ln -s "$(PWD)/git-ps1.sh" "$(HOME)/bin/git-ps1.sh"

.PHONY: clean install


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Owin;

namespace HipsterTechnologies.API.Main
{
    /// <summary>
    /// OWIN startup class.
    /// </summary>
    public class Startup
    {
        /// <summary>
        /// Instructs OWIN to use our NancyFX app.
        /// </summary>
        /// <param name="app">The OWIN app.</param>
        public void Configuration(IAppBuilder app)
        {
            app.UseNancy();
        }
    }
}