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

#include "content/web_test/renderer/blink_test_helpers.h"

#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "content/public/common/content_switches.h"
#include "content/web_test/common/web_test_switches.h"
#include "content/web_test/renderer/test_preferences.h"
#include "net/base/filename_util.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "ui/display/display.h"

#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif

using blink::WebURL;

namespace {

constexpr base::StringPiece kFileScheme = "file:///";

base::FilePath GetWebTestsFilePath() {
  static base::FilePath path;
  if (path.empty()) {
    base::FilePath root_path;
    bool success = base::PathService::Get(base::DIR_SOURCE_ROOT, &root_path);
    CHECK(success);
    path = root_path.Append(FILE_PATH_LITERAL("third_party/blink/web_tests/"));
  }
  return path;
}

base::FilePath GetExternalWPTFilePath() {
  static base::FilePath path;
  if (path.empty()) {
    base::FilePath root_path;
    bool success = base::PathService::Get(base::DIR_SOURCE_ROOT, &root_path);
    CHECK(success);
    path = root_path.Append(
        FILE_PATH_LITERAL("third_party/blink/web_tests/external/wpt"));
  }
  return path;
}

// WPT tests use absolute path links such as
//   <script src="/resources/testharness.js">.
// If we load the tests as local files (e.g. when we run
// `content_shell --run-web-tests manually for testing or debugging), such
// links don't work. This function fixes this issue by rewriting file: URLs
// which were produced from such links so that they point actual files under
// the WPT test directory.
//
// Note that this doesn't apply when the WPT tests are run by the python script.
WebURL RewriteWPTAbsolutePath(base::StringPiece utf8_url) {
  if (!base::StartsWith(utf8_url, kFileScheme, base::CompareCase::SENSITIVE) ||
      utf8_url.find("/web_tests/") != std::string::npos) {
    return WebURL(GURL(utf8_url));
  }

#if BUILDFLAG(IS_WIN)
  // +3 for a drive letter, :, and /.
  static constexpr size_t kFileSchemeAndDriveLen = kFileScheme.size() + 3;
  if (utf8_url.size() <= kFileSchemeAndDriveLen)
    return WebURL();
  base::StringPiece path = utf8_url.substr(kFileSchemeAndDriveLen);
#else
  base::StringPiece path = utf8_url.substr(kFileScheme.size());
#endif
  base::FilePath new_path = GetExternalWPTFilePath().AppendASCII(path);
  return WebURL(net::FilePathToFileURL(new_path));
}

}  // namespace

namespace content {

void ExportWebTestSpecificPreferences(const TestPreferences& from,
                                      blink::web_pref::WebPreferences* to) {
  to->javascript_can_access_clipboard = from.java_script_can_access_clipboard;
  to->editing_behavior = from.editing_behavior;
  to->default_font_size = from.default_font_size;
  to->minimum_font_size = from.minimum_font_size;
  to->default_encoding = from.default_text_encoding_name.Utf8().data();
  to->javascript_enabled = from.java_script_enabled;
  to->supports_multiple_windows = from.supports_multiple_windows;
  to->loads_images_automatically = from.loads_images_automatically;
  to->plugins_enabled = from.plugins_enabled;
  to->tabs_to_links = from.tabs_to_links;
  // experimentalCSSRegionsEnabled is deprecated and ignored.
  to->hyperlink_auditing_enabled = from.hyperlink_auditing_enabled;
  to->allow_running_insecure_content = from.allow_running_of_insecure_content;
  to->allow_file_access_from_file_urls = from.allow_file_access_from_file_urls;
  to->web_security_enabled = from.web_security_enabled;
  to->disable_reading_from_canvas = from.disable_reading_from_canvas;
  to->strict_mixed_content_checking = from.strict_mixed_content_checking;
  to->strict_powerful_feature_restrictions =
      from.strict_powerful_feature_restrictions;
  to->spatial_navigation_enabled = from.spatial_navigation_enabled;
}

static base::FilePath GetBuildDirectory() {
#if BUILDFLAG(IS_MAC)
  if (base::mac::AmIBundled()) {
    // If this is a bundled Content Shell.app, go up one from the outer bundle
    // directory.
    return base::mac::OuterBundlePath().DirName();
  }
#endif

  base::FilePath result;
  bool success = base::PathService::Get(base::DIR_EXE, &result);
  CHECK(success);

  return result;
}

WebURL RewriteWebTestsURL(base::StringPiece utf8_url, bool is_wpt_mode) {
  if (is_wpt_mode)
    return RewriteWPTAbsolutePath(utf8_url);

  static constexpr base::StringPiece kGenPrefix = "file:///gen/";

  // Map "file:///gen/" to "file://<build directory>/gen/".
  if (base::StartsWith(utf8_url, kGenPrefix, base::CompareCase::SENSITIVE)) {
    base::FilePath gen_directory_path =
        GetBuildDirectory().Append(FILE_PATH_LITERAL("gen/"));
    std::string new_url("file://");
    new_url.append(gen_directory_path.AsUTF8Unsafe());
    new_url.append(utf8_url.substr(kGenPrefix.size()).data());
    return WebURL(GURL(new_url));
  }

  static constexpr base::StringPiece kPrefix = "file:///tmp/web_tests/";

  if (!base::StartsWith(utf8_url, kPrefix, base::CompareCase::SENSITIVE))
    return WebURL(GURL(utf8_url));

  std::string new_url("file://");
  new_url.append(GetWebTestsFilePath().AsUTF8Unsafe());
  new_url.append(utf8_url.substr(kPrefix.size()).data());
  return WebURL(GURL(new_url));
}

WebURL RewriteFileURLToLocalResource(base::StringPiece resource) {
  return RewriteWebTestsURL(resource, /*is_wpt_mode=*/false);
}

bool IsWebPlatformTest(base::StringPiece test_url) {
  // ://web-platform.test is a part of the http/https URL of a wpt test run by
  // the python script.
  return test_url.find("://web-platform.test") != std::string::npos ||
         // These are part of the file URL of a wpt test run manually with
         // content_shell without a web server.
         test_url.find("/external/wpt/") != std::string::npos ||
         test_url.find("/wpt_internal/") != std::string::npos;
}

}  // namespace content


text:
#ifndef KOALA_MOVEGEN
#define KOALA_MOVEGEN

#include "attackTables.hpp"
#include "Board.hpp"
#include "Move.hpp"
#include "PawnMoveGen.hpp"
#include "MakeMove.hpp"

class MoveGen {

public:
    MoveGen();
    void generateMoves(Board* board, MOVE* moves);

private:
    // Squares which must not be in check while castling
    const BB shortCastlingMask[2];
    const BB longCastlingMask[2];

    const PawnMoveGen pawnMoveGen = PawnMoveGen();
    void generatePseudoLegalMoves(Board* board, MOVE* moves);
    void generateKnightMoves(const Board* board, MOVE* &moves) const;
    void generateBishopMoves(const Board*, MOVE* &moves) const;
    void generateRookMoves(const Board*, MOVE* &moves) const;
    void generateQueenMoves(const Board*, MOVE* &moves) const;
    void generateKingMoves(const Board*, MOVE* &moves) const;

    void removeIllegalMoves(Board* board, MOVE* moves);

    FORCE_INLINE const bool areSquaresAttacked(const Board* board, BB enemyBB, BB targetBB) {
        int colorIndex = board->getColorToPlay();
        BB allPieces = board->allPieces();

        BB pawns = enemyBB & board->b.pawn;
        BB attacks = colorIndex == WHITE ?
                ((pawns << 7) & ~FILE_H) | ((pawns << 9) & ~FILE_A) :
                ((pawns >> 7) & ~FILE_A) | ((pawns >> 9) & ~FILE_H);

        if (attacks & targetBB) return true;

        BB occupancy;
        BB magicNumber;
        int attackerSq;
        BB attackerBB = enemyBB & board->b.queen;
        while (attackerBB) {
            attackerSq = CTZ(attackerBB);
            occupancy = allPieces & rookMagics[attackerSq].mask;
            magicNumber = rookMagics[attackerSq].magic;
            attacks |= rookAttacksMap[((occupancy * magicNumber) >> rookMagics[attackerSq].shift) + rookMagics[attackerSq].offset];
            occupancy = allPieces & bishopMagics[attackerSq].mask;
            magicNumber = bishopMagics[attackerSq].magic;
            attacks |= bishopAttacksMap[((occupancy * magicNumber) >> bishopMagics[attackerSq].shift) + bishopMagics[attackerSq].offset];

            CLEAR_LSB(attackerBB)
        }
        if (attacks & targetBB) return true;

        attackerBB = enemyBB & board->b.rook;
        while (attackerBB) {
            attackerSq = CTZ(attackerBB);
            occupancy = allPieces & rookMagics[attackerSq].mask;
            magicNumber = rookMagics[attackerSq].magic;
            attacks |= rookAttacksMap[((occupancy * magicNumber) >> rookMagics[attackerSq].shift) + rookMagics[attackerSq].offset];
            CLEAR_LSB(attackerBB)
        }
        if (attacks & targetBB) return true;

        attackerBB = enemyBB & board->b.bishop;
        while (attackerBB) {
            attackerSq = CTZ(attackerBB);
            occupancy = allPieces & bishopMagics[attackerSq].mask;
            magicNumber = bishopMagics[attackerSq].magic;
            attacks |= bishopAttacksMap[((occupancy * magicNumber) >> bishopMagics[attackerSq].shift) + bishopMagics[attackerSq].offset];
            CLEAR_LSB(attackerBB)
        }
        if (attacks & targetBB) return true;

        attackerBB = enemyBB & board->b.knight;
        while (attackerBB) {
            attackerSq = CTZ(attackerBB);
            attacks |= knightAttacksMap[attackerSq];
            CLEAR_LSB(attackerBB)
        }
        if (attacks & targetBB) return true;

        return (kingAttacksMap[CTZ(enemyBB & board->b.king)] & targetBB);
    }
};

#endif

redpajama_set_name: RedPajamaGithub


text:
//This is a dummy file used by driver-parser during compilation.
//Without this file, compatibility will be broken among ASICs and  BIOs vs. driver
//James H. Apr. 22/03


text:
// This class has been generated, DO NOT EDIT!

package org.tensorflow.op.math;

import java.util.Arrays;
import org.tensorflow.GraphOperation;
import org.tensorflow.Operand;
import org.tensorflow.Operation;
import org.tensorflow.OperationBuilder;
import org.tensorflow.Output;
import org.tensorflow.op.RawOp;
import org.tensorflow.op.RawOpInputs;
import org.tensorflow.op.Scope;
import org.tensorflow.op.annotation.Endpoint;
import org.tensorflow.op.annotation.OpInputsMetadata;
import org.tensorflow.op.annotation.OpMetadata;
import org.tensorflow.op.annotation.Operator;
import org.tensorflow.proto.framework.DataType;
import org.tensorflow.types.family.TType;

/**
 * Computes the power of one value to another.
 * Given a tensor {@code x} and a tensor {@code y}, this operation computes \(x^y\) for
 * corresponding elements in {@code x} and {@code y}. For example:
 * <pre>
 * # tensor 'x' is [[2, 2]], [3, 3]]
 * # tensor 'y' is [[8, 16], [2, 3]]
 * tf.pow(x, y) ==> [[256, 65536], [9, 27]]
 * </pre>
 *
 * @param <T> data type for {@code z} output
 */
