text:
/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.plugin.defaultresourcepack;

import java.util.*;

import net.java.sip.communicator.service.resources.*;

/**
 * The default color resource pack.
 *
 * @author Damian Minkov
 * @author Yana Stamcheva
 */
public class DefaultColorPackImpl
    implements ColorPack
{
    private static final String DEFAULT_RESOURCE_PATH
        = "resources.colors.colors";

    /**
     * Returns a <tt>Map</tt>, containing all [key, value] pairs for this
     * resource pack.
     *
     * @return a <tt>Map</tt>, containing all [key, value] pairs for this
     * resource pack.
     */
    public Map<String, String> getResources()
    {
        ResourceBundle resourceBundle
            = ResourceBundle.getBundle(DEFAULT_RESOURCE_PATH);

        Map<String, String> resources = new TreeMap<String, String>();

        this.initResources(resourceBundle, resources);

        this.initPluginResources(resources);

        return resources;
    }

    /**
     * Returns the name of this resource pack.
     *
     * @return the name of this resource pack.
     */
    public String getName()
    {
        return "Default Color Resources";
    }

    /**
     * Returns the description of this resource pack.
     *
     * @return the description of this resource pack.
     */
    public String getDescription()
    {
        return "Provide Jitsi default color resource pack.";
    }

    /**
     * Fills the given resource map with all (key,value) pairs obtained from the
     * given <tt>ResourceBundle</tt>. This method will look in the properties
     * files for references to other properties files and will include in the
     * final map data from all referenced files.
     *
     * @param resourceBundle The initial <tt>ResourceBundle</tt>, corresponding
     * to the "main" properties file.
     * @param resources A <tt>Map</tt> that would store the data.
     */
    private void initResources( ResourceBundle resourceBundle,
                                Map<String, String> resources)
    {
        Enumeration<String> colorKeys = resourceBundle.getKeys();

        while (colorKeys.hasMoreElements())
        {
            String key = colorKeys.nextElement();
            String value = resourceBundle.getString(key);

            resources.put(key, value);
        }
    }

    /**
     * Finds all plugin color resources, matching the "colors-*.properties"
     * pattern and adds them to this resource pack.
     */
    private void initPluginResources(Map<String, String> resources)
    {
        Iterator<String> pluginProperties = DefaultResourcePackActivator
            .findResourcePaths(   "resources/colors",
                                    "colors-*.properties");

        while (pluginProperties.hasNext())
        {
            String resourceBundleName = pluginProperties.next();

            ResourceBundle resourceBundle
                = ResourceBundle.getBundle(
                    resourceBundleName.substring(
                        0, resourceBundleName.indexOf(".properties")));

            initResources(resourceBundle, resources);
        }
    }
}


text:
var BootParser = require('../../lib/bootparser');

//BootParser.searchBootJs(testRootPath);

var jsParseResult = BootParser.build({

	// Set the root path for all paths.
	basePath: require("path").resolve(__dirname , "data"),
	path: 'test.js',
	js: 'build/test.js',
	css: 'build/test.css',
	images: 'build/images/',
	// print: function (type, content, path) {
		// if(type == 'js'){
			// content = content.print_to_string(this.options);
		// }
		// console.log("[" +  type + "]", content);
	// },
	jsOptions: {
		"beautify": true,
		"comments": true
	},
	init: function () {

		// The default path equals to '.'
		//context.include.basePath = testRootPath;

		// The default path equals to '~'.
		//context.include.currentPath = testRootPath;

	}
});

//console.log("-----------------------------------------------");
//console.log(jsParseResult.output);
//console.log(jsParseResult.refs);
//console.log(jsParseResult.ast.print_to_string({"beautify": true, "comments": true}));
//console.log("-----------------------------------------------");

redpajama_set_name: RedPajamaGithub


text:
let sections = [
  {depth: 0, title: 'Modern JavaScript', slug: 'modern_javascript', componentName: 'ModernJavascript'},
  {depth: 1, title: 'ES6', slug: 'es6', componentName: 'ES6'},

  {depth: 2, title: 'Block Scoped Declarations', slug: 'block_scoped_declarations', componentName: 'BlockScopedDeclarations'},
  {depth: 2, title: 'Fat Arrow Functions', slug: 'fat_arrow_functions', componentName: 'FatArrowFunctions'},
  {depth: 2, title: 'Destructuring', slug: 'destructuring', componentName: 'Destructuring'},
  {depth: 2, title: 'Imports and Exports', slug: 'imports_and_exports', componentName: 'ImportsAndExports'},
  {depth: 2, title: 'Default Parameters', slug: 'default_parameters', componentName: 'DefaultParameters'},
  {depth: 2, title: 'Classes', slug: 'classes', componentName: 'Classes'},
  {depth: 2, title: 'Dynamic Object Keys', slug: 'dynamic_object_keys', componentName: 'DynamicObjectKeys'},
  {depth: 2, title: 'Array Spread', slug: 'array_spread', componentName: 'ArraySpread'},

  {depth: 1, title: 'ES7 and Beyond', slug: 'es7_and_beyond', componentName: 'ES7AndBeyond'},
  {depth: 2, title: 'Static Class Properties', slug: 'static_class_properties', componentName: 'StaticClassProperties'},
  {depth: 2, title: 'Bound Instance Methods', slug: 'bound_instance_methods', componentName: 'BoundInstanceMethods'},
  {depth: 2, title: 'Object Spread', slug: 'object_spread', componentName: 'ObjectSpread'},
  {depth: 2, title: 'Async and Await', slug: 'async_await', componentName: 'AsyncAwait'},
  {depth: 1, title: 'JSX', slug: 'jsx', componentName: 'JSX'},

  {depth: 0, title: 'React Components', slug: 'components', componentName: 'Component'},
  {depth: 1, title: 'Component API', slug: 'component_api', componentName: 'ComponentAPI'},
  {depth: 1, title: 'Lifecycle API', slug: 'lifecycle_api', componentName: 'LifecycleAPI'},

  {depth: 0, title: 'Core Components', slug: 'core_components', componentName: 'CoreComponents'},
  {depth: 1, title: 'View', slug: 'view', componentName: 'View'},
  {depth: 1, title: 'Flexbox', slug: 'flexbox', componentName: 'Flexbox'},
  {depth: 1, title: 'Text', slug: 'text', componentName: 'Text'},
  {depth: 1, title: 'Image', slug: 'image', componentName: 'Image'},
  {depth: 1, title: 'ScrollView', slug: 'scrollview', componentName: 'ScrollView'},
  {depth: 1, title: 'ListView', slug: 'listview', componentName: 'ListView'},

  {depth: 0, title: 'Component Libraries', slug: 'component_libraries', componentName: 'ComponentLibraries'},
  {depth: 1, title: 'Shoutem UI', slug: 'shoutem_ui', componentName: 'ShoutemUI'},
  {depth: 2, title: 'Themes', slug: 'shoutem_ui_theme', componentName: 'ShoutemUITheme', fullTitle: 'Shoutem Themes'},
  {depth: 2, title: 'Animation', slug: 'shoutem_ui_animation', componentName: 'ShoutemUIAnimation', fullTitle: 'Shoutem Animation'},

  {depth: 0, title: 'Data Management', slug: 'data', componentName: 'Data'},
  {depth: 1, title: 'Component State', slug: 'data_component_state', componentName: 'ComponentState'},
  {depth: 1, title: 'Redux', slug: 'redux', componentName: 'Redux'},
  {depth: 2, title: 'React Redux', slug: 'react_redux', componentName: 'ReactRedux'},
  {depth: 1, title: 'GraphQL', slug: 'graphql', componentName: 'GraphQL'},
  {depth: 1, title: 'Realm', slug: 'realm', componentName: 'Realm'},
  // {depth: 1, title: 'Firebase', slug: 'firebase_data'},

  {depth: 0, title: 'Persistence', slug: 'persistence', componentName: 'Persistence'},
  {depth: 1, title: 'AsyncStorage', slug: 'asyncstorage', componentName: 'AsyncStorage'},
  {depth: 1, title: 'Redux Persist', slug: 'redux_persist', componentName: 'ReduxPersist'},

  {depth: 0, title: 'Networking', slug: 'networking', componentName: 'Networking'},
  {depth: 1, title: 'With Redux', slug: 'networking_redux', componentName: 'NetworkingRedux', fullTitle: 'Networking with Redux'},

  {depth: 0, title: 'Animation', slug: 'animation', componentName: 'Animation'},
  {depth: 1, title: 'Animated', slug: 'animated', componentName: 'Animated'},
  {depth: 1, title: 'RN Animatable', slug: 'react_native_animatable', componentName: 'ReactNativeAnimatable'},
  {depth: 1, title: 'Gestures', slug: 'gestures', componentName: 'Gestures'},

  // {depth: 0, title: 'Navigation', slug: 'navigation'},
  // {depth: 1, title: 'React Native Router Flux', slug: 'react_native_router_flux'},
  // {depth: 1, title: 'React Native Navigation', slug: 'react_native_navigation'},

  {depth: 0, title: 'Boilerplates', slug: 'boilerplates', componentName: 'Boilerplates'},
  // {depth: 1, title: 'Ignite', slug: 'ignite'},

  {depth: 0, title: 'Exercises', slug: 'exercises', componentName: 'Exercises'},

  {depth: 1, title: 'Todo List', slug: 'todo_list', componentName: 'TodoList'},
  {depth: 2, title: 'App Layout', slug: 'todo_list_1', componentName: 'TodoList1'},
  {depth: 2, title: 'Input & Adding', slug: 'todo_list_2', componentName: 'TodoList2'},
  {depth: 2, title: 'List and Checkbox', slug: 'todo_list_3', componentName: 'TodoList3'},
  {depth: 2, title: 'Removal & Styling', slug: 'todo_list_4', componentName: 'TodoList4'},

  {depth: 1, title: 'Reddit', slug: 'reddit', componentName: 'Reddit'},
  {depth: 2, title: 'Router', slug: 'reddit_1', componentName: 'Reddit1'},
  {depth: 2, title: 'OAuth', slug: 'reddit_2', componentName: 'Reddit2'},
  {depth: 2, title: 'Persisting Token', slug: 'reddit_3', componentName: 'Reddit3'},
  {depth: 2, title: 'Fetch Posts', slug: 'reddit_4', componentName: 'Reddit4'},
  {depth: 2, title: 'Display Posts', slug: 'reddit_5', componentName: 'Reddit5'},

  {depth: 1, title: 'Uber', slug: 'uber', componentName: 'Uber'},
  {depth: 2, title: 'Search Header', slug: 'uber_1', componentName: 'Uber1'},
  {depth: 2, title: 'Results List', slug: 'uber_2', componentName: 'Uber2'},
  {depth: 2, title: 'Map & Geolocation', slug: 'uber_3', componentName: 'Uber3'},
  {depth: 2, title: 'UI Polish', slug: 'uber_4', componentName: 'Uber4'},
]

// Add section numbers. I use semver naming, since it's easy to remember
// how the sections should be numbered and arranged: {major}.{minor}.{patch}.
sections = sections.reduce((acc, section) => {
  let {major, minor, patch, sections} = acc
  const {depth} = section

  if (depth === 0) {
    major++
    minor = 0
    patch = 0
  } else if (depth === 1) {
    minor++
    patch = 0
  } else {
    patch++
  }

  sections.push({...section, major, minor, patch})

  return {...acc, major, minor, patch}
}, {sections: [], major: 0, minor: 0, patch: 0}).sections

