text:
"""
===============================
Histogram of Oriented Gradients
===============================

The `Histogram of Oriented Gradient
<http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients>`__ (HOG) feature
descriptor [1]_ is popular for object detection.

In the following example, we compute the HOG descriptor and display
a visualisation.

Algorithm overview
------------------

Compute a Histogram of Oriented Gradients (HOG) by

    1. (optional) global image normalisation
    2. computing the gradient image in x and y
    3. computing gradient histograms
    4. normalising across blocks
    5. flattening into a feature vector

The first stage applies an optional global image normalisation
equalisation that is designed to reduce the influence of illumination
effects. In practice we use gamma (power law) compression, either
computing the square root or the log of each colour channel.
Image texture strength is typically proportional to the local surface
illumination so this compression helps to reduce the effects of local
shadowing and illumination variations.

The second stage computes first order image gradients. These capture
contour, silhouette and some texture information, while providing
further resistance to illumination variations. The locally dominant
colour channel is used, which provides colour invariance to a large
extent. Variant methods may also include second order image derivatives,
which act as primitive bar detectors - a useful feature for capturing,
e.g. bar like structures in bicycles and limbs in humans.

The third stage aims to produce an encoding that is sensitive to
local image content while remaining resistant to small changes in
pose or appearance. The adopted method pools gradient orientation
information locally in the same way as the SIFT [2]_
feature. The image window is divided into small spatial regions,
called "cells". For each cell we accumulate a local 1-D histogram
of gradient or edge orientations over all the pixels in the
cell. This combined cell-level 1-D histogram forms the basic
"orientation histogram" representation. Each orientation histogram
divides the gradient angle range into a fixed number of
predetermined bins. The gradient magnitudes of the pixels in the
cell are used to vote into the orientation histogram.

The fourth stage computes normalisation, which takes local groups of
cells and contrast normalises their overall responses before passing
to next stage. Normalisation introduces better invariance to illumination,
shadowing, and edge contrast. It is performed by accumulating a measure
of local histogram "energy" over local groups of cells that we call
"blocks". The result is used to normalise each cell in the block.
Typically each individual cell is shared between several blocks, but
its normalisations are block dependent and thus different. The cell
thus appears several times in the final output vector with different
normalisations. This may seem redundant but it improves the performance.
We refer to the normalised block descriptors as Histogram of Oriented
Gradient (HOG) descriptors.

The final step collects the HOG descriptors from all blocks of a dense
overlapping grid of blocks covering the detection window into a combined
feature vector for use in the window classifier.

References
----------

.. [1] Dalal, N. and Triggs, B., "Histograms of Oriented Gradients for
       Human Detection," IEEE Computer Society Conference on Computer
       Vision and Pattern Recognition, 2005, San Diego, CA, USA.

.. [2] David G. Lowe, "Distinctive image features from scale-invariant
       keypoints," International Journal of Computer Vision, 60, 2 (2004),
       pp. 91-110.

"""
import matplotlib.pyplot as plt

from skimage.feature import hog
from skimage import data, color, exposure

image = color.rgb2gray(data.lena())

fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16),
                    cells_per_block=(1, 1), visualise=True)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4))

ax1.axis('off')
ax1.imshow(image, cmap=plt.cm.gray)
ax1.set_title('Input image')

# Rescale histogram for better display
hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 0.02))

ax2.axis('off')
ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
ax2.set_title('Histogram of Oriented Gradients')
plt.show()


text:
Yii2 multiple input change log
==============================

1.0.5
--------------------

1.0.4
--------------------

- Bug #15: Fix setting current values of dropDownList (unclead)
- Bug #16 fix render of dropDown and similar inputs (unclead)
- Add attributeOptions property

1.0.3
-----
- Hidden fields no longer break markup (unclead, kotchuprik)

1.0.2
-----

- Enh: added minified version of js script (unclead)
- Enh #8: renamed placeholders for avoid conflicts with other widgets (unclead)
- Enh #7: customization of header cell

1.0.1
-----

- Enh #1: Implemented ability to use widget as column type (unclead)
- Enh: add js events (ZAYEC77)

1.0.0
-----

first stable release

redpajama_set_name: RedPajamaGithub


text:
# Dropper
Dropper is a simple Dropdown menu for iOS. Built with customizability in mind and is flexible on how it can be used. Also, it is easy to setup and use in your projects. If you are looking for some complex dropdown menu, this is not for you. This was more built to be used as an accessory to a view. For example being able to change your currency in a shopping cart app.