@OpMetadata(
    opType = Pow.OP_NAME,
    inputsClass = Pow.Inputs.class
)
@Operator(
    group = "math"
)
public final class Pow<T extends TType> extends RawOp implements Operand<T> {
  /**
   * The name of this op, as known by TensorFlow core engine
   */
  public static final String OP_NAME = "Pow";

  private Output<T> z;

  public Pow(Operation operation) {
    super(operation, OP_NAME);
    int outputIdx = 0;
    z = operation.output(outputIdx++);
  }

  /**
   * Factory method to create a class wrapping a new Pow operation.
   *
   * @param scope current scope
   * @param x The x value
   * @param y The y value
   * @param <T> data type for {@code Pow} output and operands
   * @return a new instance of Pow
   */
  @Endpoint(
      describeByClass = true
  )
  public static <T extends TType> Pow<T> create(Scope scope, Operand<T> x, Operand<T> y) {
    OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Pow");
    opBuilder.addInput(x.asOutput());
    opBuilder.addInput(y.asOutput());
    return new Pow<>(opBuilder.build());
  }

  /**
   * Gets z.
   *
   * @return z.
   */
  public Output<T> z() {
    return z;
  }

  @Override
  public Output<T> asOutput() {
    return z;
  }

  @OpInputsMetadata(
      outputsClass = Pow.class
  )
  public static class Inputs<T extends TType> extends RawOpInputs<Pow<T>> {
    /**
     * The x input
     */
    public final Operand<T> x;

    /**
     * The y input
     */
    public final Operand<T> y;

    /**
     * The T attribute
     */
    public final DataType T;

    public Inputs(GraphOperation op) {
      super(new Pow<>(op), op, Arrays.asList("T"));
      int inputIndex = 0;
      x = (Operand<T>) op.input(inputIndex++);
      y = (Operand<T>) op.input(inputIndex++);
      T = op.attributes().getAttrType("T");
    }
  }
}


text:
module.exports = function(grunt){
	'use strict';

	/** Global Variables and Libraries **/
	var env = process.env.NODE_ENV || 'dev';
  var _ = require('lodash');

  require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});

  /** Load Task Configuration Files **/
	var configFiles = grunt.file.expand({ filter: "isFile" }, ['./Tasks/*.config.js']);
	grunt.log.writeln('Gathering Task config files:'.underline.green);

  var configArray = configFiles.map(function(taskConfigFile){
  	grunt.log.writeln('  => importing : ' + taskConfigFile.underline.cyan);
    return require(taskConfigFile)(grunt, env);
  });

  var packageJSON = grunt.file.readJSON('package.json');
  delete packageJSON.devDependencies;

  var mainConfig = {
    packageConfig: packageJSON
  };

  var defaultTasks = ['clean:All', 'jshint:self'];
  packageJSON.tasks.forEach(function(Item) {
    defaultTasks.push(Item);
  });

  configArray.forEach(function(configElement){ mainConfig = _.merge(mainConfig, configElement); });

  grunt.initConfig(mainConfig);

  /** Load Task Registrations **/
  var taskFiles = grunt.file.expand({ filter: "isFile" }, ['./Tasks/*.task.js']);
  grunt.log.writeln('Gathering Task registration files:'.underline.green);

	taskFiles.forEach(function(taskRegFile){
  	grunt.log.writeln('  => registering : ' + taskRegFile.underline.cyan);
    return require(taskRegFile)(grunt);
  });

  /** Default and Main Tasks **/
  grunt.registerTask('default', defaultTasks);

  /** Debug Task Files **/
  grunt.registerTask('debug:config', 'Debug imported configuration', function() {
    grunt.log.subhead('* Imported Configuration : *');
    grunt.log.writeln(JSON.stringify(mainConfig, undefined, 2));
  });
};


text:
package cn.felord.wepay.ali.sdk.api.response;

import cn.felord.wepay.ali.sdk.api.AlipayResponse;

/**
 * ALIPAY API: alipay.marketing.cdp.advertise.modify response.
 *
 * @author auto create
 * @version $Id: $Id
 */
public class AlipayMarketingCdpAdvertiseModifyResponse extends AlipayResponse {

	private static final long serialVersionUID = 2852432789973114413L;

}


text:
package net.drewke.tdme.utils;

import java.util.Arrays;

/**
 * Mutable string
 * @author Andreas Drewke
 * @version $Id$
 */
public final class MutableString {

	private char[] data;
	private int length;
	private int hash;

	/**
	 * Public default constructor
	 */
	public MutableString() {
		this.data = new char[64];
		this.length = 0;
		this.hash = 0;
	}

	/**
	 * Public constructor
	 */
	public MutableString(String s) {
		this.data = new char[64];
		this.length = 0;
		this.hash = 0;
		append(s);
	}

	/**
	 * Grow string backing array
	 */
	private void grow() {
		char[] dataNew = new char[data.length + 64];
		System.arraycopy(data, 0, dataNew, 0, length);
		data = dataNew;
	}

	/**
	 * @return length
	 */
	public int length() {
		return length;
	}

	/**
	 * Get char at index
	 * @param idx
	 * @return char
	 */
	public char charAt(int idx) {
		return data[idx];
	}

	/**
	 * Reset
	 */
	public MutableString reset() {
		Arrays.fill(data, '\0');
		length = 0;
		hash = 0;
		return this;
	}

	/**
	 * Set character
	 * @param c
	 * @return this mutable string
	 */
	public MutableString set(char c) {
		reset();
		append(c);
		return this;
	}

	/**
	 * Append character
	 * @param c
	 * @return this mutable string
	 */
	public MutableString append(char c) {
		if (length + 1 >= data.length) {
			grow();
		}
		data[length++] = c;
		hash = 0;
		return this;
	}

	/**
	 * Insert character c at idx
	 * @param c
	 * @return this mutable string
	 */
	public MutableString insert(int idx, char c) {
		if (length + 1 >= data.length) {
			grow();
		}
		System.arraycopy(data, idx, data, idx + 1, length - idx);
		data[idx] = c;
		length++;
		hash = 0;
		return this;
	}

	/**
	 * Set string
	 * @param s
	 * @return this mutable string
	 */
	public MutableString set(String s) {
		reset();
		append(s);
		return this;
	}

	/**
	 * Append string
	 * @param s
	 * @return this mutable string
	 */
	public MutableString append(String s) {
		for (int i = 0; i < s.length(); i++) {
			append(s.charAt(i));
		}
		return this;
	}

	/**
	 * Insert string at idx
	 * @param c
	 * @return this mutable string
	 */
	public MutableString insert(int idx, String s) {
		for (int i = 0; i < s.length(); i++) {
			insert(idx + i, s.charAt(i));
		}
		return this;
	}

	/**
	 * Set mutable string
	 * @param s
	 * @return this mutable string
	 */
	public MutableString set(MutableString s) {
		reset();
		append(s);
		return this;
	}

	/**
	 * Append mutable string
	 * @param s
	 * @return this mutable string
	 */
	public MutableString append(MutableString s) {
		for (int i = 0; i < s.length(); i++) {
			append(s.charAt(i));
		}
		return this;
	}

	/**
	 * Insert mutable string at idx
	 * @param c
	 * @return this mutable string
	 */
	public MutableString insert(int idx, MutableString s) {
		for (int i = 0; i < s.length(); i++) {
			insert(idx + i, s.charAt(i));
		}
		return this;
	}

	/**
	 * Set integer
	 * @param i
	 * @return this mutable string
	 */
	public MutableString set(int i) {
		reset();
		append(i);
		return this;
	}

	/**
	 * Append integer
	 * @see http://stackoverflow.com/questions/7123490/how-compiler-is-converting-integer-to-string-and-vice-versa
	 * @param i
	 * @return this mutable string
	 */
	public MutableString append(int i) {
		insert(length, i);
		return this;
	}

	/**
	 * Insert integer at idx
	 * @see http://stackoverflow.com/questions/7123490/how-compiler-is-converting-integer-to-string-and-vice-versa
	 * @param i
	 * @return this mutable string
	 */
	public MutableString insert(int idx, int i) {
		boolean negative = false;
		if (i < 0) {
			negative = true;
			i = -i;
		}
		while (true == true) {
			int remainder = i % 10;
			i = i / 10;
			insert(idx, (char)('0' + remainder));
			if (i == 0) {
				break;
			}
		}
		if (negative == true) {
			insert(idx, '-');
		}
		return this;
	}

	/**
	 * Set float
	 * @param f
	 * @param decimals
	 * @return this mutable string
	 */
	public MutableString set(float f, int decimals) {
		reset();
		append(f, decimals);
		return this;
	}

	/**
	 * Append float with given decimals
	 * @see http://stackoverflow.com/questions/7123490/how-compiler-is-converting-integer-to-string-and-vice-versa
	 * @param f
	 * @param decimals
	 * @return this mutable string
	 */
	public MutableString append(float f, int decimals) {
		insert(length, f, decimals);
		return this;
	}

	/**
	 * Insert float at idx
	 * @see http://stackoverflow.com/questions/7123490/how-compiler-is-converting-integer-to-string-and-vice-versa
	 * @param i
	 * @return this mutable string
	 */
	public MutableString insert(int idx, float f, int decimals) {
		int integer = (int)f;
		int integerDecimals = (int)((f - integer) * Math.pow(10f, decimals));
		if (integerDecimals < 0f) integerDecimals = -integerDecimals;
		for (int i = 0; i < decimals; i++) {
			int integerDecimal = (int)((f - integer) * Math.pow(10f, i + 1)) - (10 * (int)((f - integer) * Math.pow(10f, i)));
			insert(idx+i, integerDecimal);
		}
		insert(idx, '.');
		insert(idx, integer);
		return this;
	}

	/**
	 * Delete characters at idx with given length
	 * @param idx
	 * @param length
	 * @return this mutable string
	 */
	public MutableString delete(int idx, int count) {
		if (count + idx > length) return this;
		System.arraycopy(data, idx + count, data, idx, length - count - idx);
		length-= count;
		hash = 0;
		return this;
	}

	/**
	 * Returns the character index where string s have been found or -1 if not found
	 * @param string
	 * @param index
	 * @return index where string has been found or -1
	 */
	public int indexOf(MutableString s, int idx) {
		for (int i = idx; i < length; i++) {
			boolean found = true;
			for (int j = 0; j < s.length; j++) {
				if (i + j >= length) {
					found = false;
					break;
				};
				if (data[i + j] != s.data[j]) {
					found = false;
					break;
				}
			}
			if (found == true) {
				return i;
			}
		}

		// not found
		return -1;
	}

	/**
	 * Returns the character index where string s have been found or -1 if not found
	 * @param string
	 * @return index where string has been found or -1
	 */
	public int indexOf(MutableString s) {
		return indexOf(s, 0);
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		int h = hash;
		if (h == 0 && length > 0) {
			for (int i = 0; i < length; i++) {
				h = 31 * h + data[i];
			}
			hash = h;
		}
		return h;
	}

	/**
	 * Equals
	 * @param string 2
	 * @return string 2 equals this string
	 */
	public boolean equals(String s2) {
		if (length != s2.length()) return false;
		for (int i = 0; i < length; i++) {
			if (data[i] != s2.charAt(i)) return false;
		}
		return true;
	}