// Add {parent} to patch sections
sections = sections.reduce((acc, section) => {
  let {parent, sections} = acc
  const {depth} = section

  if (depth === 0) {
    sections.push(section)
    parent = null
  } else if (depth === 1) {
    sections.push(section)
    parent = section.slug
  } else {
    sections.push({...section, parent})
  }

  return {...acc, parent}
}, {sections: [], parent: null}).sections

export default sections

const matches = (path, section) => {
  let normalizedPath = path

  if (normalizedPath.startsWith('/')) {
    normalizedPath = normalizedPath.slice(1)
  }

  return normalizedPath === section.slug
}

export const getSection = (path, offset = 0) => {
  const index = sections.findIndex(section => matches(path, section))

  if (index === -1) return null

  return sections[index + offset]
}

export const getNextSection = (path) => getSection(path, 1)

export const getPreviousSection = (path) => getSection(path, -1)

export const chapters = sections.reduce(
  (ch, section) => {
    const {depth} = section

    if (depth === 0) {
      ch.push([])
    }

    ch[ch.length - 1].push(section)

    return ch
  }, []
)


text:
#include "config.h"
#include "dyngen-exec.h"

GLOBAL_REGISTER_VARIABLE_DECL struct CPUARMState *env asm(AREG0);

#include "cpu.h"
#include "exec-all.h"

static inline void env_to_regs(void)
{
}

static inline void regs_to_env(void)
{
}

static inline int cpu_has_work(CPUState *env)
{
    return (env->interrupt_request &
            (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB));
}

static inline int cpu_halted(CPUState *env) {
    if (!env->halted)
        return 0;
    /* An interrupt wakes the CPU even if the I and F CPSR bits are
       set.  We use EXITTB to silently wake CPU without causing an
       actual interrupt.  */
    if (cpu_has_work(env)) {
        env->halted = 0;
        return 0;
    }
    return EXCP_HALTED;
}

#if !defined(CONFIG_USER_ONLY)
#include "softmmu_exec.h"
#endif

void raise_exception(int);
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
    env->regs[15] = tb->pc;
}


text:
@class IOSByteArray;

@interface DKListEngineRecord : NSObject

#pragma mark Public

- (instancetype)initWithKey:(jlong)key
                  withOrder:(jlong)order
                  withQuery:(NSString *)query
                   withData:(IOSByteArray *)data;

- (IOSByteArray *)getData;

- (jlong)getKey;

- (jlong)getOrder;

- (NSString *)getQuery;

@end

J2OBJC_EMPTY_STATIC_INIT(DKListEngineRecord)

FOUNDATION_EXPORT void DKListEngineRecord_initWithKey_withOrder_withQuery_withData_(DKListEngineRecord *self, jlong key, jlong order, NSString *query, IOSByteArray *data);

FOUNDATION_EXPORT DKListEngineRecord *new_DKListEngineRecord_initWithKey_withOrder_withQuery_withData_(jlong key, jlong order, NSString *query, IOSByteArray *data) NS_RETURNS_RETAINED;

J2OBJC_TYPE_LITERAL_HEADER(DKListEngineRecord)

typedef DKListEngineRecord ImActorModelDroidkitEngineListEngineRecord;

#endif // _DKListEngineRecord_H_


text:
The second stable release of 2.12, with only updates to the docs website.

### Documentation

