text:
package io.pcp.parfait.cxf;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import io.pcp.parfait.timing.EventTimer;
import io.pcp.parfait.timing.Timeable;

@Path("/restdemo/")
@Produces("text/plain")
public class RestDemo implements Timeable {
	@GET
    @Path("/sayhello/")
    public String sayHello() {
        return "Hi there!";
    }

	@GET
    @Path("/snooze/")
    public String sleepyTime() throws InterruptedException {
        Thread.sleep(2000);
        return "ZZZZZ";
    }

	@Override
	public void setEventTimer(EventTimer timer) {
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BatchGbViewer.Models
{
   public class ExamQuestion
   {
      public int SettingID { get; set; }
      public string QuestionID { get; set; }
   }
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

var toPropertyKey = require('to-property-key-x');
var toObject = require('to-object-x');
var propIsEnumerable = Object.prototype.propertyIsEnumerable;

/**
 * This method returns a Boolean indicating whether the specified property is
 * enumerable. Does not attempt to fix bugs in IE<9 or old Opera, otherwise it
 * does ES6ify the method.
 *
 * @param {!Object} object - The object on which to test the property.
 * @param {string|Symbol} property - The name of the property to test.
 * @throws {TypeError} If target is null or undefined.
 * @returns {boolean} A Boolean indicating whether the specified property is
 *  enumerable.
 * @example
 * var propertyIsEnumerable = require('property-is-enumerable-x');
 *
 * var o = {};
 * var a = [];
 * o.prop = 'is enumerable';
 * a[0] = 'is enumerable';
 *
 * propertyIsEnumerable(o, 'prop'); // true
 * propertyIsEnumerable(a, 0); // true
 */
module.exports = function propertyIsEnumerable(object, property) {
  return propIsEnumerable.call(toObject(object), toPropertyKey(property));
};


text:
package divconq.work;

import java.util.concurrent.locks.StampedLock;

import divconq.hub.Hub;
import divconq.lang.op.OperationContext;
import divconq.log.Logger;

public class Worker implements Runnable {
	protected Thread thread = null;
	protected boolean stopping = false;
	protected int slot = 0;

	protected TaskRun run = null;			// we are busy when not null
	protected int taskThrottle = -1;
	protected boolean resumeTask = false;
	protected StampedLock lock = new StampedLock();

	public void start(int slot) {
		this.slot = slot;
		this.thread = new Thread(this, "WorkPool_" + this.slot);
		this.thread.setDaemon(true);

		// TODO consider this option
		//this.thread.setUncaughtExceptionHandler(eh);

		this.thread.start();
	}

	// if tr is the current running task then allow it to resume without going all the way to the back of the line
	// note that if we get here then we are the task (only the task is allowed to resume itself) so no need to
	// lock the member variables
	//
	// return false if we cannot resume
	public boolean resume(TaskRun tr) {
		long stamp = this.lock.readLock();

		try {
			if ((this.run != tr) || (this.taskThrottle == 0))
				return false;

			long wstamp = this.lock.tryConvertToWriteLock(stamp);

			if (wstamp == 0L) {
				this.lock.unlockRead(stamp);
				wstamp = this.lock.writeLock();
			}

			stamp = wstamp;

			// check again for good measure, in case we didn't get write convert
			if ((this.run != tr) || (this.taskThrottle == 0))
				return false;

			this.resumeTask = true;
			return true;
		}
		finally {
			this.lock.unlock(stamp);
		}
	}

	@Override
	public void run() {
		OperationContext.useHubContext();

		Logger.trace("Work pool thread started: " + this.slot);

		Hub.instance.getWorkPool().incThreadsCreated();

		while (!this.stopping) {
			try {
				Logger.trace("Work pool thread taking: " + this.slot);

				TaskRun r = Hub.instance.getWorkPool().take();

				r.touch();		// make sure the task does not timeout immediately (especially when debugging)

				int tthrottle = r.getTask().getThrottle();		// always run at least once even if we get 0

				long wstamp = this.lock.writeLock();

				try {
					this.run = r;
					this.taskThrottle = tthrottle;
					this.resumeTask = false;		// run once
				}
				finally {
					this.lock.unlock(wstamp);
				}

				// it is important to record the slot, if we do not then during resume
				// we may find an older worker still pointing to this run and think it can resume us
				r.slot = this.slot;

				// taskThrottle == -1 means unlimited local resumes
				// taskThrottle == 0 or 1 means don't allow local resumes
				// taskThrottle > 1 means allow N - 1 number of resumes before putting back into the work pool

				while (!this.stopping) {
					long stamp1 = this.lock.writeLock();

					try {
						// -1 has special meaning, do not go under 0
						if (this.taskThrottle > 0)
							this.taskThrottle--;

						this.resumeTask = false;
					}
					finally {
						this.lock.unlock(stamp1);
					}

					//Logger.trace("Work pool thread running: " + this.slot);

					r.run();

					OperationContext.useHubContext();

					long stamp2 = this.lock.readLock();

					try {
						// if we have no more resumes then break
						boolean needbreak = (Thread.currentThread().isInterrupted() || (this.taskThrottle == 0) || !this.resumeTask);

						if (needbreak) {
							long wstamp2 = this.lock.tryConvertToWriteLock(stamp2);

							if (wstamp2 == 0L) {
								this.lock.unlockRead(stamp2);
								wstamp2 = this.lock.writeLock();
							}

							stamp2 = wstamp2;

							needbreak = (Thread.currentThread().isInterrupted() || (this.taskThrottle == 0) || !this.resumeTask);

							if (needbreak) {
								this.taskThrottle = 0;
								this.resumeTask = false;
								this.run = null;

								break;
							}
						}
					}
					finally {
						this.lock.unlock(stamp2);
					}
				}
			}
			catch (InterruptedException x) {
				break;
			}
			catch (Exception x) {
				Logger.warn("Work pool caught error: " + x);
			}
			catch (ThreadDeath x) {
				Logger.warn("Work pool thread died: " + x);
				throw x;
			}

			long wstamp = this.lock.writeLock();

			try {
				this.taskThrottle = 0;
				this.resumeTask = false;
				this.run = null;
			}
			finally {
				this.lock.unlock(wstamp);
			}
		}

		// for interrupted flow
		this.run = null;

		Logger.trace("Work pool thread stopped: " + this.slot);
	}

	protected void dumpDebug() {
		try {
			Logger.warn("     Thread Id: " + this.thread.getId());
			Logger.warn("   Thread Name: " + this.thread.getName());
			Logger.warn("  Thread State: " + this.thread.getState());
			Logger.warn("  Thread Stack:");

			StackTraceElement[] stack = this.thread.getStackTrace();

			for (StackTraceElement e : stack)
				Logger.warn("              - " + e.toString());
		}
		catch (Exception x) {
		}
	}

	public void checkIfHung() {
		Thread th = this.thread;

		// if not alive then toss this worker out
		// replace/remove my thread
		if ((th == null) || !th.isAlive())
			Hub.instance.getWorkPool().initSlot(this.slot);

		TaskRun tr = this.run;

		if ((tr != null) && (tr.isHung())) {
			Logger.warn("Work pool thread hung: " + this.slot);

			// TODO remove
			System.out.println("Overdue: " + tr.isOverdue());
			System.out.println("Overdue Time: " + tr.getTask().getDeadlineMS());
			System.out.println("Inactive: " + tr.isInactive());
			System.out.println("Inactive Time: " + tr.getTask().getTimeoutMS());

			tr.kill();

			this.dumpDebug();

			Hub.instance.getWorkPool().incThreadsHung();
			this.stop();
		}
	}

	public void stop() {
		this.stopping = true;

		Thread th = this.thread;

		if ((th == null) || !th.isAlive())
			return;

		try {
			th.interrupt();
		}
		catch (Exception x) {
		}

		// replace/remove my thread
		Hub.instance.getWorkPool().initSlot(this.slot);
	}

	//
	public void stopNice() {
		this.stopping = true;

		Thread th = this.thread;

		if ((th == null) || !th.isAlive())
			return;

		// only stop if not busy, if run is null then no work is being done
		if (this.run != null)
			return;

		try {
			th.interrupt();
		}
		catch (Exception x) {
		}

		// replace/remove my thread
		Hub.instance.getWorkPool().initSlot(this.slot);
	}
}


text:
=head1 NAME

tkkit - Single-file dynamic library bundle for Tcl/Tk functionality

=head1 DESCRIPTION

I<tkkit> is a single-file dynamic library that bundles Tcl, Tk and several
related extensions together for use by the I<Tcl> module.

I<Tk> is a toolkit for creating applications with graphical interfaces on
Windows, Mac OS X and X11.  The Tk toolkit is native to the I<Tcl>
programming language, but its ease of use and cross-platform availability
has made it the GUI toolkit of choice for many other dynamic languages.

I<Tcl::Tk> and I<Tkx> are Perl modules that makes the Tk toolkit available
to Perl programs.  By loading one of these modules, Perl programs can
create windows and fill them with text, images, buttons and other controls
that make up the user interface of the application.  See the
I<Tkx::Tutorial> docs for an example.

=head2 Packages

I<tkkit> includes the following packages from the ActiveTcl
L<http://docs.activestate.com/activetcl/8.5/at.pkg_index.html>
distribution:

=over

=item Tcl 8.5 (core)

L<http://docs.activestate.com/activetcl/8.5/tcl/tcl_contents.htm>

=item Tk 8.5 (core)

L<http://docs.activestate.com/activetcl/8.5/tcl/tk_contents.htm>

=item TclX 8.4 (eXtended command set for Tcl)

L<http://docs.activestate.com/activetcl/8.5/tclx/TclX.n.html>

=item vfs 1.4 (script level virtual file system access)

L<http://docs.activestate.com/activetcl/8.5/tclvfs/toc.html>

=item bwidget 1.9 (extra megawidgets)

L<http://docs.activestate.com/activetcl/8.5/bwidget/contents.html>

=item Tktable 2.10 (2D table widget)

L<http://docs.activestate.com/activetcl/8.5/tktable/tkTable.html>

=item treectrl 2.3 (multi-column hierarchical tree/list widget)

L<http://docs.activestate.com/activetcl/8.5/tktreectrl/toc.html>

=item img::jpeg (JPEG image format)

L<http://docs.activestate.com/activetcl/8.5/img/doc/img-jpeg.html>

=item img::png (PNG image format)

L<http://docs.activestate.com/activetcl/8.5/img/doc/img-png.html>

=item img::ico (ICO image format)

L<http://docs.activestate.com/activetcl/8.5/img/doc/img-ico.html>

=item img::xpm (XPM image format)

L<http://docs.activestate.com/activetcl/8.5/img/doc/img-xpm.html>

=item ico 1.0 (Windows ICO manipulation)

L<http://docs.activestate.com/activetcl/8.5/tklib/ico/ico.html>

=item ctext (enhanced text widget)

L<http://docs.activestate.com/activetcl/8.5/tklib/ctext/ctext.html>

=item tooltip 1.4 (balloon help)

L<http://docs.activestate.com/activetcl/8.5/tklib/tooltip/tooltip.html>

=item widget 3.1 (megawidgets)

L<http://docs.activestate.com/activetcl/8.5/tklib/widget/widget.html>

=item comm 4.6 (remote interpreter communication)

L<http://docs.activestate.com/activetcl/8.5/tcllib/comm/comm.html>

=item snit 2.3 (object-oriented framework)

L<http://docs.activestate.com/activetcl/8.5/tcllib/snit/snit.html>

=back

=head1 LICENSE

This library is a component of ActivePerl and is covered under the same
terms as ActivePerl.

Copyright 2007-2011 ActiveState.  All rights reserved.

=head1 SEE ALSO

L<Tkx>
L<Tcl>


text:
<<<<<<< HEAD
# App Template

An empty CakePHP project for use with composer

## Installation

	composer -sdev create-project friendsofcake/app-template ProjectName

This will create a new project, with dependencies, based on this repository. Be sure to point
the webserver at the `app/webroot` folder (a [production install][1]), ensure that [url rewriting][2]
is configured correctly.

## Non-default Configuration

By default, the following has been enabled:

- Composer Autoloading
- Setting Timezone to UTC

You may change either of these at your leisure.

## Note about dependencies

FriendsOfCake encourages the use of composer and it's best not to mix composer with git submodules for
dependency management. If you need to use submodules you might notice `/vendor` and `/Plugin` folders are
ignored by git. Composer creates those directories when installing vendors and plugins.

There a few ways to solve this:
- edit the `.gitignore` file
- use the `-f` param with `git add Plugin/SomePlugin -f`
- use `app/Plugin` and `app/Vendor` for your submodules.

 [1]: http://book.cakephp.org/2.0/en/installation.html#production
 [2]: http://book.cakephp.org/2.0/en/installation/url-rewriting.html
=======
tasks
=====
>>>>>>> a92d6c7b9f92e25b9076571db3a055db7c14541b


text:
HTTP Client Benchmarks
======================

To start the server::

    $ go run server.go

And in a second shell, you'll need to have ``urllib3`` and ``requests``
installed in whichever ``python`` is there, if you're in a virtualenv, it'll
inherit use that Python::

    $ ./run.sh


text:
""" base on http://www.ibm.com/developerworks/cn/opensource/os-cn-pythonwith/index.html
contextlib:closing demo
"""
class closing(object):
    def __init__(self, thing):
        self.thing = thing

    def __enter__(self):
        return self.thing

    def __exit__(self, *exc_info):
        self.thing.close()

class ClosingDemo(object):
    """ class supporting closing
    Question: NO contextlib neither contextmanager? """
    def __init__(self):
        self.acquire()

    def acquire(self):
        print('Acquire resources.')

    def free(self):
        print('Clean up any resources acquired.')

    def close(self):
        self.free()

if __name__ == '__main__':
    with closing(ClosingDemo()):
        print('Using resources')


text: This is the repository for Allison's professional site, located here: <http://allisoncraigdds.com>


text:
from horse import build_app

application = build_app(name=__name__, debug=True).web_app

if __name__ == "__main__":
    application.run()


text:
NSString * const RDServiceClientErrorDescriptionUserAuthenticationRequired = @"you must authenticate";

#pragma mark -
#pragma mark Domains

NSString * const RDServiceClientErrorDomain = @"RDServiceClientErrorDomain";


text:
import * as echarts from 'echarts/lib/echarts';
import glmatrix from 'claygl/src/dep/glmatrix';
var vec3 = glmatrix.vec3;
var isDimensionStacked = echarts.helper.dataStack.isDimensionStacked;

function ifCrossZero(extent) {
    var min = extent[0];
    var max = extent[1];
    return !((min > 0 && max > 0) || (min < 0 && max < 0));
};

function cartesian3DLayout(seriesModel, coordSys) {

    var data = seriesModel.getData();
    // var barOnPlane = seriesModel.get('onGridPlane');

    var barSize = seriesModel.get('barSize');
    if (barSize == null) {
        var size = coordSys.size;
        var barWidth;
        var barDepth;
        var xAxis = coordSys.getAxis('x');
        var yAxis = coordSys.getAxis('y');

        if (xAxis.type === 'category') {
            barWidth = xAxis.getBandWidth() * 0.7;
        }
        else {
            // PENDING
            barWidth = Math.round(size[0] / Math.sqrt(data.count())) * 0.6;
        }
        if (yAxis.type === 'category') {
            barDepth = yAxis.getBandWidth() * 0.7;
        }
        else {
            barDepth = Math.round(size[1] / Math.sqrt(data.count())) * 0.6;
        }
        barSize = [barWidth, barDepth];
    }
    else if (!echarts.util.isArray(barSize)) {
        barSize = [barSize, barSize];
    }

    var zAxisExtent = coordSys.getAxis('z').scale.getExtent();
    var ifZAxisCrossZero = ifCrossZero(zAxisExtent);

    var dims = ['x', 'y', 'z'].map(function (coordDimName) {
        return seriesModel.coordDimToDataDim(coordDimName)[0];
    });

    var isStacked = isDimensionStacked(data, dims[2]);
    var valueDim = isStacked
        ? data.getCalculationInfo('stackResultDimension')
        : dims[2];

    data.each(dims, function (x, y, z, idx) {
        // TODO zAxis is inversed
        // TODO On different plane.
        var stackedValue = data.get(valueDim, idx);

        var baseValue = isStacked ? (stackedValue - z)
            : (ifZAxisCrossZero ? 0 : zAxisExtent[0]);

        var start = coordSys.dataToPoint([x, y, baseValue]);
        var end = coordSys.dataToPoint([x, y, stackedValue]);
        var height = vec3.dist(start, end);
        // PENDING When zAxis is not cross zero.
        var dir = [0, end[1] < start[1] ? -1 : 1, 0];
        if (Math.abs(height) === 0) {
            // TODO
            height = 0.1;
        }
        var size = [barSize[0], height, barSize[1]];
        data.setItemLayout(idx, [start, dir, size]);
    });

    data.setLayout('orient', [1, 0, 0]);
}

export default cartesian3DLayout;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. bot. Surv. India 30(1-4): 35 (1990)

#### Original name
Blyttiomyces lenis S.N. Dasgupta & R. John

### Remarks
null


text:
@class A0ProgressButton, A0UserProfile, A0DatabaseLoginCredentialValidator, A0Token, A0CredentialFieldView, A0AuthParameters,A0Connection;

@interface A0DatabaseLoginViewController : UIViewController<A0AuthenticationUIComponent>

@property (weak, nonatomic) IBOutlet A0CredentialFieldView *userField;

@property (copy, nonatomic) A0AuthParameters *parameters;
@property (strong, nonatomic) A0Connection *defaultConnection;
@property (assign, nonatomic) BOOL showSignUp;
@property (assign, nonatomic) BOOL showResetPassword;
@property (copy, nonatomic) NSString *defaultUsername;

@property (copy, nonatomic) void(^onLoginBlock)(A0UserProfile *profile, A0Token *token);
@property (copy, nonatomic) void(^onShowEnterpriseLogin)(A0Connection *connection, NSString *email);

@property (strong, nonatomic) A0DatabaseLoginCredentialValidator *validator;
@property (strong, nonatomic) id<A0ConnectionDomainMatcher> domainMatcher;

@end


text:
cask "keepassx" do
  version "2.0.3"
  sha256 "44271fef18fd07a29241e5324be407fa8edce77fb0b55c5646cd238092cdf823"

  url "https://www.keepassx.org/releases/#{version}/KeePassX-#{version}.dmg"
  name "KeePassX"
  desc "Personal data manager focusing on security"
  homepage "https://www.keepassx.org/"

  livecheck do
    url "https://github.com/keepassx/keepassx"
    strategy :git
  end

  app "KeePassX.app"

  uninstall_preflight do
    set_ownership "#{appdir}/KeePassX.app"
  end

  zap trash: "~/.keepassx"
end


text:
package org.olat.instantMessaging.rosterandchat;

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

import org.jivesoftware.smack.packet.Message;
import org.olat.core.gui.components.link.Link;

/**
 * Description:

 * holds all information regarding a new message in one place
 *

 * Initial Date: 23.11.2009

 *
 * @author guido
 */
public class NewMessageIconInfo {

	private final String jabberId;
	private final List<Message> initialMessages = new ArrayList<Message>(2);
	private Link newMessageLink;

	/**
	 * @param jabberId
	 */
	protected NewMessageIconInfo(final String jabberId, final Message initialMessage) {
		this.jabberId = extractJid(jabberId);
		initialMessages.add(initialMessage);
	}

	/**
	 * [used in velocity!]
	 *
	 * @return
	 */
	public String getJabberId() {
		return jabberId;
	}

	protected List<Message> getInitialMessages() {
		return initialMessages;
	}

	protected void addInitialMessage(final Message m) {
		initialMessages.add(m);
	}

	protected Link getNewMessageLink() {
		return newMessageLink;
	}

	protected void setNewMessageLink(final Link newMessageLink) {
		this.newMessageLink = newMessageLink;
	}

	/**
	 * extract the jabber id without the resource appendix
	 *
	 * @param jabberId
	 * @return
	 */
	private String extractJid(final String id) {
		final int pos = id.lastIndexOf("/");
		if (pos > 0) { return id.substring(0, id.lastIndexOf("/")); }
		return id;
	}

}


text:
//NOT TESTED!!!
public class GroveEHRSample {

	static {
		try {
			System.loadLibrary("javaupm_groveehr");
		} catch (UnsatisfiedLinkError e) {
			System.err.println("error in loading native library");
			System.exit(-1);
		}
	}

	public static void main(String[] args) throws InterruptedException {
		// ! [Interesting]
		// Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
		upm_groveehr.GroveEHR heart = new upm_groveehr.GroveEHR(2);

		// set the beat counter to 0, init the clock and start counting beats
		heart.clearBeatCounter();
		heart.initClock();
		heart.startBeatCounter();

		while (true) {
			long millis = heart.getMillis();
			long beats = heart.beatCounter();

			// heartRate() requires that at least 5 seconds pass before
			// returning anything other than 0
			int hr = heart.heartRate();

			// output milliseconds passed, beat count, and computed heart rate
			System.out.println("Millis: " + millis + ", Beats: " + beats + ", Heart rate: " + hr);

			Thread.sleep(1000);
		}
		// ! [Interesting]
	}
}


text:
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// identity function for calling harmony imports with the correct context
/******/ 	__webpack_require__.i = function(value) { return value; };
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 84);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = jQuery;

/***/ }),