	/**
	 * Equals
	 * @param string 2
	 * @return string 2 equals this string
	 */
	public boolean equals(MutableString s2) {
		if (this == s2) return true;
		if (length != s2.length) return false;
		for (int i = 0; i < length; i++) {
			if (data[i] != s2.data[i]) return false;
		}
		return true;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new String(data, 0, length);
	}

}


text:
//
//  MJRefreshAutoNormalFooter.h
//  MJRefreshExample
//
//  Created by MJ Lee on 15/4/24.
//  Copyright (c) 2015年 小码哥. All rights reserved.
//

#import "MJRefreshAutoStateFooter.h"

@interface MJRefreshAutoNormalFooter : MJRefreshAutoStateFooter
/** 菊花的样式 */
@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
@end


text:
{% extends "base.html" %}
{% load static %}
{% load markdown %}

{% block title %}{{ product.name }} Course Dashboard - {{ block.super }}{% endblock %}

{% block analytics %}
analytics.page("{{ product.name }} Course Dashboard");
{% endblock %}

{% block bodyclass %}

{% endblock %}

{% block content %}

Dashboard

{{ product.name }} Course

            <button class="h4 m-b-md" onclick="w3_toggle()" style="color:#498D90; padding:0">☰</button>

            {% if next_link %}
            {{ next_name }} →
            {% endif %}

{% if membership.video %}Videos / {% endif %}Content

            {% for module, chapters in course.items %}
            {% if module == "Video Extras" and not membership.video %}

            {% else %}

{{ module }}

                {% for k, v in chapters.items %}

                    {% if v.name == course_name %}
                        {{ v.name }}
                    {% else %}

                        {% if v.video %}{% if membership.video or '322468325' in v.video or '125105042' in v.video or '322480097' in v.video or '322480267' in v.video %} {% endif %}{% endif %}{{ v.name }}

                    {% endif %}

                {% endfor %}

            {% endif %}
            {% endfor %}

Updates

                    Changes and updates

Download Files

                {% include 'dashboard/course/_course_files.html' with product_name=product.name %}

{{ course_name }}

                    {% if next_link %}
                    {{ next_name }} →
                    Next →
                    {% endif %}

            {% if video_url %}
            {% if membership.video or '322468325' in video_url or '125105042' in video_url or '322480097' in video_url or '322480267' in video_url %}

                {% if not membership.video %}

                    Preview of the videos contained in this package.
                        {% if product.name == "Hello Web App" %}

                        {% else %}

                        {% endif %}
                            Upgrade here if you'd like to add them to your account
                        .

                {% endif %}

            {% endif %}
            {% endif %}

                    {% filter markdown %}
{% include course_template %}
                    {% endfilter %}

                    {% if video_url  or product.name == "Really Friendly Command Line Intro" %}
                    {% if 'Updates' not in course_name %}

                        {% include 'includes/course-prev-next.html' %}

                        {% include 'includes/course-prev-next.html' %}

Questions or comments on this section?

                    {% if product == "Hello Web App" %}

Feel free to post

                    {% else %}
                    Please use the comment form below to ask questions or get help.
                    {% endif %}

                    Please enable JavaScript to view the comments powered by Disqus.
                    {% endif %}{% endif %}

                {% include 'includes/course-prev-next.html' %}

{% endblock content %}

{% block scripts %}
<link rel="stylesheet" href="{% static '/css/tomorrow.css' %}">

{% endblock %}


text:
#include <gtest/gtest.h>
#include <yoga/Yoga.h>
#include <yoga/event/event.h>
#include <yoga/YGNode.h>
#include <yoga/testutil/testutil.h>

#include <algorithm>
#include <functional>
#include <memory>
#include <vector>
#include <yoga/YGEnums.h>

namespace facebook {
namespace yoga {
namespace test {

template <Event::Type E>
struct TypedEventTestData {};

template <>
struct TypedEventTestData<Event::LayoutPassEnd> {
  void* layoutContext;
  LayoutData layoutData;
};

struct EventArgs {
  const YGNode* node;
  Event::Type type;
  std::unique_ptr<void, std::function<void(void*)>> dataPtr;
  std::unique_ptr<void, std::function<void(void*)>> eventTestDataPtr;

  template <Event::Type E>
  const Event::TypedData<E>& data() {
    return *static_cast<Event::TypedData<E>*>(dataPtr.get());
  }

  template <Event::Type E>
  const TypedEventTestData<E>& eventTestData() {
    return *static_cast<TypedEventTestData<E>*>(eventTestDataPtr.get());
  }
};

class EventTest : public ::testing::Test {
  ScopedEventSubscription subscription = {&EventTest::listen};
  static void listen(const YGNode&, Event::Type, Event::Data);

public:
  static std::vector<EventArgs> events;
  static EventArgs& lastEvent() { return events.back(); }
  void TearDown() override;
};

TEST_F(EventTest, new_node_has_event) {
  auto c = YGConfigGetDefault();
  auto n = YGNodeNew();

  ASSERT_EQ(lastEvent().node, n);
  ASSERT_EQ(lastEvent().type, Event::NodeAllocation);
  ASSERT_EQ(lastEvent().data<Event::NodeAllocation>().config, c);

  YGNodeFree(n);
}

TEST_F(EventTest, new_node_with_config_event) {
  auto c = YGConfigNew();
  auto n = YGNodeNewWithConfig(c);

  ASSERT_EQ(lastEvent().node, n);
  ASSERT_EQ(lastEvent().type, Event::NodeAllocation);
  ASSERT_EQ(lastEvent().data<Event::NodeAllocation>().config, c);

  YGNodeFree(n);
  YGConfigFree(c);
}

TEST_F(EventTest, clone_node_event) {
  auto c = YGConfigNew();
  auto n = YGNodeNewWithConfig(c);
  auto clone = YGNodeClone(n);

  ASSERT_EQ(lastEvent().node, clone);
  ASSERT_EQ(lastEvent().type, Event::NodeAllocation);
  ASSERT_EQ(lastEvent().data<Event::NodeAllocation>().config, c);

  YGNodeFree(n);
  YGNodeFree(clone);
  YGConfigFree(c);
}

TEST_F(EventTest, free_node_event) {
  auto c = YGConfigNew();
  auto n = YGNodeNewWithConfig(c);
  YGNodeFree(n);

  ASSERT_EQ(lastEvent().node, n);
  ASSERT_EQ(lastEvent().type, Event::NodeDeallocation);
  ASSERT_EQ(lastEvent().data<Event::NodeDeallocation>().config, c);

  YGConfigFree(c);
}

TEST_F(EventTest, layout_events) {
  auto root = YGNodeNew();
  auto child = YGNodeNew();
  YGNodeInsertChild(root, child, 0);

  YGNodeCalculateLayout(root, 123, 456, YGDirectionLTR);

  ASSERT_EQ(events[2].node, root);
  ASSERT_EQ(events[2].type, Event::LayoutPassStart);

  ASSERT_EQ(events[3].node, child);
  ASSERT_EQ(events[3].type, Event::NodeLayout);

  ASSERT_EQ(events[4].node, child);
  ASSERT_EQ(events[4].type, Event::NodeLayout);

  ASSERT_EQ(events[5].node, child);
  ASSERT_EQ(events[5].type, Event::NodeLayout);

  ASSERT_EQ(events[6].node, root);
  ASSERT_EQ(events[6].type, Event::NodeLayout);

  ASSERT_EQ(events[7].node, root);
  ASSERT_EQ(events[7].type, Event::LayoutPassEnd);

  YGNodeFreeRecursive(root);
}

TEST_F(EventTest, layout_events_single_node) {
  auto root = YGNodeNew();
  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(events[1].node, root);
  ASSERT_EQ(events[1].type, Event::LayoutPassStart);

  ASSERT_EQ(events[2].node, root);
  ASSERT_EQ(events[2].type, Event::NodeLayout);

  ASSERT_EQ(events[3].node, root);
  ASSERT_EQ(events[3].type, Event::LayoutPassEnd);

  LayoutData layoutData =
      events[3].eventTestData<Event::LayoutPassEnd>().layoutData;

  ASSERT_EQ(layoutData.layouts, 1);
  ASSERT_EQ(layoutData.measures, 0);
  ASSERT_EQ(layoutData.maxMeasureCache, 1);
}

TEST_F(EventTest, layout_events_counts_multi_node_layout) {
  auto root = YGNodeNew();
  auto childA = YGNodeNew();
  YGNodeInsertChild(root, childA, 0);
  auto childB = YGNodeNew();
  YGNodeInsertChild(root, childB, 1);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(events[3].node, root);
  ASSERT_EQ(events[3].type, Event::LayoutPassStart);

  ASSERT_EQ(events[11].node, root);
  ASSERT_EQ(events[11].type, Event::LayoutPassEnd);

  LayoutData layoutData =
      events[11].eventTestData<Event::LayoutPassEnd>().layoutData;

  ASSERT_EQ(layoutData.layouts, 3);
  ASSERT_EQ(layoutData.measures, 4);
  ASSERT_EQ(layoutData.maxMeasureCache, 3);
}

TEST_F(EventTest, layout_events_counts_cache_hits_single_node_layout) {
  auto root = YGNodeNew();

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(events[4].node, root);
  ASSERT_EQ(events[4].type, Event::LayoutPassStart);

  ASSERT_EQ(events[6].node, root);
  ASSERT_EQ(events[6].type, Event::LayoutPassEnd);

  LayoutData layoutData =
      events[6].eventTestData<Event::LayoutPassEnd>().layoutData;

  ASSERT_EQ(layoutData.layouts, 0);
  ASSERT_EQ(layoutData.measures, 0);
  ASSERT_EQ(layoutData.cachedLayouts, 1);
  ASSERT_EQ(layoutData.cachedMeasures, 0);
}

TEST_F(EventTest, layout_events_counts_cache_hits_multi_node_layout) {
  auto root = YGNodeNew();
  auto childA = YGNodeNew();
  YGNodeInsertChild(root, childA, 0);
  auto childB = YGNodeNew();
  YGNodeInsertChild(root, childB, 1);

  YGNodeCalculateLayout(root, 987, 654, YGDirectionLTR);
  YGNodeCalculateLayout(root, 123, 456, YGDirectionLTR);

  YGNodeCalculateLayout(root, 987, 654, YGDirectionLTR);

  ASSERT_EQ(lastEvent().node, root);
  ASSERT_EQ(lastEvent().type, Event::LayoutPassEnd);

  LayoutData layoutData =
      lastEvent().eventTestData<Event::LayoutPassEnd>().layoutData;

  ASSERT_EQ(layoutData.layouts, 3);
  ASSERT_EQ(layoutData.measures, 0);
  ASSERT_EQ(layoutData.maxMeasureCache, 5);
  ASSERT_EQ(layoutData.cachedLayouts, 0);
  ASSERT_EQ(layoutData.cachedMeasures, 4);
}

TEST_F(EventTest, layout_events_has_max_measure_cache) {
  auto root = YGNodeNew();
  auto a = YGNodeNew();
  YGNodeInsertChild(root, a, 0);
  auto b = YGNodeNew();
  YGNodeInsertChild(root, b, 1);
  YGNodeStyleSetFlexBasis(a, 10.0f);

  for (auto s : {20, 30, 40}) {
    YGNodeCalculateLayout(root, s, s, YGDirectionLTR);
  }

  ASSERT_EQ(lastEvent().node, root);
  ASSERT_EQ(lastEvent().type, Event::LayoutPassEnd);

  LayoutData layoutData =
      lastEvent().eventTestData<Event::LayoutPassEnd>().layoutData;

  ASSERT_EQ(layoutData.layouts, 3);
  ASSERT_EQ(layoutData.measures, 3);
  ASSERT_EQ(layoutData.maxMeasureCache, 7);
}

TEST_F(EventTest, measure_functions_get_wrapped) {
  auto root = YGNodeNew();
  YGNodeSetMeasureFunc(
      root, [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode) {
        return YGSize{};
      });

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(events[2].node, root);
  ASSERT_EQ(events[2].type, Event::MeasureCallbackStart);

  ASSERT_EQ(events[events.size() - 1].node, root);
  ASSERT_EQ(events[events.size() - 1].type, Event::LayoutPassEnd);
}

TEST_F(EventTest, baseline_functions_get_wrapped) {
  auto root = YGNodeNew();
  auto child = YGNodeNew();
  YGNodeInsertChild(root, child, 0);

  YGNodeSetBaselineFunc(child, [](YGNodeRef, float, float) { return 0.0f; });
  YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
  YGNodeStyleSetAlignItems(root, YGAlignBaseline);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_EQ(events[5].node, child);
  ASSERT_EQ(events[5].type, Event::NodeBaselineStart);

  ASSERT_EQ(events[events.size() - 1].node, root);
  ASSERT_EQ(events[events.size() - 1].type, Event::LayoutPassEnd);
}

namespace {

template <Event::Type E>
EventArgs createArgs(const YGNode& node, const Event::Data data) {
  using Data = Event::TypedData<E>;
  auto deleteData = [](void* x) { delete static_cast<Data*>(x); };

  return {&node, E, {new Data{(data.get<E>())}, deleteData}};
}

template <Event::Type E>
EventArgs createArgs(
    const YGNode& node,
    const Event::Data data,
    TypedEventTestData<E> eventTestData) {
  using EventTestData = TypedEventTestData<E>;
  auto deleteEventTestData = [](void* x) {
    delete static_cast<EventTestData*>(x);
  };

  EventArgs args = createArgs<E>(node, data);
  args.eventTestDataPtr = {
      new EventTestData{eventTestData}, deleteEventTestData};
  return args;
}

} // namespace

void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
  switch (type) {
    case Event::NodeAllocation:
      events.push_back(createArgs<Event::NodeAllocation>(node, data));
      break;
    case Event::NodeDeallocation:
      events.push_back(createArgs<Event::NodeDeallocation>(node, data));
      break;
    case Event::NodeLayout:
      events.push_back(createArgs<Event::NodeLayout>(node, data));
      break;
    case Event::LayoutPassStart:
      events.push_back(createArgs<Event::LayoutPassStart>(node, data));
      break;
    case Event::LayoutPassEnd: {
      auto& eventData = data.get<Event::LayoutPassEnd>();
      events.push_back(createArgs<Event::LayoutPassEnd>(
          node, data, {eventData.layoutContext, *eventData.layoutData}));
      break;
    }

    case Event::MeasureCallbackStart:
      events.push_back(createArgs<Event::MeasureCallbackStart>(node, data));
      break;
    case Event::MeasureCallbackEnd:
      events.push_back(createArgs<Event::MeasureCallbackEnd>(node, data));
      break;
    case Event::NodeBaselineStart:
      events.push_back(createArgs<Event::NodeBaselineStart>(node, data));
      break;
    case Event::NodeBaselineEnd:
      events.push_back(createArgs<Event::NodeBaselineEnd>(node, data));
      break;
  }
}

void EventTest::TearDown() {
  events.clear();
}

std::vector<EventArgs> EventTest::events{};

} // namespace test
} // namespace yoga
} // namespace facebook


