text:
/*
 * File: HangmanCanvas.java
 * ------------------------
 * This file keeps track of the Hangman display.
 */

import java.util.ArrayList;
import java.util.List;

import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

// This isn't really a canvas but we'll keep the class name to stay as close to the assignment as possible
public class HangmanCanvas {
    /* Constants for the simple version of the picture (in pixels) */
    private static final int SCAFFOLD_HEIGHT = 360;
    private static final int BEAM_LENGTH = 144;
    private static final int ROPE_LENGTH = 18;
    private static final int HEAD_RADIUS = 36;
    private static final int BODY_LENGTH = 144;
    private static final int ARM_OFFSET_FROM_HEAD = 28;
    private static final int UPPER_ARM_LENGTH = 72;
    private static final int LOWER_ARM_LENGTH = 44;
    private static final int HIP_WIDTH = 36;
    private static final int LEG_LENGTH = 108;
    private static final int FOOT_LENGTH = 28;

    private static final int CANVAS_HEIGHT = 800;
    private static final int CANVAS_WIDTH = 500;

    private static final double VERTICAL_BEAM_START_X = CANVAS_WIDTH / 2 - BEAM_LENGTH;
    private static final double VERTICAL_BEAM_END_X = VERTICAL_BEAM_START_X;
    private static final double VERTICAL_BEAM_START_Y = (CANVAS_HEIGHT - SCAFFOLD_HEIGHT) * 1 / 3 + SCAFFOLD_HEIGHT;
    private static final double VERTICAL_BEAM_END_Y = VERTICAL_BEAM_START_Y - SCAFFOLD_HEIGHT;

    private static final double HORIZONTAL_BEAM_START_X = VERTICAL_BEAM_END_X;
    private static final double HORIZONTAL_BEAM_END_X = HORIZONTAL_BEAM_START_X + BEAM_LENGTH;
    private static final double HORIZONTAL_BEAM_START_Y = VERTICAL_BEAM_END_Y;
    private static final double HORIZONTAL_BEAM_END_Y = HORIZONTAL_BEAM_START_Y;

    private static final double ROPE_START_X = HORIZONTAL_BEAM_END_X;
    private static final double ROPE_END_X = ROPE_START_X;
    private static final double ROPE_START_Y = HORIZONTAL_BEAM_END_Y;
    private static final double ROPE_END_Y = ROPE_START_Y + ROPE_LENGTH;

    private static final double HEAD_CENTER_X = ROPE_END_X;
    private static final double HEAD_CENTER_Y = ROPE_END_Y + HEAD_RADIUS;

    private static final double BODY_START_X = HEAD_CENTER_X;
    private static final double BODY_END_X = HEAD_CENTER_X;
    private static final double BODY_START_Y = HEAD_CENTER_Y + HEAD_RADIUS;
    private static final double BODY_END_Y = BODY_START_Y + BODY_LENGTH;

    private static final double LEFT_UPPER_ARM_START_X = BODY_START_X;
    private static final double LEFT_UPPER_ARM_END_X = LEFT_UPPER_ARM_START_X - UPPER_ARM_LENGTH;
    private static final double LEFT_UPPER_ARM_START_Y = BODY_START_Y + ARM_OFFSET_FROM_HEAD;
    private static final double LEFT_UPPER_ARM_END_Y = LEFT_UPPER_ARM_START_Y;

    private static final double LEFT_LOWER_ARM_START_X = LEFT_UPPER_ARM_END_X;
    private static final double LEFT_LOWER_ARM_END_X = LEFT_LOWER_ARM_START_X;
    private static final double LEFT_LOWER_ARM_START_Y = LEFT_UPPER_ARM_END_Y;
    private static final double LEFT_LOWER_ARM_END_Y = LEFT_LOWER_ARM_START_Y + LOWER_ARM_LENGTH;

    private static final double RIGHT_UPPER_ARM_START_X = LEFT_UPPER_ARM_START_X;
    private static final double RIGHT_UPPER_ARM_END_X = RIGHT_UPPER_ARM_START_X + UPPER_ARM_LENGTH;
    private static final double RIGHT_UPPER_ARM_START_Y = LEFT_UPPER_ARM_START_Y;
    private static final double RIGHT_UPPER_ARM_END_Y = RIGHT_UPPER_ARM_START_Y;

    private static final double RIGHT_LOWER_ARM_START_X = RIGHT_UPPER_ARM_END_X;
    private static final double RIGHT_LOWER_ARM_END_X = RIGHT_LOWER_ARM_START_X;
    private static final double RIGHT_LOWER_ARM_START_Y = RIGHT_UPPER_ARM_END_Y;
    private static final double RIGHT_LOWER_ARM_END_Y = RIGHT_LOWER_ARM_START_Y + LOWER_ARM_LENGTH;

    private static final double LEFT_UPPER_LEG_START_X = BODY_END_X;
    private static final double LEFT_UPPER_LEG_END_X = LEFT_UPPER_LEG_START_X - HIP_WIDTH;
    private static final double LEFT_UPPER_LEG_START_Y = BODY_END_Y;
    private static final double LEFT_UPPER_LEG_END_Y = LEFT_UPPER_LEG_START_Y;

    private static final double LEFT_LOWER_LEG_START_X = LEFT_UPPER_LEG_END_X;
    private static final double LEFT_LOWER_LEG_END_X = LEFT_LOWER_LEG_START_X;
    private static final double LEFT_LOWER_LEG_START_Y = LEFT_UPPER_LEG_END_Y;
    private static final double LEFT_LOWER_LEG_END_Y = LEFT_LOWER_LEG_START_Y + LEG_LENGTH;

    private static final double RIGHT_UPPER_LEG_START_X = LEFT_UPPER_LEG_START_X;
    private static final double RIGHT_UPPER_LEG_END_X = RIGHT_UPPER_LEG_START_X + HIP_WIDTH;
    private static final double RIGHT_UPPER_LEG_START_Y = LEFT_UPPER_LEG_START_Y;
    private static final double RIGHT_UPPER_LEG_END_Y = RIGHT_UPPER_LEG_START_Y;

    private static final double RIGHT_LOWER_LEG_START_X = RIGHT_UPPER_LEG_END_X;
    private static final double RIGHT_LOWER_LEG_END_X = RIGHT_LOWER_LEG_START_X;
    private static final double RIGHT_LOWER_LEG_START_Y = RIGHT_UPPER_LEG_END_Y;
    private static final double RIGHT_LOWER_LEG_END_Y = RIGHT_LOWER_LEG_START_Y + LEG_LENGTH;

    private static final double LEFT_FOOT_START_X = LEFT_LOWER_LEG_END_X;
    private static final double LEFT_FOOT_END_X = LEFT_FOOT_START_X - FOOT_LENGTH;
    private static final double LEFT_FOOT_START_Y = LEFT_LOWER_LEG_END_Y;
    private static final double LEFT_FOOT_END_Y = LEFT_FOOT_START_Y;

    private static final double RIGHT_FOOT_START_X = RIGHT_LOWER_LEG_END_X;
    private static final double RIGHT_FOOT_END_X = RIGHT_FOOT_START_X + FOOT_LENGTH;
    private static final double RIGHT_FOOT_START_Y = RIGHT_LOWER_LEG_END_Y;
    private static final double RIGHT_FOOT_END_Y = RIGHT_FOOT_START_Y;

    private static final double GUESSED_WORD_LABEL_X = CANVAS_WIDTH / 8;
    private static final double GUESSED_WORD_LABEL_Y = VERTICAL_BEAM_START_Y
            + ((CANVAS_HEIGHT - VERTICAL_BEAM_START_Y) / 3);
    private static final int GUESSED_WORD_FONT_SIZE = 32;

    private static final double INCORRECT_GUESSES_LABEL_X = GUESSED_WORD_LABEL_X;
    private static final double INCORRECT_GUESSES_LABEL_Y = GUESSED_WORD_LABEL_Y + 50;
    private static final double INCORRECT_GUESSES_FONT_SIZE = 18;

    private List<Node> bodyParts;
    private Text guessedWordLabel;
    private Text incorrectGuessesLabel;
    private int numBodyPartsShown;
    private Group rootGroup;

    public HangmanCanvas(Stage primaryStage) {
        rootGroup = new Group();

        Canvas canvas = new Canvas(CANVAS_WIDTH, CANVAS_HEIGHT);
        rootGroup.getChildren().add(canvas);

        primaryStage.setScene(new Scene(rootGroup));
        primaryStage.show();

        bodyParts = new ArrayList<Node>();
        bodyParts.add(createHead());
        bodyParts.add(createBody());
        bodyParts.add(createLeftArm());
        bodyParts.add(createRightArm());
        bodyParts.add(createLeftLeg());
        bodyParts.add(createRightLeg());
        bodyParts.add(createLeftFoot());
        bodyParts.add(createRightFoot());
    }

    private Circle createHead() {
        Circle head = new Circle(HEAD_CENTER_X, HEAD_CENTER_Y, HEAD_RADIUS, Color.TRANSPARENT);
        head.setStroke(Color.BLACK);
        return head;
    }

    private Line createBody() {
        Line body = new Line(BODY_START_X, BODY_START_Y, BODY_END_X, BODY_END_Y);
        return body;
    }

    private Group createLeftArm() {
        Line leftUpperArm = new Line(LEFT_UPPER_ARM_START_X, LEFT_UPPER_ARM_START_Y, LEFT_UPPER_ARM_END_X,
                LEFT_UPPER_ARM_END_Y);
        Line leftLowerArm = new Line(LEFT_LOWER_ARM_START_X, LEFT_LOWER_ARM_START_Y, LEFT_LOWER_ARM_END_X,
                LEFT_LOWER_ARM_END_Y);

        Group leftArm = new Group(leftUpperArm, leftLowerArm);
        return leftArm;
    }

