text:
package com.intellij.remoteServer.util;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.remoteServer.configuration.RemoteServer;
import com.intellij.remoteServer.impl.runtime.ui.ServersToolWindowContent;
import com.intellij.remoteServer.impl.runtime.ui.tree.DeploymentNode;
import com.intellij.remoteServer.impl.runtime.ui.tree.actions.ServersTreeAction;
import com.intellij.remoteServer.runtime.Deployment;
import com.intellij.remoteServer.runtime.ServerConnection;
import com.intellij.remoteServer.runtime.ServerConnectionManager;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.Optional;

public abstract class ApplicationActionBase<T extends CloudApplicationRuntime> extends ServersTreeAction<DeploymentNode> {

  protected ApplicationActionBase(String text, String description, Icon icon) {
    super(text, description, icon);
  }

  @Override
  protected Class<DeploymentNode> getTargetNodeClass() {
    return DeploymentNode.class;
  }

  protected Deployment getDeployment(@Nullable DeploymentNode node) {
    return node == null ? null : ObjectUtils.tryCast(node.getValue(), Deployment.class);
  }

  protected T getApplicationRuntime(@Nullable DeploymentNode node) {
    return Optional.ofNullable(getDeployment(node))
                   .map(Deployment::getRuntime)
                   .map(rt -> ObjectUtils.tryCast(rt, getApplicationRuntimeClass()))
                   .orElse(null);
  }

  protected static ServerConnection<?> getConnection(DeploymentNode node) {
    RemoteServer<?> server = (RemoteServer<?>)node.getServerNode().getValue();
    return ServerConnectionManager.getInstance().getConnection(server);
  }

  @Override
  protected boolean isVisible4(DeploymentNode node) {
    return getApplicationRuntime(node) != null;
  }

  protected abstract Class<T> getApplicationRuntimeClass();

  protected class SelectLogRunnable implements Runnable {

    private final ServersToolWindowContent myContent;
    private final DeploymentNode myNode;
    private final String myLogName;

    public SelectLogRunnable(ServersToolWindowContent content, DeploymentNode node, String logName) {
      myContent = content;
      myNode = node;
      myLogName = logName;
    }

    @Override
    public void run() {
      final ServerConnection<?> connection = getConnection(myNode);
      if (connection == null) {
        return;
      }

      final Deployment deployment = findDeployment(connection);
      if (deployment == null) {
        return;
      }

      ApplicationManager.getApplication().invokeLater(() -> myContent.select(connection, deployment.getName(), myLogName));
    }

    private Deployment findDeployment(ServerConnection<?> connection) {
      T applicationRuntime = getApplicationRuntime(myNode);
      for (Deployment deployment : connection.getDeployments()) {
        if (applicationRuntime == deployment.getRuntime()) {
          return deployment;
        }
      }
      return null;
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
module MiniTest
  module Capistrano
    VERSION = "0.2.1.dev" # :nodoc:
  end
end


text:
Bullet, variable, amortizing, accreting & rollercoaster notionals.
============================================================================

Both bullet (i.e. constant) notional and variable notional are supported, e.g. as seen in amortizing, accreting & rollercoaster.

Constant notional.
----------------------------------------------------------------------------

This is the most common type. Specified by providing a currency \& notional amount to com.opengamma.financial.security.irs.InterestRateSwapNotional. e.g:

.. code:: Java

  com.opengamma.financial.security.irs.InterestRateSwapNotional.of(Currency.USD, 1000000)

Variable, custom or free notional.
----------------------------------------------------------------------------

A fully customizable notional schedule may be provided. Each step in the schedule may give the absolute notional to use or reference an adjustment to the previous notional in the schedule.
Each step value is accompanied by a field describing how to modify the notional on that date, supported adjustments are:

  * OUTRIGHT - this provided value will take effect on the given date. This is the default if the type is omitted.
  * DELTA - the previous notional will be multiplied by this amount to obtain the current notional amount (step should be less than 1 for an amortizing swap).
  * ADDITIVE - the shift amount will be added to the previous notional to obtain the current notional amount (step should be negative for an amortizing swap).

Not all periods during the lifetime of the instrument need be provided. For omitted periods the notional will remain unchanged from the last specified period.

For example an example amortising schedule would look like:

.. code:: Java

  com.opengamma.financial.security.irs.InterestRateSwapNotional.of(Currency.USD, Lists.asList(date1, date2), Lists.asList(1e6, 0))

Notional schedule derived from an algorithm or expression.
----------------------------------------------------------------------------

It is not possible to provide an expression to determine the notional. Instead the full schedule must be pre-computed and entered when the trade is loaded.


text:
import * as React from 'react';
import classNames from 'classnames';
import { styled } from '../style';
import { darken } from 'polished';
import { ButtonVariant } from 'skyhook-ui';

export interface LinkButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
  small?: boolean;
  variant?: ButtonVariant;
  disabled?: boolean;
}

function LinkButtonImpl({ children, className, variant, small, ...attrs }: LinkButtonProps) {
  return (
    <a className={classNames(className, variant, { small })} {...attrs}>
      {children}
    </a>
  );
}

/** Looks like a button, but is actually an anchor tag. */
export const LinkButton = styled(LinkButtonImpl)`
  align-items: center;
  border: ${props => props.theme.button[props.variant].borderColor
      ? `1px solid ${props.theme.button[props.variant].borderColor}` : 'none'};
  border-radius: 4px;
  background-color: ${props => props.theme.button[props.variant].bgColor};
  color: ${props => props.theme.button[props.variant].textColor};
  display: inline-flex;
  padding: 0 12px;
  height: 32px;
  outline: none;
  text-decoration: none;

  &[disabled] {
    opacity: 0.7;
    pointer-events: none;
  }

  &:focus {
    box-shadow: 0 0 0 3px ${props => props.theme.focusColor};
    z-index: 1;
  }

  &:hover:not([disabled]) {
    background-color: ${props => darken(0.05, props.theme.button[props.variant].bgColor)};
  }

  &:active:not([disabled]) {
    background-color: ${props => darken(0.15, props.theme.button[props.variant].bgColor)};
  }

  &.small {
    height: 24px;
    font-size: 90%;
  }

  > svg {
    margin-right: 4px;
    margin-left: -5px;
    fill: ${props => props.theme.button[props.variant].textColor};
  }
`;

LinkButton.defaultProps = { variant: 'default' };


text:
package com.facebook.react.views.textinput;

import androidx.annotation.Nullable;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.Event;

/** Event emitted by EditText native view when it loses focus. */
/* package */ class ReactTextInputBlurEvent extends Event<ReactTextInputBlurEvent> {

  private static final String EVENT_NAME = "topBlur";

  @Deprecated
  public ReactTextInputBlurEvent(int viewId) {
    this(-1, viewId);
  }

  public ReactTextInputBlurEvent(int surfaceId, int viewId) {
    super(surfaceId, viewId);
  }

  @Override
  public String getEventName() {
    return EVENT_NAME;
  }

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

  @Nullable
  @Override
  protected WritableMap getEventData() {
    WritableMap eventData = Arguments.createMap();
    eventData.putInt("target", getViewTag());
    return eventData;
  }
}


text:
Popups::Popups(QWidget *parent)
    : QWidget(parent)
{
    resize(200, 200);
    setWindowIcon(QIcon::fromTheme("info"));

    auto layout = new QVBoxLayout(this);
    auto btnInfo = new QPushButton("Info");
    auto btnCrit = new QPushButton("Critical");
    auto btnWarn = new QPushButton("Warning");
    auto btnQuestion = new QPushButton("Question");
    auto btnPrompt = new QPushButton("What to do");

    layout->addWidget(btnInfo);
    layout->addWidget(btnCrit);
    layout->addWidget(btnWarn);
    layout->addWidget(btnQuestion);
    layout->addWidget(btnPrompt);

    connect(btnInfo, &QPushButton::clicked, this, &Popups::onInfoClicked);
    connect(btnCrit, &QPushButton::clicked, this, &Popups::onCritClicked);
    connect(btnWarn, &QPushButton::clicked, this, &Popups::onWarnClicked);
    connect(btnQuestion, &QPushButton::clicked, this, &Popups::onQuestionClicked);
    connect(btnPrompt, &QPushButton::clicked, this, &Popups::onPromptClicked);

}

Popups::~Popups()
{

}

void Popups::onInfoClicked()
{
    QMessageBox::information(this, "Info", "Displaying some info");
}

void Popups::onCritClicked()
{
    QMessageBox::critical(this, "Critical", "This is critical!");
}

void Popups::onWarnClicked()
{
    QMessageBox::warning(this, "Warning", "This is a warning...");
}

void Popups::onQuestionClicked()
{
    auto answer = QMessageBox::question(this, "Question", "Are you sure about this?");
    if (answer == QMessageBox::Yes) {
        QMessageBox::information(this, "Message", "You asked for it!");
    }
}

void Popups::onPromptClicked()
{
    auto answer = QMessageBox::critical(this, "prompt", "We are heading for a wall what should we do?", QMessageBox::Abort|QMessageBox::Ignore|QMessageBox::Help, QMessageBox::Abort);

    switch (answer) {
    case QMessageBox::Abort:
        break;
    case QMessageBox::Help:
        break;
    default:
        break;
    }
}


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Vertx::SSLSupport

    — Ruby API Doc

</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

    Index (S) »
    Vertx
     »
    SSLSupport

(no frames)

      Class List

      Method List

      File List

Module: Vertx::SSLSupport

Included in:

HttpClient, HttpServer, NetClient, NetServer

Defined in:

src/main/api_shim/core/ssl_support.rb

Overview

    A mixin module allowing SSL attributes to be set on classes

Author:

Tim Fox

      Instance Method Summary
      (collapse)

      - (Object) key_store_password(password = nil)

Set or get key store password for fluent API.

      - (Object) key_store_password=(val)

Set the password for the SSL key store.

      - (Object) key_store_path(path = nil)

Set or get key store path for fluent API.

      - (Object) key_store_path=(val)

Set the path to the SSL key store.

      - (Object) ssl(ssl = nil)

Set or get ssl for fluent API.

      - (Object) ssl=(val)

Set whether the server or client will use SSL.

      - (Object) trust_store_password(password = nil)

Set or get trust store password for fluent API.

      - (Object) trust_store_password=(val)

Set the password for the SSL trust store.

      - (Object) trust_store_path(path = nil)

Set or get trust store path for fluent API.

      - (Object) trust_store_path=(val)

Set the path to the SSL trust store.

Instance Method Details

    - (<tt>Object</tt>) key_store_password(password = nil)

    Set or get key store password for fluent API

72
73
74
75
76
77
78
79

# File 'src/main/api_shim/core/ssl_support.rb', line 72

def key_store_password(password = nil)
  if password
    @j_del.setKeyStorePassword(password)
    self
  else
    @j_del.getKeyStorePassword
  end
end

    - (<tt>Object</tt>) key_store_password=(val)

    Set the password for the SSL key store. This method should only be used with the client in SSL mode, i.e. after #ssl=
has been set to true.

Parameters:

        val.

        (<tt>String</tt>)

