text:
from msrest.serialization import Model

class USqlDirectedColumn(Model):
    """A Data Lake Analytics catalog U-SQL directed column item.

    :param name: the name of the index in the table.
    :type name: str
    :param descending: the switch indicating if the index is descending or
     not.
    :type descending: bool
    """

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'descending': {'key': 'descending', 'type': 'bool'},
    }

    def __init__(self, name=None, descending=None):
        self.name = name
        self.descending = descending

redpajama_set_name: RedPajamaGithub


text:
import json
import stat
import shlex
import signal
import os.path
from os import stat as os_stat
from shutil import copyfile

import click

from shub.config import load_shub_config
from shub.image import utils

SHORT_HELP = 'Run custom image locally.'
HELP = """
Run a custom Docker image locally.

The command should be helpful to ensure that your custom image is properly
written and do some preliminary local tests before pushing it to Scrapy Cloud.

Most of the command parameters coincide with parameters for 'shub schedule'
command to simplfy its usage.

The `spider` argument should match the spider's name, e.g.:

    shub image run myspider

A more advanced example of using non-default target with settings/arguments:

    shub image run production/myspider -a ARG1=VAL1 -s LOG_LEVEL=DEBUG
"""

SCRAPINGHUB_VOLUME = '/scrapinghub'
WRAPPER_FILENAME = 'start-crawl-local'
WRAPPER_LOCAL_PATH = os.path.join(os.path.dirname(__file__), 'wrapper.py')
WRAPPER_IMAGE_PATH = os.path.join(SCRAPINGHUB_VOLUME, WRAPPER_FILENAME)

@click.command(help=HELP, short_help=SHORT_HELP)
@click.argument("spider", type=click.STRING)
@click.option('-a', '--argument', 'args',
              help='Spider argument (-a name=value)', multiple=True)
@click.option('-s', '--set', 'settings',
              help='Job-specific setting (-s name=value)', multiple=True)
@click.option('-e', '--environment', multiple=True,
              help='Job environment variable (-e VAR=VAL)')
@click.option("-V", "--version", help="use custom release version")
@click.option("-v", "--verbose", is_flag=True,
              help="stream additional logs to console")
@click.option("-k", "--keep-volume", help="Keep volume folder", is_flag=True)
def cli(spider, args, settings, environment, version, verbose, keep_volume):
    run_cmd(spider, args, settings, environment, version, keep_volume)

def run_cmd(spider, args, settings, environment, version, keep_volume):
    try:
        target, spider = spider.rsplit('/', 1)
    except ValueError:
        target = 'default'

    config = load_shub_config()
    image = config.get_image(target)
    version = version or config.get_version()
    image_name = utils.format_image_name(image, version)
    docker_client = utils.get_docker_client()

    env = _format_environment(spider, args, settings, environment)
    _run_with_docker(docker_client, image_name, env, keep_volume)

def _format_environment(spider, args, settings, environment):
    """Convert all input crawl args to environment variables."""
    # required defaults, can be overwritten with meta if needed
    job_data = {'spider': spider, 'key': '1/2/3', 'auth': '<auth>'}

    args = dict(x.split('=', 1) for x in args)
    cmd_args = shlex.split(args.pop('cmd_args', ''))
    if spider.startswith('py:'):
        job_data['job_cmd'] = [spider] + cmd_args
    else:
        job_data['spider_args'] = args
    meta = args.pop('meta', None)
    if meta:
        job_data.update(json.loads(meta))

    job_environment = dict(x.split('=', 1) for x in environment)
    job_settings = dict(x.split('=', 1) for x in settings)
    return {
        'SHUB_JOBKEY': job_data['key'],
        'SHUB_SPIDER': spider,
        'SHUB_JOB_DATA': _json_dumps(job_data),
        'SHUB_JOB_ENV': _json_dumps(job_environment),
        'SHUB_SETTINGS': _json_dumps({'job_settings': job_settings}),
        'PYTHONUNBUFFERED': 1,
    }

def _json_dumps(data):
    return json.dumps(data, sort_keys=True, separators=(',', ':'))

def _run_with_docker(client, image_name, env, keep_volume=False):
    """Run a local docker container with the given custom image."""

    def _signal_handler(sig, _):
        client.kill(container, sig)

    tmpdir_kw = {'prefix': 'shub-image-run-', 'cleanup': not keep_volume}
    with utils.make_temp_directory(**tmpdir_kw) as volume_dir:
        container = _create_container(client, image_name, env, volume_dir)
        try:
            client.start(container)
            signal.signal(signal.SIGINT, _signal_handler)
            signal.signal(signal.SIGTERM, _signal_handler)
            for log in client.logs(container, stream=True):
                click.echo(log.rstrip())
        finally:
            client.remove_container(container, force=True)

def _create_container(client, image_name, environment, volume_dir):
    """Create a docker container and customize its setup."""
    # copy start-crawl wrapper to the volume temporary directory
    wrapper_cont_path = os.path.join(volume_dir, WRAPPER_FILENAME)
    copyfile(WRAPPER_LOCAL_PATH, wrapper_cont_path)
    wrapper_perms = os_stat(wrapper_cont_path).st_mode | stat.S_IEXEC
    os.chmod(wrapper_cont_path, wrapper_perms)  # must be executable
    fifo_path = os.path.join(volume_dir, 'scrapinghub.fifo')
    environment['SHUB_FIFO_PATH'] = fifo_path
    # keep using default /scrapinghub volume but mount it as a temporary
    # directory in the host /tmp/ to have access to the files in needed
    binds = {volume_dir: {'bind': SCRAPINGHUB_VOLUME, 'mode': 'rw'}}
    host_config = client.create_host_config(binds=binds)
    return client.create_container(
        image=image_name,
        command=[WRAPPER_IMAGE_PATH],
        environment=environment,
        volumes=[volume_dir],
        host_config=host_config,
    )