* Create page of Pants team members and proudest contribs (Cherry-pick of #16676) ([#16678](https://github.com/pantsbuild/pants/pull/16678))

* Fix example BSP groups file. (Cherry-pick of #16649) ([#16651](https://github.com/pantsbuild/pants/pull/16651))

## 2.12.1rc4 (Aug 24, 2022)

### User API Changes

* Bump default version of `setuptools` to 63.4 ([#16619](https://github.com/pantsbuild/pants/pull/16619))

### Bug fixes

* Add `grpcio` to default Python module mapping ([#16605](https://github.com/pantsbuild/pants/pull/16605))

* Fix `IndexError` when codegen is missing expected `python_requirement` targets ([#16590](https://github.com/pantsbuild/pants/pull/16590))

### Documentation

* Fix broken link to community page (Cherry-pick of #16468) ([#16556](https://github.com/pantsbuild/pants/pull/16556))

## 2.12.1rc3 (Aug 14, 2022)

### Bug fixes

* Include Helm chart dependency inference rules (cherrypick of #16368) ([#16490](https://github.com/pantsbuild/pants/pull/16490))

* Fix docker invalidation bug. (cherrypick #16419) ([#16479](https://github.com/pantsbuild/pants/pull/16479))

* Explicitly add directory entries to resources JARs  (Cherry-pick of #16264) ([#16295](https://github.com/pantsbuild/pants/pull/16295))

### Documentation

* Fix source roots docs (Cherry-pick of #16363) ([#16364](https://github.com/pantsbuild/pants/pull/16364))

* Link to dev.to post on resource hub (cherrypick #16331) ([#16348](https://github.com/pantsbuild/pants/pull/16348))

## 2.12.1rc2 (Jul 20, 2022)

### Bug fixes

* Apply parameter filling for `parametrize`d dependencies to excludes, and fix accommodation for file-addressed atom targets (Cherry-pick of #16249) ([#16251](https://github.com/pantsbuild/pants/pull/16251))

* [internal] Refactors `output_field` to default to something that disambiguates on parametrized fields (cherry-pick of #16232) ([#16248](https://github.com/pantsbuild/pants/pull/16248))

## 2.12.1rc1 (Jul 19, 2022)

### Plugin API Changes

* Generically compute dynamic defaults for `Field`s (Cherry-pick of #16206) ([#16220](https://github.com/pantsbuild/pants/pull/16220))

### Bug fixes

* Fix scala plugins args order causing cache issues (Cherry-pick of #16228) ([#16233](https://github.com/pantsbuild/pants/pull/16233))

* Fix explicit dependencies of `parametrize`d targets not working for some target types (Cherry-pick of #16197) ([#16213](https://github.com/pantsbuild/pants/pull/16213))

* Fill address parameters in all cases, rather than only when a consumer is `parametrize`d. (Cherry-pick of #16198) ([#16211](https://github.com/pantsbuild/pants/pull/16211))

* Use filelists to make archive creation tasks more reliable (Cherry-pick of #16183) ([#16185](https://github.com/pantsbuild/pants/pull/16185))

### Documentation

* Document the "fromfile" feature. (cherrypick of #16205) ([#16207](https://github.com/pantsbuild/pants/pull/16207))

## 2.12.1rc0 (Jul 14, 2022)

### User API Changes

* Fix poetry locks missing hashes. (Cherry-pick of #16112) ([#16114](https://github.com/pantsbuild/pants/pull/16114))

### Bug fixes

* Fix defaulting of parameters in explicitly specified deps on `parametrize`d targets for AsyncFieldMixin (Cherry-pick of #16176) ([#16179](https://github.com/pantsbuild/pants/pull/16179))

* Improve memoization of interpreter constraints, Python parsing, and request classes (Cherry-pick of #16141) ([#16153](https://github.com/pantsbuild/pants/pull/16153))

* Fix pantsd TTY handling. (Cherry-pick of #16038) ([#16047](https://github.com/pantsbuild/pants/pull/16047))

### Documentation

* Updates installation docs to refer to the 1-step setup script (Cherry-picks of #16149) ([#16157](https://github.com/pantsbuild/pants/pull/16157))

* Add 2.12 changelog to docsite (cherrypick #16136) ([#16138](https://github.com/pantsbuild/pants/pull/16138))

* Update docs with 2.12 changes: default Pex lockfile generator, `pants.toml` env var interpolation, pip VCS requirements, and Python interpreter constraints (Cherry-pick of #16000) ([#16059](https://github.com/pantsbuild/pants/pull/16059))

* Fix CI provider table rendering. (cherrypick of #16051) ([#16061](https://github.com/pantsbuild/pants/pull/16061))

* Document Docker registries configuration options for `skip_push` and `extra_image_tags`. (Cherry-pick of #16015) ([#16021](https://github.com/pantsbuild/pants/pull/16021))

* Bump 2.12 install version ([#16002](https://github.com/pantsbuild/pants/pull/16002))

## 2.12.0 (Jun 28, 2022)

The first stable release of the `2.12.x` series, with only documentation changes since the previous `rc`!

### Documentation

* Update certificate environment variable advice for #14808. (Cherry-pick of #15943) ([#15973](https://github.com/pantsbuild/pants/pull/15973))

* Update the docs for `fmt` and test report changes (Cherry-pick of #15968) ([#15970](https://github.com/pantsbuild/pants/pull/15970))

## 2.12.0rc3 (Jun 23, 2022)

### New Features

* Add option for max wait before terminating interactive process (Cherry-pick of #15767) ([#15908](https://github.com/pantsbuild/pants/pull/15908))

### User API Changes

* Change the default `remote_cache_warnings` warnings behavior to `backoff`. (Cherry-pick of #15745) ([#15746](https://github.com/pantsbuild/pants/pull/15746))

### Plugin API Changes

* Introduce a plugin API to provide all thread local state, and deprecate stdio-specific methods (Cherry-pick of #15890) ([#15907](https://github.com/pantsbuild/pants/pull/15907))

### Bug fixes

* Upgrade to `nails` `0.13.0` to pick up support for `JDK >=13`. (Cherry-pick of #15899) ([#15906](https://github.com/pantsbuild/pants/pull/15906))

* Allow JVM memory controls to bound the process pool size to less than the process parallelism (Cherry-pick of #15903) ([#15905](https://github.com/pantsbuild/pants/pull/15905))

* Fix `[python-infer].inits` and `[python-infer].conftests` to consider `resolve` field (Cherry-pick of #15787) ([#15793](https://github.com/pantsbuild/pants/pull/15793))

* Record metrics for remote cache store errors (Cherry-pick of #15744) ([#15747](https://github.com/pantsbuild/pants/pull/15747))

* Fix help for `--process-total-child-memory-usage` and `--process-per-child-memory-usage` (Cherry-pick of #15733) ([#15737](https://github.com/pantsbuild/pants/pull/15737))

### Documentation

* Fix broken links to `tailor` documentation ([#15843](https://github.com/pantsbuild/pants/pull/15843))

* Adds current contents of readme.com docs to repo and adds notes on how to sync. (Cherry-picks #15810) ([#15820](https://github.com/pantsbuild/pants/pull/15820))

* Handle anchors in `doc_url()` correctly (cherrypick of #15812) ([#15823](https://github.com/pantsbuild/pants/pull/15823))

## 2.12.0rc2 (May 31, 2022)

### New Features

* Add Memory controls to JVM processes (Cherry-pick of #15224) ([#15682](https://github.com/pantsbuild/pants/pull/15682))

### User API Changes

* Upgrade Pex to 2.1.90. (Cherry-pick of #15656) ([#15658](https://github.com/pantsbuild/pants/pull/15658))

### Bug fixes

* Don't install Pex-style lockfile when no requirements used (Cherry-pick of #15706) ([#15707](https://github.com/pantsbuild/pants/pull/15707))

* `python_requirements()` can handle `-r reqs.txt` (Cherry-pick of #15672) ([#15677](https://github.com/pantsbuild/pants/pull/15677))

* Prevent collisions between attempts to materialize an immutable input digest. (Cherry-pick of #15652) ([#15680](https://github.com/pantsbuild/pants/pull/15680))

* Choose correct dialect according to scala-version (Cherry-pick of #15649) ([#15681](https://github.com/pantsbuild/pants/pull/15681))

## 2.12.0rc1 (May 23, 2022)

### New Features

* Allow turning off `export` of Python tools like `black` (Cherry-pick of #15509) ([#15511](https://github.com/pantsbuild/pants/pull/15511))

* Support relative address syntax for JVM compiler plugin artifacts (Cherry-pick of #15462) ([#15468](https://github.com/pantsbuild/pants/pull/15468))

### User API Changes

* Upgrade Pex to 2.1.88. (Cherry-pick of #15484) ([#15485](https://github.com/pantsbuild/pants/pull/15485))

### Bug fixes

* Fix incorrect digest for JVM multiple `jvm_artifact(.., jar=..)` entries (Cherry-pick of #15571) ([#15611](https://github.com/pantsbuild/pants/pull/15611))

* Record Scala `package object` as provided name (Cherry-pick of #15582) ([#15608](https://github.com/pantsbuild/pants/pull/15608))

* Don't give a subsequent formatter an empty snapshot after skipping (Cherry-pick of #15483) ([#15602](https://github.com/pantsbuild/pants/pull/15602))

* Fix lockfile generation for Docker and Terraform to not require Python backend (Cherry-pick of #15453) ([#15604](https://github.com/pantsbuild/pants/pull/15604))

* Fix Scala inference not inferring a symbol name after a function call (Cherry-pick of #15565) ([#15603](https://github.com/pantsbuild/pants/pull/15603))

* Fix non-deterministic order of `jvm_artifact(.., excludes=..)` (Cherry-pick of #15542) ([#15575](https://github.com/pantsbuild/pants/pull/15575))

* Fix JVM resource classification and artifact grouping (Cherry-pick of #15567) ([#15573](https://github.com/pantsbuild/pants/pull/15573))

* Fix `tag` filtering with `--changed-dependees` (Cherry-pick of #15546) ([#15564](https://github.com/pantsbuild/pants/pull/15564))

* Improve `name=` used for `python_requirements` target generators with `tailor` (Cherry-pick of #15507) ([#15519](https://github.com/pantsbuild/pants/pull/15519))

* jvm: don't generate default tool lockfiles (Cherry pick of #15488) ([#15498](https://github.com/pantsbuild/pants/pull/15498))

* jvm: fix incorrect check for root-only `ClasspathEntryRequest` implementations (Cherry pick of #15494) ([#15496](https://github.com/pantsbuild/pants/pull/15496))

* kotlin: the `plugin_id` field on `kotlinc_plugin` target is optional (Cherry-pick of #15459) ([#15466](https://github.com/pantsbuild/pants/pull/15466))

* kotlin: remove stray scala references (Cherry-pick of #15461) ([#15465](https://github.com/pantsbuild/pants/pull/15465))

### Performance

* `lint` only finds targets and files if the relevant linters were specified (Cherry-pick of #15579) ([#15601](https://github.com/pantsbuild/pants/pull/15601))

## 2.12.0rc0 (May 13, 2022)

### User API Changes

* Upgrade default Protoc version to 3.20.1 (native Apple Silicon support) (Cherry-pick of #15424) ([#15441](https://github.com/pantsbuild/pants/pull/15441))

* Require that a target's `interpreter_constraints` are a subset of their dependencies' (Cherry-pick of #15373) ([#15407](https://github.com/pantsbuild/pants/pull/15407))

### Plugin API Changes

* Move `get_git` deprecation to start in `2.14.0.dev0` (Cherry-pick of #15423) ([#15437](https://github.com/pantsbuild/pants/pull/15437))

### Bug fixes

* Fix `tags` to work with filesystem arguments, `overrides` field, and `python_tests` (Cherry-pick of #15394) ([#15412](https://github.com/pantsbuild/pants/pull/15412))

* Support the `{chroot}` env placeholder for all interactive processes that are not executed in the workspace. (Cherry-pick of #15401) ([#15405](https://github.com/pantsbuild/pants/pull/15405))

* Fix `[]` in file names with target generators (Cherry-pick of #15383) ([#15403](https://github.com/pantsbuild/pants/pull/15403))

* Fix `tailor` detection of existing `python_requirements` targets (Cherry-pick of #15363) ([#15372](https://github.com/pantsbuild/pants/pull/15372))

* Add the "named args explanation" to other relevant `parametrize` error messages. (Cherry-pick of #15362) ([#15370](https://github.com/pantsbuild/pants/pull/15370))

* Use abspath to sandbox in PATH for docker tool shims. (Cherry-pick of #15341) ([#15356](https://github.com/pantsbuild/pants/pull/15356))

* Fix non-determinism of `package_data` in generated `setup.py` files (Cherry-pick of #15292) ([#15299](https://github.com/pantsbuild/pants/pull/15299))

* Fix a bug in the python venv export logic. (#15294) ([#15297](https://github.com/pantsbuild/pants/pull/15297))

### Performance

* Eagerly skip tools with default lockfiles in `export-lockfiles` goal (Cherry-pick of #15304) ([#15308](https://github.com/pantsbuild/pants/pull/15308))

### Documentation

* Improve error message for `dependencies` on incompatible Python resolves (Cherry-pick of #15416) ([#15439](https://github.com/pantsbuild/pants/pull/15439))

* Improve `help` and error message for `[python-infer].unowned_dependency_behavior` (Cherry-pick of #15334) ([#15391](https://github.com/pantsbuild/pants/pull/15391))

* Disallow `!` patterns in `build_ignore`. (Cherry-pick of #15366) ([#15368](https://github.com/pantsbuild/pants/pull/15368))

* Improve error message for resolves x interpreter constraints issues (Cherry-pick of #15314) ([#15364](https://github.com/pantsbuild/pants/pull/15364))

* Fix error output of `parametrize()` (Cherry-pick of #15339) ([#15348](https://github.com/pantsbuild/pants/pull/15348))

## 2.12.0a0 (Apr 29, 2022)

### New Features

* Support poetry wildcard requirements. ([#15213](https://github.com/pantsbuild/pants/pull/15213))

* Implement `tailor` goal for Helm charts ([#15192](https://github.com/pantsbuild/pants/pull/15192))

* Write virtualenvs for Python tools as part of `export` ([#15098](https://github.com/pantsbuild/pants/pull/15098))

### User API Changes

* Upgrade Pex to 2.1.84. ([#15288](https://github.com/pantsbuild/pants/pull/15288))

### Plugin API Changes

* Allow for arbitrary suffixes when extracting ([#15257](https://github.com/pantsbuild/pants/pull/15257))

* Add lz4 support to archive extraction ([#15245](https://github.com/pantsbuild/pants/pull/15245))

### Bug fixes

* Simplify BSP metadata merging, and handle the empty list. ([#15283](https://github.com/pantsbuild/pants/pull/15283))

* BSP resolve filtering observes computed default values of resolve fields ([#15282](https://github.com/pantsbuild/pants/pull/15282))

* Memoize equality for `CoarsenedTarget(s)` to avoid exponential runtime in `check`. ([#15277](https://github.com/pantsbuild/pants/pull/15277))

* Fix ambiguity of Scala `package object`s with `class` or `object` definitions ([#15265](https://github.com/pantsbuild/pants/pull/15265))

* Fix issue with Docker publish when using `[docker] tools`. ([#15255](https://github.com/pantsbuild/pants/pull/15255))

* Do not lowercase Docker image tags. ([#15254](https://github.com/pantsbuild/pants/pull/15254))

* Fix the placement of the pex verbosity args. ([#15243](https://github.com/pantsbuild/pants/pull/15243))

* Fix use of `@` in path names. ([#15226](https://github.com/pantsbuild/pants/pull/15226))

* Fix lockfile generation for duplicate `jvm_artifact` targets with `jar` fields. ([#15219](https://github.com/pantsbuild/pants/pull/15219))

* golang: add more cache keys based on tool IDs ([#15205](https://github.com/pantsbuild/pants/pull/15205))

### Performance

* `MyPy` and `Pylint` partition inputs via `CoarsenedTarget` ([#15141](https://github.com/pantsbuild/pants/pull/15141))

### Documentation

* Fix `ProtobufSourcesOverridesField` help message ([#15272](https://github.com/pantsbuild/pants/pull/15272))

* Update `help` for python resolves with recent improvements ([#15228](https://github.com/pantsbuild/pants/pull/15228))

* Improve cache-related error message to be less confusing ([#15202](https://github.com/pantsbuild/pants/pull/15202))

* Show `experimental-bsp` goal in help ([#15208](https://github.com/pantsbuild/pants/pull/15208))

* Mention resolve when partitioning Mypy and Pylint ([#15172](https://github.com/pantsbuild/pants/pull/15172))

* Don't log set up of binary shims ([#15203](https://github.com/pantsbuild/pants/pull/15203))

## 2.12.0.dev3 (Apr 16, 2022)

### New Features

* Address specs for parametrized target templates expand to their created targets ([#15126](https://github.com/pantsbuild/pants/pull/15126))

* Implement `publish` goal for Helm charts ([#15042](https://github.com/pantsbuild/pants/pull/15042))

* add experimental kotlin backend to distribution  ([#15109](https://github.com/pantsbuild/pants/pull/15109))

* Support pip-style VCS requirements. ([#15097](https://github.com/pantsbuild/pants/pull/15097))

### User API Changes

* Upgrade Pex to 2.1.79. ([#15125](https://github.com/pantsbuild/pants/pull/15125))

* Ban `terraform_module` referring to subdirectories ([#15106](https://github.com/pantsbuild/pants/pull/15106))

### Plugin API Changes

* Throw a `DuplicateRuleError` when there are conflicting rules in a module. ([#15073](https://github.com/pantsbuild/pants/pull/15073))

* Expose `GitWorktree` as an `@rule` ([#15030](https://github.com/pantsbuild/pants/pull/15030))

### Bug fixes

* Fix Requires-Python for pantsbuild.pants wheel. ([#15149](https://github.com/pantsbuild/pants/pull/15149))

* Allow dashes in inferred asset strings ([#15123](https://github.com/pantsbuild/pants/pull/15123))

* Fix when the same `python_requirement` defines both type stub and implementation ([#15121](https://github.com/pantsbuild/pants/pull/15121))

* Fix missing field check in go protobuf rules ([#15105](https://github.com/pantsbuild/pants/pull/15105))

### Documentation

* Last round of softwrapping help strings ([#15142](https://github.com/pantsbuild/pants/pull/15142))

* Softwrapping a few more files ([#15138](https://github.com/pantsbuild/pants/pull/15138))

* Softwrap python backend help strings ([#15137](https://github.com/pantsbuild/pants/pull/15137))

## 2.12.0.dev2 (Apr 11, 2022)

### New Features

* Support for env var interpolation in config files. ([#15087](https://github.com/pantsbuild/pants/pull/15087))

* Support for finer control over which Docker images to push. ([#15000](https://github.com/pantsbuild/pants/pull/15000))

* Add a helpful hint to `lint` if a formatter fails ([#15048](https://github.com/pantsbuild/pants/pull/15048))

* Add support for Helm 3rd party dependencies ([#14964](https://github.com/pantsbuild/pants/pull/14964))

### User API Changes

* Default `[python].lockfile_generator` to Pex ([#15074](https://github.com/pantsbuild/pants/pull/15074))

* Upgrade Pex to 2.1.78. ([#15078](https://github.com/pantsbuild/pants/pull/15078))

* terraform: remove `terraform_modules` generator target type ([#15035](https://github.com/pantsbuild/pants/pull/15035))

* Upgrade to Pex 2.1.77. ([#15015](https://github.com/pantsbuild/pants/pull/15015))

* Change JVM defaults to use Temurin JDK distribution ([#15009](https://github.com/pantsbuild/pants/pull/15009))

### Plugin API Changes

* Remove deprecated `register_options` support. ([#15090](https://github.com/pantsbuild/pants/pull/15090))

* Remove deprecated target generator API affordances. ([#15091](https://github.com/pantsbuild/pants/pull/15091))

* Add `@rule_helper` decorator, which participates in awaitable collection ([#15025](https://github.com/pantsbuild/pants/pull/15025))

### Bug fixes

* Enable codegen on relocated files ([#15100](https://github.com/pantsbuild/pants/pull/15100))

* Preserve tombstones for workunits which complete while they still have children ([#15088](https://github.com/pantsbuild/pants/pull/15088))

* Clean the export dir under dist/ before populating it. ([#15068](https://github.com/pantsbuild/pants/pull/15068))

* Do not use a repository-PEX if a PEX has platforms specified ([#15031](https://github.com/pantsbuild/pants/pull/15031))

* Fix default layout and use of PEX-repositories for legacy lockfiles ([#15014](https://github.com/pantsbuild/pants/pull/15014))

* Pin pytest 7.0.1 ([#14997](https://github.com/pantsbuild/pants/pull/14997))

### Documentation

* files/dirs swapped in Snapshot's repr ([#15101](https://github.com/pantsbuild/pants/pull/15101))

* Tweak deprecation messages. ([#15027](https://github.com/pantsbuild/pants/pull/15027))

* Add some codegen and terraform backends to docs generator ([#15036](https://github.com/pantsbuild/pants/pull/15036))

* Text in angle brackets needs to be escaped for the docsite. ([#15046](https://github.com/pantsbuild/pants/pull/15046))

* Fix presented provider backend for rules/subsystems. ([#14999](https://github.com/pantsbuild/pants/pull/14999))

## 2.12.0.dev1 (Apr 05, 2022)

### New Features

* Support restricting specific requirements to just wheels or just sdists. ([#14985](https://github.com/pantsbuild/pants/pull/14985))

* Add support for Helm unittest ([#14849](https://github.com/pantsbuild/pants/pull/14849))

* Add support for parsing address parameters to CLI specs parsing ([#14949](https://github.com/pantsbuild/pants/pull/14949))

### User API Changes

* Merge list values across config files. ([#14850](https://github.com/pantsbuild/pants/pull/14850))

* Write test reports to a standard location under the distdir. ([#14929](https://github.com/pantsbuild/pants/pull/14929))

* Upgrade Pex to 2.1.76. ([#14992](https://github.com/pantsbuild/pants/pull/14992))

* Upgrade coursier to v2.1.0-M5-18-gfebf9838c ([#14978](https://github.com/pantsbuild/pants/pull/14978))

### Plugin API Changes

* "Unify" `fmt` and `lint` rules for formatters ([#14903](https://github.com/pantsbuild/pants/pull/14903))

* Refactor `prior_formatter_result` and its usage ([#14987](https://github.com/pantsbuild/pants/pull/14987))

* Deprecate not implementing `TargetGenerator` in `GenerateTargetsRequest` implementors. ([#14959](https://github.com/pantsbuild/pants/pull/14959))

### Bug fixes

* add go protobuf backend to init/BUILD ([#14979](https://github.com/pantsbuild/pants/pull/14979))

* Fix Pylint config check strings ([#14946](https://github.com/pantsbuild/pants/pull/14946))

* Fix missing `check` output by allowing disabled workunits to re-enable themselves ([#14934](https://github.com/pantsbuild/pants/pull/14934))

* Fix unrecognized field error and `update-build-files` to handle target generator moved fields ([#14847](https://github.com/pantsbuild/pants/pull/14847))

### Performance

* Make PEX lockfile subsetting incremental ([#14944](https://github.com/pantsbuild/pants/pull/14944))

### Documentation

* Don't warn if no relevant targets in glob or --changed. ([#14904](https://github.com/pantsbuild/pants/pull/14904))

## 2.12.0.dev0 (Mar 25, 2022)

### New Features

* Add Protobuf formatting using buf format ([#14907](https://github.com/pantsbuild/pants/pull/14907))

* add registration for the Go Protobuf backend ([#14874](https://github.com/pantsbuild/pants/pull/14874))

### User API Changes

* Remove `--use-deprecated-python-macros` in favor of always using target generators ([#14842](https://github.com/pantsbuild/pants/pull/14842))

* Add `django-dotenv`, `django-safedelete` and `factory-boy` to default Python module mapping ([#14848](https://github.com/pantsbuild/pants/pull/14848))

* Add cattrs to Python's DEFAULT_MODULE_MAPPING ([#14845](https://github.com/pantsbuild/pants/pull/14845))

* hcl parser 3.0.5 ([#14878](https://github.com/pantsbuild/pants/pull/14878))

### Plugin API Changes

* FmtResult now operates on Snapshots ([#14865](https://github.com/pantsbuild/pants/pull/14865))

### Bug fixes

* add cache key for all Go SDK invocations ([#14897](https://github.com/pantsbuild/pants/pull/14897))

* Unify glob-matching implementations to fix malformed snapshot created by subsetting ([#14889](https://github.com/pantsbuild/pants/pull/14889))

* Adds `ClasspathEntryRequest` classification for codegen target generators ([#14893](https://github.com/pantsbuild/pants/pull/14893))

* Adds `jvm_jdk` field to protobufs when the Scala backend is enabled ([#14891](https://github.com/pantsbuild/pants/pull/14891))


text:
{{extend 'template.html'}}
{{include 'attribute.html'}}

Request Parameters

docLimit =
			<select onchange="onSelectParam(this)">
				{{for n in [5,10,20,50,100,200,500]:}}
					<option value="{{WriteURL({'docLimit':n})}}" {{if params['docLimit'] == n:}}selected="selected"{{pass}}>{{=n}}</option>
				{{pass}}
			</select>

docOffset =
			<select onchange="onSelectParam(this)">
				{{for n in range(0,100,5):}}
					<option value="{{WriteURL({'docOffset':n})}}" {{if params['docOffset'] == n:}}selected="selected"{{pass}}>{{=n}}</option>
				{{pass}}
			</select>

searchPattern =
			<input type="text" class="searchPattern" value="{{=params['searchPattern']}}" style="width:150px"/> <input type="button" value="Refresh" onclick="onSubmitParams()" />

Or simply type in a URL into your browser

Server Response
		(
			{{if configs['is_text']:}}Text format{{else:}}Text format{{pass}} |
			Save as JSON |
			Save as CSV |
			Save as TSV
		)

{{if configs['is_text']:}}

{{=content}}

{{pass}}
{{if configs['is_graph']:}}

{{pass}}


text:
package nl.stokpop.lograter.processor;

import nl.stokpop.lograter.command.BaseUnit;
import nl.stokpop.lograter.counter.CounterStorageType;
import nl.stokpop.lograter.store.RequestCounterStoreFactory;

/**
 * Sets defaults for Basic analysis to:
 *
 *

 *
failureAwareAnalysis to true

 *
includeFailedHitsInAnalysis to true

 *

 *
 * Note these values can be reset after initialization.
 */
public abstract class BasicCounterLogConfig extends BasicLogConfig {

    private boolean calculateStdDev = false;
	private boolean calculateHitsPerSecond = false;
	private boolean calculateConcurrentCalls = false;
	private boolean calculateStubDelays = false;
	private CounterStorageType counterStorage = CounterStorageType.Memory;
	private boolean includeMapperRegexpColumn = false;
    private Double[] reportPercentiles = { 99d };
    private int maxUniqueRequests = RequestCounterStoreFactory.DEFAULT_MAX_UNIQUE_REQUESTS;
    private BaseUnit baseUnit = BaseUnit.milliseconds;
    private String counterStorageDir = ".";
    private boolean failureAwareAnalysis = true;
    private boolean includeFailedHitsInAnalysis = true;

    public boolean isCalculateStdDev() {
		return calculateStdDev;
	}
	public void setCalculateStdDev(boolean calculateStdDev) {
		this.calculateStdDev = calculateStdDev;
	}
	public boolean isCalculateHitsPerSecond() {
		return calculateHitsPerSecond;
	}
	public void setCalculateHitsPerSecond(boolean calculateHitsPerSecond) {
		this.calculateHitsPerSecond = calculateHitsPerSecond;
	}
	public boolean isCalculateConcurrentCalls() {
		return calculateConcurrentCalls;
	}
	public void setCalculateConcurrentCalls(boolean calculateConcurrentCalls) {
		this.calculateConcurrentCalls = calculateConcurrentCalls;
	}

    public boolean isCalculateStubDelays() {
        return calculateStubDelays;
    }

    public void setCalculateStubDelays(boolean calculateStubDelays) {
        this.calculateStubDelays = calculateStubDelays;
    }

	public void setCounterStorage(CounterStorageType counterStorage) {
		this.counterStorage = counterStorage;
	}

	public CounterStorageType getCounterStorage() {
		return counterStorage;
	}

    public void setIncludeMapperRegexpColumn(boolean includeMapperRegexpColumn) {
        this.includeMapperRegexpColumn = includeMapperRegexpColumn;
    }

    public boolean isIncludeMapperRegexpColumn() {
        return includeMapperRegexpColumn;
    }

	public boolean isFailureAwareAnalysis() {
		return failureAwareAnalysis;
	}

	/**
	 * When failure counters are available, report on failure metrics in the reports.
	 * @param failureAwareAnalysis true when failures are part of the analysis,
     *                                null to use default per module
	 */
	public void setFailureAwareAnalysis(boolean failureAwareAnalysis) {
		this.failureAwareAnalysis = failureAwareAnalysis;
	}

	@Override
	public boolean equals(Object o) {
		throw new UnsupportedOperationException();
	}

	@Override
	public int hashCode() {
		throw new UnsupportedOperationException();
	}

    public Double[] getReportPercentiles() {
        return reportPercentiles;
    }

    public void setReportPercentiles(Double[] reportPercentiles) {
        this.reportPercentiles = reportPercentiles;
    }

    public int getMaxUniqueCounters() {
        return maxUniqueRequests;
    }

    public void setMaxUniqueRequests(int maxUniqueRequests) {
        this.maxUniqueRequests = maxUniqueRequests;
    }

    public BaseUnit getBaseUnit() {
        return baseUnit;
    }

    public void setBaseUnit(BaseUnit baseUnit) {
        this.baseUnit = baseUnit;
    }

    public void setCounterStorageDir(String counterStorageDir) {
        this.counterStorageDir = counterStorageDir;
    }

    public String getCounterStorageDir() {
        return counterStorageDir;
    }

    /**
     * When FailureAwareAnalysis is true, this setting determines if failed hits should
     * be included in the analysis. If false, failure hits and failure percentage are reported,
     * but are not included in the analysis, such as determining avg and max values.
     * @param includeFailedHitsInAnalysis true or false, or null when defaults of reports should be used
     */
    public void setIncludeFailedHitsInAnalysis(boolean includeFailedHitsInAnalysis) {
        this.includeFailedHitsInAnalysis = includeFailedHitsInAnalysis;
    }

    public boolean isIncludeFailedHitsInAnalysis() {
        return includeFailedHitsInAnalysis;
    }
}


text:
package oauth2

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"net/http/httptest"
	"reflect"
	"strings"
	"testing"
	"time"

	gojwt "github.com/dgrijalva/jwt-go"
)

type MockTokenizer struct {
	Principal Principal
	ValidErr  error
	Token     Token
	CreateErr error
	ExtendErr error
}

func (m *MockTokenizer) ValidPrincipal(ctx context.Context, token Token, duration time.Duration) (Principal, error) {
	return m.Principal, m.ValidErr
}

func (m *MockTokenizer) Create(ctx context.Context, p Principal) (Token, error) {
	return m.Token, m.CreateErr
}

func (m *MockTokenizer) ExtendedPrincipal(ctx context.Context, principal Principal, extension time.Duration) (Principal, error) {
	return principal, m.ExtendErr
}

func (m *MockTokenizer) GetClaims(tokenString string) (gojwt.MapClaims, error) {
	return gojwt.MapClaims{}, nil
}

func TestCookieAuthorize(t *testing.T) {
	var test = []struct {
		Desc      string
		Value     string
		Expected  string
		Err       error
		CreateErr error
	}{
		{
			Desc:      "Unable to create token",
			Err:       ErrAuthentication,
			CreateErr: ErrAuthentication,
		},
		{
			Desc:     "Cookie token extracted",
			Value:    "reallyimportant",
			Expected: "reallyimportant",
			Err:      nil,
		},
	}
	for _, test := range test {
		cook := cookie{
			Lifespan: 1 * time.Second,
			Now: func() time.Time {
				return time.Unix(0, 0)
			},
			Tokens: &MockTokenizer{
				Token:     Token(test.Value),
				CreateErr: test.CreateErr,
			},
		}
		principal := Principal{}
		w := httptest.NewRecorder()
		err := cook.Authorize(context.Background(), w, principal)
		if err != test.Err {
			t.Fatalf("Cookie extract error; expected %v  actual %v", test.Err, err)
		}
		if test.Err != nil {
			continue
		}

		cookies := w.Header()["Set-Cookie"]

		if len(cookies) == 0 {
			t.Fatal("Expected some cookies but got zero")
		}
		log.Printf("%s", cookies[0])
		if !strings.Contains(cookies[0], fmt.Sprintf("%s=%s", DefaultCookieName, test.Expected)) {
			t.Errorf("Token extract error; expected %v  actual %v", test.Expected, principal.Subject)
		}
	}
}

func TestCookieValidate(t *testing.T) {
	var test = []struct {
		Desc     string
		Name     string
		Value    string
		Lookup   string
		Expected string
		Err      error
		ValidErr error
	}{
		{
			Desc:     "No cookie of this name",
			Name:     "Auth",
			Value:    "reallyimportant",
			Lookup:   "Doesntexist",
			Expected: "",
			Err:      ErrAuthentication,
		},
		{
			Desc:     "Unable to create token",
			Name:     "Auth",
			Lookup:   "Auth",
			Err:      ErrAuthentication,
			ValidErr: ErrAuthentication,
		},
		{
			Desc:     "Cookie token extracted",
			Name:     "Auth",
			Value:    "reallyimportant",
			Lookup:   "Auth",
			Expected: "reallyimportant",
			Err:      nil,
		},
	}
	for _, test := range test {
		req, _ := http.NewRequest("", "http://howdy.com", nil)
		req.AddCookie(&http.Cookie{
			Name:  test.Name,
			Value: test.Value,
		})

		cook := cookie{
			Name:       test.Lookup,
			Lifespan:   1 * time.Second,
			Inactivity: DefaultInactivityDuration,
			Now: func() time.Time {
				return time.Unix(0, 0)
			},
			Tokens: &MockTokenizer{
				Principal: Principal{
					Subject: test.Value,
				},
				ValidErr: test.ValidErr,
			},
		}
		principal, err := cook.Validate(context.Background(), req)
		if err != test.Err {
			t.Errorf("Cookie extract error; expected %v  actual %v", test.Err, err)
		}

		if principal.Subject != test.Expected {
			t.Errorf("Token extract error; expected %v  actual %v", test.Expected, principal.Subject)
		}
	}
}

func TestNewCookieJWT(t *testing.T) {
	auth := NewCookieJWT("secret", 2*time.Second)
	if cookie, ok := auth.(*cookie); !ok {
		t.Errorf("NewCookieJWT() did not create cookie Authenticator")
	} else if cookie.Inactivity != time.Second {
		t.Errorf("NewCookieJWT() inactivity was not two seconds: %s", cookie.Inactivity)
	}

	auth = NewCookieJWT("secret", time.Hour)
	if cookie, ok := auth.(*cookie); !ok {
		t.Errorf("NewCookieJWT() did not create cookie Authenticator")
	} else if cookie.Inactivity != DefaultInactivityDuration {
		t.Errorf("NewCookieJWT() inactivity was not five minutes: %s", cookie.Inactivity)
	}

	auth = NewCookieJWT("secret", 0)
	if cookie, ok := auth.(*cookie); !ok {
		t.Errorf("NewCookieJWT() did not create cookie Authenticator")
	} else if cookie.Inactivity != DefaultInactivityDuration {
		t.Errorf("NewCookieJWT() inactivity was not five minutes: %s", cookie.Inactivity)
	}
}

func TestCookieExtend(t *testing.T) {
	history := time.Unix(-446774400, 0)
	type fields struct {
		Name       string
		Lifespan   time.Duration
		Inactivity time.Duration
		Now        func() time.Time
		Tokens     Tokenizer
	}
	type args struct {
		ctx context.Context
		w   *httptest.ResponseRecorder
		p   Principal
	}
	tests := []struct {
		name    string
		fields  fields
		args    args
		want    Principal
		wantErr bool
	}{
		{
			name: "Successful extention",
			want: Principal{
				Subject: "subject",
			},
			fields: fields{
				Name:       "session",
				Lifespan:   time.Second,
				Inactivity: time.Second,
				Now: func() time.Time {
					return history
				},
				Tokens: &MockTokenizer{
					Principal: Principal{
						Subject: "subject",
					},
					Token:     "token",
					ExtendErr: nil,
				},
			},
			args: args{
				ctx: context.Background(),
				w:   httptest.NewRecorder(),
				p: Principal{
					Subject: "subject",
				},
			},
		},
		{
			name:    "Unable to extend",
			wantErr: true,
			fields: fields{
				Tokens: &MockTokenizer{
					ExtendErr: fmt.Errorf("bad extend"),
				},
			},
			args: args{
				ctx: context.Background(),
				w:   httptest.NewRecorder(),
				p: Principal{
					Subject: "subject",
				},
			},
		},
		{
			name:    "Unable to create",
			wantErr: true,
			fields: fields{
				Tokens: &MockTokenizer{
					CreateErr: fmt.Errorf("bad extend"),
				},
			},
			args: args{
				ctx: context.Background(),
				w:   httptest.NewRecorder(),
				p: Principal{
					Subject: "subject",
				},
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			c := &cookie{
				Name:       tt.fields.Name,
				Lifespan:   tt.fields.Lifespan,
				Inactivity: tt.fields.Inactivity,
				Now:        tt.fields.Now,
				Tokens:     tt.fields.Tokens,
			}
			got, err := c.Extend(tt.args.ctx, tt.args.w, tt.args.p)
			if (err != nil) != tt.wantErr {
				t.Errorf("cookie.Extend() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if !tt.wantErr {
				if !reflect.DeepEqual(got, tt.want) {
					t.Errorf("cookie.Extend() = %v, want %v", got, tt.want)
				}

				cookies := tt.args.w.Header()["Set-Cookie"]
				if len(cookies) == 0 {
					t.Fatal("Expected some cookies but got zero")
				}
				log.Printf("%s", cookies)
				want := fmt.Sprintf("%s=%s", DefaultCookieName, "token")
				if !strings.Contains(cookies[0], want) {
					t.Errorf("cookie.Extend() = %v, want %v", cookies[0], want)
				}
			}
		})
	}
}


text:
package st.ustp.siie.scanner.item;

import android.view.View;
import android.widget.TextView;

import st.ustp.siie.scanner.model.ExamSheet;
import st.zudamue.support.android.adapter.ItemDataSet;
import st.zudamue.support.android.adapter.ItemViewHolder;
import st.ustp.siie.scanner.R;
import st.ustp.siie.scanner.model.Scan;

/**
 *
 * Created by xdaniel on 6/11/17.
 * @author Daniel Costa <costa.xdaniel@gmail.com/>
 */
public class ItemReaderContentExamAccessSheet extends ItemViewHolder<ItemReaderContentExamAccessSheet.DataSet> {

    private TextView tvExamDisiplina;
    private TextView tvExamCourse;
    private TextView tvExamPage;
    private ItemCallback<DataSet> onCardClick;

    public ItemReaderContentExamAccessSheet( View itemView) {
        super( itemView);
        this.tvExamDisiplina = ( TextView )this.itemView.findViewById( R.id.tv_exam_disciplina );
        this.tvExamCourse = ( TextView )this.itemView.findViewById( R.id.tv_exam_curso );
        this.tvExamPage = ( TextView )this.itemView.findViewById( R.id.tv_exam_page );
        this.itemView.setOnClickListener( new View.OnClickListener() {
            @Override
            public void onClick( View v ) {
                onCardClick();
            }
        } );
    }

    public ItemReaderContentExamAccessSheet setOnCardClick( ItemCallback<DataSet> onCardClick ) {
        this.onCardClick = onCardClick;
        return this;
    }

    private void onCardClick() {
        this.callback( this.onCardClick );
    }

    public static DataSet newInstance( ExamSheet examSheet ){
        return new DataSet( examSheet );
    }

    @Override
    public void onBind( DataSet dataSet, int currentAdapterPosition, int totalDataSet ) {
        this.dataSet( dataSet );
        this.tvExamDisiplina.setText( this.dataSet.examSheet.getNotaEntregue().getDisciplina() );
        this.tvExamCourse.setText( this.dataSet.examSheet.getNotaEntregue().getCursoSigla() );
        String totalPage = String.format( "%2s", String.valueOf( this.dataSet.examSheet.getTotalPage() ) ).replaceAll( " ", "0" );
        String numPage = String.format( "%2s", String.valueOf( this.dataSet.examSheet.getPageNumber() ) ).replaceAll( " ", "0" );

        if ( dataSet.examSheet.isCapa() )
            numPage = "Capa";

        this.tvExamPage.setText( numPage+"/"+totalPage );
    }

    public static class DataSet implements ItemDataSet{
        private ExamSheet examSheet;

        public DataSet( ExamSheet examSheet ) {
            this.examSheet = examSheet;
        }

        @Override
        public int getLayoutId() {
            return R.layout.main_reader_content_exam;
        }

        public Scan getScan() {
            return this.examSheet.getNotaEntregue().getScan();
        }
    }
}


text:
.oo-ui-icon-globe {
  background-image: url('themes/wikimediaui/images/icons/globe.png');
  background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/globe.svg');
}
.oo-ui-icon-map {
  background-image: url('themes/wikimediaui/images/icons/map-rtl.png');
  background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/map-rtl.svg');
}
.oo-ui-icon-mapPin {
  background-image: url('themes/wikimediaui/images/icons/mapPin.png');
  background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/mapPin.svg');
}
.oo-ui-icon-mapPinAdd {
  background-image: url('themes/wikimediaui/images/icons/mapPinAdd.png');
  background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/mapPinAdd.svg');
}
.oo-ui-icon-mapTrail {
  background-image: url('themes/wikimediaui/images/icons/mapTrail.png');
  background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/mapTrail.svg');
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Man. fl. pl. Calif. 556. 1925

#### Original name
null

### Remarks
null


text: This is a demo-file


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>12-XMediaTest</title>
    <link href="../dist/css/bootstrap.css" rel="stylesheet" />


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//<include src="../../../../ui/webui/resources/js/cr.js">
//<include src="../../../../ui/webui/resources/js/load_time_data.js">
//<include src="../../../../ui/webui/resources/js/i18n_template_no_process.js">
//<include src="../../../../ui/webui/resources/js/cr/event_target.js">
//<include src="../../../../ui/webui/resources/js/cr/ui/dialogs.js">

(function() {
'use strict';

//<include src="../cws_widget/app_installer.js">
//<include src="../cws_widget/cws_webview_client.js">
//<include src="../cws_widget/cws_widget_container.js">
//<include src="../cws_widget/cws_widget_container_error_dialog.js">

/**
 * @type {?{
 *   filter: !Object.<string, *>,
 *   webstoreUrl: ?string
 * }}
 */
window.params = window.params || null;

/**
 * @param {string} id Element id.
 * @return {HTMLElement} The found element, or null.
 */
function $(id) {
  return document.getElementById(id);
}

/**
 * Default strings.
 */
var defaultStrings = {
  'language': 'en',
  'LINK_TO_WEBSTORE': '[LOCALIZE ME] Learn more...',
  'INSTALLATION_FAILED_MESSAGE': '[LOCALIZE ME] Installation failed!',
  'OK_BUTTON': '[LOCALIZE ME] OK',
  'TITLE_PRINTER_PROVIDERS': '[LOCALIZE ME] Select app for your printer',
  'DEFAULT_ERROR_MESSAGE': '[LOCALIZE ME] Failure'
};

/**
 * @param {string} id The string id.
 * @return {string}
 */
function getString(id) {
  return loadTimeData.getString(id) || defaultStrings[id] || '';
}

/**
 * @param {Object.<string, string>} strings Localized strings used by the
 *     container.
 * @return {!CWSWidgetContainer.PlatformDelegate}
 */
function createPlatformDelegate(strings) {
  return {
    strings: {
      UI_LOCALE: getString('language'),
      LINK_TO_WEBSTORE: getString('LINK_TO_WEBSTORE'),
      INSTALLATION_FAILED_MESSAGE: getString('INSTALLATION_FAILED_MESSAGE')
    },

    metricsImpl: {
      /**
       * @param {string} enumName
       * @param {number} value
       * @param {number} enumSize
       */
      recordEnum: function(enumName, value, enumSize) {},

      /** @param {string} actionName */
      recordUserAction: function(actionName) {},

      /** @param {string} intervalName */
      startInterval: function(intervalName) {},

      /** @param {string} intervalName */
      recordInterval: function(intervalName) {}
    },

    /**
     * @param {string} itemId Item to be installed.
     * @param {function(?string)} callback Callback param is the error message,
     *     which is set to null on success.
     */
    installWebstoreItem: function(itemId, callback) {
      chrome.webstoreWidgetPrivate.installWebstoreItem(
          itemId,
          false,
          function() {
            callback(chrome.runtime.lastError ?
                chrome.runtime.lastError.message || 'UNKNOWN_ERROR' : null);
          });
    },

    /** @param {function(Array.<string>)} callback */
    getInstalledItems: function(callback) { callback([]); },

    /**
     * @param {function(?string)} callback The argument is the fetche3d access
     *     token. Null on error.
     */
    requestWebstoreAccessToken: function(callback) {
      chrome.fileManagerPrivate.requestWebStoreAccessToken(function(token) {
        if (chrome.runtime.lastError) {
          console.error('Error getting access token: ' +
                        chrome.runtime.lastError.message);
          callback(null);
          return;
        }
        callback(token);
      });
    }
  };
}

function initializeTopbarButtons() {
  $('close-button').addEventListener('click', function(e) {
    e.preventDefault();
    closeAppWindow();
  });

  $('close-button').addEventListener('mousedown', function(e) {
    e.preventDefault();
  });

  $('minimize-button').addEventListener('click', function(e) {
    e.preventDefault();
    chrome.app.window.current().minimize();
  });

  $('minimize-button').addEventListener('mousedown', function(e) {
    e.preventDefault();
  });
}

/**
 * @param {!CWSWidgetContainer.Result} result The result reported by the widget.
 */
function showWidgetResult(result) {
  // TODO(tbarzic): Add some UI to show on success.
  if (result != CWSWidgetContainer.Result.FAILED) {
    closeAppWindow();
    return;
  }

  var dialog = new CWSWidgetContainerErrorDialog($('widget-container-root'));
  dialog.show(getString('DEFAULT_ERROR_MESSAGE'),
              closeAppWindow,
              closeAppWindow);
}

/** Closes the current app window. */
function closeAppWindow() {
  chrome.app.window.current().close();
}

window.addEventListener('DOMContentLoaded', function() {
  initializeTopbarButtons();

  chrome.webstoreWidgetPrivate.getStrings(function(strings) {
    loadTimeData.data = strings;
    i18nTemplate.process(document, loadTimeData);

    cr.ui.dialogs.BaseDialog.OK_LABEL = getString('OK_BUTTON');

    document.title = getString('TITLE_PRINTER_PROVIDERS');
    $('title').textContent = document.title;

    if (!window.params) {
      console.error('Params not set!');
      return;
    }

    /** @type {!CWSWidgetContainer.PlatformDelegate} */
    var platformDelegate = createPlatformDelegate(strings);

    var root = $('widget-container-root');
    if (!root) {
      console.error('No root element');
      return;
    }

    /** @type {!CWSWidgetContainer} */
    var widgetContainer = new CWSWidgetContainer(
        document, root, platformDelegate, {} /* state */);

    widgetContainer.ready()
        /** @return {!Promise.<CWSWidgetContainer.ResolveReason>} */
        .then(function() {
          return widgetContainer.start(window.params.filter,
                                       window.params.webstoreUrl);
        })
        /** @param {!CWSWidgetContainer.ResolveReason} reason */
        .then(function(reason) {
          if (reason != CWSWidgetContainer.ResolveReason.DONE)
            return;

          var result = widgetContainer.finalizeAndGetResult();
          showWidgetResult(result.result);
        })
        /** @param {*} error */
        .catch(function(error) {
          showWidgetResult(CWSWidgetContainer.Result.FAILED);
        });
  });
});
})();


text:
'''
Interaction with Git repositories
=================================

Important: Before using git over ssh, make sure your remote host fingerprint
exists in "~/.ssh/known_hosts" file. To avoid requiring password
authentication, it is also possible to pass private keys to use explicitly.

.. code-block:: yaml

    https://github.com/saltstack/salt.git:
      git.latest:
        - rev: develop
        - target: /tmp/salt
'''

# Import python libs
import logging
import os
import shutil

# Import salt libs
import salt.utils

log = logging.getLogger(__name__)

def __virtual__():
    '''
    Only load if git is available
    '''
    return 'git' if __salt__['cmd.has_exec']('git') else False

def latest(name,
           rev=None,
           target=None,
           runas=None,
           user=None,
           force=None,
           force_checkout=False,
           submodules=False,
           mirror=False,
           bare=False,
           remote_name='origin',
           always_fetch=False,
           identity=None,
           onlyif=False,
           unless=False):
    '''
    Make sure the repository is cloned to the given directory and is up to date

    name
        Address of the remote repository as passed to "git clone"

    rev
        The remote branch, tag, or revision ID to checkout after
        clone / before update

    target
        Name of the target directory where repository is about to be cloned

    runas
        Name of the user performing repository management operations

        .. deprecated:: 0.17.0

    user
        Name of the user performing repository management operations

        .. versionadded:: 0.17.0

    force
        Force git to clone into pre-existing directories (deletes contents)

    force_checkout
        Force a checkout even if there might be overwritten changes
        (Default: False)

    submodules
        Update submodules on clone or branch change (Default: False)

    mirror
        True if the repository is to be a mirror of the remote repository.
        This implies bare, and thus is incompatible with rev.

    bare
        True if the repository is to be a bare clone of the remote repository.
        This is incompatible with rev, as nothing will be checked out.

    remote_name
        defines a different remote name.
        For the first clone the given name is set to the default remote,
        else it is just a additional remote. (Default: 'origin')

    always_fetch
        If a tag or branch name is used as the rev a fetch will not occur
        until the tag or branch name changes. Setting this to true will force
        a fetch to occur. Only applies when rev is set. (Default: False)

    identity
        A path to a private key to use over SSH

    onlyif
        A command to run as a check, run the named command only if the command
        passed to the ``onlyif`` option returns true

    unless
        A command to run as a check, only run the named command if the command
        passed to the ``unless`` option returns false
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}, 'state_stdout': ''}

    # Check to make sure rev and mirror/bare are not both in use
    if rev and (mirror or bare):
        return _fail(ret, ('"rev" is not compatible with the "mirror" and'
                           '"bare" arguments'))

    if not target:
        return _fail(ret, '"target" option is required')

    salt.utils.warn_until(
        'Hydrogen',
        'Please remove \'runas\' support at this stage. \'user\' support was '
        'added in 0.17.0',
        _dont_call_warnings=True
    )
    if runas:
        # Warn users about the deprecation
        ret.setdefault('warnings', []).append(
            'The \'runas\' argument is being deprecated in favor of \'user\', '
            'please update your state files.'
        )
    if user is not None and runas is not None:
        # user wins over runas but let warn about the deprecation.
        ret.setdefault('warnings', []).append(
            'Passed both the \'runas\' and \'user\' arguments. Please don\'t. '
            '\'runas\' is being ignored in favor of \'user\'.'
        )
        runas = None
    elif runas is not None:
        # Support old runas usage
        user = runas
        runas = None

    run_check_cmd_kwargs = {'runas': user}

    # check if git.latest should be applied
    cret = _run_check(
        run_check_cmd_kwargs, onlyif, unless
    )
    if isinstance(cret, dict):
        ret.update(cret)
        return ret

    bare = bare or mirror
    check = 'refs' if bare else '.git'

    if os.path.isdir(target) and os.path.isdir('{0}/{1}'.format(target,
                                                                check)):
        # git pull is probably required
        log.debug(('target {0} is found, "git pull" '
                   'is probably required'.format(target)))
        try:
            current_rev = __salt__['git.revision'](target, user=user, state_ret=ret)

            # handle the case where a branch was provided for rev
            remote_rev = None
            branch = __salt__['git.current_branch'](target, user=user)
            # We're only interested in the remote branch if a branch
            # (instead of a hash, for example) was provided for rev.
            if len(branch) > 0 and branch == rev:
                remote_rev = __salt__['git.ls_remote'](target,
                                                       repository=name,
                                                       branch=branch, user=user,
                                                       identity=identity)

            # only do something, if the specified rev differs from the
            # current_rev and remote_rev
            if current_rev in [rev, remote_rev]:
                new_rev = current_rev
            else:

                if __opts__['test']:
                    return _neutral_test(
                        ret,
                        ('Repository {0} update is probably required (current '
                         'revision is {1})').format(target, current_rev))

                # if remote_name is defined set fetch_opts to remote_name
                if remote_name != 'origin':
                    fetch_opts = remote_name
                else:
                    fetch_opts = ''

                # check remote if fetch_url not == name set it
                remote = __salt__['git.remote_get'](target,
                                                    remote=remote_name,
                                                    user=user)
                if remote is None or remote[0] != name:
                    __salt__['git.remote_set'](target,
                                               name=remote_name,
                                               url=name,
                                               user=user,
                                               state_ret=ret)
                    ret['changes']['remote/{0}'.format(remote_name)] = "{0} => {1}".format(str(remote), name)

                # check if rev is already present in repo, git-fetch otherwise
                if bare:
                    __salt__['git.fetch'](target,
                                          opts=fetch_opts,
                                          user=user,
                                          identity=identity,
                                          state_ret=ret)
                elif rev:

                    cmd = "git rev-parse " + rev + '^{commit}'
                    retcode = __salt__['cmd.retcode'](cmd,
                                                      cwd=target,
                                                      runas=user)
                    # there is a issues #3938 addressing this
                    if 0 != retcode or always_fetch:
                        __salt__['git.fetch'](target,
                                              opts=fetch_opts,
                                              user=user,
                                              identity=identity,
                                              state_ret=ret)

                    __salt__['git.checkout'](target,
                                             rev,
                                             force=force_checkout,
                                             user=user,
                                             state_ret=ret)

                # check if we are on a branch to merge changes
                cmd = "git symbolic-ref -q HEAD > /dev/null"
                retcode = __salt__['cmd.retcode'](cmd, cwd=target, runas=user)
                if 0 == retcode:
                    __salt__['git.fetch' if bare else 'git.pull'](target,
                                                                  opts=fetch_opts,
                                                                  user=user,
                                                                  identity=identity, state_ret=ret)

                if submodules:
                    __salt__['git.submodule'](target,
                                              user=user,
                                              identity=identity,
                                              opts='--recursive',
                                              state_ret=ret)

                new_rev = __salt__['git.revision'](cwd=target, user=user, state_ret=ret)
        except Exception as exc:
            return _fail(
                    ret,
                    str(exc))

        if current_rev != new_rev:
            log.info('Repository {0} updated: {1} => {2}'.format(target,
                                                                 current_rev,
                                                                 new_rev))
            ret['comment'] = 'Repository {0} updated'.format(target)
            ret['changes']['revision'] = '{0} => {1}'.format(
                    current_rev, new_rev)
    else:
        if os.path.isdir(target):
            # git clone is required, target exists but force is turned on
            if force:
                log.debug(('target {0} found, but not a git repository. Since '
                           'force option is in use, deleting.').format(target))
                if os.path.islink(target):
                    os.remove(target)
                else:
                    shutil.rmtree(target)
            # git clone is required, but target exists and is non-empty
            elif os.listdir(target):
                return _fail(ret, 'Directory \'{0}\' exists, is non-empty, and '
                             'force option not in use'.format(target))

        # git clone is required
        log.debug(
                'target {0} is not found, "git clone" is required'.format(
                    target))
        if 'test' in __opts__:
            if __opts__['test']:
                return _neutral_test(
                        ret,
                        'Repository {0} is about to be cloned to {1}'.format(
                            name, target))
        try:
            # make the clone
            opts = '--mirror' if mirror else '--bare' if bare else ''
            # if remote_name is not origin add --origin <name> to opts
            if remote_name != 'origin':
                opts += ' --origin {0}'.format(remote_name)
            # do the clone
            __salt__['git.clone'](target,
                                  name,
                                  user=user,
                                  opts=opts,
                                  identity=identity,
                                  state_ret=ret)

            if rev and not bare:
                __salt__['git.checkout'](target, rev, user=user, state_ret=ret)

            if submodules:
                __salt__['git.submodule'](target,
                                          user=user,
                                          identity=identity,
                                          opts='--recursive',
                                          state_ret=ret)

            new_rev = None if bare else (
                __salt__['git.revision'](cwd=target, user=user, state_ret=ret))

        except Exception as exc:
            return _fail(
                    ret,
                    str(exc))

        message = 'Repository {0} cloned to {1}'.format(name, target)
        log.info(message)
        ret['comment'] = message

        ret['changes']['new'] = name
        ret['changes']['revision'] = new_rev
    return ret

def present(name, bare=True, runas=None, user=None, force=False):
    '''
    Make sure the repository is present in the given directory

    name
        Name of the directory where the repository is about to be created

    bare
        Create a bare repository (Default: True)

    runas
        Name of the user performing repository management operations

        .. deprecated:: 0.17.0

    user
        Name of the user performing repository management operations

        .. versionadded:: 0.17.0

    force
        Force-create a new repository into an pre-existing non-git directory
        (deletes contents)
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

    salt.utils.warn_until(
        'Hydrogen',
        'Please remove \'runas\' support at this stage. \'user\' support was '
        'added in 0.17.0',
        _dont_call_warnings=True
    )
    if runas:
        # Warn users about the deprecation
        ret.setdefault('warnings', []).append(
            'The \'runas\' argument is being deprecated in favor of \'user\', '
            'please update your state files.'
        )
    if user is not None and runas is not None:
        # user wins over runas but let warn about the deprecation.
        ret.setdefault('warnings', []).append(
            'Passed both the \'runas\' and \'user\' arguments. Please don\'t. '
            '\'runas\' is being ignored in favor of \'user\'.'
        )
        runas = None
    elif runas is not None:
        # Support old runas usage
        user = runas
        runas = None

    # If the named directory is a git repo return True
    if os.path.isdir(name):
        if bare and os.path.isfile('{0}/HEAD'.format(name)):
            return ret
        elif not bare and os.path.isdir('{0}/.git'.format(name)):
            return ret
        # Directory exists and is not a git repo, if force is set destroy the
        # directory and recreate, otherwise throw an error
        elif not force and os.listdir(name):
            return _fail(ret,
                         'Directory which does not contain a git repo '
                         'is already present at {0}. To delete this '
                         'directory and create a fresh git repo set '
                         'force: True'.format(name))

    # Run test is set
    if __opts__['test']:
        ret['changes']['new repository'] = name
        return _neutral_test(ret, ('New git repo set for'
                                   ' creation at {0}').format(name))

    if force and os.path.isdir(name):
        if os.path.islink(name):
            os.remove(name)
        else:
            shutil.rmtree(name)

    opts = '--bare' if bare else ''
    __salt__['git.init'](cwd=name, user=user, opts=opts, state_ret=ret)

    message = 'Initialized repository {0}'.format(name)
    log.info(message)
    ret['changes']['new repository'] = name
    ret['comment'] = message

    return ret

def _fail(ret, comment):
    ret['result'] = False
    ret['comment'] = comment
    return ret

def _neutral_test(ret, comment):
    ret['result'] = None
    ret['comment'] = comment
    return ret

def _run_check(cmd_kwargs, onlyif, unless):
    '''
    Execute the onlyif and unless logic.
    Return a result dict if:
    * onlyif failed (onlyif != 0)
    * unless succeeded (unless == 0)
    else return True
    '''
    if onlyif:
        if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0:
            return {'comment': 'onlyif execution failed',
                    'result': True}

    if unless:
        if __salt__['cmd.retcode'](unless, **cmd_kwargs) == 0:
            return {'comment': 'unless execution succeeded',
                    'result': True}

    # No reason to stop, return True
    return True


text:
class SessionValidator
  class SessionStartTimeValidator
    def initialize(session_duration)
      @session_duration = session_duration
    end

    def validate(_cookies, session)
      begin
        session_start_time_integer = session.fetch(:start_time)
        session_start_time = Time.at(Integer(session_start_time_integer) / 1000).to_datetime
        validate_expiry(session, session_start_time)
      rescue KeyError
        ValidationFailure.something_went_wrong("start_time not in session")
      end
    end

  private

    def validate_expiry(session, session_start_time)
      if session_start_time <= @session_duration.minutes.ago
        minutes_ago = ((DateTime.now - session_start_time) * 24 * 60).to_i - @session_duration
        ValidationFailure.session_expired(session, minutes_ago)
      else
        SuccessfulValidation
      end
    end
  end
end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.dspace</groupId>
   <artifactId>dspace-jspui-webapp</artifactId>
   <name>DSpace JSP-UI :: Web Application Resources</name>
   <packaging>war</packaging>
   <url>http://projects.dspace.org/dspace-jspui/dspace-jspui-webapp</url>
   <description>DSpace JSP Based Webapplication Resources</description>

   <!--
      A Parent POM that Maven inherits DSpace Default
      POM atrributes from.
   -->
   <parent>
      <groupId>org.dspace</groupId>
      <artifactId>dspace-jspui</artifactId>
      <version>1.7.3-SNAPSHOT</version>
   </parent>

   <!--
      The Subversion repository location is used by Continuum to update against
      when changes have occured, this spawns a new build cycle and releases snapshots
      into the snapshot repository below.
   -->
   <scm>
      <connection>scm:svn:http://scm.dspace.org/svn/repo/dspace/trunk/dspace-jspui/dspace-jspui-webapp</connection>
      <developerConnection>scm:svn:https://scm.dspace.org/svn/repo/dspace/trunk/dspace-jspui/dspace-jspui-webapp</developerConnection>
      <url>http://scm.dspace.org/svn/repo/dspace/trunk/dspace-jspui/dspace-jspui-webapp</url>
   </scm>

   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
               <archiveClasses>false</archiveClasses>
               <!-- In version 2.1-alpha-1, this was incorrectly named warSourceExcludes -->
               <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
               <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
               <webResources>
                  <resource>
                     <filtering>true</filtering>
                     <directory>${basedir}/src/main/webapp</directory>
                     <includes>
                        <include>WEB-INF/web.xml</include>
                     </includes>
                  </resource>
               </webResources>
            </configuration>
            <executions>
               <execution>
                  <phase>prepare-package</phase>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <!--
         when activated a dspace.config configuration
         file location passed on the commandline
         (-Ddspace.config=...) can be passed through
         to be used as a filter source by projects for
         tasks such as updating the ${dspace.dir} in
         web.xml etc.
      -->
      <profile>
         <activation>
            <property>
               <name>dspace.config</name>
            </property>
         </activation>
         <build>
            <filters>
               <filter>${dspace.config}</filter>
            </filters>
         </build>
      </profile>
      <profile>
         <id>oracle-support</id>
         <activation>
            <property>
               <name>db.name</name>
               <value>oracle</value>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>com.oracle</groupId>
               <artifactId>ojdbc6</artifactId>
            </dependency>
         </dependencies>
      </profile>
      <profile>
         <id>postgres-support</id>
         <activation>
            <property>
               <name>!db.name</name>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>postgresql</groupId>
               <artifactId>postgresql</artifactId>
            </dependency>
         </dependencies>
      </profile>
   </profiles>

   <dependencies>
      <dependency>
         <groupId>org.dspace</groupId>
         <artifactId>dspace-api</artifactId>
      </dependency>
      <dependency>
         <groupId>org.dspace</groupId>
         <artifactId>dspace-jspui-api</artifactId>
      </dependency>
      <dependency>
      	<groupId>javax.servlet</groupId>
      	<artifactId>jsp-api</artifactId>
      	<version>2.0</version>
      	<type>jar</type>
      	<scope>provided</scope>
      </dependency>
   </dependencies>

</project>


text:
layout: post
title: if-then & tenses
categories:
- Learning
---

3 conditions...

1. E.g. If she wins... she will go Present ... will + Verb
2. E.g. If she won... she would go Past... would/could + verb
3. W.g. If she had won... she would have gone Past Perfect... would/could + have + Participle


text:
[![TravisCI Build Status](https://travis-ci.org/deepcake/echo.svg?branch=master)](https://travis-ci.org/deepcake/echo)

Super lightweight Entity Component System framework for Haxe.
Initially created to learn the power of macros.
Focused to be simple and fast.
Inspired by other haxe ECS frameworks, especially [EDGE](https://github.com/fponticelli/edge), [ECX](https://github.com/eliasku/ecx), [ESKIMO](https://github.com/PDeveloper/eskimo) and [Ash-Haxe](https://github.com/nadako/Ash-Haxe)

#### Wip

### Overview
 * Component is an instance of `T:Any` class. For each class `T` will be generated a global component container, where instance of `T` is a value and `Entity` is a key.
 * `Entity` in that case is just an abstract over the `Int`, but with the ability to work with it as with a set of components like in other regular ECS frameworks.
 * `View<T1, T2, TN>` is a collection of entities containing all components of the required types `T1, T2, TN`. Views are placed in Systems.
 * `System` is a place for processing a certain set of data represented by views.
 * To organize systems in phases can be used the `SystemList`.

#### Example
```haxe
import echoes.SystemList;
import echoes.Workflow;
import echoes.Entity;

class Example {
  static function main() {
    var physics = new SystemList()
      .add(new Movement())
      .add(new CollisionResolver());

    Workflow.addSystem(physics);
    Workflow.addSystem(new Render()); // or just add systems directly

    var john = createRabbit(0, 0, 1, 1, 'John');
    var jack = createRabbit(5, 5, 1, 1, 'Jack');

    trace(jack.exists(Position)); // true
    trace(jack.get(Position).x); // 5
    jack.remove(Position); // oh no!
    jack.add(new Position(1, 1)); // okay

    // also somewhere should be Workflow.update call on every tick
    Workflow.update(1.0);
  }
  static function createTree(x:Float, y:Float) {
    return new Entity()
      .add(new Position(x, y))
      .add(new Sprite('assets/tree.png'));
  }
  static function createRabbit(x:Float, y:Float, vx:Float, vy:Float, name:Name) {
    var pos = new Position(x, y);
    var vel = new Velocity(vx, vy);
    var spr = new Sprite('assets/rabbit.png');
    return new Entity().add(pos, vel, spr, name);
  }
}

@:forward
abstract Name(String) from String to String {
  public function new(name:String) this = name;
}

class Movement extends echoes.System {
  // @update-functions will be called for every entity that contains all the defined components;
  // All args are interpreted as components, except Float (reserved for delta time) and Int/Entity;
  @update function updateBody(pos:Position, vel:Velocity, dt:Float, entity:Entity) {
    pos.x += vel.x * dt;
    pos.y += vel.y * dt;
  }
  // If @update-functions are defined without components,
  // they are called only once per system's update;
  @update function traceHello(dt:Float) {
    trace('Hello!');
  }
  // The execution order of @update-functions is the same as the definition order,
  // so you can perform some preparations before or after iterating over entities;
  @update function traceWorld() {
    trace('World!');
  }
}

class NamePrinter extends echoes.System {
  // All of necessary for meta-functions views will be defined and initialized under the hood,
  // but it is also possible to define the View manually (initialization is still not required)
  // for additional features such as counting and sorting entities;
  var named:View<Name>;

  @update function sortAndPrint() {
    named.entities.sort((e1, e2) -> e1.get(Name) < e2.get(Name) ? -1 : 1);
    // using Lambda
    named.entities.iter(e -> trace(e.get(Name)));
  }
}

class Render extends echoes.System {
  var scene:DisplayObjectContainer;
  // There are @a, @u and @r shortcuts for @added, @update and @removed metas;
  // @added/@removed-functions are callbacks that are called when an entity is added/removed from the view;
  @a function onEntityWithSpriteAndPositionAdded(spr:Sprite, pos:Position) {
    scene.addChild(spr);
  }
  // Even if callback was triggered by destroying the entity,
  // @removed-function will be called before this happens,
  // so access to the component will be still exists;
  @r function onEntityWithSpriteAndPositionRemoved(spr:Sprite, pos:Position, e:Entity) {
    scene.removeChild(spr); // spr is still not a null
    trace('Oh My God! They removed ${ e.exists(Name) ? e.get(Name) : "Unknown Sprite" }!');
  }
  @u inline function updateSpritePosition(spr:Sprite, pos:Position) {
    spr.x = pos.x;
    spr.y = pos.y;
  }
  @u inline function afterSpritePositionsUpdated() {
    // rendering, etc
  }
}
```

#### Live
[Tiger on the Meadow!](https://deepcake.github.io/tiger_on_the_meadow/bin/) ([source](https://github.com/deepcake/tiger_on_the_meadow)) - small example of using Echo framework

#### Also
There is also exists a few additional compiler flags:
 * `-D echoes_profiling` - collecting some more info in `Workflow.info()` method for debug purposes
 * `-D echoes_report` - traces a short report of built components and views
 * `-D echoes_array_container` - using Array<T> instead IntMap<T> for global component containers

### Install
```haxelib git echoes https://github.com/deepcake/echo.git```


text:
layout: post
date:	2011-10-18 21:24:00
title:  Some butterflies in the MICO Arekere Reserve Forest
tags: [archived-posts]
categories: archives
permalink: /:categories/:year/:month/:day/:title/
---
Here are some of the common butterflies that one can see around us, right now. One of the good places to look for them is the Reserve Forest  in the MICO Arikere Layout; but quite often, you will find these beauties in the gardens near you, too!

SNOW FLAT

<lj-cut text="Look for  more if you like">

LEMON PANSY

COMMON ROSE

BARONET

BARONET closed wing

COMMON CASTOR

TAWNY COSTER

PALMFLY

COMMON PIERROT

PLUM JUDY:

CRIMSON ROSE mating:

<lj-embed id="818"/>

</lj-cut>

And, just to wind up,  a beautiful beetle, too.

JEWEL BUG

Do look around you as you walk in the residential lanes of our city....these lovely creatures provide spots of colour and beauty to your day.


text:
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="0dp"
    android:layout_height="0dp" />


text:
{% extends 'layout.html' %}
{% block content %}
<link rel="stylesheet" href="/static/css/jquery.fileupload.css">
<link rel="stylesheet" href="/static/css/jquery.fileupload-ui.css">

<form id="fileupload" action="/+upload/" method="POST" enctype="multipart/form-data">

                Add files...
                <input type="file" name="data-files" multiple>

            <button type="submit" class="btn btn-primary start">

                Start upload
            </button>
            <button type="reset" class="btn btn-warning cancel">

                Cancel upload
            </button>
            <button type="button" class="btn btn-danger delete">

                Delete
            </button>
            <input type="checkbox" class="toggle">

</form>

{% for file in files %}

{{ file.name }}

Processing...

            <button class="btn btn-primary start" disabled>

                Start
            </button>
            <button class="btn btn-warning cancel">

                Cancel
            </button>

{% endfor %}

{% endblock %}


text:
title: «Selenium Zombies» (Project)
categories: [cv, project]
layout: "posts"
---

2011.04 - 2011.12	mellom oppdrag	«Selenium Zombies»
Antares Gruppen AS (nå i Acando)
Primus motor, evangelist, arkitekt, tester og utvikler.
Beskrivelse: Integrasjonstestene i SmartFinans hadde forfalt - de feilet ofte og ble ikke lenger kjørt.
Tommy skisserte, foreslo og drev igjennom et prosjekt for å gjenopplive integrasjonstestene i et rammeverk som gjør dem mer levedyktige ved bruk av en del Patterns / Best Practices. Han har presentert disse i interne og eksterne fagmøter. I prosjektet utviklet han "test-data-control", en utility for å dumpe data fra database i json som kunne redigeres og lastes opp igjen som et basis sett av data for integrasjonstester. Tommy har sluppet dette verktøyet som åpen kilde og artefakter lastes opp til Maven Central via SonaType OSS under namespace "no.antares" som Tommy administrerer.
Teknologi: Test patterns, Selenium 2, Fit, jUnit, dbUnit, Json, Xml, XStream, Scala, Hudson byggtjener, Maven, SonaType OSS.
Url: http://code.google.com/p/test-data-control/
Hovedoppgaver og ansvar: Utvikle en arkitektur for levedyktige integrasjonstester.


text:
package main

import (
	"github.com/farmer-project/farmer/api"
	"github.com/farmer-project/farmer/db"
	"github.com/farmer-project/farmer/farmer"
)

func main() {
	// Database
	db.Connect()
	defer db.Close()

	db.DB.AutoMigrate(
		&farmer.Release{},
		&farmer.Domain{},
		&farmer.Box{},
	)

	// API Server
	api.Listen()
}


text:
package com.caffinc.jetter.helper;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 * @author Sriram
 * @since 4/28/2016
 */
@Path("/dummy")
public class DummyResource {
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getResponse(@QueryParam("msg") String message) {
        DummyResponse response = new DummyResponse();
        response.setMessage(message);
        return Response.ok(response).build();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <FrameLayout
        android:id="@+id/fl_topbar"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

    <LinearLayout
        android:id="@+id/activity_comm_detail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:visibility="gone"
        >
        <ViewStub
            android:id="@+id/vs_net_error"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout="@layout/network_error"
            />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <android.support.v4.view.ViewPager
                        android:id="@+id/viewPager"
                        android:layout_width="match_parent"
                        android:layout_height="300dp"
                        android:src="@mipmap/image_default"
                        />
                    <LinearLayout
                        android:id="@+id/ll_dot"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom|center"
                        android:layout_marginBottom="10dp"
                        android:orientation="horizontal"
                        />

                </FrameLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:padding="20dp">

                    <TextView
                        android:id="@+id/tv_now_price"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="#000"
                        android:textSize="18dp" />

                    <TextView
                        android:id="@+id/tv_old_price"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@id/tv_now_price"
                        android:layout_toRightOf="@id/tv_now_price"
                        android:textSize="12dp" />

                    <TextView
                        android:id="@+id/tv_discount"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@id/tv_old_price"
                        android:layout_marginLeft="10dp"
                        android:layout_toRightOf="@id/tv_old_price"
                        android:background="@drawable/detail_discount_background"
                        android:gravity="bottom"
                        android:textColor="@color/main"
                        android:textSize="10dp" />

                    <LinearLayout
                        android:id="@+id/ll_collect"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginLeft="20dp"
                        android:orientation="vertical"
                        >
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@mipmap/detail_collect_normal"
                            />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="收藏"
                            android:textSize="12sp" />
                    </LinearLayout>

                    <TextView
                        android:id="@+id/tv_comm_name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/tv_now_price"
                        />

                    <View
                        android:layout_width="1dp"
                        android:layout_height="30dp"
                        android:layout_centerVertical="true"
                        android:layout_toLeftOf="@id/ll_collect"
                        android:background="@android:color/darker_gray" />

                </RelativeLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="0.5dp"
                    android:layout_marginLeft="@dimen/text_vertical_margin"
                    android:layout_marginRight="@dimen/text_vertical_margin"
                    android:background="@android:color/darker_gray" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/text_vertical_margin"
                    android:layout_marginRight="@dimen/text_vertical_margin"
                    android:gravity="center"
                    android:orientation="horizontal"
                    android:paddingTop="20dp">

                    <TextView
                        android:id="@+id/tv_switch_advisory"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="-0.5dp"
                        android:layout_weight="1"
                        android:background="@drawable/switch_commdetail_normal"
                        android:gravity="center"
                        android:text="咨询售后"
                        android:textColor="@android:color/white"
                        android:textSize="14sp" />

                    <TextView
                        android:id="@+id/tv_switch_comminfo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="-0.5dp"
                        android:layout_weight="1"
                        android:background="@drawable/switch_commdetail_selector"
                        android:gravity="center"
                        android:text="商品信息"
                        android:textColor="@android:color/black"
                        android:textSize="14sp" />

                </LinearLayout>

                <FrameLayout
                    android:id="@+id/fl_commdetail"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

            </LinearLayout>

        </ScrollView>

    </LinearLayout>

</LinearLayout>