    private Group createRightArm() {
        Line rightUpperArm = new Line(RIGHT_UPPER_ARM_START_X, RIGHT_UPPER_ARM_START_Y, RIGHT_UPPER_ARM_END_X,
                RIGHT_UPPER_ARM_END_Y);
        Line rightLowerArm = new Line(RIGHT_LOWER_ARM_START_X, RIGHT_LOWER_ARM_START_Y, RIGHT_LOWER_ARM_END_X,
                RIGHT_LOWER_ARM_END_Y);

        Group rightArm = new Group(rightUpperArm, rightLowerArm);
        return rightArm;
    }

    private Group createLeftLeg() {
        Line leftUpperLeg = new Line(LEFT_UPPER_LEG_START_X, LEFT_UPPER_LEG_START_Y, LEFT_UPPER_LEG_END_X,
                LEFT_UPPER_LEG_END_Y);
        Line leftLowerLeg = new Line(LEFT_LOWER_LEG_START_X, LEFT_LOWER_LEG_START_Y, LEFT_LOWER_LEG_END_X,
                LEFT_LOWER_LEG_END_Y);

        Group leftLeg = new Group(leftUpperLeg, leftLowerLeg);
        return leftLeg;
    }

    private Group createRightLeg() {
        Line rightUpperLeg = new Line(RIGHT_UPPER_LEG_START_X, RIGHT_UPPER_LEG_START_Y, RIGHT_UPPER_LEG_END_X,
                RIGHT_UPPER_LEG_END_Y);
        Line rightLowerLeg = new Line(RIGHT_LOWER_LEG_START_X, RIGHT_LOWER_LEG_START_Y, RIGHT_LOWER_LEG_END_X,
                RIGHT_LOWER_LEG_END_Y);

        Group rightLeg = new Group(rightUpperLeg, rightLowerLeg);
        return rightLeg;
    }

    private Line createLeftFoot() {
        Line leftFoot = new Line(LEFT_FOOT_START_X, LEFT_FOOT_START_Y, LEFT_FOOT_END_X, LEFT_FOOT_END_Y);
        return leftFoot;
    }

    private Line createRightFoot() {
        Line rightFoot = new Line(RIGHT_FOOT_START_X, RIGHT_FOOT_START_Y, RIGHT_FOOT_END_X, RIGHT_FOOT_END_Y);
        return rightFoot;
    }

    /** Resets the display so that only the scaffold appears */
    public void reset() {
        drawScaffold();
        numBodyPartsShown = 0;
        guessedWordLabel = createGuessedWordLabel();
        incorrectGuessesLabel = createIncorrectGuessesLabel();
    }

    private void drawScaffold() {
        drawVerticalBeam();
        drawHorizontalBeam();
        drawRope();
    }

    private void drawVerticalBeam() {
        Line verticalBeam = new Line(VERTICAL_BEAM_START_X, VERTICAL_BEAM_START_Y, VERTICAL_BEAM_END_X,
                VERTICAL_BEAM_END_Y);
        rootGroup.getChildren().add(verticalBeam);
    }

    private void drawHorizontalBeam() {
        Line horizontalBeam = new Line(HORIZONTAL_BEAM_START_X, HORIZONTAL_BEAM_START_Y, HORIZONTAL_BEAM_END_X,
                HORIZONTAL_BEAM_END_Y);
        rootGroup.getChildren().add(horizontalBeam);
    }

    private void drawRope() {
        Line rope = new Line(ROPE_START_X, ROPE_START_Y, ROPE_END_X, ROPE_END_Y);
        rootGroup.getChildren().add(rope);
    }

    private Text createGuessedWordLabel() {
        Text guessedWordLabel = new Text(GUESSED_WORD_LABEL_X, GUESSED_WORD_LABEL_Y, "");
        guessedWordLabel.setFont(new Font(GUESSED_WORD_FONT_SIZE));

        return guessedWordLabel;
    }

    private Text createIncorrectGuessesLabel() {
        Text incorrectGuessesLabel = new Text(INCORRECT_GUESSES_LABEL_X, INCORRECT_GUESSES_LABEL_Y, "");
        incorrectGuessesLabel.setFont(new Font(INCORRECT_GUESSES_FONT_SIZE));

        return incorrectGuessesLabel;
    }

    /**
     * Updates the word on the screen to correspond to the current state of the
     * game. The argument string shows what letters have been guessed so far;
     * unguessed letters are indicated by hyphens.
     */
    public void displayWord(String word) {
        updateGuessedWord(word);
    }

    private void updateGuessedWord(String guessedWord) {
        rootGroup.getChildren().remove(guessedWordLabel);
        guessedWordLabel.setText(guessedWord);
        rootGroup.getChildren().add(guessedWordLabel);
    }

    /**
     * Updates the display to correspond to an incorrect guess by the user.
     * Calling this method causes the next body part to appear on the scaffold
     * and adds the letter to the list of incorrect guesses that appears at the
     * bottom of the window.
     */
    public void noteIncorrectGuess(char letter) {
        addNextBodyPart();
        updateIncorrectGuesses(letter);
    }

    private void addNextBodyPart() {
        if (numBodyPartsShown < bodyParts.size()) {
            Node bodyPartToAdd = bodyParts.get(numBodyPartsShown);

            rootGroup.getChildren().add(bodyPartToAdd);
            numBodyPartsShown++;
        }
    }

    private void updateIncorrectGuesses(char letter) {
        rootGroup.getChildren().remove(incorrectGuessesLabel);
        incorrectGuessesLabel.setText(incorrectGuessesLabel.getText() + letter);
        rootGroup.getChildren().add(incorrectGuessesLabel);
    }
}


text:
class LabelPattern;
class OutputFile;
class Settings;
class Target;

// BundleData holds the information required by "create_bundle" target.
class BundleData {
 public:
  using UniqueTargets = UniqueVector<const Target*>;
  using SourceFiles = std::vector<SourceFile>;
  using OutputFiles = std::vector<OutputFile>;
  using BundleFileRules = std::vector<BundleFileRule>;

  BundleData();
  ~BundleData();

  // Adds a bundle_data target to the recursive collection of all bundle_data
  // that the target depends on.
  void AddBundleData(const Target* target);

  // Called upon resolution of the target owning this instance of BundleData.
  // |owning_target| is the owning target.
  void OnTargetResolved(Target* owning_target);

  // Returns the list of inputs.
  void GetSourceFiles(SourceFiles* sources) const;

  // Returns the list of outputs.
  bool GetOutputFiles(const Settings* settings,
                      const Target* target,
                      OutputFiles* outputs,
                      Err* err) const;

  // Returns the list of outputs as SourceFile.
  bool GetOutputsAsSourceFiles(const Settings* settings,
                               const Target* target,
                               SourceFiles* outputs_as_source,
                               Err* err) const;

  // Returns the path to the compiled asset catalog. Only valid if
  // assets_catalog_sources() is not empty.
  SourceFile GetCompiledAssetCatalogPath() const;

  // Returns the path to the top-level directory of the bundle. This is
  // based on root_dir(), but since that can be Bundle.app/Contents/ or
  // any other subpath, this is just the most top-level directory (e.g.,
  // just Bundle.app/).
  //
  // Note that this is a SourceFile instead of a SourceDir. This is because
  // the output of a create_bundle rule is a single logical unit, even though
  // it is really a directory containing many outputs. This allows other
  // targets to treat the bundle as a single unit, rather than a collection
  // of its contents.
  SourceFile GetBundleRootDirOutput(const Settings* settings) const;

  // Performs GetBundleRootDirOutput but returns the result as a directory.
  SourceDir GetBundleRootDirOutputAsDir(const Settings* settings) const;

  // Returns directory where bundle is
  SourceDir GetBundleDir(const Settings* settings) const;

  // Returns the list of inputs for the compilation of the asset catalog.
  SourceFiles& assets_catalog_sources() { return assets_catalog_sources_; }
  const SourceFiles& assets_catalog_sources() const {
    return assets_catalog_sources_;
  }

  // Returns the list of dependencies for the compilation of the asset catalog.
  std::vector<const Target*> assets_catalog_deps() const {
    return assets_catalog_deps_;
  }

  BundleFileRules& file_rules() { return file_rules_; }
  const BundleFileRules& file_rules() const { return file_rules_; }

  SourceDir& root_dir() { return root_dir_; }
  const SourceDir& root_dir() const { return root_dir_; }

  SourceDir& contents_dir() { return contents_dir_; }
  const SourceDir& contents_dir() const { return contents_dir_; }

  SourceDir& resources_dir() { return resources_dir_; }
  const SourceDir& resources_dir() const { return resources_dir_; }

  SourceDir& executable_dir() { return executable_dir_; }
  const SourceDir& executable_dir() const { return executable_dir_; }

  std::map<std::string, std::string>& xcode_extra_attributes() {
    return xcode_extra_attributes_;
  }
  const std::map<std::string, std::string>& xcode_extra_attributes() const {
    return xcode_extra_attributes_;
  }

  std::string& product_type() { return product_type_; }
  const std::string& product_type() const { return product_type_; }

  std::string& xcode_test_application_name() {
    return xcode_test_application_name_;
  }
  const std::string& xcode_test_application_name() const {
    return xcode_test_application_name_;
  }

  void set_partial_info_plist(const SourceFile& partial_info_plist) {
    partial_info_plist_ = partial_info_plist;
  }
  const SourceFile& partial_info_plist() const { return partial_info_plist_; }

  void set_code_signing_script(const SourceFile& script_file) {
    code_signing_script_ = script_file;
  }
  const SourceFile& code_signing_script() const { return code_signing_script_; }

  std::vector<SourceFile>& code_signing_sources() {
    return code_signing_sources_;
  }
  const std::vector<SourceFile>& code_signing_sources() const {
    return code_signing_sources_;
  }