        —

The password.

Returns:

[] self. So multiple invocations can be chained.

66
67
68
69

# File 'src/main/api_shim/core/ssl_support.rb', line 66

def key_store_password=(val)
  @j_del.setKeyStorePassword(val)
  self
end

    - (<tt>Object</tt>) key_store_path(path = nil)

    Set or get key store path for fluent API

53
54
55
56
57
58
59
60

# File 'src/main/api_shim/core/ssl_support.rb', line 53

def key_store_path(path = nil)
  if path
    @j_del.setKeyStorePath(path)
    self
  else
    @j_del.getKeyStorePath
  end
end

    - (<tt>Object</tt>) key_store_path=(val)

    Set the path to the SSL key store. This method should only be used with the client/server in SSL mode, i.e. after #ssl=
has been set to true.
The SSL key store is a standard Java Key Store, and should contain the client/server certificate. For a client, it's only necessary to supply
a client key store if the server requires client authentication via client certificates.

Parameters:

        val.

        (<tt>String</tt>)

        —

The path to the key store

Returns:

[] self. So multiple invocations can be chained.

47
48
49
50

# File 'src/main/api_shim/core/ssl_support.rb', line 47

def key_store_path=(val)
  @j_del.setKeyStorePath(val)
  self
end

    - (<tt>Object</tt>) ssl(ssl = nil)

    Set or get ssl for fluent API

32
33
34
35
36
37
38
39

# File 'src/main/api_shim/core/ssl_support.rb', line 32

def ssl(ssl = nil)
  if ssl
    @j_del.setSSL(ssl)
    self
  else
    @j_del.isSSL
  end
end

    - (<tt>Object</tt>) ssl=(val)

    Set whether the server or client will use SSL.

Parameters:

        val.

        (<tt>Boolean</tt>)

        —

If true then ssl will be used.

Returns:

[] self. So multiple invocations can be chained.

26
27
28
29

# File 'src/main/api_shim/core/ssl_support.rb', line 26

def ssl=(val)
  @j_del.setSSL(val)
  self
end

    - (<tt>Object</tt>) trust_store_password(password = nil)

    Set or get trust store password for fluent API

113
114
115
116
117
118
119
120

# File 'src/main/api_shim/core/ssl_support.rb', line 113

def trust_store_password(password = nil)
  if password
    @j_del.setTrustStorePassword(password)
    self
  else
    @j_del.getTrustStorePassword
  end
end

    - (<tt>Object</tt>) trust_store_password=(val)

    Set the password for the SSL trust store. This method should only be used with the client in SSL mode, i.e. after #ssl=
has been set to true.

Parameters:

        val.

        (<tt>String</tt>)

        —

The password.

Returns:

[] self. So multiple invocations can be chained.

107
108
109
110

# File 'src/main/api_shim/core/ssl_support.rb', line 107

def trust_store_password=(val)
  @j_del.setTrustStorePassword(val)
  self
end

    - (<tt>Object</tt>) trust_store_path(path = nil)

    Set or get trust store path for fluent API

94
95
96
97
98
99
100
101

# File 'src/main/api_shim/core/ssl_support.rb', line 94

def trust_store_path(path = nil)
  if path
    @j_del.setTrustStorePath(path)
    self
  else
    @j_del.getTrustStorePath
  end
end

    - (<tt>Object</tt>) trust_store_path=(val)

    Set the path to the SSL trust store. This method should only be used with the client/server in SSL mode, i.e. after #ssl=
has been set to true.
The SSL trust store is a standard Java Key Store, and should contain the certificate(s) of the clients/servers that the server/client trusts. The SSL
handshake will fail if the server provides a certificate that the client does not trust, or if client authentication is used,
if the client provides a certificate the server does not trust.<p>

Parameters:

        val.

        (<tt>String</tt>)

        —

The path to the trust store

Returns:

[] self. So multiple invocations can be chained.

88
89
90
91

# File 'src/main/api_shim/core/ssl_support.rb', line 88

def trust_store_path=(val)
  @j_del.setTrustStorePath(val)
  self
end

  Generated on Wed Jul 17 20:30:34 2013 by
  yard
  0.8.6.1 (ruby-1.9.3).


text:
using System;
using System.Runtime.Serialization;

namespace Simple.Data.Ado.Schema
{
    using System.Security;

    [Serializable]
    [SecurityCritical]
    public class AmbiguousObjectNameException : Exception
    {
        public AmbiguousObjectNameException()
        {
        }

        public AmbiguousObjectNameException(string name)
        {
            Name = name;
        }

        public AmbiguousObjectNameException(string name, string message) : base(message)
        {
            Name = name;
        }

        public AmbiguousObjectNameException(string name, string message, Exception inner) : base(message, inner)
        {
            Name = name;
        }

        protected AmbiguousObjectNameException(
            SerializationInfo info,
            StreamingContext context) : base(info, context)
        {
        }

        public string Name
        {
            get { return Data.Contains("Name") ?  Data["Name"].ToString() : null; }
            private set { Data["Name"] = value; }
        }