text:
{-# LANGUAGE TemplateHaskell #-}

------------------------------------------------------------------------------
-- | This module defines our application's state type and an alias for its
-- handler monad.
module Application where

------------------------------------------------------------------------------
import Control.Lens
import Snap.Snaplet
import Snap.Snaplet.Heist
import Snap.Snaplet.Auth
import Snap.Snaplet.Session

------------------------------------------------------------------------------
data App = App
    { _heist :: Snaplet (Heist App)
    , _sess :: Snaplet SessionManager
    , _auth :: Snaplet (AuthManager App)
    }

makeLenses ''App

instance HasHeist App where
    heistLens = subSnaplet heist

------------------------------------------------------------------------------
type AppHandler = Handler App App


text:
package scodec
package codecs

class DiscriminatorCodecTest extends CodecSuite:

  test("support building a codec using typecases") {
    if (sys.props("vm.name") ne null) {
      val codec =
        discriminated[AnyVal]
          .by(uint8)
          .typecase(0, int32)
          .typecase(1, bool)

      roundtrip(codec, true)
      roundtrip(codec, false)
      roundtrip(codec, 1)
      roundtrip(codec, Int.MaxValue)
      assertEquals(codec.sizeBound, SizeBound.bounded(9, 40))
    }
  }

  test("support building a codec using partial functions and subtyping") {
    val codec =
      discriminated[Matchable]
        .by(uint8)
        .subcaseP[Int](0) { case i: Int => i }(int32)
        .subcaseP[Boolean](1) { case b: Boolean => b }(bool)

    roundtrip(codec, true)
    roundtrip(codec, false)
    roundtrip(codec, 1)
    roundtrip(codec, Int.MaxValue)
  }

  test("support building a codec using A => Option[B] and subtyping") {
    val codec =
      discriminated[Matchable]
        .by(uint8)
        .subcaseO[Int](0) { v =>
          v match { case i: Int => Some(i); case _ => None }
        }(int32)
        .subcaseO[Boolean](1) { v =>
          v match { case b: Boolean => Some(b); case _ => None }
        }(bool)

    roundtrip(codec, true)
    roundtrip(codec, false)
    roundtrip(codec, 1)
    roundtrip(codec, Int.MaxValue)
  }

  test("support building a codec for an enumeration") {
    enum Direction { case North, South, East, West }

    val codec = mappedEnum(
      uint8,
      Direction.North -> 1,
      Direction.South -> 2,
      Direction.East -> 3,
      Direction.West -> 4
    )

    roundtrip(codec, Direction.North)
    roundtrip(codec, Direction.South)
    roundtrip(codec, Direction.East)
    roundtrip(codec, Direction.West)
  }

  test("support building a codec for an enumeration with preserved reserved values") {
    enum Color:
      case Red, Green, Blue
      case Reserved(value: Int)

    val nonReserved: Codec[Color] =
      mappedEnum(uint8, Color.Red -> 1, Color.Green -> 2, Color.Blue -> 3)
    val reserved: Codec[Color.Reserved] = uint8.as[Color.Reserved]
    val codec: Codec[Color] = choice(nonReserved, reserved.upcast[Color])

    roundtrip(codec, Color.Red)
    roundtrip(codec, Color.Green)
    roundtrip(codec, Color.Blue)
    roundtrip(codec, Color.Reserved(255))
    roundtrip(codec, Color.Reserved(4))
  }

  test(
    "support building a codec for an enumeration with preserved reserved values, and reserved values are not in the type hierarchy"
  ) {
    enum Color:
      case Red, Green, Blue
    case class Reserved(value: Int)

    val nonReserved: Codec[Color] =
      mappedEnum(uint8, Color.Red -> 1, Color.Green -> 2, Color.Blue -> 3)
    val reserved: Codec[Reserved] = uint8.as[Reserved]
    val codec: Codec[Color | Reserved] =
      choice(nonReserved.upcast[Color | Reserved], reserved.upcast[Color | Reserved])

    roundtrip(codec, Color.Red)
    roundtrip(codec, Color.Green)
    roundtrip(codec, Color.Blue)
    roundtrip(codec, Reserved(255))
    roundtrip(codec, Reserved(4))
  }

  test("support building a codec for an ADT") {
    enum Direction:
      case Stay
      case Go(units: Int)

    val codec =
      discriminated[Direction]
        .by(uint8)
        .singleton(0, Direction.Stay)
        .typecase(1, int32.as[Direction.Go])

    roundtrip(codec, Direction.Stay)
    roundtrip(codec, Direction.Go(42))
  }

  test("support building a codec for recusive ADTs - e.g., trees") {
    enum Tree:
      case Node(l: Tree, r: Tree)
      case Leaf(n: Int)
    import Tree.{Node, Leaf}

    def treeCodec: Codec[Tree] = lazily {
      discriminated[Tree]
        .by(bool)
        .typecase(false, int32.as[Leaf])
        .typecase(true, (treeCodec :: treeCodec).as[Node])
    }

    roundtrip(treeCodec, Leaf(42))
    roundtrip(treeCodec, Node(Leaf(42), Node(Leaf(1), Leaf(2))))
  }

  test("error when matching discriminator for encoding is not found") {
    val codec =
      discriminated[AnyVal]
        .by(uint8)
        .typecase(0, bool)

    roundtrip(codec, true)
    roundtrip(codec, false)
    encodeError(codec, 1, new Err.MatchingDiscriminatorNotFound(1))
    encodeError(codec, Int.MaxValue, new Err.MatchingDiscriminatorNotFound(Int.MaxValue))
  }

  test("support framing value codecs") {
    sealed trait Direction
    case object Stay extends Direction
    case class Go(units: Int) extends Direction
    case class Annotate(message: String) extends Direction

    val stayCodec = provide(Stay)
    val goCodec = int32.as[Go]
    val annotateCodec = ascii.as[Annotate]

    val codec =
      discriminated[Direction]
        .by(uint8)
        .typecase(0, stayCodec)
        .typecase(1, goCodec)
        .typecase(2, annotateCodec)
        .framing([x] => (c: Codec[x]) => variableSizeBytes(uint8, c))

    roundtrip(list(codec), List(Stay, Go(1), Annotate("Hello"), Go(2), Stay))
  }


text:
* Proposal: [SE-0105](0105-remove-where-from-forin-loops.md)
* Author: [Erica Sadun](http://github.com/erica)
* Review Manager: [Chris Lattner](http://github.com/lattner)
* Status: **Rejected**
* Decision Notes: [Rationale](https://forums.swift.org/t/rejected-se-0105-removing-where-clauses-from-for-in-loops/3205)

## Introduction

This proposal removes `where` clauses from `for-in` loops, where they are better expressed (and read) as guard conditions.

Swift Evolution Discussion: [\[Pitch\] Retiring `where` from for-in loops](https://forums.swift.org/t/pitch-retiring-where-from-for-in-loops/2926)

## Motivation

As syntactic sugar, the for loop's `where` clause is rarely used, hard to discover, and elevates one style (`continue` on condition, aka filtering) above other related styles: `break` on condition (`while` or `until`), `return` on condition (`unless`), `throw` on condition, and abort (`fatalError()`) on condition. The `where` clause supports a fluent style that is difficult to document separately at its point of use and may be hard to breakpoint and debug. Eliminating `where` in favor of `guard` statements addresses all these points: better commenting, better breakpointing and debugging, and full domain coverage over filtering and early exit in a way that `where` cannot.

#### Frequency of Use

Where clauses are rarely used. In the Swift standard library, they occur three times, compared to about 600 uses of `for-in`.

```
private/StdlibUnittest/StdlibUnittest.swift.gyb:    for j in instances.indices where i != j {
public/core/Algorithm.swift:  for value in rest where value < minValue {
public/core/Algorithm.swift:  for value in rest where value >= maxValue {
```

I pulled down a random sample of popular Swift repositories from GitHub and found one use of `for-in-where` among my sample vs over 650 `for-in` uses.

```
Carthage/Source/CarthageKit/Algorithms.swift: for (node, var incomingEdges) in workingGraph where incomingEdges.contains(lastSource) {
```

#### Confusion of Use

Consider the following two code snippets:

```swift
print("for in")
var theArray = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for x in theArray where x % 2 == 1 { print (x) }

print("while")
var anArray = [1, 2, 3, 4, 5, 6, 7, 8, 9]
while let x = anArray.popLast() where x % 2 == 1 { print(x) }
```

In the first, the where clause acts as a filter, using syntactic sugar for `continue` when its condition is not met. In while loops, it's a conjoined Boolean, and will `break` when its condition is not met. In my experience offering peer support for new Swift developers, the `where` clause is a source of confusion when it is considered and/or used.

#### Completeness of Guard Conditions

Guard conditions can `continue` (mimicking the current use of `where`), `break`, `return`, or otherwise exit scope. This offers more flexible and complete behavior.

```swift
for x in sequence {
    guard condition else { continue } // current where behavior
    guard condition else { break }
    guard condition else { return }
    guard condition else { throw error }
    guard condition else { fatalError() } // etc.
}
```

Removing where from for-in loops reduces cognitive burden when interpreting intent. The logic is easier to read and follow. And the Swift grammar is simpler.

#### SE-0099

Upon accepting [SE-0099](0099-conditionclauses.md), the core team removed `where` clauses from condition clauses. The team wrote, "[T]he 'where' keyword can be retired from its purpose as a [B]oolean condition introducer."

#### Malformed Grammar

In Swift's current form, the where-clause in for-loops inconsistently applied. Unlike `switch` statements and `do` loops, a `for-in` loop's where-clause is separated from the pattern it modifies.

```swift
for case? pattern in expression where-clause? code-block

case-item-list → pattern where-clause? | pattern where-clause? , case-item-list

catch pattern? where-clause? code-block
```

This separation makes the clause harder to associate with the pattern, can confuse users as to whether it modifies the expression or the pattern, and represents an inconsistency in Swift's grammar. The where-clause really should have been designed like this:

```swift
for case? pattern where-clause? in expression code-block
```

### Other Where Clause Uses

This proposal does not affect where clause use in generics. Using generic constraints unamibiguously offers positive utility.

Retiring `where` from `catch` clauses and `switch` statements is less clear cut.

```swift
case_item_list : pattern where_clause? | pattern where_clause? ',' case_item_list
catch_clause : 'catch' pattern? where_clause? code_block
```

##### Case:

* Instances of `case.*:` in the standard library: 1337 (!)
* Instances of `case.*where.*:` in the standard library: 1-ish
* Instances of `case.*:` in my Apple sample code collection: 40 (!)
* Instances of `case.*where.*:` in my Apple sample code collection: 7
* Instances of `case.*:` in popular 3rd party source code: Over 1400
* Instances of `case.*where.*:` in popular 3rd party source code: 17

```
public/core/String.swift:        // case let x where (x >= 0x41 && x <= 0x5a):
```

##### Catch:

* Instances of `catch` in popular 3rd party source code: 75
* Instances of `catch.*where ` in popular 3rd party source code: 0
* Instances of `catch` in the standard library: 18
* Instances of `catch.*where ` in the standard library: 0

Unlike generic constraints, nothing prevents semantic disjunction in switch-case and catch `where` clauses, both provide expressive potential that could be missed.

## Detailed Design

This proposal removes the where clause from the for-in loop grammar:

```swift
for case? pattern in expression code-block
```

## Impact on Existing Code

Code must be refactored to move the where clause into `guard` (or, for less stylish coders, `if`) conditions.

## Alternatives Considered

* Not accepting this proposal, leaving the grammar intact.

* Including `catch` and `case` under the umbrella of this proposal. I think the general Swift user base would be extremely upset. Redesigning `switch` and `catch` statements to allow disjoint expressions a la SE-0099 would be difficult and disruptive.

* Change `where` in `catch` and `case` clauses to `if`, restricting `where` clauses strictly to type constraints without  burning a new keyword. As Xiaodi Wu puts it, "Replacing `where` with `if` is unambiguous and eliminates the implication of a subordinate semantic relationship that can't be enforced, while still exposing all of the expressiveness made possible by `where` in that particular scenario."

```swift
    switch json {
    case let json as NSArray if json.count > 0:
        // handle non-empty array
    case let json as NSDictionary if json.allKeys.count > 0:
        // handle non-empty dict
    default:
        break
    }
```
* Extending the syntactic sugar in `for-in` loops to include `while`, `unless`, and `until`. This adds all four variations on `break` and `continue` to the `for-in` vocabulary, and might include a simultaneous renaming of `where` to `if`.

## Acknowledgements

Big thanks to Joe Groff, Becca Royal-Gordon, Xiaodi Wu


text:
The tchannel documentation is spread out in multiple parts

## Read the Node GUIDE

Check out our [GUIDE](./GUIDE.md)

## Core topics

The following documents are core to tchannel

 - [channel](./channel.md)
 - [sub-channels](./sub-channels.md)
 - [hyperbahn](./hyperbahn.md)
 - [as-thrift](./as-thrift.md)

## Extra topics

The following documents give more details for other use cases
that are available.

 - [as-json](./as-json.md)
 - [errors](./errors.md)
 - [peer-to-peer](./peer-to-peer.md)
 - [statsd](./statsd.md)
 - [streaming](./streaming.md)


text:
package leap.web.security.login;

import leap.core.security.Authentication;
import leap.web.Request;
import leap.web.Response;

public interface LoginManager {

    boolean promoteLogin(Request request, Response response, LoginContext context) throws Throwable;

    boolean handleLoginRequest(Request request, Response response, LoginContext context) throws Throwable;

    void handleLoginSuccess(Request request, Response response, Authentication authc) throws Throwable;
}


text:
import 'phaser';
import 'lodash';
import 'webfontloader';

require('./index.html'); // so we get it in the dist

import LoadingScene from './scenes/loading';
import MainMenuScene from './scenes/main_menu';
import PlayMissionScene from './scenes/play_mission';
import PlayMissionHudScene from './scenes/play_mission/hud';
import MissionResultsScene from './scenes/mission_results';
import MissionsScene from './scenes/missions';

var gameConfig = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    backgroundColor: '#000000',
    physics: {
        default: 'arcade',
        arcade: {
            //debug: true, // enable to see physics bodies outlined
        }
    },
    scene: [LoadingScene, MainMenuScene, PlayMissionScene, PlayMissionHudScene, MissionResultsScene, MissionsScene]
};

let game = new Phaser.Game(gameConfig);


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".activities.signup1.SignUpPart1Activity">
    <item android:id="@+id/submitSend"
        android:title="@string/submitSignup1"
        android:orderInCategory="100"
        android:icon="@android:drawable/ic_menu_send"
        app:showAsAction="always" />
</menu>


text:
from setuptools import setup, find_packages

with open('requirements.txt') as f:
    requirements = f.read().splitlines()

version = '0.3.1'

setup(
    name='praw-oauth2util',
    version=version,
    install_requires=requirements,
    author='Benjamin Schmid',
    author_email='bsgame27@gmail.com',
    packages=find_packages(),
    include_package_data=True,
    url='https://github.com/SmBe19/praw-OAuth2Util/',
    license='MIT',
    description='OAuth2 wrapper for PRAW',
    classifiers=[
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: MIT License',
        'Operating System :: POSIX',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Topic :: Internet',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Topic :: Utilities',
    ],
)


text:
import { Session, SessionType } from "../../../server/schema/Session";
import Keyword from "../../../server/schema/keywords";
import speaker from "../../people/tanmai-gopal";

const talk: Session = {
  people: [speaker],
  title: "Writing a realtime GraphQL backend as a compiler in Haskell",
  description: `At Hasura, we've been building a high-performance GraphQL backend that can handle a large number of subscription connections. We took a few interesting approaches to tackle this problem, and in this talk I'll go over the key architectural decisions, programming constructs and of course the unforeseen implementation pitfalls we ran into. I'll also cover tools from the Haskell ecosystem that made this possible. These are some of the topics I'll touch upon:

* Fast GraphQL parsing with parser combinators
* Modelling and manipulating the GraphQL AST with algebraic data types
* Software Transactional Memory: Concurrency constructs for scaling graphql subscriptions
`,
  type: SessionType.LIGHTNING_TALK,
  keywords: [Keyword.GRAPHQL],
  urls: {
    web: "",
    slides: "http://slides.graphql-finland.fi/2018/13-tanmai-gopal.pdf",
    video: "https://www.youtube.com/watch?v=bQLwmYFdCFQ",
  },
};

export default talk;


text:
.class Lcom/htc/widget/DecorFlow$2;
.super Ljava/lang/Object;
.source "DecorFlow.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/htc/widget/DecorFlow;->onKeyUp(ILandroid/view/KeyEvent;)Z
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/htc/widget/DecorFlow;

# direct methods
.method constructor <init>(Lcom/htc/widget/DecorFlow;)V
    .locals 0
    .parameter

    .prologue
    .line 1421
    iput-object p1, p0, Lcom/htc/widget/DecorFlow$2;->this$0:Lcom/htc/widget/DecorFlow;

    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()V
    .locals 1

    .prologue
    .line 1423
    iget-object v0, p0, Lcom/htc/widget/DecorFlow$2;->this$0:Lcom/htc/widget/DecorFlow;

    #calls: Lcom/htc/widget/DecorFlow;->dispatchUnpress()V
    invoke-static {v0}, Lcom/htc/widget/DecorFlow;->access$300(Lcom/htc/widget/DecorFlow;)V

    .line 1424
    return-void
.end method


text:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
sys.getdefaultencoding()


text:
require 'rails_helper'

describe ConfigurableStateMachine::Machine do
  describe 'with standard workflow Offender SAR case' do

    TRANSITIONS = [
      {
        state: :data_to_be_requested,
        specific_events: [
          :preview_cover_page,
          :mark_as_waiting_for_data,
          :send_acknowledgement_letter
        ]
      },
      {
        state: :waiting_for_data,
        specific_events: [
          :preview_cover_page,
          :mark_as_ready_for_vetting,
          :send_acknowledgement_letter,
          :move_case_back
        ]
      },
      {
        state: :ready_for_vetting,
        specific_events: [
          :preview_cover_page,
          :mark_as_vetting_in_progress,
          :move_case_back
        ]
      },
      {
        state: :vetting_in_progress,
        specific_events: [
          :mark_as_ready_to_copy,
          :preview_cover_page,
          :move_case_back
        ]
      },
      {
        state: :ready_to_copy,
        specific_events: [
          :preview_cover_page,
          :mark_as_ready_to_dispatch,
          :move_case_back
        ]
      },
      {
        state: :ready_to_dispatch,
        specific_events: [
          :preview_cover_page,
          :close,
          :send_dispatch_letter,
          :move_case_back
        ]
      },
      {
        state: :closed,
        full_events: [
          :preview_cover_page,
          :add_note_to_case,
          :edit_case,
          :send_dispatch_letter,
          :start_complaint,
          :mark_as_further_actions_required,
          :mark_as_partial_case,
          :unmark_as_further_actions_required,
          :unmark_as_partial_case,
          :mark_as_awaiting_response_for_partial_case,
          :annotate_retention_changes,
          :annotate_system_retention_changes,
        ]
      },
    ].freeze

    UNIVERSAL_EVENTS = %i[
      add_note_to_case
      add_data_received
      edit_case
    ].freeze

    def offender_sar_case(with_state:)
      create :offender_sar_case, with_state
    end

    context 'as responder' do
      let(:responder) { find_or_create :branston_user }

      TRANSITIONS.each do |transition|
        context "with Offender SAR in state #{transition[:state]}" do
          let(:kase) { offender_sar_case with_state: transition[:state] }

          before do
            expect(kase.current_state.to_sym).to eq transition[:state]
          end

          it 'only allows permitted events' do
            permitted_events = (transition[:full_events] || UNIVERSAL_EVENTS) +
                                (transition[:specific_events] || [])

            expect(kase.state_machine.permitted_events(responder))
              .to match_array permitted_events
          end

          it "allow start_complaints when the case is open late or closed" do
            if transition[:state] != 'closed'
              kase.external_deadline = Date.today - 1.days
              kase.save!
            end

            expect(kase.state_machine.permitted_events(responder))
              .to include :start_complaint
          end

        end
      end

      it "allow to record reason of lateness when a ready-to-copy case is late " do
        late_kase = create :offender_sar_case, "ready_to_copy", received_date: 2.month.ago
        expect(late_kase.state_machine.permitted_events(responder))
          .to include :capture_reason_for_lateness
        expect(late_kase.state_machine.permitted_events(responder))
          .not_to include :mark_as_ready_to_dispatch
      end

    end
  end
end


text:
import PowerSelectBeforeOptions from 'ember-power-select/components/power-select/before-options';

export default class PaperSelectOptions extends PowerSelectBeforeOptions {}


text:
Kamila's Git Hooks
==================

[Git hooks](http://githooks.com/) enable you to do things when something happens in a Git repo. My favorite use is "push to deploy": when I push new commits to a server, it will compile the thing and deploy a new version into production. Therefore:

- finding out what is deployed in production is trivial
- deploying a new release is trivial
  - and therefore there is little incentive to do horrible things like ssh-ing into prod and hotfixing things there :-)

I use it everywhere, because I have made it trivial to set up by writing it down :-)

How to
------

### [on server] set up repo:

```sh
# on server
cd _git  # I keep all my bare repos here
git clone --bare <url>  # if it's not there yet
cd <repo>/hooks
ln -s ../../git-hooks/post-receive-<something> ./post-receive
vim ./build.sh  # maybe -- see post-receive-<something>
# in my case, probably ln -s ../../git-hooks/examples/<repo>/build.sh .
```

### [in work repo] set up remote:

```sh
git remote add <name> ssh://kamila@<server>/home/kamila/_git/<repo>.git
```
Now you can type `git push <name> master` and watch your build/deploy :-)

Optionally, set up an "all" remote to push to everything at once:

```sh
git remote add all <fetch-url>
# for fish
for url in (git remote -v | cut -f2 | cut -d' ' -f1 | sort | uniq); git remote set-url --add --push all $url ; end
# for POSIX (bash, etc.)
for url in $(git remote -v | cut -f2 | cut -d' ' -f1 | sort | uniq); do git remote set-url --add --push all $url ; done
```

If you want to, set upstream to the `all` remote, so that you can `git push` there by default (for pull, `<fetch-url>` will be used):
```sh
git push -u all
```

"What to" / what useful things are in this repo
-----------------------------------------------

- `post-receive-clone-and-build`: Clones the repo into a temporary location and calls a custom script in there. Drop a `build.sh` next to `post-receive` (into `hooks/`). Example build scripts:
  - [Jekyll](https://jekyllrb.com/) website: [`examples/kamila.is/build.sh`](https://github.com/AnotherKamila/git-hooks/blob/master/examples/kamila.is/build.sh) (see https://github.com/AnotherKamila/kamila.is/tree/master/_bin for the actual scripts, which you probably want to copy as well). Mimics GitHub pages, except that it gives you more freedom :-)
  - Javascript single-page web application that uses npm (built with webpack): [`examples/songbook-web/build.sh`](https://github.com/AnotherKamila/git-hooks/blob/master/examples/songbook-web/build.sh)
  - Python web service (supervised by daemontools): [`examples/songbook-api/*`](https://github.com/AnotherKamila/git-hooks/blob/master/examples/songbook-api/)


text:
For those who don't know, a Bozo Sort is a joke sorting algorithm that actually sorts but at horrible timing and is very inefficient.

**Note**: Do not use it in production, unless you're a bozo.

![bozo clown](http://blog.syracuse.com/news/2008/07/medium_Bozo.JPG)

## Install

```
$ npm install --save bozosort
```

## Usage

```js
var bozosort = require('bozosort');

bozosort([5, 7, 3, 10, 4, 15, 1]);
//=> [1, 3, 4, 5, 7, 10, 15]
```

## API

### bozosort(list)

#### list

*Required*
Type: `Array`

## License

MIT © [Vinícius do Carmo](http://vinimdocarmo.js.org)


text:
package org.eclipse.winery.repository.resources._support.collections.withid;

import java.lang.reflect.Constructor;
import java.util.List;

import org.eclipse.winery.repository.resources._support.IPersistable;
import org.eclipse.winery.repository.resources._support.collections.EntityCollectionResource;
import org.eclipse.winery.repository.resources._support.collections.IIdDetermination;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class EntityWithIdCollectionResource<EntityResourceT extends EntityWithIdResource<EntityT>, EntityT> extends EntityCollectionResource<EntityResourceT, EntityT> {

	private static final Logger LOGGER = LoggerFactory.getLogger(EntityWithIdCollectionResource.class);

	/**
	 * {@inheritDoc}
	 */
	public EntityWithIdCollectionResource(Class<EntityResourceT> entityResourceTClazz, Class<EntityT> entityTClazz, List<EntityT> list, IPersistable res) {
		super(entityResourceTClazz, entityTClazz, list, res);
	}

	/**
	 * Each CollectionResource has to implement the id getting by itself as
	 * TOSCA XSD does not provide a general purpose id fetching mechanism
	 */
	@Override
	public abstract String getId(EntityT entity);

	@Override
	protected EntityResourceT getEntityResourceInstance(EntityT entity, int idx) {
		Constructor<EntityResourceT> constructor;
		try {
			constructor = this.entityResourceTClazz.getConstructor(IIdDetermination.class, this.entityTClazz, int.class, List.class, this.res.getClass());
		} catch (Exception e) {
			try {
				constructor = this.entityResourceTClazz.getConstructor(IIdDetermination.class, this.entityTClazz, int.class, List.class, IPersistable.class);
			} catch (Exception e2) {
				EntityWithIdCollectionResource.LOGGER.debug("Could not get constructor", e);
				EntityWithIdCollectionResource.LOGGER.debug("res.getClass() was {}", this.res.getClass());
				throw new IllegalStateException(e2);
			}
		}
		EntityResourceT newInstance;
		try {
			newInstance = constructor.newInstance(this, entity, idx, this.list, this.res);
		} catch (Exception e) {
			EntityWithIdCollectionResource.LOGGER.debug("Could not instantiate class", e);
			throw new IllegalStateException(e);
		}
		return newInstance;
	}

}


text:
#ifndef _POWER_MANAGER_H_
#define _POWER_MANAGER_H_

#include "fsl_common.h"
#include "fsl_notifier.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/

/* Power mode definition used in application. */
typedef enum _app_power_mode
{
    kAPP_PowerModeMin = 'A' - 1,
    kAPP_PowerModeRun,   /*!< Run mode. All Kinetis chips. */
    kAPP_PowerModeWait,  /*!< Wait mode. All Kinetis chips. */
    kAPP_PowerModeStop,  /*!< Stop mode. All Kinetis chips. */
    kAPP_PowerModeVlpr,  /*!< Very low power run mode. All Kinetis chips. */
    kAPP_PowerModeVlpw,  /*!< Very low power wait mode. All Kinetis chips. */
    kAPP_PowerModeVlps,  /*!< Very low power stop mode. All Kinetis chips. */
    kAPP_PowerModeLls,   /*!< Low leakage stop mode. All Kinetis chips. */
    kAPP_PowerModeVlls0, /*!< Very low leakage stop 0 mode. Chip-specific. */
    kAPP_PowerModeVlls1, /*!< Very low leakage stop 1 mode. All Kinetis chips. */
    kAPP_PowerModeVlls2, /*!< Very low leakage stop 2 mode. All Kinetis chips. */
    kAPP_PowerModeVlls3, /*!< Very low leakage stop 3 mode. All Kinetis chips. */
    kAPP_PowerModeHsrun, /*!< High-speed run mode. Chip-specific. */
    kAPP_PowerModeMax
} app_power_mode_t;

/*!
 * @brief Power mode user configuration structure.
 *
 * This structure defines Kinetis power mode with additional power options and specifies
 * transition to and out of this mode. Application may define multiple power modes and
 * switch between them.
 * List of power mode configuration structure members depends on power options available
 * for specific chip. Complete list contains:
 *  mode - Kinetis power mode. List of available modes is chip-specific. See power_manager_modes_t
 *   list of modes. This item is common for all Kinetis chips.
 *  enableLowPowerWakeUpOnInterrupt - When set to true, system exits to Run mode when any interrupt occurs while in
 *   Very low power run, Very low power wait or Very low power stop mode. This item is chip-specific.
 *  enablePowerOnResetDetection - When set to true, power on reset detection circuit is disabled in
 *   Very low leakage stop 0 mode. When set to false, circuit is enabled. This item is chip-specific.
 *  enableRAM2Powered - When set to true, RAM2 partition content is retained through Very low
 *   leakage stop 2 mode. When set to false, RAM2 partition power is disabled and memory content lost.
 *   This item is chip-specific.
 *  enableLowPowerOscillator - When set to true, the 1 kHz Low power oscillator is disabled in any
 *   Low leakage or Very low leakage stop mode. When set to false, oscillator is enabled in these modes.
 *   This item is chip-specific.
 */
typedef struct power_user_config
{
    app_power_mode_t mode; /*!< Power mode. */

    bool enablePorDetectInVlls0; /*!< true - Power on reset detection circuit is enabled in Very low leakage stop 0
                                    mode, false - Power on reset detection circuit is disabled. */

    bool enableRam2InVlls2; /*!< true - RAM2 partition content is retained through Very low leakage stop 2 mode, false -
                               RAM2 partition power is disabled and memory content lost. */

} power_user_config_t;

/* callback data type which is used for power manager user callback */
typedef struct
{
    uint32_t beforeNotificationCounter; /*!< Callback before notification counter */
    uint32_t afterNotificationCounter;  /*!< Callback after notification counter */
    smc_power_state_t originPowerState; /*!< Origin power state before switch */
} user_callback_data_t;

typedef enum _app_wakeup_source
{
    kAPP_WakeupSourceLptmr, /*!< Wakeup by LPTMR.        */
    kAPP_WakeupSourcePin    /*!< Wakeup by external pin. */
} app_wakeup_source_t;

#endif /* _POWER_MANAGER_H_ */


text:
package org.mycontroller.standalone.api.jaxrs.mixins;

import java.util.ArrayList;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * @author Jeeva Kandasamy (jkandasa)
 * @since 0.0.3
 */
abstract class FirmwareMixin {

    @JsonIgnore
    abstract ArrayList<Byte> getData();

}


text:
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class SuperReplace {

	private String text;

	public SuperReplace(String text) {
		this.text = text;
	}

	public String replace(String regex) {
		Matcher matcher = Pattern.compile(regex).matcher(text);
		StringBuffer sb = new StringBuffer("");
		while (matcher.find()) {
			matcher.appendReplacement(sb, getReplacement(sb, matcher));
		}
		if (sb.length() == 0) {
			return text;
		} else {
			matcher.appendTail(sb);
			return sb.toString();
		}
	}
	public abstract String getReplacement(StringBuffer sb, Matcher matcher);
}


text:
<?php

namespace OpenOrchestra\BBcodeBundle\ElementNode;

use OpenOrchestra\BBcodeBundle\Definition\BBcodeDefinitionInterface;

/**
 * Interface BBcodeElementNodeInterface
 */
Interface BBcodeElementNodeInterface
{
    /**
     * Return the element as html with all replacements made
     *
     * @return the html representation of this node
     */
    public function getAsHTML();

    /**
     * Return the element as text with all replacements made
     *
     * @return the text representation of this node
     */
    public function getAsText();

    /**
     * Return the element as html with all replacements made, in a preview context
     *
     * @return the html representation of this node
     */
    public function getAsPreviewHTML();

    /**
     * Sets the CodeDefinition that defines this element.
     *
     * @param codeDef the code definition that defines this element node
     */
    public function setBBCodeDefinition(BBcodeDefinitionInterface $codeDef);

    /**
     * Returns all the children of this element.
     *
     * @return array
     */
    public function getChildren();

    /**
     * Returns the element as bbcode (with all unclosed tags closed)
     *
     * @return string
     */
    public function getAsBBCode();

    /**
     * Returns the attribute (used as the option in bbcode definitions) of this element.
     *
     * @return array
     */
    public function getAttribute();
}


text:
.class public Landroid/app/SpellManager;
.super Ljava/lang/Object;
.source "SpellManager.java"

# static fields
.field private static final DEBUG:Z = true

.field public static final INTENT_ACTION_SPELLSCROLL_CHANGED:Ljava/lang/String; = "android.spell.action.SPELLSCROLL_CHANGED"

.field private static final TAG:Ljava/lang/String; = "SpellManager"

.field private static mService:Landroid/app/ISpellManager;

# instance fields
.field private final mContext:Landroid/content/Context;

.field final mHandler:Landroid/os/Handler;

# direct methods
.method constructor <init>(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 1
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 73
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 74
    iput-object p1, p0, Landroid/app/SpellManager;->mContext:Landroid/content/Context;

    .line 75
    iput-object p2, p0, Landroid/app/SpellManager;->mHandler:Landroid/os/Handler;

    .line 76
    const-string v0, "spell"

    invoke-static {v0}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

    move-result-object v0

    invoke-static {v0}, Landroid/app/ISpellManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/ISpellManager;

    move-result-object v0

    sput-object v0, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    .line 78
    return-void
.end method

# virtual methods
.method public cast(JLandroid/os/Bundle;)Z
    .locals 6
    .parameter "spellId"
    .parameter "userInput"

    .prologue
    const/4 v2, 0x0

    .line 314
    :try_start_0
    sget-object v3, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v3, p1, p2}, Landroid/app/ISpellManager;->getSpellById(J)Landroid/app/SpellScroll;

    move-result-object v1

    .line 316
    .local v1, info:Landroid/app/SpellScroll;
    if-eqz v1, :cond_0

    invoke-virtual {v1}, Landroid/app/SpellScroll;->getSpell()Landroid/app/SpellScroll$Spell;

    move-result-object v3

    if-nez v3, :cond_1

    .line 325
    .end local v1           #info:Landroid/app/SpellScroll;
    :cond_0
    :goto_0
    return v2

    .line 320
    .restart local v1       #info:Landroid/app/SpellScroll;
    :cond_1
    invoke-virtual {v1}, Landroid/app/SpellScroll;->getSpell()Landroid/app/SpellScroll$Spell;

    move-result-object v3

    iget-object v4, p0, Landroid/app/SpellManager;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v4, p3}, Landroid/app/SpellScroll$Spell;->cast(Landroid/content/Context;Landroid/os/Bundle;)Z
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v2

    goto :goto_0

    .line 321
    .end local v1           #info:Landroid/app/SpellScroll;
    :catch_0
    move-exception v0

    .line 322
    .local v0, e:Landroid/os/RemoteException;
    const-string v3, "SpellManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "cast() failed: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public getBitmap(Ljava/lang/String;I)Landroid/graphics/Bitmap;
    .locals 12
    .parameter "spellScrollName"
    .parameter "id"

    .prologue
    const/4 v8, 0x0

    .line 177
    if-nez p2, :cond_1

    .line 217
    :cond_0
    :goto_0
    return-object v8

    .line 182
    :cond_1
    :try_start_0
    sget-object v7, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v7, p1}, Landroid/app/ISpellManager;->getSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;

    move-result-object v5

    .line 184
    .local v5, info:Landroid/app/SpellScroll;
    if-eqz v5, :cond_0

    .line 185
    iget-object v7, p0, Landroid/app/SpellManager;->mContext:Landroid/content/Context;

    invoke-virtual {v5, v7}, Landroid/app/SpellScroll;->getPackageContext(Landroid/content/Context;)Landroid/content/Context;

    move-result-object v6

    .line 187
    .local v6, packageContext:Landroid/content/Context;
    invoke-virtual {v5}, Landroid/app/SpellScroll;->getIconId()I

    move-result v7

    if-ne v7, p2, :cond_3

    .line 190
    invoke-virtual {v6}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v7

    invoke-virtual {v5}, Landroid/app/SpellScroll;->getTargetPackage()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v7, v9}, Landroid/content/pm/PackageManager;->getCSCPackageItemIcon(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v3

    .line 192
    .local v3, cscAppIcon:Landroid/graphics/drawable/Drawable;
    if-eqz v3, :cond_3

    .line 193
    instance-of v7, v3, Landroid/graphics/drawable/BitmapDrawable;

    if-eqz v7, :cond_2

    .line 194
    move-object v0, v3

    check-cast v0, Landroid/graphics/drawable/BitmapDrawable;

    move-object v7, v0

    invoke-virtual {v7}, Landroid/graphics/drawable/BitmapDrawable;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object v1

    .line 196
    .local v1, bitmap:Landroid/graphics/Bitmap;
    if-eqz v1, :cond_2

    move-object v8, v1

    .line 197
    goto :goto_0

    .line 201
    .end local v1           #bitmap:Landroid/graphics/Bitmap;
    :cond_2
    invoke-virtual {v3}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v7

    invoke-virtual {v3}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v9

    sget-object v10, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {v7, v9, v10}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v1

    .line 202
    .restart local v1       #bitmap:Landroid/graphics/Bitmap;
    new-instance v2, Landroid/graphics/Canvas;

    invoke-direct {v2, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 203
    .local v2, canvas:Landroid/graphics/Canvas;
    const/4 v7, 0x0

    const/4 v9, 0x0

    invoke-virtual {v2}, Landroid/graphics/Canvas;->getWidth()I

    move-result v10

    invoke-virtual {v2}, Landroid/graphics/Canvas;->getHeight()I

    move-result v11

    invoke-virtual {v3, v7, v9, v10, v11}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 204
    invoke-virtual {v3, v2}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    move-object v8, v1

    .line 206
    goto :goto_0

    .line 210
    .end local v1           #bitmap:Landroid/graphics/Bitmap;
    .end local v2           #canvas:Landroid/graphics/Canvas;
    .end local v3           #cscAppIcon:Landroid/graphics/drawable/Drawable;
    :cond_3
    if-eqz v6, :cond_4

    invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    if-eqz v7, :cond_4

    invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    invoke-static {v7, p2}, Landroid/graphics/BitmapFactory;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v7

    :goto_1
    move-object v8, v7

    goto :goto_0

    :cond_4
    move-object v7, v8

    goto :goto_1

    .line 213
    .end local v5           #info:Landroid/app/SpellScroll;
    .end local v6           #packageContext:Landroid/content/Context;
    :catch_0
    move-exception v4

    .line 214
    .local v4, e:Landroid/os/RemoteException;
    const-string v7, "SpellManager"

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "getBitmap() failed: "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v7, v9}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto/16 :goto_0
.end method

.method public getInformationHash()I
    .locals 4

    .prologue
    .line 330
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1}, Landroid/app/ISpellManager;->getInformationHash()I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 335
    :goto_0
    return v1

    .line 331
    :catch_0
    move-exception v0

    .line 332
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getInformationHash() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 335
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getInstantSpell(Ljava/lang/String;)J
    .locals 7
    .parameter "spellText"

    .prologue
    const-wide/16 v2, 0x0

    .line 282
    :try_start_0
    sget-object v4, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v4, p1}, Landroid/app/ISpellManager;->getInstantSpell(Ljava/lang/String;)Landroid/app/SpellScroll;

    move-result-object v1

    .line 284
    .local v1, info:Landroid/app/SpellScroll;
    if-eqz v1, :cond_0

    invoke-virtual {v1}, Landroid/app/SpellScroll;->getSpell()Landroid/app/SpellScroll$Spell;

    move-result-object v4

    invoke-virtual {v4}, Landroid/app/SpellScroll$Spell;->getId()J
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-wide v2

    .line 289
    .end local v1           #info:Landroid/app/SpellScroll;
    :cond_0
    :goto_0
    return-wide v2

    .line 285
    :catch_0
    move-exception v0

    .line 286
    .local v0, e:Landroid/os/RemoteException;
    const-string v4, "SpellManager"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "getInstantSpell() failed: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public getShallowSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;
    .locals 4
    .parameter "spellScrollName"

    .prologue
    .line 113
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1}, Landroid/app/ISpellManager;->getShallowSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 118
    :goto_0
    return-object v1

    .line 114
    :catch_0
    move-exception v0

    .line 115
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getShallowSpellScroll() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 118
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpell(J)Landroid/app/SpellScroll$Spell;
    .locals 6
    .parameter "spellId"

    .prologue
    const/4 v2, 0x0

    .line 255
    :try_start_0
    sget-object v3, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v3, p1, p2}, Landroid/app/ISpellManager;->getSpellById(J)Landroid/app/SpellScroll;

    move-result-object v1

    .line 257
    .local v1, info:Landroid/app/SpellScroll;
    if-eqz v1, :cond_0

    invoke-virtual {v1}, Landroid/app/SpellScroll;->getSpell()Landroid/app/SpellScroll$Spell;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 262
    .end local v1           #info:Landroid/app/SpellScroll;
    :cond_0
    :goto_0
    return-object v2

    .line 258
    :catch_0
    move-exception v0

    .line 259
    .local v0, e:Landroid/os/RemoteException;
    const-string v3, "SpellManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "getSpell() failed: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public getSpell(Ljava/lang/String;Ljava/lang/String;)Landroid/app/SpellScroll$Spell;
    .locals 6
    .parameter "spellScrollName"
    .parameter "spellName"

    .prologue
    const/4 v2, 0x0

    .line 268
    :try_start_0
    sget-object v3, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v3, p1, p2}, Landroid/app/ISpellManager;->getSpellMatchOnly(Ljava/lang/String;Ljava/lang/String;)Landroid/app/SpellScroll;

    move-result-object v1

    .line 270
    .local v1, info:Landroid/app/SpellScroll;
    if-eqz v1, :cond_0

    invoke-virtual {v1, p2}, Landroid/app/SpellScroll;->getSpell(Ljava/lang/String;)Landroid/app/SpellScroll$Spell;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 275
    .end local v1           #info:Landroid/app/SpellScroll;
    :cond_0
    :goto_0
    return-object v2

    .line 271
    :catch_0
    move-exception v0

    .line 272
    .local v0, e:Landroid/os/RemoteException;
    const-string v3, "SpellManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "getSpell() failed: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public getSpellName(J)Ljava/lang/String;
    .locals 4
    .parameter "spellId"

    .prologue
    .line 304
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1, p2}, Landroid/app/ISpellManager;->getSpellNameById(J)Ljava/lang/String;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 309
    :goto_0
    return-object v1

    .line 305
    :catch_0
    move-exception v0

    .line 306
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellName() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 309
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpellNames(Ljava/lang/String;)Ljava/util/List;
    .locals 4
    .parameter "spellScrollName"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 168
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1}, Landroid/app/ISpellManager;->getSpellNames(Ljava/lang/String;)Ljava/util/List;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 173
    :goto_0
    return-object v1

    .line 169
    :catch_0
    move-exception v0

    .line 170
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellNames() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 173
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;
    .locals 4
    .parameter "spellScrollName"

    .prologue
    .line 123
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1}, Landroid/app/ISpellManager;->getSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 128
    :goto_0
    return-object v1

    .line 124
    :catch_0
    move-exception v0

    .line 125
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellScroll() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 128
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpellScrollName(J)Ljava/lang/String;
    .locals 4
    .parameter "spellId"

    .prologue
    .line 294
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1, p2}, Landroid/app/ISpellManager;->getSpellScrollNameById(J)Ljava/lang/String;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 299
    :goto_0
    return-object v1

    .line 295
    :catch_0
    move-exception v0

    .line 296
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellScrollName() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 299
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpellScrollNames()Ljava/util/List;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 93
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1}, Landroid/app/ISpellManager;->getSpellScrollNames()Ljava/util/List;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 98
    :goto_0
    return-object v1

    .line 94
    :catch_0
    move-exception v0

    .line 95
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellScrolls() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 98
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpellScrollNamesByPriority(I)Ljava/util/List;
    .locals 4
    .parameter "priority"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I)",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 103
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1}, Landroid/app/ISpellManager;->getSpellScrollNamesByPriority(I)Ljava/util/List;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 108
    :goto_0
    return-object v1

    .line 104
    :catch_0
    move-exception v0

    .line 105
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellScrollNamesByPriority() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 108
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getSpells(Ljava/lang/String;)Ljava/util/List;
    .locals 6
    .parameter "spellScrollName"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Landroid/app/SpellScroll$Spell;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v2, 0x0

    .line 133
    :try_start_0
    sget-object v3, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v3, p1}, Landroid/app/ISpellManager;->getSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;

    move-result-object v1

    .line 135
    .local v1, scroll:Landroid/app/SpellScroll;
    if-eqz v1, :cond_0

    invoke-virtual {v1}, Landroid/app/SpellScroll;->getSpells()Ljava/util/List;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 140
    .end local v1           #scroll:Landroid/app/SpellScroll;
    :cond_0
    :goto_0
    return-object v2

    .line 136
    :catch_0
    move-exception v0

    .line 137
    .local v0, e:Landroid/os/RemoteException;
    const-string v3, "SpellManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "getShallowSpellScroll() failed: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public getString(Ljava/lang/String;I)Ljava/lang/String;
    .locals 8
    .parameter "spellScrollName"
    .parameter "id"

    .prologue
    const/4 v4, 0x0

    .line 221
    if-nez p2, :cond_1

    .line 249
    :cond_0
    :goto_0
    return-object v4

    .line 226
    :cond_1
    :try_start_0
    sget-object v5, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v5, p1}, Landroid/app/ISpellManager;->getSpellScroll(Ljava/lang/String;)Landroid/app/SpellScroll;

    move-result-object v2

    .line 228
    .local v2, info:Landroid/app/SpellScroll;
    if-eqz v2, :cond_0

    .line 229
    iget-object v5, p0, Landroid/app/SpellManager;->mContext:Landroid/content/Context;

    invoke-virtual {v2, v5}, Landroid/app/SpellScroll;->getPackageContext(Landroid/content/Context;)Landroid/content/Context;

    move-result-object v3

    .line 231
    .local v3, packageContext:Landroid/content/Context;
    invoke-virtual {v2}, Landroid/app/SpellScroll;->getLabelId()I

    move-result v5

    if-ne v5, p2, :cond_2

    .line 235
    invoke-virtual {v3}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v5

    invoke-virtual {v2}, Landroid/app/SpellScroll;->getTargetPackage()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Landroid/content/pm/PackageManager;->getCSCPackageItemText(Ljava/lang/String;)Ljava/lang/CharSequence;

    move-result-object v0

    .line 237
    .local v0, cs:Ljava/lang/CharSequence;
    if-eqz v0, :cond_2

    .line 238
    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v4

    goto :goto_0

    .line 242
    .end local v0           #cs:Ljava/lang/CharSequence;
    :cond_2
    if-eqz v3, :cond_0

    invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    if-eqz v5, :cond_0

    invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {v5, p2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v4

    goto :goto_0

    .line 245
    .end local v2           #info:Landroid/app/SpellScroll;
    .end local v3           #packageContext:Landroid/content/Context;
    :catch_0
    move-exception v1

    .line 246
    .local v1, e:Landroid/os/RemoteException;
    const-string v5, "SpellManager"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "getString() failed: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public isValidSpell(J)Z
    .locals 7
    .parameter "spellId"

    .prologue
    const/4 v3, 0x0

    .line 145
    :try_start_0
    sget-object v4, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v4, p1, p2}, Landroid/app/ISpellManager;->getSpellScrollNameById(J)Ljava/lang/String;

    move-result-object v2

    .line 146
    .local v2, spellScrollName:Ljava/lang/String;
    sget-object v4, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v4, p1, p2}, Landroid/app/ISpellManager;->getSpellNameById(J)Ljava/lang/String;

    move-result-object v1

    .line 148
    .local v1, spellName:Ljava/lang/String;
    if-eqz v2, :cond_0

    if-eqz v1, :cond_0

    invoke-virtual {p0, v2, v1}, Landroid/app/SpellManager;->isValidSpell(Ljava/lang/String;Ljava/lang/String;)Z
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    .line 153
    .end local v1           #spellName:Ljava/lang/String;
    .end local v2           #spellScrollName:Ljava/lang/String;
    :cond_0
    :goto_0
    return v3

    .line 149
    :catch_0
    move-exception v0

    .line 150
    .local v0, e:Landroid/os/RemoteException;
    const-string v4, "SpellManager"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "isValidSpell() failed: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public isValidSpell(Ljava/lang/String;Ljava/lang/String;)Z
    .locals 4
    .parameter "spellScrollName"
    .parameter "spellName"

    .prologue
    .line 158
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1, p2}, Landroid/app/ISpellManager;->isValidSpell(Ljava/lang/String;Ljava/lang/String;)Z
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 163
    :goto_0
    return v1

    .line 159
    :catch_0
    move-exception v0

    .line 160
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "isValidSpell() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 163
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public isValidSpellScroll(Ljava/lang/String;)Z
    .locals 4
    .parameter "spellScrollName"

    .prologue
    .line 83
    :try_start_0
    sget-object v1, Landroid/app/SpellManager;->mService:Landroid/app/ISpellManager;

    invoke-interface {v1, p1}, Landroid/app/ISpellManager;->isValidSpellScroll(Ljava/lang/String;)Z
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 88
    :goto_0
    return v1

    .line 84
    :catch_0
    move-exception v0

    .line 85
    .local v0, e:Landroid/os/RemoteException;
    const-string v1, "SpellManager"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getSpellScrolls() failed: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 88
    const/4 v1, 0x0

    goto :goto_0