  SubstitutionList& code_signing_outputs() { return code_signing_outputs_; }
  const SubstitutionList& code_signing_outputs() const {
    return code_signing_outputs_;
  }

  SubstitutionList& code_signing_args() { return code_signing_args_; }
  const SubstitutionList& code_signing_args() const {
    return code_signing_args_;
  }

  std::vector<LabelPattern>& bundle_deps_filter() {
    return bundle_deps_filter_;
  }
  const std::vector<LabelPattern>& bundle_deps_filter() const {
    return bundle_deps_filter_;
  }

  SubstitutionList& xcasset_compiler_flags() { return xcasset_compiler_flags_; }
  const SubstitutionList& xcasset_compiler_flags() const {
    return xcasset_compiler_flags_;
  }

  // Recursive collection of all bundle_data that the target depends on.
  const UniqueTargets& bundle_deps() const { return bundle_deps_; }

  // Returns whether the bundle is a framework bundle.
  bool is_framework() const {
    return product_type_ == "com.apple.product-type.framework";
  }

 private:
  SourceFiles assets_catalog_sources_;
  std::vector<const Target*> assets_catalog_deps_;
  BundleFileRules file_rules_;
  UniqueTargets bundle_deps_;
  std::vector<LabelPattern> bundle_deps_filter_;

  // All those values are subdirectories relative to root_build_dir, and apart
  // from root_dir_, they are either equal to root_dir_ or subdirectories of it.
  SourceDir root_dir_;
  SourceDir contents_dir_;
  SourceDir resources_dir_;
  SourceDir executable_dir_;

  // The specified attributes will append to the build settings of the generated
  // Xcode target.
  std::map<std::string, std::string> xcode_extra_attributes_;

  // This is the target type as known to Xcode. This is only used to generate
  // the Xcode project file when using --ide=xcode.
  std::string product_type_;

  // Each Xcode unit test or ui test target must have a test application target,
  // and this value corresponds to the target name. This is only used to
  // generate the Xcode project when using --ide=xcode.
  std::string xcode_test_application_name_;

  // Path to the partial Info.plist generated by the asset catalog compiler
  // (corresponds to {{bundle_partial_info_plist}} expansion).
  SourceFile partial_info_plist_;

  // Holds the values (script name, sources, outputs, script arguments) for the
  // code signing step if defined.
  SourceFile code_signing_script_;
  std::vector<SourceFile> code_signing_sources_;
  SubstitutionList code_signing_outputs_;
  SubstitutionList code_signing_args_;
  SubstitutionList xcasset_compiler_flags_;

  BundleData(const BundleData&) = delete;
  BundleData& operator=(const BundleData&) = delete;
};

#endif  // TOOLS_GN_BUNDLE_DATA_H_

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport;

use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRTypeInterface;

/**
 * A summary of information based on the results of executing a TestScript.
 *
 * Class FHIRTestReportAction
 * @package \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport
 */
class FHIRTestReportAction extends FHIRBackboneElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_TEST_REPORT_DOT_ACTION;
    const FIELD_ASSERT = 'assert';
    const FIELD_OPERATION = 'operation';

    /** @var string */
    private $_xmlns = 'http://hl7.org/fhir';

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The results of the assertion performed on the previous operations.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAssert
     */
    protected $assert = null;

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The operation performed.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportOperation
     */
    protected $operation = null;

    /**
     * Validation map for fields in type TestReport.Action
     * @var array
     */
    private static $_validationRules = [    ];

    /**
     * FHIRTestReportAction Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIRTestReportAction::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_ASSERT])) {
            if ($data[self::FIELD_ASSERT] instanceof FHIRTestReportAssert) {
                $this->setAssert($data[self::FIELD_ASSERT]);
            } else {
                $this->setAssert(new FHIRTestReportAssert($data[self::FIELD_ASSERT]));
            }
        }
        if (isset($data[self::FIELD_OPERATION])) {
            if ($data[self::FIELD_OPERATION] instanceof FHIRTestReportOperation) {
                $this->setOperation($data[self::FIELD_OPERATION]);
            } else {
                $this->setOperation(new FHIRTestReportOperation($data[self::FIELD_OPERATION]));
            }
        }
    }

    /**
     * @return string
     */
    public function _getFHIRTypeName()
    {
        return self::FHIR_TYPE_NAME;
    }

    /**
     * @return string
     */
    public function _getFHIRXMLElementDefinition()
    {
        $xmlns = $this->_getFHIRXMLNamespace();
        if (null !== $xmlns) {
            $xmlns = " xmlns=\"{$xmlns}\"";
        }
        return "<TestReportAction{$xmlns}></TestReportAction>";
    }

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The results of the assertion performed on the previous operations.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAssert
     */
    public function getAssert()
    {
        return $this->assert;
    }

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The results of the assertion performed on the previous operations.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAssert $assert
     * @return static
     */
    public function setAssert(FHIRTestReportAssert $assert = null)
    {
        $this->assert = $assert;
        return $this;
    }

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The operation performed.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportOperation
     */
    public function getOperation()
    {
        return $this->operation;
    }

    /**
     * A summary of information based on the results of executing a TestScript.
     *
     * The operation performed.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportOperation $operation
     * @return static
     */
    public function setOperation(FHIRTestReportOperation $operation = null)
    {
        $this->operation = $operation;
        return $this;
    }

    /**
     * Returns the validation rules that this type's fields must comply with to be considered "valid"
     * The returned array is in ["fieldname[.offset]" => ["rule" => {constraint}]]
     *
     * @return array
     */
    public function _getValidationRules()
    {
        return self::$_validationRules;
    }

    /**
     * Validates that this type conforms to the specifications set forth for it by FHIR.  An empty array must be seen as
     * passing.
     *
     * @return array
     */
    public function _getValidationErrors()
    {
        $errs = parent::_getValidationErrors();
        $validationRules = $this->_getValidationRules();
        if (null !== ($v = $this->getAssert())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_ASSERT] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getOperation())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_OPERATION] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_ASSERT])) {
            $v = $this->getAssert();
            foreach($validationRules[self::FIELD_ASSERT] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_TEST_REPORT_DOT_ACTION, self::FIELD_ASSERT, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ASSERT])) {
                        $errs[self::FIELD_ASSERT] = [];
                    }
                    $errs[self::FIELD_ASSERT][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_OPERATION])) {
            $v = $this->getOperation();
            foreach($validationRules[self::FIELD_OPERATION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_TEST_REPORT_DOT_ACTION, self::FIELD_OPERATION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_OPERATION])) {
                        $errs[self::FIELD_OPERATION] = [];
                    }
                    $errs[self::FIELD_OPERATION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_MODIFIER_EXTENSION])) {
            $v = $this->getModifierExtension();
            foreach($validationRules[self::FIELD_MODIFIER_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_BACKBONE_ELEMENT, self::FIELD_MODIFIER_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_MODIFIER_EXTENSION])) {
                        $errs[self::FIELD_MODIFIER_EXTENSION] = [];
                    }
                    $errs[self::FIELD_MODIFIER_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_EXTENSION])) {
            $v = $this->getExtension();
            foreach($validationRules[self::FIELD_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_EXTENSION])) {
                        $errs[self::FIELD_EXTENSION] = [];
                    }
                    $errs[self::FIELD_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_ID])) {
            $v = $this->getId();
            foreach($validationRules[self::FIELD_ID] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_ID, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ID])) {
                        $errs[self::FIELD_ID] = [];
                    }
                    $errs[self::FIELD_ID][$rule] = $err;
                }
            }
        }
        return $errs;
    }

    /**
     * @param \SimpleXMLElement|string|null $sxe
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAction $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAction
     */
    public static function xmlUnserialize($sxe = null, PHPFHIRTypeInterface $type = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            return null;
        }
        if (is_string($sxe)) {
            libxml_use_internal_errors(true);
            $sxe = new \SimpleXMLElement($sxe, $libxmlOpts, false);
            if ($sxe === false) {
                throw new \DomainException(sprintf('FHIRTestReportAction::xmlUnserialize - String provided is not parseable as XML: %s', implode(', ', array_map(function(\libXMLError $err) { return $err->message; }, libxml_get_errors()))));
            }
            libxml_use_internal_errors(false);
        }
        if (!($sxe instanceof \SimpleXMLElement)) {
            throw new \InvalidArgumentException(sprintf('FHIRTestReportAction::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIRTestReportAction;
        } elseif (!is_object($type) || !($type instanceof FHIRTestReportAction)) {
            throw new \RuntimeException(sprintf(
                'FHIRTestReportAction::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRTestReport\FHIRTestReportAction or null, %s seen.',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }
        FHIRBackboneElement::xmlUnserialize($sxe, $type);
        $xmlNamespaces = $sxe->getDocNamespaces(false, false);
        if ([] !== $xmlNamespaces) {
            $ns = reset($xmlNamespaces);
            if (false !== $ns && '' !== $ns) {
                $type->_xmlns = $ns;
            }
        }
        $attributes = $sxe->attributes();
        $children = $sxe->children();
        if (isset($children->assert)) {
            $type->setAssert(FHIRTestReportAssert::xmlUnserialize($children->assert));
        }
        if (isset($children->operation)) {
            $type->setOperation(FHIRTestReportOperation::xmlUnserialize($children->operation));
        }
        return $type;
    }

    /**
     * @param null|\SimpleXMLElement $sxe
     * @param null|int $libxmlOpts
     * @return \SimpleXMLElement
     */
    public function xmlSerialize(\SimpleXMLElement $sxe = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            $sxe = new \SimpleXMLElement($this->_getFHIRXMLElementDefinition(), $libxmlOpts, false);
        }
        parent::xmlSerialize($sxe);
        if (null !== ($v = $this->getAssert())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_ASSERT, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getOperation())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_OPERATION, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getAssert())) {
            $a[self::FIELD_ASSERT] = $v;
        }
        if (null !== ($v = $this->getOperation())) {
            $a[self::FIELD_OPERATION] = $v;
        }
        if ([] !== ($vs = $this->_getFHIRComments())) {
            $a[PHPFHIRConstants::JSON_FIELD_FHIR_COMMENTS] = $vs;
        }
        return $a;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return self::FHIR_TYPE_NAME;
    }
}