/***/ 1:
/***/ (function(module, exports) {

module.exports = {Foundation: window.Foundation};

/***/ }),

/***/ 18:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__foundation_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_dropdownMenu__ = __webpack_require__(48);

__WEBPACK_IMPORTED_MODULE_0__foundation_core__["Foundation"].plugin(__WEBPACK_IMPORTED_MODULE_1__foundation_dropdownMenu__["a" /* DropdownMenu */], 'DropdownMenu');

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

module.exports = {Plugin: window.Foundation.Plugin};

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = {rtl: window.Foundation.rtl, GetYoDigits: window.Foundation.GetYoDigits, transitionend: window.Foundation.transitionend};

/***/ }),

/***/ 48:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DropdownMenu; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_box___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__foundation_util_box__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_core__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__foundation_util_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_plugin__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_plugin___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__foundation_plugin__);

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * DropdownMenu module.
 * @module foundation.dropdown-menu
 * @requires foundation.util.keyboard
 * @requires foundation.util.box
 * @requires foundation.util.nest
 */

var DropdownMenu = function (_Plugin) {
  _inherits(DropdownMenu, _Plugin);

  function DropdownMenu() {
    _classCallCheck(this, DropdownMenu);

    return _possibleConstructorReturn(this, (DropdownMenu.__proto__ || Object.getPrototypeOf(DropdownMenu)).apply(this, arguments));
  }

  _createClass(DropdownMenu, [{
    key: '_setup',

    /**
     * Creates a new instance of DropdownMenu.
     * @class
     * @name DropdownMenu
     * @fires DropdownMenu#init
     * @param {jQuery} element - jQuery object to make into a dropdown menu.
     * @param {Object} options - Overrides to the default plugin settings.
     */
    value: function _setup(element, options) {
      this.$element = element;
      this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, DropdownMenu.defaults, this.$element.data(), options);
      this.className = 'DropdownMenu'; // ie9 back compat

      this._init();

      __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].register('DropdownMenu', {
        'ENTER': 'open',
        'SPACE': 'open',
        'ARROW_RIGHT': 'next',
        'ARROW_UP': 'up',
        'ARROW_DOWN': 'down',
        'ARROW_LEFT': 'previous',
        'ESCAPE': 'close'
      });
    }

    /**
     * Initializes the plugin, and calls _prepareMenu
     * @private
     * @function
     */

  }, {
    key: '_init',
    value: function _init() {
      __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["Nest"].Feather(this.$element, 'dropdown');

      var subs = this.$element.find('li.is-dropdown-submenu-parent');
      this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');

      this.$menuItems = this.$element.find('[role="menuitem"]');
      this.$tabs = this.$element.children('[role="menuitem"]');
      this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);

      if (this.options.alignment === 'auto') {
        if (this.$element.hasClass(this.options.rightClass) || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__foundation_util_core__["rtl"])() || this.$element.parents('.top-bar-right').is('*')) {
          this.options.alignment = 'right';
          subs.addClass('opens-left');
        } else {
          this.options.alignment = 'left';
          subs.addClass('opens-right');
        }
      } else {
        if (this.options.alignment === 'right') {
          subs.addClass('opens-left');
        } else {
          subs.addClass('opens-right');
        }
      }
      this.changed = false;
      this._events();
    }
  }, {
    key: '_isVertical',
    value: function _isVertical() {
      return this.$tabs.css('display') === 'block' || this.$element.css('flex-direction') === 'column';
    }
  }, {
    key: '_isRtl',
    value: function _isRtl() {
      return this.$element.hasClass('align-right') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__foundation_util_core__["rtl"])() && !this.$element.hasClass('align-left');
    }

    /**
     * Adds event listeners to elements within the menu
     * @private
     * @function
     */

  }, {
    key: '_events',
    value: function _events() {
      var _this = this,
          hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined',
          parClass = 'is-dropdown-submenu-parent';

      // used for onClick and in the keyboard handlers
      var handleClickFn = function (e) {
        var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).parentsUntil('ul', '.' + parClass),
            hasSub = $elem.hasClass(parClass),
            hasClicked = $elem.attr('data-is-click') === 'true',
            $sub = $elem.children('.is-dropdown-submenu');

        if (hasSub) {
          if (hasClicked) {
            if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) {
              return;
            } else {
              e.stopImmediatePropagation();
              e.preventDefault();
              _this._hide($elem);
            }
          } else {
            e.preventDefault();
            e.stopImmediatePropagation();
            _this._show($sub);
            $elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true);
          }
        }
      };

      if (this.options.clickOpen || hasTouch) {
        this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClickFn);
      }

      // Handle Leaf element Clicks
      if (_this.options.closeOnClickInside) {
        this.$menuItems.on('click.zf.dropdownmenu', function (e) {
          var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this),
              hasSub = $elem.hasClass(parClass);
          if (!hasSub) {
            _this._hide();
          }
        });
      }

      if (!this.options.disableHover) {
        this.$menuItems.on('mouseenter.zf.dropdownmenu', function (e) {
          var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this),
              hasSub = $elem.hasClass(parClass);

          if (hasSub) {
            clearTimeout($elem.data('_delay'));
            $elem.data('_delay', setTimeout(function () {
              _this._show($elem.children('.is-dropdown-submenu'));
            }, _this.options.hoverDelay));
          }
        }).on('mouseleave.zf.dropdownmenu', function (e) {
          var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this),
              hasSub = $elem.hasClass(parClass);
          if (hasSub && _this.options.autoclose) {
            if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) {
              return false;
            }

            clearTimeout($elem.data('_delay'));
            $elem.data('_delay', setTimeout(function () {
              _this._hide($elem);
            }, _this.options.closingTime));
          }
        });
      }
      this.$menuItems.on('keydown.zf.dropdownmenu', function (e) {
        var $element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).parentsUntil('ul', '[role="menuitem"]'),
            isTab = _this.$tabs.index($element) > -1,
            $elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
            $prevElement,
            $nextElement;

        $elements.each(function (i) {
          if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is($element)) {
            $prevElement = $elements.eq(i - 1);
            $nextElement = $elements.eq(i + 1);
            return;
          }
        });

        var nextSibling = function () {
          $nextElement.children('a:first').focus();
          e.preventDefault();
        },
            prevSibling = function () {
          $prevElement.children('a:first').focus();
          e.preventDefault();
        },
            openSub = function () {
          var $sub = $element.children('ul.is-dropdown-submenu');
          if ($sub.length) {
            _this._show($sub);
            $element.find('li > a:first').focus();
            e.preventDefault();
          } else {
            return;
          }
        },
            closeSub = function () {
          //if ($element.is(':first-child')) {
          var close = $element.parent('ul').parent('li');
          close.children('a:first').focus();
          _this._hide(close);
          e.preventDefault();
          //}
        };
        var functions = {
          open: openSub,
          close: function () {
            _this._hide(_this.$element);
            _this.$menuItems.eq(0).children('a').focus(); // focus to first element
            e.preventDefault();
          },
          handled: function () {
            e.stopImmediatePropagation();
          }
        };

        if (isTab) {
          if (_this._isVertical()) {
            // vertical menu
            if (_this._isRtl()) {
              // right aligned
              __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
                down: nextSibling,
                up: prevSibling,
                next: closeSub,
                previous: openSub
              });
            } else {
              // left aligned
              __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
                down: nextSibling,
                up: prevSibling,
                next: openSub,
                previous: closeSub
              });
            }
          } else {
            // horizontal menu
            if (_this._isRtl()) {
              // right aligned
              __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
                next: prevSibling,
                previous: nextSibling,
                down: openSub,
                up: closeSub
              });
            } else {
              // left aligned
              __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
                next: nextSibling,
                previous: prevSibling,
                down: openSub,
                up: closeSub
              });
            }
          }
        } else {
          // not tabs -> one sub
          if (_this._isRtl()) {
            // right aligned
            __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
              next: closeSub,
              previous: openSub,
              down: nextSibling,
              up: prevSibling
            });
          } else {
            // left aligned
            __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, {
              next: openSub,
              previous: closeSub,
              down: nextSibling,
              up: prevSibling
            });
          }
        }
        __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].handleKey(e, 'DropdownMenu', functions);
      });
    }

    /**
     * Adds an event handler to the body to close any dropdowns on a click.
     * @function
     * @private
     */

  }, {
    key: '_addBodyHandler',
    value: function _addBodyHandler() {
      var $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body),
          _this = this;
      $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu').on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function (e) {
        var $link = _this.$element.find(e.target);
        if ($link.length) {
          return;
        }

        _this._hide();
        $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu');
      });
    }

    /**
     * Opens a dropdown pane, and checks for collisions first.
     * @param {jQuery} $sub - ul element that is a submenu to show
     * @function
     * @private
     * @fires DropdownMenu#show
     */

  }, {
    key: '_show',
    value: function _show($sub) {
      var idx = this.$tabs.index(this.$tabs.filter(function (i, el) {
        return __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el).find($sub).length > 0;
      }));
      var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent');
      this._hide($sibs, idx);
      $sub.css('visibility', 'hidden').addClass('js-dropdown-active').parent('li.is-dropdown-submenu-parent').addClass('is-active');
      var clear = __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__["Box"].ImNotTouchingYou($sub, null, true);
      if (!clear) {
        var oldClass = this.options.alignment === 'left' ? '-right' : '-left',
            $parentLi = $sub.parent('.is-dropdown-submenu-parent');
        $parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment);
        clear = __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__["Box"].ImNotTouchingYou($sub, null, true);
        if (!clear) {
          $parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner');
        }
        this.changed = true;
      }
      $sub.css('visibility', '');
      if (this.options.closeOnClick) {
        this._addBodyHandler();
      }
      /**
       * Fires when the new dropdown pane is visible.
       * @event DropdownMenu#show
       */
      this.$element.trigger('show.zf.dropdownmenu', [$sub]);
    }

    /**
     * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything.
     * @function
     * @param {jQuery} $elem - element with a submenu to hide
     * @param {Number} idx - index of the $tabs collection to hide
     * @private
     */

  }, {
    key: '_hide',
    value: function _hide($elem, idx) {
      var $toClose;
      if ($elem && $elem.length) {
        $toClose = $elem;
      } else if (idx !== undefined) {
        $toClose = this.$tabs.not(function (i, el) {
          return i === idx;
        });
      } else {
        $toClose = this.$element;
      }
      var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0;

      if (somethingToClose) {
        $toClose.find('li.is-active').add($toClose).attr({
          'data-is-click': false
        }).removeClass('is-active');

        $toClose.find('ul.js-dropdown-active').removeClass('js-dropdown-active');

        if (this.changed || $toClose.find('opens-inner').length) {
          var oldClass = this.options.alignment === 'left' ? 'right' : 'left';
          $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass('opens-inner opens-' + this.options.alignment).addClass('opens-' + oldClass);
          this.changed = false;
        }
        /**
         * Fires when the open menus are closed.
         * @event DropdownMenu#hide
         */
        this.$element.trigger('hide.zf.dropdownmenu', [$toClose]);
      }
    }

    /**
     * Destroys the plugin.
     * @function
     */

  }, {
    key: '_destroy',
    value: function _destroy() {
      this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click').removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner');
      __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body).off('.zf.dropdownmenu');
      __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["Nest"].Burn(this.$element, 'dropdown');
    }
  }]);

  return DropdownMenu;
}(__WEBPACK_IMPORTED_MODULE_5__foundation_plugin__["Plugin"]);