.end method


text:
package demo

import (
	"captcha-zh/config"

	"testing"
	"time"
	"fmt"
)

func TestTime1(t *testing.T)  {
	//获取时间戳
	tm := time.Now().Unix()

	// TODO fine
	fmt.Println("时间戳:", tm)
	fmt.Println("时间戳:", time.Unix(tm, 0).Format(config.DATE_FORMAT_DEFAULT))
	fmt.Println("当前时间是:", time.Now().Format(config.DATE_FORMAT_DEFAULT))
	fmt.Println("topic", int64(time.Now().Nanosecond()))

	fmt.Println(config.DATE_FORMAT_DEFAULT_LEN)
}


text:
<?php

if ( defined( 'CRYPTX_BASENAME' ) ) {
    add_action( 'init', 'awpcp_cryptx_compatibility' );
    add_action( 'awpcp-shortcode', 'awpcp_cryptx_shortcode_compatibility' );

    function awpcp_cryptx_exclude_posts($posts=array()) {
        global $cryptX_var;
        $excluded = explode( ',', $cryptX_var['excludedIDs'] );
        $excluded = array_unique( array_merge( $excluded, $posts ) );
        $cryptX_var['excludedIDs'] = join( ',', array_filter( $excluded ) );
    }

    function awpcp_cryptx_compatibility() {
        awpcp_cryptx_exclude_posts( awpcp_get_page_ids_by_ref( array(
            'place-ad-page-name',
            'edit-ad-page-name',
            'reply-to-ad-page-name',
        ) ) );
    }

    function awpcp_cryptx_shortcode_compatibility($shortcode) {
        global $wp_the_query;

        if ( in_array( $shortcode, array( 'place-ad', 'edit-ad', 'reply-to-ad' ) ) ) {
            awpcp_cryptx_exclude_posts( (array) $wp_the_query->queried_object->ID );
        }
    }
}


