text:
// flow-typed signature: 43c8e78eddfb29171102fff73142251a
// flow-typed version: <<STUB>>/@storybook/addon-storyshots_v3.4.1/flow_v0.70.0

/**
 * This is an autogenerated libdef stub for:
 *
 *   '@storybook/addon-storyshots'
 *
 * Fill this stub out by replacing all the `any` types.
 *
 * Once filled out, we encourage you to share your work with the
 * community by sending a pull request to:
 * https://github.com/flowtype/flow-typed
 */

declare module '@storybook/addon-storyshots' {
  declare module.exports: any;
}

/**
 * We include stubs for each file inside this npm package in case you need to
 * require those files directly. Feel free to delete any files that aren't
 * needed.
 */
declare module '@storybook/addon-storyshots/dist/angular/app.component' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/angular/app.token' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/angular/helpers' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/angular/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/angular/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/angular/types' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/config-loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/frameworkLoader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/hasDependency' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/index' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/react/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/react/renderShallowTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/react/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/require_context' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/rn/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/storybook-channel-mock' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/test-bodies' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/test-body-image-snapshot' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/utils' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/vue/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/dist/vue/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/angular/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/angular/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/config-loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/frameworkLoader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/hasDependency' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/index' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/react/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/react/renderShallowTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/react/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/require_context' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/rn/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/storybook-channel-mock' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/test-bodies' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/test-body-image-snapshot' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/utils' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/utils.test' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/vue/loader' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/src/vue/renderTree' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/directly_required/index' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/required_with_context/Button.stories' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/required_with_context/Welcome.stories' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/storyshot.enzyme.test' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/storyshot.renderOnly.test' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/storyshot.shallow.test' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/storyshot.shallowWithOptions.test' {
  declare module.exports: any;
}

declare module '@storybook/addon-storyshots/stories/storyshot.test' {
  declare module.exports: any;
}

// Filename aliases
declare module '@storybook/addon-storyshots/dist/angular/app.component.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/app.component'>;
}
declare module '@storybook/addon-storyshots/dist/angular/app.token.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/app.token'>;
}
declare module '@storybook/addon-storyshots/dist/angular/helpers.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/helpers'>;
}
declare module '@storybook/addon-storyshots/dist/angular/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/loader'>;
}
declare module '@storybook/addon-storyshots/dist/angular/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/renderTree'>;
}
declare module '@storybook/addon-storyshots/dist/angular/types.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/angular/types'>;
}
declare module '@storybook/addon-storyshots/dist/config-loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/config-loader'>;
}
declare module '@storybook/addon-storyshots/dist/frameworkLoader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/frameworkLoader'>;
}
declare module '@storybook/addon-storyshots/dist/hasDependency.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/hasDependency'>;
}
declare module '@storybook/addon-storyshots/dist/index.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/index'>;
}
declare module '@storybook/addon-storyshots/dist/react/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/react/loader'>;
}
declare module '@storybook/addon-storyshots/dist/react/renderShallowTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/react/renderShallowTree'>;
}
declare module '@storybook/addon-storyshots/dist/react/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/react/renderTree'>;
}
declare module '@storybook/addon-storyshots/dist/require_context.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/require_context'>;
}
declare module '@storybook/addon-storyshots/dist/rn/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/rn/loader'>;
}
declare module '@storybook/addon-storyshots/dist/storybook-channel-mock.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/storybook-channel-mock'>;
}
declare module '@storybook/addon-storyshots/dist/test-bodies.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/test-bodies'>;
}
declare module '@storybook/addon-storyshots/dist/test-body-image-snapshot.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/test-body-image-snapshot'>;
}
declare module '@storybook/addon-storyshots/dist/utils.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/utils'>;
}
declare module '@storybook/addon-storyshots/dist/vue/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/vue/loader'>;
}
declare module '@storybook/addon-storyshots/dist/vue/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/dist/vue/renderTree'>;
}
declare module '@storybook/addon-storyshots/src/angular/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/angular/loader'>;
}
declare module '@storybook/addon-storyshots/src/angular/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/angular/renderTree'>;
}
declare module '@storybook/addon-storyshots/src/config-loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/config-loader'>;
}
declare module '@storybook/addon-storyshots/src/frameworkLoader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/frameworkLoader'>;
}
declare module '@storybook/addon-storyshots/src/hasDependency.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/hasDependency'>;
}
declare module '@storybook/addon-storyshots/src/index.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/index'>;
}
declare module '@storybook/addon-storyshots/src/react/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/react/loader'>;
}
declare module '@storybook/addon-storyshots/src/react/renderShallowTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/react/renderShallowTree'>;
}
declare module '@storybook/addon-storyshots/src/react/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/react/renderTree'>;
}
declare module '@storybook/addon-storyshots/src/require_context.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/require_context'>;
}
declare module '@storybook/addon-storyshots/src/rn/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/rn/loader'>;
}
declare module '@storybook/addon-storyshots/src/storybook-channel-mock.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/storybook-channel-mock'>;
}
declare module '@storybook/addon-storyshots/src/test-bodies.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/test-bodies'>;
}
declare module '@storybook/addon-storyshots/src/test-body-image-snapshot.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/test-body-image-snapshot'>;
}
declare module '@storybook/addon-storyshots/src/utils.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/utils'>;
}
declare module '@storybook/addon-storyshots/src/utils.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/utils.test'>;
}
declare module '@storybook/addon-storyshots/src/vue/loader.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/vue/loader'>;
}
declare module '@storybook/addon-storyshots/src/vue/renderTree.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/src/vue/renderTree'>;
}
declare module '@storybook/addon-storyshots/stories/directly_required/index.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/directly_required/index'>;
}
declare module '@storybook/addon-storyshots/stories/required_with_context/Button.stories.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/required_with_context/Button.stories'>;
}
declare module '@storybook/addon-storyshots/stories/required_with_context/Welcome.stories.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/required_with_context/Welcome.stories'>;
}
declare module '@storybook/addon-storyshots/stories/storyshot.enzyme.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/storyshot.enzyme.test'>;
}
declare module '@storybook/addon-storyshots/stories/storyshot.renderOnly.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/storyshot.renderOnly.test'>;
}
declare module '@storybook/addon-storyshots/stories/storyshot.shallow.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/storyshot.shallow.test'>;
}
declare module '@storybook/addon-storyshots/stories/storyshot.shallowWithOptions.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/storyshot.shallowWithOptions.test'>;
}
declare module '@storybook/addon-storyshots/stories/storyshot.test.js' {
  declare module.exports: $Exports<'@storybook/addon-storyshots/stories/storyshot.test'>;
}


text:
FROM composer:latest as composer
FROM php:8.1.0-fpm

RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)";
ENV MAKEFLAGS="-j${CPU_CORES}"

RUN apt update -y && apt install -y \
    wget \
    zip \
    git \
    apt-utils \
    sudo \
    libicu-dev \
    libgmp-dev \
    libzip-dev && \
    pecl install psr zephir_parser

RUN docker-php-ext-install zip gmp intl mysqli && \
    docker-php-ext-enable psr zephir_parser

COPY --from=composer /usr/bin/composer /usr/local/bin/composer
# Bash script with helper aliases
COPY ./.bashrc /root/.bashrc

CMD ["php-fpm"]

redpajama_set_name: RedPajamaGithub


text:
import {StringDecoder} from 'string_decoder'

/**
 *
 * @description single instance of StringDecoder is all we need
 */
export const decoder = new StringDecoder('utf8')

/**
 * @description a seed for default generator
 * @type {string}
 */
const defaultCharset = '0123456789abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ'

/**
 *
 * @param {number} len - random string length
 * @param {string} charSet - character set of which the random string should
 * consist of
 * @yields {string}
 */
export function * randStringGen(len = 6, charSet = defaultCharset) {
  let cl = charSet.length
  while (true) {
    let out = ''
    for (let i = 0; i <= len; i++) {
      out += charSet[~~(Math.random() * cl)]
    }
    yield out
  }
}

/**
 *
 * @description I know it's an anti-pattern to defer promises, but I need to
 * create them in one place and finalize in the other
 * @returns {{promise: Promise, resolve: function, reject: function}}
 */