text:
var days = []
for (var i = 0; i < 180; i++) {
	days.push(i)
}
var days = days.map(function(e) {
	var day = new Date(Date.now()-e*1000*60*60*24)
	return day.toDateString()
})

angular.module('mainCtrl', ["chart.js"])

.controller('mainController', function($rootScope, $scope, $location, Auth, $http, $routeParams) {

	$http({
		method: 'GET',
		url: '/api/strava_data'
	}).then(function(data) {
		console.log('inside data control')
		// console.log(data)
		console.log($routeParams['q'])
		var colors = ['#fc4c02']
	if (!$routeParams['q']) {
		$scope.age = data.data[data.data.length-1].age
		$scope.data = data.data.map(function(e) {return e.age})
		$scope.series = 'Age'
		$scope.title = 'Your Button Age'
	} else {
		$scope.data = [
			data.data.map(function(e) {return e.fitness}),
			data.data.map(function(e) {return e.fatigue}),
			data.data.map(function(e) {return e.form})
		].reverse()
		colors = ['rgba(0, 146, 190,.7)','rgba(254, 194, 71,.7)', 'rgba(252, 76,2,.7)']
		$scope.series = ['Fitness', 'Fatigue', 'Form']
		$scope.title = 'Fitness, Fatigue, and Form'
	}
  $scope.labels = days;

  $scope.onClick = function (points, evt) {
    console.log(points, evt);
  };
  console.log(colors)
  $scope.datasetOverride = colors.map(function(e) {
  			return {
					fill: true,
					type: 'line',
					lineTension: 0.1,
					fillColor: e,
					backgroundColor: e,
					borderColor: e,
					fillOpacity: 0.5,
					borderDash: [],
					borderDashOffset: 0.0,
					pointBorderColor: "rgba(0,0,0,0)",
					pointBackgroundColor: "rgba(0,0,0,0)",
					pointHoverBackgroundColor: "rgba(0,0,0,0)",
					pointHoverBorderColor: "rgba(0,0,0,0)",
				}
			})
  $scope.datasetOverride.length===1 ? $scope.datasetOverride = $scope.datasetOverride[0] : null
  $scope.options = {
    scales: {
				xAxes: [{
					display: false,
				}],
				yAxes: [{
					display: false,
				}]
			}
  }
  })

	var vm = this;

	// get info if a person is logged in
	vm.loggedIn = Auth.isLoggedIn();
	vm.isStrava = Auth.isStrava();

	// check to see if a user is logged in on every request
	$rootScope.$on('$routeChangeStart', function() {
		vm.loggedIn = Auth.isLoggedIn();

		// get user information on page load
		Auth.getUser()
			.then(function(data) {
				vm.user = data.data;
			});
	});

	// function to handle login form
	vm.doLogin = function() {
		vm.processing = true;

		// clear the error
		vm.error = '';

		Auth.login(vm.loginData.email, vm.loginData.password)
			.success(function(data) {
				vm.processing = false;

				// if a user successfully logs in, redirect to users page
				if (data.success)
					$location.path('/');
				else
					vm.error = data.message;

			});
	};

	// function to handle logging out
	vm.doLogout = function() {
		Auth.logout();
		vm.user = '';

		$location.path('/login');
	};

});


text:
import logging

import pandas as pd
import numpy as np

from kitchensink.clients.http import Client
from kitchensink.data import RemoteData
from kitchensink import settings

settings.setup_client("http://localhost:6323/")
c = Client(settings.rpc_url)
c.reducetree("memoize*")

def add(x, y):
    return x + y
add.ks_memoize = True

c.bc(add, 1, 2)
c.execute()
c.br()

c.bc(add, 1, 2)
c.execute()
c.br()

c.bc(add, 1, 2)
c.execute()
c.br()


text:
namespace CGAL {

// This one is to show the edges of a 3D triangulation.
template < class GT, class TDS >
void
show_triangulation_edges(Geomview_stream &gv, const Triangulation_3<GT,TDS> &T)
{
  // Header.
  gv.set_ascii_mode();
  gv << "(geometry " << gv.get_new_id("triangulationedge")
     << " {appearance {}{ SKEL \n"
     << T.number_of_vertices() << T.number_of_finite_edges() << "\n";

  // Finite vertices coordinates.
  std::map<typename Triangulation_3<GT, TDS>::Vertex_handle, int> V;
  int inum = 0;
  for( typename Triangulation_3<GT, TDS>::Finite_vertices_iterator
      vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) {
    V[vit] = inum++;
    gv << vit->point() << "\n";
  }

  // Finite edges indices.
  for( typename Triangulation_3<GT, TDS>::Finite_edges_iterator
	  eit = T.finite_edges_begin(); eit != T.finite_edges_end(); ++eit) {
      gv << 2
         << V[(*eit).first->vertex((*eit).second)]
         << V[(*eit).first->vertex((*eit).third)]
         << "\n"; // without color.
      // << 4 << drand48() << drand48() << drand48() << 1.0; // random color.
  }
}

template < class GT, class TDS >
Geomview_stream&
operator<<( Geomview_stream &gv, const Triangulation_3<GT,TDS> &T)
{
    if (gv.get_wired()) {
        // We draw the edges.
        bool ascii_bak = gv.get_ascii_mode();
        bool raw_bak = gv.set_raw(true);

        show_triangulation_edges(gv, T);

        // Footer.
        gv << "}})";

        gv.set_raw(raw_bak);
        gv.set_ascii_mode(ascii_bak);
    }
    else {
        // We draw the facets.
        std::vector<typename GT::Triangle_3> triangles;

        for (typename Triangulation_3<GT, TDS>::Finite_facets_iterator
	     fit = T.finite_facets_begin(); fit != T.finite_facets_end();
	     ++fit)
            triangles.push_back(T.triangle(*fit));

        gv.draw_triangles(triangles.begin(), triangles.end());
    }
    return gv;
}

} //namespace CGAL

#endif // CGAL_IO_TRIANGULATION_GEOMVIEW_OSTREAM_3_H


text:
/* Generated SBE (Simple Binary Encoding) message codec */
package uk.co.real_logic.sbe.ir.generated;

import org.agrona.DirectBuffer;

@javax.annotation.Generated(value = {"uk.co.real_logic.sbe.ir.generated.MessageDecoder"})
@SuppressWarnings("all")
public interface MessageDecoder
{
    int sbeBlockLength();

    int sbeTemplateId();

    int sbeSchemaId();

    int sbeSchemaVersion();

    String sbeSemanticType();

    int offset();

    MessageDecoder wrap(DirectBuffer buffer, int offset, int actingBlockLength, int actingVersion);

    int encodedLength();
}


text:
var args = arguments[0] || {};

//Active icon displayed
var poslist = $.footer.getView('poslist');
poslist.image = "/images/icons/icon-pos-active.png";
Ti.App.Properties.setString('module', 'dealer_poslist');

/**Experiment**/
Ti.App.fireEvent("getSession", {session:Ti.App.Properties.getString("session")});
/**End**/

function goPosDetails(e){

	var roles = Ti.App.Properties.getString('roles');
	var param = {
        p_id: e.p_id,
    };
	var posdetail = Alloy.createController(roles + "_posdetail",param).getView();

    setWindowRelationship(posdetail);
};

function refreshPage(e){
	Ti.App.fireEvent('app:refreshPage');
}
///////////function////////////
var onSuccessCallback = function(e) {
	Ti.App.fireEvent('html:realDrawTable', {
		data: JSON.parse(e.data),
	});
};