        //[SecurityCritical]
        //public override void GetObjectData(SerializationInfo info, StreamingContext context)
        //{
        //    base.GetObjectData(info, context);
        //    info.AddValue("Name", Name);
        //}
    }
}


text:
<?php
// Inserts the site logo into the header navigation menu for MOBILE
// Remember to optimize this image for mobile viewing
?>

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
        <img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/virginian/fpo-logo.png" alt="The Virginian logo" title="The Virginian logo" />


text:
This is a very basic Physics demo using the [Game Closure](http://www.gameclosure.com) engine and the Box2dWeb library.

The liquid particles only are rendered in a browser. There is not support for getImageData() method in mobile devices.

The metaball script is an adaptation of [this fiddle](http://jsfiddle.net/julien/eCmpY/)

## Live Demo

You can see a working demo of this app right here at
[http://labs.plexxoo.com](http://labs.plexxoo.com/wp/?p=16) or download the apk file
[here](http://labs.plexxoo.com/html/PhysicsDemo/PhysicsDemo.apk) for your android device.


text:
layout: default
title: Photo Gallery
gallery:
  - img-title: Image Title
    img_path: /img/gallery/1.jpg
    category: category-1
    caption: ""
  - img-title: Image Title
    img_path: /img/gallery/2.jpg
    category: category-1
    caption: ""
  - img-title: Image Title
    img_path: /img/gallery/3.jpg
    category: category-1
    caption: ""
  - img-title: Image Title
    img_path: /img/gallery/4.jpg
    category: category-1
    caption: ""
  - img-title: Image Title
    img_path: /img/gallery/5.jpg
    category: category-1
    caption: ""
  - img-title: Image Title
    img_path: /img/gallery/6.jpg
    category: category-1
    caption: ""

---

Photo Gallery

Categories

All

Events

2013

2014

2015

2016

Awards

              {% for item in page.gallery %}

{{ item.img-title }}

{{ item.caption }}

              {% endfor %}


text:
#import <Foundation/Foundation.h>
#import "MMHTTPUtilities.h"
#import "MMServiceIOType.h"

@interface MMServiceMethod : NSObject

@property(nonatomic, strong) Class clazz;

@property(nonatomic, assign) SEL selector;

@property(nonatomic, copy) NSString *path;

@property(nonatomic, assign) MMRequestMethod requestMethod;

@property(nonatomic, assign) MMServiceIOType returnType;

@property(nonatomic, assign) MMServiceIOType returnComponentType;

// This is only available if the returnType is a Model or a collection of Model objects
@property(nonatomic, strong) Class returnTypeClass;

@property(nonatomic, copy) NSArray *parameters;

@property(nonatomic, readonly) BOOL doesReturnString;

@property(nonatomic, copy) NSSet *produces;

@property(nonatomic, copy) NSSet *consumes;

@end


text:
define(["require", "exports", "./components/Tooltip/index"], function (require, exports, index_1) {
    "use strict";
    function __export(m) {
        for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
    }
    Object.defineProperty(exports, "__esModule", { value: true });
    __export(index_1);
});

//# sourceMappingURL=Tooltip.js.map


text:
"""Bio.SearchIO support for BLAST+ output formats.

This module adds support for parsing BLAST+ outputs. BLAST+ is a rewrite of
NCBI's legacy BLAST (Basic Local Alignment Search Tool), based on the NCBI
C++ toolkit. The BLAST+ suite is available as command line programs or on
NCBI's web page.

Bio.SearchIO.BlastIO was tested on the following BLAST+ flavors and versions:

    - flavors: blastn, blastp, blastx, tblastn, tblastx
    - versions: 2.2.22+, 2.2.26+

You should also be able to parse outputs from a local BLAST+ search or from
NCBI's web interface. Although the module was not tested against all BLAST+,
it should still be able to parse these other versions' outputs. Please submit
a bug report if you stumble upon an unparseable file.

Some output formats from the BLAST legacy suite (BLAST+'s predecessor) may
still be parsed by this module. However, results are not guaranteed. You may
try to use the Bio.Blast module to parse them instead.

More information about BLAST are available through these links:
  - Publication: http://www.biomedcentral.com/1471-2105/10/421
  - Web interface: http://blast.ncbi.nlm.nih.gov/
  - User guide: http://www.ncbi.nlm.nih.gov/books/NBK1762/

Supported Formats
=================

Bio.SearchIO.BlastIO supports the following BLAST+ output formats:

  - XML        - 'blast-xml'  - parsing, indexing, writing
  - Tabular    - 'blast-tab'  - parsing, indexing, writing
  - Plain text - 'blast-text' - parsing

blast-xml
=========

The blast-xml parser follows the BLAST XML DTD written here:
http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.mod.dtd

It provides the following attributes for each SearchIO object:

+----------------+-------------------------+-----------------------------+
| Object         | Attribute               | XML Element                 |
+================+=========================+=============================+
| QueryResult    | target                  | BlastOutput_db              |
|                +-------------------------+-----------------------------+
|                | program                 | BlastOutput_program         |
|                +-------------------------+-----------------------------+
|                | reference               | BlastOutput_reference       |
|                +-------------------------+-----------------------------+
|                | version                 | BlastOutput_version[1]      |
|                +-------------------------+-----------------------------+
|                | description             | Iteration_query-def         |
|                +-------------------------+-----------------------------+
|                | id                      | Iteration_query-ID          |
|                +-------------------------+-----------------------------+
|                | seq_len                 | Iteration_query-len         |
|                +-------------------------+-----------------------------+
|                | param_evalue_threshold  | Parameters_expect           |
|                +-------------------------+-----------------------------+
|                | param_entrez_query      | Parameters_entrez-query     |
|                +-------------------------+-----------------------------+
|                | param_filter            | Parameters_filter           |
|                +-------------------------+-----------------------------+
|                | param_gap_extend        | Parameters_gap-extend       |
|                +-------------------------+-----------------------------+
|                | param_gap_open          | Parameters_gap-open         |
|                +-------------------------+-----------------------------+
|                | param_include           | Parameters_include          |
|                +-------------------------+-----------------------------+
|                | param_matrix            | Parameters_matrix           |
|                +-------------------------+-----------------------------+
|                | param_pattern           | Parameters_pattern          |
|                +-------------------------+-----------------------------+
|                | param_score_match       | Parameters_sc-match         |
|                +-------------------------+-----------------------------+
|                | param_score_mismatch    | Parameters_sc-mismatch      |
|                +-------------------------+-----------------------------+
|                | stat_db_num             | Statistics_db-num           |
|                +-------------------------+-----------------------------+
|                | stat_db_len             | Statistics_db-len           |
|                +-------------------------+-----------------------------+
|                | stat_eff_space          | Statistics_eff-space        |
|                +-------------------------+-----------------------------+
|                | stat_entropy            | Statistics_entropy          |
|                +-------------------------+-----------------------------+
|                | stat_hsp_len            | Statistics_hsp-len          |
|                +-------------------------+-----------------------------+
|                | stat_kappa              | Statistics_kappa            |
|                +-------------------------+-----------------------------+
|                | stat_lambda             | Statistics_lambda           |
+----------------+-------------------------+-----------------------------+
| Hit            | accession               | Hit_accession               |
|                +-------------------------+-----------------------------+
|                | description             | Hit_def                     |
|                +-------------------------+-----------------------------+
|                | id                      | Hit_id                      |
|                +-------------------------+-----------------------------+
|                | seq_len                 | Hit_len                     |
+----------------+-------------------------+-----------------------------+
| HSP            | bitscore                | Hsp_bit-score               |
|                +-------------------------+-----------------------------+
|                | density                 | Hsp_density                 |
|                +-------------------------+-----------------------------+
|                | evalue                  | Hsp_evalue                  |
|                +-------------------------+-----------------------------+
|                | gap_num                 | Hsp_gaps                    |
|                +-------------------------+-----------------------------+
|                | ident_num               | Hsp_identity                |
|                +-------------------------+-----------------------------+
|                | pos_num                 | Hsp_positive                |
|                +-------------------------+-----------------------------+
|                | bitscore_raw            | Hsp_score                   |
+----------------+-------------------------+-----------------------------+
| HSPFragment    | aln_span                | Hsp_align-len               |
| (also via      +-------------------------+-----------------------------+
| HSP)           | hit_frame               | Hsp_hit-frame               |
|                +-------------------------+-----------------------------+
|                | hit_start               | Hsp_hit-from                |
|                +-------------------------+-----------------------------+
|                | hit_end                 | Hsp_hit-to                  |
|                +-------------------------+-----------------------------+
|                | hit                     | Hsp_hseq                    |
|                +-------------------------+-----------------------------+
|                | aln_annotation          | Hsp_midline                 |
|                +-------------------------+-----------------------------+
|                | pattern_start           | Hsp_pattern-from            |
|                +-------------------------+-----------------------------+
|                | pattern_end             | Hsp_pattern-to              |
|                +-------------------------+-----------------------------+
|                | query_frame             | Hsp_query-frame             |
|                +-------------------------+-----------------------------+
|                | query_start             | Hsp_query-from              |
|                +-------------------------+-----------------------------+
|                | query_end               | Hsp_query-to                |
|                +-------------------------+-----------------------------+
|                | query                   | Hsp_qseq                    |
+----------------+-------------------------+-----------------------------+

You may notice that in BLAST XML files, sometimes BLAST replaces your true
sequence ID with its own generated ID. For example, the query IDs become
'Query_1', 'Query_2', and so on. While the hit IDs sometimes become
'gnl|BL_ORD_ID|1', 'gnl|BL_ORD_ID|2', and so on. In these cases, BLAST lumps the
true sequence IDs together with their descriptions.

The blast-xml parser is aware of these modifications and will attempt to extract
the true sequence IDs out of the descriptions. So when accessing QueryResult or
Hit objects, you will use the non-BLAST-generated IDs.

Conversely, the blast-xml writer will try to concatenate the true sequence IDs
with their descriptions and use the BLAST-generated IDs. This enables you to
write BLAST XML files using SearchIO as if they were written by a real BLAST
program.

blast-tab
=========

The default format for blast-tab support is the variant without comments (-m 6
flag). Commented BLAST tabular files may be parsed, indexed, or written using
the keyword argument 'comments' set to True:

    # blast-tab defaults to parsing uncommented files
    >>> from Bio import SearchIO
    >>> uncommented = 'Blast/tab_2226_tblastn_004.txt'
    >>> qresult = SearchIO.read(uncommented, 'blast-tab')
    >>> qresult
    QueryResult(id='gi|11464971:4-101', 5 hits)

    # set the keyword argument to parse commented files
    >>> commented = 'Blast/tab_2226_tblastn_008.txt'
    >>> qresult = SearchIO.read(commented, 'blast-tab', comments=True)
    >>> qresult
    QueryResult(id='gi|11464971:4-101', 5 hits)

For uncommented files, the parser defaults to using BLAST's default column
ordering: 'qseqid sseqid pident length mismatch gapopen qstart qend sstart send
evalue bitscore'.

If you want to parse an uncommented file with a customized column order, you can
use the 'fields' keyword argument to pass the custom column order. The names of
the column follow BLAST's naming. For example, 'qseqid' is the column for the
query sequence ID. These names may be passed either as a Python list or as a
space-separated strings.

    # pass the custom column names as a Python list
    >>> fname = 'Blast/tab_2226_tblastn_009.txt'
    >>> custom_fields = ['qseqid', 'sseqid']
    >>> qresult = next(SearchIO.parse(fname, 'blast-tab', fields=custom_fields))
    >>> qresult
    QueryResult(id='gi|16080617|ref|NP_391444.1|', 3 hits)

    # pass the custom column names as a space-separated string
    >>> fname = 'Blast/tab_2226_tblastn_009.txt'
    >>> custom_fields = 'qseqid sseqid'
    >>> qresult = next(SearchIO.parse(fname, 'blast-tab', fields=custom_fields))
    >>> qresult
    QueryResult(id='gi|16080617|ref|NP_391444.1|', 3 hits)

You may also use the 'std' field name as an alias to BLAST's default 12 columns,
just like when you run a command line BLAST search.

Note that the 'fields' keyword argument will be ignored if the parsed file is
commented. Commented files have their column ordering stated explicitly in the
file, so there is no need to specify it again in SearchIO.

'comments' and 'fields' keyword arguments are both applicable for parsing,
indexing, and writing.

blast-tab provides the following attributes for each SearchIO objects:

+-------------+-------------------+--------------+
| Object      | Attribute         | Column name  |
+=============+===================+==============+
| QueryResult | accession         | qacc         |
|             +-------------------+--------------+
|             | accession_version | qaccver      |
|             +-------------------+--------------+
|             | gi                | qgi          |
|             +-------------------+--------------+
|             | seq_len           | qlen         |
|             +-------------------+--------------+
|             | id                | qseqid       |
+-------------+-------------------+--------------+
| Hit         | accession         | sacc         |
|             +-------------------+--------------+
|             | accession_version | sacc_ver     |
|             +-------------------+--------------+
|             | gi                | sgi          |
|             +-------------------+--------------+
|             | gi_all            | sallgi       |
|             +-------------------+--------------+
|             | id_all            | sallseqid    |
|             +-------------------+--------------+
|             | seq_len           | slen         |
|             +-------------------+--------------+
|             | id                | sseqid       |
+-------------+-------------------+--------------+
| HSP         | bitscore          | bitscore     |
|             +-------------------+--------------+
|             | btop              | btop         |
|             +-------------------+--------------+
|             | evalue            | evalue       |
|             +-------------------+--------------+
|             | gapopen_num       | gapopen      |
|             +-------------------+--------------+
|             | gap_num           | gaps         |
|             +-------------------+--------------+
|             | ident_pct         | nident       |
|             +-------------------+--------------+
|             | ident_num         | pident       |
|             +-------------------+--------------+
|             | mismatch_num      | mismatch     |
|             +-------------------+--------------+
|             | pos_pct           | ppos         |
|             +-------------------+--------------+
|             | pos_num           | positive     |
|             +-------------------+--------------+
|             | bitscore_raw      | score        |
+-------------+-------------------+--------------+
| HSPFragment | frames            | frames[2]    |
| (also via   +-------------------+--------------+
| HSP)        | aln_span          | length       |
|             +-------------------+--------------+
|             | query_end         | qend         |
|             +-------------------+--------------+
|             | query_frame       | qframe       |
|             +-------------------+--------------+
|             | query             | qseq         |
|             +-------------------+--------------+
|             | query_start       | qstart       |
|             +-------------------+--------------+
|             | hit_end           | send         |
|             +-------------------+--------------+
|             | hit_frame         | sframe       |
|             +-------------------+--------------+
|             | hit               | sseq         |
|             +-------------------+--------------+
|             | hit_start         | sstart       |
+-------------+-------------------+--------------+

If the parsed file is commented, the following attributes may be available as
well:

+--------------+---------------+----------------------------+
| Object       | Attribute     | Value                      |
+==============+===============+============================+
| QueryResult  | description   | query description          |
|              +---------------+----------------------------+
|              | fields        | columns in the output file |
|              +---------------+----------------------------+
|              | program       | BLAST flavor               |
|              +---------------+----------------------------+
|              | rid           | remote search ID           |
|              +---------------+----------------------------+
|              | target        | target database            |
|              +---------------+----------------------------+
|              | version       | BLAST version              |
+--------------+---------------+----------------------------+

blast-text
==========
The BLAST plain text output format has been known to change considerably between
BLAST versions. NCBI itself has recommended that users not rely on the plain
text output for parsing-related work.

However, in some cases parsing the plain text output may still be useful.
SearchIO provides parsing support for the plain text output, but guarantees only
a minimum level of support. Writing a parser that fully supports plain text
output for all BLAST versions is not a priority at the moment.

If you do have a BLAST plain text file that can not be parsed and would like to
submit a patch, we are more than happy to accept it.

The blast-text parser provides the following object attributes:

+-----------------+-------------------------+----------------------------------+
| Object          | Attribute               | Value                            |
+=================+=========================+==================================+
| QueryResult     | description             | query sequence description       |
|                 +-------------------------+----------------------------------+
|                 | id                      | query sequence ID                |
|                 +-------------------------+----------------------------------+
|                 | program                 | BLAST flavor                     |
|                 +-------------------------+----------------------------------+
|                 | seq_len                 | full length of query sequence    |
|                 +-------------------------+----------------------------------+
|                 | target                  | target database of the search    |
|                 +-------------------------+----------------------------------+
|                 | version                 | BLAST version                    |
+-----------------+-------------------------+----------------------------------+
| Hit             | evalue                  | hit-level evalue, from the hit   |
|                 |                         | table                            |
|                 +-------------------------+----------------------------------+
|                 | id                      | hit sequence ID                  |
|                 +-------------------------+----------------------------------+
|                 | description             | hit sequence description         |
|                 +-------------------------+----------------------------------+
|                 | score                   | hit-level score, from the hit    |
|                 |                         | table                            |
|                 +-------------------------+----------------------------------+
|                 | seq_len                 | full length of hit sequence      |
+-----------------+-------------------------+----------------------------------+
| HSP             | evalue                  | hsp-level evalue                 |
|                 +-------------------------+----------------------------------+
|                 | bitscore                | hsp-level bit score              |
|                 +-------------------------+----------------------------------+
|                 | bitscore_raw            | hsp-level score                  |
|                 +-------------------------+----------------------------------+
|                 | gap_num                 | number of gaps in alignment      |
|                 +-------------------------+----------------------------------+
|                 | ident_num               | number of identical residues     |
|                 |                         | in alignment                     |
|                 +-------------------------+----------------------------------+
|                 | pos_num                 | number of positive matches in    |
|                 |                         | alignment                        |
+-----------------+-------------------------+----------------------------------+
| HSPFragment     | aln_annotation          | alignment similarity string      |
| (also via       +-------------------------+----------------------------------+
| HSP)            | aln_span                | length of alignment fragment     |
|                 +-------------------------+----------------------------------+
|                 | hit                     | hit sequence                     |
|                 +-------------------------+----------------------------------+
|                 | hit_end                 | hit sequence end coordinate      |
|                 +-------------------------+----------------------------------+
|                 | hit_frame               | hit sequence reading frame       |
|                 +-------------------------+----------------------------------+
|                 | hit_start               | hit sequence start coordinate    |
|                 +-------------------------+----------------------------------+
|                 | hit_strand              | hit sequence strand              |
|                 +-------------------------+----------------------------------+
|                 | query                   | query sequence                   |
|                 +-------------------------+----------------------------------+
|                 | query_end               | query sequence end coordinate    |
|                 +-------------------------+----------------------------------+
|                 | query_frame             | query sequence reading frame     |
|                 +-------------------------+----------------------------------+
|                 | query_start             | query sequence start coordinate  |
|                 +-------------------------+----------------------------------+
|                 | query_strand            | query sequence strand            |
+-----------------+-------------------------+----------------------------------+

.. [1] may be modified

.. [2] When 'frames' is present, both ``query_frame`` and ``hit_frame`` will be
   present as well. It is recommended that you use these instead of 'frames' directly.

"""

from .blast_tab import BlastTabParser, BlastTabIndexer, BlastTabWriter
from .blast_xml import BlastXmlParser, BlastXmlIndexer, BlastXmlWriter
from .blast_text import BlastTextParser

__docformat__ = "restructuredtext en"

# if not used as a module, run the doctest
if __name__ == "__main__":
    from Bio._utils import run_doctest
    run_doctest()


text:
package org.pac4j.core.authorization.authorizer;

import org.pac4j.core.context.WebContext;
import org.pac4j.core.exception.HttpAction;
import org.pac4j.core.profile.CommonProfile;

import java.util.List;
import java.util.Set;

/**
 * Checks an access if the user profile has any of the permissions.
 *
 * @param <U> the user profile
 * @author Jerome Leleu
 * @since 1.8.0
 */
public class RequireAnyPermissionAuthorizer<U extends CommonProfile> extends AbstractRequireAnyAuthorizer<String, U> {

    public RequireAnyPermissionAuthorizer() { }

    public RequireAnyPermissionAuthorizer(final String... permissions) {
        setElements(permissions);
    }

    public RequireAnyPermissionAuthorizer(final List<String> permissions) {
        setElements(permissions);
    }

    public RequireAnyPermissionAuthorizer(final Set<String> permissions) {
        setElements(permissions);
    }

    @Override
    protected boolean check(final WebContext context, final U profile, final String element) throws HttpAction {
        final Set<String> profilePermissions = profile.getPermissions();
        return profilePermissions.contains(element);
    }
}


text:
package com.blackboxgaming.engine.components;

import com.badlogic.gdx.graphics.g3d.utils.AnimationController;

/**
 *
 * @author Adrian
 */
public class Animation implements IComponent {

    public final AnimationController controller;

    public Animation(AnimationController controller) {
        this.controller = controller;
    }

    public void setAnimation(String animationId, int loopCount) {
        controller.setAnimation(animationId, loopCount);
    }

    @Override
    public String toString() {
        return "Animation{" + "controller=" + controller + '}';
    }

}


text:
#if !NETCOREAPP1_1
using System.Diagnostics;
using BenchmarkDotNet.Attributes;

namespace BenchmarkDotNet.Samples.Framework
{
    public class Framework_StackFrameVsStackTrace
    {
        [Benchmark]
        public StackFrame StackFrame()
        {
            return new StackFrame(1, false);
        }

        [Benchmark]
        public StackFrame StackTrace()
        {
            return new StackTrace().GetFrame(1);
        }
    }
}
#endif


text:
from typing import List

class Solution:
    def stringMatching(self, words: List[str]) -> List[str]:
        res = []
        for x in words:
            for y in words:
                if x==y:
                    continue
                if x in y:
                    res.append(x)
                    break
        return res

if __name__ == '__main__':
    s = Solution()
    words = ["mass", "as", "hero", "superhero"]
    print(s.stringMatching(words))
    words = ["leetcode", "et", "code"]
    print(s.stringMatching(words))
    words = ["blue","green","bu"]
    print(s.stringMatching(words))


text:
package aks

import (
	"context"

	"pharmer.dev/pharmer/apis/v1alpha1/azure"

	containersvc "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-06-01/containerservice"
	"github.com/appscode/go/types"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func (cm *ClusterManager) PrepareCloud() error {
	log := cm.Logger
	log.Info("Preparing cloud infra")

	err := cm.SetCloudConnector()
	if err != nil {
		log.Error(err, "failed to set aks cloud connector")
		return err
	}
	found, _ := cm.conn.getResourceGroup()
	if !found {
		if _, err := cm.conn.ensureResourceGroup(); err != nil {
			log.Error(err, "failed to ensure resource group")
			return err
		}
		log.Info("Resource group created", "resourcegroup-name", cm.namer.ResourceGroupName(), "zone", cm.Cluster.Spec.Config.Cloud.Zone)
	}
	nodeGroups, err := cm.StoreProvider.MachineSet(cm.Cluster.Name).List(metav1.ListOptions{})
	if err != nil {
		log.Error(err, "failed to list machineset from store")
		return err
	}
	if len(nodeGroups) > 1 {
		err = errors.Errorf("mutiple agent pool not supported yet")
		return err
	}
	agentPools := make([]containersvc.ManagedClusterAgentPoolProfile, 0)

	for _, ng := range nodeGroups {
		providerspec, err := azure.MachineSpecFromProviderSpec(ng.Spec.Template.Spec.ProviderSpec)
		if err != nil {
			log.Error(err, "failed to get provider spec")
			return err
		}
		name := cm.namer.GetNodeGroupName(ng.Name)
		ap := containersvc.ManagedClusterAgentPoolProfile{
			Name:   types.StringP(name),
			Count:  ng.Spec.Replicas,
			VMSize: containersvc.VMSizeTypes(providerspec.VMSize),
			OsType: containersvc.OSType(providerspec.OSDisk.OSType),
		}
		agentPools = append(agentPools, ap)
	}
	if err = cm.conn.upsertAKS(agentPools); err != nil {
		log.Error(err, "failed to upsert nodepools")
		return err
	}

	return nil
}

func (cm *ClusterManager) ApplyScale() error {
	log := cm.Logger
	nodeGroups, err := cm.StoreProvider.MachineSet(cm.Cluster.Name).List(metav1.ListOptions{})
	if err != nil {
		log.Error(err, "failed to list machineset from store")
		return err
	}

	cluster, err := cm.conn.managedClient.Get(context.Background(), cm.namer.ResourceGroupName(), cm.Cluster.Name)
	if err != nil {
		log.Error(err, "failed to get aks cluster")
		return err
	}

	agentPools := make([]containersvc.ManagedClusterAgentPoolProfile, 0)
	for _, ng := range nodeGroups {
		providerspec, err := azure.MachineSpecFromProviderSpec(ng.Spec.Template.Spec.ProviderSpec)
		if err != nil {
			log.Error(err, "failed to get provider spec")
			return err
		}
		name := cm.namer.GetNodeGroupName(ng.Name)
		found := false
		for _, a := range *cluster.AgentPoolProfiles {
			if *a.Name == name {
				if *a.Count == *ng.Spec.Replicas {
					found = true
					break
				}
			}
		}
		if found {
			continue
		}
		ap := containersvc.ManagedClusterAgentPoolProfile{
			Name:   types.StringP(name),
			Count:  ng.Spec.Replicas,
			VMSize: containersvc.VMSizeTypes(providerspec.VMSize),
			OsType: containersvc.Linux,
		}
		agentPools = append(agentPools, ap)
	}

	if len(agentPools) > 0 {
		if err = cm.conn.upsertAKS(agentPools); err != nil {
			log.Error(err, "failed to upsert nodepools")
			return err
		}
	}
	return nil
}

func (cm *ClusterManager) ApplyDelete() error {
	log := cm.Logger
	if err := cm.conn.deleteAKS(); err != nil {
		log.Error(err, "failed to delete cluster")
		return err
	}

	if err := cm.conn.deleteResourceGroup(); err != nil {
		log.Error(err, "failed to delete resource group")
		return err
	}
	return nil
}


text:
/* exported Person */

var Meeting = require('./Meeting');
var app = require('../main');
var bookshelf = app.get('bookshelf');

var Person = module.exports = bookshelf.Model.extend({
    tableName: 'people',
    meetings: function () {
        return this.belongsToMany(Meeting);
    }
});


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>Git Lesson</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="apple-touch-icon" href="apple-touch-icon.png">

        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" href="css/buttons.css">

Lets get started with GIT

Jim Passios

Tim L Malesky

Jim P

            <button   class="button-styles" type="button" onclick="myFunction()">States Table</button>

            <input  class="button-styles" type="button" value="States Dropdown">


text:
package org.apache.commons.lang3.builder;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.HashMap;

import org.apache.commons.lang3.builder.ToStringStyleTest.Person;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Unit tests {@link org.apache.commons.lang3.builder.ToStringStyle}.
 */
public class StandardToStringStyleTest {

    private final Integer base = Integer.valueOf(5);
    private final String baseStr = "Integer";

    private static final StandardToStringStyle STYLE = new StandardToStringStyle();

    static {
        STYLE.setUseShortClassName(true);
        STYLE.setUseIdentityHashCode(false);
        STYLE.setArrayStart("[");
        STYLE.setArraySeparator(", ");
        STYLE.setArrayEnd("]");
        STYLE.setNullText("%NULL%");
        STYLE.setSizeStartText("%SIZE=");
        STYLE.setSizeEndText("%");
        STYLE.setSummaryObjectStartText("%");
        STYLE.setSummaryObjectEndText("%");
    }

    @Before
    public void setUp() throws Exception {
        ToStringBuilder.setDefaultStyle(STYLE);
    }

    @After
    public void tearDown() throws Exception {
        ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
    }

    //----------------------------------------------------------------

    @Test
    public void testBlank() {
        assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
    }

    @Test
    public void testAppendSuper() {
        assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).appendSuper("Integer@8888[%NULL%]").toString());

        assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
        assertEquals(baseStr + "[%NULL%,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[%NULL%]").append("a", "hello").toString());
        assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
    }

    @Test
    public void testObject() {
        final Integer i3 = Integer.valueOf(3);
        final Integer i4 = Integer.valueOf(4);
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) null).toString());
        assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
        assertEquals(baseStr + "[a=%NULL%]", new ToStringBuilder(base).append("a", (Object) null).toString());
        assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString());
        assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString());
        assertEquals(baseStr + "[a=%Integer%]", new ToStringBuilder(base).append("a", i3, false).toString());
        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString());
        assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString());
        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString());
        assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString());
        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
        assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
    }

    @Test
    public void testPerson() {
        final Person p = new Person();
        p.name = "Suzy Queue";
        p.age = 19;
        p.smoker = false;
        final String pBaseStr = "ToStringStyleTest.Person";
        assertEquals(pBaseStr + "[name=Suzy Queue,age=19,smoker=false]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
    }

    @Test
    public void testLong() {
        assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(3L).toString());
        assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", 3L).toString());
        assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", 3L).append("b", 4L).toString());
    }

    @Test
    public void testObjectArray() {
        Object[] array = new Object[] {null, base, new int[] {3, 6}};
        assertEquals(baseStr + "[[%NULL%, 5, [3, 6]]]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[[%NULL%, 5, [3, 6]]]", new ToStringBuilder(base).append((Object) array).toString());
        array = null;
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
    }

    @Test
    public void testLongArray() {
        long[] array = new long[] {1, 2, -3, 4};
        assertEquals(baseStr + "[[1, 2, -3, 4]]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[[1, 2, -3, 4]]", new ToStringBuilder(base).append((Object) array).toString());
        array = null;
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
    }

    @Test
    public void testLongArrayArray() {
        long[][] array = new long[][] {{1, 2}, null, {5}};
        assertEquals(baseStr + "[[[1, 2], %NULL%, [5]]]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[[[1, 2], %NULL%, [5]]]", new ToStringBuilder(base).append((Object) array).toString());
        array = null;
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
    }

}