![Basic demo of how Dropper looks](https://raw.githubusercontent.com/kirkbyo/Dropper/master/Pod/Assets/White-DropdownBasic.mov.gif)
![Outflow Demo for how Dropper is used in the app](https://raw.githubusercontent.com/kirkbyo/Dropper/master/Pod/Assets/DropperOutflowDemo.mov.gif)

Left demo of a basic Dropper menu. Right is how Dropper is used in [Outflow](http://outflowapp.com/).

## Installation

Dropper is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "Dropper"
```

## Usage

Setting up is easy, after installing the library, initialize a Dropper menu in your view
```swift
let dropper = Dropper(width: 75, height: 200)
```
After your Dropper view is initialized, you gotta specify which items to be displayed inside the Dropper
```swift
dropper.items = ["Item 1", "Item 2", "Item 3", "Item 4"] // Items to be displayed
// Dropper also supports images
dropper.items = ["Item 1", "ImageOne.png", "Item 3", "ImageTwo.png"] // Images can be mixed with text items
```
When you are ready to show your Dropper menu you have two options for how to display it: `show()` or `showWithAnimation()`.
```Swift
dropper.show(options: .Alignment.Center, button: UIButton)
// OR
dropper.showWithAnimation(0.15, options: .Alignment.Center, button: UIButton)
```
When you are ready to get back what Dropper item was selected, confrom your class to the `DropperDelegate` and implement the `DropperSelectedRow` method, it is also importent that you initialize the `dropper.delegate` property to your class before showing your view.
```Swift
dropper.delegate = self // Insert this before you show your Dropper

extension ViewController: DropperDelegate {
    func DropperSelectedRow(path: NSIndexPath, contents: String) {
        /* Do something */
    }
}
```

#### Simple Example Usage
```swift
class ViewController: UIViewController {
    let dropper = Dropper(width: 75, height: 200)
    @IBOutlet var dropdownButton: UIButton!

    @IBAction func DropdownAction() {
        if dropper.status == .Hidden {
            dropper.items = ["Item 1", "Item 2", "Item 3", "Item 4"] // Item displayed
            dropper.theme = Dropper.Themes.White
            dropper.delegate = self
            dropper.cornerRadius = 3
            dropper.showWithAnimation(0.15, options: Dropper.Alignment.Center, button: dropdownButton)
        } else {
            dropper.hideWithAnimation(0.1)
        }
    }
}
```

## Documentation

#### Show
Shows the Dropdown Menu
- `show(options: Alignment, position: Position = .Bottom, button: UIButton)`
  - options *Dropper.Alignment*: Vertical position of the dropdown corresponding of the button (Left, Center, Right)
  - position *Dropper.Position*: Horizontal alignment of the dropdown. Defaults to under the button.
  - button *UIButton*: Button that button will be position relative too
Shows the Dropdown menu with a fade animation
- `showWithAnimation(time: NSTimeInterval, options: Alignment, position: Position = .Bottom, button: UIButton)`
  - time *NSTimeInterval*: Time taken for the fade animation
  - options *Dropper.Alignment*: Position of the dropdown corresponding of the button (Left, Center, Right)
  - position *Dropper.Position*: Horizontal alignment of the dropdown. Defaults to under the button.
  - button *UIButton*: Button that button will be position relative too

```Swift
// Dropdown displayed on top of the button
dropper.showWithAnimation(0.15, options: Dropper.Alignment.Center, position: .Top, button: button)
// Dropdown displayed under the button
dropper.showWithAnimation(0.15, options: Dropper.Alignment.Center, button: button)
```

#### Hide
Hides the Dropdown Menu
- `hide()`
Hides the Dropdown menu with an fade out animation
- `hideWithAnimation(time: NSTimeInterval)`
    - time *NSTimeInterval*: Time taken for the fade out animation

#### Properties
- `trimCorners` *Bool*: Automaticly applies border radius of 10 to Dropdown (Defaults to False)
- `defaultAnimationTime` *NSTimeInterval*: The default time for animations to take (Defaults to 0.1)
- `delegate` *DropperDelegate*: Delegate property, must be initialized for the functions to be called
    - `DropperSelectedRow`: Called everytime a Dropper row is selected
- `status` *Status (Enum)*: The current state of the view
- `spacing` *CGFloat*: The distance from the button to the Dropper
- `maxHeight` *CGFloat*: The maximum possible height of the Dropper
- `cellBackgroundColor` *UIColor*: Sets the cell background color (Defaults to theme color if not set)
- `cellColor` *UIColor*: Sets the cell tint color and text color (Defaults to theme color if not set)
- `cellTextSize` *CGFloat*: Sets the size of the text to provided value (Defaults to UILabel Font Size)
- `TableMenu` *UITableView*: Table View that the Dropper is built on
- `items` *[String]*: The items to be dispalyed in the tableview
- `height` *CGFloat*: Height of the Dropdown
- `width` *CGFloat*: Width of the Dropdown
- `cornerRadius` *CGFloat*: Corner Radius of the Dropdown
- `theme` *Themes (Enum)*: Theme of dropdown menu (Defaults to White theme)
    - `.White`: Black text color, White background Color and black border color
    - `.Black(UIColor)`: White Text, Dark background color, you can also specify your own color, or use the default by passing **nil** to the enum case
```Swift
dropper.theme = Dropper.Themes.Black(nil) // Uses default dark color
// OR
dropper.theme = Dropper.Themes.Black(UIColor.blackColor()) // Uses Black UIColor
```
- `border` *(width: CGFloat, color: UIColor)*: Specify the border width and the color of the Dropper
```Swift
dropper.border = (width: 2, color: UIColor.blueColor())
```

- `refresh()`: Refresh the Dropper. For specifically calling .reloadData() on the Table View

## License

Dropper is available under the MIT license. See the LICENSE file for more info.

Built by [Ozzie Kirkby](http://kirkbyo.com/), if you have any question feel free to contact. [Twitter](https://twitter.com/kirkbyo_)


text:
mkdir -p $(rbenv root)/plugins

cd $(rbenv root)/plugins

test -d rbenv-each         || git clone https://github.com/rbenv/rbenv-each.git
test -d rbenv-update       || git clone https://github.com/rkh/rbenv-update.git
test -d rbenv-default-gems || git clone https://github.com/sstephenson/rbenv-default-gems.git

cat > $(rbenv root)/default-gems <<EOF
awesome_print
bundler
bundler-audit
byebug
byebug-color-printer
foreman
license_finder
lunchy
qwandry
EOF

RUBY_VERSION=2.6.5

rbenv versions | grep -q $RUBY_VERSION || rbenv install $RUBY_VERSION
rbenv global $RUBY_VERSION


text:
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

package com.google.appinventor.server.project.youngandroid;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.google.appinventor.common.youngandroid.YaHttpServerConstants;
import com.google.appinventor.server.CrashReport;
import com.google.appinventor.server.encryption.EncryptionException;
import com.google.appinventor.server.project.WebStartSupport;
import com.google.appinventor.server.storage.StorageIo;
import com.google.appinventor.server.util.JsonpConnectionUtil;
import com.google.appinventor.server.util.ModifiedHeaders;
import com.google.appinventor.server.util.ResourceUtil;
import com.google.appinventor.shared.rpc.ServerLayout;
import com.google.appinventor.shared.rpc.user.UserInfoProvider;
import com.google.appinventor.shared.storage.StorageUtil;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Implementation of {@link WebStartSupport} for Young Android projects.
 *
 */
public final class YoungAndroidWebStartSupport extends WebStartSupport {

  // Logging support
  private static final Logger LOG = Logger.getLogger(YoungAndroidWebStartSupport.class.getName());

  // Content type for response header (to avoid security vulnerabilities)
  private static final String CONTENT_TYPE = "text/html; charset=utf-8";

  /**
   * Creates a YoungAndroidWebStartSupport.
   *
   * @param storageIo the StorageIo instance
   * @param userProvider the user provider
   */
  public YoungAndroidWebStartSupport(StorageIo storageIo, UserInfoProvider userProvider) {
    super(storageIo, userProvider);
  }

  /**
   * {@inheritDoc}
   *
   * The purpose parameter must be one of the following values:
   *

   *
{@link ServerLayout#WEBSTART_JNLP_PURPOSE_CODEBLOCKS}

   *

   */
  @Override
  public void sendJnlpFile(HttpServletRequest req, HttpServletResponse resp, String purpose) {
    try {
      if (purpose.equals(ServerLayout.WEBSTART_JNLP_PURPOSE_CODEBLOCKS)) {
        // see if we can avoid sending the content again
        if (ModifiedHeaders.notModified(req)) {
          resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
          return;
        }
        // Create jnlp file and send it back
        String jnlp = prepareJnlpForJsonpServer(req, "1.5+", "925m",
            ResourceUtil.CODEBLOCKS_JAR, ResourceUtil.CODEBLOCKS_MAIN,
            "App Inventor for Android Blocks Editor",  // title
            "App Inventor for Android Blocks Editor"); // description
        ModifiedHeaders.setHeaders(resp);
        sendFileResponse(resp, "AppInventorForAndroidCodeblocks.jnlp",
            "application/x-java-jnlp-file; charset=utf-8", jnlp.getBytes(Charsets.UTF_8));
      } else {
        throw new IllegalArgumentException("Unknown WebStart purpose: " + purpose);
      }
    } catch (IllegalArgumentException e) {
      throw CrashReport.createAndLogError(LOG, req, null, e);
    } catch (EncryptionException e) {
      throw CrashReport.createAndLogError(LOG, req, null, e);
    } catch (IOException e) {
      throw CrashReport.createAndLogError(LOG, req, null, e);
    }
  }

  /**
   * {@inheritDoc}
   *
   * Handle GET requests from codeblocks.
   */
  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp, String userId,
      long projectId, String fileName) {
    try {
      byte[] data;
      String contentType = "text/plain; charset=utf-8"; // default
      if (fileName.equals(ResourceUtil.CODEBLOCKS_JAR)) {
        // Special case for the codeblocks deploy jar. projectId is ignored.
        // see if we can avoid sending the content again
        if (ModifiedHeaders.notModified(req)) {
          resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
          return;
        }
        // Jar files for a web start application need to be properly signed.
        // The codeblocks jar is signed during the ant build.
        data = ResourceUtil.downloadSignedCodeblocksJar();
        ModifiedHeaders.setHeaders(resp);

      } else if (0 == fileName.compareToIgnoreCase(YaHttpServerConstants.STARTER_PHONEAPP_APK)) {
        if (!fileName.equals(YaHttpServerConstants.STARTER_PHONEAPP_APK)) {
          throw CrashReport.createAndLogError(LOG, req,
              "Bad starter app name, user=" + userId + ", project=" + projectId,
              null);
        }
        // Special case for the phone component APK. projectId is ignored.
        // Does not need to be signed.
        data = ResourceUtil.downloadStarterAppApk();

      } else if (fileName.startsWith(YaHttpServerConstants.ASSETS_ZIPFILE)) {
        // note: if an attempt to read a particular asset file gives a RuntimeException,
        // we will put a file with that name in the zip prefixed with "bad" (hence
        // all bad asset files should be in directory "badassets/".
        data = getAssetsZipFile(userId, projectId);
        if (data.length == 0) {
          sendNoContentResponse(resp, fileName);
          return;
        }
        fileName = storageIo.getProjectName(userId, projectId) +
          YaHttpServerConstants.ASSET_ZIPFILE_SUFFIX;
        contentType = StorageUtil.getContentTypeForFilePath(fileName);

      } else {
        // Codeblocks is getting a project source file.
        data = getStorageIo().downloadRawFile(userId, projectId, fileName);
      }
      sendFileResponse(resp, fileName, contentType, data);
    } catch (IOException e) {
      throw CrashReport.createAndLogError(LOG, req, null, e);
    }
  }

  /**
   * {@inheritDoc}
   *
   * Handle Post requests from codeblocks.
   */
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp, String userId,
      long projectId, String fileName) {
    try {
      String encoding = req.getCharacterEncoding();
      if (encoding == null) {
        encoding = "UTF-8";
      }
      BufferedReader reader = new BufferedReader(new InputStreamReader(
          req.getInputStream(), encoding));
      String content;
      try {
        content = CharStreams.toString(reader);
      } finally {
        reader.close();
      }
      if (fileName.startsWith(YaHttpServerConstants.CODEBLOCKS_SAVE_PORT)) {
        // Special case for saving the codeblocks port. projectId is ignored.
        int port = Integer.parseInt(content);
        byte[] data = JsonpConnectionUtil.saveJsonpConnectionInfo(getStorageIo(), userId,
            YaHttpServerConstants.CODEBLOCKS_INFO_FILE_PREFIX, port);
        resp.setStatus(HttpServletResponse.SC_OK);
        resp.setContentType("text/plain; charset=utf-8");
        OutputStream out = resp.getOutputStream();
        out.write(data);
        out.close();

      } else {
        // Codeblocks is posting a project source file.
        if (!content.endsWith("\n")) {
          content = content + "\n";
        }
        List<String> sourceFiles = getStorageIo().getProjectSourceFiles(userId, projectId);
        if (!sourceFiles.contains(fileName)) {
          getStorageIo().addSourceFilesToProject(userId, projectId, false, fileName);
        }
        getStorageIo().uploadFileForce(projectId, fileName, userId, content, StorageUtil.DEFAULT_CHARSET);
        // TODO(sharon): technically this should probably return HttpServletResponse.SC_CREATED (201)
        // I'm not sure whether it really matters.
        resp.setStatus(HttpServletResponse.SC_OK);
        resp.setContentType(CONTENT_TYPE);
      }
    } catch (IOException e) {
      throw CrashReport.createAndLogError(LOG, req, null, e);
    }
  }

  @VisibleForTesting
  public byte[] getAssetsZipFile(String userId, long projectId) throws IOException {
    List<String> files = storageIo.getProjectSourceFiles(userId, projectId);
    List<String> assetFiles = new ArrayList<String>();
    for (String file : files) {
      if (file.startsWith(YoungAndroidProjectService.ASSETS_FOLDER)) {
        assetFiles.add(file);
      }
    }
    if (assetFiles.size() != 0) {
      String fileName;
      // create a zip file containing the asset files, even if there is only 1
      ByteArrayOutputStream zipFile = new ByteArrayOutputStream();
      ZipOutputStream out = new ZipOutputStream(zipFile);
      for (String file : assetFiles) {
        try {
          byte[] data = storageIo.downloadRawFile(userId, projectId, file);
          out.putNextEntry(new ZipEntry(file));
          out.write(data, 0, data.length);
          out.closeEntry();
        } catch (RuntimeException e) {
          // don't let one bad asset spoil the whole bunch (but do leave
          // a marker in the zip file that the asset was bad so that it can
          // be reported to the user)
          out.putNextEntry(new ZipEntry("bad" + file));
          out.closeEntry();
        }
      }
      out.close();
      return zipFile.toByteArray();
    } else {
      return new byte[0];
    }
  }

  private void sendNoContentResponse(HttpServletResponse resp, String fileName) {
    // Set http response information
    resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
  }
}


text:
    {!! csrf_field() !!}
    @if (count($errors) > 0)

                @foreach ($errors->all() as $error)

{{ $error }}

                @endforeach

    @endif

<title>
	医生出诊计划 - Dashboard > Doctor Schedule
</title>

	<form action="{{ URL('admin/schedules/cityselected') }}" method="POST">
			<input type="hidden" name="_token"  value="{{ csrf_token() }}" />
			城市名称
			<input type="text" name="city" />
			<input type="submit" value="测试返回数据 JSON格式 - 医生出诊计划"/>
	</form>

	<form action="{{ URL('admin/schedules/hospitalselected') }}" method="POST">
			<input type="hidden" name="_token"  value="{{ csrf_token() }}" />
			医院ID号
			<input type="text" name="id" />
			<input type="submit" value="测试返回数据 JSON格式 - 医生出诊计划"/>
	</form>

	<form action="{{ URL('admin/schedules/depselected') }}" method="POST">
			<input type="hidden" name="_token"  value="{{ csrf_token() }}" />
			科室ID号
			<input type="text" name="id" />
			<input type="submit" value="测试返回数据 JSON格式 - 医生出诊计划"/>
	</form>

	<form action="{{ URL('admin/schedules/testjson') }}" method="POST">
			<input type="hidden" name="_token"  value="{{ csrf_token() }}" />
			医生ID号<input type="text" name="id" />
			<input type="submit" value="测试返回数据 JSON格式 - 医生出诊计划"/>
	</form>

	<form action="{{ URL('admin/schedules/updatenum') }}" method="POST">
			<input type="hidden" name="_token"  value="{{ csrf_token() }}" />
			医生ID号<input type="text" name="doctor_id" />
			Doctoring_date<input type="text" name="doctoring_date" />
			Doctoring_time<input type="text" name="doctoring_time" />
			Total_Num!<input type="text" name="total_num" />
			<input type="submit" value="改个totalnumber测试一下"/>
	</form>


text:
// -*- Mode: C++; -*-
//                            Package   : omniORB
// excepthandler.h            Created on: 13/5/97
//                            Author    : Sai Lai Lo (sll)
//
//    Copyright (C) 1996-1999 AT&T Research Cambridge
//
//    This file is part of the omniORB library.
//
//    The omniORB library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Library General Public
//    License as published by the Free Software Foundation; either
//    version 2 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Library General Public License for more details.
//
//    You should have received a copy of the GNU Library General Public
//    License along with this library; if not, write to the Free
//    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
//    02111-1307, USA
//
//
// Description:
//

/*
  $Log: excepthandler.h,v $
  Revision 1.1.6.1  2003/03/23 21:03:50  dgrisby
  Start of omniORB 4.1.x development branch.

  Revision 1.1.4.2  2002/02/25 11:17:11  dpg1
  Use tracedmutexes everywhere.

  Revision 1.1.4.1  2001/04/18 17:18:17  sll
  Big checkin with the brand new internal APIs.
  These files were relocated and scoped with the omni namespace.

  Revision 1.3.2.1  2000/07/17 10:35:53  sll
  Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0.

  Revision 1.4  2000/07/13 15:25:58  dpg1
  Merge from omni3_develop for 3.0 release.

  Revision 1.2.8.1  1999/09/22 14:26:48  djr
  Major rewrite of orbcore to support POA.

  Revision 1.1  1997/12/09 18:43:07  sll
  Initial revision

  */

#ifndef __EXCEPTHANDLER_H__
#define __EXCEPTHANDLER_H__

class omniExHandlers_iterator;

class omniExHandlers {
public:
  void*                   transient_hdr;
  void*                   transient_cookie;
  void*                   commfail_hdr;
  void*                   commfail_cookie;
  void*                   sysexcpt_hdr;
  void*                   sysexcpt_cookie;
  static omniExHandlers** Table;
  static omni_tracedmutex TableLock;
  friend class omniExHandlers_iterator;
private:
  omniExHandlers();
  omniObjRef*             objptr;
  omniExHandlers*         next;
};

class omniExHandlers_iterator {
public:
  omniExHandlers_iterator();
  // Concurrency control:
  //       MUTEX = omniExHandlers::TableLock
  // Pre-condition:
  //       Does not hold <MUTEX> on entry
  // Post-condition:
  //       Hold <MUTEX> on exit

  ~omniExHandlers_iterator();
  // Concurrency control:
  //       MUTEX = omniExHandlers::TableLock
  // Pre-condition:
  //       Hold <MUTEX> on entry
  // Post-condition:
  //       Does not hold <MUTEX> on exit

  omniExHandlers* find_or_create(omniObjRef* p);
  // Locate the omniExHandlers for this object
  // If found just returns
  // else create a new record, initialise all the handler fields to null and
  // returns the new record.

  omniExHandlers* find(omniObjRef* p);
  // Locate the omniExHandlers for this object
  // Return 0 if not found.

  void remove(omniObjRef* p);
  // Locate the omniExHandlers for this object, if found, delete the record

};

#endif // __EXCEPTHANDLER_H__


text:
WOL
========

A simple Wake-On-LAN implementation.

[![Build Status](https://api.travis-ci.org/reines/wol.png)](https://travis-ci.org/reines/wol)
[![Coverage Status](https://coveralls.io/repos/reines/wol/badge.png?branch=master)](https://coveralls.io/r/reines/wol?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.jamierf/wol/badge.png)](https://maven-badges.herokuapp.com/maven-central/com.jamierf/wol)

WOL can be found in maven central.

## Installation

```xml
<dependency>
    <groupId>com.jamierf</groupId>
    <artifactId>wol</artifactId>
    <version>...</version>
</dependency>
```

## Usage

```java
WakeOnLan.wake("b8:f6:b1:14:6a:b7");
```

## License

Released under the [Apache 2.0 License](LICENSE).


text:
require "support/shared/integration/integration_helper"

describe "Chef::Resource.property" do
  include IntegrationSupport

  module Namer
    @i = 0
    def self.next_resource_name
      "chef_resource_property_spec_#{@i += 1}"
    end

    def self.reset_index
      @current_index = 0
    end

    def self.current_index
      @current_index
    end

    def self.next_index
      @current_index += 1
    end
  end

  def lazy(&block)
    Chef::DelayedEvaluator.new(&block)
  end

  before do
    Namer.reset_index
  end

  def self.new_resource_name
    Namer.next_resource_name
  end

  let(:resource_class) do
    new_resource_name = self.class.new_resource_name
    Class.new(Chef::Resource) do
      resource_name new_resource_name
      def next_index
        Namer.next_index
      end
    end
  end

  let(:resource) do
    resource_class.new("blah")
  end

  def self.english_join(values)
    return "<nothing>" if values.size == 0
    return values[0].inspect if values.size == 1
    "#{values[0..-2].map { |v| v.inspect }.join(", ")} and #{values[-1].inspect}"
  end

  def self.with_property(*properties, &block)
    tags_index = properties.find_index { |p| !p.is_a?(String) }
    if tags_index
      properties, tags = properties[0..tags_index - 1], properties[tags_index..-1]
    else
      tags = []
    end
    if properties.size == 1
      description = "With property #{properties.first}"
    else
      description = "With properties #{english_join(properties.map { |property| "#{property.inspect}" })}"
    end
    context description, *tags do
      before do
        properties.each do |property_str|
          resource_class.class_eval("property #{property_str}", __FILE__, __LINE__)
        end
      end
      instance_eval(&block)
    end
  end

  # Basic properties
  with_property ":bare_property" do
    it "can be set" do
      expect(resource.bare_property 10).to eq 10
      expect(resource.bare_property).to eq 10
    end
    it "emits a deprecation warning and does a get, if set to nil" do
      expect(resource.bare_property 10).to eq 10
      expect { resource.bare_property nil }.to raise_error Chef::Exceptions::DeprecatedFeatureError
      Chef::Config[:treat_deprecation_warnings_as_errors] = false
      expect(resource.bare_property nil).to eq 10
      expect(resource.bare_property).to eq 10
    end
    it "can be updated" do
      expect(resource.bare_property 10).to eq 10
      expect(resource.bare_property 20).to eq 20
      expect(resource.bare_property).to eq 20
    end
    it "can be set with =" do
      expect(resource.bare_property 10).to eq 10
      expect(resource.bare_property).to eq 10
    end
    it "can be set to nil with =" do
      expect(resource.bare_property 10).to eq 10
      expect(resource.bare_property = nil).to be_nil
      expect(resource.bare_property).to be_nil
    end
    it "can be updated with =" do
      expect(resource.bare_property 10).to eq 10
      expect(resource.bare_property = 20).to eq 20
      expect(resource.bare_property).to eq 20
    end
  end

  with_property ":x, name_property: true" do
    context "and subclass" do
      let(:subresource_class) do
        new_resource_name = self.class.new_resource_name
        Class.new(resource_class) do
          resource_name new_resource_name
        end
      end
      let(:subresource) do
        subresource_class.new("blah")
      end

      context "with property :x on the subclass" do
        before do
          subresource_class.class_eval do
            property :x
          end
        end

        it "x is still name_property" do
          expect(subresource.x).to eq "blah"
        end
      end

      context "with property :x, name_attribute: false on the subclass" do
        before do
          subresource_class.class_eval do
            property :x, name_attribute: false
          end
        end

        it "x is no longer name_property" do
          expect(subresource.x).to be_nil
        end
      end

      context "with property :x, default: 10 on the subclass" do
        before do
          subresource_class.class_eval do
            property :x, default: 10
          end
        end

        it "x is no longer name_property" do
          expect(subresource.x).to eq(10)
        end
      end
    end
  end

  with_property ":x, Integer" do
    context "and subclass" do
      let(:subresource_class) do
        new_resource_name = self.class.new_resource_name
        Class.new(resource_class) do
          resource_name new_resource_name
        end
      end
      let(:subresource) do
        subresource_class.new("blah")
      end

      it "x is inherited" do
        expect(subresource.x 10).to eq 10
        expect(subresource.x).to eq 10
        expect(subresource.x = 20).to eq 20
        expect(subresource.x).to eq 20
        expect(subresource_class.properties[:x]).not_to be_nil
      end

      it "x's validation is inherited" do
        expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
      end

      context "with property :y on the subclass" do
        before do
          subresource_class.class_eval do
            property :y
          end
        end

        it "x is still there" do
          expect(subresource.x 10).to eq 10
          expect(subresource.x).to eq 10
          expect(subresource.x = 20).to eq 20
          expect(subresource.x).to eq 20
          expect(subresource_class.properties[:x]).not_to be_nil
        end
        it "y is there" do
          expect(subresource.y 10).to eq 10
          expect(subresource.y).to eq 10
          expect(subresource.y = 20).to eq 20
          expect(subresource.y).to eq 20
          expect(subresource_class.properties[:y]).not_to be_nil
        end
        it "y is not on the superclass" do
          expect { resource_class.y 10 }.to raise_error NoMethodError
          expect(resource_class.properties[:y]).to be_nil
        end
      end

      context "with property :x on the subclass" do
        before do
          subresource_class.class_eval do
            property :x
          end
        end

        it "x is still there" do
          expect(subresource.x 10).to eq 10
          expect(subresource.x).to eq 10
          expect(subresource.x = 20).to eq 20
          expect(subresource.x).to eq 20
          expect(subresource_class.properties[:x]).not_to be_nil
          expect(subresource_class.properties[:x]).not_to eq resource_class.properties[:x]
        end

        it "x's validation is inherited" do
          expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
        end
      end

      context "with property :x, default: 80 on the subclass" do
        before do
          subresource_class.class_eval do
            property :x, default: 80
          end
        end

        it "x is still there" do
          expect(subresource.x 10).to eq 10
          expect(subresource.x).to eq 10
          expect(subresource.x = 20).to eq 20
          expect(subresource.x).to eq 20
          expect(subresource_class.properties[:x]).not_to be_nil
          expect(subresource_class.properties[:x]).not_to eq resource_class.properties[:x]
        end

        it "x defaults to 80" do
          expect(subresource.x).to eq 80
        end

        it "x's validation is inherited" do
          expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
        end
      end

      context "with property :x, String on the subclass" do
        before do
          subresource_class.class_eval do
            property :x, String
          end
        end

        it "x is still there" do
          expect(subresource.x "10").to eq "10"
          expect(subresource.x).to eq "10"
          expect(subresource.x = "20").to eq "20"
          expect(subresource.x).to eq "20"
          expect(subresource_class.properties[:x]).not_to be_nil
          expect(subresource_class.properties[:x]).not_to eq resource_class.properties[:x]
        end

        it "x's validation is overwritten" do
          expect { subresource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
          expect(subresource.x "ohno").to eq "ohno"
          expect(subresource.x).to eq "ohno"
        end

        it "the superclass's validation for x is still there" do
          expect { resource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
          expect(resource.x 10).to eq 10
          expect(resource.x).to eq 10
        end
      end
    end
  end

  context "Chef::Resource::Property#reset_property" do
    it "when a resource is newly created, reset_property(:name) sets property to nil" do
      expect(resource.property_is_set?(:name)).to be_truthy
      resource.reset_property(:name)
      expect(resource.property_is_set?(:name)).to be_falsey
      expect(resource.name).to be_nil
    end

    it "when referencing an undefined property, reset_property(:x) raises an error" do
      expect { resource.reset_property(:x) }.to raise_error(ArgumentError)
    end

    with_property ":x" do
      it "when the resource is newly created, reset_property(:x) does nothing" do
        expect(resource.property_is_set?(:x)).to be_falsey
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to be_nil
      end
      it "when x is set, reset_property resets it" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to be_nil
      end
    end

    with_property ":x, Integer" do
      it "when the resource is newly created, reset_property(:x) does nothing" do
        expect(resource.property_is_set?(:x)).to be_falsey
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to be_nil
      end
      it "when x is set, reset_property resets it even though `nil` is technically invalid" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to be_nil
      end
    end

    with_property ":x, default: 10" do
      it "when the resource is newly created, reset_property(:x) does nothing" do
        expect(resource.property_is_set?(:x)).to be_falsey
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to eq 10
      end
      it "when x is set, reset_property resets it and it returns the default" do
        resource.x 20
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to eq 10
      end
    end

    with_property ":x, default: lazy { 10 }" do
      it "when the resource is newly created, reset_property(:x) does nothing" do
        expect(resource.property_is_set?(:x)).to be_falsey
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to eq 10
      end
      it "when x is set, reset_property resets it and it returns the default" do
        resource.x 20
        resource.reset_property(:x)
        expect(resource.property_is_set?(:x)).to be_falsey
        expect(resource.x).to eq 10
      end
    end
  end

  context "Chef::Resource::Property#property_is_set?" do
    it "when a resource is newly created, property_is_set?(:name) is true" do
      expect(resource.property_is_set?(:name)).to be_truthy
    end

    it "when referencing an undefined property, property_is_set?(:x) raises an error" do
      expect { resource.property_is_set?(:x) }.to raise_error(ArgumentError)
    end

    with_property ":x" do
      it "when the resource is newly created, property_is_set?(:x) is false" do
        expect(resource.property_is_set?(:x)).to be_falsey
      end
      it "when x is set, property_is_set?(:x) is true" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set with =, property_is_set?(:x) is true" do
        resource.x = 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set to a lazy value, property_is_set?(:x) is true" do
        resource.x lazy { 10 }
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is retrieved, property_is_set?(:x) is false" do
        resource.x
        expect(resource.property_is_set?(:x)).to be_falsey
      end
    end

    with_property ":x, default: 10" do
      it "when the resource is newly created, property_is_set?(:x) is false" do
        expect(resource.property_is_set?(:x)).to be_falsey
      end
      it "when x is set, property_is_set?(:x) is true" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set with =, property_is_set?(:x) is true" do
        resource.x = 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set to a lazy value, property_is_set?(:x) is true" do
        resource.x lazy { 10 }
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is retrieved, property_is_set?(:x) is false" do
        resource.x
        expect(resource.property_is_set?(:x)).to be_falsey
      end
    end

    with_property ":x, default: nil" do
      it "when the resource is newly created, property_is_set?(:x) is false" do
        expect(resource.property_is_set?(:x)).to be_falsey
      end
      it "when x is set, property_is_set?(:x) is true" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set with =, property_is_set?(:x) is true" do
        resource.x = 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set to a lazy value, property_is_set?(:x) is true" do
        resource.x lazy { 10 }
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is retrieved, property_is_set?(:x) is false" do
        resource.x
        expect(resource.property_is_set?(:x)).to be_falsey
      end
    end

    with_property ":x, default: lazy { 10 }" do
      it "when the resource is newly created, property_is_set?(:x) is false" do
        expect(resource.property_is_set?(:x)).to be_falsey
      end
      it "when x is set, property_is_set?(:x) is true" do
        resource.x 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is set with =, property_is_set?(:x) is true" do
        resource.x = 10
        expect(resource.property_is_set?(:x)).to be_truthy
      end
      it "when x is retrieved, property_is_set?(:x) is false" do
        resource.x
        expect(resource.property_is_set?(:x)).to be_falsey
      end
    end
  end

  context "Chef::Resource::Property#default" do
    with_property ":x, default: 10" do
      it "when x is set, it returns its value" do
        expect(resource.x 20).to eq 20
        expect(resource.property_is_set?(:x)).to be_truthy
        expect(resource.x).to eq 20
      end
      it "when x is not set, it returns 10" do
        expect(resource.x).to eq 10
      end
      it "when x is not set, it is not included in state" do
        expect(resource.state_for_resource_reporter).to eq({})
      end
      it "when x is set to nil, it returns nil" do
        resource.instance_eval { @x = nil }
        expect(resource.x).to be_nil
      end

      context "With a subclass" do
        let(:subresource_class) do
          new_resource_name = self.class.new_resource_name
          Class.new(resource_class) do
            resource_name new_resource_name
          end
        end
        let(:subresource) { subresource_class.new("blah") }
        it "The default is inherited" do
          expect(subresource.x).to eq 10
        end
      end
    end

    with_property ":x, default: 10, identity: true" do
      it "when x is not set, it is included in identity" do
        expect(resource.identity).to eq(10)
      end
    end

    with_property ":x, default: 1, identity: true", ":y, default: 2, identity: true" do
      it "when x is not set, it is still included in identity" do
        resource.y 20
        expect(resource.identity).to eq(x: 1, y: 20)
      end
    end

    with_property ":x, default: nil" do
      it "when x is not set, it returns nil" do
        expect(resource.x).to be_nil
      end
    end

    with_property ":x" do
      it "when x is not set, it returns nil" do
        expect(resource.x).to be_nil
      end
    end

    context "hash default" do
      context "(deprecations allowed)" do
        before { Chef::Config[:treat_deprecation_warnings_as_errors] = false }

        with_property ":x, default: {}" do
          it "when x is not set, it returns {}" do
            expect(resource.x).to eq({})
          end
          it "The same exact value is returned multiple times in a row" do
            value = resource.x
            expect(value).to eq({})
            expect(resource.x.object_id).to eq(value.object_id)
          end
          it "Multiple instances of x receive the exact same value" do
            expect(resource.x.object_id).to eq(resource_class.new("blah2").x.object_id)
          end
        end
      end

      with_property ":x, default: lazy { {} }" do
        it "when x is not set, it returns {}" do
          expect(resource.x).to eq({})
        end
        # it "The value is different each time it is called" do
        #   value = resource.x
        #   expect(value).to eq({})
        #   expect(resource.x.object_id).not_to eq(value.object_id)
        # end
        it "Multiple instances of x receive different values" do
          expect(resource.x.object_id).not_to eq(resource_class.new("blah2").x.object_id)
        end
      end
    end

    context "with a class with 'blah' as both class and instance methods" do
      before do
        resource_class.class_eval do
          def self.blah
            "class"
          end

          def blah
            "#{name}#{next_index}"
          end
        end
      end

      with_property ":x, default: lazy { blah }" do
        it "x is run in context of the instance" do
          expect(resource.x).to eq "blah1"
        end
        it "x is run in the context of each instance it is run in" do
          expect(resource.x).to eq "blah1"
          expect(resource_class.new("another").x).to eq "another2"
          # expect(resource.x).to eq "blah3"
        end
      end

      with_property ':x, default: lazy { |x| "#{blah}#{x.blah}" }' do
        it "x is run in context of the class (where it was defined) and passed the instance" do
          expect(resource.x).to eq "classblah1"
        end
        it "x is passed the value of each instance it is run in" do
          expect(resource.x).to eq "classblah1"
          expect(resource_class.new("another").x).to eq "classanother2"
          # expect(resource.x).to eq "classblah3"
        end
      end
    end

    context "validation of defaults" do
      it "When a class is declared with property :x, String, default: 10, a warning is emitted" do
        expect { resource_class.class_eval { property :x, String, default: 10 } }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
          /Default value 10 is invalid for property x of resource chef_resource_property_spec_(\d+). In Chef 13 this will become an error: Property x must be one of: String!  You passed 10./
      end
      context "With property :x, String, default: 10" do
        before do
          Chef::Config[:treat_deprecation_warnings_as_errors] = false
          resource_class.class_eval { property :x, String, default: 10 }
          Chef::Config[:treat_deprecation_warnings_as_errors] = true
        end

        it "when x is set, no error is raised" do
          expect(resource.x "hi").to eq "hi"
          expect(resource.x).to eq "hi"
        end
        it "when x is retrieved, no validation error is raised" do
          expect(resource.x).to eq 10
        end
      end

      with_property ":x, String, default: lazy { Namer.next_index }" do
        it "when the resource is created, no error is raised" do
          resource
        end
        it "when x is set, no error is raised" do
          expect(resource.x "hi").to eq "hi"
          expect(resource.x).to eq "hi"
        end
        it "when x is retrieved, an invalid default warning is emitted and the value is returned" do
          expect { resource.x }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
            /Default value 1 is invalid for property x of resource chef_resource_property_spec_(\d+). In Chef 13 this will become an error: Property x must be one of: String!  You passed 1./
          expect(Namer.current_index).to eq 1
          Chef::Config[:treat_deprecation_warnings_as_errors] = false
          expect(resource.x).to eq 2
        end
      end

      with_property ":x, default: lazy { Namer.next_index.to_s }, is: proc { |v| Namer.next_index; true }" do
        it "coercion and validation is only run the first time" do
          expect(resource.x).to eq "1"
          expect(Namer.current_index).to eq 2
          expect(resource.x).to eq "1"
          expect(Namer.current_index).to eq 2
        end
      end

      with_property ":x, default: lazy { Namer.next_index.to_s.freeze }, is: proc { |v| Namer.next_index; true }" do
        it "coercion and validation is run each time" do
          expect(resource.x).to eq "1"
          expect(Namer.current_index).to eq 2
          expect(resource.x).to eq "3"
          expect(Namer.current_index).to eq 4
        end
      end
    end

    context "coercion of defaults" do
      # Frozen default, non-frozen coerce
      with_property ':x, coerce: proc { |v| "#{v}#{next_index}" }, default: 10' do
        it "when the resource is created, the proc is not yet run" do
          resource
          expect(Namer.current_index).to eq 0
        end
        it "when x is set, coercion is run" do
          expect(resource.x "hi").to eq "hi1"
          expect(resource.x).to eq "hi1"
          expect(Namer.current_index).to eq 1
        end
        it "when x is retrieved, coercion is run exactly once" do
          expect(resource.x).to eq "101"
          expect(resource.x).to eq "101"
          expect(Namer.current_index).to eq 1
        end
      end

      # Frozen default, frozen coerce
      with_property ':x, coerce: proc { |v| "#{v}#{next_index}".freeze }, default: 10' do
        it "when the resource is created, the proc is not yet run" do
          resource
          expect(Namer.current_index).to eq 0
        end
        it "when x is set, coercion is run" do
          expect(resource.x "hi").to eq "hi1"
          expect(resource.x).to eq "hi1"
          expect(Namer.current_index).to eq 1
        end
        it "when x is retrieved, coercion is run each time" do
          expect(resource.x).to eq "101"
          expect(resource.x).to eq "102"
          expect(Namer.current_index).to eq 2
        end
      end

      # Frozen lazy default, non-frozen coerce
      with_property ':x, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
        it "when the resource is created, the proc is not yet run" do
          resource
          expect(Namer.current_index).to eq 0
        end
        it "when x is set, coercion is run" do
          expect(resource.x "hi").to eq "hi1"
          expect(resource.x).to eq "hi1"
          expect(Namer.current_index).to eq 1
        end
        it "when x is retrieved, coercion is run exactly once" do
          expect(resource.x).to eq "101"
          expect(resource.x).to eq "101"
          expect(Namer.current_index).to eq 1
        end
      end

      # Non-frozen lazy default, frozen coerce
      with_property ':x, coerce: proc { |v| "#{v}#{next_index}".freeze }, default: lazy { "10" }' do
        it "when the resource is created, the proc is not yet run" do
          resource
          expect(Namer.current_index).to eq 0
        end
        it "when x is set, coercion is run" do
          expect(resource.x "hi").to eq "hi1"
          expect(resource.x).to eq "hi1"
          expect(Namer.current_index).to eq 1
        end
        it "when x is retrieved, coercion is run each time" do
          expect(resource.x).to eq "101"
          expect(resource.x).to eq "102"
          expect(Namer.current_index).to eq 2
        end
      end

      with_property ':x, proc { |v| Namer.next_index; true }, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
        it "coercion and validation is only run the first time x is retrieved" do
          expect(Namer.current_index).to eq 0
          expect(resource.x).to eq "101"
          expect(Namer.current_index).to eq 2
          expect(resource.x).to eq "101"
          expect(Namer.current_index).to eq 2
        end
      end

      context "validation and coercion of defaults" do
        with_property ':x, String, coerce: proc { |v| "#{v}#{next_index}" }, default: 10' do
          it "when x is retrieved, it is coerced before validating and passes" do
            expect(resource.x).to eq "101"
          end
        end
        with_property ':x, Integer, coerce: proc { |v| "#{v}#{next_index}" }, default: 10' do
          it "when x is retrieved, it is coerced and emits an invalid default warning, but still returns the value" do
            expect { resource.x }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
              /Default value 10 is invalid for property x of resource chef_resource_property_spec_(\d+). In Chef 13 this will become an error: Property x must be one of: Integer!  You passed "101"./
            Chef::Config[:treat_deprecation_warnings_as_errors] = false
            expect(resource.x).to eq "102"
          end
        end
        with_property ':x, String, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
          it "when x is retrieved, it is coerced before validating and passes" do
            expect(resource.x).to eq "101"
          end
        end
        with_property ':x, Integer, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
          it "when x is retrieved, it is coerced and emits an invalid default warning; the value is still returned." do
            expect { resource.x }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
              /Default value 10 is invalid for property x of resource chef_resource_property_spec_(\d+). In Chef 13 this will become an error: Property x must be one of: Integer!  You passed "101"./
            Chef::Config[:treat_deprecation_warnings_as_errors] = false
            expect(resource.x).to eq "102"
          end
        end
        with_property ':x, proc { |v| Namer.next_index; true }, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
          it "coercion is only run the first time x is retrieved, and validation is run" do
            expect(Namer.current_index).to eq 0
            expect(resource.x).to eq "101"
            expect(Namer.current_index).to eq 2
            expect(resource.x).to eq "101"
            expect(Namer.current_index).to eq 2
          end
        end
      end
    end
  end

  context "Chef::Resource#lazy" do
    with_property ":x" do
      it "setting x to a lazy value does not run it immediately" do
        resource.x lazy { Namer.next_index }
        expect(Namer.current_index).to eq 0
      end
      it "you can set x to a lazy value in the instance" do
        resource.instance_eval do
          x lazy { Namer.next_index }
        end
        expect(resource.x).to eq 1
        expect(Namer.current_index).to eq 1
      end
      it "retrieving a lazy value pops it open" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq 1
        expect(Namer.current_index).to eq 1
      end
      it "retrieving a lazy value twice evaluates it twice" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq 1
        expect(resource.x).to eq 2
        expect(Namer.current_index).to eq 2
      end
      it "setting the same lazy value on two different instances runs it on each instancee" do
        resource2 = resource_class.new("blah2")
        l = lazy { Namer.next_index }
        resource.x l
        resource2.x l
        expect(resource2.x).to eq 1
        expect(resource.x).to eq 2
        expect(resource2.x).to eq 3
      end

      context "when the class has a class and instance method named blah" do
        before do
          resource_class.class_eval do
            def self.blah
              "class"
            end

            def blah
              "#{name}#{Namer.next_index}"
            end
          end
        end
        def blah
          "example"
        end
        # it "retrieving lazy { blah } gets the instance variable" do
        #   resource.x lazy { blah }
        #   expect(resource.x).to eq "blah1"
        # end
        # it "retrieving lazy { blah } from two different instances gets two different instance variables" do
        #   resource2 = resource_class.new("another")
        #   l = lazy { blah }
        #   resource2.x l
        #   resource.x l
        #   expect(resource2.x).to eq "another1"
        #   expect(resource.x).to eq "blah2"
        #   expect(resource2.x).to eq "another3"
        # end
        it 'retrieving lazy { |x| "#{blah}#{x.blah}" } gets the example and instance variables' do
          resource.x lazy { |x| "#{blah}#{x.blah}" }
          expect(resource.x).to eq "exampleblah1"
        end
        it 'retrieving lazy { |x| "#{blah}#{x.blah}" } from two different instances gets two different instance variables' do
          resource2 = resource_class.new("another")
          l = lazy { |x| "#{blah}#{x.blah}" }
          resource2.x l
          resource.x l
          expect(resource2.x).to eq "exampleanother1"
          expect(resource.x).to eq "exampleblah2"
          expect(resource2.x).to eq "exampleanother3"
        end
      end
    end

    with_property ':x, coerce: proc { |v| "#{v}#{Namer.next_index}" }' do
      it "lazy values are not coerced on set" do
        resource.x lazy { Namer.next_index }
        expect(Namer.current_index).to eq 0
      end
      it "lazy values are coerced on get" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq "12"
        expect(Namer.current_index).to eq 2
      end
      it "lazy values are coerced on each access" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq "12"
        expect(Namer.current_index).to eq 2
        expect(resource.x).to eq "34"
        expect(Namer.current_index).to eq 4
      end
    end

    with_property ":x, String" do
      it "lazy values are not validated on set" do
        resource.x lazy { Namer.next_index }
        expect(Namer.current_index).to eq 0
      end
      it "lazy values are validated on get" do
        resource.x lazy { Namer.next_index }
        expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
        expect(Namer.current_index).to eq 1
      end
    end

    with_property ":x, is: proc { |v| Namer.next_index; true }" do
      it "lazy values are validated on each access" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq 1
        expect(Namer.current_index).to eq 2
        expect(resource.x).to eq 3
        expect(Namer.current_index).to eq 4
      end
    end

    with_property ':x, Integer, coerce: proc { |v| "#{v}#{Namer.next_index}" }' do
      it "lazy values are not validated or coerced on set" do
        resource.x lazy { Namer.next_index }
        expect(Namer.current_index).to eq 0
      end
      it "lazy values are coerced before being validated, which fails" do
        resource.x lazy { Namer.next_index }
        expect(Namer.current_index).to eq 0
        expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
        expect(Namer.current_index).to eq 2
      end
    end

    with_property ':x, coerce: proc { |v| "#{v}#{Namer.next_index}" }, is: proc { |v| Namer.next_index; true }' do
      it "lazy values are coerced and validated exactly once" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq "12"
        expect(Namer.current_index).to eq 3
        expect(resource.x).to eq "45"
        expect(Namer.current_index).to eq 6
      end
    end

    with_property ':x, String, coerce: proc { |v| "#{v}#{Namer.next_index}" }' do
      it "lazy values are coerced before being validated, which succeeds" do
        resource.x lazy { Namer.next_index }
        expect(resource.x).to eq "12"
        expect(Namer.current_index).to eq 2
      end
    end
  end

  context "Chef::Resource::Property#coerce" do
    with_property ':x, coerce: proc { |v| "#{v}#{Namer.next_index}" }' do
      it "coercion runs on set" do
        expect(resource.x 10).to eq "101"
        expect(Namer.current_index).to eq 1
      end
      it "does not emit a deprecation warning if set to nil" do
        # nil is never coerced
        expect(resource.x nil).to be_nil
      end
      it "coercion sets the value (and coercion does not run on get)" do
        expect(resource.x 10).to eq "101"
        expect(resource.x).to eq "101"
        expect(Namer.current_index).to eq 1
      end
      it "coercion runs each time set happens" do
        expect(resource.x 10).to eq "101"
        expect(Namer.current_index).to eq 1
        expect(resource.x 10).to eq "102"
        expect(Namer.current_index).to eq 2
      end
    end
    with_property ":x, coerce: proc { |x| x }" do
      it "does not emit a deprecation warning if set to nil" do
        expect(resource.x nil).to be_nil
      end
    end
    with_property ':x, coerce: proc { |x| Namer.next_index; raise "hi" if x == 10; x }, is: proc { |x| Namer.next_index; x != 10 }' do
      it "failed coercion fails to set the value" do
        resource.x 20
        expect(resource.x).to eq 20
        expect(Namer.current_index).to eq 2
        expect { resource.x 10 }.to raise_error "hi"
        expect(resource.x).to eq 20
        expect(Namer.current_index).to eq 3
      end
      it "validation does not run if coercion fails" do
        expect { resource.x 10 }.to raise_error "hi"
        expect(Namer.current_index).to eq 1
      end
    end
  end

  context "Chef::Resource::Property validation" do
    with_property ":x, is: proc { |v| Namer.next_index; v.is_a?(Integer) }" do
      it "validation runs on set" do
        expect(resource.x 10).to eq 10
        expect(Namer.current_index).to eq 1
      end
      it "validation sets the value (and validation does not run on get)" do
        expect(resource.x 10).to eq 10
        expect(resource.x).to eq 10
        expect(Namer.current_index).to eq 1
      end
      it "validation runs each time set happens" do
        expect(resource.x 10).to eq 10
        expect(Namer.current_index).to eq 1
        expect(resource.x 10).to eq 10
        expect(Namer.current_index).to eq 2
      end
      it "failed validation fails to set the value" do
        expect(resource.x 10).to eq 10
        expect(Namer.current_index).to eq 1
        expect { resource.x "blah" }.to raise_error Chef::Exceptions::ValidationFailed
        expect(resource.x).to eq 10
        expect(Namer.current_index).to eq 2
      end
    end
  end

  %w{name_attribute name_property}.each do |name|
    context "Chef::Resource::Property##{name}" do
      with_property ":x, #{name}: true" do
        it "defaults x to resource.name" do
          expect(resource.x).to eq "blah"
        end
        it "does not pick up resource.name if set" do
          expect(resource.x 10).to eq 10
          expect(resource.x).to eq 10
        end
        it "binds to the latest resource.name when run" do
          resource.name "foo"
          expect(resource.x).to eq "foo"
        end
        it "caches resource.name" do
          expect(resource.x).to eq "blah"
          resource.name "foo"
          expect(resource.x).to eq "blah"
        end
      end

      with_property ":x, #{name}: false" do
        it "defaults to nil" do
          expect(resource.x).to be_nil
        end
      end

      with_property ":x, #{name}: nil" do
        it "defaults to nil" do
          expect(resource.x).to be_nil
        end
      end

      context "default ordering deprecation warnings" do
        it "emits a deprecation warning for property :x, default: 10, #{name}: true" do
          expect { resource_class.property :x, :default => 10, name.to_sym => true }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
            /Cannot specify both default and name_property together on property x of resource chef_resource_property_spec_(\d+). Only one \(default\) will be obeyed./
        end
        it "emits a deprecation warning for property :x, default: nil, #{name}: true" do
          expect { resource_class.property :x, :default => nil, name.to_sym => true }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
            /Cannot specify both default and name_property together on property x of resource chef_resource_property_spec_(\d+). Only one \(name_property\) will be obeyed./
        end
        it "emits a deprecation warning for property :x, #{name}: true, default: 10" do
          expect { resource_class.property :x, name.to_sym => true, :default => 10 }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
            /Cannot specify both default and name_property together on property x of resource chef_resource_property_spec_(\d+). Only one \(name_property\) will be obeyed./
        end
        it "emits a deprecation warning for property :x, #{name}: true, default: nil" do
          expect { resource_class.property :x, name.to_sym => true, :default => nil }.to raise_error Chef::Exceptions::DeprecatedFeatureError,
            /Cannot specify both default and name_property together on property x of resource chef_resource_property_spec_(\d+). Only one \(name_property\) will be obeyed./
        end
      end

      context "default ordering" do
        before { Chef::Config[:treat_deprecation_warnings_as_errors] = false }
        with_property ":x, default: 10, #{name}: true" do
          it "chooses default over #{name}" do
            expect(resource.x).to eq 10
          end
        end
        with_property ":x, default: nil, #{name}: true" do
          it "chooses #{name} over default" do
            expect(resource.x).to eq "blah"
          end
        end
        with_property ":x, #{name}: true, default: 10" do
          it "chooses #{name} over default" do
            expect(resource.x).to eq "blah"
          end
        end
        with_property ":x, #{name}: true, default: nil" do
          it "chooses #{name} over default" do
            expect(resource.x).to eq "blah"
          end
        end
      end

      context "default ordering when #{name} is nil" do
        with_property ":x, #{name}: nil, default: 10" do
          it "chooses default" do
            expect(resource.x).to eq 10
          end
        end
        with_property ":x, default: 10, #{name}: nil" do
          it "chooses default" do
            expect(resource.x).to eq 10
          end
        end
      end

      context "default ordering when #{name} is false" do
        with_property ":x, #{name}: false, default: 10" do
          it "chooses default" do
            expect(resource.x).to eq 10
          end
        end
        with_property ":x, default: 10, #{name}: nil" do
          it "chooses default" do
            expect(resource.x).to eq 10
          end
        end
      end

    end
  end

  it "raises an error if both name_property and name_attribute are specified" do
    expect { resource_class.property :x, :name_property => false, :name_attribute => 1 }.to raise_error ArgumentError,
      /Cannot specify both name_property and name_attribute together on property x of resource chef_resource_property_spec_(\d+)./
    expect { resource_class.property :x, :name_property => false, :name_attribute => nil }.to raise_error ArgumentError,
      /Cannot specify both name_property and name_attribute together on property x of resource chef_resource_property_spec_(\d+)./
    expect { resource_class.property :x, :name_property => false, :name_attribute => false }.to raise_error ArgumentError,
      /Cannot specify both name_property and name_attribute together on property x of resource chef_resource_property_spec_(\d+)./
    expect { resource_class.property :x, :name_property => true, :name_attribute => true }.to raise_error ArgumentError,
      /Cannot specify both name_property and name_attribute together on property x of resource chef_resource_property_spec_(\d+)./
  end

  context "property_type" do
    it "property_types validate their defaults" do
      expect {
        module ::PropertySpecPropertyTypes
          include Chef::Mixin::Properties
          property_type(is: [:a, :b], default: :c)
        end
      }.to raise_error(Chef::Exceptions::DeprecatedFeatureError, /Default value :c is invalid for property <property type>./)
      expect {
        module ::PropertySpecPropertyTypes
          include Chef::Mixin::Properties
          property_type(is: [:a, :b], default: :b)
        end
      }.not_to raise_error
    end

    context "With property_type ABType (is: [:a, :b]) and CDType (is: [:c, :d])" do
      before :all do
        module ::PropertySpecPropertyTypes
          include Chef::Mixin::Properties
          ABType = property_type(is: [:a, :b])
          CDType = property_type(is: [:c, :d])
        end
      end

      with_property ":x, [PropertySpecPropertyTypes::ABType, nil, PropertySpecPropertyTypes::CDType]" do
        it "The property can be set to nil without triggering a warning" do
          expect(resource.x nil).to be_nil
          expect(resource.x).to be_nil
        end
        it "The property can be set to :a" do
          expect(resource.x :a).to eq(:a)
          expect(resource.x).to eq(:a)
        end
        it "The property can be set to :c" do
          expect(resource.x :c).to eq(:c)
          expect(resource.x).to eq(:c)
        end
        it "The property cannot be set to :z" do
          expect { resource.x :z }.to raise_error(Chef::Exceptions::ValidationFailed, /Property x must be one of/)
        end
      end

      with_property ":x, [nil, PropertySpecPropertyTypes::ABType, PropertySpecPropertyTypes::CDType]" do
        it "The property can be set to nil without triggering a warning" do
          expect(resource.x nil).to be_nil
          expect(resource.x).to be_nil
        end
        it "The property can be set to :a" do
          expect(resource.x :a).to eq(:a)
          expect(resource.x).to eq(:a)
        end
        it "The property can be set to :c" do
          expect(resource.x :c).to eq(:c)
          expect(resource.x).to eq(:c)
        end
        it "The property cannot be set to :z" do
          expect { resource.x :z }.to raise_error(Chef::Exceptions::ValidationFailed, /Property x must be one of/)
        end
      end

      with_property ":x, [PropertySpecPropertyTypes::ABType, nil], default: nil" do
        it "The value defaults to nil" do
          expect(resource.x).to be_nil
        end
      end

      with_property ":x, [PropertySpecPropertyTypes::ABType, nil], default: lazy { nil }" do
        it "The value defaults to nil" do
          expect(resource.x).to be_nil
        end
      end
    end

  end

  context "with a custom property type" do
    class CustomPropertyType < Chef::Property
    end

    with_property ":x, CustomPropertyType.new" do
      it "creates x with the given type" do
        expect(resource_class.properties[:x]).to be_kind_of(CustomPropertyType)
      end

      context "and a subclass" do
        let(:subresource_class) do
          new_resource_name = self.class.new_resource_name
          Class.new(resource_class) do
            resource_name new_resource_name
          end
        end
        let(:subresource) do
          subresource_class.new("blah")
        end

        context "with property :x, default: 10 on the subclass" do
          before do
            subresource_class.class_eval do
              property :x, default: 10
            end
          end

          it "x has the given type and default on the subclass" do
            expect(subresource_class.properties[:x]).to be_kind_of(CustomPropertyType)
            expect(subresource_class.properties[:x].default).to eq(10)
          end

          it "x does not have the default on the superclass" do
            expect(resource_class.properties[:x]).to be_kind_of(CustomPropertyType)
            expect(resource_class.properties[:x].default).to be_nil
          end
        end
      end
    end

    with_property ":x, CustomPropertyType.new, default: 10" do
      it "passes the default to the custom property type" do
        expect(resource_class.properties[:x]).to be_kind_of(CustomPropertyType)
        expect(resource_class.properties[:x].default).to eq(10)
      end
    end
  end
end


text:
package antlr;

/* ANTLR Translator Generator
 * Project led by Terence Parr at http://www.jGuru.com
 * Software rights: http://www.antlr.org/RIGHTS.html
 *
 * $Id: FileCopyException.java,v 1.1 2003/06/04 20:54:36 greg Exp $
 */

class FileCopyException extends java.io.IOException {
    public FileCopyException(String msg) {
        super(msg);
    }
}


text:
<?php

namespace Soda\Cms\Foundation\Providers\Traits;

trait LoadsConstants
{
    protected $app;

    /**
     * Loads the given configuration into a global namespace.
     *
     * @param  string $path
     * @param  string $namespace
     *
     * @return void
     */
    protected function loadConstantsFrom($path, $namespace = null)
    {
        $constants = require $path;
        $prefix = $namespace ? "$namespace" : '';

        foreach ($constants as $constant => $value) {
            define(strtoupper("{$prefix}{$constant}"), $value);
        }
    }
}


text:
namespace M3PlusMicrocontroller
{
    public class Rom : Direction
    {
        public Rom(byte value)
        {
            Value = value;
        }

        public override string Description => $"o valor {Helpers.ToHex(Value)}";
        public override string Instruction => $"{Helpers.ToHex(Value)}";
        public sealed override byte Value { get; set; }
    }
}


text:
import { ENV } from '@ember/-internals/environment';
import { Object as EmberObject } from '@ember/-internals/runtime';
import { HANDLERS } from '../lib/handlers';
import {
  registerHandler,
  missingOptionsDeprecation,
  missingOptionsIdDeprecation,
  missingOptionsUntilDeprecation,
  missingOptionsForDeprecation,
  missingOptionsSinceDeprecation,
  FOR_MISSING_DEPRECATIONS,
  SINCE_MISSING_DEPRECATIONS,
} from '../lib/deprecate';

import {
  missingOptionsIdDeprecation as missingWarnOptionsIdDeprecation,
  missingOptionsDeprecation as missingWarnOptionsDeprecation,
  registerHandler as registerWarnHandler,
} from '../lib/warn';

import { deprecate, warn, assert as emberAssert } from '../index';

import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers';

let originalEnvValue;
let originalDeprecateHandler;
let originalWarnHandler;

const originalConsoleWarn = console.warn; // eslint-disable-line no-console
const noop = function () {};

moduleFor(
  'ember-debug',
  class extends TestCase {
    constructor() {
      super();

      originalEnvValue = ENV.RAISE_ON_DEPRECATION;
      originalDeprecateHandler = HANDLERS.deprecate;
      originalWarnHandler = HANDLERS.warn;

      ENV.RAISE_ON_DEPRECATION = true;
    }

    teardown() {
      HANDLERS.deprecate = originalDeprecateHandler;
      HANDLERS.warn = originalWarnHandler;
      FOR_MISSING_DEPRECATIONS.clear();
      SINCE_MISSING_DEPRECATIONS.clear();
      ENV.RAISE_ON_DEPRECATION = originalEnvValue;
    }

    afterEach() {
      console.warn = originalConsoleWarn; // eslint-disable-line no-console
    }

    ['@test deprecate does not throw if RAISE_ON_DEPRECATION is false'](assert) {
      assert.expect(1);
      console.warn = noop; // eslint-disable-line no-console

      ENV.RAISE_ON_DEPRECATION = false;

      try {
        deprecate('Should not throw', false, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
        assert.ok(true, 'deprecate did not throw');
      } catch (e) {
        assert.ok(false, `Expected deprecate not to throw but it did: ${e.message}`);
      }
    }

    ['@test deprecate resets deprecation level to RAISE if ENV.RAISE_ON_DEPRECATION is set'](
      assert
    ) {
      assert.expect(2);
      console.warn = noop; // eslint-disable-line no-console

      ENV.RAISE_ON_DEPRECATION = false;

      try {
        deprecate('Should not throw', false, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
        assert.ok(true, 'deprecate did not throw');
      } catch (e) {
        assert.ok(false, `Expected deprecate not to throw but it did: ${e.message}`);
      }

      ENV.RAISE_ON_DEPRECATION = true;

      assert.throws(() => {
        deprecate('Should throw', false, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
      }, /Should throw/);
    }

    ['@test When ENV.RAISE_ON_DEPRECATION is true, it is still possible to silence a deprecation by id'](
      assert
    ) {
      assert.expect(3);

      ENV.RAISE_ON_DEPRECATION = true;
      registerHandler(function (message, options, next) {
        if (!options || options.id !== 'my-deprecation') {
          next(...arguments);
        }
      });

      try {
        deprecate('should be silenced with matching id', false, {
          id: 'my-deprecation',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
        assert.ok(true, 'Did not throw when level is set by id');
      } catch (e) {
        assert.ok(false, `Expected deprecate not to throw but it did: ${e.message}`);
      }

      assert.throws(() => {
        deprecate('Should throw with no matching id', false, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
      }, /Should throw with no matching id/);

      assert.throws(() => {
        deprecate('Should throw with non-matching id', false, {
          id: 'other-id',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        });
      }, /Should throw with non-matching id/);
    }

    ['@test deprecate throws deprecation if second argument is falsy'](assert) {
      assert.expect(3);

      assert.throws(() =>
        deprecate('Deprecation is thrown', false, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        })
      );
      assert.throws(() =>
        deprecate('Deprecation is thrown', '', {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        })
      );
      assert.throws(() =>
        deprecate('Deprecation is thrown', 0, {
          id: 'test',
          until: 'forever',
          for: 'me',
          since: { enabled: '1.0.0' },
        })
      );
    }

    ['@test deprecate does not invoke a function as the second argument'](assert) {
      assert.expect(1);

      deprecate(
        'Deprecation is thrown',
        function () {
          assert.ok(false, 'this function should not be invoked');
        },
        { id: 'test', until: 'forever', for: 'me', since: { enabled: '1.0.0' } }
      );

      assert.ok(true, 'deprecations were not thrown');
    }

    ['@test deprecate does not throw deprecations if second argument is truthy'](assert) {
      assert.expect(1);

      deprecate('Deprecation is thrown', true, {
        id: 'test',
        until: 'forever',
        for: 'me',
        since: { enabled: '1.0.0' },
      });
      deprecate('Deprecation is thrown', '1', {
        id: 'test',
        until: 'forever',
        for: 'me',
        since: { enabled: '1.0.0' },
      });
      deprecate('Deprecation is thrown', 1, {
        id: 'test',
        until: 'forever',
        for: 'me',
        since: { enabled: '1.0.0' },
      });

      assert.ok(true, 'deprecations were not thrown');
    }

    ['@test assert throws if second argument is falsy'](assert) {
      assert.expect(3);

      assert.throws(() => emberAssert('Assertion is thrown', false));
      assert.throws(() => emberAssert('Assertion is thrown', ''));
      assert.throws(() => emberAssert('Assertion is thrown', 0));
    }

    ['@test assert does not throw if second argument is a function'](assert) {
      assert.expect(1);

      emberAssert('Assertion is thrown', () => true);

      assert.ok(true, 'assertions were not thrown');
    }

    ['@test assert does not throw if second argument is falsy'](assert) {
      assert.expect(1);

      emberAssert('Assertion is thrown', true);
      emberAssert('Assertion is thrown', '1');
      emberAssert('Assertion is thrown', 1);

      assert.ok(true, 'assertions were not thrown');
    }

    ['@test assert does not throw if second argument is an object'](assert) {
      assert.expect(1);
      let Igor = EmberObject.extend();

      emberAssert('is truthy', Igor);
      emberAssert('is truthy', Igor.create());

      assert.ok(true, 'assertions were not thrown');
    }

    ['@test deprecate does not throw a deprecation at log and silence'](assert) {
      assert.expect(4);
      let id = 'ABC';
      let until = 'forever';
      let shouldThrow = false;

      registerHandler(function (message, options) {
        if (options && options.id === id) {
          if (shouldThrow) {
            throw new Error(message);
          }
        }
      });

      try {
        deprecate('Deprecation for testing purposes', false, { id, until });
        assert.ok(true, 'Deprecation did not throw');
      } catch (e) {
        assert.ok(false, 'Deprecation was thrown despite being added to blacklist');
      }

      try {
        deprecate('Deprecation for testing purposes', false, { id, until });
        assert.ok(true, 'Deprecation did not throw');
      } catch (e) {
        assert.ok(false, 'Deprecation was thrown despite being added to blacklist');
      }

      shouldThrow = true;

      assert.throws(function () {
        deprecate('Deprecation is thrown', false, { id, until });
      });

      assert.throws(function () {
        deprecate('Deprecation is thrown', false, { id, until });
      });
    }

    ['@test deprecate without options triggers an assertion'](assert) {
      assert.expect(2);

      assert.throws(
        () => deprecate('foo'),
        new RegExp(missingOptionsDeprecation),
        'proper assertion is triggered when options is missing'
      );

      assert.throws(
        () => deprecate('foo', false, {}),
        new RegExp(missingOptionsDeprecation),
        'proper assertion is triggered when options is missing'
      );
    }

    ['@test deprecate without options.id triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () => deprecate('foo', false, { until: 'forever', for: 'me', since: { enabled: '1.0.0' } }),
        new RegExp(missingOptionsIdDeprecation),
        'proper assertion is triggered when options.id is missing'
      );
    }

    ['@test deprecate without options.until triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () => deprecate('foo', false, { id: 'test' }),
        new RegExp(missingOptionsUntilDeprecation),
        'proper assertion is triggered when options.until is missing'
      );
    }

    ['@test deprecate without options.for triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () => deprecate('message1', false, { id: 'test', until: 'forever' }),
        new RegExp(missingOptionsForDeprecation('test')),
        'proper assertion is triggered when options.for is missing'
      );
    }

    ['@test deprecate without options.for only triggers once per id'](assert) {
      ENV.RAISE_ON_DEPRECATION = false;
      let messages = [];
      registerHandler(function (message, options, next) {
        if (options.id === 'ember-source.deprecation-without-for') {
          messages.push(message);
        }
        next(...arguments);
      });

      deprecate('message1', false, { id: 'test', until: 'forever' });
      deprecate('message2', false, { id: 'test', until: 'forever' });
      deprecate('message3', false, { id: 'another', until: 'forever' });

      assert.equal(messages.length, 2, 'correct number of deprecations');
      assert.equal(messages[0], missingOptionsForDeprecation('test'), 'first message is correct');

      assert.equal(
        messages[1],
        missingOptionsForDeprecation('another'),
        'second message is correct'
      );
    }

    ['@test deprecate without options.since triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () =>
          deprecate('foo', false, {
            id: 'test',
            until: 'forever',
            for: 'me',
          }),
        new RegExp(missingOptionsSinceDeprecation('test')),
        'proper assertion is triggered when options.since is missing'
      );
    }

    ['@test deprecate without options.since only triggers once per id'](assert) {
      ENV.RAISE_ON_DEPRECATION = false;
      let messages = [];
      registerHandler(function (message, options, next) {
        if (options.id === 'ember-source.deprecation-without-since') {
          messages.push(message);
        }
        next(...arguments);
      });
      deprecate('foo', false, { id: 'test', until: 'forever', for: 'me' });
      deprecate('foobar', false, { id: 'test', until: 'forever', for: 'me' });
      deprecate('baz', false, { id: 'another', until: 'forever', for: 'me' });

      assert.equal(messages.length, 2, 'deprecation message only sent once');
      assert.equal(messages[0], missingOptionsSinceDeprecation('test'), 'first message is correct');
      assert.equal(
        messages[1],
        missingOptionsSinceDeprecation('another'),
        'second message is correct'
      );
    }

    ['@test warn without options triggers an assert'](assert) {
      assert.expect(1);

      assert.throws(
        () => warn('foo'),
        new RegExp(missingWarnOptionsDeprecation),
        'deprecation is triggered when options is missing'
      );
    }

    ['@test warn without options.id triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () => warn('foo', false, {}),
        new RegExp(missingWarnOptionsIdDeprecation),
        'deprecation is triggered when options is missing'
      );
    }

    ['@test warn without options.id nor test triggers an assertion'](assert) {
      assert.expect(1);

      assert.throws(
        () => warn('foo', {}),
        new RegExp(missingWarnOptionsIdDeprecation),
        'deprecation is triggered when options is missing'
      );
    }

    ['@test warn without test but with options does not trigger an assertion'](assert) {
      assert.expect(1);

      registerWarnHandler(function (message) {
        assert.equal(message, 'foo', 'warning was triggered');
      });

      warn('foo', { id: 'ember-debug.do-not-raise' });
    }
  }
);


text:
/*global describe, expect, fallback, it*/

describe('tests.unit.core.isObject', function() {
	it('should be a Function', function() {
		var test = fallback.isObject;
		expect(test).to.be.a('function');
	});

	it('to always return a Boolean', function() {
		var test = fallback.isObject();
		expect(typeof test).to.equal('boolean');
	});

	it('null should return false.', function() {
		expect(fallback.isObject(null)).to.equal(false);
	});

	it('undefined should return false.', function() {
		expect(fallback.isObject(undefined)).to.equal(false);
	});

	it('Array should return false.', function() {
		expect(fallback.isObject([])).to.equal(false);
	});

	it('String should return false.', function() {
		expect(fallback.isObject('String')).to.equal(false);
	});

	it('Number should return false.', function() {
		expect(fallback.isObject(0)).to.equal(false);
	});

	it('Object should return true.', function() {
		expect(fallback.isObject({})).to.equal(true);
	});

	it('Boolean of false should return false.', function() {
		expect(fallback.isObject(false)).to.equal(false);
	});

	it('Boolean of true should return false.', function() {
		expect(fallback.isObject(true)).to.equal(false);
	});

	it('Function should return false.', function() {
		expect(fallback.isObject(function() {})).to.equal(false);
	});
});


text:
.. _skiboot-6.3.1:

==============
skiboot-6.3.1
==============

skiboot 6.3.1 was released on Friday May 10th, 2019. It replaces
:ref:`skiboot-6.3` as the current stable release in the 6.3.x series.

It is recommended that 6.3.1 be used instead of 6.3 version
due to the bug fixes it contains.

Bug fixes included in this release are:

- platforms/astbmc: Check for SBE validation step

  On some POWER8 astbmc systems an update to the SBE requires pausing at
  runtime to ensure integrity of the SBE. If this is required the BMC will
  set a chassis boot option IPMI flag using the OEM parameter 0x62. If
  Skiboot sees this flag is set it waits until the SBE update is complete
  and the flag is cleared.
  Unfortunately the mystery operation that validates the SBE also leaves
  it in a bad state and unable to be used for timer operations. To
  workaround this the flag is checked as soon as possible (ie. when IPMI
  and the console are set up), and once complete the system is rebooted.

- ipmi: ensure forward progress on ipmi_queue_msg_sync()

  BT responses are handled using a timer doing the polling. To hope to
  get an answer to an IPMI synchronous message, the timer needs to run.

  We can't just check all timers though as there may be a timer that
  wants a lock that's held by a code path calling ipmi_queue_msg_sync(),
  and if we did enforce that as a requirement, it's a pretty subtle
  API that is asking to be broken.

  So, if we just run a poll function to crank anything that the IPMI
  backend needs, then we should be fine.

  This issue shows up very quickly under QEMU when loading the first
  flash resource with the IPMI HIOMAP backend.

- pci/iov: Remove skiboot VF tracking

  This feature was added a few years ago in response to a request to make
  the MaxPayloadSize (MPS) field of a Virtual Function match the MPS of the
  Physical Function that hosts it.

  The SR-IOV specification states the the MPS field of the VF is "ResvP".
  This indicates the VF will use whatever MPS is configured on the PF and
  that the field should be treated as a reserved field in the config space
  of the VF. In other words, a SR-IOV spec compliant VF should always return
  zero in the MPS field.  Adding hacks in OPAL to make it non-zero is...
  misguided at best.

  Additionally, there is a bug in the way pci_device structures are handled
  by VFs that results in a crash on fast-reboot that occurs if VFs are
  enabled and then disabled prior to rebooting. This patch fixes the bug by
  removing the code entirely. This patch has no impact on SR-IOV support on
  the host operating system.


text:
package LWP::Protocol::xmpp;

use vars qw(@ISA);
require LWP::Protocol;
@ISA = qw(LWP::Protocol);

use strict;
use Net::XMPP;

require HTTP::Request;
require HTTP::Response;
require HTTP::Status;
require HTTP::Date;

sub request
{
    my($self, $request, $proxy, $arg, $size) = @_;
  	my $proto = "xmpp";

    $size = 4096 unless defined $size and $size > 0;

    # check proxy
    if (defined $proxy)
    {
      	return new HTTP::Response &HTTP::Status::RC_BAD_REQUEST,
				  "You can not proxy through $proto";
    }

    # check method
    my $method = $request->method;
    unless ($method eq 'GET' || $method eq 'HEAD') {
	return new HTTP::Response &HTTP::Status::RC_BAD_REQUEST,
				  'Library does not allow method ' .
				  "$method for '$proto:' URLs";
    }

    # check url
    my $url = $request->url;
    my $scheme = $url->scheme;
    if ($scheme ne $proto ) {
	  return new HTTP::Response &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
      ref($self) . "::request called for '$scheme'";
    }

    # URL OK, look at file
	  my $rc =  check_xmpp(split(':',$url->authority ));
    # test file exists and is readable
    if ($rc != 0 ) {
	    return new HTTP::Response &HTTP::Status::RC_NOT_FOUND, "Failed xmpp check";
    }
    # XXX should check Accept headers?
    # Ok, should be an OK response by now...
    my $response = new HTTP::Response &HTTP::Status::RC_OK;
    if ($method ne "HEAD") {
    	$response =  $self->collect_once($arg, $response, '');
    }
    return $response;
}

# check_xmpp($server, $port)
# returns 0 for success, 1 else
sub check_xmpp
{
  my ($server, $d_port) = @_;

  my $Connection = new Net::XMPP::Client();
  my $status = $Connection->Connect(hostname=>$server,
                                    port=>$d_port,
                                    timeout=>5);
  if (!(defined($status)))
  {
    return 1;
  }
  return 0;
}

1;


text:
class AddInvitationOnlyToJobs < ActiveRecord::Migration
  def change
    add_column :jobs, :invitation_only, :boolean
  end
end


text:
@class View1Controller, View2Controller;

@interface TabBarController : UITabBarController {
    View1Controller *viewController;
    View2Controller *viewController2;
}

@end