text:
package myfeed.discovery;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

/**
 * @author Spencer Gibb
 */
@SpringBootApplication
@EnableEurekaServer
public class DiscoveryApp {
	public static void main(String[] args) {
		SpringApplication.run(DiscoveryApp.class, args);
	}
}


text:
// <auto-generated />
using GithubTrendingVisualizer.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using System;

namespace GithubTrendingVisualizer.Web.Migrations
{
    [DbContext(typeof(Context))]
    [Migration("20170918011347_InitialCreate")]
    partial class InitialCreate
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("GithubTrendingVisualizer.Data.Models.Repository", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.HasKey("Id");

                    b.ToTable("Repository");
                });

            modelBuilder.Entity("GithubTrendingVisualizer.Data.Models.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.HasKey("Id");

                    b.ToTable("Users");
                });
#pragma warning restore 612, 618
        }
    }
}


text:
'use strict';

/**
 *  @ngdoc directive
 *  @name zeus.utils.directive:useColor
 *
 *  @restrict A
 *
 *  @requires zeus.utils.Colors
 *
 *  @description
 *  A directive that assigns a color value to a particular attribute of
 *  a directive
 *
 *
 *  @param {object} useColor An object literal containing the attribute name (key) to
 *  which a color (value) may be assigned
 *
 *  @example
 <example module="zeus.demo">
    <file name="index.html">

            <colored-square text="Hobbit"
                use-color="{'bgColor': 'HOBBIT'}">
            </colored-square>

            <colored-square text="Wizard"
                use-color="{'bgColor': race}">
            </colored-square>

    </file>
    <file name="app.js">
        angular.module( 'zeus.demo', [ 'zeus.utils' ] );
        angular.module( 'zeus.demo' ).config( function ( $zsColorProvider ) {
                $zsColorProvider.
                    setColor( 'HOBBIT', '#8bc34a' ).
                    setColor( 'WIZARD', '#ffc107' );
            }
        );
    </file>

    <file name="color_square.js">
        angular.module( 'zeus.demo' ).directive( 'coloredSquare',
            function () {

                return {
                    template: '
Hello
',
                    replace: true,
                    link: function ( scope, el ) {
                        el.css( { backgroundColor: scope.bgColor } ).text( scope.text );
                    },
                    scope: {
                        bgColor: '@',
                        text: '@'
                    }

                };
            }
        );
    </file>

    <file name="myCtrl.js">
        angular.module( 'zeus.demo' ).controller( 'myCtrl', function ( $scope ) {
            $scope.race = 'WIZARD';
        } );
    </file>
 </example>
 **/
angular.module( 'zeus.utils' )
    .directive( 'useColor', [ '$zsColor', function ( $zsColor ) {

        var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g,
            MOZ_HACK_REGEXP = /^moz([A-Z])/,
            rAttrComponent = /((?:'(?:[\w\-]+)')|(?:'{0}\w+'{0}))\s*:\s*(?:\w+|(?:'\w+'))\s*,?/g,
            rColorComponent = /(?:(?:'(?:[\w\-])+')|(?:(?:[\w\-]+)))\s*:\s*(\w+|(?:'\w+'))\s*,?/g,
            camelCase, findColorAttrs, findColorValues, extractColorAttrName,
            compileFn, preLinkFn;

        // Borrowed from https://github.com/angular/angular.js/blob/master/src/jqLite.js
        camelCase = function ( name ) {
            return name.replace( SPECIAL_CHARS_REGEXP,
                        function ( _, separator, letter, offset ) {
                            return offset ? letter.toUpperCase() : letter;
                        } ).
                        replace( MOZ_HACK_REGEXP, 'Moz$1' );
        };

        findColorAttrs = function ( str ) {
            var result = [],
                matches;

            while ( ( matches = rAttrComponent.exec( str ) ) !== null ) {
                result.push( matches[ 1 ] );
            }

            return result;
        };

        findColorValues = function ( str ) {
            var result = [],
            matches;

            while ( ( matches = rColorComponent.exec( str ) ) !== null ) {
                result.push( matches[ 1 ] );
            }

            return result;
        };

        extractColorAttrName = function ( attrName ) {
            var rActualColorAttrName = /'?([\w\-]+)'?/,
                attr;

            attr = rActualColorAttrName.exec( attrName );
            if ( attr && attr[ 1 ] ) {
                return attr[ 1 ];
            }
        };

        compileFn = function ( element, attrs ) {
            var colorAttrsList, colorKeysList, colorAttr,
                a, k, i, len;

            colorAttrsList = findColorAttrs( attrs.useColor );
            colorKeysList = findColorValues( attrs.useColor );

            i = 1;
            len = colorAttrsList.length;

            for ( i = 0; i < len; i++ ) {
                a = colorAttrsList[ i ];
                k = colorKeysList[ i ];

                colorAttr = extractColorAttrName( a );
                attrs.$set( camelCase( colorAttr ), k );

            }

            return {
                pre: preLinkFn
            };
        };

        preLinkFn = function ( scope, element, attrs ) {
            var colorAttrsList,
                a, c, k, i, len;

            colorAttrsList = findColorAttrs( attrs.useColor );

            i = 1;
            len = colorAttrsList.length;

            for ( i = 0; i < len; i++ ) {
                a = extractColorAttrName( colorAttrsList[ i ] );
                a = camelCase( a );
                k = scope.$eval( attrs[ a ] );
                c = $zsColor.getColor( k );
                if ( c ) {
                    attrs.$set( a, c );
                }
            }

        };

        return {
            restrict: 'A',
            priority: 1001,
            compile: compileFn
        };
    }
] );


text:
'''
Classes used to represent a Management Protocol
'''
from .relationships import (ATTACHMENT, CONNECTION, DEPENDENCY, ENDPOINT,
                            FEATURE, HOST, STORAGE)

class Protocol():
    '''
    The Protocol class representation.

    Attributes:
    initial_state -- the initial state (type:State)
    current_state -- the current state (type:State)
    states        -- a list of States (type:[State])
    transitions   -- the list of transitions (type:[Transition])
    '''
    def __init__(self):
        """Create a new Protocol object."""
        self.states = []
        self.transitions = []
        self._initial_state = None
        self._current_state = None

    @property
    def initial_state(self):
        return self._initial_state

    @initial_state.setter
    def initial_state(self, state):
        assert isinstance(state, State)
        self.current_state = self._initial_state = state

    @property
    def current_state(self):
        return self._current_state

    @current_state.setter
    def current_state(self, state):
        assert isinstance(state, State)
        self._current_state = state

    def find_state(self, state_name):
        """Find the state object given its name."""
        return next((s for s in self.states if state_name == s.name), None)

    def reset(self):
        """Reset the protocol state."""
        self.current_state = self.initial_state

    def is_reset(self):
        return self.current_state == self.initial_state

    def execute_operation(self, operation):
        """Execute the operation and change the current state."""
        next_state = self.next_state(operation)
        if next_state is None:
            return None
        self.current_state = next_state
        return next_state

    def next_state(self, operation):
        """Return the state reached from the current state with the given operation."""
        return self.current_state.next_state(operation)

    def next_transition(self, operation):
        """Return the transition reached with the given operation."""
        return self.current_state.next_transition(operation)

    def __str__(self):
        return 'States: {}\nTransitions: {}\nInitial state: {}\nCurrent state: {}'.format(
            ', '.join((str(s) for s in self.states)),
            ', '.join((str(t) for t in self.transitions)),
            self.initial_state, self.current_state
        )

class State():
    """
    The protocol State class representation.

    Attributes:
    name        -- the State name (type:str)
    offers      -- the list of the capability offered in the state (type:[str])
    requires    -- the list of the requirement required in the state (type:[str])
    transitions -- the transition list (type:[Transition])
    """
    def __init__(self, name, requires=None, offers=None, transitions=None):
        """Create a new State object."""
        self.name = name
        self.requires = requires if requires is not None else []
        self.offers = offers if offers is not None else []
        self.transitions = transitions if transitions is not None else []

    def next_transition(self, operation):
        """Return the transition reached with the given operation."""
        return next((t for t in self.transitions if t.full_operation == operation), None)

    def next_state(self, operation):
        """Return the state reached with the given operation."""
        transition = self.next_transition(operation)
        return transition.target if transition is not None else None

    def __eq__(self, other):
        return isinstance(other, State) and\
               self.name == other.name

    def __str__(self):
        return '({}, r=[{}], o=[{}], t=[{}])'.format(
            self.name, ','.join(self.requires), ','.join(self.offers),
            ','.join((t.full_operation for t in self.transitions)))

class Transition():
    """
    The protocol Transition class represention.

    Attributes:
    name -- the name Transition name (type:str)
    source -- the source state of the Transition (type:State)
    target -- the target state of the Transition (type:State)
    interface -- the interface name (type:str)
    operation -- the operation name to be executed to change the State (type:str)
    """
    def __init__(self, source=None, target=None, interface='Standard',
                 operation=None, requires=None):
        """Create a new Transition object."""
        self.source = source
        self.target = target
        self.interface = interface
        self.operation = operation
        self.requires = requires if requires is not None else []

    @property
    def full_operation(self):
        return '.'.join((self.interface, self.operation))

    def __eq__(self, other):
        return isinstance(other, Transition) and\
               self.source == other.source and\
               self.target == other.target and\
               self.full_operation == other.full_operation

    def __str__(self):
        return '(s={}, t={}, o={}, r=[{}])'.format(
            self.source.name, self.target.name, self.full_operation, ','.join(self.requires))