text:
package vgrechka.phizdetsidea.phizdets.buildout;

import com.intellij.facet.FacetType;
import com.intellij.framework.detection.FacetBasedFrameworkDetector;
import com.intellij.framework.detection.FileContentPattern;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.patterns.ElementPattern;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileContent;
import vgrechka.phizdetsidea.phizdets.buildout.config.BuildoutCfgFileType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.util.Collection;

/**
 * @author nik
 */
public class BuildoutFrameworkDetector extends FacetBasedFrameworkDetector<BuildoutFacet, BuildoutFacetConfiguration> {
  private static final Logger LOG = Logger.getInstance("#vgrechka.phizdetsidea.phizdets.buildout.BuildoutFrameworkDetector");

  public BuildoutFrameworkDetector() {
    super("buildout-phizdets");
  }

  @NotNull
  @Override
  public FacetType<BuildoutFacet, BuildoutFacetConfiguration> getFacetType() {
    return BuildoutFacetType.getInstance();
  }

  @NotNull
  @Override
  public FileType getFileType() {
    return BuildoutCfgFileType.INSTANCE;
  }

  @NotNull
  @Override
  public ElementPattern<FileContent> createSuitableFilePattern() {
    return FileContentPattern.fileContent();
  }

  @Nullable
  @Override
  protected BuildoutFacetConfiguration createConfiguration(Collection<VirtualFile> files) {
    VirtualFile source = ContainerUtil.getFirstItem(files);
    LOG.info("Detecting Buildout facet for " + source.getPath());
    final VirtualFile baseDir = source.getParent();
    final VirtualFile runner = BuildoutFacet.getRunner(baseDir);
    if (runner != null) {
      final File script = BuildoutFacet.findScript(null, "buildout", baseDir);
      if (script != null) {
        BuildoutFacetConfiguration configuration = new BuildoutFacetConfiguration(script.getName());
        configuration.setScriptName(script.getPath());
        final VirtualFile scriptVFile = LocalFileSystem.getInstance().findFileByIoFile(script);
        if (scriptVFile != null) {
          configuration.setPaths(BuildoutFacet.extractBuildoutPaths(scriptVFile));
        }
        else {
          LOG.info("Could not find virtual file for buildout script " + script);
        }
        return configuration;
      }
      else {
        LOG.info("No buildout script found");
      }
    }
    else {
      LOG.info("No runner script found");
    }
    return null;
  }
}