var onErrorCallback = function(e) {
	alert('no cache or connection lost');
	// Handle your errors in here
};

if(!Ti.App.staff_poslist ){
	Ti.App.addEventListener("app:viewPosDetail", goPosDetails);
	Ti.App.staff_poslist = true;
}

$.poslistview.addEventListener('load', function(data) {

  	Ti.App.fireEvent('app:posListParam', {
		session: Ti.App.Properties.getString('session'),
		posUrl : Ti.API.GETPOS + Ti.App.Properties.getString('session'),
	});

});

$.dealer_poslist.addEventListener('close', function(e){				// when this window close, trigger this event to remove the event.
	Ti.App.removeEventListener('app:viewPosDetail',goPosDetails);
});

$.dealer_poslist.addEventListener('androidback', function(e){				// when this window close, trigger this event to remove the event.
	Ti.App.removeEventListener('app:viewPosDetail',goPosDetails);
});

$.rightNav.addEventListener("touchstart", function(e){
	this.setBackgroundColor("#fff");
	this.setColor("#e02222");
});

$.rightNav.addEventListener("touchend", function(e){
	this.setBackgroundColor("transparent");
	this.setColor("#fff");
});


text:
package org.knowm.xchange.examples.anx.v2.account;

import java.io.IOException;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.dto.account.AccountInfo;
import org.knowm.xchange.examples.anx.v2.ANXExamplesUtils;
import org.knowm.xchange.service.polling.account.PollingAccountService;

/**
 * Demo requesting account info at ANX
 */
public class AccountInfoDemo {

  public static void main(String[] args) throws IOException {

    Exchange anx = ANXExamplesUtils.createExchange();

    // Interested in the private account functionality (authentication)
    PollingAccountService accountService = anx.getPollingAccountService();

    // Get the account information
    AccountInfo accountInfo = accountService.getAccountInfo();

    System.out.println("Wallet as String: " + accountInfo.toString());
  }
}


text:
<?php

namespace Intellias\TestBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ProjectType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('description')
            ->add('active')
            ->add('users', null, array(
                'attr' => array('data-native-menu' => 0)
            ));
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Intellias\TestBundle\Entity\Project'
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'intellias_testbundle_project';
    }

}


text:
#import "IDEViewController.h"

#import "IDEBotIssueSummaryTableRowViewDelegate-Protocol.h"
#import "NSOutlineViewDataSource-Protocol.h"
#import "NSOutlineViewDelegate-Protocol.h"
#import "NSTextViewDelegate-Protocol.h"

@class DVTAutoExpandingScrollView, DVTNotificationToken, DVTObservingToken, DVTOutlineView, IDEBotSupportingDocument, IDEEditor, NSArray, NSButton, NSTextView, NSView;

@interface IDEBotIssueSummaryViewController : IDEViewController <NSOutlineViewDataSource, NSOutlineViewDelegate, NSTextViewDelegate, IDEBotIssueSummaryTableRowViewDelegate>
{
    DVTNotificationToken *_documentSizeUpdateToken;
    DVTObservingToken *_issueSummaryCollectionsUpdateToken;
    IDEEditor *_hostingEditor;
    IDEBotSupportingDocument *_botSupportingDocument;
    NSArray *_selectedIndexPaths;
    DVTAutoExpandingScrollView *_scrollView;
    DVTOutlineView *_outlineView;
    NSArray *_issueSummaryCollections;
    NSView *_titleHostView;
    NSButton *_jumpToLogButton;
    NSTextView *_errorTextView;
    NSView *_errorLabelHost;
}

+ (id)_statusLabelAttributes;
+ (BOOL)automaticallyNotifiesObserversOfSelectedIndexPaths;
@property __weak NSView *errorLabelHost; // @synthesize errorLabelHost=_errorLabelHost;
@property NSTextView *errorTextView; // @synthesize errorTextView=_errorTextView;
@property(retain) NSButton *jumpToLogButton; // @synthesize jumpToLogButton=_jumpToLogButton;
@property(retain) NSView *titleHostView; // @synthesize titleHostView=_titleHostView;
@property(copy) NSArray *issueSummaryCollections; // @synthesize issueSummaryCollections=_issueSummaryCollections;
@property(retain) DVTOutlineView *outlineView; // @synthesize outlineView=_outlineView;
@property(retain) DVTAutoExpandingScrollView *scrollView; // @synthesize scrollView=_scrollView;
@property(copy) NSArray *selectedIndexPaths; // @synthesize selectedIndexPaths=_selectedIndexPaths;
@property(retain, nonatomic) IDEBotSupportingDocument *botSupportingDocument; // @synthesize botSupportingDocument=_botSupportingDocument;
@property(retain, nonatomic) IDEEditor *hostingEditor; // @synthesize hostingEditor=_hostingEditor;
- (void).cxx_destruct;
- (id)subStatusStringForSubStatus:(unsigned long long)arg1;
- (void)textView:(id)arg1 doubleClickedOnCell:(id)arg2 inRect:(struct CGRect)arg3 atIndex:(unsigned long long)arg4;
- (void)textView:(id)arg1 clickedOnCell:(id)arg2 inRect:(struct CGRect)arg3 atIndex:(unsigned long long)arg4;
- (void)showCommitSheet:(id)arg1;
- (void)manageSchemes:(id)arg1;
- (void)showLogsTab:(id)arg1;
- (void)updateStatusErrorMessage:(int)arg1 subStatus:(unsigned long long)arg2;
- (id)showCommitSheetAttributedString;
- (id)manageSchemesAttributedString;
- (id)errorAttributedStringWithText:(id)arg1;
- (id)jumpToLogAttributedStringWithText:(id)arg1;
- (BOOL)outlineView:(id)arg1 doCommandBySelector:(SEL)arg2;
- (long long)separatorStyleForSummaryRowView:(id)arg1;
- (id)outlineView:(id)arg1 rowViewForItem:(id)arg2;
- (BOOL)outlineView:(id)arg1 shouldSelectItem:(id)arg2;
- (void)outlineViewSelectionDidChange:(id)arg1;
- (double)outlineView:(id)arg1 heightOfRowByItem:(id)arg2;
- (id)outlineView:(id)arg1 viewForTableColumn:(id)arg2 item:(id)arg3;
- (BOOL)outlineView:(id)arg1 isItemExpandable:(id)arg2;
- (id)outlineView:(id)arg1 objectValueForTableColumn:(id)arg2 byItem:(id)arg3;
- (id)outlineView:(id)arg1 child:(long long)arg2 ofItem:(id)arg3;
- (long long)outlineView:(id)arg1 numberOfChildrenOfItem:(id)arg2;
- (void)scrollIssueCategoryToVisible:(unsigned long long)arg1;
- (void)simpleOperationStatusDidChange:(int)arg1 subStatus:(unsigned long long)arg2;
- (void)outlineViewDoubleClickAction:(id)arg1;
- (void)primitiveInvalidate;
- (void)loadView;

@end


text:
package com.planet_ink.coffee_mud.Abilities.Druid;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class Chant_RefreshRunes extends Chant
{

	@Override
	public String ID()
	{
		return "Chant_RefreshRunes";
	}

	private final static String localizedName = CMLib.lang().L("Refresh Runes");

	@Override
	public String name()
	{
		return localizedName;
	}

	@Override
	public int overrideMana()
	{
		return 50;
	}

	@Override
	protected int canTargetCode()
	{
		return CAN_ITEMS;
	}

	@Override
	public int classificationCode()
	{
		return Ability.ACODE_CHANT|Ability.DOMAIN_PRESERVING;
	}

	@Override
	public int abstractQuality()
	{
		return Ability.QUALITY_INDIFFERENT;
	}

	@Override
	public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel)
	{
		final Item target=getTarget(mob,null,givenTarget,commands,Wearable.FILTER_ANY);
		if(target==null)
			return false;

		if((!(target instanceof Scroll))
		||(!(target instanceof MiscMagic)))
		{
			mob.tell(L("You can't refresh that."));
			return false;
		}

		if(((Scroll)target).usesRemaining()>((Scroll)target).getSpells().size())
		{
			mob.tell(L("That scroll can not be refreshed any further."));
			return false;
		}

		if(((Scroll)target).getSpells().size()==0)
		{
			mob.tell(L("That scroll has nothing on it to refresh."));
			return false;
		}
		boolean divine=false;
		for(final Ability A : ((Scroll)target).getSpells())
		{
			if((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_CHANT)
				divine=true;
		}
		if(!divine)
		{
			mob.tell(L("The runes on this scroll cannot be refreshed by this chant."));
			return false;
		}

		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		final boolean success=proficiencyCheck(mob,0,auto);

		if(success)
		{
			final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),L(auto?"<T-NAME> appear(s) refreshed!":"^S<S-NAME> chant(s), refreshing <T-NAMESELF>.^?"));
			if(mob.location().okMessage(mob,msg))
			{
				mob.location().send(mob,msg);
				mob.location().show(mob,target,CMMsg.MSG_OK_VISUAL,L("The runic markings on <T-NAME> become more definite!"));
				((Scroll)target).setUsesRemaining(((Scroll)target).usesRemaining()+1);
			}

		}
		else
			return beneficialWordsFizzle(mob,target,L("<S-NAME> chants for refreshing power, but nothing happens."));

		// return whether it worked
		return success;
	}
}


text:
<?php

namespace Page\Controller;

use CmsIr\Price\Model\Price;
use CmsIr\Users\Model\UsersTable;
use Zend\Json\Json;
use Zend\Mime\Message;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;

use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Result;
use Zend\Authentication\Storage\Session as SessionStorage;
use Zend\Db\Adapter\Adapter as DbAdapter;
use Zend\Authentication\Adapter\DbTable as AuthAdapter;

class PageController extends AbstractActionController
{
    public function homeAction()
    {
        $this->layout('layout/home');

        $viewParams = array();
        $viewModel = new ViewModel();
        $viewModel->setVariables($viewParams);
        return $viewModel;
    }

    public function viewPageAction()
    {
        $this->layout('layout/home');

        $slug = $this->params('slug');

        $posts = $this->getPostTable()->getBy(array('status_id' => 1, 'category' => $slug, 'website_id' => 2));

        foreach($posts as $post)
        {
            $eventFiles = $this->getPostFileTable()->getOneBy(array('post_id' => $post->getId()));
            $post->setFiles($eventFiles);
        }

        if(empty($posts)){
            $this->getResponse()->setStatusCode(404);
        }

        switch ($slug)
        {
            case 'arteterapia':
                $first = 'arteterapia';
                $second = 'Warsztaty dla dzieci:
 Ogrody umysłu - ciekawe i skuteczne sposoby terapeutyczne kształtujące prawidłowy rozwój dziecka';
                break;
            case 'fizjoterapia':
                $first = 'fizjoterapia';
                $second = '';
                break;
            case 'masaz-shantala':
                $first = 'masaż Shantala';
                $second = '';
                break;
            case 'integracja-sensoryczna-si':
                $first = 'integracja sensoryczna SI';
                $second = '';
                break;
            case 'neurologopeda':
                $first = 'terapia neurologopedyczna i logopedyczna';
                $second = '';
                break;
            case 'psycholog':
                $first = 'terapia dysleksji Metodą Warnkego';
                $second = '';
                break;
            case 'terapia-czaszkowo-krzyżowa':
                $first = 'terapia czaszkowo-krzyżowa (cranio-sakralna)';
                $second = '';
                break;
            case 'terapia-warnkego':
                $first = 'terapia dysleksji Metodą Warnkego';
                $second = '';
                break;
        }

        $viewParams = array();
        $viewParams['posts'] = $posts;
        $viewParams['first'] = $first;
        $viewParams['second'] = $second;
        $viewModel = new ViewModel();
        $viewModel->setVariables($viewParams);
        return $viewModel;
    }