# Protocols constants
ALIVE = 'alive'
CONTAINER_STATES = CONTAINER_STATE_DELETED, CONTAINER_STATE_CREATED, CONTAINER_STATE_RUNNING =\
                   'deleted', 'created', 'running'
SOFTWARE_STATES = SOFTWARE_STATE_DELETED, SOFTWARE_STATE_CREATED, SOFTWARE_STATE_CONFIGURED,\
                  SOFTWARE_STATE_RUNNING, SOFTWARE_STATE_ZOTTED = 'deleted', 'created',\
                  'configured', 'running', 'zotted'
VOLUME_STATES = VOLUME_STATE_DELETED, VOLUME_STATE_CREATED = 'deleted', 'created'

STATES = STATE_DELETED, STATE_CREATED, STATE_CONFIGURED, STATE_RUNNING, STATE_ZOTTED =\
         SOFTWARE_STATES

# Default protocols
def get_container_protocol():
    """Return the default protocol for the Container component."""
    protocol = Protocol()
    protocol.states = deleted, created, running = [
        State(CONTAINER_STATE_DELETED),
        State(CONTAINER_STATE_CREATED, offers=[ALIVE]),
        State(CONTAINER_STATE_RUNNING,
              requires=[STORAGE, CONNECTION, DEPENDENCY],
              offers=[ALIVE, HOST, ENDPOINT, FEATURE])
    ]
    protocol.initial_state = deleted

    protocol.transitions = create, start, stop, delete = [
        Transition(deleted, created, operation='create'),
        Transition(created, running, operation='start'),
        Transition(running, created, operation='stop'),
        Transition(created, deleted, operation='delete')
    ]

    deleted.transitions = [create]
    created.transitions = [delete, start]
    running.transitions = [stop]

    return protocol

def get_software_protocol():
    """Return the default protocol for the Software component."""
    protocol = Protocol()
    protocol.states = deleted, created, configured, running = [
        State(SOFTWARE_STATE_DELETED),
        State(SOFTWARE_STATE_CREATED, requires=[ALIVE], offers=[ALIVE]),
        State(SOFTWARE_STATE_CONFIGURED, requires=[ALIVE], offers=[ALIVE]),
        State(SOFTWARE_STATE_RUNNING,
              requires=[ALIVE, HOST, CONNECTION, DEPENDENCY],
              offers=[ALIVE, HOST, ENDPOINT, FEATURE])
    ]
    protocol.initial_state = deleted

    protocol.transitions = create, configure, start, stop, delete, delete_conf = [
        Transition(deleted, created, operation='create', requires=[HOST]),
        Transition(created, configured, operation='configure', requires=[HOST]),
        Transition(configured, running, operation='start', requires=[HOST]),
        Transition(running, configured, operation='stop', requires=[HOST]),
        Transition(created, deleted, operation='delete', requires=[HOST]),
        Transition(configured, deleted, operation='delete', requires=[HOST])
    ]

    deleted.transitions = [create]
    created.transitions = [delete, configure]
    configured.transitions = [start, delete_conf]
    running.transitions = [stop]

    return protocol

def get_volume_protocol():
    """Return the default protocol for the Volume component."""
    protocol = Protocol()
    protocol.states = deleted, created = [
        State(VOLUME_STATE_DELETED),
        State(VOLUME_STATE_CREATED, offers=[ATTACHMENT])
    ]
    protocol.initial_state = deleted

    protocol.transitions = create, delete = [
        Transition(deleted, created, operation='create'),
        Transition(created, deleted, operation='delete')
    ]

    deleted.transitions = [create]
    created.transitions = [delete]

    return protocol


text:
from . import StoreComponent, TierComponent, StoreComponents, TierComponents

class AppStoreStoreComponent(StoreComponent):

    LIVE_VERIFY_URL = "https://sandbox.itunes.apple.com/verifyReceipt"
    SANDBOX_VERIFY_URL = "https://buy.itunes.apple.com/verifyReceipt"

    def __init__(self):
        super(AppStoreStoreComponent, self).__init__()
        self.sandbox = False

    def dump(self):
        result = super(AppStoreStoreComponent, self).dump()
        result.update({
            "sandbox": self.sandbox
        })
        return result

    def load(self, data):
        super(AppStoreStoreComponent, self).load(data)
        self.sandbox = data.get("sandbox")

class AppStoreTierComponent(TierComponent):
    def __init__(self):
        super(AppStoreTierComponent, self).__init__()

StoreComponents.register_component("appstore", AppStoreStoreComponent)
TierComponents.register_component("appstore", AppStoreTierComponent)


text:
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}

