text
stringlengths 2
1.04M
| meta
dict |
|---|---|
'use strict';
['__Secure-', '__Host-'].forEach(prefix => {
promise_test(async testCase => {
await cookieStore.set(`${prefix}cookie-name`, `secure-cookie-value`);
assert_equals(
(await cookieStore.get(`${prefix}cookie-name`)).value,
'secure-cookie-value',
`Setting ${prefix} cookies should not fail in secure context`);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set with ${prefix} name on secure origin`);
promise_test(async testCase => {
// This test is for symmetry with the non-secure case. In non-secure
// contexts, the set() should fail even if the expiration date makes
// the operation a no-op.
await cookieStore.set(
{ name: `${prefix}cookie-name`, value: `secure-cookie-value`,
expires: Date.now() - (24 * 60 * 60 * 1000)});
assert_equals(await cookieStore.get(`${prefix}cookie-name`), null);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set of expired ${prefix} cookie name on secure origin`);
promise_test(async testCase => {
assert_equals(
await cookieStore.delete(`${prefix}cookie-name`), undefined,
`Deleting ${prefix} cookies should not fail in secure context`);
}, `cookieStore.delete with ${prefix} name on secure origin`);
});
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
await promise_rejects_js(testCase, TypeError,
cookieStore.set({ name: '__Host-cookie-name', value: 'cookie-value',
domain: currentDomain }));
}, 'cookieStore.set with __Host- prefix and a domain option');
promise_test(async testCase => {
await cookieStore.set({ name: '__Host-cookie-name', value: 'cookie-value',
path: "/" });
assert_equals(
(await cookieStore.get(`__Host-cookie-name`)).value, "cookie-value");
await promise_rejects_js(testCase, TypeError,
cookieStore.set( { name: '__Host-cookie-name', value: 'cookie-value',
path: "/path" }));
}, 'cookieStore.set with __Host- prefix a path option');
|
{
"content_hash": "4f376261ec7dbc71b70ad949a2a4864a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 76,
"avg_line_length": 43.46,
"alnum_prop": 0.641049240681086,
"repo_name": "scheib/chromium",
"id": "db077478e0eebb143664c651123a32bb5fc1e722",
"size": "2308",
"binary": false,
"copies": "8",
"ref": "refs/heads/main",
"path": "third_party/blink/web_tests/external/wpt/cookie-store/cookieStore_special_names.https.any.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
package com.domhauton.membrane.api.responses;
import java.util.Set;
/**
* Created by dominic on 04/02/17.
*/
public class ContractStatus implements MembraneResponse {
private final boolean contractManagerActive;
private final int contractTarget;
private final Set<String> contractedPeers;
private final Set<String> undeployedShards;
private final Set<String> partiallyDistributedShards;
private final Set<String> fullyDistributedShards;
public ContractStatus(boolean contractManagerActive, int contractTarget, Set<String> contractedPeers, Set<String> undeployedShards, Set<String> partiallyDistributedShards, Set<String> fullyDistributedShards) {
this.contractManagerActive = contractManagerActive;
this.contractTarget = contractTarget;
this.contractedPeers = contractedPeers;
this.undeployedShards = undeployedShards;
this.partiallyDistributedShards = partiallyDistributedShards;
this.fullyDistributedShards = fullyDistributedShards;
}
public boolean isContractManagerActive() {
return contractManagerActive;
}
public int getContractTarget() {
return contractTarget;
}
public Set<String> getContractedPeers() {
return contractedPeers;
}
public Set<String> getUndeployedShards() {
return undeployedShards;
}
public Set<String> getPartiallyDistributedShards() {
return partiallyDistributedShards;
}
public Set<String> getFullyDistributedShards() {
return fullyDistributedShards;
}
}
|
{
"content_hash": "5acb4b27dd5ac6b883a67051adc29572",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 211,
"avg_line_length": 30.854166666666668,
"alnum_prop": 0.7819041188386225,
"repo_name": "domhauton/membraned",
"id": "3cf1cec95c342cc8b88a88305c79aae2e0d97570",
"size": "1481",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/domhauton/membrane/api/responses/ContractStatus.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "694974"
},
{
"name": "Shell",
"bytes": "2206"
}
],
"symlink_target": ""
}
|
from math import sqrt, ceil
import unittest
DEFAULT_NUM_OF_PRIMES = 10
def get_n_primes(n=DEFAULT_NUM_OF_PRIMES):
def is_prime(num):
if num == 1 or num == 2:
return True
for i in range(2, ceil(sqrt(num))+1):
if num % i == 0:
return False
return True
result = []
candidate = 2
while len(result) < n:
if is_prime(candidate):
result.append(candidate)
candidate += 1
return result
def print_multiplication_table(top, side):
# how wide is the largest number in the table
digits = len(str(top[-1] * side[-1]))
# how wide should the side (left) column be?
side_width = len(str(side[-1]))
# build and print the table header
head_str = " " * (side_width+1)
for n in top:
head_str += str(n).rjust(digits+1)
print(head_str)
print(" " * side_width + "_" * len(head_str))
# now build and print every row
for i in range(0, len(side)): # i is the row index
# takes care of the side 'prefix'
row_string = ("%d" % (side[i],)).rjust(side_width) + "|"
for j in range(0, len(top)):
row_string += str(top[j]*side[i]).rjust(digits+1)
print(row_string)
class InterviewProblemsTest(unittest.TestCase):
def test_get_n_primes(self):
assert([2, 3, 5, 7, 11, 13, 17, 19, 23, 29] == get_n_primes())
# not really proper tests, other than making sure we handle the edge case and don't crush
def test_print_table_single(self):
col = row = get_n_primes(1)
print_multiplication_table(row, col)
def test_print_table(self):
col = [1,2,3,4,5]
row = [6,7,8]
print_multiplication_table(row, col)
if __name__ == '__main__':
unittest.main()
|
{
"content_hash": "c20974159249a21210bdbd8fabcba551",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 93,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.5706309324399776,
"repo_name": "alexakarpov/python-practice",
"id": "e808cfdfc7e14ea2ada3f5852eb4da9ab6819912",
"size": "1815",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "primes.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "24611"
}
],
"symlink_target": ""
}
|
var assert = require('assert');
var async = require('async');
var path = require('path');
var st = require('st');
var wd = require('wd');
var sauceConnect = require('sauce-connect-launcher');
var http = require('http');
var wdTap = require('./');
var user = process.env.SAUCE_USER,
key = process.env.SAUCE_KEY;
if (!user || !key) {
console.log('Set SAUCE_USER and SAUCE_KEY to your SauceLabs credentials');
process.exit(1);
}
var browsers = [
{ name: 'Chrome', browserName: 'chrome' },
{ name: 'IE 9', browserName: 'internet explorer', platform: 'Windows 7', version: '9' }
];
var server = null,
serverPort = 8000,
tunnelId = 'test-wd-tap-' + Date.now(),
tunnel;
startServer();
function startServer() {
var dir = path.join(__dirname, 'assets');
server = http.createServer(st({ path: dir, cache: false }));
server.listen(serverPort, listening);
function listening(err) {
assert.equal(err, null);
serverPort = server.address().port;
startTunnel();
}
}
function startTunnel() {
console.log('Opening tunnel to SauceLabs');
var options = {
tunnelIdentifier: tunnelId,
username: user,
accessKey: key
};
sauceConnect(options, function(err, t) {
assert.equal(err, null);
tunnel = t;
console.log('Tunnel opened');
test();
});
}
function stopTunnel(callback) {
console.log('Closing tunnel');
tunnel.close(function() {
console.log('Tunnel closed');
callback();
});
}
function test() {
async.eachSeries(browsers, runTest, complete);
function runTest(browser, callback) {
var driver;
start();
function start() {
console.log('Starting', browser.name);
browser['tunnel-identifier'] = tunnelId;
driver = wd.remote('ondemand.saucelabs.com', 80, user, key);
driver.init(browser, run);
}
function run(err) {
assert.equal(err, null);
console.log('Testing', browser.name);
wdTap(
'http://localhost:' + serverPort + '/test.html',
driver,
done);
}
function done(err, results) {
assert.equal(err, null);
assert.ok(results.ok);
assert.equal(typeof results.raw, 'string');
assert.equal(results.raw.length, 150);
console.log('Finished ' + browser.name);
driver.quit(callback);
}
}
function complete(err) {
assert.equal(err, null);
console.log('Tests completed');
cleanup();
}
}
function cleanup() {
async.series([
cleanupServer,
cleanupTunnel
], done);
function done(err) {
assert.equal(err, null);
console.log('Finished');
}
}
function cleanupServer(callback) {
if (!server) {
return callback();
}
server.close(callback);
}
function cleanupTunnel(callback) {
if (!tunnel) {
return callback();
}
tunnel.close(callback);
}
|
{
"content_hash": "3d225c2ac891e1b8d0d9950793a9469e",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 91,
"avg_line_length": 23.32330827067669,
"alnum_prop": 0.5664087685364281,
"repo_name": "conradz/wd-tap",
"id": "eefd270ee23cdbc2ab5ecdde757c95d3320176e9",
"size": "3102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test.js",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "HTML",
"bytes": "152"
},
{
"name": "JavaScript",
"bytes": "5956"
}
],
"symlink_target": ""
}
|
require "pager/version"
module Pager
def self.included(base)
base.send :include, InstanceMethods
base.send :attr_accessor, :last_offset, :default_batch, :current_index
end
module InstanceMethods
def filtered_page(limit, options={}, &block)
self.default_batch = options.delete(:default_batch) || 16
self.current_index = (options.include?(:offset) and !options[:offset].blank?) ? index(options.delete(:offset)) : (self.last_offset.nil? ? 0 : index(self.last_offset)+1)
catch(:filtered) do
collected = []
while collected.length != limit
new_batch = next_batch
if new_batch.empty?
self.last_offset = last
throw(:filtered, collected)
end
new_batch.each do |x|
collected << x if yield(x)
if collected.size == limit
self.last_offset = self[index(x)]
throw :filtered, collected
end
end
end
end
end
def next_batch
index_start = self.current_index
index_end = index_start + self.default_batch
self.current_index = index_end + 1
dup[index_start..index_end] || []
end
end
end
|
{
"content_hash": "c14c8b6f156ceaca5a2abf93d3eb932e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 174,
"avg_line_length": 28.209302325581394,
"alnum_prop": 0.5902720527617478,
"repo_name": "adhitia/pager",
"id": "1fb7a39b637aca9b6dade5aca09f1dfc7bb7a0d3",
"size": "1213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/pager.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "3860"
}
],
"symlink_target": ""
}
|
<?php
/**
* DO NOT EDIT THIS FILE!
*
* This file was automatically generated from external sources.
*
* Any manual change here will be lost the next time the SDK
* is updated. You've been warned!
*/
namespace DTS\eBaySDK\Test\Account\Types;
use DTS\eBaySDK\Account\Types\GetAFulfillmentPolicyByNameRestResponse;
class GetAFulfillmentPolicyByNameRestResponseTest extends \PHPUnit_Framework_TestCase
{
private $obj;
protected function setUp()
{
$this->obj = new GetAFulfillmentPolicyByNameRestResponse();
}
public function testCanBeCreated()
{
$this->assertInstanceOf('\DTS\eBaySDK\Account\Types\GetAFulfillmentPolicyByNameRestResponse', $this->obj);
}
public function testExtendsFulfillmentPolicy()
{
$this->assertInstanceOf('\DTS\eBaySDK\Account\Types\FulfillmentPolicy', $this->obj);
}
}
|
{
"content_hash": "aa2a49257e193db134bafd8ceaf8080b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 114,
"avg_line_length": 26.242424242424242,
"alnum_prop": 0.7240184757505773,
"repo_name": "davidtsadler/ebay-sdk-php",
"id": "810dd5c67073f21c2733c04e130125a0c70f174e",
"size": "866",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Account/Types/GetAFulfillmentPolicyByNameRestResponseTest.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "10944"
},
{
"name": "PHP",
"bytes": "9958599"
}
],
"symlink_target": ""
}
|
package org.pathvisio.core.model;
/**
* Used to notify listeners of changes to the model, i.e a Pathway or PathwayElement.
* This can mean the addition or removal of whole elements, or just a modification to
* one of the properties of an existing element.
*
* This event is currently used both by PathwayListener's and PathwayElementListener's.
* That may change in the future.
*/
public class PathwayEvent
{
/**
* Sent to listeners of Pathway when an object was deleted
*/
public static final int DELETED = 2;
/**
* Sent to listeners of Pathway when a new object was added
*/
public static final int ADDED = 3;
public static final int RESIZED = 4;
private PathwayElement affectedData;
public PathwayElement getAffectedData () { return affectedData; }
private int type;
public int getType() { return type; }
public PathwayEvent (PathwayElement object, int t)
{
affectedData = object;
type = t;
}
}
|
{
"content_hash": "ef23c46dbb9fbc45f0d56e2da008fec5",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 88,
"avg_line_length": 25.324324324324323,
"alnum_prop": 0.727854855923159,
"repo_name": "PathVisio/pathvisio",
"id": "a4e45818f400c707f5aad5dbdbe1eeff03c048b9",
"size": "1787",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/org.pathvisio.core/src/org/pathvisio/core/model/PathwayEvent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "74"
},
{
"name": "CSS",
"bytes": "390"
},
{
"name": "HTML",
"bytes": "27652"
},
{
"name": "Inno Setup",
"bytes": "2290"
},
{
"name": "Java",
"bytes": "2303047"
},
{
"name": "JavaScript",
"bytes": "16917"
},
{
"name": "Shell",
"bytes": "12653"
}
],
"symlink_target": ""
}
|
DASHBOARD.notify = (function() {
var currentNotifications = [];
var c = 0;
return function(msg,type,fixed,timeout) {
if (currentNotifications.length > 4) {
var ll = currentNotifications.length;
for (var i = 0;ll > 4 && i<currentNotifications.length;i+=1) {
var n = currentNotifications[i];
if (!n.fixed) {
window.clearTimeout(n.timeoutid);
n.close();
ll -= 1;
}
}
}
var n = document.createElement("div");
n.id="dashboard-notification-"+c;
n.className = "alert";
n.fixed = fixed;
if (type) {
n.className = "alert alert-"+type;
}
n.style.display = "none";
n.innerHTML = msg;
$("#notifications").append(n);
$(n).slideDown(300);
n.close = function() {
var nn = n;
return function() {
currentNotifications.splice(currentNotifications.indexOf(nn),1);
$(nn).slideUp(300, function() {
nn.parentNode.removeChild(nn);
});
};
}();
if (!fixed) {
n.timeoutid = window.setTimeout(n.close,timeout||3000);
}
currentNotifications.push(n);
c+=1;
return n;
}
})();
|
{
"content_hash": "cbd4edeb1e29076fb6cd867841c996b7",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 32.30232558139535,
"alnum_prop": 0.46436285097192226,
"repo_name": "peat-platform/user-dashboard",
"id": "e4cb793816872320c1d10b007b0bba5a69d5e973",
"size": "1390",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "public/user/javascripts/ui/notifications.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2151"
},
{
"name": "HTML",
"bytes": "32827"
},
{
"name": "JavaScript",
"bytes": "100186"
}
],
"symlink_target": ""
}
|
using UnityEngine;
public class bob : MonoBehaviour
{
float amount = 0.5f;
// Update is called once per frame
private void Update()
{
var pos = new Vector3(0, -0.7f + amount * Mathf.Sin(Time.time), 0);
//transform.localPosition = pos;
transform.localRotation = Quaternion.AngleAxis(Mathf.Sin(Time.time) * 10.0f, transform.forward);
}
}
|
{
"content_hash": "9bc3ee953c18a70b4b2811e9889c20fe",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 104,
"avg_line_length": 24,
"alnum_prop": 0.6380208333333334,
"repo_name": "aodendaal/ThisGameBlows",
"id": "ed0a49e4f5eee968ada99fcd0c6d4eb8e7c70aa9",
"size": "386",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Scripts/Animation/bob.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "630084"
},
{
"name": "HLSL",
"bytes": "17852"
},
{
"name": "ShaderLab",
"bytes": "364962"
}
],
"symlink_target": ""
}
|
package com.sdl.odata.service.util
import akka.actor.{Actor, ActorContext, ActorRef}
import com.sdl.odata.service.actor.MessageHandlerRegistry._
import com.sdl.odata.service.actor.ODataMessageRouter
import com.sdl.odata.service.protocol.{ODataActorMessage, RegisterMessageHandler}
import com.sdl.odata.service.spring.ActorProducer
import org.slf4j.{Logger, LoggerFactory}
/**
* Akka Util Class is resppnsible for registering routes for actors.
*
*/
object AkkaUtil {
private val logger: Logger = LoggerFactory.getLogger("AkkaUtil")
def registerRoute(messageType: Class[_ <: ODataActorMessage], actorType: Class[_ <: Actor])(implicit producer: ActorProducer) {
messageRouter().tell(RegisterMessageHandler(messageType, actorType.getSimpleName), null)
}
private def messageRouter()(implicit producer : ActorProducer): ActorRef =
actorRef(classOf[ODataMessageRouter])
private def actorRef(actorType: Class[_ <: Actor])(implicit producer: ActorProducer): ActorRef = {
producer.actorRef(actorType.getSimpleName)
}
def routeMessage(actorProducer: ActorProducer, context: ActorContext, message: ODataActorMessage) {
logger.debug(s"Routing message: $message")
val messageType = message.getClass
if (contains(messageType)) {
get(messageType).foreach {
beanName =>
logger.debug(s"Sending message to: $beanName")
actorProducer.tell(beanName, message, context.self, context)
}
} else {
logger.warn(s"No handler registered for message type: $messageType")
}
}
}
|
{
"content_hash": "bab8795fd2487e7b39756ac7f4a65c65",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 129,
"avg_line_length": 35.31818181818182,
"alnum_prop": 0.7425997425997426,
"repo_name": "sdl/odata",
"id": "c555baad6e2bc03cbb0539cc54bc95e516aee817",
"size": "2236",
"binary": false,
"copies": "1",
"ref": "refs/heads/dependabot/maven/org.springframework-spring-core-5.3.19",
"path": "odata_service/src/main/scala/com/sdl/odata/service/util/AkkaUtil.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "692"
},
{
"name": "Java",
"bytes": "1648171"
},
{
"name": "Scala",
"bytes": "348605"
},
{
"name": "Shell",
"bytes": "3090"
}
],
"symlink_target": ""
}
|
using System;
using CoreGraphics;
using UIKit;
using ZXing.Mobile;
namespace MonoTouch.Dialog
{
public partial class ScanCodeController : UIViewController
{
public ScanCodeController() : base("ScanCodeController", null)
{
}
public async override void ViewDidLoad()
{
MobileBarcodeScanner _scanner = new MobileBarcodeScanner(this);
CustomOverlayScanner overlay = new CustomOverlayScanner(new CGRect(0, 0, View.Frame.Width, View.Frame.Height), "", "", "Cancel", "Flash", () =>
{
_scanner.Cancel();
},
() => {
_scanner.Torch(!_scanner.IsTorchOn);
});
_scanner.UseCustomOverlay = true;
_scanner.CustomOverlay = overlay;
_scanner.AutoFocus();
// _scanner.Torch(false);
MobileBarcodeScanningOptions option = new MobileBarcodeScanningOptions();
option.TryHarder = true;
option.TryInverted = true;
var result = await _scanner.Scan(option);
if (result != null)
{
OnSendResponse(result.Text);
BeginInvokeOnMainThread(() =>
{
if (this.NavigationController != null)
this.NavigationController.PopViewController(true);
});
}
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
public event EventHandler<StringEventArgs> SendResponse;
private void OnSendResponse(string scanResult)
{
if (SendResponse != null)
{
SendResponse(this, new StringEventArgs { ScannerResult = scanResult });
}
}
public override void ViewDidDisappear(bool animated)
{
BeginInvokeOnMainThread(() => NavigationController.PopViewController(true));
base.ViewDidDisappear(animated);
}
public class StringEventArgs : EventArgs
{
public string ScannerResult { get; set; }
}
}
}
|
{
"content_hash": "db9dd1e451d88fd8e140e2184f93758a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 155,
"avg_line_length": 32.229729729729726,
"alnum_prop": 0.5551362683438155,
"repo_name": "ClusterReplyBUS/MonoTouch.Dialog",
"id": "e6f254dcce0e2d5c58b76a1e8254804665864732",
"size": "2387",
"binary": false,
"copies": "1",
"ref": "refs/heads/unified",
"path": "MonoTouch.Dialog-unified/Elements/Custom/ScanCodeController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "326392"
},
{
"name": "Makefile",
"bytes": "71"
}
],
"symlink_target": ""
}
|
package blkidx
import (
"crypto"
"hash"
"io"
)
type Hasher interface {
io.Writer
// the first return value is the hash of all data that has been written to this Hasher.
// the second return value are the hashes of each block that has been written to this Hasher.
Finish() ([]byte, [][]byte)
}
type hasher struct {
all hash.Hash
block hash.Hash
blockSize int
blockRem int
blocks [][]byte
}
var _ Hasher = (*hasher)(nil)
func NewHasher(algorithm crypto.Hash, blockSize int) Hasher {
return &hasher{
all: algorithm.New(),
block: algorithm.New(),
blockSize: blockSize,
blockRem: blockSize,
blocks: make([][]byte, 0, 8),
}
}
func (h *hasher) Write(p []byte) (n int, err error) {
n = len(p)
h.all.Write(p)
for {
if h.blockRem == 0 {
h.finishBlock()
}
if h.blockRem >= len(p) {
h.block.Write(p)
h.blockRem -= len(p)
break
}
h.block.Write(p[:h.blockRem])
p = p[h.blockRem:]
h.finishBlock()
}
return
}
func (h *hasher) finishBlock() {
if h.blockRem == h.blockSize {
return
}
var blockHash []byte = h.block.Sum(nil)
h.blocks = append(h.blocks, blockHash)
h.block.Reset()
h.blockRem = h.blockSize
}
func (h *hasher) Finish() ([]byte, [][]byte) {
h.finishBlock()
return h.all.Sum(nil), h.blocks
}
|
{
"content_hash": "ac98d9679a923f30d11d169e46966afa",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 94,
"avg_line_length": 17.575342465753426,
"alnum_prop": 0.6344505066250974,
"repo_name": "PhiCode/blkidx",
"id": "59a35749306b4993c85022ed7a468d6ca74bb759",
"size": "1283",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hasher.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "33476"
},
{
"name": "Shell",
"bytes": "1237"
}
],
"symlink_target": ""
}
|
import React, {Component, PropTypes} from 'react';
import {connect as connectCSSUtils} from 'react-css-utils';
import * as MaterialIcons from 'react-icons/lib/md';
import View from './View';
@connectCSSUtils({}, {})
export default class Icon extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
fill: PropTypes.string.isRequired
};
static defaultProps = {
fill: 'base'
};
render() {
const {name, ...other} = this.props;
const Component = MaterialIcons[name];
return (
<View display='flex' {...other}>
<Component size='20' />
</View>
);
}
}
|
{
"content_hash": "8ed54162890ab20ab2a6e2205cc70be6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 59,
"avg_line_length": 21.1,
"alnum_prop": 0.631911532385466,
"repo_name": "lingard/react-css-utils",
"id": "a4464204546f66e07e6b65609b86e6c0e1384385",
"size": "633",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/css-modules/components/Icon.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "9407"
}
],
"symlink_target": ""
}
|
var CompositeDisposable = require('atom').CompositeDisposable;
var copyWithSyntax = require('./copy-with-syntax');
var subscriptions;
module.exports = {
activate() {
subscriptions = new CompositeDisposable();
subscriptions.add(atom.commands.add('atom-workspace', 'copy-with-syntax:copy', copyWithSyntax));
},
deactivate() {
subscriptions.dispose();
},
};
|
{
"content_hash": "f24c05699a1fe53ff704c17060bcf08e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 100,
"avg_line_length": 25.2,
"alnum_prop": 0.708994708994709,
"repo_name": "frantic/copy-with-syntax",
"id": "99219490240f6d4a4e0eab7212874991d8e80205",
"size": "378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "204"
},
{
"name": "JavaScript",
"bytes": "3881"
}
],
"symlink_target": ""
}
|
module Neo4j
class Paginated
include Enumerable
attr_reader :items, :total, :current_page
def initialize(items, total, current_page)
@items, @total, @current_page = items, total, current_page
end
def self.create_from(source, page, per_page, order = nil)
target = source.node_var || source.identity
partial = source.skip((page - 1) * per_page).limit(per_page)
ordered_partial, ordered_source = if order
[partial.order_by(order), source.query.with("#{target} as #{target}").pluck("COUNT(#{target})").first]
else
[partial, source.count]
end
Paginated.new(ordered_partial, ordered_source, page)
end
delegate :each, to: :items
delegate :pluck, to: :items
delegate :size, :[], to: :items
end
end
|
{
"content_hash": "fa64e6b1e1702cc6c1e1c0720cf08f51",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 144,
"avg_line_length": 37.08,
"alnum_prop": 0.5458468176914779,
"repo_name": "takabes00/neo4j-ruby",
"id": "237cb1a26f2634e39deffc23881a5cc6040cc3e7",
"size": "927",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/neo4j/paginated.rb",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1928"
},
{
"name": "CoffeeScript",
"bytes": "422"
},
{
"name": "Erlang",
"bytes": "495"
},
{
"name": "HTML",
"bytes": "7675"
},
{
"name": "JavaScript",
"bytes": "664"
},
{
"name": "Perl",
"bytes": "30232"
},
{
"name": "Ruby",
"bytes": "420438"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (c) 2016-2022 Armel Soro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<resources>
<string name="maoni_app_name">Maoni Demo</string>
<string name="maoni_settings_activity_name">Maoni Demo Settings</string>
<string name="feedback">Feedback</string>
<string name="title_activity_maoni_sample_main">Maoni Demo</string>
<string name="main_activity_text"><![CDATA[
This is a demo application for Maoni, a lightweight library which provides
a ready-to-use Material-ized activity for collecting user feedbacks from within an existing app.
\n
Unlike other similar libraries, Maoni allows to capture a screenshot of the current activity,
which you may manipulate in your callbacks.
\n\n
Touch the Floating Action Button below to open the Maoni activity.
\n\n
Please navigate to http://github.com/rm3l/maoni for further instructions.
]]></string>
<string name="action_about">About</string>
<string name="default_email_addr">some.one@somewhe.re</string>
<string name="send_feedback_activity_title">Send Feedback</string>
<string name="send_feedback_activity_intro"><![CDATA[
Hey! Love this app? We would love to hear from you.
\n\n
Note: Almost everything in Maoni is customizable.
]]></string>
<string name="feedback_content_hint">Please write your valuable feedback here.</string>
<string name="include_app_logs">Attach application logs</string>
<string name="include_app_screenshot">Attach screen capture</string>
<string name="touch_edit_screenshot">Touch to preview and annotate</string>
<string name="content_error_message">This is a custom error message, which you can have displayed to your users</string>
<string name="screenshot_hint">This is a custom message, which you can have displayed next to the screen capture to explain why it might be of great help.</string>
<string name="email_address">Email address</string>
<string name="an_extra_text_area">An extra text area</string>
<string name="edittext_hint_write_something_here">EditText hint. Write something here.</string>
<string name="an_extra_radiogroup">An extra RadioGroup</string>
<string name="rg_1">RG 1</string>
<string name="rg_2">RG 2</string>
<string name="rg_3">RG 3</string>
<string name="send_maoni_email">Send via email (maoni-email)</string>
<string name="send_maoni_github">Send as Github issue (maoni-github)</string>
<string name="send_maoni_jira">Send as JIRA issue (maoni-jira)</string>
<string name="send_maoni_slack">"Send to Slack (maoni-slack)"</string>
<string name="how_to_send_feedback">How would you like to send your feedback?</string>
<string name="action_settings">Settings</string>
<string name="action_bottom_sheet">Bottom Sheet</string>
</resources>
|
{
"content_hash": "8e2daacf87a878fbaf5b9982287eaba9",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 167,
"avg_line_length": 57.30882352941177,
"alnum_prop": 0.7308185783936362,
"repo_name": "rm3l/maoni",
"id": "ab71d3f3650c0b2d52994730cc8de01579f08ce8",
"size": "3897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "maoni-sample/src/main/res/values/strings.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "157718"
},
{
"name": "Kotlin",
"bytes": "48573"
},
{
"name": "Shell",
"bytes": "6081"
}
],
"symlink_target": ""
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
using XSerialization.Attributes;
using XSerialization.Decorators;
using XSerialization.ExternalResolvers;
using XSerialization.Values;
namespace XSerialization
{
/// <summary>
/// This class is used to serialize/deserialize object from XElement.
/// </summary>
public class XSerializer : IXSerializationContext
{
#region Fields
/// <summary>
/// This field stores all the errors.
/// </summary>
protected readonly List<XSerializationError> mErrors = new List<XSerializationError>();
/// <summary>
/// Stores all the serialization context parameters
/// </summary>
private readonly Hashtable mSerializationContextParameters = new Hashtable();
/// <summary>
/// This field stores the current objects.
/// </summary>
private readonly Stack<object> mCurrentObjects = new Stack<object>();
/// <summary>
/// This field stores the object references by reference.
/// </summary>
private readonly Dictionary<int, object> mObjectReferencesByRef = new Dictionary<int, object>();
/// <summary>
/// This field stores the object references by object.
/// </summary>
private readonly Dictionary<object, int> mObjectReferencesByObj = new Dictionary<object, int>(new ObjectRefEqualityComparer());
/// <summary>
/// This field stores the XElement by type.
/// </summary>
protected readonly Dictionary<Type, XElement> mElementsByType = new Dictionary<Type, XElement>();
/// <summary>
/// This field stores the type references by reference.
/// </summary>
protected readonly Dictionary<string, Type> mTypeReferencesByRef = new Dictionary<string, Type>();
/// <summary>
/// This field stores the type references by type.
/// </summary>
protected readonly Dictionary<Type, string> mTypeReferencesByType = new Dictionary<Type, string>();
/// <summary>
/// This field stores the current directory.
/// </summary>
private DirectoryInfo mCurrentDirectory;
/// <summary>
/// The reference counter.
/// </summary>
private int mReferenceCounter;
/// <summary>
/// The reference counter.
/// </summary>
private int mTypeReferenceCounter;
/// <summary>
/// The list of all contracts that can be used by the serializer.
/// </summary>
private readonly List<IXSerializationContract> mContracts = new List<IXSerializationContract>();
/// <summary>
/// This field stores the null contract.
/// </summary>
private readonly NullValueSerializationContract mNullContract;
#endregion // Fields.
#region Events
/// <summary>
/// Fired each time an error gets raised on this serializer.
/// </summary>
public event Action<XSerializationError> ErrorRaised;
#endregion
#region Properties
/// <summary>
/// Gets the errors occured during serialization or deserialization.
/// </summary>
public IEnumerable<XSerializationError> Errors
{
get { return this.mErrors; }
}
/// <summary>
/// Gets the current object.
/// </summary>
public object CurrentObject
{
get
{
if (this.mCurrentObjects.Any())
{
return this.mCurrentObjects.Peek();
}
return null;
}
}
/// <summary>
/// Gets the current directory.
/// </summary>
public DirectoryInfo CurrentDirectory
{
get { return this.mCurrentDirectory; }
}
/// <summary>
/// Gets the external reference resolver.
/// </summary>
public IXExternalReferenceResolver ExternalReferenceResolver
{
get;
private set;
}
/// <summary>
/// Gets the flag to know if the serializer is writing or not.
/// </summary>
public bool IsWriting
{
get;
private set;
}
/// <summary>
/// Gets the current URI file.
/// </summary>
public Uri CurrentFile
{
get;
private set;
}
/// <summary>
/// Gets the type of the internal reference excluded.
/// </summary>
/// <value>
/// The type of the internal reference excluded.
/// </value>
internal List<String> InternalReferenceExcludedType
{
get;
private set;
}
#endregion // Properties.
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="XSerializer"/> class.
/// </summary>
/// <param name="pExternalReferenceResolver">An external reference resolver.</param>
/// <param name="pDiscoverContracts">Set to true to discovert new contracts.</param>
public XSerializer(IXExternalReferenceResolver pExternalReferenceResolver = null, bool pDiscoverContracts = true)
{
if (pExternalReferenceResolver == null)
{
this.ExternalReferenceResolver = new DefaultExternalReferenceResolver();
}
else
{
this.ExternalReferenceResolver = pExternalReferenceResolver;
}
this.InternalReferenceExcludedType = new List<string>();
if (pDiscoverContracts)
{
foreach (var lContract in SerializationContractManager.Instance.Contracts)
{
this.mContracts.Add(lContract);
}
}
this.mNullContract = SerializationContractManager.Instance.Contracts.FirstOrDefault(pElt => pElt is NullValueSerializationContract) as NullValueSerializationContract;
}
#endregion // Constructors.
#region Methods
/// <summary>
/// Registers a type which will be excluded from the internal refrences mechanism.
/// </summary>
/// <param name="pTypeFullName">Full name of the type to exclude.</param>
public virtual void RegisterInternalReferenceExcludedType(string pTypeFullName)
{
if (!this.InternalReferenceExcludedType.Contains(pTypeFullName))
{
this.InternalReferenceExcludedType.Add(pTypeFullName);
}
}
/// <summary>
/// This method deserializes a XElement into an object.
/// </summary>
/// <param name="pElement">The element to deserialize.</param>
/// <returns>The created object, null if the deserialization failed.</returns>
public virtual object Deserialize(XElement pElement)
{
this.IsWriting = false;
this.mErrors.Clear();
XElement lTypeContainerElement = pElement.Element(XConstants.TYPE_CONTAINER_TAG);
if (lTypeContainerElement != null)
{
this.ReadTypeContainer(lTypeContainerElement);
}
XElement lTypeElement = pElement.Element(XConstants.TYPE_TAG);
if (lTypeElement != null)
{
IXSerializationContract lContract = this.SelectContract(pElement, this.ResolveType(lTypeElement));
if (lContract != null)
{
if (this.mCurrentDirectory == null)
{
this.mCurrentDirectory = new DirectoryInfo(Environment.CurrentDirectory);
}
object lObject = null;
SerializationContractDecorator lDecoratorContract = lContract as SerializationContractDecorator;
if (lDecoratorContract != null && lDecoratorContract.NeedCreate)
{
// The decorator read method will handle the object creation.
lObject = lContract.Read(lObject, pElement, this);
}
else
{
// Forcing the object creation.
lObject = lContract.Create(pElement, this);
lObject = lContract.Read(lObject, pElement, this);
}
return lObject;
}
}
IXmlLineInfo lInfo = pElement;
this.PushError(new XSerializationError(XErrorType.UnkwnonType, lInfo.LineNumber, lInfo.LinePosition, this.CurrentFile, string.Empty));
return null;
}
/// <summary>
/// This method deserializes a XElement into an object.
/// </summary>
/// <param name="pInputFilename">The input filename.</param>
/// <returns>The created object, null if the deserialization failed.</returns>
public virtual object Deserialize(string pInputFilename)
{
try
{
FileInfo lFileInfo = new FileInfo(pInputFilename);
this.CurrentFile = new Uri(lFileInfo.FullName);
this.mCurrentDirectory = lFileInfo.Directory;
XElement lElement = XElement.Load(pInputFilename);
return this.Deserialize(lElement);
}
catch (XmlException lException)
{
this.PushError(new XSerializationError(XErrorType.InvalidXml, lException.LineNumber, lException.LinePosition, this.CurrentFile, lException.SourceUri));
}
return null;
}
/// <summary>
/// This method serializes an object into an XElement and dump it into a file.
/// </summary>
/// <param name="pObjectToSerialize">The object to serialize.</param>
/// <param name="pOutputFilename">The output filename.</param>
/// <returns>A valid XElement if the serialization succeed, null otherwise.</returns>
public virtual XElement Serialize(object pObjectToSerialize, string pOutputFilename)
{
FileInfo lFileInfo = new FileInfo(pOutputFilename);
this.CurrentFile = new Uri(lFileInfo.FullName);
this.mCurrentDirectory = lFileInfo.Directory;
XElement lElement = this.Serialize(pObjectToSerialize);
if (lElement != null)
{
lElement.Save(pOutputFilename);
return lElement;
}
return null;
}
/// <summary>
/// This method serializes an object into an XElement and dump it to a stream.
/// </summary>
/// <param name="pObjectToSerialize">The object to serialize.</param>
/// <param name="pOutputStream">The output stream.</param>
/// <returns>A valid XElement if the serialization succeed, null otherwise.</returns>
public virtual XElement Serialize(object pObjectToSerialize, Stream pOutputStream)
{
FileStream lFileStream = pOutputStream as FileStream;
if (lFileStream != null)
{
this.CurrentFile = new Uri(lFileStream.Name);
}
XElement lElement = this.Serialize(pObjectToSerialize);
if (lElement != null)
{
lElement.Save(pOutputStream);
return lElement;
}
return null;
}
/// <summary>
/// This method serializes an object into an XElement.
/// </summary>
/// <param name="pObjectToSerialize">The object to serialize.</param>
/// <returns>A valid XElement if the serialization succeed, null otherwise.</returns>
public virtual XElement Serialize(object pObjectToSerialize)
{
this.IsWriting = true;
this.mErrors.Clear();
XElement lParentElement = new XElement(XConstants.ROOT_TAG);
IXSerializationContract lContract = this.SelectContract(null, null, null, pObjectToSerialize);
if (lContract != null)
{
if (this.mCurrentDirectory == null)
{
this.mCurrentDirectory = new DirectoryInfo(Environment.CurrentDirectory);
}
// Write the object.
lContract.Write(pObjectToSerialize, lParentElement, this);
XElement lTypeContainerElement = new XElement(XConstants.TYPE_CONTAINER_TAG);
foreach (KeyValuePair<Type, XElement> lTypeInfo in this.mElementsByType)
{
lTypeInfo.Value.SetAttributeValue(XConstants.TYPE_REF_ATTRIBUTE, this.mTypeReferencesByType[lTypeInfo.Key]);
lTypeContainerElement.Add(lTypeInfo.Value);
}
lParentElement.AddFirst(lTypeContainerElement);
return lParentElement;
}
return null;
}
/// <summary>
/// This method pushes the object.
/// </summary>
/// <param name="pObject">The object to push as current</param>
/// <param name="pObjectReference">The object reference. -1 means the object reference will be fixed by the context.</param>
public virtual void PushObject(object pObject, int pObjectReference)
{
this.mCurrentObjects.Push(pObject);
// Auto-compute the object reference (generally during writing).
if (this.mObjectReferencesByObj.ContainsKey(pObject) == false && pObjectReference == XConstants.SYSTEM_REFERENCE)
{
this.mObjectReferencesByRef.Add(mReferenceCounter, pObject);
this.mObjectReferencesByObj.Add(pObject, mReferenceCounter);
this.mReferenceCounter++;
}
else if (this.mObjectReferencesByObj.ContainsKey(pObject) == false && pObjectReference != XConstants.NO_REFERENCED_OBJECT && this.mObjectReferencesByRef.ContainsKey(pObjectReference) == false)
{
this.mObjectReferencesByRef.Add(pObjectReference, pObject);
this.mObjectReferencesByObj.Add(pObject, pObjectReference);
}
}
/// <summary>
/// This method pushes the object.
/// </summary>
/// <param name="pError">The error to add.</param>
public virtual void PushError(XSerializationError pError)
{
this.mErrors.Add(pError);
if (this.ErrorRaised != null)
{
this.ErrorRaised(pError);
}
}
/// <summary>
/// This method pops the object.
/// </summary>
public virtual void PopObject()
{
this.mCurrentObjects.Pop();
}
/// <summary>
/// Gets the object reference identifier.
/// </summary>
/// <param name="pObjectReference">The object reference.</param>
/// <returns>The object if retrieved, null otherwise.</returns>
public virtual object GetObjectByReference(int pObjectReference)
{
if (this.mObjectReferencesByRef.ContainsKey(pObjectReference))
{
return this.mObjectReferencesByRef[pObjectReference];
}
return null;
}
/// <summary>
/// Gets the object reference identifier.
/// </summary>
/// <param name="pObject">The object to test.</param>
/// <returns>The object identifier or -1 if the object has no reference.</returns>
public virtual int GetObjectReference(object pObject)
{
if (this.mObjectReferencesByObj.ContainsKey(pObject))
{
return this.mObjectReferencesByObj[pObject];
}
return XConstants.NOT_YET_REFERENCED_OBJECT;
}
/// <summary>
/// This method is used to revolve a type inside a serializer.
/// </summary>
/// <param name="pTypeElement">The type element.</param>
/// <returns>The retrieved type.</returns>
public virtual Type ResolveType(XElement pTypeElement)
{
if (pTypeElement != null)
{
if (pTypeElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE) != null)
{
string lTypeRef = pTypeElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE).Value;
if (this.mTypeReferencesByRef.ContainsKey(lTypeRef))
{
return this.mTypeReferencesByRef[lTypeRef];
}
}
return pTypeElement.ToType();
}
return null;
}
/// <summary>
/// This method is used to revolve a type inside a serializer.
/// </summary>
/// <param name="pType">The type to store.</param>
/// <returns>The retrieved type.</returns>
public virtual XElement ReferenceType(Type pType)
{
string lTypeRef = string.Empty;
if (this.mElementsByType.ContainsKey(pType) == false)
{
lTypeRef = string.Format("type_{0}", this.mTypeReferenceCounter);
this.mTypeReferenceCounter++;
this.mElementsByType.Add(pType, pType.ToElement());
this.mTypeReferencesByRef.Add(lTypeRef, pType);
this.mTypeReferencesByType.Add(pType, lTypeRef);
}
else
{
lTypeRef = this.mTypeReferencesByType[pType];
}
XElement lRefTypeElement = new XElement(XConstants.TYPE_TAG);
lRefTypeElement.SetAttributeValue(XConstants.TYPE_REF_ATTRIBUTE, lTypeRef);
return lRefTypeElement;
}
/// <summary>
/// This method is used to select the contract according the best contract.
/// </summary>
/// <param name="pElement">The current element.</param>
/// <param name="pObject">The object can be a property info, a type or a value.</param>
/// <returns>The best contract according to constraints.</returns>
public virtual IXSerializationContract SelectContract(XElement pElement, object pObject)
{
Type lType = pObject as Type;
PropertyInfo lPropertyInfo = pObject as PropertyInfo;
Object lValue = null;
if (lPropertyInfo == null && lType == null)
{
lValue = pObject;
}
return this.SelectContract(pElement, lPropertyInfo, lType, lValue);
}
/// <summary>
/// This method is used to select the contract according contraints.
/// </summary>
/// <param name="pElement">The current element.</param>
/// <param name="pPropertyInfo">The current property info.</param>
/// <param name="pType">The current type.</param>
/// <param name="pObject">The current object.</param>
/// <returns>The best contract according to constraints.</returns>
public virtual IXSerializationContract SelectContract(XElement pElement, PropertyInfo pPropertyInfo, Type pType, object pObject)
{
XSerializationAttribute lCurrentAttribute = null;
List<Tuple<IXSerializationContract, SupportPriority>> lAvailableContracts = new List<Tuple<IXSerializationContract, SupportPriority>>();
if (pElement != null)
{
Tuple<IXSerializationContract, SupportPriority> lElementContract = this.FindContract(pElement);
if (lElementContract != null)
{
lAvailableContracts.Add(lElementContract);
}
}
if (pPropertyInfo != null)
{
object[] lAttributes = pPropertyInfo.GetCustomAttributes(typeof (XSerializationAttribute), true);
if (lAttributes.Any())
{
Tuple<IXSerializationContract, SupportPriority> lAttributeContract = this.FindContract(lAttributes[0]);
if (lAttributeContract != null)
{
lCurrentAttribute = lAttributes[0] as XSerializationAttribute;
lAvailableContracts.Add(lAttributeContract);
}
}
// Look for a contract on the type.
if (lCurrentAttribute == null)
{
Tuple<IXSerializationContract, SupportPriority> lObjectContract = this.FindContract(pPropertyInfo);
if (lObjectContract != null)
{
lAvailableContracts.Add(lObjectContract);
}
}
}
if (pType != null)
{
Tuple<IXSerializationContract, SupportPriority> lTypeContract = this.FindContract(pType);
if (lTypeContract != null)
{
lAvailableContracts.Add(lTypeContract);
}
}
if (pObject != null)
{
Tuple<IXSerializationContract, SupportPriority> lObjectContract = this.FindContract(pObject);
if (lObjectContract != null)
{
lAvailableContracts.Add(lObjectContract);
}
}
if (lAvailableContracts.Any())
{
var lFirstOrDefault = lAvailableContracts.OrderBy(pElt => pElt.Item2).FirstOrDefault();
if (lFirstOrDefault != null)
{
IXSerializationContract lBestContract = lFirstOrDefault.Item1;
if (lBestContract is AttributeSerializationContract && lCurrentAttribute != null)
{
AttributeSerializationContract lDynamicContract = new AttributeSerializationContract();
lDynamicContract.SubContract = Activator.CreateInstance(lCurrentAttribute.SupportedContract, true) as IXSerializationContract;
return lDynamicContract;
}
return new SerializationContractDecorator(lBestContract, this);
}
}
return this.mNullContract;
}
/// <summary>
/// This method get a serialization parameter by name
/// </summary>
/// <typeparam name="TType">The serialization parameter type to return</typeparam>
/// <param name="pParameterName">The serialization parameter name</param>
/// <param name="pIsFound">Return whether it found the parameter or not</param>
/// <returns>The serialization parameter</returns>
public virtual TType GetSerializationParameter<TType>(string pParameterName, out bool pIsFound) where TType : struct
{
if
( this.mSerializationContextParameters.ContainsKey( pParameterName ) )
{
pIsFound = true;
return (TType)this.mSerializationContextParameters[ pParameterName ];
}
pIsFound = false;
return default( TType );
}
/// <summary>
/// This method set a serialization parameter that will be indexed by the supplied name
/// </summary>
/// <typeparam name="TType">The serialization parameter type</typeparam>
/// <param name="pParameterName">The serialization parameter name</param>
/// <param name="pParameter">The serialization parameter</param>
public virtual void SetSerializationParameter<TType>(string pParameterName, TType pParameter) where TType : struct
{
this.mSerializationContextParameters[ pParameterName ] = pParameter;
}
/// <summary>
/// This method is used to add a contact for this serializer only.
/// </summary>
/// <param name="pContract">The contract to add.</param>
public virtual bool AddContract(IXSerializationContract pContract)
{
this.mContracts.Add(pContract);
return true;
}
/// <summary>
/// This method is used to add a contact for this serializer only.
/// </summary>
/// <param name="pContract">The contract to add.</param>
public virtual bool RemoveContract(IXSerializationContract pContract)
{
return this.mContracts.Remove(pContract);
}
/// <summary>
/// This method is used to read all types under element "XTypeContainer"
/// </summary>
/// <param name="pTypeContainer">The root element.</param>
/// <returns>The number of discovered types.</returns>
protected virtual int ReadTypeContainer(XElement pTypeContainer)
{
this.ClearTypeContainers();
foreach (XElement lTypeRefElement in pTypeContainer.Elements())
{
if (lTypeRefElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE) != null)
{
string lTypeRef = lTypeRefElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE).Value;
Type lResolvedType = lTypeRefElement.ToType();
if (lResolvedType != null)
{
this.mTypeReferencesByRef.Add(lTypeRef, lResolvedType);
this.mTypeReferencesByType.Add(lResolvedType, lTypeRef);
this.mElementsByType.Add(lResolvedType, lTypeRefElement);
}
}
}
return this.mTypeReferencesByRef.Count;
}
/// <summary>
/// Clears all cached types of the serializer containers.
/// </summary>
protected virtual void ClearTypeContainers()
{
this.mTypeReferencesByRef.Clear();
this.mTypeReferencesByType.Clear();
this.mElementsByType.Clear();
}
/// <summary>
/// This method finds a serialization contract.
/// </summary>
/// <param name="pObject">The object to test.</param>
/// <returns>The most suited serialization contract, null if there is no contract which supports the object.</returns>
private Tuple<IXSerializationContract, SupportPriority> FindContract(object pObject)
{
List<Tuple<IXSerializationContract, SupportPriority>> lAvailableContracts = new List<Tuple<IXSerializationContract, SupportPriority>>();
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (IXSerializationContract lContract in this.mContracts)
{
SupportPriority lPriority = lContract.CanManage(pObject, this);
if (lPriority != null && lPriority != SupportPriority.CANNOT_SUPPORT)
{
lAvailableContracts.Add(new Tuple<IXSerializationContract, SupportPriority>(lContract, lPriority));
}
}
if (lAvailableContracts.Any())
{
// ReSharper disable once PossibleNullReferenceException
return lAvailableContracts.OrderBy(pElt => pElt.Item2).FirstOrDefault();
}
return null;
}
/// <summary>
/// This method finds a serialization contract.
/// </summary>
/// <param name="pType">The target type.</param>
/// <returns>The best matching contract.</returns>
private Tuple<IXSerializationContract, SupportPriority> FindContract(Type pType)
{
List<Tuple<IXSerializationContract, SupportPriority>> lAvailableContracts = new List<Tuple<IXSerializationContract, SupportPriority>>();
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (IXSerializationContract lContract in this.mContracts)
{
SupportPriority lPriority = lContract.CanManage(pType, this);
if (lPriority != null && lPriority != SupportPriority.CANNOT_SUPPORT)
{
lAvailableContracts.Add(new Tuple<IXSerializationContract, SupportPriority>(lContract, lPriority));
}
}
if (lAvailableContracts.Any())
{
// ReSharper disable once PossibleNullReferenceException
return lAvailableContracts.OrderBy(pElt => pElt.Item2).FirstOrDefault();
}
return null;
}
/// <summary>
/// This method finds a serialization contract.
/// </summary>
/// <param name="pElement">The target element.</param>
/// <returns>The best matching contract.</returns>
private Tuple<IXSerializationContract, SupportPriority> FindContract(XElement pElement)
{
List<Tuple<IXSerializationContract, SupportPriority>> lAvailableContracts = new List<Tuple<IXSerializationContract, SupportPriority>>();
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (IXSerializationContract lContract in this.mContracts)
{
SupportPriority lPriority = lContract.CanManage(pElement, this);
if (lPriority != null && lPriority != SupportPriority.CANNOT_SUPPORT)
{
lAvailableContracts.Add(new Tuple<IXSerializationContract, SupportPriority>(lContract, lPriority));
}
}
if (lAvailableContracts.Any())
{
// ReSharper disable once PossibleNullReferenceException
return lAvailableContracts.OrderBy(pElt =>pElt.Item2).FirstOrDefault();
}
return null;
}
#endregion // Methods.
}
}
|
{
"content_hash": "f7d5041ee8cd5b0d54269a6d83152afe",
"timestamp": "",
"source": "github",
"line_count": 761,
"max_line_length": 204,
"avg_line_length": 39.72141918528252,
"alnum_prop": 0.5767169511710997,
"repo_name": "mastertnt/XRay",
"id": "82805f8820c1583fa05ef3256052bcd472edc3b4",
"size": "30230",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "XSerialization/XSerializer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1634341"
}
],
"symlink_target": ""
}
|
package com.massivcode.example.simplepermissionnotice;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.massivcode.simplepermissionnotice.SimplePermissionNotice;
import com.massivcode.simplepermissionnotice.SimplePermissionNoticeCallback;
public class MainActivity extends AppCompatActivity {
private SimplePermissionNotice mNotice = SimplePermissionNotice.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn1).setOnClickListener(mOnActivityButtonClickListener);
findViewById(R.id.btn2).setOnClickListener(mOnDialogShowButtonClickListener);
}
private View.OnClickListener mOnActivityButtonClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
mNotice.showActivity(MainActivity.this, new SimplePermissionNoticeCallback() {
@Override
public void onGranted() {
}
@Override
public void onDismiss(String[] strings, String[] strings1, String[] strings2) {
}
@Override
public void onUnderMarshmallow() {
}
});
}
};
private View.OnClickListener mOnDialogShowButtonClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
mNotice.showDialog(MainActivity.this, new SimplePermissionNoticeCallback() {
@Override
public void onGranted() {
}
@Override
public void onDismiss(String[] strings, String[] strings1, String[] strings2) {
}
@Override
public void onUnderMarshmallow() {
}
});
}
};
}
|
{
"content_hash": "17d8092c1d6913ee5daf8cec4807b515",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 94,
"avg_line_length": 26.46268656716418,
"alnum_prop": 0.7084038353073886,
"repo_name": "prChoe/SimplePermissionNotice",
"id": "f96092402edafb0d0b169902db5da1db886be5c9",
"size": "1773",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/massivcode/example/simplepermissionnotice/MainActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "53659"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Mon Aug 26 23:19:26 WST 2013 -->
<title>Z-Index</title>
<meta name="date" content="2013-08-26">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Z-Index";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../person/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="../person/package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-7.html">Prev Letter</a></li>
<li>Next Letter</li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-8.html" target="_top">Frames</a></li>
<li><a href="index-8.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="contentContainer"><a href="index-1.html">A</a> <a href="index-2.html">C</a> <a href="index-3.html">D</a> <a href="index-4.html">F</a> <a href="index-5.html">L</a> <a href="index-6.html">P</a> <a href="index-7.html">S</a> <a href="index-8.html">Z</a> <a name="_Z_">
<!-- -->
</a>
<h2 class="title">Z</h2>
<dl>
<dt><span class="strong"><a href="../person/Person.html#zipCode">zipCode</a></span> - Variable in class person.<a href="../person/Person.html" title="class in person">Person</a></dt>
<dd>
<div class="block">Stores <code>String</code> value of the zip code of the address of the person.</div>
</dd>
</dl>
<a href="index-1.html">A</a> <a href="index-2.html">C</a> <a href="index-3.html">D</a> <a href="index-4.html">F</a> <a href="index-5.html">L</a> <a href="index-6.html">P</a> <a href="index-7.html">S</a> <a href="index-8.html">Z</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../person/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="../person/package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-7.html">Prev Letter</a></li>
<li>Next Letter</li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-8.html" target="_top">Frames</a></li>
<li><a href="index-8.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
{
"content_hash": "c3f5302267b4c8ad1e7799cc3f91cdc0",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 316,
"avg_line_length": 35.141666666666666,
"alnum_prop": 0.6182119990514584,
"repo_name": "PhilDatoon/CertIV_IntroOOP",
"id": "5a2b7879fdf3a174820991d61b39a50276c214b0",
"size": "4217",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PortfolioActivity13/doc/index-files/index-8.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "22278"
},
{
"name": "Java",
"bytes": "89457"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Thu Mar 26 16:48:37 UTC 2015 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class com.hazelcast.cluster.impl.operations.MasterClaimOperation (Hazelcast Root 3.4.2 API)
</TITLE>
<META NAME="date" CONTENT="2015-03-26">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.hazelcast.cluster.impl.operations.MasterClaimOperation (Hazelcast Root 3.4.2 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../com/hazelcast/cluster/impl/operations/MasterClaimOperation.html" title="class in com.hazelcast.cluster.impl.operations"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/hazelcast/cluster/impl/operations//class-useMasterClaimOperation.html" target="_top"><B>FRAMES</B></A>
<A HREF="MasterClaimOperation.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>com.hazelcast.cluster.impl.operations.MasterClaimOperation</B></H2>
</CENTER>
No usage of com.hazelcast.cluster.impl.operations.MasterClaimOperation
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../com/hazelcast/cluster/impl/operations/MasterClaimOperation.html" title="class in com.hazelcast.cluster.impl.operations"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/hazelcast/cluster/impl/operations//class-useMasterClaimOperation.html" target="_top"><B>FRAMES</B></A>
<A HREF="MasterClaimOperation.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2015 <a href="http://www.hazelcast.com/">Hazelcast, Inc.</a>. All Rights Reserved.
</BODY>
</HTML>
|
{
"content_hash": "42f75c9b17c3b44cbc23c51f2220d8bd",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 255,
"avg_line_length": 43.97241379310345,
"alnum_prop": 0.6234316185696361,
"repo_name": "akiskip/KoDeMat-Collaboration-Platform-Application",
"id": "0d4cf210b59cd176f85fc5caba8e3e4b7df93e28",
"size": "6376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "KoDeMat_TouchScreen/lib/hazelcast-3.4.2/hazelcast-3.4.2/docs/javadoc/com/hazelcast/cluster/impl/operations/class-use/MasterClaimOperation.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1255"
},
{
"name": "CSS",
"bytes": "12362"
},
{
"name": "GLSL",
"bytes": "105719"
},
{
"name": "HTML",
"bytes": "17271482"
},
{
"name": "Java",
"bytes": "1388877"
},
{
"name": "JavaScript",
"bytes": "110983"
},
{
"name": "Shell",
"bytes": "1365"
}
],
"symlink_target": ""
}
|
/*******************************************************************************
* E.S.O. - ACS project
*
* "@(#) $Id: maciTestRegistrar.cpp,v 1.78 2003/01/16 12:14:29 vltsccm Exp $"
*
* who when what
* -------- ---------- ----------------------------------------------
* msekoran 2002-07-08 created
*/
static char *rcsId="@(#) $Id: maciTestRegistrar.cpp,v 1.78 2003/01/16 12:14:29 vltsccm Exp $";
static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId);
#include <maciRegistrar.h>
#include <stdio.h>
const char *registrarStates[] = {
"The registrar is in a consistent state.", // 0
"Doubly-linked list exceeds the capacity of the registrar;" // 1
"some of its elements are not within the array managed by the registrar.",
"Doubly-linked list is inconsistent (element's next's previous is not the element).", // 2
"An element is in the free element chain, but it is marked as allocated.", // 3
"An element in the allocated element chain, but it is marked as free.", // 4
"The two doubly-linked lists don't span the entire capacity of the registrar." // 5
};
#define CHECK(reg) \
{ \
int result = reg.CheckIntegrity(); \
printf("CHECK: %s\n", registrarStates[result]); \
}
#define ALLOCATE_TEST(h, reg) \
int h = reg.Allocate(); \
reg[h] = h;
#define PREALLOCATE_TEST(h, reg) \
int h = reg.Preallocate(); \
reg[h] = h;
#define DUMP(reg) \
{ \
int h = reg.First(); \
while (h != 0) \
{ \
printf("%d ", reg[h]); \
h = reg.Next(h); \
} \
printf("\n"); \
}
int main(int argc, char *argv[])
{
Registrar<int, int> registry;
CHECK(registry);
ALLOCATE_TEST(h1, registry)
ALLOCATE_TEST(h2, registry)
ALLOCATE_TEST(h3, registry)
registry.Deallocate(h2);
CHECK(registry);
DUMP(registry)
PREALLOCATE_TEST(h4, registry)
registry.AckAllocate(h4);
CHECK(registry);
DUMP(registry)
PREALLOCATE_TEST(h5, registry)
registry.Depreallocate(h5);
CHECK(registry);
DUMP(registry)
PREALLOCATE_TEST(h6, registry)
PREALLOCATE_TEST(h7, registry)
ALLOCATE_TEST(h8, registry)
ALLOCATE_TEST(h9, registry)
ALLOCATE_TEST(h10, registry)
registry.Deallocate(h10);
registry.AckAllocate(h7);
registry.Depreallocate(h6);
CHECK(registry);
DUMP(registry)
PREALLOCATE_TEST(h11, registry)
int i = registry.First();
while (i) i = registry.Deallocate(i);
registry.Depreallocate(h11);
CHECK(registry);
DUMP(registry)
PREALLOCATE_TEST(h12, registry)
ALLOCATE_TEST(h13, registry)
registry.Depreallocate(h12);
CHECK(registry);
DUMP(registry)
registry.Deallocate(13);
PREALLOCATE_TEST(h14, registry)
ALLOCATE_TEST(h15, registry)
registry.AckAllocate(h14);
CHECK(registry);
DUMP(registry)
registry.Deallocate(h14);
registry.Deallocate(h15);
PREALLOCATE_TEST(h20, registry)
PREALLOCATE_TEST(h21, registry)
PREALLOCATE_TEST(h22, registry)
registry.AckAllocate(h20);
PREALLOCATE_TEST(h23, registry)
registry.AckAllocate(h22);
PREALLOCATE_TEST(h24, registry)
PREALLOCATE_TEST(h25, registry)
PREALLOCATE_TEST(h26, registry)
registry.Depreallocate(h21);
PREALLOCATE_TEST(h27, registry)
PREALLOCATE_TEST(h28, registry)
PREALLOCATE_TEST(h29, registry)
registry.AckAllocate(h23);
registry.AckAllocate(h24);
registry.AckAllocate(h26);
registry.Depreallocate(h25);
registry.AckAllocate(h28);
registry.Depreallocate(h27);
registry.AckAllocate(h29);
CHECK(registry);
DUMP(registry)
/*
// unalloved case (should fail)
ALLOCATE_TEST(h30, registry)
registry.AckAllocate(h30);
CHECK(registry);
// this crashes DUMP(registry)
*/
return 0;
}
|
{
"content_hash": "dc9152d8c985e7e94ba0efe7001d3368",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 96,
"avg_line_length": 24.77639751552795,
"alnum_prop": 0.5966407620957633,
"repo_name": "csrg-utfsm/acscb",
"id": "f73089674ea998bc490d3a09a951d341417a66bd",
"size": "3989",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "LGPL/CommonSoftware/maci/ws/test/maciTestRegistrar.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "633"
},
{
"name": "Batchfile",
"bytes": "2346"
},
{
"name": "C",
"bytes": "751150"
},
{
"name": "C++",
"bytes": "7892598"
},
{
"name": "CSS",
"bytes": "21364"
},
{
"name": "Elixir",
"bytes": "906"
},
{
"name": "Emacs Lisp",
"bytes": "1990066"
},
{
"name": "FreeMarker",
"bytes": "7369"
},
{
"name": "GAP",
"bytes": "14867"
},
{
"name": "Gnuplot",
"bytes": "437"
},
{
"name": "HTML",
"bytes": "1857062"
},
{
"name": "Haskell",
"bytes": "764"
},
{
"name": "Java",
"bytes": "13573740"
},
{
"name": "JavaScript",
"bytes": "19058"
},
{
"name": "Lex",
"bytes": "5101"
},
{
"name": "Makefile",
"bytes": "1624406"
},
{
"name": "Module Management System",
"bytes": "4925"
},
{
"name": "Objective-C",
"bytes": "3223"
},
{
"name": "PLSQL",
"bytes": "9496"
},
{
"name": "Perl",
"bytes": "120411"
},
{
"name": "Python",
"bytes": "4191000"
},
{
"name": "Roff",
"bytes": "9920"
},
{
"name": "Shell",
"bytes": "1198375"
},
{
"name": "Smarty",
"bytes": "21615"
},
{
"name": "Tcl",
"bytes": "227078"
},
{
"name": "XSLT",
"bytes": "100454"
},
{
"name": "Yacc",
"bytes": "5006"
}
],
"symlink_target": ""
}
|
<!-- The <systemd-unit-status-sk> custom element declaration.
Attributes:
machine - The name of the machine the service is running on.
service - The systemd name of the service running, such as "logserver.service".
Events:
unit-action - An event triggered when the user wants to perform an action
on the service. The detail of the event has the form:
{
machine: "skia-monitoring",
name: "logserver.service",
action: "start"
}
Methods:
None.
Mailbox:
The element subscribes to the mailbox "<machine>:<service>" and uses that
value to populate the element. The mailbox value is expected to be a
systemd.UnitStatus.
-->
<link rel="stylesheet" href="/res/common/css/md.css" type="text/css" media="all" />
<link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-layout.html"/>
<dom-module id="systemd-unit-status-sk">
<style>
div div {
font-family: monospace;
margin: 0.6em;
margin-right: 2em;
padding: 0.4em 1.2em;
}
#machine {
width: 15em;
}
#service {
width: 15em;
}
#uptime {
width: 4em;
}
#state {
width: 10em;
}
.running {
color: #44AA99;
}
.failed {
color: #CC6677;
}
.halted {
color: #882255;
}
.dead {
color: #D95F02;
}
.exited {
color: #666666;
}
.top {
@apply(--layout-horizontal);
@apply(--layout-wrap);
}
</style>
<template>
<div class=top>
<div id=machine>[[machine]]</div>
<div id=service>[[service]]</div>
<div id=uptime>[[uptimeOf(value.props.ExecMainStartTimestamp)]]</div>
<div id=state class$="[[value.status.SubState]]">[[value.status.SubState]]</div>
<button raised data-action="start" data-name$="[[service]]">Start </button>
<button raised data-action="stop" data-name$="[[service]]">Stop </button>
<button raised data-action="restart" data-name$="[[service]]">Restart</button>
</div>
</template>
</dom-module>
<script>
Polymer({
is: "systemd-unit-status-sk",
properties: {
machine: {
type: String,
value: "",
},
service: {
type: String,
value: "",
},
},
ready: function() {
this.value = {};
sk.Mailbox.subscribe(this.machine+":"+this.service, function(value) {
this.value = value;
}.bind(this));
},
listeners: {
'tap': 'tapHandler'
},
tapHandler: function(e) {
var ele = sk.findParent(e.target, "BUTTON");
if (ele) {
var detail = {
machine: this.machine,
name: ele.dataset.name,
action: ele.dataset.action,
};
this.dispatchEvent(new CustomEvent('unit-action', {detail: detail, bubbles: true}));
}
},
uptimeOf: function(microSeconds) {
return sk.human.diffDate(microSeconds/1000);
},
});
</script>
|
{
"content_hash": "02f625726c1618a7d86d29e62fe1786d",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 92,
"avg_line_length": 24.016,
"alnum_prop": 0.5669553630912725,
"repo_name": "Tiger66639/skia-buildbot",
"id": "175aed67fc01d42f6a8e7d79962b280d39dceded",
"size": "3002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/imp/9/systemd-unit-status.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "517"
},
{
"name": "C",
"bytes": "3114"
},
{
"name": "C++",
"bytes": "16606"
},
{
"name": "CSS",
"bytes": "20589"
},
{
"name": "Go",
"bytes": "1707602"
},
{
"name": "HTML",
"bytes": "911324"
},
{
"name": "JavaScript",
"bytes": "92257"
},
{
"name": "Makefile",
"bytes": "24280"
},
{
"name": "PowerShell",
"bytes": "7789"
},
{
"name": "Python",
"bytes": "318392"
},
{
"name": "Shell",
"bytes": "166456"
}
],
"symlink_target": ""
}
|
RadDeck
=======
Realtime Audience Dialogue
|
{
"content_hash": "d8f16499a72e0354e9df6d5a1ae16175",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 11,
"alnum_prop": 0.7045454545454546,
"repo_name": "sameubank/RadDeckOriginal",
"id": "5cddf758785323e4b85945270bbfb170e969f52a",
"size": "44",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8711"
},
{
"name": "CoffeeScript",
"bytes": "14363"
},
{
"name": "JavaScript",
"bytes": "487759"
}
],
"symlink_target": ""
}
|
using System;
using System.Text;
using LLVMSharp.Compiler.CocoR;
using LLVMSharp.Compiler.CodeGenerators;
using LLVMSharp.Compiler.Walkers;
namespace LLVMSharp.Compiler.Ast
{
public class AstPreDecrement : AstStatement
{
public IAstExpression AstExpression;
public AstPreDecrement(
string path, int lineNumber, int columnNumber)
: base(path, lineNumber, columnNumber) { }
public AstPreDecrement(IParser parser) : base(parser) { }
public AstPreDecrement(IParser parser, bool useLookAhead) : base(parser, useLookAhead) { }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("--AstPreDecrement--{0}{0}");
sb.Append("Src: {1}{0}");
sb.Append("Ln: {2}{0}");
sb.Append("Col: {3}{0}{0}");
return string.Format(sb.ToString(), Environment.NewLine, base.Path, base.LineNumber, base.ColumnNumber);
}
public override string AssociatedType
{
get { return AstExpression.AssociatedType; }
set { throw new System.ApplicationException("No Associted type"); }
}
public override void EmitCode(CodeGenerator cgen)
{
cgen.EmitCode(this);
}
public override void Walk(Walker walker)
{
// todo walker
}
}
}
|
{
"content_hash": "7691cc2c2abdd2e8856bcd634a8ecd70",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 116,
"avg_line_length": 29.416666666666668,
"alnum_prop": 0.6055240793201133,
"repo_name": "bklooste/Bitcsharp",
"id": "e9f26e5df2ce63ba97dd54d678b05c5f541c58c2",
"size": "1414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bitcsharp/src/lsc/Compiler/Ast/Unary/AstPreDecrement.cs",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "18928"
},
{
"name": "C#",
"bytes": "1863949"
},
{
"name": "C++",
"bytes": "330"
},
{
"name": "Shell",
"bytes": "932"
},
{
"name": "XSLT",
"bytes": "9157"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html class="theme-next pisces" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png?v=5.1.3">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico?v=5.1.3">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png?v=5.1.3">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">
<meta name="keywords" content="Hexo, NexT" />
<meta name="description" content="学习笔记,记录成长">
<meta property="og:type" content="website">
<meta property="og:title" content="九月枫林">
<meta property="og:url" content="http://yangyong.xyz/tags/面试题/index.html">
<meta property="og:site_name" content="九月枫林">
<meta property="og:description" content="学习笔记,记录成长">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="九月枫林">
<meta name="twitter:description" content="学习笔记,记录成长">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Pisces',
version: '5.1.3',
sidebar: {"position":"left","display":"always","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: 'S8WI7CQ2RG',
apiKey: '1e5d4e0537d3136202da11c5c5b766b9',
indexName: 'blog',
hits: {"per_page":10},
labels: {"input_placeholder":"输入关键词","hits_empty":"没有找到与 ${query} 相关的内容","hits_stats":"${hits}条相关记录,共耗时 ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://yangyong.xyz/tags/面试题/"/>
<title>标签: 面试题 | 九月枫林</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left ">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">九月枫林</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<h1 class="site-subtitle" itemprop="description">Simon Young</h1>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
标签
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div class="post-block tag">
<div id="posts" class="posts-collapse">
<div class="collection-title">
<h2>面试题<small>标签</small>
</h2>
</div>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h3 class="post-title">
<a class="post-title-link" href="/2019/04/23/understand-js-closure-and-an-interview-question/" itemprop="url">
<span itemprop="name">理解JS的闭包及关于闭包的经典面试题</span>
</a>
</h3>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2019-04-23T10:59:16+08:00"
content="2019-04-23" >
04-23
</time>
</div>
</header>
</article>
</div>
</div>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image"
src="/images/avatar.jpg"
alt="九月枫林" />
<p class="site-author-name" itemprop="name">九月枫林</p>
<p class="site-description motion-element" itemprop="description"></p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">19</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">6</span>
<span class="site-state-item-name">分类</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">16</span>
<span class="site-state-item-name">标签</span>
</a>
</div>
</nav>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/SeptemberMaples" target="_blank" title="GitHub">
<i class="fa fa-fw fa-github"></i>GitHub</a>
</span>
<span class="links-of-author-item">
<a href="mailto:jiuyuefenglin@gmail.com" target="_blank" title="E-Mail">
<i class="fa fa-fw fa-envelope"></i>E-Mail</a>
</span>
<span class="links-of-author-item">
<a href="https://weibo.com/jiuyuefenglin" target="_blank" title="微博">
<i class="fa fa-fw fa-weibo"></i>微博</a>
</span>
<span class="links-of-author-item">
<a href="https://www.zhihu.com/people/yangyong222" target="_blank" title="知乎">
<i class="fa fa-fw fa-globe"></i>知乎</a>
</span>
</div>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© 2016 — <span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">九月枫林</span>
</div>
<div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>
<span class="post-meta-divider">|</span>
<div class="theme-info">主题 — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a></div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//cdn.jsdelivr.net/npm/valine@1.1.4/dist/Valine.min.js"></script>
<script type="text/javascript">
new Valine({
av: AV,
el: '#vcomments' ,
verify: true,
notify: false,
app_id: 'fyGrIsuAaAKmLUl8jRfcPcda-gzGzoHsz',
app_key: 'tAseGFsYxXWyNK8EIOLHxmlz',
placeholder: '说点什么吧~'
});
</script>
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
<script>AV.initialize("fyGrIsuAaAKmLUl8jRfcPcda-gzGzoHsz", "tAseGFsYxXWyNK8EIOLHxmlz");</script>
<script>
function showTime(Counter) {
var query = new AV.Query(Counter);
var entries = [];
var $visitors = $(".leancloud_visitors");
$visitors.each(function () {
entries.push( $(this).attr("id").trim() );
});
query.containedIn('url', entries);
query.find()
.done(function (results) {
var COUNT_CONTAINER_REF = '.leancloud-visitors-count';
if (results.length === 0) {
$visitors.find(COUNT_CONTAINER_REF).text(0);
return;
}
for (var i = 0; i < results.length; i++) {
var item = results[i];
var url = item.get('url');
var time = item.get('time');
var element = document.getElementById(url);
$(element).find(COUNT_CONTAINER_REF).text(time);
}
for(var i = 0; i < entries.length; i++) {
var url = entries[i];
var element = document.getElementById(url);
var countSpan = $(element).find(COUNT_CONTAINER_REF);
if( countSpan.text() == '') {
countSpan.text(0);
}
}
})
.fail(function (object, error) {
console.log("Error: " + error.code + " " + error.message);
});
}
function addCount(Counter) {
var $visitors = $(".leancloud_visitors");
var url = $visitors.attr('id').trim();
var title = $visitors.attr('data-flag-title').trim();
var query = new AV.Query(Counter);
query.equalTo("url", url);
query.find({
success: function(results) {
if (results.length > 0) {
var counter = results[0];
counter.fetchWhenSave(true);
counter.increment("time");
counter.save(null, {
success: function(counter) {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(counter.get('time'));
},
error: function(counter, error) {
console.log('Failed to save Visitor num, with error message: ' + error.message);
}
});
} else {
var newcounter = new Counter();
/* Set ACL */
var acl = new AV.ACL();
acl.setPublicReadAccess(true);
acl.setPublicWriteAccess(true);
newcounter.setACL(acl);
/* End Set ACL */
newcounter.set("title", title);
newcounter.set("url", url);
newcounter.set("time", 1);
newcounter.save(null, {
success: function(newcounter) {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(newcounter.get('time'));
},
error: function(newcounter, error) {
console.log('Failed to create');
}
});
}
},
error: function(error) {
console.log('Error:' + error.code + " " + error.message);
}
});
}
$(function() {
var Counter = AV.Object.extend("Counter");
if ($('.leancloud_visitors').length == 1) {
addCount(Counter);
} else if ($('.post-title-link').length > 1) {
showTime(Counter);
}
});
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<script type="text/javascript" src="/js/src/js.cookie.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/scroll-cookie.js?v=5.1.3"></script>
</body>
</html>
|
{
"content_hash": "647fc68ea004dcb116225a0cbce856af",
"timestamp": "",
"source": "github",
"line_count": 728,
"max_line_length": 184,
"avg_line_length": 21.708791208791208,
"alnum_prop": 0.5195520121488231,
"repo_name": "SeptemberMaples/SeptemberMaples.github.io",
"id": "1590014e8478a9b31648f9f40b67d8a8d81abf2a",
"size": "16106",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/面试题/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "60597"
},
{
"name": "HTML",
"bytes": "1737061"
},
{
"name": "JavaScript",
"bytes": "657019"
}
],
"symlink_target": ""
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================================
**
** File: ExceptionNotification.cs
**
**
** Purpose: Contains definitions for supporting Exception Notifications.
**
** Created: 10/07/2008
**
** <owner>gkhanna</owner>
**
=============================================================================*/
#if FEATURE_EXCEPTION_NOTIFICATIONS
namespace System.Runtime.ExceptionServices {
using System;
// Definition of the argument-type passed to the FirstChanceException event handler
public class FirstChanceExceptionEventArgs : EventArgs
{
// Constructor
public FirstChanceExceptionEventArgs(Exception exception)
{
m_Exception = exception;
}
// Returns the exception object pertaining to the first chance exception
public Exception Exception
{
get { return m_Exception; }
}
// Represents the FirstChance exception instance
private Exception m_Exception;
}
}
#endif // FEATURE_EXCEPTION_NOTIFICATIONS
|
{
"content_hash": "29c14e01c6c812f8ac53607dcfebc720",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 87,
"avg_line_length": 32.46153846153846,
"alnum_prop": 0.6026856240126383,
"repo_name": "bartdesmet/coreclr",
"id": "d0bda1c9143d690333ed9c2c1f4a404cc3e6ae54",
"size": "1268",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "977193"
},
{
"name": "Awk",
"bytes": "5861"
},
{
"name": "Batchfile",
"bytes": "92166"
},
{
"name": "C",
"bytes": "3145966"
},
{
"name": "C#",
"bytes": "138969213"
},
{
"name": "C++",
"bytes": "73874720"
},
{
"name": "CMake",
"bytes": "615495"
},
{
"name": "Groff",
"bytes": "529523"
},
{
"name": "Groovy",
"bytes": "163080"
},
{
"name": "HTML",
"bytes": "16196"
},
{
"name": "Makefile",
"bytes": "2527"
},
{
"name": "Objective-C",
"bytes": "543312"
},
{
"name": "PAWN",
"bytes": "850"
},
{
"name": "Perl",
"bytes": "24550"
},
{
"name": "PowerShell",
"bytes": "5539"
},
{
"name": "Python",
"bytes": "118129"
},
{
"name": "Shell",
"bytes": "142304"
},
{
"name": "Smalltalk",
"bytes": "1496826"
},
{
"name": "Stata",
"bytes": "45"
},
{
"name": "SuperCollider",
"bytes": "4752"
},
{
"name": "Yacc",
"bytes": "157348"
}
],
"symlink_target": ""
}
|
package org.traccar;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.DatagramChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.timeout.IdleStateEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.database.StatisticsManager;
import org.traccar.helper.DateUtil;
import org.traccar.model.Position;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
public class MainEventHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(MainEventHandler.class);
private static final String DEFAULT_LOGGER_ATTRIBUTES = "time,position,speed,course,accuracy,result";
private final Set<String> connectionlessProtocols = new HashSet<>();
private final Set<String> logAttributes = new LinkedHashSet<>();
public MainEventHandler() {
String connectionlessProtocolList = Context.getConfig().getString("status.ignoreOffline");
if (connectionlessProtocolList != null) {
connectionlessProtocols.addAll(Arrays.asList(connectionlessProtocolList.split("[, ]")));
}
logAttributes.addAll(Arrays.asList(
Context.getConfig().getString("logger.attributes", DEFAULT_LOGGER_ATTRIBUTES).split("[, ]")));
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Position) {
Position position = (Position) msg;
try {
Context.getDeviceManager().updateLatestPosition(position);
} catch (SQLException error) {
LOGGER.warn("Failed to update device", error);
}
String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId();
StringBuilder builder = new StringBuilder();
builder.append(formatChannel(ctx.channel())).append(" ");
builder.append("id: ").append(uniqueId);
for (String attribute : logAttributes) {
switch (attribute) {
case "time":
builder.append(", time: ").append(DateUtil.formatDate(position.getFixTime(), false));
break;
case "position":
builder.append(", lat: ").append(String.format("%.5f", position.getLatitude()));
builder.append(", lon: ").append(String.format("%.5f", position.getLongitude()));
break;
case "speed":
if (position.getSpeed() > 0) {
builder.append(", speed: ").append(String.format("%.1f", position.getSpeed()));
}
break;
case "course":
builder.append(", course: ").append(String.format("%.1f", position.getCourse()));
break;
case "accuracy":
if (position.getAccuracy() > 0) {
builder.append(", accuracy: ").append(String.format("%.1f", position.getAccuracy()));
}
break;
case "outdated":
if (position.getOutdated()) {
builder.append(", outdated");
}
break;
case "invalid":
if (!position.getValid()) {
builder.append(", invalid");
}
break;
default:
Object value = position.getAttributes().get(attribute);
if (value != null) {
builder.append(", ").append(attribute).append(": ").append(value);
}
break;
}
}
LOGGER.info(builder.toString());
Main.getInjector().getInstance(StatisticsManager.class).registerMessageStored(position.getDeviceId());
}
}
private static String formatChannel(Channel channel) {
return String.format("[%s]", channel.id().asShortText());
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
if (!(ctx.channel() instanceof DatagramChannel)) {
LOGGER.info(formatChannel(ctx.channel()) + " connected");
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
LOGGER.info(formatChannel(ctx.channel()) + " disconnected");
closeChannel(ctx.channel());
if (BasePipelineFactory.getHandler(ctx.pipeline(), HttpRequestDecoder.class) == null
&& !connectionlessProtocols.contains(ctx.pipeline().get(BaseProtocolDecoder.class).getProtocolName())) {
Context.getConnectionManager().removeActiveDevice(ctx.channel());
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
while (cause.getCause() != null && cause.getCause() != cause) {
cause = cause.getCause();
}
LOGGER.warn(formatChannel(ctx.channel()) + " error", cause);
closeChannel(ctx.channel());
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof IdleStateEvent) {
LOGGER.info(formatChannel(ctx.channel()) + " timed out");
closeChannel(ctx.channel());
}
}
private void closeChannel(Channel channel) {
if (!(channel instanceof DatagramChannel)) {
channel.close();
}
}
}
|
{
"content_hash": "928985e4493c681c1e771e3e3735bbc6",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 120,
"avg_line_length": 40.10884353741496,
"alnum_prop": 0.5741180461329715,
"repo_name": "tananaev/traccar",
"id": "2309b1e70155a24c2920f6564a3ceee50729c736",
"size": "6520",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/org/traccar/MainEventHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Inno Setup",
"bytes": "1307"
},
{
"name": "Java",
"bytes": "2857084"
},
{
"name": "Python",
"bytes": "33454"
},
{
"name": "Shell",
"bytes": "7595"
}
],
"symlink_target": ""
}
|
const paths = require("../paths");
const gulp = require("gulp");
const babel = require("gulp-babel");
const babelOptions = require("../babel-options");
const concat = require("gulp-concat");
const plumber = require("gulp-plumber");
gulp.task("buildJavascript", function () {
return gulp.src(paths.files)
.pipe(plumber())
//vs.pipe(babel(babelOptions))
.pipe(concat("app.js"))
.pipe(gulp.dest("built/scripts"));
});
|
{
"content_hash": "3d7179dd6eda346a82aa4800e32e83bb",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 49,
"avg_line_length": 34.714285714285715,
"alnum_prop": 0.5946502057613169,
"repo_name": "provenstyle/BibleTraining",
"id": "fd909fe644b2e588c75734bb396a7e2a182b5367",
"size": "488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/BibleTraining.Web.UI/build/tasks/buildJavascript.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "121"
},
{
"name": "C#",
"bytes": "127151"
},
{
"name": "CSS",
"bytes": "11154"
},
{
"name": "HTML",
"bytes": "29279"
},
{
"name": "JavaScript",
"bytes": "532416"
},
{
"name": "PLSQL",
"bytes": "2266"
},
{
"name": "PLpgSQL",
"bytes": "2028"
},
{
"name": "PowerShell",
"bytes": "32"
}
],
"symlink_target": ""
}
|
> rvsa demo api
## About
This project uses [Feathers](http://feathersjs.com). An open source web framework for building modern real-time applications.
## Getting Started
Getting up and running is as easy as 1, 2, 3.
1. Make sure you have [NodeJS](https://nodejs.org/) and [npm](https://www.npmjs.com/) installed.
2. Install your dependencies
```
cd path/to/rvsa_api; npm install
```
3. Start your app
```
npm start
```
## Testing
Simply run `npm test` and all your tests in the `test/` directory will be run.
## Scaffolding
Feathers has a powerful generator. Here's just a few things that it can do:
- **Generate a new Service:** `yo feathers:service`
- **Generate a new Hook:** `yo feathers:hook`
- **Generate a new Model:** `yo feathers:model`
## Help
For more information on all the things you can do with Feathers visit [docs.feathersjs.com](http://docs.feathersjs.com).
## Changelog
__0.1.0__
- Initial release
## License
Copyright (c) 2015
Licensed under the [MIT license](LICENSE).
|
{
"content_hash": "63670a3a4fe39f6d59411c4ab9e58eb1",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 126,
"avg_line_length": 20.86,
"alnum_prop": 0.6826462128475551,
"repo_name": "pilgin/places-api",
"id": "988cb6300fb69504b03831f42634b02940b43094",
"size": "1055",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "931"
},
{
"name": "HTML",
"bytes": "469"
},
{
"name": "JavaScript",
"bytes": "22020"
}
],
"symlink_target": ""
}
|
@implementation GameGlobals
#pragma mark Singleton Methods
+ (id)sharedInstance {
static GameGlobals *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
- (NSString*)levelNameAtIndex:(int)index{
if(self.levelNames.count <= index){
return nil;
}
else{
return (NSString*)[self.levelNames objectAtIndex:index];
}
}
- (void)setLevelNames:(NSArray *)levelNames{
_levelNames = levelNames;
_totalNumberOfLevels = (int)[levelNames count];
}
- (id)init {
if (self = [super init]) {
// init shared instance.
}
return self;
}
@end
|
{
"content_hash": "fd4940b0f9bd576ca248a51e4cdb769c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 64,
"avg_line_length": 19.37837837837838,
"alnum_prop": 0.6373779637377964,
"repo_name": "bigeyex/GoldenRightHandTest",
"id": "88c91d98015cd1401f829f23431205303442b0c2",
"size": "875",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RubberMan.spritebuilder/Source/GameGlobals.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "258606"
},
{
"name": "C++",
"bytes": "14011"
},
{
"name": "CSS",
"bytes": "18960"
},
{
"name": "Java",
"bytes": "2978"
},
{
"name": "M",
"bytes": "333590"
},
{
"name": "Matlab",
"bytes": "2853"
},
{
"name": "Objective-C",
"bytes": "2350852"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_72) on Wed Nov 05 20:55:53 EST 2014 -->
<title>Uses of Class org.apache.cassandra.cql3.ColumnCondition.CollectionInBound (apache-cassandra API)</title>
<meta name="date" content="2014-11-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.cassandra.cql3.ColumnCondition.CollectionInBound (apache-cassandra API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/cql3/ColumnCondition.CollectionInBound.html" title="class in org.apache.cassandra.cql3">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/cql3/class-use/ColumnCondition.CollectionInBound.html" target="_top">Frames</a></li>
<li><a href="ColumnCondition.CollectionInBound.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.cassandra.cql3.ColumnCondition.CollectionInBound" class="title">Uses of Class<br>org.apache.cassandra.cql3.ColumnCondition.CollectionInBound</h2>
</div>
<div class="classUseContainer">No usage of org.apache.cassandra.cql3.ColumnCondition.CollectionInBound</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/cql3/ColumnCondition.CollectionInBound.html" title="class in org.apache.cassandra.cql3">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/cql3/class-use/ColumnCondition.CollectionInBound.html" target="_top">Frames</a></li>
<li><a href="ColumnCondition.CollectionInBound.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014 The Apache Software Foundation</small></p>
</body>
</html>
|
{
"content_hash": "79403f0cf0680e146ae3167e061b6029",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 181,
"avg_line_length": 39.12931034482759,
"alnum_prop": 0.6316369244326945,
"repo_name": "vangav/vos_backend",
"id": "60544d643e8c0847928be0e663d3ba51b74ce174",
"size": "4539",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "apache-cassandra-2.1.2/javadoc/org/apache/cassandra/cql3/class-use/ColumnCondition.CollectionInBound.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "31912"
},
{
"name": "CSS",
"bytes": "68697"
},
{
"name": "CoffeeScript",
"bytes": "28149"
},
{
"name": "HTML",
"bytes": "140969"
},
{
"name": "Java",
"bytes": "2403319"
},
{
"name": "JavaScript",
"bytes": "1130298"
},
{
"name": "PowerShell",
"bytes": "37758"
},
{
"name": "Python",
"bytes": "312883"
},
{
"name": "Scala",
"bytes": "1906531"
},
{
"name": "Shell",
"bytes": "58628"
},
{
"name": "TSQL",
"bytes": "208586"
},
{
"name": "Thrift",
"bytes": "40240"
}
],
"symlink_target": ""
}
|
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32g4xx_ll_tim.h"
#include "stm32g4xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
/** @addtogroup STM32G4xx_LL_Driver
* @{
*/
#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM15) || defined (TIM16) || defined (TIM17) || defined (TIM20)
/** @addtogroup TIM_LL
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup TIM_LL_Private_Macros
* @{
*/
#define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN))
#define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \
|| ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \
|| ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4))
#define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \
|| ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \
|| ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_PWM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_RETRIG_OPM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_RETRIG_OPM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_COMBINED_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_COMBINED_PWM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_ASSYMETRIC_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_ASSYMETRIC_PWM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_PULSE_ON_COMPARE) \
|| ((__VALUE__) == LL_TIM_OCMODE_DIRECTION_OUTPUT))
#define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \
|| ((__VALUE__) == LL_TIM_OCSTATE_ENABLE))
#define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \
|| ((__VALUE__) == LL_TIM_OCPOLARITY_LOW))
#define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \
|| ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH))
#define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \
|| ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \
|| ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC))
#define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV2) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV4) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV8))
#define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8))
#define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_BOTHEDGE))
#define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X2) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X1) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X2) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X1_TI12) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X1_TI1) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X1_TI2))
#define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING))
#define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \
|| ((__VALUE__) == LL_TIM_OSSR_ENABLE))
#define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \
|| ((__VALUE__) == LL_TIM_OSSI_ENABLE))
#define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_3))
#define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \
|| ((__VALUE__) == LL_TIM_BREAK_ENABLE))
#define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \
|| ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH))
#define IS_LL_TIM_BREAK_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N8))
#define IS_LL_TIM_BREAK_AFMODE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_AFMODE_INPUT) \
|| ((__VALUE__) == LL_TIM_BREAK_AFMODE_BIDIRECTIONAL))
#define IS_LL_TIM_BREAK2_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_DISABLE) \
|| ((__VALUE__) == LL_TIM_BREAK2_ENABLE))
#define IS_LL_TIM_BREAK2_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_POLARITY_LOW) \
|| ((__VALUE__) == LL_TIM_BREAK2_POLARITY_HIGH))
#define IS_LL_TIM_BREAK2_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N8))
#define IS_LL_TIM_BREAK2_AFMODE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_AFMODE_INPUT) \
|| ((__VALUE__) == LL_TIM_BREAK2_AFMODE_BIDIRECTIONAL))
#define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \
|| ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup TIM_LL_Private_Functions TIM Private Functions
* @{
*/
static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC5Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC6Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup TIM_LL_Exported_Functions
* @{
*/
/** @addtogroup TIM_LL_EF_Init
* @{
*/
/**
* @brief Set TIMx registers to their reset values.
* @param TIMx Timer instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: invalid TIMx instance
*/
ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx)
{
ErrorStatus result = SUCCESS;
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(TIMx));
if (TIMx == TIM1)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1);
}
else if (TIMx == TIM2)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2);
}
else if (TIMx == TIM3)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM3);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM3);
}
else if (TIMx == TIM4)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM4);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM4);
}
#if defined(TIM5)
else if (TIMx == TIM5)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM5);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM5);
}
#endif /* TIM5 */
else if (TIMx == TIM6)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM6);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM6);
}
else if (TIMx == TIM7)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM7);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM7);
}
else if (TIMx == TIM8)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM8);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM8);
}
else if (TIMx == TIM15)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM15);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM15);
}
else if (TIMx == TIM16)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM16);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM16);
}
else if (TIMx == TIM17)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM17);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM17);
}
#if defined(TIM20)
else if (TIMx == TIM20)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM20);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM20);
}
#endif /* TIM20 */
else
{
result = ERROR;
}
return result;
}
/**
* @brief Set the fields of the time base unit configuration data structure
* to their default values.
* @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (time base unit configuration data structure)
* @retval None
*/
void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct)
{
/* Set the default configuration */
TIM_InitStruct->Prescaler = (uint16_t)0x0000;
TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct->Autoreload = 0xFFFFFFFFU;
TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
TIM_InitStruct->RepetitionCounter = (uint8_t)0x00;
}
/**
* @brief Configure the TIMx time base unit.
* @param TIMx Timer Instance
* @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (TIMx time base unit configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct)
{
uint32_t tmpcr1;
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(TIMx));
assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode));
assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision));
tmpcr1 = LL_TIM_ReadReg(TIMx, CR1);
if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx))
{
/* Select the Counter Mode */
MODIFY_REG(tmpcr1, (TIM_CR1_DIR | TIM_CR1_CMS), TIM_InitStruct->CounterMode);
}
if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx))
{
/* Set the clock division */
MODIFY_REG(tmpcr1, TIM_CR1_CKD, TIM_InitStruct->ClockDivision);
}
/* Write to TIMx CR1 */
LL_TIM_WriteReg(TIMx, CR1, tmpcr1);
/* Set the Autoreload value */
LL_TIM_SetAutoReload(TIMx, TIM_InitStruct->Autoreload);
/* Set the Prescaler value */
LL_TIM_SetPrescaler(TIMx, TIM_InitStruct->Prescaler);
if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx))
{
/* Set the Repetition Counter value */
LL_TIM_SetRepetitionCounter(TIMx, TIM_InitStruct->RepetitionCounter);
}
/* Generate an update event to reload the Prescaler
and the repetition counter value (if applicable) immediately */
LL_TIM_GenerateEvent_UPDATE(TIMx);
return SUCCESS;
}
/**
* @brief Set the fields of the TIMx output channel configuration data
* structure to their default values.
* @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (the output channel configuration data structure)
* @retval None
*/
void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
{
/* Set the default configuration */
TIM_OC_InitStruct->OCMode = LL_TIM_OCMODE_FROZEN;
TIM_OC_InitStruct->OCState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct->OCNState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct->CompareValue = 0x00000000U;
TIM_OC_InitStruct->OCPolarity = LL_TIM_OCPOLARITY_HIGH;
TIM_OC_InitStruct->OCNPolarity = LL_TIM_OCPOLARITY_HIGH;
TIM_OC_InitStruct->OCIdleState = LL_TIM_OCIDLESTATE_LOW;
TIM_OC_InitStruct->OCNIdleState = LL_TIM_OCIDLESTATE_LOW;
}
/**
* @brief Configure the TIMx output channel.
* @param TIMx Timer Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_TIM_CHANNEL_CH1
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
* @arg @ref LL_TIM_CHANNEL_CH5
* @arg @ref LL_TIM_CHANNEL_CH6
* @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
*/
ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
{
ErrorStatus result = ERROR;
switch (Channel)
{
case LL_TIM_CHANNEL_CH1:
result = OC1Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH2:
result = OC2Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH3:
result = OC3Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH4:
result = OC4Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH5:
result = OC5Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH6:
result = OC6Config(TIMx, TIM_OC_InitStruct);
break;
default:
break;
}
return result;
}
/**
* @brief Set the fields of the TIMx input channel configuration data
* structure to their default values.
* @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration data structure)
* @retval None
*/
void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Set the default configuration */
TIM_ICInitStruct->ICPolarity = LL_TIM_IC_POLARITY_RISING;
TIM_ICInitStruct->ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_ICInitStruct->ICPrescaler = LL_TIM_ICPSC_DIV1;
TIM_ICInitStruct->ICFilter = LL_TIM_IC_FILTER_FDIV1;
}
/**
* @brief Configure the TIMx input channel.
* @param TIMx Timer Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_TIM_CHANNEL_CH1
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
* @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
*/
ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct)
{
ErrorStatus result = ERROR;
switch (Channel)
{
case LL_TIM_CHANNEL_CH1:
result = IC1Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH2:
result = IC2Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH3:
result = IC3Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH4:
result = IC4Config(TIMx, TIM_IC_InitStruct);
break;
default:
break;
}
return result;
}
/**
* @brief Fills each TIM_EncoderInitStruct field with its default value
* @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface configuration data structure)
* @retval None
*/
void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct)
{
/* Set the default configuration */
TIM_EncoderInitStruct->EncoderMode = LL_TIM_ENCODERMODE_X2_TI1;
TIM_EncoderInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_EncoderInitStruct->IC1ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_EncoderInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1;
TIM_EncoderInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1;
TIM_EncoderInitStruct->IC2Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_EncoderInitStruct->IC2ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_EncoderInitStruct->IC2Prescaler = LL_TIM_ICPSC_DIV1;
TIM_EncoderInitStruct->IC2Filter = LL_TIM_IC_FILTER_FDIV1;
}
/**
* @brief Configure the encoder interface of the timer instance.
* @param TIMx Timer Instance
* @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct)
{
uint32_t tmpccmr1;
uint32_t tmpccer;
/* Check the parameters */
assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx));
assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC1ActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC1Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC1Filter));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC2Polarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC2ActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC2Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC2Filter));
/* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */
TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Configure TI1 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1ActiveInput >> 16U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Filter >> 16U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Prescaler >> 16U);
/* Configure TI2 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2ActiveInput >> 8U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Filter >> 8U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Prescaler >> 8U);
/* Set TI1 and TI2 polarity and enable TI1 and TI2 */
tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP);
tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC1Polarity);
tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC2Polarity << 4U);
tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Set encoder mode */
LL_TIM_SetEncoderMode(TIMx, TIM_EncoderInitStruct->EncoderMode);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Set the fields of the TIMx Hall sensor interface configuration data
* structure to their default values.
* @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (HALL sensor interface configuration data structure)
* @retval None
*/
void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct)
{
/* Set the default configuration */
TIM_HallSensorInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_HallSensorInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1;
TIM_HallSensorInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1;
TIM_HallSensorInitStruct->CommutationDelay = 0U;
}
/**
* @brief Configure the Hall sensor interface of the timer instance.
* @note TIMx CH1, CH2 and CH3 inputs connected through a XOR
* to the TI1 input channel
* @note TIMx slave mode controller is configured in reset mode.
Selected internal trigger is TI1F_ED.
* @note Channel 1 is configured as input, IC1 is mapped on TRC.
* @note Captured value stored in TIMx_CCR1 correspond to the time elapsed
* between 2 changes on the inputs. It gives information about motor speed.
* @note Channel 2 is configured in output PWM 2 mode.
* @note Compare value stored in TIMx_CCR2 corresponds to the commutation delay.
* @note OC2REF is selected as trigger output on TRGO.
* @note LL_TIM_IC_POLARITY_BOTHEDGE must not be used for TI1 when it is used
* when TIMx operates in Hall sensor interface mode.
* @param TIMx Timer Instance
* @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (TIMx HALL sensor interface configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct)
{
uint32_t tmpcr2;
uint32_t tmpccmr1;
uint32_t tmpccer;
uint32_t tmpsmcr;
/* Check the parameters */
assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity));
assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_HallSensorInitStruct->IC1Filter));
/* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */
TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx SMCR register value */
tmpsmcr = LL_TIM_ReadReg(TIMx, SMCR);
/* Connect TIMx_CH1, CH2 and CH3 pins to the TI1 input */
tmpcr2 |= TIM_CR2_TI1S;
/* OC2REF signal is used as trigger output (TRGO) */
tmpcr2 |= LL_TIM_TRGO_OC2REF;
/* Configure the slave mode controller */
tmpsmcr &= (uint32_t)~(TIM_SMCR_TS | TIM_SMCR_SMS);
tmpsmcr |= LL_TIM_TS_TI1F_ED;
tmpsmcr |= LL_TIM_SLAVEMODE_RESET;
/* Configure input channel 1 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC);
tmpccmr1 |= (uint32_t)(LL_TIM_ACTIVEINPUT_TRC >> 16U);
tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Filter >> 16U);
tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Prescaler >> 16U);
/* Configure input channel 2 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_OC2M | TIM_CCMR1_OC2FE | TIM_CCMR1_OC2PE | TIM_CCMR1_OC2CE);
tmpccmr1 |= (uint32_t)(LL_TIM_OCMODE_PWM2 << 8U);
/* Set Channel 1 polarity and enable Channel 1 and Channel2 */
tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP);
tmpccer |= (uint32_t)(TIM_HallSensorInitStruct->IC1Polarity);
tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx SMCR */
LL_TIM_WriteReg(TIMx, SMCR, tmpsmcr);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
/* Write to TIMx CCR2 */
LL_TIM_OC_SetCompareCH2(TIMx, TIM_HallSensorInitStruct->CommutationDelay);
return SUCCESS;
}
/**
* @brief Set the fields of the Break and Dead Time configuration data structure
* to their default values.
* @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure)
* @retval None
*/
void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct)
{
/* Set the default configuration */
TIM_BDTRInitStruct->OSSRState = LL_TIM_OSSR_DISABLE;
TIM_BDTRInitStruct->OSSIState = LL_TIM_OSSI_DISABLE;
TIM_BDTRInitStruct->LockLevel = LL_TIM_LOCKLEVEL_OFF;
TIM_BDTRInitStruct->DeadTime = (uint8_t)0x00;
TIM_BDTRInitStruct->BreakState = LL_TIM_BREAK_DISABLE;
TIM_BDTRInitStruct->BreakPolarity = LL_TIM_BREAK_POLARITY_LOW;
TIM_BDTRInitStruct->BreakFilter = LL_TIM_BREAK_FILTER_FDIV1;
TIM_BDTRInitStruct->BreakAFMode = LL_TIM_BREAK_AFMODE_INPUT;
TIM_BDTRInitStruct->Break2State = LL_TIM_BREAK2_DISABLE;
TIM_BDTRInitStruct->Break2Polarity = LL_TIM_BREAK2_POLARITY_LOW;
TIM_BDTRInitStruct->Break2Filter = LL_TIM_BREAK2_FILTER_FDIV1;
TIM_BDTRInitStruct->Break2AFMode = LL_TIM_BREAK2_AFMODE_INPUT;
TIM_BDTRInitStruct->AutomaticOutput = LL_TIM_AUTOMATICOUTPUT_DISABLE;
}
/**
* @brief Configure the Break and Dead Time feature of the timer instance.
* @note As the bits BK2P, BK2E, BK2F[3:0], BKF[3:0], AOE, BKP, BKE, OSSI, OSSR
* and DTG[7:0] can be write-locked depending on the LOCK configuration, it
* can be necessary to configure all of them during the first write access to
* the TIMx_BDTR register.
* @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
* a timer instance provides a break input.
* @note Macro IS_TIM_BKIN2_INSTANCE(TIMx) can be used to check whether or not
* a timer instance provides a second break input.
* @param TIMx Timer Instance
* @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: Break and Dead Time is initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct)
{
uint32_t tmpbdtr = 0;
/* Check the parameters */
assert_param(IS_TIM_BREAK_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OSSR_STATE(TIM_BDTRInitStruct->OSSRState));
assert_param(IS_LL_TIM_OSSI_STATE(TIM_BDTRInitStruct->OSSIState));
assert_param(IS_LL_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->LockLevel));
assert_param(IS_LL_TIM_BREAK_STATE(TIM_BDTRInitStruct->BreakState));
assert_param(IS_LL_TIM_BREAK_POLARITY(TIM_BDTRInitStruct->BreakPolarity));
assert_param(IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(TIM_BDTRInitStruct->AutomaticOutput));
/* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State,
the OSSI State, the dead time value and the Automatic Output Enable Bit */
/* Set the BDTR bits */
MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, TIM_BDTRInitStruct->DeadTime);
MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, TIM_BDTRInitStruct->LockLevel);
MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, TIM_BDTRInitStruct->OSSIState);
MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, TIM_BDTRInitStruct->OSSRState);
MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, TIM_BDTRInitStruct->BreakState);
MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, TIM_BDTRInitStruct->BreakPolarity);
MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, TIM_BDTRInitStruct->AutomaticOutput);
MODIFY_REG(tmpbdtr, TIM_BDTR_MOE, TIM_BDTRInitStruct->AutomaticOutput);
if (IS_TIM_ADVANCED_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_BREAK_FILTER(TIM_BDTRInitStruct->BreakFilter));
assert_param(IS_LL_TIM_BREAK_AFMODE(TIM_BDTRInitStruct->BreakAFMode));
MODIFY_REG(tmpbdtr, TIM_BDTR_BKF, TIM_BDTRInitStruct->BreakFilter);
MODIFY_REG(tmpbdtr, TIM_BDTR_BKBID, TIM_BDTRInitStruct->BreakAFMode);
}
if (IS_TIM_BKIN2_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_BREAK2_STATE(TIM_BDTRInitStruct->Break2State));
assert_param(IS_LL_TIM_BREAK2_POLARITY(TIM_BDTRInitStruct->Break2Polarity));
assert_param(IS_LL_TIM_BREAK2_FILTER(TIM_BDTRInitStruct->Break2Filter));
assert_param(IS_LL_TIM_BREAK2_AFMODE(TIM_BDTRInitStruct->Break2AFMode));
/* Set the BREAK2 input related BDTR bit-fields */
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2F, (TIM_BDTRInitStruct->Break2Filter));
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2E, TIM_BDTRInitStruct->Break2State);
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2P, TIM_BDTRInitStruct->Break2Polarity);
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2BID, TIM_BDTRInitStruct->Break2AFMode);
}
/* Set TIMx_BDTR */
LL_TIM_WriteReg(TIMx, BDTR, tmpbdtr);
return SUCCESS;
}
/**
* @}
*/
/**
* @}
*/
/** @addtogroup TIM_LL_Private_Functions TIM Private Functions
* @brief Private functions
* @{
*/
/**
* @brief Configure the TIMx output channel 1.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 1 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr1;
uint32_t tmpccer;
uint32_t tmpcr2;
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 1: Reset the CC1E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC1E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC1S);
/* Set the Output Compare Mode */
MODIFY_REG(tmpccmr1, TIM_CCMR1_OC1M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC1P, TIM_OCInitStruct->OCPolarity);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC1E, TIM_OCInitStruct->OCState);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC1NP, TIM_OCInitStruct->OCNPolarity << 2U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC1NE, TIM_OCInitStruct->OCNState << 2U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS1, TIM_OCInitStruct->OCIdleState);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS1N, TIM_OCInitStruct->OCNIdleState << 1U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH1(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 2.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 2 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr1;
uint32_t tmpccer;
uint32_t tmpcr2;
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 2: Reset the CC2E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC2E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC2S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr1, TIM_CCMR1_OC2M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC2P, TIM_OCInitStruct->OCPolarity << 4U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC2E, TIM_OCInitStruct->OCState << 4U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC2NP, TIM_OCInitStruct->OCNPolarity << 6U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC2NE, TIM_OCInitStruct->OCNState << 6U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS2, TIM_OCInitStruct->OCIdleState << 2U);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS2N, TIM_OCInitStruct->OCNIdleState << 3U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH2(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 3.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 3 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr2;
uint32_t tmpccer;
uint32_t tmpcr2;
/* Check the parameters */
assert_param(IS_TIM_CC3_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 3: Reset the CC3E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC3E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR2 register value */
tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC3S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr2, TIM_CCMR2_OC3M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC3P, TIM_OCInitStruct->OCPolarity << 8U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC3E, TIM_OCInitStruct->OCState << 8U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC3NP, TIM_OCInitStruct->OCNPolarity << 10U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC3NE, TIM_OCInitStruct->OCNState << 10U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS3, TIM_OCInitStruct->OCIdleState << 4U);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS3N, TIM_OCInitStruct->OCNIdleState << 5U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR2 */
LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH3(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 4.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 4 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr2;
uint32_t tmpccer;
uint32_t tmpcr2;
/* Check the parameters */
assert_param(IS_TIM_CC4_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 4: Reset the CC4E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC4E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR2 register value */
tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC4S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr2, TIM_CCMR2_OC4M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC4P, TIM_OCInitStruct->OCPolarity << 12U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC4E, TIM_OCInitStruct->OCState << 12U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC4NP, TIM_OCInitStruct->OCNPolarity << 14U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC4NE, TIM_OCInitStruct->OCNState << 14U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS4, TIM_OCInitStruct->OCIdleState << 6U);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS4N, TIM_OCInitStruct->OCNIdleState << 7U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR2 */
LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH4(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 5.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 5 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC5Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr3;
uint32_t tmpccer;
/* Check the parameters */
assert_param(IS_TIM_CC5_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 5: Reset the CC5E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC5E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CCMR3 register value */
tmpccmr3 = LL_TIM_ReadReg(TIMx, CCMR3);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr3, TIM_CCMR3_OC5M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC5P, TIM_OCInitStruct->OCPolarity << 16U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC5E, TIM_OCInitStruct->OCState << 16U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the Output Idle state */
MODIFY_REG(TIMx->CR2, TIM_CR2_OIS5, TIM_OCInitStruct->OCIdleState << 8U);
}
/* Write to TIMx CCMR3 */
LL_TIM_WriteReg(TIMx, CCMR3, tmpccmr3);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH5(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 6.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 6 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC6Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr3;
uint32_t tmpccer;
/* Check the parameters */
assert_param(IS_TIM_CC6_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 5: Reset the CC6E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC6E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CCMR3 register value */
tmpccmr3 = LL_TIM_ReadReg(TIMx, CCMR3);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr3, TIM_CCMR3_OC6M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC6P, TIM_OCInitStruct->OCPolarity << 20U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC6E, TIM_OCInitStruct->OCState << 20U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the Output Idle state */
MODIFY_REG(TIMx->CR2, TIM_CR2_OIS6, TIM_OCInitStruct->OCIdleState << 10U);
}
/* Write to TIMx CCMR3 */
LL_TIM_WriteReg(TIMx, CCMR3, tmpccmr3);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH6(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 1.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 1 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 1: Reset the CC1E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR1,
(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U);
/* Select the Polarity and set the CC1E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC1P | TIM_CCER_CC1NP),
(TIM_ICInitStruct->ICPolarity | TIM_CCER_CC1E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 2.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 2 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 2: Reset the CC2E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC2E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR1,
(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U);
/* Select the Polarity and set the CC2E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC2P | TIM_CCER_CC2NP),
((TIM_ICInitStruct->ICPolarity << 4U) | TIM_CCER_CC2E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 3.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 3 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC3_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 3: Reset the CC3E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC3E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR2,
(TIM_CCMR2_CC3S | TIM_CCMR2_IC3F | TIM_CCMR2_IC3PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U);
/* Select the Polarity and set the CC3E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC3P | TIM_CCER_CC3NP),
((TIM_ICInitStruct->ICPolarity << 8U) | TIM_CCER_CC3E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 4.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 4 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC4_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 4: Reset the CC4E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC4E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR2,
(TIM_CCMR2_CC4S | TIM_CCMR2_IC4F | TIM_CCMR2_IC4PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U);
/* Select the Polarity and set the CC2E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC4P | TIM_CCER_CC4NP),
((TIM_ICInitStruct->ICPolarity << 12U) | TIM_CCER_CC4E));
return SUCCESS;
}
/**
* @}
*/
/**
* @}
*/
#endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM15 || TIM16 || TIM17 || TIM20 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
{
"content_hash": "c2c5ddb197ca6a8a7ad23eb9a8c6cb1a",
"timestamp": "",
"source": "github",
"line_count": 1360,
"max_line_length": 220,
"avg_line_length": 40.50367647058823,
"alnum_prop": 0.6246709630570936,
"repo_name": "armink/rt-thread",
"id": "e3e5f4960284004b8623f373a426e0f4255e70b4",
"size": "55832",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "bsp/stm32/libraries/STM32G4xx_HAL/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_tim.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "15182128"
},
{
"name": "Batchfile",
"bytes": "183497"
},
{
"name": "C",
"bytes": "698243428"
},
{
"name": "C++",
"bytes": "684162"
},
{
"name": "CMake",
"bytes": "139410"
},
{
"name": "CSS",
"bytes": "22422"
},
{
"name": "GDB",
"bytes": "11796"
},
{
"name": "HTML",
"bytes": "1509964"
},
{
"name": "JavaScript",
"bytes": "637"
},
{
"name": "LLVM",
"bytes": "10344"
},
{
"name": "Lex",
"bytes": "7026"
},
{
"name": "Logos",
"bytes": "7238"
},
{
"name": "M4",
"bytes": "17515"
},
{
"name": "Makefile",
"bytes": "444599"
},
{
"name": "Pawn",
"bytes": "1427"
},
{
"name": "Perl",
"bytes": "16728"
},
{
"name": "Python",
"bytes": "2028276"
},
{
"name": "RPC",
"bytes": "14162"
},
{
"name": "Rich Text Format",
"bytes": "177701"
},
{
"name": "Shell",
"bytes": "415474"
},
{
"name": "Tcl",
"bytes": "179"
},
{
"name": "Yacc",
"bytes": "30555"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- android:background="@color/md_white_1000"-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
|
{
"content_hash": "30d929ce215966843eee9e03a52a5136",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.6905263157894737,
"repo_name": "Pisceslau/WishStar",
"id": "1f577dc759049c9b51f4a44b8d3e55bb5df28195",
"size": "475",
"binary": false,
"copies": "1",
"ref": "refs/heads/Pisceslau",
"path": "app/src/main/res/layout/recycler_view.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "629514"
}
],
"symlink_target": ""
}
|
<div class="container">
<hr />
<div>
<form class="form-horizontal"><div class="form-group">
<label for="sterm" class="col-sm-2 control-label">Search</label><div class="col-sm-10">
<input type="text" class="form-control" id="sterm" placeholder="Filter datasets via title and authors" style="max-width: 300px" ng-model="term">
</div></div></form>
</div>
<hr />
<table class="table table-hover table-responsive">
<thead>
<tr>
<th style="white-space:nowrap"
ng-repeat="field in model.fields track by $index"
ng-if="model.fields[$index].display"
ng-class="{'text-right': model.fields[$index].type == 'number'}"
ng-click="toggleSort($index)">
<span ng-bind-html="field.title"></span>
<i class="fa fa-sort" aria-hidden="true" ng-show="sortColumn != $index"></i>
<i class="fa" ng-class="{'fa-sort-asc': !reverse, 'fa-sort-desc':reverse}"
aria-hidden="true" ng-show="sortColumn == $index"></i>
</th>
</tr>
</thead>
<tbody>
<tr ui-sref="datasets.info.both({dataset: getValue(row, 'dataset_id'), embed: $state.params.embed})" ui-sref-options="{reload:true}" class="clickable"
ng-repeat="row in model.rows | choiceFilter:model.choices:model.fields | dsSearch:term | orderBy:columnValue:reverse:sortComparator">
<td ng-repeat="cell in row track by $index" ng-if="model.fields[$index].display">
<div ng-if="model.fields[$index].type == 'number'">
<div class="text-right" ng-repeat="content in cell" ng-bind="content.value | number"></div>
</div>
<div ng-if="model.fields[$index].type != 'number'">
<div ng-repeat="content in cell" ng-bind-html="content.title"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
|
{
"content_hash": "77b7405da8ad03b4d82d1eb5afb3b404",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 156,
"avg_line_length": 46.6,
"alnum_prop": 0.5901287553648069,
"repo_name": "MapofLife/datasets",
"id": "c4fa4aaee042b927b2bb1f6b67a3d7c39ae8cd82",
"size": "1864",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/static/app/views/table/main.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17192"
},
{
"name": "HTML",
"bytes": "34118"
},
{
"name": "JavaScript",
"bytes": "35601"
},
{
"name": "Shell",
"bytes": "171"
}
],
"symlink_target": ""
}
|
@setlocal
@echo off
REM find current branch
for /f "usebackq tokens=*" %%i in (`git symbolic-ref -q HEAD`) do set "current_branch_ref=%%i"
if defined current_branch_ref set "current_branch=%current_branch_ref:refs/heads/=%"
REM handle detached HEAD
if not defined current_branch (
echo You're not on any branch! Aborting...
goto :eof
)
REM Don't rewrite history on 'develop' or 'master' branches
set __exit=1
if not "%current_branch%"=="master" if not "%current_branch%"=="develop" set __exit=0
if %__exit%==1 (
echo Error: You cannot call this script from 'develop' or 'master'. Change to a topic branch first. Aborting...
goto :eof
)
REM find tracking branch
for /f "usebackq tokens=*" %%i in (`git rev-parse --symbolic-full-name --abbrev-ref @{u}`) do set "tracking_branch=%%i"
if not defined tracking_branch (
echo Error: Branch ^'%current_branch%^' is not tracking a remote branch! First try ^'git branch -u ^<remote^>/^<branch^>^' to set tracking info. Aborting...
goto :eof
)
for /f "usebackq tokens=*" %%i in (`git log --oneline -1`) do set "head_commit=%%i"
choice /C yn /M "Rewrite HEAD commit (%head_commit%) on branch '%current_branch%', and push to '%tracking_branch%'?"
if not %errorlevel%==1 goto :eof
for /f "usebackq tokens=*" %%i in (`git config branch.%current_branch%.remote`) do set "remote=%%i"
if not defined remote (
REM should never happen...
echo Error: could not isolate remote name for tracking branch ^'%tracking_branch%^'! Aborting...
goto :eof
)
for /f "usebackq tokens=*" %%i in (`call echo %%tracking_branch:%remote%/^=%%`) do set "tracking_abbrev=%%i"
git commit --amend --no-edit
git push -f %remote% %current_branch%:%tracking_abbrev%
|
{
"content_hash": "aa8991032304d65cdd571188486479e7",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 160,
"avg_line_length": 39.02272727272727,
"alnum_prop": 0.679673849737915,
"repo_name": "avranju/azure-iot-sdks",
"id": "47392c03f0d0b84118df17c5185746a94fb4c749",
"size": "1717",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/kick_jenkins.cmd",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "107545"
},
{
"name": "C",
"bytes": "2106631"
},
{
"name": "C#",
"bytes": "1517264"
},
{
"name": "C++",
"bytes": "3948105"
},
{
"name": "CMake",
"bytes": "75913"
},
{
"name": "CSS",
"bytes": "492583"
},
{
"name": "HTML",
"bytes": "481"
},
{
"name": "Java",
"bytes": "1327738"
},
{
"name": "JavaScript",
"bytes": "4541401"
},
{
"name": "Makefile",
"bytes": "7015"
},
{
"name": "Objective-C",
"bytes": "2177"
},
{
"name": "PowerShell",
"bytes": "28737"
},
{
"name": "Shell",
"bytes": "31092"
}
],
"symlink_target": ""
}
|
- English (all docs, plugins, etc..)
- PC as black box (simplest description and explanation)
- Software (os, editor, etc tools)
- File encoding [link 1, ru](http://dimox.name/utf-8-without-bom/), [link 2, en](http://kunststube.net/encoding/)
- bit/byte/kbyte, 2binary/10/hex(colors and etc) positional numeral system
- [bit byte and etc, stanford](https://web.stanford.edu/class/cs101/bits-bytes.html)
- Math (expressions (x=y+z), functions(math funcs), matrix), [mathisfun](http://www.mathsisfun.com/index.htm)
- [function](http://www.mathsisfun.com/definitions/function.html)
- [algorithm](http://www.mathsisfun.com/definitions/algorithm.html)
- [0.30000000000000004](http://0.30000000000000004.com/)
- [so different math, video](https://youtu.be/OmJ-4B-mS-Y)
- [recommended short guide for newbies (codeschool), pdf](http://courseware.codeschool.com/beginners_guide/CodeSchool-BeginnersGuideToWebDevelopment.pdf)
- hosting [link, ru wiki](https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D1%81%D1%82%D0%B8%D0%BD%D0%B3)
- dns [link, ru wiki](https://ru.wikipedia.org/wiki/DNS)
- html/css/ DOM!!!
- [dom, on learn.javascript.ru](https://learn.javascript.ru/document)
- semantic html, styleguides
- [principles-for-writing-idiomatic-html](http://forwebdev.ru/html/principles-for-writing-idiomatic-html/)
- [htmlacademy codeguide](https://htmlacademy.github.io/codeguide/)
- [workmanship](http://workmanship.io/)
- [ui kit example](https://s-media-cache-ak0.pinimg.com/736x/5f/c4/0e/5fc40e12a8e42bd5543c3d77ab1df14e.jpg)
- grids (bootstrap, 960, flex) [learnlayout, ru](http://ru.learnlayout.com/)
- emmet (plugin)
- css @support
- css methodologies (BOOCSS, ACSS, BEM, SMACSS), proper naming (en only)
- [css hex colors](https://medium.com/dev-channel/css-hex-colors-demystified-51c712179982)
- [LAYOUTS on developers google](https://developers.google.com/web/fundamentals/design-and-ui/responsive/?hl=en)
- http://tilda.education/courses/web-design/basicsteps/
- graphics editors (photoshop(win/ios) / sketch(ios) / gimp / inkscape -> zeplin / csshat / avocode)
- нарезка, стили слоя, информация о тексте и размерах
- vector vs raster
- [colors guide](https://css-tricks.com/nerds-guide-color-web/)
- [google fonts old site](https://www.google.com/fonts) , [new site](https://fonts.google.com/)
- [bulletproof-font-face](https://github.com/CSSLint/csslint/wiki/bulletproof-font-face) and [fontsquirrel](https://www.fontsquirrel.com/)
- [DevTools in Browsers](https://developer.chrome.com/devtools) | [discover-devtools](http://discover-devtools.codeschool.com/)
- [Devtools youtube ru](https://www.youtube.com/watch?v=nPYmp586EE0)
- [Абсолютные и относительные ссылки](http://htmlbook.ru/samhtml/ssylki/absolyutnye-i-otnositelnye-ssylki)
- [Bash: Основы командной строки, Hexlet](https://ru.hexlet.io/courses/bash)
- [AWK, grep, sed](http://www.grymoire.com/Unix/Awk.html)
- [git official site](https://git-scm.com/)
- [ru, video about git](https://www.youtube.com/watch?v=PEKN8NtBDQ0)
- [try.github.io](https://try.github.io/levels/1/challenges/1)
- [Шпаргалка по Git](https://medium.com/@ABatickaya/%D1%88%D0%BF%D0%B0%D1%80%D0%B3%D0%B0%D0%BB%D0%BA%D0%B0-%D0%BF%D0%BE-git-55eeea487676#.egt8ws81g)
- [git-diff-tips-and-tricks](https://blog.twobucks.co/git-diff-tips-and-tricks/)
- [semver](http://semver.org/lang/ru/) and [picture](http://www.jontejada.com/blog/assets/semver03.png)
- [cors](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests) and [cors-guide](https://medium.com/statuscode/cors-a-guided-tour-4e72230a8739)
- js - [eloquentjavascript_ru online](https://karmazzin.gitbooks.io/eloquentjavascript_ru/content/) ,
[eloquentjavascript_ru github link](https://github.com/karmazzin/eloquentjavascript_ru)
- [Основы программирования, Hexlet](https://ru.hexlet.io/courses/programming-basics)
- [Введение в Javascript](https://ru.hexlet.io/courses/javascript_101)
- [JS: подготовка к работе, Hexlet](https://ru.hexlet.io/courses/javascript_setup)
- [block-scheme](https://ru.wikipedia.org/wiki/%D0%91%D0%BB%D0%BE%D0%BA-%D1%81%D1%85%D0%B5%D0%BC%D0%B0)
- [types intro](https://learn.javascript.ru/types-intro)
- [types basic](http://javascript.ru/basic/types)
- [types array](https://learn.javascript.ru/array)
- [data-structures](https://proglib.io/p/data-structures/)
- After that, read through the following sections in [MDN’s JavaScript guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide):
Grammar and types, Control flow and error handling, Loops and iterations, Functions
- [funfunfunction about this and objects](https://www.youtube.com/watch?v=PIkA60I0dKU)
- objects: composition vs inheritance [Composition over Inheritance, funfunfunction](https://www.youtube.com/watch?v=wfMtDGfHWpA)
- async patterns (callbacks, promises, events, streams)
- jQuery [book ru](http://anton.shevchuk.name/jquery-book/) and [article](http://frontender.info/writing-better-jquery-code/) about better jq code
- Tooling (console/cmd/shell, git, NodeJS, npm, bower, gulp, template engines, preprocessors)
- Ajax, fetch ([fetch mdn link](https://developer.mozilla.org/en/docs/Web/API/Fetch_API)) and fetch [polyfill](https://github.com/github/fetch)
- database (сущности, связи)
- backend api endpoints / rest / restFull
- Rest(restfull) [link, ru](http://eax.me/rest/)
- [ACID](https://en.wikipedia.org/wiki/ACID)
- MVC, abstraction, black box, Frameworks Basic (css/js)
- CS50 intro and matherials from their [study site](https://study.cs50.net/)
- [Function Composition](http://prgssr.ru/development/kompoziciya-funkcij.html)
- [Carrying in JS](http://prgssr.ru/development/vvedenie-v-karrirovanie-v-javascript.html)
- [Что дальше? видео с hexlet Введение в Javascript](https://www.youtube.com/watch?v=ro7dL-Dy3cQ)
- [Хороший каталог общих паттернов design-patterns](https://refactoring.guru/ru/design-patterns/catalog)
- [programming-mental-models, medium](https://medium.com/@preethikasireddy/programming-mental-models-47ccc65eb334#.558qjslzo)
- [glossary-of-modern-javascript-concepts](https://medium.com/devschacht/glossary-of-modern-javascript-concepts-1198b24e8f56)
- [meta-language](http://frantic.im/meta-language)
- [js-modules-formats-loaders-builders](https://tproger.ru/translations/js-modules-formats-loaders-builders/)
- [s-expression](https://en.wikipedia.org/wiki/S-expression)
## PRACTICE on github/codepen :godmode:
- [learnlayout, ru](http://ru.learnlayout.com/)
- git/github
- gulp
- webpack [confusing parts](https://medium.com/@rajaraodv/webpack-the-confusing-parts-58712f8fcad9#.865moi9x7)
- dom/events/validation/list render like in twitch project (learn.javascript.ru)
- [htmlbook practice](http://htmlbook.ru/practical)
- [howtocenter in css](http://howtocenterincss.com/)
- [site to practice components](http://flypixel.com/ui-elements)
- dropdown menu,
- popup,
- responsive layout,
- styled input,
- text and images on the same line
- [webref.ru](https://webref.ru/layout/learn-html-css)
- [onepagelove](https://onepagelove.com/)
- [hover to practice](http://codepen.io/jonathanzwhite/pen/GZVKmE)
- [jscourse tasks](http://jscourse.com/tasks)
- [zfort-js-course](https://github.com/roman01la/zfort-js-course)
## Books
- [frontendhandbook (biggest)](http://www.frontendhandbook.com/)
## Vocabulary
- [functional programming jargon](https://github.com/hemanth/functional-programming-jargon)
- [webstandards ru, dictionary](https://github.com/web-standards-ru/dictionary)
## Online courses
- [freeCodeCamp](https://www.freecodecamp.com/) :free:
- [Hexlet](https://ru.hexlet.io/) :free: / :moneybag:
- [htmlacademy](https://htmlacademy.ru/) :free: / :moneybag:
- [codeschool + guide](https://www.codeschool.com/beginners-guide-to-web-development)
## Future learning
- [Путь программиста](https://map.hexlet.io/)
- [Карта развития веб-разработчика](https://github.com/zualex/devmap)
- [frontend-science-map, en](frontend-science-map.png)
- [Composition over Inheritance, funfunfunction](https://www.youtube.com/watch?v=wfMtDGfHWpA)
- [events, on learn.javascript.ru](https://learn.javascript.ru/events-and-interfaces)
- [Руководство по псевдоклассам и псевдоэлементам](http://prgssr.ru/development/polnoe-rukovodstvo-po-psevdoklassam-i-psevdoelementam.html)
- [Pure functions](https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-pure-function-d1c076bec976#.7hkf30999)
- [Semantic Versioning, SemVer](http://semver.org/)
- [Лексическая область видимости функций в JavaScript, Habr](https://habrahabr.ru/post/149526/)
- [Область видимости в JavaScript, Habr](https://habrahabr.ru/post/127482/)
- [JS Closures](https://medium.freecodecamp.com/lets-learn-javascript-closures-66feb44f6a44#.p3qti2sr6)
- [junior-middle-senior, ru](http://frontender.info/programmirovanie-klassami-v-veb-prilozheniyakh/)
- [js-by-examples](https://github.com/bmkmanoj/js-by-examples)
- [pure functions](https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-pure-function-d1c076bec976#.1qaexrxzx)
- [js modules, ru, webtackles](http://webtackles.ru/javascript/js-modules-beginners-guide/)
- [js module bundling, ru, webtackles](http://webtackles.ru/javascript/js-module-bundling/)
- [JavaScript-Garden ru](https://bonsaiden.github.io/JavaScript-Garden/ru/)
- [blind type speed test](https://vse10.ru/)
- [blind type speed practice](http://10fastfingers.com/typing-test/russian)
- [Ошибка. Осознание, примирение, извлечение пользы](https://vimeo.com/17626272)
- 7 смертных грехов программиста
- [Уныние](https://medium.com/@xanf/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D1%83%D0%BD%D1%8B%D0%BD%D0%B8%D0%B5-ac514112cb2d#.qrse6bhmw)
- [Гнев](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D0%B3%D0%BD%D0%B5%D0%B2-3bfa60d72de0#.vmktacfk5)
- [Зависть](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D1%82%D1%8C-330d3dfbc52a#.pco7xyac3)
- [Гордыня](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D0%B3%D0%BE%D1%80%D0%B4%D1%8B%D0%BD%D1%8F-fffd58553f8f#.fez0orbk8)
- [Уныние](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D1%83%D0%BD%D1%8B%D0%BD%D0%B8%D0%B5-ac514112cb2d#.7mwtdt8qq)
- [Чревоугодие](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D1%87%D1%80%D0%B5%D0%B2%D0%BE%D1%83%D0%B3%D0%BE%D0%B4%D0%B8%D0%B5-e673f677b04b#.bynrynh8u)
- [Алчность](https://medium.com/russian/7-%D0%B3%D1%80%D0%B5%D1%85%D0%BE%D0%B2-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82%D0%B0-%D0%B0%D0%BB%D1%87%D0%BD%D0%BE%D1%81%D1%82%D1%8C-c5b352d51dd4#.n54ggoby2)
- [Как быть начинающим разработчиком и не сойти с ума](http://blog.csssr.ru/2016/09/19/how-to-be-a-beginner-developer/)
- [Quantum Computers Explained – Limits of Human Technology](https://www.youtube.com/watch?v=JhHMJCUmq28)
- [Wiki Unix](https://ru.wikipedia.org/wiki/UNIX)
- [Linux intro](http://gentoo.theserverside.ru/gentoo-doc/Gentoo_doc-1.5-6.html)
- [medium, Я б в верстальщики пошел](https://medium.com/russian/%D1%8F-%D0%B1-%D0%B2-%D0%B2%D0%B5%D1%80%D1%81%D1%82%D0%B0%D0%BB%D1%8C%D1%89%D0%B8%D0%BA%D0%B8-%D0%BF%D0%BE%D1%88%D0%B5%D0%BB-4496f8eec698#.bfp6zlz8s)
- [Разработка расширяемых компонентов на HTML и CSS, prgssr, ru](http://prgssr.ru/development/razrabotka-rasshiryaemyh-komponentov-html-i-css.html)
- [install and play, css layout visualization](http://pesticide.io/)
- [google guide-to-technical-development, en](https://www.google.com/about/careers/students/guide-to-technical-development.html)
- [patterns, hexlet, ru](https://www.youtube.com/watch?v=wX6BBaQZpzE)
- [FIZZLEFADE, habr, ru](https://habrahabr.ru/post/337036/) or [original](http://fabiensanglard.net/fizzlefade/index.php)
- [0x5f3759df](https://habrahabr.ru/company/infopulse/blog/336110/) or [original](http://h14s.p5r.org/2012/09/0x5f3759df.html?mwh=1)
- [Lambda Calculus](https://youtu.be/eis11j_iGMs)
- [Functional Programming's Y Combinator](https://youtu.be/9T8A89jgeTI)
- [Map of Computer Science](https://youtu.be/SzJ46YA_RaA)
## Sources
- [ui-developer-skills](http://krekotun.ru/ui-developer-skills)
- [From Zero to Front-end Hero (Part 1)](https://medium.freecodecamp.com/from-zero-to-front-end-hero-part-1-7d4f7f0bff02#.p0pooc2p6)
- [From Zero to Front-end Hero (Part 2)](https://medium.freecodecamp.com/from-zero-to-front-end-hero-part-2-adfa4824da9b#.uj93oo4y8)
- [From Carpenter to Front End Developer in under 5 months](https://medium.freecodecamp.com/this-is-my-story-about-how-i-went-from-being-a-carpenter-with-zero-experience-in-the-tech-world-to-4252e93cb73#.azj4fczdn)
- [cs50](http://cs50.tv/2015/fall/)
## Libraries used by other projects
- [slack](https://slack.com/libs/desktop)
|
{
"content_hash": "b9650096428647c1e3b204d1b587bf72",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 248,
"avg_line_length": 75.95977011494253,
"alnum_prop": 0.7396534765831884,
"repo_name": "ikeagold/999-gists-snippets-patterns",
"id": "feff1c784d32e86ef8b5c1d24fbf4268eadbbc4c",
"size": "13848",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frontend/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "57"
},
{
"name": "CoffeeScript",
"bytes": "2061"
},
{
"name": "HTML",
"bytes": "17169"
},
{
"name": "JavaScript",
"bytes": "18993"
},
{
"name": "Shell",
"bytes": "54829"
}
],
"symlink_target": ""
}
|
#pragma once
#include <vector>
#include <string>
namespace celix::rsa {
/**
* @brief Config property for the configured endpoints files.
*
* Configured files will be read by the configured discovery manager during startup and the file will not
* be monitored for updates.
* Should be a string and can contain multiple entries ',' separated.
*/
constexpr const char *const CONFIGURED_DISCOVERY_DISCOVERY_FILES = "CELIX_RSA_CONFIGURED_DISCOVERY_DISCOVERY_FILES";
/**
* @brief The IConfiguredDiscoveryManager interface.
*
* Expected configured endpoint json format:
* {
* "endpoints": [
* {
* "endpoint.id": "id-01",
* "service.imported": true,
* "service.imported.configs": ["pubsub"],
* "service.exported.interfaces": "IHardcodedService",
* "endpoint.objectClass": "TestComponentName",
* "endpoint.anykey" : "anyval"
* }
* ]
* }
*/
class IConfiguredDiscoveryManager {
public:
virtual ~IConfiguredDiscoveryManager() noexcept = default;
/**
* @brief Adds a configured discovery file to the discovery manager.
* @param path Path to a discovery file
* @throws celix::rsa::RemoteException if the path is incorrect or if the file format is invalid.
*/
virtual void addConfiguredDiscoveryFile(const std::string& path) = 0;
/**
* @brief Removes a configured discovery file to the discovery manager.
* @param path Path to a discovery file
*/
virtual void removeConfiguredDiscoveryFile(const std::string& path) = 0;
/**
* @brief List the (valid) configured discovery files known to this configured discovery manager.
*/
virtual std::vector<std::string> getConfiguredDiscoveryFiles() const = 0;
};
}
|
{
"content_hash": "d78e3b33ddf151a3b31f914f12ded3a3",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 120,
"avg_line_length": 36.107142857142854,
"alnum_prop": 0.5875370919881305,
"repo_name": "apache/celix",
"id": "56b364981ac1e7058dfd9a72e66007beca3b27c0",
"size": "2830",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "bundles/cxx_remote_services/discovery_configured/include/celix/rsa/IConfiguredDiscoveryManager.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "2190"
},
{
"name": "C",
"bytes": "4907267"
},
{
"name": "C++",
"bytes": "1718056"
},
{
"name": "CMake",
"bytes": "466066"
},
{
"name": "HTML",
"bytes": "3361"
},
{
"name": "JavaScript",
"bytes": "27661"
},
{
"name": "Python",
"bytes": "12206"
},
{
"name": "Shell",
"bytes": "14359"
}
],
"symlink_target": ""
}
|
//package de.mannheim.uni.ds4dm.searcher;
//
//import java.io.File;
//import java.io.IOException;
//
//import org.apache.commons.io.FileUtils;
//
//import com.fasterxml.jackson.core.JsonParseException;
//import com.fasterxml.jackson.databind.JsonMappingException;
//import com.rapidminer.extension.json.JSONRelatedTablesRequest;
//
//import de.mannheim.uni.ds4dm.demo1.exploreData.GenerateMatchingExample_withKeywords;
//import de.mannheim.uni.ds4dm.utils.ReadWriteGson;
//
//public class TeastSearch {
// //TODO change
// static File tebleReositoryFolder = new File(
// "/Users/annalisa/Documents/AllWorkspaces/ds4dm/ds4dw_WebService/public/exampleData/mappings");
//
//
//
// public static void search(){
//
// File request = new File("/Users/annalisa/Documents/AllWorkspaces/ds4dm/ds4dw_WebService/public/exampleData/request_temp.json");
// try {
// String json_str = FileUtils.readFileToString(request);
// } catch (IOException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
//
//
// File response = new File("/Users/annalisa/Documents/AllWorkspaces/ds4dm/ds4dw_WebService/public/exampleData/response.json");
//
//
// JSONRelatedTablesRequest qts = new JSONRelatedTablesRequest();
// try {
//
//
//
//// qts = mapper.readValue(json_str, JSONRelatedTablesRequest.class);
//
// ReadWriteGson<JSONRelatedTablesRequest> rwj = new ReadWriteGson<JSONRelatedTablesRequest>(qts);
// qts = rwj.fromJson(request);
//
// System.out.println(qts.toString());
//
// } catch (JsonParseException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (JsonMappingException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
///* try {
//
// JSONRelatedTablesRequest qts = new JSONRelatedTablesRequest();
//
// ReadWriteGson<JSONRelatedTablesRequest> rwj = new ReadWriteGson<JSONRelatedTablesRequest>(qts);
// qts = rwj.fromJson(request);
//
// System.out.println(qts.toString());
// } catch (Exception e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }*/
//// mapping = objectMapper.readValue(json , JSONTableResponse.class);
//
//
//// JsonFactory jsonFactory = new JsonFactory();
//// File request = new File("public/exampleData/request_temp.json");
////
//// JsonGenerator jsonGen;
//// try {
//// jsonGen = jsonFactory.createGenerator(request, JsonEncoding.UTF8);
//// jsonGen.writeObject(qts);
////
//// } catch (IOException e) {
//// // TODO Auto-generated catch block
//// e.printStackTrace();
//// }
//
//// List<String> att = qts.getExtensionAttributes();
//// DS4DMBasicMatcher matcher = new DS4DMBasicMatcher(qts);
//
//
// CandidateBuilder_fromJsonFolder candBuilder = new CandidateBuilder_fromJsonFolder(tebleReositoryFolder);
// File fetchedTablesFolder = new File("/Users/annalisa/Documents/AllWorkspaces/ds4dm/ds4dw_WebService/public/exampleData/tables");
// if (!fetchedTablesFolder.exists())
// fetchedTablesFolder.mkdirs();
// GenerateMatchingExample_withKeywords.serchTables(request, fetchedTablesFolder, response, candBuilder);
//
//
// }
//
// public static void main(String[] args) {
// search();
//
// }
//}
|
{
"content_hash": "ecd1f20b4ee28473ff0412408337c4e9",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 133,
"avg_line_length": 32.625,
"alnum_prop": 0.6834659593280283,
"repo_name": "AnLiGentile/DS4DM",
"id": "7498bb7b1d0380c1b8bb92e6225607b05d1d20d6",
"size": "3393",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DS4DM_Backend/src/de/mannheim/uni/ds4dm/searcher/TeastSearch.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "356"
},
{
"name": "CSS",
"bytes": "8742"
},
{
"name": "HTML",
"bytes": "2256729"
},
{
"name": "Java",
"bytes": "1161375"
},
{
"name": "JavaScript",
"bytes": "2758151"
},
{
"name": "Scala",
"bytes": "19483"
},
{
"name": "Shell",
"bytes": "2077"
},
{
"name": "XSLT",
"bytes": "85719"
}
],
"symlink_target": ""
}
|
cask 'vorta' do
version '0.6.4'
sha256 '3cab5b2523c11250af9622a50f676c7e3488e47fcaa550272364466523b34f06'
url "https://github.com/borgbase/vorta/releases/download/v#{version}/vorta-#{version}.dmg"
appcast 'https://github.com/borgbase/vorta/releases.atom'
name 'Vorta'
homepage 'https://github.com/borgbase/vorta'
auto_updates true
depends_on macos: '>= :high_sierra'
app 'Vorta.app'
zap trash: '~/Library/Application Support/Vorta'
end
|
{
"content_hash": "aee928fb670f10b5e7eb9abc2375cda3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 92,
"avg_line_length": 28.75,
"alnum_prop": 0.741304347826087,
"repo_name": "maxnordlund/homebrew-cask",
"id": "121e4451eccbc5990d4e07e770e4be0b54436494",
"size": "460",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Casks/vorta.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "2244014"
},
{
"name": "Shell",
"bytes": "34938"
}
],
"symlink_target": ""
}
|
//-----------------------------------------------------------------------
// Copyright 2017 Roman Tumaykin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// 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.
//-----------------------------------------------------------------------
using System;
using System.IO;
using SsisBuild.Tests.Helpers;
using Xunit;
namespace SsisBuild.Logger.Tests
{
public class LoggerTests
{
[Fact]
public void Pass_Message()
{
// Setup
var stdOut = Console.Out;
var consoleOutput = new StringWriter();
var message = Fakes.RandomString();
var logger = new ConsoleLogger();
// Execute
try
{
Console.SetOut(consoleOutput);
logger.LogMessage(message);
}
finally
{
Console.SetOut(stdOut);
}
// Assert
Assert.True(consoleOutput.ToString().Contains(message));
}
[Fact]
public void Pass_Warning()
{
// Setup
var stdOut = Console.Out;
var consoleOutput = new StringWriter();
var message = Fakes.RandomString();
var logger = new ConsoleLogger();
// Execute
try
{
Console.SetOut(consoleOutput);
logger.LogWarning(message);
}
finally
{
Console.SetOut(stdOut);
}
// Assert
Assert.True(consoleOutput.ToString().Contains(message));
}
[Fact]
public void Pass_Error()
{
// Setup
var stdOut = Console.Out;
var consoleOutput = new StringWriter();
var message = Fakes.RandomString();
var logger = new ConsoleLogger();
// Execute
try
{
Console.SetOut(consoleOutput);
logger.LogError(message);
}
finally
{
Console.SetOut(stdOut);
}
// Assert
Assert.True(consoleOutput.ToString().Contains(message));
}
}
}
|
{
"content_hash": "5bb8633c4ae705a29a6af89bd893bad8",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 77,
"avg_line_length": 27.306930693069308,
"alnum_prop": 0.4916606236403191,
"repo_name": "rtumaykin/ssis-build",
"id": "e641abf820d5aa1a3f2d09e7090b763f39171011",
"size": "2760",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/SsisBuild.Logger.Tests/LoggerTests.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "875"
},
{
"name": "C#",
"bytes": "423450"
},
{
"name": "F#",
"bytes": "8259"
},
{
"name": "PowerShell",
"bytes": "2581"
}
],
"symlink_target": ""
}
|
namespace chromeos {
class CountingNewWindowClient : public ash::mojom::NewWindowClient {
public:
CountingNewWindowClient() {}
~CountingNewWindowClient() override {}
int new_tab_action_count() const { return new_tab_action_count_; }
// ash::mojom::NewWindowClient:
void NewTab() override { new_tab_action_count_++; }
void NewWindow(bool incognito) override {}
void OpenFileManager() override {}
void OpenCrosh() override {}
void OpenGetHelp() override {}
void RestoreTab() override {}
void ShowKeyboardOverlay() override {}
void ShowTaskManager() override {}
void OpenFeedbackPage() override {}
private:
int new_tab_action_count_ = 0;
DISALLOW_COPY_AND_ASSIGN(CountingNewWindowClient);
};
class StickyKeysBrowserTest : public InProcessBrowserTest {
public:
void SetUpOnMainThread() override {
content::BrowserTestBase::SetUpOnMainThread();
event_generator_.reset(
new ui::test::EventGenerator(browser()->window()->GetNativeWindow()));
new_window_client_ = new CountingNewWindowClient;
ash::WmShellTestApi().SetNewWindowClient(
base::WrapUnique(new_window_client_));
}
protected:
StickyKeysBrowserTest() {}
~StickyKeysBrowserTest() override {}
void EnableStickyKeys() {
AccessibilityManager::Get()->EnableStickyKeys(true);
}
void DisableStickyKeys() {
AccessibilityManager::Get()->EnableStickyKeys(false);
}
ash::SystemTray* GetSystemTray() {
return ash::Shell::GetInstance()->GetPrimarySystemTray();
}
void SendKeyPress(ui::KeyboardCode key) {
event_generator_->PressKey(key, ui::EF_NONE);
event_generator_->ReleaseKey(key, ui::EF_NONE);
}
content::NotificationRegistrar registrar_;
std::unique_ptr<ui::test::EventGenerator> event_generator_;
CountingNewWindowClient* new_window_client_;
DISALLOW_COPY_AND_ASSIGN(StickyKeysBrowserTest);
};
IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OpenTrayMenu) {
EnableStickyKeys();
// Open system tray bubble with shortcut.
SendKeyPress(ui::VKEY_MENU); // alt key.
SendKeyPress(ui::VKEY_SHIFT);
SendKeyPress(ui::VKEY_S);
EXPECT_TRUE(GetSystemTray()->HasSystemBubble());
// Hide system bubble.
GetSystemTray()->CloseSystemBubble();
EXPECT_FALSE(GetSystemTray()->HasSystemBubble());
// Pressing S again should not reopen the bubble.
SendKeyPress(ui::VKEY_S);
EXPECT_FALSE(GetSystemTray()->HasSystemBubble());
// With sticky keys disabled, we will fail to perform the shortcut.
DisableStickyKeys();
SendKeyPress(ui::VKEY_MENU); // alt key.
SendKeyPress(ui::VKEY_SHIFT);
SendKeyPress(ui::VKEY_S);
EXPECT_FALSE(GetSystemTray()->HasSystemBubble());
}
IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OpenNewTabs) {
// Lock the modifier key.
EnableStickyKeys();
SendKeyPress(ui::VKEY_CONTROL);
SendKeyPress(ui::VKEY_CONTROL);
// In the locked state, pressing 't' should open a new tab each time.
int tab_count = 0;
for (; tab_count < 4; ++tab_count) {
EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
SendKeyPress(ui::VKEY_T);
}
// Unlock the modifier key and shortcut should no longer activate.
SendKeyPress(ui::VKEY_CONTROL);
SendKeyPress(ui::VKEY_T);
EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
// Shortcut should not work after disabling sticky keys.
DisableStickyKeys();
SendKeyPress(ui::VKEY_CONTROL);
SendKeyPress(ui::VKEY_CONTROL);
SendKeyPress(ui::VKEY_T);
EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
}
IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, CtrlClickHomeButton) {
// Show home page button.
browser()->profile()->GetPrefs()->SetBoolean(prefs::kShowHomeButton, true);
TabStripModel* tab_strip_model = browser()->tab_strip_model();
int tab_count = 1;
EXPECT_EQ(tab_count, tab_strip_model->count());
// Test sticky keys with modified mouse click action.
EnableStickyKeys();
SendKeyPress(ui::VKEY_CONTROL);
ui_test_utils::ClickOnView(browser(), VIEW_ID_HOME_BUTTON);
EXPECT_EQ(++tab_count, tab_strip_model->count());
ui_test_utils::ClickOnView(browser(), VIEW_ID_HOME_BUTTON);
EXPECT_EQ(tab_count, tab_strip_model->count());
// Test locked modifier key with mouse click.
SendKeyPress(ui::VKEY_CONTROL);
SendKeyPress(ui::VKEY_CONTROL);
for (; tab_count < 5; ++tab_count) {
EXPECT_EQ(tab_count, tab_strip_model->count());
ui_test_utils::ClickOnView(browser(), VIEW_ID_HOME_BUTTON);
}
SendKeyPress(ui::VKEY_CONTROL);
ui_test_utils::ClickOnView(browser(), VIEW_ID_HOME_BUTTON);
EXPECT_EQ(tab_count, tab_strip_model->count());
// Test disabling sticky keys prevent modified mouse click.
DisableStickyKeys();
SendKeyPress(ui::VKEY_CONTROL);
ui_test_utils::ClickOnView(browser(), VIEW_ID_HOME_BUTTON);
EXPECT_EQ(tab_count, tab_strip_model->count());
}
IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, SearchLeftOmnibox) {
EnableStickyKeys();
OmniboxView* omnibox =
browser()->window()->GetLocationBar()->GetOmniboxView();
// Give the omnibox focus.
omnibox->SetFocus();
// Make sure that the AppList is not erroneously displayed and the omnibox
// doesn't lose focus.
EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility());
EXPECT_TRUE(omnibox->GetNativeView()->HasFocus());
// Type 'foo'.
SendKeyPress(ui::VKEY_F);
SendKeyPress(ui::VKEY_O);
SendKeyPress(ui::VKEY_O);
// Verify the location of the caret.
size_t start, end;
omnibox->GetSelectionBounds(&start, &end);
ASSERT_EQ(3U, start);
ASSERT_EQ(3U, end);
EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility());
EXPECT_TRUE(omnibox->GetNativeView()->HasFocus());
// Hit Home by sequencing Search (left Windows) and Left (arrow).
SendKeyPress(ui::VKEY_LWIN);
SendKeyPress(ui::VKEY_LEFT);
EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility());
EXPECT_TRUE(omnibox->GetNativeView()->HasFocus());
// Verify caret moved to the beginning.
omnibox->GetSelectionBounds(&start, &end);
ASSERT_EQ(0U, start);
ASSERT_EQ(0U, end);
}
IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OverlayShown) {
const ui::KeyboardCode modifier_keys[] = { ui::VKEY_CONTROL,
ui::VKEY_SHIFT,
ui::VKEY_MENU,
ui::VKEY_COMMAND };
// Overlay should not be visible if sticky keys is not enabled.
ash::StickyKeysController* controller =
ash::Shell::GetInstance()->sticky_keys_controller();
EXPECT_FALSE(controller->GetOverlayForTest());
for (auto key_code : modifier_keys) {
SendKeyPress(key_code);
EXPECT_FALSE(controller->GetOverlayForTest());
}
// Cycle through the modifier keys and make sure each gets shown.
EnableStickyKeys();
ash::StickyKeysOverlay* sticky_keys_overlay = controller->GetOverlayForTest();
for (auto key_code : modifier_keys) {
SendKeyPress(key_code);
EXPECT_TRUE(sticky_keys_overlay->is_visible());
SendKeyPress(key_code);
EXPECT_TRUE(sticky_keys_overlay->is_visible());
SendKeyPress(key_code);
EXPECT_FALSE(sticky_keys_overlay->is_visible());
}
// Disabling sticky keys should hide the overlay.
SendKeyPress(ui::VKEY_CONTROL);
EXPECT_TRUE(sticky_keys_overlay->is_visible());
DisableStickyKeys();
EXPECT_FALSE(controller->GetOverlayForTest());
for (auto key_code : modifier_keys) {
SendKeyPress(key_code);
EXPECT_FALSE(controller->GetOverlayForTest());
}
}
} // namespace chromeos
|
{
"content_hash": "ddde6951dc490a229892ac284d16e6e5",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 80,
"avg_line_length": 32.68695652173913,
"alnum_prop": 0.6975259377494014,
"repo_name": "Samsung/ChromiumGStreamerBackend",
"id": "ee08de0100989767045c1412c6782a9f5fdbf6a5",
"size": "8835",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
package es.predictia.util.time;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class Waiter {
public static void sleepWithTimeOut(final long sleepInterval, final AwakeningCondition condition, long timeOut, TimeUnit timeOutUnit) throws InterruptedException, ExecutionException{
if(TimeUnit.MILLISECONDS.convert(timeOut, timeOutUnit) < sleepInterval){
throw new IllegalArgumentException("Sleep interval should be greather than timeout");
}
Throwable e = Timeouts.callWithTimeOut(new Callable<Throwable>() {
@Override
public Throwable call() throws Exception {
try{
do{
Thread.sleep(sleepInterval);
}while(!condition.wakeUp());
}catch(Throwable e){
LOGGER.info("Exception while waiting for process: " + e.getMessage());
return e;
}
return null;
}
}, timeOut, timeOutUnit);
if(e instanceof InterruptedException){
throw (InterruptedException) e;
}else if(e != null){
throw new ExecutionException(e);
}
}
private static final Logger LOGGER = LoggerFactory.getLogger(Waiter.class);
}
|
{
"content_hash": "0bf38337a2480eb10a5946cfe26d6c84",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 183,
"avg_line_length": 29.925,
"alnum_prop": 0.7418546365914787,
"repo_name": "Predictia/util",
"id": "7c1a9b2a12469acf1f17920042e9a71cb7d37af6",
"size": "1197",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/es/predictia/util/time/Waiter.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "230075"
}
],
"symlink_target": ""
}
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); 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.
-->
<html>
<body>
Apache Solr Search Server: Scripting module
<p>
This package provides an Update Processor that allows for Java scripting engines
to be used during the Solr document update processing.
</p>
</body>
</html>
|
{
"content_hash": "2e6cb60441b8be8329dadb409fca9655",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 38.30769230769231,
"alnum_prop": 0.7791164658634538,
"repo_name": "apache/solr",
"id": "823fe062a0121d2ed02fcfa77ea6edc37e4a2628",
"size": "996",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "solr/modules/scripting/src/java/overview.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "509"
},
{
"name": "Batchfile",
"bytes": "91853"
},
{
"name": "CSS",
"bytes": "234034"
},
{
"name": "Emacs Lisp",
"bytes": "73"
},
{
"name": "HTML",
"bytes": "326277"
},
{
"name": "Handlebars",
"bytes": "7549"
},
{
"name": "Java",
"bytes": "35849436"
},
{
"name": "JavaScript",
"bytes": "17639"
},
{
"name": "Python",
"bytes": "219385"
},
{
"name": "Shell",
"bytes": "279599"
},
{
"name": "XSLT",
"bytes": "35107"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>API Help (Play! 2.x Provider for Play! 2.2.x 1.0.0-alpha9 API)</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help (Play! 2.x Provider for Play! 2.2.x 1.0.0-alpha9 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="com/google/code/play2/provider/play22/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="com/google/code/play2/provider/play22/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">How This API Document Is Organized</h1>
<div class="subTitle">This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.</div>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<h2>Package</h2>
<p>Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:</p>
<ul>
<li>Interfaces (italic)</li>
<li>Classes</li>
<li>Enums</li>
<li>Exceptions</li>
<li>Errors</li>
<li>Annotation Types</li>
</ul>
</li>
<li class="blockList">
<h2>Class/Interface</h2>
<p>Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:</p>
<ul>
<li>Class inheritance diagram</li>
<li>Direct Subclasses</li>
<li>All Known Subinterfaces</li>
<li>All Known Implementing Classes</li>
<li>Class/interface declaration</li>
<li>Class/interface description</li>
</ul>
<ul>
<li>Nested Class Summary</li>
<li>Field Summary</li>
<li>Constructor Summary</li>
<li>Method Summary</li>
</ul>
<ul>
<li>Field Detail</li>
<li>Constructor Detail</li>
<li>Method Detail</li>
</ul>
<p>Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</p>
</li>
<li class="blockList">
<h2>Annotation Type</h2>
<p>Each annotation type has its own separate page with the following sections:</p>
<ul>
<li>Annotation Type declaration</li>
<li>Annotation Type description</li>
<li>Required Element Summary</li>
<li>Optional Element Summary</li>
<li>Element Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Enum</h2>
<p>Each enum has its own separate page with the following sections:</p>
<ul>
<li>Enum declaration</li>
<li>Enum description</li>
<li>Enum Constant Summary</li>
<li>Enum Constant Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Use</h2>
<p>Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</p>
</li>
<li class="blockList">
<h2>Tree (Class Hierarchy)</h2>
<p>There is a <a href="overview-tree.html">Class Hierarchy</a> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.</p>
<ul>
<li>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.</li>
<li>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</li>
</ul>
</li>
<li class="blockList">
<h2>Deprecated API</h2>
<p>The <a href="deprecated-list.html">Deprecated API</a> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</p>
</li>
<li class="blockList">
<h2>Index</h2>
<p>The <a href="index-all.html">Index</a> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</p>
</li>
<li class="blockList">
<h2>Prev/Next</h2>
<p>These links take you to the next or previous class, interface, package, or related page.</p>
</li>
<li class="blockList">
<h2>Frames/No Frames</h2>
<p>These links show and hide the HTML frames. All pages are available with or without frames.</p>
</li>
<li class="blockList">
<h2>All Classes</h2>
<p>The <a href="allclasses-noframe.html">All Classes</a> link shows all classes and interfaces except non-static nested types.</p>
</li>
<li class="blockList">
<h2>Serialized Form</h2>
<p>Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.</p>
</li>
<li class="blockList">
<h2>Constant Field Values</h2>
<p>The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.</p>
</li>
</ul>
<em>This help file applies to API documentation generated using the standard doclet.</em></div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="com/google/code/play2/provider/play22/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="com/google/code/play2/provider/play22/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2013–2014. All rights reserved.</small></p>
</body>
</html>
|
{
"content_hash": "12f492097035f809c84c3bcb9340bc60",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 497,
"avg_line_length": 39.76635514018692,
"alnum_prop": 0.7035252643948297,
"repo_name": "play2-maven-plugin/play2-maven-plugin.github.io",
"id": "583c0a3aa987593c9d8b510c867a7eb689ba1cb1",
"size": "8510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "play2-maven-plugin/1.0.0-alpha9/play2-providers/play2-provider-play22/apidocs/help-doc.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2793124"
},
{
"name": "HTML",
"bytes": "178221432"
},
{
"name": "JavaScript",
"bytes": "120742"
}
],
"symlink_target": ""
}
|
namespace remoting {
// Used to indicate an error during a security key forwarding session.
extern const char kSecurityKeyConnectionError[];
// Returns the name of the well-known IPC server channel used to initiate a
// security key forwarding session.
const std::string& GetSecurityKeyIpcChannelName();
// Sets the name of the well-known IPC server channel for testing purposes.
void SetSecurityKeyIpcChannelNameForTest(const std::string& channel_name);
// Returns a path appropriate for placing a channel name. Without this path
// prefix, we may not have permission on linux to bind(2) a socket to a name in
// the current directory.
std::string GetChannelNamePathPrefixForTest();
} // namespace remoting
#endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_CONSTANTS_H_
|
{
"content_hash": "91161cb700d611c7e504bf669b3bd128",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 39.2,
"alnum_prop": 0.7818877551020408,
"repo_name": "danakj/chromium",
"id": "236e6d9749bf4c6943535ec54efa7782cd33831b",
"size": "1100",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "remoting/host/security_key/security_key_ipc_constants.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
module Main where
import Control.Monad
import System.IO
import System.Environment
import Lolscheme.Data
import Lolscheme.Parser
import Lolscheme.Evaluator
import Lolscheme.Environment
flushStr :: String -> IO()
flushStr str = putStr str >> hFlush stdout
readPrompt :: String -> IO String
readPrompt prompt = flushStr prompt >> getLine
evalString :: Env -> String -> IO String
evalString env expr = runIOThrows $ liftM show $ (liftThrows $ readExpr expr) >>= eval env
evalAndPrint :: Env -> String -> IO()
evalAndPrint env expr = evalString env expr >>= putStrLn
until_ :: Monad m => (a -> Bool) -> m a -> (a -> m ()) -> m ()
until_ pred prompt action = do
result <- prompt
if pred result
then return ()
else action result >> until_ pred prompt action
runOne :: [String] -> IO ()
runOne args = do
env <- primitiveBindings >>= flip bindVars [("args", List $ map String $ drop 1 args)]
(runIOThrows $ liftM show $ eval env (List [Atom "load", String (args !! 0)]))
>>= hPutStrLn stderr
runRepl :: IO ()
runRepl = primitiveBindings >>= until_ (=="quit") (readPrompt "lolscheme>>> ") . evalAndPrint
main :: IO()
main = do args <- getArgs
if null args then runRepl else runOne $ args
|
{
"content_hash": "0aadc9b4f29599ba6bf86db81b5eeb17",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 93,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.6666666666666666,
"repo_name": "qbyt/lolscheme",
"id": "8bebf45fae1891cc9bcf5766110a858cd5263ece",
"size": "1236",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Main.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "1308"
}
],
"symlink_target": ""
}
|
<!--
@license Apache-2.0
Copyright (c) 2018 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
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.
-->
# Dirac Delta
> Evaluate the [Dirac delta function][dirac-delta-function].
<section class="intro">
The [Dirac delta function][dirac-delta-function] may be loosely defined as
<!-- <equation class="equation" label="eq:dirac_delta" align="center" raw="\delta = \begin{cases} \infty & \textrm{if}\ x = 0 \\ 0 & \textrm{if}\ x \neq 0\end{cases}" alt="Dirac delta function."> -->
<div class="equation" align="center" data-raw-text="\delta = \begin{cases} \infty & \textrm{if}\ x = 0 \\ 0 & \textrm{if}\ x \neq 0\end{cases}" data-equation="eq:dirac_delta">
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/dirac-delta/docs/img/equation_dirac_delta.svg" alt="Dirac delta function.">
<br>
</div>
<!-- </equation> -->
and is constrained to satisfy the identity
<!-- <equation class="equation" label="eq:dirac_delta_integral" align="center" raw="\int^{+\infty}_{-\infty} \delta(x)\ dx = 1" alt="Dirac delta function integral."> -->
<div class="equation" align="center" data-raw-text="\int^{+\infty}_{-\infty} \delta(x)\ dx = 1" data-equation="eq:dirac_delta_integral">
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/dirac-delta/docs/img/equation_dirac_delta_integral.svg" alt="Dirac delta function integral.">
<br>
</div>
<!-- </equation> -->
Note that the [Dirac delta function][dirac-delta-function] is **not** a function in the traditional sense, as any real-valued function which is zero everywhere except at a single point, must have an integral equal to `0`.
</section>
<!-- /.intro -->
<section class="usage">
## Usage
```javascript
var diracDelta = require( '@stdlib/math/base/special/dirac-delta' );
```
#### diracDelta( x )
Evaluates the [Dirac delta function][dirac-delta-function].
```javascript
var v = diracDelta( 0.0 );
// returns Infinity
v = diracDelta( 3.14 );
// returns 0.0
v = diracDelta( NaN );
// returns NaN
```
</section>
<!-- /.usage -->
<section class="examples">
## Examples
<!-- eslint no-undef: "error" -->
```javascript
var linspace = require( '@stdlib/array/base/linspace' );
var diracDelta = require( '@stdlib/math/base/special/dirac-delta' );
var x = linspace( -1.0, 1.0, 101 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( 'dirac(%d) = %d', x[ i ], diracDelta( x[ i ] ) );
}
```
</section>
<!-- /.examples -->
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
<section class="related">
* * *
## See Also
- <span class="package-name">[`@stdlib/math/base/special/kronecker-delta`][@stdlib/math/base/special/kronecker-delta]</span><span class="delimiter">: </span><span class="description">evaluate the Kronecker delta.</span>
</section>
<!-- /.related -->
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="links">
[dirac-delta-function]: https://en.wikipedia.org/wiki/Dirac_delta_function
<!-- <related-links> -->
[@stdlib/math/base/special/kronecker-delta]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/kronecker-delta
<!-- </related-links> -->
</section>
<!-- /.links -->
|
{
"content_hash": "28afabdc2e549770f236d862be198d05",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 236,
"avg_line_length": 30.113636363636363,
"alnum_prop": 0.6925786163522013,
"repo_name": "stdlib-js/stdlib",
"id": "ad0d1b16f7b713177b173b8caed8751b35fe8a03",
"size": "3975",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/node_modules/@stdlib/math/base/special/dirac-delta/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "21739"
},
{
"name": "C",
"bytes": "15336495"
},
{
"name": "C++",
"bytes": "1349482"
},
{
"name": "CSS",
"bytes": "58039"
},
{
"name": "Fortran",
"bytes": "198059"
},
{
"name": "HTML",
"bytes": "56181"
},
{
"name": "Handlebars",
"bytes": "16114"
},
{
"name": "JavaScript",
"bytes": "85975525"
},
{
"name": "Julia",
"bytes": "1508654"
},
{
"name": "Makefile",
"bytes": "4806816"
},
{
"name": "Python",
"bytes": "3343697"
},
{
"name": "R",
"bytes": "576612"
},
{
"name": "Shell",
"bytes": "559315"
},
{
"name": "TypeScript",
"bytes": "19309407"
},
{
"name": "WebAssembly",
"bytes": "5980"
}
],
"symlink_target": ""
}
|
package com.mesosphere.sdk.scheduler.plan;
import com.mesosphere.sdk.offer.OfferRecommendation;
import com.mesosphere.sdk.offer.OfferRequirement;
import com.mesosphere.sdk.scheduler.Observable;
import java.util.Collection;
import java.util.Optional;
/**
* Defines the interface for a Step of a {@link Phase}. The {@link Step} is the base unit of a set of
* tasks to perform, such as launching a Task, updating a Task, or reconciling Mesos state with
* Framework state. A Step may be in one of five states: PENDING, PREPARED, STARTING, COMPLETE, or ERROR.
*
* A {@link Step} is an {@link Observable}, and will notify its observers when its state changes.
* <p>
* See {@link Plan} docs for more background.
*/
public interface Step extends Element, Interruptible {
/**
* Starts the Step, whose {@link Status} should be {@link Status#PENDING}. Returns an
* {@link OfferRequirement}, or an empty Optional if obtaining/updating resource requirements are not
* applicable to the Step. This will continue to be called for as long as {@link Element#isPending()} returns
* true.
*
* @see {@link #updateOfferStatus(Collection<org.apache.mesos.Protos.Offer.Operation>)} which returns the outcome of
* the {@link OfferRequirement}
*/
Optional<PodInstanceRequirement> start();
/**
* Notifies the Step whether the {@link PodInstanceRequirement} previously returned by
* {@link #start()} has been successfully accepted/fulfilled. The {@code recommendations} param is
* empty when no offers matching the requirement previously returned by {@link #start()}
* could be found. This is only called if {@link #start()} returned a non-empty
* {@link PodInstanceRequirement}.
*/
void updateOfferStatus(Collection<OfferRecommendation> recommendations);
/**
* Return the Asset that this Step intends to work on.
* @return The name of the Asset this Step intends to work on if one exists, Optional.empty() otherwise.
*/
Optional<String> getAsset();
/**
* Reports whether the Asset associated with this Step is dirty.
*/
default boolean isAssetDirty() {
return isPrepared() || isStarting();
}
@Override
default boolean isEligible(Collection<String> dirtyAssets) {
return Element.super.isEligible(dirtyAssets) &&
!isInterrupted() &&
!(getAsset().isPresent() && dirtyAssets.contains(getAsset().get()));
}
/**
* Thrown on invalid Step construction attempt.
*/
class InvalidStepException extends Exception {
public InvalidStepException(Exception e) {
super(e);
}
public InvalidStepException(String s) {
super(s);
}
}
}
|
{
"content_hash": "f3d210cdc4380a511237168818b4c78b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 120,
"avg_line_length": 38.59722222222222,
"alnum_prop": 0.6801007556675063,
"repo_name": "comptelfwd/dcos-commons",
"id": "3cd9ab3a826a0b81cbc9bd3cdbd9024738c7cc99",
"size": "2779",
"binary": false,
"copies": "1",
"ref": "refs/heads/mongodb-sidecar",
"path": "sdk/scheduler/src/main/java/com/mesosphere/sdk/scheduler/plan/Step.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "46576"
},
{
"name": "HTML",
"bytes": "50342"
},
{
"name": "Java",
"bytes": "1977329"
},
{
"name": "Makefile",
"bytes": "106"
},
{
"name": "Python",
"bytes": "146176"
},
{
"name": "Ruby",
"bytes": "22714"
},
{
"name": "Shell",
"bytes": "21143"
}
],
"symlink_target": ""
}
|
import json
import unittest
from airflow import configuration
from airflow.models.connection import Connection
from airflow.utils import db
try:
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
mock = None
class TestAzureDataLakeHook(unittest.TestCase):
def setUp(self):
configuration.load_test_config()
db.merge_conn(
Connection(
conn_id='adl_test_key',
conn_type='azure_data_lake',
login='client_id',
password='client secret',
extra=json.dumps({"tenant": "tenant",
"account_name": "accountname"})
)
)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_conn(self, mock_lib):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
from azure.datalake.store import core
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
self.assertEqual(hook.conn_id, 'adl_test_key')
self.assertIsInstance(hook.connection, core.AzureDLFileSystem)
assert mock_lib.auth.called
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.core.AzureDLFileSystem',
autospec=True)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_check_for_blob(self, mock_lib, mock_filesystem):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
hook.check_for_file('file_path')
mock_filesystem.glob.called
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.multithread.ADLUploader',
autospec=True)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_upload_file(self, mock_lib, mock_uploader):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
hook.upload_file(local_path='tests/hooks/test_adl_hook.py',
remote_path='/test_adl_hook.py',
nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304)
mock_uploader.assert_called_once_with(hook.connection,
lpath='tests/hooks/test_adl_hook.py',
rpath='/test_adl_hook.py',
nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.multithread.ADLDownloader',
autospec=True)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_download_file(self, mock_lib, mock_downloader):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
hook.download_file(local_path='test_adl_hook.py',
remote_path='/test_adl_hook.py',
nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304)
mock_downloader.assert_called_once_with(hook.connection,
lpath='test_adl_hook.py',
rpath='/test_adl_hook.py',
nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.core.AzureDLFileSystem',
autospec=True)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_list_glob(self, mock_lib, mock_fs):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
hook.list('file_path/*')
mock_fs.return_value.glob.assert_called_with('file_path/*')
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.core.AzureDLFileSystem',
autospec=True)
@mock.patch('airflow.contrib.hooks.azure_data_lake_hook.lib', autospec=True)
def test_list_walk(self, mock_lib, mock_fs):
from airflow.contrib.hooks.azure_data_lake_hook import AzureDataLakeHook
hook = AzureDataLakeHook(azure_data_lake_conn_id='adl_test_key')
hook.list('file_path/some_folder/')
mock_fs.return_value.walk.assert_called_with('file_path/some_folder/')
if __name__ == '__main__':
unittest.main()
|
{
"content_hash": "399a56167e91699bbb4cc3168f44309a",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 87,
"avg_line_length": 47.53921568627451,
"alnum_prop": 0.6091977727366468,
"repo_name": "jgao54/airflow",
"id": "797d038b880527c2b7f1452c8d8f3394b8e4d6f2",
"size": "5664",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tests/contrib/hooks/test_azure_data_lake_hook.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "69070"
},
{
"name": "Dockerfile",
"bytes": "2001"
},
{
"name": "HTML",
"bytes": "281673"
},
{
"name": "JavaScript",
"bytes": "1386980"
},
{
"name": "Mako",
"bytes": "1284"
},
{
"name": "Python",
"bytes": "5414628"
},
{
"name": "Shell",
"bytes": "40957"
}
],
"symlink_target": ""
}
|
package com.intel.oap.spark.sql.execution.datasources.arrow
import java.util.concurrent.{Executors, TimeUnit}
import com.intel.oap.spark.sql.DataFrameReaderImplicits._
import com.intel.oap.spark.sql.execution.datasources.v2.arrow.{ArrowOptions, ArrowUtils}
import org.apache.spark.SparkConf
import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.execution.datasources.v2.arrow.SparkMemoryUtils
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SharedSparkSession
class ArrowDataSourceTPCHBasedTest extends QueryTest with SharedSparkSession {
// tpc-h query cases: generated tpc-h dataset required
private val prefix = "/root/Downloads/"
private val tpchFolder = "date_tpch_10"
private val lineitem = prefix + tpchFolder + "/lineitem"
private val part = prefix + tpchFolder + "/part"
private val partSupp = prefix + tpchFolder + "/partsupp"
private val supplier = prefix + tpchFolder + "/supplier"
private val orders = prefix + tpchFolder + "/orders"
private val nation = prefix + tpchFolder + "/nation"
override protected def sparkConf: SparkConf = {
val conf = super.sparkConf
conf.set("spark.memory.offHeap.size", String.valueOf(128 * 1024 * 1024))
conf
}
ignore("tpch lineitem - desc") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame.createOrReplaceTempView("lineitem")
spark.sql("describe lineitem").show()
}
ignore("tpch part - special characters in path") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(part)
frame.createOrReplaceTempView("part")
spark.sql("select * from part limit 100").show()
}
ignore("tpch lineitem - read partition values") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(orders)
frame.createOrReplaceTempView("orders")
spark.sql("select o_orderdate from orders limit 100").show()
}
ignore("tpch lineitem - asterisk select") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame.createOrReplaceTempView("lineitem")
spark.sql("select * from lineitem limit 10").show()
}
ignore("tpch query 6") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame.createOrReplaceTempView("lineitem")
spark.sql("select\n\tsum(l_extendedprice * l_discount) as revenue\n" +
"from\n\tlineitem\n" +
"where\n\tl_shipdate >= date '1994-01-01'\n\t" +
"and l_shipdate < date '1994-01-01' + interval '1' year\n\t" +
"and l_discount between .06 - 0.01 and .06 + 0.01\n\t" +
"and l_quantity < 24").show()
}
ignore("tpch query 6 - performance comparision") {
val iterations = 10
withSQLConf(SQLConf.PARQUET_FILTER_PUSHDOWN_ENABLED.key -> "false") {
val frame1 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame1.createOrReplaceTempView("lineitem_arrow")
val frame2 = spark.read
.parquet(lineitem)
frame2.createOrReplaceTempView("lineitem_parquet")
val pPrev = System.currentTimeMillis()
(0 until iterations).foreach(_ =>
spark.sql("select\n\tsum(l_extendedprice * l_discount) as revenue\n" +
"from\n\tlineitem_parquet\n" +
"where\n\tl_shipdate >= date '1994-01-01'\n\t" +
"and l_shipdate < date '1994-01-01' + interval '1' year\n\t" +
"and l_discount between .06 - 0.01 and .06 + 0.01\n\t" +
"and l_quantity < 24").show()
)
val parquetExecTime = System.currentTimeMillis() - pPrev
val aPrev = System.currentTimeMillis()
(0 until iterations).foreach(_ => {
// scalastyle:off println
println(SparkMemoryUtils.contextAllocator().getAllocatedMemory)
// scalastyle:on println
spark.sql("select\n\tsum(l_extendedprice * l_discount) as revenue\n" +
"from\n\tlineitem_arrow\n" +
"where\n\tl_shipdate >= date '1994-01-01'\n\t" +
"and l_shipdate < date '1994-01-01' + interval '1' year\n\t" +
"and l_discount between .06 - 0.01 and .06 + 0.01\n\t" +
"and l_quantity < 24").show()
}
)
val arrowExecTime = System.currentTimeMillis() - aPrev
// unstable assert
assert(arrowExecTime < parquetExecTime)
}
}
ignore("tpch query 16 - performance comparision") {
val iterations = 1
withSQLConf(SQLConf.PARQUET_FILTER_PUSHDOWN_ENABLED.key -> "false") {
val frame1 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(partSupp)
frame1.createOrReplaceTempView("partsupp_arrow")
val frame2 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(part)
frame2.createOrReplaceTempView("part_arrow")
val frame3 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(supplier)
frame3.createOrReplaceTempView("supplier_arrow")
val frame4 = spark.read
.parquet(partSupp)
frame4.createOrReplaceTempView("partsupp_parquet")
val frame5 = spark.read
.parquet(part)
frame5.createOrReplaceTempView("part_parquet")
val frame6 = spark.read
.parquet(supplier)
frame6.createOrReplaceTempView("supplier_parquet")
val pPrev = System.currentTimeMillis()
(0 until iterations).foreach(_ =>
spark.sql("select\n\tp_brand,\n\tp_type,\n\tp_size," +
"\n\tcount(distinct ps_suppkey) as supplier_cnt\n" +
"from\n\tpartsupp_parquet,\n\tpart_parquet\nwhere\n\tp_partkey" +
" = ps_partkey\n\tand p_brand <> 'Brand#45'\n\t" +
"and p_type not like 'MEDIUM POLISHED%'\n\tand p_size in " +
"(49, 14, 23, 45, 19, 3, 36, 9)\n\t" +
"and ps_suppkey not in (\n\t\tselect\n\t\t\ts_suppkey\n\t\t" +
"from\n\t\t\tsupplier_parquet\n\t\twhere\n\t\t\t" +
"s_comment like '%Customer%Complaints%'\n\t)\ngroup by\n\t" +
"p_brand,\n\tp_type,\n\tp_size\norder by\n\t" +
"supplier_cnt desc,\n\tp_brand,\n\tp_type,\n\tp_size").show()
)
val parquetExecTime = System.currentTimeMillis() - pPrev
val aPrev = System.currentTimeMillis()
(0 until iterations).foreach(_ =>
spark.sql("select\n\tp_brand,\n\tp_type,\n\tp_size," +
"\n\tcount(distinct ps_suppkey) as supplier_cnt\n" +
"from\n\tpartsupp_arrow,\n\tpart_arrow\nwhere\n\tp_partkey" +
" = ps_partkey\n\tand p_brand <> 'Brand#45'\n\t" +
"and p_type not like 'MEDIUM POLISHED%'\n\tand p_size in " +
"(49, 14, 23, 45, 19, 3, 36, 9)\n\t" +
"and ps_suppkey not in (\n\t\tselect\n\t\t\ts_suppkey\n\t\t" +
"from\n\t\t\tsupplier_arrow\n\t\twhere\n\t\t\t" +
"s_comment like '%Customer%Complaints%'\n\t)\ngroup by\n\t" +
"p_brand,\n\tp_type,\n\tp_size\norder by\n\t" +
"supplier_cnt desc,\n\tp_brand,\n\tp_type,\n\tp_size").show()
)
val arrowExecTime = System.currentTimeMillis() - aPrev
// scalastyle:off println
println(arrowExecTime)
println(parquetExecTime)
// scalastyle:on println
// unstable assert
assert(arrowExecTime < parquetExecTime)
}
}
ignore("tpch query 1") {
val frame = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame.createOrReplaceTempView("lineitem")
spark.sql("select\n\tl_returnflag,\n\tl_linestatus," +
"\n\tsum(l_quantity) as sum_qty,\n\t" +
"sum(l_extendedprice) as sum_base_price," +
"\n\tsum(l_extendedprice * (1 - l_discount)) as sum_disc_price,\n\t" +
"sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge," +
"\n\tavg(l_quantity) as avg_qty,\n\t" +
"avg(l_extendedprice) as avg_price,\n\tavg(l_discount) as avg_disc," +
"\n\tcount(*) as count_order\nfrom\n\t" +
"lineitem\nwhere\n\tl_shipdate <= date '1998-12-01' - interval '90' day" +
"\ngroup by\n\tl_returnflag,\n\t" +
"l_linestatus\norder by\n\tl_returnflag,\n\tl_linestatus").explain(true)
}
ignore("tpch query 21 - memory leak") {
val frame1 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(supplier)
frame1.createOrReplaceTempView("supplier")
val frame2 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(lineitem)
frame2.createOrReplaceTempView("lineitem")
val frame3 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(orders)
frame3.createOrReplaceTempView("orders")
val frame4 = spark.read
.option(ArrowOptions.KEY_ORIGINAL_FORMAT, "parquet")
.option(ArrowOptions.KEY_FILESYSTEM, "hdfs")
.arrow(nation)
frame4.createOrReplaceTempView("nation")
Executors.newSingleThreadExecutor().execute(() => {
spark.sql("select\n\ts_name,\n\tcount(*) as numwait\nfrom\n\tsupplier,\n\t" +
"lineitem l1,\n\torders,\n\tnation\nwhere\n\ts_suppkey = l1.l_suppkey\n\t" +
"and o_orderkey = l1.l_orderkey\n\tand o_orderstatus = 'F'\n\tand " +
"l1.l_receiptdate > l1.l_commitdate\n\tand exists (\n\t\tselect\n\t\t\t*\n\t\tfrom\n\t\t\t" +
"lineitem l2\n\t\twhere\n\t\t\tl2.l_orderkey = l1.l_orderkey\n\t\t\tand " +
"l2.l_suppkey <> l1.l_suppkey\n\t)\n\tand not exists (\n\t\tselect\n\t\t\t*\n\t\t" +
"from\n\t\t\tlineitem l3\n\t\twhere\n\t\t\tl3.l_orderkey = l1.l_orderkey\n\t\t\t" +
"and l3.l_suppkey <> l1.l_suppkey\n\t\t\tand l3.l_receiptdate > " +
"l3.l_commitdate\n\t)\n\tand s_nationkey = n_nationkey\n\tand n_name = 'SAUDI ARABIA'\n" +
"group by\n\ts_name\norder by\n\tnumwait desc,\n\t" +
"s_name\nlimit 100").show()
})
Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(() => {
println("[org.apache.spark.sql.util.ArrowUtils.rootAllocator] " +
"Allocated memory amount: " + SparkMemoryUtils.contextAllocator())
println("[com.intel.oap.vectorized.ArrowWritableColumnVector.allocator] " +
"Allocated memory amount: " + SparkMemoryUtils.contextAllocator().getAllocatedMemory)
}, 0L, 100L, TimeUnit.MILLISECONDS)
Thread.sleep(60 * 60 * 1000L)
}
}
|
{
"content_hash": "9b93f02b21374ba605c67092f991a68b",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 101,
"avg_line_length": 41.15867158671587,
"alnum_prop": 0.6432669894208356,
"repo_name": "Intel-bigdata/OAP",
"id": "b33d4a1d32cbc66f8d99ab5cad3f35aa9da731a7",
"size": "11954",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oap-data-source/arrow/standard/src/test/scala/com/intel/oap/spark/sql/execution/datasources/arrow/ArrowDataSourceTPCHBasedTest.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "5734"
},
{
"name": "C",
"bytes": "14206"
},
{
"name": "C++",
"bytes": "4052"
},
{
"name": "CMake",
"bytes": "1227"
},
{
"name": "HTML",
"bytes": "7525"
},
{
"name": "Java",
"bytes": "402297"
},
{
"name": "JavaScript",
"bytes": "28148"
},
{
"name": "Makefile",
"bytes": "1868"
},
{
"name": "Scala",
"bytes": "1526195"
},
{
"name": "Shell",
"bytes": "1513"
}
],
"symlink_target": ""
}
|
module Framework (
-- * Generic Functions
ym,ltraverse, insertRev, reverseCompare, mergeWithoutDuplicatesBy, insertWithoutDuplicatesBy
-- * Identifiers
-- * Pretty-Printing
, PrettyPrintable(..)
-- * Counters
, UniqueM (..) -- because Data.Unique blows
, Counter
, CounterT
, CounterM
, evalCounter
, evalCounterM
, runCounter
, counterInit
-- Generics for SourcePos (instances only)
-- type system hacks
, EqualOrd (..)
, eovUpd
, warn
-- strings
, toLower, lowercase
, catMaybes
, Map
) where
import Data.Map (Map)
import Data.Maybe (catMaybes)
import Data.Char (toLower)
import Control.Applicative
import qualified System.IO as IO
import Control.Monad.State.Strict
import Control.Monad.Identity
import qualified Data.List as L
import Data.Generics hiding (GT)
import qualified Data.Foldable as Foldable
import Data.Foldable (Foldable)
import qualified Data.Traversable as Traversable
import Data.Traversable (Traversable, traverse)
import qualified Text.PrettyPrint.HughesPJ as Pp
import Text.ParserCombinators.Parsec.Pos (SourcePos, initialPos)
import WebBits.Common
lowercase = map toLower
--------------------------------------------------------------------------------
-- Generic functions
-- |Insert into a sorted list, with the greatest element at the head.
insertRev :: (Ord a) => a -> [a] -> [a]
insertRev x xs = L.insertBy (reverseCompare compare) x xs
reverseCompare :: (a -> a -> Ordering) -> (a -> a -> Ordering)
reverseCompare f x y = case f x y of
EQ -> EQ
LT -> GT
GT -> LT
mergeWithoutDuplicatesBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
mergeWithoutDuplicatesBy f xs [] = xs
mergeWithoutDuplicatesBy f [] ys = ys
mergeWithoutDuplicatesBy f (x:xs) (y:ys) = case f x y of
LT -> x : (mergeWithoutDuplicatesBy f xs (y:ys))
GT -> y : (mergeWithoutDuplicatesBy f (x:xs) ys)
EQ -> x : (mergeWithoutDuplicatesBy f xs ys)
insertWithoutDuplicatesBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
insertWithoutDuplicatesBy _ y [] = [y]
insertWithoutDuplicatesBy f y (x:xs) = case f y x of
LT -> y:x:xs
GT -> x:(insertWithoutDuplicatesBy f y xs)
EQ -> x:xs
-- | Given an applicative functor, 'f', and and a list of traversable
-- data-structures, apply the functor to every element of the list from left
-- to right.
ltraverse:: (Traversable t, Applicative f) => (a -> f b) -> [t a] -> f [t b]
ltraverse f [] = pure []
ltraverse f (x:xs) = pure (:) <*> (traverse f x) <*> ltraverse f xs
-- | Lifts a monadic function to 'f' over 'Maybe.'
ym:: (Monad m) => (a -> m b) -> (Maybe a -> m (Maybe b))
ym _ Nothing = return Nothing
ym f (Just a) = f a >>= return.Just
--------------------------------------------------------------------------------
-- Counter monads
class Monad m => UniqueM m where
getCounter :: m Int
putCounter :: Int -> m ()
preincrCounter :: m Int
newtype Counter = Counter Int
--- |'CounterT' implements a counter and encapsulates another monad.
type CounterT m = StateT Counter m
type CounterM = CounterT Identity
counterInit = Counter 0
instance (Monad m) => UniqueM (CounterT m) where
getCounter = do
(Counter n) <- get
return n
preincrCounter = do
(Counter n) <- get
put (Counter (n+1))
return n
putCounter n = do
put (Counter n)
evalCounter :: Monad m => CounterT m a -> m a
evalCounter m = evalStateT m (Counter 0)
runCounter :: Monad m => Counter -> CounterT m a -> m (a,Counter)
runCounter init m = runStateT m init
evalCounterM :: CounterM a -> a
evalCounterM m = runIdentity $ evalCounter m
--------------------------------------------------------------------------------
-- Generics for SourcePos
-- | These definitions allow us to use data structures containing 'SourcePos'
-- values with generics.
instance Typeable (EqualOrd a) where
typeOf _ =
mkTyConApp (mkTyCon "EqualOrd") []
-- Guesswork. It works for Test.JavascriptParser.
equalOrdDatatype = mkDataType "EqualOrd" [equalOrdConstr1]
equalOrdConstr1 = mkConstr equalOrdDatatype "EqualOrd" [] Prefix
-- | This definition is incomplete.
instance Data (EqualOrd a) where
-- We treat source locations as opaque. After all, we don't have access to
-- the constructor.
gfoldl k z pos = z pos
toConstr _ = equalOrdConstr1
gunfold = error "gunfold is not defined for EqualOrd"
dataTypeOf = error "dataTypeOf is not defined for EqualOrd"
-- -----------------------------------------------------------------------------
-- EqualOrd
-- |A container type with instances of 'Eq' and 'Ord' defined so that all values
-- values are equal. Hacking around equality seems a little dicey. Use this
-- carefully. 'EqualOrd' is an instance of 'Show' as well for convenience.
data EqualOrd v = EqualOrd { equalOrdValue :: v }
instance Eq (EqualOrd v) where
_ == _ = True
instance Ord (EqualOrd v) where
compare _ _ = EQ
-- |If we allow overlapping instances, we could do a little better.
instance Show (EqualOrd v) where
show (EqualOrd v) = "EqualOrd-value"
eovUpd :: (a -> a) -> EqualOrd a -> EqualOrd a
eovUpd f (EqualOrd x) = EqualOrd (f x)
-- ---------------------------------------------------------------------------------------------------------------------
-- Debugging
warn :: MonadIO m => String -> m ()
warn s = liftIO (IO.hPutStrLn IO.stderr s)
|
{
"content_hash": "a56c90e4399e7029a8959c1703db966a",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 120,
"avg_line_length": 30.09039548022599,
"alnum_prop": 0.6301164100638378,
"repo_name": "brownplt/ovid",
"id": "a9cb444ac7eb088066aa0e62debdfe39202f98ce",
"size": "5378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Framework.hs",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Haskell",
"bytes": "183851"
},
{
"name": "JavaScript",
"bytes": "1310"
}
],
"symlink_target": ""
}
|
const version = process.env.npm_package_config_sw_version;
importScripts('/js/serviceworker-cache-polyfill.js');
const cacheNameStatic = 'jot-static-v' + version;
const cacheNameGoogleAvatar = 'jot-google-avatar-v' + version;
const currentCacheNames = [
cacheNameStatic,
cacheNameGoogleAvatar,
];
self.addEventListener('install', event => {
event.waitUntil(
caches.open(cacheNameStatic)
.then(cache => {
return cache.addAll([
'/',
'/css/app.css',
'/js/dist/app.js',
'/js/browser-polyfill.js',
'/js/pouchdb.js',
// '/js/webfontloader.js',
]);
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys()
.then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (currentCacheNames.indexOf(cacheName) === -1) {
return caches.delete(cacheName);
}
})
);
})
.then(promises => {
// localStorage.setItem('sw-version', version);
return promises;
})
);
});
self.addEventListener('fetch', event => {
const selfURL = self.location;
const requestURL = new URL(event.request.url);
if (requestURL.pathname.indexOf('/auth/') === 0 && requestURL.pathname !== '/auth/user') {
return;
}
// if no extension, assume it's a page (not root)
if (selfURL.host === requestURL.host && requestURL.pathname.indexOf('.') === -1 && requestURL.pathname !== '/auth/user') {
event.respondWith(caches.match('/').then(cacheResponse => {
return cacheResponse;
}, err => {
console.log('sw match error: ', err);
}));
} else {
event.respondWith(
caches.match(event.request)
.then(response => {
if (response) {
return response;
}
const fetchRequest = event.request.clone();
return fetch(fetchRequest).then(fetchResponse => {
let shouldCache = false;
if (fetchResponse.type === 'basic' && fetchResponse.status === 200) {
// shouldCache = cacheNameStatic;
} else if (fetchResponse.type === 'opaque') { // if response isn't from our origin / doesn't support CORS
if (requestURL.hostname.indexOf('.googleusercontent.com') > -1) {
shouldCache = cacheNameGoogleAvatar;
} else {
// just let response pass through, don't cache
}
}
if (shouldCache) {
const responseToCache = fetchResponse.clone();
caches.open(shouldCache)
.then(cache => {
const cacheRequest = event.request.clone();
cache.put(cacheRequest, responseToCache);
});
}
return fetchResponse;
}, err => {
console.log('sw fetch error: ', err);
if (requestURL.pathname === '/auth/user') {
return new Response(JSON.stringify({
serviceworker: true,
}, {
headers: { 'Content-Type': 'application/json' },
}));
}
if (requestURL.origin === location.origin) {
return caches.match('/');
}
});
})
);
}
});
|
{
"content_hash": "6a9ee87504d739d4931e7d48c11d1b8a",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 124,
"avg_line_length": 29.36842105263158,
"alnum_prop": 0.5313620071684588,
"repo_name": "lamplightdev/jot",
"id": "91df3b406d26b97853536a77e75fde3293ee96de",
"size": "3348",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/serviceworker-es6.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "85646"
},
{
"name": "HTML",
"bytes": "17443"
},
{
"name": "JavaScript",
"bytes": "2245441"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<ldml>
<identity>
<version number="$Revision: 4183 $"/>
<generation date="$Date: 2009-06-15 13:12:26 -0400 (Mon, 15 Jun 2009) $"/>
<language type="de"/>
</identity>
<localeDisplayNames>
<localeDisplayPattern>
<localePattern>{0} ({1})</localePattern>
<localeSeparator>, </localeSeparator>
</localeDisplayPattern>
<languages>
<language type="aa">Afar</language>
<language type="ab">Abchasisch</language>
<language type="ace">Aceh-Sprache</language>
<language type="ach">Acholi-Sprache</language>
<language type="ada">Adangme</language>
<language type="ady">Adygeisch</language>
<language type="ae">Avestisch</language>
<language type="af">Afrikaans</language>
<language type="afa">Afroasiatische Sprachen</language>
<language type="afa" alt="proposed-x1001" draft="unconfirmed">Afro-Asiatische Sprache</language>
<language type="afh">Afrihili</language>
<language type="ain">Ainu-Sprache</language>
<language type="ain" alt="proposed-x1001" draft="unconfirmed">Ainu (Japan)</language>
<language type="ak">Akan</language>
<language type="akk">Akkadisch</language>
<language type="ale">Aleutisch</language>
<language type="alg">Algonkin-Sprachen</language>
<language type="alg" alt="proposed-x1001" draft="unconfirmed">Algonkin-Sprache</language>
<language type="alt">Süd-Altaisch</language>
<language type="am">Amharisch</language>
<language type="an">Aragonesisch</language>
<language type="ang">Altenglisch</language>
<language type="anp">Angika</language>
<language type="apa">Apachen-Sprache</language>
<language type="ar">Arabisch</language>
<language type="arc">Aramäisch</language>
<language type="arn">Araukanisch</language>
<language type="arp">Arapaho-Sprache</language>
<language type="art">Kunstsprache</language>
<language type="arw">Arawak-Sprachen</language>
<language type="as">Assamesisch</language>
<language type="ast">Asturianisch</language>
<language type="ath">Athapaskische Sprachen</language>
<language type="aus">Australische Sprachen</language>
<language type="aus" alt="proposed-x1001" draft="unconfirmed">Australische Sprache</language>
<language type="av">Awarisch</language>
<language type="awa">Awadhi</language>
<language type="ay">Aymara</language>
<language type="az">Aserbaidschanisch</language>
<language type="ba">Baschkirisch</language>
<language type="bad">Banda-Sprache</language>
<language type="bai">Bamileke-Sprache</language>
<language type="bal">Belutschisch</language>
<language type="ban">Balinesisch</language>
<language type="bas">Basaa-Sprache</language>
<language type="bas" alt="proposed-x1001" draft="unconfirmed">Baasa (Kamerun)</language>
<language type="bat">Baltische Sprachen</language>
<language type="bat" alt="proposed-x1001" draft="unconfirmed">Baltische Sprache</language>
<language type="be">Weißrussisch</language>
<language type="bej">Bedauye</language>
<language type="bem">Bemba-Sprache</language>
<language type="ber">Berbersprache</language>
<language type="bg">Bulgarisch</language>
<language type="bh">Biharisch</language>
<language type="bho">Bhodschpuri</language>
<language type="bi">Bislama</language>
<language type="bik">Bikol-Sprache</language>
<language type="bik" alt="proposed-x1001" draft="unconfirmed">Bikolano</language>
<language type="bin">Bini-Sprache</language>
<language type="bin" alt="proposed-x1001" draft="unconfirmed">Bini</language>
<language type="bla">Blackfoot-Sprache</language>
<language type="bm">Bambara-Sprache</language>
<language type="bn">Bengalisch</language>
<language type="bnt">Bantusprachen</language>
<language type="bnt" alt="proposed-x1001" draft="unconfirmed">Bantusprache</language>
<language type="bo">Tibetisch</language>
<language type="br">Bretonisch</language>
<language type="bra">Braj-Bhakha</language>
<language type="bs">Bosnisch</language>
<language type="btk">Batak</language>
<language type="bua">Burjatisch</language>
<language type="bug">Buginesisch</language>
<language type="byn">Blin</language>
<language type="ca">Katalanisch</language>
<language type="cad">Caddo</language>
<language type="cai">Zentralamerikanische Indianersprache</language>
<language type="car">Karibische Sprachen</language>
<language type="car" alt="proposed-x1001" draft="unconfirmed">Karibisch</language>
<language type="car" alt="proposed-x1002" draft="unconfirmed">Karibische Sprache</language>
<language type="cau">Kaukasische Sprache</language>
<language type="cch">Atsam</language>
<language type="ce">Tschetschenisch</language>
<language type="ceb">Cebuano</language>
<language type="cel">Keltische Sprachen</language>
<language type="cel" alt="proposed-x1001" draft="unconfirmed">Keltische Sprache</language>
<language type="ch">Chamorro-Sprache</language>
<language type="ch" alt="proposed-x1001" draft="unconfirmed">Chamorro</language>
<language type="chb">Chibcha-Sprache</language>
<language type="chb" alt="proposed-x1001" draft="unconfirmed">Chibcha-Sprachen</language>
<language type="chg">Tschagataisch</language>
<language type="chk">Trukesisch</language>
<language type="chm">Tscheremissisch</language>
<language type="chn">Chinook</language>
<language type="cho">Choctaw</language>
<language type="chp">Chipewyan</language>
<language type="chr">Cherokee</language>
<language type="chy">Cheyenne</language>
<language type="cmc">Cham-Sprachen</language>
<language type="cmc" alt="proposed-x1001" draft="unconfirmed">Cham-Sprache</language>
<language type="co">Korsisch</language>
<language type="cop">Koptisch</language>
<language type="cpe">Kreolisch-Englische Sprache</language>
<language type="cpf">Kreolisch-Französische Sprache</language>
<language type="cpp">Kreolisch-Portugiesische Sprache</language>
<language type="cr">Cree</language>
<language type="crh">Krimtatarisch</language>
<language type="crp">Kreolische Sprache</language>
<language type="crp" alt="proposed-x1001" draft="unconfirmed">Kreolische Sprachen</language>
<language type="cs">Tschechisch</language>
<language type="csb">Kaschubisch</language>
<language type="cu">Kirchenslawisch</language>
<language type="cus">Kuschitische Sprachen</language>
<language type="cus" alt="proposed-x1001" draft="unconfirmed">Kuschitische Sprache</language>
<language type="cv">Tschuwaschisch</language>
<language type="cy">Walisisch</language>
<language type="da">Dänisch</language>
<language type="dak">Dakota-Sprache</language>
<language type="dar">Darginisch</language>
<language type="day">Dajak</language>
<language type="day" alt="proposed-x1001" draft="unconfirmed">Bidayuh-Sprache</language>
<language type="de">Deutsch</language>
<language type="de_AT">Österreichisches Deutsch</language>
<language type="de_CH">Schweizer Hochdeutsch</language>
<language type="del">Delaware-Sprache</language>
<language type="den">Slave</language>
<language type="dgr">Dogrib</language>
<language type="din">Dinka-Sprache</language>
<language type="doi">Dogri</language>
<language type="dra">Drawidische Sprache</language>
<language type="dsb">Niedersorbisch</language>
<language type="dua">Duala</language>
<language type="dum">Mittelniederländisch</language>
<language type="dv">Maledivisch</language>
<language type="dyu">Dyula-Sprache</language>
<language type="dz">Bhutanisch</language>
<language type="ee">Ewe-Sprache</language>
<language type="efi">Efik</language>
<language type="egy">Ägyptisch</language>
<language type="eka">Ekajuk</language>
<language type="el">Griechisch</language>
<language type="elx">Elamisch</language>
<language type="en">Englisch</language>
<language type="en_AU">Australisches Englisch</language>
<language type="en_CA">Kanadisches Englisch</language>
<language type="en_GB">Britisches Englisch</language>
<language type="en_US">Amerikanisches Englisch</language>
<language type="enm">Mittelenglisch</language>
<language type="eo">Esperanto</language>
<language type="es">Spanisch</language>
<language type="es_419">Lateinamerikanisches Spanisch</language>
<language type="es_ES">Iberisches Spanisch</language>
<language type="et">Estnisch</language>
<language type="eu">Baskisch</language>
<language type="ewo">Ewondo</language>
<language type="fa">Persisch</language>
<language type="fan">Pangwe-Sprache</language>
<language type="fat">Fanti-Sprache</language>
<language type="ff">Ful</language>
<language type="fi">Finnisch</language>
<language type="fil">Filipino</language>
<language type="fiu">Finnougrische Sprachen</language>
<language type="fiu" alt="proposed-x1001" draft="unconfirmed">Finnougrische Sprache</language>
<language type="fj">Fidschianisch</language>
<language type="fo">Färöisch</language>
<language type="fon">Fon-Sprache</language>
<language type="fon" alt="proposed-x1001" draft="unconfirmed">Fongbe</language>
<language type="fr">Französisch</language>
<language type="fr_CA">Kanadisches Französisch</language>
<language type="fr_CH">Schweizer Französisch</language>
<language type="frm">Mittelfranzösisch</language>
<language type="fro">Altfranzösisch</language>
<language type="frr">Nordfriesisch</language>
<language type="frs">Ostfriesisch</language>
<language type="fur">Friulisch</language>
<language type="fy">Friesisch</language>
<language type="ga">Irisch</language>
<language type="gaa">Ga-Sprache</language>
<language type="gaa" alt="proposed-x1001" draft="unconfirmed">Ga</language>
<language type="gay">Gayo</language>
<language type="gba">Gbaya-Sprache</language>
<language type="gba" alt="proposed-x1001" draft="unconfirmed">Gbaya</language>
<language type="gd">Schottisches Gälisch</language>
<language type="gem">Germanische Sprachen</language>
<language type="gem" alt="proposed-x1001" draft="unconfirmed">Germanische Sprache</language>
<language type="gez">Geez</language>
<language type="gil">Gilbertesisch</language>
<language type="gl">Galizisch</language>
<language type="gmh">Mittelhochdeutsch</language>
<language type="gn">Guarani</language>
<language type="goh">Althochdeutsch</language>
<language type="gon">Gondi-Sprache</language>
<language type="gor">Mongondou</language>
<language type="got">Gotisch</language>
<language type="grb">Grebo-Sprache</language>
<language type="grb" alt="proposed-x1001" draft="unconfirmed">Grebo</language>
<language type="grc">Altgriechisch</language>
<language type="gsw">Schweizerdeutsch</language>
<language type="gu">Gujarati</language>
<language type="gv">Manx</language>
<language type="gwi">Kutchin-Sprache</language>
<language type="gwi" alt="proposed-x1001" draft="unconfirmed">Kutchin</language>
<language type="ha">Hausa</language>
<language type="hai">Haida-Sprache</language>
<language type="hai" alt="proposed-x1001" draft="unconfirmed">Haida</language>
<language type="haw">Hawaiisch</language>
<language type="haw" alt="proposed-x1001" draft="unconfirmed">Hawaiianisch</language>
<language type="he">Hebräisch</language>
<language type="hi">Hindi</language>
<language type="hil">Hiligaynon-Sprache</language>
<language type="hil" alt="proposed-x1001" draft="unconfirmed">Hiligaynon</language>
<language type="him">Himachali</language>
<language type="hit">Hethitisch</language>
<language type="hmn">Miao-Sprachen</language>
<language type="hmn" alt="proposed-x1001" draft="unconfirmed">Hmong</language>
<language type="ho">Hiri-Motu</language>
<language type="hr">Kroatisch</language>
<language type="hsb">Obersorbisch</language>
<language type="ht">Haitianisch</language>
<language type="ht" alt="proposed-x1001" draft="unconfirmed">Kreolisch</language>
<language type="hu">Ungarisch</language>
<language type="hup">Hupa</language>
<language type="hy">Armenisch</language>
<language type="hz">Herero-Sprache</language>
<language type="hz" alt="proposed-x1001" draft="unconfirmed">Herero</language>
<language type="ia">Interlingua</language>
<language type="iba">Iban</language>
<language type="id">Indonesisch</language>
<language type="ie">Interlingue</language>
<language type="ig">Igbo-Sprache</language>
<language type="ig" alt="proposed-x1001" draft="unconfirmed">Igbo</language>
<language type="ii">Sichuan Yi</language>
<language type="ijo">Ijo-Sprache</language>
<language type="ik">Inupiak</language>
<language type="ilo">Ilokano-Sprache</language>
<language type="ilo" alt="proposed-x1001" draft="unconfirmed">Ilokano</language>
<language type="inc">Indoarische Sprache</language>
<language type="ine">Indogermanische Sprachen</language>
<language type="inh">Inguschisch</language>
<language type="inh" alt="proposed-x1001" draft="unconfirmed">Ingush</language>
<language type="io">Ido-Sprache</language>
<language type="io" alt="proposed-x1001" draft="unconfirmed">Ido</language>
<language type="ira">Iranische Sprachen</language>
<language type="ira" alt="proposed-x1001" draft="unconfirmed">Iranische Sprache</language>
<language type="iro">Irokesische Sprache</language>
<language type="iro" alt="proposed-x1001" draft="unconfirmed">Irokesische Sprachen</language>
<language type="is">Isländisch</language>
<language type="it">Italienisch</language>
<language type="iu">Inukitut</language>
<language type="ja">Japanisch</language>
<language type="jbo">Lojban</language>
<language type="jpr">Jüdisch-Persisch</language>
<language type="jrb">Jüdisch-Arabisch</language>
<language type="jv">Javanisch</language>
<language type="ka">Georgisch</language>
<language type="kaa">Karakalpakisch</language>
<language type="kab">Kabylisch</language>
<language type="kac">Kachin-Sprache</language>
<language type="kaj">Jju</language>
<language type="kam">Kamba</language>
<language type="kar">Karenisch</language>
<language type="kaw">Kawi</language>
<language type="kbd">Kabardinisch</language>
<language type="kcg">Tyap</language>
<language type="kfo">Koro</language>
<language type="kg">Kongo</language>
<language type="kha">Khasi-Sprache</language>
<language type="kha" alt="proposed-x1001" draft="unconfirmed">Khasi</language>
<language type="khi">Khoisan-Sprache</language>
<language type="kho">Sakisch</language>
<language type="ki">Kikuyu-Sprache</language>
<language type="ki" alt="proposed-x1001" draft="unconfirmed">Kikuyu</language>
<language type="kj">Kwanyama</language>
<language type="kk">Kasachisch</language>
<language type="kl">Grönländisch</language>
<language type="km">Kambodschanisch</language>
<language type="kmb">Kimbundu-Sprache</language>
<language type="kmb" alt="proposed-x1001" draft="unconfirmed">Kimbundu</language>
<language type="kn">Kannada</language>
<language type="ko">Koreanisch</language>
<language type="kok">Konkani</language>
<language type="kos">Kosraeanisch</language>
<language type="kpe">Kpelle-Sprache</language>
<language type="kpe" alt="proposed-x1001" draft="unconfirmed">Kpellé</language>
<language type="kr">Kanuri-Sprache</language>
<language type="kr" alt="proposed-x1001" draft="unconfirmed">Kanuri</language>
<language type="krc">Karatschaiisch-Balkarisch</language>
<language type="krl">Karelisch</language>
<language type="kro">Kru-Sprachen</language>
<language type="kru">Oraon-Sprache</language>
<language type="kru" alt="proposed-x1001" draft="unconfirmed">Kuruth</language>
<language type="ks">Kaschmirisch</language>
<language type="ku">Kurdisch</language>
<language type="kum">Kumükisch</language>
<language type="kut">Kutenai-Sprache</language>
<language type="kut" alt="proposed-x1001" draft="unconfirmed">Kutenai</language>
<language type="kv">Komi-Sprache</language>
<language type="kv" alt="proposed-x1001" draft="unconfirmed">Komi</language>
<language type="kw">Kornisch</language>
<language type="ky">Kirgisisch</language>
<language type="la">Latein</language>
<language type="lad">Ladino</language>
<language type="lah">Lahnda</language>
<language type="lam">Lamba-Sprache</language>
<language type="lam" alt="proposed-x1001" draft="unconfirmed">Lamba</language>
<language type="lb">Luxemburgisch</language>
<language type="lez">Lesgisch</language>
<language type="lg">Ganda-Sprache</language>
<language type="lg" alt="proposed-x1001" draft="unconfirmed">Ganda</language>
<language type="li">Limburgisch</language>
<language type="ln">Lingala</language>
<language type="lo">Laotisch</language>
<language type="lol">Mongo</language>
<language type="loz">Rotse-Sprache</language>
<language type="loz" alt="proposed-x1001" draft="unconfirmed">Lozi</language>
<language type="lt">Litauisch</language>
<language type="lu">Luba-Katanga</language>
<language type="lua">Luba-Lulua</language>
<language type="lui">Luiseno-Sprache</language>
<language type="lui" alt="proposed-x1001" draft="unconfirmed">Luiseno</language>
<language type="lun">Lunda-Sprache</language>
<language type="lun" alt="proposed-x1001" draft="unconfirmed">Lunda</language>
<language type="luo">Luo-Sprache</language>
<language type="luo" alt="proposed-x1001" draft="unconfirmed">Luo</language>
<language type="lus">Lushai-Sprache</language>
<language type="lus" alt="proposed-x1001" draft="unconfirmed">Lushai</language>
<language type="lv">Lettisch</language>
<language type="mad">Maduresisch</language>
<language type="mag">Khotta</language>
<language type="mai">Maithili</language>
<language type="mak">Makassarisch</language>
<language type="man">Manding-Sprache</language>
<language type="man" alt="proposed-x1001" draft="unconfirmed">Manding</language>
<language type="map">Austronesische Sprachen</language>
<language type="map" alt="proposed-x1001" draft="unconfirmed">Austronesische Sprache</language>
<language type="mas">Massai-Sprache</language>
<language type="mas" alt="proposed-x1001" draft="unconfirmed">Massai</language>
<language type="mdf">Moksha</language>
<language type="mdf" alt="proposed-x1001" draft="unconfirmed">Mokscha-Mordwinisch</language>
<language type="mdr">Mandaresisch</language>
<language type="men">Mende-Sprache</language>
<language type="men" alt="proposed-x1001" draft="unconfirmed">Mende</language>
<language type="mg">Malagassi-Sprache</language>
<language type="mg" alt="proposed-x1001" draft="unconfirmed">Malagassy</language>
<language type="mga">Mittelirisch</language>
<language type="mh">Marschallesisch</language>
<language type="mi">Maori</language>
<language type="mic">Micmac-Sprache</language>
<language type="mic" alt="proposed-x1001" draft="unconfirmed">Miʼkmaq</language>
<language type="min">Minangkabau-Sprache</language>
<language type="min" alt="proposed-x1001" draft="unconfirmed">Minangkabau</language>
<language type="mis">Verschiedene Sprachen</language>
<language type="mis" alt="proposed-x1001" draft="unconfirmed">andere Sprache</language>
<language type="mk">Mazedonisch</language>
<language type="mkh">Mon-Khmer-Sprache</language>
<language type="ml">Malayalam</language>
<language type="mn">Mongolisch</language>
<language type="mnc">Mandschurisch</language>
<language type="mni">Meithei-Sprache</language>
<language type="mni" alt="proposed-x1001" draft="unconfirmed">Manipuri</language>
<language type="mno">Manobo-Sprache</language>
<language type="mo">Moldauisch</language>
<language type="mo" alt="proposed-x1001" draft="unconfirmed">Moldawisch</language>
<language type="moh">Mohawk-Sprache</language>
<language type="moh" alt="proposed-x1001" draft="unconfirmed">Mohawk</language>
<language type="mos">Mossi-Sprache</language>
<language type="mr">Marathi</language>
<language type="ms">Malaiisch</language>
<language type="mt">Maltesisch</language>
<language type="mul">Mehrsprachig</language>
<language type="mul" alt="proposed-x1001" draft="unconfirmed">mehrsprachig</language>
<language type="mun">Munda-Sprachen</language>
<language type="mus">Muskogee-Sprachen</language>
<language type="mwl">Mirandesisch</language>
<language type="mwr">Marwari</language>
<language type="my">Birmanisch</language>
<language type="myn">Maya-Sprachen</language>
<language type="myv">Ersja-Mordwinisch</language>
<language type="na">Nauruisch</language>
<language type="nah">Nahuatl</language>
<language type="nai">Nordamerikanische Indianersprache</language>
<language type="nap">Neapolitanisch</language>
<language type="nb">Norwegisch Bokmål</language>
<language type="nd">Nord-Ndebele-Sprache</language>
<language type="nd" alt="proposed-x1001" draft="unconfirmed">Nord-Ndebele</language>
<language type="nds">Niederdeutsch</language>
<language type="ne">Nepalesisch</language>
<language type="new">Newari</language>
<language type="ng">Ndonga</language>
<language type="nia">Nias-Sprache</language>
<language type="nic">Nigerkordofanische Sprachen</language>
<language type="nic" alt="proposed-x1001" draft="unconfirmed">Nigerkordofanische Sprache</language>
<language type="niu">Niue-Sprache</language>
<language type="niu" alt="proposed-x1001" draft="unconfirmed">Niue</language>
<language type="nl">Niederländisch</language>
<language type="nl_BE">Flämisch</language>
<language type="nn">Norwegisch Nynorsk</language>
<language type="no">Norwegisch</language>
<language type="nog">Nogai</language>
<language type="non">Altnordisch</language>
<language type="nqo">N’Ko</language>
<language type="nr">Süd-Ndebele-Sprache</language>
<language type="nso">Nord-Sotho-Sprache</language>
<language type="nso" alt="proposed-x1001" draft="unconfirmed">Nord-Sotho</language>
<language type="nub">Nubische Sprachen</language>
<language type="nub" alt="proposed-x1001" draft="unconfirmed">Nubische Sprache</language>
<language type="nv">Navajo-Sprache</language>
<language type="nwc">Alt-Newari</language>
<language type="ny">Nyanja-Sprache</language>
<language type="nym">Nyamwezi-Sprache</language>
<language type="nyn">Nyankole</language>
<language type="nyo">Nyoro</language>
<language type="nzi">Nzima</language>
<language type="oc">Okzitanisch</language>
<language type="oj">Ojibwa-Sprache</language>
<language type="om">Oromo</language>
<language type="or">Orija</language>
<language type="or" alt="proposed-x1001" draft="unconfirmed">Oriya-Sprache</language>
<language type="os">Ossetisch</language>
<language type="osa">Osage-Sprache</language>
<language type="ota">Osmanisch</language>
<language type="oto">Otomangue-Sprachen</language>
<language type="pa">Pandschabisch</language>
<language type="paa">Papuasprachen</language>
<language type="pag">Pangasinan-Sprache</language>
<language type="pal">Mittelpersisch</language>
<language type="pam">Pampanggan-Sprache</language>
<language type="pap">Papiamento</language>
<language type="pau">Palau</language>
<language type="peo">Altpersisch</language>
<language type="phi">Philippinen-Austronesische Sprachen</language>
<language type="phn">Phönikisch</language>
<language type="pi">Pali</language>
<language type="pl">Polnisch</language>
<language type="pon">Ponapeanisch</language>
<language type="pra">Prakrit</language>
<language type="pro">Altprovenzalisch</language>
<language type="ps">Paschtu</language>
<language type="pt">Portugiesisch</language>
<language type="pt_BR">Brasilianisches Portugiesisch</language>
<language type="pt_PT">Iberisches Portugiesisch</language>
<language type="qu">Quechua</language>
<language type="raj">Rajasthani</language>
<language type="rap">Osterinsel-Sprache</language>
<language type="rar">Rarotonganisch</language>
<language type="rm">Rätoromanisch</language>
<language type="rn">Rundi-Sprache</language>
<language type="ro">Rumänisch</language>
<language type="roa">Romanische Sprachen</language>
<language type="rom">Romani</language>
<language type="root">Root</language>
<language type="ru">Russisch</language>
<language type="rup">Aromunisch</language>
<language type="rw">Ruandisch</language>
<language type="sa">Sanskrit</language>
<language type="sad">Sandawe-Sprache</language>
<language type="sah">Jakutisch</language>
<language type="sai">Südamerikanische Indianersprache</language>
<language type="sal">Salish-Sprache</language>
<language type="sam">Samaritanisch</language>
<language type="sas">Sasak</language>
<language type="sat">Santali</language>
<language type="sc">Sardisch</language>
<language type="scn">Sizilianisch</language>
<language type="sco">Schottisch</language>
<language type="sd">Sindhi</language>
<language type="se">Nord-Samisch</language>
<language type="sel">Selkupisch</language>
<language type="sem">Semitische Sprachen</language>
<language type="sg">Sango</language>
<language type="sga">Altirisch</language>
<language type="sgn">Gebärdensprache</language>
<language type="sh">Serbo-Kroatisch</language>
<language type="shn">Schan-Sprache</language>
<language type="si">Singhalesisch</language>
<language type="sid">Sidamo</language>
<language type="sio">Sioux-Sprachen</language>
<language type="sio" alt="proposed-x1001" draft="unconfirmed">Sioux-Sprache</language>
<language type="sit">Sinotibetische Sprache</language>
<language type="sk">Slowakisch</language>
<language type="sl">Slowenisch</language>
<language type="sla">Slawische Sprachen</language>
<language type="sm">Samoanisch</language>
<language type="sma">Süd-Samisch</language>
<language type="smi">Lappisch</language>
<language type="smj">Lule-Lappisch</language>
<language type="smn">Inari-Lappisch</language>
<language type="sms">Skolt-Lappisch</language>
<language type="sn">Shona</language>
<language type="sn" alt="proposed-x1001" draft="unconfirmed">Schona-Sprache</language>
<language type="snk">Soninke-Sprache</language>
<language type="so">Somali</language>
<language type="sog">Sogdisch</language>
<language type="son">Songhai-Sprache</language>
<language type="sq">Albanisch</language>
<language type="sr">Serbisch</language>
<language type="srn">Srananisch</language>
<language type="srr">Serer-Sprache</language>
<language type="ss">Swazi</language>
<language type="ssa">Nilosaharanische Sprachen</language>
<language type="ssa" alt="proposed-x1001" draft="unconfirmed">Nilosaharanische Sprache</language>
<language type="st">Süd-Sotho-Sprache</language>
<language type="su">Sundanesisch</language>
<language type="suk">Sukuma-Sprache</language>
<language type="sus">Susu</language>
<language type="sux">Sumerisch</language>
<language type="sv">Schwedisch</language>
<language type="sw">Suaheli</language>
<language type="syc">Altsyrisch</language>
<language type="syr">Syrisch</language>
<language type="ta">Tamilisch</language>
<language type="tai">Thaisprache</language>
<language type="te">Telugu</language>
<language type="tem">Temne</language>
<language type="ter">Tereno-Sprache</language>
<language type="tet">Tetum-Sprache</language>
<language type="tg">Tadschikisch</language>
<language type="th">Thailändisch</language>
<language type="ti">Tigrinja</language>
<language type="tig">Tigre</language>
<language type="tiv">Tiv-Sprache</language>
<language type="tk">Turkmenisch</language>
<language type="tkl">Tokelauanisch</language>
<language type="tl">Tagalog</language>
<language type="tlh">Klingonisch</language>
<language type="tli">Tlingit-Sprache</language>
<language type="tmh">Tamaseq</language>
<language type="tn">Tswana-Sprache</language>
<language type="to">Tongaisch</language>
<language type="tog">Tsonga-Sprache</language>
<language type="tpi">Neumelanesisch</language>
<language type="tr">Türkisch</language>
<language type="ts">Tsonga</language>
<language type="tsi">Tsimshian-Sprache</language>
<language type="tt">Tatarisch</language>
<language type="tum">Tumbuka-Sprache</language>
<language type="tup">Tupi-Sprachen</language>
<language type="tut">Altaische Sprache</language>
<language type="tvl">Elliceanisch</language>
<language type="tw">Twi</language>
<language type="ty">Tahitisch</language>
<language type="tyv">Tuwinisch</language>
<language type="udm">Udmurtisch</language>
<language type="ug">Uigurisch</language>
<language type="uga">Ugaritisch</language>
<language type="uk">Ukrainisch</language>
<language type="umb">Mbundu-Sprache</language>
<language type="und">Unbestimmte Sprache</language>
<language type="ur">Urdu</language>
<language type="uz">Usbekisch</language>
<language type="vai">Vai-Sprache</language>
<language type="ve">Venda-Sprache</language>
<language type="vi">Vietnamesisch</language>
<language type="vo">Volapük</language>
<language type="vot">Wotisch</language>
<language type="wa">Wallonisch</language>
<language type="wak">Wakashanisch</language>
<language type="wal">Walamo-Sprache</language>
<language type="war">Waray</language>
<language type="was">Washo-Sprache</language>
<language type="wen">Sorbisch</language>
<language type="wo">Wolof</language>
<language type="xal">Kalmückisch</language>
<language type="xh">Xhosa</language>
<language type="yao">Yao-Sprache</language>
<language type="yap">Yapesisch</language>
<language type="yi">Jiddisch</language>
<language type="yo">Yoruba</language>
<language type="ypk">Yupik-Sprache</language>
<language type="za">Zhuang</language>
<language type="zap">Zapotekisch</language>
<language type="zbl">Bliss-Symbole</language>
<language type="zen">Zenaga</language>
<language type="zh">Chinesisch</language>
<language type="zh_Hans">Chinesisch (vereinfacht)</language>
<language type="zh_Hant">Chinesisch (traditionell)</language>
<language type="znd">Zande-Sprache</language>
<language type="zu">Zulu</language>
<language type="zun">Zuni-Sprache</language>
<language type="zxx">Keine Sprachinhalte</language>
<language type="zxx" alt="proposed-x1001" draft="unconfirmed">kein Sprachinhalt</language>
<language type="zza">Zaza</language>
</languages>
<scripts>
<script type="Arab">Arabisch</script>
<script type="Armi">Armi</script>
<script type="Armn">Armenisch</script>
<script type="Avst">Avestisch</script>
<script type="Bali">Balinesisch</script>
<script type="Batk">Battakisch</script>
<script type="Beng">Bengalisch</script>
<script type="Blis">Bliss-Symbole</script>
<script type="Bopo">Bopomofo</script>
<script type="Brah">Brahmi</script>
<script type="Brai">Blindenschrift</script>
<script type="Bugi">Buginesisch</script>
<script type="Buhd">Buhid</script>
<script type="Cakm">Cakm</script>
<script type="Cans">UCAS</script>
<script type="Cari">Karisch</script>
<script type="Cham">Cham</script>
<script type="Cher">Cherokee</script>
<script type="Cirt">Cirth</script>
<script type="Copt">Koptisch</script>
<script type="Cprt">Zypriotisch</script>
<script type="Cyrl">Kyrillisch</script>
<script type="Cyrs">Altkirchenslawisch</script>
<script type="Deva">Devanagari</script>
<script type="Dsrt">Deseret</script>
<script type="Egyd">Ägyptisch - Demotisch</script>
<script type="Egyh">Ägyptisch - Hieratisch</script>
<script type="Egyp">Ägyptische Hieroglyphen</script>
<script type="Ethi">Äthiopisch</script>
<script type="Geok">Khutsuri</script>
<script type="Geor">Georgisch</script>
<script type="Glag">Glagolitisch</script>
<script type="Goth">Gotisch</script>
<script type="Grek">Griechisch</script>
<script type="Gujr">Gujarati</script>
<script type="Guru">Gurmukhi</script>
<script type="Hang">Hangul</script>
<script type="Hani">Chinesisch</script>
<script type="Hano">Hanunoo</script>
<script type="Hans">Vereinfachte Chinesische Schrift</script>
<script type="Hant">Traditionelle Chinesische Schrift</script>
<script type="Hebr">Hebräisch</script>
<script type="Hira">Hiragana</script>
<script type="Hmng">Pahawh Hmong</script>
<script type="Hrkt">Katakana oder Hiragana</script>
<script type="Hung">Altungarisch</script>
<script type="Inds">Indus-Schrift</script>
<script type="Ital">Altitalisch</script>
<script type="Java">Javanesisch</script>
<script type="Jpan">Japanisch</script>
<script type="Kali">Kayah Li</script>
<script type="Kana">Katakana</script>
<script type="Khar">Kharoshthi</script>
<script type="Khmr">Khmer</script>
<script type="Knda">Kannada</script>
<script type="Kore">Koreanisch</script>
<script type="Kthi">Kthi</script>
<script type="Lana">Lanna</script>
<script type="Laoo">Laotisch</script>
<script type="Latf">Lateinisch - Fraktur-Variante</script>
<script type="Latg">Lateinisch - Gälische Variante</script>
<script type="Latn">Lateinisch</script>
<script type="Lepc">Lepcha</script>
<script type="Limb">Limbu</script>
<script type="Lina">Linear A</script>
<script type="Linb">Linear B</script>
<script type="Lyci">Lykisch</script>
<script type="Lydi">Lydisch</script>
<script type="Mand">Mandäisch</script>
<script type="Mani">Manichäisch</script>
<script type="Maya">Maya-Hieroglyphen</script>
<script type="Mero">Meroitisch</script>
<script type="Mlym">Malaysisch</script>
<script type="Mong">Mongolisch</script>
<script type="Moon">Moon</script>
<script type="Mtei">Meitei Mayek</script>
<script type="Mymr">Birmanisch</script>
<script type="Nkoo">N’Ko</script>
<script type="Ogam">Ogham</script>
<script type="Olck">Ol Chiki</script>
<script type="Orkh">Orchon-Runen</script>
<script type="Orya">Oriya</script>
<script type="Osma">Osmanisch</script>
<script type="Perm">Altpermisch</script>
<script type="Phag">Phags-pa</script>
<script type="Phli">Phli</script>
<script type="Phlp">Phlp</script>
<script type="Phlv">Pahlavi</script>
<script type="Phnx">Phönizisch</script>
<script type="Plrd">Pollard Phonetisch</script>
<script type="Prti">Prti</script>
<script type="Qaai">Geerbter Schriftwert</script>
<script type="Rjng">Rejang</script>
<script type="Roro">Rongorongo</script>
<script type="Runr">Runenschrift</script>
<script type="Samr">Samaritanisch</script>
<script type="Sara">Sarati</script>
<script type="Saur">Saurashtra</script>
<script type="Sgnw">Gebärdensprache</script>
<script type="Shaw">Shaw-Alphabet</script>
<script type="Sinh">Singhalesisch</script>
<script type="Sund">Sundanesisch</script>
<script type="Sylo">Syloti Nagri</script>
<script type="Syrc">Syrisch</script>
<script type="Syre">Syrisch - Estrangelo-Variante</script>
<script type="Syrj">Westsyrisch</script>
<script type="Syrn">Ostsyrisch</script>
<script type="Tagb">Tagbanwa</script>
<script type="Tale">Tai Le</script>
<script type="Talu">Tai Lue</script>
<script type="Taml">Tamilisch</script>
<script type="Tavt">Tavt</script>
<script type="Telu">Telugu</script>
<script type="Teng">Tengwar</script>
<script type="Tfng">Tifinagh</script>
<script type="Tglg">Tagalog</script>
<script type="Thaa">Thaana</script>
<script type="Thai">Thai</script>
<script type="Tibt">Tibetisch</script>
<script type="Ugar">Ugaritisch</script>
<script type="Vaii">Vai</script>
<script type="Visp">Sichtbare Sprache</script>
<script type="Xpeo">Altpersisch</script>
<script type="Xsux">Sumerisch-akkadische Keilschrift</script>
<script type="Yiii">Yi</script>
<script type="Zmth">Zmth</script>
<script type="Zsym">Zsym</script>
<script type="Zxxx">Schriftlose Sprachen</script>
<script type="Zyyy">Unbestimmt</script>
<script type="Zzzz">Uncodierte Schrift</script>
</scripts>
<territories>
<territory type="001">Welt</territory>
<territory type="002">Afrika</territory>
<territory type="003">Nordamerika</territory>
<territory type="005">Südamerika</territory>
<territory type="009">Ozeanien</territory>
<territory type="011">Westafrika</territory>
<territory type="013">Mittelamerika</territory>
<territory type="014">Ostafrika</territory>
<territory type="015">Nordafrika</territory>
<territory type="017">Zentralafrika</territory>
<territory type="018">Südliches Afrika</territory>
<territory type="019">Amerika</territory>
<territory type="019" alt="proposed-x1001" draft="unconfirmed">Nord-, Mittel- und Südamerika</territory>
<territory type="021">Nördliches Amerika</territory>
<territory type="029">Karibik</territory>
<territory type="030">Ostasien</territory>
<territory type="034">Südasien</territory>
<territory type="035">Südostasien</territory>
<territory type="039">Südeuropa</territory>
<territory type="053">Australien und Neuseeland</territory>
<territory type="054">Melanesien</territory>
<territory type="057">Mikronesisches Inselgebiet</territory>
<territory type="061">Polynesien</territory>
<territory type="062">Süd-Zentralasien</territory>
<territory type="142">Asien</territory>
<territory type="143">Zentralasien</territory>
<territory type="145">Westasien</territory>
<territory type="150">Europa</territory>
<territory type="151">Osteuropa</territory>
<territory type="154">Nordeuropa</territory>
<territory type="155">Westeuropa</territory>
<territory type="172">Gemeinschaft Unabhängiger Staaten</territory>
<territory type="419">Lateinamerika und Karibik</territory>
<territory type="830">Kanalinseln</territory>
<territory type="AD">Andorra</territory>
<territory type="AE">Vereinigte Arabische Emirate</territory>
<territory type="AF">Afghanistan</territory>
<territory type="AG">Antigua und Barbuda</territory>
<territory type="AI">Anguilla</territory>
<territory type="AL">Albanien</territory>
<territory type="AM">Armenien</territory>
<territory type="AN">Niederländische Antillen</territory>
<territory type="AO">Angola</territory>
<territory type="AQ">Antarktis</territory>
<territory type="AR">Argentinien</territory>
<territory type="AS">Amerikanisch-Samoa</territory>
<territory type="AT">Österreich</territory>
<territory type="AU">Australien</territory>
<territory type="AW">Aruba</territory>
<territory type="AX">Alandinseln</territory>
<territory type="AZ">Aserbaidschan</territory>
<territory type="BA">Bosnien und Herzegowina</territory>
<territory type="BB">Barbados</territory>
<territory type="BD">Bangladesch</territory>
<territory type="BE">Belgien</territory>
<territory type="BF">Burkina Faso</territory>
<territory type="BG">Bulgarien</territory>
<territory type="BH">Bahrain</territory>
<territory type="BI">Burundi</territory>
<territory type="BJ">Benin</territory>
<territory type="BL">St. Barthélemy</territory>
<territory type="BM">Bermuda</territory>
<territory type="BN">Brunei Darussalam</territory>
<territory type="BO">Bolivien</territory>
<territory type="BR">Brasilien</territory>
<territory type="BS">Bahamas</territory>
<territory type="BT">Bhutan</territory>
<territory type="BV">Bouvetinsel</territory>
<territory type="BW">Botsuana</territory>
<territory type="BY">Belarus</territory>
<territory type="BZ">Belize</territory>
<territory type="CA">Kanada</territory>
<territory type="CC">Kokosinseln</territory>
<territory type="CD">Demokratische Republik Kongo</territory>
<territory type="CF">Zentralafrikanische Republik</territory>
<territory type="CG">Kongo</territory>
<territory type="CH">Schweiz</territory>
<territory type="CI">Côte d’Ivoire</territory>
<territory type="CI" alt="proposed-x1001" draft="unconfirmed">Elfenbeinküste</territory>
<territory type="CK">Cookinseln</territory>
<territory type="CL">Chile</territory>
<territory type="CM">Kamerun</territory>
<territory type="CN">China</territory>
<territory type="CO">Kolumbien</territory>
<territory type="CR">Costa Rica</territory>
<territory type="CS">Serbien und Montenegro</territory>
<territory type="CU">Kuba</territory>
<territory type="CV">Kap Verde</territory>
<territory type="CX">Weihnachtsinsel</territory>
<territory type="CY">Zypern</territory>
<territory type="CZ">Tschechische Republik</territory>
<territory type="DE">Deutschland</territory>
<territory type="DJ">Dschibuti</territory>
<territory type="DK">Dänemark</territory>
<territory type="DM">Dominica</territory>
<territory type="DO">Dominikanische Republik</territory>
<territory type="DZ">Algerien</territory>
<territory type="EC">Ecuador</territory>
<territory type="EE">Estland</territory>
<territory type="EG">Ägypten</territory>
<territory type="EH">Westsahara</territory>
<territory type="ER">Eritrea</territory>
<territory type="ES">Spanien</territory>
<territory type="ET">Äthiopien</territory>
<territory type="FI">Finnland</territory>
<territory type="FJ">Fidschi</territory>
<territory type="FK">Falklandinseln</territory>
<territory type="FM">Mikronesien</territory>
<territory type="FO">Färöer</territory>
<territory type="FR">Frankreich</territory>
<territory type="GA">Gabun</territory>
<territory type="GB">Vereinigtes Königreich</territory>
<territory type="GD">Grenada</territory>
<territory type="GE">Georgien</territory>
<territory type="GF">Französisch-Guayana</territory>
<territory type="GG">Guernsey</territory>
<territory type="GH">Ghana</territory>
<territory type="GI">Gibraltar</territory>
<territory type="GL">Grönland</territory>
<territory type="GM">Gambia</territory>
<territory type="GN">Guinea</territory>
<territory type="GP">Guadeloupe</territory>
<territory type="GQ">Äquatorialguinea</territory>
<territory type="GR">Griechenland</territory>
<territory type="GS">Südgeorgien und die Südlichen Sandwichinseln</territory>
<territory type="GT">Guatemala</territory>
<territory type="GU">Guam</territory>
<territory type="GW">Guinea-Bissau</territory>
<territory type="GY">Guyana</territory>
<territory type="HK">Sonderverwaltungszone Hongkong</territory>
<territory type="HK" alt="proposed-x1001" draft="unconfirmed">Hongkong</territory>
<territory type="HK" alt="short">Hongkong</territory>
<territory type="HM">Heard- und McDonald-Inseln</territory>
<territory type="HN">Honduras</territory>
<territory type="HR">Kroatien</territory>
<territory type="HT">Haiti</territory>
<territory type="HU">Ungarn</territory>
<territory type="ID">Indonesien</territory>
<territory type="IE">Irland</territory>
<territory type="IL">Israel</territory>
<territory type="IM">Isle of Man</territory>
<territory type="IN">Indien</territory>
<territory type="IO">Britisches Territorium im Indischen Ozean</territory>
<territory type="IQ">Irak</territory>
<territory type="IR">Iran</territory>
<territory type="IS">Island</territory>
<territory type="IT">Italien</territory>
<territory type="JE">Jersey</territory>
<territory type="JM">Jamaika</territory>
<territory type="JO">Jordanien</territory>
<territory type="JP">Japan</territory>
<territory type="KE">Kenia</territory>
<territory type="KG">Kirgisistan</territory>
<territory type="KH">Kambodscha</territory>
<territory type="KI">Kiribati</territory>
<territory type="KM">Komoren</territory>
<territory type="KN">St. Kitts und Nevis</territory>
<territory type="KP">Demokratische Volksrepublik Korea</territory>
<territory type="KR">Republik Korea</territory>
<territory type="KW">Kuwait</territory>
<territory type="KY">Kaimaninseln</territory>
<territory type="KZ">Kasachstan</territory>
<territory type="LA">Laos</territory>
<territory type="LB">Libanon</territory>
<territory type="LC">St. Lucia</territory>
<territory type="LI">Liechtenstein</territory>
<territory type="LK">Sri Lanka</territory>
<territory type="LR">Liberia</territory>
<territory type="LS">Lesotho</territory>
<territory type="LT">Litauen</territory>
<territory type="LU">Luxemburg</territory>
<territory type="LV">Lettland</territory>
<territory type="LY">Libyen</territory>
<territory type="MA">Marokko</territory>
<territory type="MC">Monaco</territory>
<territory type="MD">Republik Moldau</territory>
<territory type="ME">Montenegro</territory>
<territory type="MF">St. Martin</territory>
<territory type="MG">Madagaskar</territory>
<territory type="MH">Marshallinseln</territory>
<territory type="MK">Mazedonien</territory>
<territory type="ML">Mali</territory>
<territory type="MM">Myanmar</territory>
<territory type="MN">Mongolei</territory>
<territory type="MO">Sonderverwaltungszone Macao</territory>
<territory type="MO" alt="proposed-x1001" draft="unconfirmed">Macao</territory>
<territory type="MO" alt="proposed-x1002" draft="unconfirmed">Sonderverwaltungsregion Macau</territory>
<territory type="MO" alt="short">Macao</territory>
<territory type="MO" alt="short-proposed-x1001" draft="unconfirmed">Macau</territory>
<territory type="MP">Nördliche Marianen</territory>
<territory type="MQ">Martinique</territory>
<territory type="MR">Mauretanien</territory>
<territory type="MS">Montserrat</territory>
<territory type="MT">Malta</territory>
<territory type="MU">Mauritius</territory>
<territory type="MV">Malediven</territory>
<territory type="MW">Malawi</territory>
<territory type="MX">Mexiko</territory>
<territory type="MY">Malaysia</territory>
<territory type="MZ">Mosambik</territory>
<territory type="NA">Namibia</territory>
<territory type="NC">Neukaledonien</territory>
<territory type="NE">Niger</territory>
<territory type="NF">Norfolkinsel</territory>
<territory type="NG">Nigeria</territory>
<territory type="NI">Nicaragua</territory>
<territory type="NL">Niederlande</territory>
<territory type="NO">Norwegen</territory>
<territory type="NP">Nepal</territory>
<territory type="NR">Nauru</territory>
<territory type="NU">Niue</territory>
<territory type="NZ">Neuseeland</territory>
<territory type="OM">Oman</territory>
<territory type="PA">Panama</territory>
<territory type="PE">Peru</territory>
<territory type="PF">Französisch-Polynesien</territory>
<territory type="PG">Papua-Neuguinea</territory>
<territory type="PH">Philippinen</territory>
<territory type="PK">Pakistan</territory>
<territory type="PL">Polen</territory>
<territory type="PM">St. Pierre und Miquelon</territory>
<territory type="PN">Pitcairn</territory>
<territory type="PR">Puerto Rico</territory>
<territory type="PS">Palästinensische Gebiete</territory>
<territory type="PT">Portugal</territory>
<territory type="PW">Palau</territory>
<territory type="PY">Paraguay</territory>
<territory type="QA">Katar</territory>
<territory type="QO">Äußeres Ozeanien</territory>
<territory type="QU">Europäische Union</territory>
<territory type="RE">Réunion</territory>
<territory type="RO">Rumänien</territory>
<territory type="RS">Serbien</territory>
<territory type="RU">Russische Föderation</territory>
<territory type="RW">Ruanda</territory>
<territory type="SA">Saudi-Arabien</territory>
<territory type="SB">Salomonen</territory>
<territory type="SC">Seychellen</territory>
<territory type="SD">Sudan</territory>
<territory type="SE">Schweden</territory>
<territory type="SG">Singapur</territory>
<territory type="SH">St. Helena</territory>
<territory type="SI">Slowenien</territory>
<territory type="SJ">Svalbard und Jan Mayen</territory>
<territory type="SK">Slowakei</territory>
<territory type="SL">Sierra Leone</territory>
<territory type="SM">San Marino</territory>
<territory type="SN">Senegal</territory>
<territory type="SO">Somalia</territory>
<territory type="SR">Suriname</territory>
<territory type="ST">São Tomé und Príncipe</territory>
<territory type="SV">El Salvador</territory>
<territory type="SY">Syrien</territory>
<territory type="SZ">Swasiland</territory>
<territory type="TC">Turks- und Caicosinseln</territory>
<territory type="TD">Tschad</territory>
<territory type="TF">Französische Süd- und Antarktisgebiete</territory>
<territory type="TG">Togo</territory>
<territory type="TH">Thailand</territory>
<territory type="TJ">Tadschikistan</territory>
<territory type="TK">Tokelau</territory>
<territory type="TL">Osttimor</territory>
<territory type="TM">Turkmenistan</territory>
<territory type="TN">Tunesien</territory>
<territory type="TO">Tonga</territory>
<territory type="TR">Türkei</territory>
<territory type="TT">Trinidad und Tobago</territory>
<territory type="TV">Tuvalu</territory>
<territory type="TW">Taiwan</territory>
<territory type="TZ">Tansania</territory>
<territory type="UA">Ukraine</territory>
<territory type="UG">Uganda</territory>
<territory type="UM">Amerikanisch-Ozeanien</territory>
<territory type="US">Vereinigte Staaten</territory>
<territory type="UY">Uruguay</territory>
<territory type="UZ">Usbekistan</territory>
<territory type="VA">Vatikanstadt</territory>
<territory type="VC">St. Vincent und die Grenadinen</territory>
<territory type="VE">Venezuela</territory>
<territory type="VG">Britische Jungferninseln</territory>
<territory type="VI">Amerikanische Jungferninseln</territory>
<territory type="VN">Vietnam</territory>
<territory type="VU">Vanuatu</territory>
<territory type="WF">Wallis und Futuna</territory>
<territory type="WS">Samoa</territory>
<territory type="YE">Jemen</territory>
<territory type="YT">Mayotte</territory>
<territory type="ZA">Südafrika</territory>
<territory type="ZM">Sambia</territory>
<territory type="ZW">Simbabwe</territory>
<territory type="ZZ">Unbekannte oder ungültige Region</territory>
</territories>
<variants>
<variant type="1901">Alte deutsche Rechtschreibung</variant>
<variant type="1994">Standardisierte Resianische Rechtschreibung</variant>
<variant type="1996">Neue deutsche Rechtschreibung</variant>
<variant type="1606NICT">Spätes Mittelfranzösisch</variant>
<variant type="1694ACAD">Klassisches Französisch</variant>
<variant type="AREVELA">Ostarmenisch</variant>
<variant type="AREVMDA">Westarmenisch</variant>
<variant type="BAKU1926">Einheitliches Türkisches Alphabet</variant>
<variant type="BISKE">Bela-Dialekt</variant>
<variant type="BOONT">Boontling</variant>
<variant type="FONIPA">IPA Phonetisch</variant>
<variant type="FONUPA">Phonetisch (UPA)</variant>
<variant type="LIPAW">Lipovaz-Dialekt</variant>
<variant type="MONOTON">Monotonisch</variant>
<variant type="NEDIS">Natisone-Dialekt</variant>
<variant type="NJIVA">Njiva-Dialekt</variant>
<variant type="OSOJS">Osojane-Dialekt</variant>
<variant type="POLYTON">Polytonisch</variant>
<variant type="POSIX">Posix</variant>
<variant type="POSIX" alt="proposed-x1001" draft="unconfirmed">POSIX</variant>
<variant type="REVISED">Revidierte Rechtschreibung</variant>
<variant type="ROZAJ">Resianisch</variant>
<variant type="SAAHO">Saho</variant>
<variant type="SCOTLAND">Schottisches Standardenglisch</variant>
<variant type="SCOUSE">Scouse-Dialekt</variant>
<variant type="SOLBA">Solbica-Dialekt</variant>
<variant type="TARASK">Taraskievica-Orthographie</variant>
<variant type="VALENCIA">Valencianisch</variant>
</variants>
<keys>
<key type="calendar">Kalender</key>
<key type="collation">Sortierung</key>
<key type="currency">Währung</key>
</keys>
<types>
<type type="big5han" key="collation">Traditionelles Chinesisch - Big5</type>
<type type="buddhist" key="calendar">Buddhistischer Kalender</type>
<type type="chinese" key="calendar">Chinesischer Kalender</type>
<type type="direct" key="collation">Direkte Sortierregeln</type>
<type type="gb2312han" key="collation">Vereinfachtes Chinesisch - GB2312</type>
<type type="gregorian" key="calendar">Gregorianischer Kalender</type>
<type type="hebrew" key="calendar">Hebräischer Kalender</type>
<type type="indian" key="calendar">Indischer Nationalkalender</type>
<type type="islamic" key="calendar">Islamischer Kalender</type>
<type type="islamic-civil" key="calendar">Bürgerlicher islamischer Kalender</type>
<type type="japanese" key="calendar">Japanischer Kalender</type>
<type type="phonebook" key="collation">Telefonbuch-Sortierregeln</type>
<type type="pinyin" key="collation">Pinyin-Sortierregeln</type>
<type type="roc" key="calendar">Kalender der Republik China</type>
<type type="stroke" key="collation">Strichfolge</type>
<type type="traditional" key="collation">Traditionelle Sortierregeln</type>
</types>
<measurementSystemNames>
<measurementSystemName type="metric">Metrisch</measurementSystemName>
<measurementSystemName type="metric" alt="proposed-x1001" draft="unconfirmed">SI-Einheiten</measurementSystemName>
<measurementSystemName type="US">Angloamerikanisch</measurementSystemName>
<measurementSystemName type="US" alt="proposed-x1001" draft="unconfirmed">US-Einheiten</measurementSystemName>
</measurementSystemNames>
<codePatterns>
<codePattern type="language">Sprache: {0}</codePattern>
<codePattern type="script">Schrift: {0}</codePattern>
<codePattern type="territory">Region: {0}</codePattern>
</codePatterns>
</localeDisplayNames>
<characters>
<exemplarCharacters>[a ä b-o ö p-s ß t u ü v-z]</exemplarCharacters>
<exemplarCharacters type="auxiliary">[á à ă â å ā æ ç é è ĕ ê ë ē í ì ĭ î ï ī ñ ó ò ŏ ô ø ō œ ú ù ŭ û ū ÿ]</exemplarCharacters>
<exemplarCharacters type="currencySymbol">[a-z]</exemplarCharacters>
</characters>
<delimiters>
<quotationStart>„</quotationStart>
<quotationEnd>“</quotationEnd>
<alternateQuotationStart>‚</alternateQuotationStart>
<alternateQuotationEnd>‘</alternateQuotationEnd>
</delimiters>
<dates>
<dateRangePattern draft="unconfirmed">{0}−{1}</dateRangePattern>
<calendars>
<calendar type="buddhist">
<am>vorm.</am>
<pm>nachm.</pm>
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern>EEEE d. MMMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern>d. MMMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern>d. MMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern>d.M.yyyy</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
</calendar>
<calendar type="chinese">
<am>vorm.</am>
<pm>nachm.</pm>
</calendar>
<calendar type="coptic">
<am>vorm.</am>
<pm>nachm.</pm>
</calendar>
<calendar type="gregorian">
<months>
<monthContext type="format">
<monthWidth type="abbreviated">
<month type="1">Jan</month>
<month type="2">Feb</month>
<month type="3">Mär</month>
<month type="4">Apr</month>
<month type="5">Mai</month>
<month type="6">Jun</month>
<month type="7">Jul</month>
<month type="8">Aug</month>
<month type="9">Sep</month>
<month type="10">Okt</month>
<month type="11">Nov</month>
<month type="12">Dez</month>
</monthWidth>
<monthWidth type="wide">
<month type="1">Januar</month>
<month type="2">Februar</month>
<month type="3">März</month>
<month type="4">April</month>
<month type="5">Mai</month>
<month type="6">Juni</month>
<month type="7">Juli</month>
<month type="8">August</month>
<month type="9">September</month>
<month type="10">Oktober</month>
<month type="11">November</month>
<month type="12">Dezember</month>
</monthWidth>
</monthContext>
<monthContext type="stand-alone">
<monthWidth type="abbreviated">
<month type="3">Mär</month>
<month type="7">Jul</month>
<month type="8">Aug</month>
<month type="9">Sep</month>
<month type="10">Okt</month>
<month type="11">Nov</month>
<month type="12">Dez</month>
</monthWidth>
<monthWidth type="narrow">
<month type="1">J</month>
<month type="2">F</month>
<month type="3">M</month>
<month type="4">A</month>
<month type="5">M</month>
<month type="6">J</month>
<month type="7">J</month>
<month type="8">A</month>
<month type="9">S</month>
<month type="10">O</month>
<month type="11">N</month>
<month type="12">D</month>
</monthWidth>
</monthContext>
</months>
<days>
<dayContext type="format">
<dayWidth type="abbreviated">
<day type="sun">So.</day>
<day type="mon">Mo.</day>
<day type="tue">Di.</day>
<day type="wed">Mi.</day>
<day type="thu">Do.</day>
<day type="fri">Fr.</day>
<day type="sat">Sa.</day>
</dayWidth>
<dayWidth type="wide">
<day type="sun">Sonntag</day>
<day type="mon">Montag</day>
<day type="tue">Dienstag</day>
<day type="wed">Mittwoch</day>
<day type="thu">Donnerstag</day>
<day type="fri">Freitag</day>
<day type="sat">Samstag</day>
</dayWidth>
</dayContext>
<dayContext type="stand-alone">
<dayWidth type="narrow">
<day type="sun">S</day>
<day type="mon">M</day>
<day type="tue">D</day>
<day type="wed">M</day>
<day type="thu">D</day>
<day type="fri">F</day>
<day type="sat">S</day>
</dayWidth>
</dayContext>
</days>
<quarters>
<quarterContext type="format">
<quarterWidth type="abbreviated">
<quarter type="1">Q1</quarter>
<quarter type="2">Q2</quarter>
<quarter type="3">Q3</quarter>
<quarter type="4">Q4</quarter>
</quarterWidth>
<quarterWidth type="wide">
<quarter type="1">1. Quartal</quarter>
<quarter type="2">2. Quartal</quarter>
<quarter type="3">3. Quartal</quarter>
<quarter type="4">4. Quartal</quarter>
</quarterWidth>
</quarterContext>
<quarterContext type="stand-alone">
<quarterWidth type="narrow">
<quarter type="1">1</quarter>
<quarter type="2">2</quarter>
<quarter type="3">3</quarter>
<quarter type="4">4</quarter>
</quarterWidth>
</quarterContext>
</quarters>
<am>vorm.</am>
<pm>nachm.</pm>
<eras>
<eraNames>
<era type="0">v. Chr.</era>
<era type="1">n. Chr.</era>
</eraNames>
<eraAbbr>
<era type="0">v. Chr.</era>
<era type="1">n. Chr.</era>
</eraAbbr>
</eras>
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern>EEEE, d. MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern>d. MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern>dd.MM.yyyy</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern>dd.MM.yy</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
<timeFormats>
<timeFormatLength type="full">
<timeFormat>
<pattern>HH:mm:ss zzzz</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="long">
<timeFormat>
<pattern>HH:mm:ss z</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="medium">
<timeFormat>
<pattern>HH:mm:ss</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="short">
<timeFormat>
<pattern>HH:mm</pattern>
</timeFormat>
</timeFormatLength>
</timeFormats>
<dateTimeFormats>
<dateTimeFormatLength type="full">
<dateTimeFormat>
<pattern>{1} {0}</pattern>
</dateTimeFormat>
</dateTimeFormatLength>
<dateTimeFormatLength type="long">
<dateTimeFormat>
<pattern>{1} {0}</pattern>
</dateTimeFormat>
</dateTimeFormatLength>
<dateTimeFormatLength type="medium">
<dateTimeFormat>
<pattern>{1} {0}</pattern>
</dateTimeFormat>
</dateTimeFormatLength>
<dateTimeFormatLength type="short">
<dateTimeFormat>
<pattern>{1} {0}</pattern>
</dateTimeFormat>
</dateTimeFormatLength>
<availableFormats>
<dateFormatItem id="d">d</dateFormatItem>
<dateFormatItem id="Ed">E d.</dateFormatItem>
<dateFormatItem id="EEEd">d. EEE</dateFormatItem>
<dateFormatItem id="H">H</dateFormatItem>
<dateFormatItem id="HHmm">HH:mm</dateFormatItem>
<dateFormatItem id="HHmmss">HH:mm:ss</dateFormatItem>
<dateFormatItem id="Hm">H:mm</dateFormatItem>
<dateFormatItem id="M">L</dateFormatItem>
<dateFormatItem id="Md">d.M.</dateFormatItem>
<dateFormatItem id="MEd">E, d.M.</dateFormatItem>
<dateFormatItem id="MMd">d.MM.</dateFormatItem>
<dateFormatItem id="MMdd">dd.MM.</dateFormatItem>
<dateFormatItem id="MMM">LLL</dateFormatItem>
<dateFormatItem id="MMMd">d. MMM</dateFormatItem>
<dateFormatItem id="MMMEd">E d. MMM</dateFormatItem>
<dateFormatItem id="MMMMd">d. MMMM</dateFormatItem>
<dateFormatItem id="MMMMdd">dd. MMMM</dateFormatItem>
<dateFormatItem id="MMMMEd">E d. MMMM</dateFormatItem>
<dateFormatItem id="mmss">mm:ss</dateFormatItem>
<dateFormatItem id="ms">mm:ss</dateFormatItem>
<dateFormatItem id="y">y</dateFormatItem>
<dateFormatItem id="yM">yyyy-M</dateFormatItem>
<dateFormatItem id="yMEd">EEE, yyyy-M-d</dateFormatItem>
<dateFormatItem id="yMMM">MMM y</dateFormatItem>
<dateFormatItem id="yMMMEd">EEE, d. MMM y</dateFormatItem>
<dateFormatItem id="yMMMM">MMMM y</dateFormatItem>
<dateFormatItem id="yQ">Q yyyy</dateFormatItem>
<dateFormatItem id="yQQQ">QQQ y</dateFormatItem>
<dateFormatItem id="yyMM">MM.yy</dateFormatItem>
<dateFormatItem id="yyMMdd">dd.MM.yy</dateFormatItem>
<dateFormatItem id="yyMMM">MMM yy</dateFormatItem>
<dateFormatItem id="yyQ">Q yy</dateFormatItem>
<dateFormatItem id="yyQQQQ">QQQQ yy</dateFormatItem>
<dateFormatItem id="yyyy">y</dateFormatItem>
<dateFormatItem id="yyyyMMMM">MMMM y</dateFormatItem>
</availableFormats>
<intervalFormats>
<intervalFormatFallback>{0} - {1}</intervalFormatFallback>
<intervalFormatItem id="d">
<greatestDifference id="d">d.-d.</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="h">
<greatestDifference id="a">HH-HH</greatestDifference>
<greatestDifference id="h">HH-HH</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="hm">
<greatestDifference id="a">HH:mm-HH:mm</greatestDifference>
<greatestDifference id="h">HH:mm-HH:mm</greatestDifference>
<greatestDifference id="m">HH:mm-HH:mm</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="hmv">
<greatestDifference id="a">HH:mm-HH:mm v</greatestDifference>
<greatestDifference id="h">HH:mm-HH:mm v</greatestDifference>
<greatestDifference id="m">HH:mm-HH:mm v</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="hv">
<greatestDifference id="a">HH-HH v</greatestDifference>
<greatestDifference id="h">HH-HH v</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="M">
<greatestDifference id="M">M.-M.</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="Md">
<greatestDifference id="d">dd.MM. - dd.MM.</greatestDifference>
<greatestDifference id="M">dd.MM. - dd.MM.</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="MEd">
<greatestDifference id="d">E, dd.MM. - E, dd.MM.</greatestDifference>
<greatestDifference id="M">E, dd.MM. - E, dd.MM.</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="MMM">
<greatestDifference id="M">MMM-MMM</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="MMMd">
<greatestDifference id="d">d.-d. MMM</greatestDifference>
<greatestDifference id="M">d. MMM - d. MMM</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="MMMEd">
<greatestDifference id="d">E, d. - E, d. MMM</greatestDifference>
<greatestDifference id="M">E, d. MMM - E, d. MMM</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="MMMM">
<greatestDifference id="M">LLLL-LLLL</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="y">
<greatestDifference id="y">y-y</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yM">
<greatestDifference id="M">MM.yy - MM.yy</greatestDifference>
<greatestDifference id="y">MM.yy - MM.yy</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMd">
<greatestDifference id="d">dd.MM.yy - dd.MM.yy</greatestDifference>
<greatestDifference id="M">dd.MM.yy - dd.MM.yy</greatestDifference>
<greatestDifference id="y">dd.MM.yy - dd.MM.yy</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMEd">
<greatestDifference id="d">E, dd.MM.yy - E, dd.MM.yy</greatestDifference>
<greatestDifference id="M">E, dd.MM.yy - E, dd.MM.yy</greatestDifference>
<greatestDifference id="y">E, dd.MM.yy - E, dd.MM.yy</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMMM">
<greatestDifference id="M">MMM-MMM y</greatestDifference>
<greatestDifference id="y">MMM y - MMM y</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMMMd">
<greatestDifference id="d">d.-d. MMM y</greatestDifference>
<greatestDifference id="M">d. MMM - d. MMM y</greatestDifference>
<greatestDifference id="y">d. MMM y - d. MMM y</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMMMEd">
<greatestDifference id="d">E, d. - E, d. MMM y</greatestDifference>
<greatestDifference id="M">E, d. MMM - E, d. MMM y</greatestDifference>
<greatestDifference id="y">E, d. MMM y - E, d. MMM y</greatestDifference>
</intervalFormatItem>
<intervalFormatItem id="yMMMM">
<greatestDifference id="M">MM – MM.yyyy</greatestDifference>
<greatestDifference id="y">MM.yyyy – MM.yyyy</greatestDifference>
</intervalFormatItem>
</intervalFormats>
</dateTimeFormats>
<fields>
<field type="era">
<displayName>Epoche</displayName>
</field>
<field type="year">
<displayName>Jahr</displayName>
</field>
<field type="month">
<displayName>Monat</displayName>
</field>
<field type="week">
<displayName>Woche</displayName>
</field>
<field type="day">
<displayName>Tag</displayName>
<relative type="-3">Vor drei Tagen</relative>
<relative type="-3" alt="proposed-x1001" draft="unconfirmed">vorvorgestern</relative>
<relative type="-2">Vorgestern</relative>
<relative type="-2" alt="proposed-x1001" draft="unconfirmed">vorgestern</relative>
<relative type="-1">Gestern</relative>
<relative type="-1" alt="proposed-x1001" draft="unconfirmed">gestern</relative>
<relative type="0">Heute</relative>
<relative type="0" alt="proposed-x1001" draft="unconfirmed">heute</relative>
<relative type="1">Morgen</relative>
<relative type="1" alt="proposed-x1001" draft="unconfirmed">morgen</relative>
<relative type="2">Übermorgen</relative>
<relative type="2" alt="proposed-x1001" draft="unconfirmed">übermorgen</relative>
<relative type="3">In drei Tagen</relative>
<relative type="3" alt="proposed-x1001" draft="unconfirmed">überübermorgen</relative>
</field>
<field type="weekday">
<displayName>Wochentag</displayName>
</field>
<field type="dayperiod">
<displayName>Tageshälfte</displayName>
</field>
<field type="hour">
<displayName>Stunde</displayName>
</field>
<field type="minute">
<displayName>Minute</displayName>
</field>
<field type="second">
<displayName>Sekunde</displayName>
</field>
<field type="zone">
<displayName>Zone</displayName>
<displayName alt="proposed-x1001" draft="unconfirmed">Zeitzone</displayName>
</field>
</fields>
</calendar>
<calendar type="hebrew">
<am>vorm.</am>
<pm>nachm.</pm>
</calendar>
<calendar type="islamic">
<am>vorm.</am>
<pm>nachm.</pm>
</calendar>
</calendars>
<timeZoneNames>
<hourFormat>+HH:mm;-HH:mm</hourFormat>
<hourFormat alt="proposed-x1001" draft="unconfirmed">+HH:mm;−HH:mm</hourFormat>
<gmtFormat>GMT{0}</gmtFormat>
<regionFormat>{0}</regionFormat>
<fallbackFormat>{1} ({0})</fallbackFormat>
<zone type="Etc/Unknown">
<exemplarCity>Unbekannt</exemplarCity>
</zone>
<zone type="Europe/Tirane">
<exemplarCity>Tirana</exemplarCity>
</zone>
<zone type="Asia/Yerevan">
<exemplarCity>Erivan</exemplarCity>
</zone>
<zone type="America/Curacao">
<exemplarCity>Curaçao</exemplarCity>
</zone>
<zone type="Antarctica/South_Pole">
<exemplarCity>Südpol</exemplarCity>
</zone>
<zone type="Antarctica/Vostok">
<exemplarCity>Wostok</exemplarCity>
</zone>
<zone type="Antarctica/DumontDUrville">
<exemplarCity>Dumont D'Urville</exemplarCity>
</zone>
<zone type="Europe/Vienna">
<exemplarCity>Wien</exemplarCity>
</zone>
<zone type="Europe/Brussels">
<exemplarCity>Brüssel</exemplarCity>
</zone>
<zone type="Africa/Ouagadougou">
<exemplarCity>Wagadugu</exemplarCity>
</zone>
<zone type="Atlantic/Bermuda">
<exemplarCity>Bermudas</exemplarCity>
</zone>
<zone type="Europe/Zurich">
<exemplarCity>Zürich</exemplarCity>
</zone>
<zone type="Pacific/Easter">
<exemplarCity>Osterinsel</exemplarCity>
</zone>
<zone type="America/Havana">
<exemplarCity>Havanna</exemplarCity>
</zone>
<zone type="Atlantic/Cape_Verde">
<exemplarCity>Kap Verde</exemplarCity>
</zone>
<zone type="Indian/Christmas">
<exemplarCity>Weihnachts-Inseln</exemplarCity>
</zone>
<zone type="Asia/Nicosia">
<exemplarCity>Nikosia</exemplarCity>
</zone>
<zone type="Africa/Djibouti">
<exemplarCity>Dschibuti</exemplarCity>
</zone>
<zone type="Europe/Copenhagen">
<exemplarCity>Kopenhagen</exemplarCity>
</zone>
<zone type="Africa/Algiers">
<exemplarCity>Algier</exemplarCity>
</zone>
<zone type="Africa/Cairo">
<exemplarCity>Kairo</exemplarCity>
</zone>
<zone type="Africa/El_Aaiun">
<exemplarCity>El Aaiún</exemplarCity>
</zone>
<zone type="Atlantic/Canary">
<exemplarCity>Kanaren</exemplarCity>
</zone>
<zone type="Africa/Addis_Ababa">
<exemplarCity>Addis Abeba</exemplarCity>
</zone>
<zone type="Pacific/Fiji">
<exemplarCity>Fidschi</exemplarCity>
</zone>
<zone type="Atlantic/Faeroe">
<exemplarCity>Färöer</exemplarCity>
</zone>
<zone type="Asia/Tbilisi">
<exemplarCity>Tiflis</exemplarCity>
</zone>
<zone type="Africa/Accra">
<exemplarCity>Akkra</exemplarCity>
</zone>
<zone type="Europe/Athens">
<exemplarCity>Athen</exemplarCity>
</zone>
<zone type="Atlantic/South_Georgia">
<exemplarCity>Süd-Georgien</exemplarCity>
</zone>
<zone type="Asia/Hong_Kong">
<exemplarCity>Hongkong</exemplarCity>
</zone>
<zone type="Asia/Baghdad">
<exemplarCity>Bagdad</exemplarCity>
</zone>
<zone type="Asia/Tehran">
<exemplarCity>Teheran</exemplarCity>
</zone>
<zone type="Europe/Rome">
<exemplarCity>Rom</exemplarCity>
</zone>
<zone type="America/Jamaica">
<exemplarCity>Jamaika</exemplarCity>
</zone>
<zone type="Asia/Tokyo">
<exemplarCity>Tokio</exemplarCity>
</zone>
<zone type="Asia/Bishkek">
<exemplarCity>Bischkek</exemplarCity>
</zone>
<zone type="Indian/Comoro">
<exemplarCity>Komoren</exemplarCity>
</zone>
<zone type="America/St_Kitts">
<exemplarCity>St. Kitts</exemplarCity>
</zone>
<zone type="Asia/Pyongyang">
<exemplarCity>Pjöngjang</exemplarCity>
</zone>
<zone type="America/Cayman">
<exemplarCity>Kaimaninseln</exemplarCity>
</zone>
<zone type="Asia/Aqtobe">
<exemplarCity>Aktobe</exemplarCity>
</zone>
<zone type="America/St_Lucia">
<exemplarCity>St. Lucia</exemplarCity>
</zone>
<zone type="Europe/Vilnius">
<exemplarCity>Wilna</exemplarCity>
</zone>
<zone type="Europe/Luxembourg">
<exemplarCity>Luxemburg</exemplarCity>
</zone>
<zone type="Africa/Tripoli">
<exemplarCity>Tripolis</exemplarCity>
</zone>
<zone type="Europe/Chisinau">
<exemplarCity>Kischinau</exemplarCity>
</zone>
<zone type="Asia/Macau">
<exemplarCity>Macao</exemplarCity>
</zone>
<zone type="Indian/Maldives">
<exemplarCity>Malediven</exemplarCity>
</zone>
<zone type="America/Mexico_City">
<exemplarCity>Mexiko-Stadt</exemplarCity>
</zone>
<zone type="Africa/Niamey">
<exemplarCity>Niger</exemplarCity>
</zone>
<zone type="Asia/Muscat">
<exemplarCity>Muskat</exemplarCity>
</zone>
<zone type="Europe/Warsaw">
<exemplarCity>Warschau</exemplarCity>
</zone>
<zone type="Atlantic/Azores">
<exemplarCity>Azoren</exemplarCity>
</zone>
<zone type="Europe/Lisbon">
<exemplarCity>Lissabon</exemplarCity>
</zone>
<zone type="America/Asuncion">
<exemplarCity>Asunción</exemplarCity>
</zone>
<zone type="Asia/Qatar">
<exemplarCity>Katar</exemplarCity>
</zone>
<zone type="Indian/Reunion">
<exemplarCity>Réunion</exemplarCity>
</zone>
<zone type="Europe/Bucharest">
<exemplarCity>Bukarest</exemplarCity>
</zone>
<zone type="Europe/Moscow">
<exemplarCity>Moskau</exemplarCity>
</zone>
<zone type="Asia/Yekaterinburg">
<exemplarCity>Jekaterinburg</exemplarCity>
</zone>
<zone type="Asia/Novosibirsk">
<exemplarCity>Nowosibirsk</exemplarCity>
</zone>
<zone type="Asia/Krasnoyarsk">
<exemplarCity>Krasnojarsk</exemplarCity>
</zone>
<zone type="Asia/Yakutsk">
<exemplarCity>Jakutsk</exemplarCity>
</zone>
<zone type="Asia/Vladivostok">
<exemplarCity>Wladiwostok</exemplarCity>
</zone>
<zone type="Asia/Sakhalin">
<exemplarCity>Sachalin</exemplarCity>
</zone>
<zone type="Asia/Kamchatka">
<exemplarCity>Kamtschatka</exemplarCity>
</zone>
<zone type="Asia/Riyadh">
<exemplarCity>Riad</exemplarCity>
</zone>
<zone type="Africa/Khartoum">
<exemplarCity>Khartum</exemplarCity>
</zone>
<zone type="Asia/Singapore">
<exemplarCity>Singapur</exemplarCity>
</zone>
<zone type="Atlantic/St_Helena">
<exemplarCity>St. Helena</exemplarCity>
</zone>
<zone type="Africa/Mogadishu">
<exemplarCity>Mogadischu</exemplarCity>
</zone>
<zone type="Africa/Sao_Tome">
<exemplarCity>São Tomé</exemplarCity>
</zone>
<zone type="America/El_Salvador">
<exemplarCity>Salvador</exemplarCity>
</zone>
<zone type="Asia/Damascus">
<exemplarCity>Damaskus</exemplarCity>
</zone>
<zone type="Asia/Dushanbe">
<exemplarCity>Duschanbe</exemplarCity>
</zone>
<zone type="America/Port_of_Spain">
<exemplarCity>Port-of-Spain</exemplarCity>
</zone>
<zone type="Asia/Taipei">
<exemplarCity>Taipeh</exemplarCity>
</zone>
<zone type="Africa/Dar_es_Salaam">
<exemplarCity>Daressalam</exemplarCity>
</zone>
<zone type="Europe/Uzhgorod">
<exemplarCity>Uschgorod</exemplarCity>
</zone>
<zone type="Europe/Kiev">
<exemplarCity>Kiew</exemplarCity>
</zone>
<zone type="Europe/Zaporozhye">
<exemplarCity>Saporischja</exemplarCity>
</zone>
<zone type="America/Indiana/Knox">
<exemplarCity draft="unconfirmed">Knox</exemplarCity>
</zone>
<zone type="Asia/Tashkent">
<exemplarCity>Taschkent</exemplarCity>
</zone>
<zone type="America/St_Vincent">
<exemplarCity>St. Vincent</exemplarCity>
</zone>
<zone type="America/St_Thomas">
<exemplarCity>St. Thomas</exemplarCity>
</zone>
<metazone type="Acre">
<long>
<standard>Acre-Zeit</standard>
<daylight>Acre-Sommerzeit</daylight>
</long>
</metazone>
<metazone type="Afghanistan">
<long>
<standard>Afghanistan-Zeit</standard>
</long>
</metazone>
<metazone type="Africa_Central">
<long>
<standard>Zentralafrikanische Zeit</standard>
</long>
</metazone>
<metazone type="Africa_Eastern">
<long>
<standard>Ostafrikanische Zeit</standard>
</long>
</metazone>
<metazone type="Africa_Southern">
<long>
<generic>Südafrikanische Zeit</generic>
<standard>Südafrikanische Standardzeit</standard>
</long>
</metazone>
<metazone type="Africa_Western">
<long>
<standard>Westafrikanische Zeit</standard>
<daylight>Westafrikanische Sommerzeit</daylight>
</long>
</metazone>
<metazone type="Aktyubinsk">
<long>
<standard>Aktyubinsk-Zeit</standard>
<daylight>Aktyubinsk-Sommerzeit</daylight>
</long>
</metazone>
<metazone type="Alaska">
<long>
<generic>Alaska-Zeit</generic>
<standard>Alaska-Standardzeit</standard>
</long>
<commonlyUsed>true</commonlyUsed>
</metazone>
<metazone type="Alaska_Hawaii">
<long>
<generic>Alaska-Hawaii-Zeit</generic>
<standard>Alaska-Hawaii-Standardzeit</standard>
</long>
</metazone>
<metazone type="Almaty">
<long>
<standard>Almaty-Zeit</standard>
<daylight>Almaty-Sommerzeit</daylight>
</long>
</metazone>
<metazone type="Amazon">
<long>
<daylight>Amazonas-Sommerzeit</daylight>
</long>
</metazone>
<metazone type="Europe_Central">
<long>
<standard>Mitteleuropäische Zeit</standard>
<daylight>Mitteleuropäische Sommerzeit</daylight>
</long>
<short>
<standard>MEZ</standard>
<daylight>MESZ</daylight>
</short>
<commonlyUsed>true</commonlyUsed>
</metazone>
<metazone type="Europe_Eastern">
<long>
<standard>Osteuropäische Zeit</standard>
<daylight>Osteuropäische Sommerzeit</daylight>
</long>
<short>
<standard>OEZ</standard>
<daylight>OESZ</daylight>
</short>
</metazone>
<metazone type="Europe_Western">
<long>
<standard>Westeuropäische Zeit</standard>
<daylight>Westeuropäische Sommerzeit</daylight>
</long>
<short>
<standard>WEZ</standard>
<daylight>WESZ</daylight>
</short>
</metazone>
<metazone type="Moscow">
<long>
<standard>Moskauer Zeit</standard>
<daylight>Moskauer Sommerzeit</daylight>
</long>
</metazone>
</timeZoneNames>
</dates>
<numbers>
<symbols>
<decimal>,</decimal>
<group>.</group>
<group alt="proposed-x1001" draft="unconfirmed"> </group>
<list>;</list>
<percentSign>%</percentSign>
<nativeZeroDigit>0</nativeZeroDigit>
<patternDigit>#</patternDigit>
<plusSign>+</plusSign>
<minusSign>-</minusSign>
<minusSign alt="proposed-x1001" draft="unconfirmed">−</minusSign>
<exponential>E</exponential>
<exponential alt="proposed-x1001" draft="unconfirmed">×10^</exponential>
<perMille>‰</perMille>
<infinity>∞</infinity>
<nan>NaN</nan>
<nan alt="proposed-x1001" draft="unconfirmed">¤¤¤</nan>
</symbols>
<decimalFormats>
<decimalFormatLength>
<decimalFormat>
<pattern>#,##0.###</pattern>
</decimalFormat>
</decimalFormatLength>
</decimalFormats>
<scientificFormats>
<scientificFormatLength>
<scientificFormat>
<pattern>#E0</pattern>
</scientificFormat>
</scientificFormatLength>
</scientificFormats>
<percentFormats>
<percentFormatLength>
<percentFormat>
<pattern>#,##0 %</pattern>
</percentFormat>
</percentFormatLength>
</percentFormats>
<currencyFormats>
<currencyFormatLength>
<currencyFormat>
<pattern>#,##0.00 ¤</pattern>
</currencyFormat>
</currencyFormatLength>
<unitPattern count="one">{0} {1}</unitPattern>
<unitPattern count="other">{0} {1}</unitPattern>
</currencyFormats>
<currencies>
<currency type="ADP">
<displayName>Andorranische Pesete</displayName>
<displayName count="other">Andorranische Peseten</displayName>
</currency>
<currency type="AED">
<displayName>UAE Dirham</displayName>
<displayName count="other">UAE Dirham</displayName>
<displayName alt="proposed-x1001" draft="unconfirmed">VAE-Dirham</displayName>
<displayName alt="proposed-x1002" draft="unconfirmed">Dirham der Vereinigten Arabischen Emirate</displayName>
</currency>
<currency type="AFA">
<displayName>Afghani (1927-2002)</displayName>
<displayName count="other">Afghani (1927-2002)</displayName>
</currency>
<currency type="AFN">
<displayName>Afghani</displayName>
<displayName count="other">Afghani</displayName>
</currency>
<currency type="ALL">
<displayName>Lek</displayName>
<displayName count="other">Albanische Lek</displayName>
</currency>
<currency type="AMD">
<displayName>Dram</displayName>
<displayName count="other">Armenische Dram</displayName>
</currency>
<currency type="ANG">
<displayName>Niederl. Antillen Gulden</displayName>
<displayName count="other">Niederländische-Antillen-Gulden</displayName>
</currency>
<currency type="AOA">
<displayName>Kwanza</displayName>
<displayName count="other">Angolanische Kwanza</displayName>
</currency>
<currency type="AOK">
<displayName>Angolanischer Kwanza (1977-1990)</displayName>
<displayName count="other">Angolanische Kwanza (AOK)</displayName>
</currency>
<currency type="AON">
<displayName>Neuer Kwanza</displayName>
<displayName count="other">Angolanische Neue Kwanza (AON)</displayName>
</currency>
<currency type="AOR">
<displayName>Kwanza Reajustado</displayName>
<displayName count="other">Angolanische Kwanza Reajustado (AOR)</displayName>
</currency>
<currency type="ARA">
<displayName>Argentinischer Austral</displayName>
<displayName count="other">Argentinische Austral</displayName>
</currency>
<currency type="ARP">
<displayName>Argentinischer Peso (1983-1985)</displayName>
<displayName count="other">Argentinische Peso (ARP)</displayName>
</currency>
<currency type="ARS">
<displayName>Argentinischer Peso</displayName>
<displayName count="other">Argentinische Peso</displayName>
</currency>
<currency type="ATS">
<displayName>Österreichischer Schilling</displayName>
<displayName count="other">Österreichische Schilling</displayName>
<symbol>öS</symbol>
</currency>
<currency type="AUD">
<displayName>Australischer Dollar</displayName>
<displayName count="other">Australische Dollar</displayName>
</currency>
<currency type="AWG">
<displayName>Aruba Florin</displayName>
<displayName count="other">Aruba Florin</displayName>
</currency>
<currency type="AZM">
<displayName>Aserbaidschan-Manat (1993-2006)</displayName>
<displayName count="other">Aserbaidschan-Manat (AZM)</displayName>
</currency>
<currency type="AZN">
<displayName>Aserbaidschan-Manat</displayName>
<displayName count="other">Aserbaidschan-Manat</displayName>
</currency>
<currency type="BAD">
<displayName>Bosnien und Herzegowina Dinar</displayName>
<displayName count="other">Bosnien und Herzegowina Dinar</displayName>
</currency>
<currency type="BAM">
<displayName>Konvertierbare Mark</displayName>
<displayName count="other">Bosnien und Herzegowina Konvertierbare Mark</displayName>
</currency>
<currency type="BBD">
<displayName>Barbados-Dollar</displayName>
<displayName count="other">Barbados-Dollar</displayName>
</currency>
<currency type="BDT">
<displayName>Taka</displayName>
<displayName count="other">Taka</displayName>
</currency>
<currency type="BEC">
<displayName>Belgischer Franc (konvertibel)</displayName>
<displayName count="other">Belgische Franc (konvertibel)</displayName>
</currency>
<currency type="BEF">
<displayName>Belgischer Franc</displayName>
<displayName count="other">Belgische Franc</displayName>
</currency>
<currency type="BEL">
<displayName>Belgischer Finanz-Franc</displayName>
<displayName count="other">Belgische Finanz-Franc</displayName>
</currency>
<currency type="BGL">
<displayName>Lew (1962-1999)</displayName>
<displayName count="other">Bulgarische Lew</displayName>
</currency>
<currency type="BGN">
<displayName>Lew</displayName>
<displayName count="other">Bulgarische Lew (BGN)</displayName>
</currency>
<currency type="BHD">
<displayName>Bahrain-Dinar</displayName>
<displayName count="other">Bahrain-Dinar</displayName>
</currency>
<currency type="BIF">
<displayName>Burundi-Franc</displayName>
<displayName count="other">Burundi-Franc</displayName>
</currency>
<currency type="BMD">
<displayName>Bermuda-Dollar</displayName>
<displayName count="other">Bermuda-Dollar</displayName>
</currency>
<currency type="BND">
<displayName>Brunei-Dollar</displayName>
<displayName count="other">Brunei-Dollar</displayName>
</currency>
<currency type="BOB">
<displayName>Boliviano</displayName>
<displayName count="other">Boliviano</displayName>
</currency>
<currency type="BOP">
<displayName>Bolivianischer Peso</displayName>
<displayName count="other">Bolivianische Peso</displayName>
</currency>
<currency type="BOV">
<displayName>Mvdol</displayName>
<displayName count="other">Bolivianische Mvdol</displayName>
</currency>
<currency type="BRB">
<displayName>Brasilianischer Cruzeiro Novo (1967-1986)</displayName>
<displayName count="other">Brasilianische Cruzeiro Novo (BRB)</displayName>
</currency>
<currency type="BRC">
<displayName>Brasilianischer Cruzado</displayName>
<displayName count="other">Brasilianische Cruzado</displayName>
</currency>
<currency type="BRE">
<displayName>Brasilianischer Cruzeiro (1990-1993)</displayName>
<displayName count="other">Brasilianische Cruzeiro (BRE)</displayName>
</currency>
<currency type="BRL">
<displayName>Real</displayName>
<displayName count="other">Brasilianische Real</displayName>
</currency>
<currency type="BRN">
<displayName>Brasilianischer Cruzado Novo</displayName>
<displayName count="other">Brasilianische Cruzado Novo</displayName>
</currency>
<currency type="BRR">
<displayName>Brasilianischer Cruzeiro</displayName>
<displayName count="other">Brasilianische Cruzeiro</displayName>
</currency>
<currency type="BSD">
<displayName>Bahama-Dollar</displayName>
<displayName count="other">Bahama-Dollar</displayName>
</currency>
<currency type="BTN">
<displayName>Ngultrum</displayName>
<displayName count="other">Bhutanische Ngultrum</displayName>
</currency>
<currency type="BUK">
<displayName>Birmanischer Kyat</displayName>
<displayName count="other">Birmanische Kyat</displayName>
</currency>
<currency type="BWP">
<displayName>Pula</displayName>
<displayName count="other">Botswanische Pula</displayName>
</currency>
<currency type="BYB">
<displayName>Belarus Rubel (alt)</displayName>
<displayName count="other">Belarus-Rubel (BYB)</displayName>
</currency>
<currency type="BYR">
<displayName>Belarus Rubel (neu)</displayName>
<displayName count="other">Belarus-Rubel</displayName>
</currency>
<currency type="BZD">
<displayName>Belize-Dollar</displayName>
<displayName count="other">Belize-Dollar</displayName>
</currency>
<currency type="CAD">
<displayName>Kanadischer Dollar</displayName>
<displayName count="other">Kanadische Dollar</displayName>
</currency>
<currency type="CDF">
<displayName>Franc congolais</displayName>
<displayName count="other">Franc congolais</displayName>
</currency>
<currency type="CHE">
<displayName>WIR-Euro</displayName>
</currency>
<currency type="CHF">
<displayName>Schweizer Franken</displayName>
<displayName count="other">Schweizer Franken</displayName>
</currency>
<currency type="CHW">
<displayName>WIR Franken</displayName>
<displayName count="other">WIR Franken</displayName>
</currency>
<currency type="CLF">
<displayName>Unidades de Fomento</displayName>
<displayName count="other">Chilenische Unidades de Fomento</displayName>
</currency>
<currency type="CLP">
<displayName>Chilenischer Peso</displayName>
<displayName count="other">Chilenische Pesos</displayName>
</currency>
<currency type="CNY">
<displayName>Renminbi Yuan</displayName>
<displayName count="other">Renminbi Yuan</displayName>
</currency>
<currency type="COP">
<displayName>Kolumbianischer Peso</displayName>
<displayName count="other">Kolumbianische Pesos</displayName>
</currency>
<currency type="COU">
<displayName>Unidad de Valor Real</displayName>
<displayName count="other">Unidad de Valor Real</displayName>
</currency>
<currency type="CRC">
<displayName>Costa Rica Colon</displayName>
<displayName count="other">Costa Rica Colon</displayName>
</currency>
<currency type="CSD">
<displayName>Alter Serbischer Dinar</displayName>
<displayName count="other">Alte Serbische Dinar</displayName>
</currency>
<currency type="CSK">
<displayName>Tschechoslowakische Krone</displayName>
<displayName count="other">Tschechoslowakische Kronen</displayName>
</currency>
<currency type="CUP">
<displayName>Kubanischer Peso</displayName>
<displayName count="other">Kubanische Pesos</displayName>
</currency>
<currency type="CVE">
<displayName>Kap Verde Escudo</displayName>
<displayName count="other">Kap Verde Escudo</displayName>
</currency>
<currency type="CYP">
<displayName>Zypern-Pfund</displayName>
<displayName count="other">Zypern Pfund</displayName>
</currency>
<currency type="CZK">
<displayName>Tschechische Krone</displayName>
<displayName count="other">Tschechische Kronen</displayName>
</currency>
<currency type="DDM">
<displayName>Mark der DDR</displayName>
<displayName count="other">Mark der DDR</displayName>
</currency>
<currency type="DEM">
<displayName>Deutsche Mark</displayName>
<displayName count="other">Deutsche Mark</displayName>
</currency>
<currency type="DJF">
<displayName>Dschibuti-Franc</displayName>
<displayName count="other">Dschibuti-Franc</displayName>
</currency>
<currency type="DKK">
<displayName>Dänische Krone</displayName>
<displayName count="other">Dänische Kronen</displayName>
</currency>
<currency type="DOP">
<displayName>Dominikanischer Peso</displayName>
<displayName count="other">Dominikanische Pesos</displayName>
</currency>
<currency type="DZD">
<displayName>Algerischer Dinar</displayName>
<displayName count="other">Algerische Dinar</displayName>
</currency>
<currency type="ECS">
<displayName>Ecuadorianischer Sucre</displayName>
<displayName count="other">Ecuadorianische Sucre</displayName>
</currency>
<currency type="ECV">
<displayName>Verrechnungseinheit für EC</displayName>
<displayName count="other">Verrechnungseinheiten für EC</displayName>
</currency>
<currency type="EEK">
<displayName>Estnische Krone</displayName>
<displayName count="other">Estnische Kronen</displayName>
</currency>
<currency type="EGP">
<displayName>Ägyptisches Pfund</displayName>
<displayName count="other">Ägyptische Pfund</displayName>
</currency>
<currency type="ERN">
<displayName>Nakfa</displayName>
<displayName count="other">Eritreische Nakfa</displayName>
</currency>
<currency type="ESA">
<displayName references="R021">Spanische Peseta (A-Konten)</displayName>
<displayName count="other">Spanische Peseten (A-Konten)</displayName>
</currency>
<currency type="ESB">
<displayName references="R021">Spanische Peseta (konvertibel)</displayName>
<displayName count="other">Spanische Peseten (konvertibel)</displayName>
</currency>
<currency type="ESP">
<displayName>Spanische Peseta</displayName>
<displayName count="other">Spanische Peseten</displayName>
</currency>
<currency type="ETB">
<displayName>Birr</displayName>
<displayName count="other">Äthiopische Birr</displayName>
</currency>
<currency type="EUR">
<displayName>Euro</displayName>
<displayName count="other">Euro</displayName>
</currency>
<currency type="FIM">
<displayName>Finnische Mark</displayName>
<displayName count="other">Finnische Mark</displayName>
</currency>
<currency type="FJD">
<displayName>Fidschi-Dollar</displayName>
<displayName count="other">Fidschi Dollar</displayName>
</currency>
<currency type="FKP">
<displayName>Falkland-Pfund</displayName>
<displayName count="other">Falkland Pfund</displayName>
</currency>
<currency type="FRF">
<displayName>Französischer Franc</displayName>
<displayName count="other">Französische Franc</displayName>
</currency>
<currency type="GBP">
<displayName>Pfund Sterling</displayName>
<displayName count="other">Pfund Sterling</displayName>
</currency>
<currency type="GEK">
<displayName>Georgischer Kupon Larit</displayName>
<displayName count="other">Georgische Kupon Larit</displayName>
</currency>
<currency type="GEL">
<displayName>Georgischer Lari</displayName>
<displayName count="other">Georgische Lari</displayName>
</currency>
<currency type="GHC">
<displayName>Cedi</displayName>
<displayName count="other">Cedi</displayName>
</currency>
<currency type="GHS">
<displayName>Ghanaische Cedi</displayName>
</currency>
<currency type="GIP">
<displayName>Gibraltar-Pfund</displayName>
<displayName count="other">Gibraltar Pfund</displayName>
</currency>
<currency type="GMD">
<displayName>Dalasi</displayName>
<displayName count="other">Gambische Dalasi</displayName>
</currency>
<currency type="GNF">
<displayName>Guinea-Franc</displayName>
<displayName count="other">Guinea Franc</displayName>
</currency>
<currency type="GNS">
<displayName references="R021">Guineischer Syli</displayName>
<displayName count="other">Guineische Syli</displayName>
</currency>
<currency type="GQE">
<displayName>Ekwele</displayName>
<displayName count="other">Äquatorialguinea-Ekwele</displayName>
</currency>
<currency type="GRD">
<displayName>Griechische Drachme</displayName>
<displayName count="other">Griechische Drachmen</displayName>
</currency>
<currency type="GTQ">
<displayName>Quetzal</displayName>
<displayName count="other">Quetzal</displayName>
</currency>
<currency type="GWE">
<displayName>Portugiesisch Guinea Escudo</displayName>
<displayName count="other">Portugiesisch Guinea Escudo</displayName>
</currency>
<currency type="GWP">
<displayName>Guinea Bissau Peso</displayName>
<displayName count="other">Guinea-Bissau Pesos</displayName>
</currency>
<currency type="GYD">
<displayName>Guyana-Dollar</displayName>
<displayName count="other">Guyana Dollar</displayName>
</currency>
<currency type="HKD">
<displayName>Hongkong-Dollar</displayName>
<displayName count="other">Hongkong-Dollar</displayName>
</currency>
<currency type="HNL">
<displayName>Lempira</displayName>
<displayName count="other">Lempira</displayName>
</currency>
<currency type="HRD">
<displayName>Kroatischer Dinar</displayName>
<displayName count="other">Kroatische Dinar</displayName>
</currency>
<currency type="HRK">
<displayName>Kuna</displayName>
<displayName count="other">Kuna</displayName>
</currency>
<currency type="HTG">
<displayName>Gourde</displayName>
<displayName count="other">Gourde</displayName>
</currency>
<currency type="HUF">
<displayName>Forint</displayName>
<displayName count="other">Forint</displayName>
</currency>
<currency type="IDR">
<displayName>Rupiah</displayName>
<displayName count="other">Rupiah</displayName>
</currency>
<currency type="IEP">
<displayName>Irisches Pfund</displayName>
<displayName count="other">Irische Pfund</displayName>
</currency>
<currency type="ILP">
<displayName>Israelisches Pfund</displayName>
<displayName count="other">Israelische Pfund</displayName>
</currency>
<currency type="ILS">
<displayName>Schekel</displayName>
<displayName count="other">Neue Schekel</displayName>
</currency>
<currency type="INR">
<displayName>Indische Rupie</displayName>
<displayName count="other">Indische Rupien</displayName>
</currency>
<currency type="IQD">
<displayName>Irak Dinar</displayName>
<displayName count="other">Irak Dinar</displayName>
</currency>
<currency type="IRR">
<displayName>Rial</displayName>
<displayName count="other">Rial</displayName>
</currency>
<currency type="ISK">
<displayName>Isländische Krone</displayName>
<displayName count="other">Isländische Kronen</displayName>
</currency>
<currency type="ITL">
<displayName>Italienische Lira</displayName>
<displayName count="other">Italienische Lire</displayName>
</currency>
<currency type="JMD">
<displayName>Jamaika-Dollar</displayName>
<displayName count="other">Jamaika Dollar</displayName>
</currency>
<currency type="JOD">
<displayName>Jordanischer Dinar</displayName>
<displayName count="other">Jordanische Dinar</displayName>
</currency>
<currency type="JPY">
<displayName>Yen</displayName>
<displayName count="other">Yen</displayName>
<symbol>¥</symbol>
</currency>
<currency type="KES">
<displayName>Kenia-Schilling</displayName>
<displayName count="other">Kenia Schilling</displayName>
</currency>
<currency type="KGS">
<displayName>Som</displayName>
<displayName count="other">Som</displayName>
</currency>
<currency type="KHR">
<displayName>Riel</displayName>
<displayName count="other">Riel</displayName>
</currency>
<currency type="KMF">
<displayName>Komoren Franc</displayName>
<displayName count="other">Komoren-Franc</displayName>
</currency>
<currency type="KPW">
<displayName>Nordkoreanischer Won</displayName>
<displayName count="other">Nordkoreanische Won</displayName>
</currency>
<currency type="KRW">
<displayName>Südkoreanischer Won</displayName>
<displayName count="other">Südkoreanische Won</displayName>
</currency>
<currency type="KWD">
<displayName>Kuwait Dinar</displayName>
<displayName count="other">Kuwait Dinar</displayName>
</currency>
<currency type="KYD">
<displayName>Kaiman-Dollar</displayName>
<displayName count="other">Kaiman-Dollar</displayName>
</currency>
<currency type="KZT">
<displayName>Tenge</displayName>
<displayName count="other">Tenge</displayName>
</currency>
<currency type="LAK">
<displayName>Kip</displayName>
<displayName count="other">Kip</displayName>
</currency>
<currency type="LBP">
<displayName>Libanesisches Pfund</displayName>
<displayName count="other">Libanesische Pfund</displayName>
</currency>
<currency type="LKR">
<displayName>Sri Lanka Rupie</displayName>
<displayName count="other">Sri Lanka Rupie</displayName>
</currency>
<currency type="LRD">
<displayName>Liberianischer Dollar</displayName>
<displayName count="other">Liberianische Dollar</displayName>
</currency>
<currency type="LSL">
<displayName>Loti</displayName>
<displayName count="other">Loti</displayName>
</currency>
<currency type="LTL">
<displayName>Litauischer Litas</displayName>
<displayName count="other">Litauische Litas</displayName>
</currency>
<currency type="LTT">
<displayName>Litauischer Talonas</displayName>
<displayName count="other">Litauische Talonas</displayName>
</currency>
<currency type="LUC">
<displayName>Luxemburgischer Franc (konvertibel)</displayName>
<displayName count="other">Luxemburgische Franc (konvertibel)</displayName>
</currency>
<currency type="LUF">
<displayName>Luxemburgischer Franc</displayName>
<displayName count="other">Luxemburgische Franc</displayName>
</currency>
<currency type="LUL">
<displayName>Luxemburgischer Finanz-Franc</displayName>
<displayName count="other">Luxemburgische Finanz-Franc</displayName>
</currency>
<currency type="LVL">
<displayName>Lettischer Lats</displayName>
<displayName count="other">Lettische Lats</displayName>
</currency>
<currency type="LVR">
<displayName>Lettischer Rubel</displayName>
<displayName count="other">Lettische Rubel</displayName>
</currency>
<currency type="LYD">
<displayName>Libyscher Dinar</displayName>
<displayName count="other">Libysche Dinar</displayName>
</currency>
<currency type="MAD">
<displayName>Marokkanischer Dirham</displayName>
<displayName count="other">Marokkanische Dirham</displayName>
</currency>
<currency type="MAF">
<displayName>Marokkanischer Franc</displayName>
<displayName count="other">Marokkanische Franc</displayName>
</currency>
<currency type="MDL">
<displayName>Moldau Leu</displayName>
<displayName count="other">Moldau Leu</displayName>
</currency>
<currency type="MGA">
<displayName>Madagaskar Ariary</displayName>
<displayName count="other">Madagaskar Ariary</displayName>
<displayName alt="proposed-x1001" draft="unconfirmed">Madagaskar-Ariary</displayName>
<displayName alt="proposed-x1002" draft="unconfirmed">Ariary</displayName>
</currency>
<currency type="MGF">
<displayName>Madagaskar-Franc</displayName>
<displayName count="other">Madagaskar-Franc</displayName>
</currency>
<currency type="MKD">
<displayName>Denar</displayName>
<displayName count="other">Denar</displayName>
</currency>
<currency type="MLF">
<displayName>Malischer Franc</displayName>
<displayName count="other">Malische Franc</displayName>
</currency>
<currency type="MMK">
<displayName>Kyat</displayName>
<displayName count="other">Kyat</displayName>
</currency>
<currency type="MNT">
<displayName>Tugrik</displayName>
<displayName count="other">Tugrik</displayName>
</currency>
<currency type="MOP">
<displayName>Pataca</displayName>
<displayName count="other">Pataca</displayName>
</currency>
<currency type="MRO">
<displayName>Ouguiya</displayName>
<displayName count="other">Ouguiya</displayName>
</currency>
<currency type="MTL">
<displayName>Maltesische Lira</displayName>
<displayName count="other">Maltesische Lira</displayName>
</currency>
<currency type="MTP">
<displayName>Maltesisches Pfund</displayName>
<displayName count="other">Maltesische Pfund</displayName>
</currency>
<currency type="MUR">
<displayName>Mauritius-Rupie</displayName>
<displayName count="other">Mauritius Rupie</displayName>
</currency>
<currency type="MVR">
<displayName>Rufiyaa</displayName>
<displayName count="other">Rufiyaa</displayName>
</currency>
<currency type="MWK">
<displayName>Malawi Kwacha</displayName>
<displayName count="other">Malawi-Kwacha</displayName>
</currency>
<currency type="MXN">
<displayName>Mexikanischer Peso</displayName>
<displayName count="other">Mexikanische Pesos</displayName>
</currency>
<currency type="MXP">
<displayName>Mexikanischer Silber-Peso (1861-1992)</displayName>
<displayName count="other">Mexikanische Silber-Pesos (MXP)</displayName>
</currency>
<currency type="MXV">
<displayName>Mexican Unidad de Inversion (UDI)</displayName>
<displayName count="other">Mexikanische Unidad de Inversion (UDI)</displayName>
</currency>
<currency type="MYR">
<displayName>Malaysischer Ringgit</displayName>
<displayName count="other">Malaysische Ringgit</displayName>
</currency>
<currency type="MZE">
<displayName>Mosambikanischer Escudo</displayName>
<displayName count="other">Mozambikanische Escudo</displayName>
</currency>
<currency type="MZM">
<displayName>Alter Metical</displayName>
<displayName count="other">Alte Metical</displayName>
</currency>
<currency type="MZN">
<displayName>Metical</displayName>
<displayName count="other">Metical</displayName>
</currency>
<currency type="NAD">
<displayName>Namibia-Dollar</displayName>
<displayName count="other">Namibia-Dollar</displayName>
</currency>
<currency type="NGN">
<displayName>Naira</displayName>
<displayName count="other">Naira</displayName>
</currency>
<currency type="NIC">
<displayName>Cordoba</displayName>
<displayName count="other">Cordoba</displayName>
</currency>
<currency type="NIO">
<displayName>Gold-Cordoba</displayName>
<displayName count="other">Gold-Cordoba</displayName>
</currency>
<currency type="NLG">
<displayName>Holländischer Gulden</displayName>
<displayName count="other">Holländische Gulden</displayName>
</currency>
<currency type="NOK">
<displayName>Norwegische Krone</displayName>
<displayName count="other">Norwegische Kronen</displayName>
</currency>
<currency type="NPR">
<displayName>Nepalesische Rupie</displayName>
<displayName count="other">Nepalesische Rupien</displayName>
</currency>
<currency type="NZD">
<displayName>Neuseeland-Dollar</displayName>
<displayName count="other">Neuseeland-Dollar</displayName>
</currency>
<currency type="OMR">
<displayName>Rial Omani</displayName>
<displayName count="other">Rial Omani</displayName>
</currency>
<currency type="PAB">
<displayName>Balboa</displayName>
<displayName count="other">Balboa</displayName>
</currency>
<currency type="PEI">
<displayName>Peruanischer Inti</displayName>
<displayName count="other">Peruanische Inti</displayName>
</currency>
<currency type="PEN">
<displayName>Neuer Sol</displayName>
<displayName count="other">Neue Sol</displayName>
</currency>
<currency type="PES">
<displayName>Sol</displayName>
<displayName count="other">Sol</displayName>
</currency>
<currency type="PGK">
<displayName>Kina</displayName>
<displayName count="other">Kina</displayName>
</currency>
<currency type="PHP">
<displayName>Philippinischer Peso</displayName>
<displayName count="other">Philippinische Peso</displayName>
</currency>
<currency type="PKR">
<displayName>Pakistanische Rupie</displayName>
<displayName count="other">Pakistanische Rupien</displayName>
</currency>
<currency type="PLN">
<displayName>Zloty</displayName>
<displayName count="other">Zloty</displayName>
</currency>
<currency type="PLZ">
<displayName>Zloty (1950-1995)</displayName>
<displayName count="other">Zloty (PLZ)</displayName>
</currency>
<currency type="PTE">
<displayName>Portugiesischer Escudo</displayName>
<displayName count="other">Portugiesische Escudo</displayName>
</currency>
<currency type="PYG">
<displayName>Guarani</displayName>
<displayName count="other">Guarani</displayName>
</currency>
<currency type="QAR">
<displayName>Katar Riyal</displayName>
<displayName count="other">Katar Riyal</displayName>
</currency>
<currency type="RHD">
<displayName>Rhodesischer Dollar</displayName>
<displayName count="other">Rhodesische Dollar</displayName>
</currency>
<currency type="ROL">
<displayName>Leu</displayName>
<displayName count="other">Leu</displayName>
</currency>
<currency type="RON">
<displayName>Rumänischer Leu</displayName>
<displayName count="other">Rumänische Leu</displayName>
</currency>
<currency type="RSD">
<displayName>Serbischer Dinar</displayName>
<displayName count="other">Serbische Dinar</displayName>
</currency>
<currency type="RUB">
<displayName>Russischer Rubel (neu)</displayName>
<displayName count="other">Russische Rubel (neu)</displayName>
</currency>
<currency type="RUR">
<displayName>Russischer Rubel (alt)</displayName>
<displayName count="other">Russische Rubel (alt)</displayName>
</currency>
<currency type="RWF">
<displayName>Ruanda-Franc</displayName>
<displayName count="other">Ruanda-Franc</displayName>
</currency>
<currency type="SAR">
<displayName>Saudi Riyal</displayName>
<displayName count="other">Saudi Riyal</displayName>
</currency>
<currency type="SBD">
<displayName>Salomonen-Dollar</displayName>
<displayName count="other">Salomonen-Dollar</displayName>
</currency>
<currency type="SCR">
<displayName>Seychellen-Rupie</displayName>
<displayName count="other">Seychellen-Rupien</displayName>
</currency>
<currency type="SDD">
<displayName>Sudanesischer Dinar</displayName>
<displayName count="other">Sudanesische Dinar</displayName>
</currency>
<currency type="SDG">
<displayName>Sudanesisches Pfund</displayName>
<displayName count="other">Sudanesische Pfund</displayName>
</currency>
<currency type="SDP">
<displayName>Sudanesisches Pfund (alt)</displayName>
<displayName count="other">Sudanesische Pfund (alt)</displayName>
</currency>
<currency type="SEK">
<displayName>Schwedische Krone</displayName>
<displayName count="other">Schwedische Kronen</displayName>
</currency>
<currency type="SGD">
<displayName>Singapur-Dollar</displayName>
<displayName count="other">Singapur-Dollar</displayName>
</currency>
<currency type="SHP">
<displayName>St. Helena Pfund</displayName>
<displayName count="other">St. Helena-Pfund</displayName>
</currency>
<currency type="SIT">
<displayName>Tolar</displayName>
<displayName count="other">Tolar</displayName>
</currency>
<currency type="SKK">
<displayName>Slowakische Krone</displayName>
<displayName count="other">Slowakische Kronen</displayName>
</currency>
<currency type="SLL">
<displayName>Leone</displayName>
<displayName count="other">Leone</displayName>
</currency>
<currency type="SOS">
<displayName>Somalia-Schilling</displayName>
<displayName count="other">Somalia-Schilling</displayName>
</currency>
<currency type="SRD">
<displayName references="R021">Surinamischer Dollar</displayName>
<displayName count="other">Surinamische Dollar</displayName>
</currency>
<currency type="SRG">
<displayName>Suriname Gulden</displayName>
<displayName count="other">Suriname-Gulden</displayName>
</currency>
<currency type="STD">
<displayName>Dobra</displayName>
<displayName count="other">Dobra</displayName>
</currency>
<currency type="SUR">
<displayName>Sowjetischer Rubel</displayName>
<displayName count="other">Sowjetische Rubel</displayName>
</currency>
<currency type="SVC">
<displayName>El Salvador Colon</displayName>
<displayName count="other">El Salvador-Colon</displayName>
</currency>
<currency type="SYP">
<displayName>Syrisches Pfund</displayName>
<displayName count="other">Syrische Pfund</displayName>
</currency>
<currency type="SZL">
<displayName>Lilangeni</displayName>
<displayName count="other">Lilangeni</displayName>
</currency>
<currency type="THB">
<displayName>Baht</displayName>
<displayName count="other">Baht</displayName>
</currency>
<currency type="TJR">
<displayName>Tadschikistan Rubel</displayName>
<displayName count="other">Tadschikistan-Rubel</displayName>
</currency>
<currency type="TJS">
<displayName>Tadschikistan Somoni</displayName>
<displayName count="other">Tadschikistan-Somoni</displayName>
</currency>
<currency type="TMM">
<displayName>Turkmenistan-Manat</displayName>
<displayName count="other">Turkmenistan-Manat</displayName>
</currency>
<currency type="TND">
<displayName>Tunesischer Dinar</displayName>
<displayName count="other">Tunesische Dinar</displayName>
</currency>
<currency type="TOP">
<displayName>Paʻanga</displayName>
<displayName count="other">Paʻanga</displayName>
</currency>
<currency type="TPE">
<displayName>Timor-Escudo</displayName>
<displayName count="other">Timor-Escudo</displayName>
</currency>
<currency type="TRL">
<displayName>Alte Türkische Lira</displayName>
<displayName count="one">Alte Türkische Lira</displayName>
<displayName count="other">Alte Türkische Lire</displayName>
</currency>
<currency type="TRY">
<displayName>Türkische Lira</displayName>
<displayName count="one">Türkische Lira</displayName>
<displayName count="other">Türkische Lira</displayName>
</currency>
<currency type="TTD">
<displayName>Trinidad- und Tobago-Dollar</displayName>
<displayName count="other">Trinidad und Tobago-Dollar</displayName>
</currency>
<currency type="TWD">
<displayName>Neuer Taiwan-Dollar</displayName>
<displayName count="other">Neuer Taiwan Dollar</displayName>
</currency>
<currency type="TZS">
<displayName>Tansania-Schilling</displayName>
<displayName count="other">Tansania-Schilling</displayName>
</currency>
<currency type="UAH">
<displayName>Hryvnia</displayName>
<displayName count="other">Hryvnia</displayName>
</currency>
<currency type="UAK">
<displayName>Ukrainischer Karbovanetz</displayName>
<displayName count="other">Ukrainische Karbovanetz</displayName>
</currency>
<currency type="UGS">
<displayName>Uganda-Schilling (1966-1987)</displayName>
<displayName count="other">Uganda-Schilling (UGS)</displayName>
</currency>
<currency type="UGX">
<displayName>Uganda-Schilling</displayName>
<displayName count="other">Uganda-Schilling</displayName>
</currency>
<currency type="USD">
<displayName>US-Dollar</displayName>
<displayName count="other">US-Dollar</displayName>
<symbol>$</symbol>
</currency>
<currency type="USN">
<displayName>US Dollar (Nächster Tag)</displayName>
<displayName count="other">US-Dollar (Nächster Tag)</displayName>
</currency>
<currency type="USS">
<displayName>US Dollar (Gleicher Tag)</displayName>
<displayName count="other">US-Dollar (Gleicher Tag)</displayName>
</currency>
<currency type="UYI">
<displayName>UYU</displayName>
</currency>
<currency type="UYP">
<displayName references="R021">Uruguayischer Neuer Peso (1975-1993)</displayName>
<displayName count="other">Uruguayische Pesos (UYP)</displayName>
</currency>
<currency type="UYU">
<displayName>Uruguayischer Peso</displayName>
<displayName count="other">Uruguayische Pesos</displayName>
</currency>
<currency type="UZS">
<displayName>Usbekistan Sum</displayName>
<displayName count="other">Usbekistan-Sum</displayName>
</currency>
<currency type="VEB">
<displayName>Bolivar</displayName>
<displayName count="other">Bolivar</displayName>
</currency>
<currency type="VEF">
<displayName>Bolívar Fuerte</displayName>
</currency>
<currency type="VND">
<displayName>Dong</displayName>
<displayName count="other">Dong</displayName>
</currency>
<currency type="VUV">
<displayName>Vatu</displayName>
<displayName count="other">Vatu</displayName>
</currency>
<currency type="WST">
<displayName>Tala</displayName>
<displayName count="other">Tala</displayName>
</currency>
<currency type="XAF">
<displayName>CFA Franc (Äquatorial)</displayName>
<displayName count="other">CFA-Franc (BEAC)</displayName>
</currency>
<currency type="XAG">
<displayName>Unze Silber</displayName>
<displayName count="one">Unze Silber</displayName>
<displayName count="other">Silber</displayName>
<displayName count="other" alt="proposed-x1001" draft="unconfirmed">Unze Silber</displayName>
</currency>
<currency type="XAU">
<displayName>Unze Gold</displayName>
<displayName count="one">Unze Gold</displayName>
<displayName count="other">Gold</displayName>
<displayName count="other" alt="proposed-x1001" draft="unconfirmed">Unze Gold</displayName>
</currency>
<currency type="XBA">
<displayName>Europäische Rechnungseinheit</displayName>
<displayName count="other">Europäische Rechnungseinheiten</displayName>
</currency>
<currency type="XBB">
<displayName>Europäische Währungseinheit (XBB)</displayName>
<displayName count="other">Europäische Währungseinheiten (XBB)</displayName>
</currency>
<currency type="XBC">
<displayName>Europäische Rechnungseinheit (XBC)</displayName>
<displayName count="other">Europäische Rechnungseinheiten (XBC)</displayName>
</currency>
<currency type="XBD">
<displayName>Europäische Rechnungseinheit (XBD)</displayName>
<displayName count="other">Europäische Rechnungseinheiten (XBD)</displayName>
</currency>
<currency type="XCD">
<displayName>Ostkaribischer Dollar</displayName>
<displayName count="other">Ostkaribische Dollar</displayName>
</currency>
<currency type="XDR">
<displayName>Sonderziehungsrechte</displayName>
<displayName count="other">Sonderziehungsrechte</displayName>
</currency>
<currency type="XEU">
<displayName>Europäische Währungseinheit (XEU)</displayName>
<displayName count="other">Europäische Währungseinheiten (XEU)</displayName>
</currency>
<currency type="XFO">
<displayName>Französischer Gold-Franc</displayName>
<displayName count="other">Französische Gold-Franc</displayName>
</currency>
<currency type="XFU">
<displayName>Französischer UIC-Franc</displayName>
<displayName count="other">Französische UIC-Franc</displayName>
</currency>
<currency type="XOF">
<displayName>CFA Franc (West)</displayName>
<displayName count="other">CFA-Franc (BCEAO)</displayName>
</currency>
<currency type="XPD">
<displayName>Unze Palladium</displayName>
<displayName count="one">Unze Palladium</displayName>
<displayName count="other">Palladium</displayName>
<displayName count="other" alt="proposed-x1001" draft="unconfirmed">Unze Palladium</displayName>
</currency>
<currency type="XPF">
<displayName>CFP Franc</displayName>
<displayName count="other">CFP-Franc</displayName>
</currency>
<currency type="XPT">
<displayName>Unze Platin</displayName>
<displayName count="one">Unze Platin</displayName>
<displayName count="other">Platin</displayName>
<displayName count="other" alt="proposed-x1001" draft="unconfirmed">Unze Platin</displayName>
</currency>
<currency type="XRE">
<displayName>RINET Funds</displayName>
<displayName count="other">RINET Funds</displayName>
</currency>
<currency type="XTS">
<displayName>Testwährung</displayName>
<displayName count="other">Testwährung</displayName>
</currency>
<currency type="XXX">
<displayName>Unbekannte Währung</displayName>
<displayName count="one">Unbekannte Währung</displayName>
<displayName count="other">Unbekannte Währung</displayName>
</currency>
<currency type="YDD">
<displayName>Jemen-Dinar</displayName>
<displayName count="other">Jemen-Dinar</displayName>
</currency>
<currency type="YER">
<displayName>Jemen-Rial</displayName>
<displayName count="other">Jemen-Rial</displayName>
</currency>
<currency type="YUD">
<displayName>Jugoslawischer Dinar (1966-1990)</displayName>
<displayName count="other">Jugoslawische Dinar</displayName>
</currency>
<currency type="YUM">
<displayName>Neuer Dinar</displayName>
<displayName count="other">Jugoslawische Neue Dinar</displayName>
</currency>
<currency type="YUN">
<displayName>Jugoslawischer Dinar (konvertibel)</displayName>
<displayName count="other">Jugoslawische Dinar (konvertibel)</displayName>
</currency>
<currency type="ZAL">
<displayName>Südafrikanischer Rand (Finanz)</displayName>
<displayName count="one">Südafrikanischer Rand (Finanz)</displayName>
<displayName count="other">Südafrikanischer Rand (Finanz)</displayName>
<displayName alt="proposed-x1001" draft="unconfirmed">ZAR</displayName>
</currency>
<currency type="ZAR">
<displayName>Südafrikanischer Rand</displayName>
<displayName count="one">Südafrikanischer Rand</displayName>
<displayName count="other">Rand</displayName>
<displayName count="other" alt="proposed-x1001" draft="unconfirmed">Südafrikanischer Rand</displayName>
</currency>
<currency type="ZMK">
<displayName>Kwacha</displayName>
<displayName count="other">Kwacha</displayName>
</currency>
<currency type="ZRN">
<displayName>Neuer Zaire</displayName>
<displayName count="other">Neue Zaire</displayName>
</currency>
<currency type="ZRZ">
<displayName>Zaire</displayName>
<displayName count="other">Zaire</displayName>
</currency>
<currency type="ZWD">
<displayName>Simbabwe-Dollar</displayName>
<displayName count="other">Simbabwe-Dollar</displayName>
</currency>
</currencies>
</numbers>
<units>
<unit type="day">
<unitPattern count="one">{0} Tag</unitPattern>
<unitPattern count="one" alt="short">{0} Tag</unitPattern>
<unitPattern count="other">{0} Tage</unitPattern>
<unitPattern count="other" alt="short">{0} Tage</unitPattern>
</unit>
<unit type="hour">
<unitPattern count="one">{0} Stunde</unitPattern>
<unitPattern count="one" alt="short">{0} Std.</unitPattern>
<unitPattern count="other">{0} Stunden</unitPattern>
<unitPattern count="other" alt="short">{0} Std.</unitPattern>
</unit>
<unit type="minute">
<unitPattern count="one">{0} Minute</unitPattern>
<unitPattern count="one" alt="short">{0} Min.</unitPattern>
<unitPattern count="other">{0} Minuten</unitPattern>
<unitPattern count="other" alt="short">{0} Min.</unitPattern>
</unit>
<unit type="month">
<unitPattern count="one">{0} Monat</unitPattern>
<unitPattern count="one" alt="short">{0} Monat</unitPattern>
<unitPattern count="other">{0} Monate</unitPattern>
<unitPattern count="other" alt="short">{0} Monate</unitPattern>
</unit>
<unit type="second">
<unitPattern count="one">{0} Sekunde</unitPattern>
<unitPattern count="one" alt="short">{0} Sek.</unitPattern>
<unitPattern count="other">{0} Sekunden</unitPattern>
<unitPattern count="other" alt="short">{0} Sek.</unitPattern>
</unit>
<unit type="week">
<unitPattern count="one">{0} Woche</unitPattern>
<unitPattern count="one" alt="short">{0} Woche</unitPattern>
<unitPattern count="other">{0} Wochen</unitPattern>
<unitPattern count="other" alt="short">{0} Wochen</unitPattern>
</unit>
<unit type="year">
<unitPattern count="one">{0} Jahr</unitPattern>
<unitPattern count="one" alt="short">{0} Jahr</unitPattern>
<unitPattern count="other">{0} Jahre</unitPattern>
<unitPattern count="other" alt="short">{0} Jahre</unitPattern>
</unit>
</units>
<posix>
<messages>
<yesstr>ja:j</yesstr>
<nostr>nein:n</nostr>
</messages>
</posix>
<references>
<reference type="R019" uri="http://de.wikipedia.org/wiki/Angloamerikanisches_Ma%C3%9Fsystem">US measurement system in German</reference>
<reference type="R020" uri="http://www.allegro-c.de/formate/sprachen.htm">Languages 2</reference>
<reference type="R021" uri="http://www.ids-mannheim.de/reform/regelwerk.pdf">German spelling, official new rules (for capitalization see pp. 51, 64-67 = §§ 60-64)</reference>
<reference type="R022" uri="http://www.oenb.at/ebusinesscodes/isocodes?lang=de&amp;mode=isocodes">Currencies</reference>
<reference type="R023" uri="http://de.wikipedia.org/wiki/Prozent">Prozent</reference>
<reference type="R024" uri="http://www.metatab.de/meta_tags/sprachenkuerzel2.htm">Languages 3</reference>
<reference type="R025" uri="http://de.wikipedia.org/wiki/Liste_der_Unicode-Blöcke">Scripts</reference>
<reference type="R026" uri="http://www2.bibliothek.uni-augsburg.de/kfe/kkb_mab_037.html">Languages</reference>
<reference type="R027" uri="http://afrika.heim.at">Territories of Africa in German</reference>
<reference type="R028" uri="http://de.wikipedia.org/wiki/ISO_4217">Currencies 2</reference>
<reference type="R029" uri="http://www.auswaertiges-amt.de/www/de/infoservice/download/pdf/publikationen/staatennamen.pdf">Territories</reference>
<reference type="RP1" uri="http://de.wikipedia.org/wiki/Zeitzone">Time Zones</reference>
<reference type="RP2" uri="http://www.hebis.de/bib/arbeitshilfen/bereich_arbeitshilfen.php?we_objectID=6538">Sprachcodes nach ISO 639-2</reference>
<reference type="RP3" uri="http://de.wikipedia.org/wiki/Sprachgebrauch_in_%C3%96sterreich">Österreichisches Deutsch</reference>
<reference type="RP4" uri="http://de.wikipedia.org/wiki/Anführungszeichen#Schweiz">Quotation marks in Swiss German/French/Italian</reference>
<reference type="RP5" uri="http://www.statistik.at/dynamic/wcmsprod/idcplg?IdcService=GET_NATIVE_FILE&dID=55770&dDocName=027512">Bevölkerungsstand Österreich 2007</reference>
<reference type="RP6" uri="http://www.statistik.at/dynamic/wcmsprod/idcplg?IdcService=GET_NATIVE_FILE&dID=36700&dDocName=007139">Volkszählung 2001, Hauptergebnisse I - Österreich</reference>
<reference type="RP7" uri="http://waldkauz.bibliothek.uni-augsburg.de/kfe/kkb_mab_037.html">Sprachencode nach ISO 639.2</reference>
</references>
</ldml>
|
{
"content_hash": "2e43b4955a77c00edf3c4b15bfe61c8b",
"timestamp": "",
"source": "github",
"line_count": 3092,
"max_line_length": 200,
"avg_line_length": 42.32923673997413,
"alnum_prop": 0.6822252104949497,
"repo_name": "mbr/Babel-CLDR",
"id": "ac1f19ed938f940ee42714e83dd66de6b82bbd92",
"size": "131175",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CLDR-1.7.2/common/main/de.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "4752"
},
{
"name": "Python",
"bytes": "446655"
}
],
"symlink_target": ""
}
|
<?php
defined('IN_IA') or exit('Access Denied');
function frame_lists(){
$data = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = 0 ORDER BY is_system ASC, displayorder ASC, id ASC');
if(!empty($data)) {
foreach($data as &$da) {
$childs = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $da['id']));
if(!empty($childs)) {
foreach($childs as &$child) {
$grandchilds = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $child['id']));
if(!empty($grandchilds)) {
foreach($grandchilds as &$grandchild) {
$greatsons = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $grandchild['id']));
$grandchild['greatsons'] = $greatsons;
}
}
$child['grandchild'] = $grandchilds;
}
$da['child'] = $childs;
}
}
}
return $data;
}
|
{
"content_hash": "8f19bf8b531f4cf244daee1cd2e0dcde",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 183,
"avg_line_length": 22.862745098039216,
"alnum_prop": 0.5634648370497427,
"repo_name": "shengkai86/yushungroup",
"id": "088055975da8c39c2deeefb4e9fb790247d36091",
"size": "1354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "framework/model/frame.mod.php",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2010395"
},
{
"name": "HTML",
"bytes": "4270239"
},
{
"name": "JavaScript",
"bytes": "6956114"
},
{
"name": "PHP",
"bytes": "8646508"
}
],
"symlink_target": ""
}
|
This is a website module for Polyfill Service. It also contains examples of using the api and rest modules.
## Routes
- `/`
- main website
- `/api/web/polyfills`
- get all polyfill metadata as json
- `/api/web/polyfill/${polyfilln=Name}`
- get a polyfill's metadata as json
- `/api/tests/test`
- run mocha tests for polyfills
- `/api/polyfill[.min].js`
- imported from rest module
|
{
"content_hash": "2f47005fed01397c11a48a29ee732575",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 107,
"avg_line_length": 30.923076923076923,
"alnum_prop": 0.6865671641791045,
"repo_name": "reiniergs/polyfill-service",
"id": "2128a9b1534b7ef034586c8a99cf9413c4ec8c3b",
"size": "436",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "polyfill-service-web/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "263507"
},
{
"name": "HTML",
"bytes": "717180"
},
{
"name": "Java",
"bytes": "177792"
},
{
"name": "JavaScript",
"bytes": "505140"
},
{
"name": "Shell",
"bytes": "156"
}
],
"symlink_target": ""
}
|
google-site-verification: google016eaf754d88b4a5.html
|
{
"content_hash": "5339ff3eaba7605e6a362805fa6869ab",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 53,
"avg_line_length": 53,
"alnum_prop": 0.9056603773584906,
"repo_name": "valix/valix.github.io",
"id": "aa6dd762eacec0e388a457d461368a0fa8ca4451",
"size": "53",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "google016eaf754d88b4a5.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "9489"
},
{
"name": "HTML",
"bytes": "39795"
},
{
"name": "JavaScript",
"bytes": "43925"
},
{
"name": "PHP",
"bytes": "1224"
}
],
"symlink_target": ""
}
|
import { Injectable } from '@angular/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { TranslateService } from '@ngx-translate/core';
import { ConstantsService } from 'app/core/core-services/constants.service';
import { AssignmentPollRepositoryService } from 'app/core/repositories/assignments/assignment-poll-repository.service';
import { ConfigService } from 'app/core/ui-services/config.service';
import {
AssignmentPoll,
AssignmentPollMethod,
AssignmentPollPercentBase
} from 'app/shared/models/assignments/assignment-poll';
import { MajorityMethod, PercentBase, PollType, VOTE_UNDOCUMENTED } from 'app/shared/models/poll/base-poll';
import { ParsePollNumberPipe } from 'app/shared/pipes/parse-poll-number.pipe';
import { PollKeyVerbosePipe } from 'app/shared/pipes/poll-key-verbose.pipe';
import { ViewAssignmentOption } from 'app/site/assignments/models/view-assignment-option';
import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll';
import {
PollData,
PollDataOption,
PollService,
PollTableData,
VotingResult
} from 'app/site/polls/services/poll.service';
export const UnknownUserLabel = _('Deleted user');
@Injectable({
providedIn: 'root'
})
export class AssignmentPollService extends PollService {
/**
* The default percentage base
*/
public defaultPercentBase: AssignmentPollPercentBase;
/**
* The default majority method
*/
public defaultMajorityMethod: MajorityMethod;
public defaultGroupIds: number[];
public defaultPollMethod: AssignmentPollMethod;
public defaultPollType: PollType;
private sortByVote: boolean;
/**
* Constructor. Subscribes to the configuration values needed
* @param config ConfigService
*/
public constructor(
config: ConfigService,
constants: ConstantsService,
pollKeyVerbose: PollKeyVerbosePipe,
parsePollNumber: ParsePollNumberPipe,
protected translate: TranslateService,
private pollRepo: AssignmentPollRepositoryService
) {
super(constants, translate, pollKeyVerbose, parsePollNumber);
config
.get<AssignmentPollPercentBase>('assignment_poll_default_100_percent_base')
.subscribe(base => (this.defaultPercentBase = base));
config
.get<MajorityMethod>('assignment_poll_default_majority_method')
.subscribe(method => (this.defaultMajorityMethod = method));
config.get<number[]>(AssignmentPoll.defaultGroupsConfig).subscribe(ids => (this.defaultGroupIds = ids));
config
.get<AssignmentPollMethod>(AssignmentPoll.defaultPollMethodConfig)
.subscribe(method => (this.defaultPollMethod = method));
config.get<PollType>('assignment_poll_default_type').subscribe(type => (this.defaultPollType = type));
config.get<boolean>('assignment_poll_sort_poll_result_by_votes').subscribe(sort => (this.sortByVote = sort));
}
public getDefaultPollData(contextId?: number): AssignmentPoll {
const poll = new AssignmentPoll({
...super.getDefaultPollData()
});
poll.title = this.translate.instant('Ballot');
poll.pollmethod = this.defaultPollMethod;
if (contextId) {
const length = this.pollRepo.getViewModelList().filter(item => item.assignment_id === contextId).length;
if (length) {
poll.title += ` (${length + 1})`;
}
}
return poll;
}
private getGlobalVoteKeys(poll: ViewAssignmentPoll | PollData): VotingResult[] {
return [
{
vote: 'amount_global_yes',
showPercent: this.showPercentOfValidOrCast(poll),
hide:
poll.amount_global_yes === VOTE_UNDOCUMENTED ||
!poll.amount_global_yes ||
poll.pollmethod === AssignmentPollMethod.N
},
{
vote: 'amount_global_no',
showPercent: this.showPercentOfValidOrCast(poll),
hide: poll.amount_global_no === VOTE_UNDOCUMENTED || !poll.amount_global_no
},
{
vote: 'amount_global_abstain',
showPercent: this.showPercentOfValidOrCast(poll),
hide: poll.amount_global_abstain === VOTE_UNDOCUMENTED || !poll.amount_global_abstain
}
];
}
public generateTableData(poll: ViewAssignmentPoll | PollData): PollTableData[] {
const tableData: PollTableData[] = poll.options
.sort((a, b) => {
if (this.sortByVote) {
let compareValue;
if (poll.pollmethod === AssignmentPollMethod.N) {
// least no on top:
compareValue = a.no - b.no;
} else {
// most yes on top
compareValue = b.yes - a.yes;
}
// Equal votes, sort by weight to have equal votes correctly sorted.
if (compareValue === 0 && a.weight && b.weight) {
// least weight on top
return a.weight - b.weight;
} else {
return compareValue;
}
}
// PollData does not have weight, we need to rely on the order of things.
if (a.weight && b.weight) {
// least weight on top
return a.weight - b.weight;
} else {
return 0;
}
})
.map((candidate: ViewAssignmentOption) => {
const pollTableEntry: PollTableData = {
class: 'user',
value: super.getVoteTableKeys(poll).map(
key =>
({
vote: key.vote,
amount: candidate[key.vote],
icon: key.icon,
hide: key.hide,
showPercent: key.showPercent
} as VotingResult)
)
};
// Since pollData does not have any subtitle option
if (candidate instanceof ViewAssignmentOption && candidate.user) {
pollTableEntry.votingOption = candidate.user.short_name;
pollTableEntry.votingOptionSubtitle = candidate.user.getLevelAndNumber();
} else if (candidate.user) {
pollTableEntry.votingOption = (candidate as PollDataOption).user.short_name;
} else {
pollTableEntry.votingOption = UnknownUserLabel;
}
return pollTableEntry;
});
tableData.push(...this.formatVotingResultToTableData(this.getGlobalVoteKeys(poll), poll));
tableData.push(...this.formatVotingResultToTableData(super.getSumTableKeys(poll), poll));
return tableData;
}
private formatVotingResultToTableData(resultList: VotingResult[], poll: PollData): PollTableData[] {
return resultList
.filter(key => {
return !key.hide;
})
.map(key => ({
votingOption: key.vote,
class: 'sums',
value: [
{
amount: poll[key.vote],
hide: key.hide,
showPercent: key.showPercent
} as VotingResult
]
}));
}
private sumOptionsYN(poll: PollData): number {
return poll.options.reduce((o, n) => {
o += n.yes > 0 ? n.yes : 0;
o += n.no > 0 ? n.no : 0;
return o;
}, 0);
}
private sumOptionsYNA(poll: PollData): number {
return poll.options.reduce((o, n) => {
o += n.abstain > 0 ? n.abstain : 0;
return o;
}, this.sumOptionsYN(poll));
}
public getPercentBase(poll: PollData): number {
const base: AssignmentPollPercentBase = poll.onehundred_percent_base as AssignmentPollPercentBase;
let totalByBase: number;
switch (base) {
case AssignmentPollPercentBase.YN:
totalByBase = this.sumOptionsYN(poll);
break;
case AssignmentPollPercentBase.YNA:
totalByBase = this.sumOptionsYNA(poll);
break;
case AssignmentPollPercentBase.Y:
totalByBase = this.sumOptionsYNA(poll);
break;
case AssignmentPollPercentBase.Valid:
totalByBase = poll.votesvalid;
break;
case AssignmentPollPercentBase.Entitled:
totalByBase = poll.entitled_users_at_stop.length;
break;
case AssignmentPollPercentBase.Cast:
totalByBase = poll.votescast;
break;
default:
break;
}
return totalByBase;
}
public getChartLabels(poll: PollData): string[] {
const fields = this.getPollDataFields(poll);
return poll.options.map(option => {
const votingResults = fields.map(field => {
const voteValue = option[field];
const votingKey = this.translate.instant(this.pollKeyVerbose.transform(field));
const resultValue = this.parsePollNumber.transform(voteValue);
const resultInPercent = this.getVoteValueInPercent(voteValue, poll);
let resultLabel = `${votingKey}: ${resultValue}`;
// 0 is a valid number in this case
if (resultInPercent !== null) {
resultLabel += ` (${resultInPercent})`;
}
return resultLabel;
});
const optionName = option.user?.short_name ?? UnknownUserLabel;
return `${optionName} · ${votingResults.join(' · ')}`;
});
}
}
|
{
"content_hash": "91b7ed313e5acf38c23aee569cc5cdc0",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 119,
"avg_line_length": 39.20992366412214,
"alnum_prop": 0.5575781173951134,
"repo_name": "CatoTH/OpenSlides",
"id": "35c29731a3d7ee04f9049604ee959b82e5133941",
"size": "10275",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/src/app/site/assignments/modules/assignment-poll/services/assignment-poll.service.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "114698"
},
{
"name": "Dockerfile",
"bytes": "853"
},
{
"name": "HTML",
"bytes": "417865"
},
{
"name": "JavaScript",
"bytes": "159617"
},
{
"name": "Python",
"bytes": "1185432"
},
{
"name": "Smarty",
"bytes": "7188"
},
{
"name": "TypeScript",
"bytes": "2327301"
}
],
"symlink_target": ""
}
|
package org.springframework.boot.devtools.restart;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ThreadFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile.Kind;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFiles;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Tests for {@link Restarter}.
*
* @author Phillip Webb
* @author Andy Wilkinson
*/
public class RestarterTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Rule
public OutputCapture out = new OutputCapture();
@Before
public void setup() {
Restarter.setInstance(new TestableRestarter());
}
@After
public void cleanup() {
Restarter.clearInstance();
}
@Test
public void cantGetInstanceBeforeInitialize() throws Exception {
Restarter.clearInstance();
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Restarter has not been initialized");
Restarter.getInstance();
}
@Test
public void testRestart() throws Exception {
Restarter.clearInstance();
Thread thread = new Thread() {
@Override
public void run() {
SampleApplication.main();
};
};
thread.start();
Thread.sleep(2600);
String output = this.out.toString();
assertThat(StringUtils.countOccurrencesOf(output, "Tick 0")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output, "Tick 1")).isGreaterThan(1);
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
}
@Test
@SuppressWarnings("rawtypes")
public void getOrAddAttributeWithNewAttribute() throws Exception {
ObjectFactory objectFactory = mock(ObjectFactory.class);
given(objectFactory.getObject()).willReturn("abc");
Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory);
assertThat(attribute).isEqualTo("abc");
}
public void addUrlsMustNotBeNull() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Urls must not be null");
Restarter.getInstance().addUrls(null);
}
@Test
public void addUrls() throws Exception {
URL url = new URL("file:/proj/module-a.jar!/");
Collection<URL> urls = Collections.singleton(url);
Restarter restarter = Restarter.getInstance();
restarter.addUrls(urls);
restarter.restart();
ClassLoader classLoader = ((TestableRestarter) restarter)
.getRelaunchClassLoader();
assertThat(((URLClassLoader) classLoader).getURLs()[0]).isEqualTo(url);
}
@Test
public void addClassLoaderFilesMustNotBeNull() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("ClassLoaderFiles must not be null");
Restarter.getInstance().addClassLoaderFiles(null);
}
@Test
public void addClassLoaderFiles() throws Exception {
ClassLoaderFiles classLoaderFiles = new ClassLoaderFiles();
classLoaderFiles.addFile("f", new ClassLoaderFile(Kind.ADDED, "abc".getBytes()));
Restarter restarter = Restarter.getInstance();
restarter.addClassLoaderFiles(classLoaderFiles);
restarter.restart();
ClassLoader classLoader = ((TestableRestarter) restarter)
.getRelaunchClassLoader();
assertThat(FileCopyUtils.copyToByteArray(classLoader.getResourceAsStream("f")))
.isEqualTo("abc".getBytes());
}
@Test
@SuppressWarnings("rawtypes")
public void getOrAddAttributeWithExistingAttribute() throws Exception {
Restarter.getInstance().getOrAddAttribute("x", new ObjectFactory<String>() {
@Override
public String getObject() throws BeansException {
return "abc";
}
});
ObjectFactory objectFactory = mock(ObjectFactory.class);
Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory);
assertThat(attribute).isEqualTo("abc");
verifyZeroInteractions(objectFactory);
}
@Test
public void getThreadFactory() throws Exception {
final ClassLoader parentLoader = Thread.currentThread().getContextClassLoader();
final ClassLoader contextClassLoader = new URLClassLoader(new URL[0]);
Thread thread = new Thread() {
@Override
public void run() {
Runnable runnable = mock(Runnable.class);
Thread regular = new Thread();
ThreadFactory factory = Restarter.getInstance().getThreadFactory();
Thread viaFactory = factory.newThread(runnable);
// Regular threads will inherit the current thread
assertThat(regular.getContextClassLoader()).isEqualTo(contextClassLoader);
// Factory threads should should inherit from the initial thread
assertThat(viaFactory.getContextClassLoader()).isEqualTo(parentLoader);
};
};
thread.setContextClassLoader(contextClassLoader);
thread.start();
thread.join();
}
@Test
public void getInitialUrls() throws Exception {
Restarter.clearInstance();
RestartInitializer initializer = mock(RestartInitializer.class);
URL[] urls = new URL[] { new URL("file:/proj/module-a.jar!/") };
given(initializer.getInitialUrls(any(Thread.class))).willReturn(urls);
Restarter.initialize(new String[0], false, initializer, false);
assertThat(Restarter.getInstance().getInitialUrls()).isEqualTo(urls);
}
@Component
@EnableScheduling
public static class SampleApplication {
private int count = 0;
private static volatile boolean quit = false;
@Scheduled(fixedDelay = 200)
public void tickBean() {
System.out.println("Tick " + this.count++ + " " + Thread.currentThread());
}
@Scheduled(initialDelay = 500, fixedDelay = 500)
public void restart() {
System.out.println("Restart " + Thread.currentThread());
if (!SampleApplication.quit) {
Restarter.getInstance().restart();
}
}
public static void main(String... args) {
Restarter.initialize(args, false, new MockRestartInitializer(), true);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
SampleApplication.class);
context.addApplicationListener(new CloseCountingApplicationListener());
Restarter.getInstance().prepare(context);
System.out.println("Sleep " + Thread.currentThread());
sleep();
quit = true;
}
private static void sleep() {
try {
Thread.sleep(1200);
}
catch (InterruptedException ex) {
// Ignore
}
}
}
private static class CloseCountingApplicationListener
implements ApplicationListener<ContextClosedEvent> {
static int closed = 0;
@Override
public void onApplicationEvent(ContextClosedEvent event) {
closed++;
}
}
private static class TestableRestarter extends Restarter {
private ClassLoader relaunchClassLoader;
TestableRestarter() {
this(Thread.currentThread(), new String[] {}, false,
new MockRestartInitializer());
}
protected TestableRestarter(Thread thread, String[] args,
boolean forceReferenceCleanup, RestartInitializer initializer) {
super(thread, args, forceReferenceCleanup, initializer);
}
@Override
public void restart(FailureHandler failureHandler) {
try {
stop();
start(failureHandler);
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
@Override
protected Throwable relaunch(ClassLoader classLoader) throws Exception {
this.relaunchClassLoader = classLoader;
return null;
}
@Override
protected void stop() throws Exception {
}
public ClassLoader getRelaunchClassLoader() {
return this.relaunchClassLoader;
}
}
}
|
{
"content_hash": "2269765a593e4aee14fc62fc7a11d719",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 87,
"avg_line_length": 30.31899641577061,
"alnum_prop": 0.7595460456318713,
"repo_name": "izeye/spring-boot",
"id": "0d97d5d2bd9d9d6d5c25b6544b767da27e40753b",
"size": "9079",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6954"
},
{
"name": "CSS",
"bytes": "5769"
},
{
"name": "FreeMarker",
"bytes": "2116"
},
{
"name": "Groovy",
"bytes": "44968"
},
{
"name": "HTML",
"bytes": "69819"
},
{
"name": "Java",
"bytes": "9172430"
},
{
"name": "JavaScript",
"bytes": "37789"
},
{
"name": "Ruby",
"bytes": "1305"
},
{
"name": "SQLPL",
"bytes": "40170"
},
{
"name": "Shell",
"bytes": "20385"
},
{
"name": "Smarty",
"bytes": "3276"
},
{
"name": "XSLT",
"bytes": "33894"
}
],
"symlink_target": ""
}
|
package com.prowidesoftware.swift.model.field;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.Generated;
import com.prowidesoftware.deprecation.ProwideDeprecated;
import com.prowidesoftware.deprecation.TargetYear;
import java.io.Serializable;
import java.util.Locale;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* SWIFT MT Field 17Z.
* <p>
* Model and parser for field 17Z of a SWIFT MT message.
*
* <p>Subfields (components) Data types
* <ol>
* <li><code>String</code></li>
* </ol>
*
* <p>Structure definition
* <ul>
* <li>validation pattern: <code>1a</code></li>
* <li>parser pattern: <code>S</code></li>
* <li>components pattern: <code>S</code></li>
* </ul>
*
* <p>
* This class complies with standard release <strong>SRU2022</strong>
*/
@SuppressWarnings("unused")
@Generated
public class Field17Z extends Field implements Serializable {
/**
* Constant identifying the SRU to which this class belongs to.
*/
public static final int SRU = 2022;
private static final long serialVersionUID = 1L;
/**
* Constant with the field name 17Z.
*/
public static final String NAME = "17Z";
/**
* Same as NAME, intended to be clear when using static imports.
*/
public static final String F_17Z = "17Z";
/**
* @deprecated Use {@link #parserPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase3 = TargetYear.SRU2023)
public static final String PARSER_PATTERN = "S";
/**
* @deprecated Use {@link #typesPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase3 = TargetYear.SRU2023)
public static final String COMPONENTS_PATTERN = "S";
/**
* @deprecated Use {@link #typesPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase3 = TargetYear.SRU2023)
public static final String TYPES_PATTERN = "S";
/**
* Component number for the Indicator subfield.
*/
public static final Integer INDICATOR = 1;
/**
* Default constructor. Creates a new field setting all components to null.
*/
public Field17Z() {
super(1);
}
/**
* Creates a new field and initializes its components with content from the parameter value.
* @param value complete field value including separators and CRLF
*/
public Field17Z(final String value) {
super(value);
}
/**
* Creates a new field and initializes its components with content from the parameter tag.
* The value is parsed with {@link #parse(String)}
* @throws IllegalArgumentException if the parameter tag is null or its tagname does not match the field name
* @since 7.8
*/
public Field17Z(final Tag tag) {
this();
if (tag == null) {
throw new IllegalArgumentException("tag cannot be null.");
}
if (!StringUtils.equals(tag.getName(), "17Z")) {
throw new IllegalArgumentException("cannot create field 17Z from tag "+tag.getName()+", tagname must match the name of the field.");
}
parse(tag.getValue());
}
/**
* Copy constructor.
* Initializes the components list with a deep copy of the source components list.
* @param source a field instance to copy
* @since 7.7
*/
public static Field17Z newInstance(Field17Z source) {
Field17Z cp = new Field17Z();
cp.setComponents(new ArrayList<>(source.getComponents()));
return cp;
}
/**
* Create a Tag with this field name and the given value.
* Shorthand for <code>new Tag(NAME, value)</code>
* @see #NAME
* @since 7.5
*/
public static Tag tag(final String value) {
return new Tag(NAME, value);
}
/**
* Create a Tag with this field name and an empty string as value.
* Shorthand for <code>new Tag(NAME, "")</code>
* @see #NAME
* @since 7.5
*/
public static Tag emptyTag() {
return new Tag(NAME, "");
}
/**
* Parses the parameter value into the internal components structure.
*
* <p>Used to update all components from a full new value, as an alternative
* to setting individual components. Previous component values are overwritten.
*
* @param value complete field value including separators and CRLF
* @since 7.8
*/
@Override
public void parse(final String value) {
init(1);
setComponent1(value);
}
/**
* Serializes the fields' components into the single string value (SWIFT format)
*/
@Override
public String getValue() {
final StringBuilder result = new StringBuilder();
append(result, 1);
return result.toString();
}
/**
* Returns a localized suitable for showing to humans string of a field component.<br>
*
* @param component number of the component to display
* @param locale optional locale to format date and amounts, if null, the default locale is used
* @return formatted component value or null if component number is invalid or not present
* @throws IllegalArgumentException if component number is invalid for the field
* @since 7.8
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 17Z");
}
if (component == 1) {
//default format (as is)
return getComponent(1);
}
return null;
}
/**
* @deprecated Use {@link #typesPattern()} instead.
*/
@Override
@Deprecated
@ProwideDeprecated(phase3 = TargetYear.SRU2023)
public String componentsPattern() {
return "S";
}
/**
* Returns the field component types pattern.
*
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
*/
@Override
public String typesPattern() {
return "S";
}
/**
* Returns the field parser pattern.
*/
@Override
public String parserPattern() {
return "S";
}
/**
* Returns the field validator pattern
*/
@Override
public String validatorPattern() {
return "1a";
}
/**
* Given a component number it returns true if the component is optional,
* regardless of the field being mandatory in a particular message.<br>
* Being the field's value conformed by a composition of one or several
* internal component values, the field may be present in a message with
* a proper value but with some of its internal components not set.
*
* @param component component number, first component of a field is referenced as 1
* @return true if the component is optional for this field, false otherwise
*/
@Override
public boolean isOptional(int component) {
return false;
}
/**
* Returns true if the field is a GENERIC FIELD as specified by the standard.
* @return true if the field is generic, false otherwise
*/
@Override
public boolean isGeneric() {
return false;
}
/**
* Returns the defined amount of components.<br>
* This is not the amount of components present in the field instance, but the total amount of components
* that this field accepts as defined.
* @since 7.7
*/
@Override
public int componentsSize() {
return 1;
}
/**
* Returns english label for components.
* <br>
* The index in the list is in sync with specific field component structure.
* @see #getComponentLabel(int)
* @since 7.8.4
*/
@Override
public List<String> getComponentLabels() {
List<String> result = new ArrayList<>();
result.add("Indicator");
return result;
}
/**
* Returns a mapping between component numbers and their label in camel case format.
* @since 7.10.3
*/
@Override
protected Map<Integer, String> getComponentMap() {
Map<Integer, String> result = new HashMap<>();
result.put(1, "indicator");
return result;
}
/**
* Gets the component 1 (Indicator).
* @return the component 1
*/
public String getComponent1() {
return getComponent(1);
}
/**
* Gets the Indicator (component 1).
* @return the Indicator from component 1
*/
public String getIndicator() {
return getComponent1();
}
/**
* Set the component 1 (Indicator).
*
* @param component1 the Indicator to set
* @return the field object to enable build pattern
*/
public Field17Z setComponent1(String component1) {
setComponent(1, component1);
return this;
}
/**
* Set the Indicator (component 1).
*
* @param component1 the Indicator to set
* @return the field object to enable build pattern
*/
public Field17Z setIndicator(String component1) {
return setComponent1(component1);
}
/**
* Returns the field's name composed by the field number and the letter option (if any).
* @return the static value of Field17Z.NAME
*/
@Override
public String getName() {
return NAME;
}
/**
* Gets the first occurrence form the tag list or null if not found.
* @return null if not found o block is null or empty
* @param block may be null or empty
*/
public static Field17Z get(final SwiftTagListBlock block) {
if (block == null || block.isEmpty()) {
return null;
}
final Tag t = block.getTagByName(NAME);
if (t == null) {
return null;
}
return new Field17Z(t);
}
/**
* Gets the first instance of Field17Z in the given message.
* @param msg may be empty or null
* @return null if not found or msg is empty or null
* @see #get(SwiftTagListBlock)
*/
public static Field17Z get(final SwiftMessage msg) {
if (msg == null || msg.getBlock4() == null || msg.getBlock4().isEmpty()) {
return null;
}
return get(msg.getBlock4());
}
/**
* Gets a list of all occurrences of the field Field17Z in the given message
* an empty list is returned if none found.
* @param msg may be empty or null in which case an empty list is returned
* @see #getAll(SwiftTagListBlock)
*/
public static List<Field17Z> getAll(final SwiftMessage msg) {
if (msg == null || msg.getBlock4() == null || msg.getBlock4().isEmpty()) {
return java.util.Collections.emptyList();
}
return getAll(msg.getBlock4());
}
/**
* Gets a list of all occurrences of the field Field17Z from the given block
* an empty list is returned if none found.
*
* @param block may be empty or null in which case an empty list is returned
*/
public static List<Field17Z> getAll(final SwiftTagListBlock block) {
final List<Field17Z> result = new ArrayList<>();
if (block == null || block.isEmpty()) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
for (final Tag f : arr) {
result.add(new Field17Z(f));
}
}
return result;
}
/**
* This method deserializes the JSON data into a Field17Z object.
* @param json JSON structure including tuples with label and value for all field components
* @return a new field instance with the JSON data parsed into field components or an empty field id the JSON is invalid
* @since 7.10.3
* @see Field#fromJson(String)
*/
public static Field17Z fromJson(final String json) {
final Field17Z field = new Field17Z();
final JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();
// **** COMPONENT 1 - Indicator
if (jsonObject.get("indicator") != null) {
field.setComponent1(jsonObject.get("indicator").getAsString());
}
return field;
}
}
|
{
"content_hash": "68d36225c7b18f057fcd55c82f21ab47",
"timestamp": "",
"source": "github",
"line_count": 435,
"max_line_length": 144,
"avg_line_length": 29.347126436781608,
"alnum_prop": 0.6274479085069716,
"repo_name": "prowide/prowide-core",
"id": "22d71cb410f33550dcb09faf55962484553f716e",
"size": "13361",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/generated/java/com/prowidesoftware/swift/model/field/Field17Z.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "43156"
},
{
"name": "Java",
"bytes": "25397388"
}
],
"symlink_target": ""
}
|
begin
require 'rails'
require 'rails/generators/base'
require 'active_record/errors'
require 'active_record/migration'
rescue LoadError
puts 'This package requires Rails generators.'
puts 'Please run `gem install rails` first!'
exit(1)
end
|
{
"content_hash": "d91ed7b470932b7ff977290d9e492501",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 25.6,
"alnum_prop": 0.7421875,
"repo_name": "carrot/hw",
"id": "bab81a0af80c528e2e95a278edb17282872f3858",
"size": "256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/hw/ext/rails.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "13737"
}
],
"symlink_target": ""
}
|
using System;
namespace xStudio.Web.Areas.HelpPage.ModelDescriptions
{
public class ParameterAnnotation
{
public Attribute AnnotationAttribute { get; set; }
public string Documentation { get; set; }
}
}
|
{
"content_hash": "b3ceb422ddff720e9a72f1d315d91a3d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 58,
"avg_line_length": 21.09090909090909,
"alnum_prop": 0.6939655172413793,
"repo_name": "xDevsPro/xStudio",
"id": "5be9a0697f8e9041f3c26c7ed4f3623adfecc685",
"size": "232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Solution/UIs/xStudio.Web/Areas/HelpPage/ModelDescriptions/ParameterAnnotation.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "C#",
"bytes": "257521"
},
{
"name": "CSS",
"bytes": "3049"
},
{
"name": "JavaScript",
"bytes": "146043"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (9-Debian) on Thu Sep 28 23:13:05 GMT 2017 -->
<title>Uses of Class dollar.java.Java9ScriptingLanguage (dollar-scripting-java-plugin 0.4.5195 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="date" content="2017-09-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class dollar.java.Java9ScriptingLanguage (dollar-scripting-java-plugin 0.4.5195 API)";
}
}
catch(err) {
}
//-->
var pathtoroot = "../../../";loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../dollar/java/package-summary.html">Package</a></li>
<li><a href="../../../dollar/java/Java9ScriptingLanguage.html" title="class in dollar.java">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?dollar/java/class-use/Java9ScriptingLanguage.html" target="_top">Frames</a></li>
<li><a href="Java9ScriptingLanguage.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<ul class="navListSearch">
<li><span>SEARCH: </span>
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
<div class="header">
<h2 title="Uses of Class dollar.java.Java9ScriptingLanguage" class="title">Uses of Class<br>dollar.java.Java9ScriptingLanguage</h2>
</div>
<div class="classUseContainer">No usage of dollar.java.Java9ScriptingLanguage</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../dollar/java/package-summary.html">Package</a></li>
<li><a href="../../../dollar/java/Java9ScriptingLanguage.html" title="class in dollar.java">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?dollar/java/class-use/Java9ScriptingLanguage.html" target="_top">Frames</a></li>
<li><a href="Java9ScriptingLanguage.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2017. All rights reserved.</small></p>
</body>
</html>
|
{
"content_hash": "9b9b730833708d5f4d7c8c40627a93a5",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 131,
"avg_line_length": 36.675496688741724,
"alnum_prop": 0.6375947995666306,
"repo_name": "sillelien/dollar",
"id": "bc4047eb0a65be5dc0401e0233d9d36ae0715f82",
"size": "5538",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/dev/dollar-plugins/dollar-scripting-java-plugin/apidocs/dollar/java/class-use/Java9ScriptingLanguage.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "5403"
},
{
"name": "Java",
"bytes": "1134511"
},
{
"name": "Shell",
"bytes": "11580"
}
],
"symlink_target": ""
}
|
namespace clang {
class CompilerInstance;
}
namespace unittest {
class ModuleInterfaceLoaderTest;
}
namespace swift {
class LangOptions;
class SearchPathOptions;
/// A ModuleLoader that runs a subordinate \c CompilerInvocation and
/// \c CompilerInstance to convert .swiftinterface files to .swiftmodule
/// files on the fly, caching the resulting .swiftmodules in the module cache
/// directory, and loading the serialized .swiftmodules from there.
class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
friend class unittest::ModuleInterfaceLoaderTest;
explicit ModuleInterfaceLoader(
ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
DependencyTracker *tracker, ModuleLoadingMode loadMode,
ArrayRef<std::string> PreferInterfaceForModules,
bool RemarkOnRebuildFromInterface, bool IgnoreSwiftSourceInfoFile)
: SerializedModuleLoaderBase(ctx, tracker, loadMode,
IgnoreSwiftSourceInfoFile),
CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
RemarkOnRebuildFromInterface(RemarkOnRebuildFromInterface),
PreferInterfaceForModules(PreferInterfaceForModules)
{}
std::string CacheDir;
std::string PrebuiltCacheDir;
bool RemarkOnRebuildFromInterface;
ArrayRef<std::string> PreferInterfaceForModules;
std::error_code findModuleFilesInDirectory(
AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename,
StringRef ModuleDocFilename,
StringRef ModuleSourceInfoFilename,
SmallVectorImpl<char> *ModuleInterfacePath,
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer) override;
bool isCached(StringRef DepPath) override;
public:
static std::unique_ptr<ModuleInterfaceLoader>
create(ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
DependencyTracker *tracker, ModuleLoadingMode loadMode,
ArrayRef<std::string> PreferInterfaceForModules = {},
bool RemarkOnRebuildFromInterface = false,
bool IgnoreSwiftSourceInfoFile = false) {
return std::unique_ptr<ModuleInterfaceLoader>(
new ModuleInterfaceLoader(ctx, cacheDir, prebuiltCacheDir,
tracker, loadMode,
PreferInterfaceForModules,
RemarkOnRebuildFromInterface,
IgnoreSwiftSourceInfoFile));
}
/// Append visible module names to \p names. Note that names are possibly
/// duplicated, and not guaranteed to be ordered in any way.
void collectVisibleTopLevelModuleNames(
SmallVectorImpl<Identifier> &names) const override;
/// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as
/// a swiftmodule file).
///
/// A simplified version of the core logic in #openModuleFiles.
static bool buildSwiftModuleFromSwiftInterface(
SourceManager &SourceMgr, DiagnosticEngine &Diags,
const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
StringRef CacheDir, StringRef PrebuiltCacheDir,
StringRef ModuleName, StringRef InPath, StringRef OutPath,
bool SerializeDependencyHashes, bool TrackSystemDependencies,
bool RemarkOnRebuildFromInterface);
};
/// Extract the specified-or-defaulted -module-cache-path that winds up in
/// the clang importer, for reuse as the .swiftmodule cache path when
/// building a ModuleInterfaceLoader.
std::string
getModuleCachePathFromClang(const clang::CompilerInstance &Instance);
}
#endif
|
{
"content_hash": "cf7d51168236251da4f85a3cb02e8144",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 40.82022471910113,
"alnum_prop": 0.7453894852738784,
"repo_name": "lorentey/swift",
"id": "07c371c43423f71d839d4fc636963ee56eebd4d4",
"size": "10479",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "include/swift/Frontend/ModuleInterfaceLoader.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "13203"
},
{
"name": "C",
"bytes": "232100"
},
{
"name": "C++",
"bytes": "34440043"
},
{
"name": "CMake",
"bytes": "541520"
},
{
"name": "D",
"bytes": "1107"
},
{
"name": "DTrace",
"bytes": "2438"
},
{
"name": "Emacs Lisp",
"bytes": "57302"
},
{
"name": "LLVM",
"bytes": "70517"
},
{
"name": "MATLAB",
"bytes": "2576"
},
{
"name": "Makefile",
"bytes": "1841"
},
{
"name": "Objective-C",
"bytes": "429426"
},
{
"name": "Objective-C++",
"bytes": "249901"
},
{
"name": "Perl",
"bytes": "2211"
},
{
"name": "Python",
"bytes": "1612445"
},
{
"name": "Roff",
"bytes": "3495"
},
{
"name": "Ruby",
"bytes": "2091"
},
{
"name": "Shell",
"bytes": "189755"
},
{
"name": "Swift",
"bytes": "31105346"
},
{
"name": "Vim Script",
"bytes": "16883"
},
{
"name": "sed",
"bytes": "1050"
}
],
"symlink_target": ""
}
|
package com.google.zxing.client.android.camera;
import java.io.IOException;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.Camera;
import android.os.Build;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.SurfaceHolder;
import com.google.zxing.client.android.PlanarYUVLuminanceSource;
/**
* This object wraps the Camera service object and expects to be the only one talking to it. The
* implementation encapsulates the steps needed to take preview-sized images, which are used for
* both preview and decoding.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class CameraManager {
private static final String TAG = CameraManager.class.getSimpleName();
private static final int MIN_FRAME_WIDTH = 240;
private static final int MIN_FRAME_HEIGHT = 240;
private static final int MAX_FRAME_WIDTH = 480;
private static final int MAX_FRAME_HEIGHT = 360;
private static CameraManager cameraManager;
static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT
static {
int sdkInt;
try {
sdkInt = Integer.parseInt(Build.VERSION.SDK);
} catch (NumberFormatException nfe) {
// Just to be safe
sdkInt = 10000;
}
SDK_INT = sdkInt;
}
private final Context context;
private final CameraConfigurationManager configManager;
private Camera camera;
private Rect framingRect;
private Rect framingRectInPreview;
private boolean initialized;
private boolean previewing;
private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
* clear the handler so it will only receive one message.
*/
private final PreviewCallback previewCallback;
/** Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. */
private final AutoFocusCallback autoFocusCallback;
/**
* Initializes this static object with the Context of the calling Activity.
*
* @param context The Activity which wants to use the camera.
*/
public static void init(Context context) {
if (cameraManager == null) {
cameraManager = new CameraManager(context);
}
}
/**
* Gets the CameraManager singleton instance.
*
* @return A reference to the CameraManager singleton.
*/
public static CameraManager get() {
return cameraManager;
}
private CameraManager(Context context) {
this.context = context;
this.configManager = new CameraConfigurationManager(context);
// Camera.setOneShotPreviewCallback() has a race condition in Cupcake, so we use the older
// Camera.setPreviewCallback() on 1.5 and earlier. For Donut and later, we need to use
// the more efficient one shot callback, as the older one can swamp the system and cause it
// to run out of memory. We can't use SDK_INT because it was introduced in the Donut SDK.
//useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > Build.VERSION_CODES.CUPCAKE;
useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > 3; // 3 = Cupcake
previewCallback = new PreviewCallback(configManager, useOneShotPreviewCallback);
autoFocusCallback = new AutoFocusCallback();
}
/**
* Opens the camera driver and initializes the hardware parameters.
*
* @param holder The surface object which the camera will draw preview frames into.
* @throws IOException Indicates the camera driver failed to open.
*/
public void openDriver(SurfaceHolder holder) throws IOException {
if (camera == null) {
camera = Camera.open();
if (camera == null) {
throw new IOException();
}
camera.setPreviewDisplay(holder);
if (!initialized) {
initialized = true;
configManager.initFromCameraParameters(camera);
}
configManager.setDesiredCameraParameters(camera);
//if dark
//FlashlightManager.enableFlashlight();
}
}
/**
* Closes the camera driver if still in use.
*/
public void closeDriver() {
if (camera != null) {
FlashlightManager.disableFlashlight();
camera.release();
camera = null;
}
}
/**
* Asks the camera hardware to begin drawing preview frames to the screen.
*/
public void startPreview() {
if (camera != null && !previewing) {
camera.startPreview();
previewing = true;
}
}
/**
* Tells the camera to stop drawing preview frames.
*/
public void stopPreview() {
if (camera != null && previewing) {
if (!useOneShotPreviewCallback) {
camera.setPreviewCallback(null);
}
camera.stopPreview();
previewCallback.setHandler(null, 0);
autoFocusCallback.setHandler(null, 0);
previewing = false;
}
}
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
/**
* Asks the camera hardware to perform an autofocus.
*
* @param handler The Handler to notify when the autofocus completes.
* @param message The message to deliver.
*/
public void requestAutoFocus(Handler handler, int message) {
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler, message);
//Log.d(TAG, "Requesting auto-focus callback");
camera.autoFocus(autoFocusCallback);
}
}
/**
* Calculates the framing rect which the UI should draw to show the user where to place the
* barcode. This target helps with alignment as well as forces the user to hold the device
* far enough away to ensure the image will be in focus.
*
* @return The rectangle to draw on screen in window coordinates.
*/
public Rect getFramingRect() {
Point screenResolution = configManager.getScreenResolution();
if (framingRect == null) {
if (camera == null) {
return null;
}
int width = screenResolution.x * 3 / 4;
if (width < MIN_FRAME_WIDTH) {
width = MIN_FRAME_WIDTH;
} else if (width > MAX_FRAME_WIDTH) {
width = MAX_FRAME_WIDTH;
}
int height = screenResolution.y * 3 / 4;
if (height < MIN_FRAME_HEIGHT) {
height = MIN_FRAME_HEIGHT;
} else if (height > MAX_FRAME_HEIGHT) {
height = MAX_FRAME_HEIGHT;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
}
/**
* Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
* not UI / screen.
*/
public Rect getFramingRectInPreview() {
if (framingRectInPreview == null) {
Rect rect = new Rect(getFramingRect());
Point cameraResolution = configManager.getCameraResolution();
Point screenResolution = configManager.getScreenResolution();
rect.left = rect.left * cameraResolution.x / screenResolution.x;
rect.right = rect.right * cameraResolution.x / screenResolution.x;
rect.top = rect.top * cameraResolution.y / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
framingRectInPreview = rect;
}
return framingRectInPreview;
}
/**
* Converts the result points from still resolution coordinates to screen coordinates.
*
* @param points The points returned by the Reader subclass through Result.getResultPoints().
* @return An array of Points scaled to the size of the framing rect and offset appropriately
* so they can be drawn in screen coordinates.
*/
/*
public Point[] convertResultPoints(ResultPoint[] points) {
Rect frame = getFramingRectInPreview();
int count = points.length;
Point[] output = new Point[count];
for (int x = 0; x < count; x++) {
output[x] = new Point();
output[x].x = frame.left + (int) (points[x].getX() + 0.5f);
output[x].y = frame.top + (int) (points[x].getY() + 0.5f);
}
return output;
}
*/
/**
* A factory method to build the appropriate LuminanceSource object based on the format
* of the preview buffers, as described by Camera.Parameters.
*
* @param data A preview frame.
* @param width The width of the image.
* @param height The height of the image.
* @return A PlanarYUVLuminanceSource instance.
*/
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
Rect rect = getFramingRectInPreview();
int previewFormat = configManager.getPreviewFormat();
String previewFormatString = configManager.getPreviewFormatString();
switch (previewFormat) {
// This is the standard Android format which all devices are REQUIRED to support.
// In theory, it's the only one we should ever care about.
case PixelFormat.YCbCr_420_SP:
// This format has never been seen in the wild, but is compatible as we only care
// about the Y channel, so allow it.
case PixelFormat.YCbCr_422_SP:
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
default:
// The Samsung Moment incorrectly uses this variant instead of the 'sp' version.
// Fortunately, it too has all the Y data up front, so we can read it.
if ("yuv420p".equals(previewFormatString)) {
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
}
}
throw new IllegalArgumentException("Unsupported picture format: " +
previewFormat + '/' + previewFormatString);
}
}
|
{
"content_hash": "9ec55ae93458f9f33ba59180fe2a92dc",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 100,
"avg_line_length": 34.67326732673267,
"alnum_prop": 0.6854178564629735,
"repo_name": "barmstrong/bitcoin-android",
"id": "25067b01b16f062d08e6eff1b2fe52e07189fa1a",
"size": "11107",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/google/zxing/client/android/camera/CameraManager.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3505654"
}
],
"symlink_target": ""
}
|
import { Component, OnInit, Input } from '@angular/core';
import { Article } from '../models/article.model';
@Component({
selector: 'app-article',
templateUrl: './article.component.html',
styleUrls: ['./article.component.css']
})
export class ArticleComponent implements OnInit {
private symbols: number = 250;
@Input() article: Article;
@Input() articleDesc: string;
descToShow: string;
articleDescLen: number;
showReadMoreBtn: boolean = true;
showHideBtn: boolean = false;
imageIsShown: boolean = false;
imageButtonTitle: string = 'Show Image';
constructor() {
this.articleDescLen = 0;
this.descToShow = '';
}
ngOnInit() {
}
readMore(): void {
this.articleDescLen += this.symbols;
if (this.articleDescLen > this.articleDesc.length) {
this.showReadMoreBtn = false;
this.showHideBtn = true;
} else {
this.descToShow = this.articleDesc.substring(0, this.articleDescLen);
}
}
toggleImage(): void {
this.imageIsShown = !this.imageIsShown;
this.imageButtonTitle = this.imageButtonTitle === 'Show Image' ? 'Hide Image' : 'Show Image';
}
hideDesc(): void {
this.descToShow = '';
this.articleDescLen = 0;
this.showReadMoreBtn = true;
this.showHideBtn = false;
}
}
|
{
"content_hash": "fb6d9f9cc86b29b0cbd13476a9c7bcd5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 97,
"avg_line_length": 25.48,
"alnum_prop": 0.6664050235478807,
"repo_name": "stoyanov7/SoftwareUniversity",
"id": "d3fa6a9e8c9ee8d03e6892b7a4cf6bf9642e0542",
"size": "1274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JavaScriptCore/JavaScriptWeb/Components-Lab/articles-app/src/app/article/article.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "108"
},
{
"name": "C#",
"bytes": "2704772"
},
{
"name": "CSS",
"bytes": "133306"
},
{
"name": "HTML",
"bytes": "248344"
},
{
"name": "Handlebars",
"bytes": "4195"
},
{
"name": "JavaScript",
"bytes": "398638"
},
{
"name": "PLpgSQL",
"bytes": "5115"
},
{
"name": "TSQL",
"bytes": "46837"
},
{
"name": "TypeScript",
"bytes": "19883"
}
],
"symlink_target": ""
}
|
var bidderList = [];
if(window.localStorage.storedBidderList) {
Array.prototype.push.apply(bidderList, window.localStorage.storedBidderList.split(','));
}
export default {
getInitialList: function() {
return {
bidderList: bidderList
};
},
addToArray: function(value) {
bidderList.push(value);
console.log(bidderList);
window.localStorage.storedBidderList = bidderList.toString();
},
};
|
{
"content_hash": "67fbba1e95f3c9e1530c1a1bc968a1c2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 90,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.6932084309133489,
"repo_name": "williamliew/brokerApp",
"id": "587cd60cd28b6b233de27a7366461f1ea9bb4c21",
"size": "427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/actions/bidactions.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11628"
},
{
"name": "HTML",
"bytes": "324"
},
{
"name": "JavaScript",
"bytes": "5006"
}
],
"symlink_target": ""
}
|
import { module } from 'angular';
import React from 'react';
import { react2angular } from 'react2angular';
import { Application, ManifestWriter, ConfirmationModalService } from '@spinnaker/core';
import { IKubernetesServerGroupManager } from 'kubernetes/v2/serverGroupManager';
interface IRollingRestartProps {
application: Application;
serverGroupManager: IKubernetesServerGroupManager;
}
interface IRollingRestartParameters {
account: string;
cloudProvider: string;
location: string;
manifestName: string;
}
function RollingRestart({ application, serverGroupManager }: IRollingRestartProps) {
function rollingRestart() {
const rollingRestartParameters: IRollingRestartParameters = {
account: serverGroupManager.account,
cloudProvider: 'kubernetes',
location: serverGroupManager.namespace,
manifestName: serverGroupManager.name,
};
ConfirmationModalService.confirm({
account: serverGroupManager.account,
askForReason: true,
header: `Initiate rolling restart of ${serverGroupManager.name}`,
submitMethod: () => {
return ManifestWriter.rollingRestartManifest(rollingRestartParameters, application);
},
taskMonitorConfig: {
application,
title: `Rolling restart of ${serverGroupManager.name}`,
},
});
}
return (
<li>
<a onClick={rollingRestart}>Rolling Restart</a>
</li>
);
}
export const KUBERNETES_ROLLING_RESTART = 'spinnaker.kubernetes.v2.rolling.restart';
module(KUBERNETES_ROLLING_RESTART, []).component(
'kubernetesRollingRestart',
react2angular(RollingRestart, ['application', 'serverGroupManager']),
);
|
{
"content_hash": "24ac602aea40a7873690d971b3623758",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 92,
"avg_line_length": 30.75925925925926,
"alnum_prop": 0.7308850090307044,
"repo_name": "icfantv/deck",
"id": "389b45857b95411433cab9ae3f53678d567cdd48",
"size": "1661",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/scripts/modules/kubernetes/src/v2/manifest/rollout/RollingRestart.tsx",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "180899"
},
{
"name": "HTML",
"bytes": "1281694"
},
{
"name": "JavaScript",
"bytes": "1994618"
},
{
"name": "Shell",
"bytes": "24704"
},
{
"name": "TypeScript",
"bytes": "5272235"
}
],
"symlink_target": ""
}
|
package phonenumbers
import (
"fmt"
"strings"
"testing"
"github.com/keybase/client/go/kbtest"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/keybase1"
"github.com/stretchr/testify/require"
)
func TestSetPhoneNumber(t *testing.T) {
tc := libkb.SetupTest(t, "TestPhoneNumbers", 1)
defer tc.Cleanup()
_, err := kbtest.CreateAndSignupFakeUser("phon", tc.G)
require.NoError(t, err)
// Generate a random phone number e.g. "14155552671".
randomNumber := kbtest.GenerateTestPhoneNumber()
// In strict format: "+14155552671".
phoneNumber := keybase1.PhoneNumber("+" + randomNumber)
// Create a representation likely to come from phone contact book: "+1-415-555-2671".
phoneFormatted := keybase1.RawPhoneNumber(fmt.Sprintf("+%s-%s-%s-%s", randomNumber[0:1], randomNumber[1:4], randomNumber[4:7], randomNumber[7:11]))
// Sanity check.
require.EqualValues(t, phoneNumber, strings.ReplaceAll(string(phoneFormatted), "-", ""))
t.Logf("Generated phone number: %q formatted as %q", phoneNumber, phoneFormatted)
mctx := libkb.NewMetaContextForTest(tc)
err = AddPhoneNumber(mctx, phoneNumber, keybase1.IdentityVisibility_PRIVATE)
require.NoError(t, err)
code, err := kbtest.GetPhoneVerificationCode(mctx, phoneNumber)
require.NoError(t, err)
t.Logf("Got verification code: %q", code)
err = VerifyPhoneNumber(mctx, phoneNumber, code)
require.NoError(t, err)
err = SetVisibilityPhoneNumber(mctx, phoneNumber, keybase1.IdentityVisibility_PUBLIC)
require.NoError(t, err)
resp, err := GetPhoneNumbers(mctx)
require.NoError(t, err)
require.Len(t, resp, 1)
require.Equal(t, phoneNumber, resp[0].PhoneNumber)
require.True(t, resp[0].Verified)
err = DeletePhoneNumber(mctx, phoneNumber)
require.NoError(t, err)
resp, err = GetPhoneNumbers(mctx)
require.NoError(t, err)
require.Len(t, resp, 0)
}
func TestDeleteSupersededNumber(t *testing.T) {
tc := libkb.SetupTest(t, "TestPhoneNumbers", 1)
defer tc.Cleanup()
mctx := libkb.NewMetaContextForTest(tc)
user1, err := kbtest.CreateAndSignupFakeUser("user1", tc.G)
require.NoError(t, err)
phoneNumber := keybase1.PhoneNumber("+15550123456")
err = AddPhoneNumber(mctx, phoneNumber, keybase1.IdentityVisibility_PRIVATE)
require.NoError(t, err)
// Verify phone on another user
_, err = kbtest.CreateAndSignupFakeUser("user2", tc.G)
require.NoError(t, err)
err = AddPhoneNumber(mctx, phoneNumber, keybase1.IdentityVisibility_PRIVATE)
require.NoError(t, err)
code, err := kbtest.GetPhoneVerificationCode(mctx, phoneNumber)
require.NoError(t, err)
t.Logf("Got verification code: %q", code)
err = VerifyPhoneNumber(mctx, phoneNumber, code)
require.NoError(t, err)
// Check it's superseded on user1
kbtest.Logout(tc)
err = user1.Login(tc.G)
require.NoError(t, err)
numbers, err := GetPhoneNumbers(mctx)
require.NoError(t, err)
require.Len(t, numbers, 1)
require.True(t, numbers[0].Superseded)
// Try adding again; superseded one should be deleted
err = AddPhoneNumber(mctx, phoneNumber, keybase1.IdentityVisibility_PRIVATE)
require.NoError(t, err)
numbers, err = GetPhoneNumbers(mctx)
require.NoError(t, err)
require.Len(t, numbers, 1)
require.False(t, numbers[0].Superseded)
}
func TestBadPhoneNumbers(t *testing.T) {
tc := libkb.SetupTest(t, "TestPhoneNumbers", 1)
defer tc.Cleanup()
_, err := kbtest.CreateAndSignupFakeUser("phon", tc.G)
require.NoError(t, err)
mctx := libkb.NewMetaContextForTest(tc)
require.Error(t, AddPhoneNumber(mctx, "14155552671", keybase1.IdentityVisibility_PUBLIC))
require.Error(t, AddPhoneNumber(mctx, "014155552671", keybase1.IdentityVisibility_PUBLIC))
require.Error(t, AddPhoneNumber(mctx, "784111222", keybase1.IdentityVisibility_PUBLIC))
}
|
{
"content_hash": "d6c0d568ad73a2bdb236fe89446f1754",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 148,
"avg_line_length": 32.08620689655172,
"alnum_prop": 0.7458355722729715,
"repo_name": "keybase/client",
"id": "dc94403dc14dfb180a97f2f6b714c28d686fdd3d",
"size": "3843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "go/phonenumbers/user_test.go",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "17403"
},
{
"name": "C",
"bytes": "183175"
},
{
"name": "C++",
"bytes": "26935"
},
{
"name": "CMake",
"bytes": "2524"
},
{
"name": "CSS",
"bytes": "46433"
},
{
"name": "CoffeeScript",
"bytes": "28635"
},
{
"name": "Dockerfile",
"bytes": "19841"
},
{
"name": "Go",
"bytes": "32360664"
},
{
"name": "HTML",
"bytes": "7113636"
},
{
"name": "Java",
"bytes": "144690"
},
{
"name": "JavaScript",
"bytes": "113705"
},
{
"name": "Makefile",
"bytes": "8579"
},
{
"name": "Objective-C",
"bytes": "1419995"
},
{
"name": "Objective-C++",
"bytes": "34802"
},
{
"name": "Perl",
"bytes": "2673"
},
{
"name": "Python",
"bytes": "25189"
},
{
"name": "Roff",
"bytes": "108890"
},
{
"name": "Ruby",
"bytes": "38112"
},
{
"name": "Shell",
"bytes": "186628"
},
{
"name": "Starlark",
"bytes": "1928"
},
{
"name": "Swift",
"bytes": "217"
},
{
"name": "TypeScript",
"bytes": "2493"
},
{
"name": "XSLT",
"bytes": "914"
}
],
"symlink_target": ""
}
|
package ar.edu.undec.nortia.controller.view;
import ar.edu.undec.nortia.model.Archivorendicion;
import ar.edu.undec.nortia.controller.view.util.JsfUtil;
import ar.edu.undec.nortia.controller.view.util.PaginationHelper;
import ar.edu.undec.nortia.controller.ArchivorendicionFacade;
import ar.edu.undec.nortia.controller.RendicionFacade;
import ar.edu.undec.nortia.model.Rendicion;
import ar.edu.undec.nortia.model.Solicitud;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.faces.event.PhaseId;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import javax.imageio.ImageIO;
import org.primefaces.event.CellEditEvent;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
@ManagedBean(name = "archivorendicionController")
@SessionScoped
public class ArchivorendicionController implements Serializable {
private Archivorendicion current;
private DataModel items = null;
@EJB
private ar.edu.undec.nortia.controller.ArchivorendicionFacade ejbFacade;
@EJB
private ar.edu.undec.nortia.controller.RendicionFacade ejbFacadeRendicion;
@EJB
private ar.edu.undec.nortia.controller.ConfiguracionFacade ejbFacadec;
private PaginationHelper pagination;
private int selectedItemIndex;
private List<Archivorendicion> listaArchivos;
public ArchivorendicionController() {
}
public Archivorendicion getSelected() {
if (current == null) {
current = new Archivorendicion();
selectedItemIndex = -1;
}
return current;
}
public void setSelected(Archivorendicion archivorendicion) {
current = archivorendicion;
}
private ArchivorendicionFacade getFacade() {
return ejbFacade;
}
public RendicionFacade getEjbFacadeRendicion() {
return ejbFacadeRendicion;
}
public List<Archivorendicion> getListaArchivos() {
if (listaArchivos == null) {
listaArchivos = new ArrayList<Archivorendicion>();
}
return listaArchivos;
}
public void setListaArchivos(List<Archivorendicion> listaArchivos) {
this.listaArchivos = listaArchivos;
}
public PaginationHelper getPagination() {
if (pagination == null) {
pagination = new PaginationHelper(10) {
@Override
public int getItemsCount() {
return getFacade().count();
}
@Override
public DataModel createPageDataModel() {
return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()}));
}
};
}
return pagination;
}
public String prepareList() {
recreateModel();
return "List";
}
public String prepareListEjecutados(){
obtenerArchivosRendicionEjecutados();
System.out.println("asdasd");
return "ListComprobantesEjecutados";
}
public String prepareView() {
current = (Archivorendicion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "View";
}
public String prepareCreate() {
current = new Archivorendicion();
selectedItemIndex = -1;
return "Create";
}
public String create() {
try {
getFacade().create(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ArchivorendicionCreated"));
return prepareCreate();
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String prepareEdit() {
current = (Archivorendicion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "Edit";
}
public String update() {
try {
getFacade().edit(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ArchivorendicionUpdated"));
return "View";
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String destroy() {
current = (Archivorendicion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
performDestroy();
recreatePagination();
recreateModel();
return "List";
}
public String destroyAndView() {
performDestroy();
recreateModel();
updateCurrentItem();
if (selectedItemIndex >= 0) {
return "View";
} else {
// all items were removed - go back to list
recreateModel();
return "List";
}
}
private void performDestroy() {
try {
getFacade().remove(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ArchivorendicionDeleted"));
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
}
}
private void updateCurrentItem() {
int count = getFacade().count();
if (selectedItemIndex >= count) {
// selected index cannot be bigger than number of items:
selectedItemIndex = count - 1;
// go to previous page if last page disappeared:
if (pagination.getPageFirstItem() >= count) {
pagination.previousPage();
}
}
if (selectedItemIndex >= 0) {
current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex + 1}).get(0);
}
}
public DataModel getItems() {
if (items == null) {
items = getPagination().createPageDataModel();
}
return items;
}
private void recreateModel() {
items = null;
}
private void recreatePagination() {
pagination = null;
}
public String next() {
getPagination().nextPage();
recreateModel();
return "List";
}
public String previous() {
getPagination().previousPage();
recreateModel();
return "List";
}
public SelectItem[] getItemsAvailableSelectMany() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), false);
}
public SelectItem[] getItemsAvailableSelectOne() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), true);
}
@FacesConverter(forClass = Archivorendicion.class)
public static class ArchivorendicionControllerConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
ArchivorendicionController controller = (ArchivorendicionController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "archivorendicionController");
return controller.ejbFacade.find(getKey(value));
}
java.lang.Integer getKey(String value) {
java.lang.Integer key;
key = Integer.valueOf(value);
return key;
}
String getStringKey(java.lang.Integer value) {
StringBuilder sb = new StringBuilder();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof Archivorendicion) {
Archivorendicion o = (Archivorendicion) object;
return getStringKey(o.getId());
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + Archivorendicion.class.getName());
}
}
}
public void nuevoArchivoRendicion() {
System.out.println("Nuevo Archivo Rendicion Inicio");
//current = null;
current = new Archivorendicion();
// Obtenemos el controlador necesario
FacesContext context = FacesContext.getCurrentInstance();
RendicionController rendicioncontroller = (RendicionController) context.getApplication().evaluateExpressionGet(context, "#{rendicionController}", RendicionController.class);
System.out.println("Rendicion Solicitud: " + rendicioncontroller.getSolicitudSeleccionada().getPresupuestotarea().getDescripcion());
System.out.println("Rendicion Fecha Solicitud: " + rendicioncontroller.getSolicitudSeleccionada().getFechasolicitud().toString());
// System.out.println("Rendicion Fecha Aprobacion: " + rendicioncontroller.getSolicitudSeleccionada().getFechaaprobacion().toString());
// System.out.println("Rendicion Fecha Ejecucion: " + rendicioncontroller.getSolicitudSeleccionada().getFechaejecucion().toString());
System.out.println("Nuevo Archivo rendicion Fin");
}
public void agregarArchivoLista() {
System.out.println("Inicio Método agregarArchivoLista <<>><<>");
// Obtenemos el controlador necesario
FacesContext context = FacesContext.getCurrentInstance();
RendicionController rendicioncontroller = (RendicionController) context.getApplication().evaluateExpressionGet(context, "#{rendicionController}", RendicionController.class);
SolicitudController solicitudcontroller = (SolicitudController) context.getApplication().evaluateExpressionGet(context, "#{solicitudController}", SolicitudController.class);
float sumaArchivosRendicion = 0f;
for (Archivorendicion ar : getListaArchivos()) {
sumaArchivosRendicion = sumaArchivosRendicion + ar.getMontofactura().floatValue();
}
sumaArchivosRendicion = sumaArchivosRendicion + current.getMontofactura().floatValue();
System.out.println("Suma de Archivos de Rendicion = " + sumaArchivosRendicion);
if (rendicioncontroller.getSolicitudSeleccionada() == null) {
System.out.println("rendicioncontroller.getSolicitudSeleccionada() NULLLLLLLLLLLLLLLL asd");
}
if (sumaArchivosRendicion > rendicioncontroller.getSolicitudSeleccionada().getImporte().floatValue()) {
float porcentaje = 20f;
// Obtenemos el porcentaje maximo el cual no se debe superar por la suma de comprobantes
try {
porcentaje = Float.parseFloat(ejbFacadec.findAtributo("maxporcentajerendicion").getValor());
} catch (Exception e) {
porcentaje = 20f;
System.out.println("Error en obtencion de parametro 'maxporcentajerendicion' desde la base de datos [maxporcentajerendicion = 20]");
e.printStackTrace();
}
float porcentajeArchivosRendicion = (rendicioncontroller.getSolicitudSeleccionada().getImporte().floatValue() * (porcentaje / 100.0f));
System.out.println(porcentaje + "% de la suma de Archivos de Rendicion = " + porcentajeArchivosRendicion);
//validacion de que el el total de archivos de rendicion,
//sea igual o hasta un 20% mayor que el importe de la rendicion
if (sumaArchivosRendicion > (rendicioncontroller.getSolicitudSeleccionada().getImporte().floatValue() + porcentajeArchivosRendicion)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error en Creación de la Rendicion", "La suma de comprobantes de pago debe ser igual o mayor hasta un " + porcentaje + "% del total de la solicitud a rendir."));
return;
} else {
float diferencia = sumaArchivosRendicion - rendicioncontroller.getSolicitudSeleccionada().getImporte().floatValue();
System.out.println("Diferencia: " + diferencia);
// la diferencia se encuentra dentro del porcentaje permitido
if (diferencia > 0 && diferencia < porcentajeArchivosRendicion) {
// verificar si hay dinero disponible para la diferencia
for (Solicitud s : solicitudcontroller.getItemsDisponiblesNuevo()) {
if (rendicioncontroller.getSolicitudSeleccionada().getPresupuestotarea().getId() == s.getPresupuestotarea().getId() && s.getDisponible().floatValue() >= diferencia) {
// agregar el archivo rendicion a la lista
getListaArchivos().add(current);
// a la solicitud encontrada, le cambiamos el importe por la diferencia
s.setImporte(new BigDecimal(diferencia));
// seteamos la solicitud encontrada como la solicitud para el reintegro
rendicioncontroller.setSolicitudReintegroPorDiferencia(s);
System.out.println("rendicioncontroller.SolicitudReintegroPorDiferencia: " + rendicioncontroller.getSolicitudReintegroPorDiferencia().getImporte() + " - " + rendicioncontroller.getSolicitudReintegroPorDiferencia().getPresupuestotarea().getDescripcion());
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Rendicion: existe una diferencia.", "La suma de comprobantes supera la solicitud a rendir dentro de lo permitido y hay dinero disponible para el item. La diferencia es de: " + diferencia + " y se asigna a " + s.getPresupuestotarea().getDescripcion()));
return;
}
}
// si no hay dinero disponible para la diferencia de rendicion.
}
}
} else {
// agregar el archivo rendicion a la lista
getListaArchivos().add(current);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Rendición: comprobante agregado correctamente", "Importe: " + current.getMontofactura().floatValue()));
}
}
public void subirArchivoRendicion(FileUploadEvent event) {
System.out.println("Subiendo Archivo de Rendición");
try {
//current = new Archivorendicion();
current.setNombrearchivo(event.getFile().getFileName());
current.setArchivo(event.getFile().getContents());
//getListaArchivos().add(current);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Información", "El archivo" + current.getNombrearchivo() + " fue subido satisfactoriamente!"));
} catch (Exception e) {
System.out.println("Excepcion en RendicionController - subirArchivo");
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Error", "Ocurrió un error al subir el archivo"));
e.printStackTrace();
}
}
public void removerArchivoLista(Archivorendicion archivo) {
// se quita de la lista de solicitados
// Iterator i = this.itemsSolicitados.iterator();
// while(i.hasNext()){
// if(((Solicitud)i.next()).getPresupuestotarea().equals(solicitud.getPresupuestotarea())){
// i.remove();
// }
// }
listaArchivos.remove(archivo);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Información", "El comprobante del proveedor: " + current.getProveedor() + " - Nº: " + current.getNrofactura() + " fue borrado"));
}
public StreamedContent obtenerImagen() throws IOException {
StreamedContent imagen = null;
FacesContext context = FacesContext.getCurrentInstance();
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
// Renderizamos el HTML. Devolver un stub de StreamedContent asi se general la URL correcta.
System.out.println("obtenerImagen: RENDER_RESPONSE");
return new DefaultStreamedContent();
} else {
// Se responde al requerimiento de la imagen, con un StreamContent con los bytes de imagen reales.
String nombreArchivo = context.getExternalContext().getRequestParameterMap().get("archivo");
System.out.println("obtenerImagen: <NO> RENDER_RESPONSE");
System.out.println("Archivo del Comprobante: " + nombreArchivo);
for (Archivorendicion ar : getListaArchivos()) {
if (ar.getNombrearchivo().equals(nombreArchivo)) {
return new DefaultStreamedContent(new ByteArrayInputStream(ar.getArchivo()));
}
}
}
return null;
}
public StreamedContent getImagenComprobante(){
FacesContext context = FacesContext.getCurrentInstance();
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
// Renderizamos el HTML. Devuelve un stub StreamedContent para generar el URL correcto.
return new DefaultStreamedContent();
} else {
// El browser requiere la imagen. Devuelve el StreamedContent real con los bytes de la imagen.
String nombreArchivo = context.getExternalContext().getRequestParameterMap().get("archivo");
System.out.println("Nombre de Archivo >> " + nombreArchivo);
for (Archivorendicion ar : getListaArchivos()) {
if (ar.getNombrearchivo().equals(nombreArchivo)) {
//BufferedImage bufferedImg = new BufferedImage(100, 25, BufferedImage.TYPE_INT_RGB);
//ByteArrayOutputStream os = new ByteArrayOutputStream();
//ImageIO.write(bufferedImg, "png", os);
//imagen = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/png");
return new DefaultStreamedContent(new ByteArrayInputStream(ar.getArchivo()));
}
}
}
return new DefaultStreamedContent();
}
public StreamedContent getImagenSelected(){
FacesContext context = FacesContext.getCurrentInstance();
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
// Renderizamos el HTML. Devuelve un stub StreamedContent para generar el URL correcto.
return new DefaultStreamedContent();
} else {
// si el current o el archivo que contiene son nulos.
if(null == current){
return new DefaultStreamedContent();
}
if(null == current.getArchivo()){
return new DefaultStreamedContent();
}
// El browser requiere la imagen. Devuelve el StreamedContent real con los bytes de la imagen.
return new DefaultStreamedContent(new ByteArrayInputStream(current.getArchivo()));
}
}
public float sumarComprobantes() {
float r = 0;
if (listaArchivos != null & listaArchivos.size() > 0) {
for (Archivorendicion a : listaArchivos) {
r += a.getMontofactura().floatValue();
}
}
return r;
}
public float sumarMontoAprobadoComprobantes() {
float r = 0;
if (listaArchivos != null & listaArchivos.size() > 0) {
for (Archivorendicion a : listaArchivos) {
r += a.getMontoaprobado().floatValue();
}
}
return r;
}
public void llenarListaArchivosPorSolicitudSeleccionada() {
// Obtenemos el controlador necesario
FacesContext context = FacesContext.getCurrentInstance();
RendicionController rendicioncontroller = (RendicionController) context.getApplication().evaluateExpressionGet(context, "#{rendicionController}", RendicionController.class);
// vaciamos la lista de comprobantes
listaArchivos.clear();
// si, la solicitud seleccionada no es nula
if (rendicioncontroller.getSolicitudSeleccionada() != null) {
System.out.println("rendicioncontroller.getSolicitudSeleccionada NO null");
listaArchivos.addAll(getFacade().buscarPorRendicion(rendicioncontroller.getSolicitudSeleccionada().getRendicionid().getId()));
}
}
public void llenarListaArchivosPorListaSolicitudes(List<Solicitud> listaSolicitudes) {
// si la lista no es nula o vacia
if (listaSolicitudes != null && listaSolicitudes.size() > 0) {
for (Solicitud s : listaSolicitudes) {
if (s.getRendicionid() != null) {
listaArchivos.addAll(getFacade().buscarPorRendicion(s.getRendicionid().getId()));
}
}
}
}
public void onCellEdit(CellEditEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
//String nombreColumna = event.getColumn().getHeaderText();
//String nombreColumna = event.getColumn().getFacet("header").toString();
if (newValue != null && !newValue.equals(oldValue)) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cambio.", "Valor Anterior: " + oldValue + ", Nuevo Valor:" + newValue);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
/*
* Obtenemos la lista de comprobantes de las rendiciones ejecutadas.
*/
public void obtenerArchivosRendicionEjecutados(){
System.out.println("obtenerArchivosRendicionEjecutados");
List<Rendicion> rendiciones = new ArrayList<Rendicion>();
FacesContext context = FacesContext.getCurrentInstance();
ProyectoController proyectocontroller = (ProyectoController) context.getApplication().evaluateExpressionGet(context, "#{proyectoController}", ProyectoController.class);
rendiciones = this.ejbFacadeRendicion.obtenerPorProyectoAprobadas(proyectocontroller.getSelected().getId());
// inicializamos la lista de comprobantes
listaArchivos = new ArrayList<Archivorendicion>();
for(Rendicion rendicion : rendiciones){
try{
listaArchivos.addAll(getFacade().buscarPorRendicion(rendicion.getId()));
}catch(Exception e){
System.out.println("Excepción en obtener los comprobantes de una rendicion");
e.printStackTrace();
}
}
for(Archivorendicion ac : listaArchivos){
System.out.println("Comprobante >> " + ac.getNrofactura());
}
// items = a la lista de comprobantes de todas las rendiciones ejecutadas
//items = new ArrayDataModel<Archivorendicion>(comprobantes.toArray(new Archivorendicion[comprobantes.size()]));
}
}
|
{
"content_hash": "2aa9a175360fd3f45c11a234b4cb87cf",
"timestamp": "",
"source": "github",
"line_count": 593,
"max_line_length": 378,
"avg_line_length": 40.67284991568297,
"alnum_prop": 0.641485965421452,
"repo_name": "hcmaza/nortia",
"id": "6928a513bbbe599aa5223276c55478f59131dc05",
"size": "24128",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ar/edu/undec/nortia/controller/view/ArchivorendicionController.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "141046"
},
{
"name": "HTML",
"bytes": "2163178"
},
{
"name": "Java",
"bytes": "1188189"
},
{
"name": "JavaScript",
"bytes": "40129"
}
],
"symlink_target": ""
}
|
namespace juno {
namespace misc {
class CertificateStore {
public:
explicit CertificateStore(const wchar_t* store_name) : store_handle_() {
store_handle_ = CertOpenSystemStore(NULL, store_name);
}
CertificateStore(const char* provider, DWORD encoding, DWORD flags,
const void* param)
: store_handle_() {
store_handle_ = CertOpenStore(provider, encoding, NULL, flags, param);
}
~CertificateStore() {
if (IsValid())
CertCloseStore(store_handle_, 0);
}
PCCERT_CONTEXT EnumCertificate(PCCERT_CONTEXT previous) {
if (!IsValid())
return nullptr;
return CertEnumCertificatesInStore(store_handle_, previous);
}
PCCERT_CONTEXT FindCertificate(DWORD encoding, DWORD flags, DWORD type,
const void* data, PCCERT_CONTEXT previous) {
if (!IsValid())
return nullptr;
return CertFindCertificateInStore(store_handle_, encoding, flags, type,
data, previous);
}
PCCERT_CONTEXT SelectCertificate(HWND parent, const wchar_t* title,
const wchar_t* message, DWORD exclude) {
if (!IsValid())
return nullptr;
return CryptUIDlgSelectCertificateFromStore(store_handle_, parent, title,
message, exclude, 0, nullptr);
}
operator HCERTSTORE() const {
return store_handle_;
}
bool IsValid() const {
return store_handle_ != NULL;
}
operator bool() const {
return IsValid();
}
private:
HCERTSTORE store_handle_;
CertificateStore(const CertificateStore&) = delete;
CertificateStore& operator=(const CertificateStore&) = delete;
};
} // namespace misc
} // namespace juno
#endif // JUNO_MISC_CERTIFICATE_STORE_H_
|
{
"content_hash": "2001e4a061997f60c7c661d16e2fd0a9",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 78,
"avg_line_length": 26.352941176470587,
"alnum_prop": 0.62890625,
"repo_name": "dacci/juno",
"id": "4587938f801563e1aca8059b326041439c43fd24",
"size": "1950",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "juno/misc/certificate_store.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3244"
},
{
"name": "C++",
"bytes": "394018"
}
],
"symlink_target": ""
}
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>net.martenscs.wso2.application.hello</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>net.martenscs.wso2.rap.app</groupId>
<artifactId>wso2-rap-build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../wso2-rap-build</relativePath>
</parent>
</project>
|
{
"content_hash": "769e06139a44211b5b19d28f65f70888",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 204,
"avg_line_length": 50.72727272727273,
"alnum_prop": 0.7311827956989247,
"repo_name": "martenscs/wso2-rap",
"id": "930d62ea808051fe17b5f377891b8597576140fb",
"size": "558",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rap-hello/net.martenscs.wso2.application.hello/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "24762"
}
],
"symlink_target": ""
}
|
title: State for Terraform with Google Cloud Storage (GCS)
author: Adron Hall
date: 2017-09-28 14:35:13
template: article.jade
---
**UPDATE INLINE BELOW -** ***SEPTEMBER 29, 2017***
[Article Code/Config Repository](https://github.com/Adron/terraform-gcs-state)
I've started this process by setting up two stages for execution. The initial Terraform execution which will create the Google Cloud Storage (GCS) bucket and then the Terraform stage that will then init that bucket for Terraform State and then create a simple resource.
For phase 1 I have created a simple *connetion.tf* file that has the provider information in it.
<span class="more"></span>
```
provider "google" {
credentials = "${file("../../secrets/account-thrashingcode.json")}"
project = "thrashingcorecode"
region = "us-west1"
}
```
The next element of phase 1 is a simple resource with the storage to be created for use as the remote state management for Terraform. That file I've named *google-cloud-storage.tf* with the following contents for creating the Google Cloud Storage resource.
```
resource "google_storage_bucket" "blue-world-tf-state" {
name = "blue-world-terraform-state-test"
location = "us-west1"
}
```
This part of the process works quickly, just a few seconds. A simple `terraform apply` and the resource is created.
```
$ terraform apply
google_storage_bucket.blue-world-tf-state: Creating...
force_destroy: "" => "false"
location: "" => "US-WEST1"
name: "" => "blue-world-terraform-state"
self_link: "" => "<computed>"
storage_class: "" => "STANDARD"
url: "" => "<computed>"
google_storage_bucket.blue-world-tf-state: Creation complete (ID: blue-world-terraform-state)
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
✔ ~/Codez/terraform-gcs-state/phase1
```
***Success!***
In the phase 2 Terraform execution I've setup a *connection.tf* file for connection and declaration of GCS for the Terraform state files. The file contents looks like this.
```
provider "google" {
credentials = "${file("../../secrets/account-thrashingcode.json")}"
project = "thrashingcorecode"
region = "us-west1"
}
terraform {
backend "gcs" {
bucket = "terraform-remote-states"
path = "dev/terraform.tfstate"
project = "thrashingcorecode"
}
}
```
The resource I've setup, at least for this example, is a super simple configuration to create a default network in GCP. That configuration looks like this.
```
data "google_compute_network" "my-network" {
name = "default-us-west1"
}
```
Now when I run `terraform init` I get this error.
```
$ terraform init
Initializing the backend...
Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configuration changes.
Error refreshing state: [WARN] Error retrieving object blue-world-terraform-state/dev/terraform.tfstate: googleapi: got HTTP response code 403 with body: adronsotheremail@gmail.com does not have storage.objects.get access to blue-world-terraform-state/dev/terraform.tfstate.
```
This leaves me with a few questions.
* Where does Terraform derive the "adronsotheremail@gmail.com" email identity as the account to try to access the storage location with? It doesn't appear to actually be the same email associated to the account I created the resource with.
* If I can create the resource originally with a service account that has ownership rights in phase 1, what is it using for permissions in this particular situation? It does clearly exist as shown 
My first attempt to fix this was to go to the storage resource and add this account to insure it has permission to this resource.

Ok, so that fixed the issue, but I'm still not entirely sure why I had to add the member, when theoretically I thought I was using the connection information detailed in the *connection.tf* files in both phases right? RIGHT?
I went to RTFM at this point, to see what I might be missing. I found on the [Hashicorp Docs](https://www.terraform.io/docs/backends/types/gcs.html) some information. As I scrolled down it appeared that maybe I could use the *credentials* property for the configuration resource.

I added it as such to my configuration in the *connection.tf* file.
```
terraform {
backend "gcs" {
bucket = "blue-world-terraform-state"
path = "dev/terraform.tfstate"
project = "thrashingcorecode"
credentials = "${file("../../secrets/account-thrashingcode.json")}"
}
}
```
Now, this seems all groovy. But now I'm looking at my *connection.tf* file and the complete file looks like this.
```
provider "google" {
credentials = "${file("../../secrets/account-thrashingcode.json")}"
project = "thrashingcorecode"
region = "us-west1"
}
terraform {
backend "gcs" {
bucket = "blue-world-terraform-state"
path = "dev/terraform.tfstate"
project = "thrashingcorecode"
credentials = "${file("../../secrets/account-thrashingcode.json")}"
}
}
```
My first issue with this is I have two credentials properties and really there should just be the one, in the provider. But I digress, I'm experimenting so upwards and onward.
```
$ terraform apply
Failed to load backend: Error loading backend config: 1 error(s) occurred:
* terraform.backend: configuration cannot contain interpolations
The backend configuration is loaded by Terraform extremely early, before
the core of Terraform can be initialized. This is necessary because the backend
dictates the behavior of that core. The core is what handles interpolation
processing. Because of this, interpolations cannot be used in backend
configuration.
If you'd like to parameterize backend configuration, we recommend using
partial configuration with the "-backend-config" flag to "terraform init".
```
So yup, that's an utter failure. Let's read this. The meat of this message boils down to *"terraform.backend: configuration cannot contain interpolations"*. Ok, that I understand, the `credentials = "${file("../../secrets/account-thrashingcode.json")}"` can't be used in this particular configuration. That doesn't fix the underlying issue.
I'm not exactly sure, at this point, what is using what permission and why the permission isn't available by creating the resource and using the same service account to write into that bucket, the resource, with the contents of the Terraform state unless I go set the bucket's permissions manually. Simply, this is odd and I'm convinced I'm missing something or maybe something really is just that crazy.
If you've got any idea what's going on, ping me [@Adron](https://twitter.com/adron) if you would. I'd love to complete this automation without such a hacky fix. When I get all the pieces understood, figure out this issue, and fix it, I'll update this post ASAP with the end of this whole story!
I've also posted a question on Stackoverflow to make providing an answer easier [here](https://stackoverflow.com/questions/46495146/my-terraform-backend-state-with-google-cloud-storage-buckets-is-created-oddly-t).
**UPDATED:** ***SEPTEMBER 29, 2017***
The Stackoverflow has the update with the answer I stumbled into. I feel I was being a bit of a dummy. The Google Cloud Storage Bucket is setup with the account that I used in the `connection.tf` file. But, the storage bucket needs an ACL, or Access Control List resource, created and assigned appropriately. I needed to add that to my configuration, which I did as shown below.
```
resource "google_storage_bucket" "blue-world-tf-state" {
name = "blue-world-terraform-state"
location = "us-west1"
}
resource "google_storage_bucket_acl" "image-store-acl" {
bucket = "${google_storage_bucket.blue-world-tf-state.name}"
predefined_acl = "publicreadwrite"
}
```
The first resource I'd setup before, the second is the specific ACL that I now have setup to allow my Terraform state files to be stored there as a central repository. So the mystery is resolved, albeit I still think there ought to be some "*give the storage bucket rights per the service account*" type of creation process. But there isn't, so at least once the practice is known, one can easily move forward with that practice in play. Cheers!
**UPDATE FINI**
|
{
"content_hash": "6446534007042a7dc263230f51be2fd9",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 445,
"avg_line_length": 46.29281767955801,
"alnum_prop": 0.744718940207662,
"repo_name": "Adron/adron.github.io",
"id": "8ec97fabe4b41c893c8fb43d0fa767a93ff73e09",
"size": "8385",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_working/contents/articles/my-terraform-is-broken-in-state/index.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "948844"
},
{
"name": "CoffeeScript",
"bytes": "3301"
},
{
"name": "HTML",
"bytes": "4348293"
},
{
"name": "JavaScript",
"bytes": "1735132"
},
{
"name": "Less",
"bytes": "369008"
},
{
"name": "Pug",
"bytes": "23977"
},
{
"name": "Shell",
"bytes": "2625"
}
],
"symlink_target": ""
}
|
<?php
namespace Composer\Repository\Vcs;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor;
use Composer\Util\Perforce;
class PerforceDriver extends VcsDriver
{
protected $depot;
protected $branch;
protected $perforce;
protected $composerInfo;
protected $composerInfoIdentifier;
public function initialize()
{
$this->depot = $this->repoConfig['depot'];
$this->branch = '';
if (!empty($this->repoConfig['branch'])) {
$this->branch = $this->repoConfig['branch'];
}
$this->initPerforce($this->repoConfig);
$this->perforce->p4Login($this->io);
$this->perforce->checkStream($this->depot);
$this->perforce->writeP4ClientSpec();
$this->perforce->connectClient();
return true;
}
private function initPerforce($repoConfig)
{
if (!empty($this->perforce)) {
return;
}
$repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
$this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
}
public function getComposerInformation($identifier)
{
if (!empty($this->composerInfoIdentifier)) {
if (strcmp($identifier, $this->composerInfoIdentifier) === 0) {
return $this->composerInfo;
}
}
$composer_info = $this->perforce->getComposerInformation($identifier);
return $composer_info;
}
public function getRootIdentifier()
{
return $this->branch;
}
public function getBranches()
{
$branches = $this->perforce->getBranches();
return $branches;
}
public function getTags()
{
$tags = $this->perforce->getTags();
return $tags;
}
public function getDist($identifier)
{
return null;
}
public function getSource($identifier)
{
$source = array(
'type' => 'perforce',
'url' => $this->repoConfig['url'],
'reference' => $identifier,
'p4user' => $this->perforce->getUser(),
);
return $source;
}
public function getUrl()
{
return $this->url;
}
public function hasComposerFile($identifier)
{
$this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
$this->composerInfoIdentifier = $identifier;
return !empty($this->composerInfo);
}
public function getContents($url)
{
return false;
}
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{
if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
return Perforce::checkServerExists($url, new ProcessExecutor($io));
}
return false;
}
public function cleanup()
{
$this->perforce->cleanupClientSpec();
$this->perforce = null;
}
public function getDepot()
{
return $this->depot;
}
public function getBranch()
{
return $this->branch;
}
}
|
{
"content_hash": "c40d0ce0bfc79557b3efea3f1fe9d2e9",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 103,
"avg_line_length": 14.021621621621621,
"alnum_prop": 0.6985350809560524,
"repo_name": "FredFerri/FBSharedQuotes",
"id": "a72e9acc1e52b214f78dedcd0409ad228cc96d91",
"size": "2594",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Composer/Repository/Vcs/PerforceDriver.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "32588"
},
{
"name": "JavaScript",
"bytes": "11014"
},
{
"name": "PHP",
"bytes": "891228"
}
],
"symlink_target": ""
}
|
module PaozhoumoUser
module ApplicationHelper
end
end
|
{
"content_hash": "3d31ff07b9b41507fb30fd87f360ea4d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 14.5,
"alnum_prop": 0.8275862068965517,
"repo_name": "zhaoxiao10/paozhoumo-user",
"id": "33cc415617d2c0b8769170595a557094c709d994",
"size": "58",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/paozhoumo-user/application_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "9350"
},
{
"name": "Ruby",
"bytes": "10324"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "af2887b7fb27507357afb3dbbba8f2d1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "d7d8e16f28c74d35ae204d4e73f0b442ca8c8bf5",
"size": "174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Pteridophyta/Psilotopsida/Ophioglossales/Ophioglossaceae/Botrychium/Botrychium negeri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
package org.ligboy.android.utils;
import android.Manifest;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresPermission;
import android.support.annotation.WorkerThread;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* Network Util
* @author Ligboy.Liu ligboy@gmail.com.
*/
public final class NetworkUtil {
private NetworkUtil() {
throw new IllegalAccessError();
}
/**
* Check network connectivity.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
* @param context to use to check for network connectivity.
* @return true if connected, false otherwise.
*/
@RequiresPermission(allOf = {Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.INTERNET})
public static boolean isConnected(@NonNull Context context) {
ConnectivityManager connectivityManager
= (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected();
}
/**
* Returns the address of a host according to the given host string name host.
* The host string may be either a machine name or a dotted string IP address.
* If the latter, the hostName field is determined upon demand.
* host can be null which means that an address of the loopback interface is returned.
* @param host he hostName to be resolved to an address or null.
* @return address of the host
*/
@Nullable
@WorkerThread
@RequiresPermission(Manifest.permission.INTERNET)
public static String resolveDomainName(@Nullable String host) {
try {
InetAddress inetAddress = InetAddress.getByName(host);
return inetAddress.getHostAddress();
} catch (UnknownHostException ignored) {
}
return null;
}
/**
* Get local IPv4 internet address
* @return Local IPv4 internet address
*/
@Nullable
public static String getLocalHostIpv4Address() {
List<InetAddress> localInetAddress = getLocalHostAddress();
for (InetAddress inetAddres : localInetAddress) {
if (inetAddres instanceof Inet4Address) {
return inetAddres.getHostAddress();
}
}
return null;
}
/**
* Get local IPv6 internet address
* @return Local IPv6 internet address
*/
@Nullable
public static String getLocalHostIpv6Address() {
List<InetAddress> localInetAddress = getLocalHostAddress();
for (InetAddress inetAddres : localInetAddress) {
if (inetAddres instanceof Inet6Address) {
return inetAddres.getHostAddress();
}
}
return null;
}
/**
* Get local internet address
* @return Local internet address
*/
@NonNull
public static List<InetAddress> getLocalHostAddress() {
List<InetAddress> inetAddressList = new ArrayList<>();
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (!inetAddress.isLoopbackAddress() && !inetAddress.isLinkLocalAddress() && !inetAddress.isAnyLocalAddress()) {
inetAddressList.add(inetAddress);
}
}
}
} catch (SocketException ignored) {
}
return inetAddressList;
}
/**
* Detects whether or not IPv6 is supported
* @return true - IPv6 supported
*/
public static boolean isIpv6Supported() {
List<InetAddress> localInetAddress = getLocalHostAddress();
for (InetAddress localInetAddres : localInetAddress) {
if (localInetAddres instanceof Inet6Address) {
return true;
}
}
return false;
}
}
|
{
"content_hash": "03fa67ed05704dd14cf3481542242af9",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 132,
"avg_line_length": 34.9264705882353,
"alnum_prop": 0.6644210526315789,
"repo_name": "ligboy/android-utils",
"id": "22331821ac8150b94c5079d95d2d4e3cc26cfed0",
"size": "4750",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "utils/src/main/java/org/ligboy/android/utils/NetworkUtil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "46101"
}
],
"symlink_target": ""
}
|
package sc10dw.distributed.cw2.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import sc10dw.distributed.cw2.*;
/**
* @author sc10dw
* Servlet which searches for employees and presents informatiob
* about found employees.
*/
public class EmployeeInformation extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(Config.HTTP_CONTENT_TYPE);
PrintWriter out = response.getWriter();
String employeeObjectName = request.getParameter("surname");
List<Employee> employees = getEmployees(employeeObjectName);
if (employees.size() > 0) {
out.println("<html>\n\n<head>\n\t<title>Employee Information</title>\n</head>\n\n");
out.println("\t<body>");
out.println("\t\t<h1>" + employees.size() + " Employee(s) Found</h1>");
out.println("\t\t<table>");
for (Employee emp : employees) {
out.println("\t\t<tr><th>Name</th><td>" + emp.getForename() + " " + emp.getSurname() + "</td></tr>");
out.println("\t\t<tr><th>Hourly Rate</th><td>" + emp.getHourlyRate() + "</td></tr>");
out.println("\t\t<tr><th>Hours per Week</th><td>" + emp.getNumberHours() + "</td></tr>");
out.println("\t\t<tr><th>Total Earnings per Week</th><td>" + emp.getWeeklyEarning() + "</td></tr>");
out.println("\t\t<tr><tr>");
}
out.println("\t\t</table>");
out.println("\t\t<a href='" + Config.ROOT_URL + "'><button type='button'>Back to Main Page</button></a>");
out.println("\t</body>\n\n</html>");
} else {
out.println("<html>\n\n<head>\n\t<title>Employee Not Found</title>\n</head>\n\n");
out.println("\t<body>\n\t\t<h1>Employee Not Found</h1>");
out.println("\t\t<p>Employee with object name '" + employeeObjectName + "' not found.</p>");
out.println("\t\t<a href='" + Config.ROOT_URL + "'><button type='button'>Back to Main Page</button></a>");
out.println("\t</body>\n\n</html>");
}
out.close();
}
/**
* Find existing employees with a specific surname.,
* @param surname Surname of desired employees to retrieve
* @return List of employees who have the given surname
*/
private List<Employee> getEmployees(String surname) {
try {
Registry registry = LocateRegistry.getRegistry();
EmployeeFactory employeeFactory = (EmployeeFactory)registry.lookup("employee_factory");
return employeeFactory.getEmployee(surname);
} catch (Exception e) {
return new ArrayList<Employee>();
}
}
}
|
{
"content_hash": "b9959d5084f5e8c25812f7bc75ac6997",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 109,
"avg_line_length": 37.41095890410959,
"alnum_prop": 0.6770413767850604,
"repo_name": "DonaldWhyte/distributed-systems-coursework",
"id": "a143732a3d9599a7c2004598cd2f8d50889b4f62",
"size": "2731",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DistributedSystemsCW2/src/sc10dw/distributed/cw2/web/EmployeeInformation.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "36829"
}
],
"symlink_target": ""
}
|
/* See license.txt for terms of usage */
define([
"firebug/firefox/xpcom",
"firebug/lib/trace",
"firebug/lib/deprecated",
"firebug/js/stackFrame",
],
function(Xpcom, FBTrace, Deprecated, StackFrame) {
// ********************************************************************************************* //
// Constants
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const NS_SEEK_SET = Ci.nsISeekableStream.NS_SEEK_SET;
const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var Http = {};
// ********************************************************************************************* //
// Module Implementation
Http.readFromStream = function(stream, charset, noClose)
{
var sis = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream);
sis.setInputStream(stream);
var segments = [];
for (var count = stream.available(); count; count = stream.available())
segments.push(sis.readBytes(count));
if (!noClose)
sis.close();
var text = segments.join("");
try
{
return Http.convertToUnicode(text, charset);
}
catch (err)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("httpLib.readFromStream EXCEPTION charset: " + charset, err);
}
return text;
};
Http.readPostTextFromPage = function(url, context)
{
if (url == context.browser.contentWindow.location.href)
{
try
{
var webNav = context.browser.webNavigation;
var descriptor = (webNav instanceof Ci.nsIWebPageDescriptor) ?
webNav.currentDescriptor : null;
if (!(descriptor instanceof Ci.nsISHEntry))
return;
var entry = descriptor;
if (entry && entry.postData)
{
if (!(entry.postData instanceof Ci.nsISeekableStream))
return;
var postStream = entry.postData;
postStream.seek(NS_SEEK_SET, 0);
var charset = context.window.document.characterSet;
return Http.readFromStream(postStream, charset, true);
}
}
catch (exc)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("httpLib.readPostText FAILS, url:"+url, exc);
}
}
};
Http.getResource = function(aURL)
{
try
{
var channel = ioService.newChannel(aURL, null, null);
var input = channel.open();
return Http.readFromStream(input);
}
catch (e)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("lib.getResource FAILS for \'"+aURL+"\'", e);
}
};
Http.readPostTextFromRequest = function(request, context)
{
try
{
var is = (request instanceof Ci.nsIUploadChannel) ? request.uploadStream : null;
if (is)
{
if (!(is instanceof Ci.nsISeekableStream))
return;
var ss = is;
var prevOffset;
if (ss)
{
prevOffset = ss.tell();
ss.seek(NS_SEEK_SET, 0);
}
// Read data from the stream..
var charset = (context && context.window) ? context.window.document.characterSet : null;
var text = Http.readFromStream(is, charset, true);
// Seek locks the file so, seek to the beginning only if necko hasn't read it yet,
// since necko doesn't seek to 0 before reading (at lest not till 459384 is fixed).
if (ss && prevOffset == 0)
ss.seek(NS_SEEK_SET, 0);
return text;
}
}
catch(exc)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("httpLib.readPostTextFromRequest FAILS ", exc);
}
return null;
};
Http.getInputStreamFromString = function(dataString)
{
var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].
createInstance(Ci.nsIStringInputStream);
if ("data" in stringStream) // Gecko 1.9 or newer
stringStream.data = dataString;
else // 1.8 or older
stringStream.setData(dataString, dataString.length);
return stringStream;
};
Http.getWindowForRequest = function(request)
{
var loadContext = Http.getRequestLoadContext(request);
try
{
if (loadContext)
return loadContext.associatedWindow;
}
catch (ex)
{
}
return null;
};
Http.getRequestLoadContext = function(request)
{
try
{
if (request && request.notificationCallbacks)
{
StackFrame.suspendShowStackTrace();
return request.notificationCallbacks.getInterface(Ci.nsILoadContext);
}
}
catch (exc)
{
}
finally
{
StackFrame.resumeShowStackTrace();
}
try
{
if (request && request.loadGroup && request.loadGroup.notificationCallbacks)
{
StackFrame.suspendShowStackTrace();
return request.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext);
}
}
catch (exc)
{
}
finally
{
StackFrame.resumeShowStackTrace();
}
return null;
};
Http.getRequestWebProgress = Deprecated.deprecated("Use getRequestLoadContext function",
Http.getRequestLoadContext);
// ********************************************************************************************* //
// HTTP Channel Fields
Http.safeGetRequestName = function(request)
{
try
{
return request.name;
}
catch (exc)
{
}
return null;
}
Http.safeGetURI = function(browser)
{
try
{
return browser.currentURI;
}
catch (exc)
{
}
return null;
}
Http.safeGetContentType = function(request)
{
try
{
return new String(request.contentType).toLowerCase();
}
catch (err)
{
}
return null;
}
// ********************************************************************************************* //
// IP Adress and port number (Requires Gecko 5).
Http.safeGetLocalAddress = function(request)
{
try
{
if (request instanceof Ci.nsIHttpChannelInternal)
return request.localAddress;
}
catch (err)
{
}
return null;
}
Http.safeGetLocalPort = function(request)
{
try
{
if (request instanceof Ci.nsIHttpChannelInternal)
return request.localPort;
}
catch (err)
{
}
return null;
}
Http.safeGetRemoteAddress = function(request)
{
try
{
if (request instanceof Ci.nsIHttpChannelInternal)
return request.remoteAddress;
}
catch (err)
{
}
return null;
}
Http.safeGetRemotePort = function(request)
{
try
{
if (request instanceof Ci.nsIHttpChannelInternal)
return request.remotePort;
}
catch (err)
{
}
return null;
}
// ********************************************************************************************* //
// XHR
Http.isXHR = function(request)
{
try
{
var callbacks = request.notificationCallbacks;
StackFrame.suspendShowStackTrace();
var xhrRequest = callbacks ? callbacks.getInterface(Ci.nsIXMLHttpRequest) : null;
return (xhrRequest != null);
}
catch (exc)
{
}
finally
{
StackFrame.resumeShowStackTrace();
}
return false;
},
// ********************************************************************************************* //
// Conversions
Http.convertToUnicode = function(text, charset)
{
if (!text)
return "";
try
{
var conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"].getService(
Ci.nsIScriptableUnicodeConverter);
conv.charset = charset ? charset : "UTF-8";
return conv.ConvertToUnicode(text);
}
catch (exc)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("lib.convertToUnicode: fails: for charset "+charset+" conv.charset:"+
conv.charset+" exc: "+exc, exc);
// the exception is worthless, make up a new one
throw new Error("Firebug failed to convert to unicode using charset: "+conv.charset+
" in @mozilla.org/intl/scriptableunicodeconverter");
}
};
Http.convertFromUnicode = function(text, charset)
{
if (!text)
return "";
try
{
var conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(
Ci.nsIScriptableUnicodeConverter);
conv.charset = charset ? charset : "UTF-8";
return conv.ConvertFromUnicode(text);
}
catch (exc)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("lib.convertFromUnicode: fails: for charset "+charset+" conv.charset:"+
conv.charset+" exc: "+exc, exc);
}
};
// ************************************************************************************************
// Network Tracing
Http.getStateDescription = function(flag)
{
var state = [];
var nsIWebProgressListener = Ci.nsIWebProgressListener;
if (flag & nsIWebProgressListener.STATE_START) state.push("STATE_START");
else if (flag & nsIWebProgressListener.STATE_REDIRECTING) state.push("STATE_REDIRECTING");
else if (flag & nsIWebProgressListener.STATE_TRANSFERRING) state.push("STATE_TRANSFERRING");
else if (flag & nsIWebProgressListener.STATE_NEGOTIATING) state.push("STATE_NEGOTIATING");
else if (flag & nsIWebProgressListener.STATE_STOP) state.push("STATE_STOP");
if (flag & nsIWebProgressListener.STATE_IS_REQUEST) state.push("STATE_IS_REQUEST");
if (flag & nsIWebProgressListener.STATE_IS_DOCUMENT) state.push("STATE_IS_DOCUMENT");
if (flag & nsIWebProgressListener.STATE_IS_NETWORK) state.push("STATE_IS_NETWORK");
if (flag & nsIWebProgressListener.STATE_IS_WINDOW) state.push("STATE_IS_WINDOW");
if (flag & nsIWebProgressListener.STATE_RESTORING) state.push("STATE_RESTORING");
if (flag & nsIWebProgressListener.STATE_IS_INSECURE) state.push("STATE_IS_INSECURE");
if (flag & nsIWebProgressListener.STATE_IS_BROKEN) state.push("STATE_IS_BROKEN");
if (flag & nsIWebProgressListener.STATE_IS_SECURE) state.push("STATE_IS_SECURE");
if (flag & nsIWebProgressListener.STATE_SECURE_HIGH) state.push("STATE_SECURE_HIGH");
if (flag & nsIWebProgressListener.STATE_SECURE_MED) state.push("STATE_SECURE_MED");
if (flag & nsIWebProgressListener.STATE_SECURE_LOW) state.push("STATE_SECURE_LOW");
return state.join(", ");
};
Http.getStatusDescription = function(status)
{
var nsISocketTransport = Ci.nsISocketTransport;
var nsITransport = Ci.nsITransport;
if (status == nsISocketTransport.STATUS_RESOLVING) return "STATUS_RESOLVING";
if (status == nsISocketTransport.STATUS_CONNECTING_TO) return "STATUS_CONNECTING_TO";
if (status == nsISocketTransport.STATUS_CONNECTED_TO) return "STATUS_CONNECTED_TO";
if (status == nsISocketTransport.STATUS_SENDING_TO) return "STATUS_SENDING_TO";
if (status == nsISocketTransport.STATUS_WAITING_FOR) return "STATUS_WAITING_FOR";
if (status == nsISocketTransport.STATUS_RECEIVING_FROM) return "STATUS_RECEIVING_FROM";
if (status == nsITransport.STATUS_READING) return "STATUS_READING";
if (status == nsITransport.STATUS_WRITING) return "STATUS_WRITING";
};
Http.getLoadFlagsDescription = function(loadFlags)
{
var flags = [];
var nsIChannel = Ci.nsIChannel;
var nsICachingChannel = Ci.nsICachingChannel;
if (loadFlags & nsIChannel.LOAD_DOCUMENT_URI) flags.push("LOAD_DOCUMENT_URI");
if (loadFlags & nsIChannel.LOAD_RETARGETED_DOCUMENT_URI) flags.push("LOAD_RETARGETED_DOCUMENT_URI");
if (loadFlags & nsIChannel.LOAD_REPLACE) flags.push("LOAD_REPLACE");
if (loadFlags & nsIChannel.LOAD_INITIAL_DOCUMENT_URI) flags.push("LOAD_INITIAL_DOCUMENT_URI");
if (loadFlags & nsIChannel.LOAD_TARGETED) flags.push("LOAD_TARGETED");
if (loadFlags & nsIChannel.LOAD_CALL_CONTENT_SNIFFERS) flags.push("LOAD_CALL_CONTENT_SNIFFERS");
if (loadFlags & nsICachingChannel.LOAD_NO_NETWORK_IO) flags.push("LOAD_NO_NETWORK_IO");
if (loadFlags & nsICachingChannel.LOAD_CHECK_OFFLINE_CACHE) flags.push("LOAD_CHECK_OFFLINE_CACHE");
if (loadFlags & nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE) flags.push("LOAD_BYPASS_LOCAL_CACHE");
if (loadFlags & nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY) flags.push("LOAD_BYPASS_LOCAL_CACHE_IF_BUSY");
if (loadFlags & nsICachingChannel.LOAD_ONLY_FROM_CACHE) flags.push("LOAD_ONLY_FROM_CACHE");
if (loadFlags & nsICachingChannel.LOAD_ONLY_IF_MODIFIED) flags.push("LOAD_ONLY_IF_MODIFIED");
return flags.join(", ");
};
// ********************************************************************************************* //
Http.BaseProgressListener =
{
QueryInterface : function(iid)
{
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
{
return this;
}
throw Components.results.NS_NOINTERFACE;
},
stateIsRequest: false,
onLocationChange: function() {},
onStateChange : function() {},
onProgressChange : function() {},
onStatusChange : function() {},
onSecurityChange : function() {},
onLinkIconAvailable : function() {}
};
// ********************************************************************************************* //
// Registration
return Http;
// ********************************************************************************************* //
});
|
{
"content_hash": "a72f2f561aa0cb40e71ef39608d0ca2a",
"timestamp": "",
"source": "github",
"line_count": 473,
"max_line_length": 117,
"avg_line_length": 29.801268498942918,
"alnum_prop": 0.5683172531214529,
"repo_name": "mdks/Firebug-Mod-Element-Mover",
"id": "b2ed66a7f059497adb32766040ff9087081b7751",
"size": "14096",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "content/firebug/net/httpLib.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "12491091"
},
{
"name": "PHP",
"bytes": "9082"
},
{
"name": "Ruby",
"bytes": "6070"
},
{
"name": "Shell",
"bytes": "371"
}
],
"symlink_target": ""
}
|
import json
import os
import socket
from datetime import datetime, timedelta
from decimal import Decimal
from django.conf import settings
from django.core import mail
from django.core.files.storage import default_storage as storage
import jingo
import mock
import waffle
from jingo.helpers import datetime as datetime_filter
from nose import SkipTest
from nose.plugins.attrib import attr
from nose.tools import assert_not_equal, assert_raises, eq_
from PIL import Image
from pyquery import PyQuery as pq
from tower import strip_whitespace
# Unused, but needed so that we can patch jingo.
from waffle import helpers
import amo
import amo.tests
import files
import paypal
from addons.models import (Addon, AddonCategory, AddonUpsell, AddonUser,
Category, Charity)
from amo.helpers import (absolutify, babel_datetime, url as url_reverse,
timesince)
from amo.tests import (addon_factory, assert_no_validation_errors, formset,
initial)
from amo.tests.test_helpers import get_image_path
from amo.urlresolvers import reverse
from applications.models import Application, AppVersion
from devhub.forms import ContribForm
from devhub.models import ActivityLog, BlogPost, SubmitStep
from devhub import tasks
from files.models import File, FileUpload, Platform
from files.tests.test_models import UploadTest as BaseUploadTest
from market.models import AddonPremium, Price, Refund
from reviews.models import Review
from stats.models import Contribution
from translations.models import Translation
from users.models import UserProfile
from versions.models import ApplicationsVersions, License, Version
class HubTest(amo.tests.TestCase):
fixtures = ['browse/nameless-addon', 'base/users']
def setUp(self):
self.url = reverse('devhub.index')
assert self.client.login(username='regular@mozilla.com',
password='password')
eq_(self.client.get(self.url).status_code, 200)
self.user_profile = UserProfile.objects.get(id=999)
def clone_addon(self, num, addon_id=57132):
ids = []
for i in range(num):
addon = Addon.objects.get(id=addon_id)
data = dict(type=addon.type, status=addon.status,
name='cloned-addon-%s-%s' % (addon_id, i))
new_addon = Addon.objects.create(**data)
AddonUser.objects.create(user=self.user_profile, addon=new_addon)
ids.append(new_addon.id)
return ids
class TestNav(HubTest):
def test_navbar(self):
r = self.client.get(self.url)
doc = pq(r.content)
eq_(doc('#site-nav').length, 1)
def test_no_addons(self):
"""Check that no add-ons are displayed for this user."""
r = self.client.get(self.url)
doc = pq(r.content)
assert_not_equal(
doc('#navbar ul li.top a').eq(0).text(),
'My Add-ons',
'My Add-ons menu should not be visible if user has no add-ons.')
def test_my_addons(self):
"""Check that the correct items are listed for the My Add-ons menu."""
# Assign this add-on to the current user profile.
addon = Addon.objects.get(id=57132)
addon.name = 'Test'
addon.save()
AddonUser.objects.create(user=self.user_profile, addon=addon)
r = self.client.get(self.url)
doc = pq(r.content)
# Check the anchor for the 'My Add-ons' menu item.
eq_(doc('#site-nav ul li.top a').eq(0).text(), 'My Add-ons')
# Check the anchor for the single add-on.
eq_(doc('#site-nav ul li.top li a').eq(0).attr('href'),
addon.get_dev_url())
# Create 6 add-ons.
self.clone_addon(6)
r = self.client.get(self.url)
doc = pq(r.content)
# There should be 8 items in this menu.
eq_(doc('#site-nav ul li.top').eq(0).find('ul li').length, 8)
# This should be the 8th anchor, after the 7 addons.
eq_(doc('#site-nav ul li.top').eq(0).find('li a').eq(7).text(),
'Submit a New Add-on')
self.clone_addon(1)
r = self.client.get(self.url)
doc = pq(r.content)
eq_(doc('#site-nav ul li.top').eq(0).find('li a').eq(7).text(),
'more add-ons...')
def test_only_one_header(self):
# For bug 682359.
# Remove this test when we switch to Impala in the devhub!
doc = pq(self.client.get(reverse('devhub.addons')).content)
# Make sure we're on a non-impala page.
eq_(doc('.is-impala').length, 0,
'This test should be run on a non-impala page.')
eq_(doc('#header').length, 0, 'Uh oh, there are two headers!')
class TestDashboard(HubTest):
def setUp(self):
super(TestDashboard, self).setUp()
self.url = reverse('devhub.addons')
self.apps_url = reverse('devhub.apps')
self.themes_url = reverse('devhub.themes')
eq_(self.client.get(self.url).status_code, 200)
def test_addons_layout(self):
doc = pq(self.client.get(self.url).content)
eq_(doc('title').text(),
'Manage My Submissions :: Developer Hub :: Add-ons for Firefox')
eq_(doc('#social-footer').length, 1)
eq_(doc('#copyright').length, 1)
eq_(doc('#footer-links .mobile-link').length, 0)
def get_action_links(self, addon_id):
r = self.client.get(self.url)
doc = pq(r.content)
links = [a.text.strip() for a in
doc('.item[data-addonid=%s] .item-actions li > a' % addon_id)]
return links
def test_no_addons(self):
"""Check that no add-ons are displayed for this user."""
r = self.client.get(self.url)
doc = pq(r.content)
eq_(doc('.item item').length, 0)
def test_addon_pagination(self):
"""Check that the correct info. is displayed for each add-on:
namely, that add-ons are paginated at 10 items per page, and that
when there is more than one page, the 'Sort by' header and pagination
footer appear.
"""
# Create 10 add-ons.
self.clone_addon(10)
r = self.client.get(self.url)
doc = pq(r.content)
eq_(len(doc('.item .item-info')), 10)
eq_(doc('nav.paginator').length, 0)
# Create 5 add-ons.
self.clone_addon(5)
r = self.client.get(self.url, dict(page=2))
doc = pq(r.content)
eq_(len(doc('.item .item-info')), 5)
eq_(doc('nav.paginator').length, 1)
def test_themes(self):
"""Check themes show on dashboard."""
# Create 2 themes.
self.create_flag(name='submit-personas')
for x in range(2):
addon = addon_factory(type=amo.ADDON_PERSONA)
AddonUser.objects.create(user=self.user_profile, addon=addon)
r = self.client.get(self.themes_url)
doc = pq(r.content)
eq_(len(doc('.item .item-info')), 2)
def test_show_hide_statistics(self):
a_pk = self.clone_addon(1)[0]
# when Active and Public show statistics
Addon.objects.get(pk=a_pk).update(disabled_by_user=False,
status=amo.STATUS_PUBLIC)
links = self.get_action_links(a_pk)
assert 'Statistics' in links, ('Unexpected: %r' % links)
# when Active and Incomplete hide statistics
Addon.objects.get(pk=a_pk).update(disabled_by_user=False,
status=amo.STATUS_NULL)
links = self.get_action_links(a_pk)
assert 'Statistics' not in links, ('Unexpected: %r' % links)
def test_public_addon(self):
addon = Addon.objects.get(id=self.clone_addon(1)[0])
eq_(addon.status, amo.STATUS_PUBLIC)
doc = pq(self.client.get(self.url).content)
item = doc('.item[data-addonid=%s]' % addon.id)
eq_(item.find('h3 a').attr('href'), addon.get_dev_url())
assert item.find('p.downloads'), 'Expected weekly downloads'
assert item.find('p.users'), 'Expected ADU'
assert item.find('.item-details'), 'Expected item details'
assert not item.find('p.incomplete'), (
'Unexpected message about incomplete add-on')
def test_incomplete_addon(self):
waffle.models.Switch.objects.create(name='marketplace', active=True)
addon = Addon.objects.get(id=self.clone_addon(1)[0])
addon.update(status=amo.STATUS_NULL)
doc = pq(self.client.get(self.url).content)
item = doc('.item[data-addonid=%s]' % addon.id)
assert not item.find('h3 a'), 'Unexpected link to add-on'
assert not item.find('.item-details'), 'Unexpected item details'
assert not item.find('.price'), 'Expected price'
assert item.find('p.incomplete'), (
'Expected message about incompleted add-on')
def test_dev_news(self):
self.clone_addon(1) # We need one to see this module
for i in xrange(7):
bp = BlogPost(title='hi %s' % i,
date_posted=datetime.now() - timedelta(days=i))
bp.save()
r = self.client.get(self.url)
doc = pq(r.content)
eq_(doc('.blog-posts').length, 1)
eq_(doc('.blog-posts li').length, 5)
eq_(doc('.blog-posts li a').eq(0).text(), "hi 0")
eq_(doc('.blog-posts li a').eq(4).text(), "hi 4")
def test_sort_created_filter(self):
a_pk = self.clone_addon(1)[0]
addon = Addon.objects.get(pk=a_pk)
response = self.client.get(self.url + '?sort=created')
doc = pq(response.content)
eq_(doc('.item-details').length, 1)
d = doc('.item-details .date-created')
eq_(d.length, 1)
eq_(d.remove('strong').text(),
strip_whitespace(datetime_filter(addon.created)))
def test_sort_updated_filter(self):
a_pk = self.clone_addon(1)[0]
addon = Addon.objects.get(pk=a_pk)
response = self.client.get(self.url)
doc = pq(response.content)
eq_(doc('.item-details').length, 1)
d = doc('.item-details .date-updated')
eq_(d.length, 1)
eq_(d.remove('strong').text(),
strip_whitespace(datetime_filter(addon.last_updated)))
class TestUpdateCompatibility(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_4594_a9',
'base/addon_3615']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
self.url = reverse('devhub.addons')
# TODO(andym): use Mock appropriately here.
self._versions = amo.FIREFOX.latest_version, amo.MOBILE.latest_version
amo.FIREFOX.latest_version = amo.MOBILE.latest_version = '3.6.15'
def tearDown(self):
amo.FIREFOX.latest_version, amo.MOBILE.latest_version = self._versions
def test_no_compat(self):
self.client.logout()
assert self.client.login(username='admin@mozilla.com',
password='password')
r = self.client.get(self.url)
doc = pq(r.content)
assert not doc('.item[data-addonid=4594] li.compat')
a = Addon.objects.get(pk=4594)
r = self.client.get(reverse('devhub.ajax.compat.update',
args=[a.slug, a.current_version.id]))
eq_(r.status_code, 404)
r = self.client.get(reverse('devhub.ajax.compat.status',
args=[a.slug]))
eq_(r.status_code, 404)
def test_compat(self):
a = Addon.objects.get(pk=3615)
r = self.client.get(self.url)
doc = pq(r.content)
cu = doc('.item[data-addonid=3615] .tooltip.compat-update')
assert cu
update_url = reverse('devhub.ajax.compat.update',
args=[a.slug, a.current_version.id])
eq_(cu.attr('data-updateurl'), update_url)
status_url = reverse('devhub.ajax.compat.status', args=[a.slug])
eq_(doc('.item[data-addonid=3615] li.compat').attr('data-src'),
status_url)
assert doc('.item[data-addonid=3615] .compat-update-modal')
def test_incompat_firefox(self):
versions = ApplicationsVersions.objects.all()[0]
versions.max = AppVersion.objects.get(version='2.0')
versions.save()
doc = pq(self.client.get(self.url).content)
assert doc('.item[data-addonid=3615] .tooltip.compat-error')
def test_incompat_mobile(self):
app = Application.objects.get(id=amo.MOBILE.id)
appver = AppVersion.objects.get(version='2.0')
appver.update(application=app)
av = ApplicationsVersions.objects.all()[0]
av.application = app
av.max = appver
av.save()
doc = pq(self.client.get(self.url).content)
assert doc('.item[data-addonid=3615] .tooltip.compat-error')
class TestDevRequired(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.get_url = self.addon.get_dev_url('payments')
self.post_url = self.addon.get_dev_url('payments.disable')
assert self.client.login(username='del@icio.us', password='password')
self.au = AddonUser.objects.get(user__email='del@icio.us',
addon=self.addon)
eq_(self.au.role, amo.AUTHOR_ROLE_OWNER)
def test_anon(self):
self.client.logout()
r = self.client.get(self.get_url, follow=True)
login = reverse('users.login')
self.assertRedirects(r, '%s?to=%s' % (login, self.get_url))
def test_dev_get(self):
eq_(self.client.get(self.get_url).status_code, 200)
def test_dev_post(self):
self.assertRedirects(self.client.post(self.post_url), self.get_url)
def test_viewer_get(self):
self.au.role = amo.AUTHOR_ROLE_VIEWER
self.au.save()
eq_(self.client.get(self.get_url).status_code, 200)
def test_viewer_post(self):
self.au.role = amo.AUTHOR_ROLE_VIEWER
self.au.save()
eq_(self.client.post(self.get_url).status_code, 403)
def test_disabled_post_dev(self):
self.addon.update(status=amo.STATUS_DISABLED)
eq_(self.client.post(self.get_url).status_code, 403)
def test_disabled_post_admin(self):
self.addon.update(status=amo.STATUS_DISABLED)
assert self.client.login(username='admin@mozilla.com',
password='password')
self.assertRedirects(self.client.post(self.post_url), self.get_url)
class TestVersionStats(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
assert self.client.login(username='admin@mozilla.com',
password='password')
def test_counts(self):
addon = Addon.objects.get(id=3615)
version = addon.current_version
user = UserProfile.objects.get(email='admin@mozilla.com')
for _ in range(10):
Review.objects.create(addon=addon, user=user,
version=addon.current_version)
url = reverse('devhub.versions.stats', args=[addon.slug])
r = json.loads(self.client.get(url).content)
exp = {str(version.id):
{'reviews': 10, 'files': 1, 'version': version.version,
'id': version.id}}
self.assertDictEqual(r, exp)
class TestEditPayments(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = self.get_addon()
self.addon.the_reason = self.addon.the_future = '...'
self.addon.save()
self.foundation = Charity.objects.create(
id=amo.FOUNDATION_ORG, name='moz', url='$$.moz', paypal='moz.pal')
self.url = self.addon.get_dev_url('payments')
assert self.client.login(username='del@icio.us', password='password')
self.paypal_mock = mock.Mock()
self.paypal_mock.return_value = (True, None)
paypal.check_paypal_id = self.paypal_mock
def get_addon(self):
return Addon.objects.no_cache().get(id=3615)
def post(self, *args, **kw):
d = dict(*args, **kw)
eq_(self.client.post(self.url, d).status_code, 302)
def check(self, **kw):
addon = self.get_addon()
for k, v in kw.items():
eq_(getattr(addon, k), v)
assert addon.wants_contributions
assert addon.takes_contributions
def test_logging(self):
count = ActivityLog.objects.all().count()
self.post(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
eq_(ActivityLog.objects.all().count(), count + 1)
def test_success_dev(self):
self.post(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
self.check(paypal_id='greed@dev', suggested_amount=2,
annoying=amo.CONTRIB_AFTER)
def test_success_foundation(self):
self.post(recipient='moz', suggested_amount=2,
annoying=amo.CONTRIB_ROADBLOCK)
self.check(paypal_id='', suggested_amount=2,
charity=self.foundation, annoying=amo.CONTRIB_ROADBLOCK)
def test_success_charity(self):
d = dict(recipient='org', suggested_amount=11.5,
annoying=amo.CONTRIB_PASSIVE)
d.update({'charity-name': 'fligtar fund',
'charity-url': 'http://feed.me',
'charity-paypal': 'greed@org'})
self.post(d)
self.check(paypal_id='', suggested_amount=Decimal('11.50'),
charity=Charity.objects.get(name='fligtar fund'))
@mock.patch('devhub.views.client')
def test_success_solitude(self, client):
self.create_flag(name='solitude-payments')
self.post(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
eq_(client.create_seller_paypal.call_args[0][0], self.addon)
eq_(client.patch_seller_paypal.call_args[1]['data'],
{'paypal_id': u'greed@dev'})
@mock.patch('devhub.views.client')
def test_success_solitude_charity(self, client):
self.create_flag(name='solitude-payments')
d = dict(recipient='org', suggested_amount=11.5,
annoying=amo.CONTRIB_PASSIVE)
d.update({'charity-name': 'fligtar fund',
'charity-url': 'http://feed.me',
'charity-paypal': 'greed@org'})
self.post(d)
eq_(client.create_seller_paypal.call_args[0][0], self.addon)
eq_(client.patch_seller_paypal.call_args[1]['data'],
{'paypal_id': u'greed@org'})
@mock.patch('devhub.views.client')
def test_uses_solitude(self, client):
self.create_flag(name='solitude-payments')
self.addon.update(charity=self.foundation)
client.get_seller_paypal_if_exists.return_value = {'paypal_id': 'f@f'}
res = self.client.get(self.url)
eq_(res.context['addon'].paypal_id, 'f@f')
eq_(res.context['contrib_form'].initial['paypal_id'], 'f@f')
@mock.patch('devhub.views.client')
def test_uses_solitude_missing(self, client):
self.create_flag(name='solitude-payments')
client.get_seller_paypal_if_exists.return_value = None
res = self.client.get(self.url)
eq_(res.context['addon'].paypal_id, '')
def test_dev_paypal_id_length(self):
r = self.client.get(self.url)
doc = pq(r.content)
eq_(int(doc('#id_paypal_id').attr('size')), 50)
def test_dev_paypal_reqd(self):
d = dict(recipient='dev', suggested_amount=2,
annoying=amo.CONTRIB_PASSIVE)
r = self.client.post(self.url, d)
self.assertFormError(r, 'contrib_form', 'paypal_id',
'PayPal ID required to accept contributions.')
def test_bad_paypal_id_dev(self):
self.paypal_mock.return_value = False, 'error'
d = dict(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
r = self.client.post(self.url, d)
self.assertFormError(r, 'contrib_form', 'paypal_id', 'error')
def test_bad_paypal_id_charity(self):
self.paypal_mock.return_value = False, 'error'
d = dict(recipient='org', suggested_amount=11.5,
annoying=amo.CONTRIB_PASSIVE)
d.update({'charity-name': 'fligtar fund',
'charity-url': 'http://feed.me',
'charity-paypal': 'greed@org'})
r = self.client.post(self.url, d)
self.assertFormError(r, 'charity_form', 'paypal', 'error')
def test_paypal_timeout(self):
self.paypal_mock.side_effect = socket.timeout()
d = dict(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
r = self.client.post(self.url, d)
self.assertFormError(r, 'contrib_form', 'paypal_id',
'Could not validate PayPal id.')
def test_max_suggested_amount(self):
too_much = settings.MAX_CONTRIBUTION + 1
msg = ('Please enter a suggested amount less than $%d.' %
settings.MAX_CONTRIBUTION)
r = self.client.post(self.url, {'suggested_amount': too_much})
self.assertFormError(r, 'contrib_form', 'suggested_amount', msg)
def test_neg_suggested_amount(self):
msg = 'Please enter a suggested amount greater than 0.'
r = self.client.post(self.url, {'suggested_amount': -1})
self.assertFormError(r, 'contrib_form', 'suggested_amount', msg)
def test_charity_details_reqd(self):
d = dict(recipient='org', suggested_amount=11.5,
annoying=amo.CONTRIB_PASSIVE)
r = self.client.post(self.url, d)
self.assertFormError(r, 'charity_form', 'name',
'This field is required.')
eq_(self.get_addon().suggested_amount, None)
def test_switch_charity_to_dev(self):
self.test_success_charity()
self.test_success_dev()
eq_(self.get_addon().charity, None)
eq_(self.get_addon().charity_id, None)
def test_switch_charity_to_foundation(self):
self.test_success_charity()
self.test_success_foundation()
# This will break if we start cleaning up licenses.
old_charity = Charity.objects.get(name='fligtar fund')
assert old_charity.id != self.foundation
def test_switch_foundation_to_charity(self):
self.test_success_foundation()
self.test_success_charity()
moz = Charity.objects.get(id=self.foundation.id)
eq_(moz.name, 'moz')
eq_(moz.url, '$$.moz')
eq_(moz.paypal, 'moz.pal')
def test_contrib_form_initial(self):
eq_(ContribForm.initial(self.addon)['recipient'], 'dev')
self.addon.charity = self.foundation
eq_(ContribForm.initial(self.addon)['recipient'], 'moz')
self.addon.charity_id = amo.FOUNDATION_ORG + 1
eq_(ContribForm.initial(self.addon)['recipient'], 'org')
eq_(ContribForm.initial(self.addon)['annoying'], amo.CONTRIB_PASSIVE)
self.addon.annoying = amo.CONTRIB_AFTER
eq_(ContribForm.initial(self.addon)['annoying'], amo.CONTRIB_AFTER)
def test_enable_thankyou(self):
d = dict(enable_thankyou='on', thankyou_note='woo',
annoying=1, recipient='moz')
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
addon = self.get_addon()
eq_(addon.enable_thankyou, True)
eq_(unicode(addon.thankyou_note), 'woo')
def test_enable_thankyou_unchecked_with_text(self):
d = dict(enable_thankyou='', thankyou_note='woo',
annoying=1, recipient='moz')
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
addon = self.get_addon()
eq_(addon.enable_thankyou, False)
eq_(addon.thankyou_note, None)
def test_contribution_link(self):
self.test_success_foundation()
r = self.client.get(self.url)
doc = pq(r.content)
span = doc('#status-bar').find('span')
eq_(span.length, 1)
assert span.text().startswith('Your contribution page: ')
a = span.find('a')
eq_(a.length, 1)
eq_(a.attr('href'), reverse('addons.about',
args=[self.get_addon().slug]))
eq_(a.text(), url_reverse('addons.about', self.get_addon().slug,
host=settings.SITE_URL))
def test_enable_thankyou_no_text(self):
d = dict(enable_thankyou='on', thankyou_note='',
annoying=1, recipient='moz')
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
addon = self.get_addon()
eq_(addon.enable_thankyou, False)
eq_(addon.thankyou_note, None)
def test_no_future(self):
self.get_addon().update(the_future=None)
res = self.client.get(self.url)
err = pq(res.content)('p.error').text()
eq_('completed developer profile' in err, True)
def test_with_upsell_no_contributions(self):
AddonUpsell.objects.create(free=self.addon, premium=self.addon)
res = self.client.get(self.url)
error = pq(res.content)('p.error').text()
eq_('premium add-on enrolled' in error, True)
eq_(' %s' % self.addon.name in error, True)
@mock.patch.dict(jingo.env.globals['waffle'], {'switch': lambda x: True})
def test_addon_public(self):
self.get_addon().update(status=amo.STATUS_PUBLIC)
res = self.client.get(self.url)
doc = pq(res.content)
eq_(doc('#do-setup').text(), 'Set up Contributions')
eq_('You cannot enroll in the Marketplace' in doc('p.error').text(),
True)
@mock.patch('addons.models.Addon.upsell')
def test_upsell(self, upsell):
upsell.return_value = self.get_addon()
d = dict(recipient='dev', suggested_amount=2, paypal_id='greed@dev',
annoying=amo.CONTRIB_AFTER)
res = self.client.post(self.url, d)
eq_('premium add-on' in res.content, True)
@mock.patch.dict(jingo.env.globals['waffle'], {'switch': lambda x: True})
def test_voluntary_contributions_addons(self):
r = self.client.get(self.url)
doc = pq(r.content)
eq_(doc('.intro').length, 2)
eq_(doc('.intro.full-intro').length, 0)
class TestDisablePayments(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.addon.the_reason = self.addon.the_future = '...'
self.addon.save()
self.addon.update(wants_contributions=True, paypal_id='woohoo')
self.pay_url = self.addon.get_dev_url('payments')
self.disable_url = self.addon.get_dev_url('payments.disable')
assert self.client.login(username='del@icio.us', password='password')
def test_statusbar_visible(self):
r = self.client.get(self.pay_url)
self.assertContains(r, '<div id="status-bar">')
self.addon.update(wants_contributions=False)
r = self.client.get(self.pay_url)
self.assertNotContains(r, '<div id="status-bar">')
def test_disable(self):
r = self.client.post(self.disable_url)
eq_(r.status_code, 302)
assert(r['Location'].endswith(self.pay_url))
eq_(Addon.objects.no_cache().get(id=3615).wants_contributions, False)
class TestPaymentsProfile(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
raise SkipTest
self.addon = a = self.get_addon()
self.url = self.addon.get_dev_url('payments')
# Make sure all the payment/profile data is clear.
assert not (a.wants_contributions or a.paypal_id or a.the_reason
or a.the_future or a.takes_contributions)
assert self.client.login(username='del@icio.us', password='password')
self.paypal_mock = mock.Mock()
self.paypal_mock.return_value = (True, None)
paypal.check_paypal_id = self.paypal_mock
def get_addon(self):
return Addon.objects.get(id=3615)
def test_intro_box(self):
# We don't have payments/profile set up, so we see the intro.
doc = pq(self.client.get(self.url).content)
assert doc('.intro')
assert doc('#setup.hidden')
def test_status_bar(self):
# We don't have payments/profile set up, so no status bar.
doc = pq(self.client.get(self.url).content)
assert not doc('#status-bar')
def test_profile_form_exists(self):
doc = pq(self.client.get(self.url).content)
assert doc('#trans-the_reason')
assert doc('#trans-the_future')
def test_profile_form_success(self):
d = dict(recipient='dev', suggested_amount=2, paypal_id='xx@yy',
annoying=amo.CONTRIB_ROADBLOCK, the_reason='xxx',
the_future='yyy')
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
# The profile form is gone, we're accepting contributions.
doc = pq(self.client.get(self.url).content)
assert not doc('.intro')
assert not doc('#setup.hidden')
assert doc('#status-bar')
assert not doc('#trans-the_reason')
assert not doc('#trans-the_future')
addon = self.get_addon()
eq_(unicode(addon.the_reason), 'xxx')
eq_(unicode(addon.the_future), 'yyy')
eq_(addon.wants_contributions, True)
def test_profile_required(self):
def check_page(request):
doc = pq(request.content)
assert not doc('.intro')
assert not doc('#setup.hidden')
assert not doc('#status-bar')
assert doc('#trans-the_reason')
assert doc('#trans-the_future')
d = dict(recipient='dev', suggested_amount=2, paypal_id='xx@yy',
annoying=amo.CONTRIB_ROADBLOCK)
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'profile_form', 'the_reason',
'This field is required.')
self.assertFormError(r, 'profile_form', 'the_future',
'This field is required.')
check_page(r)
eq_(self.get_addon().wants_contributions, False)
d = dict(recipient='dev', suggested_amount=2, paypal_id='xx@yy',
annoying=amo.CONTRIB_ROADBLOCK, the_reason='xxx')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'profile_form', 'the_future',
'This field is required.')
check_page(r)
eq_(self.get_addon().wants_contributions, False)
def test_checker_no_email(self):
url = reverse('devhub.check_paypal')
r = self.client.post(url)
eq_(r.status_code, 404)
@mock.patch('paypal.check_paypal_id')
@mock.patch('paypal.get_paykey')
def test_checker_valid_email(self, gp, cpi):
cpi.return_value = (True, "")
gp.return_value = "123abc"
url = reverse('devhub.check_paypal')
r = self.client.post(url, {'email': 'test@test.com'})
eq_(r.status_code, 200)
result = json.loads(r.content)
eq_(result['valid'], True)
@mock.patch('paypal.check_paypal_id')
@mock.patch('paypal.get_paykey')
def test_checker_invalid_email(self, gp, cpi):
cpi.return_value = (False, "Oh no you didn't")
gp.return_value = "123abc"
url = reverse('devhub.check_paypal')
r = self.client.post(url, {'email': 'test.com'})
eq_(r.status_code, 200)
result = json.loads(r.content)
eq_(result[u'valid'], False)
assert len(result[u'message']) > 0, "No error on invalid email"
@mock.patch('paypal.check_paypal_id')
@mock.patch('paypal.get_paykey')
def test_checker_no_paykey(self, gp, cpi):
cpi.return_value = (True, "")
gp.side_effect = paypal.PaypalError()
url = reverse('devhub.check_paypal')
r = self.client.post(url, {'email': 'test@test.com'})
eq_(r.status_code, 200)
result = json.loads(r.content)
eq_(result[u'valid'], False)
assert len(result[u'message']) > 0, "No error on missing paykey"
@mock.patch('paypal.get_paykey')
def test_checker_no_pre_approval(self, get_paykey):
self.client.post(reverse('devhub.check_paypal'),
{'email': 'test@test.com'})
assert 'preapprovalKey' not in get_paykey.call_args[0][0]
class MarketplaceMixin(object):
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.addon.update(status=amo.STATUS_NOMINATED,
highest_status=amo.STATUS_NOMINATED)
self.url = self.addon.get_dev_url('payments')
assert self.client.login(username='del@icio.us', password='password')
self.marketplace = (waffle.models.Switch.objects
.get_or_create(name='marketplace')[0])
self.marketplace.active = True
self.marketplace.save()
def tearDown(self):
self.marketplace.active = False
self.marketplace.save()
def setup_premium(self):
self.price = Price.objects.create(price='0.99')
self.price_two = Price.objects.create(price='1.99')
self.other_addon = Addon.objects.create(type=amo.ADDON_EXTENSION,
premium_type=amo.ADDON_FREE)
AddonUser.objects.create(addon=self.other_addon,
user=self.addon.authors.all()[0])
AddonPremium.objects.create(addon=self.addon, price_id=self.price.pk)
self.addon.update(premium_type=amo.ADDON_PREMIUM,
paypal_id='a@a.com')
class TestIssueRefund(amo.tests.TestCase):
fixtures = ('base/users', 'base/addon_3615')
def setUp(self):
waffle.models.Switch.objects.create(name='allow-refund', active=True)
self.addon = Addon.objects.get(id=3615)
self.transaction_id = u'fake-txn-id'
self.paykey = u'fake-paykey'
self.client.login(username='del@icio.us', password='password')
self.user = UserProfile.objects.get(username='clouserw')
self.url = self.addon.get_dev_url('issue_refund')
def make_purchase(self, uuid='123456', type=amo.CONTRIB_PURCHASE):
return Contribution.objects.create(uuid=uuid, addon=self.addon,
transaction_id=self.transaction_id,
user=self.user, paykey=self.paykey,
amount=Decimal('10'), type=type)
def test_request_issue(self):
c = self.make_purchase()
r = self.client.get(self.url, {'transaction_id': c.transaction_id})
doc = pq(r.content)
eq_(doc('#issue-refund button').length, 2)
eq_(doc('#issue-refund input[name=transaction_id]').val(),
self.transaction_id)
def test_nonexistent_txn(self):
r = self.client.get(self.url, {'transaction_id': 'none'})
eq_(r.status_code, 404)
def test_nonexistent_txn_no_really(self):
r = self.client.get(self.url)
eq_(r.status_code, 404)
def _test_issue(self, refund, enqueue_refund):
refund.return_value = []
c = self.make_purchase()
r = self.client.post(self.url, {'transaction_id': c.transaction_id,
'issue': '1'})
self.assertRedirects(r, self.addon.get_dev_url('refunds'), 302)
refund.assert_called_with(self.paykey)
eq_(len(mail.outbox), 1)
assert 'approved' in mail.outbox[0].subject
# There should be one approved refund added.
eq_(enqueue_refund.call_args_list[0][0][0], amo.REFUND_APPROVED)
@mock.patch('stats.models.Contribution.enqueue_refund')
@mock.patch('paypal.refund')
def test_addons_issue(self, refund, enqueue_refund):
self._test_issue(refund, enqueue_refund)
@mock.patch('amo.messages.error')
@mock.patch('paypal.refund')
def test_only_one_issue(self, refund, error):
refund.return_value = []
c = self.make_purchase()
self.client.post(self.url,
{'transaction_id': c.transaction_id,
'issue': '1'})
r = self.client.get(self.url, {'transaction_id': c.transaction_id})
assert 'Decline Refund' not in r.content
assert 'Refund already processed' in error.call_args[0][1]
self.client.post(self.url,
{'transaction_id': c.transaction_id,
'issue': '1'})
eq_(Refund.objects.count(), 1)
@mock.patch('amo.messages.error')
@mock.patch('paypal.refund')
def test_no_issue_after_decline(self, refund, error):
refund.return_value = []
c = self.make_purchase()
self.client.post(self.url,
{'transaction_id': c.transaction_id,
'decline': ''})
del self.client.cookies['messages']
r = self.client.get(self.url, {'transaction_id': c.transaction_id})
eq_(pq(r.content)('#issue-refund button').length, 0)
assert 'Refund already processed' in error.call_args[0][1]
self.client.post(self.url,
{'transaction_id': c.transaction_id,
'issue': '1'})
eq_(Refund.objects.count(), 1)
eq_(Refund.objects.get(contribution=c).status, amo.REFUND_DECLINED)
def _test_decline(self, refund, enqueue_refund):
c = self.make_purchase()
r = self.client.post(self.url, {'transaction_id': c.transaction_id,
'decline': ''})
self.assertRedirects(r, self.addon.get_dev_url('refunds'), 302)
assert not refund.called
eq_(len(mail.outbox), 1)
assert 'declined' in mail.outbox[0].subject
# There should be one declined refund added.
eq_(enqueue_refund.call_args_list[0][0][0], amo.REFUND_DECLINED)
@mock.patch('stats.models.Contribution.enqueue_refund')
@mock.patch('paypal.refund')
def test_addons_decline(self, refund, enqueue_refund):
self._test_decline(refund, enqueue_refund)
@mock.patch('stats.models.Contribution.enqueue_refund')
@mock.patch('paypal.refund')
def test_non_refundable_txn(self, refund, enqueue_refund):
c = self.make_purchase('56789', amo.CONTRIB_VOLUNTARY)
r = self.client.post(self.url, {'transaction_id': c.transaction_id,
'issue': ''})
eq_(r.status_code, 404)
assert not refund.called, '`paypal.refund` should not have been called'
assert not enqueue_refund.called, (
'`Contribution.enqueue_refund` should not have been called')
@mock.patch('paypal.refund')
def test_already_refunded(self, refund):
refund.return_value = [{'refundStatus': 'ALREADY_REVERSED_OR_REFUNDED',
'receiver.email': self.user.email}]
c = self.make_purchase()
r = self.client.post(self.url, {'transaction_id': c.transaction_id,
'issue': '1'})
self.assertRedirects(r, self.addon.get_dev_url('refunds'), 302)
eq_(len(mail.outbox), 0)
assert 'previously issued' in r.cookies['messages'].value
@mock.patch('stats.models.Contribution.record_failed_refund')
@mock.patch('paypal.refund')
def test_refund_failed(self, refund, record):
err = paypal.PaypalError('transaction died in a fire')
def fail(*args, **kwargs):
raise err
refund.side_effect = fail
c = self.make_purchase()
r = self.client.post(self.url, {'transaction_id': c.transaction_id,
'issue': '1'})
record.assert_called_once_with(err)
self.assertRedirects(r, self.addon.get_dev_url('refunds'), 302)
class TestRefunds(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
waffle.models.Switch.objects.create(name='allow-refund', active=True)
self.addon = Addon.objects.get(id=3615)
self.addon.premium_type = amo.ADDON_PREMIUM
self.addon.save()
self.user = UserProfile.objects.get(email='del@icio.us')
self.url = self.addon.get_dev_url('refunds')
self.client.login(username='del@icio.us', password='password')
self.queues = {
'pending': amo.REFUND_PENDING,
'approved': amo.REFUND_APPROVED,
'instant': amo.REFUND_APPROVED_INSTANT,
'declined': amo.REFUND_DECLINED,
}
def generate_refunds(self):
self.expected = {}
for status in amo.REFUND_STATUSES.keys():
for x in xrange(status + 1):
c = Contribution.objects.create(addon=self.addon,
user=self.user,
type=amo.CONTRIB_PURCHASE)
r = Refund.objects.create(contribution=c, status=status,
requested=datetime.now(),
user=self.user)
self.expected.setdefault(status, []).append(r)
def test_anonymous(self):
self.client.logout()
r = self.client.get(self.url, follow=True)
self.assertRedirects(r, '%s?to=%s' % (reverse('users.login'),
self.url))
def test_bad_owner(self):
self.client.logout()
self.client.login(username='regular@mozilla.com', password='password')
r = self.client.get(self.url)
eq_(r.status_code, 403)
def test_owner(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
def test_admin(self):
self.client.logout()
self.client.login(username='admin@mozilla.com', password='password')
r = self.client.get(self.url)
eq_(r.status_code, 200)
def test_not_premium(self):
self.addon.premium_type = amo.ADDON_FREE
self.addon.save()
r = self.client.get(self.url)
eq_(r.status_code, 200)
eq_(pq(r.content)('#enable-payments').length, 1)
def test_empty_queues(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
for key, status in self.queues.iteritems():
eq_(list(r.context[key]), [])
@mock.patch.object(settings, 'TASK_USER_ID', 999)
def test_queues(self):
self.generate_refunds()
r = self.client.get(self.url)
eq_(r.status_code, 200)
for key, status in self.queues.iteritems():
eq_(list(r.context[key]), list(self.expected[status]))
def test_empty_tables(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
doc = pq(r.content)
for key in self.queues.keys():
eq_(doc('.no-results#queue-%s' % key).length, 1)
@mock.patch.object(settings, 'TASK_USER_ID', 999)
def test_tables(self):
self.generate_refunds()
r = self.client.get(self.url)
eq_(r.status_code, 200)
doc = pq(r.content)
eq_(doc('#enable-payments').length, 0)
for key in self.queues.keys():
table = doc('#queue-%s' % key)
eq_(table.length, 1)
@mock.patch.object(settings, 'TASK_USER_ID', 999)
def test_timestamps(self):
self.generate_refunds()
r = self.client.get(self.url)
eq_(r.status_code, 200)
doc = pq(r.content)
# Pending timestamps should be relative.
table = doc('#queue-pending')
for refund in self.expected[amo.REFUND_PENDING]:
tr = table.find('.refund[data-refundid=%s]' % refund.id)
purchased = tr.find('.purchased-date')
requested = tr.find('.requested-date')
eq_(purchased.text(),
timesince(refund.contribution.created).strip())
eq_(requested.text(),
timesince(refund.requested).strip())
eq_(purchased.attr('title'),
babel_datetime(refund.contribution.created).strip())
eq_(requested.attr('title'),
babel_datetime(refund.requested).strip())
# Remove pending table.
table.remove()
# All other timestamps should be absolute.
table = doc('table')
others = Refund.objects.exclude(status__in=(amo.REFUND_PENDING,
amo.REFUND_FAILED))
for refund in others:
tr = table.find('.refund[data-refundid=%s]' % refund.id)
eq_(tr.find('.purchased-date').text(),
babel_datetime(refund.contribution.created).strip())
eq_(tr.find('.requested-date').text(),
babel_datetime(refund.requested).strip())
class TestDelete(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
self.get_addon = lambda: Addon.objects.filter(id=3615)
assert self.client.login(username='del@icio.us', password='password')
self.get_url = lambda: self.get_addon()[0].get_dev_url('delete')
def test_post_not(self):
r = self.client.post(self.get_url(), follow=True)
eq_(pq(r.content)('.notification-box').text(),
'Password was incorrect. Add-on was not deleted.')
eq_(self.get_addon().exists(), True)
def test_post(self):
r = self.client.post(self.get_url(), {'password': 'password'},
follow=True)
eq_(pq(r.content)('.notification-box').text(), 'Add-on deleted.')
eq_(self.get_addon().exists(), False)
def test_post_theme(self):
Addon.objects.get(id=3615).update(type=amo.ADDON_PERSONA)
r = self.client.post(self.get_url(), {'password': 'password'},
follow=True)
eq_(pq(r.content)('.notification-box').text(), 'Theme deleted.')
eq_(self.get_addon().exists(), False)
class TestHome(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
self.url = reverse('devhub.index')
def get_pq(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
return pq(r.content)
def test_addons(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
self.assertTemplateUsed(r, 'devhub/index.html')
def test_editor_promo(self):
eq_(self.get_pq()('#devhub-sidebar #editor-promo').length, 1)
def test_no_editor_promo(self):
Addon.objects.all().delete()
# Regular users (non-devs) should not see this promo.
eq_(self.get_pq()('#devhub-sidebar #editor-promo').length, 0)
def test_my_addons(self):
addon = Addon.objects.get(id=3615)
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_NOMINATED),
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED),
(amo.STATUS_LITE, amo.STATUS_UNREVIEWED)]
for addon_status in statuses:
addon.status = addon_status[0]
addon.save()
file = addon.latest_version.files.all()[0]
file.status = addon_status[1]
file.save()
doc = self.get_pq()
addon_item = doc('#my-addons .addon-item')
eq_(addon_item.length, 1)
eq_(addon_item.find('.addon-name').attr('href'),
addon.get_dev_url('edit'))
eq_(addon_item.find('p').eq(2).find('a').attr('href'),
addon.current_version.get_url_path())
eq_('Queue Position: 1 of 1', addon_item.find('p').eq(3).text())
eq_(addon_item.find('.upload-new-version a').attr('href'),
addon.get_dev_url('versions') + '#version-upload')
addon.status = statuses[1][0]
addon.save()
doc = self.get_pq()
addon_item = doc('#my-addons .addon-item')
eq_('Status: ' + unicode(amo.STATUS_CHOICES[addon.status]),
addon_item.find('p').eq(1).text())
Addon.objects.all().delete()
eq_(self.get_pq()('#my-addons').length, 0)
def test_incomplete_no_new_version(self):
def no_link():
doc = self.get_pq()
addon_item = doc('#my-addons .addon-item')
eq_(addon_item.length, 1)
eq_(addon_item.find('.upload-new-version').length, 0)
addon = Addon.objects.get(id=3615)
addon.update(status=amo.STATUS_NULL)
no_link()
addon.update(status=amo.STATUS_DISABLED)
no_link()
addon.update(status=amo.STATUS_PUBLIC, disabled_by_user=True)
no_link()
class TestActivityFeed(amo.tests.TestCase):
fixtures = ('base/apps', 'base/users', 'base/addon_3615')
def setUp(self):
super(TestActivityFeed, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
def test_feed_for_all(self):
r = self.client.get(reverse('devhub.feed_all'))
eq_(r.status_code, 200)
doc = pq(r.content)
eq_(doc('header h2').text(), 'Recent Activity for My Add-ons')
eq_(doc('#breadcrumbs li:eq(2)').text(), 'Recent Activity')
def test_feed_for_addon(self):
addon = Addon.objects.no_cache().get(id=3615)
r = self.client.get(reverse('devhub.feed', args=[addon.slug]))
eq_(r.status_code, 200)
doc = pq(r.content)
eq_(doc('header h2').text(),
'Recent Activity for %s' % addon.name)
eq_(doc('#breadcrumbs li:eq(3)').text(),
addon.slug)
def test_feed_disabled(self):
addon = Addon.objects.no_cache().get(id=3615)
addon.update(status=amo.STATUS_DISABLED)
r = self.client.get(reverse('devhub.feed', args=[addon.slug]))
eq_(r.status_code, 200)
def test_feed_disabled_anon(self):
self.client.logout()
addon = Addon.objects.no_cache().get(id=3615)
r = self.client.get(reverse('devhub.feed', args=[addon.slug]))
eq_(r.status_code, 302)
def add_hidden_log(self, action=amo.LOG.COMMENT_VERSION):
addon = Addon.objects.get(id=3615)
amo.set_user(UserProfile.objects.get(email='del@icio.us'))
amo.log(action, addon, addon.versions.all()[0])
return addon
def test_feed_hidden(self):
addon = self.add_hidden_log()
self.add_hidden_log(amo.LOG.OBJECT_ADDED)
res = self.client.get(reverse('devhub.feed', args=[addon.slug]))
doc = pq(res.content)
eq_(len(doc('#recent-activity p')), 1)
def test_addons_hidden(self):
self.add_hidden_log()
self.add_hidden_log(amo.LOG.OBJECT_ADDED)
res = self.client.get(reverse('devhub.addons'))
doc = pq(res.content)
eq_(len(doc('#dashboard-sidebar div.recent-activity li.item')), 0)
class TestProfileBase(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.url = self.addon.get_dev_url('profile')
assert self.client.login(username='del@icio.us', password='password')
def get_addon(self):
return Addon.objects.no_cache().get(id=self.addon.id)
def enable_addon_contributions(self):
self.addon.wants_contributions = True
self.addon.paypal_id = 'somebody'
self.addon.save()
def post(self, *args, **kw):
d = dict(*args, **kw)
eq_(self.client.post(self.url, d).status_code, 302)
def check(self, **kw):
addon = self.get_addon()
for k, v in kw.items():
if k in ('the_reason', 'the_future'):
eq_(getattr(getattr(addon, k), 'localized_string'), unicode(v))
else:
eq_(getattr(addon, k), v)
class TestProfileStatusBar(TestProfileBase):
def setUp(self):
super(TestProfileStatusBar, self).setUp()
self.remove_url = self.addon.get_dev_url('profile.remove')
def test_no_status_bar(self):
self.addon.the_reason = self.addon.the_future = None
self.addon.save()
assert not pq(self.client.get(self.url).content)('#status-bar')
def test_status_bar_no_contrib(self):
self.addon.the_reason = self.addon.the_future = '...'
self.addon.wants_contributions = False
self.addon.save()
doc = pq(self.client.get(self.url).content)
assert doc('#status-bar')
eq_(doc('#status-bar button').text(), 'Remove Profile')
def test_status_bar_with_contrib(self):
self.addon.the_reason = self.addon.the_future = '...'
self.addon.wants_contributions = True
self.addon.paypal_id = 'xxx'
self.addon.save()
doc = pq(self.client.get(self.url).content)
assert doc('#status-bar')
eq_(doc('#status-bar button').text(), 'Remove Both')
def test_remove_profile(self):
raise SkipTest
self.addon.the_reason = self.addon.the_future = '...'
self.addon.save()
self.client.post(self.remove_url)
addon = self.get_addon()
eq_(addon.the_reason, None)
eq_(addon.the_future, None)
eq_(addon.takes_contributions, False)
eq_(addon.wants_contributions, False)
def test_remove_profile_without_content(self):
# See bug 624852
self.addon.the_reason = self.addon.the_future = None
self.addon.save()
self.client.post(self.remove_url)
addon = self.get_addon()
eq_(addon.the_reason, None)
eq_(addon.the_future, None)
def test_remove_both(self):
raise SkipTest
self.addon.the_reason = self.addon.the_future = '...'
self.addon.wants_contributions = True
self.addon.paypal_id = 'xxx'
self.addon.save()
self.client.post(self.remove_url)
addon = self.get_addon()
eq_(addon.the_reason, None)
eq_(addon.the_future, None)
eq_(addon.takes_contributions, False)
eq_(addon.wants_contributions, False)
class TestProfile(TestProfileBase):
def test_without_contributions_labels(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
doc = pq(r.content)
eq_(doc('label[for=the_reason] .optional').length, 1)
eq_(doc('label[for=the_future] .optional').length, 1)
def test_without_contributions_fields_optional(self):
self.post(the_reason='', the_future='')
self.check(the_reason='', the_future='')
self.post(the_reason='to be cool', the_future='')
self.check(the_reason='to be cool', the_future='')
self.post(the_reason='', the_future='hot stuff')
self.check(the_reason='', the_future='hot stuff')
self.post(the_reason='to be hot', the_future='cold stuff')
self.check(the_reason='to be hot', the_future='cold stuff')
def test_with_contributions_labels(self):
self.enable_addon_contributions()
r = self.client.get(self.url)
doc = pq(r.content)
assert doc('label[for=the_reason] .req').length, (
'the_reason field should be required.')
assert doc('label[for=the_future] .req').length, (
'the_future field should be required.')
def test_log(self):
self.enable_addon_contributions()
d = dict(the_reason='because', the_future='i can')
o = ActivityLog.objects
eq_(o.count(), 0)
self.client.post(self.url, d)
eq_(o.filter(action=amo.LOG.EDIT_PROPERTIES.id).count(), 1)
def test_with_contributions_fields_required(self):
self.enable_addon_contributions()
d = dict(the_reason='', the_future='')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'profile_form', 'the_reason',
'This field is required.')
self.assertFormError(r, 'profile_form', 'the_future',
'This field is required.')
d = dict(the_reason='to be cool', the_future='')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'profile_form', 'the_future',
'This field is required.')
d = dict(the_reason='', the_future='hot stuff')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'profile_form', 'the_reason',
'This field is required.')
self.post(the_reason='to be hot', the_future='cold stuff')
self.check(the_reason='to be hot', the_future='cold stuff')
class TestSubmitBase(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_5579', 'base/platforms',
'base/users']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
self.addon = self.get_addon()
def get_addon(self):
return Addon.objects.no_cache().get(pk=3615)
def get_version(self):
return self.get_addon().versions.get()
def get_step(self):
return SubmitStep.objects.get(addon=self.get_addon())
class TestSubmitStep1(TestSubmitBase):
def test_step1_submit(self):
response = self.client.get(reverse('devhub.submit.1'))
eq_(response.status_code, 200)
doc = pq(response.content)
eq_(doc('#breadcrumbs a').eq(1).attr('href'), reverse('devhub.addons'))
links = doc('#agreement-container a')
assert links
for ln in links:
href = ln.attrib['href']
assert not href.startswith('%'), (
"Looks like link %r to %r is still a placeholder" %
(href, ln.text))
class TestSubmitStep2(amo.tests.TestCase):
# More tests in TestCreateAddon.
fixtures = ['base/users']
def setUp(self):
self.client.login(username='regular@mozilla.com', password='password')
def test_step_2_with_cookie(self):
r = self.client.post(reverse('devhub.submit.1'))
self.assertRedirects(r, reverse('devhub.submit.2'))
r = self.client.get(reverse('devhub.submit.2'))
eq_(r.status_code, 200)
def test_step_2_no_cookie(self):
# We require a cookie that gets set in step 1.
r = self.client.get(reverse('devhub.submit.2'), follow=True)
self.assertRedirects(r, reverse('devhub.submit.1'))
class TestSubmitStep3(TestSubmitBase):
def setUp(self):
super(TestSubmitStep3, self).setUp()
self.url = reverse('devhub.submit.3', args=['a3615'])
SubmitStep.objects.create(addon_id=3615, step=3)
AddonCategory.objects.filter(
addon=self.get_addon(),
category=Category.objects.get(id=23)).delete()
AddonCategory.objects.filter(
addon=self.get_addon(),
category=Category.objects.get(id=24)).delete()
ctx = self.client.get(self.url).context['cat_form']
self.cat_initial = initial(ctx.initial_forms[0])
def get_dict(self, **kw):
cat_initial = kw.pop('cat_initial', self.cat_initial)
fs = formset(cat_initial, initial_count=1)
result = {'name': 'Test name', 'slug': 'testname',
'description': 'desc', 'summary': 'Hello!'}
result.update(**kw)
result.update(fs)
return result
def test_submit_success(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
# Post and be redirected.
d = self.get_dict()
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
eq_(self.get_step().step, 4)
addon = self.get_addon()
eq_(addon.name, 'Test name')
eq_(addon.slug, 'testname')
eq_(addon.description, 'desc')
eq_(addon.summary, 'Hello!')
# Test add-on log activity.
log_items = ActivityLog.objects.for_addons(addon)
assert not log_items.filter(action=amo.LOG.EDIT_DESCRIPTIONS.id), (
"Creating a description needn't be logged.")
def test_submit_name_unique(self):
# Make sure name is unique.
r = self.client.post(self.url, self.get_dict(name='Cooliris'))
error = 'This name is already in use. Please choose another.'
self.assertFormError(r, 'form', 'name', error)
def test_submit_name_unique_strip(self):
# Make sure we can't sneak in a name by adding a space or two.
r = self.client.post(self.url, self.get_dict(name=' Cooliris '))
error = 'This name is already in use. Please choose another.'
self.assertFormError(r, 'form', 'name', error)
def test_submit_name_unique_case(self):
# Make sure unique names aren't case sensitive.
r = self.client.post(self.url, self.get_dict(name='cooliris'))
error = 'This name is already in use. Please choose another.'
self.assertFormError(r, 'form', 'name', error)
def test_submit_name_length(self):
# Make sure the name isn't too long.
d = self.get_dict(name='a' * 51)
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
error = 'Ensure this value has at most 50 characters (it has 51).'
self.assertFormError(r, 'form', 'name', error)
def test_submit_slug_invalid(self):
# Submit an invalid slug.
d = self.get_dict(slug='slug!!! aksl23%%')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'form', 'slug', "Enter a valid 'slug' " +
"consisting of letters, numbers, underscores or "
"hyphens.")
def test_submit_slug_required(self):
# Make sure the slug is required.
r = self.client.post(self.url, self.get_dict(slug=''))
eq_(r.status_code, 200)
self.assertFormError(r, 'form', 'slug', 'This field is required.')
def test_submit_summary_required(self):
# Make sure summary is required.
r = self.client.post(self.url, self.get_dict(summary=''))
eq_(r.status_code, 200)
self.assertFormError(r, 'form', 'summary', 'This field is required.')
def test_submit_summary_length(self):
# Summary is too long.
r = self.client.post(self.url, self.get_dict(summary='a' * 251))
eq_(r.status_code, 200)
error = 'Ensure this value has at most 250 characters (it has 251).'
self.assertFormError(r, 'form', 'summary', error)
def test_submit_categories_required(self):
del self.cat_initial['categories']
r = self.client.post(self.url,
self.get_dict(cat_initial=self.cat_initial))
eq_(r.context['cat_form'].errors[0]['categories'],
['This field is required.'])
def test_submit_categories_max(self):
eq_(amo.MAX_CATEGORIES, 2)
self.cat_initial['categories'] = [22, 23, 24]
r = self.client.post(self.url,
self.get_dict(cat_initial=self.cat_initial))
eq_(r.context['cat_form'].errors[0]['categories'],
['You can have only 2 categories.'])
def test_submit_categories_add(self):
eq_([c.id for c in self.get_addon().all_categories], [22])
self.cat_initial['categories'] = [22, 23]
self.client.post(self.url, self.get_dict())
addon_cats = self.get_addon().categories.values_list('id', flat=True)
eq_(sorted(addon_cats), [22, 23])
def test_submit_categories_addandremove(self):
AddonCategory(addon=self.addon, category_id=23).save()
eq_([c.id for c in self.get_addon().all_categories], [22, 23])
self.cat_initial['categories'] = [22, 24]
self.client.post(self.url, self.get_dict(cat_initial=self.cat_initial))
category_ids_new = [c.id for c in self.get_addon().all_categories]
eq_(category_ids_new, [22, 24])
def test_submit_categories_remove(self):
c = Category.objects.get(id=23)
AddonCategory(addon=self.addon, category=c).save()
eq_([c.id for c in self.get_addon().all_categories], [22, 23])
self.cat_initial['categories'] = [22]
self.client.post(self.url, self.get_dict(cat_initial=self.cat_initial))
category_ids_new = [c.id for c in self.get_addon().all_categories]
eq_(category_ids_new, [22])
def test_check_version(self):
r = self.client.get(self.url)
doc = pq(r.content)
version = doc("#current_version").val()
eq_(version, self.addon.current_version.version)
class TestSubmitStep4(TestSubmitBase):
def setUp(self):
super(TestSubmitStep4, self).setUp()
self.old_addon_icon_url = settings.ADDON_ICON_URL
settings.ADDON_ICON_URL = (
settings.STATIC_URL +
'img/uploads/addon_icons/%s/%s-%s.png?modified=%s')
SubmitStep.objects.create(addon_id=3615, step=4)
self.url = reverse('devhub.submit.4', args=['a3615'])
self.next_step = reverse('devhub.submit.5', args=['a3615'])
self.icon_upload = reverse('devhub.addons.upload_icon',
args=['a3615'])
self.preview_upload = reverse('devhub.addons.upload_preview',
args=['a3615'])
def tearDown(self):
settings.ADDON_ICON_URL = self.old_addon_icon_url
def test_get(self):
eq_(self.client.get(self.url).status_code, 200)
def test_post(self):
data = dict(icon_type='')
data_formset = self.formset_media(**data)
r = self.client.post(self.url, data_formset)
eq_(r.status_code, 302)
eq_(self.get_step().step, 5)
def formset_new_form(self, *args, **kw):
ctx = self.client.get(self.url).context
blank = initial(ctx['preview_form'].forms[-1])
blank.update(**kw)
return blank
def formset_media(self, *args, **kw):
kw.setdefault('initial_count', 0)
kw.setdefault('prefix', 'files')
fs = formset(*[a for a in args] + [self.formset_new_form()], **kw)
return dict([(k, '' if v is None else v) for k, v in fs.items()])
def test_icon_upload_attributes(self):
doc = pq(self.client.get(self.url).content)
field = doc('input[name=icon_upload]')
eq_(field.length, 1)
eq_(sorted(field.attr('data-allowed-types').split('|')),
['image/jpeg', 'image/png'])
eq_(field.attr('data-upload-url'), self.icon_upload)
def test_edit_media_defaulticon(self):
data = dict(icon_type='')
data_formset = self.formset_media(**data)
self.client.post(self.url, data_formset)
addon = self.get_addon()
assert addon.get_icon_url(64).endswith('icons/default-64.png')
for k in data:
eq_(unicode(getattr(addon, k)), data[k])
def test_edit_media_preuploadedicon(self):
data = dict(icon_type='icon/appearance')
data_formset = self.formset_media(**data)
self.client.post(self.url, data_formset)
addon = self.get_addon()
eq_('/'.join(addon.get_icon_url(64).split('/')[-2:]),
'addon-icons/appearance-64.png')
for k in data:
eq_(unicode(getattr(addon, k)), data[k])
def test_edit_media_uploadedicon(self):
img = get_image_path('mozilla.png')
src_image = open(img, 'rb')
data = dict(upload_image=src_image)
response = self.client.post(self.icon_upload, data)
response_json = json.loads(response.content)
addon = self.get_addon()
# Now, save the form so it gets moved properly.
data = dict(icon_type='image/png',
icon_upload_hash=response_json['upload_hash'])
data_formset = self.formset_media(**data)
self.client.post(self.url, data_formset)
addon = self.get_addon()
# Sad we're hardcoding /3/ here, but that's how the URLs work
_url = addon.get_icon_url(64).split('?')[0]
assert _url.endswith('img/uploads/addon_icons/3/%s-64.png' % addon.id)
eq_(data['icon_type'], 'image/png')
# Check that it was actually uploaded
dirname = os.path.join(settings.ADDON_ICONS_PATH,
'%s' % (addon.id / 1000))
dest = os.path.join(dirname, '%s-32.png' % addon.id)
assert storage.exists(dest)
eq_(Image.open(storage.open(dest)).size, (32, 12))
def test_edit_media_uploadedicon_noresize(self):
img = "%s/img/notifications/error.png" % settings.MEDIA_ROOT
src_image = open(img, 'rb')
data = dict(upload_image=src_image)
response = self.client.post(self.icon_upload, data)
response_json = json.loads(response.content)
addon = self.get_addon()
# Now, save the form so it gets moved properly.
data = dict(icon_type='image/png',
icon_upload_hash=response_json['upload_hash'])
data_formset = self.formset_media(**data)
self.client.post(self.url, data_formset)
addon = self.get_addon()
# Sad we're hardcoding /3/ here, but that's how the URLs work
_url = addon.get_icon_url(64).split('?')[0]
assert _url.endswith('img/uploads/addon_icons/3/%s-64.png' % addon.id)
eq_(data['icon_type'], 'image/png')
# Check that it was actually uploaded
dirname = os.path.join(settings.ADDON_ICONS_PATH,
'%s' % (addon.id / 1000))
dest = os.path.join(dirname, '%s-64.png' % addon.id)
assert storage.exists(dest)
eq_(Image.open(storage.open(dest)).size, (48, 48))
def test_client_lied(self):
filehandle = open(get_image_path('non-animated.gif'), 'rb')
data = {'upload_image': filehandle}
res = self.client.post(self.preview_upload, data)
response_json = json.loads(res.content)
eq_(response_json['errors'][0], u'Images must be either PNG or JPG.')
def test_icon_animated(self):
filehandle = open(get_image_path('animated.png'), 'rb')
data = {'upload_image': filehandle}
res = self.client.post(self.preview_upload, data)
response_json = json.loads(res.content)
eq_(response_json['errors'][0], u'Images cannot be animated.')
def test_icon_non_animated(self):
filehandle = open(get_image_path('non-animated.png'), 'rb')
data = {'icon_type': 'image/png', 'icon_upload': filehandle}
data_formset = self.formset_media(**data)
res = self.client.post(self.url, data_formset)
eq_(res.status_code, 302)
eq_(self.get_step().step, 5)
class Step5TestBase(TestSubmitBase):
def setUp(self):
super(Step5TestBase, self).setUp()
SubmitStep.objects.create(addon_id=self.addon.id, step=5)
self.url = reverse('devhub.submit.5', args=['a3615'])
self.next_step = reverse('devhub.submit.6', args=['a3615'])
License.objects.create(builtin=3, on_form=True)
class TestSubmitStep5(Step5TestBase):
"""License submission."""
def test_get(self):
eq_(self.client.get(self.url).status_code, 200)
def test_set_license(self):
r = self.client.post(self.url, {'builtin': 3})
self.assertRedirects(r, self.next_step)
eq_(self.get_addon().current_version.license.builtin, 3)
eq_(self.get_step().step, 6)
log_items = ActivityLog.objects.for_addons(self.get_addon())
assert not log_items.filter(action=amo.LOG.CHANGE_LICENSE.id), (
"Initial license choice:6 needn't be logged.")
def test_license_error(self):
r = self.client.post(self.url, {'builtin': 4})
eq_(r.status_code, 200)
self.assertFormError(r, 'license_form', 'builtin',
'Select a valid choice. 4 is not one of '
'the available choices.')
eq_(self.get_step().step, 5)
def test_set_eula(self):
self.get_addon().update(eula=None, privacy_policy=None)
r = self.client.post(self.url, dict(builtin=3, has_eula=True,
eula='xxx'))
self.assertRedirects(r, self.next_step)
eq_(unicode(self.get_addon().eula), 'xxx')
eq_(self.get_step().step, 6)
def test_set_eula_nomsg(self):
"""
You should not get punished with a 500 for not writing your EULA...
but perhaps you should feel shame for lying to us. This test does not
test for shame.
"""
self.get_addon().update(eula=None, privacy_policy=None)
r = self.client.post(self.url, dict(builtin=3, has_eula=True))
self.assertRedirects(r, self.next_step)
eq_(self.get_step().step, 6)
class TestSubmitStep6(TestSubmitBase):
def setUp(self):
super(TestSubmitStep6, self).setUp()
SubmitStep.objects.create(addon_id=3615, step=6)
self.url = reverse('devhub.submit.6', args=['a3615'])
def test_get(self):
r = self.client.get(self.url)
eq_(r.status_code, 200)
def test_require_review_type(self):
r = self.client.post(self.url, {'dummy': 'text'})
eq_(r.status_code, 200)
self.assertFormError(r, 'review_type_form', 'review_type',
'A review type must be selected.')
def test_bad_review_type(self):
d = dict(review_type='jetsfool')
r = self.client.post(self.url, d)
eq_(r.status_code, 200)
self.assertFormError(r, 'review_type_form', 'review_type',
'Select a valid choice. jetsfool is not one of '
'the available choices.')
def test_prelim_review(self):
d = dict(review_type=amo.STATUS_UNREVIEWED)
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
eq_(self.get_addon().status, amo.STATUS_UNREVIEWED)
assert_raises(SubmitStep.DoesNotExist, self.get_step)
def test_full_review(self):
self.get_version().update(nomination=None)
d = dict(review_type=amo.STATUS_NOMINATED)
r = self.client.post(self.url, d)
eq_(r.status_code, 302)
addon = self.get_addon()
eq_(addon.status, amo.STATUS_NOMINATED)
self.assertCloseToNow(self.get_version().nomination)
assert_raises(SubmitStep.DoesNotExist, self.get_step)
def test_nomination_date_is_only_set_once(self):
# This was a regression, see bug 632191.
# Nominate:
r = self.client.post(self.url, dict(review_type=amo.STATUS_NOMINATED))
eq_(r.status_code, 302)
nomdate = datetime.now() - timedelta(days=5)
self.get_version().update(nomination=nomdate, _signal=False)
# Update something else in the addon:
self.get_addon().update(slug='foobar')
eq_(self.get_version().nomination.timetuple()[0:5],
nomdate.timetuple()[0:5])
class TestSubmitStep7(TestSubmitBase):
def setUp(self):
super(TestSubmitStep7, self).setUp()
self.url = reverse('devhub.submit.7', args=[self.addon.slug])
@mock.patch.object(settings, 'SITE_URL', 'http://b.ro')
@mock.patch('devhub.tasks.send_welcome_email.delay')
def test_welcome_email_for_newbies(self, send_welcome_email_mock):
self.client.get(self.url)
context = {
'app': unicode(amo.FIREFOX.pretty),
'detail_url': 'http://b.ro/en-US/firefox/addon/a3615/',
'version_url': 'http://b.ro/en-US/developers/addon/a3615/versions',
'edit_url': 'http://b.ro/en-US/developers/addon/a3615/edit',
'full_review': False,
}
send_welcome_email_mock.assert_called_with(self.addon.id,
['del@icio.us'], context)
@mock.patch('devhub.tasks.send_welcome_email.delay')
def test_no_welcome_email(self, send_welcome_email_mock):
"""You already submitted an add-on? We won't spam again."""
new_addon = Addon.objects.create(type=amo.ADDON_EXTENSION,
status=amo.STATUS_NOMINATED)
new_addon.addonuser_set.create(user=self.addon.authors.all()[0])
self.client.get(self.url)
assert not send_welcome_email_mock.called
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_finish_submitting_addon(self):
eq_(self.addon.current_version.supported_platforms, [amo.PLATFORM_ALL])
r = self.client.get(self.url)
eq_(r.status_code, 200)
doc = pq(r.content)
a = doc('a#submitted-addon-url')
url = self.addon.get_url_path()
eq_(a.attr('href'), url)
eq_(a.text(), absolutify(url))
next_steps = doc('.done-next-steps li a')
# edit listing of freshly submitted add-on...
eq_(next_steps.eq(0).attr('href'), self.addon.get_dev_url())
# edit your developer profile...
eq_(next_steps.eq(1).attr('href'), self.addon.get_dev_url('profile'))
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_finish_submitting_platform_specific_addon(self):
# mac-only Add-on:
addon = Addon.objects.get(name__localized_string='Cooliris')
AddonUser.objects.create(user=UserProfile.objects.get(pk=55021),
addon=addon)
r = self.client.get(reverse('devhub.submit.7', args=[addon.slug]))
eq_(r.status_code, 200)
next_steps = pq(r.content)('.done-next-steps li a')
# upload more platform specific files...
eq_(next_steps.eq(0).attr('href'),
reverse('devhub.versions.edit',
kwargs=dict(addon_id=addon.slug,
version_id=addon.current_version.id)))
# edit listing of freshly submitted add-on...
eq_(next_steps.eq(1).attr('href'), addon.get_dev_url())
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_finish_addon_for_prelim_review(self):
self.addon.update(status=amo.STATUS_UNREVIEWED)
response = self.client.get(self.url)
eq_(response.status_code, 200)
doc = pq(response.content)
intro = doc('.addon-submission-process p').text().strip()
assert 'Preliminary Review' in intro, ('Unexpected intro: %s' % intro)
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_finish_addon_for_full_review(self):
self.addon.update(status=amo.STATUS_NOMINATED)
response = self.client.get(self.url)
eq_(response.status_code, 200)
doc = pq(response.content)
intro = doc('.addon-submission-process p').text().strip()
assert 'Full Review' in intro, ('Unexpected intro: %s' % intro)
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_incomplete_addon_no_versions(self):
self.addon.update(status=amo.STATUS_NULL)
self.addon.versions.all().delete()
r = self.client.get(self.url, follow=True)
self.assertRedirects(r, self.addon.get_dev_url('versions'), 302)
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_link_to_activityfeed(self):
r = self.client.get(self.url, follow=True)
doc = pq(r.content)
eq_(doc('.done-next-steps a').eq(2).attr('href'),
reverse('devhub.feed', args=[self.addon.slug]))
@mock.patch('devhub.tasks.send_welcome_email.delay', new=mock.Mock)
def test_display_non_ascii_url(self):
u = 'フォクすけといっしょ'
self.addon.update(slug=u)
r = self.client.get(reverse('devhub.submit.7', args=[u]))
eq_(r.status_code, 200)
# The meta charset will always be utf-8.
doc = pq(r.content.decode('utf-8'))
eq_(doc('#submitted-addon-url').text(),
u'%s/en-US/firefox/addon/%s/' % (
settings.SITE_URL, u.decode('utf8')))
class TestResumeStep(TestSubmitBase):
def setUp(self):
super(TestResumeStep, self).setUp()
self.url = reverse('devhub.submit.resume', args=['a3615'])
def test_no_step_redirect(self):
r = self.client.get(self.url, follow=True)
self.assertRedirects(r, self.addon.get_dev_url('versions'), 302)
def test_step_redirects(self):
SubmitStep.objects.create(addon_id=3615, step=1)
for i in xrange(3, 7):
SubmitStep.objects.filter(addon=self.get_addon()).update(step=i)
r = self.client.get(self.url, follow=True)
self.assertRedirects(r, reverse('devhub.submit.%s' % i,
args=['a3615']))
def test_redirect_from_other_pages(self):
SubmitStep.objects.create(addon_id=3615, step=4)
r = self.client.get(reverse('devhub.addons.edit', args=['a3615']),
follow=True)
self.assertRedirects(r, reverse('devhub.submit.4', args=['a3615']))
class TestSubmitBump(TestSubmitBase):
def setUp(self):
super(TestSubmitBump, self).setUp()
self.url = reverse('devhub.submit.bump', args=['a3615'])
def test_bump_acl(self):
r = self.client.post(self.url, {'step': 4})
eq_(r.status_code, 403)
def test_bump_submit_and_redirect(self):
assert self.client.login(username='admin@mozilla.com',
password='password')
r = self.client.post(self.url, {'step': 4}, follow=True)
self.assertRedirects(r, reverse('devhub.submit.4', args=['a3615']))
eq_(self.get_step().step, 4)
class TestSubmitSteps(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
def assert_linked(self, doc, numbers):
"""Check that the nth <li> in the steps list is a link."""
lis = doc('.submit-addon-progress li')
eq_(len(lis), 7)
for idx, li in enumerate(lis):
links = pq(li)('a')
if (idx + 1) in numbers:
eq_(len(links), 1)
else:
eq_(len(links), 0)
def assert_highlight(self, doc, num):
"""Check that the nth <li> is marked as .current."""
lis = doc('.submit-addon-progress li')
assert pq(lis[num - 1]).hasClass('current')
eq_(len(pq('.current', lis)), 1)
def test_step_1(self):
r = self.client.get(reverse('devhub.submit.1'))
eq_(r.status_code, 200)
def test_on_step_6(self):
# Hitting the step we're supposed to be on is a 200.
SubmitStep.objects.create(addon_id=3615, step=6)
r = self.client.get(reverse('devhub.submit.6',
args=['a3615']))
eq_(r.status_code, 200)
def test_skip_step_6(self):
# We get bounced back to step 3.
SubmitStep.objects.create(addon_id=3615, step=3)
r = self.client.get(reverse('devhub.submit.6',
args=['a3615']), follow=True)
self.assertRedirects(r, reverse('devhub.submit.3', args=['a3615']))
def test_all_done(self):
# There's no SubmitStep, so we must be done.
r = self.client.get(reverse('devhub.submit.6',
args=['a3615']), follow=True)
self.assertRedirects(r, reverse('devhub.submit.7', args=['a3615']))
def test_menu_step_1(self):
doc = pq(self.client.get(reverse('devhub.submit.1')).content)
self.assert_linked(doc, [1])
self.assert_highlight(doc, 1)
def test_menu_step_2(self):
self.client.post(reverse('devhub.submit.1'))
doc = pq(self.client.get(reverse('devhub.submit.2')).content)
self.assert_linked(doc, [1, 2])
self.assert_highlight(doc, 2)
def test_menu_step_3(self):
SubmitStep.objects.create(addon_id=3615, step=3)
url = reverse('devhub.submit.3', args=['a3615'])
doc = pq(self.client.get(url).content)
self.assert_linked(doc, [3])
self.assert_highlight(doc, 3)
def test_menu_step_3_from_6(self):
SubmitStep.objects.create(addon_id=3615, step=6)
url = reverse('devhub.submit.3', args=['a3615'])
doc = pq(self.client.get(url).content)
self.assert_linked(doc, [3, 4, 5, 6])
self.assert_highlight(doc, 3)
def test_menu_step_6(self):
SubmitStep.objects.create(addon_id=3615, step=6)
url = reverse('devhub.submit.6', args=['a3615'])
doc = pq(self.client.get(url).content)
self.assert_linked(doc, [3, 4, 5, 6])
self.assert_highlight(doc, 6)
def test_menu_step_7(self):
url = reverse('devhub.submit.7', args=['a3615'])
doc = pq(self.client.get(url).content)
self.assert_linked(doc, [])
self.assert_highlight(doc, 7)
class TestUpload(BaseUploadTest):
fixtures = ['base/apps', 'base/users']
def setUp(self):
super(TestUpload, self).setUp()
assert self.client.login(username='regular@mozilla.com',
password='password')
self.url = reverse('devhub.upload')
def post(self):
# Has to be a binary, non xpi file.
data = open(get_image_path('animated.png'), 'rb')
return self.client.post(self.url, {'upload': data})
def test_login_required(self):
self.client.logout()
r = self.post()
eq_(r.status_code, 302)
def test_create_fileupload(self):
self.post()
upload = FileUpload.objects.get(name='animated.png')
eq_(upload.name, 'animated.png')
data = open(get_image_path('animated.png'), 'rb').read()
eq_(storage.open(upload.path).read(), data)
def test_fileupload_user(self):
self.client.login(username='regular@mozilla.com', password='password')
self.post()
user = UserProfile.objects.get(email='regular@mozilla.com')
eq_(FileUpload.objects.get().user, user)
@attr('validator')
def test_fileupload_validation(self):
self.post()
fu = FileUpload.objects.get(name='animated.png')
assert_no_validation_errors(fu)
assert fu.validation
validation = json.loads(fu.validation)
eq_(validation['success'], False)
# The current interface depends on this JSON structure:
eq_(validation['errors'], 1)
eq_(validation['warnings'], 0)
assert len(validation['messages'])
msg = validation['messages'][0]
assert 'uid' in msg, "Unexpected: %r" % msg
eq_(msg['type'], u'error')
eq_(msg['message'], u'The package is not of a recognized type.')
assert not msg['description'], 'Found unexpected description.'
def test_redirect(self):
r = self.post()
upload = FileUpload.objects.get()
url = reverse('devhub.upload_detail', args=[upload.pk, 'json'])
self.assertRedirects(r, url)
class TestUploadDetail(BaseUploadTest):
fixtures = ['base/apps', 'base/appversion', 'base/users']
def setUp(self):
super(TestUploadDetail, self).setUp()
assert self.client.login(username='regular@mozilla.com',
password='password')
def post(self):
# Has to be a binary, non xpi file.
data = open(get_image_path('animated.png'), 'rb')
return self.client.post(reverse('devhub.upload'), {'upload': data})
def validation_ok(self):
return {
'errors': 0,
'success': True,
'warnings': 0,
'notices': 0,
'message_tree': {},
'messages': [],
'rejected': False,
'metadata': {}}
def upload_file(self, file):
addon = os.path.join(settings.ROOT, 'apps', 'devhub', 'tests',
'addons', file)
with open(addon, 'rb') as f:
r = self.client.post(reverse('devhub.upload'),
{'upload': f})
eq_(r.status_code, 302)
@attr('validator')
def test_detail_json(self):
self.post()
upload = FileUpload.objects.get()
r = self.client.get(reverse('devhub.upload_detail',
args=[upload.uuid, 'json']))
eq_(r.status_code, 200)
data = json.loads(r.content)
assert_no_validation_errors(data)
eq_(data['url'],
reverse('devhub.upload_detail', args=[upload.uuid, 'json']))
eq_(data['full_report_url'],
reverse('devhub.upload_detail', args=[upload.uuid]))
# We must have tiers
assert len(data['validation']['messages'])
msg = data['validation']['messages'][0]
eq_(msg['tier'], 1)
def test_detail_view(self):
self.post()
upload = FileUpload.objects.get(name='animated.png')
r = self.client.get(reverse('devhub.upload_detail',
args=[upload.uuid]))
eq_(r.status_code, 200)
doc = pq(r.content)
eq_(doc('header h2').text(), 'Validation Results for animated.png')
suite = doc('#addon-validator-suite')
eq_(suite.attr('data-validateurl'),
reverse('devhub.standalone_upload_detail', args=[upload.uuid]))
@mock.patch('devhub.tasks.run_validator')
def check_excluded_platforms(self, xpi, platforms, v):
v.return_value = json.dumps(self.validation_ok())
self.upload_file(xpi)
upload = FileUpload.objects.get()
r = self.client.get(reverse('devhub.upload_detail',
args=[upload.uuid, 'json']))
eq_(r.status_code, 200)
data = json.loads(r.content)
eq_(sorted(data['platforms_to_exclude']), sorted(platforms))
def test_multi_app_addon_can_have_all_platforms(self):
self.check_excluded_platforms('mobile-2.9.10-fx+fn.xpi', [])
def test_mobile_excludes_desktop_platforms(self):
self.check_excluded_platforms('mobile-0.1-fn.xpi', [
str(p) for p in amo.DESKTOP_PLATFORMS])
def test_android_excludes_desktop_platforms(self):
# Test native Fennec.
self.check_excluded_platforms('android-phone.xpi', [
str(p) for p in amo.DESKTOP_PLATFORMS])
def test_search_tool_excludes_all_platforms(self):
self.check_excluded_platforms('searchgeek-20090701.xml', [
str(p) for p in amo.SUPPORTED_PLATFORMS])
def test_desktop_excludes_mobile(self):
self.check_excluded_platforms('desktop.xpi', [
str(p) for p in amo.MOBILE_PLATFORMS])
@mock.patch('devhub.tasks.run_validator')
@mock.patch.object(waffle, 'flag_is_active')
def test_unparsable_xpi(self, flag_is_active, v):
flag_is_active.return_value = True
v.return_value = json.dumps(self.validation_ok())
self.upload_file('unopenable.xpi')
upload = FileUpload.objects.get()
r = self.client.get(reverse('devhub.upload_detail',
args=[upload.uuid, 'json']))
data = json.loads(r.content)
eq_([(m['message'], m.get('fatal', False))
for m in data['validation']['messages']],
[(u'Could not parse install.rdf.', True)])
def assert_json_error(request, field, msg):
eq_(request.status_code, 400)
eq_(request['Content-Type'], 'application/json')
field = '__all__' if field is None else field
content = json.loads(request.content)
assert field in content, '%r not in %r' % (field, content)
eq_(content[field], [msg])
def assert_json_field(request, field, msg):
eq_(request.status_code, 200)
eq_(request['Content-Type'], 'application/json')
content = json.loads(request.content)
assert field in content, '%r not in %r' % (field, content)
eq_(content[field], msg)
class UploadTest(BaseUploadTest, amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
super(UploadTest, self).setUp()
self.upload = self.get_upload('extension.xpi')
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.addon.update(guid='guid@xpi')
if not Platform.objects.filter(id=amo.PLATFORM_MAC.id):
Platform.objects.create(id=amo.PLATFORM_MAC.id)
assert self.client.login(username='del@icio.us', password='password')
class TestQueuePosition(UploadTest):
fixtures = ['base/apps', 'base/users',
'base/addon_3615', 'base/platforms']
def setUp(self):
super(TestQueuePosition, self).setUp()
self.url = reverse('devhub.versions.add_file',
args=[self.addon.slug, self.version.id])
self.edit_url = reverse('devhub.versions.edit',
args=[self.addon.slug, self.version.id])
version_files = self.version.files.all()[0]
version_files.platform_id = amo.PLATFORM_LINUX.id
version_files.save()
def test_not_in_queue(self):
r = self.client.get(self.addon.get_dev_url('versions'))
eq_(self.addon.status, amo.STATUS_PUBLIC)
eq_(pq(r.content)('.version-status-actions .dark').length, 0)
def test_in_queue(self):
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_NOMINATED),
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED),
(amo.STATUS_LITE, amo.STATUS_UNREVIEWED)]
for addon_status in statuses:
self.addon.status = addon_status[0]
self.addon.save()
file = self.addon.latest_version.files.all()[0]
file.status = addon_status[1]
file.save()
r = self.client.get(self.addon.get_dev_url('versions'))
doc = pq(r.content)
span = doc('.version-status-actions .dark')
eq_(span.length, 1)
assert "Queue Position: 1 of 1" in span.text()
class TestVersionAddFile(UploadTest):
fixtures = ['base/apps', 'base/users',
'base/addon_3615', 'base/platforms']
def setUp(self):
super(TestVersionAddFile, self).setUp()
self.version.update(version='0.1')
self.url = reverse('devhub.versions.add_file',
args=[self.addon.slug, self.version.id])
self.edit_url = reverse('devhub.versions.edit',
args=[self.addon.slug, self.version.id])
version_files = self.version.files.all()[0]
version_files.platform_id = amo.PLATFORM_LINUX.id
version_files.save()
def make_mobile(self):
app = Application.objects.get(pk=amo.MOBILE.id)
for a in self.version.apps.all():
a.application = app
a.save()
def post(self, platform=amo.PLATFORM_MAC):
return self.client.post(self.url, dict(upload=self.upload.pk,
platform=platform.id))
def test_guid_matches(self):
self.addon.update(guid='something.different')
r = self.post()
assert_json_error(r, None, "UUID doesn't match add-on.")
def test_version_matches(self):
self.version.update(version='2.0')
r = self.post()
assert_json_error(r, None, "Version doesn't match")
def test_delete_button_enabled(self):
version = self.addon.current_version
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
r = self.client.get(self.edit_url)
doc = pq(r.content)('#file-list')
eq_(doc.find('a.remove').length, 1)
eq_(doc.find('span.remove.tooltip').length, 0)
def test_delete_button_disabled(self):
r = self.client.get(self.edit_url)
doc = pq(r.content)('#file-list')
eq_(doc.find('a.remove').length, 0)
eq_(doc.find('span.remove.tooltip').length, 1)
tip = doc.find('span.remove.tooltip')
assert "You cannot remove an individual file" in tip.attr('title')
def test_delete_button_multiple(self):
file = self.addon.current_version.files.all()[0]
file.pk = None
file.save()
cases = [(amo.STATUS_UNREVIEWED, amo.STATUS_UNREVIEWED, True),
(amo.STATUS_NULL, amo.STATUS_UNREVIEWED, False)]
for c in cases:
version_files = self.addon.current_version.files.all()
version_files[0].update(status=c[0])
version_files[1].update(status=c[1])
r = self.client.get(self.edit_url)
doc = pq(r.content)('#file-list')
assert (doc.find('a.remove').length > 0) == c[2]
assert not (doc.find('span.remove').length > 0) == c[2]
if not c[2]:
tip = doc.find('span.remove.tooltip')
assert "You cannot remove an individual" in tip.attr('title')
def test_delete_submit_disabled(self):
file_id = self.addon.current_version.files.all()[0].id
platform = amo.PLATFORM_MAC.id
form = {'DELETE': 'checked', 'id': file_id, 'platform': platform}
data = formset(form, platform=platform, upload=self.upload.pk,
initial_count=1, prefix='files')
r = self.client.post(self.edit_url, data)
doc = pq(r.content)
assert "You cannot delete a file once" in doc('.errorlist li').text()
def test_delete_submit_enabled(self):
version = self.addon.current_version
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
file_id = self.addon.current_version.files.all()[0].id
platform = amo.PLATFORM_MAC.id
form = {'DELETE': 'checked', 'id': file_id, 'platform': platform}
data = formset(form, platform=platform, upload=self.upload.pk,
initial_count=1, prefix='files')
data.update(formset(total_count=1, initial_count=1))
r = self.client.post(self.edit_url, data)
doc = pq(r.content)
eq_(doc('.errorlist li').length, 0)
def test_platform_limits(self):
r = self.post(platform=amo.PLATFORM_BSD)
assert_json_error(r, 'platform',
'Select a valid choice. That choice is not one of '
'the available choices.')
def test_platform_choices(self):
r = self.client.get(self.edit_url)
form = r.context['new_file_form']
platform = self.version.files.get().platform_id
choices = form.fields['platform'].choices
# User cannot upload existing platforms:
assert platform not in dict(choices), choices
# User cannot upload platform=ALL when platform files exist.
assert amo.PLATFORM_ALL.id not in dict(choices), choices
def test_platform_choices_when_no_files(self):
all_choices = self.version.compatible_platforms().values()
self.version.files.all().delete()
url = reverse('devhub.versions.edit',
args=[self.addon.slug, self.version.id])
r = self.client.get(url)
form = r.context['new_file_form']
eq_(sorted(dict(form.fields['platform'].choices).keys()),
sorted([p.id for p in all_choices]))
def test_platform_choices_when_mobile(self):
self.make_mobile()
self.version.files.all().delete()
r = self.client.get(self.edit_url)
form = r.context['new_file_form']
# TODO(Kumar) Allow All Mobile Platforms when supported for downloads.
# See bug 646268.
exp_plats = (set(amo.MOBILE_PLATFORMS.values()) -
set([amo.PLATFORM_ALL_MOBILE]))
eq_(sorted([unicode(c[1]) for c in form.fields['platform'].choices]),
sorted([unicode(p.name) for p in exp_plats]))
def test_exclude_mobile_all_when_we_have_platform_files(self):
self.make_mobile()
# set one to Android
self.version.files.all().update(platform=amo.PLATFORM_ANDROID.id)
r = self.post(platform=amo.PLATFORM_ALL_MOBILE)
assert_json_error(r, 'platform',
'Select a valid choice. That choice is not '
'one of the available choices.')
def test_type_matches(self):
self.addon.update(type=amo.ADDON_THEME)
r = self.post()
assert_json_error(r, None, "<em:type> doesn't match add-on")
def test_file_platform(self):
# Check that we're creating a new file with the requested platform.
qs = self.version.files
eq_(len(qs.all()), 1)
assert not qs.filter(platform=amo.PLATFORM_MAC.id)
self.post()
eq_(len(qs.all()), 2)
assert qs.get(platform=amo.PLATFORM_MAC.id)
def test_upload_not_found(self):
r = self.client.post(self.url, dict(upload='xxx',
platform=amo.PLATFORM_MAC.id))
assert_json_error(r, 'upload',
'There was an error with your upload. Please try '
'again.')
@mock.patch('versions.models.Version.is_allowed_upload')
def test_cant_upload(self, allowed):
"""Test that if is_allowed_upload fails, the upload will fail."""
allowed.return_value = False
res = self.post()
assert_json_error(res, '__all__',
'You cannot upload any more files for this version.')
def test_success_html(self):
r = self.post()
eq_(r.status_code, 200)
new_file = self.version.files.get(platform=amo.PLATFORM_MAC.id)
eq_(r.context['form'].instance, new_file)
def test_show_item_history(self):
version = self.addon.current_version
user = UserProfile.objects.get(email='editor@mozilla.com')
details = {'comments': 'yo', 'files': [version.files.all()[0].id]}
amo.log(amo.LOG.APPROVE_VERSION, self.addon,
self.addon.current_version, user=user, created=datetime.now(),
details=details)
doc = pq(self.client.get(self.edit_url).content)
appr = doc('#approval_status')
eq_(appr.length, 1)
eq_(appr.find('strong').eq(0).text(), "File (Linux)")
eq_(appr.find('.version-comments').length, 1)
comment = appr.find('.version-comments').eq(0)
eq_(comment.find('strong a').text(), 'Delicious Bookmarks Version 0.1')
eq_(comment.find('pre.email_comment').length, 1)
eq_(comment.find('pre.email_comment').text(), 'yo')
def test_show_item_history_hide_message(self):
""" Test to make sure comments not to the user aren't shown. """
version = self.addon.current_version
user = UserProfile.objects.get(email='editor@mozilla.com')
details = {'comments': 'yo', 'files': [version.files.all()[0].id]}
amo.log(amo.LOG.REQUEST_SUPER_REVIEW, self.addon,
self.addon.current_version, user=user, created=datetime.now(),
details=details)
doc = pq(self.client.get(self.edit_url).content)
comment = doc('#approval_status').find('.version-comments').eq(0)
eq_(comment.find('pre.email_comment').length, 0)
def test_show_item_history_multiple(self):
version = self.addon.current_version
user = UserProfile.objects.get(email='editor@mozilla.com')
details = {'comments': 'yo', 'files': [version.files.all()[0].id]}
amo.log(amo.LOG.APPROVE_VERSION, self.addon,
self.addon.current_version, user=user, created=datetime.now(),
details=details)
amo.log(amo.LOG.REQUEST_SUPER_REVIEW, self.addon,
self.addon.current_version, user=user, created=datetime.now(),
details=details)
doc = pq(self.client.get(self.edit_url).content)
comments = doc('#approval_status').find('.version-comments')
eq_(comments.length, 2)
class TestUploadErrors(UploadTest):
fixtures = ['base/apps', 'base/users',
'base/addon_3615', 'base/platforms']
validator_success = json.dumps({
"errors": 0,
"success": True,
"warnings": 0,
"notices": 0,
"message_tree": {},
"messages": [],
"metadata": {},
})
def xpi(self):
return open(os.path.join(os.path.dirname(files.__file__),
'fixtures', 'files',
'delicious_bookmarks-2.1.106-fx.xpi'),
'rb')
@mock.patch.object(waffle, 'flag_is_active')
@mock.patch('devhub.tasks.run_validator')
def test_version_upload(self, run_validator, flag_is_active):
run_validator.return_value = ''
flag_is_active.return_value = True
# Load the versions page:
res = self.client.get(self.addon.get_dev_url('versions'))
eq_(res.status_code, 200)
doc = pq(res.content)
# javascript: upload file:
upload_url = doc('#upload-addon').attr('data-upload-url')
with self.xpi() as f:
res = self.client.post(upload_url, {'upload': f}, follow=True)
data = json.loads(res.content)
# Simulate the validation task finishing after a delay:
run_validator.return_value = self.validator_success
tasks.validator.delay(data['upload'])
# javascript: poll for status:
res = self.client.get(data['url'])
data = json.loads(res.content)
if data['validation'] and data['validation']['messages']:
raise AssertionError('Unexpected validation errors: %s'
% data['validation']['messages'])
@mock.patch.object(waffle, 'flag_is_active')
@mock.patch('devhub.tasks.run_validator')
def test_dupe_xpi(self, run_validator, flag_is_active):
run_validator.return_value = ''
flag_is_active.return_value = True
# Submit a new addon:
self.client.post(reverse('devhub.submit.1')) # set cookie
res = self.client.get(reverse('devhub.submit.2'))
eq_(res.status_code, 200)
doc = pq(res.content)
# javascript: upload file:
upload_url = doc('#upload-addon').attr('data-upload-url')
with self.xpi() as f:
res = self.client.post(upload_url, {'upload': f}, follow=True)
data = json.loads(res.content)
# Simulate the validation task finishing after a delay:
run_validator.return_value = self.validator_success
tasks.validator.delay(data['upload'])
# javascript: poll for results:
res = self.client.get(data['url'])
data = json.loads(res.content)
eq_(list(m['message'] for m in data['validation']['messages']),
[u'Duplicate UUID found.'])
class AddVersionTest(UploadTest):
def post(self, desktop_platforms=[amo.PLATFORM_MAC], mobile_platforms=[],
override_validation=False, expected_status=200):
d = dict(upload=self.upload.pk,
desktop_platforms=[p.id for p in desktop_platforms],
mobile_platforms=[p.id for p in mobile_platforms],
admin_override_validation=override_validation)
r = self.client.post(self.url, d)
eq_(r.status_code, expected_status)
return r
def setUp(self):
super(AddVersionTest, self).setUp()
self.url = reverse('devhub.versions.add', args=[self.addon.slug])
class TestAddVersion(AddVersionTest):
def test_unique_version_num(self):
self.version.update(version='0.1')
r = self.post(expected_status=400)
assert_json_error(r, None, 'Version 0.1 already exists')
def test_success(self):
r = self.post()
version = self.addon.versions.get(version='0.1')
assert_json_field(r, 'url',
reverse('devhub.versions.edit',
args=[self.addon.slug, version.id]))
def test_public(self):
self.post()
fle = File.objects.all().order_by("-created")[0]
eq_(fle.status, amo.STATUS_PUBLIC)
def test_not_public(self):
self.addon.update(trusted=False)
self.post()
fle = File.objects.all().order_by("-created")[0]
assert_not_equal(fle.status, amo.STATUS_PUBLIC)
def test_multiple_platforms(self):
r = self.post(desktop_platforms=[amo.PLATFORM_MAC,
amo.PLATFORM_LINUX])
eq_(r.status_code, 200)
version = self.addon.versions.get(version='0.1')
eq_(len(version.all_files), 2)
class TestAddBetaVersion(AddVersionTest):
fixtures = ['base/apps', 'base/users', 'base/appversion',
'base/addon_3615', 'base/platforms']
def setUp(self):
super(TestAddBetaVersion, self).setUp()
self.do_upload()
def do_upload(self):
self.upload = self.get_upload('extension-0.2b1.xpi')
def post_additional(self, version, platform=amo.PLATFORM_MAC):
url = reverse('devhub.versions.add_file',
args=[self.addon.slug, version.id])
return self.client.post(url, dict(upload=self.upload.pk,
platform=platform.id))
def test_add_multi_file_beta(self):
r = self.post(desktop_platforms=[amo.PLATFORM_MAC])
version = self.addon.versions.all().order_by('-id')[0]
# Make sure that the first file is beta
fle = File.objects.all().order_by('-id')[0]
eq_(fle.status, amo.STATUS_BETA)
self.do_upload()
r = self.post_additional(version, platform=amo.PLATFORM_LINUX)
eq_(r.status_code, 200)
# Make sure that the additional files are beta
fle = File.objects.all().order_by('-id')[0]
eq_(fle.status, amo.STATUS_BETA)
class TestAddVersionValidation(AddVersionTest):
def login_as_admin(self):
assert self.client.login(username='admin@mozilla.com',
password='password')
def do_upload_non_fatal(self):
validation = {
'errors': 1,
'detected_type': 'extension',
'success': False,
'warnings': 0,
'notices': 0,
'message_tree': {},
'ending_tier': 5,
'messages': [
{'description': 'The subpackage could not be opened due to '
'issues with corruption. Ensure that the file '
'is valid.',
'type': 'error',
'id': [],
'file': 'unopenable.jar',
'tier': 2,
'message': 'Subpackage corrupt.',
'uid': '8a3d5854cf0d42e892b3122259e99445',
'compatibility_type': None}],
'metadata': {}}
self.upload = self.get_upload(
'validation-error.xpi',
validation=json.dumps(validation))
assert not self.upload.valid
def test_non_admin_validation_override_fails(self):
self.do_upload_non_fatal()
self.post(override_validation=True, expected_status=400)
def test_admin_validation_override(self):
self.login_as_admin()
self.do_upload_non_fatal()
assert not self.addon.admin_review
self.post(override_validation=True, expected_status=200)
eq_(self.addon.reload().admin_review, True)
def test_admin_validation_sans_override(self):
self.login_as_admin()
self.do_upload_non_fatal()
self.post(override_validation=False, expected_status=400)
class TestVersionXSS(UploadTest):
def test_unique_version_num(self):
self.version.update(
version='<script>alert("Happy XSS-Xmas");</script>')
r = self.client.get(reverse('devhub.addons'))
eq_(r.status_code, 200)
assert '<script>alert' not in r.content
assert '<script>alert' in r.content
class UploadAddon(object):
def post(self, desktop_platforms=[amo.PLATFORM_ALL], mobile_platforms=[],
expect_errors=False):
d = dict(upload=self.upload.pk,
desktop_platforms=[p.id for p in desktop_platforms],
mobile_platforms=[p.id for p in mobile_platforms])
r = self.client.post(self.url, d, follow=True)
eq_(r.status_code, 200)
if not expect_errors:
# Show any unexpected form errors.
if r.context and 'new_addon_form' in r.context:
eq_(r.context['new_addon_form'].errors.as_text(), '')
return r
class TestCreateAddon(BaseUploadTest, UploadAddon, amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/platforms']
def setUp(self):
super(TestCreateAddon, self).setUp()
self.upload = self.get_upload('extension.xpi')
self.url = reverse('devhub.submit.2')
assert self.client.login(username='regular@mozilla.com',
password='password')
self.client.post(reverse('devhub.submit.1'))
def assert_json_error(self, *args):
UploadTest().assert_json_error(self, *args)
def test_unique_name(self):
addon_factory(name='xpi name')
r = self.post(expect_errors=True)
eq_(r.context['new_addon_form'].non_field_errors(),
['This name is already in use. Please choose another.'])
def test_success(self):
eq_(Addon.objects.count(), 0)
r = self.post()
addon = Addon.objects.get()
self.assertRedirects(r, reverse('devhub.submit.3', args=[addon.slug]))
log_items = ActivityLog.objects.for_addons(addon)
assert log_items.filter(action=amo.LOG.CREATE_ADDON.id), (
'New add-on creation never logged.')
def test_missing_platforms(self):
r = self.client.post(self.url, dict(upload=self.upload.pk))
eq_(r.status_code, 200)
eq_(r.context['new_addon_form'].errors.as_text(),
'* __all__\n * Need at least one platform.')
doc = pq(r.content)
eq_(doc('ul.errorlist').text(),
'Need at least one platform.')
def test_one_xpi_for_multiple_platforms(self):
eq_(Addon.objects.count(), 0)
r = self.post(desktop_platforms=[amo.PLATFORM_MAC,
amo.PLATFORM_LINUX])
addon = Addon.objects.get()
self.assertRedirects(r, reverse('devhub.submit.3',
args=[addon.slug]))
eq_(sorted([f.filename for f in addon.current_version.all_files]),
[u'xpi_name-0.1-linux.xpi', u'xpi_name-0.1-mac.xpi'])
class TestDeleteAddon(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.url = self.addon.get_dev_url('delete')
self.client.login(username='admin@mozilla.com', password='password')
def test_bad_password(self):
r = self.client.post(self.url, dict(password='turd'))
self.assertRedirects(r, self.addon.get_dev_url('versions'))
eq_(r.context['title'],
'Password was incorrect. Add-on was not deleted.')
eq_(Addon.objects.count(), 1)
def test_success(self):
r = self.client.post(self.url, dict(password='password'))
self.assertRedirects(r, reverse('devhub.addons'))
eq_(r.context['title'], 'Add-on deleted.')
eq_(Addon.objects.count(), 0)
class TestRequestReview(amo.tests.TestCase):
fixtures = ['base/users', 'base/platforms']
def setUp(self):
self.addon = Addon.objects.create(type=1, name='xxx')
self.version = Version.objects.create(addon=self.addon)
self.file = File.objects.create(version=self.version,
platform_id=amo.PLATFORM_ALL.id)
self.redirect_url = self.addon.get_dev_url('versions')
self.lite_url = reverse('devhub.request-review',
args=[self.addon.slug, amo.STATUS_LITE])
self.public_url = reverse('devhub.request-review',
args=[self.addon.slug, amo.STATUS_PUBLIC])
assert self.client.login(username='admin@mozilla.com',
password='password')
def get_addon(self):
return Addon.objects.get(id=self.addon.id)
def get_version(self):
return Version.objects.get(pk=self.version.id)
def check(self, old_status, url, new_status):
self.addon.update(status=old_status)
r = self.client.post(url)
self.assertRedirects(r, self.redirect_url)
eq_(self.get_addon().status, new_status)
def check_400(self, url):
r = self.client.post(url)
eq_(r.status_code, 400)
def test_404(self):
bad_url = self.public_url.replace(str(amo.STATUS_PUBLIC), '0')
eq_(self.client.post(bad_url).status_code, 404)
def test_public(self):
self.addon.update(status=amo.STATUS_PUBLIC)
self.check_400(self.lite_url)
self.check_400(self.public_url)
def test_disabled_by_user_to_lite(self):
self.addon.update(disabled_by_user=True)
self.check_400(self.lite_url)
def test_disabled_by_admin(self):
self.addon.update(status=amo.STATUS_DISABLED)
self.check_400(self.lite_url)
def test_lite_to_lite(self):
self.addon.update(status=amo.STATUS_LITE)
self.check_400(self.lite_url)
def test_lite_to_public(self):
eq_(self.version.nomination, None)
self.check(amo.STATUS_LITE, self.public_url,
amo.STATUS_LITE_AND_NOMINATED)
self.assertCloseToNow(self.get_version().nomination)
def test_purgatory_to_lite(self):
self.check(amo.STATUS_PURGATORY, self.lite_url, amo.STATUS_UNREVIEWED)
def test_purgatory_to_public(self):
eq_(self.version.nomination, None)
self.check(amo.STATUS_PURGATORY, self.public_url,
amo.STATUS_NOMINATED)
self.assertCloseToNow(self.get_version().nomination)
def test_lite_and_nominated_to_public(self):
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
self.check_400(self.public_url)
def test_lite_and_nominated(self):
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
self.check_400(self.lite_url)
self.check_400(self.public_url)
def test_renominate_for_full_review(self):
# When a version is rejected, the addon is disabled.
# The author must upload a new version and re-nominate.
# However, renominating the *same* version does not adjust the
# nomination date.
orig_date = datetime.now() - timedelta(days=30)
# Pretend it was nominated in the past:
self.version.update(nomination=orig_date)
self.check(amo.STATUS_NULL, self.public_url, amo.STATUS_NOMINATED)
eq_(self.get_version().nomination.timetuple()[0:5],
orig_date.timetuple()[0:5])
def test_renomination_doesnt_reset_nomination_date(self):
# Nominate:
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
# Pretend it was nominated in the past:
orig_date = datetime.now() - timedelta(days=30)
self.version.update(nomination=orig_date, _signal=False)
# Reject it:
self.addon.update(status=amo.STATUS_NULL)
# Re-nominate:
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
eq_(self.get_version().nomination.timetuple()[0:5],
orig_date.timetuple()[0:5])
class TestRedirects(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.base = reverse('devhub.index')
assert self.client.login(username='admin@mozilla.com',
password='password')
def test_edit(self):
url = self.base + 'addon/edit/3615'
r = self.client.get(url, follow=True)
self.assertRedirects(r, reverse('devhub.addons.edit', args=['a3615']),
301)
url = self.base + 'addon/edit/3615/'
r = self.client.get(url, follow=True)
self.assertRedirects(r, reverse('devhub.addons.edit', args=['a3615']),
301)
def test_status(self):
url = self.base + 'addon/status/3615'
r = self.client.get(url, follow=True)
self.assertRedirects(r, reverse('devhub.addons.versions',
args=['a3615']), 301)
def test_versions(self):
url = self.base + 'versions/3615'
r = self.client.get(url, follow=True)
self.assertRedirects(r, reverse('devhub.addons.versions',
args=['a3615']), 301)
class TestDocs(amo.tests.TestCase):
def test_doc_urls(self):
eq_('/en-US/developers/docs/', reverse('devhub.docs', args=[]))
eq_('/en-US/developers/docs/te', reverse('devhub.docs', args=['te']))
eq_('/en-US/developers/docs/te/st', reverse('devhub.docs',
args=['te', 'st']))
urls = [(reverse('devhub.docs', args=["getting-started"]), 200),
(reverse('devhub.docs', args=["how-to"]), 200),
(reverse('devhub.docs', args=["how-to", "other-addons"]), 200),
(reverse('devhub.docs', args=["fake-page"]), 302),
(reverse('devhub.docs', args=["how-to", "fake-page"]), 200),
(reverse('devhub.docs'), 302)]
index = reverse('devhub.index')
for url in urls:
r = self.client.get(url[0])
eq_(r.status_code, url[1])
if url[1] == 302: # Redirect to the index page
self.assertRedirects(r, index)
class TestRemoveLocale(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
def setUp(self):
self.addon = Addon.objects.get(id=3615)
self.url = reverse('devhub.addons.remove-locale', args=['a3615'])
assert self.client.login(username='del@icio.us', password='password')
def test_bad_request(self):
r = self.client.post(self.url)
eq_(r.status_code, 400)
def test_success(self):
self.addon.name = {'en-US': 'woo', 'el': 'yeah'}
self.addon.save()
self.addon.remove_locale('el')
qs = (Translation.objects.filter(localized_string__isnull=False)
.values_list('locale', flat=True))
r = self.client.post(self.url, {'locale': 'el'})
eq_(r.status_code, 200)
eq_(sorted(qs.filter(id=self.addon.name_id)), ['en-US'])
def test_delete_default_locale(self):
r = self.client.post(self.url, {'locale': self.addon.default_locale})
eq_(r.status_code, 400)
def test_remove_version_locale(self):
version = self.addon.versions.all()[0]
version.releasenotes = {'fr': 'oui'}
version.save()
self.client.post(self.url, {'locale': 'fr'})
res = self.client.get(reverse('devhub.versions.edit',
args=[self.addon.slug, version.pk]))
doc = pq(res.content)
# There's 2 fields, one for en-us, one for init.
eq_(len(doc('div.trans textarea')), 2)
class TestSearch(amo.tests.TestCase):
def test_search_titles(self):
r = self.client.get(reverse('devhub.search'), {'q': 'davor'})
self.assertContains(r, '"davor"</h1>')
self.assertContains(r, '<title>davor :: Search ::')
def test_search_titles_default(self):
r = self.client.get(reverse('devhub.search'))
self.assertContains(r, '<title>Search ::')
self.assertContains(r, '<h1>Search Results</h1>')
|
{
"content_hash": "4c2ac235cd6794c90efd14e78a94820f",
"timestamp": "",
"source": "github",
"line_count": 3193,
"max_line_length": 79,
"avg_line_length": 39.00469777638585,
"alnum_prop": 0.589126559714795,
"repo_name": "Joergen/zamboni",
"id": "bd0e95026dab77e86a790c4fedae1876b310d39a",
"size": "124586",
"binary": false,
"copies": "1",
"ref": "refs/heads/uge43",
"path": "apps/devhub/tests/test_views.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "4145"
},
{
"name": "CSS",
"bytes": "608838"
},
{
"name": "JavaScript",
"bytes": "1750529"
},
{
"name": "Perl",
"bytes": "565"
},
{
"name": "Puppet",
"bytes": "13808"
},
{
"name": "Python",
"bytes": "6063534"
},
{
"name": "Ruby",
"bytes": "1865"
},
{
"name": "Shell",
"bytes": "19774"
}
],
"symlink_target": ""
}
|
#import "MgLayerState.h"
@interface MgGroupLayerState : MgLayerState
@property(nonatomic, assign, getter=isPassThrough) BOOL passThrough;
@property(nonatomic, assign) BOOL flattensSublayers;
@end
|
{
"content_hash": "af7c45dc4c9fd47e0a0944a308d601e2",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 68,
"avg_line_length": 20.1,
"alnum_prop": 0.8009950248756219,
"repo_name": "a2/glint",
"id": "7c4e5f7a2821c453dd44bbe845e082a4547bbf40",
"size": "1358",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "mg/MgGroupLayerState.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4608"
},
{
"name": "C++",
"bytes": "5504"
},
{
"name": "Objective-C",
"bytes": "584426"
},
{
"name": "Objective-C++",
"bytes": "2190"
}
],
"symlink_target": ""
}
|
using System;
namespace SharperArchitecture.Domain.Attributes
{
public class IgnoreAttribute : Attribute
{
}
}
|
{
"content_hash": "0b9aec0c0afcd8774a990326774ec78f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 47,
"avg_line_length": 15.5,
"alnum_prop": 0.7258064516129032,
"repo_name": "maca88/PowerArhitecture",
"id": "5e957daa0615c424b5656956c2f219144cd721fd",
"size": "124",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/SharperArchitecture.Domain/Attributes/IgnoreAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "133"
},
{
"name": "Batchfile",
"bytes": "1856"
},
{
"name": "C#",
"bytes": "1199472"
},
{
"name": "JavaScript",
"bytes": "1048"
}
],
"symlink_target": ""
}
|
/**
* Bootstrap Table Slovak translation
* Author: Jozef Dúc<jozef.d13@gmail.com>
*/
$.fn.bootstrapTable.locales['sk-SK'] = $.fn.bootstrapTable.locales['sk'] = {
formatCopyRows () {
return 'Skopírovať riadky'
},
formatPrint () {
return 'Vytlačiť'
},
formatLoadingMessage () {
return 'Prosím čakajte'
},
formatRecordsPerPage (pageNumber) {
return `${pageNumber} záznamov na stranu`
},
formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
return `Zobrazená ${pageFrom}. - ${pageTo}. položka z celkových ${totalRows} (filtered from ${totalNotFiltered} total rows)`
}
return `Zobrazená ${pageFrom}. - ${pageTo}. položka z celkových ${totalRows}`
},
formatSRPaginationPreText () {
return 'Predchádzajúca strana'
},
formatSRPaginationPageText (page) {
return `na stranu ${page}`
},
formatSRPaginationNextText () {
return 'Nasledujúca strana'
},
formatDetailPagination (totalRows) {
return `Zobrazuje sa ${totalRows} riadkov`
},
formatClearSearch () {
return 'Odstráň filtre'
},
formatSearch () {
return 'Vyhľadávanie'
},
formatNoMatches () {
return 'Nenájdená žiadna vyhovujúca položka'
},
formatPaginationSwitch () {
return 'Skry/Zobraz stránkovanie'
},
formatPaginationSwitchDown () {
return 'Zobraziť stránkovanie'
},
formatPaginationSwitchUp () {
return 'Skryť stránkovanie'
},
formatRefresh () {
return 'Obnoviť'
},
formatToggleOn () {
return 'Zobraziť kartové zobrazenie'
},
formatToggleOff () {
return 'skryť kartové zobrazenie'
},
formatColumns () {
return 'Stĺpce'
},
formatColumnsToggleAll () {
return 'Prepnúť všetky'
},
formatFullscreen () {
return 'Celá obrazovka'
},
formatAllRows () {
return 'Všetky'
},
formatAutoRefresh () {
return 'Automatické obnovenie'
},
formatExport () {
return 'Exportuj dáta'
},
formatJumpTo () {
return 'Ísť'
},
formatAdvancedSearch () {
return 'Pokročilé vyhľadávanie'
},
formatAdvancedCloseButton () {
return 'Zatvoriť'
},
formatFilterControlSwitch () {
return 'Zobraziť/Skryť tlačidlá'
},
formatFilterControlSwitchHide () {
return 'Skryť tlačidlá'
},
formatFilterControlSwitchShow () {
return 'Zobraziť tlačidlá'
}
}
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['sk-SK'])
|
{
"content_hash": "05c32a4347df7d9a544beff20179009e",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 130,
"avg_line_length": 24.29126213592233,
"alnum_prop": 0.6614708233413269,
"repo_name": "wenzhixin/bootstrap-table",
"id": "5d413fc927fa9a674eaf9d8ddc9308583f35bf2b",
"size": "2563",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/locale/bootstrap-table-sk-SK.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2625"
},
{
"name": "HTML",
"bytes": "25313"
},
{
"name": "JavaScript",
"bytes": "79219"
},
{
"name": "Ruby",
"bytes": "310"
},
{
"name": "SCSS",
"bytes": "11145"
},
{
"name": "Vue",
"bytes": "21458"
}
],
"symlink_target": ""
}
|
import random
import string
def random_string_simple(maxlen):
symbols = string.ascii_letters + string.digits + ' '*13 + '-'*3 + '_'*3
# + "'"*3
return ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))])
def random_username(prefix, maxlen):
symbols = string.ascii_letters + string.digits + '-'*3 + '_'*3 + "."*3
return prefix + ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))])
def test_signup_new_account(app):
username = random_username("user_", 10)
password = "test"
email=username + '@localhost'
# nie robimy odrębnej fixtury dla serwera pocztowego tylko dodatkowy helper do fixtury application (tak samo jak przy session)
app.james.ensure_user_exist(username, password)
app.signup.new_user(username, email, password)
# sprawdzenie w aplikacji
# app.session.login(username, password)
# assert app.session.is_logged_in_as(username)
# app.session.logout()
# sprawdzenie przez soap
assert app.soap.can_login(username, password)
|
{
"content_hash": "e93c61b661ce62f4a0f0e12856302a9b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 130,
"avg_line_length": 39.629629629629626,
"alnum_prop": 0.6728971962616822,
"repo_name": "Droriel/python_training_mantis",
"id": "49982d7f9a346eaf10b4ca2df13b22c7c4d82b42",
"size": "1071",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test_signup_new_account.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "356"
},
{
"name": "Python",
"bytes": "29852"
}
],
"symlink_target": ""
}
|
@interface ViewController ()
@end
@implementation ViewController
#pragma mark - Lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Example";
self.edgesForExtendedLayout = UIRectEdgeNone;
self.view.backgroundColor = [UIColor whiteColor];
UIButton *objectivecButton = [UIButton buttonWithType:UIButtonTypeSystem];
[objectivecButton setTitle:@"Objective-C" forState:UIControlStateNormal];
[objectivecButton addTarget:self action:@selector(onObjectivec) forControlEvents:UIControlEventTouchUpInside];
objectivecButton.frame = CGRectMake(self.view.frame.size.width / 2 - 50, 20, 100, 30);
[self.view addSubview:objectivecButton];
UIButton *swiftButton = [UIButton buttonWithType:UIButtonTypeSystem];
[swiftButton setTitle:@"Swift" forState:UIControlStateNormal];
[swiftButton addTarget:self action:@selector(onSwift) forControlEvents:UIControlEventTouchUpInside];
swiftButton.frame = CGRectMake(self.view.frame.size.width / 2 - 50, 70, 100, 30);
[self.view addSubview:swiftButton];
}
#pragma mark - Action
- (void)onSwift {
SwiftController *viewController = [[SwiftController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
}
- (void)onObjectivec {
ObjectivecController *viewController = [[ObjectivecController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
}
@end
|
{
"content_hash": "22f000f7d0e1945695f6a1873fe41baf",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 114,
"avg_line_length": 37.30769230769231,
"alnum_prop": 0.7580756013745704,
"repo_name": "lszzy/FWDebug",
"id": "e54ef3250edf622358f7fb995b3a166b2e322013",
"size": "1676",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/Example/ViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7703"
},
{
"name": "HTML",
"bytes": "31168"
},
{
"name": "JavaScript",
"bytes": "65257"
},
{
"name": "Objective-C",
"bytes": "285952"
},
{
"name": "Ruby",
"bytes": "2196"
},
{
"name": "Shell",
"bytes": "1191"
},
{
"name": "Swift",
"bytes": "4269"
}
],
"symlink_target": ""
}
|
JSONEventCalendar
=================
Description
-----------
JSONEventCalendar is jQuery plugin to create calendar which shows events in JSON format.
Each event has element like: title, date and time, type, link and more.
You can set own date format to show on list of events, choose colors of events and more - check feature list.
index.html is example
Progress
-----------

Features
-----------
- Events are JSON objects of event
- Date format for event and title of calendar
- Colors for event type
How to use
-----------
Call JSONEventCalendar on element in HTML and pass event as parametr.
One event have:
* id - need to show correct event details
* type - name of type (optional)
* color - color of type
* title - need to show on list
* url - url (optional)
* description
* date - correct date
Option for JSONEventCalendar:
* lang - language from moment
* formatTitle - display format ; check here: http://momentjs.com/docs/#/displaying/format/
* formatEvent - display format ; check here: http://momentjs.com/docs/#/displaying/format/
* startFrom - first day of week ; 0 - Sunday, 1 - Monday etc.
* eventsInDay - FUTURE FEATURE ; how many events display in day of calendar
* closeText - override default text
* typeText - override default text
Version
-----------
1.0
License
-----------
MIT
Changelog
-----------
1.0 First release
0.1 Initial version
Languages
-----------
Multilanguage - support by moment.js
|
{
"content_hash": "57f5452acd570b7de0e2df77d050fee9",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 109,
"avg_line_length": 21.782608695652176,
"alnum_prop": 0.6959414504324684,
"repo_name": "dszymczuk/JSONEventCalendar",
"id": "a1052244ded19f86f85960ede0b9433b02f8d582",
"size": "1503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7488"
},
{
"name": "JavaScript",
"bytes": "67040"
},
{
"name": "Ruby",
"bytes": "868"
}
],
"symlink_target": ""
}
|
"""
Extra friendly XML node API for Python
"""
from amara import Error
from amara.lib.util import set_namespaces
from amara import tree
def parse(obj, uri=None, entity_factory=None, standalone=False, validate=False, prefixes=None, model=None):
if model:
entity_factory = model.clone
if not entity_factory:
entity_factory = nodes.entity_base
doc = tree.parse(obj, uri, entity_factory=entity_factory, standalone=standalone, validate=validate)
if prefixes: set_namespaces(doc, prefixes)
return doc
class BinderyError(Error):
CONSTRAINT_VIOLATION = 1
@classmethod
def _load_messages(cls):
from gettext import gettext as _
return {
# -- internal/unexpected errors --------------------------------
BinderyError.CONSTRAINT_VIOLATION: _(
'Failed constraint: "%(constraint)s" in context of node %(node)s.'),
}
#FIXME: Use proper L10N (gettext)
def _(t): return t
import nodes
|
{
"content_hash": "b4db3ca4abd48a7af89354e91dcf93b4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 107,
"avg_line_length": 28.2,
"alnum_prop": 0.6494427558257345,
"repo_name": "zepheira/amara",
"id": "be08e9362b9900fb5c56dadf1d6ee9715eb171a6",
"size": "1089",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/bindery/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1830216"
},
{
"name": "C++",
"bytes": "82201"
},
{
"name": "GLSL",
"bytes": "5081"
},
{
"name": "HTML",
"bytes": "578831"
},
{
"name": "JavaScript",
"bytes": "18734"
},
{
"name": "Logos",
"bytes": "175"
},
{
"name": "Objective-C",
"bytes": "26041"
},
{
"name": "Python",
"bytes": "1507578"
},
{
"name": "Shell",
"bytes": "2497"
},
{
"name": "XSLT",
"bytes": "398316"
}
],
"symlink_target": ""
}
|
var width;
var height;
var layoutValue=0;
var canDescend=false;
$(document).ready(function() {
$.getJSON('data.json', function(JSON) {
var units = "USD";
var chartElement = $("#loanFlowChart");
var margin = {top: 10, right: 10, bottom: 10, left: 10};
width = chartElement.width();
height = chartElement.height();
var formatNumber = d3.format(",.0f"), // zero decimal places
format = function(d) { return formatNumber(d) + " " + units; },
color = d3.scale.category20();
var url = window.location.protocol + "//" + window.location.host + window.location.pathname;
drawChart();
function handleResize()
{
if (width != chartElement.width())
{
width = chartElement.width();
drawChart(true);
}
}
setInterval(handleResize, 500);
function drawChart(redraw)
{
if (redraw)
{
d3.selectAll(".link").remove();
d3.selectAll(".node").remove();
d3.selectAll("#loanFlowChart svg").remove();
}
var sankey = d3.sankey()
.size([width, height - margin.bottom])
.nodes(JSON.nodes)
.links(JSON.links)
.nodeWidth(20)
.nodePadding(10);
// If layoutValue is non-zero, we're not looking at the whole map, so
// we want to optimize the height of the display. To do that, we set the
// sankey height to something small (100) and call layoutTest to get a
// new optimal height.
if (layoutValue)
{
sankey.size([width, 100]);
height = sankey.layoutTest(1);
chartElement.height((height + margin.bottom) + "px");
sankey.size([width, height])
}
// append the svg canvas to the page
var svg = d3.select("#loanFlowChart").append("svg")
.attr("width", (width + margin.right)+"px")
.attr("height", (height + margin.bottom)+"px")
.attr("id", "loanFlowSVG")
.append("g")
.attr("transform", "translate(1,1)");
// Set the sankey layout property (0 means don't sort the nodes; higher values will
// sort the nodes by size.
sankey.layout(layoutValue); // layoutValue is a global set by the module
var path = sankey.link();
// add in the links
var link = svg.append("g")
.attr("class", "links")
.selectAll(".link")
.data(JSON.links)
.enter().append("path")
.attr("class", function(d) {
if (canDescend) {
return "link clickable";
} else {
return "link";
}
})
.attr("d", path)
.style("stroke-width", function(d) { return Math.max(1, d.dy); })
.style("stroke", function(d) { return d.color = color(d.source.name.replace(/ .*/, "")); })
.sort(function(a, b) { return b.dy - a.dy; });
// add the link titles
link.append("title")
.text(function(d) {
return d.source.name + " → " +
d.target.name + "\n" + format(d.value);
});
// set the action for clicking on links
if (canDescend)
{
link.on("click", function() {
var major = d3.select(this).datum().source.name;
var career = d3.select(this).datum().target.name;
window.location = url + "?major=" + major + "&career=" + career;
})
}
// add in the nodes
var node = svg.append("g")
.attr("class", "nodes")
.selectAll(".node")
.data(JSON.nodes)
.enter().append("g")
.attr("class", function(d) {
if (canDescend) {
return "node clickable";
} else {
return "node";
}
})
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
// add the rectangles for the nodes
node.append("rect")
.attr("height", function(d) { return d.dy; })
.attr("width", sankey.nodeWidth())
.style("fill", function(d) {
return d.color = color(d.name.replace(/ .*/, ""));
})
.style("stroke", function(d) {
return d3.rgb(d.color).darker(2);
})
.append("title")
.text(function(d) {
return d.name + "\n" + format(d.value);
});
// add in the title for the nodes
node.append("text")
.attr("x", -6)
.attr("y", function(d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) { return d.name; })
.filter(function(d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
// set the action for clicking on nodes
node.on("click", function() {
// Left node
if (d3.select(this).datum().x == 0) {
var major = d3.select(this).datum().name;
window.location = url + "?major=" + major;
}
// Right node
else if (canDescend) {
var career = d3.select(this).datum().name;
window.location = url + "?career=" + career;
}
});
drawCareerResources(sankey, redraw);
};
// Add the links on the right side of each career
function drawCareerResources(sankey, redraw) {
if (redraw)
{
document.getElementById("careerLink").innerHTML = "";
}
sankey.nodes().forEach(function(node) {
if (node.link) {
var firstDiv = document.createElement('div');
var xPos = node.x + sankey.nodeWidth() + 5;
var yPos = node.y;
var height = node.dy;
firstDiv.setAttribute('style', 'margin-top:'+yPos+'px; margin-left:'+xPos+'px; height:'+height+'px');
firstDiv.innerHTML = node.link;
document.getElementById('careerLink').appendChild(firstDiv);
}
});
}
});
});
|
{
"content_hash": "41e1bb45dc349e7b5bee725ef049e349",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 105,
"avg_line_length": 26.149253731343283,
"alnum_prop": 0.594558599695586,
"repo_name": "fdurant/fdurant_github_io_source",
"id": "d6a4642d7a269e891789a2b516ecf26e6d04a455",
"size": "5340",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "projects/kiva-loan-funding-predictor-project/loanflow_visualizer.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "100096"
},
{
"name": "Dockerfile",
"bytes": "199"
},
{
"name": "HTML",
"bytes": "104940"
},
{
"name": "JavaScript",
"bytes": "611281"
},
{
"name": "Ruby",
"bytes": "725"
},
{
"name": "SCSS",
"bytes": "45409"
},
{
"name": "Shell",
"bytes": "2295"
}
],
"symlink_target": ""
}
|
package org.ow2.contrail.common.implementation.ovf;
import java.util.ArrayList;
import java.util.Collection;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.ow2.contrail.common.implementation.application.ApplianceDescriptor;
/**
* Represents an OVF startup section block.
*/
public class OVFStartupSection
{
private Collection<Item> items;
public OVFStartupSection(){
items=new ArrayList<Item>();
}
public Collection<Item> getItems()
{
return items;
}
public static class Item {
private String id;
private int order;
private ApplianceDescriptor appliance;
public Item(String id, int order)
{
this.id = id;
this.order = order;
}
public String getId()
{
return id;
}
public int getOrder()
{
return order;
}
public ApplianceDescriptor getApplianceDescriptor()
{
return appliance;
}
public void setApplianceDescriptor(ApplianceDescriptor appliance)
{
this.appliance = appliance;
}
}
//FIXME added to StAx
public OVFStartupSection(XMLEvent e, XMLEventReader r) throws XMLStreamException {
// TODO Auto-generated constructor stub
this();
boolean end=false;
while(!end&&r.hasNext()){
e=r.nextEvent();
end=(e.isEndElement()&&e.asEndElement().getName().getLocalPart().contentEquals("StartupSection"));
if(!end){
switch(e.getEventType()){
case XMLEvent.START_ELEMENT:
String tagName=e.asStartElement().getName().getLocalPart();
if(tagName.contentEquals("Item")){
items.add(new Item(e.asStartElement().getAttributeByName(
QName.valueOf("{http://schemas.dmtf.org/ovf/envelope/1}id")).getValue().trim(),
Integer.parseInt(e.asStartElement().getAttributeByName(
QName.valueOf("{http://schemas.dmtf.org/ovf/envelope/1}order")).getValue())));
}
break;
}
}
}
}
//FIXME END added to StAx
}
|
{
"content_hash": "1226a947df7d8dace78b93f4ae13d447",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 101,
"avg_line_length": 22.370786516853933,
"alnum_prop": 0.6976393771973882,
"repo_name": "gaetanofan/ovf-toolkit",
"id": "94d627b6ed8aeafd87daa99b15c5866f981df800",
"size": "1991",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ovf-parser/src/main/java/org/ow2/contrail/common/implementation/ovf/OVFStartupSection.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "303570"
},
{
"name": "XSLT",
"bytes": "11959"
}
],
"symlink_target": ""
}
|
<?php
/**
* TOP API: ecs.aliyuncs.com.ModifyInstanceAttribute.2014-05-26 request
*
* @author auto create
* @since 1.0, 2014-09-13 16:51:05
*/
class Ecs20140526ModifyInstanceAttributeRequest
{
/**
* 实例说明
**/
private $description;
/**
* 表示实例的主机名。必须以字母开始,并只可以含有字母、“-”字符。Windows系统最长为15字节,Linux系统最长为30字节
**/
private $hostName;
/**
* 指定的实例ID
**/
private $instanceId;
/**
* 实例名称
**/
private $instanceName;
/**
* 重置为用户指定的密码,密码只能是数字或者英文
字母。长度必须在6~30个英文字符
**/
private $password;
private $apiParas = array();
public function setDescription($description)
{
$this->description = $description;
$this->apiParas["Description"] = $description;
}
public function getDescription()
{
return $this->description;
}
public function setHostName($hostName)
{
$this->hostName = $hostName;
$this->apiParas["HostName"] = $hostName;
}
public function getHostName()
{
return $this->hostName;
}
public function setInstanceId($instanceId)
{
$this->instanceId = $instanceId;
$this->apiParas["InstanceId"] = $instanceId;
}
public function getInstanceId()
{
return $this->instanceId;
}
public function setInstanceName($instanceName)
{
$this->instanceName = $instanceName;
$this->apiParas["InstanceName"] = $instanceName;
}
public function getInstanceName()
{
return $this->instanceName;
}
public function setPassword($password)
{
$this->password = $password;
$this->apiParas["Password"] = $password;
}
public function getPassword()
{
return $this->password;
}
public function getApiMethodName()
{
return "ecs.aliyuncs.com.ModifyInstanceAttribute.2014-05-26";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->instanceId,"instanceId");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}
|
{
"content_hash": "8f67eb85ad24dc0dbc98b0f03bd4911b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 71,
"avg_line_length": 17.150442477876105,
"alnum_prop": 0.6769865841073271,
"repo_name": "zhangbobell/mallshop",
"id": "de6c8daef15ab75ebb8b2a5fc63858a0c275dab5",
"size": "2126",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/onekey/taobao/aliyun/request/Ecs20140526ModifyInstanceAttributeRequest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "331783"
},
{
"name": "JavaScript",
"bytes": "1035225"
},
{
"name": "PHP",
"bytes": "4876816"
},
{
"name": "XSLT",
"bytes": "9223"
}
],
"symlink_target": ""
}
|
/**
This file brings in the functionality to read Domain schema and give us the Domain objects. Interceptors are also defined here.
*/
function Database(callback) {
var _this = this;
var path = require('path');
var fs = require('fs');
var mongoose = require("mongoose");
this.connection = mongoose.createConnection(_config.dataSource.mongo.url, {poolSize: _config.dataSource.mongo.poolSize});
this.connection.on('error', function () {
log.error(arguments);
if (_config.dataSource.mongo.ignoreConnectionError) callback(_this);
});
this.connection.once('open', function () {
callback(_this);
});
var models = {};
var Domain = function (domainName) {
var domainDescriptor = require(path.join(__appBaseDir, "domain", domainName));
var schema = new mongoose.Schema(domainDescriptor.schema);
for (var method in domainDescriptor.methods) {
if (domainDescriptor.methods.hasOwnProperty(method)) schema.methods[method] = domainDescriptor.methods[method];
}
for (var staticMethod in domainDescriptor.static) {
if (domainDescriptor.static.hasOwnProperty(staticMethod)) schema.statics[staticMethod] = domainDescriptor.static[staticMethod];
}
schema.statics.ensureAllManuallyDefinedSchemaIndexes = function () {
for (var indexDescriptor in domainDescriptor.indexes) {
if (domainDescriptor.indexes.hasOwnProperty(indexDescriptor)) {
schema.index(domainDescriptor.indexes[indexDescriptor]);
}
}
_this.connection.model(domainName, schema).ensureIndexes(function (err) {
if (err) log.error(err);
});
};
this.createModel = function () {
return _this.connection.model(domainName, schema);
}
};
this.getDomain = function (name) {
if (!Boolean(models[name])) models[name] = new Domain(name).createModel();
return models[name];
};
}
/**
* @param {function} callback
* @returns {Database}
*/
exports.getDatabase = function (callback) {
return new Database(callback);
};
|
{
"content_hash": "923f24d6411be81e3ad8eda373d35362",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 139,
"avg_line_length": 39.72727272727273,
"alnum_prop": 0.6411899313501144,
"repo_name": "sahilchitkara/my-todo",
"id": "4b1093645c830af06ceb1c59e254b78a106b69f7",
"size": "2185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "custom_modules/AppBuilder/lib/modules/MongoDatabaseProvider.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "311"
},
{
"name": "JavaScript",
"bytes": "21629"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-cute</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>playn-cute-robovm</artifactId>
<packaging>jar</packaging>
<name>PlayN Cute RoboVM</name>
<dependencies>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-cute-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-robovm</artifactId>
<version>${playn.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>robosim</id>
<build>
<plugins>
<plugin>
<groupId>org.robovm</groupId>
<artifactId>robovm-maven-plugin</artifactId>
<version>${robovm.maven.version}</version>
<configuration>
<deviceName>iPad-Retina</deviceName>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>ipad-sim</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>robodev</id>
<build>
<plugins>
<plugin>
<groupId>org.robovm</groupId>
<artifactId>robovm-maven-plugin</artifactId>
<version>${robovm.maven.version}</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>ios-device</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
|
{
"content_hash": "1595cba001515abadad7273ae030f556",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 98,
"avg_line_length": 28.546666666666667,
"alnum_prop": 0.5441382531527323,
"repo_name": "fredsa/playn-samples",
"id": "cbdc77a15e8472d712f86ecd54c6b961857e6b7d",
"size": "2141",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cute/robovm/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "4918"
},
{
"name": "CSS",
"bytes": "3693"
},
{
"name": "Emacs Lisp",
"bytes": "105"
},
{
"name": "HTML",
"bytes": "1706004"
},
{
"name": "Java",
"bytes": "824385"
},
{
"name": "Scala",
"bytes": "784"
},
{
"name": "Shell",
"bytes": "3186"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Sensorberg Windows 10 SDK: SensorbergSDK.SdkConfiguration Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Sensorberg_Logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Sensorberg Windows 10 SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Packages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_sensorberg_s_d_k.html">SensorbergSDK</a></li><li class="navelem"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html">SdkConfiguration</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#properties">Properties</a> |
<a href="class_sensorberg_s_d_k_1_1_sdk_configuration-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">SensorbergSDK.SdkConfiguration Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Defines the configuration for the SDK.
<a href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afff68c431ca880bc2838c44f00c55eeb"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#afff68c431ca880bc2838c44f00c55eeb">SdkConfiguration</a> ()</td></tr>
<tr class="memdesc:afff68c431ca880bc2838c44f00c55eeb"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new object that starts automatic the scanner and collect every beacon contains the sensorberg uuids. <a href="#afff68c431ca880bc2838c44f00c55eeb">More...</a><br /></td></tr>
<tr class="separator:afff68c431ca880bc2838c44f00c55eeb"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:afa08fd8d22a3c3baafd7a3857c459d28"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#afa08fd8d22a3c3baafd7a3857c459d28">ApiKey</a><code> [get, set]</code></td></tr>
<tr class="memdesc:afa08fd8d22a3c3baafd7a3857c459d28"><td class="mdescLeft"> </td><td class="mdescRight">ApiKey to connect to the Sensorberg Backend. See <a href="https://manage.sensorberg.com/#/applications">https://manage.sensorberg.com/#/applications</a> for the key. <a href="#afa08fd8d22a3c3baafd7a3857c459d28">More...</a><br /></td></tr>
<tr class="separator:afa08fd8d22a3c3baafd7a3857c459d28"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6c462bef3073f5883b23fa181a2829b5"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a6c462bef3073f5883b23fa181a2829b5">BackgroundTimerClassName</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a6c462bef3073f5883b23fa181a2829b5"><td class="mdescLeft"> </td><td class="mdescRight">Class name to register the background timer. <a class="el" href="class_sensorberg_s_d_k_1_1_s_d_k_manager.html#a7474d1c46c98b10f011b62e53d5d625d" title="Registers the background task or in the case of a pending background filter update, re-registers the task. ">SDKManager.RegisterBackgroundTaskAsync</a> <a href="#a6c462bef3073f5883b23fa181a2829b5">More...</a><br /></td></tr>
<tr class="separator:a6c462bef3073f5883b23fa181a2829b5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4204f3e639f29bbc6d239a4e756c129e"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a4204f3e639f29bbc6d239a4e756c129e">BackgroundAdvertisementClassName</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a4204f3e639f29bbc6d239a4e756c129e"><td class="mdescLeft"> </td><td class="mdescRight">class name to register the advertismend task, this task receives the bluetooth events. <a class="el" href="class_sensorberg_s_d_k_1_1_s_d_k_manager.html#a7474d1c46c98b10f011b62e53d5d625d" title="Registers the background task or in the case of a pending background filter update, re-registers the task. ">SDKManager.RegisterBackgroundTaskAsync</a> <a href="#a4204f3e639f29bbc6d239a4e756c129e">More...</a><br /></td></tr>
<tr class="separator:a4204f3e639f29bbc6d239a4e756c129e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abd9c9211d716db11102a5c90dc544c12"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#abd9c9211d716db11102a5c90dc544c12">BackgroundBeaconUuidSpace</a><code> [get, set]</code></td></tr>
<tr class="memdesc:abd9c9211d716db11102a5c90dc544c12"><td class="mdescLeft"> </td><td class="mdescRight">Defines an differend background beacon uuid space. See <a href="https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.advertisement.bluetoothleadvertisementfilter.bytepatterns.aspx">https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.advertisement.bluetoothleadvertisementfilter.bytepatterns.aspx</a> for further information. Without background usage this property isn't needet. <a href="#abd9c9211d716db11102a5c90dc544c12">More...</a><br /></td></tr>
<tr class="separator:abd9c9211d716db11102a5c90dc544c12"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a336a72dbeefccefcddd7b66a45afe972"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a336a72dbeefccefcddd7b66a45afe972">AutoStartScanner</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a336a72dbeefccefcddd7b66a45afe972"><td class="mdescLeft"> </td><td class="mdescRight">Defines if the beacon scanner should automaticly start. <a href="#a336a72dbeefccefcddd7b66a45afe972">More...</a><br /></td></tr>
<tr class="separator:a336a72dbeefccefcddd7b66a45afe972"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acce776130833d8918301a7dd3b9f3ac1"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#acce776130833d8918301a7dd3b9f3ac1">UseLocation</a><code> [get, set]</code></td></tr>
<tr class="memdesc:acce776130833d8918301a7dd3b9f3ac1"><td class="mdescLeft"> </td><td class="mdescRight">Enable or disable the usage of geolocation for the beacon actions. <a href="#acce776130833d8918301a7dd3b9f3ac1">More...</a><br /></td></tr>
<tr class="separator:acce776130833d8918301a7dd3b9f3ac1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4396c5079e94dc3889139f52888e92ba"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a4396c5079e94dc3889139f52888e92ba">UserId</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a4396c5079e94dc3889139f52888e92ba"><td class="mdescLeft"> </td><td class="mdescRight">Defines an user or advertisement id for collection all the events from a specific user or device. <a href="#a4396c5079e94dc3889139f52888e92ba">More...</a><br /></td></tr>
<tr class="separator:a4396c5079e94dc3889139f52888e92ba"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a16c2b895a376281c4fe26875c27717f0"><td class="memItemLeft" align="right" valign="top">ushort </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a16c2b895a376281c4fe26875c27717f0">ManufacturerId</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a16c2b895a376281c4fe26875c27717f0"><td class="mdescLeft"> </td><td class="mdescRight">The manufacturer ID to filter beacons that are being watched. <a href="#a16c2b895a376281c4fe26875c27717f0">More...</a><br /></td></tr>
<tr class="separator:a16c2b895a376281c4fe26875c27717f0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad465933dda707461413e47edfc8341e5"><td class="memItemLeft" align="right" valign="top">ushort </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#ad465933dda707461413e47edfc8341e5">BeaconCode</a><code> [get, set]</code></td></tr>
<tr class="memdesc:ad465933dda707461413e47edfc8341e5"><td class="mdescLeft"> </td><td class="mdescRight">The beacon code to filter beacons that are being watched. <a href="#ad465933dda707461413e47edfc8341e5">More...</a><br /></td></tr>
<tr class="separator:ad465933dda707461413e47edfc8341e5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a68c3b4bb49649aebdcfd98f8f39cd96b"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a68c3b4bb49649aebdcfd98f8f39cd96b">ResolverUri</a><code> [get, set]</code></td></tr>
<tr class="memdesc:a68c3b4bb49649aebdcfd98f8f39cd96b"><td class="mdescLeft"> </td><td class="mdescRight">Sets the uri for the resolver. If it is set all related uris will recreated. <a href="#a68c3b4bb49649aebdcfd98f8f39cd96b">More...</a><br /></td></tr>
<tr class="separator:a68c3b4bb49649aebdcfd98f8f39cd96b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8975e50fbbbd1f58f4bdd1ad46fcadc2"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#a8975e50fbbbd1f58f4bdd1ad46fcadc2">LayoutUri</a><code> [get, set]</code></td></tr>
<tr class="separator:a8975e50fbbbd1f58f4bdd1ad46fcadc2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aff79cc7d13af8715cecf271bc6ed4163"><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_sensorberg_s_d_k_1_1_sdk_configuration.html#aff79cc7d13af8715cecf271bc6ed4163">SettingsUri</a><code> [get, set]</code></td></tr>
<tr class="separator:aff79cc7d13af8715cecf271bc6ed4163"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Defines the configuration for the SDK. </p>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="afff68c431ca880bc2838c44f00c55eeb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SensorbergSDK.SdkConfiguration.SdkConfiguration </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new object that starts automatic the scanner and collect every beacon contains the sensorberg uuids. </p>
</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a class="anchor" id="afa08fd8d22a3c3baafd7a3857c459d28"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.ApiKey</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>ApiKey to connect to the Sensorberg Backend. See <a href="https://manage.sensorberg.com/#/applications">https://manage.sensorberg.com/#/applications</a> for the key. </p>
</div>
</div>
<a class="anchor" id="a336a72dbeefccefcddd7b66a45afe972"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool SensorbergSDK.SdkConfiguration.AutoStartScanner</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Defines if the beacon scanner should automaticly start. </p>
</div>
</div>
<a class="anchor" id="a4204f3e639f29bbc6d239a4e756c129e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.BackgroundAdvertisementClassName</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>class name to register the advertismend task, this task receives the bluetooth events. <a class="el" href="class_sensorberg_s_d_k_1_1_s_d_k_manager.html#a7474d1c46c98b10f011b62e53d5d625d" title="Registers the background task or in the case of a pending background filter update, re-registers the task. ">SDKManager.RegisterBackgroundTaskAsync</a> </p>
</div>
</div>
<a class="anchor" id="abd9c9211d716db11102a5c90dc544c12"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.BackgroundBeaconUuidSpace</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Defines an differend background beacon uuid space. See <a href="https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.advertisement.bluetoothleadvertisementfilter.bytepatterns.aspx">https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.advertisement.bluetoothleadvertisementfilter.bytepatterns.aspx</a> for further information. Without background usage this property isn't needet. </p>
</div>
</div>
<a class="anchor" id="a6c462bef3073f5883b23fa181a2829b5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.BackgroundTimerClassName</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Class name to register the background timer. <a class="el" href="class_sensorberg_s_d_k_1_1_s_d_k_manager.html#a7474d1c46c98b10f011b62e53d5d625d" title="Registers the background task or in the case of a pending background filter update, re-registers the task. ">SDKManager.RegisterBackgroundTaskAsync</a> </p>
</div>
</div>
<a class="anchor" id="ad465933dda707461413e47edfc8341e5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">ushort SensorbergSDK.SdkConfiguration.BeaconCode</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The beacon code to filter beacons that are being watched. </p>
</div>
</div>
<a class="anchor" id="a8975e50fbbbd1f58f4bdd1ad46fcadc2"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.LayoutUri</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a16c2b895a376281c4fe26875c27717f0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">ushort SensorbergSDK.SdkConfiguration.ManufacturerId</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The manufacturer ID to filter beacons that are being watched. </p>
</div>
</div>
<a class="anchor" id="a68c3b4bb49649aebdcfd98f8f39cd96b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.ResolverUri</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the uri for the resolver. If it is set all related uris will recreated. </p>
</div>
</div>
<a class="anchor" id="aff79cc7d13af8715cecf271bc6ed4163"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.SettingsUri</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="acce776130833d8918301a7dd3b9f3ac1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool SensorbergSDK.SdkConfiguration.UseLocation</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable or disable the usage of geolocation for the beacon actions. </p>
</div>
</div>
<a class="anchor" id="a4396c5079e94dc3889139f52888e92ba"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string SensorbergSDK.SdkConfiguration.UserId</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span><span class="mlabel">set</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Defines an user or advertisement id for collection all the events from a specific user or device. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/work/sensorberg/windows10-sdk/SensorbergSDK/<a class="el" href="_sdk_configuration_8cs.html">SdkConfiguration.cs</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
|
{
"content_hash": "488896b269006fb9a6f7c2b476c3078c",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 616,
"avg_line_length": 53.35159817351598,
"alnum_prop": 0.7001882916809312,
"repo_name": "sensorberg-dev/windows10-sdk",
"id": "f720bd1943acc191151315c5eee955d85ff775be",
"size": "23368",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SensorbergSDK/doxygen/out/html/class_sensorberg_s_d_k_1_1_sdk_configuration.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "62"
},
{
"name": "C#",
"bytes": "599112"
},
{
"name": "CSS",
"bytes": "45715"
},
{
"name": "Groovy",
"bytes": "3648"
},
{
"name": "HTML",
"bytes": "3928865"
},
{
"name": "JavaScript",
"bytes": "67840"
}
],
"symlink_target": ""
}
|
package rds_region
import (
"fmt"
"testing"
)
func TestDescribeAbnormalDBInstances(t *testing.T) {
var req DescribeAbnormalDBInstancesRequest
req.Init()
req.SetFormat("JSON")
req.SetRegionId("cn-shenzhen")
var accessId = "Ie65kUInu5GeAsma"
var accessSecret = "8cCqoxdYU9zKUihwXFXiN1HEACBDwB"
resp, err := DescribeAbnormalDBInstances(&req, accessId, accessSecret)
if err != nil {
t.Errorf("Error: %s", err.Error())
}
fmt.Printf("Success: %v\n", resp)
}
|
{
"content_hash": "b1cc8c18cf99e2b14860c5ba5109fc71",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 71,
"avg_line_length": 23.4,
"alnum_prop": 0.7329059829059829,
"repo_name": "cklxmu/aliyun-openapi-go-sdk",
"id": "61cf6e3e5b64eb06b524e9b8ee43f500a660f2b0",
"size": "468",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rds_region/2014-08-15/DescribeAbnormalDBInstances_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "2698473"
}
],
"symlink_target": ""
}
|
@implementation LTUMetaData
- (id)initWithValue:(NSString *)value forKey:(NSString *)key andOrdering:(NSInteger)ordering
{
if ((self = [self init]))
{
// Set Defaults for optional params
self.ordering = ordering;
self.value = value;
self.key = key;
}
return self;
}
- (id)initWithAttributes:(NSDictionary *)attributes
{
if ((self = [super initWithAttributes:attributes]))
{
self.key = attributes[@"key"];
self.metadata_id = [attributes[@"id"] intValue];
self.ordering = [attributes[@"ordering"] intValue];
self.user = attributes[@"user"];
self.value = attributes[@"value"];
}
return self;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"Metadata: %@ => %@",self.key, self.value];
}
@end
|
{
"content_hash": "573b7d1e171a6332b79ec0ce2f65c19d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 92,
"avg_line_length": 24.242424242424242,
"alnum_prop": 0.62375,
"repo_name": "ltutech/ltucloud-ios-sdk",
"id": "7463d0b731bd4ff296c003324d707389f7ddb83e",
"size": "955",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LTUSDK/LTUModels/Visual/LTUMetaData.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "7553"
},
{
"name": "Objective-C",
"bytes": "65044"
},
{
"name": "Shell",
"bytes": "2624"
}
],
"symlink_target": ""
}
|
from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-costmanagement
# USAGE
python billing_profile_query_mca.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CostManagementClient(
credential=DefaultAzureCredential(),
)
response = client.query.usage(
scope="providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579",
parameters={
"dataset": {
"filter": {
"and": [
{
"or": [
{
"dimensions": {
"name": "ResourceLocation",
"operator": "In",
"values": ["East US", "West Europe"],
}
},
{"tags": {"name": "Environment", "operator": "In", "values": ["UAT", "Prod"]}},
]
},
{"dimensions": {"name": "ResourceGroup", "operator": "In", "values": ["API"]}},
]
},
"granularity": "Daily",
},
"timeframe": "MonthToDate",
"type": "Usage",
},
)
print(response)
# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQuery.json
if __name__ == "__main__":
main()
|
{
"content_hash": "54f44eed40ef85d490a6e28f8a703505",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 148,
"avg_line_length": 37.07272727272727,
"alnum_prop": 0.5007356547327121,
"repo_name": "Azure/azure-sdk-for-python",
"id": "57d7ec2310fa045616235bcf92a4cc0738da1cef",
"size": "2507",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1224"
},
{
"name": "Bicep",
"bytes": "24196"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "4892"
},
{
"name": "HTML",
"bytes": "12058"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "Jinja",
"bytes": "10377"
},
{
"name": "Jupyter Notebook",
"bytes": "272022"
},
{
"name": "PowerShell",
"bytes": "518535"
},
{
"name": "Python",
"bytes": "715484989"
},
{
"name": "Shell",
"bytes": "3631"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
<File path="Classes/UCloudGPUImageBoxBlurFilter.html">
<Token>
<TokenIdentifier>//apple_ref/occ/cl/UCloudGPUImageBoxBlurFilter</TokenIdentifier>
<Abstract type="html">A hardware-accelerated box blur of an image</Abstract>
<DeclaredIn>UCloudGPUImageBoxBlurFilter.h</DeclaredIn>
<NodeRef refid="6"/>
</Token>
</File>
</Tokens>
|
{
"content_hash": "942f31afa7213e2d37cb5696a5ebd800",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 24.88888888888889,
"alnum_prop": 0.6607142857142857,
"repo_name": "umdk/UCDLive_iOS",
"id": "8ef476fb61279762b2b40d7b535c39655ab5b9ba",
"size": "448",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/cn.UCloud.UCDLive_iOS.docset/Contents/Resources/Tokens6.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "17916"
},
{
"name": "C++",
"bytes": "284904"
},
{
"name": "Objective-C",
"bytes": "222704"
},
{
"name": "Ruby",
"bytes": "1572"
}
],
"symlink_target": ""
}
|
<?php
namespace frontend\modules\message\models\search;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use frontend\modules\message\models\Messages;
/**
* MessagesSearch represents the model behind the search form about `frontend\modules\message\models\Messages`.
*/
class MessagesSearch extends Messages
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'sender_id', 'receiver_id'], 'integer'],
[['subject', 'body', 'is_read', 'deleted_by', 'created_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Messages::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'sender_id' => $this->sender_id,
'receiver_id' => $this->receiver_id,
'created_at' => $this->created_at,
]);
$query->andFilterWhere(['like', 'subject', $this->subject])
->andFilterWhere(['like', 'body', $this->body])
->andFilterWhere(['like', 'is_read', $this->is_read])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
}
|
{
"content_hash": "a39239c783a781b8e3ac8b6a23513ebf",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 111,
"avg_line_length": 26.04,
"alnum_prop": 0.5555555555555556,
"repo_name": "gudezi/yiiBaseAdvanced",
"id": "2f151d0d2ce135dea1080481cd0e1cbe0f88656d",
"size": "1953",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "frontend/modules/message/models/search/MessagesSearch.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "960"
},
{
"name": "Batchfile",
"bytes": "1541"
},
{
"name": "CSS",
"bytes": "3332"
},
{
"name": "PHP",
"bytes": "374768"
},
{
"name": "Shell",
"bytes": "3257"
}
],
"symlink_target": ""
}
|
<?php
class Mutex
{
var $id;
var $sem_id;
var $is_acquired = false;
var $is_windows = false;
var $filename = '';
var $filepointer;
function __construct()
{
if(substr(PHP_OS, 0, 3) == 'WIN')
$this->is_windows = true;
}
function init($id='xmutex', $filename = '')
{
global $cfgMainFolder;
$this->id = $id;
$this->is_windows=$filename>'';
if($this->is_windows)
{
if(empty($filename)){
print "no filename specified";
return false;
}
else {
$this->filename = "$cfgMainFolder/lock/$filename";
if (!is_dir("$cfgMainFolder/lock"))
mkdir("$cfgMainFolder/lock",0766, true);
}
}
else
{
if(!($this->sem_id = sem_get($this->id, 1))){
print "Error getting semaphore";
return false;
}
}
return true;
}
function acquire()
{
if($this->is_windows)
{
if(($this->filepointer = @fopen($this->filename, "w+")) == false)
{
print "error opening mutex file $this->filename<br>";
return false;
}
if(flock($this->filepointer, LOCK_EX) == false)
{
print "error locking mutex file<br>";
return false;
}
}
else
{
if (! sem_acquire($this->sem_id)){
print "error acquiring semaphore";
return false;
}
}
$this->is_acquired = true;
return true;
}
function release()
{
if(!$this->is_acquired)
return true;
if($this->is_windows)
{
if(flock($this->filepointer, LOCK_UN) == false)
{
print "error unlocking mutex file<br>";
return false;
}
fclose($this->filepointer);
}
else
{
if (! sem_release($this->sem_id)){
print "error releasing semaphore";
return false;
}
}
$this->is_acquired = false;
return true;
}
function getId()
{
return $this->sem_id;
}
}
?>
|
{
"content_hash": "267257ad1ff2f42ff5d6bb68c7a5fda0",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 81,
"avg_line_length": 24.82882882882883,
"alnum_prop": 0.36502177068214803,
"repo_name": "EDortta/YeAPF",
"id": "d11d4ec892dbbcc9cb8cf997266ac57faa81c841",
"size": "2942",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "0.8.60/includes/mutex.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1434759"
},
{
"name": "HTML",
"bytes": "9865143"
},
{
"name": "JavaScript",
"bytes": "43628308"
},
{
"name": "PHP",
"bytes": "32252830"
},
{
"name": "Shell",
"bytes": "216948"
}
],
"symlink_target": ""
}
|
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<!-- THIS LAYOUT IS FOR PAGES WHICH HAVE TABLES IN THEM. NO TOC, AND WIDER MAIN BODY WIDTH -->
<head>
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
{% include _head.html %}
</head>
<body class="page">
{% include _browser-upgrade.html %}
{% include _navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ site.url }}/images/{{ page.image.feature }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
<div id="main" role="main">
<div class="article-author-side">
{% include _author-bio.html %}
</div>
<article class="page">
<h1>{{ page.title }}</h1>
<div class="article-wrap">
{{ content }}
{% if page.share != false %}
<hr />
{% include _social-share.html %}
{% endif %}
</div><!-- /.article-wrap -->
{% if site.owner.disqus-shortname and page.comments == true %}
<section id="disqus_thread"></section><!-- /#disqus_thread -->
{% endif %}
</article>
</div><!-- /#index -->
<div class="footer-wrap">
<footer>
{% include _footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include _scripts.html %}
</body>
</html>
|
{
"content_hash": "816fc02dec2a004aa00242d78871decc",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 120,
"avg_line_length": 30.6231884057971,
"alnum_prop": 0.575958353052532,
"repo_name": "harshnisar/ml-india",
"id": "16709033b983f02149e23ae0357daca380ed1b03",
"size": "2113",
"binary": false,
"copies": "2",
"ref": "refs/heads/gh-pages",
"path": "_layouts/page.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "120043"
},
{
"name": "HTML",
"bytes": "3695474"
},
{
"name": "JavaScript",
"bytes": "389531"
},
{
"name": "PHP",
"bytes": "27722"
},
{
"name": "Ruby",
"bytes": "2258"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "f2f030b3da0703a21c7fb5de0c832b59",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "763a2aa0d8a3b8bf1f619ea3a3e870cf7b99bc49",
"size": "208",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Gomesa/Gomesa radicans/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.