    public function priceAction()
    {
        $this->layout('layout/home');

        $prices = $this->getPriceService()->findAllByWebsiteId(2);

        $konsultacje = array();
        $tomatis = array();
        $warnke = array();

        /* @var $price Price */
        foreach($prices as $price)
        {
            if($price->getCategory() == 'konsultacje-i-terapie')
            {
                array_push($konsultacje, $price);
            } elseif($price->getCategory() == 'cennik-treningow-sluchowych-metoda-tomatisa')
            {
                array_push($tomatis, $price);
            } else
            {
                array_push($warnke, $price);
            }
        }

        $viewParams = array();
        $viewParams['konsultacje'] = $konsultacje;
        $viewParams['tomatis'] = $tomatis;
        $viewParams['warnke'] = $warnke;
        $viewModel = new ViewModel();
        $viewModel->setVariables($viewParams);
        return $viewModel;
    }

    public function galleryAction()
    {
        $this->layout('layout/home');

        $galleries = $this->getFileService()->findAllByCategoryAndWebsiteId('gallery', 2);

        $viewParams['galleries'] = $galleries;
        $viewModel = new ViewModel();
        $viewModel->setVariables($viewParams);
        return $viewModel;
    }

    public function contactAction()
    {
        $this->layout('layout/home');

        $viewModel = new ViewModel();
        return $viewModel;
    }

    public function contactFormAction()
    {
        $request = $this->getRequest();
        if ($request->isPost())
        {
            $name = $request->getPost('name');
            $email = $request->getPost('mail');
            $phone = $request->getPost('phone');
            $subject = $request->getPost('subject');
            $content = $request->getPost('content');

            $content = "Imię i nazwisko: " . $name . "
" .
                "Email: " . $email . "
" .
                "Telefon kontaktowy: " . $phone . "
" .
                "Temat: " . $subject . "
" .
                "Treść: " . $content . "
";

            $html = new MimePart($content);
            $html->type = "text/html";

            $body = new MimeMessage();
            $body->setParts(array($html));

            $transport = $this->getServiceLocator()->get('mail.transport');
            $message = new \Zend\Mail\Message();
            $this->getRequest()->getServer();
            $message->addTo('biuro@web-ir.pl')
                ->addFrom('biuro@web-ir.pl')
                ->setEncoding('UTF-8')
                ->setSubject('Wiadomość z formularza kontaktowego')
                ->setBody($body);
            $transport->send($message);
        }

        $params = 'Wiadomość została wysłana poprawnie';
        $jsonObject = Json::encode($params, true);
        echo $jsonObject;
        return $this->response;
    }

    public function terapeuciAction()
    {
        $this->layout('layout/home');
        $boss = $this->getUsersTable()->getOneBy(array('dictionary_position_id' => 8));
        $people = $this->getUsersTable()->getBy(array('dictionary_position_id' => 3));

        $viewParams['boss'] = $boss;
        $viewParams['people'] = $people;
        $viewModel = new ViewModel();
        $viewModel->setVariables($viewParams);
        return $viewModel;
    }

    /**
     * @return \CmsIr\Menu\Service\MenuService
     */
    public function getMenuService()
    {
        return $this->getServiceLocator()->get('CmsIr\Menu\Service\MenuService');
    }

    /**
     * @return \CmsIr\Slider\Service\SliderService
     */
    public function getSliderService()
    {
        return $this->getServiceLocator()->get('CmsIr\Slider\Service\SliderService');
    }

    /**
     * @return \CmsIr\Page\Service\PageService
     */
    public function getPageService()
    {
        return $this->getServiceLocator()->get('CmsIr\Page\Service\PageService');
    }

    /**
     * @return \CmsIr\System\Model\StatusTable
     */
    public function getStatusTable()
    {
        return $this->getServiceLocator()->get('CmsIr\System\Model\StatusTable');
    }

    /**
     * @return \CmsIr\Price\Service\PriceService
     */
    public function getPriceService()
    {
        return $this->getServiceLocator()->get('CmsIr\Price\Service\PriceService');
    }

    /**
     * @return \CmsIr\File\Service\FileService
     */
    public function getFileService()
    {
        return $this->getServiceLocator()->get('CmsIr\File\Service\FileService');
    }

    /**
     * @return \CmsIr\Post\Model\PostTable
     */
    public function getPostTable()
    {
        return $this->getServiceLocator()->get('CmsIr\Post\Model\PostTable');
    }

    /**
     * @return \CmsIr\Post\Model\PostFileTable
     */
    public function getPostFileTable()
    {
        return $this->getServiceLocator()->get('CmsIr\Post\Model\PostFileTable');
    }

    /**
     * @return UsersTable
     */
    public function getUsersTable()
    {
        return $this->getServiceLocator()->get('CmsIr\Users\Model\UsersTable');
    }
}


text:
const config = require('./config');

module.exports = (grunt) => {
    // Project configuration.
    grunt.initConfig(config);

    // Actually load this plugin's task(s).
    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('gruntify-eslint');

    // Whenever the "test" task is run, first clean the "tmp" dir, then run this
    // plugin's task(s), then test the result.
    grunt.registerTask('test', ['clean', 'copy', 'mocha_istanbul']);

    // By default, lint and run all tests.
    grunt.registerTask('default', ['eslint', 'test']);
};


text:
import os
import sys
import pytest
import platform
from py.code import Source
from _pytest.pytester import LineMatcher

win32 = sys.platform == 'win32'
win32py2 = win32 and sys.version_info[0] == 2
win32pypy = win32 and platform.python_implementation() == 'PyPy'

def makefile(testdir, path, content):
    return testdir.tmpdir.ensure(*path).write('\n'.join(Source(content)))

def ls(dir, filepath=''):
    return sorted([x.basename for x in dir.join(filepath).listdir()])

def basetemp(testdir):
    return testdir.tmpdir.join('..', 'basetemp')

def outdir(testdir, dst):
    return testdir.tmpdir.join('..', dst)

@pytest.fixture(autouse=True)
def set_classic_output(monkeypatch, testdir):
    runpytest = testdir.runpytest

    def wrapper(*args, **kwargs):
        return runpytest('--override-ini=console_output_style=classic', *args, **kwargs)

    monkeypatch.setattr(testdir, 'runpytest', wrapper)

@pytest.fixture
def conftest_py(testdir):
    filename = 'conftest.py'
    makefile(testdir, [filename], """
        import logging
        def pytest_logger_fileloggers(item):
            return [
                'foo',
                ('bar', logging.ERROR),
            ]
    """)
    return filename

@pytest.fixture
def test_case_py(testdir):
    filename = 'test_case.py'
    makefile(testdir, [filename], """
        import logging
        def test_case():
            for lgr in (logging.getLogger(name) for name in ['foo', 'bar', 'baz']):
                lgr.error('this is error')
                lgr.warning('this is warning')
                lgr.info('this is info')
    """)
    return filename

class FileLineMatcher(LineMatcher):
    def __init__(self, dir, filepath):
        lines = dir.join(filepath).read().splitlines()
        LineMatcher.__init__(self, lines)

def test_logdir_fixture(testdir):
    makefile(testdir, ['test_foo1.py'], """
        import os

        def test_bar(logdir, tmpdir_factory):
            print(tmpdir_factory)
            assert str(logdir).endswith(os.path.join('logs', 'test_foo1.py', 'test_bar'))

        def test_baz(logdir):
            assert str(logdir).endswith(os.path.join('logs', 'test_foo1.py', 'test_baz'))

        class TestInsideClass(object):
            def test_qez(self, logdir):
                assert str(logdir).endswith(os.path.join('logs', 'test_foo1.py', 'TestInsideClass', 'test_qez'))

        import pytest
        @pytest.mark.parametrize('param1,param2', [
            ('abc', 'de'),
            (2, 4.127)
        ])
        def test_par(logdir, param1, param2):
            assert any((
                str(logdir).endswith(os.path.join('logs', 'test_foo1.py', 'test_par-abc-de')),
                str(logdir).endswith(os.path.join('logs', 'test_foo1.py', 'test_par-2-4.127')),
            ))
        def test_this_should_not_generate_logdir():
            pass
    """)
    makefile(testdir, ['subdir', 'test_foo2.py'], """
        import os
        def test_bar(logdir):
            assert str(logdir).endswith(os.path.join('logs', 'subdir', 'test_foo2.py', 'test_bar'))
    """)
    makefile(testdir, ['subdir', 'subsubdir', 'test_foo3.py'], """
        import os
        def test_bar(logdir):
            assert str(logdir).endswith(os.path.join('logs', 'subdir', 'subsubdir', 'test_foo3.py', 'test_bar'))
    """)

    result = testdir.runpytest()
    assert result.ret == 0

    assert ls(basetemp(testdir), 'logs') == ['subdir', 'test_foo1.py']
    assert ls(basetemp(testdir), 'logs/subdir') == ['subsubdir', 'test_foo2.py']
    assert ls(basetemp(testdir), 'logs/subdir/subsubdir') == ['test_foo3.py']
    assert ls(basetemp(testdir), 'logs/subdir/subsubdir/test_foo3.py') == ['test_bar']
    assert ls(basetemp(testdir), 'logs/subdir/test_foo2.py') == ['test_bar']
    assert ls(basetemp(testdir), 'logs/test_foo1.py') == sorted([
        'test_bar',
        'test_baz',
        'TestInsideClass',
        'test_par-abc-de',
        'test_par-2-4.127',
    ])
    assert ls(basetemp(testdir), 'logs/test_foo1.py/TestInsideClass') == ['test_qez']

def test_stdout_handlers(testdir):
    makefile(testdir, ['conftest.py'], """
        def pytest_logger_stdoutloggers(item):
            return ['foo']
    """)
    makefile(testdir, ['test_case.py'], """
        import logging
        def test_case():
            logging.getLogger('foo').warning('this is warning')
            logging.getLogger('foo').info('you do not see me: level too low')
            logging.getLogger('bar').warning('you do not see me: logger not handled')
    """)

    result = testdir.runpytest()
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    result = testdir.runpytest('-s')
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py ',
        '* foo: this is warning',
        '.',
        ''
    ])