-- The code from the ticket lacked these extensions,
-- but crashed the compiler with "GHC internal error"
-- It doesn't crash now; and in this test case I've added
-- the extensions, which makes it compile cleanly
{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances, FunctionalDependencies #-}

module T12055 where

import GHC.Base ( Constraint, Type )
import GHC.Exts ( type (~~) )

type Cat k = k -> k -> Type

class Category (p :: Cat k) where
    type Ob p :: k -> Constraint

class (Category (Dom f), Category (Cod f)) => Functor (f :: j -> k) where
    type Dom f :: Cat j
    type Cod f :: Cat k
    functor :: forall a b.
               Iso Constraint (:-) (:-)
               (Ob (Dom f) a)     (Ob (Dom f) b)
               (Ob (Cod f) (f a)) (Ob (Cod f) (f b))

class (Functor f , Dom f ~ p, Cod f ~ q) =>
    Fun (p :: Cat j) (q :: Cat k) (f :: j -> k) | f -> p q
instance (Functor f , Dom f ~ p, Cod f ~ q) =>
    Fun (p :: Cat j) (q :: Cat k) (f :: j -> k)

data Nat (p :: Cat j) (q :: Cat k) (f :: j -> k) (g :: j -> k)

type Iso k (c :: Cat k) (d :: Cat k) s t a b =
    forall p. (Cod p ~~ Nat d (->)) => p a b -> p s t

data (p :: Constraint) :- (q :: Constraint)


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/specific-people/pioneers/gailey-john-1814-1887" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/gailey-john-1814-1887</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Gailey, John 1814-1887</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/gailey-john-1814-1887</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/gailey-john-1814-1887</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
class ModuleDocFragment(object):
    # Parameters for VMware modules
    DOCUMENTATION = r'''
options:
    hostname:
      description:
      - The hostname or IP address of the vSphere vCenter or ESXi server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead.
      - Environment variable support added in Ansible 2.6.
      type: str
    username:
      description:
      - The username of the vSphere vCenter or ESXi server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead.
      - Environment variable support added in Ansible 2.6.
      type: str
      aliases: [ admin, user ]
    password:
      description:
      - The password of the vSphere vCenter or ESXi server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead.
      - Environment variable support added in Ansible 2.6.
      type: str
      aliases: [ pass, pwd ]
    validate_certs:
      description:
      - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead.
      - Environment variable support added in Ansible 2.6.
      - If set to C(yes), please make sure Python >= 2.7.9 is installed on the given machine.
      type: bool
      default: yes
    port:
      description:
      - The port number of the vSphere vCenter or ESXi server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT) will be used instead.
      - Environment variable support added in Ansible 2.6.
      type: int
      default: 443
      version_added: '2.5'
'''

    # This doc fragment is specific to vcenter modules like vcenter_license
    VCENTER_DOCUMENTATION = r'''
options:
    hostname:
      description:
      - The hostname or IP address of the vSphere vCenter server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead.
      - Environment variable supported added in Ansible 2.6.
      type: str
    username:
      description:
      - The username of the vSphere vCenter server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead.
      - Environment variable supported added in Ansible 2.6.
      type: str
      aliases: [ admin, user ]
    password:
      description:
      - The password of the vSphere vCenter server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead.
      - Environment variable supported added in Ansible 2.6.
      type: str
      aliases: [ pass, pwd ]
    validate_certs:
      description:
      - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead.
      - Environment variable supported added in Ansible 2.6.
      - If set to C(yes), please make sure Python >= 2.7.9 is installed on the given machine.
      type: bool
      default: yes
    port:
      description:
      - The port number of the vSphere vCenter server.
      - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT) will be used instead.
      - Environment variable supported added in Ansible 2.6.
      type: int
      default: 443
      version_added: '2.5'
    '''


text:
package org.hisp.dhis.android.core.relationship;

import android.database.Cursor;

import androidx.annotation.Nullable;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.gabrielittner.auto.value.cursor.ColumnAdapter;
import com.google.auto.value.AutoValue;

import org.hisp.dhis.android.core.arch.db.adapters.enums.internal.RelationshipConstraintTypeColumnAdapter;
import org.hisp.dhis.android.core.arch.db.adapters.enums.internal.RelationshipEntityTypeColumnAdapter;
import org.hisp.dhis.android.core.arch.db.adapters.identifiable.internal.ObjectWithUidColumnAdapter;
import org.hisp.dhis.android.core.common.BaseObject;
import org.hisp.dhis.android.core.common.ObjectWithUid;

@AutoValue
@JsonDeserialize(builder = AutoValue_RelationshipConstraint.Builder.class)
public abstract class RelationshipConstraint extends BaseObject {

    @Nullable
    @JsonIgnore()
    @ColumnAdapter(ObjectWithUidColumnAdapter.class)
    public abstract ObjectWithUid relationshipType();

    @Nullable
    @JsonIgnore()
    @ColumnAdapter(RelationshipConstraintTypeColumnAdapter.class)
    public abstract RelationshipConstraintType constraintType();

    @Nullable
    @ColumnAdapter(RelationshipEntityTypeColumnAdapter.class)
    public abstract RelationshipEntityType relationshipEntity();

    @Nullable
    @ColumnAdapter(ObjectWithUidColumnAdapter.class)
    public abstract ObjectWithUid trackedEntityType();

    @Nullable
    @ColumnAdapter(ObjectWithUidColumnAdapter.class)
    public abstract ObjectWithUid program();

    @Nullable
    @ColumnAdapter(ObjectWithUidColumnAdapter.class)
    public abstract ObjectWithUid programStage();

    public static RelationshipConstraint create(Cursor cursor) {
        return AutoValue_RelationshipConstraint.createFromCursor(cursor);
    }

    public static Builder builder() {
        return new AutoValue_RelationshipConstraint.Builder();
    }

    public abstract Builder toBuilder();

    @AutoValue.Builder
    @JsonPOJOBuilder(withPrefix = "")
    public static abstract class Builder extends BaseObject.Builder<Builder> {

        public abstract Builder relationshipType(ObjectWithUid relationshipType);

        public abstract Builder constraintType(RelationshipConstraintType constraintType);

        public abstract Builder relationshipEntity(RelationshipEntityType relationshipEntity);

        public abstract Builder trackedEntityType(ObjectWithUid trackedEntityType);

        public abstract Builder program(ObjectWithUid program);

        public abstract Builder programStage(ObjectWithUid programStage);

        public abstract RelationshipConstraint build();
    }
}


text:
struct BinaryMsg
{
  unsigned          type_;
  std::vector<char> data_;
};

template<typename M>
BinaryMsg serialize(M const& m)
{
  BinaryMsg b;
  b.type_ = M::type();
  b.data_.resize(sizeof(m));
  memcpy(b.data_.data(), &m, sizeof(m));
  return b;
}

template<typename M>
M deserialize(BinaryMsg const& b)
{
  M m;
  assert( M::type() == b.type_ );
  if( b.data_.size() != sizeof(m) )
    throw std::runtime_error("invalid payload size");
  memcpy(&m, b.data_.data(), sizeof(m));
  return m;
}


text:
package com.google.gwt.dom.client;

/**
 * Audio element.
 *
 *

 * Experimental API: This API is still under development
 * and is subject to change.
 *
 *

 *
 * @see W3C HTML 5 Specification
 */
@TagName(AudioElement.TAG)
public class AudioElement extends MediaElement {

  /**
   * The tag for this element.
   */
  public static final String TAG = "audio";

  /**
   * The audio type of MP3 encoded audio.
   */
  public static final String TYPE_MP3 = "audio/mpeg";

  /**
   * The audio type of Ogg encoded audio.
   */
  public static final String TYPE_OGG = "audio/ogg";

  /**
   * The audio type of WAV encoded audio.
   */
  public static final String TYPE_WAV = "audio/wav";

  protected AudioElement() {
  }
}


text:
<Type Name="PPWebSocketCloseCode" FullName="PepperSharp.PPWebSocketCloseCode">
  <TypeSignature Language="C#" Value="public enum PPWebSocketCloseCode" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed PPWebSocketCloseCode extends System.Enum" />
  <AssemblyInfo>
    <AssemblyName>Xamarin.PepperSharp</AssemblyName>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Enum</BaseTypeName>
  </Base>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
    PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE
    PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN
    PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX
    PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN
    PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX
  </Docs>
  <Members>
    <Member MemberName="WebsocketstatuscodeAbnormalClosure">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeAbnormalClosure" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeAbnormalClosure = int32(1006)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeGoingAway">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeGoingAway" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeGoingAway = int32(1001)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeInternalServerError">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeInternalServerError" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeInternalServerError = int32(1011)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeInvalidFramePayloadData">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeInvalidFramePayloadData" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeInvalidFramePayloadData = int32(1007)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeMandatoryExtension">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeMandatoryExtension" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeMandatoryExtension = int32(1010)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeMessageTooBig">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeMessageTooBig" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeMessageTooBig = int32(1009)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeNormalClosure">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeNormalClosure" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeNormalClosure = int32(1000)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeNoStatusReceived">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeNoStatusReceived" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeNoStatusReceived = int32(1005)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeNotSpecified">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeNotSpecified" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeNotSpecified = int32(1005)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodePolicyViolation">
      <MemberSignature Language="C#" Value="WebsocketstatuscodePolicyViolation" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodePolicyViolation = int32(1008)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeProtocolError">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeProtocolError" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeProtocolError = int32(1002)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeTlsHandshake">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeTlsHandshake" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeTlsHandshake = int32(1015)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeUnsupportedData">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeUnsupportedData" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeUnsupportedData = int32(1003)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeUserPrivateMax">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeUserPrivateMax" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeUserPrivateMax = int32(4999)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeUserPrivateMin">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeUserPrivateMin" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeUserPrivateMin = int32(4000)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeUserRegisteredMax">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeUserRegisteredMax" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeUserRegisteredMax = int32(3999)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="WebsocketstatuscodeUserRegisteredMin">
      <MemberSignature Language="C#" Value="WebsocketstatuscodeUserRegisteredMin" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype PepperSharp.PPWebSocketCloseCode WebsocketstatuscodeUserRegisteredMin = int32(3000)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>PepperSharp.PPWebSocketCloseCode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
  </Members>
</Type>


text:
$(document).ready(function() {

  //
  //
  // if ($.browser.webkit) {
  //   module("Webkit");
  //   test("should support the fancy attributes", function() {
  //     equal(HTML5Support.supports_attribute('placeholder'), true, "should support placeholder attribute");
  //     equal(HTML5Support.supports_attribute('autofocus'), true, "should support autofocus attribute");
  //   });
  // } else {
  //   module("Non-webkit browsers");
  //   test("should not support fancy attributes", function() {
  //     equal(HTML5Support.supports_attribute('placeholder'), false, "should not support placeholder attribute");
  //     equal(HTML5Support.supports_attribute('autofocus'), false, "should not support autofocus attribute");
  //   });
  // }

  module("placeholder attribute");
  if (HTML5Support.supports_attribute('placeholder')) {
    test("with placeholder support", function() {
      var input = $('#with_placeholder');
      equal(input[0].placeholder, "foobar", "elements placeholder accessor should have the placeholder value");

      input.placeholder();
      equal(input[0].className, "");
      equal(input.val(), "");
    });
  } else {
    test("without placeholder support", function() {
      var input = $('#with_placeholder'),
          expected_placeholder_value = $.browser.msie ? "foobar" : undefined;
      equal(input[0].placeholder, expected_placeholder_value, "elements placeholder accessor should be undefined");

      input.placeholder();
      equal(input[0].className, "placeholder");
      equal(input.val(), "foobar\u00A0\u00A0\u00A0");
    });
  }

  module("Password placeholder");
  if (HTML5Support.supports_attribute('placeholder')) {
    test("with placeholder support", function() {
      var input = $('#password_field'),
          n_fields = $('#test_form input').length;
      input.placeholder();
      equal($('#test_form input').length, n_fields, "expected the number of fields not to change");
    });
  } else {
    test("without placeholder support", function() {
      var input = $('#password_field'),
          n_fields = $('#test_form input').length;

      input.placeholder();

      var placeholder = input.next();
      equal($('#test_form input').length, n_fields+1, "there should still be 4 input fields");
      equal(placeholder.length, 1, 'we expect the new placeholder input to exist');
      ok(!input.is(':visible'), 'the input field should have been hidden');
      ok(placeholder.is(':visible'), "we should start out by seeing the placeholder");

      placeholder.focus();

      ok(input.is(':visible'), 'the input field should have been shown');
      ok(!placeholder.is(':visible'), 'the placeholder should have been hidden');

      // we could go through a whole cycle, but the next test does...

      input.blur();
    });

    test("without placeholder support and with already a value in the password field", function() {
      var input = $('#password_with_value'),
          n_fields = $('#test_form input').length;

      input.placeholder();

      var placeholder = input.next();
      equal($('#test_form input').length, n_fields+1, "there should still be 3 input fields");
      equal(placeholder.length, 1, 'we expect the new placeholder input to exist');
      ok(input.is(':visible'), 'the input field should have been hidden');
      ok(!placeholder.is(':visible'), "we should start out by seeing the placeholder");

      input.focus();

      ok(input.is(':visible'), 'the input field should still be shown');
      ok(!placeholder.is(':visible'), 'the placeholder should still be hidden');

      input.val(' '); input.blur();

      ok(!input.is(':visible'), 'the input field should have been hidden');
      ok(placeholder.is(':visible'), "the placeholder should have been shown");

      placeholder.focus(); input.val('secret').blur();

      ok(input.is(':visible'), 'the input field should be shown');
      ok(!placeholder.is(':visible'), 'the placeholder should be hidden');
    });
  }

  module("autofocus attribute");
  if (HTML5Support.supports_attribute('autofocus')) {
    test("with autofocus support", function() {
      var input = $('#autofocus_test'),
          input_has_been_focused = false;

      input.focus(function() {
        input_has_been_focused = true;
      });

      input.autofocus();
      ok(!input_has_been_focused, 'input should not have been focused on call to autofocus');
    });
  } else {
    test("without placeholder support", function() {
      var input = $('#autofocus_test'),
          input_has_been_focused = false;

      input.focus(function() {
        input_has_been_focused = true;
      });

      input.autofocus();
      ok(input_has_been_focused, 'input should have been focused on call to autofocus');
    });

    test("without placeholder support with the full attribute specifier", function() {
      var input = $('#autofocus_attr_test'),
          input_has_been_focused = false;

      input.focus(function() {
        input_has_been_focused = true;
      });

      input.autofocus();
      ok(input_has_been_focused, 'input should have been focused on call to autofocus');
    });

  }

});


text:
"""Test-appropriate entry points into the gRPC Python Beta API."""

import grpc
from grpc.beta import implementations

def not_really_secure_channel(host, port, channel_credentials,
                              server_host_override):
    """Creates an insecure Channel to a remote host.

  Args:
    host: The name of the remote host to which to connect.
    port: The port of the remote host to which to connect.
    channel_credentials: The implementations.ChannelCredentials with which to
      connect.
    server_host_override: The target name used for SSL host name checking.

  Returns:
    An implementations.Channel to the remote host through which RPCs may be
      conducted.
  """
    target = '%s:%d' % (host, port)
    channel = grpc.secure_channel(target, channel_credentials, (
        ('grpc.ssl_target_name_override', server_host_override,),))
    return implementations.Channel(channel)


text:
/* global $ch, $$CHOP */
$ch.define('store', function () {
  'use strict';

  $$CHOP.store = {};

  var cache = {
    _cache: {}
  };

  $$CHOP.store = {
    local: function (key, value) {
      if (typeof Storage === 'undefined') {
        throw new Error('Local storage is not supported by browser.');
      }

      if (arguments.length === 0) {
        throw new Error('$ch.store.local requires at least one parameter.');
      }

      if (arguments.length === 1) {
        var data = localStorage.getItem(key);
        if (data !== null) {
          data = JSON.parse(data);
        }
        return data;
      } else {
        if (value === undefined) {
          throw new Error('$ch.store.local does not allow undefined value.');
        }

        localStorage.setItem(key, JSON.stringify(value));
      }
    },

    session: function (key, value) {
      if (typeof Storage === 'undefined') {
        throw new Error('Session storage is not supported by browser.');
      }

      if (arguments.length === 0) {
        throw new Error('$ch.store.session requires at least one parameter.');
      }

      if (arguments.length === 1) {
        var data = sessionStorage.getItem(key);
        if (data !== null) {
          data = JSON.parse(data);
        }
        return data;
      } else {
        if (value === undefined) {
          throw new Error('$ch.store.session does not allow undefined value.');
        }

        sessionStorage.setItem(key, JSON.stringify(value));
      }
    },

    cookie: function (key, value, expDay) {
      if (document.cookie === undefined) {
        throw new Error('Cookie is not supported by this browser.');
      }

      var regex, data;
      if (arguments.length === 0) {
        data = document.cookie;
        if (data === undefined || data === '') {
          return '';
        }
        return data;
      }

      if (arguments.length === 1) {
        data = document.cookie;
        if (typeof key === 'object') {
          $$CHOP.each(key, function (k, v) {
            regex = new RegExp(k + '\\ *=[^;]{0,}', 'g');
            data = data.replace(regex, '');
            data = k + '=' + encodeURIComponent(v) + ';' + data;
          });
          document.cookie = data;
        }

        if (typeof key === 'string') {
          data = document.cookie;
          if (data === undefined || data === '') {
            return '';
          } else {
            regex = new RegExp(key + '\\ *=[^;]{0,}', 'g');
            var founds = data.match(regex);
            if (founds !== null) {
              var found =  founds[0];
              regex = new RegExp(key + '\\ *=\\ *', 'g');
              found = found.trim().replace(regex, '').trim();
              return decodeURIComponent(found);
            } else {
              return null;
            }
          }
        }
      }

      if (arguments.length >= 2) {
        data = document.cookie;
        if (data === undefined) {
          data = '';
        }

        regex = new RegExp(key + '\\ *=[0-9A-Za-z\\.\\ \\-%]+;?', 'g');
        data = data.replace(regex, '');
        data = key + '=' + encodeURIComponent(value) + ';' + data;

        if (arguments.length === 3) {
          if (expDay !== undefined) {
            expDay = parseFloat(expDay, 10);
          }

          var d = new Date();
          d.setTime(d.getTime() + (expDay*24*60*60*1000));
          var expires = "expires=" + d.toGMTString();
          document.cookie = data + "; " + expires;
        } else {
          document.cookie = data;
        }
      }
    },
    cookies: this.cookie,

    cache: function (key, value) {
      if (arguments.length === 0) {
        return cache._cache;
      }

      if (arguments.length === 1) {
        if (typeof key !== 'string') {
          throw new Error('$ch.store.cache requires a string-type parameter.');
        }

        return cache._cache[key];
      }

      if (arguments.length === 2) {
        if (typeof key !== 'string') {
          throw new Error('$ch.store.cache requires a string-type value for "key" parameter.');
        }

        cache._cache[key] = {};
        cache._cache[key] = value;
        return this;
      }
    }

  };

});


text:
title: BP205
layout: default
group: courses
---

# Biophysics 205A: Physical Underpinnings of Biological Systems (PUBS)

The PUBS course is a hands-on, project-based course that integrates proteomics, deep mutational profiling [(Fowler and Fields, _Nature Methods_, 2014)](http://cdn.fraserlab.com/pubs/2014_fowler.pdf), and computational biology.

- [PUBS 2014](/courses/pubs_2014/)
  - [Paper in eLife](http://cdn.fraserlab.com/publications/2016_mavor.pdf)
  - [eLIFEdigest: Yeast in a class of their own](https://medium.com/lifes-building-blocks/yeast-in-a-class-of-their-own-4dabb27653eb#.tcf71ly8z)
- [PUBS 2015](/courses/pubs_2015/)
- [PUBS 2016](http://kampmannlab.ucsf.edu/pubs-2016)
  - [Paper in Biology Open](http://cdn.fraserlab.com/publications/2018_mavor.pdf)

PUBS is now run by Martin Kampmann and examines alpha synuclein!
- [PUBS 2017](https://kampmannlab.ucsf.edu/pubs-2017)
- [PUBS 2018](https://kampmannlab.ucsf.edu/pubs-2017)

<img class="img-fluid mx-auto d-block" src="/static/img/pub/2016_mavor.jpg" alt="PUBS Students in the teaching lab">


text:
module Kirpich::Messaging
  class Slack

    include Virtus.model

    attribute :token, String
    attribute :auth, Hash
    attribute :bot, Kirpich::Bot

    def start
      Kirpich.logger.info "Starting slack service"

      ::Slack.configure { |config| config.token = token }
      @auth = ::Slack.auth_test
      raise_auth_error unless @auth['ok']
      client = ::Slack.realtime

      on_post = -> (request, text) { post(request, text) }
      @bot = Kirpich::Bot.new(on_post: on_post)

      client.on :message do |data|
        on_message(data)
      end

      client.on :reaction_added do |data|
        on_reaction(data)
      end

      client.start
    end

    def raise_auth_error
      Kirpich.logger.error "Slack auth error #{@auth['error']}"
      fail @auth['error']
    end

    def post(request, text)
      EM.next_tick do
        ::Slack.chat_postMessage as_user: true, channel: request.channel, text: text
      end
    rescue RuntimeError => e
      Kirpich.logger.error e
    end

    def on_message(data)
      request = Kirpich::Messaging::Slack::Request.new(data, @auth)
      @bot.on_message(request)
    end

    def on_reaction(data)
      @bot.add_money(data['item']['channel'], data['item_user'])
    end
  end
end


text:
package com.palmelf.eoffice.service.communicate.impl;

import com.palmelf.core.service.impl.BaseServiceImpl;
import com.palmelf.eoffice.dao.communicate.OutMailDao;
import com.palmelf.eoffice.model.communicate.OutMail;
import com.palmelf.eoffice.service.communicate.OutMailService;

import java.util.List;
import java.util.Map;

public class OutMailServiceImpl extends BaseServiceImpl<OutMail> implements
		OutMailService {
	private OutMailDao dao;

	public OutMailServiceImpl(OutMailDao dao) {
		super(dao);
		this.dao = dao;
	}

	public List<OutMail> findByFolderId(Long folderId) {
		return this.dao.findByFolderId(folderId);
	}

	public Long CountByFolderId(Long folderId) {
		return this.dao.CountByFolderId(folderId);
	}

	public Map getUidByUserId(Long userId) {
		return this.dao.getUidByUserId(userId);
	}
}


text:
<?php
class placeModel extends baseModel{
	protected $table = 'place';
}
?>


text:
struct _CadePanelPopupWindow {
  GtkWindow parent_instance;
};

struct _CadePanelPopupWindowClass {
  GtkWindowClass parent_class;
};

G_DEFINE_TYPE (CadePanelPopupWindow, cade_panel_popup_window, GTK_TYPE_WINDOW)

static void
cade_panel_popup_window_class_init (CadePanelPopupWindowClass *klass)
{
}

static void
cade_panel_popup_window_init (CadePanelPopupWindow *self)
{
}

CadePanelPopupWindow *
cade_panel_popup_window_new (void)
{
  return g_object_new (CADE_TYPE_PANEL_POPUP_WINDOW, NULL);
}

void cade_panel_popup_window_set_relative_to(CadePanelPopupWindow *menu, GtkWidget *relative)
{
  gtk_widget_realize(GTK_WIDGET(menu));
  gtk_widget_show_all(GTK_WIDGET(menu));
  GdkWindow *relativeWindow = gtk_widget_get_window(relative);
  if(relativeWindow == NULL)
  {
    gtk_widget_realize(GTK_WIDGET(relative));
    relativeWindow = gtk_widget_get_window(relative);
  }
  gint x = 0, y = 0;
  gdk_window_get_position(relativeWindow, &x, &y);

  gint height = 0, width = 0;
  gtk_window_get_size(GTK_WINDOW(menu), &width, &height);
  y -= height;

  if(y < 0)
  {
    gdk_window_get_position(relativeWindow, &x, &y);
    y += gdk_window_get_height(relativeWindow);
  }
  gtk_window_move(GTK_WINDOW(menu), x, y);
}


text:
comments: true
layout: post
title:  "James Lyne: Everyday cybercrime"
date:   2013-10-02 19:46:00
categories: blog Technology
---
<iframe width="560" height="315" src="//www.youtube.com/embed/fSErHToV8IU" frameborder="0" allowfullscreen></iframe>

Basic daily things to take care of.

> James Lyne, Whether he's taking on insecure hotspots, inept passwords, or lax OS designers, James Lyne exposes technology's vulnerabilities while elevating the security awareness of everyday users.


text:
.. spelling::

    debug_assert

.. index:: unsorted ; debug_assert

.. _pkg.debug_assert:

debug_assert
============

-  `Official <https://github.com/foonathan/debug_assert>`__
-  `Example <https://github.com/cpp-pm/hunter/blob/master/examples/debug_assert/CMakeLists.txt>`__
-  Added by `dvirtz <https://github.com/dvirtz>`__ (`pr-1127 <https://github.com/ruslo/hunter/pull/1127>`__)

.. code-block:: cmake

    hunter_add_package(debug_assert)
    find_package(debug_assert CONFIG REQUIRED)
    target_link_libraries(debug_assert_example debug_assert)


text:
using Ocelot.Responses;
using Ocelot.Values;

namespace Ocelot.DownstreamRouteFinder.UrlMatcher
{
    public interface IUrlPathToUrlTemplateMatcher
    {
        Response<UrlMatch> Match(string upstreamUrlPath, string upstreamQueryString, UpstreamPathTemplate pathTemplate);
    }
}


text:
package org.owasp.webgoat.service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.owasp.webgoat.lessons.model.RequestParameter;
import org.owasp.webgoat.session.WebSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
ParameterService class.

 *
 * @author rlawson
 * @version $Id: $Id
 */
@Controller
public class ParameterService extends BaseService {

    final Logger logger = LoggerFactory.getLogger(ParameterService.class);

    /**
     * Returns request parameters for last attack
     *
     * @param session a {@link javax.servlet.http.HttpSession} object.
     * @return a {@link java.util.List} object.
     */
    @RequestMapping(value = "/parameter.mvc", produces = "application/json")
    public @ResponseBody
    List<RequestParameter> showParameters(HttpSession session) {
        WebSession ws = getWebSession(session);
        List<RequestParameter> listParms = ws.getParmsOnLastRequest();
        Collections.sort(listParms);
        return listParms;
    }
}


text:
package com.michaelfotiadis.crossyscore.ui.components.create;

import android.app.Activity;

import com.michaelfotiadis.crossyscore.ui.core.common.viewbinder.BaseViewBinder;
import com.michaelfotiadis.crossyscore.ui.core.intent.dispatch.IntentDispatcher;

import butterknife.ButterKnife;

/**
 *
 */
public class CreateFragmentViewBinder extends BaseViewBinder<CreateFragmentViewHolder> {

    protected CreateFragmentViewBinder(final Activity activity,
                                       final IntentDispatcher intentDispatcher) {
        super(activity, intentDispatcher);

    }

    @Override
    public void bind(final CreateFragmentViewHolder holder) {
        ButterKnife.bind(holder, holder.getRoot());
    }

    @Override
    public void reset(final CreateFragmentViewHolder holder) {

    }
}


text:
<?php
/*
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
$Id: proxy.php 3650 2007-11-28 00:26:06Z rdewit $
$Name$
*/

////////////////////////////////////////////////////////////////////////////////
// Description:
// Script to redirect the request http://host/proxy.php?url=http://someUrl
// to http://someUrl .
//
// This script can be used to circumvent javascript's security requirements
// which prevent a URL from an external web site being called.
//
// Author: Nedjo Rogers
////////////////////////////////////////////////////////////////////////////////

// read in the variables

if(array_key_exists('HTTP_SERVERURL', $_SERVER)){
  $onlineresource=$_SERVER['HTTP_SERVERURL'];
}else{
  $onlineresource=$_REQUEST['url'];
}
$parsed = parse_url($onlineresource);
$host = @$parsed["host"];
$path = @$parsed["path"] . "?" . @$parsed["query"];
if(empty($host)) {
  $host = "localhost";
}
$port = @$parsed['port'];
if(empty($port)){
  $port="80";
}
$contenttype = @$_REQUEST['contenttype'];
if(empty($contenttype)) {
  $contenttype = "text/xml";
}
$data = @$GLOBALS["HTTP_RAW_POST_DATA"];
// define content type
header("Content-type: " . $contenttype);

if(empty($data)) {
  $result = send_request();
}
else {
  // post XML
  $posting = new HTTP_Client($host, $port, $data);
  $posting->set_path($path);
  $result = $posting->send_request();
}

// strip leading text from result and output result
$len=strlen($result);
$pos = strpos($result, "<");
if($pos > 1) {
  $result = substr($result, $pos, $len);
}
//$result = str_replace("xlink:","",$result);
echo $result;

// define class with functions to open socket and post XML
// from http://www.phpbuilder.com/annotate/message.php3?id=1013274 by Richard Hundt

class HTTP_Client {
  var $host;
  var $path;
  var $port;
  var $data;
  var $socket;
  var $errno;
  var $errstr;
  var $timeout;
  var $buf;
  var $result;
  var $agent_name = "MyAgent";
  //Constructor, timeout 30s
  function HTTP_Client($host, $port, $data, $timeout = 30) {
    $this->host = $host;
    $this->port = $port;
    $this->data = $data;
    $this->timeout = $timeout;
  }

  //Opens a connection
  function connect() {
    $this->socket = fsockopen($this->host,
      $this->port,
      $this->errno,
      $this->errstr,
      $this->timeout
      );
    if(!$this->socket)
      return false;
    else
      return true;
  }

  //Set the path
  function set_path($path) {
    $this->path = $path;
  }

  //Send request and clean up
  function send_request() {
    if(!$this->connect()) {
      return false;
    }
    else {
      $this->result = $this->request($this->data);
      return $this->result;
    }
  }

  function request($data) {
    $this->buf = "";
    fwrite($this->socket,
      "POST $this->path HTTP/1.0\r\n".
      "Host:$this->host\r\n".
      "User-Agent: $this->agent_name\r\n".
      "Content-Type: application/xml\r\n".
      "Content-Length: ".strlen($data).
      "\r\n".
      "\r\n".$data.
      "\r\n"
    );

    while(!feof($this->socket))
      $this->buf .= fgets($this->socket, 2048);
      $this->close();
      return $this->buf;
  }

  function close() {
    fclose($this->socket);
  }
}

function send_request() {
  global $onlineresource;
  $ch = curl_init();
  $timeout = 5; // set to zero for no timeout

  // fix to allow HTTPS connections with incorrect certificates
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

  curl_setopt ($ch, CURLOPT_URL,$onlineresource);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  curl_setopt ($ch, CURLOPT_ENCODING , "gzip, deflate");

  $file_contents = curl_exec($ch);
  curl_close($ch);
  $lines = array();
  $lines = explode("\n", $file_contents);
  if(!($response = $lines)) {
    echo "Unable to retrieve file '$service_request'";
  }
  $response = implode("",$response);
  return $response;
}
?>


text:
#ifndef __itkCommandVnlIterationUpdate_h
#define __itkCommandVnlIterationUpdate_h

#include "itkCommand.h"
#include "itkWeakPointer.h"

namespace itk {

/**
 *  Implementation of the Command Pattern to be invoked every iteration
 * \class CommandVnlIterationUpdate
 * \ingroup ITKRegistrationCommon
 */
template < class TOptimizer >
class ITK_EXPORT CommandVnlIterationUpdate : public Command
{
public:
  /**
   * Standard "Self" typedef.
   */
  typedef CommandVnlIterationUpdate   Self;

  /**
   * Standard "Superclass" typedef.
   */
  typedef itk::Command  Superclass;

  /**
   * Smart pointer typedef support.
   */
  typedef itk::SmartPointer<Self>  Pointer;

  /**
   * ConstSmart pointer typedef support.
   */
  typedef itk::SmartPointer<const Self>  ConstPointer;

  /**
   * Execute method will print data at each iteration
   */
  void Execute(itk::Object *caller, const itk::EventObject & event)
  {
    Execute( (const itk::Object *)caller, event);
  }

  void Execute(const itk::Object * itkNotUsed(caller), const itk::EventObject & event)
  {
    if( typeid( event ) == typeid( itk::StartEvent ) )
      {
      std::cout << std::endl << "Position              Value";
      std::cout << std::endl << std::endl;
      }
    else if( itk::IterationEvent().CheckEvent( &event ) )
      {
      std::cout << m_Optimizer->GetCurrentIteration() << " = ";
      std::cout << m_Optimizer->GetCurrentPosition() << std::endl;
      }
    else if( typeid( event ) == typeid( itk::EndEvent ) )
      {
      std::cout << std::endl << std::endl;
      std::cout << "After " << m_Optimizer->GetCurrentIteration();
      std::cout << "  iterations " << std::endl;
      std::cout << "Solution is    = " << m_Optimizer->GetCurrentPosition();
      std::cout << std::endl;
      std::cout << "vnl report = " << std::endl;
      m_Optimizer->GetOptimizer()->diagnose_outcome( std::cout );
      }

  }

  /**
   * Run-time type information (and related methods).
   */
  itkTypeMacro( CommandVnlIterationUpdate, ::itk::Command );

  /**
   * Method for creation through the object factory.
   */
  itkNewMacro( Self );

  /**
   * Type defining the optimizer
   */
  typedef    TOptimizer     OptimizerType;

  /**
   * Set Optimizer
   */
  void SetOptimizer( OptimizerType * optimizer )
    {
    m_Optimizer = optimizer;
    m_Optimizer->AddObserver( itk::IterationEvent(), this );
    }

protected:

  /**
   * Constructor
   */
  CommandVnlIterationUpdate() {};

private:

  /**
   *  WeakPointer to the Optimizer
   */
  WeakPointer<OptimizerType>   m_Optimizer;
};

} // end namespace itk

#endif