text:
/**
 * Script for parent frame, listening to messages from the iframe, to update iframe height
 */
(function (window, document) {
  var listen = function (e, t, f) {
    return typeof e.addEventListener === "function" ? e.addEventListener(t, f, false) : e.attachEvent('on' + t, f);
  };
  // Listen for events from the projects themselves
  listen(window, 'message', function (e) {
    var data = JSON.parse(e.data);
    if (!data.hasOwnProperty('iframeid')) {
      return;
    }
    if (data.iframeid.substr(0, 1) === '#') {
      data.iframeid = data.iframeid.substr(1);
    }
    // Find the iframe with updated height
    var iframe = document.getElementById(data.iframeid);
    if (!iframe ) {
      return;
    }
    // Update iframe height
    if (data.hasOwnProperty('height')) {
      iframe.style.height = parseInt(data.height, 10) + 'px';
    }
  });
})(window, document);


text:
use reproto_core::errors::Result;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use url::Url;

const GIT_BIN_ENV: &'static str = "REPROTO_GIT_BIN";
const FETCH_HEAD: &'static str = "FETCH_HEAD";

#[cfg(unix)]
mod sys {
    pub const DEFAULT_GIT_COMMAND: &'static str = "git";
}

#[cfg(windows)]
mod sys {
    pub const DEFAULT_GIT_COMMAND: &'static str = "git.exe";
}