def test_stdout_handlers_many_loggers(testdir):
    makefile(testdir, ['conftest.py'], """
        import logging
        def pytest_logger_stdoutloggers(item):
            return [
                'foo',
                ('bar', logging.ERROR),
                ('baz', logging.FATAL)
            ]
    """)
    makefile(testdir, ['test_case.py'], """
        import logging
        def test_case():
            for lgr in (logging.getLogger(name) for name in ['foo', 'bar', 'baz']):
                lgr.fatal('this is fatal')
                lgr.error('this is error')
                lgr.warning('this is warning')
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py ',
        '* foo: this is fatal',
        '* foo: this is error',
        '* foo: this is warning',
        '* bar: this is fatal',
        '* bar: this is error',
        '* baz: this is fatal',
        '.',
        ''
    ])

def test_file_handlers(testdir, conftest_py, test_case_py):

    result = testdir.runpytest('-s')
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    assert ls(basetemp(testdir), 'logs') == [test_case_py]
    assert ls(basetemp(testdir), 'logs/{0}'.format(test_case_py)) == ['test_case']
    assert ls(basetemp(testdir), 'logs/{0}/test_case'.format(test_case_py)) == ['bar', 'foo']

    FileLineMatcher(basetemp(testdir), 'logs/{0}/test_case/foo'.format(test_case_py)).fnmatch_lines([
        '* foo: this is error',
        '* foo: this is warning',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/{0}/test_case/bar'.format(test_case_py)).fnmatch_lines([
        '* bar: this is error',
    ])

@pytest.mark.skipif(win32py2, reason="python 2 on windows doesn't have symlink feature")
def test_split_logs_by_outcome(testdir):
    makefile(testdir, ['conftest.py'], """
        import logging
        def pytest_logger_fileloggers(item):
            return [
                'foo',
                ('bar', logging.ERROR),
            ]

        def pytest_logger_config(logger_config):
            logger_config.split_by_outcome(outcomes=['passed', 'failed'])
    """)
    makefile(testdir, ['test_case.py'], """
            import pytest
            import logging
            def test_case_that_fails():
                for lgr in (logging.getLogger(name) for name in ['foo', 'bar', 'baz']):
                    lgr.error('this is error')
                    lgr.warning('this is warning')
                pytest.fail('just checking')

            def test_case_that_passes():
                for lgr in (logging.getLogger(name) for name in ['foo', 'bar', 'baz']):
                    lgr.error('this is error')
                    lgr.warning('this is warning')
        """)
    result = testdir.runpytest('-s')
    assert result.ret != 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py F.',
        '',
    ])

    assert 'by_outcome' in ls(basetemp(testdir).join('logs'))

    assert 'failed' in ls(basetemp(testdir).join('logs', 'by_outcome'))
    failedlogpath = basetemp(testdir).join('logs', 'by_outcome', 'failed', 'test_case.py', 'test_case_that_fails')
    assert failedlogpath.islink()
    failedlogdest = os.path.join(
        os.path.pardir, os.path.pardir, os.path.pardir, 'test_case.py', 'test_case_that_fails')
    assert os.readlink(str(failedlogpath)) == failedlogdest

    assert 'passed' in ls(basetemp(testdir).join('logs', 'by_outcome'))
    passedlogpath = basetemp(testdir).join('logs', 'by_outcome', 'passed', 'test_case.py', 'test_case_that_passes')
    assert passedlogpath.islink()
    passedlogdest = os.path.join(
        os.path.pardir, os.path.pardir, os.path.pardir, 'test_case.py', 'test_case_that_passes')
    assert os.readlink(str(passedlogpath)) == passedlogdest

def test_file_handlers_root(testdir):
    makefile(testdir, ['conftest.py'], """
        import logging
        def pytest_logger_fileloggers(item):
            return [
                ('', logging.ERROR),
                ('foo', logging.WARNING),
            ]
    """)
    makefile(testdir, ['test_case.py'], """
        import logging
        def test_case():
            for lgr in (logging.getLogger(name) for name in ['foo', 'bar', 'baz']):
                lgr.error('this is error')
                lgr.warning('this is warning')
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0

    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    assert ls(basetemp(testdir), 'logs') == ['test_case.py']
    assert ls(basetemp(testdir), 'logs/test_case.py') == ['test_case']
    assert ls(basetemp(testdir), 'logs/test_case.py/test_case') == ['foo', 'logs']

    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/logs').fnmatch_lines([
        '* foo: this is error',
        '* bar: this is error',
        '* baz: this is error',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/foo').fnmatch_lines([
        '* foo: this is error',
        '* foo: this is warning',
    ])