/**
 * Default settings for plugin
 */

DropdownMenu.defaults = {
  /**
   * Disallows hover events from opening submenus
   * @option
   * @type {boolean}
   * @default false
   */
  disableHover: false,
  /**
   * Allow a submenu to automatically close on a mouseleave event, if not clicked open.
   * @option
   * @type {boolean}
   * @default true
   */
  autoclose: true,
  /**
   * Amount of time to delay opening a submenu on hover event.
   * @option
   * @type {number}
   * @default 50
   */
  hoverDelay: 50,
  /**
   * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
   * @option
   * @type {boolean}
   * @default false
   */
  clickOpen: false,
  /**
   * Amount of time to delay closing a submenu on a mouseleave event.
   * @option
   * @type {number}
   * @default 500
   */

  closingTime: 500,
  /**
   * Position of the menu relative to what direction the submenus should open. Handled by JS. Can be `'auto'`, `'left'` or `'right'`.
   * @option
   * @type {string}
   * @default 'auto'
   */
  alignment: 'auto',
  /**
   * Allow clicks on the body to close any open submenus.
   * @option
   * @type {boolean}
   * @default true
   */
  closeOnClick: true,
  /**
   * Allow clicks on leaf anchor links to close any open submenus.
   * @option
   * @type {boolean}
   * @default true
   */
  closeOnClickInside: true,
  /**
   * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
   * @option
   * @type {string}
   * @default 'vertical'
   */
  verticalClass: 'vertical',
  /**
   * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
   * @option
   * @type {string}
   * @default 'align-right'
   */
  rightClass: 'align-right',
  /**
   * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
   * @option
   * @type {boolean}
   * @default true
   */
  forceFollow: true
};