use self::sys::*;

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct GitRepo {
    git_command: String,
    work_tree: PathBuf,
    git_dir: PathBuf,
    remote: Option<Url>,
    revspec: Option<String>,
}

impl GitRepo {
    pub fn with_remote<P: AsRef<Path>>(path: P, remote: Url, revspec: String) -> Result<GitRepo> {
        let path = path.as_ref();

        let git_command = find_git_command()?;

        let git_repo = GitRepo {
            git_command: git_command,
            work_tree: path.to_owned(),
            git_dir: path.join(".git"),
            remote: Some(remote),
            revspec: Some(revspec),
        };

        if !path.is_dir() {
            log::trace!("Initializing git repo in {}", path.display());
            fs::create_dir_all(path)?;
            git_repo.git(&["init"])?;
            git_repo.update()?;
        }

        Ok(git_repo)
    }

    /// Open the given path as an already existing git repository.
    pub fn open<P: AsRef<Path>>(path: P) -> Result<GitRepo> {
        let path = path.as_ref();

        let git_command = find_git_command()?;

        Ok(GitRepo {
            git_command: git_command,
            work_tree: path.to_owned(),
            git_dir: path.join(".git"),
            remote: None,
            revspec: None,
        })
    }

    pub fn path(&self) -> &Path {
        self.work_tree.as_ref()
    }