export const defer = ()=> {
  let deferred = {}
  deferred.promise = new Promise((resolve, reject) => {
    deferred.resolve = resolve
    deferred.reject = reject
  })
  return deferred
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>mvclpf2</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="mvclpf1.html" title="mvclpf1" />
    <link rel="next" href="mvclpf3.html" title="mvclpf3" />

          mvclpf2

          Prev
          Orchestra Opcodes and Operators
           Next

          mvclpf2

mvclpf2 —
      Moog voltage-controlled lowpass filter emulation.

Description

Mvclpf2 is an digital implementation of the 4th-order (24 dB/oct) Moog ladder filter
originally written by Fons Andriaensen. According to the author,
mvclpf2 "uses five non-linear elements, in the input and in all four filter
sections. It works by using the derivative of the nonlinearity (for which
1 / (1 + x * x) is reasonable approximation). The main advantage of this is
that only one evaluation of the non-linear function is required for each
section".

Syntax

asig mvclpf2 ain, xcf, xres[, istor]

Initialization

      istor --initial disposition of internal
      data space. Since filtering incorporates a feedback loop of
      previous output, the initial status of the storage space used is
      significant.  A zero value will clear the space; a non-zero
      value will allow previous information to remain. The default
      value is 0.

Performance

      ain -- input signal.

      xcf -- filter
      cutoff frequency. The useful range is around six octaves below
      and above middle C (pch 8.00).

      xres  --
      resonance, limited to the interval [0,1].

Examples

      Here is an example of the mvclpf2 opcode. It uses the file mvclpf2.csd.

            Example 560. Example of the mvclpf2 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
0dbfs = 1

instr 1
 kenv linen p4,0.1,p3,0.1
 ain rand kenv
 kfr expon 220, p3, 1760
 asig mvclpf1 ain,kfr,0.9
   out asig
endin

</CsInstruments>
<CsScore>
i1 0 5 0.9
</CsScore>
</CsoundSynthesizer>

Credits

            Author: Fons Andriaensen,

             ported to Csound by Victor Lazzarini

            January 2016

New in version 6.07

January 2016.

          Prev

            Up

           Next

          mvclpf1

            Home

           mvclpf3


text:
// Generated by xsd compiler for android/java
// DO NOT CHANGE!
package ebay.apis.eblbasecomponents;

/**
 *
 * For GetSellerPayments, indicates the type of Half.com payment being
 * made (sale or refund).
 *
 */
public enum PaymentTypeCodeType {

    /**
     *
   * (out) The buyer paid the seller.
   * Applicable to Half.com.
   *
     */
    SALE("Sale"),

    /**
     *
   * (out) The seller issued a refund to the buyer.
   * Applicable to Half.com.
   *
     */
    REFUND("Refund"),

    /**
     *
   * For eBay internal use.
   *
     */
    SELLER_DENIED_PAYMENT("SellerDeniedPayment"),

    /**
     *
   * For eBay internal use.
   *
     */
    ADMIN_REVERSAL("AdminReversal"),

    /**
     *
   * All other payment types.
   *
     */
    ALL_OTHER("AllOther"),

    /**
     *
   * (out) The buyer paid the seller for a rental extension.
   * Applicable to Half.com only.
   *
     */
    RENTAL_EXTENSION("RentalExtension"),

    /**
     *
   * (out) The buyer paid the seller for a rental buyout.
   * Applicable to Half.com only.
   *
     */
    RENTAL_BUYOUT("RentalBuyout"),

    /**
     *
   * (out) Reserved for internal or future use.
   *
     */
    CUSTOM_CODE("CustomCode");

    private final String value;

    PaymentTypeCodeType(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static PaymentTypeCodeType fromValue(String v) {
        if (v != null) {
            for (PaymentTypeCodeType c: PaymentTypeCodeType.values()) {
                if (c.value.equals(v)) {
                    return c;
                }
            }
        }
        throw new IllegalArgumentException(v);
    }
}


text:
package mobi.cangol.mobile.base;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.fragment.app.FragmentActivity;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Toast;

import java.lang.ref.WeakReference;

import mobi.cangol.mobile.CoreApplication;
import mobi.cangol.mobile.logging.Log;
import mobi.cangol.mobile.service.AppService;
import mobi.cangol.mobile.service.session.Session;
import mobi.cangol.mobile.service.session.SessionService;

public abstract class BaseFragmentActivity extends FragmentActivity implements BaseActivityDelegate, CustomFragmentActivityDelegate {
    protected final String TAG = Log.makeLogTag(this.getClass());
    protected CoreApplication app;
    private CustomFragmentManager stack;
    private long startTime;
    private HandlerThread handlerThread;
    private Handler threadHandler;
    private Handler uiHandler;
    public float getIdleTime() {
        return (System.currentTimeMillis() - startTime) / 1000.0f;
    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.getWindow().setSoftInputMode(
                WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        Log.setLogTag(this);
        startTime = System.currentTimeMillis();
        handlerThread = new HandlerThread(TAG);
        handlerThread.start();
        threadHandler = new BaseActionBarActivity.InternalHandler(this,handlerThread.getLooper());
        uiHandler= new BaseActionBarActivity.InternalHandler(this,Looper.getMainLooper());
        app = (CoreApplication) this.getApplication();
        app.addActivityToManager(this);
    }
    @Override
    public void showToast(int resId) {
        if(!isFinishing())Toast.makeText(this.getApplicationContext(), resId, Toast.LENGTH_SHORT).show();
    }
    @Override
    public void showToast(String str) {
        if(!isFinishing())Toast.makeText(this.getApplicationContext(), str, Toast.LENGTH_SHORT).show();
    }
    @Override
    public void showToast(int resId, int duration) {
        if(!isFinishing())Toast.makeText(this.getApplicationContext(), resId, duration).show();
    }
    @Override
    public void showToast(String str, int duration) {
        if(!isFinishing())Toast.makeText(this.getApplicationContext(), str, duration).show();
    }

    /**
     * 初始自定义栈管理器
     *
     * @param containerId
     */
    @Override
    public void initFragmentStack(int containerId) {
        if (null == stack)
            stack = CustomFragmentManager.forContainer(this, containerId, this.getSupportFragmentManager());
    }

    /**
     * 替换fragment
     *
     * @param fragmentClass
     * @param tag
     * @param args
     */
    @Override
    public void replaceFragment(Class<? extends BaseFragment> fragmentClass, String tag, Bundle args) {
        if (null == stack) {
            throw new IllegalStateException("stack is null");
        }else if(!stack.isStateSaved()){
            stack.replace(fragmentClass, tag, args);
            stack.commit();
        }else{
            Log.e(TAG,"Can not perform this action after onSaveInstanceState");
        }
    }
    @Override
    public void replaceFragment(Class<? extends BaseFragment> fragmentClass, String tag, Bundle args,int moduleId) {
        this.replaceFragment(fragmentClass,tag,args);
    }
    @Override
    public CustomFragmentManager getCustomFragmentManager() {
        return stack;
    }

    /**
     * 获取AppService
     *
     * @param name
     * @return
     */
    public AppService getAppService(String name) {
        return app.getAppService(name);
    }

    /**
     * 获取Session
     *
     * @return
     */
    public Session getSession() {
        return app.getSession();
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.v(TAG, "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.v(TAG, "onResume " + getIdleTime() + "s");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.v(TAG, "onPause");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.v(TAG, "onRestart");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.v(TAG, "onStop");
    }

    @Override
    protected void onDestroy() {
        Log.v(TAG, "onDestroy");
        if (null != stack)stack.destroy();
        app.delActivityFromManager(this);
        handlerThread.quit();
        super.onDestroy();
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        if (null != stack) stack.restoreState(savedInstanceState);
        Log.v(TAG, "onRestoreInstanceState");
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        if (null != stack) stack.saveState(outState);
        Log.v(TAG, "onSaveInstanceState");
    }

    @Override
    public Object getLastCustomNonConfigurationInstance() {
        Log.v(TAG, "getLastCustomNonConfigurationInstance");
        return super.getLastCustomNonConfigurationInstance();
    }

    @Override
    public Object onRetainCustomNonConfigurationInstance() {
        Log.v(TAG, "onRetainCustomNonConfigurationInstance");
        return super.onRetainCustomNonConfigurationInstance();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Log.v(TAG, "onConfigurationChanged");
    }

    /**
     * 设置全屏
     *
     * @param fullscreen
     */
    @Override
    public void setFullScreen(boolean fullscreen) {
        if (fullscreen) {
            this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }

    }
    @Override
    public boolean isFullScreen() {
        int flag = this.getWindow().getAttributes().flags;
         return (flag & WindowManager.LayoutParams.FLAG_FULLSCREEN)
                    == WindowManager.LayoutParams.FLAG_FULLSCREEN;
    }
    @Override
    public final  void onBackPressed() {
        Log.v(TAG, "onBackPressed ");
        if (null == stack||stack.size()==0||stack.peek()==null) {
            onBack();
        }else {
            if (!stack.peek().onBackPressed()) {
                if (stack.size() == 1)  {
                    onBack();
                }else{
                    stack.popBackStack();
                }
            }
        }
    }

    /**
     * 处理back事件
     */
    @Override
    public void onBack() {
        Log.v(TAG, "onBack");
        super.onBackPressed();
    }
    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (null == stack||stack.size()==0||stack.peek()==null) {
            return super.onKeyUp(keyCode, event);
        }else {
            if(stack.peek().onKeyUp(keyCode, event)){
                return true;
            }else {
                return super.onKeyUp(keyCode, event);
            }
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (null == stack||stack.size()==0||stack.peek()==null) {
            return super.onKeyDown(keyCode, event);
        }else {
            if(stack.peek().onKeyDown(keyCode, event)){
                return true;
            }else {
                return super.onKeyDown(keyCode, event);
            }
        }
    }
    @Override
    public void showSoftInput(EditText editText) {
        editText.requestFocus();
        InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(editText, 0);
        editText.setText(null);
    }
    @Override
    public void hideSoftInput() {
        InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (this.getCurrentFocus() != null) {
            imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }
    @Override
    public void hideSoftInput(EditText editText) {
        InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }

    @Override
    public Handler getUiHandler() {
        return uiHandler;
    }

    @Override
    public Handler getThreadHandler() {
        return threadHandler;
    }

    protected void postRunnable(StaticInnerRunnable runnable) {
        if (threadHandler!= null && runnable != null)
            threadHandler.post(runnable);
    }
    protected void handleMessage(Message msg) {
        //do somethings
    }
    protected  static class StaticInnerRunnable implements Runnable{
        @Override
        public void run() {
            //do somethings
        }
    }
    static final  class InternalHandler extends Handler {
        private final WeakReference<Context> mContext;

        public InternalHandler(Context context,Looper looper) {
            super(looper);
            mContext = new WeakReference<>(context);
        }

        public void handleMessage(Message msg) {
            Context context = mContext.get();
            if (context != null) {
                ((BaseFragmentActivity)context).handleMessage(msg);
            }
        }
    }

    @ColorInt
    public  int getThemeAttrColor(@AttrRes int colorAttr) {
        TypedArray array = this.obtainStyledAttributes(null, new int[]{colorAttr});
        try {
            return array.getColor(0, 0);
        } finally {
            array.recycle();
        }
    }
}


text:
namespace ParentLoadSoftDelete.DataAccess.ERCLevel
{
    public partial class F03_Continent_ChildDto
    {
    }
}


text:
// Copyright 2017, Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Google.Cloud.Speech.V1
{
    ///
    /// A helper class forming a hierarchy of supported language codes, via nested classes.
    /// All language codes are eventually represented as string constants. This is simply
    /// a code-convenient form of the table at https://cloud.google.com/speech/docs/languages.
    /// It is regenerated regularly, but not guaranteed to be complete at any moment in time;
    /// if the language you wish to use is present in the table but not covered here, please use
    /// the listed language code as a hard-coded string until this class catches up.
    ///
    public static class LanguageCodes
    {
        // To populate this class, run the LanguageCodeGenerator project and check how many entries
        // are reported. If it's different to the number reported below, replace everything below
        // (to just before the closing brace of this class) with the generated text in
        // language-codes.tmp.txt.

        // Generated 2017-03-31; 89 entries.

        /// Language codes for Afrikaans.
        public static class Afrikaans
        {
            /// Language code for Afrikaans (South Africa)
            public const string SouthAfrica = "af-ZA";

        }

        /// Language codes for Arabic.
        public static class Arabic
        {
            /// Language code for Arabic (Algeria)
            public const string Algeria = "ar-DZ";

            /// Language code for Arabic (Bahrain)
            public const string Bahrain = "ar-BH";

            /// Language code for Arabic (Egypt)
            public const string Egypt = "ar-EG";

            /// Language code for Arabic (Iraq)
            public const string Iraq = "ar-IQ";

            /// Language code for Arabic (Israel)
            public const string Israel = "ar-IL";

            /// Language code for Arabic (Jordan)
            public const string Jordan = "ar-JO";

            /// Language code for Arabic (Kuwait)
            public const string Kuwait = "ar-KW";

            /// Language code for Arabic (Lebanon)
            public const string Lebanon = "ar-LB";

            /// Language code for Arabic (Morocco)
            public const string Morocco = "ar-MA";

            /// Language code for Arabic (Oman)
            public const string Oman = "ar-OM";

            /// Language code for Arabic (Qatar)
            public const string Qatar = "ar-QA";

            /// Language code for Arabic (Saudi Arabia)
            public const string SaudiArabia = "ar-SA";

            /// Language code for Arabic (State of Palestine)
            public const string StateofPalestine = "ar-PS";

            /// Language code for Arabic (Tunisia)
            public const string Tunisia = "ar-TN";

            /// Language code for Arabic (United Arab Emirates)
            public const string UnitedArabEmirates = "ar-AE";

        }

        /// Language codes for Basque.
        public static class Basque
        {
            /// Language code for Basque (Spain)
            public const string Spain = "eu-ES";

        }

        /// Language codes for Bulgarian.
        public static class Bulgarian
        {
            /// Language code for Bulgarian (Bulgaria)
            public const string Bulgaria = "bg-BG";

        }

        /// Language codes for Catalan.
        public static class Catalan
        {
            /// Language code for Catalan (Spain)
            public const string Spain = "ca-ES";

        }

        /// Language codes for Chinese, Cantonese.
        public static class ChineseCantonese
        {
            /// Language code for Chinese, Cantonese (Traditional, Hong Kong)
            public const string TraditionalHongKong = "yue-Hant-HK";

        }

        /// Language codes for Chinese, Mandarin.
        public static class ChineseMandarin
        {
            /// Language code for Chinese, Mandarin (Simplified, China)
            public const string SimplifiedChina = "cmn-Hans-CN";

            /// Language code for Chinese, Mandarin (Simplified, Hong Kong)
            public const string SimplifiedHongKong = "cmn-Hans-HK";

            /// Language code for Chinese, Mandarin (Traditional, Taiwan)
            public const string TraditionalTaiwan = "cmn-Hant-TW";

        }

        /// Language codes for Croatian.
        public static class Croatian
        {
            /// Language code for Croatian (Croatia)
            public const string Croatia = "hr-HR";

        }

        /// Language codes for Czech.
        public static class Czech
        {
            /// Language code for Czech (Czech Republic)
            public const string CzechRepublic = "cs-CZ";

        }

        /// Language codes for Danish.
        public static class Danish
        {
            /// Language code for Danish (Denmark)
            public const string Denmark = "da-DK";

        }

        /// Language codes for Dutch.
        public static class Dutch
        {
            /// Language code for Dutch (Netherlands)
            public const string Netherlands = "nl-NL";

        }

        /// Language codes for English.
        public static class English
        {
            /// Language code for English (Australia)
            public const string Australia = "en-AU";

            /// Language code for English (Canada)
            public const string Canada = "en-CA";

            /// Language code for English (India)
            public const string India = "en-IN";

            /// Language code for English (Ireland)
            public const string Ireland = "en-IE";

            /// Language code for English (New Zealand)
            public const string NewZealand = "en-NZ";

            /// Language code for English (Philippines)
            public const string Philippines = "en-PH";

            /// Language code for English (South Africa)
            public const string SouthAfrica = "en-ZA";

            /// Language code for English (United Kingdom)
            public const string UnitedKingdom = "en-GB";

            /// Language code for English (United States)
            public const string UnitedStates = "en-US";

        }

        /// Language codes for Filipino.
        public static class Filipino
        {
            /// Language code for Filipino (Philippines)
            public const string Philippines = "fil-PH";

        }

        /// Language codes for Finnish.
        public static class Finnish
        {
            /// Language code for Finnish (Finland)
            public const string Finland = "fi-FI";

        }

        /// Language codes for French.
        public static class French
        {
            /// Language code for French (Canada)
            public const string Canada = "fr-CA";

            /// Language code for French (France)
            public const string France = "fr-FR";

        }

        /// Language codes for Galician.
        public static class Galician
        {
            /// Language code for Galician (Spain)
            public const string Spain = "gl-ES";

        }

        /// Language codes for German.
        public static class German
        {
            /// Language code for German (Germany)
            public const string Germany = "de-DE";

        }

        /// Language codes for Greek.
        public static class Greek
        {
            /// Language code for Greek (Greece)
            public const string Greece = "el-GR";

        }

        /// Language codes for Hebrew.
        public static class Hebrew
        {
            /// Language code for Hebrew (Israel)
            public const string Israel = "he-IL";

        }

        /// Language codes for Hindi.
        public static class Hindi
        {
            /// Language code for Hindi (India)
            public const string India = "hi-IN";

        }

        /// Language codes for Hungarian.
        public static class Hungarian
        {
            /// Language code for Hungarian (Hungary)
            public const string Hungary = "hu-HU";

        }

        /// Language codes for Icelandic.
        public static class Icelandic
        {
            /// Language code for Icelandic (Iceland)
            public const string Iceland = "is-IS";

        }

        /// Language codes for Indonesian.
        public static class Indonesian
        {
            /// Language code for Indonesian (Indonesia)
            public const string Indonesia = "id-ID";

        }

        /// Language codes for Italian.
        public static class Italian
        {
            /// Language code for Italian (Italy)
            public const string Italy = "it-IT";

        }

        /// Language codes for Japanese.
        public static class Japanese
        {
            /// Language code for Japanese (Japan)
            public const string Japan = "ja-JP";

        }

        /// Language codes for Korean.
        public static class Korean
        {
            /// Language code for Korean (South Korea)
            public const string SouthKorea = "ko-KR";

        }

        /// Language codes for Lithuanian.
        public static class Lithuanian
        {
            /// Language code for Lithuanian (Lithuania)
            public const string Lithuania = "lt-LT";

        }

        /// Language codes for Malay.
        public static class Malay
        {
            /// Language code for Malay (Malaysia)
            public const string Malaysia = "ms-MY";

        }

        /// Language codes for Norwegian Bokmål.
        public static class NorwegianBokmal
        {
            /// Language code for Norwegian Bokmål (Norway)
            public const string Norway = "nb-NO";

        }

        /// Language codes for Persian.
        public static class Persian
        {
            /// Language code for Persian (Iran)
            public const string Iran = "fa-IR";

        }

        /// Language codes for Polish.
        public static class Polish
        {
            /// Language code for Polish (Poland)
            public const string Poland = "pl-PL";

        }

        /// Language codes for Portuguese.
        public static class Portuguese
        {
            /// Language code for Portuguese (Brazil)
            public const string Brazil = "pt-BR";

            /// Language code for Portuguese (Portugal)
            public const string Portugal = "pt-PT";

        }

        /// Language codes for Romanian.
        public static class Romanian
        {
            /// Language code for Romanian (Romania)
            public const string Romania = "ro-RO";

        }

        /// Language codes for Russian.
        public static class Russian
        {
            /// Language code for Russian (Russia)
            public const string Russia = "ru-RU";

        }

        /// Language codes for Serbian.
        public static class Serbian
        {
            /// Language code for Serbian (Serbia)
            public const string Serbia = "sr-RS";

        }

        /// Language codes for Slovak.
        public static class Slovak
        {
            /// Language code for Slovak (Slovakia)
            public const string Slovakia = "sk-SK";

        }

        /// Language codes for Slovenian.
        public static class Slovenian
        {
            /// Language code for Slovenian (Slovenia)
            public const string Slovenia = "sl-SI";

        }

        /// Language codes for Spanish.
        public static class Spanish
        {
            /// Language code for Spanish (Argentina)
            public const string Argentina = "es-AR";

            /// Language code for Spanish (Bolivia)
            public const string Bolivia = "es-BO";

            /// Language code for Spanish (Chile)
            public const string Chile = "es-CL";

            /// Language code for Spanish (Colombia)
            public const string Colombia = "es-CO";

            /// Language code for Spanish (Costa Rica)
            public const string CostaRica = "es-CR";

            /// Language code for Spanish (Dominican Republic)
            public const string DominicanRepublic = "es-DO";

            /// Language code for Spanish (Ecuador)
            public const string Ecuador = "es-EC";

            /// Language code for Spanish (El Salvador)
            public const string ElSalvador = "es-SV";

            /// Language code for Spanish (Guatemala)
            public const string Guatemala = "es-GT";

            /// Language code for Spanish (Honduras)
            public const string Honduras = "es-HN";

            /// Language code for Spanish (Mexico)
            public const string Mexico = "es-MX";

            /// Language code for Spanish (Nicaragua)
            public const string Nicaragua = "es-NI";

            /// Language code for Spanish (Panama)
            public const string Panama = "es-PA";

            /// Language code for Spanish (Paraguay)
            public const string Paraguay = "es-PY";

            /// Language code for Spanish (Peru)
            public const string Peru = "es-PE";

            /// Language code for Spanish (Puerto Rico)
            public const string PuertoRico = "es-PR";

            /// Language code for Spanish (Spain)
            public const string Spain = "es-ES";

            /// Language code for Spanish (United States)
            public const string UnitedStates = "es-US";

            /// Language code for Spanish (Uruguay)
            public const string Uruguay = "es-UY";

            /// Language code for Spanish (Venezuela)
            public const string Venezuela = "es-VE";

        }

        /// Language codes for Swedish.
        public static class Swedish
        {
            /// Language code for Swedish (Sweden)
            public const string Sweden = "sv-SE";

        }

        /// Language codes for Thai.
        public static class Thai
        {
            /// Language code for Thai (Thailand)
            public const string Thailand = "th-TH";

        }

        /// Language codes for Turkish.
        public static class Turkish
        {
            /// Language code for Turkish (Turkey)
            public const string Turkey = "tr-TR";

        }

        /// Language codes for Ukrainian.
        public static class Ukrainian
        {
            /// Language code for Ukrainian (Ukraine)
            public const string Ukraine = "uk-UA";

        }

        /// Language codes for Vietnamese.
        public static class Vietnamese
        {
            /// Language code for Vietnamese (Vietnam)
            public const string Vietnam = "vi-VN";

        }

        /// Language codes for Zulu.
        public static class Zulu
        {
            /// Language code for Zulu (South Africa)
            public const string SouthAfrica = "zu-ZA";

        }
    }
}


text:
package models;

/**
 * Enumeration class Kind - write a description of the enum class here
 *
 * @author (your name here)
 * @version (version number or date here)
 */
public enum Kind {
  SPECIAL, PHYSICAL, NORMAL
}


text:
The KBase Module Builder (kb-sdk) is an application that helps developers initialize, compile, test, and run KBase modules. This document details how to install and use it.

The module builder tooling is being designed to allow complete local testing of long running jobs without any external registration or configuration of the deployed job execution engine. Implementation of the code for long running jobs is handled identically to implementations of server code in the current standard KBase server generation.

Stubs for services can be generated in Python, Java and Perl. Clients can be generated in Python, Java, JavaScript and Perl.
For an example KBase service with an asynchronous, long running job, see code and automated tests here:
- Perl: https://github.com/kbaseIncubator/contigcount/tree/develop
- Python: https://github.com/kbaseIncubator/onerepotest

An example KBase service written in Java will be available soon.

# Obtain and install prerequisites

1. Mac: OS X 10.8 or higher.
 - The SDK should also work on Linux but has not yet been extensively tested. We are not yet supporting Windows.
2. Java JDK (version 7 or above): http://java.oracle.com/
 - You will also need to set the JAVA_HOME environment variable to point to your Java installation.
3. Latest version of XCode (includes make and other developer tools)
4. ant: http://ant.apache.org/
 - You will also need to add the directory with the ant binary to your PATH environment variable.
5. git (command-line version): https://git-scm.com/ (OS X users should install Xcode to get git)
6. Create a GitHub account if you do not have one already: https://github.com
 - All modules in KBase are pulled and registered from public GitHub repositories

# Set environment variables

Set JAVA_HOME to the directory where you installed JDK. If you're not sure where that is, the command `/usr/libexec/java_home` will tell you.

    # for tcsh/csh
    setenv JAVA_HOME `/usr/libexec/java_home`
    # for bash
    export JAVA_HOME=`/usr/libexec/java_home`

Also, be sure your PATH includes the directory that has the *ant* executable.

# Get the git repos

    git clone https://github.com/kbase/kb_sdk
    git clone https://github.com/kbase/jars

# Build the SDK

Some newer features are on other branches, such as develop.  If you do not need these features you do not need to check out a different branch.

    cd kb_sdk
    git checkout <branch>
    make

You should now have the kb-sdk program built in kb_sdk/bin. It will be helpful to add this to your execution path:

    # for bash
    export PATH=$(pwd)/bin:$PATH

(or some variant for your shell -- consider adding this to your .profile or .bashrc)

## Enable command completion (optional)
Optionally, you can install command completion with:

    source src/sh/mobu-completion.sh

# Get started
Once the kb-sdk command is in your PATH, you can get additional help by running:

    kb-sdk help

The module builder can generate an executable wrapper for long-running code (i.e., code that runs for more than ~20 seconds and should be queued by some execution engine). This basic usage guide will focus on this feature.

The module builder operates on an interface specification file ("spec file") written in KIDL (KBase Interface Description Language). We assume you have some basic understanding of this format and how to define types and functions. The best way to get started is to create an example module in your language of choice (Perl, Python or Java), look at its structure and contents, and structure your module similarly. The next section describes how to use `kb-sdk init` to set up your module directory, including the option to set up an example.

# kb-sdk init

There are a few functions built into the module builder. Let's start with `init`.

    kb-sdk init [-ev] [-l language] [-u username] module_name

The kb-sdk init function creates a new directory with the given module name (any whitespace is replaced with underscores) and populates it with the basic structure of a KBase module. Optionally, this can also be filled with an executable example module.

_Options:_

-v, --verbose    Show verbose output about which files and directories are being created.

-u, --username    Set the username (presumably a GitHub username) that will be filled in in some files in the module.

-e, --example    Populate your repo with an example module in the language set by -l

-l, --language    Choose a programming language to base your repo on. Currently, we support Perl, Python, and Java. Default is Python

## Examples:

    kb-sdk init MyModule

Creates an empty module named MyModule. This has just the bare components needed to build a repo - just the Typespec file and a bare Makefile. You'll need to fill out the Makefile with some options.

    kb-sdk init -e -l Perl MyModule

Creates a module with an example written in Perl. With the example written, you should be able to just enter the module's directory and run 'make' to build the module.

    kb-sdk init -v -e -l Perl -u my_user_name MyModule

Creates a complete example that also tailors the module to your user name.

# Create a GitHub repository for your module

Since functionality in KBase is pulled into KBase from public GitHub repositories, you will need to put your module code into a  GitHub repository. With git installed, this is easy to do. First you can commit your module code into a local git repository. Go into the directory where your module code is, git add all files created by kb-sdk, and commit with some commit message. This creates a git repository locally.

    cd MyModule
    git init
    git add .
    git commit -m 'initial commit'

Now you can sync this to a new GitHub repository. First create a new GitHub repository on github.com
(it can be in your personal GitHub account or in an organization, but it must be public),
but do not initialize it! Just go here to set up a new empty repository: https://github.com/new or see more
instructions here: https://help.github.com/articles/creating-a-new-repository .  You may wish to
use the name of your module as the name for your new repository.

Once the repository is set up, you can push your local KBase module to GitHub.  When you create a new
repository you can copy and paste the URL to your repository.

    git remote add origin https://github.com/[GITHUB_USER_OR_ORG_NAME]/[GITHUB_MODULE_NAME].git
    git push -u origin master

# What to edit

You will need to modify the following files in your repository in order to be able to run your code.

1. kbase.yaml.  Define metadata about your module here, such as your module name (which will be used to register with KBase), a short description, the implementation language, a version, and the KBase ids of the owners of the module (only these listed ids will also be permitted to register the module).
2. MyModule.spec. Add your funcdef definitions here, then run kb-sdk compile.
3. The implementation file for your language.  This is where you actually write the code for your defined methods.
4. The method specs.  This is where you define your narrative widgets.
5. Dockerfile.  This is used to build a Docker image.  Add any prerequisites here.

# (below here, out of date and probably won't work!) Build and run examples

To build and run the module examples, you'll need to do the following.

1. Run `make` in the new module directory

    `cd MyModule`

    `make`

2. Start the Mockup job service. This is a small web service that is a part of the SDK, and used for testing for now (note - this is under construction).

    `cd [Path_to_kb_sdk]/test_scripts/ee_mock_service`

    `./start_service.sh`

3. Start your module's server. The Perl example is given below.

    `cd [Path_to_MyModule]/scripts`

    `sh ./start_perl_server.sh > server.log 2>&1 &`

4. Now you can run your tests against your running server. The example test directory contains some basic client tests, but others can be added here.

    `cd MyModule/test`

    `./test_all_clients.sh`

# kb-sdk compile

To compile a KIDL spec file, there is a `compile` subcommand of `kb-sdk` that takes as an argument the KIDL file, and generates the client/server/executable wrapper. Run it as:

    kb-sdk compile [MyModule.spec]

If the KIDL file is valid, you will not see any output. If there are syntax errors, those will be printed. The command does not actually generate any code until the appropriate parameters are set. For example, we can generate a Python server and client in the 'lib' directory by running this:

    kb-sdk compile [MyModule.spec] \
        --out lib
        --pysrvname biokbase.mymodule.MyModuleServer
        --pyclname biokbase.mymodule.MyModuleClient

Run `kb-sdk help` for full parameter options.

The module builder allows us to run server code directly as a command line script in Python or Perl or as an executable jar in Java. For instance, in a Perl example, you could directly invoke a Perl server function from the command line as:

    perl Bio/KBase/MyModuleServer.pm [input.json] [output.json] [token]

The input file is exactly the JSON information sent to the server in a standard KBase JSON RPC call. The output saved to the output JSON file is the output response of that server call. The token is the kbase user token generated when a user is authenticated.

Right now, `kb-sdk` does not wrap the command above as a shell script, although it may be able to in the future depending on how we set up our development environment. To use this prototype for now, though, you should package the necessary environment variables needed by your language/script manually into a shell script. You can build the shell script in the Makefile. For instance, see this example from https://github.com/msneddon/service_test/blob/perl/Makefile#L40:

    build-executable-script-perl:
    	mkdir -p $(LBIN_DIR)
    	echo '#!/bin/bash' > $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME)
    	echo 'export PERL5LIB=$(DIR)/$(LIB_DIR):$$PATH:$$PERL5LIB' >> $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME)
    	echo 'perl $(DIR)/$(LIB_DIR)/Bio/KBase/$(SERVICE_CAPS)/$(SERVICE_CAPS)Server.pm $$1 $$2 $$3' >>   $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME)
    	chmod +x $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME)
    	ifeq ($(TOP_DIR_NAME), dev_container)
    	  cp $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) $(TOP_DIR)/bin/.
    	endif