/***/ }),

/***/ 5:
/***/ (function(module, exports) {

module.exports = {Keyboard: window.Foundation.Keyboard};

/***/ }),

/***/ 8:
/***/ (function(module, exports) {

module.exports = {Box: window.Foundation.Box};

/***/ }),

/***/ 84:
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(18);

/***/ }),

/***/ 9:
/***/ (function(module, exports) {

module.exports = {Nest: window.Foundation.Nest};

/***/ })

/******/ });


text:
                    {{ menu.title() | translate }}

                    {{ menu.title() | translate }}

                            {{ menu.title() | translate }}


text:
/**************************************************************************//**
 * @file     opa.h
 * @version  V1.00
 * @brief    M251 series OPA driver header file
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * Copyright (c) 2019 Nuvoton Technology Corp. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright notice,
 *      this list of conditions and the following disclaimer in the documentation
 *      and/or other materials provided with the distribution.
 *   3. Neither the name of Nuvoton Technology Corp. nor the names of its contributors
 *      may be used to endorse or promote products derived from this software
 *      without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *****************************************************************************/
#ifndef __OPA_H__
#define __OPA_H__

#ifdef __cplusplus
extern "C"
{
#endif

/** @addtogroup Standard_Driver Standard Driver
  @{
*/

/** @addtogroup OPA_Driver OPA Driver
  @{
*/

/** @addtogroup OPA_EXPORTED_CONSTANTS OPA Exported Constants
  @{
*/
#define OPA_CALIBRATION_CLK_1K                        (0UL)                     /*!< OPA calibration clock select 1 KHz  \hideinitializer */
#define OPA_CALIBRATION_RV_1_2_AVDD                   (0UL)                     /*!< OPA calibration reference voltage select 1/2 AVDD  \hideinitializer */
#define OPA_CALIBRATION_RV_H_L_VCM                    (1UL)                     /*!< OPA calibration reference voltage select from high vcm to low vcm \hideinitializer */

/*@}*/ /* end of group OPA_EXPORTED_CONSTANTS */

/** @addtogroup OPA_EXPORTED_FUNCTIONS OPA Exported Functions
  @{
*/

/*---------------------------------------------------------------------------------------------------------*/
/* Define OPA functions prototype                                                                         */
/*---------------------------------------------------------------------------------------------------------*/

__STATIC_INLINE int32_t OPA_Calibration(OPA_T *opa, uint32_t u32OpaNum, uint32_t u32ClockSel, uint32_t u32RefVol);

/**
  * @brief This macro is used to power on the OPA circuit
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will set OPENx (x=0) bit of OPA_CTL register to power on the OPA circuit.
  * \hideinitializer
  */
#define OPA_POWER_ON(opa, u32OpaNum) ((opa)->CTL |= (1UL<<(OPA_CTL_OPEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to power down the OPA circuit
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will clear OPENx (x=0) bit of OPA_CTL register to power down the OPA circuit.
  * \hideinitializer
  */
#define OPA_POWER_DOWN(opa, u32OpaNum) ((opa)->CTL &= ~(1UL<<(OPA_CTL_OPEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to enable the OPA Schmitt trigger buffer
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will set OPDOENx (x=0) bit of OPA_CTL register to enable the OPA Schmitt trigger buffer.
  * \hideinitializer
  */
#define OPA_ENABLE_SCH_TRIGGER(opa, u32OpaNum) ((opa)->CTL |= (1UL<<(OPA_CTL_OPDOEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to disable the OPA Schmitt trigger buffer
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will clear OPDOENx (x=0) bit of OPA_CTL register to disable the OPA Schmitt trigger buffer.
  * \hideinitializer
  */
#define OPA_DISABLE_SCH_TRIGGER(opa, u32OpaNum) ((opa)->CTL &= ~(1UL<<(OPA_CTL_OPDOEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to enable OPA Schmitt trigger digital output interrupt
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will set OPDOIENx (x=0) bit of OPA_CTL register to enable the OPA Schmitt trigger digital output interrupt.
  * \hideinitializer
  */
#define OPA_ENABLE_INT(opa, u32OpaNum) ((opa)->CTL |= (1UL<<(OPA_CTL_OPDOIEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to disable OPA Schmitt trigger digital output interrupt
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return None
  * @details This macro will clear OPDOIENx (x=0) bit of OPA_CTL register to disable the OPA Schmitt trigger digital output interrupt.
  * \hideinitializer
  */
#define OPA_DISABLE_INT(opa, u32OpaNum) ((opa)->CTL &= ~(1UL<<(OPA_CTL_OPDOIEN0_Pos+(u32OpaNum))))

/**
  * @brief This macro is used to get OPA digital output state
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return  OPA digital output state
  * @details This macro will return the OPA digital output value.
  * \hideinitializer
  */
#define OPA_GET_DIGITAL_OUTPUT(opa, u32OpaNum) (((opa)->STATUS & (OPA_STATUS_OPDO0_Msk<<(u32OpaNum)))?1UL:0UL)

/**
  * @brief This macro is used to get OPA interrupt flag
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @retval     0 OPA interrupt does not occur.
  * @retval     1 OPA interrupt occurs.
  * @details This macro will return the OPA interrupt flag.
  * \hideinitializer
  */
#define OPA_GET_INT_FLAG(opa, u32OpaNum) (((opa)->STATUS & (OPA_STATUS_OPDOIF0_Msk<<(u32OpaNum)))?1UL:0UL)

/**
  * @brief This macro is used to clear OPA interrupt flag
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @return   None
  * @details This macro will write 1 to OPDOIFx (x=0) bit of OPA_STATUS register to clear interrupt flag.
  * \hideinitializer
  */
#define OPA_CLR_INT_FLAG(opa, u32OpaNum) ((opa)->STATUS = (OPA_STATUS_OPDOIF0_Msk<<(u32OpaNum)))

/**
  * @brief This function is used to configure and start OPA calibration
  * @param[in] opa The pointer of the specified OPA module
  * @param[in] u32OpaNum The OPA number. 0 for OPA0.
  * @param[in] u32ClockSel Select OPA calibration clock
  *                 - \ref OPA_CALIBRATION_CLK_1K
  * @param[in] u32RefVol Select OPA reference voltage
  *                 - \ref OPA_CALIBRATION_RV_1_2_AVDD
  *                 - \ref OPA_CALIBRATION_RV_H_L_VCM
  * @retval      0 PMOS and NMOS calibration successfully.
  * @retval     -1 only PMOS calibration failed.
  * @retval     -2 only NMOS calibration failed.
  * @retval     -3 PMOS and NMOS calibration failed.
  */
__STATIC_INLINE int32_t OPA_Calibration(OPA_T *opa, uint32_t u32OpaNum, uint32_t u32ClockSel, uint32_t u32RefVol)
{
    uint32_t u32CALResult;
    int32_t i32Ret = 0L;

    (opa)->CALCTL = (((opa)->CALCTL) & ~(0x30ul << (u32OpaNum << 1))) | (((u32ClockSel) << 4) << (u32OpaNum << 1));
    (opa)->CALCTL = (((opa)->CALCTL) & ~(OPA_CALCTL_CALRVS0_Msk << (u32OpaNum))) | (((u32RefVol) << OPA_CALCTL_CALRVS0_Pos) << (u32OpaNum));
    (opa)->CALCTL |= (OPA_CALCTL_CALTRG0_Msk << (u32OpaNum));

    while ((opa)->CALCTL & (OPA_CALCTL_CALTRG0_Msk << (u32OpaNum))) {}

    u32CALResult = ((opa)->CALST >> ((u32OpaNum) * 4U)) & (OPA_CALST_CALNS0_Msk | OPA_CALST_CALPS0_Msk);

    if (u32CALResult == 0ul)
    {
        i32Ret = 0L;
    }
    else if (u32CALResult == OPA_CALST_CALNS0_Msk)
    {
        i32Ret = -2L;
    }
    else if (u32CALResult == OPA_CALST_CALPS0_Msk)
    {
        i32Ret = -1L;
    }
    else if (u32CALResult == (uint32_t)(OPA_CALST_CALNS0_Msk | OPA_CALST_CALPS0_Msk))
    {
        i32Ret = -3L;
    }
    else
    {

    }

    return i32Ret;
}

/*@}*/ /* end of group OPA_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group OPA_Driver */

/*@}*/ /* end of group Standard_Driver */

#ifdef __cplusplus
}
#endif