    pub fn git(&self, args: &[&str]) -> Result<()> {
        let mut command = Command::new(&self.git_command);

        command
            .args(args)
            .env("GIT_DIR", &self.git_dir)
            .env("GIT_WORK_TREE", &self.work_tree);

        log::debug!("git: {:?}", command);

        let status = command.status()?;

        if !status.success() {
            let code = status.code().unwrap_or(-1);
            return Err(format!("git: bad exit code: {}", code).into());
        }

        Ok(())
    }

    /// Reset to the given revspec.
    pub fn reset(&self, revspec: &str) -> Result<()> {
        self.git(&["reset", "--hard", revspec])?;
        Ok(())
    }

    /// Commit the current staged changed to the repo with the given message.
    pub fn commit(&self, message: &str) -> Result<()> {
        self.git(&["commit", "-m", message])?;
        Ok(())
    }

    /// Add the give file.
    pub fn add<P: AsRef<Path>>(&self, path: P) -> Result<()> {
        let path = path.as_ref();
        let path_str = path
            .to_str()
            .ok_or_else(|| format!("{}: could not convert to string", path.display()))?;

        self.git(&["add", path_str])?;
        Ok(())
    }

    /// Update the repository.
    pub fn update(&self) -> Result<()> {
        let remote = match self.remote.as_ref() {
            None => return Ok(()),
            Some(remote) => remote,
        };

        let revspec = match self.revspec.as_ref().map(|s| s.as_str()) {
            None => return Ok(()),
            Some(revspec) => revspec,
        };

        log::info!("Updating {}", remote);
        self.git(&["fetch", remote.as_ref(), revspec])?;
        self.reset(FETCH_HEAD)?;

        Ok(())
    }
}