text:
import os
import json
import pytest
import numpy as np
import openpnm as op
from pathlib import Path
from openpnm.io import network_from_jsongraph, network_to_jsongraph

class JSONGraphTest:

    def setup_class(self):
        ws = op.Workspace()
        ws.settings['local_data'] = True
        self.net = op.network.Cubic(shape=[2, 2, 2])
        self.net['pore.diameter'] = 2.0 * np.ones(self.net.Np)
        self.net['throat.diameter'] = 2.0 * np.ones(self.net.Nt)
        self.net.add_model(propname='throat.length',
                           model=op.models.network.pore_to_pore_distance)

    def teardown_class(self):
        ws = op.Workspace()
        ws.clear()

    # def test_save_failure(self, tmpdir):
    #     path = Path(os.path.realpath(tmpdir),
    #                 '../../../fixtures/JSONGraphFormat')
    #     filename = Path(path.resolve(), 'save_failure.json')

    #     # Create a deep copy of network with one required property missing
    #     net = copy.deepcopy(self.net)
    #     net.pop('pore.diameter')

    #     # Ensure an exception was thrown
    #     with pytest.raises(Exception) as e_info:
    #         op.io.network_to_jsongraph(net.project, filename=filename)
    #     expected_error = 'Error - network is missing one of:'
    #     assert expected_error in str(e_info.value)

    def test_save_success(self):
        path = Path(os.path.realpath(__file__),
                    '../../../fixtures/JSONGraphFormat')
        filename = Path(path.resolve(), 'save_success.json')
        op.io.network_to_jsongraph(self.net, filename=filename)

        # Read newly created file
        with open(filename, 'r') as file:
            json_file = json.load(file)

        # Ensure correctnes of overal network properties
        assert json_file['graph']['metadata']['number_of_nodes'] == self.net.Np
        assert json_file['graph']['metadata']['number_of_links'] == self.net.Nt

        # Ensure correctnes of node list properties
        nodes = sorted(json_file['graph']['nodes'], key=lambda node: int(node['id']))
        assert len(nodes) == self.net.Np
        assert isinstance(nodes, list)

        # Sweep all nodes in the list
        for node in nodes:
            assert isinstance(node, dict)

            # Ensure correctnes of node property types
            assert 'id' in node
            assert 'metadata' in node
            assert isinstance(node['id'], str)
            assert isinstance(node['metadata'], dict)

            # Ensure correctnes of node property values
            assert int(node['id']) < self.net.Np

            # Ensure correctnes of node metadata types
            assert 'node_coordinates' in node['metadata']
            assert 'node_squared_radius' in node['metadata']
            assert 'x' in node['metadata']['node_coordinates']
            assert 'y' in node['metadata']['node_coordinates']
            assert 'z' in node['metadata']['node_coordinates']
            assert isinstance(node['metadata']['node_coordinates'], dict)
            assert isinstance(node['metadata']['node_squared_radius'], int)
            assert isinstance(node['metadata']['node_coordinates']['x'], int)
            assert isinstance(node['metadata']['node_coordinates']['y'], int)
            assert isinstance(node['metadata']['node_coordinates']['z'], int)

            # Ensure correctness of node metadata values
            assert node['metadata']['node_squared_radius'] == 1
            assert node['metadata']['node_coordinates']['x'] * 2 % 2 == 0
            assert node['metadata']['node_coordinates']['y'] * 2 % 2 == 0
            assert node['metadata']['node_coordinates']['z'] * 2 % 2 == 0

        # Ensure correctnes of edge list properties
        edges = sorted(json_file['graph']['edges'], key=lambda edge: int(edge['id']))
        assert len(edges) == self.net.Nt
        assert isinstance(edges, list)

        # Sweep all edges in the list
        for edge in edges:
            assert isinstance(edge, dict)

            # Ensure correctnes of edge property types
            assert 'id' in edge
            assert 'source' in edge
            assert 'target' in edge
            assert 'metadata' in edge
            assert isinstance(edge['id'], str)
            assert isinstance(edge['source'], str)
            assert isinstance(edge['target'], str)
            assert isinstance(edge['metadata'], dict)

            # Ensure correctnes of edge property values
            assert int(edge['id']) < self.net.Nt
            assert int(edge['source']) < self.net.Np
            assert int(edge['target']) < self.net.Np

            # Ensure correctnes of edge metadata types
            assert 'link_length' in edge['metadata']
            assert 'link_squared_radius' in edge['metadata']
            assert isinstance(edge['metadata']['link_length'], float)
            assert isinstance(edge['metadata']['link_squared_radius'], float)

            # Ensure correctnes of edge metadata values
            assert edge['metadata']['link_length'] == 1.0
            assert edge['metadata']['link_squared_radius'] == 1.0

        # Remove test file after completion
        os.remove(filename)

    def test_load_failure(self):
        path = Path(os.path.realpath(__file__),
                    '../../../fixtures/JSONGraphFormat')
        filename = Path(path.resolve(), 'invalid.json')

        # Ensure an exception was thrown
        with pytest.raises(Exception):
            op.io.from_jsongraph(filename)

    def test_load_success(self):
        # Load JSON file and ensure project integrity
        path = Path(os.path.realpath(__file__),
                    '../../../fixtures/JSONGraphFormat')
        filename = Path(path.resolve(), 'valid.json')
        net = op.io.network_from_jsongraph(filename)
        assert hasattr(net, 'conns')

        # Ensure overal network properties
        assert net.Np == 2
        assert net.Nt == 1

        # Ensure correctness of pore properties
        assert np.array_equal(net['pore.index'], np.array([0, 1]))
        assert np.array_equal(net['pore.diameter'], np.array([0, 0]))
        assert np.array_equal(net['pore.coords'][0], np.array([0, 0, 0]))
        assert np.array_equal(net['pore.coords'][1], np.array([1, 1, 1]))

        # Ensure correctness of throat properties
        length = 1.73205080757
        squared_radius = 5.169298742047715
        assert net['throat.length'] == length
        assert np.array_equal(net['throat.conns'], np.array([[0, 1]]))
        assert net['throat.diameter'] == 2.0 * np.sqrt(squared_radius)

if __name__ == '__main__':
    import py
    # All the tests in this file can be run with 'playing' this file
    t = JSONGraphTest()
    self = t  # For interacting with the tests at the command line
    tmpdir = py.path.local()
    t.setup_class()
    for item in t.__dir__():
        if item.startswith('test'):
            print(f'Running test: {item}')
            try:
                t.__getattribute__(item)()
            except TypeError:
                t.__getattribute__(item)()