@pytest.mark.skipif(win32py2, reason="python 2 on windows doesn't have symlink feature")
def test_logdir_link(testdir):
    makefile(testdir, ['conftest.py'], """
        import os
        def pytest_logger_fileloggers(item):
            return ['']
        def pytest_logger_logdirlink(config):
            return os.path.join(os.path.dirname(__file__), 'my_link_dir')
    """)
    makefile(testdir, ['test_case.py'], """
        def test_case():
            pass
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0
    assert 'my_link_dir' in ls(testdir.tmpdir)
    assert ['test_case'] == ls(testdir.tmpdir, 'my_link_dir/test_case.py')

def test_logsdir(testdir):
    makefile(testdir, ['conftest.py'], """
        import os
        def pytest_logger_fileloggers(item):
            return ['']
        def pytest_logger_logsdir(config):
            return os.path.join(os.path.dirname(__file__), 'my_logs_dir')
    """)
    makefile(testdir, ['test_case.py'], """
        def test_case():
            pass
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0
    assert 'my_logs_dir' in ls(testdir.tmpdir)
    assert ['test_case'] == ls(testdir.tmpdir, 'my_logs_dir/test_case.py')

def test_format(testdir):
    makefile(testdir, ['conftest.py'], """
        import os
        import logging
        def pytest_logger_stdoutloggers(item):
            return ['']
        def pytest_logger_fileloggers(item):
            return ['']
    """)
    makefile(testdir, ['test_case.py'], """
        import logging
        def test_case():
            lgr = logging.getLogger('foo')
            lgr.fatal('this is fatal')
            lgr.error('this is error')
            lgr.warning('this is warning')
            lgr.info('this is info')
            lgr.debug('this is debug')
            lgr.log(35, 'this is 35')
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0

    expected_lines = [
        '*:*.* ftl foo: this is fatal',
        '*:*.* err foo: this is error',
        '*:*.* wrn foo: this is warning',
        '*:*.* inf foo: this is info',
        '*:*.* dbg foo: this is debug',
        '*:*.* l35 foo: this is 35',
    ]
    result.stdout.fnmatch_lines(expected_lines)
    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/logs').fnmatch_lines(expected_lines)

def test_multiple_conftests(testdir):
    makefile(testdir, ['conftest.py'], """
        import os
        def pytest_logger_stdoutloggers(item):
            return ['foo']
        def pytest_logger_fileloggers(item):
            return ['foo']
        def pytest_logger_logdirlink(config):
            return os.path.join(os.path.dirname(__file__), 'logs')
    """)
    makefile(testdir, ['subdir', 'conftest.py'], """
        import os
        def pytest_logger_stdoutloggers(item):
            return ['bar']
        def pytest_logger_fileloggers(item):
            return ['bar']
        def pytest_logger_logdirlink(config):
            return os.path.join(os.path.dirname(__file__), 'logs')
    """)
    makefile(testdir, ['subdir', 'test_case.py'], """
        import logging
        def test_case():
            for lgr in (logging.getLogger(name) for name in ['foo', 'bar']):
                lgr.warning('this is warning')
    """)
    makefile(testdir, ['makes_nodeid_in_pytest29_contain_subdir_name', 'empty'], '')

    result = testdir.runpytest('subdir', 'makes_nodeid_in_pytest29_contain_subdir_name', '-s')
    assert result.ret == 0

    if not win32py2:
        assert ls(testdir.tmpdir, 'logs/subdir/test_case.py') == ['test_case']
        assert ls(testdir.tmpdir, 'subdir/logs/subdir/test_case.py') == ['test_case']

    result.stdout.fnmatch_lines([
        '',
        'subdir/test_case.py ',
        '* foo: this is warning',
        '* bar: this is warning',
        '.',
        ''
    ])

    FileLineMatcher(basetemp(testdir), 'logs/subdir/test_case.py/test_case/foo').fnmatch_lines([
        '* foo: this is warning',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/subdir/test_case.py/test_case/bar').fnmatch_lines([
        '* bar: this is warning',
    ])

def test_skip_gracefully(testdir):
    makefile(testdir, ['conftest.py'], """
        import os
        def pytest_logger_stdoutloggers(item):
            return ['foo']
        def pytest_logger_fileloggers(item):
            return ['foo']
        def pytest_logger_logdirlink(config):
            return os.path.join(os.path.dirname(__file__), 'logs')
    """)
    makefile(testdir, ['test_case.py'], """
        import pytest
        @pytest.mark.skipif(True, reason='')
        def test_case():
            pass
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0

    assert 'logs' not in ls(testdir.tmpdir)

@pytest.mark.skipif(win32pypy, reason="pytest-xdist crashes on win32 under pypy")
def test_xdist(testdir):
    N = 8
    makefile(testdir, ['conftest.py'], """
        import os
        def pytest_logger_stdoutloggers(item):
            return ['foo']
        def pytest_logger_fileloggers(item):
            return ['foo']
        def pytest_logger_logdirlink(config):
            return os.path.join(os.path.dirname(__file__), 'logs')
    """)
    for index in range(N):
        makefile(testdir, ['test_case%s.py' % index], """
            import logging
            def test_case{0}():
                logging.getLogger('foo').warning('this is test {0}')
        """.format(index))

    result = testdir.runpytest('-n3')
    assert result.ret == 0

    if not win32py2:
        assert ls(testdir.tmpdir, 'logs') == ['test_case%s.py' % i for i in range(N)]

    for index in range(N):
        logfilename = 'logs/test_case{0}.py/test_case{0}/foo'.format(index)
        FileLineMatcher(basetemp(testdir), logfilename).fnmatch_lines(['* wrn foo: this is test %s' % index])

def test_logsdir_option(testdir, conftest_py, test_case_py):

    logsdir = outdir(testdir, 'myinilogs')
    result = testdir.runpytest('-s', '--logger-logsdir={0}'.format(str(logsdir)))
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    assert ls(logsdir) == [test_case_py]
    assert ls(logsdir, test_case_py) == ['test_case']
    assert ls(logsdir, '{0}/test_case'.format(test_case_py)) == ['bar', 'foo']

    FileLineMatcher(logsdir, '{0}/test_case/foo'.format(test_case_py)).fnmatch_lines([
        '* foo: this is error',
        '* foo: this is warning',
    ])
    FileLineMatcher(logsdir, '{0}/test_case/bar'.format(test_case_py)).fnmatch_lines([
        '* bar: this is error',
    ])

def test_logsdir_ini(testdir, conftest_py, test_case_py):

    logsdir = outdir(testdir, 'myinilogs')
    makefile(testdir, ['pytest.ini'], """
        [pytest]
        logger_logsdir={0}
    """.format(logsdir))

    result = testdir.runpytest('-s')
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    assert ls(logsdir) == [test_case_py]
    assert ls(logsdir, test_case_py) == ['test_case']
    assert ls(logsdir, '{0}/test_case'.format(test_case_py)) == ['bar', 'foo']

    FileLineMatcher(logsdir, '{0}/test_case/foo'.format(test_case_py)).fnmatch_lines([
        '* foo: this is error',
        '* foo: this is warning',
    ])
    FileLineMatcher(logsdir, '{0}/test_case/bar'.format(test_case_py)).fnmatch_lines([
        '* bar: this is error',
    ])

def test_logsdir_cleanup(testdir, conftest_py, test_case_py):

    logsdir = outdir(testdir, 'myinilogs')

    makefile(testdir, ['pytest.ini'], """
        [pytest]
        logger_logsdir={0}
    """.format(logsdir))

    logsdir.ensure('tmpfile').write('\n'.join(Source('this shall be removed')))
    logsdir.join('tmpdir')

    result = testdir.runpytest('-s')
    assert result.ret == 0
    result.stdout.fnmatch_lines([
        '',
        'test_case.py .',
        '',
    ])

    assert ls(logsdir) == [test_case_py]
    assert ls(logsdir, test_case_py) == ['test_case']
    assert ls(logsdir, '{0}/test_case'.format(test_case_py)) == ['bar', 'foo']

    FileLineMatcher(logsdir, '{0}/test_case/foo'.format(test_case_py)).fnmatch_lines([
        '* foo: this is error',
        '* foo: this is warning',
    ])
    FileLineMatcher(logsdir, '{0}/test_case/bar'.format(test_case_py)).fnmatch_lines([
        '* bar: this is error',
    ])

def test_logger_config(testdir, test_case_py):
    makefile(testdir, ['conftest.py'], """
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo', 'bar'], stdout_level='warning', file_level='info')
            logger_config.add_loggers(['baz'], stdout_level='error', file_level='warning')
            logger_config.set_log_option_default('foo,bar,baz')
    """)

    result = testdir.runpytest('-s')
    assert result.ret == 0

    result.stdout.fnmatch_lines([
        '',
        'test_case.py ',
        '* err foo: this is error',
        '* wrn foo: this is warning',
        '* err bar: this is error',
        '* wrn bar: this is warning',
        '* err baz: this is error',
        '.',
        '',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/foo').fnmatch_lines([
        '* err foo: this is error',
        '* wrn foo: this is warning',
        '* inf foo: this is info',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/bar').fnmatch_lines([
        '* err bar: this is error',
        '* wrn bar: this is warning',
        '* inf bar: this is info',
    ])
    FileLineMatcher(basetemp(testdir), 'logs/test_case.py/test_case/baz').fnmatch_lines([
        '* err baz: this is error',
        '* wrn baz: this is warning',
    ])

@pytest.mark.parametrize('log_option', ('', '--loggers=foo.info,baz'))
def test_logger_config_option(testdir, test_case_py, log_option):
    makefile(testdir, ['conftest.py'], """
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo', 'bar'])
            logger_config.add_loggers(['baz'], file_level='error')
    """)

    opts = ('-s', log_option) if log_option else ('-s',)
    result = testdir.runpytest(*opts)
    assert result.ret == 0

    if log_option:
        result.stdout.fnmatch_lines([
            '',
            'test_case.py ',
            '* err foo: this is error',
            '* wrn foo: this is warning',
            '* inf foo: this is info',
            '* err baz: this is error',
            '.',
            '',
        ])
    else:
        result.stdout.fnmatch_lines([
            '',
            'test_case.py .',
            '',
        ])

@pytest.mark.parametrize('log_option', ('', '--loggers=foo.info,baz'))
def test_logger_config_formatter(testdir, test_case_py, log_option):
    makefile(testdir, ['conftest.py'], """
        import logging

        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo', 'bar'])
            logger_config.add_loggers(['baz'], file_level='error')
            logger_config.set_formatter_class(logging.Formatter)
    """)

    opts = ('-s', log_option) if log_option else ('-s',)
    result = testdir.runpytest(*opts)
    assert result.ret == 0

    if log_option:
        result.stdout.fnmatch_lines([
            '',
            'test_case.py ',
            'this is error',
            'this is warning',
            'this is info',
            'this is error',
            '.',
            '',
        ])
    else:
        result.stdout.fnmatch_lines([
            '',
            'test_case.py .',
            '',
        ])

@pytest.mark.parametrize('with_hook', (False, True))
def test_logger_config_option_missing_without_hook(testdir, test_case_py, with_hook):
    makefile(testdir, ['conftest.py'], """
        def pytest_addoption(parser):
            parser.addoption('--loggers')
    """ + ("""
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo', 'bar'], stdout_level='warning', file_level='info')
            logger_config.add_loggers(['baz'], stdout_level='error', file_level='warning')
    """ if with_hook else ""))

    result = testdir.runpytest('-s', '--loggers=foo')
    assert result.ret == (3 if with_hook else 0)

    if with_hook:
        result.stderr.fnmatch_lines([
            '*ArgumentError: argument --loggers: conflicting option string*: --loggers',
        ])

@pytest.mark.parametrize('stdout_hook', (False, True))
@pytest.mark.parametrize('config_hook', (False, True))
def test_error_both_hook_apis_used(testdir, test_case_py, stdout_hook, config_hook):
    makefile(testdir, ['conftest.py'], ("""
        def pytest_logger_stdoutloggers(item):
            return ['foo']
    """ if stdout_hook else '') + ("""
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo'])
    """ if config_hook else ''))

    result = testdir.runpytest('-s')
    assert result.ret == (1 if (stdout_hook and config_hook) else 0)

    if stdout_hook and config_hook:
        result.stdout.fnmatch_lines([
            '*AssertionError: pytest_logger_config and pytest_logger_*loggers hooks used at the same time',
        ])

def test_help_prints(testdir, test_case_py):
    """
    Pytest doesn't evaluate group.addoption(..., type=...) option when run with --help option.
    This causes log option string to remain as unchecked string instead of a list in expected format.
    This happens regardless of --loggers option source (default, cmdline, etc.),

    To remedy this hack checking whether option has been parsed was made.
    This test ensures that it keeps working.
    """
    makefile(testdir, ['conftest.py'], ("""
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo'])
            logger_config.set_log_option_default('foo')
    """))

    result = testdir.runpytest('-s', '--help')
    assert result.ret == 0

@pytest.mark.skip("Since pytest v3.3 progress percentage is being displayed by default during test execution. "
                  "It interferes with most of the old test cases that assert stdout/err so to not change them, we are "
                  "now forcing classic output with a set_classic_output auto-use fixture which overrides pytest's "
                  "console_output_style. We could have at least one test that proves the plugin can work in the new"
                  "default mode as well.")
def test_works_with_progress_percentage_prints():
    assert False

def test_collects_teardown_logs(testdir):
    makefile(testdir, ['conftest.py'], """
        def pytest_logger_config(logger_config):
            logger_config.add_loggers(['foo'])
            logger_config.set_log_option_default('foo')
    """)

    makefile(testdir, ['test_bar.py'], """
        import logging
        import pytest
        logger = logging.getLogger('foo')

        @pytest.fixture(autouse=True)
        def fixture_with_teardown_logging():
            logger.info('setup')
            yield
            logger.info('teardown')

        def test_bar():
            logger.info('test_bar')
    """)

    result = testdir.runpytest()
    assert result.ret == 0

    FileLineMatcher(basetemp(testdir), 'logs/test_bar.py/test_bar/foo').fnmatch_lines([
        '* inf foo: setup',
        '* inf foo: test_bar',
        '* inf foo: teardown',
    ])


text:
.class public Lcom/tencent/connect/common/BaseApi$TempRequestListener;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/tencent/tauth/IRequestListener;

# instance fields
.field final synthetic a:Lcom/tencent/connect/common/BaseApi;

.field private b:Lcom/tencent/tauth/IUiListener;

.field private c:Landroid/os/Handler;

# direct methods
.method public constructor <init>(Lcom/tencent/connect/common/BaseApi;Lcom/tencent/tauth/IUiListener;)V
    .locals 2

    iput-object p1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->a:Lcom/tencent/connect/common/BaseApi;

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

    iput-object p2, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->b:Lcom/tencent/tauth/IUiListener;

    new-instance v0, Lcom/tencent/connect/common/a;

    iget-object v1, p1, Lcom/tencent/connect/common/BaseApi;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getMainLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, p0, v1, p1}, Lcom/tencent/connect/common/a;-><init>(Lcom/tencent/connect/common/BaseApi$TempRequestListener;Landroid/os/Looper;Lcom/tencent/connect/common/BaseApi;)V

    iput-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    return-void
.end method

.method static synthetic a(Lcom/tencent/connect/common/BaseApi$TempRequestListener;)Lcom/tencent/tauth/IUiListener;
    .locals 1

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->b:Lcom/tencent/tauth/IUiListener;

    return-object v0
.end method

# virtual methods
.method public onComplete(Lorg/json/JSONObject;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    iput-object p1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, 0x0

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onConnectTimeoutException(Lorg/apache/http/conn/ConnectTimeoutException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Lorg/apache/http/conn/ConnectTimeoutException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x7

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onHttpStatusException(Lcom/tencent/utils/HttpUtils$HttpStatusException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Lcom/tencent/utils/HttpUtils$HttpStatusException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/16 v1, -0x9

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onIOException(Ljava/io/IOException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x2

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onJSONException(Lorg/json/JSONException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Lorg/json/JSONException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x4

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onMalformedURLException(Ljava/net/MalformedURLException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Ljava/net/MalformedURLException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x3

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onNetworkUnavailableException(Lcom/tencent/utils/HttpUtils$NetworkUnavailableException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Lcom/tencent/utils/HttpUtils$NetworkUnavailableException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/16 v1, -0xa

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onSocketTimeoutException(Ljava/net/SocketTimeoutException;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Ljava/net/SocketTimeoutException;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x8

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method

.method public onUnknowException(Ljava/lang/Exception;)V
    .locals 2

    iget-object v0, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/Handler;->obtainMessage()Landroid/os/Message;

    move-result-object v0

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    const/4 v1, -0x6

    iput v1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tencent/connect/common/BaseApi$TempRequestListener;->c:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    return-void
.end method


text:
package ua.nure.model;

public enum Role {
    USER("user"),
    ADMIN("admin");

    private final String name;

    Role(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
    /*USER,
    ADMIN*/
}


text:
using System;
using System.IO;
using System.Runtime.InteropServices;

namespace Gibbed.IO
{
    public static partial class StreamHelpers
    {
        public static T ReadStructure<T>(this Stream stream)
        {
            var structureSize = Marshal.SizeOf(typeof(T));
            var buffer = new byte[structureSize];

            if (stream.Read(buffer, 0, structureSize) != structureSize)
            {
                throw new EndOfStreamException("could not read all of data for structure");
            }

            var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            var structure = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));

            handle.Free();

            return structure;
        }

        public static T ReadStructure<T>(this Stream stream, int size)
        {
            var structureSize = Marshal.SizeOf(typeof(T));
            var buffer = new byte[Math.Max(structureSize, size)];

            if (stream.Read(buffer, 0, size) != size)
            {
                throw new EndOfStreamException("could not read all of data for structure");
            }

            var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            var structure = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));

            handle.Free();

            return structure;
        }

        public static void WriteStructure<T>(this Stream stream, T structure)
        {
            var structureSize = Marshal.SizeOf(typeof(T));
            var buffer = new byte[structureSize];
            var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            Marshal.StructureToPtr(structure, handle.AddrOfPinnedObject(), false);

            handle.Free();

            stream.Write(buffer, 0, buffer.Length);
        }

        public static void WriteStructure<T>(this Stream stream, T structure, int size)
        {
            var structureSize = Marshal.SizeOf(typeof(T));
            var buffer = new byte[Math.Max(structureSize, size)];
            var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            Marshal.StructureToPtr(structure, handle.AddrOfPinnedObject(), false);

            handle.Free();

            stream.Write(buffer, 0, buffer.Length);
        }
    }
}