fn find_git_command() -> Result<String> {
    match env::var(GIT_BIN_ENV) {
        Ok(git_bin) => return Ok(git_bin.to_owned()),
        Err(_) => {}
    };

    Ok(DEFAULT_GIT_COMMAND.to_owned())
}


text:
using System;
using ReMi.BusinessEntities.Auth;
using ReMi.Contracts.Cqrs.Commands;

namespace ReMi.Commands.Auth
{
    [Command("Set default package for new user", CommandGroup.Configuration)]
    public class SetDefaultProductForNewlyRegisteredUserCommand : ICommand
    {
        public CommandContext CommandContext { get; set; }
        public Account Account { get; set; }

        public override string ToString()
        {
            return String.Format("[Account={0}, CommandContext={1}]", Account, CommandContext);
        }
    }
}


text:
"""
   Purchase information.

.. module:: purchase
    :platform: Unix, Windows
    :synopis: providing purchase information for a movie

.. moduleauthor:: Thomas Lehmann <thomas.lehmann.private@googlemail.com>

   =======
   License
   =======
   Copyright (c) 2017 Thomas Lehmann

   Permission is hereby granted, free of charge, to any person obtaining a copy of this
   software and associated documentation files (the "Software"), to deal in the Software
   without restriction, including without limitation the rights to use, copy, modify, merge,
   publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
   to whom the Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies
   or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
   DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from concept.tools.serialize import Serializable
from concept.tools.decorator import validate_types
from concept.tools.compatible import TextType

class Purchase(Serializable):
    """Represents one purchase information of a movie."""

    @validate_types([TextType, TextType], offset=1)
    def __init__(self, where="", when="", url=""):
        """Initializing from parameters."""
        super(Purchase, self).__init__()
        self.where = where
        self.when = when
        self.url = url

    def is_enabled_for_attributes(self):
        """
        Provide true to store fiels as XML attributes.

        :rtype: True for writing the fields as attributes of the tag
        """
        return True

    def __repr__(self):
        """Readable string representation of an instance of this class."""
        return "Purchase(where=%(where)s, when=%(when)s, url=%(url)s)" % self.__dict__


text:
import pytest
import cv2
import numpy as np
import sys
import os
import upload
# make sure it can find detector.py file
sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/.."))
import util

image_path = './image/cat.jpg'
class TestUtil():

    def test_cv2(self):
        cat = cv2.imread(image_path)
        assert cat.shape == (566,604,3)

    def test_addnoise(self):
        _name = 'test_util_addnoise'
        _file  = './output/'+_name+'.png'
        cat = cv2.imread(image_path)
        noisy_ret = util.add_noise(cat,0.1)
        assert noisy_ret.shape == cat.shape
        cv2.imwrite(_file, noisy_ret)
        upload.imgur(_file, _name)


text:
var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
    showDivs(slideIndex += n);
}

function showDivs(n) {
    var i;
    var x = document.getElementsByClassName("slider");
    if (n > x.length) {slideIndex = 1;}
    if (n < 1) {slideIndex = x.length;}
    for (i = 0; i < x.length; i++) {
        x[i].style.display = "none";
    }
    x[slideIndex-1].style.display = "block";
}


text:
namespace RedDog.Messenger.Processor
{
    public interface IEventProcessor : IProcessor
    {

    }
}


text:
function Window_MenuActor() {
    this.initialize.apply(this, arguments);
}

Window_MenuActor.prototype = Object.create(Window_MenuStatus.prototype);
Window_MenuActor.prototype.constructor = Window_MenuActor;

Window_MenuActor.prototype.initialize = function() {
    Window_MenuStatus.prototype.initialize.call(this, 0, 0);
    this.hide();
};

Window_MenuActor.prototype.processOk = function() {
    if (!this.cursorAll()) {
        $gameParty.setTargetActor($gameParty.members()[this.index()]);
    }
    this.callOkHandler();
};

Window_MenuActor.prototype.selectLast = function() {
    this.select($gameParty.targetActor().index() || 0);
};

Window_MenuActor.prototype.selectForItem = function(item) {
    var actor = $gameParty.menuActor();
    var action = new Game_Action(actor);
    action.setItemObject(item);
    this.setCursorFixed(false);
    this.setCursorAll(false);
    if (action.isForUser()) {
        if (DataManager.isSkill(item)) {
            this.setCursorFixed(true);
            this.select(actor.index());
        } else {
            this.selectLast();
        }
    } else if (action.isForAll()) {
        this.setCursorAll(true);
        this.select(0);
    } else {
        this.selectLast();
    }
};


text:
<?php

namespace LidskaSila\Glow\Commanding;

interface CommandHandler
{

	public function handle(Command $command);
}


text:
package com.b2international.snowowl.api.rest.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.async.DeferredResult;

import com.b2international.commons.collections.Procedure;
import com.b2international.snowowl.core.events.util.Promise;

/**
 * @since 4.5
 */
public class DeferredResults {

	private static final Logger LOG = LoggerFactory.getLogger(DeferredResults.class);

	private static final class ResultSetter<T> extends Procedure<T> {
		private final DeferredResult<T> deferredResult;

		private ResultSetter(DeferredResult<T> deferredResult) {
			this.deferredResult = deferredResult;
		}

		@Override
		protected void doApply(T input) {
			if (deferredResult.isSetOrExpired()) {
				LOG.warn("Deferred result is already set or expired, could not deliver result {}.", input);
			} else {
				deferredResult.setResult(input);
			}
		}
	}

	private static final class PredefinedValueSetter<C, T> extends Procedure<C> {
		private final DeferredResult<T> deferredResult;
		private final T value;

		private PredefinedValueSetter(DeferredResult<T> deferredResult, T value) {
			this.deferredResult = deferredResult;
			this.value = value;
		}

		@Override
		protected void doApply(C input) {
			if (deferredResult.isSetOrExpired()) {
				LOG.warn("Deferred result is already set or expired, could not deliver value {} for result {}.", value, input);
			} else {
				deferredResult.setResult(value);
			}
		}
	}

	private static final class ThrowableSetter extends Procedure<Throwable> {
		private final DeferredResult<?> deferredResult;

		private ThrowableSetter(DeferredResult<?> deferredResult) {
			this.deferredResult = deferredResult;
		}

		@Override
		protected void doApply(Throwable err) {
			if (deferredResult.isSetOrExpired()) {
				LOG.warn("Deferred result is already set or expired, could not deliver Throwable.", err);
			} else {
				deferredResult.setErrorResult(err);
			}
		}
	}

	private DeferredResults() {
		throw new UnsupportedOperationException("This class is not supposed to be instantiated.");
	}

	/**
	 * Wraps a {@link Promise} into Spring's {@link DeferredResult}.
	 *
	 * @param promise
	 *            - the promise to wrap
	 * @return - the {@link DeferredResult}
	 */
	public static <T> DeferredResult<T> wrap(Promise<T> promise) {
		final DeferredResult<T> result = new DeferredResult<>();
		promise.then(new ResultSetter<T>(result)).fail(new ThrowableSetter(result));
		return result;
	}

	/**
	 * Wraps a {@link Promise} into Spring's {@link DeferredResult} and resolve it with the given {@link ResponseEntity response}.
	 *
	 * @param promise
	 *            - the promise to wait for
	 * @param response
	 *            - the response to send back when the promise has been resolved
	 * @return
	 */
	public static <T extends ResponseEntity<B>, B, C> DeferredResult<T> wrap(Promise<C> promise, final T response) {
		final DeferredResult<T> result = new DeferredResult<>();
		promise.then(new PredefinedValueSetter<C, T>(result, response)).fail(new ThrowableSetter(result));
		return result;
	}

}


text:
package org.efaps.db;

import java.util.List;

import org.efaps.admin.event.EventDefinition;
import org.efaps.admin.event.EventType;
import org.efaps.admin.event.Parameter;
import org.efaps.admin.event.Parameter.ParameterValues;
import org.efaps.util.EFapsException;

/**
 * Abstract class where all eFaps database actions are derived.
 *
 * @author The eFaps Team
 * @version $Id$
 */
public abstract class AbstractAction
{
    /**
     * Instance holding the oid of the object which is checked in/out.
     *
     * @see #getInstance()
     * @see #setInstance(Instance)
     */
    private Instance instance;

    /**
     * The method gets all events for the given EventType and executes them in
     * the given order. If no events are defined, nothing is done. The method
     * return true if a event was found, otherwise false.
     *
     * @param _eventtype  trigger events to execute
     * @return true if a trigger was found and executed, otherwise
     *         false
     * @throws EFapsException on error
     */
    protected boolean executeEvents(final EventType _eventtype)
        throws EFapsException
    {
        final boolean ret;
        final List<EventDefinition> triggers = this.instance.getType().getEvents(_eventtype);
        if (triggers != null) {
            final Parameter parameter = new Parameter();
            parameter.put(ParameterValues.INSTANCE, getInstance());
            for (final EventDefinition evenDef : triggers) {
                evenDef.execute(parameter);
            }
            ret = true;
        } else  {
            ret = false;
        }
        return ret;
    }

    /**
     * This is the getter method for instance variable {@link #instance}.
     *
     * @return the Instance of the check in / check out
     * @see #setInstance(Instance)
     */
    protected Instance getInstance()
    {
        return this.instance;
    }

    /**
     * This is the setter method for instance variable {@link #instance}.
     *
     * @param _instance     tnstance to set
     * @see #getInstance()
     */
    protected void setInstance(final Instance _instance)
    {
        this.instance = _instance;
    }
}