# Synchronous vs. asynchronous methods
A new KIDL feature supported by Module Builder is the ability to tag a method as asynchronous using the new async keyword placed before a function definition:

    async funcdef long_task(string input) returns (string output)
       authentication required;

Note that async methods should always require authentication because we assume that compute resources will always have to be tracked per user.

When a standard KBase server method is called on a running server, it is handled identically to the current KBase service architecture. In fact, clients generated by kb-sdk on an existing service KIDL will be completely compatible with that existing and running KBase service. The difference is only when calling an async task. In this case, the Server code automatically forwards the request in a standard way to an Execution Engine. That Execution Engine then is responsible for queuing and executing the job, and returning any results.

We have a prototype interface to the Execution Engine that has the information necessary to submit a job in a general way--see [KBaseJobService.spec](https://github.com/kbase/kb_sdk/blob/master/KBaseJobService.spec). The interface is something we can iterate on based on the functionality in KBase we need.

For testing, however, the module builder includes a mock Execution Engine that is easy to set up and run locally. To start/stop the mock Execution Engine, build the kb-sdk using `make`, which will create start/stop scripts in the test_scripts/ee_mock_service directory.

Once the mock Execution Engine is running, you can start your server configured to forward requests for the long running async method to the mock Execution Engine by setting the job-service-url config variable in the deploy.cfg file of your module--for example,

    job-service-url = http://localhost:8000

The location of the deploy.cfg config file used by KBase services can be set by an environment variable named `KB_DEPLOYMENT_CONFIG`.

Again, to see all this in action (for a Perl server for now), see [https://travis-ci.org/msneddon/service_test](https://travis-ci.org/msneddon/service_test).

Finally, a few brief words on the methods generated in the client code for async methods. Instead of generating just one client function per method, async methods will generate three functions:

 - [method_name] - a method that submits the long running job and checks the state of the method until it completes, finally returning the output. For the client, it appears as a standard synchronous call.
 - [method_name]_async - submits a long running job and returns a job id. The job id can be used later to check the status of the job.
 - [method_name]_check - given a job id, checks the status of the job. If the job is complete and has output, this method returns the output data marshalled into the types specified in KIDL. This marshalling of output data is a key reason why this is not generated as a single method for all jobs, which would force the user of the client to map some generic output into the specific return data types by hand.

# Running tests
This code includes a test suite that builds a number of KBase services from KIDL specifications and tests compatibility for clients in each supported language with the servers in each supported back-end language.

In these tests, the servers in each language are run and clients in each language connect to those servers, so additional dependencies are required to start/stop/run code in each of these languages. These dependencies are essentially the same dependencies required to run the current set of KBase servers. Eventually, the minimal dependencies to run a server or client in each language should be documented here.
For now, you should probably just run tests in the dev_container environment, or look at example KBase services with Travis CI configs to determine what you need to install.
All that said, starting tests is relatively easy. First edit the test config file `test_scripts/test.cfg`, putting in a valid username, which is necessary for testing service authentication. Then, from the base kb_sdk directory, simply run:

    make test

## Local Docker deployments

You can optionally build and run a Docker image locally on your own workstation or laptop.  To do this see [Docker_deployment.md](Docker_deployment.md).


text:
"""
To build with coverage of Cython files
export SM_CYTHON_COVERAGE=1
python -m pip install -e .
pytest --cov=statsmodels statsmodels
coverage html
"""
from setuptools import Command, Extension, find_packages, setup
from setuptools.dist import Distribution

from collections import defaultdict
import fnmatch
import os
from os.path import join as pjoin, relpath
from pathlib import Path
import shutil
import sys

import pkg_resources

SETUP_DIR = Path(__file__).parent.resolve()

try:
    # SM_FORCE_C is a testing shim to force setup to use C source files
    FORCE_C = int(os.environ.get("SM_FORCE_C", 0))
    if FORCE_C:
        raise ImportError("Force import error for testing")
    from Cython import Tempita
    from Cython.Build import cythonize
    from Cython.Distutils import build_ext

    HAS_CYTHON = True
except ImportError:
    from setuptools.command.build_ext import build_ext

    HAS_CYTHON = False

try:
    import numpy  # noqa: F401

    HAS_NUMPY = True
except ImportError:
    HAS_NUMPY = False

###############################################################################
# Key Values that Change Each Release
###############################################################################
# These are strictly installation requirements. Builds requirements are
# managed in pyproject.toml
INSTALL_REQUIRES = []
with open("requirements.txt", encoding="utf-8") as req:
    for line in req.readlines():
        INSTALL_REQUIRES.append(line.split("#")[0].strip())

DEVELOP_REQUIRES = []
with open("requirements-dev.txt", encoding="utf-8") as req:
    for line in req.readlines():
        DEVELOP_REQUIRES.append(line.split("#")[0].strip())

CYTHON_MIN_VER = "0.29.26"  # released 2020

EXTRAS_REQUIRE = {
    "build": ["cython>=" + CYTHON_MIN_VER],
    "develop": ["cython>=" + CYTHON_MIN_VER] + DEVELOP_REQUIRES,
    "docs": [
        "sphinx",
        "nbconvert",
        "jupyter_client",
        "ipykernel",
        "matplotlib",
        "nbformat",
        "numpydoc",
        "pandas-datareader",
    ],
}

###############################################################################
# Values that rarely change
###############################################################################
DISTNAME = "statsmodels"
DESCRIPTION = "Statistical computations and models for Python"
README = SETUP_DIR.joinpath("README.rst").read_text()
LONG_DESCRIPTION = README
MAINTAINER = "statsmodels Developers"
MAINTAINER_EMAIL = "pystatsmodels@googlegroups.com"
URL = "https://www.statsmodels.org/"
LICENSE = "BSD License"
DOWNLOAD_URL = ""
PROJECT_URLS = {
    "Bug Tracker": "https://github.com/statsmodels/statsmodels/issues",
    "Documentation": "https://www.statsmodels.org/stable/index.html",
    "Source Code": "https://github.com/statsmodels/statsmodels",
}

CLASSIFIERS = [
    "Development Status :: 4 - Beta",
    "Environment :: Console",
    "Programming Language :: Cython",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Operating System :: OS Independent",
    "Intended Audience :: End Users/Desktop",
    "Intended Audience :: Developers",
    "Intended Audience :: Science/Research",
    "Natural Language :: English",
    "License :: OSI Approved :: BSD License",
    "Topic :: Office/Business :: Financial",
    "Topic :: Scientific/Engineering",
]

FILES_TO_INCLUDE_IN_PACKAGE = ["LICENSE.txt", "setup.cfg"]

FILES_COPIED_TO_PACKAGE = []
for filename in FILES_TO_INCLUDE_IN_PACKAGE:
    if os.path.exists(filename):
        dest = os.path.join("statsmodels", filename)
        shutil.copy2(filename, dest)
        FILES_COPIED_TO_PACKAGE.append(dest)

STATESPACE_RESULTS = "statsmodels.tsa.statespace.tests.results"

ADDITIONAL_PACKAGE_DATA = {
    "statsmodels": FILES_TO_INCLUDE_IN_PACKAGE,
    "statsmodels.datasets.tests": ["*.zip"],
    "statsmodels.iolib.tests.results": ["*.dta"],
    "statsmodels.stats.tests.results": ["*.json"],
    "statsmodels.tsa.vector_ar.tests.results": ["*.npz", "*.dat"],
    "statsmodels.stats.tests": ["*.txt"],
    "statsmodels.stats.libqsturng": ["*.r", "*.txt", "*.dat"],
    "statsmodels.stats.libqsturng.tests": ["*.csv", "*.dat"],
    "statsmodels.sandbox.regression.tests": ["*.dta", "*.csv"],
    STATESPACE_RESULTS: ["*.pkl", "*.csv"],
    STATESPACE_RESULTS + ".frbny_nowcast": ["test*.mat"],
    STATESPACE_RESULTS + ".frbny_nowcast.Nowcasting.data.US": ["*.csv"],
}

##############################################################################
# Extension Building
##############################################################################
CYTHON_COVERAGE = os.environ.get("SM_CYTHON_COVERAGE", False)
CYTHON_COVERAGE = CYTHON_COVERAGE in ("1", "true", '"true"')
CYTHON_TRACE_NOGIL = str(int(CYTHON_COVERAGE))
if CYTHON_COVERAGE:
    print("Building with coverage for Cython code")
COMPILER_DIRECTIVES = {"linetrace": CYTHON_COVERAGE}
DEFINE_MACROS = [
    ("CYTHON_TRACE_NOGIL", CYTHON_TRACE_NOGIL),
    ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
]

exts = dict(
    _stl={"source": "statsmodels/tsa/stl/_stl.pyx"},
    _exponential_smoothers={
        "source": "statsmodels/tsa/holtwinters/_exponential_smoothers.pyx"
    },  # noqa: E501
    _ets_smooth={
        "source": "statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx"
    },  # noqa: E501
    _innovations={"source": "statsmodels/tsa/_innovations.pyx"},
    _hamilton_filter={
        "source": "statsmodels/tsa/regime_switching/_hamilton_filter.pyx.in"
    },  # noqa: E501
    _kim_smoother={
        "source": "statsmodels/tsa/regime_switching/_kim_smoother.pyx.in"
    },  # noqa: E501
    _arma_innovations={
        "source": "statsmodels/tsa/innovations/_arma_innovations.pyx.in"
    },  # noqa: E501
    linbin={"source": "statsmodels/nonparametric/linbin.pyx"},
    _qn={"source": "statsmodels/robust/_qn.pyx"},
    _smoothers_lowess={
        "source": "statsmodels/nonparametric/_smoothers_lowess.pyx"
    },  # noqa: E501
)

statespace_exts = [
    "statsmodels/tsa/statespace/_initialization.pyx.in",
    "statsmodels/tsa/statespace/_representation.pyx.in",
    "statsmodels/tsa/statespace/_kalman_filter.pyx.in",
    "statsmodels/tsa/statespace/_filters/_conventional.pyx.in",
    "statsmodels/tsa/statespace/_filters/_inversions.pyx.in",
    "statsmodels/tsa/statespace/_filters/_univariate.pyx.in",
    "statsmodels/tsa/statespace/_filters/_univariate_diffuse.pyx.in",
    "statsmodels/tsa/statespace/_kalman_smoother.pyx.in",
    "statsmodels/tsa/statespace/_smoothers/_alternative.pyx.in",
    "statsmodels/tsa/statespace/_smoothers/_classical.pyx.in",
    "statsmodels/tsa/statespace/_smoothers/_conventional.pyx.in",
    "statsmodels/tsa/statespace/_smoothers/_univariate.pyx.in",
    "statsmodels/tsa/statespace/_smoothers/_univariate_diffuse.pyx.in",
    "statsmodels/tsa/statespace/_simulation_smoother.pyx.in",
    "statsmodels/tsa/statespace/_cfa_simulation_smoother.pyx.in",
    "statsmodels/tsa/statespace/_tools.pyx.in",
]

class CleanCommand(Command):
    user_options = []

    def initialize_options(self) -> None:
        pass

    def finalize_options(self) -> None:
        pass

    def run(self) -> None:
        msg = """

python setup.py clean is not supported.

Use one of:

* `git clean -xdf` to clean all untracked files
* `git clean -Xdf` to clean untracked files ignored by .gitignore
"""
        print(msg)
        sys.exit(1)

def update_extension(extension, requires_math=True):
    import numpy as np

    numpy_includes = [np.get_include()]
    extra_incl = pkg_resources.resource_filename("numpy", "core/include")
    numpy_includes += [extra_incl]
    numpy_includes = list(set(numpy_includes))
    numpy_math_libs = {
        "include_dirs": [np.get_include()],
        "library_dirs": [os.path.join(np.get_include(), '..', 'lib')],
        "libraries": ["npymath"]
    }

    if not hasattr(extension, "include_dirs"):
        return
    extension.include_dirs = list(set(extension.include_dirs + numpy_includes))
    if requires_math:
        extension.include_dirs += numpy_math_libs["include_dirs"]
        extension.libraries += numpy_math_libs["libraries"]
        extension.library_dirs += numpy_math_libs["library_dirs"]

class DeferredBuildExt(build_ext):
    """build_ext command for use when numpy headers are needed."""

    def build_extensions(self):
        self._update_extensions()
        build_ext.build_extensions(self)

    def _update_extensions(self):
        for extension in self.extensions:
            requires_math = extension.name in EXT_REQUIRES_NUMPY_MATH_LIBS
            update_extension(extension, requires_math=requires_math)

cmdclass = {"clean": CleanCommand}
if not HAS_NUMPY:
    cmdclass["build_ext"] = DeferredBuildExt

def check_source(source_name):
    """Chooses C or pyx source files, and raises if C is needed but missing"""
    source_ext = ".pyx"
    if not HAS_CYTHON:
        source_name = source_name.replace(".pyx.in", ".c")
        source_name = source_name.replace(".pyx", ".c")
        source_ext = ".c"
        if not os.path.exists(source_name):
            msg = (
                "C source not found.  You must have Cython installed to "
                "build if the C source files have not been generated."
            )
            raise IOError(msg)
    return source_name, source_ext

def process_tempita(source_name):
    """Runs pyx.in files through tempita is needed"""
    if source_name.endswith("pyx.in"):
        with open(source_name, "r", encoding="utf-8") as templated:
            pyx_template = templated.read()
        pyx = Tempita.sub(pyx_template)
        pyx_filename = source_name[:-3]
        with open(pyx_filename, "w", encoding="utf-8") as pyx_file:
            pyx_file.write(pyx)
        file_stats = os.stat(source_name)
        try:
            os.utime(
                pyx_filename,
                ns=(file_stats.st_atime_ns, file_stats.st_mtime_ns),
            )
        except AttributeError:
            os.utime(pyx_filename, (file_stats.st_atime, file_stats.st_mtime))
        source_name = pyx_filename
    return source_name

EXT_REQUIRES_NUMPY_MATH_LIBS = []
extensions = []
for config in exts.values():
    uses_blas = True
    source, ext = check_source(config["source"])
    source = process_tempita(source)
    name = source.replace("/", ".").replace(ext, "")
    include_dirs = config.get("include_dirs", [])
    depends = config.get("depends", [])
    libraries = config.get("libraries", [])
    library_dirs = config.get("library_dirs", [])

    uses_numpy_libraries = config.get("numpy_libraries", False)
    if uses_blas or uses_numpy_libraries:
        EXT_REQUIRES_NUMPY_MATH_LIBS.append(name)

    ext = Extension(
        name,
        [source],
        include_dirs=include_dirs,
        depends=depends,
        libraries=libraries,
        library_dirs=library_dirs,
        define_macros=DEFINE_MACROS,
    )
    extensions.append(ext)

for source in statespace_exts:
    source, ext = check_source(source)
    source = process_tempita(source)
    name = source.replace("/", ".").replace(ext, "")

    EXT_REQUIRES_NUMPY_MATH_LIBS.append(name)
    ext = Extension(
        name,
        [source],
        include_dirs=["statsmodels/src"],
        depends=[],
        libraries=[],
        library_dirs=[],
        define_macros=DEFINE_MACROS,
    )
    extensions.append(ext)

if HAS_NUMPY:
    for extension in extensions:
        requires_math = extension.name in EXT_REQUIRES_NUMPY_MATH_LIBS
        update_extension(extension, requires_math=requires_math)

if HAS_CYTHON:
    extensions = cythonize(
        extensions,
        compiler_directives=COMPILER_DIRECTIVES,
        language_level=3,
        force=CYTHON_COVERAGE,
    )

##############################################################################
# Construct package data
##############################################################################
package_data = defaultdict(list)
filetypes = ["*.csv", "*.txt", "*.dta"]
for root, _, filenames in os.walk(
    pjoin(os.getcwd(), "statsmodels", "datasets")
):  # noqa: E501
    matches = []
    for filetype in filetypes:
        for filename in fnmatch.filter(filenames, filetype):
            matches.append(filename)
    if matches:
        package_data[".".join(relpath(root).split(os.path.sep))] = filetypes
for root, _, _ in os.walk(pjoin(os.getcwd(), "statsmodels")):
    if root.endswith("results"):
        package_data[".".join(relpath(root).split(os.path.sep))] = filetypes

for path, filetypes in ADDITIONAL_PACKAGE_DATA.items():
    package_data[path].extend(filetypes)

if os.path.exists("MANIFEST"):
    os.unlink("MANIFEST")

class BinaryDistribution(Distribution):
    def is_pure(self):
        return False

setup(
    name=DISTNAME,
    maintainer=MAINTAINER,
    ext_modules=extensions,
    maintainer_email=MAINTAINER_EMAIL,
    description=DESCRIPTION,
    license=LICENSE,
    url=URL,
    download_url=DOWNLOAD_URL,
    project_urls=PROJECT_URLS,
    long_description=LONG_DESCRIPTION,
    classifiers=CLASSIFIERS,
    platforms="any",
    cmdclass=cmdclass,
    packages=find_packages(),
    package_data=package_data,
    distclass=BinaryDistribution,
    include_package_data=False,  # True will install all files in repo
    install_requires=INSTALL_REQUIRES,
    extras_require=EXTRAS_REQUIRE,
    zip_safe=False,
    python_requires=">=3.8",
)

# Clean-up copied files
for copy in FILES_COPIED_TO_PACKAGE:
    os.unlink(copy)


text:
'use strict';

/* App Module */

var ulboraCmsApp = angular.module('ulboraCmsApp', [
    'ngRoute',
    "ngAnimate",
    'ngCookies',
    'ulboraCmsControllers',
    'ulboraCmsBusinessServices',
    'ulboraCmsServices'
]);

ulboraCmsApp.config(['$routeProvider', '$locationProvider',
    function($routeProvider, $locationProvider) {
        $routeProvider.
                when('/', {
                    templateUrl: 'partials/main.html',
                    controller: 'MainCtrl'
                }).when('/archive/:month/:year', {
                    templateUrl: 'partials/archives.html',
                    controller: 'ArchiveCtrl'
                }).when('/article/:a', {
                    templateUrl: 'partials/article.html',
                    controller: 'ArticleCtrl'
                }).when('/menuArticle/:a/:name', {
                    templateUrl: 'partials/article.html',
                    controller: 'ArticleCtrl'
                }).when('/register', {
                    templateUrl: 'partials/register.html',
                    controller: 'RegistrationNewCtrl'
                }).when('/changePassword', {
                    templateUrl: 'partials/changePassword.html',
                    controller: 'PasswordChangeCtrl'
                }).when('/processSuccess', {
                    templateUrl: 'partials/processSuccess.html',
                    controller: 'ProcessSuccessCtrl'
                }).when('/processFailure', {
                    templateUrl: 'partials/processFailure.html',
                    controller: 'ProcessFailureCtrl'
                }).when('/login', {
                    templateUrl: 'partials/login.html',
                    controller: 'LoginScreenCtrl'
                }).when('/resetPassword', {
                    templateUrl: 'partials/resetPassword.html',
                    controller: 'PasswordResetCtrl'
                }).when('/loginFailedForm', {
                    templateUrl: 'partials/login.html',
                    controller: 'LoginFailedFormCtrl'
                }).when('/logOut', {
                    templateUrl: 'partials/logOut.html',
                    controller: 'LogOutCtrl'
                });

        $locationProvider.html5Mode(false).hashPrefix('!');
    }]);


text:
import re

from flask import Flask
from flask.ext.statics import ALL_RESOURCES, ALL_RESOURCES_MINIFIED, Statics
import pytest

@pytest.fixture(autouse=True, scope='session')
def app_context(request):
    """Initialize the Flask application for tests."""
    app = Flask(__name__)
    app.config['TESTING'] = True
    Statics(app)
    context = app.app_context()
    context.push()
    request.addfinalizer(lambda: context.pop())

@pytest.fixture(scope='session')
def template():
    """Load template example in README.md."""
    regex = re.compile(r'```html\+django\n(.*)```', re.DOTALL)
    file_path = 'README.md'
    with open(file_path) as f:
        t = re.findall(regex, f.read())[0]
    return t

@pytest.fixture(scope='session')
def all_files_both():
    """Get a set of all files for non-minified and minified resources."""
    all_files = set([f for r in ALL_RESOURCES.values() for f in r['css'] + r['js']])
    all_files_minified = set([f for r in ALL_RESOURCES_MINIFIED.values() for f in r['css'] + r['js']])
    return all_files, all_files_minified


text:
core = require(... .. ".core")

local setmetatable = setmetatable
local assert, select, type = assert, select, type

module(...)

local _mt = {}
function _mt:log(str, ...)
	if select('#', ...) > 0 then
		str = str:format(...)
	end
	core.write(9, self.name, str)
end

function _mt:__call(...)
	return _mt.log(self, ...)
end
_mt.__index = _mt

function logger(name)
	assert(name == nil or type(name) == 'string')

	return setmetatable({ name = name }, _mt)
end


text:
package docker

import (
	"testing"

	"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestParseReference(t *testing.T) {
	tests := []struct {
		description            string
		image                  string
		expectedName           string
		expectedTag            string
		expectedDigest         string
		expectedFullyQualified bool
		shouldErr              bool
	}{
		{
			description:            "port and tag",
			image:                  "host:1234/user/container:tag",
			expectedName:           "host:1234/user/container",
			expectedTag:            "tag",
			expectedFullyQualified: true,
		},
		{
			description:            "port",
			image:                  "host:1234/user/container",
			expectedName:           "host:1234/user/container",
			expectedTag:            "",
			expectedFullyQualified: false,
		},
		{
			description:            "tag",
			image:                  "host/user/container:tag",
			expectedName:           "host/user/container",
			expectedTag:            "tag",
			expectedFullyQualified: true,
		},
		{
			description:            "latest",
			image:                  "host/user/container:latest",
			expectedName:           "host/user/container",
			expectedTag:            "latest",
			expectedFullyQualified: false,
		},
		{
			description:            "digest",
			image:                  "gcr.io/k8s-skaffold/example@sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedName:           "gcr.io/k8s-skaffold/example",
			expectedDigest:         "sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedFullyQualified: true,
		},
		{
			description:            "digest and tag",
			image:                  "gcr.io/k8s-skaffold/example:v1@sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedName:           "gcr.io/k8s-skaffold/example",
			expectedTag:            "v1",
			expectedDigest:         "sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedFullyQualified: true,
		},
		{
			description:            "docker library",
			image:                  "nginx:latest",
			expectedName:           "nginx",
			expectedTag:            "latest",
			expectedFullyQualified: false,
		},
		{
			description:            "accept and remove ko prefix",
			image:                  "ko://host/user/container",
			expectedName:           "host/user/container",
			expectedTag:            "",
			expectedFullyQualified: false,
		},
		{
			description:            "make name lowercase",
			image:                  "ko://github.com/GoogleContainerTools/skaffold",
			expectedName:           "github.com/googlecontainertools/skaffold",
			expectedTag:            "",
			expectedFullyQualified: false,
		},
		{
			description:            "maintain tag case",
			image:                  "gcr.io/k8s-skaffold/Example:Tag",
			expectedName:           "gcr.io/k8s-skaffold/example",
			expectedTag:            "Tag",
			expectedFullyQualified: true,
		},
		{
			description:            "maintain tag case when digest is present",
			image:                  "us-central1-docker.pkg.dev/k8s-skaffold/Example:Tag@sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedName:           "us-central1-docker.pkg.dev/k8s-skaffold/example",
			expectedTag:            "Tag",
			expectedDigest:         "sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883",
			expectedFullyQualified: true,
		},
		{
			description: "invalid reference",
			image:       "!!invalid!!",
			shouldErr:   true,
		},
	}
	for _, test := range tests {
		testutil.Run(t, test.description, func(t *testutil.T) {
			parsed, err := ParseReference(test.image)

			t.CheckError(test.shouldErr, err)
			if !test.shouldErr {
				t.CheckDeepEqual(test.expectedName, parsed.BaseName)
				t.CheckDeepEqual(test.expectedTag, parsed.Tag)
				t.CheckDeepEqual(test.expectedDigest, parsed.Digest)
				t.CheckDeepEqual(test.expectedFullyQualified, parsed.FullyQualified)
			}
		})
	}
}