#endif /* __OPA_H__ */

/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/


text:
<?php
namespace metastore;

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;

class DateColumnStatsData
{
    static public $isValidate = false;

    static public $_TSPEC = array(
        1 => array(
            'var' => 'lowValue',
            'isRequired' => false,
            'type' => TType::STRUCT,
            'class' => '\metastore\Date',
        ),
        2 => array(
            'var' => 'highValue',
            'isRequired' => false,
            'type' => TType::STRUCT,
            'class' => '\metastore\Date',
        ),
        3 => array(
            'var' => 'numNulls',
            'isRequired' => true,
            'type' => TType::I64,
        ),
        4 => array(
            'var' => 'numDVs',
            'isRequired' => true,
            'type' => TType::I64,
        ),
        5 => array(
            'var' => 'bitVectors',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
    );

    /**
     * @var \metastore\Date
     */
    public $lowValue = null;
    /**
     * @var \metastore\Date
     */
    public $highValue = null;
    /**
     * @var int
     */
    public $numNulls = null;
    /**
     * @var int
     */
    public $numDVs = null;
    /**
     * @var string
     */
    public $bitVectors = null;

    public function __construct($vals = null)
    {
        if (is_array($vals)) {
            if (isset($vals['lowValue'])) {
                $this->lowValue = $vals['lowValue'];
            }
            if (isset($vals['highValue'])) {
                $this->highValue = $vals['highValue'];
            }
            if (isset($vals['numNulls'])) {
                $this->numNulls = $vals['numNulls'];
            }
            if (isset($vals['numDVs'])) {
                $this->numDVs = $vals['numDVs'];
            }
            if (isset($vals['bitVectors'])) {
                $this->bitVectors = $vals['bitVectors'];
            }
        }
    }

    public function getName()
    {
        return 'DateColumnStatsData';
    }

    public function read($input)
    {
        $xfer = 0;
        $fname = null;
        $ftype = 0;
        $fid = 0;
        $xfer += $input->readStructBegin($fname);
        while (true) {
            $xfer += $input->readFieldBegin($fname, $ftype, $fid);
            if ($ftype == TType::STOP) {
                break;
            }
            switch ($fid) {
                case 1:
                    if ($ftype == TType::STRUCT) {
                        $this->lowValue = new \metastore\Date();
                        $xfer += $this->lowValue->read($input);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 2:
                    if ($ftype == TType::STRUCT) {
                        $this->highValue = new \metastore\Date();
                        $xfer += $this->highValue->read($input);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 3:
                    if ($ftype == TType::I64) {
                        $xfer += $input->readI64($this->numNulls);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 4:
                    if ($ftype == TType::I64) {
                        $xfer += $input->readI64($this->numDVs);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 5:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->bitVectors);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                default:
                    $xfer += $input->skip($ftype);
                    break;
            }
            $xfer += $input->readFieldEnd();
        }
        $xfer += $input->readStructEnd();
        return $xfer;
    }

    public function write($output)
    {
        $xfer = 0;
        $xfer += $output->writeStructBegin('DateColumnStatsData');
        if ($this->lowValue !== null) {
            if (!is_object($this->lowValue)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('lowValue', TType::STRUCT, 1);
            $xfer += $this->lowValue->write($output);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->highValue !== null) {
            if (!is_object($this->highValue)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('highValue', TType::STRUCT, 2);
            $xfer += $this->highValue->write($output);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->numNulls !== null) {
            $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
            $xfer += $output->writeI64($this->numNulls);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->numDVs !== null) {
            $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
            $xfer += $output->writeI64($this->numDVs);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->bitVectors !== null) {
            $xfer += $output->writeFieldBegin('bitVectors', TType::STRING, 5);
            $xfer += $output->writeString($this->bitVectors);
            $xfer += $output->writeFieldEnd();
        }
        $xfer += $output->writeFieldStop();
        $xfer += $output->writeStructEnd();
        return $xfer;
    }
}


text:
import { FETCH_USER_DATA_REQUEST, RECEIVE_USER_DATA } from '../constants/index'
import { parseJSON } from '../utils/misc'
import { data_about_user, data_about_accounts } from '../utils/http_functions'
import { logoutAndRedirect } from './auth'

export function receiveUserData(data) {
  return {
    type: RECEIVE_USER_DATA,
    payload: {
      data
    }
  }
}

export function fetchUserDataRequest() {
  return {
    type: FETCH_USER_DATA_REQUEST
  }
}

export function fetchUserData(token) {
  return dispatch => {
    dispatch(fetchUserDataRequest())
    data_about_user(token)
      .then(parseJSON)
      .then(response => {
        dispatch(receiveUserData(response.result))
      })
      .catch(error => {
        if (error.status === 401) {
          dispatch(logoutAndRedirect(error))
        }
      })
  }
}


text:
namespace Kvasir {
//None
    namespace Pbgp4Pb{    ///<Output Latch
        using Addr = Register::Address<0x4002a320,0xffff0000,0x00000000,unsigned>;
        ///Output Latch.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pb{};
    }
    namespace Pbgp4Pbpin{    ///<Pin Value
        using Addr = Register::Address<0x4002a330,0xffff0000,0x00000000,unsigned>;
        ///Pin Value.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> pbpin{};
    }
    namespace Pbgp4Pbmdsel{    ///<Mode Select
        using Addr = Register::Address<0x4002a340,0xffff0000,0x00000000,unsigned>;
        ///Mode Select.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pbmdsel{};
    }
    namespace Pbgp4Pboutmd{    ///<Output Mode
        using Addr = Register::Address<0x4002a350,0xffff0000,0x00000000,unsigned>;
        ///Output Mode.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pboutmd{};
    }
    namespace Pbgp4Pbdrv{    ///<Drive Strength
        using Addr = Register::Address<0x4002a360,0xfffe0000,0x00000000,unsigned>;
        ///Drive Strength.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pbdrv{};
        ///Port Bank Weak Pull-up Enable.
        enum class PbpuenVal {
            disabled=0x00000000,     ///<Disable weak pull-ups for this port.
            enabled=0x00000001,     ///<Enable weak pull-ups for this port.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,PbpuenVal> pbpuen{};
        namespace PbpuenValC{
            constexpr Register::FieldValue<decltype(pbpuen)::Type,PbpuenVal::disabled> disabled{};
            constexpr Register::FieldValue<decltype(pbpuen)::Type,PbpuenVal::enabled> enabled{};
        }
    }
    namespace Pbgp4Pm{    ///<Port Match Value
        using Addr = Register::Address<0x4002a370,0xffff0000,0x00000000,unsigned>;
        ///Port Match Value.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pm{};
    }
    namespace Pbgp4Pmen{    ///<Port Match Enable
        using Addr = Register::Address<0x4002a380,0xffff0000,0x00000000,unsigned>;
        ///Port Match Enable.
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pmen{};
    }
}


text:
#include "spark_wiring_udp.h"
#include "socket_hal.h"
#include "inet_hal.h"
#include "spark_macros.h"
#include "spark_wiring_network.h"

using namespace spark;

static bool inline isOpen(sock_handle_t sd)
{
   return sd != socket_handle_invalid();
}

UDP::UDP() : _sock(socket_handle_invalid()), _offset(0), _total(0), _buffer(0), _buffer_size(512)
{
}

bool UDP::setBuffer(size_t buf_size, uint8_t* buffer)
{
    releaseBuffer();

    _buffer = buffer;
    _buffer_size = 0;
    if (!_buffer && buf_size) {         // requested allocation
        _buffer = new uint8_t[buf_size];
        _buffer_allocated = true;
    }
    if (_buffer) {
        _buffer_size = buf_size;
    }
    return _buffer_size;
}

void UDP::releaseBuffer()
{
    if (_buffer_allocated && _buffer) {
        delete _buffer;
    }
    _buffer = NULL;
    _buffer_allocated = false;
    _buffer_size = 0;
    flush();
}

uint8_t UDP::begin(uint16_t port, network_interface_t nif)
{
    bool bound = 0;
    if(Network.from(nif).ready())
    {
       _sock = socket_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, port, nif);
        DEBUG("socket=%d",_sock);
        if (socket_handle_valid(_sock))
        {
            flush();
            _port = port;
            _nif = nif;
            bound = true;
        }
        else {
            stop();
            bound = false;
        }
    }
    return bound;
}

int UDP::available()
{
    return _total - _offset;
}

void UDP::stop()
{
    DEBUG("_sock %d closesocket", _sock);
    if (isOpen(_sock))
    {
        socket_close(_sock);
    }
    _sock = socket_handle_invalid();

    flush();
}

int UDP::beginPacket(const char *host, uint16_t port)
{
    if(Network.from(_nif).ready())
    {
        HAL_IPAddress ip_addr;

        if(inet_gethostbyname((char*)host, strlen(host), &ip_addr, _nif, NULL) == 0)
        {
            IPAddress remote_addr(ip_addr);
            return beginPacket(remote_addr, port);
        }
    }
    return 0;
}

int UDP::beginPacket(IPAddress ip, uint16_t port)
{
    // default behavior previously was to use a 512 byte buffer, so instantiate that if not already done
    if (!_buffer && _buffer_size) {
        setBuffer(_buffer_size);
    }

    _remoteIP = ip;
    _remotePort = port;
    flush();
    return _buffer_size;
}

int UDP::endPacket()
{
    int result = sendPacket(_buffer, _offset, _remoteIP, _remotePort);
    flush();
    return result;
}

int UDP::sendPacket(const uint8_t* buffer, size_t buffer_size, IPAddress remoteIP, uint16_t port)
{
    sockaddr_t remoteSockAddr;
    remoteSockAddr.sa_family = AF_INET;

    remoteSockAddr.sa_data[0] = (port & 0xFF00) >> 8;
    remoteSockAddr.sa_data[1] = (port & 0x00FF);

    remoteSockAddr.sa_data[2] = remoteIP[0];
    remoteSockAddr.sa_data[3] = remoteIP[1];
    remoteSockAddr.sa_data[4] = remoteIP[2];
    remoteSockAddr.sa_data[5] = remoteIP[3];

    int rv = socket_sendto(_sock, buffer, buffer_size, 0, &remoteSockAddr, sizeof(remoteSockAddr));
    DEBUG("sendto(buffer=%lx, size=%d)=%d",buffer, buffer_size , rv);
    return rv;
}

size_t UDP::write(uint8_t byte)
{
    return write(&byte, 1);
}

size_t UDP::write(const uint8_t *buffer, size_t size)
{
    size_t available = _buffer ? _buffer_size - _offset : 0;
    if (size>available)
        size = available;
    memcpy(_buffer+_offset, buffer, size);
    _offset += size;
    return size;
}

int UDP::parsePacket()
{
    if (!_buffer && _buffer_size) {
        setBuffer(_buffer_size);
    }

    flush();         // start a new read - discard the old data
    if (_buffer && _buffer_size) {
        int result = receivePacket(_buffer, _buffer_size);
        if (result>0) {
            _total = result;
        }
    };
    return available();
}

int UDP::receivePacket(uint8_t* buffer, size_t size)
{
    int ret = -1;
    if(Network.from(_nif).ready() && isOpen(_sock) && buffer)
    {
        sockaddr_t remoteSockAddr;
        socklen_t remoteSockAddrLen = sizeof(remoteSockAddr);

        ret = socket_receivefrom(_sock, buffer, size, 0, &remoteSockAddr, &remoteSockAddrLen);
        if (ret >= 0)
        {
            _remotePort = remoteSockAddr.sa_data[0] << 8 | remoteSockAddr.sa_data[1];
            _remoteIP = &remoteSockAddr.sa_data[2];
        }
    }
    return ret;
}

int UDP::read()
{
  return available() ? _buffer[_offset++] : -1;
}

int UDP::read(unsigned char* buffer, size_t len)
{
    int read = -1;
    if (available())
    {
    read = min(int(len), available());
      memcpy(buffer, &_buffer[_offset], read);
      _offset += read;
    }
    return read;
}

int UDP::peek()
{
    return available() ? _buffer[_offset] : -1;
}

void UDP::flush()
{
  _offset = 0;
  _total = 0;
}

size_t UDP::printTo(Print& p) const
{
    // can't use available() since this is a `const` method, and available is part of the Stream interface, and is non-const.
    int size = _total - _offset;
    return p.write(_buffer+_offset, size);
}

int UDP::joinMulticast(const IPAddress& ip)
{
    if (_sock == socket_handle_invalid())
        return -1;
    HAL_IPAddress address = ip.raw();
    return socket_join_multicast(&address, _nif, 0);
}

int UDP::leaveMulticast(const IPAddress& ip)
{
    if (_sock == socket_handle_invalid())
        return -1;
    HAL_IPAddress address = ip.raw();
    return socket_leave_multicast(&address, _nif, 0);
}


text:
package org.jetbrains.sbt.project.template.activator

import java.io.{File, IOException}
import java.net.HttpURLConnection

import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.util.io.StreamUtil
import com.intellij.util.net.HttpConfigurable
import org.apache.lucene.document.Document

/**
 * User: Dmitry.Naydanov
 * Date: 20.01.15.
 *
 *
 */
object ActivatorRepoProcessor {
  val REPO_URI = "http://downloads.typesafe.com/typesafe-activator"
  val INDEX_DIR = "index"
  val TEMPLATES_DIR = "templates"
  val VERSION = "v2"
  val PROPERTIES = "current.properties"
  val CACHE_HASH = "cache.hash="

  def indexName(hash: String) = s"index-$hash.zip"
  def templateFileName(id: String) = s"$id.zip"
  def calculateHash(id: String): String = id.take(2) + "/" + id.take(6) + "/"

  case class DocData(id: String, title: String, author: String, src: String, category: String, desc: String, tags: String) {
    override def toString: String = title
  }

  object Keys {
    class Key(val keyName: String) {
      def getValue(doc: Document): String = doc.get(keyName)
    }

    val TEMPLATE_ID = new Key("id")
    val NAME = new Key("name")
    val TITLE = new Key("title")
    val TAGS = new Key("tags")
    val AUTHOR_NAME = new Key("authorName")
    val SOURCE_LINK = new Key("sourceLink")
    val CATEGORY = new Key("category")
    val DESCRIPTION = new Key("description")

    def from(doc: Document): (String, DocData) =
      (NAME getValue doc, DocData(TEMPLATE_ID getValue doc, TITLE getValue doc, AUTHOR_NAME getValue doc,
        SOURCE_LINK getValue doc, CATEGORY getValue doc, DESCRIPTION getValue doc, TAGS getValue doc))
  }

  def downloadStringFromRepo(url: String): Option[String] = {
    val conf = HttpConfigurable.getInstance()
    var connection: HttpURLConnection = null

    try {
      connection = conf openHttpConnection url
      connection.connect()

      val status = connection.getResponseMessage
      if (status != null && status.trim.startsWith("OK")) {
        val text = StreamUtil.readText(connection.getInputStream, "utf-8" /*connection.getContentEncoding*/)
        Some(text)
      } else None
    } catch {
      case _: Exception => None
    } finally {
      if (connection != null) connection.disconnect()
    }
  }

  def downloadFile(url: String, toFile: String, onError: String => Unit, indicator: ProgressIndicator = null): Boolean = {
    try {
      val file = new File(toFile)
      if (!file.exists()) return false

      ActivatorDownloadUtil.downloadContentToFile(indicator, url, file)
      true
    } catch {
      case io: IOException =>
        onError(io.getMessage)
        ActivatorCachedRepoProcessor.logError(s"Can't download $url", io)
        false
    }
  }

  def downloadTemplateFromRepo(id: String, pathTo: File, onError: String => Unit, indicator: ProgressIndicator = null) {
    try {
      val url = s"$REPO_URI/$TEMPLATES_DIR/${calculateHash(id)}${templateFileName(id)}"
      ActivatorDownloadUtil.downloadContentToFile(indicator, url, pathTo)
    } catch {
      case io: IOException =>
//        log.error(s"Can't download template $id", io) - it is not an error anymore
        onError(io.getMessage)
    }

  }
}


text:
<?php

namespace PHPExiftool\Driver\Tag\DICOM;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class RadiusOfCurvature extends AbstractTag
{

    protected $Id = '0046,0075';

    protected $Name = 'RadiusOfCurvature';

    protected $FullName = 'DICOM::Main';

    protected $GroupName = 'DICOM';

    protected $g0 = 'DICOM';

    protected $g1 = 'DICOM';

    protected $g2 = 'Image';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Radius Of Curvature';
}


text:
from multiprocessing import RLock
import multiprocessing.sharedctypes
import ctypes

class SynchronizedCounter(multiprocessing.sharedctypes.Synchronized):
    def increment(self, amount=1):
        self.acquire()
        try:
            self._obj.value += amount
        finally:
            self.release()

def Counter():
    value = multiprocessing.sharedctypes.RawValue(ctypes.c_uint)
    return SynchronizedCounter(value, RLock())


text:
/* tslint:disable:no-unused-variable */
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { SidenavComponent } from './sidenav.component';

describe('SidenavComponent', () => {
  let component: SidenavComponent;
  let fixture: ComponentFixture<SidenavComponent>;

  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      declarations: [ SidenavComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(SidenavComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
"""Entity for the opengarage.io component."""

from homeassistant.core import callback
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from . import DOMAIN

class OpenGarageEntity(CoordinatorEntity):
    """Representation of a OpenGarage entity."""

    def __init__(self, open_garage_data_coordinator, device_id, description=None):
        """Initialize the entity."""
        super().__init__(open_garage_data_coordinator)

        if description is not None:
            self.entity_description = description
            self._attr_unique_id = f"{device_id}_{description.key}"
        else:
            self._attr_unique_id = device_id

        self._device_id = device_id
        self._update_attr()

    @callback
    def _update_attr(self) -> None:
        """Update the state and attributes."""

    @callback
    def _handle_coordinator_update(self) -> None:
        """Handle updated data from the coordinator."""
        self._update_attr()
        self.async_write_ha_state()

    @property
    def device_info(self):
        """Return the device_info of the device."""
        device_info = DeviceInfo(
            configuration_url=self.coordinator.open_garage_connection.device_url,
            connections={(CONNECTION_NETWORK_MAC, self.coordinator.data["mac"])},
            identifiers={(DOMAIN, self._device_id)},
            manufacturer="Open Garage",
            name=self.coordinator.data["name"],
            suggested_area="Garage",
            sw_version=self.coordinator.data["fwv"],
        )
        return device_info


text:
package uk.ac.ebi.pride.tools.cluster.quality;

import uk.ac.ebi.pride.spectracluster.repo.model.ClusterQuality;
import uk.ac.ebi.pride.spectracluster.repo.model.ClusterSummary;

/**
 * Decide the quality of a cluster for a cluster summary
 *
 * NOTE: the threshold will be inclusive
 *
 * @author Rui Wang
 * @version $Id$
 */
public class ClusterSummaryQualityDecider implements IClusterQualityDecider<ClusterSummary> {

    private final int spectrumCountThreshold;
    private final int projectCountThreshold;
    private final float maxPeptideRatioThreshold;

    public ClusterSummaryQualityDecider(int spectrumCountThreshold, int projectCountThreshold, float maxPeptideRatioThreshold) {
        this.spectrumCountThreshold = spectrumCountThreshold;
        this.projectCountThreshold = projectCountThreshold;
        this.maxPeptideRatioThreshold = maxPeptideRatioThreshold;
    }

    @Override
    public ClusterQuality decideQuality(ClusterSummary cluster) {

        int numberOfSpectra = cluster.getTotalNumberOfSpectra();
        int numberOfProjects = cluster.getNumberOfProjects();
        float maxPeptideRatio = cluster.getMaxPeptideRatio();

        boolean belowSpectrumCountThreshold = numberOfSpectra < spectrumCountThreshold;
        boolean belowProjectCountThreshold = numberOfProjects < projectCountThreshold;
        boolean belowMaxPeptideRatioThreshold = maxPeptideRatio < maxPeptideRatioThreshold;

        // check for high quality cluster
        if (!belowMaxPeptideRatioThreshold && !belowProjectCountThreshold && !belowSpectrumCountThreshold) {
            return ClusterQuality.HIGH;
        }

        // check for medium qualit cluster
        if (!belowMaxPeptideRatioThreshold && belowProjectCountThreshold && !belowSpectrumCountThreshold) {
            return ClusterQuality.MEDIUM;
        }

        return ClusterQuality.LOW;
    }
}


text:
module Attask

  # The model that contains information about a project
  #
  # == Fields
  # [+name+] (REQUIRED) the name of the project

  class Company < Hashie::Mash
    include Attask::Model

    api_path '/cmpy'

  end

end


text:
title: 404
layout: 404
---
(This page is not shown)


text:
FROM nginx:1.23.1-alpine

# Nginx conf
COPY ./conf/html /var/www/html
COPY ./conf/default.conf /etc/nginx/conf.d/default.conf

# Entrypoint
COPY ./entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh

CMD /usr/local/bin/entrypoint.sh


text:
/* vim: set tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab */

/*
 * Copyright 2015 Lanet Network
 * Programmed by Oleksandr Natalenko <o.natalenko@lanet.ua>
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#ifndef __PFGFQ_H__
#define __PFGFQ_H__

typedef void (*glfs_dentry_handler_t)(glfs_t*, const char*, struct dirent*, struct stat*, void*, unsigned int);
typedef int (*glfs_dentry_comparator_t)(const char*, struct dirent*, struct stat*, unsigned int);

int glfs_mkdir_safe(glfs_t* _fs, const char* _path, mode_t _mode);
void glfs_walk_dir_generic(glfs_t* _fs, const char* _entry_point, glfs_dentry_handler_t _handler, glfs_dentry_comparator_t _comparator, void* _data, unsigned int _level) __attribute__((nonnull(1, 2, 3)));

#endif /* __PFGFQ_H__ */


text:
<?php
namespace Look\AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * @ORM\Entity
 */
class Cart
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="User", inversedBy="carts")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     **/
    protected $user;

    /**
     * @ORM\OneToMany(targetEntity="CartProduct", mappedBy="cart")
     **/
    protected $cartProducts;

     /**
     * @ORM\Column(type="boolean")
     * @Assert\NotBlank()
     */
    protected $is_cart;

    public function __construct() {
        $this->cartProducts = new ArrayCollection();
    }

    public function getId()
    {
        return $this->id;
    }

    public function getUser()
    {
        return $this->user;
    }

    public function setUser($user)
    {
        $this->user = $user;
    }

    public function getCartProducts()
    {
        return $this->cartProducts;
    }

    public function addCartProduct($cartProduct)
    {
        $this->cartProducts->add($cartProduct);
    }

    public function getIsCart()
    {
        return $this->is_cart;
    }

    public function setIsCart($is_cart)
    {
        $this->is_cart = $is_cart;
    }
}


text:
package org.apache.flink.table.types.logical;

import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.table.api.ValidationException;
import org.apache.flink.table.data.RowData;
import org.apache.flink.types.Row;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.StringUtils;

import javax.annotation.Nullable;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import static org.apache.flink.table.utils.EncodingUtils.escapeIdentifier;
import static org.apache.flink.table.utils.EncodingUtils.escapeSingleQuotes;

/**
 * Logical type of a sequence of fields. A field consists of a field name, field type, and an optional
 * description. The most specific type of a row of a table is a row type. In this case, each column
 * of the row corresponds to the field of the row type that has the same ordinal position as the
 * column. Compared to the SQL standard, an optional field description simplifies the handling with
 * complex structures.
 *
 * <p>The serialized string representation is {@code ROW<n0 t0 'd0', n1 t1 'd1', ...>} where
 * {@code n} is the unique name of a field, {@code t} is the logical type of a field, {@code d} is
 * the description of a field. {@code ROW(...)} is a synonym for being closer to the SQL standard.
 */
@PublicEvolving
public final class RowType extends LogicalType {

	public static final String FORMAT = "ROW<%s>";

	private static final Set<String> INPUT_OUTPUT_CONVERSION = conversionSet(
		Row.class.getName(),
		RowData.class.getName());

	private static final Class<?> DEFAULT_CONVERSION = Row.class;

	/**
	 * Describes a field of a {@link RowType}.
	 */
	public static final class RowField implements Serializable {

		public static final String FIELD_FORMAT_WITH_DESCRIPTION = "%s %s '%s'";

		public static final String FIELD_FORMAT_NO_DESCRIPTION = "%s %s";

		private final String name;

		private final LogicalType type;

		private final @Nullable String description;

		public RowField(String name, LogicalType type, @Nullable String description) {
			this.name = Preconditions.checkNotNull(name, "Field name must not be null.");
			this.type = Preconditions.checkNotNull(type, "Field type must not be null.");
			this.description = description;
		}

		public RowField(String name, LogicalType type) {
			this(name, type, null);
		}

		public String getName() {
			return name;
		}

		public LogicalType getType() {
			return type;
		}

		public Optional<String> getDescription() {
			return Optional.ofNullable(description);
		}

		public RowField copy() {
			return new RowField(name, type.copy(), description);
		}

		public String asSummaryString() {
			return formatString(type.asSummaryString(), true);
		}

		public String asSerializableString() {
			return formatString(type.asSerializableString(), false);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) {
				return true;
			}
			if (o == null || getClass() != o.getClass()) {
				return false;
			}
			RowField rowField = (RowField) o;
			return name.equals(rowField.name) &&
				type.equals(rowField.type) &&
				Objects.equals(description, rowField.description);
		}

		@Override
		public int hashCode() {
			return Objects.hash(name, type, description);
		}

		private String formatString(String typeString, boolean excludeDescription) {
			if (description == null) {
				return String.format(FIELD_FORMAT_NO_DESCRIPTION,
					escapeIdentifier(name),
					typeString);
			} else if (excludeDescription) {
				return String.format(FIELD_FORMAT_WITH_DESCRIPTION,
					escapeIdentifier(name),
					typeString,
					"...");
			} else {
				return String.format(FIELD_FORMAT_WITH_DESCRIPTION,
					escapeIdentifier(name),
					typeString,
					escapeSingleQuotes(description));
			}
		}
	}

	private final List<RowField> fields;

	public RowType(boolean isNullable, List<RowField> fields) {
		super(isNullable, LogicalTypeRoot.ROW);
		this.fields = Collections.unmodifiableList(
			new ArrayList<>(
				Preconditions.checkNotNull(fields, "Fields must not be null.")));

		validateFields(fields);
	}

	public RowType(List<RowField> fields) {
		this(true, fields);
	}

	public List<RowField> getFields() {
		return fields;
	}

	public List<String> getFieldNames() {
		return fields.stream().map(RowField::getName).collect(Collectors.toList());
	}

	public LogicalType getTypeAt(int i) {
		return fields.get(i).getType();
	}

	public int getFieldCount() {
		return fields.size();
	}

	public int getFieldIndex(String fieldName) {
		for (int i = 0; i < fields.size(); i++) {
			if (fields.get(i).getName().equals(fieldName)) {
				return i;
			}
		}
		return -1;
	}

	@Override
	public LogicalType copy(boolean isNullable) {
		return new RowType(
			isNullable,
			fields.stream().map(RowField::copy).collect(Collectors.toList()));
	}

	@Override
	public String asSummaryString() {
		return withNullability(
			FORMAT,
			fields.stream()
				.map(RowField::asSummaryString)
				.collect(Collectors.joining(", ")));
	}

	@Override
	public String asSerializableString() {
		return withNullability(
			FORMAT,
			fields.stream()
				.map(RowField::asSerializableString)
				.collect(Collectors.joining(", ")));
	}

	@Override
	public boolean supportsInputConversion(Class<?> clazz) {
		return INPUT_OUTPUT_CONVERSION.contains(clazz.getName());
	}

	@Override
	public boolean supportsOutputConversion(Class<?> clazz) {
		return INPUT_OUTPUT_CONVERSION.contains(clazz.getName());
	}

	@Override
	public Class<?> getDefaultConversion() {
		return DEFAULT_CONVERSION;
	}

	@Override
	public List<LogicalType> getChildren() {
		return Collections.unmodifiableList(
			fields.stream()
				.map(RowField::getType)
				.collect(Collectors.toList()));
	}

	@Override
	public <R> R accept(LogicalTypeVisitor<R> visitor) {
		return visitor.visit(this);
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		if (!super.equals(o)) {
			return false;
		}
		RowType rowType = (RowType) o;
		return fields.equals(rowType.fields);
	}

	@Override
	public int hashCode() {
		return Objects.hash(super.hashCode(), fields);
	}

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

	private static void validateFields(List<RowField> fields) {
		final List<String> fieldNames = fields.stream()
			.map(f -> f.name)
			.collect(Collectors.toList());
		if (fieldNames.stream().anyMatch(StringUtils::isNullOrWhitespaceOnly)) {
			throw new ValidationException("Field names must contain at least one non-whitespace character.");
		}
		final Set<String> duplicates = fieldNames.stream()
			.filter(n -> Collections.frequency(fieldNames, n) > 1)
			.collect(Collectors.toSet());
		if (!duplicates.isEmpty()) {
			throw new ValidationException(
				String.format("Field names must be unique. Found duplicates: %s", duplicates));
		}
	}

	public static RowType of(LogicalType... types) {
		List<RowField> fields = new ArrayList<>();
		for (int i = 0; i < types.length; i++) {
			fields.add(new RowField("f" + i, types[i]));
		}
		return new RowType(fields);
	}

	public static RowType of(LogicalType[] types, String[] names) {
		List<RowField> fields = new ArrayList<>();
		for (int i = 0; i < types.length; i++) {
			fields.add(new RowField(names[i], types[i]));
		}
		return new RowType(fields);
	}
}


text:
"""CIFAR datasets."""

import collections
import os

from etils import epath
import numpy as np
from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow as tf
import tensorflow_datasets.public_api as tfds

# Shared constants
_CIFAR_IMAGE_SIZE = 32
_CIFAR_IMAGE_SHAPE = (_CIFAR_IMAGE_SIZE, _CIFAR_IMAGE_SIZE, 3)

_CITATION = """\
@TECHREPORT{Krizhevsky09learningmultiple,
    author = {Alex Krizhevsky},
    title = {Learning multiple layers of features from tiny images},
    institution = {},
    year = {2009}
}
"""

class Cifar10(tfds.core.GeneratorBasedBuilder):
  """CIFAR-10."""

  VERSION = tfds.core.Version("3.0.2")

  def _info(self):
    return tfds.core.DatasetInfo(
        builder=self,
        description=("The CIFAR-10 dataset consists of 60000 32x32 colour "
                     "images in 10 classes, with 6000 images per class. There "
                     "are 50000 training images and 10000 test images."),
        features=tfds.features.FeaturesDict({
            "id": tfds.features.Text(),
            "image": tfds.features.Image(shape=_CIFAR_IMAGE_SHAPE),
            "label": tfds.features.ClassLabel(num_classes=10),
        }),
        supervised_keys=("image", "label"),
        homepage="https://www.cs.toronto.edu/~kriz/cifar.html",
        citation=_CITATION,
    )

  @property
  def _cifar_info(self):
    return CifarInfo(
        name=self.name,
        url="https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz",
        train_files=[
            "data_batch_1.bin", "data_batch_2.bin", "data_batch_3.bin",
            "data_batch_4.bin", "data_batch_5.bin"
        ],
        test_files=["test_batch.bin"],
        prefix="cifar-10-batches-bin/",
        label_files=["batches.meta.txt"],
        label_keys=["label"],
    )

  def _split_generators(self, dl_manager):
    """Returns SplitGenerators."""
    cifar_path = dl_manager.download_and_extract(self._cifar_info.url)
    cifar_info = self._cifar_info

    cifar_path = os.path.join(cifar_path, cifar_info.prefix)

    # Load the label names
    for label_key, label_file in zip(cifar_info.label_keys,
                                     cifar_info.label_files):
      labels_path = os.path.join(cifar_path, label_file)
      with epath.Path(labels_path).open() as label_f:
        label_names = [name for name in label_f.read().split("\n") if name]
      self.info.features[label_key].names = label_names

    # Define the splits
    def gen_filenames(filenames):
      for f in filenames:
        yield os.path.join(cifar_path, f)

    return {
        tfds.Split.TRAIN:
            self._generate_examples("train_",
                                    gen_filenames(cifar_info.train_files)),
        tfds.Split.TEST:
            self._generate_examples("test_",
                                    gen_filenames(cifar_info.test_files)),
    }

  def _generate_examples(self, split_prefix, filepaths):
    """Generate CIFAR examples as dicts.

    Shared across CIFAR-{10, 100}. Uses self._cifar_info as
    configuration.

    Args:
      split_prefix (str): Prefix that identifies the split (e.g. "tr" or "te").
      filepaths (list[str]): The files to use to generate the data.

    Yields:
      The cifar examples, as defined in the dataset info features.
    """
    label_keys = self._cifar_info.label_keys
    index = 0  # Using index as key since data is always loaded in same order.
    for path in filepaths:
      for labels, np_image in _load_data(path, len(label_keys)):
        record = dict(zip(label_keys, labels))
        # Note: "id" is only provided for the user convenience. To shuffle the
        # dataset we use `index`, so that the sharding is compatible with
        # earlier versions.
        record["id"] = "{}{:05d}".format(split_prefix, index)
        record["image"] = np_image
        yield index, record
        index += 1

class Cifar100(Cifar10):
  """CIFAR-100 dataset."""

  VERSION = tfds.core.Version("3.0.2")

  @property
  def _cifar_info(self):
    return CifarInfo(
        name=self.name,
        url="https://www.cs.toronto.edu/~kriz/cifar-100-binary.tar.gz",
        train_files=["train.bin"],
        test_files=["test.bin"],
        prefix="cifar-100-binary/",
        label_files=["coarse_label_names.txt", "fine_label_names.txt"],
        label_keys=["coarse_label", "label"],
    )

  def _info(self):
    return tfds.core.DatasetInfo(
        builder=self,
        description=("This dataset is just like the CIFAR-10, except it has "
                     "100 classes containing 600 images each. There are 500 "
                     "training images and 100 testing images per class. The "
                     "100 classes in the CIFAR-100 are grouped into 20 "
                     "superclasses. Each image comes with a \"fine\" label "
                     "(the class to which it belongs) and a \"coarse\" label "
                     "(the superclass to which it belongs)."),
        features=tfds.features.FeaturesDict({
            "id": tfds.features.Text(),
            "image": tfds.features.Image(shape=_CIFAR_IMAGE_SHAPE),
            "label": tfds.features.ClassLabel(num_classes=100),
            "coarse_label": tfds.features.ClassLabel(num_classes=20),
        }),
        supervised_keys=("image", "label"),
        homepage="https://www.cs.toronto.edu/~kriz/cifar.html",
        citation=_CITATION,
    )

class CifarInfo(
    collections.namedtuple("_CifarInfo", [
        "name",
        "url",
        "prefix",
        "train_files",
        "test_files",
        "label_files",
        "label_keys",
    ])):
  """Contains the information necessary to generate a CIFAR dataset.

  Attributes:
    name (str): name of dataset.
    url (str): data URL.
    prefix (str): path prefix within the downloaded and extracted file to look
      for `train_files` and `test_files`.
    train_files (list<str>): name of training files within `prefix`.
    test_files (list<str>): name of test files within `prefix`.
    label_files (list<str>): names of the label files in the data.
    label_keys (list<str>): names of the label keys in the data.
  """

def _load_data(path, labels_number=1):
  """Yields (labels, np_image) tuples."""
  with tf.io.gfile.GFile(path, "rb") as f:
    data = f.read()
  offset = 0
  max_offset = len(data) - 1
  while offset < max_offset:
    labels = np.frombuffer(
        data, dtype=np.uint8, count=labels_number, offset=offset).reshape(
            (labels_number,))
    # 1 byte per label, 1024 * 3 = 3072 bytes for the image.
    offset += labels_number
    img = (
        np.frombuffer(data, dtype=np.uint8, count=3072, offset=offset).reshape(
            (3, _CIFAR_IMAGE_SIZE, _CIFAR_IMAGE_SIZE)).transpose((1, 2, 0)))
    offset += 3072
    yield labels, img