text:
MAGGSIU4 ;WOIFO/NST/GEK - Utilities for Image Import API ; 16 Apr 2013 8:49 AM
 ;;3.0;IMAGING;**121,135**;Mar 19, 2002;Build 5238;Jul 17, 2013
 ;; Per VHA Directive 2004-038, this routine should not be modified.
 ;; +---------------------------------------------------------------+
 ;; | Property of the US Government.                                |
 ;; | No permission to copy or redistribute this software is given. |
 ;; | Use of unreleased versions of this software requires the user |
 ;; | to execute a written test agreement with the VistA Imaging    |
 ;; | Development Office of the Department of Veterans Affairs,     |
 ;; | telephone (301) 734-0100.                                     |
 ;; | The Food and Drug Administration classifies this software as  |
 ;; | a medical device.  As such, it may not be changed in any way. |
 ;; | Modifications to this software may result in an adulterated   |
 ;; | medical device under 21CFR820, the use of which is considered |
 ;; | to be a violation of US Federal Statutes.                     |
 ;; +---------------------------------------------------------------+
 ;;
 Q
 ; ----- Rescind images attached to a TIU note
 ; RESCIND(MAGRY,TIUDA)
 ;
 ; Input Parameters
 ; ================
 ; TIUDA = IEN of TIU note in TIU DOCUMENT file (#8925)
 ;
 ; Return Values
 ; =============
 ; if error found during execution
 ;   MAGRY(0) = 0^Error message"
 ;   MAGRU(1..N) = messages describing the Error.
 ;
 ; if success
 ;   MAGRY(0) = 1^Success
 ;   .. for each image queued we have 3 lines of info.
 ;   MAGRY(x)   = Image(1..n): Tracking ID: TRKID
 ;   MAGRY(x+1) = Image(1..n): Queue: QUENUMBER
 ;   MAGRY(x+2) = Image(1..n): Image: MAGDA
 ;
 ; if First image success, and subsequent image problem we Return
 ;   MAGRY(0) =  2^Warning message
 ;   for each successfully Queued image queued we have 3 lines of info as above
 ;   for any image that was a problem deleting (unlikely) we have MAGDA and
 ;   error messages.  The Image is changed to status of "Needs Review",
 ;     so it is blocked from view.
 ;   MAGRY(x) = Image(n): Image: MAGDA
 ;   MAGRY(x+1) =
 ;
 ;
 ;   Tracking ID is a field in each file:
 ;      IMAGE File (#2005) (Field #108) (index "ATRKID")
 ;      IMAGING WINDOWS SESSION File (#2006.82) (Field #8) (index "E")
 ;      ACQUISITION SESSION FILE File(#2006.041)(Field #.02) (index "C")
 ;
RESCIND(MAGRY,TIUDA) ; Main entry point to rescind images attached to a TIU note
 N IMGLIST,MAGA,QUECT
 N MAGIEN,REASON,REASDA,MERR
 N I,I2,S,ICT,N0,N2,N40,MPOS
 N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
 K MAGRY
 ; check TIUDA
 I '$G(TIUDA) S MAGRY(0)="0^TIU Note is not valid: "_TIUDA Q
 I '$D(^TIU(8925,TIUDA)) S MAGRY(0)="0^TIU Note does not exist: "_TIUDA Q
 ;
 ; Does Note have any Images?  Quit if No.
 D GETILST^TIUSRVPL(.MAGA,TIUDA)
 I '$D(MAGA) S MAGRY(0)="1^No images found for TIU Note: "_TIUDA  Q  ; no images found
 ;
 ;  Set the Reason text and Reason DA
 S REASON="Rescinded TIU Note"
 S REASDA=$O(^MAG(2005.88,"B",REASON,""))
 ;
 S MAGRY(0)="0^Processing Rescind request..."
 D IMAGES^MAGGNTI(.IMGLIST,TIUDA)  ; Get a list with images linked to TIU note
 ; format of result to IMAGES:
 ; XX(1)="B2^20175^<FULL UNC PATCH to Full Res Image>^<FULL UNC PATCH to Abstract>
 ;  we know there are images (from above) so a '0^' means an error in this situation.
 I '$P(IMGLIST(0),"^",1) D  Q  ;
 . S MAGRY(0)="0^Error building Image list for TIU Note: "_TIUDA
 . S MAGRY($O(MAGRY(""),-1)+1)=IMGLIST(0)
 . D MAILERR("",TIUDA,.MAGRY) Q
 . Q
 ;
 S I=0,ICT=0,QUECT=0,MERR=""
 ; we are setting an Import Queue for each image attached to the Note.
 F  S I=$O(IMGLIST(I)) Q:I=""  D  I $L(MERR) S MAGRY(0)=MERR Q
 . S ICT=ICT+1 ; Image Counter.
 . ; example: (1)="B2^19412^c:\image\Q...\QRT00000019412.JPG^c:\image\Q...\QRT00000019412.ABS
 . S MAGIEN=$P(IMGLIST(I),U,2)
 . K MAGRY2
 . D RSND1^MAGGSIU5(.MAGRY2,MAGIEN,TIUDA,REASON)
 . ;
 . ; We need to build MAGRY with MAGRY2 from each image.
 . S I2="" F  S I2=$O(MAGRY2(I2)) Q:(I2="")  D
 . . S MAGRY($O(MAGRY(""),-1)+1)="Image("_ICT_") "_MAGRY2(I2)
 . . Q
 . ;   add the Image IEN to Result Array.
 . S MAGRY($O(MAGRY(""),-1)+1)="Image("_ICT_") IEN: "_MAGIEN
 . ; if success MAGRY2(0)= QueNumber ^Data has been Queued.
 . I MAGRY2(0)>0 S QUECT=QUECT+1
 . I 'MAGRY2(0) D  ;
 . . ; If Error after calling RSND1, then if Image ISN'T Deleted, we
 . . ; want to change it's status to 'Needs Review' to block it from view.
 . . D SETSTAT(MAGIEN,11,REASDA)
 . . ;
 . . ; if this is first image, we Quit the process.
 . . I ICT=1 S MERR=MAGRY2(0) Q
 . . ; if this is image other than first, we return Warning.
 . . S MAGRY(0)="2^Warning while creating Import Queue"
 . . Q
 . Q
 ; add TIUDA to the result Array.
 S MAGRY($O(MAGRY(""),-1)+1)="TIU Note: "_TIUDA
 ; Call MAILERR if needed  i.e if  MAGRY(0)=0 OR 2  .
 I $L(MERR)!(+MAGRY(0)=2) D MAILERR("","",.MAGRY) Q
 ;  Here.  Image has been queued.   If Group, check for QUECT not equal Image Count.
 S MPOS="" I QUECT>1 S MPOS="s"
 S MAGRY(0)="1^"_QUECT_" Image"_MPOS_" Queued for RESCINDED watermark"
 ; if only some of images queued for watermark, change status in
 ; (0) node to warning '2' and add a line of text.
 I QUECT<ICT D
 . S $P(MAGRY(0),"^",1)="2"
 . S MAGRY($O(MAGRY(""),-1)+1)="Warning : Only "_QUECT_" of "_ICT_" images were Queued for Watermark"
 Q
 ;
 ; --------  TRKID()   Returns Unique Tracking ID for Import API --------
 ;   Imaging is now a 'user' of the Import API.  This API call will
 ;   guarantee a unique Imaging Tracking ID number for Rescind "MAGRSND"
 ;   to be used when Imaging Calls the Import API.
 ;  ; e.g. MAGRSND;3110222.080459.344
TRKID() ; Returns a new unique Import API tracking id
 N TKI,EDT
 ; Set the required 0 node of XTMP.
 S EDT=$$FMADD^XLFDT(DT,30)
 I $P($G(^XTMP("MAGTRKID",0)),"^",1)<EDT S $P(^XTMP("MAGTRKID",0),"^",1,2)=EDT_"^"_DT
 ;
 ; Need to use LOCKs and daily counter to assure we have unique TRKID
 ; Lock it, increment today's counter, use increment, update counter and UnLock it for next.
 L +^XTMP("MAGTRKID"):4 E  Q 0
 S TKI=$G(^XTMP("MAGTRKID",DT))+1
 S ^XTMP("MAGTRKID",DT)=TKI
 L -^XTMP("MAGTRKID")
 ;
 Q "MAGRSND;"_$$NOW^XLFDT_"."_TKI
 ;
 ;
 ; --------  STATCB(STATARR) -----------
 ;   TAG^ROUTINE Receives the status array of the Import Process.
 ;   This is the Imaging Callback function required by the Import API.
 ;   This Status Callback is for the RESCIND Import function.
 ;   STATARR is the status array of the Import Process
 ;    ;   STATARR is the format
 ;   (0)=0|1|2     0=Error, 1=Success, 2=Warning
 ;   (1)=Tracking ID
 ;   (2)=Queue Number
 ;   (3..n)= any extra messages describing error or warning.
 ;
STATCB(STATARR) ; CALLBACK function for IAPI Status array for Rescinded Import.
 ;   Tracking of Rescinded Image through IMAGE ACCESS LOG (#2006.95)
 ;   For Rescinded Images : Set Delete Queue with File Name(s)
 ;   i.e. the Image Entry in 2005 is already deleted, now delete the Image Files
 ;   Email Status of Rescind to Mail Group.  Success, Warning or Error.
 ;
 N IDATA,TRKID,I,SESS,SDATA
 N MAGDUZ,MAGO,MAGDFN,MAGAD
 N STATUS ;Status of the Rescinded Import
 S STATUS=+$P($G(STATARR(0)),"^",1)
 S TRKID=$G(STATARR(1))
 I $L(TRKID) D
 . S SESS=$$SES4TRK^MAGGSIU3(TRKID)
 . I $L(SESS) D  ; Create Entry in IMAGE ACCESS LOG file (#2006.95)
 . . S SDATA=$G(^MAG(2006.82,SESS,0))
 . . S MAGDUZ=$P(SDATA,"^",2),MAGO=$P(SDATA,"^",7),MAGDFN=$P(SDATA,"^",6)
 . . ; set the Additional info (MAGAD) to the (0) node message or warning.
 . . ;    get out "^" for storage.
 . . S MAGAD=$TR(STATARR(0),"^","~")
 . . ; Parameters needed:    (MAGAD optional)
 . . ; ENTRY^MAGLOG(MAGIMT     ,MAGDUZ         ,MAGO        ,MAGPACK,   MAGDFN   ,MAGCT,MAGAD)
 . . D ENTRY^MAGLOG("RESCIND",MAGDUZ,MAGO,"IAPI",MAGDFN,1,MAGAD)
 . . Q
 . ;  If there are Rescinded image files, we get a list of the files we need
 . ;  to set Delete Queues for.  i.e. this is Abs, Full, Big and Alt (Alt is TXT File).
 . ;  In the Session File we saved the Place. Place is needed for the Delete function.
 . ;  So we get data from Session File (#2006.82) for the files to delete.
 . D GETIAPID^MAGGSIUI(.IDATA,TRKID) ; Data from (#2006.82) Session File.
 . ;135T5 Topeka issue: Only Delete Images if Rescind is Successful.
 . I STATUS S I=0 F  S I=$O(STATARR(I)) Q:'I  D  ;
 . . I $P(STATARR(I),"^",1)="RESCINDED IMAGE FILE" D DELFILES(.IDATA)
 . . Q
 . Q
 ; Mail Status.
 D MAILSTAT(.STATARR)
 Q
 ; --------  Notifies user of problems of the Rescind/Watermark attempt.
 ;      IEN : IMAGE File (#2005)
 ;      TIUDA : TIU DOCUMENT File (#8925)
 ;      STARR : Status array to send in message.
MAILERR(IEN,TIUDA,STARR) ;  Notifies user of problems.
 ; IEN = IEN of the image in IMAGE file (#2005)
 ; TIUDA = IEN of Note in TIU DOCUMENT File (#8925)
 ; Only add IEN, TIUDA if requested.
 I $G(IEN) S STARR($O(STARR(""),-1)+1)="Image IEN: "_$G(IEN)
 I $G(TIUDA) S STARR($O(STARR(""),-1)+1)="TIU Note: "_$G(TIUDA)
 D MAILSTAT(.STARR)
 Q
 ;
 ; ----- MAILSTAT -  Mail Msgs from RESCIND Function.--------
 ;      STATARR : Status Array to send to G.MAG SERVER mail group.
 ;
MAILSTAT(STATARR) ;Status Callback (called by the import API)
 ;
 N I,MARR,CT
 N XMDUZ,XMSUB,XMTEXT,XMY
 ;  0 = error, 2 = Warning, 1 = Success.
 ; [  ] do we Always send email, Success or Not. ?
 ; or only sending Error and Warning, because too many emails ?
 ; I $P(STATARR(0),"^",1)'=1 D  ;
 D  ; For now, Always send email, Success or Not.
 . ; send email to G.MAG SERVER and current user.
 . ;Send to:
 . S XMY("G.MAG SERVER")=""
 . S XMDUZ=DUZ ; Current User could be TIU User. Send DUZ also.
 . S XMSUB="Import API Report"
 . S XMTEXT="MARR("
 . ; XMD needs array to start with 1
 . S CT=0,I=""
 . F  S I=$O(STATARR(I)) Q:I=""  D
 . . S CT=CT+1,MARR(CT)=I_") "_STATARR(I)
 . . Q
 . S CT=CT+1,MARR(CT)=" "
 . S CT=CT+1,MARR(CT)="   The preceding array was generated by"
 . S CT=CT+1,MARR(CT)="   the VistA Imaging Import API while "
 . S CT=CT+1,MARR(CT)="   processing a 'RESCIND' Image action."
 . D ^XMD
 . Q
 Q
 ; -----    Set Status of Image and Status Reason.
 ;   MAGIEN = Internal entry number IMAGE File (#2005)
 ;   STAT   = Internal value for STATUS Field  (#113)
 ;   REASDA = Internal value for STATUS REASON Field (#113.3)
 ;
SETSTAT(MAGIEN,STAT,REASDA) ;
 N MAGFDA,MAGERR,IENC,MSG
 S IENC=MAGIEN_","
 S MAGFDA(2005,IENC,113)=STAT
 ; This is computed: 113.1)=DT   Status Date
 ; This is computed:,113.2)=DUZ
 I $G(REASDA) S MAGFDA(2005,IENC,113.3)=REASDA
 D UPDATE^DIE("S","MAGFDA","","MAGERR")
 I $D(MAGERR) D
 . D RTRNERR(.MSG)
 . S MAGRY($O(MAGRY(""),-1)+1)="Failed to Set Status: "_MSG
 . Q
 Q
 ;
 ; ----- RTRNERR Catch FM error during processing of Rescind Image.
 ; Return the Error from FM Call in ETXT.
RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
 S ETXT="0^ERROR  "_MAGERR("DIERR",1,"TEXT",1)
 Q
 ; --------  DELETE - Delete Image entry. Rescind Function.--------
 ;   IEN : IMAGE FILE (#2005) Internal entry Number
 ;   REASON : Free text for (#30.2) DELETED REASON [3F] ^
DELETE(IEN,REASON) ; Delete Image by IEN
 N RSLT,IENDF
 L +^MAG(2005,IEN):4
 E  Q "0^Image ID# "_IEN_" is Locked. Delete is Canceled"
 ;  the call to DELETE has 3rd param =0  this means do not Set the Delete Queue to
 ;  delete the file from Share.  We will set the Delete Queue to delete the file
 ;  from share after the successful watermarking process.
 ; gek 121T2 This is the IEN + the Force Delete Flag.  User won't need MAG DELETE key.
 S IENDF=IEN_"^"_1
 ; '0' in 3rd param : this is a flag to tell function to NOT queue images for delete by
 ;   the BP yet.
 D DELETE^MAGGTID(.RSLT,IENDF,0,1,REASON)
 L -^MAG(2005,IEN)
 Q RSLT(0)
 ;
 ; --------  DELFILES(IDATA)  After a Rescind Action.
 ;  IDATA : has filenames and file places, format is :
 ;  "FullFile^AbsFile^BigFile|FullPlace^AbsPlace^BigPlace"
 ;
 ;   from the Status Callback call, if successful import and watermark,  then we
 ;  delete the Image Files associated with the Image that was Rescinded.
DELFILES(IDATA) ;This will format the data for the call to set the Delete Queue.
 N RSN1,RSN2,I,RSNF
 N MAGPLC,MAGFILE2,X,X2,ALTEXT,ALTPATH
 ; Only 1 image is in a Rescind Import.
 ; example :
 ; ..IMAGE,1)=20467~c:\image\SLA0\00\00\02\04\SLA00000020467.TIF~c:\image\SLA0\00\00\02\04\SLA00000020467.ABS~|1~1~1
 ; RSNF= c:\image...\SLA00000020467.TIF~c:\image...\SLA00000020467.ABS~
 ; RSN2=1~1~1
 S RSN1=$P($G(IDATA("IMAGE",1)),"|",1)
 S RSNF=$P(RSN1,"~",2,4)
 S RSN2=$P($G(IDATA("IMAGE",1)),"|",2)
 F I=1,2,3 D
 . ; Send the Full Path and Place : for Full, Abs, Big.
 . ; Don't set null values in the Queue
 . I ($P(RSNF,"~",I)="")!($P(RSN2,"~",I)="") Q
 . S X=$$DELETE^MAGBAPI($P(RSNF,"~",I),$P(RSN2,"~",I))
 . Q
 ;Delete any other ALTernate files. ( TXT)
 ; -- code from MAGGTID, Can't call MAGGTID, because the 2005 entry is gone.
 ;    (gek 3/31/03) Since ALT files are (for now) always on same server as Full
 ;    We only attempt to delete them here  (If we have a path to FullRes on Magnetic)
 ;
 S MAGFILE2=$P(RSNF,"~",1),MAGPLC=$P(RSN2,"~",1)
 S X2=0
 ; Don't set null values in the Queue
 I (MAGFILE2="")!(MAGPLC="") Q
 F  S X2=$O(^MAG(2006.1,MAGPLC,2,X2)) Q:'X2  D
 . S ALTEXT=^MAG(2006.1,MAGPLC,2,X2,0)
 . S ALTPATH=$P(MAGFILE2,".")_"."_ALTEXT
 . S X=$$DELETE^MAGBAPI(ALTPATH,MAGPLC)
 . Q
 Q


text:
struct KINTERRUPT;

typedef BOOLEAN (NTAPI *PKSERVICE_ROUTINE)(KINTERRUPT *, PVOID);

enum KINTERRUPT_MODE {
	LevelSensitive = 0,
	Latched = 1
};

typedef struct KINTERRUPT { // 0x70
	PKSERVICE_ROUTINE ServiceRoutine; // +0x0(0x4)
	PVOID ServiceContext; // +0x4(0x4)
	DWORD BusInterruptLevel; // +0x8(0x4)
	DWORD Irql; // +0xC(0x4)
	BYTE Connected; // +0x10(0x1)
	BYTE ShareVector; // +0x11(0x1)
	BYTE Mode; // +0x12(0x1)
	DWORD ServiceCount; // +0x14(0x4)
	DWORD DispatchCode[22]; // +0x18(0x58)
} KINTERRUPT;

uint32_t NTAPI kernel_HalGetInterruptVector(
	uint32_t BusInterruptLevel,
	KIRQL *Irql
);

void NTAPI kernel_KeInitializeInterrupt(
	KINTERRUPT *Interrupt,
	PKSERVICE_ROUTINE ServiceRoutine,
	void *ServiceContext,
	uint32_t Vector,
	KIRQL Irql,
	KINTERRUPT_MODE InterruptMode,
	BOOLEAN ShareVector
);

BOOLEAN NTAPI kernel_KeConnectInterrupt(
	KINTERRUPT *Interrupt
);


text:
require 'spec_helper'

describe DataSource do
  describe 'scopes' do
    describe 'accessible_to' do
      let(:permitted_data_source) { data_sources(:owners) }
      let(:prohibited_data_source) { data_sources(:admins) }
      let(:online_data_source) { data_sources(:online) }
      let(:offline_data_source) { data_sources(:offline) }

      let(:user) { users(:owner) }

      it "returns data sources that the user can access" do
        DataSource.accessible_to(user).should include(online_data_source)
        DataSource.accessible_to(user).should include(offline_data_source)
        DataSource.accessible_to(user).should include(permitted_data_source)
        DataSource.accessible_to(user).should_not include(prohibited_data_source)
      end
    end
  end

  it_behaves_like "a notable model" do
    let!(:note) do
      Events::NoteOnDataSource.create!({
                                           :actor => users(:owner),
                                           :data_source => model,
                                           :body => "This is the body"
                                       }, :as => :create)
    end

    let!(:model) { FactoryGirl.create(:gpdb_data_source) }
  end

  describe 'creating a DataSource' do
    before do
      any_instance_of(DataSource) do |data_source|
        stub(data_source).valid_db_credentials? { true }
      end
    end

    it 'enqueues a refresh job' do
      stub(SolrIndexer.SolrQC).enqueue_if_not_queued.any_times # for other jobs
      mock(SolrIndexer.SolrQC).enqueue_if_not_queued('DataSource.refresh', anything, hash_including('new' => true))
      FactoryGirl.create(:data_source)
    end
  end

  describe 'automatic reindexing' do
    let(:data_source) { data_sources(:oracle) }

    before do
      stub(Sunspot).index.with_any_args
    end

    context 'making the data source shared' do
      it 'enqueues a reindex job' do
        mock(data_source).solr_reindex_later
        data_source.shared = true
        data_source.save
      end
    end

    context 'making the data source un-shared' do
      let(:data_source) { data_sources(:shared) }

      it 'enqueues a reindex job' do
        mock(data_source).solr_reindex_later
        data_source.shared = false
        data_source.save
      end
    end

    context 'not changing the shared state' do
      it 'doesnt reindex' do
        dont_allow(data_source).solr_reindex_later
        data_source.update_attributes(:name => 'foo')
      end
    end
  end

  describe '#solr_reindex_later' do
    let(:data_source) { data_sources(:owners) }

    it 'enqueues a job' do
      mock(SolrIndexer.SolrQC).enqueue_if_not_queued('DataSource.reindex_data_source', data_source.id)
      data_source.solr_reindex_later
    end
  end

  describe '#reindex_data_source' do
    let(:data_source) { data_sources(:owners) }

    before do
      stub(Sunspot).index.with_any_args
    end

    it 'reindexes itself' do
      mock(Sunspot).index(data_source)
      DataSource.reindex_data_source(data_source.id)
    end

    it 'should reindex all of its datasets' do
      mock(Sunspot).index(is_a(Dataset)).times(data_source.datasets.count)
      DataSource.reindex_data_source(data_source.id)
    end
  end

  describe '.refresh' do
    let(:data_source) { data_sources(:owners) }

    before do
      any_instance_of(DataSource) do |data_source|
        stub(data_source).refresh { @refreshed_data_source = true }
      end
    end

    it 'calls refresh on the data source' do
      DataSource.refresh(data_source.id)
      @refreshed_data_source.should be_true
    end
  end

  describe '#refresh' do
    let(:data_source) { data_sources(:owners) }

    it 'refreshes databases for the data source' do
      mock(data_source).refresh_databases({})
      data_source.refresh
    end

    context 'when new is set' do
      it 'refreshes the databases, skipping dataset solr indexing and then refreshes the schemas forcing the dataset solr indexing' do
        mock(data_source).refresh_databases(hash_including(:skip_dataset_solr_index => true))
        mock(data_source).refresh_schemas(hash_including(:force_index => true))
        data_source.refresh(:new => true)
      end
    end
  end

  describe '#refresh_databases_later' do
    let(:data_source) { data_sources(:owners) }

    it 'should enqueue a job' do
      mock(SolrIndexer.SolrQC).enqueue_if_not_queued('DataSource.refresh_databases', data_source.id)
      data_source.refresh_databases_later
    end
  end

  describe '#account_for_user!' do
    let(:user) { users(:owner) }

    context 'shared data source' do
      let(:data_source) { data_sources(:shared) }
      let(:owner_account) { data_source.owner_account }

      it 'should return the same account for everyone' do
        data_source.account_for_user!(user).should == owner_account
        data_source.account_for_user!(data_source.owner).should == owner_account
      end
    end

    context 'individual data source' do
      let(:data_source) { data_sources(:owners) }
      let!(:owner_account) { DataSourceAccount.find_by_data_source_id_and_owner_id(data_source.id, data_source.owner.id) }
      let!(:user_account) { DataSourceAccount.find_by_data_source_id_and_owner_id(data_source.id, users(:the_collaborator).id) }

      it 'should return the account for the user' do
        data_source.account_for_user!(data_source.owner).should == owner_account
        data_source.account_for_user!(user_account.owner).should == user_account
      end
    end

    context 'missing account' do
      let(:data_source) { data_sources(:owners) }

      it 'raises an exception' do
        expect { data_source.account_for_user!(users(:no_collaborators)) }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end
  end

  describe '#account_for_user' do
    let(:data_source) { data_sources(:owners) }

    context 'missing account' do
      it 'returns nil' do
        data_source.account_for_user(users(:no_collaborators)).should be_nil
      end
    end
  end

  describe '#check_status!' do
    let(:data_source) { data_sources(:owners) }

    context "when the data source is offline" do
      before do
        stub(data_source).connect_as_owner {
          raise "can't connect!"
        }
      end

      it "sets the state to offline" do
        data_source.state = "whatever"
        data_source.check_status!
        data_source.state.should == "offline"
      end

      it "updates last_checked_at" do
        expect {
          data_source.check_status!
        }.to change(data_source, :last_checked_at)
      end

      it "does not update last_online_at" do
        expect {
          data_source.check_status!
        }.not_to change(data_source, :last_online_at)
      end
    end

    context "when the data source is online" do
      before do
        stub(data_source).connect_as_owner {
          connection = Object.new
          stub(connection).version { '1.2.3.4' }
          connection
        }
      end

      it "sets the state to online" do
        data_source.state = "whatever"
        data_source.check_status!
        data_source.state.should == "online"
      end

      it "updates the version" do
        data_source.version = "whatever"
        data_source.check_status!
        data_source.version.should == "1.2.3.4"
      end

      it "updates last_checked_at" do
        expect {
          data_source.check_status!
        }.to change(data_source, :last_checked_at)
      end

      it "updates last_online_at" do
        expect {
          data_source.check_status!
        }.to change(data_source, :last_online_at)
      end
    end
  end

  describe "search fields" do
    it "indexes text fields" do
      DataSource.should have_searchable_field :name
      DataSource.should have_searchable_field :description
    end
  end

  describe ".reindex_data_source" do
    let(:data_source) { data_sources(:owners) }

    before do
      stub(Sunspot).index.with_any_args
    end

    it "reindexes itself" do
      mock(Sunspot).index(data_source)
      DataSource.reindex_data_source(data_source.id)
    end

    it "should reindex all of its datasets" do
      mock(Sunspot).index(is_a(Dataset)).times(data_source.datasets.count)
      DataSource.reindex_data_source(data_source.id)
    end
  end

  describe ".solr_reindex_later" do
    let(:data_source) { data_sources(:owners) }
    it "should enqueue a job" do
      mock(SolrIndexer.SolrQC).enqueue_if_not_queued("DataSource.reindex_data_source", data_source.id)
      data_source.solr_reindex_later
    end
  end

  describe ".owned_by" do
    let(:owner) { users(:owner) }
    let!(:gpdb_shared_data_source) { data_sources(:shared) }
    let!(:gpdb_owned_data_source) { data_sources(:owners) }
    let!(:oracle_data_source) {
      ds = data_sources(:oracle)
      ds.owner = users(:the_collaborator)
      ds.save!
    }

    context "for owners" do
      it "includes owned data sources" do
        DataSource.owned_by(owner).should include gpdb_owned_data_source
      end

      it "excludes other users' data sources" do
        DataSource.owned_by(owner).should_not include oracle_data_source
      end

      it "excludes shared data sources" do
        DataSource.owned_by(owner).should_not include gpdb_shared_data_source
      end
    end

    context "for non-owners" do
      it "excludes all data sources" do
        DataSource.owned_by(FactoryGirl.build_stubbed(:user)).should be_empty
      end
    end

    context "for admins" do
      it "includes all data sources" do
        DataSource.owned_by(users(:evil_admin)).count.should == DataSource.count
      end
    end
  end

  it "creates an event if the data source is destroyed" do
    set_current_user(users(:admin))
    data_source = data_sources(:default)
    expect { data_source.destroy }.to change { Events::DataSourceDeleted.count }.by(1)
    Events::DataSourceDeleted.last.data_source.should == data_source
  end

  it_should_behave_like "taggable models", [:data_sources, :default]

  it_behaves_like 'a soft deletable model' do
    let(:model) { data_sources(:oracle) }
  end
end


text:
<?php
namespace Vivo\IO;

/**
 * Input stream, that reads data from file or any valid resource.
 * @see fopen() for valid filenames
 */
class FileInputStream implements InputStreamInterface, CloseableInterface
{

    /**
     * @var resource
     */
    private $fp;

    /**
     * @var boolean
     */
    private $closed = false;

    /**
     * Constructor
     * @param string $filename
     * @throws Exception\RuntimeException
     */
    public function __construct($filename)
    {
        $this->fp = fopen($filename, 'r');
        if (!$this->fp) {
            throw new Exception\RuntimeException("Can not create stream for '$filename'");
        }
    }

    /**
     * Reads data from stream.
     * Returns null when data could not be read
     * @param integer $bytes
     * @return string|bool
     * @throws Exception\InvalidArgumentException
     * @throws Exception\RuntimeException
     */
    public function read($bytes = 1)
    {
        if (!is_int($bytes) || $bytes < 1) {
            throw new Exception\InvalidArgumentException(
                'Parameter $bytes must be integer.');
        }
        if ($this->isClosed()) {
            throw new Exception\RuntimeException('Can not read from closed stream.');
        }
        $data = fread($this->fp, $bytes);
        if ($data == '') {
            $data = false;
        }
        return $data;
    }

    /**
     * Closes stream.
     */
    public function close()
    {
        if (!$this->isClosed()) {
            fclose($this->fp);
            $this->closed = true;
        }
    }

    /**
     * @return boolean
     */
    public function isClosed()
    {
        return $this->closed;
    }
}


text:
import unittest
from mock import Mock, patch

from scrapy.exceptions import NotConfigured

from scrapylogentries.extension import LogentriesExtension

class TestLogentriesExtension(unittest.TestCase):

    def test_unconfigured_init(self):
        crawler = Mock()
        crawler.settings = {'LOGENTRIES_TOKEN': None, }

        with self.assertRaises(NotConfigured):
            self.extension = LogentriesExtension.from_crawler(crawler)

    @patch('scrapylogentries.extension.LogentriesHandler')
    def test_configured_init(self, handler):
        token = 'azertyuiop123456789'
        crawler = Mock()
        crawler.settings = {'LOGENTRIES_TOKEN': token, }

        extension = LogentriesExtension.from_crawler(crawler)

        handler.assert_called_once_with(token)
        extension.handler

# vim: syntax=python:sws=4:sw=4:et:


text:
package com.playseeds.android.sdk;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;

import com.android.vending.billing.IInAppBillingService;
import com.playseeds.android.sdk.inappmessaging.InAppMessageListener;

import java.lang.ref.WeakReference;

/**
 * Streamlines the integration experience on Android v4.0 and up by
 * - automating the resolving of the billing service
 * - listening to onStart, onStop and onDestroy of the activity and informing Seeds SDK
 *   about the changes in application state
 */
public class ActivityLifecycleManager implements Application.ActivityLifecycleCallbacks {
    private Context context;
    private WeakReference<Activity> currentActivityWeakReference;
    private ServiceConnection mServiceConn;
    IInAppBillingService mService;

    private boolean isBound;

    ActivityLifecycleManager(Context context) {
        this.context = context;

        resolve();
    }

    private void resolve() {

        ((Application) context).registerActivityLifecycleCallbacks(this);
    }

    @Override
    public void onActivityStarted(Activity activity) {
        currentActivityWeakReference = new WeakReference<>(activity);

        if (currentActivityWeakReference.get() != null) {

            Log.d(Seeds.TAG, "On Activity start");
            bindService();
            Seeds.sharedInstance().onStart();
        }
    }

    @Override
    public void onActivityStopped(Activity activity) {
        if (currentActivityWeakReference.get() != null) {

            Log.d(Seeds.TAG, "On Activity stop");
            Seeds.sharedInstance().onStop();
        }
    }

    @Override
    public void onActivityDestroyed(Activity activity) {
        if (currentActivityWeakReference.get() != null && mService != null) {

            Log.d(Seeds.TAG, "On Activity destroyed");
            if (isBound) {

                currentActivityWeakReference.get().unbindService(mServiceConn);
                isBound = false;
            }
        }
    }

    @Override
    public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}

    @Override
    public void onActivityResumed(Activity activity) {}

    @Override
    public void onActivityPaused(Activity activity) {}

    @Override
    public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}

    public Activity getValidViewContext(){

        return currentActivityWeakReference.get();
    }

    private void bindService(){

        mServiceConn = new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {

                Log.d(Seeds.TAG, "On Billing Service connected");

                mService = IInAppBillingService.Stub.asInterface(service);

                Seeds.setBillingService(mService);
            }

            @Override
            public void onServiceDisconnected(ComponentName name) {
                mService = null;
            }
        };

        Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
        serviceIntent.setPackage("com.android.vending");

        currentActivityWeakReference.get().bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
        isBound = true;
    }
}