identifier
stringlengths 42
383
| collection
stringclasses 1
value | open_type
stringclasses 1
value | license
stringlengths 0
1.81k
| date
float64 1.99k
2.02k
⌀ | title
stringlengths 0
100
| creator
stringlengths 1
39
| language
stringclasses 157
values | language_type
stringclasses 2
values | word_count
int64 1
20k
| token_count
int64 4
1.32M
| text
stringlengths 5
1.53M
| __index_level_0__
int64 0
57.5k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/neeyongliang/backup/blob/master/scripts/build-python-dev.sh
|
Github Open Source
|
Open Source
|
MIT
| null |
backup
|
neeyongliang
|
Shell
|
Code
| 81
| 177
|
#!/bin/sh
# Program:
# Run this shell script to get Python develop environment.
# History:
# 2019/01/30 yongliang First release
echo " Now, install python develop environment..."
echo "udate source list..."
sudo apt update
echo "udate source list end"
echo "install packages..."
sudo apt install python3-pip python3-dev python3-setuptools \
python-setuptools python2-pip python2-dev python3-doc python2-doc
echo "install packages end"
echo "install pip packages begin"
echo "pip3..."
sudo pip3 install thefuck pylint
echo "pip2..."
pip install --upgrade pip=20.3
echo "install pip packages end"
| 47,920
|
https://github.com/c3rebro/EventMessenger/blob/master/EventMessenger/3rdParty/Itinerary/Expl.Itinerary/Schedule/Composite/UnionSchedule.cs
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
EventMessenger
|
c3rebro
|
C#
|
Code
| 366
| 933
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Expl.Auxiliary;
namespace Expl.Itinerary {
/// <summary>
/// Union collection of ISchedule objects.
/// </summary>
[Description("Union")]
[Serializable]
public class UnionSchedule : ICompositeSchedule {
private ListSchedule _Schedule;
/// <summary>
/// Constructor for empty list.
/// </summary>
public UnionSchedule() {
_Schedule = new ListSchedule();
}
/// <summary>
/// Constructor for single schedule.
/// </summary>
/// <param name="A">Schedule.</param>
public UnionSchedule(ISchedule A) {
_Schedule = new ListSchedule(A);
}
/// <summary>
/// Constructor for two schedules.
/// </summary>
/// <param name="A">Schedule A.</param>
/// <param name="B">Schedule B.</param>
public UnionSchedule(ISchedule A, ISchedule B) {
_Schedule = new ListSchedule(A, B);
}
/// <summary>
/// Constructor for many schedules.
/// </summary>
/// <param name="List">Enumerable list of ISchedule objects.</param>
public UnionSchedule(IEnumerable<ISchedule> List) {
_Schedule = new ListSchedule(List);
}
public IEnumerable<ISchedule> Schedules {
get { return _Schedule.Schedules; }
}
public int MinSchedules {
get { return 1; }
}
public int MaxSchedules {
get { return int.MaxValue; }
}
public int OperatorPrecedence { get { return 50; } }
public override string ToString() {
// If schedule precedence is > this schedule, add parens
// If lvalue is same type as this schedule, no parens are needed.
// e.g. "(A | B) | C" equates to "A | B | C"
// e.g. "A | (B | C)" equates to "A | B | C"
StringBuilder sb = new StringBuilder();
sb.Append(Schedules.Select<ISchedule, string>(Schedule =>
Schedule.OperatorPrecedence > this.OperatorPrecedence
? "(" + Schedule.ToString() + ")"
: Schedule.ToString()
).JoinStrings(" | "));
return sb.ToString();
}
// Optimized 2008-07-13
public IEnumerable<TimedEvent> GetRange(DateTime RangeStart, DateTime RangeEnd) {
// AAAA
// BBBB
// xxxxxx
//
// AA
// BB
// xxxx
//
// AAAA
// BBBB
// xxxxxx
// CC
// xxxxxxxx
TimedEvent MatchEvent = null;
foreach (TimedEvent A in _Schedule.GetRange(RangeStart, RangeEnd)) {
if (MatchEvent == null) {
// Load up MatchEvent
MatchEvent = A;
}
else if (MatchEvent.Intersects(A) || MatchEvent.IsAdjacentTo(A)) {
// Compute union and move on
MatchEvent = MatchEvent.Union(A)[0];
}
else {
// No intersection, return MatchEvent
yield return MatchEvent;
MatchEvent = A;
}
}
// If MatchEvent has a value, return it
if (MatchEvent != null) yield return MatchEvent;
yield break;
}
public override int GetHashCode() {
return _Schedule.GetHashCode();
}
}
}
| 3,904
|
https://github.com/chuanlei/hustle/blob/master/profile.py
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
hustle
|
chuanlei
|
Python
|
Code
| 500
| 1,368
|
# 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.
"""Hustle Cloudlab Repeatable Experiment Profile
Default behavior:
By default, this uses a c220g5 with 100GB of storage and runs experiments at scale factor 1.
Numbered experiments will not be run unless provided with one or more arguments to use.
A common argument can be provided that will precede all per-experiment arguments.
Storage size may need to be increased for larger scale factors.
Instructions:
No additional instructions needed. Remember to access experiment results at: /mydata/results
"""
import geni.portal as portal
import geni.rspec.pg as pg
import json
try:
import urllib.parse as url_parser
except ImportError:
import urllib as url_parser
pc = portal.Context()
pc.defineParameter("hardware", "Hardware (Default: c220g5)", portal.ParameterType.STRING, "c220g5")
pc.defineParameter("storage", "Storage Size (Default: 100GB)", portal.ParameterType.STRING, "100GB")
pc.defineParameter("scale_factor", "SSB Scale Factor (Default: 1)", portal.ParameterType.INTEGER, 1)
pc.defineParameter("common_args",
"Common Experiment Args (Default: \"ssb hash-aggregate\", replace with \"skip\" if not in use.)",
portal.ParameterType.STRING, "ssb hash-aggregate")
pc.defineParameter("experiment_1_args", "Experiment 1 Args (Default: \"skip\")", portal.ParameterType.STRING, "skip")
pc.defineParameter("experiment_2_args", "Experiment 2 Args (Default: \"skip\")", portal.ParameterType.STRING, "skip")
pc.defineParameter("experiment_3_args", "Experiment 3 Args (Default: \"skip\")", portal.ParameterType.STRING, "skip")
pc.defineParameter("experiment_4_args", "Experiment 4 Args (Default: \"skip\")", portal.ParameterType.STRING, "skip")
pc.defineParameter("experiment_5_args", "Experiment 5 Args (Default: \"skip\")", portal.ParameterType.STRING, "skip")
params = portal.context.bindParameters()
'''
c220g5 224 nodes (Intel Skylake, 20 core, 2 disks)
CPU Two Intel Xeon Silver 4114 10-core CPUs at 2.20 GHz
RAM 192GB ECC DDR4-2666 Memory
Disk One 1 TB 7200 RPM 6G SAS HDs
Disk One Intel DC S3500 480 GB 6G SATA SSD
NIC Dual-port Intel X520-DA2 10Gb NIC (PCIe v3.0, 8 lanes)
NIC Onboard Intel i350 1Gb
Note that the sysvol is the SSD, while the nonsysvol is the 7200 RPM HD.
We almost always want to use the sysvol.
'''
rspec = pg.Request()
node = pg.RawPC("node")
node.hardware_type = params.hardware
bs = node.Blockstore("bs", "/mydata")
bs.size = params.storage
bs.placement = "sysvol"
# explicitly copy the needed params for better readability
out_params = {
"hardware": params.hardware,
"storage": params.storage,
"scale_factor": params.scale_factor,
"common_args": params.common_args,
"experiment_1_args": params.experiment_1_args,
"experiment_2_args": params.experiment_2_args,
"experiment_3_args": params.experiment_3_args,
"experiment_4_args": params.experiment_4_args,
"experiment_5_args": params.experiment_5_args,
}
enc_str = url_parser.quote_plus((json.dumps(out_params, separators=(',', ':'))))
execute_str = \
"sudo touch /mydata/params.json;" + \
"sudo chmod +777 /mydata/params.json;" + \
"echo " + enc_str + " > /mydata/params.json;" + \
"sudo chmod +777 /local/repository/scripts/cloudlab/cloudlab_setup.sh;" + \
"/local/repository/scripts/cloudlab/cloudlab_setup.sh " + str(params.scale_factor) + ";" + \
"sudo chmod +777 /mydata/repo/scripts/cloudlab/cloudlab.py;" + \
"python3 /mydata/repo/scripts/cloudlab/cloudlab.py >> /mydata/report.txt 2>&1;"
node.addService(pg.Execute(shell="bash", command=execute_str))
rspec.addResource(node)
pc.printRequestRSpec(rspec)
| 30,892
|
https://github.com/walkccc/LeetCode/blob/master/solutions/1144. Decrease Elements To Make Array Zigzag/1144.py
|
Github Open Source
|
Open Source
|
MIT
| 2,023
|
LeetCode
|
walkccc
|
Python
|
Code
| 56
| 128
|
class Solution:
def movesToMakeZigzag(self, nums: List[int]) -> int:
decreasing = [0] * 2
for i, num in enumerate(nums):
l = nums[i - 1] if i > 0 else 1001
r = nums[i + 1] if i + 1 < len(nums) else 1001
decreasing[i % 2] += max(0, num - min(l, r) + 1)
return min(decreasing[0], decreasing[1])
| 3,964
|
https://github.com/GridProtectionAlliance/go2cs/blob/master/src/go-src-converted/cmd/vendor/golang.org/x/tools/go/types/typeutil/ui.cs
|
Github Open Source
|
Open Source
|
MIT, BSD-3-Clause, CC-BY-3.0
| 2,022
|
go2cs
|
GridProtectionAlliance
|
C#
|
Code
| 352
| 851
|
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// package typeutil -- go2cs converted at 2022 March 13 06:42:44 UTC
// import "cmd/vendor/golang.org/x/tools/go/types/typeutil" ==> using typeutil = go.cmd.vendor.golang.org.x.tools.go.types.typeutil_package
// Original source: C:\Program Files\Go\src\cmd\vendor\golang.org\x\tools\go\types\typeutil\ui.go
namespace go.cmd.vendor.golang.org.x.tools.go.types;
// This file defines utilities for user interfaces that display types.
using types = go.types_package;
using System;
public static partial class typeutil_package {
// IntuitiveMethodSet returns the intuitive method set of a type T,
// which is the set of methods you can call on an addressable value of
// that type.
//
// The result always contains MethodSet(T), and is exactly MethodSet(T)
// for interface types and for pointer-to-concrete types.
// For all other concrete types T, the result additionally
// contains each method belonging to *T if there is no identically
// named method on T itself.
//
// This corresponds to user intuition about method sets;
// this function is intended only for user interfaces.
//
// The order of the result is as for types.MethodSet(T).
//
public static slice<ptr<types.Selection>> IntuitiveMethodSet(types.Type T, ptr<MethodSetCache> _addr_msets) {
ref MethodSetCache msets = ref _addr_msets.val;
Func<types.Type, bool> isPointerToConcrete = T => {
ptr<types.Pointer> (ptr, ok) = T._<ptr<types.Pointer>>();
return ok && !types.IsInterface(ptr.Elem());
};
slice<ptr<types.Selection>> result = default;
var mset = msets.MethodSet(T);
if (types.IsInterface(T) || isPointerToConcrete(T)) {
{
nint i__prev1 = i;
var n__prev1 = n;
for (nint i = 0;
var n = mset.Len(); i < n; i++) {
result = append(result, mset.At(i));
}
else
i = i__prev1;
n = n__prev1;
}
} {
// T is some other concrete type.
// Report methods of T and *T, preferring those of T.
var pmset = msets.MethodSet(types.NewPointer(T));
{
nint i__prev1 = i;
var n__prev1 = n;
for (i = 0;
n = pmset.Len(); i < n; i++) {
var meth = pmset.At(i);
{
var m = mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name());
if (m != null) {
meth = m;
}
}
result = append(result, meth);
}
i = i__prev1;
n = n__prev1;
}
}
return result;
}
} // end typeutil_package
| 41,160
|
https://github.com/egouletlang/Ethos/blob/master/EthosUI/EthosUI/Controller/Navigation/Button/ImageNavigationBarItem.swift
|
Github Open Source
|
Open Source
|
MIT
| null |
Ethos
|
egouletlang
|
Swift
|
Code
| 166
| 462
|
//
// ImageNavigationBarItem.swift
// EthosUI
//
// Created by Etienne Goulet-Lang on 4/20/19.
// Copyright © 2019 egouletlang. All rights reserved.
//
import Foundation
import EthosImage
open class ImageNavigationBarItem: BaseNavigationBarItem {
open func with(imageUri: String?) -> ImageNavigationBarItem {
self.imageUri = imageUri
return self
}
open func with(image: UIImage?) -> ImageNavigationBarItem {
self.image = image
return self
}
open func with(tint: UIColor?) -> ImageNavigationBarItem {
self.tint = tint
return self
}
open var imageUri: String?
open var image: UIImage?
open var tint: UIColor?
private func getImage() -> UIImage? {
if let image = self.image {
return image
}
if let url = self.imageUri {
return (ImageHelper.shared.get(urls: [url]).first as? UIImage)
}
return nil
}
open override var button: UIBarButtonItem? {
guard let image = ImageHelper.addColorMask(img: self.getImage(), color: tint) else {
return nil
}
let button = UIButton(type: .custom)
button.setImage(image, for: UIControl.State())
button.addTarget(self.target, action: self.selector, for: .touchUpInside)
button.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
let ret = UIBarButtonItem(customView: button)
ret.width = 20
return ret
}
}
| 38,249
|
https://github.com/agunghimura11/Laravel_QA/blob/master/app/Question2.php
|
Github Open Source
|
Open Source
|
MIT
| 2,020
|
Laravel_QA
|
agunghimura11
|
PHP
|
Code
| 12
| 36
|
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Question2 extends Model
{
//
}
| 1,992
|
https://github.com/Xirzag/Wasp-Swarm-Generative-Algorithm/blob/master/Code/Assets/Scripts/Generative/StructureRenderer.cs
|
Github Open Source
|
Open Source
|
MIT
| null |
Wasp-Swarm-Generative-Algorithm
|
Xirzag
|
C#
|
Code
| 73
| 238
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StructureRenderer : MonoBehaviour
{
public GameObject brickPrefab;
List<GameObject> renderedBricks = new List<GameObject>();
public void Render(BrickStructure structure)
{
var bricks = structure.GetBricks();
foreach (var brick in renderedBricks)
{
Destroy(brick);
}
foreach (var brick in bricks)
{
if (brick.Value != 0) {
Vector3 position = new Vector3(brick.Key.x, brick.Key.y, 0);
var g = Instantiate(brickPrefab);
renderedBricks.Add(g);
g.transform.parent = transform;
g.transform.localPosition = position;
g.transform.localRotation = Quaternion.identity;
}
}
}
}
| 2,340
|
https://github.com/tavii/SQSJobQueueBundle/blob/master/Command/WorkerStopCommand.php
|
Github Open Source
|
Open Source
|
MIT
| 2,017
|
SQSJobQueueBundle
|
tavii
|
PHP
|
Code
| 68
| 347
|
<?php
namespace Tavii\SQSJobQueueBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Tavii\SQSJobQueue\Queue\QueueName;
class WorkerStopCommand extends ContainerAwareCommand
{
protected function configure()
{
$this->setName('sqs_job_queue:worker-stop')
->setDescription('Stop a sqs worker')
->addArgument('queue', InputArgument::REQUIRED, 'Queue name')
->addOption('pid', 'p', InputOption::VALUE_OPTIONAL, 'stop pid name', null)
->addOption('force', 'f', InputOption::VALUE_NONE, 'force storage delete')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$queueName = new QueueName($input->getArgument('queue'), $this->getContainer()->getParameter('sqs_job_queue.prefix'));
$worker = $this->getContainer()->get('sqs_job_queue.worker');
$worker->stop($queueName, $input->getOption('pid'), $input->getOption('force'));
}
}
| 12,799
|
https://github.com/shang-demo/static-tools/blob/master/copy/stylie/src/model/actor.js
|
Github Open Source
|
Open Source
|
MIT
| 2,020
|
static-tools
|
shang-demo
|
JavaScript
|
Code
| 443
| 1,957
|
define([
'jquery'
,'underscore'
,'backbone'
,'src/constants'
,'src/collection/keyframes'
,'src/model/keyframe'
,'src/view/keyframe-forms'
,'src/view/crosshairs'
], function (
$
,_
,Backbone
,constant
,KeyframeCollection
,KeyframeModel
,KeyframeFormsView
,CrosshairsView
) {
// TODO: This model needs teardown/cleanup logic.
return Backbone.Model.extend({
/**
* @param {Object} attrs
* @param {Object} opts
* @param {Stylie} stylie
*/
initialize: function (attrs, opts) {
this.stylie = opts.stylie;
this.keyframeCollection =
new KeyframeCollection([], { stylie: this.stylie });
this.listenTo(
this.keyframeCollection, 'sort',
_.bind(this.onKeyframeCollectionSort, this));
this.listenTo(this.keyframeCollection,
'add', _.bind(this.onKeyframeCollectionAdd, this));
this.keyframeFormsView = new KeyframeFormsView({
stylie: this.stylie
,el: document.getElementById('keyframe-controls')
,model: this
});
this.crosshairsView = new CrosshairsView({
stylie: this.stylie
,el: document.getElementById('crosshairs')
,model: this
});
}
/**
* @param {KeyframeModel} model
*/
,onKeyframeCollectionAdd: function (model) {
this.crosshairsView.addCrosshairView(model);
this.keyframeFormsView.addKeyframeView(model);
}
,getLength: function () {
return this.keyframeCollection.length;
}
,getAttrsForKeyframe: function (index) {
return this.keyframeCollection.at(index).getAttrs();
}
,getMillisecondOfKeyframe: function (index) {
return +this.keyframeCollection.at(index).get('millisecond');
}
,onKeyframeCollectionSort: function () {
this.trigger('change');
this.stylie.trigger(constant.KEYFRAME_ORDER_CHANGED);
}
,appendNewKeyframeWithDefaultProperties: function () {
var lastKeyframeIndex = this.getLength() - 1;
var lastKeyframeMillisecond =
this.getMillisecondOfKeyframe(lastKeyframeIndex);
var lastKeyframeAttrs =
this.getAttrsForKeyframe(lastKeyframeIndex);
var newKeyframeMillisecond =
lastKeyframeMillisecond + constant.NEW_KEYFRAME_MILLISECOND_OFFSET;
this.keyframe(newKeyframeMillisecond, {
x: this.getNewKeyframeX(lastKeyframeAttrs.x)
,y: lastKeyframeAttrs.y
,scale: 1
,rX: 0
,rY: 0
,rZ: 0
}, 'linear');
}
,getNewKeyframeX: function (lastKeyframeX) {
var newKeyframeX = lastKeyframeX + constant.NEW_KEYFRAME_X_OFFSET;
var $crosshairEl = this.crosshairsView.$el.find('.crosshair');
var maxX = $crosshairEl.parent().width() - ($crosshairEl.width() / 2);
return Math.min(newKeyframeX, maxX);
}
,removeAllKeyframes: function () {
var copiedList = this.keyframeCollection.models.slice(0);
_.each(copiedList, function (keyframeModel) {
keyframeModel.destroy();
});
}
// Rekapi encapsulation methods
/**
* @param {number} millisecond
* @param {Object} properties
* @param {string|Object} opt_easing
*/
,keyframe: function (millisecond, properties, opt_easing) {
var transformRule = KeyframeModel.createCSSRuleObject(
properties.x
,properties.y
,properties.scale
,properties.rX
,properties.rY
,properties.rZ
,this.attributes.isCenteredToPath);
this.attributes.actor.keyframe(millisecond, transformRule, opt_easing);
var modelProperties = _.extend({
millisecond: millisecond
,easing: opt_easing
}, properties);
this.keyframeCollection.add(modelProperties, { actorModel: this });
var keyframeModel =
this.keyframeCollection.findWhere({ millisecond: millisecond });
this.listenTo(keyframeModel, 'change', _.bind(function () {
this.trigger('change');
}, this));
this.listenTo(keyframeModel, 'destroy', _.bind(function () {
this.removeKeyframe(
keyframeModel.attributes.millisecond, keyframeModel);
}, this));
this.stylie.trigger(constant.UPDATE_CSS_OUTPUT);
}
/**
* @param {number} millisecond
*/
,hasKeyframeAt: function (millisecond) {
var actor = this.get('actor');
return actor.hasKeyframeAt.apply(actor, arguments);
}
/**
* @param {number} from
* @param {number} to
*/
,moveKeyframe: function (from, to) {
if (this.hasKeyframeAt(to)) {
if (from !== to) {
this.stylie.trigger(constant.ALERT_ERROR,
'There is already a keyframe at millisecond ' + to + '.');
}
return;
}
var actor = this.attributes.actor;
actor.moveKeyframe.apply(actor, arguments);
var keyframeModel =
this.keyframeCollection.findWhere({ millisecond: from });
keyframeModel.set('millisecond', to);
this.keyframeCollection.sort();
}
/**
* @param {number} millisecond
* @param {KeyframeModel} keyframeModel
*/
,removeKeyframe: function (millisecond, keyframeModel) {
this.stopListening(keyframeModel);
this.keyframeCollection.removeKeyframe(millisecond);
this.get('actor').removeKeyframe(millisecond);
this.stylie.trigger(constant.PATH_CHANGED);
}
,importTimeline: function (actorData) {
_.each(actorData.propertyTracks, function (propertyTrack) {
_.each(propertyTrack, function (property) {
var transformObject = this.parseTranformString(property.value);
this.keyframe(
property.millisecond, transformObject, property.easing);
}, this);
}, this);
this.stylie.rekapi.update();
this.stylie.trigger(constant.PATH_CHANGED);
}
,parseTranformString: function (transformString) {
var chunks = transformString.match(/(-|\d|\.)+/g);
return {
x: +chunks[0]
,y: +chunks[1]
,scale: +chunks[2]
,rX: +chunks[3]
,rY: +chunks[4]
,rZ: +chunks[5]
};
}
});
});
| 7,677
|
https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmui/packages/vmui/src/components/Chart/GraphTips/GraphTips.tsx
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,023
|
VictoriaMetrics
|
VictoriaMetrics
|
TSX
|
Code
| 120
| 419
|
import React, { FC } from "preact/compat";
import "./style.scss";
import Button from "../../Main/Button/Button";
import { TipIcon } from "../../Main/Icons";
import Tooltip from "../../Main/Tooltip/Tooltip";
import Modal from "../../Main/Modal/Modal";
import useBoolean from "../../../hooks/useBoolean";
import tips from "./contants/tips";
const GraphTips: FC = () => {
const {
value: showTips,
setFalse: handleCloseTips,
setTrue: handleOpenTips
} = useBoolean(false);
return (
<>
<Tooltip title={"Show tips on working with the graph"}>
<Button
variant="text"
color={"gray"}
startIcon={<TipIcon/>}
onClick={handleOpenTips}
ariaLabel="open the tips"
/>
</Tooltip>
{showTips && (
<Modal
title={"Tips on working with the graph and the legend"}
onClose={handleCloseTips}
>
<div className="fc-graph-tips">
{tips.map(({ title, description }) => (
<div
className="fc-graph-tips-item"
key={title}
>
<h4 className="fc-graph-tips-item__action">
{title}
</h4>
<p className="fc-graph-tips-item__description">
{description}
</p>
</div>
))}
</div>
</Modal>
)}
</>
);
};
export default GraphTips;
| 15,958
|
https://github.com/mastermnd-io/cortex/blob/master/translator/run.sh
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
cortex
|
mastermnd-io
|
Shell
|
Code
| 15
| 51
|
#!/bin/bash
rm -rf ../content/*/
mkdir ./courses
node content-builder.js && cp -r ./courses/* ../content/
rmdir ./courses
| 7,798
|
https://github.com/BoniLindsley/phile/blob/master/phile/watchdog/observers.py
|
Github Open Source
|
Open Source
|
MIT
| null |
phile
|
BoniLindsley
|
Python
|
Code
| 599
| 2,027
|
#!/usr/bin/env python3
"""
-----------------------------------------------------------------
Convenience module for using :attr:`~watchdog.observers.Observer`
-----------------------------------------------------------------
"""
# Standard library.
import asyncio
import collections.abc
import contextlib
import pathlib
import typing
# External dependencies.
import watchdog.events
import watchdog.observers
def was_start_called(
observer: watchdog.observers.api.BaseObserver
) -> bool:
"""
Returns whether
the :meth:`~watchdog.observers.api.BaseObserver.start` method
of ``observer`` was called.
.. admonition:: Raison d'être
This can be useful for avoiding :exc:`RuntimeError`.
from calling :meth:`~threading.Thread.start` twice.
"""
return observer.ident is not None
def was_stop_called(
observer: watchdog.observers.api.BaseObserver
) -> bool:
"""
Returns whether
the :meth:`~watchdog.observers.api.BaseObserver.stop` method
of ``observer`` was called.
.. admonition:: Implementation detail
Uses an implementation-specific work-around
as it uses underscore variables.
.. admonition:: Raison d'être
The :meth:`~watchdog.observers.api.BaseObserver.stop` method
occurs asynchronously,
in the sense that :meth:`~threading.Thread.is_alive`
may not be :data:`False` immediately
after :meth:`~watchdog.observers.api.BaseObserver.stop` returns.
This function on the other hand returns :data:`True`
after such a call,
hence the name of the function.
Note that :meth:`~watchdog.observers.api.BaseObserver.stop`
is idempotent.
And it can be called before
:meth:`~watchdog.observers.api.BaseObserver.start`,
which will then try to stop it immediately.
In particular, it is possible
to have :func:`was_start_called` being :data:`False`
while :func:`was_stop_called` being :data:`True`.
"""
return observer.stopped_event.is_set()
@contextlib.contextmanager
def open( # pylint: disable=redefined-builtin
opener: typing.Callable[[], watchdog.observers.api.
BaseObserver] = watchdog.observers.Observer,
) -> collections.abc.Iterator[watchdog.observers.api.BaseObserver]:
observer = opener()
try:
observer.start()
yield observer
finally:
observer.stop()
@contextlib.asynccontextmanager
async def async_open(
opener: typing.Callable[[], watchdog.observers.api.
BaseObserver] = watchdog.observers.Observer,
) -> collections.abc.AsyncIterator[watchdog.observers.api.BaseObserver]:
loop = asyncio.get_running_loop()
observer = opener()
try:
await loop.run_in_executor(None, observer.start)
yield observer
finally:
await loop.run_in_executor(None, observer.stop)
def has_handlers(
observer: watchdog.observers.api.BaseObserver,
watch: watchdog.observers.api.ObservedWatch
) -> bool:
"""
Returns whether any handlers are monitoring ``watch``.
.. admonition:: Implementation detail
Uses an implementation-specific work-around
as it uses underscore variables.
"""
try:
return bool(
observer._handlers[watch] # pylint: disable=protected-access
)
except KeyError:
return False
def add_handler(
observer: watchdog.observers.api.BaseObserver,
event_handler: watchdog.events.FileSystemEventHandler,
path: pathlib.Path,
recursive: bool = False,
) -> watchdog.observers.api.ObservedWatch:
"""
Notify ``event_handler`` of changes in ``path``.
This function is identical
to :meth:`~watchdog.observers.api.BaseObserver.schedule`,
except the ``path`` parameter should be a :class:`~pathlib.Path`,
for potential type checking purposes.
This function is provided mainly for symmetry of operations
with :func:`remove_handler`.
.. admonition:: Raison d'être
The :class:`~watchdog.observers.api.BaseObserver` class
provides :meth:`~watchdog.observers.api.BaseObserver.schedule`
and
:meth:`~watchdog.observers.api.BaseObserver.add_handler_for_watch`
for registering ``event_handler`` to be called later.
The :meth:`~watchdog.observers.api.BaseObserver.schedule` method
sets up file monitoring of the given ``path``,
and remembers which handlers to call for the ``path``.
The
:meth:`~watchdog.observers.api.BaseObserver.add_handler_for_watch`
method does the same except it does not do the setting up.
For predictability reasons,
since :meth:`~watchdog.observers.api.BaseObserver.schedule`
skips the setting up if its was already done,
it should always be used over
:meth:`~watchdog.observers.api.BaseObserver.add_handler_for_watch`
so that the handler would not be registered against no monitoring
except in simple use cases.
Otherwise, if the user has to do their own redundant tracking
of :attr:`~watchdog.observers.api.ObservedWatch.path`-s.
"""
return observer.schedule(event_handler, str(path), recursive)
def remove_handler(
observer: watchdog.observers.api.BaseObserver,
event_handler: watchdog.events.FileSystemEventHandler,
watch: watchdog.observers.api.ObservedWatch,
) -> None:
""" # pylint: disable=line-too-long
Stop notifying ``event_handler`` of changes in ``watch``.
It merges
:meth:`~watchdog.observers.api.BaseObserver.remove_handler_for_watch`
and :meth:`~watchdog.observers.api.BaseObserver.unschedule`.
Note that the ``path`` parameter should be a :class:`~pathlib.Path`,
for potential type checking purposes.
.. admonition:: Implementation detail
This is an implementation-specific work-around
as it uses underscore variables.
.. admonition:: Raison d'être
The :class:`~watchdog.observers.api.BaseObserver` class
provides :meth:`~watchdog.observers.api.BaseObserver.unschedule`
and
:meth:`~watchdog.observers.api.BaseObserver.remove_handler_for_watch`
for deregistering ``event_handler``
as being interested in monitoring ``watch``.
The :meth:`~watchdog.observers.api.BaseObserver.unschedule` method
unregisters all handlers registered for ``watch``, whereas
:meth:`~watchdog.observers.api.BaseObserver.remove_handler_for_watch`
removes a single handler
but without checking if the monitoring should stop.
The former does not provide fine control over unregistering
whereas the latter potentially leads to a inotify watch leak.
This function provides finer control in the sense that
it stops the monitoring if there are no more handlers registered
for the given ``watch```, bridging functionality gaps.
"""
# pylint: disable=protected-access
with observer._lock:
handlers = observer._handlers.get(watch)
if not handlers:
return
handlers.remove(event_handler)
if not handlers:
emitter = observer._emitter_for_watch[watch]
del observer._handlers[watch]
observer._remove_emitter(emitter)
observer._watches.remove(watch)
| 569
|
https://github.com/OpenIoTHub/utils/blob/master/vendor/github.com/klauspost/reedsolomon/go.mod
|
Github Open Source
|
Open Source
|
MIT, LicenseRef-scancode-unknown-license-reference
| 2,022
|
utils
|
OpenIoTHub
|
Go Module
|
Code
| 7
| 43
|
module github.com/klauspost/reedsolomon
go 1.14
require github.com/klauspost/cpuid/v2 v2.0.6
| 19,772
|
https://github.com/clay/amphora-fs/blob/master/lib/getComponentPackage/index.js
|
Github Open Source
|
Open Source
|
MIT
| null |
amphora-fs
|
clay
|
JavaScript
|
Code
| 83
| 211
|
'use strict';
const _ = require('lodash'),
path = require('path');
let getComponentPath = require('../getComponentPath'),
tryRequire = require('../tryRequire');
/**
* Load a component's package
*
* Should only occur once per name!
*
* NOTE: This includes local components as well as npm components
*
* @param {string} name
* @returns {object|false}
*/
function getComponentPackage(name) {
let componentPath = getComponentPath(name);
return componentPath && tryRequire(path.join(componentPath, 'package.json'));
}
module.exports = _.memoize(getComponentPackage);
// for testing
module.exports.setDeps = (gCP, tR) => {
getComponentPath = gCP;
tryRequire = tR;
};
| 28,402
|
https://github.com/1and1/camunda-bpm-platform/blob/master/webapps/camunda-webapp/webapp/src/main/webapp/assets/vendor/camunda-common/directives/notificationsPanel.js
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,019
|
camunda-bpm-platform
|
1and1
|
JavaScript
|
Code
| 172
| 582
|
ngDefine('camunda.common.directives.notificationsPanel', [
'angular',
'jquery',
'module:ngSanitize'
], function(module, angular, $) {
var notificationsTemplate =
'<div class="notifications">' +
' <div ng-repeat="notification in notifications" class="alert" ng-class="notificationClass(notification)">' +
' <button type="button" class="close" ng-click="removeNotification(notification)">×</button>' +
' <strong>{{ notification.status }}:</strong> <span ng-bind-html="notification.message"></span>' +
' </div>' +
'</div>';
module.directive('notificationsPanel', function(Notifications, $filter) {
return {
restrict: 'EAC',
scope: {
filter: '=notificationsFilter'
},
template: notificationsTemplate,
link: function(scope, element, attrs, $destroy) {
var filter = scope.filter;
function matchesFilter(notification) {
if (!filter) {
return true;
}
return !!$filter('filter')([ notification ], filter).length;
};
var notifications = scope.notifications = [];
var consumer = {
add: function(notification) {
if (matchesFilter(notification)) {
notifications.push(notification);
return true;
} else {
return false;
}
},
remove: function(notification) {
var idx = notifications.indexOf(notification);
if (idx != -1) {
notifications.splice(idx, 1);
}
}
};
Notifications.registerConsumer(consumer);
scope.removeNotification = function(notification) {
notifications.splice(notifications.indexOf(notification), 1);
};
scope.notificationClass = function(notification) {
var classes = [ 'error', 'success', 'warning', 'information' ];
var type = 'information';
if (classes.indexOf(notification.type) != -1) {
type = notification.type;
}
return 'alert-' + type;
};
scope.$on('$destroy', function() {
Notifications.unregisterConsumer(consumer);
});
}
};
});
});
| 47,028
|
https://github.com/zengming00/unicorn_engine_tutorial/blob/master/1.c
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
unicorn_engine_tutorial
|
zengming00
|
C
|
Code
| 84
| 589
|
#include <stdio.h>
#include <stdint.h>
#include "./unicorn-1.0.2-win32/include/unicorn/unicorn.h"
// 指令数据在内存中的地址,你可以放在内存地址范围内的任何一个地方,
// 但是每个CPU架构都有一些特殊的内存地址区间是有特殊作用的,
// 并且unicorn要求地址必需4k对齐,因此这里我用的是0x8000
#define ADDRESS 0x8000
int main() {
uc_engine *uc;
uint32_t r2;
// 汇编代码 指令
// mov r0,1 0xE3A00001
// mov r1,2 0xE3A01002
// add r2,r0,r1 0xE0802001
uint32_t code[] = {0xE3A00001, 0xE3A01002, 0xE0802001};
// 将unicorn初始化为arm架构的arm指令集模式
uc_open(UC_ARCH_ARM, UC_MODE_ARM, &uc);
// 申请一块内存空间,由于unicorn要求地址必需4k对齐,所以这里申请了4K的内存,权限为全部权限(可读、可写、可执行)
uc_mem_map(uc, ADDRESS, 1024 * 4, UC_PROT_ALL);
// 将指令数据写入到模拟器内存
uc_mem_write(uc, ADDRESS, code, sizeof(code));
// 让模拟器从指定的地址开始运行,到指定的地址停止运行
uc_emu_start(uc, ADDRESS, ADDRESS + sizeof(code), 0, 0);
// 从模拟器中读取r2寄存器的值
uc_reg_read(uc, UC_ARM_REG_R2, &r2);
printf("r2 = %d\n", r2);
uc_close(uc);
return 0;
}
| 21,700
|
https://github.com/bertrandg/angular2-app-demo/blob/master/src/app/components/app.ts
|
Github Open Source
|
Open Source
|
MIT
| null |
angular2-app-demo
|
bertrandg
|
TypeScript
|
Code
| 135
| 361
|
/// <reference path="../../../typings/tsd.d.ts" />
/// <reference path="../../custom_typings/ng2.d.ts" />
import {Component, View, Directive, ElementRef} from 'angular2/angular2';
// Simple example directive
@Directive({
selector: '[x-large]' // using [ ] means selecting attributes
})
class XLarge {
constructor(public el: ElementRef) {
// simple dom manipulation to set font size to x-large
this.el.domElement.style.fontSize = 'x-large';
}
}
// Top Level Component
@Component({
selector: 'app' // without [ ] means we are selecting the tag directly
})
@View({
directives: [ XLarge ], // needed in order to tell Angular's compiler what's in the template
template: `
<h1>Hello {{ name }}</h1>
<span x-large>Extra Large Font Directive</span>
<hr>
<p (click)="showMeTheWay(ref)">XX{{ ref.value }}XX</p>
<input type="text" #ref (keyup)>
`
})
export class App {
name: string;
constructor() {
this.name = 'Angular 2';
}
showMeTheWay(ref) {
console.log('ref = ', ref);
console.log('ref.value = ', ref.value);
}
}
| 44,151
|
https://github.com/Laneglos/error-tracker/blob/master/tests/DjangoTest/tests/test_basic.py
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| 2,022
|
error-tracker
|
Laneglos
|
Python
|
Code
| 159
| 954
|
# -*- coding: utf-8 -*-
#
# Basic test case test, this tests basic part of application
#
# :copyright: 2019 Sonu Kumar
# :license: BSD-3-Clause
#
import unittest
from django.test import LiveServerTestCase
from util import TestBase
class BasicTests(object):
def no_exception(self):
result = self.client.get("/")
self.assertEqual(u'No Exception!', result.content.decode('utf-8'))
self.assertEqual(self.get_exceptions(), [])
def value_error(self):
self.get("/value-error")
errors = self.get_exceptions()
self.assertEqual(len(errors), 1)
error = errors[0]
self.assertIsNotNone(error.hash)
self.assertIsNotNone(error.host)
self.assertIsNotNone(error.path)
self.assertIsNotNone(error.method)
self.assertIsNotNone(error.request_data)
self.assertIsNotNone(error.traceback)
self.assertIsNotNone(error.count)
self.assertIsNotNone(error.created_on)
self.assertIsNotNone(error.last_seen)
self.assertEqual(error.count, 1)
self.assertEqual(error.method, 'GET')
self.assertEqual(error.path, "/value-error")
self.get('/value-error')
errors = self.get_exceptions()
self.assertEqual(len(errors), 1)
error_new = errors[-1]
self.assertEqual(error_new.hash, error.hash)
self.assertEqual(error_new.host, error.host)
self.assertEqual(error_new.path, error.path)
self.assertEqual(error_new.method, error.method)
self.assertEqual(error_new.request_data, error.request_data)
self.assertEqual(error_new.traceback, error.traceback)
self.assertNotEqual(error_new.count, error.count)
self.assertEqual(error_new.created_on, error.created_on)
self.assertNotEqual(error_new.last_seen, error.last_seen)
self.assertEqual(error_new.count, 2)
self.get('/value-error')
errors = self.get_exceptions()
self.assertEqual(len(errors), 1)
error_new = errors[-1]
self.assertEqual(error_new.count, 3)
def post_method_error(self):
self.post('/post-view')
errors = self.get_exceptions()
self.assertEqual(len(errors), 1)
error = errors[-1]
self.assertIsNotNone(error.hash)
self.assertIsNotNone(error.host)
self.assertIsNotNone(error.path)
self.assertIsNotNone(error.method)
self.assertIsNotNone(error.request_data)
self.assertIsNotNone(error.traceback)
self.assertIsNotNone(error.count)
self.assertIsNotNone(error.created_on)
self.assertIsNotNone(error.last_seen)
self.assertEqual(error.count, 1)
self.assertEqual(error.method, 'POST')
self.assertEqual(error.path, "/post-view")
class BasicTestCase(LiveServerTestCase, TestBase, BasicTests):
def test_no_exception(self):
self.no_exception()
def test_value_error(self):
self.value_error()
def test_post_method_error(self):
self.post_method_error()
if __name__ == '__main__':
unittest.main()
| 33,734
|
https://github.com/alezandr/geohash-explorer/blob/master/src/extended-leaflet.ts
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
geohash-explorer
|
alezandr
|
TypeScript
|
Code
| 485
| 1,657
|
// Copyright 2019 Alexander Berezovsky
// License: http://opensource.org/licenses/MIT
import * as L from 'leaflet'
interface Cell {
midX: number
midY: number
width: number
height: number
}
export let ExtendSVG = L.SVG.extend({
initialize(options) {
L.Renderer.prototype['initialize'].call(this, options);
this._msie = window.navigator.userAgent.indexOf['MSIE '] >= 0
|| !!navigator.userAgent.match(/Trident.*rv\:11\./);
},
_initPath: function (layer) {
L.SVG.prototype['_initPath'].call(this, layer);
var label = layer._label = L.SVG.create('text');
if (this._msie) {
label['textContent'] = layer['_text'] ? layer['_text'] : 'W';
} else {
label.innerHTML = layer['_text'] ? layer['_text'] : 'W';
}
},
_addPath: function (layer) {
L.SVG.prototype['_addPath'].call(this, layer);
this._rootGroup.appendChild(layer._label);
},
_removePath: function (layer) {
L.SVG.prototype['_removePath'].call(this, layer);
L.DomUtil.remove(layer._label);
},
_setStyle(layer: L.Layer & { _label }, style: { x: number, y: number, fontSize: number, opacity: number }) {
let label = layer._label
label.setAttribute('class', "geohash-cell-label")
label.setAttribute('visibility', 'visible')
label.setAttribute('x', style.x)
label.setAttribute('y', style.y)
label.setAttribute('text-anchor', 'middle')
label.setAttribute('dominant-baseline', 'middle')
label.setAttribute('font-size', style.fontSize)
label.setAttribute('fill-opacity', style.opacity)
},
_updateLabel: function (layer: L.Layer & { _parts, _label }) {
if (layer._parts.length > 0) {
let label = layer._label
const cell: Cell = this._calcCell(layer._parts)
// debug(`ExtendLeaflet._updateLabel() cell - '${label.innerHTML}',
// size: '${JSON.stringify(cell)}, parts: ${JSON.stringify(layer._parts)}`)
if (cell.width > 300) {
label.setAttribute('visibility', 'visible')
label.setAttribute('x', cell.midX)
label.setAttribute('y', cell.midY)
label.setAttribute('text-anchor', 'middle')
label.setAttribute('dominant-baseline', 'middle')
label.setAttribute('font-size', 150)
label.setAttribute('fill-opacity', "0.3")
label.setAttribute('class', "geohash-cell-label")
} else if (cell.width > 80) {
label.setAttribute('visibility', 'visible')
label.setAttribute('x', cell.midX)
label.setAttribute('y', cell.midY)
label.setAttribute('text-anchor', 'middle')
label.setAttribute('dominant-baseline', 'middle')
label.setAttribute('font-size', 50)
label.setAttribute('fill-opacity', "0.6")
label.setAttribute('class', "geohash-cell-label")
} else if (cell.width > 24) {
label.setAttribute('visibility', 'visible')
label.setAttribute('x', cell.midX)
label.setAttribute('y', cell.midY)
label.setAttribute('text-anchor', 'middle')
label.setAttribute('dominant-baseline', 'middle')
label.setAttribute('font-size', 16)
label.setAttribute('fill-opacity', "1.0")
label.setAttribute('class', "geohash-cell-label")
} else {
label.setAttribute('visibility', 'hidden')
}
} else {
layer._label.setAttribute('visibility', 'hidden')
}
},
_updatePoly: function (layer: L.Layer & { _parts, _label }, closed) {
this._setPath(layer, L.SVG.pointsToPath(layer._parts, closed));
this._updateLabel(layer)
},
_calcCell(_rings): Cell {
var i, j, p1, p2, f, area, x, y,
points = _rings[0],
len = points.length;
if (!len) { return null; }
// polygon centroid algorithm; only uses the first ring if there are multiple
area = x = y = 0;
var minX, minY, maxX, maxY = 0
for (i = 0, j = len - 1; i < len; j = i++) {
if (i == 0) {
minX = maxX = points[i].x
minY = maxY = points[i].y
} else {
if (points[i].x > maxX) {
maxX = points[i].x
}
if (points[i].y > maxY) {
maxY = points[i].y
}
if (points[i].x < minX) {
minX = points[i].x
}
if (points[i].y < minY) {
minY = points[i].y
}
}
p1 = points[i];
p2 = points[j];
f = p1.y * p2.x - p2.y * p1.x;
x += (p1.x + p2.x) * f;
y += (p1.y + p2.y) * f;
area += f * 3;
}
let midX, midY, width, height
if (area === 0) {
// Polygon is so small that all points are on same pixel.
midX = minY = points[0];
width = height = 0
} else {
midX = x / area
midY = y / area
width = maxX - minX
height = maxY - minY
}
return {
midX, midY, width, height
}
}
})
| 46,327
|
https://github.com/Sinalma/SINCycleView/blob/master/SINCycleView/SINCycleView/Demo/CycleView/SINImageView.h
|
Github Open Source
|
Open Source
|
MIT
| null |
SINCycleView
|
Sinalma
|
C
|
Code
| 32
| 96
|
//
// SINImageView.h
// SINCycleView
//
// Created by apple on 30/04/2017.
// Copyright © 2017 sinalma. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SINImageView : UIImageView
@property (nonatomic,assign) NSInteger identify;
@end
| 43,050
|
https://github.com/canonical/postgresql-operator/blob/master/tests/unit/test_charm.py
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,022
|
postgresql-operator
|
canonical
|
Python
|
Code
| 647
| 3,108
|
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
import re
import subprocess
import unittest
from unittest.mock import Mock, patch
from charms.operator_libs_linux.v0 import apt
from ops.model import ActiveStatus, BlockedStatus, WaitingStatus
from ops.testing import Harness
from charm import PostgresqlOperatorCharm
from tests.helpers import patch_network_get
class TestCharm(unittest.TestCase):
@patch_network_get(private_address="1.1.1.1")
def setUp(self):
self._peer_relation = "postgresql-replicas"
self._postgresql_container = "postgresql"
self._postgresql_service = "postgresql"
self.harness = Harness(PostgresqlOperatorCharm)
self.addCleanup(self.harness.cleanup)
self.harness.begin()
self.charm = self.harness.charm
@patch("charm.PostgresqlOperatorCharm._install_pip_packages")
@patch("charm.PostgresqlOperatorCharm._install_apt_packages")
@patch("charm.Patroni.inhibit_default_cluster_creation")
def test_on_install(
self, _inhibit_default_cluster_creation, _install_apt_packages, _install_pip_packages
):
# Test without adding Patroni resource.
self.charm.on.install.emit()
# Assert that the needed calls were made.
_inhibit_default_cluster_creation.assert_called_once()
_install_apt_packages.assert_called_once()
# Assert that the needed calls were made.
_install_pip_packages.assert_not_called()
# Assert the status set by the event handler.
self.assertTrue(isinstance(self.harness.model.unit.status, BlockedStatus))
# Add an empty file as Patroni resource just to check that the correct calls were made.
self.harness.add_resource("patroni", "")
self.charm.on.install.emit()
_install_pip_packages.assert_called_once()
# Assert the status set by the event handler.
self.assertTrue(isinstance(self.harness.model.unit.status, WaitingStatus))
@patch("charm.PostgresqlOperatorCharm._install_pip_packages")
@patch("charm.PostgresqlOperatorCharm._install_apt_packages")
@patch("charm.Patroni.inhibit_default_cluster_creation")
def test_on_install_apt_failure(
self, _inhibit_default_cluster_creation, _install_apt_packages, _install_pip_packages
):
# Mock the result of the call.
_install_apt_packages.side_effect = apt.PackageNotFoundError
# Trigger the hook.
self.charm.on.install.emit()
# Assert that the needed calls were made.
_inhibit_default_cluster_creation.assert_called_once()
_install_apt_packages.assert_called_once()
_install_pip_packages.assert_not_called()
self.assertTrue(isinstance(self.harness.model.unit.status, BlockedStatus))
@patch("charm.PostgresqlOperatorCharm._install_pip_packages")
@patch("charm.PostgresqlOperatorCharm._install_apt_packages")
@patch("charm.Patroni.inhibit_default_cluster_creation")
def test_on_install_pip_failure(
self, _inhibit_default_cluster_creation, _install_apt_packages, _install_pip_packages
):
# Mock the result of the call.
_install_pip_packages.side_effect = subprocess.CalledProcessError(
cmd="pip3 install patroni", returncode=1
)
# Add an empty file as Patroni resource just to check that the correct calls were made.
self.harness.add_resource("patroni", "")
self.charm.on.install.emit()
# Assert that the needed calls were made.
_inhibit_default_cluster_creation.assert_called_once()
_install_apt_packages.assert_called_once()
_install_pip_packages.assert_called_once()
self.assertTrue(isinstance(self.harness.model.unit.status, BlockedStatus))
def test_on_leader_elected(self):
# Assert that there is no password in the peer relation.
self.harness.add_relation(self._peer_relation, self.charm.app.name)
self.assertIsNone(self.charm._peers.data[self.charm.app].get("postgres-password", None))
# Check that a new password was generated on leader election.
self.harness.set_leader()
password = self.charm._peers.data[self.charm.app].get("postgres-password", None)
self.assertIsNotNone(password)
# Trigger a new leader election and check that the password is still the same.
self.harness.set_leader(False)
self.harness.set_leader()
self.assertEqual(
self.charm._peers.data[self.charm.app].get("postgres-password", None), password
)
@patch("charm.Patroni.bootstrap_cluster")
@patch(
"charm.PostgresqlOperatorCharm._replication_password", return_value="fake-replication-pw"
)
@patch("charm.PostgresqlOperatorCharm._get_postgres_password", return_value=None)
def test_on_start(self, _get_postgres_password, _replication_password, _bootstrap_cluster):
# Test before the passwords are generated.
self.charm.on.start.emit()
_bootstrap_cluster.assert_not_called()
self.assertTrue(isinstance(self.harness.model.unit.status, WaitingStatus))
# Mock the generated superuser password.
_get_postgres_password.return_value = "fake-postgres-password"
# Mock cluster start success values.
_bootstrap_cluster.side_effect = [False, True]
# Test for a failed cluster bootstrapping.
self.charm.on.start.emit()
_bootstrap_cluster.assert_called_once()
self.assertTrue(isinstance(self.harness.model.unit.status, BlockedStatus))
# Set an initial waiting status (like after the install hook was triggered).
self.harness.model.unit.status = WaitingStatus("fake message")
# Then test the event of a correct cluster bootstrapping.
self.charm.on.start.emit()
self.assertTrue(isinstance(self.harness.model.unit.status, ActiveStatus))
@patch("charm.Patroni.bootstrap_cluster")
@patch("charm.PostgresqlOperatorCharm._replication_password")
@patch("charm.PostgresqlOperatorCharm._get_postgres_password")
def test_on_start_after_blocked_state(
self, _get_postgres_password, _replication_password, _bootstrap_cluster
):
# Set an initial blocked status (like after the install hook was triggered).
initial_status = BlockedStatus("fake message")
self.harness.model.unit.status = initial_status
# Test for a failed cluster bootstrapping.
self.charm.on.start.emit()
_get_postgres_password.assert_not_called()
_replication_password.assert_not_called()
_bootstrap_cluster.assert_not_called()
# Assert the status didn't change.
self.assertEqual(self.harness.model.unit.status, initial_status)
@patch("charm.PostgresqlOperatorCharm._get_postgres_password")
def test_on_get_postgres_password(self, _get_postgres_password):
mock_event = Mock()
_get_postgres_password.return_value = "test-password"
self.charm._on_get_initial_password(mock_event)
_get_postgres_password.assert_called_once()
mock_event.set_results.assert_called_once_with({"postgres-password": "test-password"})
def test_get_postgres_password(self):
# Test for a None password.
self.harness.add_relation(self._peer_relation, self.charm.app.name)
self.assertIsNone(self.charm._get_postgres_password())
# Then test for a non empty password after leader election and peer data set.
self.harness.set_leader()
password = self.charm._get_postgres_password()
self.assertIsNotNone(password)
self.assertNotEqual(password, "")
@patch("charms.operator_libs_linux.v0.apt.add_package")
@patch("charms.operator_libs_linux.v0.apt.update")
def test_install_apt_packages(self, _update, _add_package):
mock_event = Mock()
# Mock the returns of apt-get update calls.
_update.side_effect = [
subprocess.CalledProcessError(returncode=1, cmd="apt-get update"),
None,
None,
]
# Test for problem with apt update.
with self.assertRaises(subprocess.CalledProcessError):
self.charm._install_apt_packages(mock_event, ["postgresql"])
_update.assert_called_once()
# Test with a not found package.
_add_package.side_effect = apt.PackageNotFoundError
with self.assertRaises(apt.PackageNotFoundError):
self.charm._install_apt_packages(mock_event, ["postgresql"])
_update.assert_called()
_add_package.assert_called_with("postgresql")
# Then test a valid one.
_update.reset_mock()
_add_package.reset_mock()
_add_package.side_effect = None
self.charm._install_apt_packages(mock_event, ["postgresql"])
_update.assert_called_once()
_add_package.assert_called_with("postgresql")
@patch("subprocess.call")
def test_install_pip_packages(self, _call):
# Fake pip packages.
packages = ["package1", "package2"]
_call.side_effect = [None, subprocess.SubprocessError]
# Then test for a succesful install.
self.charm._install_pip_packages(packages)
# Check that check_call was invoked with the correct arguments.
_call.assert_called_once_with(
[
"pip3",
"install",
"package1 package2",
]
)
# Assert the status set by the event handler.
self.assertFalse(isinstance(self.harness.model.unit.status, BlockedStatus))
# Then, test for an error.
with self.assertRaises(subprocess.SubprocessError):
self.charm._install_pip_packages(packages)
def test_new_password(self):
# Test the password generation twice in order to check if we get different passwords and
# that they meet the required criteria.
first_password = self.charm._new_password()
self.assertEqual(len(first_password), 16)
self.assertIsNotNone(re.fullmatch("[a-zA-Z0-9\b]{16}$", first_password))
second_password = self.charm._new_password()
self.assertIsNotNone(re.fullmatch("[a-zA-Z0-9\b]{16}$", second_password))
self.assertNotEqual(second_password, first_password)
| 43,694
|
https://github.com/velialarm/FancyApps/blob/master/FancyApps/FancyApps.Services/Controllers/FriendController.cs
|
Github Open Source
|
Open Source
|
MIT
| null |
FancyApps
|
velialarm
|
C#
|
Code
| 264
| 912
|
namespace FancyApps.Services.Controllers
{
using System;
using System.Linq;
using System.Web.Http;
using Model;
using Model.Entities;
using Models;
using Models.Request;
using Models.Response;
public class FriendController : AbstractApiController
{
[Route("api/add-friend")]
[HttpPost]
public AddFriendResponse AddFriend(AddFriendRequest input)
{
if (!this.ModelState.IsValid)
{
return new AddFriendResponse
{
Status = new Status
{
Code = Status.INTERNAL_MESSAGE_CODE,
Message = this.ModelState.Values.First().Errors.First().ErrorMessage
}
};
}
if (input == null)
{
return new AddFriendResponse(Status.MISSING_PARRAMETERS);
}
////check for register user by Token
User currentUser = null;
try
{
currentUser = this.Users.SingleOrDefault(a => a.Token == input.Token); ////TOKEN must be unique
if (currentUser == null)
{
return new AddFriendResponse(Status.INVALID_TOKEN);
}
}
catch (Exception)
{
return new AddFriendResponse(Status.INTERNAL_ERROR);
}
////check for exist friend
var friends = currentUser.Friends;
if (friends.Count > 0)
{
var friend = friends.FirstOrDefault(a => a.Email == input.Email);
if (friend != null)
{
return new AddFriendResponse(Status.ADDFRIEND_EXIST);
}
}
friends.Add(new Friend
{
Nickname = input.Nickname,
Email = input.Email
});
this.Users.Update(currentUser);
return new AddFriendResponse(Status.ADDFRIEND_SUCCESSFULL_ADDED);
}
[Route("api/remove-friend")]
[HttpPost]
public RemoveFriendResponse RemoveFriend(RemoveFriendRequest input)
{
if (!this.ModelState.IsValid)
{
return new RemoveFriendResponse
{
Status = new Status
{
Code = 601,
Message = this.ModelState.Values.First().Errors.First().ErrorMessage
}
};
}
if (input == null)
{
return new RemoveFriendResponse(Status.MISSING_PARRAMETERS);
}
////check for register user by Token
User currentUser = null;
try
{
currentUser = this.Users.SingleOrDefault(a => a.Token == input.Token); ////TOKEN must be unique
if (currentUser == null)
{
return new RemoveFriendResponse(Status.INVALID_TOKEN);
}
}
catch (Exception)
{
return new RemoveFriendResponse(Status.INTERNAL_ERROR);
}
////check for exist friend
var friends = currentUser.Friends;
if (friends.Count > 0)
{
var friend = friends.FirstOrDefault(a => a.Email == input.Email);
if (friend != null)
{
friends.Remove(friend);
this.Users.Update(currentUser);
return new RemoveFriendResponse(Status.REMOVEFRIEND_SUCCESS);
}
}
return new RemoveFriendResponse(Status.REMOVEFRIEND_NOT_EXIST_IN_LIST);
}
}
}
| 39,106
|
https://github.com/lynings/tdd-kata/blob/master/src/main/java/pers/lyning/kata/conferencetrack/Track.java
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
tdd-kata
|
lynings
|
Java
|
Code
| 47
| 127
|
package pers.lyning.kata.conferencetrack;
/**
* @author lyning
*/
public class Track {
private final Session afternoon;
private final Session morning;
public Track(Session morning, Session afternoon) {
this.morning = morning;
this.afternoon = afternoon;
}
public Session getAfternoon() {
return this.afternoon;
}
public Session getMorning() {
return this.morning;
}
}
| 42,210
|
https://github.com/Olga-Sh1/jsm-ars/blob/master/src/JSMBase.Medicine/RWServices/Excel/Converters/LogicalThreeConverter.cs
|
Github Open Source
|
Open Source
|
MIT
| null |
jsm-ars
|
Olga-Sh1
|
C#
|
Code
| 129
| 398
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BFSettings;
using JSMBase.RNK;
namespace JSMBase.Medicine.RWServices.Excel.Converters
{
public sealed class LogicalThreeConverter : BaseConverter<BFSettings.LogicalTreePropSetting>
{
PropInfoList pil;
private static string YES = "Да";
private static string NO = "Нет";
public LogicalThreeConverter(LogicalTreePropSetting ob) : base(ob)
{
}
public override IPropInfo CreateInfo()
{
if (pil == null)
{
pil = new PropInfoList();
pil.Name = pil.Description = inner.Name;
pil.Values = new string[]
{
YES, NO
};
if (inner.Categories != null && inner.Categories.Length > 0) pil.GroupId = inner.Categories[0];
}
return pil;
}
public override IPropValue CreateValue(DataRow dr)
{
Object ob = dr[inner.ExcelColumn];
String tr = TryConvert<String>(ob);
String val = null;
if (inner.StringTrueValues.Contains(tr))
val = YES;
else if (inner.StringFalseValues.Contains(tr))
val = NO;
PropValueList pvl = new PropValueList((PropInfoList)CreateInfo(), val);
return pvl;
}
}
}
| 39,138
|
https://github.com/condast/AieonF/blob/master/Workspace/org.aieonf.commons.ui/src/org/aieonf/commons/ui/wizard/PageActionEvent.java
|
Github Open Source
|
Open Source
|
Apache-2.0
| null |
AieonF
|
condast
|
Java
|
Code
| 106
| 333
|
package org.aieonf.commons.ui.wizard;
import java.util.EventObject;
import org.aieonf.commons.ui.flow.IFlowControl;
import org.aieonf.commons.ui.wizard.IAddWizardPageListener.PageActions;
import org.eclipse.jface.wizard.IWizard;
public class PageActionEvent extends EventObject {
private static final long serialVersionUID = 1L;
private PageActions event;
private String pageName;
private String description;
private String message;
private IFlowControl flow;
public PageActionEvent( IWizard source, IFlowControl flow, PageActions event, String pageName, String description, String message ){
super(source);
this.event = event;
this.pageName = pageName;
this.description = description;
this.message = message;
this.flow = flow;
}
public IFlowControl getFlow() {
return flow;
}
public PageActions getEvent() {
return event;
}
public String getPageName() {
return pageName;
}
public String getDescription() {
return description;
}
public String getMessage() {
return message;
}
}
| 31,896
|
https://github.com/beatgrabe/absync-todo/blob/master/public/js/todo/todos.js
|
Github Open Source
|
Open Source
|
MIT
| 2,016
|
absync-todo
|
beatgrabe
|
JavaScript
|
Code
| 63
| 204
|
"use strict";
angular
.module( "todomvc" )
.config( registerTodoService )
.run( configureService );
/* @ngInject */
function registerTodoService( absyncProvider ) {
absyncProvider.collection( "todos",
{
model : "Todo",
collectionName : "todos",
collectionUri : "/api/todos",
entityName : "todo",
entityUri : "/api/todos"
}
);
}
/* @ngInjec */
function configureService( $http, todos ) {
todos.throwFailures = true;
todos.clearCompleted = function() {
return $http.delete( "/api/todos" );
}
}
| 173
|
https://github.com/jwpf100/essential-coaching-gatsby/blob/master/src/components/BlogPostFooter/index.js
|
Github Open Source
|
Open Source
|
0BSD
| 2,021
|
essential-coaching-gatsby
|
jwpf100
|
JavaScript
|
Code
| 6
| 14
|
export { default } from './BlogPostFooter'
| 13,686
|
https://github.com/RodrigoHolztrattner/Wonderland/blob/master/Wonderland/Wonderland/Editor/Modules/Flux/Box/Function/DynamicMemberFunction/DynamicMemberFunctionCreator.cpp
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
Wonderland
|
RodrigoHolztrattner
|
C++
|
Code
| 136
| 423
|
////////////////////////////////////////////////////////////////////////////////
// Filename: DynamicMemberFunctionCreator.cpp
////////////////////////////////////////////////////////////////////////////////
#include "DynamicMemberFunctionCreator.h"
#include "DynamicMemberFunctionRegister.h"
#include "DynamicMemberFunction.h"
#include "..\..\..\Class\ClassRegister.h"
#include "..\..\..\Class\Class.h"
Flux::DynamicMemberFunctionCreator::DynamicMemberFunctionCreator()
{
}
Flux::DynamicMemberFunctionCreator::~DynamicMemberFunctionCreator()
{
}
Flux::DynamicMemberFunction* Flux::DynamicMemberFunctionCreator::CreateDynamicMemberFunction(std::string _functionName, Flux::Handle _classHandle)
{
// Get the global instances we will need
Flux::ClassRegister* classRegisterInstance = Flux::ClassRegister::GetInstance();
Flux::DynamicMemberFunctionRegister* DynamicMemberFunctionRegisterInstance = Flux::DynamicMemberFunctionRegister::GetInstance();
// First we need to get the class object
Flux::Class* functionClass = classRegisterInstance->GetClass(_classHandle);
// Now we need to check if the class already have a member function with the same name
if (functionClass->GetMemberFunction(_functionName))
{
// We already have a function with this name
return nullptr;
}
// Now we can create our member function object and set the internal class handle to differentiate the owner
Flux::DynamicMemberFunction* newDynamicMemberFunction = new Flux::DynamicMemberFunction(_functionName, _classHandle);
// Generate a valid handle for the new member function
newDynamicMemberFunction->GenerateHandle();
// We need to register the function
DynamicMemberFunctionRegisterInstance->RegisterFunction(newDynamicMemberFunction);
return newDynamicMemberFunction;
}
| 5,378
|
https://github.com/RobPethick/Favrobot/blob/master/lib/models/card.py
|
Github Open Source
|
Open Source
|
MIT
| 2,017
|
Favrobot
|
RobPethick
|
Python
|
Code
| 20
| 76
|
class Card(object):
def __init__(self, json):
self.cardId = json['cardId']
self.organizationId = json['organizationId']
self.widgetId = json['widgetCommonId']
self.columnId = json['columnId']
self.name = json['name']
| 25,082
|
https://github.com/yunfzhan/Xit/blob/master/Xit/Changes/RepositorySelection.swift
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,022
|
Xit
|
yunfzhan
|
Swift
|
Code
| 286
| 644
|
import Cocoa
typealias FileChangesRepo =
BasicRepository & CommitReferencing & FileDiffing & FileContents &
FileStaging & FileStatusDetection
/// Protocol for a commit or commit-like object, with metadata, files, and diffs.
protocol RepositorySelection: AnyObject
{
var repository: any FileChangesRepo { get set }
/// SHA for commit to be selected in the history list
var oidToSelect: (any OID)? { get }
/// Is this used to stage and commit files? Differentiates between staging
/// and stash changes, which both have unstaged lists.
var canCommit: Bool { get }
/// The primary or staged file list.
var fileList: any FileListModel { get }
}
/// A selection that also has an unstaged file list
protocol StagedUnstagedSelection: RepositorySelection
{
/// The unstaged file list
var unstagedFileList: any FileListModel { get }
var amending: Bool { get }
}
extension StagedUnstagedSelection
{
func counts() -> (staged: Int, unstaged: Int)
{
let indexChanges = fileList.changes
let workspaceChanges = unstagedFileList.changes
let unmodifiedCounter: (FileChange) -> Bool = { $0.status != .unmodified }
let stagedCount = indexChanges.count(where: unmodifiedCounter)
let unstagedCount = workspaceChanges.count(where: unmodifiedCounter)
return (stagedCount, unstagedCount)
}
}
extension RepositorySelection
{
func list(staged: Bool) -> any FileListModel
{
return staged ? fileList :
(self as? StagedUnstagedSelection)?.unstagedFileList ?? fileList
}
func equals(_ other: (any RepositorySelection)?) -> Bool
{
guard let other = other
else {
return false
}
return type(of: self) == type(of: other) &&
oidToSelect == other.oidToSelect
}
}
enum StagingType
{
// No staging actions
case none
// Index: can unstage
case index
// Workspace: can stage
case workspace
}
func == (a: (any RepositorySelection)?, b: (any RepositorySelection)?) -> Bool
{
return a?.equals(b) ?? (b == nil)
}
func != (a: (any RepositorySelection)?, b: (any RepositorySelection)?) -> Bool
{
return !(a == b)
}
| 8,831
|
https://github.com/AsahiOS/gate/blob/master/usr/src/lib/pam_modules/krb5_migrate/krb5_migrate_authenticate.c
|
Github Open Source
|
Open Source
|
MIT
| null |
gate
|
AsahiOS
|
C
|
Code
| 1,257
| 4,136
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <kadm5/admin.h>
#include <krb5.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <security/pam_impl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <syslog.h>
#include <libintl.h>
#define KRB5_AUTOMIGRATE_DATA "SUNW-KRB5-AUTOMIGRATE-DATA"
static void krb5_migrate_cleanup(pam_handle_t *pamh, void *data,
int pam_status);
/*
* pam_sm_authenticate - Authenticate a host-based client service
* principal to kadmind in order to permit the creation of a new user
* principal in the client's default realm.
*/
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char **argv)
{
char *user = NULL;
char *userdata = NULL;
char *olduserdata = NULL;
char *password = NULL;
int err, i;
time_t now;
/* pam.conf options */
int debug = 0;
int quiet = 0;
int expire_pw = 0;
char *service = NULL;
/* krb5-specific defines */
kadm5_ret_t retval = 0;
krb5_context context = NULL;
kadm5_config_params params;
krb5_principal svcprinc;
char *svcprincstr = NULL;
krb5_principal userprinc;
char *userprincstr = NULL;
int strlength = 0;
kadm5_principal_ent_rec kadm5_userprinc;
char *kadmin_princ = NULL;
char *def_realm = NULL;
void *handle = NULL;
long mask = 0;
for (i = 0; i < argc; i++) {
if (strcmp(argv[i], "debug") == 0) {
debug = 1;
} else if (strcmp(argv[i], "quiet") == 0) {
quiet = 1;
} else if (strcmp(argv[i], "expire_pw") == 0) {
expire_pw = 1;
} else if ((strstr(argv[i], "client_service=") != NULL) &&
(strcmp((strstr(argv[i], "=") + 1), "") != 0)) {
service = strdup(strstr(argv[i], "=") + 1);
} else {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): unrecognized "
"option %s", argv[i]);
}
}
if (flags & PAM_SILENT)
quiet = 1;
err = pam_get_item(pamh, PAM_USER, (void**)&user);
if (err != PAM_SUCCESS) {
goto cleanup;
}
/*
* Check if user name is *not* NULL
*/
if (user == NULL || (user[0] == '\0')) {
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): user empty or null");
goto cleanup;
}
/*
* Can't tolerate memory failure later on. Get a copy
* before any work is done.
*/
if ((userdata = strdup(user)) == NULL) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Out of memory");
goto cleanup;
}
/*
* Grok the user password
*/
err = pam_get_item(pamh, PAM_AUTHTOK, (void **)&password);
if (err != PAM_SUCCESS) {
goto cleanup;
}
if (password == NULL || (password[0] == '\0')) {
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): "
"authentication token is empty or null");
goto cleanup;
}
/*
* Now, lets do the all krb5/kadm5 setup for the principal addition
*/
if (retval = krb5_init_secure_context(&context)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error initializing "
"krb5: %s", error_message(retval));
goto cleanup;
}
(void) memset((char *)¶ms, 0, sizeof (params));
(void) memset(&kadm5_userprinc, 0, sizeof (kadm5_userprinc));
if (def_realm == NULL && krb5_get_default_realm(context, &def_realm)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while obtaining "
"default krb5 realm");
goto cleanup;
}
params.mask |= KADM5_CONFIG_REALM;
params.realm = def_realm;
if (kadm5_get_adm_host_srv_name(context, def_realm,
&kadmin_princ)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while obtaining "
"host based service name for realm %s\n", def_realm);
goto cleanup;
}
if (retval = krb5_sname_to_principal(context, NULL,
(service != NULL) ? service : "host", KRB5_NT_SRV_HST, &svcprinc)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while creating "
"krb5 host service principal: %s",
error_message(retval));
goto cleanup;
}
if (retval = krb5_unparse_name(context, svcprinc,
&svcprincstr)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while "
"unparsing principal name: %s", error_message(retval));
krb5_free_principal(context, svcprinc);
goto cleanup;
}
krb5_free_principal(context, svcprinc);
/*
* Initialize the kadm5 connection using the default keytab
*/
retval = kadm5_init_with_skey(svcprincstr, NULL,
kadmin_princ, ¶ms, KADM5_STRUCT_VERSION, KADM5_API_VERSION_2,
NULL, &handle);
if (retval) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while "
"doing kadm5_init_with_skey: %s", error_message(retval));
goto cleanup;
}
/*
* The RPCSEC_GSS connection has been established; Lets check to see
* if the corresponding user principal exists in the KDC database.
* If not, lets create a new one.
*/
strlength = strlen(user) + strlen(def_realm) + 2;
if ((userprincstr = malloc(strlength)) == NULL)
goto cleanup;
(void) strlcpy(userprincstr, user, strlength);
(void) strlcat(userprincstr, "@", strlength);
(void) strlcat(userprincstr, def_realm, strlength);
if (retval = krb5_parse_name(context, userprincstr,
&userprinc)) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while "
"parsing user principal name: %s",
error_message(retval));
goto cleanup;
}
retval = kadm5_get_principal(handle, userprinc, &kadm5_userprinc,
KADM5_PRINCIPAL_NORMAL_MASK);
krb5_free_principal(context, userprinc);
if (retval) {
switch (retval) {
case KADM5_AUTH_GET:
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): %s does "
"not have the GET privilege "
"for kadm5_get_principal: %s",
svcprincstr, error_message(retval));
break;
case KADM5_UNK_PRINC:
default:
break;
}
/*
* We will try & add this principal anyways, continue on ...
*/
(void) memset(&kadm5_userprinc, 0, sizeof (kadm5_userprinc));
} else {
/*
* Principal already exists in the KDC database, quit now
*/
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): Principal %s "
"already exists in Kerberos KDC database",
userprincstr);
goto cleanup;
}
if (retval = krb5_parse_name(context, userprincstr,
&(kadm5_userprinc.principal))) {
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Error while "
"parsing user principal name: %s",
error_message(retval));
goto cleanup;
}
if (expire_pw) {
(void) time(&now);
/*
* The local system time could actually be later than the
* system time of the KDC we are authenticating to. We expire
* w/the local system time minus clockskew so that we are
* assured that it is expired on this login, not the next.
*/
now -= context->clockskew;
kadm5_userprinc.pw_expiration = now;
mask |= KADM5_PW_EXPIRATION;
}
mask |= KADM5_PRINCIPAL;
retval = kadm5_create_principal(handle, &kadm5_userprinc,
mask, password);
if (retval) {
switch (retval) {
case KADM5_AUTH_ADD:
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): %s does "
"not have the ADD privilege "
"for kadm5_create_principal: %s",
svcprincstr, error_message(retval));
break;
default:
__pam_log(LOG_AUTH | LOG_ERR,
"PAM-KRB5-AUTOMIGRATE (auth): Generic error"
"while doing kadm5_create_principal: %s",
error_message(retval));
break;
}
goto cleanup;
}
/*
* Success, new user principal has been added !
*/
if (!quiet) {
char messages[PAM_MAX_NUM_MSG][PAM_MAX_MSG_SIZE];
(void) snprintf(messages[0], sizeof (messages[0]),
dgettext(TEXT_DOMAIN, "\nUser `%s' has been "
"automatically migrated to the Kerberos realm %s\n"),
user, def_realm);
(void) __pam_display_msg(pamh, PAM_TEXT_INFO, 1,
messages, NULL);
}
if (debug)
__pam_log(LOG_AUTH | LOG_DEBUG,
"PAM-KRB5-AUTOMIGRATE (auth): User %s "
"has been added to the Kerberos KDC database",
userprincstr);
/*
* Since this is a new krb5 principal, do a pam_set_data()
* for possible use by the acct_mgmt routine of pam_krb5(5)
*/
if (pam_get_data(pamh, KRB5_AUTOMIGRATE_DATA,
(const void **)&olduserdata) == PAM_SUCCESS) {
/*
* We created a princ in a previous run on the same handle and
* it must have been for a different PAM_USER / princ name,
* otherwise we couldn't succeed here, unless that princ
* got deleted.
*/
if (olduserdata != NULL)
free(olduserdata);
}
if (pam_set_data(pamh, KRB5_AUTOMIGRATE_DATA, userdata,
krb5_migrate_cleanup) != PAM_SUCCESS) {
free(userdata);
}
cleanup:
if (service)
free(service);
if (kadmin_princ)
free(kadmin_princ);
if (svcprincstr)
free(svcprincstr);
if (userprincstr)
free(userprincstr);
if (def_realm)
free(def_realm);
(void) kadm5_free_principal_ent(handle, &kadm5_userprinc);
(void) kadm5_destroy((void *)handle);
if (context != NULL)
krb5_free_context(context);
return (PAM_IGNORE);
}
/*ARGSUSED*/
static void
krb5_migrate_cleanup(pam_handle_t *pamh, void *data, int pam_status) {
if (data != NULL)
free((char *)data);
}
/*ARGSUSED*/
int
pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv)
{
return (PAM_IGNORE);
}
| 33,867
|
https://github.com/djFooFoo/aws-lambda-add-article/blob/master/src/application.py
|
Github Open Source
|
Open Source
|
Apache-2.0
| null |
aws-lambda-add-article
|
djFooFoo
|
Python
|
Code
| 39
| 171
|
import os
from images import image_service
from rss import feed_reader
from scraping import scraper
def handler(event, context):
latest_article_url = feed_reader.get_latest_article_url(os.environ['ARTICLE_RSS_FEED_URL'])
article = scraper.get_article(latest_article_url)
image_id = image_service.store_article_metadata_in_database(article)
image_service.store_image_in_s3(article, image_id)
return {"statusCode": 200, "body": image_id}
if __name__ == "__main__":
print(handler(None, None))
| 38,254
|
https://github.com/Dunku1/Danil_Web/blob/master/app/Http/Controllers/ArticleController.php
|
Github Open Source
|
Open Source
|
MIT
| null |
Danil_Web
|
Dunku1
|
PHP
|
Code
| 29
| 100
|
<?php
namespace App\Http\Controllers;
use App\Product;
use Illuminate\Http\Request;
class ArticleController extends Controller
{
public function show()
{
return Product::all();
}
public function search($title)
{
return Product::where('title', 'like', '%'.$title.'%')->get();
}
}
| 3,291
|
https://github.com/dejan2609/Android/blob/master/app/src/main/java/com/duckduckgo/app/email/EmailJavascriptInterface.kt
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
Android
|
dejan2609
|
Kotlin
|
Code
| 178
| 446
|
/*
* Copyright (c) 2020 DuckDuckGo
*
* 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.
*/
package com.duckduckgo.app.email
import android.webkit.JavascriptInterface
import timber.log.Timber
class EmailJavascriptInterface(
private val emailManager: EmailManager,
private val showNativeTooltip: () -> Unit
) {
@JavascriptInterface
fun log(message: String) {
Timber.i("EmailInterface $message")
}
@JavascriptInterface
fun getAlias(): String {
val nextAlias = emailManager.getAlias()
return if (nextAlias.isNullOrBlank()) {
""
} else {
"{\"nextAlias\": \"$nextAlias\"}"
}
}
@JavascriptInterface
fun isSignedIn(): String = emailManager.isSignedIn().toString()
@JavascriptInterface
fun storeCredentials(token: String, username: String) {
emailManager.storeCredentials(token, username)
}
@JavascriptInterface
fun showTooltip() {
showNativeTooltip()
}
companion object {
const val JAVASCRIPT_INTERFACE_NAME = "EmailInterface"
}
}
| 47,037
|
https://github.com/ShawnAndrews/ConnectWithGamers/blob/master/client/src/games/home/horrorgamesbanner/HorrorGamesBannerContainer.tsx
|
Github Open Source
|
Open Source
|
MIT
| 2,019
|
ConnectWithGamers
|
ShawnAndrews
|
TypeScript
|
Code
| 78
| 336
|
import * as React from 'react';
import { withRouter, RouteComponentProps } from 'react-router';
import HorrorGamesBanner from './HorrorGamesBanner';
import { SidenavEnums, GameResponse } from '../../../../client-server-common/common';
interface IHorrorGamesBannerContainerProps extends RouteComponentProps<any> {
goToRedirect: (URL: string) => void;
sidebarActiveEnum: SidenavEnums;
games: GameResponse[];
}
interface IHorrorGamesBannerContainerState {
mediaCarouselElement: any;
}
class HorrorGamesBannerContainer extends React.Component<IHorrorGamesBannerContainerProps, IHorrorGamesBannerContainerState> {
constructor(props: IHorrorGamesBannerContainerProps) {
super(props);
this.state = {
mediaCarouselElement: undefined,
};
}
render() {
return (
<HorrorGamesBanner
goToRedirect={this.props.goToRedirect}
sidebarActiveEnum={this.props.sidebarActiveEnum}
games={this.props.games}
mediaCarouselElement={this.state.mediaCarouselElement}
/>
);
}
}
export default withRouter(HorrorGamesBannerContainer);
| 23,136
|
https://github.com/johansantri/bess/blob/master/application/views/backand/setup/sidebar.php
|
Github Open Source
|
Open Source
|
MIT
| null |
bess
|
johansantri
|
PHP
|
Code
| 83
| 480
|
<div class="app-sidebar__overlay" data-toggle="sidebar"></div>
<aside class="app-sidebar">
<div class="app-sidebar__user">
<div id="image_sementara">
</div>
<p class="app-sidebar__user-name"><?php echo $this->session->userdata('nama_depan');?> </p>
</div>
<ul class="app-menu">
<li><a class="app-menu__item active" href="<?php echo base_url()?>auth"><i class="app-menu__icon fa fa-dashboard"></i><span class="app-menu__label">Dashboard</span></a></li>
<li class="treeview"><a class="app-menu__item" href="#" data-toggle="treeview"><i class="app-menu__icon fa fa-user"></i><span class="app-menu__label">Personal</span><i class="treeview-indicator fa fa-user-right"></i></a>
<ul class="treeview-menu">
<li><a class="treeview-item" href="<?php echo base_url()?>profile" ><i class="icon fa fa-user-circle-o"></i> Profile</a></li>
<li><a class="treeview-item" href="<?php echo base_url()?>education"><i class="icon fa fa-graduation-cap"></i> Education </a></li>
<li><a class="treeview-item" href="<?php echo base_url()?>works"><i class="icon fa fa-user-plus"></i> Work Experience</a></li>
</ul>
</li>
<li><a class="app-menu__item" href="charts.html"><i class="app-menu__icon fa fa-tasks"></i><span class="app-menu__label">Job</span></a></li>
</ul>
</aside>
| 28,321
|
https://github.com/tekktonic/programming/blob/master/scheme/test.scm
|
Github Open Source
|
Open Source
|
0BSD
| null |
programming
|
tekktonic
|
Scheme
|
Code
| 28
| 89
|
(use ncurses srfi-25)
(initscr)
(define w 0)
(define h 0)
(let-values (((height width) (getmaxyx stdscr)))
(set! h height)
(set! w width))
(endwin)
(display w)
(newline)
(display h)
(newline)
| 6,435
|
https://github.com/yu3mars/proconVSCodeGcc/blob/master/atcoder/abc/abc159/f.cpp
|
Github Open Source
|
Open Source
|
MIT
| null |
proconVSCodeGcc
|
yu3mars
|
C++
|
Code
| 149
| 524
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};
ll dp[3010][3010]; // bgn, val, cnt
ll mod = 998244353;
int main()
{
ll n,s,ans=0;
cin>>n>>s;
vector<ll> a(n);
for (int i = 0; i < n; i++)
{
cin>>a[i];
}
for (int i = 0; i < n; i++)
{
dp[i][0]=1;
}
for (int bgn = 0; bgn < n; bgn++)
{
for (int now = bgn; bgn < n; now++)
{
for (int valBef = 0; valBef <= s; valBef++)
{
int valAft = valBef+a[now];
if(valAft>s) break;
if(dp[bgn][valBef]>0)
{
dp[bgn][valAft]+=dp[bgn][valBef];
dp[bgn][valAft]%=mod;
}
}
}
for (int now = 0; now <= bgn; now++)
{
cout<<now<<"\t"<<now<<"\t"<<dp[now][s]<<endl;
ans+=dp[now][s];
ans%=mod;
}
}
cout<<ans<<endl;
return 0;
}
| 43,098
|
https://github.com/Crouching-Tiger-Hidden-Dragon/sfi-hackathon-july-2021/blob/master/pages/404.js
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
sfi-hackathon-july-2021
|
Crouching-Tiger-Hidden-Dragon
|
JavaScript
|
Code
| 36
| 101
|
import Head from 'next/head';
import Layout from '../components/Layout/Layout';
const Custom404 = () => {
return (
<>
<Head>
<title>404 - Not Found</title>
</Head>
<Layout>
<h1>404 - Page Not Found</h1>
</Layout>
</>
);
};
export default Custom404;
| 45,053
|
https://github.com/MoonStarCZW/py2rb/blob/master/run_tests.py
|
Github Open Source
|
Open Source
|
MIT
| null |
py2rb
|
MoonStarCZW
|
Python
|
Code
| 102
| 406
|
#! /usr/bin/python
import optparse
import testtools.runner
import testtools.util
import testtools.tests
def main():
option_parser = optparse.OptionParser(
usage="%prog [options] [filenames]",
description="py2rb unittests script."
)
option_parser.add_option(
"-a",
"--run-all",
action="store_true",
dest="run_all",
default=False,
help="run all tests (including the known-to-fail)"
)
option_parser.add_option(
"-x",
"--no-error",
action="store_true",
dest="no_error",
default=False,
help="ignores error( don't display them after tests)"
)
options, args = option_parser.parse_args()
runner = testtools.runner.Py2RbTestRunner(verbosity=2)
results = None
if options.run_all:
results = runner.run(testtools.tests.ALL)
elif args:
results = runner.run(testtools.tests.get_tests(args))
else:
results = runner.run(testtools.tests.NOT_KNOWN_TO_FAIL)
if not options.no_error and results.errors:
print
print("errors:")
print(" (use -x to skip this part)")
for test, error in results.errors:
print
print("*", str(test), "*")
print(error)
if __name__ == "__main__":
main()
| 11,772
|
https://github.com/utahnlp/lapa-mrp/blob/master/utility/eds_utils/test_mrp_eds.py
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
lapa-mrp
|
utahnlp
|
Python
|
Code
| 344
| 1,456
|
#!/usr/bin/env python3.6
# coding=utf-8
'''
Load eds transformed mrp, and load into AMRGraph as gold label, test the output with the gold AMRGraph
@author: Jie Cao ([email protected])
@since: 2019-06-23
'''
import parser
import os
import sys
from torch import cuda
from parser.EDSProcessors import *
from utility.eds_utils.EDSGraph import *
from utility.data_helper import folder_to_files_path
from src import *
from parser.Dict import read_dicts
from src.config_reader import get_parser
from utility.mtool.score import mces
from utility.constants import *
logger = logging.getLogger("mrp.eds.generator")
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
def arg_parser():
parser = argparse.ArgumentParser(description='test_mrp_eds.py')
## Data options
parser.add_argument('--suffix', default=".mrp_eds", type=str,
help="""suffix of files to combine""")
parser.add_argument('--companion_suffix', default=".mrp_conllu_pre_processed", type=str,
help="""suffix of files to combine""")
parser.add_argument('--build_folder', default="", type=str,
help="""the build folder for dict and rules, data""")
return parser
def test_eds_pipe(data, n):
if "eds_matrix" in data:
eds_t = data["eds_matrix"]
else:
eds_t = None
if "mrp_eds" in data:
mrp_eds = data["mrp_eds"]
else:
mrp_eds = None
# gold edsGraph
eds = EDSGraph(eds_t, mrp_eds)
graph = eds.graph
h_v = BOS_WORD
root_v = eds.root
root_symbol = EDSUniversal.TOP_EDSUniversal()
graph.add_node(h_v, value=root_symbol, align=[],gold=True,dep=1)
graph.add_edge(h_v, root_v, key=":top", role=":top")
graph.add_edge(root_v, h_v, key=":top-of", role=":top-of")
# to mrp
mrp_eds_back, _ = EDSDecoder.graph_to_mrpGraph(mrp_eds.id, graph, flavor=1, framework="eds", sentence = mrp_eds.input)
result = mces.evaluate([mrp_eds], [mrp_eds_back], trace = 2);
if result["all"]["f"] != 1.0:
logger.error("result is {} for {}\n grpah_nodes:{}\n graph_edges:{}\n gold:{}\n pred:{} \n\n".format(result,mrp_eds.id, graph.nodes.data(), graph.edges.data(), mrp_eds.encode(), mrp_eds_back.encode()))
def test_mrp_dataset(dataset):
n = 0
for id, data in dataset.items():
# try to extend this to other frameworks
if 'mrp_eds' in data:
n = n + 1
if n % 500 ==0:
logger.info(n)
test_eds_pipe(data, n)
def test_mrp_to_graph():
logger.info("processing training set")
training_data = readFeaturesInput(opt.trainingCompanionFilesPath)
mergeWithAnnotatedGraphs(training_data, opt.trainingFilesPath)
test_mrp_dataset(training_data)
logger.info(("processing development set"))
dev_data = readFeaturesInput(opt.devCompanionFilesPath)
mergeWithAnnotatedGraphs(dev_data, opt.devFilesPath)
test_mrp_dataset(dev_data)
logger.info("processing test set")
test_data = readFeaturesInput(opt.testCompanionFilesPath)
mergeWithAnnotatedGraphs(test_data, opt.testFilesPath)
test_mrp_dataset(test_data)
def main(opt):
test_mrp_to_graph()
if __name__ == "__main__":
global opt
parser = arg_parser()
opt = parser.parse_args()
suffix = opt.suffix
opt.trainFolderPath = opt.build_folder + "/training/"
opt.trainingFilesPath = folder_to_files_path(opt.trainFolderPath, suffix)
opt.trainingCompanionFilesPath = folder_to_files_path(opt.trainFolderPath, opt.companion_suffix)
opt.devFolderPath = opt.build_folder + "/dev/"
opt.devFilesPath = folder_to_files_path(opt.devFolderPath, suffix)
opt.devCompanionFilesPath = folder_to_files_path(opt.devFolderPath, opt.companion_suffix)
opt.testFolderPath = opt.build_folder + "/test/"
opt.testFilesPath = folder_to_files_path(opt.testFolderPath, suffix)
opt.testCompanionFilesPath = folder_to_files_path(opt.testFolderPath, opt.companion_suffix)
logger.info("opt:{}".format(opt))
main(opt)
| 915
|
https://github.com/gabbinguyen/lifeOfTheParty/blob/master/trash/frontendmain/node_modules/react-tiny-link/src/rules/Image/ScrapImage.ts
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
lifeOfTheParty
|
gabbinguyen
|
TypeScript
|
Code
| 41
| 129
|
import { ReactTinyLinkType } from '../../ReactTinyLinkTypes'
import { isEmpty } from '../utils'
export default async (url: string, defaultMedia: string[]) => ({
title: url.substring(url.lastIndexOf('/') + 1),
description: url.substring(url.lastIndexOf('/') + 1),
url: url,
video: [],
image: [url, defaultMedia].filter(i => !isEmpty(i)),
type: ReactTinyLinkType.TYPE_IMAGE,
})
| 39,495
|
https://github.com/WASdev/sample.async.jaxrs/blob/master/build.gradle
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,020
|
sample.async.jaxrs
|
WASdev
|
Gradle
|
Code
| 217
| 808
|
apply plugin: 'maven'
apply plugin: 'war'
apply plugin: 'liberty'
group = 'liberty.samples'
version = '1'
description = "WAS Liberty Sample - JAX-RS 2.0 Asynchronous processing Sample"
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.6.3'
}
}
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'org.apache.cxf', name: 'cxf-rt-rs-client', version:'3.1.1'
testCompile group: 'org.glassfish', name: 'javax.json', version:'1.0.4'
providedCompile group: 'javax', name: 'javaee-api', version:'7.0'
libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-javaee7', version: '17.0.0.2'
}
ext {
testServerHttpPort = 9081
testServerHttpsPort = 9443
warContext = 'async-jaxrs'
packagingType = 'usr'
}
war {
archiveName = baseName + '.' + extension
}
liberty {
server {
configFile = file('src/main/liberty/config/server.xml')
bootstrapProperties = ['default.http.port': testServerHttpPort,
'default.https.port': testServerHttpsPort,
'appContext': warContext,
'appLocation': war.archiveName]
apps = [war]
}
packageLiberty {
include = packagingType
}
}
test {
println 'inside the unit test block'
reports.html.destination = file("$buildDir/reports/unit")
reports.junitXml.destination = file("$buildDir/test-results/unit")
exclude '**/it/**'
}
task integrationTest(type: Test) {
group 'Verification'
description 'Runs the integration tests.'
reports.html.destination = file("$buildDir/reports/it")
reports.junitXml.destination = file("$buildDir/test-results/it")
include '**/it/**'
exclude '**/unit/**'
systemProperties = ['liberty.test.port': testServerHttpPort, 'war.context': warContext]
}
task printMessageAboutRunningServer {
doLast {
println "The server is now running at http://localhost:${testServerHttpPort}/jaxrs-async"
println "To stop the server run 'gradle libertyStop'"
}
}
check.dependsOn 'integrationTest'
integrationTest.dependsOn 'libertyStart'
integrationTest.finalizedBy 'libertyStop'
libertyStart.finalizedBy 'printMessageAboutRunningServer'
| 29,461
|
https://github.com/TeroJokela/Web-Mania/blob/master/Init.js
|
Github Open Source
|
Open Source
|
MIT
| null |
Web-Mania
|
TeroJokela
|
JavaScript
|
Code
| 45
| 81
|
//Add code and function calls here that need to be executed on start.
//Add event listener for browser window resizes and fullscreen changes and resize the canvas's container when it occurs
addEventListener("resize", ReSize);
addEventListener("fullscreenchange", ReSize);
//Create global game object
var game = new Game();
game.Start();
| 230
|
https://github.com/npgsql/efcore.pg/blob/master/test/EFCore.PG.FunctionalTests/Query/InheritanceRelationshipsQueryNpgsqlFixture.cs
|
Github Open Source
|
Open Source
| 2,023
|
efcore.pg
|
npgsql
|
C#
|
Code
| 17
| 91
|
using Npgsql.EntityFrameworkCore.PostgreSQL.TestUtilities;
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query;
public class InheritanceRelationshipsQueryNpgsqlFixture : InheritanceRelationshipsQueryRelationalFixture
{
protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance;
}
| 33,716
|
|
https://github.com/nfrechette/acl-js/blob/master/.gitignore
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
acl-js
|
nfrechette
|
Ignore List
|
Code
| 9
| 32
|
# Temporary data rules
bin/
build/
staging/
**/__pycache__/
.vscode/
| 26,799
|
https://github.com/zkn1163691192/DAPPLE/blob/master/vgg19/tf-keras-dapple.py
|
Github Open Source
|
Open Source
|
BSD-3-Clause, MIT
| 2,020
|
DAPPLE
|
zkn1163691192
|
Python
|
Code
| 1,442
| 5,759
|
#!/usr/bin/env python2
import tensorflow as tf
import numpy as np
import glob
import subprocess
import argparse
import os
import sys
import json
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Flatten,Dropout
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import MaxPooling2D
import applications
import horovod.tensorflow as hvd
from applications import cluster_utils
from tensorflow.python.ops import nccl_ops
import time
import pdb
flags = tf.app.flags
start = time.time()
def imgs_input_fn(filenames, labels=None, batch_size=64, fake_io=False):
def _parse_function(filename, label):
image_string = tf.read_file(filename)
image = tf.image.decode_image(image_string, channels=3)
image.set_shape([None, None, None])
global img_size
global img_shape
img_size = list(img_size)
img_shape = list(img_shape)
image = tf.image.resize_images(image, img_size)
image.set_shape(img_shape)
image = tf.reverse(image, axis=[2]) # 'RGB'->'BGR'
d = image, label
print('d=', d)
return d
def _parse_function_fake(filename, label):
shape = tf.constant(np.array([[224, 224, 3]], dtype=np.int32))
image = tf.constant(1.0, shape=[224, 224, 3])
global img_size
global img_shape
print(img_shape, img_size)
# img_size = list(img_size)
# img_shape = list(img_shape)
# image = tf.image.resize_images(image, img_size)
# image.set_shape(shape)
# image = tf.reverse(image, axis=[2]) # 'RGB'->'BGR'
d = image, label
return d
if labels is None:
labels = [0]*len(filenames)
labels=np.array(labels)
if len(labels.shape) == 1:
labels = np.expand_dims(labels, axis=1)
filenames = tf.constant(filenames)
labels = tf.constant(labels)
labels = tf.cast(labels, tf.float32)
dataset = tf.data.Dataset.from_tensor_slices((filenames, labels))
if fake_io is False:
dataset = dataset.map(_parse_function)
else:
print('Using Fake IO')
dataset = dataset.map(_parse_function_fake)
dataset = dataset.shuffle(buffer_size=256)
dataset = dataset.repeat(1) # Repeats dataset this # times
dataset = dataset.batch(batch_size).prefetch(10) # Batch size to use
dataset = dataset.apply(tf.contrib.data.prefetch_to_device('/replica:0/task:0/device:GPU:0'))
# iterator = dataset.make_one_shot_iterator()
# batch_features, batch_labels = iterator.get_next()
# if using distribute.Strategy(), must use "return dataset" instead of "return batch_features, batch_lables"
return dataset
def prepare_tf_config():
hvd.init()
ip_list = FLAGS.worker_hosts.split(',')
worker_hosts = []
for i, ip in enumerate(ip_list):
worker_hosts.append(ip + ":" + str(4000 + i * 1000 + hvd.local_rank()))
if len(worker_hosts) > 1:
cluster = {"chief": [worker_hosts[0]],
"worker": worker_hosts[1:]}
else:
cluster = {"chief": [worker_hosts[0]]}
if FLAGS.task_index == 0:
os.environ['TF_CONFIG'] = json.dumps(
{'cluster': cluster,
'task': {'type': "chief", 'index': 0}})
else:
os.environ['TF_CONFIG'] = json.dumps(
{'cluster': cluster,
'task': {'type': 'worker',
'index': FLAGS.task_index - 1}})
if __name__ == '__main__':
default_raw_data_dir = '/tmp/dataset/mini-imagenet/raw-data/train/n01440764/'
default_ckpt_dir = 'mycheckpoint'
flags.DEFINE_string('model', 'resnet50', 'imagenet model name.')
flags.DEFINE_string('strategy', 'none', 'strategy of variable updating')
flags.DEFINE_integer('num_gpus', 1, 'number of GPUs used')
flags.DEFINE_string('raw_data_dir', '', 'path to directory containing training dataset')
flags.DEFINE_string('logdir', '', 'path to directory containing logs')
flags.DEFINE_string('ckpt_dir', '', 'path to checkpoint directory')
flags.DEFINE_integer('num_batches', 1, 'number of batches (a.k.a. steps or iterations')
flags.DEFINE_integer('batch_size', 64, 'batch size per device (e.g. 32,64)')
flags.DEFINE_string('worker', '', 'e.g. "host1:2222,host2:2222"')
flags.DEFINE_string('ps', '', 'e.g. "host1:2220,host2:2220"')
flags.DEFINE_string('task', '', 'e.g. "worker:0"')
flags.DEFINE_bool('summary_only', False, '')
flags.DEFINE_bool('fake_io', False, '')
flags.DEFINE_string('mode', '', '')
flags.DEFINE_string('worker_hosts', '', 'worker_hosts')
flags.DEFINE_string('job_name', '', 'worker or ps')
flags.DEFINE_integer('task_index', 0, '')
flags.DEFINE_bool('cross_pipeline', False, '')
flags.DEFINE_integer('pipeline_device_num', 1, '')
flags.DEFINE_integer('micro_batch_num', 1, '')
flags.DEFINE_integer('num_replica', 1, '')
flags.DEFINE_bool('fp16', False, 'whether enable fp16 communication while transfer activations between stages')
FLAGS = flags.FLAGS
os.environ['HOROVOD_FUSION_THRESHOLD'] = '0'
subprocess.call('rm -rf /tmp/tmp*',shell=True)
print("logdir = %s" % FLAGS.logdir)
if os.path.isdir(FLAGS.logdir):
subprocess.call('rm -rf %s/*' % FLAGS.logdir, shell=True)
else:
subprocess.call('mkdir -p %s' % FLAGS.logdir, shell=True)
if FLAGS.model is not None:
print('Training model: ', FLAGS.model)
if FLAGS.model == 'vgg19':
model = applications.vgg19.SliceVGG19(weights=None)
else:
print("No model")
exit(1)
if FLAGS.summary_only:
print(model.summary())
sys.exit(0)
subprocess.call('rm -rf %s' % FLAGS.ckpt_dir, shell=True)
global img_shape
global img_size
# shape = list(model.layers[0].output_shape)
# shape.pop(0)
img_shape = (224, 224, 3)
# shape.pop(-1)
img_size = (224, 224)
tf.logging.set_verbosity(tf.logging.DEBUG)
if FLAGS.fake_io is False:
filenames = glob.glob(FLAGS.raw_data_dir+"*.JPEG")
else:
filenames = ["biu.JPEG"] * 1048576
if FLAGS.strategy == 'none':
distribution = None
else:
print("Error distribute strategy!")
exit(1)
prepare_tf_config()
session_config = tf.ConfigProto(
allow_soft_placement=True,
log_device_placement=False,
gpu_options=tf.GPUOptions(allow_growth=True))
if FLAGS.cross_pipeline:
cluster_manager = cluster_utils.get_cluster_manager(config_proto=session_config)
config = tf.estimator.RunConfig(
train_distribute = distribution,
log_step_count_steps=10,
save_checkpoints_secs=None,
save_checkpoints_steps=None, ## QQ: disable checkpoints
session_config=session_config)
def get_train_op(grads_and_vars, slice_num=None, replica_length=None, vars_org=None):
global_step = tf.train.get_or_create_global_step()
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.1)
gradients, variables = zip(*grads_and_vars)
if FLAGS.cross_pipeline and hvd.size() > 1:
# pipeline num device
devices = cluster_utils.get_pipeline_devices(FLAGS.pipeline_device_num)
if FLAGS.num_replica >= 2:
replica_devices = cluster_utils.get_replica_devices(FLAGS.num_replica)
replica_grads_list = [[] for i in xrange(len(replica_devices))]
for grad, var in grads_and_vars:
for i in xrange(len(replica_devices)):
if var.device == replica_devices[i]:
replica_grads_list[i].append((grad, var))
break
replica_avg_grads_and_vars = []
for i in xrange(len(replica_devices)):
with tf.device(replica_devices[i]):
for grad, var in replica_grads_list[i]:
if isinstance(grad, tf.IndexedSlices):
grad = tf.convert_to_tensor(grad)
avg_grad = hvd.allreduce(grad)
avg_grads_and_vars.append((avg_grad, var))
grads_and_vars = avg_grads_and_vars
# Note:
# As stage0:stage1=15:1, so stage1 only holds one device
# and no DataParallel is applied on top of DAPPLE unit,
# as a result no hvd.allreduce() of weights of stage1 is applied here.
else:
gradients_list = [[] for i in xrange(len(devices))]
for grad, var in grads_and_vars:
for i in xrange(len(devices)):
if var.device == devices[i]:
gradients_list[i].append((grad, var))
break
avg_grads_and_vars = []
for i in xrange(len(devices)):
with tf.device(devices[i]):
for grad, var in gradients_list[i]:
if isinstance(grad, tf.IndexedSlices):
grad = tf.convert_to_tensor(grad)
avg_grad = hvd.allreduce(grad)
avg_grads_and_vars.append((avg_grad, var))
grads_and_vars = avg_grads_and_vars
train_op = optimizer.apply_gradients(
grads_and_vars, global_step=global_step)
############ fsq175703, FIXME later
#if FLAGS.num_replica > 1:
# if vars_org is not None:
# if slice_num == 2:
# length = replica_length
# offset = length / FLAGS.num_replica
# update = []
# with tf.control_dependencies([train_op]):
# for i in xrange(1, FLAGS.num_replica):
# for j in xrange(offset):
# with tf.device(vars_org[i*offset + j].device):
# update.append(vars_org[i*offset + j].assign(vars_org[j] if i < split_gpu+1 else vars_org[split_gpu*offset + j]))
# train_op = tf.group(update)
# else:
# print("replica weights update error!")
# exit(1)
# else:
# print("replica weights update error!")
# exit(1)
return train_op
def model_fn(features, labels, mode):
total_loss, outputs = model.build(features, labels)
if FLAGS.pipeline_device_num <= 1:
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.1)
grads_and_vars = optimizer.compute_gradients(loss, colocate_gradients_with_ops=True)
else:
#######################
devices = cluster_utils.get_pipeline_devices(FLAGS.pipeline_device_num)
slice_num = len(devices)
micro_batch_num = FLAGS.micro_batch_num
losses = []
all_outputs = []
losses.append(total_loss)
all_outputs.append(outputs)
layer_grads = [[[] for i in xrange(slice_num)] for j in xrange(micro_batch_num)]
layer_vars = [[] for i in xrange(slice_num)]
remained_vars = tf.trainable_variables()
ys = losses[0]
prev_grads=None
# layers-1 ~ 1 compute grads
for i in xrange(slice_num - 1, 0, -1):
vars_i = [v for v in remained_vars if v.device==devices[i]]
remained_vars = [v for v in remained_vars if v not in vars_i]
prev_y = all_outputs[0][i-1]
y_grads = tf.gradients(ys=ys, xs=[prev_y]+vars_i, grad_ys=prev_grads, colocate_gradients_with_ops=True)
ys = prev_y
prev_grads = y_grads[0]
grads_i = y_grads[1:]
layer_grads[0][i] = [g for g in grads_i if g is not None]
layer_vars[i] = [v for (g, v) in zip(grads_i, vars_i) if g is not None]
# layer 0 compute grads
grads_0 = tf.gradients(ys=ys, xs=remained_vars, grad_ys=prev_grads, colocate_gradients_with_ops=True)
layer_grads[0][0] = [g for g in grads_0 if g is not None]
layer_vars[0] = [v for (g, v) in zip(grads_0, remained_vars) if g is not None]
# other micro_batch_num
for j in xrange(1, micro_batch_num):
dep_outputs = []
for i in xrange(slice_num):
dep_outputs.append(all_outputs[j-1][i] if i+j < 2*slice_num-1 else layer_grads[i+j-2*slice_num+1][i])
# dep_outputs.append(all_outputs[j-1][i] if i+j < slice_num else layer_grads[i+j-slice_num][i])
loss, outputs = model.build(features, labels, dep_outputs=dep_outputs)
losses.append(loss)
all_outputs.append(outputs)
ys = losses[j]
prev_grads=None
for i in xrange(slice_num - 1, 0, -1):
prev_y = all_outputs[j][i-1]
y_grads = tf.gradients(ys=ys, xs=[prev_y]+layer_vars[i], grad_ys=prev_grads, colocate_gradients_with_ops=True)
ys = prev_y
prev_grads = y_grads[0]
grads_i = y_grads[1:]
layer_grads[j][i] = [g for g in grads_i if g is not None]
grads_0 = tf.gradients(ys=ys, xs=layer_vars[0], grad_ys=prev_grads, colocate_gradients_with_ops=True)
layer_grads[j][0] = [g for g in grads_0 if g is not None]
grads_set_org = []
vars_set_org = []
for i in xrange(slice_num):
for j in xrange(len(layer_grads[0][i])):
grad_i_set = [layer_grads[m][i][j] for m in range(micro_batch_num)]
#print (grad_i_set)
if micro_batch_num == 1:
with tf.device(grad_i_set[0].device):
acc_grads = grad_i_set[0]
else:
with tf.control_dependencies(grad_i_set), tf.device(grad_i_set[0].device): # replica
if isinstance(grad_i_set[0], tf.IndexedSlices):
acc_grads = tf.add_n(grad_i_set)
else:
acc_grads = tf.accumulate_n(grad_i_set)
grads_set_org.append(acc_grads)
vars_set_org.append(layer_vars[i][j])
if FLAGS.num_replica > 1:
################
# Note the grads_set_org looks like the following:
# (grad0_gpu0, grad1_gpu0, grad2_gpu0, ..., gradN_gpu0,
# grad0_gpu1, grad1_gpu1, grad2_gpu1, ..., gradN_gpu1,
# ...
# grad0_gpuR, grad1_gpuR, grad2_gpuR, ..., gradN_gpuR)
if slice_num ==2:
new_grads_set = []
new_vars_set = []
length = len(layer_grads[0][0])
offset = length / FLAGS.num_replica
## Option1: use hvd.allreduce
avg_grads_and_vars = []
for i in xrange(offset):
for j in xrange(FLAGS.num_replica):
grad = grads_set_org[j*offset + i]
with tf.device(grad.device):
avg_grad = hvd.allreduce(grad)
avg_grads_and_vars.append((avg_grad, vars_set_org[j*offset+i]))
for i in xrange(length, len(grads_set_org)):
avg_grads_and_vars.append((grads_set_org[i], vars_set_org[i]))
grads_and_vars = avg_grads_and_vars
#for i in xrange(offset):
# grads_i = []
# for j in xrange(FLAGS.num_replica):
# grads_i.append(grads_set_org[j*offset + i])
# global split_gpu
# split_gpu = 2
# summed_grads_i_0 = nccl_ops.all_sum(grads_i[:split_gpu])[0] ### 0~7 device on machine0
# summed_grads_i_1 = nccl_ops.all_sum(grads_i[split_gpu:])[0] ### 0~6 device on machine1
# with tf.device(summed_grads_i_0.device):
# summed_grads_i_0 += summed_grads_i_1 ## Cross machine communication!
# new_grads_set.append(summed_grads_i_0)
# new_vars_set.append(vars_set_org[i])
#grads_set = new_grads_set + grads_set_org[length:]
#vars_set = new_vars_set + vars_set_org[length:]
#grads_and_vars = zip(grads_set, vars_set)
################
#if slice_num == 2:
# length = len(layer_grads[0][0])
# offset = length / FLAGS.num_replica
# for i in xrange(1,FLAGS.num_replica):
# for j in xrange(offset):
# grads_set_org[j] += grads_set_org[i*offset + j]
# grads_set = grads_set_org[0:offset] + grads_set_org[length:]
# vars_set = vars_set_org[0:offset] + vars_set_org[length:]
#grads_and_vars = zip(grads_set, vars_set)
else:
print("replica gradients aggregation error!")
exit(1)
else:
grads_set = grads_set_org
vars_set = vars_set_org
grads_and_vars = zip(grads_set, vars_set)
#######################
train_op = get_train_op(grads_and_vars, slice_num, length, vars_set_org)
return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, train_op=train_op, )
est = tf.estimator.Estimator(model_fn=model_fn, config=config)
# Create a callalble object: fn_image_preprocess
fn_image_preprocess = lambda : imgs_input_fn(filenames, None, FLAGS.batch_size, FLAGS.fake_io)
print("Training starts.")
start = time.time()
est.train( input_fn = fn_image_preprocess , steps = FLAGS.num_batches) #, hooks = hooks)
print('Elapsed ', time.time() - start, 's for ', FLAGS.num_batches, ' batches')
| 861
|
https://github.com/gabrielchl/tfsec/blob/master/internal/app/tfsec/rules/aws/athena/enable_at_rest_encryption_rule.go
|
Github Open Source
|
Open Source
|
MIT
| null |
tfsec
|
gabrielchl
|
Go
|
Code
| 164
| 869
|
package athena
import (
"strings"
"github.com/aquasecurity/defsec/rules"
"github.com/aquasecurity/defsec/rules/aws/athena"
"github.com/aquasecurity/tfsec/internal/app/tfsec/block"
"github.com/aquasecurity/tfsec/internal/app/tfsec/scanner"
"github.com/aquasecurity/tfsec/pkg/rule"
)
func init() {
scanner.RegisterCheckRule(rule.Rule{
LegacyID: "AWS059",
BadExample: []string{`
resource "aws_athena_database" "bad_example" {
name = "database_name"
bucket = aws_s3_bucket.hoge.bucket
}
resource "aws_athena_workgroup" "bad_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
}
}
}
`},
GoodExample: []string{`
resource "aws_athena_database" "good_example" {
name = "database_name"
bucket = aws_s3_bucket.hoge.bucket
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
resource "aws_athena_workgroup" "good_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
}
}
`},
Links: []string{
"https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/athena_workgroup#encryption_configuration",
"https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/athena_database#encryption_configuration",
},
RequiredTypes: []string{"resource"},
RequiredLabels: []string{"aws_athena_database", "aws_athena_workgroup"},
Base: athena.CheckEnableAtRestEncryption,
CheckTerraform: func(resourceBlock block.Block, _ block.Module) (results rules.Results) {
if strings.EqualFold(resourceBlock.TypeLabel(), "aws_athena_workgroup") {
if !resourceBlock.HasChild("configuration") {
return
}
configBlock := resourceBlock.GetBlock("configuration")
if !configBlock.HasChild("result_configuration") {
return
}
resourceBlock = configBlock.GetBlock("result_configuration")
}
if resourceBlock.MissingChild("encryption_configuration") {
results.Add("Missing encryption configuration block.", resourceBlock)
}
return results
},
})
}
| 10,297
|
https://github.com/daodao10/chart/blob/master/sg/FSTM_d.js
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
chart
|
daodao10
|
JavaScript
|
Code
| 5,333
| 58,542
|
var data=[['19990831',498.5900],
['19990901',498.5900],
['19990902',491.7000],
['19990903',486.5300],
['19990906',486.9900],
['19990907',485.9400],
['19990908',481.9400],
['19990909',483.2900],
['19990910',481.8500],
['19990913',479.9300],
['19990914',478.2500],
['19990915',477.5600],
['19990916',471.8000],
['19990917',481.9900],
['19990920',474.7400],
['19990921',465.5800],
['19990922',455.1200],
['19990923',463.7100],
['19990924',452.3700],
['19990927',437.3900],
['19990928',445.1600],
['19990929',441.2300],
['19990930',441.7300],
['19991001',442.9700],
['19991004',441.6800],
['19991005',450.8200],
['19991006',456.9700],
['19991007',472.0300],
['19991008',467.1100],
['19991011',464.0200],
['19991012',459.3400],
['19991013',452.0800],
['19991014',457.3800],
['19991015',445.8200],
['19991018',431.9100],
['19991019',427.0200],
['19991020',433.1500],
['19991021',433.4000],
['19991022',431.7000],
['19991025',431.7800],
['19991026',431.5400],
['19991027',427.5400],
['19991028',428.7900],
['19991029',436.0000],
['19991101',450.2500],
['19991102',445.4800],
['19991103',459.4000],
['19991104',460.0800],
['19991105',461.5000],
['19991109',466.2900],
['19991110',477.3800],
['19991111',476.6200],
['19991112',485.4800],
['19991115',499.1000],
['19991116',506.5000],
['19991117',498.9300],
['19991118',495.6000],
['19991119',494.8000],
['19991122',486.5300],
['19991123',482.7700],
['19991124',479.6200],
['19991125',478.2100],
['19991126',484.3800],
['19991129',480.6400],
['19991130',477.6700],
['19991201',472.5800],
['19991202',467.9000],
['19991203',468.8300],
['19991206',466.7000],
['19991207',475.3100],
['19991208',485.6200],
['19991209',487.8900],
['19991210',490.1000],
['19991213',482.7000],
['19991214',472.0300],
['19991215',464.6700],
['19991216',464.9900],
['19991217',477.5400],
['19991220',470.2900],
['19991221',461.2600],
['19991222',467.0300],
['19991223',471.0300],
['19991224',482.4900],
['19991227',499.1400],
['19991228',492.9200],
['19991229',503.0700],
['19991230',510.9900],
['20000103',526.7300],
['20000104',516.0900],
['20000105',487.8500],
['20000106',482.9500],
['20000107',486.6700],
['20000110',490.9100],
['20000111',482.2400],
['20000112',484.1400],
['20000113',481.2200],
['20000114',484.2900],
['20000117',480.1900],
['20000118',476.9200],
['20000119',469.1600],
['20000120',477.4600],
['20000121',469.9900],
['20000124',467.2100],
['20000125',465.3100],
['20000126',473.1400],
['20000127',474.8100],
['20000128',478.1000],
['20000131',469.0100],
['20000201',470.0800],
['20000202',481.5300],
['20000203',481.7300],
['20000204',485.5900],
['20000208',487.7700],
['20000209',491.8500],
['20000210',504.5400],
['20000211',502.7600],
['20000214',504.4700],
['20000215',500.7200],
['20000216',514.3900],
['20000217',529.7800],
['20000218',519.7700],
['20000221',516.4100],
['20000222',512.8800],
['20000223',512.2800],
['20000224',511.3800],
['20000225',523.5200],
['20000228',515.3300],
['20000229',511.0500],
['20000301',501.7300],
['20000302',506.4700],
['20000303',501.7500],
['20000306',498.7100],
['20000307',488.8100],
['20000308',485.9500],
['20000309',488.7200],
['20000310',501.6700],
['20000313',484.4600],
['20000314',481.4400],
['20000315',470.8800],
['20000317',476.6200],
['20000320',471.3500],
['20000321',484.1400],
['20000322',483.9000],
['20000323',487.0800],
['20000324',498.8700],
['20000327',511.6300],
['20000328',512.3500],
['20000329',510.9700],
['20000330',497.0500],
['20000331',496.5900],
['20000403',485.2800],
['20000404',473.6600],
['20000405',463.7200],
['20000406',475.2600],
['20000407',476.6800],
['20000410',472.7400],
['20000411',470.4700],
['20000412',473.5600],
['20000413',473.0400],
['20000414',480.7700],
['20000417',438.2800],
['20000418',441.8300],
['20000419',447.5200],
['20000420',447.8300],
['20000424',442.3400],
['20000425',444.9400],
['20000426',447.6400],
['20000427',454.8900],
['20000428',457.7200],
['20000502',466.6800],
['20000503',457.7500],
['20000504',456.3900],
['20000505',455.8400],
['20000508',447.9000],
['20000509',448.9600],
['20000510',447.2600],
['20000511',440.5900],
['20000512',441.7700],
['20000515',437.7900],
['20000516',445.1400],
['20000517',433.6100],
['20000519',425.1600],
['20000522',418.5400],
['20000523',410.5800],
['20000524',401.6200],
['20000525',397.7700],
['20000526',390.1100],
['20000529',390.4000],
['20000530',387.2600],
['20000531',382.3600],
['20000601',388.0600],
['20000602',404.2800],
['20000605',416.0400],
['20000606',421.0600],
['20000607',421.3900],
['20000608',424.1200],
['20000609',424.5600],
['20000612',422.4900],
['20000613',417.3400],
['20000614',423.9100],
['20000615',424.4900],
['20000616',421.6100],
['20000619',418.9900],
['20000620',419.2800],
['20000621',420.9700],
['20000622',419.0800],
['20000623',419.1300],
['20000626',418.6900],
['20000627',422.5600],
['20000628',428.8400],
['20000629',424.9100],
['20000630',426.6000],
['20000703',425.7900],
['20000704',424.9400],
['20000705',427.5300],
['20000706',427.3100],
['20000707',437.9900],
['20000710',442.4000],
['20000711',441.4700],
['20000712',454.0900],
['20000713',442.4300],
['20000714',438.3200],
['20000717',439.9900],
['20000718',433.3000],
['20000719',435.0800],
['20000720',433.7600],
['20000721',434.6800],
['20000724',430.0400],
['20000725',430.8000],
['20000726',428.6800],
['20000727',425.2900],
['20000728',422.4200],
['20000731',420.5300],
['20000801',422.1700],
['20000802',423.1100],
['20000803',419.8300],
['20000804',419.7600],
['20000807',417.3100],
['20000808',416.2100],
['20000810',416.8100],
['20000811',422.1900],
['20000814',422.9900],
['20000815',430.1000],
['20000816',434.8100],
['20000817',435.0100],
['20000818',433.3300],
['20000821',429.7800],
['20000822',433.2800],
['20000823',432.9600],
['20000824',432.4300],
['20000825',431.9000],
['20000828',430.2000],
['20000829',429.1700],
['20000830',429.5000],
['20000831',429.3500],
['20000901',430.0700],
['20000904',432.3600],
['20000905',429.8900],
['20000906',428.9300],
['20000907',427.2200],
['20000908',424.3400],
['20000911',419.4700],
['20000912',414.1500],
['20000913',410.9800],
['20000914',410.1100],
['20000915',407.9900],
['20000918',400.3600],
['20000919',396.6600],
['20000920',396.6500],
['20000921',392.1000],
['20000922',385.3200],
['20000925',388.6600],
['20000926',392.5200],
['20000927',391.7700],
['20000928',392.0800],
['20000929',393.8700],
['20001002',389.9500],
['20001003',392.3400],
['20001004',392.1600],
['20001005',392.4900],
['20001006',389.6300],
['20001009',380.6800],
['20001010',381.1000],
['20001011',369.7900],
['20001012',369.8700],
['20001013',361.4000],
['20001016',369.9200],
['20001017',362.9900],
['20001018',365.4900],
['20001019',373.3900],
['20001020',381.6200],
['20001023',380.7300],
['20001024',381.0900],
['20001025',378.8600],
['20001027',380.9200],
['20001030',382.9800],
['20001031',390.8400],
['20001101',401.7500],
['20001102',407.2800],
['20001103',416.0100],
['20001106',409.6800],
['20001107',408.8300],
['20001108',404.5500],
['20001109',401.3800],
['20001110',396.3800],
['20001113',388.7300],
['20001114',398.0300],
['20001115',394.6800],
['20001116',397.8300],
['20001117',393.8300],
['20001120',389.8700],
['20001121',387.8400],
['20001122',382.0400],
['20001123',381.9500],
['20001124',386.6300],
['20001127',383.9300],
['20001128',381.2800],
['20001129',379.0300],
['20001130',374.8200],
['20001201',378.1900],
['20001204',371.9500],
['20001205',374.4100],
['20001206',377.5500],
['20001207',375.7500],
['20001208',379.3800],
['20001211',381.5400],
['20001212',379.2200],
['20001213',382.7400],
['20001214',380.0400],
['20001215',375.2900],
['20001218',374.8700],
['20001219',374.0300],
['20001220',370.6300],
['20001221',369.1900],
['20001222',365.7300],
['20001226',365.8700],
['20001228',364.6600],
['20001229',369.9200],
['20010102',364.0500],
['20010103',359.0000],
['20010104',368.2300],
['20010105',377.0900],
['20010108',371.1400],
['20010109',370.3500],
['20010110',368.6300],
['20010111',365.0000],
['20010112',365.1800],
['20010115',360.2700],
['20010116',358.5700],
['20010117',357.1300],
['20010118',359.5700],
['20010119',363.2000],
['20010122',360.2700],
['20010123',361.3700],
['20010126',359.2800],
['20010129',363.2100],
['20010130',363.3400],
['20010131',368.3800],
['20010201',372.4900],
['20010202',382.5100],
['20010205',381.4700],
['20010206',381.1600],
['20010207',379.0900],
['20010208',384.7700],
['20010209',380.7800],
['20010212',384.3900],
['20010213',386.7600],
['20010214',381.9800],
['20010215',382.9900],
['20010216',380.5300],
['20010219',378.2700],
['20010220',385.0600],
['20010221',382.0800],
['20010222',380.5700],
['20010223',379.5300],
['20010226',378.2700],
['20010227',374.5300],
['20010228',378.2600],
['20010301',371.4100],
['20010302',371.7300],
['20010305',370.5900],
['20010307',369.0100],
['20010308',369.1800],
['20010309',369.1100],
['20010312',362.5800],
['20010313',357.1700],
['20010314',354.1700],
['20010315',354.1400],
['20010316',351.1500],
['20010319',344.8200],
['20010320',345.0900],
['20010321',343.3300],
['20010322',336.8500],
['20010323',342.6800],
['20010326',342.1600],
['20010327',335.2600],
['20010328',329.9300],
['20010329',321.2200],
['20010330',325.7800],
['20010402',318.9100],
['20010403',317.6700],
['20010404',315.4100],
['20010405',325.5600],
['20010406',325.8900],
['20010409',318.7500],
['20010410',325.5100],
['20010411',328.1100],
['20010412',326.7400],
['20010416',323.8400],
['20010417',319.0300],
['20010418',327.1400],
['20010419',330.1900],
['20010420',331.8400],
['20010423',335.1200],
['20010424',337.8300],
['20010425',337.4100],
['20010426',338.3500],
['20010427',341.3000],
['20010430',347.4500],
['20010502',353.0200],
['20010503',349.1000],
['20010504',352.2800],
['20010508',351.0400],
['20010509',347.7600],
['20010510',350.5100],
['20010511',350.4800],
['20010514',344.0800],
['20010515',347.4000],
['20010516',343.5400],
['20010517',348.5600],
['20010518',345.1000],
['20010521',346.0600],
['20010522',353.2200],
['20010523',353.4100],
['20010524',356.1700],
['20010525',359.6300],
['20010528',354.6700],
['20010529',351.6300],
['20010530',348.4100],
['20010531',346.9500],
['20010601',343.7800],
['20010604',346.0600],
['20010605',345.1900],
['20010606',346.9100],
['20010607',346.0700],
['20010608',348.7700],
['20010611',346.7800],
['20010612',343.3600],
['20010613',346.7700],
['20010614',347.2700],
['20010615',349.6400],
['20010618',352.3500],
['20010619',351.6100],
['20010620',350.0100],
['20010621',354.8200],
['20010622',360.9600],
['20010625',365.8100],
['20010626',364.0500],
['20010627',364.2700],
['20010628',360.4900],
['20010629',365.0900],
['20010702',358.4000],
['20010703',355.4100],
['20010704',350.0700],
['20010705',350.4500],
['20010706',345.6200],
['20010709',342.8600],
['20010710',347.3600],
['20010711',343.4500],
['20010712',348.8000],
['20010713',348.4200],
['20010716',348.6400],
['20010717',344.2900],
['20010718',340.6300],
['20010719',341.1900],
['20010720',341.3600],
['20010723',338.8200],
['20010724',341.0000],
['20010725',341.3900],
['20010726',341.5500],
['20010727',341.9300],
['20010730',340.3700],
['20010731',340.2900],
['20010801',343.6900],
['20010802',343.5000],
['20010803',340.2700],
['20010806',339.2100],
['20010807',339.5000],
['20010808',337.7800],
['20010810',334.9600],
['20010813',333.8100],
['20010814',337.3900],
['20010815',335.6500],
['20010816',332.5500],
['20010817',333.8000],
['20010820',330.0300],
['20010821',328.3000],
['20010822',328.8200],
['20010823',330.8400],
['20010824',329.3400],
['20010827',329.5600],
['20010828',326.8800],
['20010829',326.5100],
['20010830',326.1300],
['20010831',324.2800],
['20010903',319.2200],
['20010904',319.8500],
['20010905',317.7100],
['20010906',317.4900],
['20010907',312.3500],
['20010910',310.8000],
['20010911',313.5000],
['20010912',293.3500],
['20010913',289.0800],
['20010914',276.3000],
['20010917',254.7400],
['20010918',253.1400],
['20010919',263.3300],
['20010920',259.4300],
['20010921',250.8500],
['20010924',253.2800],
['20010925',252.7100],
['20010926',258.5600],
['20010927',271.6900],
['20010928',272.9600],
['20011001',271.2900],
['20011002',275.5100],
['20011003',271.4100],
['20011004',277.9900],
['20011005',278.8300],
['20011008',270.5300],
['20011009',279.6400],
['20011010',277.2700],
['20011011',285.5200],
['20011012',285.9000],
['20011015',283.0600],
['20011016',284.1800],
['20011017',295.2200],
['20011018',289.5200],
['20011019',287.1000],
['20011022',287.6200],
['20011023',292.9600],
['20011024',293.4900],
['20011025',292.6100],
['20011026',290.9800],
['20011029',286.8600],
['20011030',284.2800],
['20011031',282.5300],
['20011101',279.1000],
['20011102',279.1600],
['20011105',281.8700],
['20011106',281.6300],
['20011107',279.0200],
['20011108',279.0000],
['20011109',281.6800],
['20011112',283.2900],
['20011113',281.4000],
['20011115',296.3100],
['20011116',295.8500],
['20011119',305.3400],
['20011120',304.8500],
['20011121',305.7500],
['20011122',303.9700],
['20011123',306.0300],
['20011126',305.2200],
['20011127',305.6000],
['20011128',305.0400],
['20011129',306.1300],
['20011130',305.5300],
['20011203',305.5800],
['20011204',312.7400],
['20011205',318.6100],
['20011206',315.8400],
['20011207',317.0600],
['20011210',316.4900],
['20011211',313.5000],
['20011212',312.3200],
['20011213',308.3200],
['20011214',310.3900],
['20011218',308.9100],
['20011219',313.0700],
['20011220',314.9500],
['20011221',311.0300],
['20011224',310.6100],
['20011226',311.4500],
['20011227',317.6300],
['20011228',318.7300],
['20011231',319.2400],
['20020102',324.3100],
['20020103',330.9300],
['20020104',337.7600],
['20020107',341.8200],
['20020108',340.2500],
['20020109',337.8400],
['20020110',344.9800],
['20020111',348.5600],
['20020114',348.3600],
['20020115',343.4100],
['20020116',335.2800],
['20020117',337.6900],
['20020118',334.4000],
['20020121',333.6400],
['20020122',331.9800],
['20020123',335.0600],
['20020124',337.1800],
['20020125',348.4000],
['20020128',353.7900],
['20020129',354.5300],
['20020130',351.8000],
['20020131',356.9800],
['20020201',353.6300],
['20020204',349.8300],
['20020205',347.0600],
['20020206',350.6200],
['20020207',344.9600],
['20020208',347.0000],
['20020211',348.6100],
['20020214',355.4100],
['20020215',356.2800],
['20020218',355.0300],
['20020219',356.1300],
['20020220',355.5200],
['20020221',352.2900],
['20020222',348.2500],
['20020225',342.9900],
['20020226',342.5500],
['20020227',346.5800],
['20020228',347.2000],
['20020301',351.7500],
['20020304',360.1100],
['20020305',356.0100],
['20020306',362.2900],
['20020307',363.2400],
['20020308',366.8200],
['20020311',370.6900],
['20020312',364.8400],
['20020313',366.1100],
['20020314',364.7900],
['20020315',365.6600],
['20020318',367.9000],
['20020319',369.8900],
['20020320',367.5200],
['20020321',365.8700],
['20020322',366.9000],
['20020325',363.4900],
['20020326',362.6500],
['20020327',361.0800],
['20020328',358.6600],
['20020401',356.2800],
['20020402',355.8400],
['20020403',353.8900],
['20020404',352.1900],
['20020405',354.2000],
['20020408',350.9800],
['20020409',351.1300],
['20020410',346.1800],
['20020411',350.0100],
['20020412',350.9100],
['20020415',353.0100],
['20020416',358.2800],
['20020417',359.2200],
['20020418',357.2100],
['20020419',353.7200],
['20020422',353.5100],
['20020423',354.9800],
['20020424',354.9300],
['20020425',351.6300],
['20020426',351.4700],
['20020429',346.9400],
['20020430',349.6200],
['20020502',352.4800],
['20020503',352.5500],
['20020506',351.3300],
['20020507',353.1300],
['20020508',355.2700],
['20020509',354.0100],
['20020510',355.9500],
['20020513',356.7400],
['20020514',355.7200],
['20020515',357.2900],
['20020516',354.9600],
['20020517',356.8300],
['20020520',356.8100],
['20020521',357.3000],
['20020522',356.5200],
['20020523',355.6100],
['20020524',356.9900],
['20020528',352.1200],
['20020529',347.0800],
['20020530',348.7800],
['20020531',345.8200],
['20020603',347.1500],
['20020604',344.2300],
['20020605',345.7200],
['20020606',343.8400],
['20020607',342.0100],
['20020610',342.5900],
['20020611',343.3300],
['20020612',344.2300],
['20020613',342.5600],
['20020614',340.9000],
['20020617',337.5700],
['20020618',339.5500],
['20020619',332.8600],
['20020620',335.6500],
['20020621',333.8400],
['20020624',333.7800],
['20020625',340.5200],
['20020626',332.9600],
['20020627',335.4900],
['20020628',339.7400],
['20020701',338.6900],
['20020702',337.6600],
['20020703',341.7200],
['20020704',344.2400],
['20020705',352.1400],
['20020708',351.5400],
['20020709',354.5100],
['20020710',350.8600],
['20020711',346.8400],
['20020712',347.6100],
['20020715',345.2300],
['20020716',340.0100],
['20020717',339.0600],
['20020718',338.3000],
['20020719',334.5800],
['20020722',328.7100],
['20020723',332.0300],
['20020724',323.5800],
['20020725',321.1400],
['20020726',316.5500],
['20020729',317.0600],
['20020730',320.4000],
['20020731',316.4100],
['20020801',318.5200],
['20020802',316.6200],
['20020805',312.9000],
['20020806',308.7300],
['20020807',312.2900],
['20020808',311.5600],
['20020812',310.0400],
['20020813',313.2700],
['20020814',313.4400],
['20020815',314.0000],
['20020816',313.9700],
['20020819',317.8300],
['20020820',321.0700],
['20020821',321.9200],
['20020822',319.8700],
['20020823',318.0300],
['20020826',315.7600],
['20020827',314.9100],
['20020828',313.9500],
['20020829',310.1600],
['20020830',313.4900],
['20020902',305.2500],
['20020903',301.3200],
['20020904',301.6700],
['20020905',300.8800],
['20020906',298.5500],
['20020909',290.7200],
['20020910',296.6100],
['20020911',297.9200],
['20020912',297.5100],
['20020913',293.7700],
['20020916',290.9100],
['20020917',295.9200],
['20020918',290.3400],
['20020919',291.0500],
['20020920',290.2700],
['20020923',282.9300],
['20020924',271.9700],
['20020925',270.7800],
['20020926',271.7900],
['20020927',276.2300],
['20020930',271.0800],
['20021001',274.0100],
['20021002',275.2900],
['20021003',276.5000],
['20021004',280.3900],
['20021007',277.9400],
['20021008',279.2600],
['20021009',278.5600],
['20021010',277.1900],
['20021011',280.1200],
['20021014',278.7600],
['20021015',290.6000],
['20021016',289.0900],
['20021017',295.6200],
['20021018',295.7300],
['20021021',295.0400],
['20021022',296.3000],
['20021023',298.5000],
['20021024',298.3000],
['20021025',302.8400],
['20021028',304.9300],
['20021029',300.8300],
['20021030',299.9200],
['20021031',298.8800],
['20021101',293.7300],
['20021105',291.8300],
['20021106',295.6600],
['20021107',291.1800],
['20021108',291.0500],
['20021111',287.0900],
['20021112',289.4600],
['20021113',286.3100],
['20021114',288.3200],
['20021115',291.5900],
['20021118',290.9200],
['20021119',289.7300],
['20021120',290.3100],
['20021121',293.2100],
['20021122',297.3400],
['20021125',301.2900],
['20021126',298.2700],
['20021127',296.8100],
['20021128',297.2800],
['20021129',293.9400],
['20021202',293.9700],
['20021203',290.3600],
['20021204',287.3500],
['20021205',286.7800],
['20021209',286.0900],
['20021210',286.2900],
['20021211',282.9100],
['20021212',285.7000],
['20021213',283.2900],
['20021216',280.6200],
['20021217',281.1600],
['20021218',277.1400],
['20021219',279.9700],
['20021220',277.3000],
['20021223',276.7800],
['20021224',276.2900],
['20021226',276.1200],
['20021227',279.1300],
['20021230',277.8500],
['20021231',278.9300],
['20030102',280.4000],
['20030103',283.3200],
['20030106',282.4600],
['20030107',283.1100],
['20030108',281.2500],
['20030109',284.5600],
['20030110',289.4800],
['20030113',297.5000],
['20030114',296.3800],
['20030115',298.4600],
['20030116',295.5400],
['20030117',294.3400],
['20030120',290.8900],
['20030121',294.3300],
['20030122',294.1200],
['20030123',296.0300],
['20030124',293.4100],
['20030127',286.9600],
['20030128',288.8100],
['20030129',283.6400],
['20030130',284.2300],
['20030131',284.8800],
['20030204',289.3700],
['20030205',288.7600],
['20030206',289.7900],
['20030207',290.7600],
['20030210',287.7300],
['20030211',289.4200],
['20030213',286.9700],
['20030214',285.8800],
['20030217',290.3300],
['20030218',290.1400],
['20030219',292.4900],
['20030220',291.8500],
['20030221',292.4400],
['20030224',291.8200],
['20030225',289.5200],
['20030226',289.6100],
['20030227',288.0900],
['20030228',289.0400],
['20030303',290.2300],
['20030304',289.5000],
['20030305',287.0600],
['20030306',284.4500],
['20030307',281.8200],
['20030310',278.6000],
['20030311',277.4600],
['20030312',280.0300],
['20030313',280.1600],
['20030314',281.8200],
['20030317',280.1000],
['20030318',285.6500],
['20030319',287.9100],
['20030320',287.6900],
['20030321',290.6500],
['20030324',288.3600],
['20030325',287.9700],
['20030326',291.7400],
['20030327',290.0300],
['20030328',291.5400],
['20030331',284.4600],
['20030401',288.4100],
['20030402',289.4200],
['20030403',290.6500],
['20030404',291.5700],
['20030407',298.9200],
['20030408',295.1800],
['20030409',293.4600],
['20030410',294.0500],
['20030411',293.1300],
['20030414',289.0400],
['20030415',289.2600],
['20030416',291.5100],
['20030417',290.7800],
['20030421',287.9600],
['20030422',286.5400],
['20030423',284.3700],
['20030424',278.0500],
['20030425',277.0500],
['20030428',278.0500],
['20030429',285.7000],
['20030430',286.3600],
['20030502',292.7100],
['20030505',300.1100],
['20030506',294.6000],
['20030507',295.7300],
['20030508',302.1600],
['20030509',306.3800],
['20030512',313.3300],
['20030513',312.0200],
['20030514',310.9900],
['20030516',312.4600],
['20030519',307.6900],
['20030520',308.6400],
['20030521',308.1100],
['20030522',311.7700],
['20030523',317.7200],
['20030526',322.5500],
['20030527',318.7200],
['20030528',323.7000],
['20030529',324.6700],
['20030530',326.1800],
['20030602',329.4900],
['20030603',327.4600],
['20030604',328.9600],
['20030605',332.1600],
['20030606',333.4400],
['20030609',336.2800],
['20030610',341.4700],
['20030611',339.9400],
['20030612',344.2400],
['20030613',341.6300],
['20030616',337.0900],
['20030617',340.6100],
['20030618',338.2500],
['20030619',341.4200],
['20030620',340.7800],
['20030623',337.6400],
['20030624',337.0800],
['20030625',341.9300],
['20030626',341.6800],
['20030627',348.8900],
['20030630',347.8300],
['20030701',348.0200],
['20030702',350.1900],
['20030703',350.8100],
['20030704',351.6200],
['20030707',361.4000],
['20030708',362.5300],
['20030709',366.4600],
['20030710',361.4200],
['20030711',368.0200],
['20030714',374.1700],
['20030715',375.3300],
['20030716',379.2300],
['20030717',372.7800],
['20030718',374.6800],
['20030721',370.3700],
['20030722',369.7500],
['20030723',368.1800],
['20030724',365.7100],
['20030725',369.7800],
['20030728',375.4400],
['20030729',372.4800],
['20030730',374.2900],
['20030731',372.1300],
['20030801',373.5500],
['20030804',369.1700],
['20030805',361.7500],
['20030806',362.7200],
['20030807',367.9200],
['20030808',368.2400],
['20030811',371.3600],
['20030812',373.4800],
['20030813',377.9200],
['20030814',381.8400],
['20030815',383.5600],
['20030818',391.7100],
['20030819',388.4200],
['20030820',388.2600],
['20030821',390.3300],
['20030822',390.9900],
['20030825',384.9900],
['20030826',380.8300],
['20030827',378.5000],
['20030828',378.9200],
['20030829',384.8800],
['20030901',384.9000],
['20030902',385.0700],
['20030903',388.3200],
['20030904',392.2200],
['20030905',394.0000],
['20030908',396.9100],
['20030909',382.8300],
['20030910',387.0400],
['20030911',393.2100],
['20030912',394.8800],
['20030915',394.1800],
['20030916',398.2000],
['20030917',402.9600],
['20030918',405.7600],
['20030919',406.9800],
['20030922',402.6300],
['20030923',404.8700],
['20030924',409.3100],
['20030925',405.9100],
['20030926',403.7300],
['20030929',403.6100],
['20030930',403.0400],
['20031001',400.3500],
['20031002',402.2900],
['20031003',405.4100],
['20031006',412.5000],
['20031007',408.8700],
['20031008',413.6300],
['20031009',416.0500],
['20031010',418.5500],
['20031013',419.0600],
['20031014',417.3500],
['20031015',421.4800],
['20031016',423.3700],
['20031017',425.9100],
['20031020',429.4800],
['20031021',431.0500],
['20031022',429.1100],
['20031023',421.0900],
['20031027',414.5900],
['20031028',421.1100],
['20031029',411.8100],
['20031030',403.8400],
['20031031',410.9200],
['20031103',419.8500],
['20031104',422.3100],
['20031105',419.1300],
['20031106',415.8200],
['20031107',417.9300],
['20031110',412.2800],
['20031111',400.4200],
['20031112',403.9800],
['20031113',409.8100],
['20031114',410.7600],
['20031117',402.3500],
['20031118',406.9300],
['20031119',400.2700],
['20031120',395.5800],
['20031121',392.5000],
['20031124',392.1300],
['20031126',395.7700],
['20031127',399.0600],
['20031128',408.3800],
['20031201',410.2500],
['20031202',406.9200],
['20031203',409.4200],
['20031204',406.1600],
['20031205',404.1400],
['20031208',400.8600],
['20031209',402.1500],
['20031210',400.1000],
['20031211',402.2700],
['20031212',404.0900],
['20031215',411.0100],
['20031216',407.6700],
['20031217',404.3500],
['20031218',403.7300],
['20031219',404.0400],
['20031222',402.5500],
['20031223',402.5400],
['20031224',404.6600],
['20031226',408.7100],
['20031229',412.8600],
['20031230',416.1400],
['20031231',418.0100],
['20040102',426.0200],
['20040105',431.3300],
['20040106',427.0600],
['20040107',434.1800],
['20040108',439.0900],
['20040109',440.5400],
['20040112',436.1200],
['20040113',440.9400],
['20040114',438.4800],
['20040115',430.1600],
['20040116',433.1800],
['20040119',432.9700],
['20040120',436.1000],
['20040121',438.1400],
['20040126',437.4800],
['20040127',437.6000],
['20040128',430.6500],
['20040129',431.7200],
['20040130',433.6900],
['20040203',429.6000],
['20040204',431.5200],
['20040205',434.5600],
['20040206',437.5800],
['20040209',442.1800],
['20040210',441.8200],
['20040211',441.2800],
['20040212',442.9700],
['20040213',443.2600],
['20040216',439.7700],
['20040217',444.1800],
['20040218',442.3300],
['20040219',448.4000],
['20040220',449.2700],
['20040223',449.0400],
['20040224',443.8500],
['20040225',441.8300],
['20040226',445.3400],
['20040227',447.6300],
['20040301',443.9700],
['20040302',440.9300],
['20040303',439.4500],
['20040304',442.5800],
['20040305',443.4400],
['20040308',442.4300],
['20040309',445.3800],
['20040310',446.7200],
['20040311',441.3700],
['20040312',442.5200],
['20040315',442.6000],
['20040316',444.9600],
['20040317',448.5000],
['20040318',444.3200],
['20040319',445.2800],
['20040322',440.4200],
['20040323',441.9100],
['20040324',443.5700],
['20040325',440.5100],
['20040326',441.4300],
['20040329',441.5900],
['20040330',445.5000],
['20040331',443.9400],
['20040401',451.7700],
['20040402',456.8800],
['20040405',464.2900],
['20040406',463.4700],
['20040407',464.8300],
['20040408',468.5300],
['20040412',465.5700],
['20040413',465.9700],
['20040414',464.2900],
['20040415',462.7900],
['20040416',462.1800],
['20040419',460.7100],
['20040420',454.6600],
['20040421',454.0300],
['20040422',454.6100],
['20040423',455.7100],
['20040426',450.5400],
['20040427',448.5900],
['20040428',443.1500],
['20040429',429.8500],
['20040430',435.8000],
['20040503',427.8700],
['20040504',435.6100],
['20040505',437.1800],
['20040506',434.9400],
['20040507',434.7000],
['20040510',421.5600],
['20040511',426.8700],
['20040512',428.8500],
['20040513',424.8900],
['20040514',425.6100],
['20040517',413.9200],
['20040518',415.0900],
['20040519',424.8000],
['20040520',420.9400],
['20040521',426.3000],
['20040524',431.5200],
['20040525',428.4000],
['20040526',430.8000],
['20040527',433.0400],
['20040528',434.0400],
['20040531',432.6000],
['20040601',431.9200],
['20040603',430.3900],
['20040604',432.8200],
['20040607',440.2100],
['20040608',438.6400],
['20040609',440.6900],
['20040610',439.7400],
['20040611',439.1800],
['20040614',438.0100],
['20040615',438.8500],
['20040616',438.6000],
['20040617',432.0700],
['20040618',431.0400],
['20040621',429.3800],
['20040622',428.5300],
['20040623',429.0600],
['20040624',430.9600],
['20040625',431.0700],
['20040628',436.9200],
['20040629',440.8500],
['20040630',440.2300],
['20040701',439.6700],
['20040702',440.7300],
['20040705',443.1300],
['20040706',444.0300],
['20040707',448.2600],
['20040708',444.3300],
['20040709',446.1700],
['20040712',442.8200],
['20040713',439.1900],
['20040714',436.2900],
['20040715',437.2000],
['20040716',437.3000],
['20040719',433.7400],
['20040720',431.2500],
['20040721',435.3100],
['20040722',432.2500],
['20040723',430.1400],
['20040726',427.2300],
['20040727',430.5400],
['20040728',429.9500],
['20040729',430.4500],
['20040730',433.6300],
['20040802',430.8500],
['20040803',436.0100],
['20040804',434.8300],
['20040805',440.6900],
['20040806',439.5000],
['20040810',435.8000],
['20040811',430.7200],
['20040812',434.8700],
['20040813',433.5100],
['20040816',428.7900],
['20040817',429.8600],
['20040818',430.4100],
['20040819',435.2600],
['20040820',433.5300],
['20040823',438.4900],
['20040824',442.3100],
['20040825',445.4600],
['20040826',443.9900],
['20040827',443.6900],
['20040830',440.1700],
['20040831',444.9400],
['20040901',446.5700],
['20040902',446.5600],
['20040903',445.9900],
['20040906',445.9200],
['20040907',449.5300],
['20040908',450.1200],
['20040909',450.6600],
['20040910',453.0600],
['20040913',460.1500],
['20040914',459.3100],
['20040915',459.3900],
['20040916',463.8100],
['20040917',462.0200],
['20040920',459.4100],
['20040921',463.5700],
['20040922',461.3400],
['20040923',462.3100],
['20040924',461.7500],
['20040927',463.0600],
['20040928',462.5000],
['20040929',463.2500],
['20040930',464.0800],
['20041001',463.7700],
['20041004',468.6800],
['20041005',468.5200],
['20041006',468.7200],
['20041007',469.5100],
['20041008',470.7400],
['20041011',469.7300],
['20041012',466.6000],
['20041013',468.0200],
['20041014',464.2800],
['20041015',465.9000],
['20041018',464.0500],
['20041019',466.9500],
['20041020',466.5100],
['20041021',469.0700],
['20041022',470.2900],
['20041025',466.2300],
['20041026',467.5700],
['20041027',466.2500],
['20041028',469.5800],
['20041029',466.3600],
['20041101',463.2500],
['20041102',466.1100],
['20041103',470.2300],
['20041104',469.3000],
['20041105',470.8000],
['20041108',467.0200],
['20041109',467.6300],
['20041110',469.4500],
['20041112',470.7800],
['20041116',468.2500],
['20041117',470.9000],
['20041118',469.9100],
['20041119',472.2200],
['20041122',469.6800],
['20041123',475.8000],
['20041124',477.1700],
['20041125',480.2700],
['20041126',477.5900],
['20041129',480.3400],
['20041130',478.7900],
['20041201',476.1800],
['20041202',480.0600],
['20041203',478.9700],
['20041206',478.5100],
['20041207',473.9000],
['20041208',472.8100],
['20041209',469.3300],
['20041210',468.2200],
['20041213',463.8900],
['20041214',469.6600],
['20041215',472.6700],
['20041216',471.2300],
['20041217',472.4700],
['20041220',474.9400],
['20041221',478.0700],
['20041222',477.7300],
['20041223',478.7300],
['20041224',480.0000],
['20041227',482.8300],
['20041228',482.8000],
['20041229',482.7300],
['20041230',483.7200],
['20041231',487.0200],
['20050103',489.5800],
['20050104',490.5300],
['20050105',491.5200],
['20050106',496.6900],
['20050107',498.8500],
['20050110',497.5500],
['20050111',498.6700],
['20050112',499.4000],
['20050113',505.2700],
['20050114',505.6000],
['20050117',511.3100],
['20050118',513.2900],
['20050119',513.7500],
['20050120',513.1200],
['20050124',511.0100],
['20050125',508.2700],
['20050126',509.8800],
['20050127',506.9600],
['20050128',511.1400],
['20050131',517.6500],
['20050201',516.5800],
['20050202',518.3800],
['20050203',515.2800],
['20050204',512.4500],
['20050207',514.7500],
['20050208',516.8000],
['20050211',518.4300],
['20050214',522.9800],
['20050215',524.6100],
['20050216',525.9700],
['20050217',525.3500],
['20050218',523.3300],
['20050221',523.7700],
['20050222',519.1100],
['20050223',516.5100],
['20050224',513.7200],
['20050225',511.8200],
['20050228',512.4700],
['20050301',508.0100],
['20050302',509.5500],
['20050303',510.8100],
['20050304',514.5000],
['20050307',518.3200],
['20050308',517.2600],
['20050309',519.7700],
['20050310',518.1300],
['20050311',519.0200],
['20050314',519.5100],
['20050315',515.8100],
['20050316',516.9600],
['20050317',517.5500],
['20050318',518.8100],
['20050321',521.9100],
['20050322',518.2000],
['20050323',511.0800],
['20050324',513.8200],
['20050328',510.7200],
['20050329',506.0800],
['20050330',503.8000],
['20050331',505.3300],
['20050401',508.5300],
['20050404',509.2400],
['20050405',511.5100],
['20050406',513.9700],
['20050407',515.4500],
['20050408',518.9700],
['20050411',521.2100],
['20050412',520.8400],
['20050413',520.4500],
['20050414',522.7000],
['20050415',518.6600],
['20050418',503.2700],
['20050419',513.3800],
['20050420',513.9600],
['20050421',512.4100],
['20050422',512.3900],
['20050425',513.0500],
['20050426',515.0400],
['20050427',513.6100],
['20050428',514.5800],
['20050429',513.0600],
['20050503',513.5300],
['20050504',514.9700],
['20050505',515.9100],
['20050506',518.7700],
['20050509',519.0400],
['20050510',517.8000],
['20050511',518.9700],
['20050512',521.0100],
['20050513',518.1400],
['20050516',514.4200],
['20050517',511.0000],
['20050518',510.7500],
['20050519',512.8400],
['20050520',513.6400],
['20050524',517.1000],
['20050525',515.3100],
['20050526',516.3200],
['20050527',518.4800],
['20050530',522.5400],
['20050531',524.8900],
['20050601',524.0300],
['20050602',527.8800],
['20050603',532.7500],
['20050606',538.4800],
['20050607',539.0600],
['20050608',538.2500],
['20050609',540.0200],
['20050610',543.6200],
['20050613',544.1400],
['20050614',539.9900],
['20050615',542.1800],
['20050616',544.1500],
['20050617',542.8200],
['20050620',540.9900],
['20050621',540.0900],
['20050622',545.2500],
['20050623',546.4900],
['20050624',545.8400],
['20050627',543.2800],
['20050628',546.6900],
['20050629',546.3500],
['20050630',547.5200],
['20050701',548.3400],
['20050704',549.1700],
['20050705',550.2200],
['20050706',556.4400],
['20050707',556.2500],
['20050708',556.4300],
['20050711',563.5800],
['20050712',564.0600],
['20050713',569.2000],
['20050714',568.3300],
['20050715',565.1300],
['20050718',565.6300],
['20050719',570.4500],
['20050720',571.9400],
['20050721',572.1300],
['20050722',576.9300],
['20050725',576.2800],
['20050726',577.3100],
['20050727',580.6000],
['20050728',587.4300],
['20050729',585.8800],
['20050801',587.3400],
['20050802',592.9400],
['20050803',588.9900],
['20050804',587.5100],
['20050805',583.9400],
['20050808',587.1800],
['20050810',587.5900],
['20050811',580.9500],
['20050812',580.3000],
['20050815',572.3700],
['20050816',577.7900],
['20050817',578.3200],
['20050818',575.3200],
['20050819',575.0400],
['20050822',577.3200],
['20050823',574.6000],
['20050824',572.9000],
['20050825',573.7300],
['20050826',577.5100],
['20050829',572.5800],
['20050830',572.7700],
['20050831',575.6700],
['20050901',585.0600],
['20050902',588.5100],
['20050905',582.8600],
['20050906',580.1200],
['20050907',582.0200],
['20050908',581.4300],
['20050909',584.7300],
['20050912',587.9100],
['20050913',585.2900],
['20050914',589.2000],
['20050915',591.1600],
['20050916',589.9500],
['20050919',589.2900],
['20050920',593.8200],
['20050921',592.6900],
['20050922',591.4300],
['20050923',590.6700],
['20050926',594.1900],
['20050927',595.8100],
['20050928',592.9300],
['20050929',595.3900],
['20050930',599.6300],
['20051003',596.2500],
['20051004',600.4700],
['20051005',600.2700],
['20051006',592.1400],
['20051007',595.4200],
['20051010',600.4000],
['20051011',599.1900],
['20051012',595.2200],
['20051013',592.8800],
['20051014',588.9700],
['20051017',583.8800],
['20051018',583.0400],
['20051019',565.3200],
['20051020',564.8900],
['20051021',569.3000],
['20051024',567.8900],
['20051025',566.7300],
['20051026',567.2700],
['20051027',561.6600],
['20051028',559.3900],
['20051031',564.4200],
['20051102',570.1400],
['20051104',576.9600],
['20051107',574.9900],
['20051108',575.5200],
['20051109',577.7900],
['20051110',574.7500],
['20051111',576.1600],
['20051114',566.9200],
['20051115',565.1600],
['20051116',568.9000],
['20051117',567.2400],
['20051118',569.5900],
['20051121',563.0200],
['20051122',566.0500],
['20051123',576.1500],
['20051124',577.3700],
['20051125',576.9100],
['20051128',578.6400],
['20051129',576.5400],
['20051130',582.5200],
['20051201',578.8600],
['20051202',581.2200],
['20051205',582.6700],
['20051206',579.5100],
['20051207',579.9000],
['20051208',577.1700],
['20051209',578.0200],
['20051212',579.4400],
['20051213',580.7600],
['20051214',579.7700],
['20051215',581.8100],
['20051216',579.5800],
['20051219',578.4600],
['20051220',575.5900],
['20051221',576.2600],
['20051222',572.6100],
['20051223',575.8000],
['20051227',577.4100],
['20051228',578.1300],
['20051229',582.0200],
['20051230',583.4500],
['20060103',589.5500],
['20060104',595.6900],
['20060105',601.7400],
['20060106',602.7800],
['20060109',609.2000],
['20060111',612.6700],
['20060112',608.9100],
['20060113',608.0100],
['20060116',607.3100],
['20060117',604.7300],
['20060118',598.9900],
['20060119',604.9500],
['20060120',606.2600],
['20060123',601.1000],
['20060124',602.2200],
['20060125',606.5500],
['20060126',608.0200],
['20060127',618.2300],
['20060201',624.1900],
['20060202',627.2500],
['20060203',627.3700],
['20060206',632.7900],
['20060207',641.2200],
['20060208',637.4000],
['20060209',641.5600],
['20060210',640.6800],
['20060213',640.8800],
['20060214',638.2700],
['20060215',633.6800],
['20060216',632.9700],
['20060217',631.8800],
['20060220',630.3000],
['20060221',635.2000],
['20060222',632.5300],
['20060223',634.1000],
['20060224',634.8000],
['20060227',638.4600],
['20060228',638.4000],
['20060301',636.9700],
['20060302',637.3100],
['20060303',639.1200],
['20060306',642.7100],
['20060307',638.0000],
['20060308',636.0000],
['20060309',636.6600],
['20060310',632.7000],
['20060313',634.5800],
['20060314',637.1100],
['20060315',639.8100],
['20060316',641.6000],
['20060317',642.0700],
['20060320',640.1200],
['20060321',640.5400],
['20060322',634.6900],
['20060323',642.8100],
['20060324',647.8200],
['20060327',647.8800],
['20060328',652.6500],
['20060329',651.1800],
['20060330',656.0100],
['20060331',661.7600],
['20060403',663.2600],
['20060404',659.1400],
['20060405',662.0200],
['20060406',659.8200],
['20060407',659.9700],
['20060410',655.5800],
['20060411',656.4600],
['20060412',654.2200],
['20060413',659.6700],
['20060417',659.0300],
['20060418',663.5300],
['20060419',670.6900],
['20060420',674.0400],
['20060421',674.3900],
['20060424',671.6100],
['20060425',672.0400],
['20060426',673.6600],
['20060427',674.4300],
['20060428',669.9500],
['20060502',669.0100],
['20060503',669.7700],
['20060504',667.4100],
['20060505',665.1600],
['20060508',671.7100],
['20060509',674.9000],
['20060510',671.7400],
['20060511',666.4400],
['20060515',646.8800],
['20060516',635.9300],
['20060517',643.7900],
['20060518',628.9100],
['20060519',632.7300],
['20060522',606.9900],
['20060523',611.8200],
['20060524',614.0100],
['20060525',598.3700],
['20060526',610.1700],
['20060529',606.2100],
['20060530',605.9900],
['20060531',598.9500],
['20060601',599.8700],
['20060602',604.1400],
['20060605',605.2500],
['20060606',598.5500],
['20060607',590.6700],
['20060608',574.9600],
['20060609',581.4500],
['20060612',581.5900],
['20060613',570.2700],
['20060614',564.5400],
['20060615',570.5200],
['20060616',589.1200],
['20060619',582.9600],
['20060620',577.2400],
['20060621',578.4800],
['20060622',585.0300],
['20060623',581.2300],
['20060626',584.9900],
['20060627',584.0800],
['20060628',582.5600],
['20060629',589.1900],
['20060630',599.2600],
['20060703',603.2000],
['20060704',609.3400],
['20060705',605.8500],
['20060706',608.7400],
['20060707',607.2400],
['20060710',610.0000],
['20060711',605.9900],
['20060712',606.3800],
['20060713',603.6200],
['20060714',592.7400],
['20060717',576.9600],
['20060718',581.5600],
['20060719',581.6000],
['20060720',590.1600],
['20060721',585.4600],
['20060724',584.5900],
['20060725',591.3100],
['20060726',590.9700],
['20060727',601.3000],
['20060728',601.5800],
['20060731',607.2500],
['20060801',608.2000],
['20060802',610.8600],
['20060803',612.6100],
['20060804',612.1000],
['20060807',612.5800],
['20060808',614.2600],
['20060810',609.9500],
['20060811',612.0800],
['20060814',617.4600],
['20060815',614.6100],
['20060816',620.3900],
['20060817',621.8200],
['20060818',625.1300],
['20060821',619.7700],
['20060822',624.1200],
['20060823',623.9600],
['20060824',621.3500],
['20060825',620.2200],
['20060828',614.4500],
['20060829',618.8400],
['20060830',619.4200],
['20060831',624.1900],
['20060901',623.0200],
['20060904',627.8900],
['20060905',630.2100],
['20060906',632.9600],
['20060907',627.5500],
['20060908',627.8900],
['20060911',623.6500],
['20060912',622.9200],
['20060913',628.8100],
['20060914',631.1900],
['20060915',632.1700],
['20060918',639.3900],
['20060919',640.1100],
['20060920',640.7300],
['20060921',642.5100],
['20060922',641.9200],
['20060925',639.0900],
['20060926',635.2100],
['20060927',643.8600],
['20060928',642.5000],
['20060929',650.7100],
['20061002',655.8100],
['20061003',656.4400],
['20061004',658.8800],
['20061005',665.4100],
['20061006',667.2200],
['20061009',664.5700],
['20061010',672.7800],
['20061011',674.5100],
['20061012',679.6900],
['20061013',680.8900],
['20061016',679.5600],
['20061017',674.6200],
['20061018',675.5400],
['20061019',675.9500],
['20061020',681.5000],
['20061023',681.2600],
['20061025',686.5000],
['20061026',689.0000],
['20061027',681.8700],
['20061030',674.0300],
['20061031',680.7700],
['20061101',685.6500],
['20061102',686.5500],
['20061103',688.2200],
['20061106',692.8500],
['20061107',693.5200],
['20061108',686.2700],
['20061109',687.3600],
['20061110',688.7800],
['20061113',689.5400],
['20061114',697.8200],
['20061115',698.9500],
['20061116',703.4200],
['20061117',706.5400],
['20061120',705.2500],
['20061121',713.9800],
['20061122',722.0700],
['20061123',723.8200],
['20061124',723.7100],
['20061127',728.0000],
['20061128',712.3900],
['20061129',721.4600],
['20061130',726.1100],
['20061201',727.1800],
['20061204',731.9300],
['20061205',745.5800],
['20061206',739.4800],
['20061207',738.1300],
['20061208',725.7600],
['20061211',731.0000],
['20061212',731.9600],
['20061213',723.4000],
['20061214',729.0300],
['20061215',732.5000],
['20061218',732.4700],
['20061219',723.8000],
['20061220',729.7600],
['20061221',734.5700],
['20061222',737.8700],
['20061226',738.1900],
['20061227',745.3900],
['20061228',755.4300],
['20061229',769.9100],
['20070103',790.2800],
['20070104',775.5500],
['20070105',775.8100],
['20070108',769.5300],
['20070109',772.8700],
['20070110',763.8900],
['20070111',769.9100],
['20070112',780.2800],
['20070115',792.0900],
['20070116',795.6100],
['20070117',799.9900],
['20070118',808.6900],
['20070119',811.0300],
['20070122',822.4000],
['20070123',823.3600],
['20070124',827.0000],
['20070125',815.7400],
['20070126',807.7200],
['20070129',819.0900],
['20070130',821.1700],
['20070131',819.3600],
['20070201',826.5400],
['20070202',836.0400],
['20070205',842.3400],
['20070206',851.1900],
['20070207',859.2900],
['20070208',865.4100],
['20070209',860.8600],
['20070212',851.5300],
['20070213',850.3600],
['20070214',850.1100],
['20070215',856.1600],
['20070216',849.8100],
['20070221',864.0200],
['20070222',869.9300],
['20070223',877.6400],
['20070226',886.0700],
['20070227',872.8400],
['20070228',840.7200],
['20070301',848.7000],
['20070302',843.5300],
['20070305',797.9000],
['20070306',823.9900],
['20070307',826.6300],
['20070308',843.4100],
['20070309',849.1100],
['20070312',867.5600],
['20070313',865.6100],
['20070314',841.2300],
['20070315',851.3100],
['20070316',852.7700],
['20070319',862.3900],
['20070320',872.9500],
['20070321',880.1200],
['20070322',886.4500],
['20070323',888.1400],
['20070326',887.7000],
['20070327',898.3700],
['20070328',895.5400],
['20070329',903.1600],
['20070330',904.2200],
['20070402',909.9300],
['20070403',921.4900],
['20070404',929.4900],
['20070405',933.2700],
['20070409',938.5300],
['20070410',941.9000],
['20070411',942.3500],
['20070412',937.7600],
['20070413',941.4600],
['20070416',953.8600],
['20070417',953.7100],
['20070418',948.1000],
['20070419',929.6100],
['20070420',941.8300],
['20070423',948.1800],
['20070424',944.1300],
['20070425',945.4500],
['20070426',952.1000],
['20070427',949.9200],
['20070430',952.4700],
['20070502',964.8100],
['20070503',970.7700],
['20070504',976.2100],
['20070507',975.4700],
['20070508',966.2300],
['20070509',980.4700],
['20070510',977.6100],
['20070511',970.3000],
['20070514',977.2100],
['20070515',967.6800],
['20070516',974.1800],
['20070517',977.6300],
['20070518',974.1400],
['20070521',977.4500],
['20070522',980.9700],
['20070523',983.5500],
['20070524',972.8300],
['20070525',967.4000],
['20070528',968.0800],
['20070529',963.5000],
['20070530',954.7100],
['20070601',962.4300],
['20070604',976.6100],
['20070605',985.5300],
['20070606',984.1800],
['20070607',985.3000],
['20070608',977.7600],
['20070611',980.9900],
['20070612',983.1900],
['20070613',983.5000],
['20070614',992.5900],
['20070615',996.4200],
['20070618',1002.2700],
['20070619',1007.4500],
['20070620',1013.4100],
['20070621',1013.7400],
['20070622',1014.1200],
['20070625',1009.0500],
['20070626',994.2900],
['20070627',990.2400],
['20070628',993.7500],
['20070629',1002.2500],
['20070702',1001.4200],
['20070703',1011.6700],
['20070704',1012.5700],
['20070705',1014.0800],
['20070706',1014.7100],
['20070709',1023.6900],
['20070710',1027.2400],
['20070711',1016.2700],
['20070712',1025.1100],
['20070713',1030.7900],
['20070716',1023.7800],
['20070717',1028.3400],
['20070718',1009.0200],
['20070719',1001.5500],
['20070720',1014.8700],
['20070723',1007.1700],
['20070724',1009.9300],
['20070725',1000.1000],
['20070726',992.3500],
['20070727',968.7100],
['20070730',970.1500],
['20070731',974.9500],
['20070801',943.6400],
['20070802',940.9000],
['20070803',946.6800],
['20070806',917.6200],
['20070807',912.5700],
['20070808',930.9800],
['20070810',908.8500],
['20070813',912.7600],
['20070814',913.0300],
['20070815',885.0200],
['20070816',841.5300],
['20070817',820.7900],
['20070820',864.4900],
['20070821',845.6700],
['20070822',866.6400],
['20070823',888.9500],
['20070824',881.8300],
['20070827',901.9800],
['20070828',889.6400],
['20070829',879.4800],
['20070830',881.8200],
['20070831',895.9600],
['20070903',898.8300],
['20070904',899.7300],
['20070905',908.0300],
['20070906',905.5200],
['20070907',916.5600],
['20070910',909.2900],
['20070911',918.9200],
['20070912',927.8800],
['20070913',927.8900],
['20070914',931.6200],
['20070917',916.6400],
['20070918',913.6500],
['20070919',932.5300],
['20070920',928.6800],
['20070921',924.7900],
['20070924',939.3200],
['20070925',936.8400],
['20070926',950.4500],
['20070927',962.3700],
['20070928',979.9100],
['20071001',1012.5400],
['20071002',1014.7000],
['20071003',994.3200],
['20071004',991.5300],
['20071005',1000.0000],
['20071008',1006.3300],
['20071009',1012.0200],
['20071010',1008.2500],
['20071011',1026.9900],
['20071012',1029.7700],
['20071015',1029.4100],
['20071016',1014.1400],
['20071017',1010.1800],
['20071018',1002.0300],
['20071019',991.1900],
['20071022',960.9000],
['20071023',984.7300],
['20071024',978.8700],
['20071025',992.8400],
['20071026',1007.7000],
['20071029',1011.4100],
['20071030',1001.9700],
['20071031',1005.4500],
['20071101',1010.3800],
['20071102',994.0100],
['20071105',976.8400],
['20071106',987.0100],
['20071107',985.4000],
['20071109',965.7300],
['20071112',944.4200],
['20071113',937.2800],
['20071114',941.7900],
['20071115',935.6800],
['20071116',924.4900],
['20071119',914.9600],
['20071120',907.5100],
['20071121',885.7100],
['20071122',873.6400],
['20071123',879.3800],
['20071126',895.3300],
['20071127',879.5400],
['20071128',871.9800],
['20071129',889.8900],
['20071130',890.5500],
['20071203',883.9400],
['20071204',892.2900],
['20071205',898.6600],
['20071206',900.8700],
['20071207',903.1500],
['20071210',892.8500],
['20071211',901.7200],
['20071212',890.9000],
['20071213',882.3200],
['20071214',880.6700],
['20071217',862.0400],
['20071218',863.1600],
['20071219',865.1200],
['20071221',868.8200],
['20071224',878.1200],
['20071226',885.7800],
['20071227',887.3600],
['20071228',894.5500],
['20071231',907.9700],
['20080102',894.8500],
['20080103',880.5400],
['20080104',889.1300],
['20080107',870.8700],
['20080108',868.2000],
['20080109',862.4300],
['20080110',851.0200],
['20080111',846.2000],
['20080114',830.9500],
['20080115',812.3000],
['20080116',787.6000],
['20080117',800.0500],
['20080118',790.0300],
['20080121',748.8400],
['20080122',708.2100],
['20080123',738.3400],
['20080124',752.9100],
['20080125',790.8000],
['20080128',767.2800],
['20080129',771.7300],
['20080130',758.8700],
['20080131',764.1200],
['20080201',771.4200],
['20080204',789.9100],
['20080205',784.2500],
['20080206',765.8300],
['20080211',752.5500],
['20080212',761.9500],
['20080213',763.4400],
['20080214',788.4400],
['20080215',798.8300],
['20080218',801.2400],
['20080219',810.4700],
['20080220',794.6500],
['20080221',799.3900],
['20080222',800.1600],
['20080225',802.5000],
['20080226',798.4700],
['20080227',805.4300],
['20080228',798.6600],
['20080229',793.4100],
['20080303',769.8900],
['20080304',767.7000],
['20080305',762.5400],
['20080306',771.2800],
['20080307',757.7600],
['20080310',738.6700],
['20080311',736.9700],
['20080312',744.1700],
['20080313',717.7500],
['20080314',722.5200],
['20080317',705.0600],
['20080318',716.0100],
['20080319',718.4000],
['20080320',703.0300],
['20080324',724.1000],
['20080325',746.8300],
['20080326',749.9600],
['20080327',760.9100],
['20080328',770.4600],
['20080331',769.7700],
['20080401',770.0800],
['20080402',773.2900],
['20080403',782.9400],
['20080404',783.1200],
['20080407',793.9700],
['20080408',785.6200],
['20080409',774.4000],
['20080410',769.1800],
['20080411',779.1600],
['20080414',765.3500],
['20080415',774.4700],
['20080416',782.0400],
['20080417',790.5100],
['20080418',786.3400],
['20080421',799.0600],
['20080422',802.7100],
['20080423',806.8400],
['20080424',808.6900],
['20080425',808.7300],
['20080428',806.0500],
['20080429',803.8500],
['20080430',802.3700],
['20080502',822.2800],
['20080505',823.6300],
['20080506',824.1900],
['20080507',826.0500],
['20080508',822.4600],
['20080509',810.9200],
['20080512',817.0600],
['20080513',816.9200],
['20080514',820.1800],
['20080515',821.8800],
['20080516',824.9900],
['20080520',818.9800],
['20080521',818.2800],
['20080522',812.8900],
['20080523',806.5400],
['20080526',791.3600],
['20080527',793.6900],
['20080528',795.8000],
['20080529',802.8100],
['20080530',800.4300],
['20080602',802.8600],
['20080603',798.3700],
['20080604',798.4700],
['20080605',797.8000],
['20080606',801.4200],
['20080609',781.1500],
['20080610',768.5500],
['20080611',768.6800],
['20080612',758.9900],
['20080613',747.3100],
['20080616',746.6000],
['20080617',750.3000],
['20080618',751.8900],
['20080619',741.8600],
['20080620',739.6800],
['20080623',735.2100],
['20080624',730.9500],
['20080625',734.3200],
['20080626',735.3600],
['20080627',725.9000],
['20080630',720.8500],
['20080701',717.3000],
['20080702',717.3300],
['20080703',701.7700],
['20080704',699.7600],
['20080707',710.9700],
['20080708',694.6500],
['20080709',706.2200],
['20080710',702.6800],
['20080711',709.9900],
['20080714',705.2200],
['20080715',693.0200],
['20080716',694.6200],
['20080717',696.7900],
['20080718',688.4700],
['20080721',698.6900],
['20080722',696.4400],
['20080723',710.1300],
['20080724',706.8700],
['20080725',698.9900],
['20080728',697.0000],
['20080729',687.4400],
['20080730',694.2000],
['20080731',694.2600],
['20080801',692.9100],
['20080804',683.7600],
['20080805',679.7100],
['20080806',686.8500],
['20080807',675.0300],
['20080808',673.7900],
['20080811',667.5200],
['20080812',661.7900],
['20080813',658.2600],
['20080814',661.9400],
['20080815',659.1700],
['20080818',656.2500],
['20080819',644.5300],
['20080820',651.6900],
['20080821',642.1500],
['20080822',648.2800],
['20080825',646.4600],
['20080826',631.7900],
['20080827',629.0400],
['20080828',623.6900],
['20080829',628.8300],
['20080901',622.7100],
['20080902',622.6200],
['20080903',613.3900],
['20080904',596.7400],
['20080905',587.2700],
['20080908',604.0400],
['20080909',596.1100],
['20080910',589.9600],
['20080911',577.5200],
['20080912',575.6200],
['20080915',554.1600],
['20080916',547.5700],
['20080917',542.2900],
['20080918',533.1900],
['20080919',567.2500],
['20080922',556.7000],
['20080923',541.9000],
['20080924',546.4300],
['20080925',539.4800],
['20080926',525.3800],
['20080929',504.6300],
['20080930',509.9200],
['20081002',509.6500],
['20081003',497.8200],
['20081006',468.8400],
['20081007',462.0300],
['20081008',427.5600],
['20081009',424.7400],
['20081010',386.3600],
['20081013',399.9800],
['20081014',418.8100],
['20081015',404.7700],
['20081016',385.7000],
['20081017',370.6100],
['20081020',382.1100],
['20081021',384.5400],
['20081022',366.8800],
['20081023',354.7800],
['20081024',325.6400],
['20081028',320.7800],
['20081029',318.2500],
['20081030',340.4000],
['20081031',344.7600],
['20081103',373.0000],
['20081104',377.9400],
['20081105',390.2800],
['20081106',378.9500],
['20081107',382.6700],
['20081110',386.1200],
['20081111',374.7700],
['20081112',368.3600],
['20081113',353.7200],
['20081114',355.2600],
['20081117',351.6500],
['20081118',338.5400],
['20081119',332.6200],
['20081120',320.9700],
['20081121',326.1200],
['20081124',317.5800],
['20081125',324.0500],
['20081126',328.5300],
['20081127',331.5700],
['20081128',331.3900],
['20081201',329.4500],
['20081202',323.8900],
['20081203',325.0700],
['20081204',325.1000],
['20081205',327.7300],
['20081209',339.4800],
['20081210',349.1500],
['20081211',346.3200],
['20081212',341.5400],
['20081215',350.6300],
['20081216',352.5200],
['20081217',352.5500],
['20081218',360.6800],
['20081219',361.4400],
['20081222',360.3700],
['20081223',351.8700],
['20081224',352.4500],
['20081226',351.4100],
['20081229',353.4400],
['20081230',360.4300],
['20081231',357.5400],
['20090102',364.3200],
['20090105',385.7700],
['20090106',384.4000],
['20090107',384.4400],
['20090108',382.8200],
['20090109',384.9300],
['20090112',376.8000],
['20090113',371.4800],
['20090114',367.4300],
['20090115',355.3100],
['20090116',355.2600],
['20090119',352.9500],
['20090120',350.2200],
['20090121',349.9500],
['20090122',351.1900],
['20090123',345.3700],
['20090128',358.8300],
['20090129',355.7300],
['20090130',356.7000],
['20090202',352.1000],
['20090203',349.0700],
['20090204',348.7700],
['20090205',345.6100],
['20090206',350.9000],
['20090209',345.4300],
['20090210',343.5800],
['20090211',345.1800],
['20090212',342.6700],
['20090213',346.4200],
['20090216',343.5500],
['20090217',333.5900],
['20090218',335.4500],
['20090219',332.6300],
['20090220',326.7500],
['20090223',329.4800],
['20090224',324.5400],
['20090225',325.4700],
['20090226',324.4200],
['20090227',322.1900],
['20090302',311.7600],
['20090303',311.4000],
['20090304',312.6900],
['20090305',308.8500],
['20090306',303.8000],
['20090309',295.8300],
['20090310',295.6400],
['20090311',298.0600],
['20090312',294.0200],
['20090313',305.0200],
['20090316',307.3400],
['20090317',305.8800],
['20090318',309.6500],
['20090319',309.9600],
['20090320',310.6300],
['20090323',323.7000],
['20090324',329.7200],
['20090325',330.1100],
['20090326',340.3400],
['20090327',343.3800],
['20090330',325.7300],
['20090331',333.6800],
['20090401',335.3300],
['20090402',351.7400],
['20090403',354.9400],
['20090406',368.1900],
['20090407',357.0500],
['20090408',354.0100],
['20090409',365.3200],
['20090413',373.7600],
['20090414',382.3300],
['20090415',391.8200],
['20090416',388.4600],
['20090417',392.2600],
['20090420',391.1000],
['20090421',384.8700],
['20090422',379.6500],
['20090423',384.9900],
['20090424',384.8500],
['20090427',373.6600],
['20090428',366.8700],
['20090429',379.0700],
['20090430',384.8000],
['20090504',405.3800],
['20090505',417.7600],
['20090506',431.7400],
['20090507',457.5200],
['20090508',473.3700],
['20090511',461.2500],
['20090512',476.5200],
['20090513',476.3800],
['20090514',463.4700],
['20090515',458.1300],
['20090518',453.2800],
['20090519',474.7700],
['20090520',483.5300],
['20090521',473.4200],
['20090522',479.9600],
['20090525',497.0500],
['20090526',492.4600],
['20090527',506.6900],
['20090528',512.7600],
['20090529',527.4100],
['20090601',548.0200],
['20090602',548.0000],
['20090603',556.9400],
['20090604',549.5600],
['20090605',549.3800],
['20090608',530.0800],
['20090609',536.2600],
['20090610',550.0700],
['20090611',546.6000],
['20090612',543.1100],
['20090615',530.7400],
['20090616',519.5000],
['20090617',520.3500],
['20090618',509.0600],
['20090619',515.8500],
['20090622',515.2100],
['20090623',505.0000],
['20090624',514.3900],
['20090625',521.6200],
['20090626',524.5500],
['20090629',522.7500],
['20090630',518.0300],
['20090701',528.3300],
['20090702',526.4700],
['20090703',523.4200],
['20090706',517.9500],
['20090707',514.6000],
['20090708',504.0100],
['20090709',511.3500],
['20090710',506.9900],
['20090713',497.4200],
['20090714',505.6100],
['20090715',525.8900],
['20090716',526.0400],
['20090717',533.9000],
['20090720',550.7100],
['20090721',553.3400],
['20090722',551.2300],
['20090723',562.4200],
['20090724',572.7000],
['20090727',578.1000],
['20090728',581.1800],
['20090729',580.4900],
['20090730',588.3500],
['20090731',595.2800],
['20090803',603.2100],
['20090804',596.9300],
['20090805',588.1300],
['20090806',594.8200],
['20090807',584.6700],
['20090811',595.2000],
['20090812',585.7500],
['20090813',594.9400],
['20090814',594.9500],
['20090817',575.5900],
['20090818',583.9800],
['20090819',575.9300],
['20090820',584.6400],
['20090821',581.5900],
['20090824',597.1300],
['20090825',596.5100],
['20090826',600.2800],
['20090827',604.5300],
['20090828',603.9900],
['20090831',595.1400],
['20090901',593.9400],
['20090902',589.5700],
['20090903',596.7400],
['20090904',603.4700],
['20090907',610.8000],
['20090908',617.2900],
['20090909',615.1500],
['20090910',623.7500],
['20090911',621.1300],
['20090914',607.5600],
['20090915',611.5000],
['20090916',619.2100],
['20090917',620.3900],
['20090918',622.5800],
['20090922',627.7500],
['20090923',630.1600],
['20090924',624.2600],
['20090925',624.5100],
['20090928',611.8500],
['20090929',617.0900],
['20090930',618.4200],
['20091001',614.1600],
['20091002',601.9500],
['20091005',590.6100],
['20091006',598.6700],
['20091007',610.5400],
['20091008',616.9700],
['20091009',617.2300],
['20091012',621.7900],
['20091013',622.2200],
['20091014',632.3400],
['20091015',633.7300],
['20091016',633.5000],
['20091019',636.6500],
['20091020',635.1200],
['20091021',632.4900],
['20091022',629.3300],
['20091023',634.8600],
['20091026',637.0800],
['20091027',630.2600],
['20091028',623.0200],
['20091029',618.9100],
['20091030',625.4700],
['20091102',619.9600],
['20091103',616.3800],
['20091104',621.2600],
['20091105',612.2100],
['20091106',614.0600],
['20091109',618.0700],
['20091110',619.4600],
['20091111',624.7500],
['20091112',623.6500],
['20091113',626.3400],
['20091116',641.4900],
['20091117',638.0200],
['20091118',636.6600],
['20091119',634.6600],
['20091120',635.0900],
['20091123',642.0300],
['20091124',643.0600],
['20091125',643.1500],
['20091126',644.0000],
['20091130',642.5300],
['20091201',649.3900],
['20091202',655.2600],
['20091203',664.2800],
['20091204',665.3500],
['20091207',667.8500],
['20091208',669.3300],
['20091209',665.3300],
['20091210',662.2700],
['20091211',662.3100],
['20091214',662.5400],
['20091215',663.7500],
['20091216',664.2200],
['20091217',665.6900],
['20091218',666.6000],
['20091221',668.3300],
['20091222',672.5600],
['20091223',677.9100],
['20091224',680.2900],
['20091228',686.5100],
['20091229',692.4600],
['20091230',695.2500],
['20091231',699.4400],
['20100104',705.2200],
['20100105',715.4400],
['20100106',716.3000],
['20100107',716.8800],
['20100108',719.2000],
['20100111',726.0600],
['20100112',719.8700],
['20100113',712.6600],
['20100114',719.4800],
['20100115',716.6500],
['20100118',714.0700],
['20100119',715.9100],
['20100120',711.3600],
['20100121',701.5200],
['20100122',699.7200],
['20100125',695.7300],
['20100126',668.4700],
['20100127',655.8200],
['20100128',667.4100],
['20100129',664.0400],
['20100201',661.2500],
['20100202',662.2600],
['20100203',670.9900],
['20100204',664.1700],
['20100205',651.1000],
['20100208',651.6400],
['20100209',656.9400],
['20100210',658.3300],
['20100211',660.3700],
['20100212',665.9200],
['20100217',672.4400],
['20100218',664.3100],
['20100219',661.0100],
['20100222',663.3500],
['20100223',671.7400],
['20100224',672.3200],
['20100225',668.6400],
['20100226',667.1100],
['20100301',675.2700],
['20100302',675.0500],
['20100303',676.3500],
['20100304',674.2500],
['20100305',678.3100],
['20100308',686.1300],
['20100309',688.1500],
['20100310',694.1100],
['20100311',695.4700],
['20100312',693.1800],
['20100315',692.7500],
['20100316',694.5400],
['20100317',701.4000],
['20100318',698.7400],
['20100319',696.0900],
['20100322',692.0000],
['20100323',693.6100],
['20100324',691.4100],
['20100325',694.2700],
['20100326',701.0800],
['20100329',702.8100],
['20100330',704.2900],
['20100331',693.8100],
['20100401',703.3800],
['20100405',711.7500],
['20100406',713.6600],
['20100407',716.0600],
['20100408',713.0300],
['20100409',723.8900],
['20100412',728.5300],
['20100413',727.0800],
['20100414',739.4300],
['20100415',738.6200],
['20100416',737.5400],
['20100419',727.4000],
['20100420',732.4700],
['20100421',729.4500],
['20100422',728.6600],
['20100423',726.7500],
['20100426',729.9300],
['20100427',726.7100],
['20100428',717.3900],
['20100429',721.5300],
['20100430',724.4400],
['20100503',717.2700],
['20100504',707.6300],
['20100505',701.5000],
['20100506',691.8600],
['20100507',678.6400],
['20100510',694.2000],
['20100511',687.6100],
['20100512',694.9200],
['20100513',695.2600],
['20100514',693.6600],
['20100517',685.8900],
['20100518',690.7500],
['20100519',676.4700],
['20100520',669.2700],
['20100521',657.6500],
['20100524',659.7600],
['20100525',633.9100],
['20100526',644.7400],
['20100527',654.2100],
['20100531',664.3100],
['20100601',654.7200],
['20100602',659.9700],
['20100603',672.5900],
['20100604',674.9600],
['20100607',663.6800],
['20100608',666.5200],
['20100609',666.1400],
['20100610',670.5600],
['20100611',674.2700],
['20100614',681.2200],
['20100615',685.3300],
['20100616',690.5800],
['20100617',689.0700],
['20100618',690.4400],
['20100621',698.1800],
['20100622',697.9800],
['20100623',692.4200],
['20100624',686.5300],
['20100625',690.3700],
['20100628',695.2500],
['20100629',686.2800],
['20100630',685.1300],
['20100701',681.7700],
['20100702',687.9600],
['20100705',688.5800],
['20100706',693.4400],
['20100707',691.0600],
['20100708',698.1700],
['20100709',705.7200],
['20100712',705.1000],
['20100713',705.4300],
['20100714',712.2900],
['20100715',712.2600],
['20100716',714.8600],
['20100719',715.4200],
['20100720',723.1400],
['20100721',721.6200],
['20100722',726.2400],
['20100723',729.6100],
['20100726',729.2800],
['20100727',732.6200],
['20100728',732.4400],
['20100729',735.9200],
['20100730',731.9800],
['20100802',741.3600],
['20100803',740.9200],
['20100804',739.5400],
['20100805',738.0200],
['20100806',737.0400],
['20100810',729.3700],
['20100811',721.4400],
['20100812',715.0900],
['20100813',721.6400],
['20100816',717.6500],
['20100817',718.6300],
['20100818',717.6800],
['20100819',723.2400],
['20100820',721.3200],
['20100823',721.2800],
['20100824',720.2400],
['20100825',719.4000],
['20100826',718.9300],
['20100827',717.6500],
['20100830',717.3300],
['20100831',719.1600],
['20100901',724.5200],
['20100902',725.7200],
['20100903',730.5100],
['20100906',740.1800],
['20100907',742.1400],
['20100908',742.3300],
['20100909',746.3100],
['20100913',753.6600],
['20100914',748.6600],
['20100915',756.6100],
['20100916',753.7500],
['20100917',758.2200],
['20100920',760.5100],
['20100921',766.0700],
['20100922',766.6900],
['20100923',769.6300],
['20100924',770.1500],
['20100927',775.2100],
['20100928',766.0500],
['20100929',772.9800],
['20100930',771.7300],
['20101001',777.1000],
['20101004',779.9500],
['20101005',780.0000],
['20101006',783.3000],
['20101007',778.3400],
['20101008',778.2800],
['20101011',783.8400],
['20101012',778.6200],
['20101013',790.6400],
['20101014',789.3000],
['20101015',792.4000],
['20101018',790.1000],
['20101019',791.0000],
['20101020',789.0700],
['20101021',789.3900],
['20101022',787.2700],
['20101025',789.8400],
['20101026',785.4400],
['20101027',780.1900],
['20101028',780.4300],
['20101029',785.6400],
['20101101',793.8700],
['20101102',794.7400],
['20101103',797.8000],
['20101104',803.9700],
['20101108',820.7000],
['20101109',823.4800],
['20101110',820.9800],
['20101111',817.7300],
['20101112',803.4200],
['20101115',797.9500],
['20101116',797.6400],
['20101118',793.7800],
['20101119',792.7700],
['20101122',795.5800],
['20101123',782.1600],
['20101124',782.6300],
['20101125',788.9600],
['20101126',785.4000],
['20101129',786.5200],
['20101130',786.3400],
['20101201',794.4400],
['20101202',800.7600],
['20101203',794.0600],
['20101206',796.9600],
['20101207',800.6500],
['20101208',799.3300],
['20101209',801.8200],
['20101210',795.9300],
['20101213',798.6700],
['20101214',800.0700],
['20101215',798.9000],
['20101216',789.4900],
['20101217',791.9100],
['20101220',786.6000],
['20101221',791.2700],
['20101222',794.6600],
['20101223',794.1700],
['20101224',795.2100],
['20101227',795.9700],
['20101228',803.2500],
['20101229',808.6800],
['20101230',808.5600],
['20101231',806.3200],
['20110103',816.8300],
['20110104',821.6400],
['20110105',823.2200],
['20110106',827.6500],
['20110107',823.6300],
['20110110',820.3400],
['20110111',826.0500],
['20110112',834.7600],
['20110113',835.6000],
['20110114',829.6000],
['20110117',826.3000],
['20110118',827.7000],
['20110119',832.5000],
['20110120',818.7600],
['20110121',816.2600],
['20110124',813.0700],
['20110125',809.8900],
['20110126',813.6300],
['20110127',809.0100],
['20110128',804.0000],
['20110131',792.7100],
['20110201',799.1700],
['20110202',808.2300],
['20110207',806.0300],
['20110208',803.4100],
['20110209',796.5800],
['20110210',784.3700],
['20110211',777.9900],
['20110214',781.9000],
['20110215',772.9100],
['20110216',776.0300],
['20110217',771.3500],
['20110218',771.5900],
['20110221',767.1400],
['20110222',748.8600],
['20110223',750.3200],
['20110224',740.5800],
['20110225',747.8700],
['20110228',743.2000],
['20110301',758.1600],
['20110302',750.8200],
['20110303',756.8600],
['20110304',761.5700],
['20110307',761.1400],
['20110308',767.1300],
['20110309',769.1100],
['20110310',762.6600],
['20110311',753.1200],
['20110314',749.3800],
['20110315',726.2400],
['20110316',737.7100],
['20110317',725.9100],
['20110318',725.6200],
['20110321',738.3000],
['20110322',742.7100],
['20110323',747.7600],
['20110324',755.9800],
['20110325',761.4200],
['20110328',761.0900],
['20110329',759.9100],
['20110330',766.7700],
['20110331',766.1100],
['20110401',771.6600],
['20110404',777.1100],
['20110405',775.3000],
['20110406',777.9500],
['20110407',777.4500],
['20110408',783.1800],
['20110411',777.9600],
['20110412',772.7600],
['20110413',776.6800],
['20110414',777.0600],
['20110415',774.7200],
['20110418',768.9200],
['20110419',767.2700],
['20110420',773.0000],
['20110421',775.8600],
['20110425',774.5900],
['20110426',773.0000],
['20110427',773.9100],
['20110428',771.6100],
['20110429',772.0200],
['20110503',764.0400],
['20110504',757.0900],
['20110505',757.2100],
['20110506',757.1500],
['20110509',764.4000],
['20110510',765.8800],
['20110511',764.2000],
['20110512',757.0000],
['20110513',761.7300],
['20110516',754.3700],
['20110518',758.3700],
['20110519',758.7300],
['20110520',760.2200],
['20110523',745.4300],
['20110524',754.8900],
['20110525',755.3000],
['20110526',756.0600],
['20110527',756.0000],
['20110530',755.9300],
['20110531',760.4600],
['20110601',759.5100],
['20110602',755.9900],
['20110603',757.6700],
['20110606',749.5200],
['20110607',750.8500],
['20110608',750.0200],
['20110609',750.2700],
['20110610',746.0000],
['20110613',737.4900],
['20110614',739.3600],
['20110615',733.8900],
['20110616',729.8900],
['20110617',721.1100],
['20110620',724.5000],
['20110621',733.4900],
['20110622',728.9300],
['20110623',727.6300],
['20110624',735.1600],
['20110627',733.8300],
['20110628',735.1000],
['20110629',738.6100],
['20110630',742.1800],
['20110701',746.1800],
['20110704',750.3400],
['20110705',747.7500],
['20110706',749.3600],
['20110707',750.6300],
['20110708',755.2800],
['20110711',751.3100],
['20110712',742.2000],
['20110713',743.4300],
['20110714',741.9000],
['20110715',735.6200],
['20110718',728.6400],
['20110719',731.8900],
['20110720',737.6500],
['20110721',738.3400],
['20110722',745.7700],
['20110725',742.3400],
['20110726',744.9500],
['20110727',743.2800],
['20110728',743.5900],
['20110729',741.5300],
['20110801',742.1900],
['20110802',729.5900],
['20110803',723.2700],
['20110804',716.5400],
['20110805',693.4700],
['20110808',668.5400],
['20110810',653.6300],
['20110811',641.7600],
['20110812',647.9800],
['20110815',655.5600],
['20110816',652.6100],
['20110817',659.0500],
['20110818',653.1900],
['20110819',632.8700],
['20110822',629.5500],
['20110823',635.8400],
['20110824',630.1600],
['20110825',635.3200],
['20110826',631.0900],
['20110829',643.3100],
['20110831',664.6600],
['20110901',661.6000],
['20110902',659.6800],
['20110905',647.8900],
['20110906',648.6500],
['20110907',655.2700],
['20110908',655.8100],
['20110909',650.2500],
['20110912',635.6000],
['20110913',636.3000],
['20110914',638.9700],
['20110915',641.5300],
['20110916',647.0100],
['20110919',636.0200],
['20110920',637.9300],
['20110921',636.2700],
['20110922',622.3500],
['20110923',613.3100],
['20110926',594.8400],
['20110927',607.8700],
['20110928',602.6200],
['20110929',599.3500],
['20110930',597.3500],
['20111003',580.5500],
['20111004',566.4200],
['20111005',570.4200],
['20111006',578.1400],
['20111007',579.9700],
['20111010',588.5500],
['20111011',595.8400],
['20111012',605.7200],
['20111013',610.2100],
['20111014',615.0200],
['20111017',620.5300],
['20111018',608.2000],
['20111019',611.0400],
['20111020',605.8900],
['20111021',611.1200],
['20111024',618.0700],
['20111025',618.7300],
['20111027',635.5300],
['20111028',646.0100],
['20111031',633.6900],
['20111101',621.1500],
['20111102',628.9500],
['20111103',620.8900],
['20111104',627.8300],
['20111108',627.3400],
['20111109',629.3800],
['20111110',615.8000],
['20111111',618.8200],
['20111114',623.3700],
['20111115',620.4400],
['20111116',618.6700],
['20111117',614.9000],
['20111118',617.0200],
['20111121',607.5600],
['20111122',611.7600],
['20111123',602.7500],
['20111124',600.3500],
['20111125',592.3100],
['20111128',597.0600],
['20111129',594.7400],
['20111130',595.7600],
['20111201',601.0000],
['20111202',606.5700],
['20111205',608.1100],
['20111206',606.0700],
['20111207',612.1900],
['20111208',601.6500],
['20111209',592.8700],
['20111212',592.6100],
['20111213',591.0800],
['20111214',588.7800],
['20111215',588.6400],
['20111216',587.4700],
['20111219',579.9500],
['20111220',579.8000],
['20111221',586.5700],
['20111222',584.6800],
['20111223',587.3800],
['20111227',587.5900],
['20111228',586.8200],
['20111229',586.2700],
['20111230',587.0000],
['20120103',597.3400],
['20120104',598.4400],
['20120105',602.0800],
['20120106',605.4500],
['20120109',606.3000],
['20120110',611.9100],
['20120111',618.2500],
['20120112',617.8500],
['20120113',624.6300],
['20120116',620.7500],
['20120117',629.6800],
['20120118',628.1800],
['20120119',629.3400],
['20120120',635.5900],
['20120125',645.1900],
['20120126',643.6500],
['20120127',644.7800],
['20120130',641.8200],
['20120131',648.7300],
['20120201',646.9800],
['20120202',656.1400],
['20120203',658.2400],
['20120206',663.5400],
['20120207',667.2000],
['20120208',676.1400],
['20120209',677.2200],
['20120210',672.4500],
['20120213',676.9000],
['20120214',679.5900],
['20120215',687.6100],
['20120216',677.7000],
['20120217',681.6400],
['20120220',685.3800],
['20120221',688.7800],
['20120222',690.7600],
['20120223',687.9500],
['20120224',692.2900],
['20120227',686.1400],
['20120228',688.7400],
['20120229',692.7300],
['20120301',688.8200],
['20120302',693.2600],
['20120305',689.7700],
['20120306',678.5800],
['20120307',675.8100],
['20120308',684.0800],
['20120309',684.0200],
['20120312',682.8300],
['20120313',691.5600],
['20120314',697.9100],
['20120315',695.4300],
['20120316',699.7700],
['20120319',695.0400],
['20120320',694.7700],
['20120321',695.4600],
['20120322',692.3800],
['20120323',692.9900],
['20120326',691.0400],
['20120327',698.3600],
['20120328',695.6200],
['20120329',690.6200],
['20120330',694.8100],
['20120402',697.8100],
['20120403',698.5000],
['20120404',696.1500],
['20120405',693.9600],
['20120409',687.7000],
['20120410',689.3900],
['20120411',686.1800],
['20120412',687.9200],
['20120413',689.6500],
['20120416',688.2500],
['20120417',685.6400],
['20120418',691.2400],
['20120419',690.9100],
['20120420',691.2300],
['20120423',683.9900],
['20120424',686.3200],
['20120425',684.3800],
['20120426',684.2400],
['20120427',682.5600],
['20120430',680.9500],
['20120502',687.9200],
['20120503',685.2600],
['20120504',679.8500],
['20120507',666.9400],
['20120508',671.0700],
['20120509',667.1300],
['20120510',667.9500],
['20120511',664.2600],
['20120514',658.2000],
['20120515',660.5000],
['20120516',651.1300],
['20120517',649.3200],
['20120518',638.8900],
['20120521',641.8900],
['20120522',648.4900],
['20120523',641.4700],
['20120524',642.3900],
['20120525',643.8000],
['20120528',644.9100],
['20120529',650.5900],
['20120530',647.9000],
['20120531',649.1500],
['20120601',643.5000],
['20120604',630.0300],
['20120605',630.0800],
['20120606',640.0700],
['20120607',638.9000],
['20120608',636.9600],
['20120611',645.3800],
['20120612',647.0300],
['20120613',647.7200],
['20120614',646.7700],
['20120615',655.2700],
['20120618',657.5200],
['20120619',659.7900],
['20120620',662.3900],
['20120621',661.6800],
['20120622',661.6800],
['20120625',661.1700],
['20120626',664.8500],
['20120627',668.3200],
['20120628',666.8800],
['20120629',673.8500],
['20120702',680.1900],
['20120703',686.4800],
['20120704',685.6200],
['20120705',691.6800],
['20120706',696.2300],
['20120709',688.1500],
['20120710',694.1000],
['20120711',696.3200],
['20120712',693.5200],
['20120713',695.9300],
['20120716',697.9900],
['20120717',701.4100],
['20120718',700.9400],
['20120719',702.5500],
['20120720',697.0000],
['20120723',687.6300],
['20120724',691.8500],
['20120725',693.2300],
['20120726',695.5700],
['20120727',695.4300],
['20120730',698.3600],
['20120731',697.6900],
['20120801',699.5300],
['20120802',698.6900],
['20120803',702.6400],
['20120806',705.2600],
['20120807',702.2500],
['20120808',700.9000],
['20120810',703.4500],
['20120813',700.6400],
['20120814',707.6800],
['20120815',704.2600],
['20120816',704.4800],
['20120817',706.1100],
['20120821',707.9300],
['20120822',707.4500],
['20120823',710.7200],
['20120824',710.5600],
['20120827',715.2000],
['20120828',713.3800],
['20120829',716.3400],
['20120830',710.5000],
['20120831',711.9000],
['20120903',715.7900],
['20120904',714.2400],
['20120905',710.4300],
['20120906',709.5700],
['20120907',716.0600],
['20120910',714.1900],
['20120911',714.7200],
['20120912',720.3400],
['20120913',721.3400],
['20120914',728.0500],
['20120917',730.9800],
['20120918',729.4800],
['20120919',733.3800],
['20120920',730.4100],
['20120921',737.3000],
['20120924',733.1400],
['20120925',732.2900],
['20120926',734.0100],
['20120927',737.2800],
['20120928',737.8400],
['20121001',738.6000],
['20121002',742.6000],
['20121003',737.8200],
['20121004',743.4200],
['20121005',748.9400],
['20121008',745.2100],
['20121009',745.5600],
['20121010',741.4700],
['20121011',740.6700],
['20121012',743.3900],
['20121015',748.5100],
['20121016',753.1900],
['20121017',754.8500],
['20121018',759.5900],
['20121019',755.4100],
['20121022',753.6500],
['20121023',750.5800],
['20121024',748.5400],
['20121025',750.8400],
['20121029',746.6600],
['20121030',739.7300],
['20121031',738.9200],
['20121101',733.8700],
['20121102',739.2500],
['20121105',739.0500],
['20121106',737.2300],
['20121107',744.6000],
['20121108',739.8200],
['20121109',733.9200],
['20121112',735.0100],
['20121114',733.2500],
['20121115',722.0200],
['20121116',724.2300],
['20121119',727.3500],
['20121120',728.6800],
['20121121',732.8000],
['20121122',734.5900],
['20121123',737.4900],
['20121126',742.1700],
['20121127',739.3000],
['20121128',741.4200],
['20121129',748.3100],
['20121130',752.2600],
['20121203',749.9300],
['20121204',747.8400],
['20121205',747.9000],
['20121206',748.3300],
['20121207',755.0900],
['20121210',755.2400],
['20121211',755.3000],
['20121212',759.2700],
['20121213',760.9500],
['20121214',761.9600],
['20121217',762.7600],
['20121218',764.4200],
['20121219',764.2300],
['20121220',765.8900],
['20121221',762.6400],
['20121224',766.4700],
['20121226',770.4200],
['20121227',769.6800],
['20121228',774.0800],
['20121231',773.2700],
['20130102',782.7400],
['20130103',784.5000],
['20130104',786.6100],
['20130107',792.2300],
['20130108',790.5200],
['20130109',794.4100],
['20130110',803.3600],
['20130111',803.6800],
['20130114',795.7500],
['20130115',792.2300],
['20130116',789.9500],
['20130117',791.7200],
['20130118',796.8100],
['20130121',794.8600],
['20130122',792.1500],
['20130123',797.7200],
['20130124',800.0500],
['20130125',803.7000],
['20130128',806.2000],
['20130129',805.8100],
['20130130',810.6900],
['20130131',808.7300],
['20130201',810.7800],
['20130204',812.4800],
['20130205',808.8100],
['20130206',813.0500],
['20130207',809.2200],
['20130208',809.6700],
['20130213',814.8900],
['20130214',816.4400],
['20130215',822.3100],
['20130218',823.2700],
['20130219',825.5100],
['20130220',826.3100],
['20130221',819.6900],
['20130222',815.8000],
['20130225',816.9200],
['20130226',812.1700],
['20130227',811.9900],
['20130228',814.8200],
['20130301',814.0500],
['20130304',803.2400],
['20130305',807.4500],
['20130306',812.3500],
['20130307',811.8900],
['20130308',809.6300],
['20130311',806.6500],
['20130312',809.3900],
['20130313',806.5700],
['20130314',807.2900],
['20130315',804.0900],
['20130318',800.2300],
['20130319',805.0100],
['20130320',804.2700],
['20130321',811.2800],
['20130322',813.9300],
['20130325',815.2900],
['20130326',817.2400],
['20130327',823.8900],
['20130328',821.9400],
['20130401',821.2900],
['20130402',823.2500],
['20130403',824.7400],
['20130404',826.0900],
['20130405',824.4700],
['20130408',821.3200],
['20130409',827.5200],
['20130410',830.2600],
['20130411',833.3000],
['20130412',838.0800],
['20130415',838.2600],
['20130416',835.2700],
['20130417',834.7300],
['20130418',831.0600],
['20130419',837.7100],
['20130422',837.5900],
['20130423',831.3700],
['20130424',834.3400],
['20130425',838.9400],
['20130426',837.6800],
['20130429',838.8300],
['20130430',838.5100],
['20130502',835.9800],
['20130503',831.4900],
['20130506',833.6800],
['20130507',835.6100],
['20130508',840.1100],
['20130509',842.7000],
['20130510',844.3100],
['20130513',846.1200],
['20130514',848.2200],
['20130515',849.3600],
['20130516',847.4900],
['20130517',847.7100],
['20130520',849.2200],
['20130521',846.9600],
['20130522',848.7100],
['20130523',824.1800],
['20130527',825.9300],
['20130528',831.9000],
['20130529',817.0200],
['20130530',801.0500],
['20130531',793.2100],
['20130603',791.9300],
['20130604',807.0000],
['20130605',796.0800],
['20130606',786.9700],
['20130607',783.5600],
['20130610',783.1400],
['20130611',769.8400],
['20130612',764.1500],
['20130613',752.1300],
['20130614',759.7500],
['20130617',763.6000],
['20130618',771.1800],
['20130619',771.8100],
['20130620',750.1600],
['20130621',743.0600],
['20130624',721.9800],
['20130625',724.7200],
['20130626',736.8600],
['20130627',741.0000],
['20130628',750.7100],
['20130701',746.5800],
['20130702',754.9900],
['20130703',746.6300],
['20130704',749.5300],
['20130705',754.1000],
['20130708',743.8800],
['20130709',748.2900],
['20130710',748.2700],
['20130711',763.5300],
['20130712',763.2600],
['20130715',763.2200],
['20130716',760.8900],
['20130717',758.4000],
['20130718',761.8600],
['20130719',758.8100],
['20130722',762.0100],
['20130723',770.7600],
['20130724',774.8400],
['20130725',771.6500],
['20130726',772.6800],
['20130729',767.3700],
['20130730',767.0300],
['20130731',763.3600],
['20130801',765.9600],
['20130802',763.1600],
['20130805',764.1500],
['20130806',761.2900],
['20130807',762.3600],
['20130812',762.0700],
['20130813',762.1000],
['20130814',757.1500],
['20130815',758.8600],
['20130816',755.1200],
['20130819',747.2100],
['20130820',736.5300],
['20130821',738.9000],
['20130822',736.4400],
['20130823',740.3600],
['20130826',742.0500],
['20130827',734.4000],
['20130828',729.4100],
['20130829',733.1300],
['20130830',734.2600],
['20130902',740.4500],
['20130903',745.3400],
['20130904',738.5900],
['20130905',739.2200],
['20130906',740.6500],
['20130909',743.3600],
['20130910',747.2600],
['20130911',752.5200],
['20130912',757.5400],
['20130913',755.6900],
['20130916',769.8600],
['20130917',766.7100],
['20130918',773.1900],
['20130919',793.5200],
['20130920',789.2700],
['20130923',788.8000],
['20130924',788.6000],
['20130925',790.4400],
['20130926',792.3300],
['20130927',797.4900],
['20130930',785.0800],
['20131001',791.1900],
['20131002',789.7200],
['20131003',780.1500],
['20131004',746.4900],
['20131007',722.1200],
['20131008',723.9200],
['20131009',725.5900],
['20131010',731.2800],
['20131011',732.4800],
['20131014',729.5900],
['20131016',730.1300],
['20131017',733.2700],
['20131018',736.6100],
['20131021',742.8200],
['20131022',741.8800],
['20131023',742.3700],
['20131024',744.4300],
['20131025',744.2900],
['20131028',742.3100],
['20131029',744.6700],
['20131030',745.8300],
['20131031',744.8900],
['20131101',746.5600],
['20131104',744.4200],
['20131105',743.0200],
['20131106',742.8700],
['20131107',742.7200],
['20131108',741.4000],
['20131111',737.9400],
['20131112',733.5200],
['20131113',726.8900],
['20131114',729.3500],
['20131115',731.5400],
['20131118',732.1100],
['20131119',731.0300],
['20131120',728.8600],
['20131121',724.7200],
['20131122',724.8400],
['20131125',724.1000],
['20131126',725.5800],
['20131127',722.6000],
['20131128',724.0900],
['20131129',724.9900],
['20131202',726.5000],
['20131203',722.8800],
['20131204',718.0300],
['20131205',711.3600],
['20131206',710.9200],
['20131209',711.7200],
['20131210',708.9300],
['20131211',702.7300],
['20131212',702.0700],
['20131213',705.3000],
['20131216',703.0600],
['20131217',705.1900],
['20131218',704.1400],
['20131219',704.1800],
['20131220',707.7400],
['20131223',710.9700],
['20131224',715.3800],
['20131226',718.4000],
['20131227',720.0100],
['20131230',720.3900],
['20131231',721.3300],
['20140102',724.4300],
['20140103',717.0800],
['20140106',715.4600],
['20140107',715.5500],
['20140108',721.7200],
['20140109',719.5900],
['20140110',720.1000],
['20140113',718.3200],
['20140114',713.5000],
['20140115',715.5300],
['20140116',714.8300],
['20140117',716.1300],
['20140120',714.7000],
['20140121',717.9100],
['20140122',721.8400],
['20140123',716.8000],
['20140124',712.0100],
['20140127',706.3100],
['20140128',706.1300],
['20140129',706.8600],
['20140130',701.0200],
['20140203',696.3000],
['20140204',690.9300],
['20140205',690.4400],
['20140206',694.4800],
['20140207',698.1400],
['20140210',697.8700],
['20140211',701.8300],
['20140212',701.5800],
['20140213',701.5300],
['20140214',703.3300],
['20140217',707.2300],
['20140218',711.1000],
['20140219',712.0300],
['20140220',711.7500],
['20140221',711.5400],
['20140224',711.1900],
['20140225',713.2900],
['20140226',712.1700],
['20140227',714.7900],
['20140228',715.2200],
['20140303',710.0000],
['20140304',712.6800],
['20140305',714.1100],
['20140306',716.8000],
['20140307',718.0600],
['20140310',715.2200],
['20140311',715.2300],
['20140312',713.9800],
['20140313',714.7400],
['20140314',713.1800],
['20140317',715.4000],
['20140318',716.5300],
['20140319',715.1100],
['20140320',710.3500],
['20140321',712.9300],
['20140324',714.8700],
['20140325',714.3200],
['20140326',716.9000],
['20140327',719.9700],
['20140328',724.2700],
['20140331',724.1700],
['20140401',724.4000],
['20140402',727.2700],
['20140403',732.6900],
['20140404',734.9700],
['20140407',731.8700],
['20140408',734.0700],
['20140409',737.0600],
['20140410',735.4200],
['20140411',733.3900],
['20140414',736.3100],
['20140415',741.4000],
['20140416',746.6900],
['20140417',751.6700],
['20140421',750.0000],
['20140422',753.5400],
['20140423',750.7700],
['20140424',762.3200],
['20140425',755.9800],
['20140428',753.6000],
['20140429',751.3500],
['20140430',752.9800],
['20140502',758.8700],
['20140505',758.7100],
['20140506',759.3600],
['20140507',758.5900],
['20140508',760.3700],
['20140509',756.1500],
['20140512',756.3400],
['20140514',760.7100],
['20140515',761.5900],
['20140516',763.3600],
['20140519',764.4400],
['20140520',765.4100],
['20140521',767.6500],
['20140522',766.7600],
['20140523',768.9700],
['20140526',769.6200],
['20140527',770.9600],
['20140528',773.9600],
['20140529',778.8100],
['20140530',773.4300],
['20140602',772.6300],
['20140603',771.0000],
['20140604',767.6500],
['20140605',767.9000],
['20140606',769.2100],
['20140609',770.8700],
['20140610',768.4900],
['20140611',767.3200],
['20140612',768.7600],
['20140613',770.0100],
['20140616',771.1200],
['20140617',768.4200],
['20140618',773.4500],
['20140619',773.7500],
['20140620',775.0800],
['20140623',770.9900],
['20140624',771.7600],
['20140625',770.3300],
['20140626',773.8200],
['20140627',773.5600],
['20140630',773.0700],
['20140701',770.5400],
['20140702',772.6900],
['20140703',776.3600],
['20140704',778.7000],
['20140707',776.7900],
['20140708',773.0900],
['20140709',772.6000],
['20140710',774.7400],
['20140711',777.5100],
['20140714',776.1700],
['20140715',775.5300],
['20140716',778.5600],
['20140717',777.8300],
['20140718',778.6800],
['20140721',781.6900],
['20140722',782.8600],
['20140723',786.1200],
['20140724',785.4300],
['20140725',784.8300],
['20140729',783.1300],
['20140730',780.8300],
['20140731',781.7200],
['20140801',776.6300],
['20140804',773.0200],
['20140805',775.4400],
['20140806',772.3800],
['20140807',772.3600],
['20140808',764.8000],
['20140811',767.0200],
['20140812',766.7700],
['20140813',767.1100],
['20140814',768.5700],
['20140815',769.4400],
['20140818',769.9600],
['20140819',773.8900],
['20140820',773.9400],
['20140821',775.4600],
['20140822',779.4200],
['20140825',779.1600],
['20140826',776.4700],
['20140827',778.9400],
['20140828',778.6500],
['20140829',779.0500],
['20140901',779.1200],
['20140902',779.5900],
['20140903',782.0600],
['20140904',781.2900],
['20140905',780.9100],
['20140908',780.7300],
['20140909',780.9100],
['20140910',777.7300],
['20140911',777.3600],
['20140912',776.1300],
['20140915',769.5400],
['20140916',761.5700],
['20140917',765.5700],
['20140918',763.4900],
['20140919',765.5700],
['20140922',763.2200],
['20140923',763.4900],
['20140924',760.4700],
['20140925',762.3900],
['20140926',759.0500],
['20140929',759.9100],
['20140930',758.9100],
['20141001',762.7300],
['20141002',755.8500],
['20141003',758.9500],
['20141007',754.6300],
['20141008',751.6200],
['20141009',754.4200],
['20141010',745.8500],
['20141013',740.9300],
['20141014',740.1600],
['20141015',737.5700],
['20141016',727.5700],
['20141017',731.1200],
['20141020',735.6100],
['20141021',737.8200],
['20141023',746.5500],
['20141024',747.6600],
['20141027',745.5800],
['20141028',744.4900],
['20141029',747.0500],
['20141030',745.3500],
['20141031',750.9700],
['20141103',750.5900],
['20141104',750.2900],
['20141105',749.2900],
['20141106',747.2500],
['20141107',746.9800],
['20141110',749.6900],
['20141111',748.4800],
['20141112',748.2300],
['20141113',749.0100],
['20141114',748.6900],
['20141117',745.1300],
['20141118',747.2500],
['20141119',749.2400],
['20141120',746.6400],
['20141121',751.3900],
['20141124',753.0900],
['20141125',754.6700],
['20141126',755.9200],
['20141127',755.0600],
['20141128',756.1400],
['20141201',745.1200],
['20141202',742.8600],
['20141203',742.6200],
['20141204',742.0100],
['20141205',743.0800],
['20141208',741.2600],
['20141209',739.8000],
['20141210',741.9500],
['20141211',738.8700],
['20141212',739.3700],
['20141215',735.6100],
['20141216',730.5300],
['20141217',730.0500],
['20141218',732.1800],
['20141219',732.7200],
['20141222',739.6300],
['20141223',738.7300],
['20141224',743.1800],
['20141226',744.4000],
['20141229',745.8000],
['20141230',746.0100],
['20141231',748.6200],
['20150102',752.2300],
['20150105',751.6600],
['20150106',748.1800],
['20150107',751.9100],
['20150108',757.4400],
['20150109',758.4200],
['20150112',757.6500],
['20150113',756.0200],
['20150114',755.5700],
['20150115',759.5700],
['20150116',756.7600],
['20150119',759.1600],
['20150120',765.0200],
['20150121',768.8100],
['20150122',774.6200],
['20150123',782.1700],
['20150126',789.7900],
['20150127',789.2100],
['20150128',792.4200],
['20150129',786.2800],
['20150130',783.3900],
['20150202',785.8600],
['20150203',783.2900],
['20150204',785.5300],
['20150205',785.3200],
['20150206',786.8800],
['20150209',785.3200],
['20150210',786.0300],
['20150211',787.0300],
['20150212',780.1900],
['20150213',782.3500],
['20150216',778.9900],
['20150217',779.5400],
['20150218',783.1200],
['20150223',781.4600],
['20150224',782.4000],
['20150225',787.8700],
['20150226',785.4300],
['20150227',784.0300],
['20150302',781.0100],
['20150303',783.2500],
['20150304',783.9200],
['20150305',782.4800],
['20150306',784.1600],
['20150309',777.6100],
['20150310',775.4200],
['20150311',769.2500],
['20150312',770.8000],
['20150313',772.1800],
['20150316',771.4300],
['20150317',768.3400],
['20150318',765.3200],
['20150319',768.7400],
['20150320',770.1300],
['20150323',773.6000],
['20150324',776.9300],
['20150325',779.8600],
['20150326',781.9700],
['20150327',783.3600],
['20150330',784.1800],
['20150331',782.8100],
['20150401',783.0000],
['20150402',784.3000],
['20150406',786.2500],
['20150407',787.5500],
['20150408',792.2700],
['20150409',794.3500],
['20150410',795.3900],
['20150413',797.9300],
['20150414',801.8600],
['20150415',803.2300],
['20150416',807.5300],
['20150417',805.1200],
['20150420',802.5500],
['20150421',805.3600],
['20150422',805.4500],
['20150423',804.6000],
['20150424',806.2800],
['20150427',811.9500],
['20150428',806.8700],
['20150429',797.8100],
['20150430',801.5600],
['20150504',798.2100],
['20150505',792.0000],
['20150506',791.2400],
['20150507',783.7500],
['20150508',783.8000],
['20150511',784.5200],
['20150512',784.1900],
['20150513',783.8800],
['20150514',784.9600],
['20150515',788.7300],
['20150518',789.5200],
['20150519',788.1000],
['20150520',790.3300],
['20150521',789.9400],
['20150522',791.5000],
['20150525',790.5200],
['20150526',788.2100],
['20150527',785.4900],
['20150528',783.3200],
['20150529',783.5000],
['20150602',781.1300],
['20150603',780.2800],
['20150604',776.1000],
['20150605',772.9600],
['20150608',768.6500],
['20150609',760.4800],
['20150610',761.7300],
['20150611',764.0200],
['20150612',763.3400],
['20150615',760.0000],
['20150616',760.4500],
['20150617',764.6200],
['20150618',764.7100],
['20150619',767.6700],
['20150622',766.0000],
['20150623',765.8600],
['20150624',767.7800],
['20150625',762.9200],
['20150626',763.5300],
['20150629',756.7100],
['20150630',761.6900],
['20150701',762.4000],
['20150702',761.9100],
['20150703',763.1500],
['20150706',759.7200],
['20150707',757.9400],
['20150708',747.0300],
['20150709',745.9700],
['20150710',746.5600],
['20150713',750.1400],
['20150714',751.2600],
['20150715',751.7800],
['20150716',754.8000],
['20150720',756.8700],
['20150721',754.7900],
['20150722',755.1600],
['20150723',754.6000],
['20150724',755.2600],
['20150727',745.5600],
['20150728',739.2100],
['20150729',738.2700],
['20150730',735.5500],
['20150731',732.8200],
['20150803',724.4100],
['20150804',727.8900],
['20150805',727.0200],
['20150806',728.6800],
['20150811',721.3900],
['20150812',710.0000],
['20150813',712.0500],
['20150814',711.3800],
['20150817',703.3100],
['20150818',697.8400],
['20150819',690.0200],
['20150820',681.7900],
['20150821',668.7700],
['20150824',638.1600],
['20150825',653.5500],
['20150826',647.0500],
['20150827',666.8300],
['20150828',672.7900],
['20150831',669.9800],
['20150901',658.6000],
['20150902',657.1000],
['20150903',660.7300],
['20150904',660.8800],
['20150907',656.1100],
['20150908',664.0800],
['20150909',672.7000],
['20150910',665.9000],
['20150914',663.5200],
['20150915',661.8200],
['20150916',668.3100],
['20150917',668.9400],
['20150918',672.4500],
['20150921',669.8600],
['20150922',670.3700],
['20150923',668.0500],
['20150925',667.7700],
['20150928',661.5500],
['20150929',657.1900],
['20150930',663.7000],
['20151001',664.6600],
['20151002',662.3400],
['20151005',671.9400],
['20151006',678.4900],
['20151007',686.7500],
['20151008',683.4200],
['20151009',692.4400],
['20151012',700.6400],
['20151013',691.3000],
['20151014',694.0800],
['20151015',697.6700],
['20151016',701.1000],
['20151019',700.8600],
['20151020',700.4600],
['20151021',701.9300],
['20151022',705.2600],
['20151023',712.1000],
['20151026',718.3500],
['20151027',713.1300],
['20151028',711.5100],
['20151029',706.1200],
['20151030',701.5300],
['20151102',693.6400],
['20151103',699.4200],
['20151104',707.4600],
['20151105',705.3400],
['20151106',703.3600],
['20151109',702.2200],
['20151111',693.9300],
['20151112',688.6000],
['20151113',681.1800],
['20151116',678.8100],
['20151117',679.0800],
['20151118',674.5000],
['20151119',678.5500],
['20151120',675.6500],
['20151123',674.8000],
['20151124',677.0300],
['20151125',674.9100],
['20151126',674.5500],
['20151127',671.3200],
['20151130',672.8800],
['20151201',677.4400],
['20151202',678.6700],
['20151203',677.9600],
['20151204',676.5300],
['20151207',677.9200],
['20151208',673.1200],
['20151209',671.7500],
['20151210',666.2800],
['20151211',662.3900],
['20151214',654.4900],
['20151215',656.1900],
['20151216',660.1100],
['20151217',663.0300],
['20151218',663.5900],
['20151221',666.6200],
['20151222',666.8900],
['20151223',671.0900],
['20151224',671.3700],
['20151228',668.6100],
['20151229',671.7600],
['20151230',669.1200],
['20151231',667.5300],
['20160104',664.0300],
['20160105',666.3500],
['20160106',661.9900],
['20160107',648.0200],
['20160108',650.0200],
['20160111',642.7800],
['20160112',643.6500],
['20160113',644.6200],
['20160114',635.0600],
['20160115',633.7100],
['20160118',625.4600],
['20160119',637.8500],
['20160120',624.2100],
['20160121',617.5400],
['20160122',621.9100],
['20160125',622.4600],
['20160126',615.8700],
['20160127',619.3700],
['20160128',620.3000],
['20160129',631.3300],
['20160201',633.3400],
['20160202',630.8000],
['20160203',627.2300],
['20160204',633.0600],
['20160205',643.4300],
['20160210',635.1200],
['20160211',629.6100],
['20160212',626.8900],
['20160215',636.6700],
['20160216',642.8300],
['20160217',640.6100],
['20160218',650.4700],
['20160219',650.8100],
['20160222',654.5900],
['20160223',656.2200],
['20160224',652.1400],
['20160225',649.4000],
['20160226',655.4700],
['20160229',655.4000],
['20160301',656.5400],
['20160302',661.4200],
['20160303',668.4800],
['20160304',678.8800],
['20160307',679.3600],
['20160308',671.4800],
['20160309',675.1200],
['20160310',676.5300],
['20160311',680.0400],
['20160314',681.4600],
['20160315',681.0200],
['20160316',684.0200],
['20160317',689.0100],
['20160318',693.0500],
['20160321',690.6400],
['20160322',692.2300],
['20160323',694.4200],
['20160324',689.6400],
['20160328',686.5300],
['20160329',684.9100],
['20160330',692.5500],
['20160331',686.2200],
['20160401',684.6200],
['20160404',685.1000],
['20160405',683.5900],
['20160406',683.4200],
['20160407',682.6900],
['20160408',683.4100],
['20160411',682.4900],
['20160412',683.7100],
['20160413',692.5400],
['20160414',693.5500],
['20160415',696.1000],
['20160418',694.7200],
['20160419',700.9400],
['20160420',700.2200],
['20160421',707.9500],
['20160422',707.2100],
['20160425',699.8200],
['20160426',697.7100],
['20160427',695.1100],
['20160428',699.3100],
['20160429',696.7800],
['20160503',691.8000],
['20160504',680.9800],
['20160505',679.5400],
['20160506',676.6200],
['20160509',674.9200],
['20160510',678.0500],
['20160511',677.1300],
['20160512',674.8100],
['20160513',671.6700],
['20160516',670.9800],
['20160517',675.7600],
['20160518',674.0200],
['20160519',666.7600],
['20160520',671.1300],
['20160523',670.5700],
['20160524',668.3300],
['20160525',669.3800],
['20160526',671.1900],
['20160527',674.6500],
['20160530',673.4800],
['20160531',676.9700],
['20160601',675.2900],
['20160602',675.9600],
['20160603',675.6900],
['20160606',673.8200],
['20160607',677.9900],
['20160608',680.7400],
['20160609',679.2800],
['20160610',675.5200],
['20160613',667.6600],
['20160614',667.5400],
['20160615',667.3300],
['20160616',661.6400],
['20160617',660.9500],
['20160620',665.2000],
['20160621',663.2500],
['20160622',662.1700],
['20160623',660.5300],
['20160624',653.1800],
['20160627',653.4600],
['20160628',663.9600],
['20160629',666.8000],
['20160630',673.6500],
['20160701',677.2200],
['20160704',684.2500],
['20160705',684.4400],
['20160707',684.9500],
['20160708',680.2100],
['20160711',682.4400],
['20160712',689.4900],
['20160713',690.7000],
['20160714',689.3100],
['20160715',690.9600],
['20160718',691.6300],
['20160719',685.8500],
['20160720',688.5200],
['20160721',691.1800],
['20160722',685.3800],
['20160725',684.0400],
['20160726',684.6200],
['20160727',685.8500],
['20160728',686.7200],
['20160729',680.4200],
['20160801',683.3100],
['20160802',674.7900],
['20160803',674.5400],
['20160804',676.6500],
['20160805',679.9200],
['20160808',680.0500],
['20160810',683.9300],
['20160811',684.5600],
['20160812',685.1800],
['20160815',684.7900],
['20160816',687.0700],
['20160817',685.1600],
['20160818',683.4700],
['20160819',685.9700],
['20160822',682.9400],
['20160823',683.8700],
['20160824',686.8800],
['20160825',683.8200],
['20160826',680.8700],
['20160830',678.5500],
['20160831',677.2100],
['20160901',677.8900],
['20160902',677.9100],
['20160905',686.1400],
['20160906',694.7200],
['20160907',693.9500],
['20160908',696.3500],
['20160909',692.7800],
['20160913',681.4400],
['20160914',680.1900],
['20160915',678.7000],
['20160916',682.2400],
['20160919',683.6800],
['20160920',684.6700],
['20160921',685.5000],
['20160922',689.3900],
['20160923',689.7000],
['20160926',687.4000],
['20160927',690.2600],
['20160928',693.4600],
['20160929',696.3500],
['20160930',693.3200],
['20161003',696.2900],
['20161004',699.5100],
['20161005',702.2700],
['20161006',703.8300],
['20161007',700.9900],
['20161010',702.0300],
['20161011',698.3800],
['20161012',687.3000],
['20161013',687.5000],
['20161014',692.6900],
['20161017',690.5500],
['20161018',692.8900],
['20161019',694.6700],
['20161020',694.6800],
['20161021',693.3300],
['20161024',695.6000],
['20161025',696.9800],
['20161026',689.4900],
['20161027',694.3300],
['20161028',690.2800],
['20161031',690.3300],
['20161101',689.9800],
['20161102',685.1700],
['20161103',685.8400],
['20161104',678.9400],
['20161107',682.9200],
['20161108',689.5400],
['20161109',687.7400],
['20161110',693.4000],
['20161111',683.4900],
['20161114',673.8300],
['20161115',672.0300],
['20161116',674.1800],
['20161117',680.5700],
['20161118',679.9400],
['20161121',673.1100],
['20161122',674.4400],
['20161123',677.7200],
['20161124',677.9800],
['20161125',684.6100],
['20161128',682.8600],
['20161129',682.4200],
['20161130',684.5200],
['20161201',684.5500],
['20161202',683.3000],
['20161205',689.2800],
['20161206',688.8600],
['20161207',689.9100],
['20161208',692.8000],
['20161209',692.5800],
['20161212',690.0000],
['20161213',690.5200],
['20161214',689.4200],
['20161215',681.8600],
['20161216',684.1400],
['20161219',679.5900],
['20161220',678.9600],
['20161221',676.7600],
['20161222',672.0500],
['20161223',668.4200],
['20161228',675.8200],
['20161229',675.0400],
['20161230',678.8900],
['20170103',682.9900],
['20170104',687.1400],
['20170105',690.1100],
['20170106',694.2000],
['20170109',696.8100],
['20170110',700.4400],
['20170111',702.4400],
['20170112',699.4300],
['20170113',700.7400],
['20170116',695.5000],
['20170117',696.1500],
['20170118',697.2900],
['20170119',699.0500],
['20170120',698.3800],
['20170123',700.9100],
['20170124',703.3800],
['20170125',699.2700],
['20170126',701.3700],
['20170127',703.4600],
['20170131',701.6500],
['20170201',704.1800],
['20170202',701.1500],
['20170203',702.5900],
['20170206',702.7100],
['20170207',704.8600],
['20170208',705.3000],
['20170209',709.9300],
['20170210',712.5300],
['20170213',712.7100],
['20170214',715.0400],
['20170215',717.1000],
['20170216',714.8300],
['20170217',712.3000],
['20170220',710.4000],
['20170221',711.2000],
['20170222',715.3100],
['20170223',723.7200],
['20170224',713.2100],
['20170227',711.1100],
['20170228',713.7900],
['20170301',715.7300],
['20170302',718.7600],
['20170303',720.8200],
['20170306',720.2300],
['20170307',723.3800],
['20170308',723.2000],
['20170309',716.9600],
['20170310',720.7400],
['20170313',722.5800],
['20170314',720.7700],
['20170315',720.1200],
['20170316',724.1200],
['20170317',724.1200],
['20170320',722.0900],
['20170321',721.2500],
['20170322',716.8800],
['20170323',718.3800],
['20170324',722.7000],
['20170327',720.1000],
['20170328',727.5800],
['20170329',730.7800],
['20170330',732.6200],
['20170331',732.1900],
['20170403',735.2200],
['20170404',736.9200],
['20170405',736.9300],
['20170406',734.0500],
['20170407',736.2100],
['20170410',734.7000],
['20170411',734.4400],
['20170412',735.5600],
['20170413',734.4400],
['20170417',728.8500],
['20170418',729.3700],
['20170419',727.8400],
['20170420',726.9000],
['20170421',728.2100],
['20170424',726.6300],
['20170425',731.1000],
['20170426',735.3500],
['20170427',737.9400],
['20170428',737.6200],
['20170502',740.5400],
['20170503',735.6000],
['20170504',738.7400],
['20170505',736.2900],
['20170508',740.5500],
['20170509',740.7500],
['20170511',736.6100],
['20170512',732.2100],
['20170515',728.3800],
['20170516',725.1400],
['20170517',726.5500],
['20170518',724.2600],
['20170519',726.5100],
['20170522',724.4400],
['20170523',725.3900],
['20170524',727.7400],
['20170525',727.9500],
['20170526',724.3000],
['20170529',724.7100],
['20170530',724.6400],
['20170531',726.2200],
['20170601',729.0400],
['20170602',731.6500],
['20170605',730.7100],
['20170606',728.5400],
['20170607',729.8300],
['20170608',729.9200],
['20170609',730.8000],
['20170612',730.3400],
['20170613',733.4200],
['20170614',733.0600],
['20170615',732.9900],
['20170616',731.9300],
['20170619',736.1400],
['20170620',735.4100],
['20170621',731.9500],
['20170622',733.8700],
['20170623',731.2100],
['20170627',733.9100],
['20170628',731.8800],
['20170629',737.9200],
['20170630',732.7600],
['20170703',733.2800],
['20170704',730.5000],
['20170705',734.4700],
['20170706',732.8200],
['20170707',731.5600],
['20170710',734.1000],
['20170711',731.8000],
['20170712',728.6600],
['20170713',731.4600],
['20170714',737.1700],
['20170717',738.7800],
['20170718',738.8500],
['20170719',742.9800],
['20170720',739.1000],
['20170721',742.4800],
['20170724',741.8700],
['20170725',742.6100],
['20170726',742.0100],
['20170727',739.4900],
['20170728',734.2600],
['20170731',739.0200],
['20170801',737.0500],
['20170802',739.9900],
['20170803',738.9500],
['20170804',737.7900],
['20170807',738.0100],
['20170808',742.7000],
['20170810',741.5600],
['20170811',735.0700],
['20170814',738.3400],
['20170815',737.7800],
['20170816',736.2200],
['20170817',736.0800],
['20170818',734.5700],
['20170821',732.5200],
['20170822',735.1700],
['20170823',741.0300],
['20170824',737.3000],
['20170825',734.9300],
['20170829',738.1500],
['20170830',740.8000],
['20170831',739.3800],
['20170904',731.8600],
['20170905',733.9400],
['20170906',729.8200],
['20170907',727.6100],
['20170908',729.6100],
['20170911',728.2800],
['20170912',728.9600],
['20170913',734.2400],
['20170914',730.6300],
['20170915',730.7600],
['20170918',731.9000],
['20170919',728.5100],
['20170920',728.6600],
['20170921',728.9000],
['20170922',727.7000],
['20170925',727.7000],
['20170926',727.7500],
['20170927',730.6900],
['20170928',731.4900],
['20170929',733.9400],
['20171002',738.5500],
['20171003',734.9500],
['20171004',734.9400],
['20171005',736.9000],
['20171006',739.5600],
['20171009',742.4700],
['20171010',743.8200],
['20171011',741.9500],
['20171012',743.1100],
['20171013',748.4300],
['20171016',749.3300],
['20171017',749.7700],
['20171019',747.4800],
['20171020',750.5400],
['20171023',754.7600],
['20171024',752.7000],
['20171025',754.7400],
['20171026',753.9300],
['20171027',753.4700],
['20171030',753.4700],
['20171031',757.0700],
['20171101',762.1300],
['20171102',759.3700],
['20171103',759.2800],
['20171106',766.1000],
['20171107',766.4600],
['20171108',763.8500],
['20171109',763.7200],
['20171110',767.6600],
['20171113',771.5600],
['20171114',767.8800],
['20171115',763.8700],
['20171116',759.2200],
['20171117',764.6500],
['20171120',764.7900],
['20171121',766.6300],
['20171122',765.4100],
['20171123',762.3600],
['20171124',764.8100],
['20171127',766.0600],
['20171128',762.8900],
['20171129',762.2700],
['20171130',767.0100],
['20171201',764.6500],
['20171204',762.3200],
['20171205',760.9900],
['20171206',756.4800],
['20171207',754.0200],
['20171208',758.3600],
['20171211',763.4000],
['20171212',766.3000],
['20171213',762.1700],
['20171214',761.9800],
['20171215',762.2200],
['20171218',763.1400],
['20171219',765.3700],
['20171220',764.2900],
['20171221',762.4700],
['20171222',763.6100],
['20171227',765.0300],
['20171228',768.3900],
['20171229',767.0400],
['20180102',778.0800],
['20180103',783.1900],
['20180104',787.3900],
['20180105',785.4200],
['20180108',786.0500],
['20180109',787.6800],
['20180110',789.2600],
['20180111',786.8500],
['20180112',791.3800],
['20180115',791.1200],
['20180116',793.3600],
['20180117',795.7400],
['20180118',796.0100],
['20180119',808.7400],
['20180122',808.0900],
['20180123',810.8100],
['20180124',810.6700],
['20180125',807.0200],
['20180126',805.4100],
['20180129',806.7400],
['20180130',801.1800],
['20180131',801.6700],
['20180201',801.3000],
['20180202',796.1000],
['20180205',784.9600],
['20180206',767.3300],
['20180207',768.9200],
['20180208',765.6700],
['20180209',752.3300],
['20180212',750.5600],
['20180213',754.3700],
['20180214',752.9000],
['20180215',758.4900],
['20180219',769.8200],
['20180220',766.5500],
['20180221',771.6300],
['20180222',760.4800],
['20180223',766.2100],
['20180226',771.8300],
['20180227',772.3900],
['20180228',771.7600],
['20180301',762.5800],
['20180302',759.9800],
['20180305',751.2600],
['20180306',754.9600],
['20180307',754.5100],
['20180308',759.5400],
['20180309',760.9900],
['20180312',768.6000],
['20180313',769.1800],
['20180314',764.4300],
['20180315',761.2200],
['20180316',765.4200],
['20180319',762.3700],
['20180320',761.2900],
['20180321',761.1400],
['20180322',760.4100],
['20180323',750.7600],
['20180326',751.4000],
['20180327',754.8600],
['20180328',747.2000],
['20180329',753.6200],
['20180402',754.7000],
['20180403',750.4500],
['20180404',740.4500],
['20180405',749.0000],
['20180406',752.2400],
['20180409',752.6900],
['20180410',756.3100],
['20180411',759.5500],
['20180412',759.7200],
['20180413',763.8100],
['20180416',760.9700],
['20180417',758.4900],
['20180418',766.8200],
['20180419',773.0400],
['20180420',768.5000],
['20180423',768.3500],
['20180424',766.8900],
['20180425',763.9100],
['20180426',765.4100],
['20180427',769.3300],
['20180430',772.3700],
['20180502',773.0300],
['20180503',766.6100],
['20180504',763.6300],
['20180507',762.8000],
['20180508',764.6500],
['20180509',767.8300],
['20180510',769.4900],
['20180511',771.6500],
['20180514',770.4300],
['20180515',766.1200],
['20180516',760.6300],
['20180517',763.2300],
['20180518',759.7300],
['20180521',760.2200],
['20180522',758.4700],
['20180523',747.7500],
['20180524',755.2600],
['20180525',753.5500],
['20180528',751.8600],
['20180530',744.5100],
['20180531',741.1100],
['20180601',742.5800],
['20180604',747.0100],
['20180605',747.5800],
['20180606',747.6200],
['20180607',746.6800],
['20180608',742.0900],
['20180611',739.6300],
['20180612',737.3700],
['20180613',735.6400],
['20180614',726.4300],
['20180618',719.4100],
['20180619',713.9900],
['20180620',718.6200],
['20180621',710.5400],
['20180622',715.4300],
['20180625',709.8500],
['20180626',714.6200],
['20180627',713.0600],
['20180628',712.5600],
['20180629',716.2900],
['20180702',710.2400],
['20180703',712.4500],
['20180704',714.8300],
['20180705',717.1800],
['20180706',711.7000],
['20180709',719.1800],
['20180710',725.2500],
['20180711',721.0600],
['20180712',722.0800],
['20180713',726.3400],
['20180716',722.0900],
['20180717',724.7700],
['20180718',723.9600],
['20180719',732.5200],
['20180720',731.8500],
['20180723',733.0400],
['20180724',735.6000],
['20180725',737.1100],
['20180726',736.4300],
['20180727',735.2400],
['20180730',734.0100],
['20180731',732.3800],
['20180801',733.2600],
['20180802',726.4800],
['20180803',719.0300],
['20180806',718.9400],
['20180807',724.4200],
['20180808',726.5400],
['20180810',721.7900],
['20180813',718.3000],
['20180814',719.7100],
['20180815',720.1900],
['20180816',718.0600],
['20180817',718.4400],
['20180820',719.4700],
['20180821',721.6300],
['20180823',725.7700],
['20180824',722.5800],
['20180827',724.8000],
['20180828',726.9800],
['20180829',725.5400],
['20180830',723.2000],
['20180831',721.2900],
['20180903',722.9700],
['20180904',723.7700],
['20180905',719.2300],
['20180906',717.6900],
['20180907',714.5300],
['20180910',711.0100],
['20180911',711.7300],
['20180912',715.1000],
['20180913',713.1200],
['20180914',716.8300],
['20180917',713.9900],
['20180918',715.0100],
['20180919',720.5600],
['20180920',719.8300],
['20180921',722.5300],
['20180924',722.2800],
['20180925',726.1000],
['20180926',725.6700],
['20180927',729.0000],
['20180928',736.8600],
['20181001',738.6100],
['20181002',739.9900],
['20181003',742.7600],
['20181004',736.7500],
['20181005',729.7100],
['20181008',725.4100],
['20181009',726.4600],
['20181010',716.6500],
['20181011',699.6100],
['20181012',703.8500],
['20181015',700.3000],
['20181016',699.6000],
['20181017',707.5100],
['20181018',709.6800],
['20181019',702.6000],
['20181022',708.7700],
['20181023',701.8600],
['20181024',702.6800],
['20181025',700.3400],
['20181026',698.1600],
['20181029',698.7600],
['20181030',691.3100],
['20181031',698.8000],
['20181101',698.7700],
['20181102',705.4500],
['20181105',695.4500],
['20181107',703.1700],
['20181108',702.1000],
['20181109',697.6000],
['20181112',695.9600],
['20181113',693.1800],
['20181114',692.8000],
['20181115',690.9000],
['20181116',692.3200],
['20181119',691.6700],
['20181120',684.3400],
['20181121',685.9000],
['20181122',685.7200],
['20181123',686.8200],
['20181126',688.7500],
['20181127',687.7200],
['20181128',692.8300],
['20181129',696.5100],
['20181130',697.9500],
['20181203',708.7000],
['20181204',701.7400],
['20181205',702.7900],
['20181206',699.1700],
['20181207',697.1700],
['20181210',692.0000],
['20181211',692.1600],
['20181212',697.7600],
['20181213',699.1500],
['20181214',695.1900],
['20181217',696.3000],
['20181218',692.8600],
['20181219',694.6800],
['20181220',689.2200],
['20181221',688.0800],
['20181224',685.2800],
['20181227',680.4000],
['20181228',682.9600],
['20181231',684.6400],
['20190102',683.8700],
['20190103',681.1100],
['20190104',689.2400],
['20190107',694.8300],
['20190108',700.8300],
['20190109',705.6500],
['20190110',710.2700],
['20190111',712.4100],
['20190114',707.0300],
['20190115',714.1700],
['20190116',714.5200],
['20190117',714.0200],
['20190118',716.4300],
['20190121',718.3300],
['20190122',717.0900],
['20190123',713.9200],
['20190124',722.9000],
['20190125',728.5500],
['20190128',728.2600],
['20190129',726.5700],
['20190130',727.5100],
['20190131',732.2700],
['20190201',730.4200],
['20190204',730.1800],
['20190207',732.5600],
['20190208',733.1100],
['20190211',732.2300],
['20190212',730.5600],
['20190213',732.5000],
['20190214',733.5600],
['20190215',733.9900],
['20190218',735.5700],
['20190219',732.9400],
['20190220',738.9300],
['20190221',738.3700],
['20190222',742.6000],
['20190225',745.9900],
['20190226',747.6200],
['20190227',744.5100],
['20190228',742.1500],
['20190301',746.4800],
['20190304',753.0600],
['20190305',749.1300],
['20190306',751.4800],
['20190307',751.1700],
['20190308',743.7000],
['20190311',743.2300],
['20190312',748.2000],
['20190313',746.2800],
['20190314',747.9600],
['20190315',744.0300],
['20190318',748.4000],
['20190319',752.5200],
['20190320',751.9400],
['20190321',752.8400],
['20190322',755.5100],
['20190325',749.8300],
['20190326',755.4600],
['20190327',756.6100],
['20190328',757.7600],
['20190329',758.6400],
['20190401',766.6700],
['20190402',768.8200],
['20190403',767.1600],
['20190404',772.7300],
['20190405',772.2500],
['20190408',774.8900],
['20190409',777.4200],
['20190410',778.6400],
['20190411',776.7200],
['20190412',775.8100],
['20190415',774.7400],
['20190416',772.3400],
['20190417',770.9600],
['20190418',769.7700],
['20190422',770.5900],
['20190423',770.1100],
['20190424',773.5000],
['20190425',770.7300],
['20190426',768.2500],
['20190429',771.0700],
['20190430',766.7000],
['20190502',769.8400],
['20190503',769.4400],
['20190506',754.1200],
['20190507',761.0000],
['20190508',755.3000],
['20190509',748.8500],
['20190510',748.3600],
['20190513',744.5900],
['20190514',745.8100],
['20190515',743.8600],
['20190516',745.2700],
['20190517',740.2900],
['20190521',734.9600],
['20190522',735.1400],
['20190523',728.7400],
['20190524',732.1700],
['20190527',732.3000],
['20190528',734.3100],
['20190529',731.6200],
['20190530',729.9400],
['20190531',728.1600],
['20190603',728.1600],
['20190604',732.9600],
['20190606',740.0700],
['20190607',740.9900],
['20190610',744.1300],
['20190611',749.5900],
['20190612',752.0000],
['20190613',756.9000],
['20190614',757.2100],
['20190617',755.7400],
['20190618',760.1900],
['20190619',765.7700],
['20190620',770.4700],
['20190621',772.8200],
['20190624',773.9800],
['20190625',769.4800],
['20190626',769.9100],
['20190627',773.3200],
['20190628',773.7700],
['20190701',780.5000],
['20190702',780.1600],
['20190703',780.9600],
['20190704',784.2600],
['20190705',787.0700],
['20190708',784.7800],
['20190709',777.1500],
['20190710',776.6900],
['20190711',778.7400],
['20190712',776.5100],
['20190715',771.0100],
['20190716',774.9500],
['20190717',775.5000],
['20190718',776.2500],
['20190719',775.4800],
['20190722',769.6300],
['20190723',770.8700],
['20190724',768.6800],
['20190725',770.8400],
['20190726',768.6600],
['20190729',766.3600],
['20190730',768.1500],
['20190731',759.2700],
['20190801',755.0500],
['20190802',752.3800],
['20190805',742.4300],
['20190806',735.5700],
['20190807',734.3100],
['20190808',731.6000],
['20190813',730.7200],
['20190814',728.0000],
['20190815',723.1600],
['20190816',726.9600],
['20190819',732.2800],
['20190820',731.9400],
['20190821',732.5000],
['20190822',732.2100],
['20190823',726.9300],
['20190827',714.2400],
['20190828',713.1700],
['20190829',721.4800],
['20190830',725.4000],
['20190902',722.7200],
['20190903',721.9100],
['20190904',731.0300],
['20190905',732.4400],
['20190906',732.7600],
['20190909',731.8500],
['20190910',730.5800],
['20190911',736.0600],
['20190912',736.5200],
['20190913',742.0000],
['20190916',737.8200],
['20190917',736.4500],
['20190918',737.9700],
['20190919',741.6000],
['20190920',744.6400],
['20190923',738.1100],
['20190924',743.6600],
['20190925',739.9500],
['20190926',738.9200],
['20190927',734.9700],
['20190930',733.9100],
['20191001',738.6700],
['20191002',731.6000],
['20191003',732.7700],
['20191004',732.3000],
['20191007',733.2700],
['20191008',736.6000],
['20191009',736.9800],
['20191010',736.8600],
['20191011',741.0700],
['20191014',742.1000],
['20191015',741.3900],
['20191016',745.8500],
['20191017',745.3100],
['20191018',740.4800],
['20191021',747.2800],
['20191022',744.1300],
['20191023',745.3500],
['20191024',748.6700],
['20191025',749.1000],
['20191029',743.8800],
['20191030',744.2800],
['20191031',745.1700],
['20191101',748.5300],
['20191104',750.7700],
['20191105',754.3800],
['20191106',753.4400],
['20191107',756.8700],
['20191108',748.2400],
['20191111',736.1000],
['20191112',741.7700],
['20191113',741.6200],
['20191114',740.9200],
['20191115',743.5900],
['20191118',747.5700],
['20191119',747.0200],
['20191120',745.3100],
['20191121',737.5600],
['20191122',744.6800],
['20191125',744.2700],
['20191126',748.4500],
['20191127',747.6600],
['20191128',746.3400],
['20191129',744.5400],
['20191202',745.9600],
['20191203',743.1900],
['20191204',741.1400],
['20191205',747.0500],
['20191206',751.1200],
['20191209',747.7700],
['20191210',746.7800],
['20191211',746.1900],
['20191212',743.8700],
['20191213',743.9200],
['20191216',744.4300],
['20191217',741.9200],
['20191218',747.1800],
['20191219',745.6500],
['20191220',745.4600],
['20191223',747.7300],
['20191224',749.6900],
['20191227',756.6200],
['20191230',759.2000],
['20191231',758.3900],
['20200102',763.5700],
['20200103',760.3100],
['20200106',758.2700],
['20200107',764.8800],
['20200108',761.3000],
['20200109',763.9700],
['20200110',763.9300],
['20200113',764.1300],
['20200114',767.9900],
['20200115',768.6300],
['20200116',769.3700],
['20200117',771.1800],
['20200120',770.5900],
['20200121',764.1500],
['20200122',764.9500],
['20200123',762.6700],
['20200124',762.1300],
['20200128',745.7700],
['20200129',746.6700],
['20200130',746.0200],
['20200131',743.4400],
['20200203',735.6900],
['20200204',740.8500],
['20200205',748.9900],
['20200206',752.9100],
['20200207',743.2400],
['20200210',740.5700],
['20200211',744.5000],
['20200212',755.1500],
['20200213',756.2700],
['20200214',755.6100],
['20200217',752.8900],
['20200218',753.5700],
['20200219',758.9500],
['20200220',759.4100],
['20200221',754.4500],
['20200224',742.2700],
['20200225',741.1400],
['20200226',732.0000],
['20200227',727.0800],
['20200228',705.2200],
['20200302',706.5200],
['20200303',711.3100],
['20200304',723.4800],
['20200305',727.5800],
['20200306',721.2000],
['20200309',684.4800],
['20200310',698.3000],
['20200311',690.3100],
['20200312',655.8700],
['20200313',633.4900],
['20200316',581.7700],
['20200317',562.3200],
['20200318',552.8700],
['20200319',518.1300],
['20200320',541.0300],
['20200323',502.4500],
['20200324',533.1300],
['20200325',571.0700],
['20200326',569.0700],
['20200327',580.1700],
['20200330',564.9500],
['20200331',574.8500],
['20200401',560.6900],
['20200402',552.7600],
['20200403',535.0100],
['20200406',550.2800],
['20200407',582.0300],
['20200408',579.1500],
['20200409',590.9800],
['20200413',585.2200],
['20200414',604.4800],
['20200415',602.5100],
['20200416',606.1400],
['20200417',615.0100],
['20200420',617.8500],
['20200421',600.8000],
['20200422',601.3300],
['20200423',600.3700],
['20200424',593.5800],
['20200427',605.8500],
['20200428',610.2400],
['20200429',613.4300],
['20200430',628.8500],
['20200504',610.9000],
['20200505',616.0200],
['20200506',618.0200],
['20200508',615.5800],
['20200511',621.9000],
['20200512',616.0700],
['20200513',607.8300],
['20200514',599.0000],
['20200515',598.2900],
['20200518',605.7900],
['20200519',616.8200],
['20200520',617.5700],
['20200521',618.6300],
['20200522',609.0400],
['20200526',619.2500],
['20200527',619.6300],
['20200528',620.9700],
['20200529',629.3400],
['20200601',637.3000],
['20200602',646.6200],
['20200603',655.4600],
['20200604',654.9900],
['20200605',663.7800],
['20200608',670.7000],
['20200609',666.9000],
['20200610',671.2400],
['20200611',650.2600],
['20200612',644.5800],
['20200615',636.5400],
['20200616',652.3900],
['20200617',655.9900],
['20200618',656.5100],
['20200619',650.1700],
['20200622',647.4600],
['20200623',647.3100],
['20200624',647.7600],
['20200625',640.0400],
['20200626',642.0300],
['20200629',635.2600],
['20200630',632.5600],
['20200701',639.4000],
['20200702',643.0100],
['20200703',645.5900],
['20200706',655.1100],
['20200707',651.2000],
['20200708',651.4400],
['20200709',647.2100],
['20200713',645.1300],
['20200714',638.7000],
['20200715',640.9100],
['20200716',634.8400],
['20200717',637.2200],
['20200720',636.9200],
['20200721',643.3500],
['20200722',638.4200],
['20200723',647.0300],
['20200724',643.5000],
['20200727',639.7700],
['20200728',641.5500],
['20200729',643.6000],
['20200730',640.5000],
['20200803',633.6000],
['20200804',640.0400],
['20200805',649.9500],
['20200806',649.2300],
['20200807',644.3900],
['20200811',644.9200],
['20200812',645.6500],
['20200813',653.5600],
['20200814',648.5900],
['20200817',650.9800],
['20200818',652.4200],
['20200819',648.8800],
['20200820',643.7500],
['20200821',644.4600],
['20200824',646.6300],
['20200825',651.4500],
['20200826',654.3600],
['20200827',647.3600],
['20200828',649.4900],
['20200831',649.7800],
['20200901',649.1000],
['20200902',656.3500],
['20200903',653.6900],
['20200904',651.1100],
['20200907',653.1200],
['20200908',652.5500],
['20200909',654.9000],
['20200910',651.7800],
['20200911',650.8700],
['20200914',652.1500],
['20200915',657.5000],
['20200916',663.8200],
['20200917',666.4200],
['20200918',663.5000],
['20200921',656.1200],
['20200922',652.8200],
['20200923',658.9600],
['20200924',650.4100],
['20200925',651.8400],
['20200928',653.4000],
['20200929',652.2200],
['20200930',652.4200],
['20201001',657.7000],
['20201002',655.7400],
['20201005',656.8800],
['20201006',661.2500],
['20201007',659.7900],
['20201008',662.3800],
['20201009',659.1300],
['20201012',664.6700],
['20201013',667.3500],
['20201014',662.3800],
['20201015',659.9700],
['20201016',659.3900],
['20201019',659.6400],
['20201020',656.0400],
['20201021',656.8900],
['20201022',655.0200],
['20201023',655.6300],
['20201026',651.2300],
['20201027',649.4900],
['20201028',644.5500],
['20201029',636.2900],
['20201030',627.3200],
['20201102',626.7300],
['20201103',636.9500],
['20201104',642.8600],
['20201105',653.0400],
['20201106',647.5800],
['20201109',655.2800],
['20201110',658.5200],
['20201111',658.1900],
['20201112',658.1900],
['20201113',657.2200],
['20201116',669.5300],
['20201117',673.6900],
['20201118',673.9600],
['20201119',669.6200],
['20201120',681.9700],
['20201123',685.8500],
['20201124',703.5600],
['20201125',696.9900],
['20201126',698.8300],
['20201127',701.1000],
['20201130',687.2100],
['20201201',690.4300],
['20201202',685.2600]];
var source="www.sgx.com"
| 36,732
|
https://github.com/shamankingrokas/phase-0/blob/master/week-6/guessing-game/my_solution.rb
|
Github Open Source
|
Open Source
|
MIT
| 2,016
|
phase-0
|
shamankingrokas
|
Ruby
|
Code
| 367
| 836
|
# # Build a simple guessing game
# # I worked on this challenge [by myself, with: ].
# # I spent [#] hours on this challenge.
# # Pseudocode
# # Initial Solution
# class GuessingGame
# attr_reader :low
# attr_reader :high
# attr_reader :correct
# def initialize(answer)
# # Your initialization code goes here
# if answer < 0
# raise ArgumentError.new("Please enter a number greater than 1")
# end
# @answer = answer
# # @num_guessed = :num_guessed
# # @low = 0
# # @high = 10000
# end
# # Make sure you define the other required methods, too
# def guess(num_guessed)
# if num_guessed == @answer
# p :correct
# elsif num_guessed < :answer
# p :low
# else
# p :high
# end
# end
# def solved?
# if :guess == :answer
# return true
# else
# return false
# end
# end
# end
# # game = GuessingGame.new rand(100)
# # last_guess = nil
# # last_result = nil
# # until game.solved?
# # unless last_guess.nil?
# # puts "Oops! Your last guess (#{last_guess}) was #{last_result}."
# # puts ""
# # end
# # print "Enter your guess: "
# # last_guess = gets.chomp.to_i
# # last_result = game.guess(last_guess)
# # end
# # puts "#{last_guess} was correct!"
# game = GuessingGame.new(10)
# game.solved? # => false
# game.guess(5) # => :low
# game.guess(20) # => :high
# game.solved? # => false
# game.guess(10) # => :correct
# game.solved? # => true
# # Refactored Solution
class GuessingGame
attr_reader :answer, :guess, :high, :low, :correct
def initialize(answer)
@answer = answer
if answer < 0
raise ArgumentError.new("Please enter a number greater than 1")
end
end
def guess(num_guessed)
# create a guess
@guess = num_guessed
if num_guessed == @answer
p :correct
elsif num_guessed < @answer
p :low
else
p :high
end
end
def solved?
# is the guess the same as the answer
if @guess == @answer
return true
else
return false
end
end
end
game = GuessingGame.new(10)
p game.solved? # => false
game.guess(5) # => :low
game.guess(20) # => :high
game.solved? # => false
game.guess(10) # => :correct
p game.solved? # => true
# # Reflection
| 14,343
|
https://github.com/i-gaven/Just_a_dumper/blob/master/all_headers/QQ空间-杨洋代言全民社交平台-7.7.6(越狱应用)_headers/QzonePhotoManager_Feed.h
|
Github Open Source
|
Open Source
|
MIT
| 2,018
|
Just_a_dumper
|
i-gaven
|
Objective-C
|
Code
| 327
| 1,417
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <Foundation/NSObject.h>
#import "QzoneNewPhotoManagerDelegate-Protocol.h"
#import "QzonePhotoManager-Protocol.h"
@class NSDate, NSMutableArray, NSString, QzoneFeedModel, QzoneNewPhotoManager;
@protocol QzonePhotoManagerDelegate;
@interface QzonePhotoManager_Feed : NSObject <QzonePhotoManager, QzoneNewPhotoManagerDelegate>
{
NSMutableArray *_photoModelArray;
id _curData;
NSString *_picURL;
long long _picIndexOfTotal;
unsigned long long _picTotalCount;
_Bool _isExternalPic;
long long _failureCount;
_Bool _isPulling;
NSDate *_lastPullTime;
_Bool _hasGetPhotoList;
_Bool _allowShare;
QzoneNewPhotoManager *_photoManager;
_Bool _pullBatchMode;
_Bool _forbitBottomLayer;
_Bool _forbitPullPhoto;
_Bool _leftPullFinished;
_Bool _rightPullFinished;
_Bool _keepOriginalPhotos;
int _enterFrom;
id <QzonePhotoManagerDelegate> _delegate;
unsigned long long _centerPhotoIndex;
long long _uin;
NSString *_albumId;
NSString *_albumName;
NSString *_albumOwnerUin;
NSString *_albumOwnerNickname;
QzoneFeedModel *_feedModel;
QzoneFeedModel *_feedModel_raw;
}
@property(nonatomic) int enterFrom; // @synthesize enterFrom=_enterFrom;
@property(retain, nonatomic) QzoneFeedModel *feedModel_raw; // @synthesize feedModel_raw=_feedModel_raw;
@property(retain, nonatomic) QzoneFeedModel *feedModel; // @synthesize feedModel=_feedModel;
@property(retain, nonatomic) NSString *albumOwnerNickname; // @synthesize albumOwnerNickname=_albumOwnerNickname;
@property(retain, nonatomic) NSString *albumOwnerUin; // @synthesize albumOwnerUin=_albumOwnerUin;
@property(retain, nonatomic) NSString *albumName; // @synthesize albumName=_albumName;
@property(retain, nonatomic) NSString *albumId; // @synthesize albumId=_albumId;
@property(nonatomic) long long uin; // @synthesize uin=_uin;
@property(nonatomic) _Bool keepOriginalPhotos; // @synthesize keepOriginalPhotos=_keepOriginalPhotos;
@property(nonatomic) _Bool rightPullFinished; // @synthesize rightPullFinished=_rightPullFinished;
@property(nonatomic) _Bool leftPullFinished; // @synthesize leftPullFinished=_leftPullFinished;
@property(nonatomic) _Bool forbitPullPhoto; // @synthesize forbitPullPhoto=_forbitPullPhoto;
@property(nonatomic) _Bool forbitBottomLayer; // @synthesize forbitBottomLayer=_forbitBottomLayer;
@property(nonatomic) _Bool pullBatchMode; // @synthesize pullBatchMode=_pullBatchMode;
@property(nonatomic) unsigned long long centerPhotoIndex; // @synthesize centerPhotoIndex=_centerPhotoIndex;
@property(readonly, nonatomic) NSMutableArray *photoModelArray; // @synthesize photoModelArray=_photoModelArray;
@property(nonatomic) __weak id <QzonePhotoManagerDelegate> delegate; // @synthesize delegate=_delegate;
- (void).cxx_destruct;
- (void)didGetPhotoListFailure:(id)arg1;
- (void)didGetPhotoListSucceed:(id)arg1;
- (long long)calcCenterPhotoIndex:(id)arg1 matchURL:(id)arg2;
- (void)addIncrementallySmart:(id)arg1 hasLeft:(_Bool)arg2 hasRight:(_Bool)arg3;
- (void)reFillPhotoModel:(id)arg1 withModel:(id)arg2;
- (void)appendArrayToTail:(id)arg1;
- (void)appendArrayToHead:(id)arg1;
- (_Bool)isFakeFeed;
- (_Bool)hasGetPhotoList;
- (long long)failureCount;
- (id)lastPullTime;
- (_Bool)isPulling;
- (void)pullPhotoListMore_left;
- (void)pullPhotoListMore_right;
- (void)pullPhotoList;
- (void)smartPullPhotoList;
- (_Bool)needPullPhotoList;
- (long long)photoViewGetPicOperation;
- (id)realFeedModel;
- (long long)appid;
- (id)photoDesc:(id)arg1;
- (_Bool)photoPraised:(id)arg1;
- (unsigned long long)photoCommentCount:(id)arg1;
- (unsigned long long)photoPraiseCount:(id)arg1;
- (unsigned long long)centerPhotoNumber;
- (unsigned long long)totalPhotoCount;
- (id)centerPhotoModel;
- (void)extractPhotoModelArrayFromFeedModel:(id)arg1 itemImage:(id)arg2;
- (_Bool)checkPictureURL:(id)arg1;
- (id)init;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| 41,765
|
https://github.com/dhylands/upy-examples/blob/master/boot-msc.py
|
Github Open Source
|
Open Source
|
MIT
| 2,022
|
upy-examples
|
dhylands
|
Python
|
Code
| 115
| 373
|
# boot.py -- run on boot-up
#
# This is some common initialization that I like to keep around.
import pyb
import micropython
import sys
#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('CDC') # act as a serial only
pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
def bl():
pyb.bootloader()
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin)))
def af():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin.af_list())))
def init():
if True:
uart = pyb.UART(6,115200)
pyb.repl_uart(uart)
print("REPL is also on UART 6 (Y1=Tx Y2=Rx)")
if True:
bufsize = 100
print("Setting alloc_emergency_exception_buf to", bufsize)
micropython.alloc_emergency_exception_buf(bufsize)
init()
| 3,845
|
https://github.com/phaza/BaGet/blob/master/src/BaGet.Protocol/Registration/PackageMetadata.cs
|
Github Open Source
|
Open Source
|
MIT
| 2,018
|
BaGet
|
phaza
|
C#
|
Code
| 398
| 1,001
|
using System;
using System.Collections.Generic;
using BaGet.Protocol.Converters;
using Newtonsoft.Json;
using NuGet.Versioning;
namespace BaGet.Protocol
{
public class PackageMetadata
{
public PackageMetadata(
string catalogUri,
string packageId,
NuGetVersion version,
string authors,
string description,
long downloads,
bool hasReadme,
string iconUrl,
string language,
string licenseUrl,
bool listed,
string minClientVersion,
string packageContent,
string projectUrl,
string repositoryUrl,
string repositoryType,
DateTime published,
bool requireLicenseAcceptance,
string summary,
IReadOnlyList<string> tags,
string title,
IReadOnlyList<DependencyGroupItem> dependencyGroups)
{
CatalogUri = catalogUri ?? throw new ArgumentNullException(nameof(catalogUri));
PackageId = packageId;
Version = version;
Authors = authors;
Description = description;
Downloads = downloads;
HasReadme = hasReadme;
IconUrl = iconUrl;
Language = language;
LicenseUrl = licenseUrl;
Listed = listed;
MinClientVersion = minClientVersion;
PackageContent = packageContent;
ProjectUrl = projectUrl;
RepositoryUrl = repositoryUrl;
RepositoryType = repositoryType;
Published = published;
RequireLicenseAcceptance = requireLicenseAcceptance;
Summary = summary;
Tags = tags;
Title = title;
DependencyGroups = dependencyGroups;
}
[JsonProperty(PropertyName = "@id")]
public string CatalogUri { get; }
[JsonProperty(PropertyName = "id")]
public string PackageId { get; }
[JsonConverter(typeof(NuGetVersionConverter))]
public NuGetVersion Version { get; }
public string Authors { get; }
public string Description { get; }
public long Downloads { get; }
public bool HasReadme { get; }
public string IconUrl { get; }
public string Language { get; }
public string LicenseUrl { get; }
public bool Listed { get; }
public string MinClientVersion { get; }
public string PackageContent { get; }
public string ProjectUrl { get; }
public string RepositoryUrl { get; }
public string RepositoryType { get; }
public DateTime Published { get; }
public bool RequireLicenseAcceptance { get; }
public string Summary { get; }
public IReadOnlyList<string> Tags { get; }
public string Title { get; }
public IReadOnlyList<DependencyGroupItem> DependencyGroups { get; }
}
public class DependencyGroupItem
{
public DependencyGroupItem(
string id,
string targetFramework,
IReadOnlyList<DependencyItem> dependencies)
{
Id = id;
Type = "PackageDependencyGroup";
TargetFramework = targetFramework;
Dependencies = (dependencies?.Count > 0) ? dependencies : null;
}
[JsonProperty(PropertyName = "@id")]
public string Id { get; }
[JsonProperty(PropertyName = "@type")]
public string Type { get; }
public string TargetFramework { get; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public IReadOnlyList<DependencyItem> Dependencies { get; }
}
public class DependencyItem
{
[JsonProperty(PropertyName = "@id")]
public string DepId { get; }
[JsonProperty(PropertyName = "@type")]
public string Type { get; }
public string Id { get; }
public string Range { get; }
public DependencyItem(string depId, string id, string range)
{
DepId = depId;
Type = "PackageDependency";
Id = id;
Range = range;
}
}
}
| 17,581
|
https://github.com/Sefora-Code/svuotArmadio/blob/master/database/seeders/DatabaseSeeder.php
|
Github Open Source
|
Open Source
|
MIT
| null |
svuotArmadio
|
Sefora-Code
|
PHP
|
Code
| 37
| 220
|
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(RoleSeeder::class);
$this->call(SuperAdminSeeder::class);
$this->call(UserSeeder::class);
$this->call(PaymentTypeSeeder::class);
$this->call(OrderSeeder::class);
$this->call(OrderDetailSeeder::class);
$this->call(PaymentSeeder::class);
$this->call(VehicleTypesSeeder::class);
$this->call(VehiclesSeeder::class);
$this->call(EmployeeVehiclesSeeder::class);
}
}
| 8,123
|
https://github.com/WyTcorporation/yii2.shop.loc/blob/master/frontend/controllers/CartController.php
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| null |
yii2.shop.loc
|
WyTcorporation
|
PHP
|
Code
| 640
| 2,880
|
<?php
/**
* Created by PhpStorm.
* User: WyTcorp
* Date: 16.03.2020
* Time: 12:15
* Email: [email protected]
* Site : http://lockit.com.ua/
*/
namespace frontend\controllers;
use backend\models\np\NpCities;
use backend\models\np\NpRegion;
use backend\models\orders\Orders;
use backend\models\orders\OrdersItems;
use backend\models\translations\Content;
use backend\models\translations\Languages;
use backend\models\translations\Type;
use common\models\User;
use Yii;
use backend\models\products\Products;
use frontend\models\Cart;
use frontend\models\Order;
use frontend\models\OrderItems;
use yii\base\BaseObject;
use frontend\models\LiqPay;
class CartController extends AppController
{
public function actionAdd($id, $qty)
{
// $qty = (int)Yii::$app->request->get('qty');
$product = Products::findOne($id);
if (empty($product)) {
return false;
}
$session = Yii::$app->session;
$session->open();
$cart = new Cart();
$qty = !(int)$qty ? 1 : $qty;
$cart->AddToCart($product, $qty);
if (!Yii::$app->request->isAjax) {
return $this->redirect(Yii::$app->request->referrer);
}
$this->layout = false;
$language = Yii::$app->language;
return $this->render('cart-modal', compact('session', 'language'));
}
public function actionClear()
{
$session = Yii::$app->session;
$session->open();
$session->remove('cart');
$session->remove('cart.qty');
$session->remove('cart.sum');
$this->layout = false;
return $this->render('cart-modal', compact('session'));
}
public function actionDelItem($id)
{
$session = Yii::$app->session;
$session->open();
$cart = new Cart();
$cart->recalc($id);
$this->layout = false;
return $this->render('cart-modal', compact('session'));
}
public function actionShow()
{
$session = Yii::$app->session;
$session->open();
$this->layout = false;
return $this->render('cart-modal', compact('session'));
}
public function actionView()
{
$this->setMeta(null, null, null, 'Магазин | Корзина');
$language = Yii::$app->language;
$language_id = Languages::findOne(['code' => $language])->id;
$content_id = Content::findOne(['content' => 'name'])->id;
$type_id = Type::findOne(['type' => 'products'])->id;
$user_role = Yii::$app->user->identity->role;
$params = Yii::$app->params['languages'];
$user = User::findOne(Yii::$app->user->id);
$session = Yii::$app->session;
$session->open();
if (isset($session['cart']) && !empty($session['cart'])) {
$new_array = array_values($session['cart']);
$productList = null;
for ($x=0;$x<=count($new_array);$x++) {
if (isset($new_array[$x]) && !empty($new_array[$x])) {
$product = Products::findOne($new_array[$x]['id']);
$product->content_id = $content_id;
$product->language_id = $language_id;
$product->type_id = $type_id;
$name = $product->translation->content;
$productList['products'][$x]['id'] = $product->id;
$productList['products'][$x]['name'] = $name;
$productList['products'][$x]['price'] = $new_array[$x]['price'];
$productList['products'][$x]['qty'] = $new_array[$x]['qty'];
$productList['products'][$x]['img'] = $product->img;
$productList['products'][$x]['slug'] = $product->slug;
}
}
$productList['cart.qty'] = $session['cart.qty'];
$productList['cart.sum'] = $session['cart.sum'];
}
$order = new Orders();
if (Yii::$app->request->isPjax) {
if ($order->load(Yii::$app->request->post())) {
$products = Yii::$app->request->post('Products');
$orders = Yii::$app->request->post('Orders');
if(!isset($orders['user_id'])) {
$order->user_id = 2;
} else {
$order->user_id = $user->id;
}
$shipping_method = Yii::$app->request->post('shipping_method');
// $getRegions = Yii::$app->request->post('getRegions');
// $getCities = Yii::$app->request->post('getCities');
$getWarehouses = Yii::$app->request->post('getWarehouses');
if(isset($getWarehouses)) {
$order->address = $getWarehouses;
}
if ($shipping_method == 'pickup.pickup') {
$order->shipping = 1;
} elseif ($shipping_method == 'npradio') {
$order->shipping = 2;
}
//Убрать после проверки liqpay
$order->sum = 1;
if ($order->save()) {
$this->saveOrderItems($products, $order->id);
Yii::$app->session->setFlash('success', Yii::t('frontend/flash', 'Your order is accepted'));
Yii::$app->mailer->compose('order', ['session' => $session])
->setFrom(['[email protected]' => 'name'])
->setTo('[email protected]')
->setSubject('Заказ')
->setTextBody('Текст сообщения')
->setHtmlBody('<b>текст сообщения в формате HTML</b>')
->send();
if ($orders['payment'] == 1){
$order_id = $order->id;
} else {
return $this->redirect('thanks');
}
} else {
Yii::$app->session->setFlash('error', Yii::t('frontend/flash', 'Order placement error'));
}
}
}
return $this->render('view', compact(
'session',
'order',
'user',
'order_id',
'productList'
));
}
protected function saveOrderItems($items, $order_id)
{
$language = Yii::$app->language;
for ($x = 0; $x <= count($items); $x++) {
if (isset($items[$x]) && !empty($items[$x])) {
$id = $items[$x]['id'];
$qty = $items[$x]['qty'];
$product = Products::findOne($id);
$language_id = Languages::findOne(['code' => $language])->id;
$content_id = Content::findOne(['content' => 'name'])->id;
$type_id = Type::findOne(['type' => 'products'])->id;
$product->content_id = $content_id;
$product->language_id = $language_id;
$product->type_id = $type_id;
$name = $product->translation->content;;
$order_item = new OrdersItems();
$order_item->order_id = $order_id;
$order_item->product_id = $id;
$order_item->name = $name;
$order_item->img = $product->img;
$order_item->slug = $product->slug;
$order_item->price = $product->price;
$order_item->qty_item = $qty;
$order_item->sum_item = $qty * $product->price;
$order_item->save();
}
}
}
public function actionPayment($id)
{
$public_key = Yii::$app->params['liqpay_public_key'];
$private_key = Yii::$app->params['liqpay_private_key'];
$result_url = Yii::$app->params['liqpay_result_url'];
$server_url = Yii::$app->params['liqpay_server_url'];
$language = Yii::$app->language;
$order = Orders::findOne($id);
$liqpay = new LiqPay($public_key, $private_key);
$html = $liqpay->cnb_form(array(
'action' => 'pay',
'amount' => $order->sum,
'currency' => 'UAH',
'language' => $language,
'description' => 'Покупка № ' . $order->id,
'order_id' => $order->id,
'version' => '3',
'paytypes' => 'card',
'result_url' => $result_url,
//'server_url' => $server_url,
));
$array = array(
'action' => 'pay',
'amount' => $order->sum,
'currency' => 'UAH',
'public_key' => $public_key,
'language' => $language,
'description' => 'Покупка № ' . $order->id,
'order_id' => $order->id,
'version' => '3',
'paytypes' => 'card',
'result_url' => $result_url,
//'server_url' => $server_url,
);
$data = base64_encode(json_encode($array));;
$signature = $liqpay->cnb_signature($array);
$this->layout = false;
return $this->render('payment', compact('order', 'html', 'data', 'signature'));
}
public function actionThanks()
{
$language = Yii::$app->language;
$session = Yii::$app->session;
$session->open();
$session->remove('cart');
$session->remove('cart.qty');
$session->remove('cart.sum');
$this->setMeta(null, null, null, 'Магазин | Спасибо');
return $this->render('thanks');
}
}
| 18,678
|
https://github.com/akoeplinger/roslyn/blob/master/src/Interactive/EditorFeatures/VisualBasic/Interactive/VisualBasicRepl.vb
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
roslyn
|
akoeplinger
|
Visual Basic
|
Code
| 103
| 340
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Interactive
Imports Microsoft.CodeAnalysis.Scripting
Imports Microsoft.CodeAnalysis.Scripting.VisualBasic
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Interactive
Friend Class VisualBasicRepl
Implements IRepl
Public Sub New()
End Sub
Public Function CreateObjectFormatter() As ObjectFormatter Implements IRepl.CreateObjectFormatter
Return VisualBasicObjectFormatter.Instance
End Function
Public Function CreateScript(code As String) As Script Implements IRepl.CreateScript
Return VisualBasicScript.Create(code)
End Function
Public Function GetLogo() As String Implements IRepl.GetLogo
Return String.Format(VBInteractiveEditorResources.VBReplLogo,
FileVersionInfo.GetVersionInfo(GetType(VisualBasicCommandLineArguments).Assembly.Location).FileVersion)
End Function
Public Function GetCommandLineParser() As CommandLineParser Implements IRepl.GetCommandLineParser
Return VisualBasicCommandLineParser.Interactive
End Function
Public Function GetDiagnosticFormatter() As DiagnosticFormatter Implements IRepl.GetDiagnosticFormatter
Return VisualBasicDiagnosticFormatter.Instance
End Function
End Class
End Namespace
| 10,307
|
https://github.com/reactivespace/Steemit-Fork-2.0/blob/master/python_scripts/tests/api_tests/list_account.py
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
Steemit-Fork-2.0
|
reactivespace
|
Python
|
Code
| 217
| 600
|
#!/usr/bin/env python3
"""
Create list of all clout accounts in file.
Usage: create_account_list.py <server_address> [<output_filename>]
"""
import sys
import json
from jsonsocket import JSONSocket
from jsonsocket import cloutd_call
def list_accounts(url):
"""
url in form <ip_address>:<port>
"""
last_account = ""
end = False
accounts_count = 0
accounts = []
while end == False:
request = bytes( json.dumps( {
"jsonrpc": "2.0",
"id": 0,
"method": "database_api.list_accounts",
"params": { "start": last_account, "limit": 1000, "order": "by_name" }
} ), "utf-8" ) + b"\r\n"
status, response = cloutd_call(url, data=request)
if status == False:
print( "rpc failed for last_account: " + last_account )
return []
account_list = response["result"]["accounts"]
if last_account != "":
assert account_list[0]["name"] == last_account
del account_list[0]
if len( account_list ) == 0:
end = True
continue
last_account = account_list[-1]["name"]
accounts_count += len( accounts )
for account in account_list:
accounts.append( account["name"] )
# while end == False
return accounts
def main():
if len( sys.argv ) < 2 or len( sys.argv ) > 3:
exit( "Usage: create_account_list.py <server_address> [<output_filename>]" )
url = sys.argv[1]
print( url )
accounts = list_accounts( url )
if len(accounts) == 0:
exit(-1)
if len( sys.argv ) == 3:
filename = sys.argv[2]
try: file = open( filename, "w" )
except: exit( "Cannot open file " + filename )
for account in accounts:
file.write(account + "\n")
file.close()
if __name__ == "__main__":
main()
| 297
|
https://github.com/viniciusdacal/generator-angular-rockr/blob/master/test/template/mock-model.js
|
Github Open Source
|
Open Source
|
MIT
| null |
generator-angular-rockr
|
viniciusdacal
|
JavaScript
|
Code
| 70
| 269
|
'use strict';
require('yeoman-generator');
var _ = require('lodash');
var mockPrompts = require('../../app/src/mock-prompts');
module.exports = function () {
var props = _.extend(_.cloneDeep(mockPrompts.defaults), {
paths: {
src: null,
tmp: null,
e2e: null,
dist: null
}
});
return _.cloneDeep({
appName: null,
props: props,
computedPaths: {
pathToBower: null
},
modulesDependencies: null,
angularModulesObject: {},
routerHtml: null,
routerJs: null,
isVendorStylesPreprocessed: false,
watchTaskDeps: [],
wiredepExclusions: [],
processedFileExtension: null,
includeModernizr: false,
imageMin: false,
qrCode: false,
bowerOverrides: null
});
};
| 45,648
|
https://github.com/mapr-demos/mapr-streams-sample-programs/blob/master/src/main/java/com/mapr/examples/Run.java
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,022
|
mapr-streams-sample-programs
|
mapr-demos
|
Java
|
Code
| 87
| 211
|
package com.mapr.examples;
import java.io.IOException;
/**
* Pick whether we want to run as producer or consumer. This lets us
* have a single executable as a build target.
*/
public class Run {
public static void main(String[] args) throws IOException {
if (args.length < 1) {
throw new IllegalArgumentException("Must have either 'producer', 'consumer' or 'dbconsumer' as argument");
}
switch (args[0]) {
case "producer":
Producer.main(args);
break;
case "consumer":
Consumer.main(args);
break;
case "dbconsumer":
DBConsumer.main(args);
break;
default:
throw new IllegalArgumentException("Don't know how to do " + args[0]);
}
}
}
| 44,937
|
https://github.com/durulhoda/aims2017/blob/master/aims_sms_system/controllers/systemaccess/Expensesadd.php
|
Github Open Source
|
Open Source
|
MIT
| null |
aims2017
|
durulhoda
|
PHP
|
Code
| 51
| 164
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* Project Name: Aims
* Author: Adventure Soft
* Author url: http://www.adventure-soft.com
*/
class Expensesadd extends MY_Controller{
public function __construct() {
parent::__construct();
$this->my_admin();
}
public function index(){
$this->load->view('templates/admin/expensesadd/index');
}
public function insertExpensesadd(){
print_r($_POST);
}
//put your code here
}
?>
| 28,078
|
https://github.com/fengyinws/django_blog/blob/master/comment/migrations/0005_auto_20190503_1657.py
|
Github Open Source
|
Open Source
|
MIT
| null |
django_blog
|
fengyinws
|
Python
|
Code
| 54
| 295
|
# Generated by Django 2.1 on 2019-05-03 08:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comment', '0004_auto_20190502_2050'),
]
operations = [
migrations.AddField(
model_name='comment',
name='level',
field=models.PositiveIntegerField(default=0, editable=False),
preserve_default=False,
),
migrations.AddField(
model_name='comment',
name='lft',
field=models.PositiveIntegerField(default=0, editable=False),
preserve_default=False,
),
migrations.AddField(
model_name='comment',
name='rght',
field=models.PositiveIntegerField(default=0, editable=False),
preserve_default=False,
),
migrations.AddField(
model_name='comment',
name='tree_id',
field=models.PositiveIntegerField(db_index=True, default=0, editable=False),
preserve_default=False,
),
]
| 47,691
|
https://github.com/findy-network/findy-wrapper-go/blob/master/pool/dto.go
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
findy-wrapper-go
|
findy-network
|
Go
|
Code
| 29
| 59
|
package pool
// Config is pool creating config structure used by indy.
type Config struct {
// GenesisTxn is full filename of the genesis file.
GenesisTxn string `json:"genesis_txn,omitempty"`
}
| 49,670
|
https://github.com/nimasrn/book-managment-server/blob/master/src/books/dto/update.dto.ts
|
Github Open Source
|
Open Source
|
MIT
| null |
book-managment-server
|
nimasrn
|
TypeScript
|
Code
| 27
| 88
|
import { IsString, IsInt, IsOptional, IsObject, IsArray } from 'class-validator';
export class UpdateBookDto {
@IsString()
title: string;
@IsString()
ISBN: string;
@IsArray()
authors: string[];
@IsObject()
cover: string;
}
| 47,024
|
https://github.com/spring-based-solutions/repeat-read-stream-demo/blob/master/src/main/java/com/rjh/web/filter/InputStreamRequest.java
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| null |
repeat-read-stream-demo
|
spring-based-solutions
|
Java
|
Code
| 140
| 441
|
package com.rjh.web.filter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StreamUtils;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;
/**
* 支持重复读取流的请求
* @author Null
* @date 2019-12-26
*/
@Slf4j
public class InputStreamRequest extends HttpServletRequestWrapper {
/**
* 请求的body
*/
private byte[] requestBody;
/**
* Constructs a request object wrapping the given request.
*
* @param request The request to wrap
* @throws IllegalArgumentException if the request is null
*/
public InputStreamRequest(HttpServletRequest request) {
super(request);
try {
requestBody = StreamUtils.copyToByteArray(request.getInputStream());
} catch (IOException e) {
log.error("请求获取流失败",e);
}
}
@Override
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(requestBody);
return new ServletInputStream() {
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener listener) {
}
@Override
public int read() throws IOException {
return byteArrayInputStream.read();
}
};
}
}
| 20,900
|
https://github.com/onyonkaclifford/data-structures-and-algorithms/blob/master/data_structures/trees/tree.py
|
Github Open Source
|
Open Source
|
MIT
| null |
data-structures-and-algorithms
|
onyonkaclifford
|
Python
|
Code
| 2,011
| 4,616
|
from abc import ABC, abstractmethod
from typing import Any, Generator, Iterable, List, Union
class Empty(Exception):
pass
class Tree(ABC):
"""A tree is a hierarchical collection of nodes containing items, with each node having a unique parent and zero,
one or many children items. The topmost element in a non-empty tree, the root, has no parent. Tree vocabularies
include, but are not limited to:
1. Root - the topmost element in a non-empty tree, it has no parent
2. Leaf - a node with zero children
3. Siblings - nodes that share a parent node
4. Edge - a pair of nodes such the one is the parent of the other
5. Path - a collection of nodes such that any pair of adjacent nodes have a parent/child relationship
6. Height - number of edges between a node and it's furthest leaf
7. Depth - number of edges between a node and the root
8. Level - number of nodes in the path between a node and the root, inclusive of both the node itself and the root
9. Ordered tree - a tree with a meaningful organisation among its nodes such that its nodes can be arranged in a
linear manner from first to last
"""
class _Node:
def __init__(self, key, value, parent=None, children: Union[List, None] = None):
self.key = key
self.value = value
self.parent = parent
self.children = children if children is not None else []
class _Position:
"""A representation of the position of a node within a tree"""
def __init__(self, belongs_to, node):
self.__variables = {"belongs_to": belongs_to}
self.__node = node
def is_owned_by(self, owner):
"""Check whether position belongs to the tree, owner. Time complexity: O(1).
:param owner: object to check whether it's the owner of this position
:returns: True of the position is owned by the object passed, else False
"""
return owner is self.__variables["belongs_to"]
def manipulate_variables(self, owner, method: str, *params):
"""Manipulate member variables of this position. Methods of the owner list are the only ones that can call
this method. Time complexity: O(1).
:param owner: tree object that owns this position
:param method: method name of tree object that will manipulate the member variables of this position
:param params: extra optional parameters to pass to the method
:returns: the return value of the tree method whose name is passed
"""
if not self.is_owned_by(owner):
raise ValueError("Position doesn't belong to the passed owner")
return getattr(owner, method)(self.__variables, *params)
def manipulate_node(self, owner, method: str, *params):
"""Manipulate the node held by this position. Methods of the owner list are the only ones that can call
this method. Time complexity: O(1).
:param owner: tree object that owns this position
:param method: method name of tree object that will manipulate the node contained in this position
:param params: extra optional parameters to pass to the method
:returns: the return value of the tree method whose name is passed
"""
if not self.is_owned_by(owner):
raise ValueError("Position doesn't belong to the passed owner")
return getattr(owner, method)(self.__node, *params)
def get_data(self):
"""Return the data stored by the node held by this position. Time complexity: O(1).
:returns: data stored in node contained in this position
"""
return self.__node.key, self.__node.value
def __init__(self):
self._root: Union[Tree._Node, None] = None
self._length = 0
self.__generator: Union[Generator, None] = None
def __len__(self) -> int:
"""Return total number of items in tree
:return: count of items in tree
"""
return self._length
def __repr__(self) -> str:
"""Return a string representation of the tree
:return: the string representation of the tree
"""
def helper(current_position):
children = self.get_children(current_position)
num_of_children = len(children)
last_child_idx = num_of_children - 1
data_dict["string_data"] += f"{current_position.get_data()[0]}"
for i, j in enumerate(children):
data_dict["string_data"] += "(" if i == 0 else ", "
helper(j)
data_dict["string_data"] += ")" if i == last_child_idx else ""
if self.is_empty():
return ""
data_dict = {"string_data": ""}
helper(Tree._Position(self, self._root))
return data_dict["string_data"]
def __iter__(self) -> Iterable:
"""Return a tree iterable
:return: tree iterable
"""
return self
def __next__(self) -> _Position:
"""Return next position of tree iterator, implemented based on level-order traversal
:return: next position
:raises StopIteration: when the cursor denoting the current position surpasses the last position of the tree
"""
if self.__generator is None:
self.__generator = self.traverse_tree_level_order()
try:
next_position = next(self.__generator)
except StopIteration as e:
self.__generator = None
raise e
return next_position
@staticmethod
def _validate_node(node):
"""Helper function to check if the node passed is a tree node. Returns the node passed if the validation
passes, else raises a TypeError. Time complexity: O(1).
:param node: node to validate
:returns: the node passed if it passes validation
:raises TypeError: if the validation fails
"""
if not isinstance(node, Tree._Node):
raise TypeError("Not a tree node")
return node
@staticmethod
def _invalidate_position(variables):
"""Helper function to set the belongs_to key of a dictionary to None. Used to revoke the ownership of a
position by this tree. Time complexity: O(1).
:returns: the dictionary passed, with the belongs_to key set to None
"""
variables["belongs_to"] = None
return variables
def is_empty(self) -> bool:
"""Return True if tree is empty, else False. Time complexity: O(1).
:returns: True if tree is empty, else False
"""
return self._root is None
def is_root(self, position: _Position) -> bool:
"""Check if the passed position contains the root node. Time complexity: O(1).
:returns: True if the passed position holds the root node, else False
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
node = position.manipulate_node(self, "_validate_node")
return node.parent is None
def is_leaf(self, position: _Position) -> bool:
"""Check if the passed position contains a leaf. Time complexity: O(1).
:returns: True if the passed position holds a leaf node, else False
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
return len(self.get_children(position)) == 0
def get_root(self) -> Union[_Position, None]:
"""Return the root position. Time complexity: O(1).
:returns: the root position
"""
if self.is_empty():
return None
else:
return Tree._Position(self, self._root)
def get_parent(self, position: _Position) -> Union[_Position, None]:
"""Return the parent of the given position. Time complexity: O(1).
:param position: position containing the node whose parent is being sought
:returns: the position of parent of the node contained in the passed position. None if the position passed
contains the root node.
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
node = position.manipulate_node(self, "_validate_node")
if self.is_root(Tree._Position(self, node)):
return None
else:
return Tree._Position(self, node.parent)
def get_children(self, position: _Position) -> Union[List[_Position], None]:
"""Return the children of the given position. Time complexity: O(1).
:param position: position containing the node whose children are being sought
:returns: the positions of the children of the node contained in the passed position. None if the position has
no children.
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
node = position.manipulate_node(self, "_validate_node")
children = node.children
if children is None:
return None
else:
return [Tree._Position(self, i) for i in children if i is not None]
def get_siblings(self, position: _Position) -> Union[List[_Position], None]:
"""Return the siblings of the given position. Time complexity: O(1).
:param position: position containing the node whose children are being sought
:returns: the positions of the siblings of the node contained in the passed position
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
node = position.manipulate_node(self, "_validate_node")
parent = node.parent
if parent is None:
return []
return [Tree._Position(self, i) for i in parent.children if i is not node]
def get_height_of_node(self, position: _Position) -> int:
"""Return the number of edges between a node and the farthest leaf among its descendants. Time complexity:
O(n).
:param position: position containing the node whose height is being sought
:returns: the number of edges between a node and the farthest leaf among its descendants
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
if self.is_leaf(position):
return 0
return 1 + max(self.get_height_of_node(p) for p in self.get_children(position))
def get_height_of_tree(self) -> int:
"""Return the number of edges between the root node and the farthest leaf. Time complexity: O(n).
:returns: the number of edges between the root node and the farthest leaf
"""
if self.is_empty():
raise Empty("Tree is empty")
return self.get_height_of_node(Tree._Position(self, self._root))
def get_depth_of_node(self, position: _Position) -> int:
"""Return the number of edges between a node and the root. Time complexity: O(n).
:param position: position containing the node whose depth is being sought
:returns: the number of edges between a node and the root
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
if self.is_root(position):
return 0
return 1 + self.get_depth_of_node(self.get_parent(position))
def get_depth_of_tree(self) -> int:
"""Return the number of edges between the farthest leaf and the root. Time complexity: O(n).
:returns: the number of edges between the farthest leaf and the root
"""
return self.get_height_of_tree()
def get_level_of_node(self, position: _Position) -> int:
"""Return the number of nodes between a node and the root, inclusive of itself. Time complexity: O(n).
:param position: position containing the node whose level is being sought
:returns: the number of nodes between a node and the root, inclusive of itself
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
return 1 + self.get_depth_of_node(position)
def traverse_subtree_pre_order(self, position: _Position) -> Generator:
"""Pre-order traverse subtree whose root is the passed position and return a generator of the positions it
contains
:param position: position containing the node that's the root of the subtree to be traversed
:returns: a generator of the positions
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
yield position
for i in self.get_children(position):
for j in self.traverse_subtree_pre_order(i):
yield j
def traverse_tree_pre_order(self) -> Generator:
"""Pre-order traverse tree and return a generator of the positions it contains
:returns: a generator of the positions
"""
position = self.get_root()
if position is not None:
for i in self.traverse_subtree_pre_order(position):
yield i
def traverse_subtree_post_order(self, position: _Position) -> Generator:
"""Post-order traverse subtree whose root is the passed position and return a generator of the positions it
contains
:param position: position containing the node that's the root of the subtree to be traversed
:returns: a generator of the positions
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
for i in self.get_children(position):
for j in self.traverse_subtree_post_order(i):
yield j
yield position
def traverse_tree_post_order(self) -> Generator:
"""Post-order traverse tree and return a generator of the positions it contains
:returns: a generator of the positions
"""
position = self.get_root()
if position is not None:
for i in self.traverse_subtree_post_order(position):
yield i
def traverse_subtree_level_order(self, position: _Position) -> Generator:
"""Level-by-level traverse subtree whose root is the passed position and return a generator of the positions it
contains
:param position: position containing the node that's the root of the subtree to be traversed
:returns: a generator of the positions
"""
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
def helper(root_node, level):
if root_node is not None:
if level == 1:
yield Tree._Position(self, root_node)
elif level > 1:
for child in root_node.children:
for k in helper(child, level - 1):
yield k
node = position.manipulate_node(self, "_validate_node")
number_of_levels = self.get_height_of_node(position) + 1
for i in range(1, number_of_levels + 1):
for j in helper(node, i):
yield j
def traverse_tree_level_order(self) -> Generator:
"""Level-by-level traverse tree and return a generator of the positions it contains
:returns: a generator of the positions
"""
position = self.get_root()
if position is not None:
for i in self.traverse_subtree_level_order(position):
yield i
def delete(self, position: _Position) -> None:
"""Delete a value from the tree
:param position: position containing the node to be removed from the tree
"""
self._length -= 1
if not position.is_owned_by(self):
raise ValueError("Position doesn't belong to this tree")
def insert_node(node_to_insert, is_node_left_child, parent_node):
if node_to_insert is not None:
node_to_insert.parent = parent_node
if is_node_left_child is not None:
if is_node_left_child:
parent_node.children[0] = node_to_insert
else:
parent_node.children[1] = node_to_insert
def delete_node(node_to_delete, is_root):
parent = node_to_delete.parent
left = node_to_delete.children[0]
right = node_to_delete.children[1]
is_left_child = None if parent is None else node_to_delete.key < parent.key
if left is None:
insert_node(right, is_left_child, parent)
if is_root:
self._root = right
else:
current_node = left
right_child = current_node.children[1]
if right_child is None:
current_node.children[1] = right
insert_node(current_node, is_left_child, parent)
if is_root:
self._root = current_node
else:
new_node = Tree._Node(
right_child.key,
right_child.value,
children=[current_node, right],
)
insert_node(new_node, is_left_child, parent)
if is_root:
self._root = new_node
delete_node(right_child, False)
node = position.manipulate_node(self, "_validate_node")
is_root_node = self.is_root(position)
_ = position.manipulate_variables(self, "_invalidate_position")
delete_node(node, is_root_node)
@abstractmethod
def insert(self, key: Any, value: Any) -> None:
"""Insert a value into the tree
:param key: unique identifier of the item to be added to the tree
:param value: item to be added to the tree
"""
self._length += 1
| 46,795
|
https://github.com/Anguei/OI-Codes/blob/master/LuoguCodes/P1135.cpp
|
Github Open Source
|
Open Source
|
MIT
| null |
OI-Codes
|
Anguei
|
C++
|
Code
| 127
| 325
|
//【P1135】奇怪的电梯 - 洛谷 - Uk
#include <iostream>
#include <algorithm>
const int N = 200 + 5;
int n, a, b;
int k[N];
bool vis[N];
int ans = 2147483647;
void dfs(int now, int depth)
{
if (now == b)
{
ans = std::min(ans, depth);
return;
}
if (depth >= ans)
return;
vis[now] = true;
if (now + k[now] <= n and !vis[k[now] + now])
dfs(k[now] + now, depth + 1);
if (now - k[now] >= 1 and !vis[-k[now] + now])
dfs(-k[now] + now, depth + 1);
vis[now] = false;
}
int main()
{
std::cin >> n >> a >> b;
for (int i = 1; i <= n; ++i)
std::cin >> k[i];
dfs(a, 1);
std::cout << (ans ^ 2147483647 ? ans - 1 : -1) << std::endl;
}
| 21,001
|
https://github.com/hvy/models/blob/master/multi-label-classification/lib/eval_multi_label_classification.py
|
Github Open Source
|
Open Source
|
MIT
| 2,018
|
models
|
hvy
|
Python
|
Code
| 177
| 610
|
from __future__ import division
import numpy as np
from collections import defaultdict
from chainercv.evaluations import calc_detection_voc_ap
def eval_multi_label_classification(
pred_labels, pred_scores, gt_labels):
prec, rec = calc_multi_label_classification_prec_rec(
pred_labels, pred_scores, gt_labels)
ap = calc_detection_voc_ap(prec, rec)
return {'ap': ap, 'map': np.nanmean(ap)}
def calc_multi_label_classification_prec_rec(
pred_labels, pred_scores, gt_labels):
n_pos = defaultdict(int)
score = defaultdict(list)
match = defaultdict(list)
for pred_label, pred_score, gt_label in zip(
pred_labels, pred_scores, gt_labels):
indices = np.argsort(pred_label)
pred_label = pred_label[indices]
pred_score = pred_score[indices]
np.testing.assert_equal(
pred_label, np.arange(len(pred_label)))
n_class = pred_label.shape[0]
for lb in pred_label:
if lb in list(gt_label):
n_pos[lb] += 1
match[lb].append(1)
else:
match[lb].append(0)
score[lb].append(pred_score[lb])
n_class = max(n_pos.keys()) + 1
prec = [None] * n_class
rec = [None] * n_class
for l in n_pos.keys():
score_l = np.array(score[l])
match_l = np.array(match[l], dtype=np.int8)
order = score_l.argsort()[::-1]
match_l = match_l[order]
tp = np.cumsum(match_l == 1)
fp = np.cumsum(match_l == 0)
# If an element of fp + tp is 0,
# the corresponding element of prec[l] is nan.
prec[l] = tp / (fp + tp)
# If n_pos[l] is 0, rec[l] is None.
if n_pos[l] > 0:
rec[l] = tp / n_pos[l]
return prec, rec
| 41,846
|
https://github.com/gabriel84k/vanger/blob/master/resources/js/components/Footer/Footer.vue
|
Github Open Source
|
Open Source
|
MIT
| null |
vanger
|
gabriel84k
|
Vue
|
Code
| 40
| 182
|
<template>
<footer v-show="visible" class="footer">
<div v-show="visible" class="d-sm-flex justify-content-center justify-content-sm-between">
<span class="float-none float-sm-right d-block mt-1 mt-sm-0">
<img :src="imgLougemedia.path" alt="" class="footerimg">
</span>
</div>
</footer>
</template>
<script>
export default {
props:["visible"],
data() {
return {
imgLougemedia:{path:"/logo/Vanger/footer.jpeg"}, /* Vanger */
}
},
}
</script>
| 30,821
|
https://github.com/shaynjay/scaling-apps-with-kafka/blob/master/microservices/frontend/app.js
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,022
|
scaling-apps-with-kafka
|
shaynjay
|
JavaScript
|
Code
| 93
| 207
|
/*eslint-env node*/
//------------------------------------------------------------------------------
// node.js starter application for Bluemix
//------------------------------------------------------------------------------
// This application uses express as its web server
// for more info, see: http://expressjs.com
var express = require('express');
var app = express();
var port = process.env.PORT || 8090;
// serve the files out of ./public as our main files
app.use(express.static('.'));
const pino = require('pino-http')()
app.use(pino)
const logger = require('pino')()
// const child = logger.child({ a: 'property' })
// child.info('hello child!')
// start server on the specified port and binding host
app.listen(port);
logger.info('scaling apps with kafka, starting up on port: ' + port);
| 14,889
|
https://github.com/smajohusic/passlawl.js/blob/master/src/locale/en/verbs.js
|
Github Open Source
|
Open Source
|
MIT
| 2,016
|
passlawl.js
|
smajohusic
|
JavaScript
|
Code
| 51
| 265
|
'use strict';
module.exports = [
'bore',
'became',
'began',
'bit',
'broke',
'brought',
'caught',
'chose',
'came',
'did',
'drank',
'drove',
'ate',
'fell',
'felt',
'flew',
'froze',
'got',
'went',
'knew',
'laid',
'led',
'lent',
'lay',
'lost',
'rode',
'rang',
'rose',
'ran',
'said',
'saw',
'set',
'shook',
'sang',
'sank',
'sat',
'slept',
'spoke',
'stole',
'swam',
'took',
'threw',
'wore',
'won',
'wrote'
];
| 34,665
|
https://github.com/ygtfrdes/Program/blob/master/Engineering/boards/contiki/emma-node/contiki/tools/cooja/apps/avrora/src/avrora/Defaults.java
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| 2,019
|
Program
|
ygtfrdes
|
Java
|
Code
| 2,033
| 5,251
|
/**
* Copyright (c) 2004-2005, Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the University of California, Los Angeles nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package avrora;
import avrora.actions.*;
import avrora.arch.ArchitectureRegistry;
import avrora.core.Program;
import avrora.core.ProgramReader;
import avrora.monitors.*;
import avrora.sim.Simulation;
import avrora.sim.Simulator;
import avrora.sim.clock.ClockDomain;
import avrora.sim.mcu.*;
import avrora.sim.platform.*;
import avrora.sim.radio.*;
import avrora.sim.types.*;
import avrora.syntax.atmel.AtmelProgramReader;
import avrora.syntax.elf.ELFParser;
import avrora.syntax.objdump.*;
import avrora.syntax.raw.RAWReader;
import avrora.test.*;
//import avrora.test.sim.SimTestHarness;
import cck.help.*;
import cck.test.TestEngine;
import cck.text.StringUtil;
import cck.util.ClassMap;
import cck.util.Util;
import java.util.*;
/**
* The <code>Defaults</code> class contains the default mappings for microcontrollers, actions,
* input formats, constants, etc.
*
* @author Ben L. Titzer
*/
public class Defaults {
private static final HashMap mainCategories = new HashMap();
private static ClassMap microcontrollers;
private static ClassMap platforms;
private static ClassMap actions;
private static ClassMap inputs;
private static ClassMap harnessMap;
private static ClassMap monitorMap;
private static ClassMap simMap;
private static ClassMap topologies;
private static synchronized void addAll() {
addMicrocontrollers();
addPlatforms();
addActions();
addInputFormats();
addTestHarnesses();
addMonitors();
addSimulations();
addTopologies();
ArchitectureRegistry.addArchitectures();
}
private static synchronized void addMonitors() {
if (monitorMap == null) {
monitorMap = new ClassMap("Monitor", MonitorFactory.class);
//-- DEFAULT MONITORS AVAILABLE
monitorMap.addClass("calls", CallMonitor.class);
monitorMap.addClass("break", BreakMonitor.class);
monitorMap.addClass("c-print", PrintMonitor.class);
monitorMap.addClass("c-timer", TimerMonitor.class);
monitorMap.addClass("profile", ProfileMonitor.class);
monitorMap.addClass("memory", MemoryMonitor.class);
monitorMap.addClass("sleep", SleepMonitor.class);
monitorMap.addClass("leds", LEDMonitor.class);
monitorMap.addClass("stack", StackMonitor.class);
monitorMap.addClass("energy", EnergyMonitor.class);
monitorMap.addClass("interrupts", InterruptMonitor.class);
monitorMap.addClass("interactive", InteractiveMonitor.class);
monitorMap.addClass("trace", TraceMonitor.class);
monitorMap.addClass("energy-profile", EnergyProfiler.class);
monitorMap.addClass("packet", PacketMonitor.class);
monitorMap.addClass("gdb", GDBServer.class);
monitorMap.addClass("simperf", SimPerfMonitor.class);
monitorMap.addClass("serial", SerialMonitor.class);
monitorMap.addClass("spi", SPIMonitor.class);
monitorMap.addClass("call-time", CallTimeMonitor.class);
monitorMap.addClass("call-profile", CallTreeProfiler.class);
monitorMap.addClass("trip-time", TripTimeMonitor.class);
monitorMap.addClass("ioregs", IORegMonitor.class);
monitorMap.addClass("virgil", VirgilMonitor.class);
monitorMap.addClass("real-time", RealTimeMonitor.class);
monitorMap.addClass("sniffer", SnifferMonitor.class);
HelpCategory hc = new HelpCategory("monitors", "Help for the supported simulation monitors.");
hc.addOptionValueSection("SIMULATION MONITORS", "Avrora's simulator offers the ability to install execution " +
"monitors that instrument the program in order to study and analyze its behavior. The " +
"\"simulate\" action supports this option that allows a monitor class " +
"to be loaded which will instrument the program before it is run and then generate a report " +
"after the program has completed execution.", "-monitors", monitorMap);
addMainCategory(hc);
addSubCategories(monitorMap);
}
}
private static synchronized void addTestHarnesses() {
if (harnessMap == null) {
harnessMap = new ClassMap("Test Harness", TestEngine.Harness.class);
//-- DEFAULT TEST HARNESSES
// harnessMap.addClass("simulator", SimTestHarness.class);
harnessMap.addClass("simplifier", SimplifierTestHarness.class);
harnessMap.addClass("probes", ProbeTestHarness.class);
harnessMap.addClass("disassembler", DisassemblerTestHarness.class);
harnessMap.addClass("interrupt", InterruptTestHarness.class);
}
}
private static synchronized void addInputFormats() {
if (inputs == null) {
inputs = new ClassMap("Input Format", ProgramReader.class);
//-- DEFAULT INPUT FORMATS
inputs.addClass("auto", AutoProgramReader.class);
inputs.addClass("raw", RAWReader.class);
inputs.addClass("atmel", AtmelProgramReader.class);
inputs.addClass("objdump", ObjDumpProgramReader.class);
inputs.addClass("odpp", ObjDump2ProgramReader.class);
inputs.addClass("elf", ELFParser.class);
HelpCategory hc = new HelpCategory("inputs", "Help for the supported program input formats.");
hc.addOptionValueSection("INPUT FORMATS", "The input format of the program is specified with the \"-input\" " +
"option supplied at the command line. This input format is used by " +
"actions that operate on programs to determine how to interpret the " +
"input and build a program from the files specified. For example, the input format might " +
"be Atmel syntax, GAS syntax, or the output of a disassembler such as avr-objdump. Currently " +
"no binary formats are supported.", "-input", inputs);
addMainCategory(hc);
addSubCategories(inputs);
}
}
private static synchronized void addActions() {
if (actions == null) {
actions = new ClassMap("Action", Action.class);
//-- DEFAULT ACTIONS
actions.addClass("disassemble", DisassembleAction.class);
actions.addClass("simulate", SimAction.class);
actions.addClass("analyze-stack", AnalyzeStackAction.class);
actions.addClass("test", TestAction.class);
actions.addClass("cfg", CFGAction.class);
actions.addClass("isea", ISEAAction.class);
actions.addClass("odpp", ODPPAction.class);
actions.addClass("elf-dump", ELFDumpAction.class);
// plug in a new help category for actions accesible with "-help actions"
HelpCategory hc = new HelpCategory("actions", "Help for Avrora actions.");
hc.addOptionValueSection("ACTIONS", "Avrora accepts the \"-action\" command line option " +
"that you can use to select from the available functionality that Avrora " +
"provides. This action might be to assemble the file, " +
"print a listing, perform a simulation, or run an analysis tool. This " +
"flexibility allows this single frontend to select from multiple useful " +
"tools. The currently supported actions are given below.", "-action", actions);
addMainCategory(hc);
addSubCategories(actions);
}
}
private static synchronized void addSimulations() {
if (simMap == null) {
simMap = new ClassMap("Simulation", Simulation.class);
//-- DEFAULT ACTIONS
simMap.addClass("single", SingleSimulation.class);
simMap.addClass("sensor-network", SensorSimulation.class);
simMap.addClass("wired", WiredSimulation.class);
// plug in a new help category for simulations accesible with "-help simulations"
HelpCategory hc = new HelpCategory("simulations", "Help for supported simulation types.");
hc.addOptionValueSection("SIMULATION TYPES",
"When running a simulation, Avrora accepts the \"-simulation\" command line option " +
"that selects the simulation type from multiple different types provided, or a " +
"user-supplied Java class of your own. For example, a simulation might be for a " +
"sensor network application, a single node simulation, or a robotics simulation. ",
"-simulation", simMap);
addMainCategory(hc);
addSubCategories(simMap);
}
}
private static synchronized void addPlatforms() {
if (platforms == null) {
platforms = new ClassMap("Platform", PlatformFactory.class);
//-- DEFAULT PLATFORMS
// platforms.addClass("mica2", Mica2.Factory.class);
platforms.addClass("micaz", MicaZ.Factory.class);
// platforms.addClass("seres", Seres.Factory.class);
// platforms.addClass("superbot", Superbot.Factory.class);
// platforms.addClass("telos", Telos.Factory.class);
}
}
private static synchronized void addMicrocontrollers() {
if (microcontrollers == null) {
microcontrollers = new ClassMap("Microcontroller", MicrocontrollerFactory.class);
//-- DEFAULT MICROCONTROLLERS
microcontrollers.addInstance("atmega128", new ATMega128.Factory());
microcontrollers.addInstance("atmega32", new ATMega32.Factory());
microcontrollers.addInstance("atmega16", new ATMega16.Factory());
}
}
private static synchronized void addTopologies() {
if (topologies == null) {
topologies = new ClassMap("Topology", Topology.class);
//-- DEFAULT TOPOLOGIES
topologies.addClass("static", TopologyStatic.class);
topologies.addClass("rwp", TopologyRWP.class);
// plug in a new help category for simulations accesible with "-help topologies"
HelpCategory hc = new HelpCategory("topologies", "Help for supported topology types.");
hc.addOptionValueSection("TOPOLOGY TYPES",
"Avrora supports different types of topolgies using the \"-topology\" command " +
"line option. This option works only for sensor-network simulation. Note that a " +
"topology must be set to use a specific radio model.",
"-topology", topologies);
addMainCategory(hc);
addSubCategories(topologies);
}
}
/**
* The <code>getMicrocontroller()</code> method gets the microcontroller factory corresponding
* to the given name represented as a string. This string can represent a short name for the
* class (an alias), or a fully qualified Java class name.
*
* @param s the name of the microcontroller as string; a class name or an alias such as "atmega128"
* @return an instance of the <code>MicrocontrollerFactory</code> interface that is capable
* of creating repeated instances of the microcontroller.
*/
public static MicrocontrollerFactory getMicrocontroller(String s) {
addMicrocontrollers();
return (MicrocontrollerFactory) microcontrollers.getObjectOfClass(s);
}
/**
* The <code>getPlatform()</code> method gets the platform factory corresponding to the
* given name represented as a string. This string can represent a short name for the
* class (an alias), or a fully qualified Java class name.
*
* @param s the name of the platform as string; a class name or an alias such as "mica2"
* @return an instance of the <code>PlatformFactory</code> interface that is capable of
* creating repeated instances of the microcontroller.
*/
public static PlatformFactory getPlatform(String s) {
addPlatforms();
return (PlatformFactory) platforms.getObjectOfClass(s);
}
/**
* The <code>getProgramReader()</code> method gets the program reader corresponding to
* the given name represented as a string. This string can represent a short name for the
* class (an alias), or a fully qualified Java class name.
*
* @param s the name of the program reader format as a string
* @return an instance of the <code>ProgramReader</code> class that is capable of reading
* a program into the internal program representation format.
*/
public static ProgramReader getProgramReader(String s) {
addInputFormats();
return (ProgramReader) inputs.getObjectOfClass(s);
}
/**
* The <code>getAction()</code> method gets the action corresponding to the given name
* represented as a string. This string can represent a short name for the
* class (an alias), or a fully qualified Java class name.
*
* @param s the name of the action as a string
* @return an instance of the <code>Action</code> class which can run given the command
* line arguments and options provided.
*/
public static Action getAction(String s) {
addActions();
return (Action) actions.getObjectOfClass(s);
}
/**
* The <code>getMonitor()</code> method gets the monitor corresponding to the given name
* represented as a string. This string can represent a short name for the class (an alias),
* or a fully qualified Java class name.
*
* @param s the name of the monitor as a string
* @return an instance of the <code>MonitorFactory</code> class that is capable of attaching
* monitors to nodes as they are created
*/
public static MonitorFactory getMonitor(String s) {
addMonitors();
return (MonitorFactory) monitorMap.getObjectOfClass(s);
}
public static Simulation getSimulation(String s) {
addSimulations();
// TODO: add a simulation factory
return (Simulation)simMap.getObjectOfClass(s);
}
public static Topology getTopology(String s) {
addTopologies();
return (Topology)topologies.getObjectOfClass(s);
}
/**
* The <code>getTestHarnessMap()</code> method gets the test harness class map.
*
* @return an instance of the <code>ClassMap</code> class that is capable of creating a
* test case for a file and running it
*/
public static ClassMap getTestHarnessMap() {
addTestHarnesses();
return harnessMap;
}
/**
* The <code>getActionList()</code> method returns a list of aliases for actions sorted
* alphabetically.
*
* @return a sorted list of known actions
*/
public static List getActionList() {
addActions();
return actions.getSortedList();
}
/**
* The <code>getProgramReaderList()</code> method returns a list of aliases for program
* readers sorted alphabetically.
*
* @return a sorted list of known program readers
*/
public static List getProgramReaderList() {
addInputFormats();
return inputs.getSortedList();
}
public static void addSubCategories(ClassMap vals) {
List l = vals.getSortedList();
Iterator i = l.iterator();
while (i.hasNext()) {
String val = (String) i.next();
Class cz = vals.getClass(val);
if (HelpCategory.class.isAssignableFrom(cz))
HelpSystem.addCategory(val, cz);
}
}
public static void addMainCategory(HelpCategory cat) {
HelpSystem.addCategory(cat.name, cat);
mainCategories.put(cat.name, cat);
}
public static HelpCategory getHelpCategory(String name) {
addAll();
return HelpSystem.getCategory(name);
}
public static List getMainCategories() {
addAll();
List list = Collections.list(Collections.enumeration(mainCategories.values()));
Collections.sort(list, HelpCategory.COMPARATOR);
return list;
}
public static List getAllCategories() {
addAll();
List l = HelpSystem.getSortedList();
LinkedList nl = new LinkedList();
Iterator i = l.iterator();
while ( i.hasNext() ) {
String s = (String)i.next();
nl.addLast(HelpSystem.getCategory(s));
}
return nl;
}
public static Simulator newSimulator(int id, Program p) {
return newSimulator(id, "atmega128", 8000000, 8000000, p);
}
public static Simulator newSimulator(int id, String mcu, long hz, long exthz, Program p) {
MicrocontrollerFactory f = getMicrocontroller(mcu);
ClockDomain cd = new ClockDomain(hz);
cd.newClock("external", exthz);
return f.newMicrocontroller(id, new SingleSimulation(), cd, p).getSimulator();
}
public static class AutoProgramReader extends ProgramReader {
public AutoProgramReader() {
super("The \"auto\" input format reads a program from a single file at a time. " +
"It uses the extension of the filename as a clue to decide what input " +
"reader to use for that file. For example, an extension of \".asm\" is " +
"considered to be a program in Atmel assembly syntax.");
}
public Program read(String[] args) throws Exception {
if (args.length == 0)
Util.userError("no input files");
if (args.length != 1)
Util.userError("input type \"auto\" accepts only one file at a time.");
String n = args[0];
int offset = n.lastIndexOf('.');
if (offset < 0)
Util.userError("file " + StringUtil.quote(n) + " does not have an extension");
String extension = n.substring(offset).toLowerCase();
ProgramReader reader = null;
if (".asm".equals(extension))
reader = new AtmelProgramReader();
else if (".od".equals(extension))
reader = new ObjDumpProgramReader();
else if (".odpp".equals(extension))
reader = new ObjDump2ProgramReader();
else if (".elf".equals(extension))
reader = new ELFParser();
else
reader = new ELFParser(); //for contiki .$(TARGET) elf files
if ( reader == null ) {
Util.userError("file extension " + StringUtil.quote(extension) + " unknown");
return null;
}
// TODO: this is a hack; all inherited options should be available
reader.INDIRECT_EDGES.set(INDIRECT_EDGES.stringValue());
reader.ARCH.set(ARCH.stringValue());
reader.options.process(options);
return reader.read(args);
}
}
}
| 19,467
|
https://github.com/GabrielTrossero/CAOV/blob/master/resources/views/pagoAlquiler/ingresarPagoInmueble.blade.php
|
Github Open Source
|
Open Source
|
MIT
| null |
CAOV
|
GabrielTrossero
|
PHP
|
Code
| 629
| 2,949
|
@extends('layouts.master')
@section('content')
<div class="cuadro">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Ingresar N° de Recibo para el Alquiler de Inmueble') }}</div>
<div class="card-body">
<form method="POST" action="{{ url('/pagoalquiler/pagoinmueble') }}">
{{ csrf_field() }}
@if (\Session::has('newID'))
<input type="hidden" name="id" value="{!! \Session::get('newID') !!}">
@else
<input type="hidden" name="id" value="{{ $reservaInmueble->id }}">
@endif
<!--para mostrar las distintas alertas-->
<div class="form-group row">
<label class="col-md-1 col-form-label text-md-right"></label>
<div class="col-md-10">
<div class="alert alert-warning">
{{ 'ACLARACIÓN: El costo Total incluye el costo de la Reserva.' }}
</div>
</div>
</div>
<div class="form-group row">
<label for="persona" class="col-md-4 col-form-label text-md-right">{{ __('Solicitante') }}</label>
<div class="col-md-6">
<input type="text" name="persona" id="persona" class="form-control" maxlength="8" value="{{ $reservaInmueble->persona->DNI .' - '. $reservaInmueble->persona->apellido .', '. $reservaInmueble->persona->nombres }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="inmueble" class="col-md-4 col-form-label text-md-right">{{ __('Inmueble') }}</label>
<div class="col-md-6">
<select name="inmueble" id="inmueble" class="form-control" disabled>
@foreach ($inmuebles as $inmueble)
@if ($inmueble->id == $reservaInmueble->idInmueble)
<option value="{{ $inmueble->id }}" selected>{{ $inmueble->nombre }}</option>
@else
<option value="{{ $inmueble->id }}">{{ $inmueble->nombre }}</option>
@endif
@endforeach
</select>
</div>
</div>
<div class="form-group row">
<label for="fechaSol" class="col-md-4 col-form-label text-md-right">{{ __('Fecha de Solicitud') }}</label>
<div class="col-md-6">
<input type="date" name="fechaSol" id="fechaSol" class="form-control" value="{{ $reservaInmueble->fechaSolicitud }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="fechaHoraInicio" class="col-md-4 col-form-label text-md-right">{{ __('Fecha y Hora de Inicio') }}</label>
<div class="col-md-6">
<input type="datetime" name="fechaHoraInicio" id="fechaHoraInicio" class="form-control" value="{{ $reservaInmueble->fechaHoraInicio }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="fechaHoraFin" class="col-md-4 col-form-label text-md-right">{{ __('Fecha y Hora de Finalización') }}</label>
<div class="col-md-6">
<input type="datetime" name="fechaHoraFin" id="fechaHoraFin" class="form-control" value="{{ old('fechaHoraFin') ?? $reservaInmueble->fechaHoraFin }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="observacion" class="col-md-4 col-form-label text-md-right">{{ __('Observación') }}</label>
<div class="col-md-6">
<input type="text" name="observacion" id="observacion" class="form-control" value="{{ old('observacion') ?? $reservaInmueble->observacion }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="costoReserva" class="col-md-4 col-form-label text-md-right">{{ __('Costo de la Reserva') }}</label>
<div class="col-md-6">
<input type="text" name="costoReserva" id="costoReserva" class="form-control" value="{{ '$ '. $reservaInmueble->costoReserva }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="costoTotal" class="col-md-4 col-form-label text-md-right">{{ __('Costo Total') }}</label>
<div class="col-md-6">
<input type="text" name="costoTotal" id="costoTotal" class="form-control" value="{{ '$ '. $reservaInmueble->costoTotal }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="medioPago" class="col-md-4 col-form-label text-md-right">{{ __('Medio de Pago') }}</label>
<div class="col-md-6">
<select name="medioPago" id="medioPago" class="form-control" disabled>
@foreach ($mediosDePago as $medioDePago)
@if ($medioDePago->id == $reservaInmueble->idMedioDePago)
<option value="{{ $medioDePago->id }}" selected>{{ $medioDePago->nombre }}</option>
@else
<option value="{{ $medioDePago->id }}">{{ $medioDePago->nombre }}</option>
@endif
@endforeach
</select>
</div>
</div>
<div class="form-group row">
<label for="tipoEvento" class="col-md-4 col-form-label text-md-right">{{ __('Tipo de Evento') }}</label>
<div class="col-md-6">
<input type="text" name="tipoEvento" id="tipoEvento" class="form-control" value="{{ old('tipoEvento') ?? $reservaInmueble->tipoEvento }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="cantAsistentes" class="col-md-4 col-form-label text-md-right">{{ __('Cantidad de Asistentes') }}</label>
<div class="col-md-6">
<input type="number" name="cantAsistentes" id="cantAsistentes" class="form-control" value="{{ old('cantAsistentes') ?? $reservaInmueble->cantAsistentes }}" disabled>
</div>
</div>
<div class="form-group row">
<label for="servicioLimp" class="col-md-4 col-form-label text-md-right">{{ __('Servicio de Limpieza') }}</label>
<div class="col-md-6">
<select name="servicioLimp" id="servicioLimp" class="form-control" disabled>
@if ($reservaInmueble->tieneServicioLimpieza)
<option value="0">No</option>
<option value="1" selected>Si</option>
@else
<option value="0" selected>No</option>
<option value="1">Si</option>
@endif
</select>
</div>
</div>
<div class="form-group row">
<label for="musica" class="col-md-4 col-form-label text-md-right">{{ __('Música') }}</label>
<div class="col-md-6">
<select name="musica" id="musica" class="form-control" disabled>
@if ($reservaInmueble->tieneMusica)
<option value="0">No</option>
<option value="1" selected>Si</option>
@else
<option value="0" selected>No</option>
<option value="1">Si</option>
@endif
</select>
</div>
</div>
<div class="form-group row">
<label for="reglamento" class="col-md-4 col-form-label text-md-right">{{ __('Reglamento') }}</label>
<div class="col-md-6">
<select name="reglamento" id="reglamento" class="form-control" disabled>
@if ($reservaInmueble->tieneReglamento)
<option value="0">No</option>
<option value="1" selected>Si</option>
@else
<option value="0" selected>No</option>
<option value="1">Si</option>
@endif
</select>
</div>
</div>
<div class="form-group row">
<label for="numRecibo" class="col-md-4 col-form-label text-md-right">{{ __('N° Recibo *') }}</label>
<div class="col-md-6">
<input type="number" name="numRecibo" id="numRecibo" class="form-control" value="{{ old('numRecibo') ?? $reservaInmueble->numRecibo }}" min="0" required>
<span class="text-danger">{{$errors->first('numRecibo')}}</span>
@if (\Session::has('validarNumRecibo'))
<div class="alert alert-danger errorForm">
{!! \Session::get('validarNumRecibo') !!}
</div>
@endif
</div>
</div>
<!--para mostrar las distintas alertas-->
<div class="form-group row">
<label class="col-md-1 col-form-label text-md-right"></label>
<div class="col-md-10">
<div class="alert alert-danger" align="center">
{{ 'MONTO A PAGAR: $ '. ($reservaInmueble->costoTotal - $reservaInmueble->costoReserva) }}
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-1 offset-md-4">
<a style="text-decoration:none" onclick="history.back()">
<button type="button" class="btn btn-secondary">
Volver
</button>
</a>
</div>
<div class="offset-md-1">
<button type="submit" class="btn btn-primary">
{{ __('Guardar') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@stop
| 39,863
|
https://github.com/lmgginspace/PokeWorld/blob/master/Source/PokeWorld/PokeWorld/Quests/LegendaryQuestsTracker.cs
|
Github Open Source
|
Open Source
|
MIT
| null |
PokeWorld
|
lmgginspace
|
C#
|
Code
| 100
| 385
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld.Planet;
using RimWorld;
using RimWorld.QuestGen;
using Verse;
namespace PokeWorld
{
public class LegendaryQuestsTracker : WorldComponent
{
private DefMap<QuestConditionDef, bool> questConditionDefMap = new DefMap<QuestConditionDef, bool>();
public LegendaryQuestsTracker(World world) : base(world)
{
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Deep.Look(ref questConditionDefMap, "PW_questConditionDefMap");
}
public override void WorldComponentTick()
{
base.WorldComponentTick();
if (Find.TickManager.TicksGame % 60000 == 0)
{
foreach (QuestConditionDef condition in DefDatabase<QuestConditionDef>.AllDefs)
{
if (!questConditionDefMap[condition])
{
if (condition.CheckCompletion())
{
Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(condition.questScriptDef, new Slate());
if (!quest.hidden && condition.questScriptDef.sendAvailableLetter)
{
QuestUtility.SendLetterQuestAvailable(quest);
}
questConditionDefMap[condition] = true;
}
}
}
}
}
}
}
| 28,677
|
https://github.com/techtastet/deno-jampstack/blob/master/src/article.ts
|
Github Open Source
|
Open Source
|
MIT
| 2,020
|
deno-jampstack
|
techtastet
|
TypeScript
|
Code
| 197
| 621
|
import { join, Marked, __dirname } from "../deps.ts";
import {
ELEMENTS,
encoder,
decoder,
replaceAssets,
} from "./functions.ts";
/**
* READ /posts dir for posts
*/
async function processArticle(file: string): Promise<object> {
let article: any = {
markdown: "",
html: "",
handle: "",
};
// dir will be the handle by default
article.handle = file.split(".").slice(0, -1)[0];
const data = await Deno.readFile(join(__dirname, "./articles/", file));
article.markdown = await decoder.decode(data);
// Processing the metadata
if (article.markdown.substr(0, 3) === "---") {
article.markdown = article.markdown.replaceAll("\n", "[NEWLINEENCODEDFOR]");
const meta = /---((.)+)---/.exec(article.markdown);
if (meta && meta[1]) {
const tmp = meta[1].replaceAll("[NEWLINEENCODEDFOR]", "\n");
// Get all meta
const regex = /^(([a-zA-Z-0-9-_])+):((.)+)$/gm;
let m;
while ((m = regex.exec(tmp)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
article[m[1]] = m[3].trim();
}
article.markdown = article.markdown.replace(meta[0], "");
}
article.markdown = article.markdown.replaceAll("[NEWLINEENCODEDFOR]", "\n");
}
// create dir
await Deno.mkdir(join(__dirname, "./public/articles/" + article.handle));
// Processing the body
article.html = await Marked.parse(article.markdown).content;
let tmp = ELEMENTS.layout;
tmp = tmp.replaceAll("[BODY]", article.html);
// create the file
await Deno.writeFile(
join(__dirname, "./public/articles/" + article.handle, "/index.html"),
encoder.encode(await replaceAssets(tmp))
);
return article;
}
export { processArticle };
| 12,732
|
https://github.com/traal-devel/udacity-p02-vehicles-starter/blob/master/vehicles-api/src/test/java/ch/traal/vehicles/VehiclesApiApplicationTests.java
|
Github Open Source
|
Open Source
|
MIT
| null |
udacity-p02-vehicles-starter
|
traal-devel
|
Java
|
Code
| 62
| 283
|
package ch.traal.vehicles;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import ch.traal.vehicles.client.maps.MapsClient;
import ch.traal.vehicles.client.prices.PriceClient;
@RunWith(SpringRunner.class)
@SpringBootTest
public class VehiclesApiApplicationTests {
/* member variables */
@Autowired
private PriceClient wcPrice;
@Autowired
private MapsClient wcMaps;
/* constructors */
/* methods */
@Test
public void testNotNull() {
assertNotNull(this.wcPrice);
assertNotNull(this.wcMaps);
}
@Test
public void contextLoads() {
assertTrue(true);
}
}
| 5,121
|
https://github.com/sillywalk/grazz/blob/master/tests/binutils-2.30/src/ld/testsuite/ld-arm/attr-merge-incompatibleb.s
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,020
|
grazz
|
sillywalk
|
GAS
|
Code
| 4
| 19
|
.eabi_attribute Tag_compatibility, 1, "gnu"
| 16,809
|
https://github.com/sakusimu/mh4-skillsimu/blob/master/test/unit/40_deco/10_normalizer.js
|
Github Open Source
|
Open Source
|
MIT
| 2,017
|
mh4-skillsimu
|
sakusimu
|
JavaScript
|
Code
| 850
| 2,644
|
'use strict';
var assert = require('power-assert'),
Normalizer = require('../../../lib/deco/normalizer.js'),
util = require('../../../lib/util.js'),
myapp = require('../../../test/lib/driver-myapp.js');
describe('40_deco/10_normalizer', function () {
var got, exp;
beforeEach(function () {
myapp.initialize();
});
it('require', function () {
assert(typeof Normalizer === 'function', 'is function');
});
it('new', function () {
got = new Normalizer();
assert(typeof got === 'object', 'is object');
assert(typeof got.initialize === 'function', 'has initialize()');
});
describe('_normalize1', function () {
var n = new Normalizer();
it('slot0', function () {
var decoCombsBySlot = util.deco.combs([ '研ぎ師' ]);
var equip = { name: 'slot0', slot: 0, skillComb: { '攻撃': 1, '斬れ味': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [ { decos: [], slot: 0, skillComb: {} } ];
assert.deepEqual(got, exp);
});
it("slot1: [ '研ぎ師' ]", function () {
var decoCombsBySlot = util.deco.combs([ '研ぎ師' ]);
var equip = { name: 'slot1', slot: 1, skillComb: { '攻撃': 1, '斬れ味': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [
{ decos: [], slot: 0, skillComb: {} },
{ decos: [ '研磨珠【1】' ], slot: 1, skillComb: { '研ぎ師': 2 } }
];
assert.deepEqual(got, exp);
});
it("slot1: [ '匠' ]", function () {
var decoCombsBySlot = util.deco.combs([ '匠' ]);
var equip = { name: 'slot1', slot: 1, skillComb: { '攻撃': 1, '斬れ味': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [ { decos: [], slot: 0, skillComb: {} } ];
assert.deepEqual(got, exp);
});
it("slot3: [ '匠', '研ぎ師' ]", function () {
var decoCombsBySlot = util.deco.combs([ '匠', '研ぎ師' ]);
var equip = { name: 'slot3', slot: 3, skillComb: { '攻撃': 1, '斬れ味': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [
{ decos: [], slot: 0, skillComb: {} },
{ decos: [ '研磨珠【1】' ], slot: 1, skillComb: { '研ぎ師': 2 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】' ],
slot: 2, skillComb: { '研ぎ師': 4 } },
{ decos: [ '匠珠【2】' ], slot: 2, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】', '研磨珠【1】' ],
slot: 3, skillComb: { '研ぎ師': 6 } },
{ decos: [ '匠珠【2】', '研磨珠【1】' ],
slot: 3, skillComb: { '匠': 1, '斬れ味': -1, '研ぎ師': 2 } },
{ decos: [ '匠珠【3】' ], slot: 3, skillComb: { '匠': 2, '斬れ味': -2 } }
];
assert.deepEqual(got, exp);
});
it("slot3: [ '匠' ]", function () {
var decoCombsBySlot = util.deco.combs([ '匠' ]);
var equip = { name: 'slot3', slot: 3, skillComb: { '攻撃': 1, '斬れ味': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [
{ decos: [], slot: 0, skillComb: {} },
{ decos: [ '匠珠【2】' ], slot: 2, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '匠珠【2】' ], slot: 3, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '匠珠【3】' ], slot: 3, skillComb: { '匠': 2, '斬れ味': -2 } }
];
assert.deepEqual(got, exp);
});
it('torsoUp', function () {
var decoCombsBySlot = util.deco.combs([ '匠' ]);
var equip = { name: 'torsoUp', slot: 0, skillComb: { '胴系統倍化': 1 } };
got = n._normalize1(decoCombsBySlot, equip);
exp = [ { decos: [], slot: 0, skillComb: { '胴系統倍化': 1 } } ];
assert.deepEqual(got, exp);
});
it("equip is null", function () {
var decoCombsBySlot = util.deco.combs([ '匠' ]);
got = n._normalize1(decoCombsBySlot, null);
exp = [];
assert.deepEqual(got, exp);
});
it('equip.skillComb is {}', function () {
var decoCombsBySlot = util.deco.combs([ '匠' ]);
var equip = { name: 'slot3', slot: 3, skillComb: {} };
got = n._normalize1(decoCombsBySlot, equip);
exp = [
{ decos: [], slot: 0, skillComb: {} },
{ decos: [ '匠珠【2】' ], slot: 2, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '匠珠【2】' ], slot: 3, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '匠珠【3】' ], slot: 3, skillComb: { '匠': 2, '斬れ味': -2 } }
];
assert.deepEqual(got, exp);
});
});
describe('_normalizer2', function () {
var n = new Normalizer();
it('normalize', function () {
var bulks = [
{ decos: [], slot: 0, skillComb: {} },
{ decos: [ '研磨珠【1】' ], slot: 1, skillComb: { '研ぎ師': 2 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】' ],
slot: 2, skillComb: { '研ぎ師': 4 } },
{ decos: [ '匠珠【2】' ], slot: 2, skillComb: { '匠': 1, '斬れ味': -1 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】', '研磨珠【1】' ],
slot: 3, skillComb: { '研ぎ師': 6 } },
{ decos: [ '匠珠【2】', '研磨珠【1】' ],
slot: 3, skillComb: { '匠': 1, '斬れ味': -1, '研ぎ師': 2 } },
{ decos: [ '匠珠【3】' ], slot: 3, skillComb: { '匠': 2, '斬れ味': -2 } }
];
got = n._normalize2(bulks, [ '匠', '研ぎ師' ]);
exp = [
{ decos: [], slot: 0, skillComb: { '匠': 0, '研ぎ師': 0 } },
{ decos: [ '研磨珠【1】' ], slot: 1, skillComb: { '匠': 0, '研ぎ師': 2 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】' ],
slot: 2, skillComb: { '匠': 0, '研ぎ師': 4 } },
{ decos: [ '匠珠【2】' ], slot: 2, skillComb: { '匠': 1, '研ぎ師': 0 } },
{ decos: [ '研磨珠【1】', '研磨珠【1】', '研磨珠【1】' ],
slot: 3, skillComb: { '匠': 0, '研ぎ師': 6 } },
{ decos: [ '匠珠【2】', '研磨珠【1】' ],
slot: 3, skillComb: { '匠': 1, '研ぎ師': 2 } },
{ decos: [ '匠珠【3】' ], slot: 3, skillComb: { '匠': 2, '研ぎ師': 0 } }
];
assert.deepEqual(got, exp);
});
});
});
| 47,105
|
https://github.com/ibis-project/ibis/blob/master/ibis/expr/types/relations.py
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,023
|
ibis
|
ibis-project
|
Python
|
Code
| 16,840
| 73,226
|
from __future__ import annotations
import collections
import contextlib
import functools
import itertools
import operator
import re
from keyword import iskeyword
from typing import TYPE_CHECKING, Callable, Iterable, Literal, Mapping, Sequence
import toolz
from public import public
import ibis
import ibis.common.exceptions as com
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import ibis.expr.schema as sch
from ibis import util
from ibis.expr.deferred import Deferred
from ibis.expr.types.core import Expr, _FixedTextJupyterMixin
from ibis.expr.types.generic import literal
if TYPE_CHECKING:
import pandas as pd
import pyarrow as pa
import ibis.selectors as s
import ibis.expr.types as ir
from ibis.common.typing import SupportsSchema
from ibis.selectors import IfAnyAll, Selector
from ibis.expr.types.groupby import GroupedTable
_ALIASES = (f"_ibis_view_{n:d}" for n in itertools.count())
def _ensure_expr(table, expr):
from ibis.selectors import Selector
# This is different than self._ensure_expr, since we don't want to
# treat `str` or `int` values as column indices
if isinstance(expr, Expr):
return expr
elif util.is_function(expr):
return expr(table)
elif isinstance(expr, Deferred):
return expr.resolve(table)
elif isinstance(expr, Selector):
return expr.expand(table)
else:
return literal(expr)
def _regular_join_method(
name: str,
how: Literal[
"inner",
"left",
"outer",
"right",
"semi",
"anti",
"any_inner",
"any_left",
],
):
def f( # noqa: D417
self: Table,
right: Table,
predicates: str
| Sequence[
str | tuple[str | ir.Column, str | ir.Column] | ir.BooleanValue
] = (),
*,
lname: str = "",
rname: str = "{name}_right",
) -> Table:
"""Perform a join between two tables.
Parameters
----------
right
Right table to join
predicates
Boolean or column names to join on
lname
A format string to use to rename overlapping columns in the left
table (e.g. ``"left_{name}"``).
rname
A format string to use to rename overlapping columns in the right
table (e.g. ``"right_{name}"``).
Returns
-------
Table
Joined table
"""
return self.join(right, predicates, how=how, lname=lname, rname=rname)
f.__name__ = name
return f
@public
class Table(Expr, _FixedTextJupyterMixin):
# Higher than numpy & dask objects
__array_priority__ = 20
__array_ufunc__ = None
def __array__(self, dtype=None):
return self.execute().__array__(dtype)
def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True):
from ibis.expr.types.dataframe_interchange import IbisDataFrame
return IbisDataFrame(self, nan_as_null=nan_as_null, allow_copy=allow_copy)
def __pyarrow_result__(self, table: pa.Table) -> pa.Table:
from ibis.formats.pyarrow import PyArrowData
return PyArrowData.convert_table(table, self.schema())
def __pandas_result__(self, df: pd.DataFrame) -> pd.DataFrame:
from ibis.formats.pandas import PandasData
return PandasData.convert_table(df, self.schema())
def as_table(self) -> Table:
"""Promote the expression to a table.
This method is a no-op for table expressions.
Returns
-------
Table
A table expression
Examples
--------
>>> t = ibis.table(dict(a="int"), name="t")
>>> s = t.as_table()
>>> t is s
True
"""
return self
def __contains__(self, name: str) -> bool:
"""Return whether `name` is a column in the table.
Parameters
----------
name
Possible column name
Returns
-------
bool
Whether `name` is a column in `self`
Examples
--------
>>> t = ibis.table(dict(a="string", b="float"), name="t")
>>> "a" in t
True
>>> "c" in t
False
"""
return name in self.schema()
def cast(self, schema: SupportsSchema) -> Table:
"""Cast the columns of a table.
!!! note "If you need to cast columns to a single type, use [selectors](https://ibis-project.org/blog/selectors/)."
Parameters
----------
schema
Mapping, schema or iterable of pairs to use for casting
Returns
-------
Table
Casted table
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.schema()
ibis.Schema {
species string
island string
bill_length_mm float64
bill_depth_mm float64
flipper_length_mm int64
body_mass_g int64
sex string
year int64
}
>>> cols = ["body_mass_g", "bill_length_mm"]
>>> t[cols].head()
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ body_mass_g ┃ bill_length_mm ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ int64 │ float64 │
├─────────────┼────────────────┤
│ 3750 │ 39.1 │
│ 3800 │ 39.5 │
│ 3250 │ 40.3 │
│ NULL │ nan │
│ 3450 │ 36.7 │
└─────────────┴────────────────┘
Columns not present in the input schema will be passed through unchanged
>>> t.columns
['species', 'island', 'bill_length_mm', 'bill_depth_mm', 'flipper_length_mm', 'body_mass_g', 'sex', 'year']
>>> expr = t.cast({"body_mass_g": "float64", "bill_length_mm": "int"})
>>> expr.select(*cols).head()
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ body_mass_g ┃ bill_length_mm ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ float64 │ int64 │
├─────────────┼────────────────┤
│ 3750.0 │ 39 │
│ 3800.0 │ 40 │
│ 3250.0 │ 40 │
│ nan │ NULL │
│ 3450.0 │ 37 │
└─────────────┴────────────────┘
Columns that are in the input `schema` but not in the table raise an error
>>> t.cast({"foo": "string"})
Traceback (most recent call last):
...
ibis.common.exceptions.IbisError: Cast schema has fields that are not in the table: ['foo']
"""
return self._cast(schema, cast_method="cast")
def try_cast(self, schema: SupportsSchema) -> Table:
"""Cast the columns of a table.
If the cast fails for a row, the value is returned
as `NULL` or `NaN` depending on backend behavior.
Parameters
----------
schema
Mapping, schema or iterable of pairs to use for casting
Returns
-------
Table
Casted table
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": ["1", "2", "3"], "b": ["2.2", "3.3", "book"]})
>>> t.try_cast({"a": "int", "b": "float"})
┏━━━━━━━┳━━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━━┩
│ int64 │ float64 │
├───────┼─────────┤
│ 1 │ 2.2 │
│ 2 │ 3.3 │
│ 3 │ nan │
└───────┴─────────┘
"""
return self._cast(schema, cast_method="try_cast")
def _cast(self, schema: SupportsSchema, cast_method: str = "cast") -> Table:
schema = sch.schema(schema)
cols = []
columns = self.columns
if missing_fields := frozenset(schema.names).difference(columns):
raise com.IbisError(
f"Cast schema has fields that are not in the table: {sorted(missing_fields)}"
)
for col in columns:
if (new_type := schema.get(col)) is not None:
new_col = getattr(self[col], cast_method)(new_type).name(col)
else:
new_col = col
cols.append(new_col)
return self.select(*cols)
def __interactive_rich_console__(self, console, options):
from ibis.expr.types.pretty import to_rich_table
if console.is_jupyter:
# Rich infers a console width in jupyter notebooks, but since
# notebooks can use horizontal scroll bars we don't want to apply a
# limit here. Since rich requires an integer for max_width, we
# choose an arbitrarily large integer bound. Note that we need to
# handle this here rather than in `to_rich_table`, as this setting
# also needs to be forwarded to `console.render`.
options = options.update(max_width=1_000_000)
width = None
else:
width = options.max_width
table = to_rich_table(self, width)
return console.render(table, options=options)
def __getitem__(self, what):
"""Select items from a table expression.
This method implements square bracket syntax for table expressions,
including various forms of projection and filtering.
Parameters
----------
what
Selection object. This can be a variety of types including strings, ints, lists.
Returns
-------
Table | Column
The return type depends on the input. For a single string or int
input a column is returned, otherwise a table is returned.
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Return a column by name
>>> t["island"]
┏━━━━━━━━━━━┓
┃ island ┃
┡━━━━━━━━━━━┩
│ string │
├───────────┤
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ … │
└───────────┘
Return the second column, starting from index 0
>>> t.columns[1]
'island'
>>> t[1]
┏━━━━━━━━━━━┓
┃ island ┃
┡━━━━━━━━━━━┩
│ string │
├───────────┤
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ … │
└───────────┘
Extract a range of rows
>>> t[:2]
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t[:5]
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t[2:5]
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Some backends support negative slice indexing
>>> t[-5:] # last 5 rows
┏━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├───────────┼────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Chinstrap │ Dream │ 55.8 │ 19.8 │ 207 │ … │
│ Chinstrap │ Dream │ 43.5 │ 18.1 │ 202 │ … │
│ Chinstrap │ Dream │ 49.6 │ 18.2 │ 193 │ … │
│ Chinstrap │ Dream │ 50.8 │ 19.0 │ 210 │ … │
│ Chinstrap │ Dream │ 50.2 │ 18.7 │ 198 │ … │
└───────────┴────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t[-5:-3] # last 5th to 3rd rows
┏━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├───────────┼────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Chinstrap │ Dream │ 55.8 │ 19.8 │ 207 │ … │
│ Chinstrap │ Dream │ 43.5 │ 18.1 │ 202 │ … │
└───────────┴────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t[2:-2] # chop off the first two and last two rows
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ Adelie │ Torgersen │ 37.8 │ 17.1 │ 186 │ … │
│ Adelie │ Torgersen │ 37.8 │ 17.3 │ 180 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Select columns
>>> t[["island", "bill_length_mm"]].head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ island ┃ bill_length_mm ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼────────────────┤
│ Torgersen │ 39.1 │
│ Torgersen │ 39.5 │
│ Torgersen │ 40.3 │
│ Torgersen │ nan │
│ Torgersen │ 36.7 │
└───────────┴────────────────┘
>>> t["island", "bill_length_mm"].head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ island ┃ bill_length_mm ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼────────────────┤
│ Torgersen │ 39.1 │
│ Torgersen │ 39.5 │
│ Torgersen │ 40.3 │
│ Torgersen │ nan │
│ Torgersen │ 36.7 │
└───────────┴────────────────┘
>>> t[_.island, _.bill_length_mm].head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ island ┃ bill_length_mm ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼────────────────┤
│ Torgersen │ 39.1 │
│ Torgersen │ 39.5 │
│ Torgersen │ 40.3 │
│ Torgersen │ nan │
│ Torgersen │ 36.7 │
└───────────┴────────────────┘
Filtering
>>> t[t.island.lower() != "torgersen"].head()
┏━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Biscoe │ 37.8 │ 18.3 │ 174 │ … │
│ Adelie │ Biscoe │ 37.7 │ 18.7 │ 180 │ … │
│ Adelie │ Biscoe │ 35.9 │ 19.2 │ 189 │ … │
│ Adelie │ Biscoe │ 38.2 │ 18.1 │ 185 │ … │
│ Adelie │ Biscoe │ 38.8 │ 17.2 │ 180 │ … │
└─────────┴────────┴────────────────┴───────────────┴───────────────────┴───┘
Selectors
>>> t[~s.numeric() | (s.numeric() & ~s.c("year"))].head()
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t[s.r["bill_length_mm":"body_mass_g"]].head()
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ float64 │ float64 │ int64 │ int64 │
├────────────────┼───────────────┼───────────────────┼─────────────┤
│ 39.1 │ 18.7 │ 181 │ 3750 │
│ 39.5 │ 17.4 │ 186 │ 3800 │
│ 40.3 │ 18.0 │ 195 │ 3250 │
│ nan │ nan │ NULL │ NULL │
│ 36.7 │ 19.3 │ 193 │ 3450 │
└────────────────┴───────────────┴───────────────────┴─────────────┘
"""
from ibis.expr.types.generic import Column
from ibis.expr.types.logical import BooleanValue
if isinstance(what, (str, int)):
return ops.TableColumn(self, what).to_expr()
if isinstance(what, slice):
limit, offset = util.slice_to_limit_offset(what, self.count())
return self.limit(limit, offset=offset)
what = bind_expr(self, what)
if isinstance(what, (list, tuple, Table)):
# Projection case
return self.select(what)
elif isinstance(what, BooleanValue):
# Boolean predicate
return self.filter([what])
elif isinstance(what, Column):
# Projection convenience
return self.select(what)
else:
raise NotImplementedError(
"Selection rows or columns with {} objects is not "
"supported".format(type(what).__name__)
)
def __len__(self):
raise com.ExpressionError("Use .count() instead")
def __getattr__(self, key: str) -> ir.Column:
"""Return the column name of a table.
Parameters
----------
key
Column name
Returns
-------
Column
Column expression with name `key`
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.island
┏━━━━━━━━━━━┓
┃ island ┃
┡━━━━━━━━━━━┩
│ string │
├───────────┤
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ Torgersen │
│ … │
└───────────┘
"""
with contextlib.suppress(com.IbisTypeError):
return ops.TableColumn(self, key).to_expr()
# A mapping of common attribute typos, mapping them to the proper name
common_typos = {
"sort": "order_by",
"sort_by": "order_by",
"sortby": "order_by",
"orderby": "order_by",
"groupby": "group_by",
}
if key in common_typos:
hint = common_typos[key]
raise AttributeError(
f"{type(self).__name__} object has no attribute {key!r}, did you mean {hint!r}"
)
raise AttributeError(f"'Table' object has no attribute {key!r}")
def __dir__(self) -> list[str]:
out = set(dir(type(self)))
out.update(c for c in self.columns if c.isidentifier() and not iskeyword(c))
return sorted(out)
def _ipython_key_completions_(self) -> list[str]:
return self.columns
def _ensure_expr(self, expr):
import numpy as np
from ibis.selectors import Selector
if isinstance(expr, str):
# treat strings as column names
return self[expr]
elif isinstance(expr, (int, np.integer)):
# treat Python integers as a column index
return self[self.schema().name_at_position(expr)]
elif isinstance(expr, Deferred):
# resolve deferred expressions
return expr.resolve(self)
elif isinstance(expr, Selector):
return expr.expand(self)
elif callable(expr):
return expr(self)
else:
return expr
@property
def columns(self) -> list[str]:
"""The list of columns in this table.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.columns
['species',
'island',
'bill_length_mm',
'bill_depth_mm',
'flipper_length_mm',
'body_mass_g',
'sex',
'year']
"""
return list(self.schema().names)
def schema(self) -> sch.Schema:
"""Return the schema for this table.
Returns
-------
Schema
The table's schema.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.schema()
ibis.Schema {
species string
island string
bill_length_mm float64
bill_depth_mm float64
flipper_length_mm int64
body_mass_g int64
sex string
year int64
}
"""
return self.op().schema
def group_by(
self,
by: str | ir.Value | Iterable[str] | Iterable[ir.Value] | None = None,
**key_exprs: str | ir.Value | Iterable[str] | Iterable[ir.Value],
) -> GroupedTable:
"""Create a grouped table expression.
Parameters
----------
by
Grouping expressions
key_exprs
Named grouping expressions
Returns
-------
GroupedTable
A grouped table expression
Examples
--------
>>> import ibis
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"fruit": ["apple", "apple", "banana", "orange"], "price": [0.5, 0.5, 0.25, 0.33]})
>>> t
┏━━━━━━━━┳━━━━━━━━━┓
┃ fruit ┃ price ┃
┡━━━━━━━━╇━━━━━━━━━┩
│ string │ float64 │
├────────┼─────────┤
│ apple │ 0.50 │
│ apple │ 0.50 │
│ banana │ 0.25 │
│ orange │ 0.33 │
└────────┴─────────┘
>>> t.group_by("fruit").agg(total_cost=_.price.sum(), avg_cost=_.price.mean())
┏━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ fruit ┃ total_cost ┃ avg_cost ┃
┡━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ string │ float64 │ float64 │
├────────┼────────────┼──────────┤
│ apple │ 1.00 │ 0.50 │
│ banana │ 0.25 │ 0.25 │
│ orange │ 0.33 │ 0.33 │
└────────┴────────────┴──────────┘
"""
from ibis.expr.types.groupby import GroupedTable
return GroupedTable(self, by, **key_exprs)
def rowid(self) -> ir.IntegerValue:
"""A unique integer per row.
!!! note "This operation is only valid on physical tables"
Any further meaning behind this expression is backend dependent.
Generally this corresponds to some index into the database storage
(for example, sqlite or duckdb's `rowid`).
For a monotonically increasing row number, see `ibis.row_number`.
Returns
-------
IntegerColumn
An integer column
"""
if not isinstance(self.op(), ops.PhysicalTable):
raise com.IbisTypeError(
"rowid() is only valid for physical tables, not for generic "
"table expressions"
)
return ops.RowID(self).to_expr()
def view(self) -> Table:
"""Create a new table expression distinct from the current one.
Use this API for any self-referencing operations like a self-join.
Returns
-------
Table
Table expression
"""
return ops.SelfReference(self).to_expr()
def difference(self, table: Table, *rest: Table, distinct: bool = True) -> Table:
"""Compute the set difference of multiple table expressions.
The input tables must have identical schemas.
Parameters
----------
table:
A table expression
*rest:
Additional table expressions
distinct
Only diff distinct rows not occurring in the calling table
See Also
--------
[`ibis.difference`][ibis.difference]
Returns
-------
Table
The rows present in `self` that are not present in `tables`.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t1 = ibis.memtable({"a": [1, 2]})
>>> t1
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
│ 2 │
└───────┘
>>> t2 = ibis.memtable({"a": [2, 3]})
>>> t2
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
│ 3 │
└───────┘
>>> t1.difference(t2)
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
└───────┘
"""
node = ops.Difference(self, table, distinct=distinct)
for table in rest:
node = ops.Difference(node, table, distinct=distinct)
return node.to_expr().select(self.columns)
def aggregate(
self,
metrics: Sequence[ir.Scalar] | None = None,
by: Sequence[ir.Value] | None = None,
having: Sequence[ir.BooleanValue] | None = None,
**kwargs: ir.Value,
) -> Table:
"""Aggregate a table with a given set of reductions grouping by `by`.
Parameters
----------
metrics
Aggregate expressions. These can be any scalar-producing
expression, including aggregation functions like `sum` or literal
values like `ibis.literal(1)`.
by
Grouping expressions.
having
Post-aggregation filters. The shape requirements are the same
`metrics`, but the output type for `having` is `boolean`.
!!! warning "Expressions like `x is None` return `bool` and **will not** generate a SQL comparison to `NULL`"
kwargs
Named aggregate expressions
Returns
-------
Table
An aggregate table expression
Examples
--------
>>> import ibis
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"fruit": ["apple", "apple", "banana", "orange"], "price": [0.5, 0.5, 0.25, 0.33]})
>>> t
┏━━━━━━━━┳━━━━━━━━━┓
┃ fruit ┃ price ┃
┡━━━━━━━━╇━━━━━━━━━┩
│ string │ float64 │
├────────┼─────────┤
│ apple │ 0.50 │
│ apple │ 0.50 │
│ banana │ 0.25 │
│ orange │ 0.33 │
└────────┴─────────┘
>>> t.aggregate(by=["fruit"], total_cost=_.price.sum(), avg_cost=_.price.mean(), having=_.price.sum() < 0.5)
┏━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ fruit ┃ total_cost ┃ avg_cost ┃
┡━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ string │ float64 │ float64 │
├────────┼────────────┼──────────┤
│ banana │ 0.25 │ 0.25 │
│ orange │ 0.33 │ 0.33 │
└────────┴────────────┴──────────┘
"""
import ibis.expr.analysis as an
metrics = itertools.chain(
itertools.chain.from_iterable(
(
(_ensure_expr(self, m) for m in metric)
if isinstance(metric, (list, tuple))
else util.promote_list(_ensure_expr(self, metric))
)
for metric in util.promote_list(metrics)
),
(
e.name(name)
for name, expr in kwargs.items()
for e in util.promote_list(_ensure_expr(self, expr))
),
)
agg = ops.Aggregation(
self,
metrics=list(metrics),
by=bind_expr(self, util.promote_list(by)),
having=bind_expr(self, util.promote_list(having)),
)
agg = an.simplify_aggregation(agg)
return agg.to_expr()
agg = aggregate
def distinct(
self,
*,
on: str | Iterable[str] | s.Selector | None = None,
keep: Literal["first", "last"] | None = "first",
) -> Table:
"""Return a Table with duplicate rows removed.
Similar to `pandas.DataFrame.drop_duplicates()`.
!!! note "Some backends do not support `keep='last'`"
Parameters
----------
on
Only consider certain columns for identifying duplicates.
By default deduplicate all of the columns.
keep
Determines which duplicates to keep.
- `"first"`: Drop duplicates except for the first occurrence.
- `"last"`: Drop duplicates except for the last occurrence.
- `None`: Drop all duplicates
Examples
--------
>>> import ibis
>>> import ibis.examples as ex
>>> import ibis.selectors as s
>>> ibis.options.interactive = True
>>> t = ex.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Compute the distinct rows of a subset of columns
>>> t[["species", "island"]].distinct()
┏━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ species ┃ island ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━┩
│ string │ string │
├───────────┼───────────┤
│ Adelie │ Torgersen │
│ Adelie │ Biscoe │
│ Adelie │ Dream │
│ Gentoo │ Biscoe │
│ Chinstrap │ Dream │
└───────────┴───────────┘
Drop all duplicate rows except the first
>>> t.distinct(on=["species", "island"], keep="first")
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_… ┃ flipper_length_mm ┃ ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━┩
│ string │ string │ float64 │ float64 │ int64 │ │
├───────────┼───────────┼────────────────┼──────────────┼───────────────────┼──┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ │
│ Adelie │ Biscoe │ 37.8 │ 18.3 │ 174 │ │
│ Adelie │ Dream │ 39.5 │ 16.7 │ 178 │ │
│ Gentoo │ Biscoe │ 46.1 │ 13.2 │ 211 │ │
│ Chinstrap │ Dream │ 46.5 │ 17.9 │ 192 │ │
└───────────┴───────────┴────────────────┴──────────────┴───────────────────┴──┘
Drop all duplicate rows except the last
>>> t.distinct(on=["species", "island"], keep="last")
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_… ┃ flipper_length_mm ┃ ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━┩
│ string │ string │ float64 │ float64 │ int64 │ │
├───────────┼───────────┼────────────────┼──────────────┼───────────────────┼──┤
│ Adelie │ Torgersen │ 43.1 │ 19.2 │ 197 │ │
│ Adelie │ Biscoe │ 42.7 │ 18.3 │ 196 │ │
│ Adelie │ Dream │ 41.5 │ 18.5 │ 201 │ │
│ Gentoo │ Biscoe │ 49.9 │ 16.1 │ 213 │ │
│ Chinstrap │ Dream │ 50.2 │ 18.7 │ 198 │ │
└───────────┴───────────┴────────────────┴──────────────┴───────────────────┴──┘
Drop all duplicated rows
>>> expr = t.distinct(on=["species", "island", "year", "bill_length_mm"], keep=None)
>>> expr.count()
273
>>> t.count()
344
You can pass [`selectors`][ibis.selectors] to `on`
>>> t.distinct(on=~s.numeric())
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Biscoe │ 37.8 │ 18.3 │ 174 │ … │
│ Adelie │ Biscoe │ 37.7 │ 18.7 │ 180 │ … │
│ Adelie │ Dream │ 39.5 │ 16.7 │ 178 │ … │
│ Adelie │ Dream │ 37.2 │ 18.1 │ 178 │ … │
│ Adelie │ Dream │ 37.5 │ 18.9 │ 179 │ … │
│ Gentoo │ Biscoe │ 46.1 │ 13.2 │ 211 │ … │
│ Gentoo │ Biscoe │ 50.0 │ 16.3 │ 230 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
The only valid values of `keep` are `"first"`, `"last"` and [`None][None]
>>> t.distinct(on="species", keep="second")
Traceback (most recent call last):
...
ibis.common.exceptions.IbisError: Invalid value for keep: 'second' ...
"""
import ibis.selectors as s
if on is None:
# dedup everything
if keep != "first":
raise com.IbisError(
f"Only keep='first' (the default) makes sense when deduplicating all columns; got keep={keep!r}"
)
return ops.Distinct(self).to_expr()
on = s._to_selector(on)
if keep is None:
having = lambda t: t.count() == 1
how = "first"
elif keep == "first" or keep == "last":
having = None
how = keep
else:
raise com.IbisError(
f"Invalid value for `keep`: {keep!r}, must be 'first', 'last' or None"
)
aggs = {col.get_name(): col.arbitrary(how=how) for col in (~on).expand(self)}
gb = self.group_by(on)
if having is not None:
gb = gb.having(having)
res = gb.agg(**aggs)
assert len(res.columns) == len(self.columns)
if res.columns != self.columns:
return res.select(self.columns)
return res
def limit(self, n: int | None, offset: int = 0) -> Table:
"""Select `n` rows from `self` starting at `offset`.
!!! note "The result set is not deterministic without a call to [`order_by`][ibis.expr.types.relations.Table.order_by]."
Parameters
----------
n
Number of rows to include. If `None`, the entire table is selected
starting from `offset`.
offset
Number of rows to skip first
Returns
-------
Table
The first `n` rows of `self` starting at `offset`
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": [1, 1, 2], "b": ["c", "a", "a"]})
>>> t
┏━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━┩
│ int64 │ string │
├───────┼────────┤
│ 1 │ c │
│ 1 │ a │
│ 2 │ a │
└───────┴────────┘
>>> t.limit(2)
┏━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━┩
│ int64 │ string │
├───────┼────────┤
│ 1 │ c │
│ 1 │ a │
└───────┴────────┘
You can use `None` with `offset` to slice starting from a particular row
>>> t.limit(None, offset=1)
┏━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━┩
│ int64 │ string │
├───────┼────────┤
│ 1 │ a │
│ 2 │ a │
└───────┴────────┘
See Also
--------
[`Table.order_by`][ibis.expr.types.relations.Table.order_by]
"""
return ops.Limit(self, n, offset).to_expr()
def head(self, n: int = 5) -> Table:
"""Select the first `n` rows of a table.
!!! note "The result set is not deterministic without a call to [`order_by`][ibis.expr.types.relations.Table.order_by]."
Parameters
----------
n
Number of rows to include
Returns
-------
Table
`self` limited to `n` rows
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": [1, 1, 2], "b": ["c", "a", "a"]})
>>> t
┏━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━┩
│ int64 │ string │
├───────┼────────┤
│ 1 │ c │
│ 1 │ a │
│ 2 │ a │
└───────┴────────┘
>>> t.head(2)
┏━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃
┡━━━━━━━╇━━━━━━━━┩
│ int64 │ string │
├───────┼────────┤
│ 1 │ c │
│ 1 │ a │
└───────┴────────┘
See Also
--------
[`Table.limit`][ibis.expr.types.relations.Table.limit]
[`Table.order_by`][ibis.expr.types.relations.Table.order_by]
"""
return self.limit(n=n)
def order_by(
self,
by: str | ir.Column | Sequence[str] | Sequence[ir.Column] | None,
) -> Table:
"""Sort a table by one or more expressions.
Parameters
----------
by
Expressions to sort the table by.
Returns
-------
Table
Sorted table
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": [1, 2, 3], "b": ["c", "b", "a"], "c": [4, 6, 5]})
>>> t
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ a ┃ b ┃ c ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ int64 │ string │ int64 │
├───────┼────────┼───────┤
│ 1 │ c │ 4 │
│ 2 │ b │ 6 │
│ 3 │ a │ 5 │
└───────┴────────┴───────┘
>>> t.order_by("b")
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ a ┃ b ┃ c ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ int64 │ string │ int64 │
├───────┼────────┼───────┤
│ 3 │ a │ 5 │
│ 2 │ b │ 6 │
│ 1 │ c │ 4 │
└───────┴────────┴───────┘
>>> t.order_by(ibis.desc("c"))
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ a ┃ b ┃ c ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ int64 │ string │ int64 │
├───────┼────────┼───────┤
│ 2 │ b │ 6 │
│ 3 │ a │ 5 │
│ 1 │ c │ 4 │
└───────┴────────┴───────┘
"""
sort_keys = []
for item in util.promote_list(by):
if isinstance(item, tuple):
if len(item) != 2:
raise ValueError(
"Tuple must be of length 2, got {}".format(len(item))
)
item = (bind_expr(self, item[0]), item[1])
used_tuple_syntax = True
else:
item = bind_expr(self, item)
sort_keys.append(item)
return self.op().order_by(sort_keys).to_expr()
def union(self, table: Table, *rest: Table, distinct: bool = False) -> Table:
"""Compute the set union of multiple table expressions.
The input tables must have identical schemas.
Parameters
----------
table
A table expression
*rest
Additional table expressions
distinct
Only return distinct rows
Returns
-------
Table
A new table containing the union of all input tables.
See Also
--------
[`ibis.union`][ibis.union]
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t1 = ibis.memtable({"a": [1, 2]})
>>> t1
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
│ 2 │
└───────┘
>>> t2 = ibis.memtable({"a": [2, 3]})
>>> t2
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
│ 3 │
└───────┘
>>> t1.union(t2) # union all by default
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
│ 2 │
│ 2 │
│ 3 │
└───────┘
>>> t1.union(t2, distinct=True).order_by("a")
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
│ 2 │
│ 3 │
└───────┘
"""
node = ops.Union(self, table, distinct=distinct)
for table in rest:
node = ops.Union(node, table, distinct=distinct)
return node.to_expr().select(self.columns)
def intersect(self, table: Table, *rest: Table, distinct: bool = True) -> Table:
"""Compute the set intersection of multiple table expressions.
The input tables must have identical schemas.
Parameters
----------
table
A table expression
*rest
Additional table expressions
distinct
Only return distinct rows
Returns
-------
Table
A new table containing the intersection of all input tables.
See Also
--------
[`ibis.intersect`][ibis.intersect]
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t1 = ibis.memtable({"a": [1, 2]})
>>> t1
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 1 │
│ 2 │
└───────┘
>>> t2 = ibis.memtable({"a": [2, 3]})
>>> t2
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
│ 3 │
└───────┘
>>> t1.intersect(t2)
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
└───────┘
"""
node = ops.Intersection(self, table, distinct=distinct)
for table in rest:
node = ops.Intersection(node, table, distinct=distinct)
return node.to_expr().select(self.columns)
def to_array(self) -> ir.Column:
"""View a single column table as an array.
Returns
-------
Value
A single column view of a table
"""
schema = self.schema()
if len(schema) != 1:
raise com.ExpressionError(
"Table must have exactly one column when viewed as array"
)
return ops.TableArrayView(self).to_expr()
def mutate(
self, exprs: Sequence[ir.Expr] | None = None, **mutations: ir.Value
) -> Table:
"""Add columns to a table expression.
Parameters
----------
exprs
List of named expressions to add as columns
mutations
Named expressions using keyword arguments
Returns
-------
Table
Table expression with additional columns
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch().select("species", "year", "bill_length_mm")
>>> t
┏━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ species ┃ year ┃ bill_length_mm ┃
┡━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ int64 │ float64 │
├─────────┼───────┼────────────────┤
│ Adelie │ 2007 │ 39.1 │
│ Adelie │ 2007 │ 39.5 │
│ Adelie │ 2007 │ 40.3 │
│ Adelie │ 2007 │ nan │
│ Adelie │ 2007 │ 36.7 │
│ Adelie │ 2007 │ 39.3 │
│ Adelie │ 2007 │ 38.9 │
│ Adelie │ 2007 │ 39.2 │
│ Adelie │ 2007 │ 34.1 │
│ Adelie │ 2007 │ 42.0 │
│ … │ … │ … │
└─────────┴───────┴────────────────┘
Add a new column from a per-element expression
>>> t.mutate(next_year=_.year + 1).head()
┏━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ species ┃ year ┃ bill_length_mm ┃ next_year ┃
┡━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ string │ int64 │ float64 │ int64 │
├─────────┼───────┼────────────────┼───────────┤
│ Adelie │ 2007 │ 39.1 │ 2008 │
│ Adelie │ 2007 │ 39.5 │ 2008 │
│ Adelie │ 2007 │ 40.3 │ 2008 │
│ Adelie │ 2007 │ nan │ 2008 │
│ Adelie │ 2007 │ 36.7 │ 2008 │
└─────────┴───────┴────────────────┴───────────┘
Add a new column based on an aggregation. Note the automatic broadcasting.
>>> t.select("species", bill_demean=_.bill_length_mm - _.bill_length_mm.mean()).head()
┏━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ species ┃ bill_demean ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━┩
│ string │ float64 │
├─────────┼─────────────┤
│ Adelie │ -4.82193 │
│ Adelie │ -4.42193 │
│ Adelie │ -3.62193 │
│ Adelie │ nan │
│ Adelie │ -7.22193 │
└─────────┴─────────────┘
Mutate across multiple columns
>>> t.mutate(s.across(s.numeric() & ~s.c("year"), _ - _.mean())).head()
┏━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ species ┃ year ┃ bill_length_mm ┃
┡━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ int64 │ float64 │
├─────────┼───────┼────────────────┤
│ Adelie │ 2007 │ -4.82193 │
│ Adelie │ 2007 │ -4.42193 │
│ Adelie │ 2007 │ -3.62193 │
│ Adelie │ 2007 │ nan │
│ Adelie │ 2007 │ -7.22193 │
└─────────┴───────┴────────────────┘
"""
import ibis.expr.analysis as an
exprs = [] if exprs is None else util.promote_list(exprs)
exprs = itertools.chain(
itertools.chain.from_iterable(
util.promote_list(_ensure_expr(self, expr)) for expr in exprs
),
(
e.name(name)
for name, expr in mutations.items()
for e in util.promote_list(_ensure_expr(self, expr))
),
)
mutation_exprs = an.get_mutation_exprs(list(exprs), self)
return self.select(mutation_exprs)
def select(
self,
*exprs: ir.Value | str | Iterable[ir.Value | str],
**named_exprs: ir.Value | str,
) -> Table:
"""Compute a new table expression using `exprs` and `named_exprs`.
Passing an aggregate function to this method will broadcast the
aggregate's value over the number of rows in the table and
automatically constructs a window function expression. See the examples
section for more details.
For backwards compatibility the keyword argument `exprs` is reserved
and cannot be used to name an expression. This behavior will be removed
in v4.
Parameters
----------
exprs
Column expression, string, or list of column expressions and
strings.
named_exprs
Column expressions
Returns
-------
Table
Table expression
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Simple projection
>>> t.select("island", "bill_length_mm").head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ island ┃ bill_length_mm ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼────────────────┤
│ Torgersen │ 39.1 │
│ Torgersen │ 39.5 │
│ Torgersen │ 40.3 │
│ Torgersen │ nan │
│ Torgersen │ 36.7 │
└───────────┴────────────────┘
Projection by zero-indexed column position
>>> t.select(0, 4).head()
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ species ┃ flipper_length_mm ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │
├─────────┼───────────────────┤
│ Adelie │ 181 │
│ Adelie │ 186 │
│ Adelie │ 195 │
│ Adelie │ NULL │
│ Adelie │ 193 │
└─────────┴───────────────────┘
Projection with renaming and compute in one call
>>> t.select(next_year=t.year + 1).head()
┏━━━━━━━━━━━┓
┃ next_year ┃
┡━━━━━━━━━━━┩
│ int64 │
├───────────┤
│ 2008 │
│ 2008 │
│ 2008 │
│ 2008 │
│ 2008 │
└───────────┘
Projection with aggregation expressions
>>> t.select("island", bill_mean=t.bill_length_mm.mean()).head()
┏━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ island ┃ bill_mean ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼───────────┤
│ Torgersen │ 43.92193 │
│ Torgersen │ 43.92193 │
│ Torgersen │ 43.92193 │
│ Torgersen │ 43.92193 │
│ Torgersen │ 43.92193 │
└───────────┴───────────┘
Projection with a selector
>>> import ibis.selectors as s
>>> t.select(s.numeric() & ~s.c("year")).head()
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ float64 │ float64 │ int64 │ int64 │
├────────────────┼───────────────┼───────────────────┼─────────────┤
│ 39.1 │ 18.7 │ 181 │ 3750 │
│ 39.5 │ 17.4 │ 186 │ 3800 │
│ 40.3 │ 18.0 │ 195 │ 3250 │
│ nan │ nan │ NULL │ NULL │
│ 36.7 │ 19.3 │ 193 │ 3450 │
└────────────────┴───────────────┴───────────────────┴─────────────┘
Projection + aggregation across multiple columns
>>> from ibis import _
>>> t.select(s.across(s.numeric() & ~s.c("year"), _.mean())).head()
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ float64 │ float64 │ float64 │ float64 │
├────────────────┼───────────────┼───────────────────┼─────────────┤
│ 43.92193 │ 17.15117 │ 200.915205 │ 4201.754386 │
│ 43.92193 │ 17.15117 │ 200.915205 │ 4201.754386 │
│ 43.92193 │ 17.15117 │ 200.915205 │ 4201.754386 │
│ 43.92193 │ 17.15117 │ 200.915205 │ 4201.754386 │
│ 43.92193 │ 17.15117 │ 200.915205 │ 4201.754386 │
└────────────────┴───────────────┴───────────────────┴─────────────┘
"""
import ibis.expr.analysis as an
from ibis.selectors import Selector
exprs = list(
itertools.chain(
itertools.chain.from_iterable(
util.promote_list(e.expand(self) if isinstance(e, Selector) else e)
for e in exprs
),
(
self._ensure_expr(expr).name(name)
for name, expr in named_exprs.items()
),
)
)
if not exprs:
raise com.IbisTypeError(
"You must select at least one column for a valid projection"
)
op = an.Projector(self, exprs).get_result()
return op.to_expr()
projection = select
@util.deprecated(
as_of="7.0",
instead=(
"use `Table.rename` instead (if passing a mapping, note the meaning "
"of keys and values are swapped in Table.rename)."
),
)
def relabel(
self,
substitutions: Mapping[str, str]
| Callable[[str], str | None]
| str
| Literal["snake_case", "ALL_CAPS"],
) -> Table:
"""Deprecated in favor of `Table.rename`"""
if isinstance(substitutions, Mapping):
substitutions = {new: old for old, new in substitutions.items()}
return self.rename(substitutions)
def rename(
self,
method: str
| Callable[[str], str | None]
| Literal["snake_case", "ALL_CAPS"]
| Mapping[str, str]
| None = None,
/,
**substitutions: str,
) -> Table:
"""Rename columns in the table.
Parameters
----------
method
An optional method for renaming columns. May be one of:
- A format string to use to rename all columns, like
``"prefix_{name}"``.
- A function from old name to new name. If the function returns
``None`` the old name is used.
- The literal strings ``"snake_case"`` or ``"ALL_CAPS"`` to
rename all columns using a ``snake_case`` or ``"ALL_CAPS"``
naming convention respectively.
- A mapping from new name to old name. Existing columns not present
in the mapping will passthrough with their original name.
substitutions
Columns to be explicitly renamed, expressed as ``new_name=old_name``
keyword arguments.
Returns
-------
Table
A renamed table expression
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> ibis.options.interactive = True
>>> first3 = s.r[:3] # first 3 columns
>>> t = ibis.examples.penguins_raw_raw.fetch().select(first3)
>>> t
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ studyName ┃ Sample Number ┃ Species ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├───────────┼───────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 2 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 3 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 4 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 5 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 6 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 7 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 8 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 9 │ Adelie Penguin (Pygoscelis adeliae) │
│ PAL0708 │ 10 │ Adelie Penguin (Pygoscelis adeliae) │
│ … │ … │ … │
└───────────┴───────────────┴─────────────────────────────────────┘
Rename specific columns by passing keyword arguments like
``new_name="old_name"``
>>> t.rename(study_name="studyName").head(1)
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ study_name ┃ Sample Number ┃ Species ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├────────────┼───────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
└────────────┴───────────────┴─────────────────────────────────────┘
Rename all columns using a format string
>>> t.rename("p_{name}").head(1)
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ p_studyName ┃ p_Sample Number ┃ p_Species ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├─────────────┼─────────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
└─────────────┴─────────────────┴─────────────────────────────────────┘
Rename all columns using a snake_case convention
>>> t.rename("snake_case").head(1)
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ study_name ┃ sample_number ┃ species ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├────────────┼───────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
└────────────┴───────────────┴─────────────────────────────────────┘
Rename all columns using an ALL_CAPS convention
>>> t.rename("ALL_CAPS").head(1)
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ STUDY_NAME ┃ SAMPLE_NUMBER ┃ SPECIES ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├────────────┼───────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
└────────────┴───────────────┴─────────────────────────────────────┘
Rename all columns using a callable
>>> t.rename(str.upper).head(1)
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ STUDYNAME ┃ SAMPLE NUMBER ┃ SPECIES ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ int64 │ string │
├───────────┼───────────────┼─────────────────────────────────────┤
│ PAL0708 │ 1 │ Adelie Penguin (Pygoscelis adeliae) │
└───────────┴───────────────┴─────────────────────────────────────┘
"""
if isinstance(method, Mapping):
substitutions.update(method)
method = None
# A mapping from old_name -> renamed expr
renamed = {}
if substitutions:
schema = self.schema()
for new_name, old_name in substitutions.items():
col = self[old_name]
if old_name not in renamed:
renamed[old_name] = col.name(new_name)
else:
raise ValueError(
"duplicate new names passed for renaming {old_name!r}"
)
if method is None:
def rename(c):
return None
elif isinstance(method, str) and method in {"snake_case", "ALL_CAPS"}:
def rename(c):
c = c.strip()
if " " in c:
# Handle "space case possibly with-hyphens"
if method == "snake_case":
return "_".join(c.lower().split()).replace("-", "_")
elif method == "ALL_CAPS":
return "_".join(c.upper().split()).replace("-", "_")
# Handle PascalCase, camelCase, and kebab-case
c = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", c)
c = re.sub(r"([a-z\d])([A-Z])", r"\1_\2", c)
c = c.replace("-", "_")
if method == "snake_case":
return c.lower()
elif method == "ALL_CAPS":
return c.upper()
elif isinstance(method, str):
def rename(name):
return method.format(name=name)
# Detect the case of missing or extra format string parameters
try:
dummy_name1 = "_unlikely_column_name_1_"
dummy_name2 = "_unlikely_column_name_2_"
invalid = rename(dummy_name1) == rename(dummy_name2)
except KeyError:
invalid = True
if invalid:
raise ValueError("Format strings must take a single parameter `name`")
else:
rename = method
exprs = []
for c in self.columns:
if c in renamed:
expr = renamed[c]
else:
expr = self[c]
if (name := rename(c)) is not None:
expr = expr.name(name)
exprs.append(expr)
return self.select(exprs)
def drop(self, *fields: str | Selector) -> Table:
"""Remove fields from a table.
Parameters
----------
fields
Fields to drop. Strings and selectors are accepted.
Returns
-------
Table
A table with all columns matching `fields` removed.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Drop one or more columns
>>> t.drop("species").head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ float64 │ float64 │ int64 │ … │
├───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Torgersen │ nan │ nan │ NULL │ … │
│ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
└───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t.drop("species", "bill_length_mm").head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━┓
┃ island ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃ sex ┃ … ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━┩
│ string │ float64 │ int64 │ int64 │ string │ … │
├───────────┼───────────────┼───────────────────┼─────────────┼────────┼───┤
│ Torgersen │ 18.7 │ 181 │ 3750 │ male │ … │
│ Torgersen │ 17.4 │ 186 │ 3800 │ female │ … │
│ Torgersen │ 18.0 │ 195 │ 3250 │ female │ … │
│ Torgersen │ nan │ NULL │ NULL │ NULL │ … │
│ Torgersen │ 19.3 │ 193 │ 3450 │ female │ … │
└───────────┴───────────────┴───────────────────┴─────────────┴────────┴───┘
Drop with selectors, mix and match
>>> import ibis.selectors as s
>>> t.drop("species", s.startswith("bill_")).head()
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ island ┃ flipper_length_mm ┃ body_mass_g ┃ sex ┃ year ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ string │ int64 │ int64 │ string │ int64 │
├───────────┼───────────────────┼─────────────┼────────┼───────┤
│ Torgersen │ 181 │ 3750 │ male │ 2007 │
│ Torgersen │ 186 │ 3800 │ female │ 2007 │
│ Torgersen │ 195 │ 3250 │ female │ 2007 │
│ Torgersen │ NULL │ NULL │ NULL │ 2007 │
│ Torgersen │ 193 │ 3450 │ female │ 2007 │
└───────────┴───────────────────┴─────────────┴────────┴───────┘
"""
from ibis import selectors as s
if not fields:
# no-op if nothing to be dropped
return self
fields = tuple(
field.resolve(self) if isinstance(field, Deferred) else field
for field in fields
)
if missing_fields := {f for f in fields if isinstance(f, str)}.difference(
self.schema().names
):
raise KeyError(f"Fields not in table: {sorted(missing_fields)}")
return self.select(~s._to_selector(fields))
def filter(
self,
predicates: ir.BooleanValue | Sequence[ir.BooleanValue] | IfAnyAll,
) -> Table:
"""Select rows from `table` based on `predicates`.
Parameters
----------
predicates
Boolean value expressions used to select rows in `table`.
Returns
-------
Table
Filtered table expression
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t.filter([t.species == "Adelie", t.body_mass_g > 3500]).sex.value_counts().dropna("sex")
┏━━━━━━━━┳━━━━━━━━━━━┓
┃ sex ┃ sex_count ┃
┡━━━━━━━━╇━━━━━━━━━━━┩
│ string │ int64 │
├────────┼───────────┤
│ male │ 68 │
│ female │ 22 │
└────────┴───────────┘
"""
import ibis.expr.analysis as an
resolved_predicates = _resolve_predicates(self, predicates)
predicates = [
an._rewrite_filter(pred.op() if isinstance(pred, Expr) else pred)
for pred in resolved_predicates
]
return an.apply_filter(self.op(), predicates).to_expr()
def nunique(self, where: ir.BooleanValue | None = None) -> ir.IntegerScalar:
"""Compute the number of unique rows in the table.
Parameters
----------
where
Optional boolean expression to filter rows when counting.
Returns
-------
IntegerScalar
Number of unique rows in the table
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": ["foo", "bar", "bar"]})
>>> t
┏━━━━━━━━┓
┃ a ┃
┡━━━━━━━━┩
│ string │
├────────┤
│ foo │
│ bar │
│ bar │
└────────┘
>>> t.nunique()
2
>>> t.nunique(t.a != "foo")
1
"""
return ops.CountDistinctStar(self, where=where).to_expr()
def count(self, where: ir.BooleanValue | None = None) -> ir.IntegerScalar:
"""Compute the number of rows in the table.
Parameters
----------
where
Optional boolean expression to filter rows when counting.
Returns
-------
IntegerScalar
Number of rows in the table
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": ["foo", "bar", "baz"]})
>>> t
┏━━━━━━━━┓
┃ a ┃
┡━━━━━━━━┩
│ string │
├────────┤
│ foo │
│ bar │
│ baz │
└────────┘
>>> t.count()
3
>>> t.count(t.a != "foo")
2
>>> type(t.count())
<class 'ibis.expr.types.numeric.IntegerScalar'>
"""
return ops.CountStar(self, where).to_expr()
def dropna(
self,
subset: Sequence[str] | str | None = None,
how: Literal["any", "all"] = "any",
) -> Table:
"""Remove rows with null values from the table.
Parameters
----------
subset
Columns names to consider when dropping nulls. By default all columns
are considered.
how
Determine whether a row is removed if there is **at least one null
value in the row** (`'any'`), or if **all** row values are null
(`'all'`).
Returns
-------
Table
Table expression
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> t.count()
344
>>> t.dropna(["bill_length_mm", "body_mass_g"]).count()
342
>>> t.dropna(how="all").count() # no rows where all columns are null
344
"""
if subset is not None:
subset = bind_expr(self, util.promote_list(subset))
return ops.DropNa(self, how, subset).to_expr()
def fillna(
self,
replacements: ir.Scalar | Mapping[str, ir.Scalar],
) -> Table:
"""Fill null values in a table expression.
!!! note "There is potential lack of type stability with the `fillna` API"
For example, different library versions may impact whether a given
backend promotes integer replacement values to floats.
Parameters
----------
replacements
Value with which to fill nulls. If `replacements` is a mapping, the
keys are column names that map to their replacement value. If
passed as a scalar all columns are filled with that value.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.sex
┏━━━━━━━━┓
┃ sex ┃
┡━━━━━━━━┩
│ string │
├────────┤
│ male │
│ female │
│ female │
│ NULL │
│ female │
│ male │
│ female │
│ male │
│ NULL │
│ NULL │
│ … │
└────────┘
>>> t.fillna({"sex": "unrecorded"}).sex
┏━━━━━━━━━━━━┓
┃ sex ┃
┡━━━━━━━━━━━━┩
│ string │
├────────────┤
│ male │
│ female │
│ female │
│ unrecorded │
│ female │
│ male │
│ female │
│ male │
│ unrecorded │
│ unrecorded │
│ … │
└────────────┘
Returns
-------
Table
Table expression
"""
schema = self.schema()
if isinstance(replacements, collections.abc.Mapping):
for col, val in replacements.items():
if col not in schema:
columns_formatted = ", ".join(map(repr, schema.names))
raise com.IbisTypeError(
f"Column {col!r} is not found in table. "
f"Existing columns: {columns_formatted}."
) from None
col_type = schema[col]
val_type = val.type() if isinstance(val, Expr) else dt.infer(val)
if not dt.castable(val_type, col_type):
raise com.IbisTypeError(
f"Cannot fillna on column {col!r} of type {col_type} with a "
f"value of type {val_type}"
)
else:
val_type = (
replacements.type()
if isinstance(replacements, Expr)
else dt.infer(replacements)
)
for col, col_type in schema.items():
if col_type.nullable and not dt.castable(val_type, col_type):
raise com.IbisTypeError(
f"Cannot fillna on column {col!r} of type {col_type} with a "
f"value of type {val_type} - pass in an explicit mapping "
f"of fill values to `fillna` instead."
)
return ops.FillNa(self, replacements).to_expr()
def unpack(self, *columns: str) -> Table:
"""Project the struct fields of each of `columns` into `self`.
Existing fields are retained in the projection.
Parameters
----------
columns
String column names to project into `self`.
Returns
-------
Table
The child table with struct fields of each of `columns` projected.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> lines = '''
... {"name": "a", "pos": {"lat": 10.1, "lon": 30.3}}
... {"name": "b", "pos": {"lat": 10.2, "lon": 30.2}}
... {"name": "c", "pos": {"lat": 10.3, "lon": 30.1}}
... '''
>>> with open("/tmp/lines.json", "w") as f:
... _ = f.write(lines)
>>> t = ibis.read_json("/tmp/lines.json")
>>> t
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ name ┃ pos ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ struct<lat: float64, lon: float64> │
├────────┼────────────────────────────────────┤
│ a │ {'lat': 10.1, 'lon': 30.3} │
│ b │ {'lat': 10.2, 'lon': 30.2} │
│ c │ {'lat': 10.3, 'lon': 30.1} │
└────────┴────────────────────────────────────┘
>>> t.unpack("pos")
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
┃ name ┃ lat ┃ lon ┃
┡━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
│ string │ float64 │ float64 │
├────────┼─────────┼─────────┤
│ a │ 10.1 │ 30.3 │
│ b │ 10.2 │ 30.2 │
│ c │ 10.3 │ 30.1 │
└────────┴─────────┴─────────┘
See Also
--------
[`StructValue.lift`][ibis.expr.types.structs.StructValue.lift]
"""
columns_to_unpack = frozenset(columns)
result_columns = []
for column in self.columns:
if column in columns_to_unpack:
expr = self[column]
result_columns.extend(expr[field] for field in expr.names)
else:
result_columns.append(column)
return self[result_columns]
def info(self) -> Table:
"""Return summary information about a table.
Returns
-------
Table
Summary of `self`
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.info()
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━┓
┃ name ┃ type ┃ nullable ┃ nulls ┃ non_nulls ┃ null_frac ┃ … ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━┩
│ string │ string │ boolean │ int64 │ int64 │ float64 │ … │
├───────────────────┼─────────┼──────────┼───────┼───────────┼───────────┼───┤
│ species │ string │ True │ 0 │ 344 │ 0.000000 │ … │
│ island │ string │ True │ 0 │ 344 │ 0.000000 │ … │
│ bill_length_mm │ float64 │ True │ 2 │ 342 │ 0.005814 │ … │
│ bill_depth_mm │ float64 │ True │ 2 │ 342 │ 0.005814 │ … │
│ flipper_length_mm │ int64 │ True │ 2 │ 342 │ 0.005814 │ … │
│ body_mass_g │ int64 │ True │ 2 │ 342 │ 0.005814 │ … │
│ sex │ string │ True │ 11 │ 333 │ 0.031977 │ … │
│ year │ int64 │ True │ 0 │ 344 │ 0.000000 │ … │
└───────────────────┴─────────┴──────────┴───────┴───────────┴───────────┴───┘
"""
from ibis import literal as lit
aggs = []
for pos, colname in enumerate(self.columns):
col = self[colname]
typ = col.type()
agg = self.select(
isna=ibis.case().when(col.isnull(), 1).else_(0).end()
).agg(
name=lit(colname),
type=lit(str(typ)),
nullable=lit(int(typ.nullable)).cast("bool"),
nulls=lambda t: t.isna.sum(),
non_nulls=lambda t: (1 - t.isna).sum(),
null_frac=lambda t: t.isna.mean(),
pos=lit(pos),
)
aggs.append(agg)
return ibis.union(*aggs).order_by(ibis.asc("pos"))
def join(
left: Table,
right: Table,
predicates: str
| Sequence[
str | tuple[str | ir.Column, str | ir.Column] | ir.BooleanColumn
] = (),
how: Literal[
"inner",
"left",
"outer",
"right",
"semi",
"anti",
"any_inner",
"any_left",
"left_semi",
] = "inner",
*,
lname: str = "",
rname: str = "{name}_right",
) -> Table:
"""Perform a join between two tables.
Parameters
----------
left
Left table to join
right
Right table to join
predicates
Boolean or column names to join on
how
Join method
lname
A format string to use to rename overlapping columns in the left
table (e.g. ``"left_{name}"``).
rname
A format string to use to rename overlapping columns in the right
table (e.g. ``"right_{name}"``).
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> import ibis.examples as ex
>>> from ibis import _
>>> ibis.options.interactive = True
>>> movies = ex.ml_latest_small_movies.fetch()
>>> movies
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ movieId ┃ title ┃ genres ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ int64 │ string │ string │
├─────────┼──────────────────────────────────┼─────────────────────────────────┤
│ 1 │ Toy Story (1995) │ Adventure|Animation|Children|C… │
│ 2 │ Jumanji (1995) │ Adventure|Children|Fantasy │
│ 3 │ Grumpier Old Men (1995) │ Comedy|Romance │
│ 4 │ Waiting to Exhale (1995) │ Comedy|Drama|Romance │
│ 5 │ Father of the Bride Part II (19… │ Comedy │
│ 6 │ Heat (1995) │ Action|Crime|Thriller │
│ 7 │ Sabrina (1995) │ Comedy|Romance │
│ 8 │ Tom and Huck (1995) │ Adventure|Children │
│ 9 │ Sudden Death (1995) │ Action │
│ 10 │ GoldenEye (1995) │ Action|Adventure|Thriller │
│ … │ … │ … │
└─────────┴──────────────────────────────────┴─────────────────────────────────┘
>>> links = ex.ml_latest_small_links.fetch()
>>> links
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
┃ movieId ┃ imdbId ┃ tmdbId ┃
┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━┩
│ int64 │ string │ int64 │
├─────────┼─────────┼────────┤
│ 1 │ 0114709 │ 862 │
│ 2 │ 0113497 │ 8844 │
│ 3 │ 0113228 │ 15602 │
│ 4 │ 0114885 │ 31357 │
│ 5 │ 0113041 │ 11862 │
│ 6 │ 0113277 │ 949 │
│ 7 │ 0114319 │ 11860 │
│ 8 │ 0112302 │ 45325 │
│ 9 │ 0114576 │ 9091 │
│ 10 │ 0113189 │ 710 │
│ … │ … │ … │
└─────────┴─────────┴────────┘
Implicit inner equality join on the shared `movieId` column
>>> linked = movies.join(links, "movieId", how="inner")
>>> linked.head()
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
┃ movieId ┃ title ┃ genres ┃ imdbId ┃ tmdbId ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━┩
│ int64 │ string │ string │ string │ int64 │
├─────────┼────────────────────────┼────────────────────────┼─────────┼────────┤
│ 1 │ Toy Story (1995) │ Adventure|Animation|C… │ 0114709 │ 862 │
│ 2 │ Jumanji (1995) │ Adventure|Children|Fa… │ 0113497 │ 8844 │
│ 3 │ Grumpier Old Men (199… │ Comedy|Romance │ 0113228 │ 15602 │
│ 4 │ Waiting to Exhale (19… │ Comedy|Drama|Romance │ 0114885 │ 31357 │
│ 5 │ Father of the Bride P… │ Comedy │ 0113041 │ 11862 │
└─────────┴────────────────────────┴────────────────────────┴─────────┴────────┘
Explicit equality join using the default `how` value of `"inner"`
>>> linked = movies.join(links, movies.movieId == links.movieId)
>>> linked.head()
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
┃ movieId ┃ title ┃ genres ┃ imdbId ┃ tmdbId ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━┩
│ int64 │ string │ string │ string │ int64 │
├─────────┼────────────────────────┼────────────────────────┼─────────┼────────┤
│ 1 │ Toy Story (1995) │ Adventure|Animation|C… │ 0114709 │ 862 │
│ 2 │ Jumanji (1995) │ Adventure|Children|Fa… │ 0113497 │ 8844 │
│ 3 │ Grumpier Old Men (199… │ Comedy|Romance │ 0113228 │ 15602 │
│ 4 │ Waiting to Exhale (19… │ Comedy|Drama|Romance │ 0114885 │ 31357 │
│ 5 │ Father of the Bride P… │ Comedy │ 0113041 │ 11862 │
└─────────┴────────────────────────┴────────────────────────┴─────────┴────────┘
"""
_join_classes = {
"inner": ops.InnerJoin,
"left": ops.LeftJoin,
"any_inner": ops.AnyInnerJoin,
"any_left": ops.AnyLeftJoin,
"outer": ops.OuterJoin,
"right": ops.RightJoin,
"left_semi": ops.LeftSemiJoin,
"semi": ops.LeftSemiJoin,
"anti": ops.LeftAntiJoin,
"cross": ops.CrossJoin,
}
klass = _join_classes[how.lower()]
expr = klass(left, right, predicates).to_expr()
# semi/anti join only give access to the left table's fields, so
# there's never overlap
if how in ("left_semi", "semi", "anti"):
return expr
return ops.relations._dedup_join_columns(expr, lname=lname, rname=rname)
def asof_join(
left: Table,
right: Table,
predicates: str | ir.BooleanColumn | Sequence[str | ir.BooleanColumn] = (),
by: str | ir.Column | Sequence[str | ir.Column] = (),
tolerance: str | ir.IntervalScalar | None = None,
*,
lname: str = "",
rname: str = "{name}_right",
) -> Table:
"""Perform an "as-of" join between `left` and `right`.
Similar to a left join except that the match is done on nearest key
rather than equal keys.
Optionally, match keys with `by` before joining with `predicates`.
Parameters
----------
left
Table expression
right
Table expression
predicates
Join expressions
by
column to group by before joining
tolerance
Amount of time to look behind when joining
lname
A format string to use to rename overlapping columns in the left
table (e.g. ``"left_{name}"``).
rname
A format string to use to rename overlapping columns in the right
table (e.g. ``"right_{name}"``).
Returns
-------
Table
Table expression
"""
op = ops.AsOfJoin(
left=left,
right=right,
predicates=predicates,
by=by,
tolerance=tolerance,
)
return ops.relations._dedup_join_columns(op.to_expr(), lname=lname, rname=rname)
def cross_join(
left: Table,
right: Table,
*rest: Table,
lname: str = "",
rname: str = "{name}_right",
) -> Table:
"""Compute the cross join of a sequence of tables.
Parameters
----------
left
Left table
right
Right table
rest
Additional tables to cross join
lname
A format string to use to rename overlapping columns in the left
table (e.g. ``"left_{name}"``).
rname
A format string to use to rename overlapping columns in the right
table (e.g. ``"right_{name}"``).
Returns
-------
Table
Cross join of `left`, `right` and `rest`
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> t.count()
344
>>> agg = t.drop("year").agg(s.across(s.numeric(), _.mean()))
>>> expr = t.cross_join(agg)
>>> expr
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
>>> expr.columns
['species',
'island',
'bill_length_mm',
'bill_depth_mm',
'flipper_length_mm',
'body_mass_g',
'sex',
'year',
'bill_length_mm_right',
'bill_depth_mm_right',
'flipper_length_mm_right',
'body_mass_g_right']
>>> expr.count()
344
"""
op = ops.CrossJoin(
left,
functools.reduce(Table.cross_join, rest, right),
[],
)
return ops.relations._dedup_join_columns(op.to_expr(), lname=lname, rname=rname)
inner_join = _regular_join_method("inner_join", "inner")
left_join = _regular_join_method("left_join", "left")
outer_join = _regular_join_method("outer_join", "outer")
right_join = _regular_join_method("right_join", "right")
semi_join = _regular_join_method("semi_join", "semi")
anti_join = _regular_join_method("anti_join", "anti")
any_inner_join = _regular_join_method("any_inner_join", "any_inner")
any_left_join = _regular_join_method("any_left_join", "any_left")
def alias(self, alias: str) -> ir.Table:
"""Create a table expression with a specific name `alias`.
This method is useful for exposing an ibis expression to the underlying
backend for use in the
[`Table.sql`][ibis.expr.types.relations.Table.sql] method.
!!! note "`.alias` will create a temporary view"
`.alias` creates a temporary view in the database.
This side effect will be removed in a future version of ibis and
**is not part of the public API**.
Parameters
----------
alias
Name of the child expression
Returns
-------
Table
An table expression
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> expr = t.alias("pingüinos").sql('SELECT * FROM "pingüinos" LIMIT 5')
>>> expr
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
"""
expr = ops.View(child=self, name=alias).to_expr()
# NB: calling compile is necessary so that any temporary views are
# created so that we can infer the schema without executing the entire
# query
expr.compile()
return expr
def sql(self, query: str, dialect: str | None = None) -> ir.Table:
'''Run a SQL query against a table expression.
Parameters
----------
query
Query string
dialect
Optional string indicating the dialect of `query`. Defaults to the
backend's native dialect.
Returns
-------
Table
An opaque table expression
Examples
--------
>>> import ibis
>>> from ibis import _
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch(table_name="penguins")
>>> expr = t.sql(
... """
... SELECT island, mean(bill_length_mm) AS avg_bill_length
... FROM penguins
... GROUP BY 1
... ORDER BY 2 DESC
... """
... )
>>> expr
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ island ┃ avg_bill_length ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼─────────────────┤
│ Biscoe │ 45.257485 │
│ Dream │ 44.167742 │
│ Torgersen │ 38.950980 │
└───────────┴─────────────────┘
Mix and match ibis expressions with SQL queries
>>> t = ibis.examples.penguins.fetch(table_name="penguins")
>>> expr = t.sql(
... """
... SELECT island, mean(bill_length_mm) AS avg_bill_length
... FROM penguins
... GROUP BY 1
... ORDER BY 2 DESC
... """
... )
>>> expr = expr.mutate(
... island=_.island.lower(),
... avg_bill_length=_.avg_bill_length.round(1),
... )
>>> expr
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ island ┃ avg_bill_length ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├───────────┼─────────────────┤
│ biscoe │ 45.3 │
│ dream │ 44.2 │
│ torgersen │ 39.0 │
└───────────┴─────────────────┘
Because ibis expressions aren't named, they aren't visible to
subsequent `.sql` calls. Use the [`alias`][ibis.expr.types.relations.Table.alias] method
to assign a name to an expression.
>>> expr.alias("b").sql("SELECT * FROM b WHERE avg_bill_length > 40")
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ island ┃ avg_bill_length ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ string │ float64 │
├────────┼─────────────────┤
│ biscoe │ 45.3 │
│ dream │ 44.2 │
└────────┴─────────────────┘
See Also
--------
[`Table.alias`][ibis.expr.types.relations.Table.alias]
'''
# only transpile if dialect was passed
if dialect is not None:
backend = self._find_backend()
query = backend._transpile_sql(query, dialect=dialect)
op = ops.SQLStringView(child=self, name=next(_ALIASES), query=query)
return op.to_expr()
def to_pandas(self, **kwargs) -> pd.DataFrame:
"""Convert a table expression to a pandas DataFrame.
Parameters
----------
kwargs
Same as keyword arguments to [`execute`][ibis.expr.types.core.Expr.execute]
"""
return self.execute(**kwargs)
def cache(self) -> Table:
"""Cache the provided expression.
All subsequent operations on the returned expression will be performed
on the cached data. Use the
[`with`](https://docs.python.org/3/reference/compound_stmts.html#with)
statement to limit the lifetime of a cached table.
This method is idempotent: calling it multiple times in succession will
return the same value as the first call.
!!! note "This method eagerly evaluates the expression prior to caching"
Subsequent evaluations will not recompute the expression so method
chaining will not incur the overhead of caching more than once.
Returns
-------
Table
Cached table
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.examples.penguins.fetch()
>>> cached_penguins = t.mutate(computation="Heavy Computation").cache()
>>> cached_penguins
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
Explicit cache cleanup
>>> with t.mutate(computation="Heavy Computation").cache() as cached_penguins:
... cached_penguins
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ int64 │ … │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │
│ Adelie │ Torgersen │ nan │ nan │ NULL │ … │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │
│ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘
"""
current_backend = self._find_backend(use_default=True)
return current_backend._cached(self)
def pivot_longer(
self,
col: str | s.Selector,
*,
names_to: str | Iterable[str] = "name",
names_pattern: str | re.Pattern = r"(.+)",
names_transform: Callable[[str], ir.Value]
| Mapping[str, Callable[[str], ir.Value]]
| None = None,
values_to: str = "value",
values_transform: Callable[[ir.Value], ir.Value] | Deferred | None = None,
) -> Table:
"""Transform a table from wider to longer.
Parameters
----------
col
String column name or selector.
names_to
A string or iterable of strings indicating how to name the new
pivoted columns.
names_pattern
Pattern to use to extract column names from the input. By default
the entire column name is extracted.
names_transform
Function or mapping of a name in `names_to` to a function to
transform a column name to a value.
values_to
Name of the pivoted value column.
values_transform
Apply a function to the value column. This can be a lambda or
deferred expression.
Returns
-------
Table
Pivoted table
Examples
--------
Basic usage
>>> import ibis
>>> import ibis.selectors as s
>>> from ibis import _
>>> ibis.options.interactive = True
>>> relig_income = ibis.examples.relig_income_raw.fetch()
>>> relig_income
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━┓
┃ religion ┃ <$10k ┃ $10-20k ┃ $20-30k ┃ $30-40k ┃ $40-50k ┃ … ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━┩
│ string │ int64 │ int64 │ int64 │ int64 │ int64 │ … │
├─────────────────────────┼───────┼─────────┼─────────┼─────────┼─────────┼───┤
│ Agnostic │ 27 │ 34 │ 60 │ 81 │ 76 │ … │
│ Atheist │ 12 │ 27 │ 37 │ 52 │ 35 │ … │
│ Buddhist │ 27 │ 21 │ 30 │ 34 │ 33 │ … │
│ Catholic │ 418 │ 617 │ 732 │ 670 │ 638 │ … │
│ Don’t know/refused │ 15 │ 14 │ 15 │ 11 │ 10 │ … │
│ Evangelical Prot │ 575 │ 869 │ 1064 │ 982 │ 881 │ … │
│ Hindu │ 1 │ 9 │ 7 │ 9 │ 11 │ … │
│ Historically Black Prot │ 228 │ 244 │ 236 │ 238 │ 197 │ … │
│ Jehovah's Witness │ 20 │ 27 │ 24 │ 24 │ 21 │ … │
│ Jewish │ 19 │ 19 │ 25 │ 25 │ 30 │ … │
│ … │ … │ … │ … │ … │ … │ … │
└─────────────────────────┴───────┴─────────┴─────────┴─────────┴─────────┴───┘
Here we convert column names not matching the selector for the `religion` column
and convert those names into values
>>> relig_income.pivot_longer(~s.c("religion"), names_to="income", values_to="count")
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
┃ religion ┃ income ┃ count ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩
│ string │ string │ int64 │
├──────────┼────────────────────┼───────┤
│ Agnostic │ <$10k │ 27 │
│ Agnostic │ $10-20k │ 34 │
│ Agnostic │ $20-30k │ 60 │
│ Agnostic │ $30-40k │ 81 │
│ Agnostic │ $40-50k │ 76 │
│ Agnostic │ $50-75k │ 137 │
│ Agnostic │ $75-100k │ 122 │
│ Agnostic │ $100-150k │ 109 │
│ Agnostic │ >150k │ 84 │
│ Agnostic │ Don't know/refused │ 96 │
│ … │ … │ … │
└──────────┴────────────────────┴───────┘
Similarly for a different example dataset, we convert names to values
but using a different selector and the default `values_to` value.
>>> world_bank_pop = ibis.examples.world_bank_pop_raw.fetch()
>>> world_bank_pop.head()
┏━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━┓
┃ country ┃ indicator ┃ 2000 ┃ 2001 ┃ 2002 ┃ … ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ float64 │ float64 │ float64 │ … │
├─────────┼─────────────┼──────────────┼──────────────┼──────────────┼───┤
│ ABW │ SP.URB.TOTL │ 4.244400e+04 │ 4.304800e+04 │ 4.367000e+04 │ … │
│ ABW │ SP.URB.GROW │ 1.182632e+00 │ 1.413021e+00 │ 1.434560e+00 │ … │
│ ABW │ SP.POP.TOTL │ 9.085300e+04 │ 9.289800e+04 │ 9.499200e+04 │ … │
│ ABW │ SP.POP.GROW │ 2.055027e+00 │ 2.225930e+00 │ 2.229056e+00 │ … │
│ AFG │ SP.URB.TOTL │ 4.436299e+06 │ 4.648055e+06 │ 4.892951e+06 │ … │
└─────────┴─────────────┴──────────────┴──────────────┴──────────────┴───┘
>>> world_bank_pop.pivot_longer(s.matches(r"\\d{4}"), names_to="year").head()
┏━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━┓
┃ country ┃ indicator ┃ year ┃ value ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━┩
│ string │ string │ string │ float64 │
├─────────┼─────────────┼────────┼─────────┤
│ ABW │ SP.URB.TOTL │ 2000 │ 42444.0 │
│ ABW │ SP.URB.TOTL │ 2001 │ 43048.0 │
│ ABW │ SP.URB.TOTL │ 2002 │ 43670.0 │
│ ABW │ SP.URB.TOTL │ 2003 │ 44246.0 │
│ ABW │ SP.URB.TOTL │ 2004 │ 44669.0 │
└─────────┴─────────────┴────────┴─────────┘
`pivot_longer` has some preprocessing capabiltiies like stripping a prefix and applying
a function to column names
>>> billboard = ibis.examples.billboard.fetch()
>>> billboard
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━┓
┃ artist ┃ track ┃ date_entered ┃ wk1 ┃ wk2 ┃ … ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━┩
│ string │ string │ date │ int64 │ int64 │ … │
├────────────────┼─────────────────────────┼──────────────┼───────┼───────┼───┤
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 87 │ 82 │ … │
│ 2Ge+her │ The Hardest Part Of ... │ 2000-09-02 │ 91 │ 87 │ … │
│ 3 Doors Down │ Kryptonite │ 2000-04-08 │ 81 │ 70 │ … │
│ 3 Doors Down │ Loser │ 2000-10-21 │ 76 │ 76 │ … │
│ 504 Boyz │ Wobble Wobble │ 2000-04-15 │ 57 │ 34 │ … │
│ 98^0 │ Give Me Just One Nig... │ 2000-08-19 │ 51 │ 39 │ … │
│ A*Teens │ Dancing Queen │ 2000-07-08 │ 97 │ 97 │ … │
│ Aaliyah │ I Don't Wanna │ 2000-01-29 │ 84 │ 62 │ … │
│ Aaliyah │ Try Again │ 2000-03-18 │ 59 │ 53 │ … │
│ Adams, Yolanda │ Open My Heart │ 2000-08-26 │ 76 │ 76 │ … │
│ … │ … │ … │ … │ … │ … │
└────────────────┴─────────────────────────┴──────────────┴───────┴───────┴───┘
>>> billboard.pivot_longer(
... s.startswith("wk"),
... names_to="week",
... names_pattern=r"wk(.+)",
... names_transform=int,
... values_to="rank",
... values_transform=_.cast("int"),
... ).dropna("rank")
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━┓
┃ artist ┃ track ┃ date_entered ┃ week ┃ rank ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━┩
│ string │ string │ date │ int8 │ int64 │
├─────────┼─────────────────────────┼──────────────┼──────┼───────┤
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 1 │ 87 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 2 │ 82 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 3 │ 72 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 4 │ 77 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 5 │ 87 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 6 │ 94 │
│ 2 Pac │ Baby Don't Cry (Keep... │ 2000-02-26 │ 7 │ 99 │
│ 2Ge+her │ The Hardest Part Of ... │ 2000-09-02 │ 1 │ 91 │
│ 2Ge+her │ The Hardest Part Of ... │ 2000-09-02 │ 2 │ 87 │
│ 2Ge+her │ The Hardest Part Of ... │ 2000-09-02 │ 3 │ 92 │
│ … │ … │ … │ … │ … │
└─────────┴─────────────────────────┴──────────────┴──────┴───────┘
You can use regular expression capture groups to extract multiple
variables stored in column names
>>> who = ibis.examples.who.fetch()
>>> who
┏━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━┓
┃ country ┃ iso2 ┃ iso3 ┃ year ┃ new_sp_m014 ┃ new_sp_m1524 ┃ … ┃
┡━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━┩
│ string │ string │ string │ int64 │ int64 │ int64 │ … │
├─────────────┼────────┼────────┼───────┼─────────────┼──────────────┼───┤
│ Afghanistan │ AF │ AFG │ 1980 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1981 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1982 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1983 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1984 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1985 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1986 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1987 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1988 │ NULL │ NULL │ … │
│ Afghanistan │ AF │ AFG │ 1989 │ NULL │ NULL │ … │
│ … │ … │ … │ … │ … │ … │ … │
└─────────────┴────────┴────────┴───────┴─────────────┴──────────────┴───┘
>>> len(who.columns)
60
>>> who.pivot_longer(
... s.r["new_sp_m014":"newrel_f65"],
... names_to=["diagnosis", "gender", "age"],
... names_pattern="new_?(.*)_(.)(.*)",
... values_to="count",
... )
┏━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ country ┃ iso2 ┃ iso3 ┃ year ┃ diagnosis ┃ gender ┃ age ┃ count ┃
┡━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ string │ string │ string │ int64 │ string │ string │ string │ int64 │
├─────────────┼────────┼────────┼───────┼───────────┼────────┼────────┼───────┤
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 014 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 1524 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 2534 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 3544 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 4554 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 5564 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ m │ 65 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ f │ 014 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ f │ 1524 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ f │ 2534 │ NULL │
│ … │ … │ … │ … │ … │ … │ … │ … │
└─────────────┴────────┴────────┴───────┴───────────┴────────┴────────┴───────┘
`names_transform` is flexible, and can be:
1. A mapping of one or more names in `names_to` to callable
2. A callable that will be applied to every name
Let's recode gender and age to numeric values using a mapping
>>> who.pivot_longer(
... s.r["new_sp_m014":"newrel_f65"],
... names_to=["diagnosis", "gender", "age"],
... names_pattern="new_?(.*)_(.)(.*)",
... names_transform=dict(
... gender={"m": 1, "f": 2}.get,
... age=dict(zip(["014", "1524", "2534", "3544", "4554", "5564", "65"], range(7))).get,
... ),
... values_to="count",
... )
┏━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┳━━━━━━━┓
┃ country ┃ iso2 ┃ iso3 ┃ year ┃ diagnosis ┃ gender ┃ age ┃ count ┃
┡━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━╇━━━━━━━┩
│ string │ string │ string │ int64 │ string │ int8 │ int8 │ int64 │
├─────────────┼────────┼────────┼───────┼───────────┼────────┼──────┼───────┤
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 0 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 1 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 2 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 3 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 4 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 5 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 1 │ 6 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 2 │ 0 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 2 │ 1 │ NULL │
│ Afghanistan │ AF │ AFG │ 1980 │ sp │ 2 │ 2 │ NULL │
│ … │ … │ … │ … │ … │ … │ … │ … │
└─────────────┴────────┴────────┴───────┴───────────┴────────┴──────┴───────┘
The number of match groups in `names_pattern` must match the length of `names_to`
>>> who.pivot_longer(
... s.r["new_sp_m014":"newrel_f65"],
... names_to=["diagnosis", "gender", "age"],
... names_pattern="new_?(.*)_.(.*)",
... )
Traceback (most recent call last):
...
ibis.common.exceptions.IbisInputError: Number of match groups in `names_pattern` ...
`names_transform` must be a mapping or callable
>>> who.pivot_longer(s.r["new_sp_m014":"newrel_f65"], names_transform="upper")
Traceback (most recent call last):
...
ibis.common.exceptions.IbisTypeError: ... Got <class 'str'>
"""
import ibis.selectors as s
pivot_sel = s._to_selector(col)
pivot_cols = pivot_sel.expand(self)
if not pivot_cols:
# TODO: improve the repr of selectors
raise com.IbisInputError("Selector returned no columns to pivot on")
names_to = util.promote_list(names_to)
names_pattern = re.compile(names_pattern)
if (ngroups := names_pattern.groups) != (nnames := len(names_to)):
raise com.IbisInputError(
f"Number of match groups in `names_pattern`"
f"{names_pattern.pattern!r} ({ngroups:d} groups) doesn't "
f"match the length of `names_to` {names_to} (length {nnames:d})"
)
if names_transform is None:
names_transform = dict.fromkeys(names_to, toolz.identity)
elif not isinstance(names_transform, Mapping):
if callable(names_transform):
names_transform = dict.fromkeys(names_to, names_transform)
else:
raise com.IbisTypeError(
f"`names_transform` must be a mapping or callable. Got {type(names_transform)}"
)
for name in names_to:
names_transform.setdefault(name, toolz.identity)
if values_transform is None:
values_transform = toolz.identity
elif isinstance(values_transform, Deferred):
values_transform = values_transform.resolve
pieces = []
for pivot_col in pivot_cols:
col_name = pivot_col.get_name()
match_result = names_pattern.match(col_name)
row = {
name: names_transform[name](value)
for name, value in zip(names_to, match_result.groups())
}
row[values_to] = values_transform(pivot_col)
pieces.append(ibis.struct(row))
# nest into an array of structs to zip unnests together
pieces = ibis.array(pieces)
return self.select(~pivot_sel, __pivoted__=pieces.unnest()).unpack(
"__pivoted__"
)
@util.experimental
def pivot_wider(
self,
*,
id_cols: s.Selector | None = None,
names_from: str | Iterable[str] | s.Selector = "name",
names_prefix: str = "",
names_sep: str = "_",
names_sort: bool = False,
names: Iterable[str] | None = None,
values_from: str | Iterable[str] | s.Selector = "value",
values_fill: int | float | str | ir.Scalar | None = None,
values_agg: str | Callable[[ir.Value], ir.Scalar] | Deferred = "arbitrary",
):
"""Pivot a table to a wider format.
Parameters
----------
id_cols
A set of columns that uniquely identify each observation.
names_from
An argument describing which column or columns to use to get the
name of the output columns.
names_prefix
String added to the start of every column name.
names_sep
If `names_from` or `values_from` contains multiple columns, this
argument will be used to join their values together into a single
string to use as a column name.
names_sort
If [`True`][True] columns are sorted. If [`False`][False] column
names are ordered by appearance.
names
An explicit sequence of values to look for in columns matching
`names_from`.
* When this value is `None`, the values will be computed from
`names_from`.
* When this value is not `None`, each element's length must match
the length of `names_from`.
See examples below for more detail.
values_from
An argument describing which column or columns to get the cell
values from.
values_fill
A scalar value that specifies what each value should be filled with
when missing.
values_agg
A function applied to the value in each cell in the output.
Returns
-------
Table
Wider pivoted table
Examples
--------
>>> import ibis
>>> import ibis.selectors as s
>>> from ibis import _
>>> ibis.options.interactive = True
Basic usage
>>> fish_encounters = ibis.examples.fish_encounters.fetch()
>>> fish_encounters
┏━━━━━━━┳━━━━━━━━━┳━━━━━━━┓
┃ fish ┃ station ┃ seen ┃
┡━━━━━━━╇━━━━━━━━━╇━━━━━━━┩
│ int64 │ string │ int64 │
├───────┼─────────┼───────┤
│ 4842 │ Release │ 1 │
│ 4842 │ I80_1 │ 1 │
│ 4842 │ Lisbon │ 1 │
│ 4842 │ Rstr │ 1 │
│ 4842 │ Base_TD │ 1 │
│ 4842 │ BCE │ 1 │
│ 4842 │ BCW │ 1 │
│ 4842 │ BCE2 │ 1 │
│ 4842 │ BCW2 │ 1 │
│ 4842 │ MAE │ 1 │
│ … │ … │ … │
└───────┴─────────┴───────┘
>>> fish_encounters.pivot_wider(names_from="station", values_from="seen")
┏━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━┓
┃ fish ┃ Release ┃ I80_1 ┃ Lisbon ┃ Rstr ┃ Base_TD ┃ BCE ┃ BCW ┃ … ┃
┡━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━┩
│ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ … │
├───────┼─────────┼───────┼────────┼───────┼─────────┼───────┼───────┼───┤
│ 4842 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4843 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4844 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4845 │ 1 │ 1 │ 1 │ 1 │ 1 │ NULL │ NULL │ … │
│ 4847 │ 1 │ 1 │ 1 │ NULL │ NULL │ NULL │ NULL │ … │
│ 4848 │ 1 │ 1 │ 1 │ 1 │ NULL │ NULL │ NULL │ … │
│ 4849 │ 1 │ 1 │ NULL │ NULL │ NULL │ NULL │ NULL │ … │
│ 4850 │ 1 │ 1 │ NULL │ 1 │ 1 │ 1 │ 1 │ … │
│ 4851 │ 1 │ 1 │ NULL │ NULL │ NULL │ NULL │ NULL │ … │
│ 4854 │ 1 │ 1 │ NULL │ NULL │ NULL │ NULL │ NULL │ … │
│ … │ … │ … │ … │ … │ … │ … │ … │ … │
└───────┴─────────┴───────┴────────┴───────┴─────────┴───────┴───────┴───┘
Fill missing pivoted values using `values_fill`
>>> fish_encounters.pivot_wider(names_from="station", values_from="seen", values_fill=0)
┏━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━┓
┃ fish ┃ Release ┃ I80_1 ┃ Lisbon ┃ Rstr ┃ Base_TD ┃ BCE ┃ BCW ┃ … ┃
┡━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━┩
│ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ … │
├───────┼─────────┼───────┼────────┼───────┼─────────┼───────┼───────┼───┤
│ 4842 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4843 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4844 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4845 │ 1 │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ … │
│ 4847 │ 1 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ … │
│ 4848 │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ 0 │ … │
│ 4849 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ … │
│ 4850 │ 1 │ 1 │ 0 │ 1 │ 1 │ 1 │ 1 │ … │
│ 4851 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ … │
│ 4854 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ … │
│ … │ … │ … │ … │ … │ … │ … │ … │ … │
└───────┴─────────┴───────┴────────┴───────┴─────────┴───────┴───────┴───┘
Compute multiple values columns
>>> us_rent_income = ibis.examples.us_rent_income.fetch()
>>> us_rent_income
┏━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┓
┃ geoid ┃ name ┃ variable ┃ estimate ┃ moe ┃
┡━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━┩
│ string │ string │ string │ int64 │ int64 │
├────────┼────────────┼──────────┼──────────┼───────┤
│ 01 │ Alabama │ income │ 24476 │ 136 │
│ 01 │ Alabama │ rent │ 747 │ 3 │
│ 02 │ Alaska │ income │ 32940 │ 508 │
│ 02 │ Alaska │ rent │ 1200 │ 13 │
│ 04 │ Arizona │ income │ 27517 │ 148 │
│ 04 │ Arizona │ rent │ 972 │ 4 │
│ 05 │ Arkansas │ income │ 23789 │ 165 │
│ 05 │ Arkansas │ rent │ 709 │ 5 │
│ 06 │ California │ income │ 29454 │ 109 │
│ 06 │ California │ rent │ 1358 │ 3 │
│ … │ … │ … │ … │ … │
└────────┴────────────┴──────────┴──────────┴───────┘
>>> us_rent_income.pivot_wider(names_from="variable", values_from=["estimate", "moe"])
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━┓
┃ geoid ┃ name ┃ estimate_income ┃ moe_income ┃ … ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━┩
│ string │ string │ int64 │ int64 │ … │
├────────┼──────────────────────┼─────────────────┼────────────┼───┤
│ 01 │ Alabama │ 24476 │ 136 │ … │
│ 02 │ Alaska │ 32940 │ 508 │ … │
│ 04 │ Arizona │ 27517 │ 148 │ … │
│ 05 │ Arkansas │ 23789 │ 165 │ … │
│ 06 │ California │ 29454 │ 109 │ … │
│ 08 │ Colorado │ 32401 │ 109 │ … │
│ 09 │ Connecticut │ 35326 │ 195 │ … │
│ 10 │ Delaware │ 31560 │ 247 │ … │
│ 11 │ District of Columbia │ 43198 │ 681 │ … │
│ 12 │ Florida │ 25952 │ 70 │ … │
│ … │ … │ … │ … │ … │
└────────┴──────────────────────┴─────────────────┴────────────┴───┘
The column name separator can be changed using the `names_sep` parameter
>>> us_rent_income.pivot_wider(
... names_from="variable",
... names_sep=".",
... values_from=("estimate", "moe"),
... )
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━┓
┃ geoid ┃ name ┃ estimate.income ┃ moe.income ┃ … ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━┩
│ string │ string │ int64 │ int64 │ … │
├────────┼──────────────────────┼─────────────────┼────────────┼───┤
│ 01 │ Alabama │ 24476 │ 136 │ … │
│ 02 │ Alaska │ 32940 │ 508 │ … │
│ 04 │ Arizona │ 27517 │ 148 │ … │
│ 05 │ Arkansas │ 23789 │ 165 │ … │
│ 06 │ California │ 29454 │ 109 │ … │
│ 08 │ Colorado │ 32401 │ 109 │ … │
│ 09 │ Connecticut │ 35326 │ 195 │ … │
│ 10 │ Delaware │ 31560 │ 247 │ … │
│ 11 │ District of Columbia │ 43198 │ 681 │ … │
│ 12 │ Florida │ 25952 │ 70 │ … │
│ … │ … │ … │ … │ … │
└────────┴──────────────────────┴─────────────────┴────────────┴───┘
Supply an alternative function to summarize values
>>> warpbreaks = ibis.examples.warpbreaks.fetch().select("wool", "tension", "breaks")
>>> warpbreaks
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
┃ wool ┃ tension ┃ breaks ┃
┡━━━━━━━━╇━━━━━━━━━╇━━━━━━━━┩
│ string │ string │ int64 │
├────────┼─────────┼────────┤
│ A │ L │ 26 │
│ A │ L │ 30 │
│ A │ L │ 54 │
│ A │ L │ 25 │
│ A │ L │ 70 │
│ A │ L │ 52 │
│ A │ L │ 51 │
│ A │ L │ 26 │
│ A │ L │ 67 │
│ A │ M │ 18 │
│ … │ … │ … │
└────────┴─────────┴────────┘
>>> warpbreaks.pivot_wider(names_from="wool", values_from="breaks", values_agg="mean")
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ tension ┃ A ┃ B ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━┩
│ string │ float64 │ float64 │
├─────────┼───────────┼───────────┤
│ L │ 44.555556 │ 28.222222 │
│ M │ 24.000000 │ 28.777778 │
│ H │ 24.555556 │ 18.777778 │
└─────────┴───────────┴───────────┘
Passing `Deferred` objects to `values_agg` is supported
>>> warpbreaks.pivot_wider(
... names_from="tension",
... values_from="breaks",
... values_agg=_.sum(),
... )
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ wool ┃ L ┃ M ┃ H ┃
┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ string │ int64 │ int64 │ int64 │
├────────┼───────┼───────┼───────┤
│ A │ 401 │ 216 │ 221 │
│ B │ 254 │ 259 │ 169 │
└────────┴───────┴───────┴───────┘
Use a custom aggregate function
>>> warpbreaks.pivot_wider(
... names_from="wool",
... values_from="breaks",
... values_agg=lambda col: col.std() / col.mean(),
... )
┏━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ tension ┃ A ┃ B ┃
┡━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ string │ float64 │ float64 │
├─────────┼──────────┼──────────┤
│ L │ 0.406183 │ 0.349325 │
│ M │ 0.360844 │ 0.327719 │
│ H │ 0.418344 │ 0.260590 │
└─────────┴──────────┴──────────┘
Generate some random data, setting the random seed for reproducibility
>>> import random
>>> random.seed(0)
>>> raw = ibis.memtable(
... [
... dict(
... product=product,
... country=country,
... year=year,
... production=random.random(),
... )
... for product in "AB"
... for country in ["AI", "EI"]
... for year in range(2000, 2015)
... ]
... )
>>> production = raw.filter(
... ((_.product == "A") & (_.country == "AI")) | (_.product == "B")
... )
>>> production
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━┓
┃ product ┃ country ┃ year ┃ production ┃
┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━┩
│ string │ string │ int64 │ float64 │
├─────────┼─────────┼───────┼────────────┤
│ B │ AI │ 2000 │ 0.477010 │
│ B │ AI │ 2001 │ 0.865310 │
│ B │ AI │ 2002 │ 0.260492 │
│ B │ AI │ 2003 │ 0.805028 │
│ B │ AI │ 2004 │ 0.548699 │
│ B │ AI │ 2005 │ 0.014042 │
│ B │ AI │ 2006 │ 0.719705 │
│ B │ AI │ 2007 │ 0.398824 │
│ B │ AI │ 2008 │ 0.824845 │
│ B │ AI │ 2009 │ 0.668153 │
│ … │ … │ … │ … │
└─────────┴─────────┴───────┴────────────┘
Pivoting with multiple name columns
>>> production.pivot_wider(
... names_from=["product", "country"],
... values_from="production",
... )
┏━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ year ┃ B_AI ┃ B_EI ┃ A_AI ┃
┡━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ int64 │ float64 │ float64 │ float64 │
├───────┼──────────┼──────────┼──────────┤
│ 2000 │ 0.477010 │ 0.870471 │ 0.844422 │
│ 2001 │ 0.865310 │ 0.191067 │ 0.757954 │
│ 2002 │ 0.260492 │ 0.567511 │ 0.420572 │
│ 2003 │ 0.805028 │ 0.238616 │ 0.258917 │
│ 2004 │ 0.548699 │ 0.967540 │ 0.511275 │
│ 2005 │ 0.014042 │ 0.803179 │ 0.404934 │
│ 2006 │ 0.719705 │ 0.447970 │ 0.783799 │
│ 2007 │ 0.398824 │ 0.080446 │ 0.303313 │
│ 2008 │ 0.824845 │ 0.320055 │ 0.476597 │
│ 2009 │ 0.668153 │ 0.507941 │ 0.583382 │
│ … │ … │ … │ … │
└───────┴──────────┴──────────┴──────────┘
Select a subset of names. This call incurs no computation when
constructing the expression.
>>> production.pivot_wider(
... names_from=["product", "country"],
... names=[("A", "AI"), ("B", "AI")],
... values_from="production",
... )
┏━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ year ┃ A_AI ┃ B_AI ┃
┡━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ int64 │ float64 │ float64 │
├───────┼──────────┼──────────┤
│ 2000 │ 0.844422 │ 0.477010 │
│ 2001 │ 0.757954 │ 0.865310 │
│ 2002 │ 0.420572 │ 0.260492 │
│ 2003 │ 0.258917 │ 0.805028 │
│ 2004 │ 0.511275 │ 0.548699 │
│ 2005 │ 0.404934 │ 0.014042 │
│ 2006 │ 0.783799 │ 0.719705 │
│ 2007 │ 0.303313 │ 0.398824 │
│ 2008 │ 0.476597 │ 0.824845 │
│ 2009 │ 0.583382 │ 0.668153 │
│ … │ … │ … │
└───────┴──────────┴──────────┘
Sort the new columns' names
>>> production.pivot_wider(
... names_from=["product", "country"],
... values_from="production",
... names_sort=True,
... )
┏━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ year ┃ A_AI ┃ B_AI ┃ B_EI ┃
┡━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ int64 │ float64 │ float64 │ float64 │
├───────┼──────────┼──────────┼──────────┤
│ 2000 │ 0.844422 │ 0.477010 │ 0.870471 │
│ 2001 │ 0.757954 │ 0.865310 │ 0.191067 │
│ 2002 │ 0.420572 │ 0.260492 │ 0.567511 │
│ 2003 │ 0.258917 │ 0.805028 │ 0.238616 │
│ 2004 │ 0.511275 │ 0.548699 │ 0.967540 │
│ 2005 │ 0.404934 │ 0.014042 │ 0.803179 │
│ 2006 │ 0.783799 │ 0.719705 │ 0.447970 │
│ 2007 │ 0.303313 │ 0.398824 │ 0.080446 │
│ 2008 │ 0.476597 │ 0.824845 │ 0.320055 │
│ 2009 │ 0.583382 │ 0.668153 │ 0.507941 │
│ … │ … │ … │ … │
└───────┴──────────┴──────────┴──────────┘
"""
import pandas as pd
import ibis.selectors as s
import ibis.expr.analysis as an
from ibis import _
orig_names_from = util.promote_list(names_from)
names_from = s._to_selector(orig_names_from)
values_from = s._to_selector(values_from)
if id_cols is None:
id_cols = ~(names_from | values_from)
else:
id_cols = s._to_selector(id_cols)
if isinstance(values_agg, str):
values_agg = operator.methodcaller(values_agg)
elif isinstance(values_agg, Deferred):
values_agg = values_agg.resolve
if names is None:
# no names provided, compute them from the data
names = self.select(names_from).distinct().execute()
else:
if not (columns := [col.get_name() for col in names_from.expand(self)]):
raise com.IbisInputError(
f"No matching names columns in `names_from`: {orig_names_from}"
)
names = pd.DataFrame(list(map(util.promote_list, names)), columns=columns)
if names_sort:
names = names.sort_values(by=names.columns.tolist())
values_cols = values_from.expand(self)
more_than_one_value = len(values_cols) > 1
aggs = {}
names_cols_exprs = [self[col] for col in names.columns]
for keys in names.itertuples(index=False):
where = ibis.and_(*map(operator.eq, names_cols_exprs, keys))
for values_col in values_cols:
arg = values_agg(values_col)
# add in the where clause to filter the appropriate values
# in/out
#
# this allows users to write the aggregate without having to deal with
# the filter themselves
existing_aggs = an.find_toplevel_aggs(arg.op())
subs = {
agg: agg.copy(
where=(
where
if (existing := agg.where) is None
else where & existing
)
)
for agg in existing_aggs
}
arg = an.sub_for(arg.op(), subs).to_expr()
# build the components of the group by key
key_components = (
# user provided prefix
names_prefix,
# include the `values` column name if there's more than one
# `values` column
values_col.get_name() * more_than_one_value,
# values computed from `names`/`names_from`
*keys,
)
key = names_sep.join(filter(None, key_components))
aggs[key] = arg if values_fill is None else arg.coalesce(values_fill)
return self.group_by(id_cols).aggregate(**aggs)
def relocate(
self,
*columns: str | s.Selector,
before: str | s.Selector | None = None,
after: str | s.Selector | None = None,
**kwargs: str,
) -> Table:
"""Relocate `columns` before or after other specified columns.
Parameters
----------
columns
Columns to relocate. Selectors are accepted.
before
A column name or selector to insert the new columns before.
after
A column name or selector. Columns in `columns` are relocated after the last
column selected in `after`.
kwargs
Additional column names to relocate, renaming argument values to
keyword argument names.
Returns
-------
Table
A table with the columns relocated.
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> import ibis.selectors as s
>>> t = ibis.memtable(dict(a=[1], b=[1], c=[1], d=["a"], e=["a"], f=["a"]))
>>> t
┏━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ a ┃ b ┃ c ┃ d ┃ e ┃ f ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ int64 │ int64 │ int64 │ string │ string │ string │
├───────┼───────┼───────┼────────┼────────┼────────┤
│ 1 │ 1 │ 1 │ a │ a │ a │
└───────┴───────┴───────┴────────┴────────┴────────┘
>>> t.relocate("f")
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ f ┃ a ┃ b ┃ c ┃ d ┃ e ┃
┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ string │ int64 │ int64 │ int64 │ string │ string │
├────────┼───────┼───────┼───────┼────────┼────────┤
│ a │ 1 │ 1 │ 1 │ a │ a │
└────────┴───────┴───────┴───────┴────────┴────────┘
>>> t.relocate("a", after="c")
┏━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ b ┃ c ┃ a ┃ d ┃ e ┃ f ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ int64 │ int64 │ int64 │ string │ string │ string │
├───────┼───────┼───────┼────────┼────────┼────────┤
│ 1 │ 1 │ 1 │ a │ a │ a │
└───────┴───────┴───────┴────────┴────────┴────────┘
>>> t.relocate("f", before="b")
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ a ┃ f ┃ b ┃ c ┃ d ┃ e ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ int64 │ string │ int64 │ int64 │ string │ string │
├───────┼────────┼───────┼───────┼────────┼────────┤
│ 1 │ a │ 1 │ 1 │ a │ a │
└───────┴────────┴───────┴───────┴────────┴────────┘
>>> t.relocate("a", after=s.last())
┏━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ b ┃ c ┃ d ┃ e ┃ f ┃ a ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ int64 │ int64 │ string │ string │ string │ int64 │
├───────┼───────┼────────┼────────┼────────┼───────┤
│ 1 │ 1 │ a │ a │ a │ 1 │
└───────┴───────┴────────┴────────┴────────┴───────┘
Relocate allows renaming
>>> t.relocate(ff="f")
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ ff ┃ a ┃ b ┃ c ┃ d ┃ e ┃
┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ string │ int64 │ int64 │ int64 │ string │ string │
├────────┼───────┼───────┼───────┼────────┼────────┤
│ a │ 1 │ 1 │ 1 │ a │ a │
└────────┴───────┴───────┴───────┴────────┴────────┘
You can relocate based on any predicate selector, such as
[`of_type`][ibis.selectors.of_type]
>>> t.relocate(s.of_type("string"))
┏━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ d ┃ e ┃ f ┃ a ┃ b ┃ c ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ string │ string │ string │ int64 │ int64 │ int64 │
├────────┼────────┼────────┼───────┼───────┼───────┤
│ a │ a │ a │ 1 │ 1 │ 1 │
└────────┴────────┴────────┴───────┴───────┴───────┘
>>> t.relocate(s.numeric(), after=s.last())
┏━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ d ┃ e ┃ f ┃ a ┃ b ┃ c ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ string │ string │ string │ int64 │ int64 │ int64 │
├────────┼────────┼────────┼───────┼───────┼───────┤
│ a │ a │ a │ 1 │ 1 │ 1 │
└────────┴────────┴────────┴───────┴───────┴───────┘
>>> t.relocate(s.any_of(s.c(*"ae")))
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ a ┃ e ┃ b ┃ c ┃ d ┃ f ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ int64 │ string │ int64 │ int64 │ string │ string │
├───────┼────────┼───────┼───────┼────────┼────────┤
│ 1 │ a │ 1 │ 1 │ a │ a │
└───────┴────────┴───────┴───────┴────────┴────────┘
When multiple columns are selected with `before` or `after`, those
selected columns are moved before and after the `selectors` input
>>> t = ibis.memtable(dict(a=[1], b=["a"], c=[1], d=["a"]))
>>> t.relocate(s.numeric(), after=s.of_type("string"))
┏━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ b ┃ d ┃ a ┃ c ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ string │ string │ int64 │ int64 │
├────────┼────────┼───────┼───────┤
│ a │ a │ 1 │ 1 │
└────────┴────────┴───────┴───────┘
>>> t.relocate(s.numeric(), before=s.of_type("string"))
┏━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ a ┃ c ┃ b ┃ d ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ int64 │ int64 │ string │ string │
├───────┼───────┼────────┼────────┤
│ 1 │ 1 │ a │ a │
└───────┴───────┴────────┴────────┘
"""
import ibis.selectors as s
if not columns and before is None and after is None and not kwargs:
raise com.IbisInputError(
"At least one selector or `before` or `after` must be provided"
)
if before is not None and after is not None:
raise com.IbisInputError("Cannot specify both `before` and `after`")
sels = {}
table_columns = self.columns
for name, sel in itertools.chain(
zip(itertools.repeat(None), map(s._to_selector, columns)),
zip(kwargs.keys(), map(s._to_selector, kwargs.values())),
):
for pos in sel.positions(self):
if pos in sels:
# make sure the last duplicate column wins by reinserting
# the position if it already exists
del sels[pos]
sels[pos] = name if name is not None else table_columns[pos]
ncols = len(table_columns)
if before is not None:
where = min(s._to_selector(before).positions(self), default=0)
elif after is not None:
where = max(s._to_selector(after).positions(self), default=ncols - 1) + 1
else:
assert before is None and after is None
where = 0
# all columns that should come BEFORE the matched selectors
front = [left for left in range(where) if left not in sels]
# all columns that should come AFTER the matched selectors
back = [right for right in range(where, ncols) if right not in sels]
# selected columns
middle = [self[i].name(name) for i, name in sels.items()]
relocated = self.select(*front, *middle, *back)
assert len(relocated.columns) == ncols
return relocated
@public
class CachedTable(Table):
def __exit__(self, *_):
self.release()
def __enter__(self):
return self
def release(self):
"""Release the underlying expression from the cache."""
current_backend = self._find_backend(use_default=True)
return current_backend._release_cached(self)
def _resolve_predicates(
table: Table, predicates
) -> tuple[list[ir.BooleanValue], list[tuple[ir.BooleanValue, ir.Table]]]:
import ibis.expr.analysis as an
import ibis.expr.types as ir
# TODO(kszucs): clean this up, too much flattening and resolving happens here
predicates = [
pred.op()
for preds in map(
functools.partial(ir.relations.bind_expr, table),
util.promote_list(predicates),
)
for pred in util.promote_list(preds)
]
predicates = an.flatten_predicate(predicates)
resolved_predicates = []
for pred in predicates:
if isinstance(pred, ops.logical._UnresolvedSubquery):
resolved_predicates.append(pred._resolve(table.op()))
else:
resolved_predicates.append(pred)
return resolved_predicates
def bind_expr(table, expr):
if util.is_iterable(expr):
return [bind_expr(table, x) for x in expr]
return table._ensure_expr(expr)
public(TableExpr=Table)
| 11,002
|
https://github.com/GoFightNguyen/programming-in-csharp/blob/master/2.CreateAndUseTypes/2.85_WeakReference/Program.cs
|
Github Open Source
|
Open Source
|
MIT
| null |
programming-in-csharp
|
GoFightNguyen
|
C#
|
Code
| 72
| 194
|
using System;
namespace _2._85_WeakReference
{
class Program
{
static WeakReference data;
public static void Run()
{
object result = GetData();
//GC.Collect(); uncommenting this line will make data.Target null
result = GetData();
}
private static object GetData()
{
if (data == null)
data = new WeakReference(LoadLargeList());
if (data.Target == null)
data.Target = LoadLargeList();
return data.Target;
}
private static object LoadLargeList()
{
throw new NotImplementedException();
}
static void Main(string[] args)
{
}
}
}
| 7,317
|
https://github.com/Jono120/PlayMe/blob/master/SpotiFire.SpotifyLib/Interfaces/IPlaylistContainer.cs
|
Github Open Source
|
Open Source
|
MIT
| 2,022
|
PlayMe
|
Jono120
|
C#
|
Code
| 36
| 128
|
namespace SpotiFire.SpotifyLib
{
public interface IPlaylistContainer : ISpotifyObject
{
//IUser User {get;}
IPlaylistList Playlists { get; }
bool IsLoaded { get; }
event PlaylistContainerHandler Loaded;
event PlaylistContainerHandler<PlaylistEventArgs> PlaylistAdded;
event PlaylistContainerHandler<PlaylistMovedEventArgs> PlaylistMoved;
event PlaylistContainerHandler<PlaylistEventArgs> PlaylistRemoved;
}
}
| 9,775
|
https://github.com/asuttles/euler/blob/master/problem26.py
|
Github Open Source
|
Open Source
|
Unlicense
| null |
euler
|
asuttles
|
Python
|
Code
| 208
| 472
|
# A unit fraction contains 1 in the numerator.
# The decimal representation of the unit fractions
# with denominators 2 to 10 are given:
#
# 1/2 = 0.5
# 1/3 = 0.(3)
# 1/4 = 0.25
# 1/5 = 0.2
# 1/6 = 0.1(6)
# 1/7 = 0.(142857)
# 1/8 = 0.125
# 1/9 = 0.(1)
# 1/10 = 0.1
#
# Where 0.1(6) means 0.166666..., and
# has a 1-digit recurring cycle.
#
# It can be seen that 1/7 has a 6-digit recurring cycle.
#
# Find the value of d < 1000 for which 1/d contains
# the longest recurring cycle in its decimal fraction part.
maxLen = 0
maxNum = 0
print()
# for num in range(2,1000):
# a = "{0:.2000f}".format(1/num)
# a = a.lstrip("0.") # Remove leading 0s and decimal
#
# for i in range(1,1000):
# x = a[0:i]
# y = a[i:i+i]
# if x == y:
# print("Repeat: {0} 1/{0} = {1} (rpt len is: {2})".format(num,1/num,i))
# if i > maxLen:
# maxLen = i
# maxNum = num
# break
#
# print("MaxLen = ", maxLen)
# print("d = ", maxNum)
for num in range(2, 12):
dividend = 10
divisor = num
quotient = dividend / divi
| 46,022
|
https://github.com/mthistle/SendHapticSwift/blob/master/MicrosoftBandKit_iOS.framework/Versions/Current/Headers/MSBMargins.h
|
Github Open Source
|
Open Source
|
MIT
| 2,016
|
SendHapticSwift
|
mthistle
|
Objective-C
|
Code
| 40
| 149
|
//----------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface MSBMargins : NSObject
@property(nonatomic, assign) UInt16 left;
@property(nonatomic, assign) UInt16 top;
@property(nonatomic, assign) UInt16 right;
@property(nonatomic, assign) UInt16 bottom;
+(MSBMargins *)marginsWithLeft:(UInt16)left top:(UInt16)top right:(UInt16)right bottom:(UInt16)bottom;
@end
| 45,552
|
https://github.com/jasoncypret/animate.sass-rails/blob/master/vendor/assets/stylesheets/animate/animations/bouncing-exits/_bounceOutRight.sass
|
Github Open Source
|
Open Source
|
MIT
| null |
animate.sass-rails
|
jasoncypret
|
Sass
|
Code
| 44
| 293
|
=bounceOutRight($prefix)
0%
+transform(translateX(0), $prefix)
20%
opacity: 1
+transform(translateX(-20px), $prefix)
100%
opacity: 0
+transform(translateX(2000px), $prefix)
@if $experimental-support-for-webkit
@-webkit-keyframes bounceOutRight
+bounceOutRight(webkit)
@if $experimental-support-for-khtml
@-khtml-keyframes bounceOutRight
+bounceOutRight(khtml)
@if $experimental-support-for-mozilla
@-moz-keyframes bounceOutRight
+bounceOutRight(moz)
@if $experimental-support-for-microsoft
@-ms-keyframes bounceOutRight
+bounceOutRight(ms)
@if $experimental-support-for-opera
@-o-keyframes bounceOutRight
+bounceOutRight(o)
@keyframes bounceOutRight
+bounceOutRight(none)
.bounceOutRight
+animation-name(bounceOutRight)
| 28,853
|
https://github.com/fancylou/o2oa/blob/master/x_processplatform_assemble_bam/src/main/java/com/x/processplatform/assemble/bam/factory/TaskFactory.java
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| 2,019
|
o2oa
|
fancylou
|
Java
|
Code
| 1,626
| 6,232
|
package com.x.processplatform.assemble.bam.factory;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.processplatform.assemble.bam.AbstractFactory;
import com.x.processplatform.assemble.bam.Business;
import com.x.processplatform.assemble.bam.stub.ActivityStub;
import com.x.processplatform.assemble.bam.stub.ApplicationStub;
import com.x.processplatform.assemble.bam.stub.CompanyStub;
import com.x.processplatform.assemble.bam.stub.DepartmentStub;
import com.x.processplatform.assemble.bam.stub.PersonStub;
import com.x.processplatform.assemble.bam.stub.ProcessStub;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.Task_;
public class TaskFactory extends AbstractFactory {
public TaskFactory(Business abstractBusiness) throws Exception {
super(abstractBusiness);
}
public Long count(Date start, ApplicationStub applicationStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.application), applicationStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long count(Date start, ProcessStub processStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.process), processStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long count(Date start, ActivityStub activityStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.activity), activityStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long count(Date start, CompanyStub companyStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.company), companyStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long count(Date start, DepartmentStub departmentStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.department), departmentStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long count(Date start, PersonStub personStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.person), personStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, ApplicationStub applicationStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
p = cb.and(p, cb.equal(root.get(Task_.application), applicationStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, ProcessStub processStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
p = cb.and(p, cb.equal(root.get(Task_.process), processStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, ActivityStub activityStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
p = cb.and(p, cb.equal(root.get(Task_.activity), activityStub.getValue()));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, CompanyStub companyStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.company), companyStub.getValue()));
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, DepartmentStub departmentStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.department), departmentStub.getValue()));
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long expiredCount(Date start, Date current, PersonStub personStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.person), personStub.getValue()));
p = cb.and(p, cb.lessThan(root.get(Task_.expireTime), current));
cq.select(cb.count(root)).where(p);
return em.createQuery(cq).getSingleResult();
}
public Long duration(Date start, Date current, ApplicationStub applicationStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.application), applicationStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public Long duration(Date start, Date current, ProcessStub processStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.process), processStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public Long duration(Date start, Date current, ActivityStub activityStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.activity), activityStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public Long duration(Date start, Date current, CompanyStub companyStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.company), companyStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public Long duration(Date start, Date current, DepartmentStub departmentStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.department), departmentStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public Long duration(Date start, Date current, PersonStub personStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.person), personStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
long duration = 0;
for (Date o : os) {
duration += current.getTime() - o.getTime();
}
duration = duration / (1000L * 60L);
return duration;
}
public TaskDurationWithPeriodCountObject durationWithPeriodCount(Date start, Date current) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
int halfDay = 0;
int oneDay = 0;
int twoDay = 0;
int threeDay = 0;
int moreDay = 0;
long duration = 0;
for (Date o : os) {
long d = current.getTime() - o.getTime();
if (d > (1000L * 60L * 60L * 24L * 3L)) {
moreDay++;
} else if (d > (1000L * 60L * 60L * 24L * 2L)) {
threeDay++;
} else if (d > (1000L * 60L * 60L * 24L)) {
twoDay++;
} else if (d > (1000L * 60L * 60L * 12L)) {
oneDay++;
} else {
halfDay++;
}
duration += d;
}
duration = duration / (1000L * 60L);
TaskDurationWithPeriodCountObject o = new TaskDurationWithPeriodCountObject();
o.setDuration(duration);
o.setHalfDay(halfDay);
o.setOneDay(oneDay);
o.setTwoDay(twoDay);
o.setThreeDay(threeDay);
o.setMoreDay(moreDay);
return o;
}
public TaskDurationWithPeriodCountObject durationWithPeriodCount(Date start, Date current,
ApplicationStub applicationStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.application), applicationStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
int halfDay = 0;
int oneDay = 0;
int twoDay = 0;
int threeDay = 0;
int moreDay = 0;
long duration = 0;
for (Date o : os) {
long d = current.getTime() - o.getTime();
if (d > (1000L * 60L * 60L * 24L * 3L)) {
moreDay++;
} else if (d > (1000L * 60L * 60L * 24L * 2L)) {
threeDay++;
} else if (d > (1000L * 60L * 60L * 24L)) {
twoDay++;
} else if (d > (1000L * 60L * 60L * 12L)) {
oneDay++;
} else {
halfDay++;
}
duration += d;
}
duration = duration / (1000L * 60L);
TaskDurationWithPeriodCountObject o = new TaskDurationWithPeriodCountObject();
o.setDuration(duration);
o.setHalfDay(halfDay);
o.setOneDay(oneDay);
o.setTwoDay(twoDay);
o.setThreeDay(threeDay);
o.setMoreDay(moreDay);
return o;
}
public TaskDurationWithPeriodCountObject durationWithPeriodCount(Date start, Date current, ProcessStub processStub)
throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.process), processStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
int halfDay = 0;
int oneDay = 0;
int twoDay = 0;
int threeDay = 0;
int moreDay = 0;
long duration = 0;
for (Date o : os) {
long d = current.getTime() - o.getTime();
if (d > (1000L * 60L * 60L * 24L * 3L)) {
moreDay++;
} else if (d > (1000L * 60L * 60L * 24L * 2L)) {
threeDay++;
} else if (d > (1000L * 60L * 60L * 24L)) {
twoDay++;
} else if (d > (1000L * 60L * 60L * 12L)) {
oneDay++;
} else {
halfDay++;
}
duration += d;
}
duration = duration / (1000L * 60L);
TaskDurationWithPeriodCountObject o = new TaskDurationWithPeriodCountObject();
o.setDuration(duration);
o.setHalfDay(halfDay);
o.setOneDay(oneDay);
o.setTwoDay(twoDay);
o.setThreeDay(threeDay);
o.setMoreDay(moreDay);
return o;
}
public TaskDurationWithPeriodCountObject durationWithPeriodCount(Date start, Date current,
ActivityStub activityStub) throws Exception {
EntityManager em = this.entityManagerContainer().get(Task.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Date> cq = cb.createQuery(Date.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.greaterThan(root.get(Task_.startTime), start);
p = cb.and(p, cb.equal(root.get(Task_.activity), activityStub.getValue()));
cq.select(root.get(Task_.startTime)).where(p);
List<Date> os = em.createQuery(cq).getResultList();
int halfDay = 0;
int oneDay = 0;
int twoDay = 0;
int threeDay = 0;
int moreDay = 0;
long duration = 0;
for (Date o : os) {
long d = current.getTime() - o.getTime();
if (d > (1000L * 60L * 60L * 24L * 3L)) {
moreDay++;
} else if (d > (1000L * 60L * 60L * 24L * 2L)) {
threeDay++;
} else if (d > (1000L * 60L * 60L * 24L)) {
twoDay++;
} else if (d > (1000L * 60L * 60L * 12L)) {
oneDay++;
} else {
halfDay++;
}
duration += d;
}
duration = duration / (1000L * 60L);
TaskDurationWithPeriodCountObject o = new TaskDurationWithPeriodCountObject();
o.setDuration(duration);
o.setHalfDay(halfDay);
o.setOneDay(oneDay);
o.setTwoDay(twoDay);
o.setThreeDay(threeDay);
o.setMoreDay(moreDay);
return o;
}
}
| 21,014
|
https://github.com/deyvisgc/SysConta/blob/master/application/controllers/Cuentas/Asientos.php
|
Github Open Source
|
Open Source
|
MIT
| null |
SysConta
|
deyvisgc
|
PHP
|
Code
| 141
| 897
|
<?php
/**
* Created by PhpStorm.
* User: Deyvis G
* Date: 30/03/2019
* Time: 4:06 AM
*/
class Asientos extends CI_Controller
{
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->database();
$this->load->model('cuentas_contables_model');
$this->load->model('rol_has_privilegio_model');
$this->load->helper('seguridad');
$this->load->helper('util');
$this->load->helper('url');
}
public function index()
{
is_logged_in_or_exit($this);
$data_header['list_privilegio'] = get_privilegios($this);
$data_header['pri_grupo'] = 'CUENTAS CONTABLES';
$data_header['pri_nombre'] = 'Asientos Contables';
$data_header['usuario'] = get_usuario($this);
$data_header['title'] = "Asientos Contables";
$data_body['capital'] = $this->cuentas_contables_model->capital();
$data_footer['inits_function'] = array("init_Asientos_Contables");
$this->load->view('header', $data_header);
$this->load->view('Asiento_Contables/index',$data_body);
$this->load->view('footer', $data_footer);
}
public function RegistrarAsiento1(){
$data=array(
'id_Empresa'=>$this->input->post('idempresa'),
'fecha_registro'=>$this->input->post('fecha'),
'debe'=>$this->input->post("debe"),
'empre_socio'=>$this->input->post("socio"),
'descripcion'=>$this->input->post("descripcion"),
);
$result = $this->cuentas_contables_model->RegistrarAsiento1($data);
$datos=array('hecho'=>'SI');
echo json_encode($datos);
}
public function ListarAsiento1(){
is_logged_in_or_exit($this);
$data = $this->cuentas_contables_model->ListarAsientos1();
$totales_debe = $this->cuentas_contables_model->ListarHaberAsientos1();
$result = array('data'=>array(),'totales_haber'=>$totales_debe);
foreach ($data as $key =>$value){
$fecha = $value['fecha_registro'];
$descripcion= $value['descripcion'];
$socio = $value['empre_socio'];
$debe = $value['debe'];
$haber= $value['haber'];
$button = '
<button title="Eliminar Asiento" type="button" onclick="liss('.$value['idcuenta'].')"
data-toggle="modal" data-target="#detalle_kardex" class="btn btn-danger"><i class="fa fa-remove"></i></button>
';
$result['data'][$key]=array(
$fecha,$descripcion,$socio,$debe,$haber,$button
);
}
echo json_encode($result);
}
}
| 19,577
|
https://github.com/7eXx/LiteDbExplorer/blob/master/source/LiteDbExplorer/Modules/ApplicationInteraction.cs
|
Github Open Source
|
Open Source
|
MIT
| 2,019
|
LiteDbExplorer
|
7eXx
|
C#
|
Code
| 879
| 3,166
|
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using Caliburn.Micro;
using CSharpFunctionalExtensions;
using Forge.Forms;
using LiteDbExplorer.Controls;
using LiteDbExplorer.Core;
using LiteDbExplorer.Framework.Windows;
using LiteDbExplorer.Modules.Database;
using LiteDbExplorer.Modules.DbCollection;
using LiteDbExplorer.Modules.DbDocument;
using LiteDbExplorer.Modules.DbQuery;
using LiteDbExplorer.Modules.Help;
using LiteDbExplorer.Modules.ImportData;
using LiteDbExplorer.Modules.Shared;
using LiteDbExplorer.Windows;
using LiteDbExplorer.Wpf.Framework;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
using DialogOptions = LiteDbExplorer.Framework.Windows.DialogOptions;
namespace LiteDbExplorer.Modules
{
[Export(typeof(IApplicationInteraction))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class ApplicationInteraction : IApplicationInteraction
{
private readonly IWindowManager _windowManager;
private readonly IShellNavigationService _navigationService;
[ImportingConstructor]
public ApplicationInteraction(IWindowManager windowManager, IShellNavigationService navigationService)
{
_windowManager = windowManager;
_navigationService = navigationService;
}
public bool OpenDatabaseProperties(DatabaseReference database)
{
var vm = IoC.Get<IDatabasePropertiesView>();
vm.Init(database);
var dialogOptions = new DialogOptions
{
Width = 480,
MinWidth = 480,
MinHeight = 740,
MaxHeight = SystemParameters.VirtualScreenHeight - 160,
SizeToContent = SizeToContent.Height,
ResizeMode = ResizeMode.CanResize,
ShowMaxRestoreButton = false
}
.SizeToFit();
return _windowManager.ShowDialog(vm, null, dialogOptions.Value) == true;
}
public bool ShowImportWizard(ImportDataOptions options = null)
{
var vm = IoC.Get<ImportDataWizardViewModel>();
vm.Init(options);
var dialogOptions = new DialogOptions
{
Width = 800,
MinWidth = 600,
Height = 700,
MinHeight = 500,
SizeToContent = SizeToContent.Manual,
ResizeMode = ResizeMode.CanResizeWithGrip
}
.SizeToFit();
return _windowManager.ShowDialog(vm, null, dialogOptions.Value) == true;
}
public bool OpenEditDocument(DocumentReference document)
{
/*var vm = IoC.Get<DocumentEntryViewModel>();
vm.Init(document);
dynamic settings = new ExpandoObject();
settings.Height = 600;
settings.Width = 640;
settings.SizeToContent = SizeToContent.Manual;
return _windowManager.ShowDialog(vm, null, settings) == true;*/
var windowController = new WindowController {Title = "Document Editor"};
var control = new DocumentEntryControl(document, windowController);
var window = new DialogWindow(control, windowController)
{
MinWidth = 400,
MinHeight = 400,
Height = Math.Min(Math.Max(636, SystemParameters.VirtualScreenHeight / 1.61), SystemParameters.VirtualScreenHeight)
};
if (document.Collection.IsFilesOrChunks)
{
window.Width = Math.Min(1024, SystemParameters.VirtualScreenWidth);
}
window.Owner = windowController.InferOwnerOf(window);
return window.ShowDialog() == true;
// TODO: Handle UpdateGridColumns(document.Value.LiteDocument) and UpdateDocumentPreview();
}
public async Task<Result> OpenQuery(RunQueryContext queryContext)
{
await _navigationService.Navigate<QueryViewModel>(queryContext);
return Result.Ok();
}
public Task<bool> RevealInExplorer(string filePath)
{
var isFile = Path.HasExtension(filePath);
if ((Path.HasExtension(filePath) && !File.Exists(filePath)) || !isFile && !Directory.Exists(filePath))
{
return Task.FromResult(false);
}
//Clean up file path so it can be navigated OK
filePath = Path.GetFullPath(filePath);
System.Diagnostics.Process.Start("explorer.exe", isFile ? $"/select,\"{filePath}\"" : filePath);
return Task.FromResult(true);
}
public Task<bool> OpenFileWithAssociatedApplication(string filePath)
{
if (!System.IO.File.Exists(filePath))
{
return Task.FromResult(false);
}
//Clean up file path so it can be navigated OK
filePath = Path.GetFullPath(filePath);
System.Diagnostics.Process.Start(filePath);
return Task.FromResult(true);
}
public async Task<Result> ActivateDefaultCollectionView(CollectionReference collection, IEnumerable<DocumentReference> selectedDocuments = null)
{
if (collection == null)
{
return Result.Ok();
}
await _navigationService.Navigate<CollectionExplorerViewModel>(new CollectionReferencePayload(collection, selectedDocuments));
return Result.Ok();
}
public async Task<Result> ActivateDefaultDocumentView(DocumentReference document)
{
if (document == null)
{
return Result.Ok();
}
await _navigationService.Navigate<DocumentPreviewViewModel>(new DocumentReferencePayload(document));
return Result.Ok();
}
public void PutClipboardText(string text)
{
Clipboard.SetData(DataFormats.Text, text);
}
public bool ShowConfirm(string message, string title = "Are you sure?")
{
return MessageBox.Show(
message,
title,
MessageBoxButton.YesNo,
MessageBoxImage.Question
) == MessageBoxResult.Yes;
}
protected static Dictionary<UINotificationType, MessageBoxImage> NotificationTypeToMessageBoxImage =
new Dictionary<UINotificationType, MessageBoxImage>
{
{ UINotificationType.None, MessageBoxImage.None },
{ UINotificationType.Info, MessageBoxImage.Information },
{ UINotificationType.Warning, MessageBoxImage.Warning },
{ UINotificationType.Error, MessageBoxImage.Error },
};
public void ShowAlert(string message, string title = null, UINotificationType type = UINotificationType.None)
{
if (!NotificationTypeToMessageBoxImage.TryGetValue(type, out var image))
{
image = MessageBoxImage.None;
}
MessageBox.Show(
message,
string.IsNullOrEmpty(title) ? AppConstants.Application.DisplayName : title,
MessageBoxButton.OK,
image
);
}
public void ShowError(string message, string title = "")
{
MessageBox.Show(
message,
string.IsNullOrEmpty(title) ? "Error" : title,
MessageBoxButton.OK,
MessageBoxImage.Error
);
}
public void ShowError(Exception exception, string message, string title = "")
{
var exceptionViewer = new ExceptionViewer(message, exception);
var baseDialogWindow = new BaseDialogWindow
{
Title = string.IsNullOrEmpty(title) ? "Error" : title,
Content = exceptionViewer,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
ResizeMode = ResizeMode.CanResizeWithGrip,
MinHeight = 400,
MinWidth = 500,
ShowMinButton = false,
ShowMaxRestoreButton = false
};
baseDialogWindow.ShowDialog();
}
public void ShowAbout()
{
_windowManager.ShowDialog(IoC.Get<AboutViewModel>(), null, AboutViewModel.DefaultDialogOptions.Value);
}
public void ShowReleaseNotes(Version version = null)
{
var viewModel = IoC.Get<ReleaseNotesViewModel>();
viewModel.FilterVersion(version);
_windowManager.ShowDialog(viewModel, null, ReleaseNotesViewModel.DefaultDialogOptions.Value);
}
public void ShowIssueHelper()
{
var viewModel = IoC.Get<IssueHelperViewModel>();
_windowManager.ShowDialog(viewModel, null, IssueHelperViewModel.DefaultDialogOptions.Value);
}
public Task<Maybe<string>> ShowSaveFileDialog(string title = "", string filter = "All files|*.*",
string fileName = "", string initialDirectory = "", bool overwritePrompt = true)
{
var completionSource = new TaskCompletionSource<Maybe<string>>();
var dialog = new SaveFileDialog
{
OverwritePrompt = overwritePrompt
};
if (!string.IsNullOrEmpty(fileName))
{
dialog.FileName = fileName;
}
if (!string.IsNullOrEmpty(filter))
{
dialog.Filter = filter;
}
if (!string.IsNullOrEmpty(title))
{
dialog.Title = title;
}
if (!string.IsNullOrEmpty(initialDirectory))
{
dialog.InitialDirectory = initialDirectory;
}
completionSource.SetResult(dialog.ShowDialog() == true ? dialog.FileName : Maybe<string>.None);
return completionSource.Task;
}
public Task<Maybe<string>> ShowOpenFileDialog(string title = "", string filter = "All files|*.*",
string fileName = "", string initialDirectory = "")
{
var completionSource = new TaskCompletionSource<Maybe<string>>();
var dialog = new OpenFileDialog
{
Multiselect = false
};
if (!string.IsNullOrEmpty(fileName))
{
dialog.FileName = fileName;
}
if (!string.IsNullOrEmpty(filter))
{
dialog.Filter = filter;
}
if (!string.IsNullOrEmpty(title))
{
dialog.Title = title;
}
if (!string.IsNullOrEmpty(initialDirectory))
{
dialog.InitialDirectory = initialDirectory;
}
completionSource.SetResult(dialog.ShowDialog() == true ? dialog.FileName : Maybe<string>.None);
return completionSource.Task;
}
public Task<Maybe<string>> ShowFolderPickerDialog(string title = "", string initialDirectory = "")
{
var completionSource = new TaskCompletionSource<Maybe<string>>();
var dialog = new CommonOpenFileDialog
{
Multiselect = false,
IsFolderPicker = true
};
if (!string.IsNullOrEmpty(title))
{
dialog.Title = title;
}
if (!string.IsNullOrEmpty(initialDirectory))
{
dialog.InitialDirectory = initialDirectory;
}
completionSource.SetResult(
dialog.ShowDialog() == CommonFileDialogResult.Ok
? dialog.FileName
: Maybe<string>.None);
return completionSource.Task;
}
public Task<Maybe<string>> ShowInputDialog(string message, string caption = "", string predefined = "", Func<string, Result> validationFunc = null)
{
var completionSource = new TaskCompletionSource<Maybe<string>>();
completionSource.SetResult(
InputBoxWindow.ShowDialog(message, caption, predefined, validationFunc, out var inputText) == true
? inputText
: Maybe<string>.None);
return completionSource.Task;
}
public async Task<Maybe<PasswordInput>> ShowPasswordInputDialog(string message, string caption = "", string predefined = "", bool rememberMe = false)
{
var passwordInput = new PasswordInput(message, caption, predefined, rememberMe);
var result = await Show.Dialog(AppConstants.DialogHosts.Shell).For(passwordInput);
if (result.Action is PasswordInput.CANCEL_ACTION)
{
return Maybe<PasswordInput>.None;
}
return result.Model;
}
}
}
| 16,108
|
https://github.com/wooksong/api/blob/master/java/android/nnstreamer/src/main/jni/Android-flatbuf.mk
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,023
|
api
|
wooksong
|
Makefile
|
Code
| 181
| 806
|
#------------------------------------------------------
# flatbuffers
#
# This mk file defines the flatbuffers-module with the prebuilt static library.
#------------------------------------------------------
LOCAL_PATH := $(call my-dir)
ifndef NNSTREAMER_ROOT
$(error NNSTREAMER_ROOT is not defined!)
endif
include $(NNSTREAMER_ROOT)/jni/nnstreamer.mk
FLATBUF_VER := @FLATBUF_VER@
ifeq ($(FLATBUF_VER),@FLATBUF_VER@)
$(error 'FLATBUF_VER' is not properly set)
endif
ifeq ($(shell which flatc),)
$(error No 'flatc' in your PATH, install flatbuffers-compiler from ppa:nnstreamer/ppa)
else
SYS_FLATC_VER := $(word 3, $(shell flatc --version))
endif
ifneq ($(SYS_FLATC_VER), $(FLATBUF_VER))
$(warning Found 'flatc' v$(SYS_FLATC_VER), but required v$(FLATBUF_VER))
endif
FLATBUF_DIR := $(LOCAL_PATH)/flatbuffers
FLATBUF_INCLUDES := $(FLATBUF_DIR)/include
GEN_FLATBUF_HEADER := $(shell flatc --cpp -o $(LOCAL_PATH) $(NNSTREAMER_ROOT)/ext/nnstreamer/include/nnstreamer.fbs )
FLATBUF_HEADER_GEN := $(wildcard $(LOCAL_PATH)/nnstreamer_generated.h)
ifeq ($(FLATBUF_HEADER_GEN), '')
$(error Failed to generate the header file, '$(LOCAL_PATH)/nnstreamer_generated.h')
endif
FLATBUF_LIB_PATH := $(FLATBUF_DIR)/lib/$(TARGET_ARCH_ABI)
ifeq ($(wildcard $(FLATBUF_LIB_PATH)), )
$(error The given ABI is not supported by the flatbuffers-module: $(TARGET_ARCH_ABI))
endif
#------------------------------------------------------
# libflatbuffers.a (prebuilt static library)
#------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := flatbuffers-lib
LOCAL_SRC_FILES := $(FLATBUF_LIB_PATH)/libflatbuffers.a
include $(PREBUILT_STATIC_LIBRARY)
#------------------------------------------------------
# converter/decoder sub-plugins for flatbuffers
#------------------------------------------------------
FLATBUF_SRC_FILES := \
$(NNSTREAMER_CONVERTER_FLATBUF_SRCS) \
$(NNSTREAMER_CONVERTER_FLEXBUF_SRCS) \
$(NNSTREAMER_DECODER_FLATBUF_SRCS) \
$(NNSTREAMER_DECODER_FLEXBUF_SRCS)
include $(CLEAR_VARS)
LOCAL_MODULE := flatbuffers-subplugin
LOCAL_SRC_FILES := $(sort $(FLATBUF_SRC_FILES))
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(FLATBUF_INCLUDES) $(NNSTREAMER_INCLUDES) $(GST_HEADERS_COMMON)
LOCAL_STATIC_LIBRARIES := flatbuffers-lib
include $(BUILD_STATIC_LIBRARY)
| 38,407
|
https://github.com/fathurwalkers/project-pendataan-siswa/blob/master/app/Http/Controllers/PrintController.php
|
Github Open Source
|
Open Source
|
MIT
| null |
project-pendataan-siswa
|
fathurwalkers
|
PHP
|
Code
| 81
| 323
|
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Login;
use App\Detail;
use App\Absensi;
use App\Kelas;
use App\Matapelajaran;
use App\Nilai;
use App\Semester;
use App\Pengajar;
use Illuminate\Support\Str;
use Faker\Factory as Faker;
use Illuminate\Support\Arr as Randoms;
use PDF;
class PrintController extends Controller
{
public function print_daftarsiswa()
{
$users = session('data_login');
$data = Detail::where('role_status', 'siswa')->get();
$pdf = PDF::loadView('print.print-daftar-siswa', ['data' => $data]);
return $pdf->download('daftar-siswa.pdf');
}
public function print_daftarguru()
{
$users = session('data_login');
$data = Detail::where('role_status', 'guru')->get();
$pdf = PDF::loadView('print.print-daftar-guru', ['data' => $data]);
return $pdf->download('daftar-guru.pdf');
}
}
| 4,245
|
https://github.com/ErikChanHub/rosedb/blob/master/rosedb_test.go
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
rosedb
|
ErikChanHub
|
Go
|
Code
| 623
| 2,160
|
package rosedb
import (
"encoding/json"
"fmt"
"github.com/roseduan/rosedb/storage"
"github.com/stretchr/testify/assert"
"io/ioutil"
"log"
"os"
"testing"
"time"
)
var dbPath = "/tmp/rosedb_server"
func InitDb() *RoseDB {
config := DefaultConfig()
//config.DirPath = dbPath
config.IdxMode = KeyOnlyMemMode
config.RwMethod = storage.FileIO
db, err := Open(config)
if err != nil {
log.Fatal(err)
}
return db
}
func InitDB(cfg Config) *RoseDB {
db, err := Open(cfg)
if err != nil {
panic(fmt.Sprintf("open rosedb err.%+v", err))
}
return db
}
func DestroyDB(db *RoseDB) {
if db == nil {
return
}
err := os.RemoveAll(db.config.DirPath)
if err != nil {
log.Fatalf("destroy db err.%+v", err)
}
}
func ReopenDb() *RoseDB {
return InitDb()
}
func TestRoseDb_Save(t *testing.T) {
config := DefaultConfig()
config.DirPath = "/tmp/testRoseDB"
config.BlockSize = 3
db, err := Open(config)
if err != nil {
t.Fatal(err.Error())
}
testKey := []byte("test_key1")
testVal := []byte("test_val1")
e := &storage.Entry{
Meta: &storage.Meta{
Key: testKey,
Value: testVal,
Extra: nil,
KeySize: uint32(len(testKey)),
ValueSize: uint32(len(testVal)),
ExtraSize: 0,
},
Timestamp: 0,
TxId: 0,
}
err = db.store(e)
//if err != nil {
// t.Fatal(err.Error())
//}
testKey = []byte("test_key2")
testVal = []byte("test_val2")
e2 := &storage.Entry{
Meta: &storage.Meta{
Key: testKey,
Value: testVal,
Extra: nil,
KeySize: uint32(len(testKey)),
ValueSize: uint32(len(testVal)),
ExtraSize: 0,
},
Timestamp: 0,
TxId: 0,
}
err = db.store(e2)
if err != nil {
t.Fatal(err.Error())
}
testKey = []byte("test_key3")
testVal = []byte("test_val3")
e3 := &storage.Entry{
Meta: &storage.Meta{
Key: testKey,
Value: testVal,
Extra: nil,
KeySize: uint32(len(testKey)),
ValueSize: uint32(len(testVal)),
ExtraSize: 0,
},
Timestamp: 0,
TxId: 0,
}
err = db.store(e3)
}
func TestOpen(t *testing.T) {
opendb := func(method storage.FileRWMethod) {
config := DefaultConfig()
config.RwMethod = method
config.DirPath = dbPath
db, err := Open(config)
if err != nil {
t.Error("open db err: ", err)
}
defer db.Close()
}
t.Run("FileIO", func(t *testing.T) {
opendb(storage.FileIO)
})
t.Run("MMap", func(t *testing.T) {
opendb(storage.MMap)
})
}
func Test_SaveInfo(t *testing.T) {
config := DefaultConfig()
config.DirPath = dbPath
db, err := Open(config)
if err != nil {
panic(err)
}
db.saveConfig()
var cfg Config
bytes, _ := ioutil.ReadFile(config.DirPath + "/db.cfg")
_ = json.Unmarshal(bytes, &cfg)
}
func TestRoseDB_Backup(t *testing.T) {
err := roseDB.Backup("/tmp/rosedb/backup-db0")
if err != nil {
t.Error(err)
}
}
func TestRoseDB_Close(t *testing.T) {
db := InitDb()
defer db.Close()
}
func TestRoseDB_Sync(t *testing.T) {
db := InitDb()
defer db.Close()
db.Sync()
}
func TestRoseDB_Reclaim2(t *testing.T) {
now := time.Now()
for i := 0; i <= 2000000; i++ {
value := GetValue()
err := roseDB.Set(GetKey(i%500000), value)
if err != nil {
panic(err)
}
if i == 44091 {
err := roseDB.Set("test-key", "rosedb")
if err != nil {
panic(err)
}
}
_, err = roseDB.HSet(GetKey(100), []byte("h1"), GetValue())
if err != nil {
panic(err)
}
}
for i := 0; i <= 2000000; i++ {
listKey := []byte("my-list")
_, err := roseDB.LPush(listKey, GetValue())
if err != nil {
panic(err)
}
if i > 200 {
_, err = roseDB.LPop(listKey)
if err != nil {
panic(err)
}
}
}
t.Log("time spend --- ", time.Since(now).Milliseconds())
}
func TestRoseDB_SingleMerge(t *testing.T) {
//writeDataForMerge()
err := roseDB.SingleMerge(0)
assert.Nil(t, err)
}
func TestRoseDB_StartMerge(t *testing.T) {
var err error
//writeDataForMerge()
//go func() {
// time.Sleep(4 * time.Second)
// fmt.Println("发送终止信号")
// roseDB.StopMerge()
//}()
now := time.Now()
err = roseDB.StartMerge()
if err != nil {
panic(err)
}
t.Log("merge spend --- ", time.Since(now).Milliseconds())
var r string
err = roseDB.Get("test-key", &r)
//assert.Equal(t, err, nil)
t.Log(r, err)
l := roseDB.strIndex.idxList.Len
t.Log("string 数据量 : ", l)
}
func TestRoseDB_StopMerge(t *testing.T) {
fmt.Println("发送终止信号")
roseDB.StopMerge()
}
func writeDataForMerge() {
//for i := 0; i <= 200000; i++ {
// listKey := []byte("my-list")
// _, err := roseDB.LPush(listKey, GetValue())
// if err != nil {
// panic(err)
// }
// if i > 20 {
// _, err = roseDB.LPop(listKey)
// if err != nil {
// panic(err)
// }
// }
//}
for i := 0; i <= 2000000; i++ {
err := roseDB.Set(GetKey(i%10000), GetValue())
if err != nil {
panic(err)
}
}
}
| 38,142
|
https://github.com/vamshipalle/leave-management-system/blob/master/client/src/data/leaveStatuses.js
|
Github Open Source
|
Open Source
|
MIT
| 2,019
|
leave-management-system
|
vamshipalle
|
JavaScript
|
Code
| 38
| 176
|
export const leaveStatuses = Object.freeze({
WAITING: 'WAITING',
EXPIRED: 'EXPIRED',
ACCEPTED: 'ACCEPTED',
REJECTEDBYHOD: 'REJECTEDBYHOD',
AUTOREJECTED: 'AUTOREJECTED',
REJECTEDBYALT: 'REJECTEDBYALT'
});
export const leaveStatusSelectOptions = Object.keys(leaveStatuses).map(
(key, index) => {
return {
value: leaveStatuses[key],
label:
leaveStatuses[key].charAt(0) + leaveStatuses[key].slice(1).toLowerCase()
};
}
);
| 34,043
|
https://github.com/galvez/fastify-esm-loader/blob/master/example/routes/stagingOnly.js
|
Github Open Source
|
Open Source
|
MIT
| 2,020
|
fastify-esm-loader
|
galvez
|
JavaScript
|
Code
| 11
| 25
|
export default (request, reply) => {
reply.send({ status: 'ok' })
}
| 26,062
|
https://github.com/vcellmike/Biosimulators_VCell/blob/master/vcell-client/src/main/java/org/vcell/util/gui/EnhancedLabelUI.java
|
Github Open Source
|
Open Source
|
MIT
| 2,022
|
Biosimulators_VCell
|
vcellmike
|
Java
|
Code
| 168
| 551
|
/*
* Copyright (C) 1999-2011 University of Connecticut Health Center
*
* Licensed under the MIT License (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.opensource.org/licenses/mit-license.php
*/
package org.vcell.util.gui;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicLabelUI;
/**
* Insert the type's description here.
* Creation date: (2/10/2001 3:13:43 AM)
* @author: Ion Moraru
*/
public class EnhancedLabelUI extends BasicLabelUI {
/**
* EnhancedLabelUI constructor comment.
*/
public EnhancedLabelUI() {
super();
}
protected String layoutCL(
JLabel label,
FontMetrics fontMetrics,
String text,
Icon icon,
Rectangle viewR,
Rectangle iconR,
Rectangle textR)
{
// so that we compute proper text clipping if rotated label
if (label instanceof EnhancedJLabel) {
EnhancedJLabel eLabel = (EnhancedJLabel)label;
if (eLabel.getVertical()) {
Rectangle2D viewR2 = (Rectangle2D)viewR;
viewR2.setRect(viewR.x, viewR.y, viewR.height, viewR.width);
}
}
//
return SwingUtilities.layoutCompoundLabel(
(JComponent) label,
fontMetrics,
text,
icon,
label.getVerticalAlignment(),
label.getHorizontalAlignment(),
label.getVerticalTextPosition(),
label.getHorizontalTextPosition(),
viewR,
iconR,
textR,
label.getIconTextGap());
}
}
| 12,684
|
https://github.com/stratosger/glGA-edu/blob/master/_thirdPartyLibs/include/vsr/z_deprecated/vsr_manifold.h
|
Github Open Source
|
Open Source
|
BSD-4-Clause-UC
| 2,021
|
glGA-edu
|
stratosger
|
C
|
Code
| 98
| 307
|
/*
* =====================================================================================
*
* Filename: vsr_manifold.h
*
* Description: 3d combo of smart objects and graphs (like halfedge)
*
* Version: 1.0
* Created: 11/15/2013 13:47:08
* Revision: none
* Compiler: gcc
*
* Author: Pablo Colapinto (), wolftype (gmail)
* Organization:
*
* =====================================================================================
*/
#include "vsr_graph.h"
#include "vsr_smart.h"
#include "vsr_cga3D_op.h"
namespace vsr{
/*
* =====================================================================================
* Class: Facet
* Description: A triangular face
* =====================================================================================
*/
class Facet {
SmartObj<Pnt, HEGraph::Node> a, b, c;
public:
};
/*!
* =====================================================================================
* Class: Surface
* Description: 2d manifold
* =====================================================================================
*/
class Surface {
public:
};
}
| 26,276
|
https://github.com/alibaba/graph-learn/blob/master/dynamic_graph_service/src/service/actor_ref_builder.h
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,023
|
graph-learn
|
alibaba
|
C++
|
Code
| 121
| 395
|
/* Copyright 2022 Alibaba Group Holding Limited. All Rights Reserved.
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.
==============================================================================*/
#ifndef DGS_SERVICE_ACTOR_REF_BUILDER_H_
#define DGS_SERVICE_ACTOR_REF_BUILDER_H_
#include "service/generated/sampling_actor_ref.act.autogen.h"
#include "service/generated/data_update_actor_ref.act.autogen.h"
#include "service/generated/serving_actor_ref.act.autogen.h"
namespace dgs {
SamplingActor_ref
MakeSamplingActorInstRef(hiactor::scope_builder& builder);
SamplingActor_ref*
MakeSamplingActorInstRefPtr(hiactor::scope_builder& builder);
DataUpdateActor_ref
MakeDataUpdateActorInstRef(hiactor::scope_builder& builder);
ServingActor_ref
MakeServingActorInstRef(hiactor::scope_builder& builder);
} // namespace dgs
#endif // DGS_SERVICE_ACTOR_REF_BUILDER_H_
| 29,826
|
https://github.com/LunarRed/tfjs/blob/master/tfjs-core/src/ops/confusion_matrix.ts
|
Github Open Source
|
Open Source
|
Apache-2.0
| 2,021
|
tfjs
|
LunarRed
|
TypeScript
|
Code
| 515
| 1,104
|
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* 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.
* =============================================================================
*/
import {Tensor1D, Tensor2D} from '../tensor';
import {convertToTensor} from '../tensor_util_env';
import {TensorLike} from '../types';
import * as util from '../util';
import {cast} from './cast';
import {matMul} from './mat_mul';
import {oneHot} from './one_hot';
import {op} from './operation';
import {transpose} from './transpose';
/**
* Computes the confusion matrix from true labels and predicted labels.
*
* ```js
* const labels = tf.tensor1d([0, 1, 2, 1, 0], 'int32');
* const predictions = tf.tensor1d([0, 2, 2, 1, 0], 'int32');
* const numClasses = 3;
* const out = tf.math.confusionMatrix(labels, predictions, numClasses);
* out.print();
* // Expected output matrix:
* // [[2, 0, 0],
* // [0, 1, 1],
* // [0, 0, 1]]
* ```
*
* @param labels The target labels, assumed to be 0-based integers
* for the classes. The shape is `[numExamples]`, where
* `numExamples` is the number of examples included.
* @param predictions The predicted classes, assumed to be
* 0-based integers for the classes. Must have the same shape as `labels`.
* @param numClasses Number of all classes, as an integer.
* Its value must be larger than the largest element in `labels` and
* `predictions`.
* @returns The confusion matrix as a int32-type 2D tensor. The value at
* row `r` and column `c` is the number of times examples of actual class
* `r` were predicted as class `c`.
*/
/** @doc {heading: 'Operations', subheading: 'Evaluation'} */
export function confusionMatrix_(
labels: Tensor1D|TensorLike, predictions: Tensor1D|TensorLike,
numClasses: number): Tensor2D {
const $labels = convertToTensor(labels, 'labels', 'confusionMatrix');
const $predictions =
convertToTensor(predictions, 'predictions', 'confusionMatrix');
util.assert(
numClasses == null || numClasses > 0 && Number.isInteger(numClasses),
() => `If provided, numClasses must be a positive integer, ` +
`but got ${numClasses}`);
util.assert(
$labels.rank === 1,
() => `Expected the rank of labels to be 1, but got ${$labels.rank}`);
util.assert(
$predictions.rank === 1,
() => `Expected the rank of predictions to be 1, ` +
`but got ${$predictions.rank}`);
util.assert(
$labels.shape[0] === $predictions.shape[0],
() => `Mismatch in the number of examples: ` +
`${$labels.shape[0]} vs. ${$predictions.shape[0]}. ` +
`Labels and predictions should have the same number of elements.`);
util.assert(
numClasses > 0 && Number.isInteger(numClasses),
() => `numClasses is required to be a positive integer, but got ` +
`${numClasses}`);
// TODO(cais): In the future, if oneHot supports tensors inputs for
// `numClasses`, `confusionMatrix` can make `numClasses` optional.
const oneHotLabels = oneHot(cast($labels, 'int32'), numClasses) as Tensor2D;
const oneHotPredictions =
oneHot(cast($predictions, 'int32'), numClasses) as Tensor2D;
const oneHotLabelsT: Tensor2D = transpose(oneHotLabels);
return cast(matMul(oneHotLabelsT, oneHotPredictions), 'int32');
}
export const confusionMatrix = op({confusionMatrix_});
| 39,581
|
https://github.com/mtcarvalho/docs-connectors/blob/master/hl7/4.2/modules/ROOT/nav.adoc
|
Github Open Source
|
Open Source
|
BSD-3-Clause
| 2,022
|
docs-connectors
|
mtcarvalho
|
AsciiDoc
|
Code
| 41
| 186
|
.xref:index.adoc[HL7 EDI Connector]
* xref:index.adoc[About HL7 EDI Connector]
* xref:hl7-connector-reference.adoc[HL7 EDI Connector Reference]
* xref:hl7-connector-studio.adoc[Use Anypoint Studio to Configure HL7 EDI Connector]
* xref:hl7-connector-config-topics.adoc[HL7 Schema Configuration]
* xref:hl7-connector-examples.adoc[HL7 EDI Examples]
* xref:hl7-connector-xml-maven.adoc[HL7 EDI XML and Maven Support]
* xref:hl7-schemas.adoc[HL7 Supported Schemas]
| 3,820
|
https://github.com/novakge/project-parsers/blob/master/data/mmlib100/J10057_5.mm
|
Github Open Source
|
Open Source
|
MIT
| 2,021
|
project-parsers
|
novakge
|
Objective-C++
|
Code
| 2,992
| 5,904
|
jobs (incl. supersource/sink ): 102
RESOURCES
- renewable : 2 R
- nonrenewable : 2 N
- doubly constrained : 0 D
************************************************************************
PRECEDENCE RELATIONS:
jobnr. #modes #successors successors
1 1 16 2 3 4 5 6 7 8 9 10 11 12 14 17 20 23 25
2 3 11 45 43 37 36 32 31 29 26 24 16 15
3 3 10 43 36 34 29 24 21 19 18 15 13
4 3 13 51 46 45 42 41 39 36 35 32 31 29 27 24
5 3 10 60 51 46 45 44 37 36 31 27 16
6 3 9 47 46 45 44 36 33 24 21 13
7 3 9 54 45 43 39 37 36 31 27 18
8 3 13 59 51 46 45 44 39 38 37 36 31 30 28 24
9 3 10 54 53 51 49 46 38 36 30 29 22
10 3 6 60 51 44 31 27 16
11 3 13 65 60 59 53 49 47 46 42 41 40 37 36 33
12 3 11 74 60 52 50 46 44 42 41 37 35 27
13 3 13 74 60 56 54 53 52 51 50 49 48 39 38 30
14 3 13 71 62 54 53 50 49 48 46 42 41 40 36 29
15 3 13 74 62 60 59 55 53 52 51 48 47 44 38 30
16 3 8 74 53 52 48 47 39 35 30
17 3 6 65 59 49 36 31 30
18 3 9 74 55 53 52 51 48 46 35 30
19 3 10 65 60 59 52 51 50 49 47 44 30
20 3 8 65 60 53 52 47 44 39 30
21 3 12 74 71 65 59 56 55 53 52 50 42 41 40
22 3 12 84 74 71 62 55 52 50 48 45 42 41 40
23 3 10 84 74 65 61 59 51 48 42 41 36
24 3 13 84 71 65 60 58 56 55 53 52 50 49 48 40
25 3 6 65 50 43 41 40 36
26 3 12 78 74 68 65 60 55 50 48 47 46 42 41
27 3 8 71 58 55 53 48 47 40 38
28 3 15 79 78 77 71 70 69 64 63 62 61 57 55 53 50 47
29 3 13 79 78 76 74 70 64 63 60 59 57 56 55 47
30 3 6 84 71 68 42 41 40
31 3 13 79 77 74 71 70 69 64 63 62 61 57 50 47
32 3 13 100 84 83 79 77 71 68 65 58 57 55 54 48
33 3 12 84 83 74 70 68 63 57 56 55 51 50 48
34 3 8 84 78 68 63 61 55 42 41
35 3 12 98 84 79 76 72 71 70 68 66 65 59 49
36 3 10 101 83 77 76 73 63 58 56 55 52
37 3 11 101 96 78 76 73 71 69 64 63 62 55
38 3 16 101 100 98 97 96 84 82 79 77 76 75 69 68 66 65 64
39 3 10 100 97 96 77 76 69 64 62 58 55
40 3 11 98 96 83 82 78 77 76 67 63 61 57
41 3 11 100 98 96 95 94 83 79 77 72 70 57
42 3 10 100 97 96 90 75 72 69 67 64 58
43 3 9 99 98 97 84 82 72 67 64 57
44 3 7 100 97 96 72 66 64 57
45 3 15 101 99 98 97 96 94 91 90 83 82 81 76 72 69 67
46 3 12 96 94 92 91 90 86 82 81 77 72 69 67
47 3 10 100 98 97 96 90 86 84 83 75 66
48 3 9 96 94 92 90 82 81 72 69 66
49 3 9 101 100 99 93 90 89 75 69 64
50 3 10 100 98 97 95 92 90 82 76 73 67
51 3 9 96 94 90 87 80 79 78 75 66
52 3 12 98 97 96 95 91 90 89 88 82 81 80 68
53 3 12 99 98 93 91 90 89 88 83 82 81 80 68
54 3 10 98 97 96 95 90 88 78 76 73 72
55 3 8 99 98 90 87 86 82 75 66
56 3 6 99 94 92 90 69 66
57 3 9 101 91 90 89 88 87 81 75 73
58 3 8 99 93 92 89 88 87 81 70
59 3 9 99 97 96 94 89 87 86 85 77
60 3 10 101 97 96 92 91 90 88 87 86 85
61 3 7 97 94 91 90 87 86 72
62 3 7 99 93 91 90 88 83 80
63 3 6 100 97 93 88 86 72
64 3 6 95 94 92 86 83 81
65 3 5 91 90 88 87 73
66 3 2 91 67
67 3 4 93 89 88 85
68 3 4 92 87 86 85
69 3 3 95 87 80
70 3 3 91 86 82
71 3 3 92 87 80
72 3 2 89 80
73 3 2 86 80
74 3 2 86 80
75 3 2 92 85
76 3 2 87 86
77 3 2 93 88
78 3 2 86 85
79 3 2 86 85
80 3 1 85
81 3 1 85
82 3 1 85
83 3 1 87
84 3 1 85
85 3 1 102
86 3 1 102
87 3 1 102
88 3 1 102
89 3 1 102
90 3 1 102
91 3 1 102
92 3 1 102
93 3 1 102
94 3 1 102
95 3 1 102
96 3 1 102
97 3 1 102
98 3 1 102
99 3 1 102
100 3 1 102
101 3 1 102
102 1 0
************************************************************************
REQUESTS/DURATIONS
jobnr. mode dur R1 R2 N1 N2
------------------------------------------------------------------------
1 1 0 0 0 0 0
2 1 1 1 4 6 0
2 6 1 3 4 0
3 9 1 1 0 5
3 1 3 2 1 10 0
2 5 1 1 8 0
3 7 1 1 5 0
4 1 2 4 2 5 0
2 6 3 2 0 10
3 9 2 1 4 0
5 1 1 4 1 0 4
2 10 2 1 0 3
3 10 1 1 2 0
6 1 3 1 3 0 6
2 5 1 2 2 0
3 10 1 2 1 0
7 1 7 5 2 3 0
2 9 2 1 2 0
3 10 1 1 0 7
8 1 1 4 1 7 0
2 8 3 1 7 0
3 9 2 1 7 0
9 1 2 5 5 9 0
2 7 5 3 6 0
3 8 5 3 4 0
10 1 1 2 3 7 0
2 2 2 2 6 0
3 9 2 2 5 0
11 1 2 4 3 0 10
2 4 4 3 0 8
3 5 3 3 9 0
12 1 1 1 4 8 0
2 6 1 4 7 0
3 9 1 4 0 1
13 1 3 4 4 6 0
2 4 3 3 0 6
3 5 2 2 5 0
14 1 1 5 3 0 7
2 6 4 3 6 0
3 9 2 3 0 4
15 1 1 4 2 0 3
2 1 4 1 6 0
3 10 4 1 5 0
16 1 1 3 5 0 7
2 2 1 3 0 5
3 2 1 3 10 0
17 1 1 2 5 3 0
2 2 2 4 3 0
3 6 2 4 0 4
18 1 5 1 5 6 0
2 7 1 4 3 0
3 9 1 3 0 1
19 1 6 4 3 0 5
2 7 4 2 0 4
3 10 4 2 0 3
20 1 4 2 5 8 0
2 6 1 3 8 0
3 10 1 3 0 7
21 1 3 3 3 0 7
2 4 2 3 4 0
3 9 2 3 0 4
22 1 1 4 3 5 0
2 3 3 3 0 7
3 3 3 3 3 0
23 1 1 4 4 0 6
2 5 3 3 0 5
3 10 1 3 0 4
24 1 4 5 2 0 9
2 5 4 1 5 0
3 6 4 1 4 0
25 1 1 5 1 3 0
2 2 4 1 0 2
3 4 2 1 3 0
26 1 1 2 5 10 0
2 2 2 4 6 0
3 7 2 4 5 0
27 1 2 4 4 7 0
2 4 3 3 0 5
3 5 3 3 0 4
28 1 6 1 3 5 0
2 7 1 1 5 0
3 9 1 1 0 6
29 1 2 5 3 9 0
2 3 4 3 0 7
3 5 3 1 6 0
30 1 3 1 5 0 10
2 7 1 2 0 6
3 9 1 2 2 0
31 1 2 4 3 6 0
2 4 4 2 0 2
3 5 4 1 0 2
32 1 1 5 4 0 8
2 5 4 3 7 0
3 7 2 2 7 0
33 1 2 4 2 4 0
2 6 3 1 0 4
3 8 3 1 3 0
34 1 4 3 3 0 5
2 8 2 1 4 0
3 9 2 1 3 0
35 1 2 4 5 6 0
2 8 4 3 0 6
3 10 4 3 0 3
36 1 3 3 2 0 4
2 4 3 1 0 4
3 4 2 1 3 0
37 1 3 4 5 6 0
2 6 3 4 0 5
3 8 2 4 2 0
38 1 2 5 4 7 0
2 4 5 4 6 0
3 7 5 4 5 0
39 1 2 4 5 8 0
2 3 4 4 6 0
3 3 4 3 0 3
40 1 4 2 3 0 4
2 5 1 3 0 3
3 7 1 1 3 0
41 1 2 1 4 0 5
2 4 1 3 0 5
3 8 1 3 0 4
42 1 3 3 2 3 0
2 4 2 2 2 0
3 7 2 2 1 0
43 1 5 4 2 0 6
2 5 4 2 5 0
3 6 4 2 0 5
44 1 3 3 4 0 8
2 9 3 3 0 8
3 10 3 3 3 0
45 1 3 5 4 6 0
2 4 4 4 0 2
3 9 2 3 3 0
46 1 2 3 5 0 9
2 2 2 4 4 0
3 8 1 2 0 3
47 1 4 5 3 4 0
2 5 4 2 0 4
3 8 3 2 0 3
48 1 2 5 4 8 0
2 8 3 4 0 9
3 10 3 4 7 0
49 1 3 3 3 5 0
2 4 3 3 0 6
3 7 2 2 3 0
50 1 1 3 2 3 0
2 3 3 1 0 6
3 10 3 1 1 0
51 1 5 2 4 9 0
2 8 2 4 0 5
3 9 2 4 0 4
52 1 7 2 3 0 6
2 9 1 3 0 3
3 9 1 2 7 0
53 1 2 3 4 0 9
2 6 2 4 0 7
3 8 2 2 2 0
54 1 1 2 4 0 7
2 5 2 3 0 7
3 6 2 1 0 7
55 1 4 4 1 0 9
2 5 3 1 9 0
3 10 2 1 0 7
56 1 1 3 3 7 0
2 7 2 3 7 0
3 10 2 2 0 5
57 1 7 5 3 4 0
2 8 5 3 0 6
3 10 5 3 3 0
58 1 4 4 4 9 0
2 9 2 3 0 3
3 10 2 3 0 2
59 1 3 5 2 4 0
2 6 3 2 4 0
3 7 2 2 3 0
60 1 2 1 5 0 5
2 5 1 4 7 0
3 6 1 4 5 0
61 1 2 2 2 9 0
2 4 2 1 0 6
3 10 2 1 0 5
62 1 1 3 3 0 6
2 3 2 2 7 0
3 9 1 2 7 0
63 1 5 5 3 2 0
2 6 4 3 2 0
3 7 4 1 0 3
64 1 1 2 4 0 7
2 4 1 3 0 6
3 7 1 2 0 5
65 1 5 4 4 0 8
2 8 4 2 6 0
3 9 4 2 0 7
66 1 3 5 3 9 0
2 7 4 3 4 0
3 7 4 3 0 4
67 1 7 2 1 9 0
2 7 2 1 0 4
3 10 2 1 5 0
68 1 3 2 4 0 6
2 6 2 4 5 0
3 8 2 3 5 0
69 1 2 3 1 0 3
2 7 2 1 0 2
3 9 2 1 0 1
70 1 5 5 2 0 6
2 6 4 1 3 0
3 8 2 1 0 6
71 1 1 1 5 0 3
2 5 1 2 5 0
3 10 1 1 0 3
72 1 2 2 4 0 7
2 2 2 3 6 0
3 10 1 3 0 1
73 1 3 4 5 0 5
2 4 4 4 2 0
3 7 3 4 1 0
74 1 1 2 3 0 10
2 6 2 2 0 9
3 9 1 2 3 0
75 1 1 4 3 9 0
2 2 4 3 8 0
3 6 4 2 8 0
76 1 2 5 3 4 0
2 2 4 2 0 7
3 10 4 2 2 0
77 1 2 2 4 10 0
2 7 2 3 0 6
3 8 2 3 0 2
78 1 4 5 4 7 0
2 7 3 2 5 0
3 10 3 2 0 3
79 1 8 1 2 3 0
2 9 1 1 0 6
3 9 1 1 2 0
80 1 1 3 3 0 10
2 4 2 3 6 0
3 4 2 3 0 8
81 1 2 4 3 0 5
2 6 3 3 0 4
3 9 3 3 0 3
82 1 6 4 2 0 5
2 6 2 2 4 0
3 9 2 2 0 5
83 1 3 3 4 5 0
2 9 3 4 0 4
3 10 3 4 0 3
84 1 2 4 3 6 0
2 3 3 2 0 7
3 4 2 1 4 0
85 1 1 3 5 6 0
2 2 2 5 5 0
3 8 2 5 0 8
86 1 8 4 2 0 6
2 9 3 1 0 6
3 10 1 1 0 2
87 1 4 5 5 0 6
2 7 5 5 0 3
3 9 5 5 5 0
88 1 1 3 3 1 0
2 3 2 3 0 3
3 5 1 2 1 0
89 1 6 4 4 0 6
2 7 3 4 0 4
3 8 2 4 7 0
90 1 1 3 4 0 10
2 2 3 3 0 9
3 10 3 3 1 0
91 1 3 2 2 0 2
2 4 2 1 5 0
3 5 2 1 4 0
92 1 6 1 2 0 6
2 7 1 2 4 0
3 9 1 2 0 2
93 1 3 2 3 0 10
2 5 2 2 4 0
3 8 2 2 0 8
94 1 1 4 2 0 4
2 2 3 2 0 4
3 5 3 2 0 2
95 1 3 3 5 0 6
2 5 3 4 0 6
3 9 2 2 3 0
96 1 7 2 4 6 0
2 8 2 4 3 0
3 9 2 2 0 3
97 1 4 4 2 0 6
2 6 4 2 0 5
3 7 4 2 0 2
98 1 3 1 2 8 0
2 7 1 1 0 5
3 7 1 1 7 0
99 1 2 5 3 0 9
2 3 4 2 5 0
3 9 4 1 0 8
100 1 4 5 4 0 4
2 5 5 2 2 0
3 7 5 2 1 0
101 1 1 1 4 8 0
2 5 1 3 0 5
3 6 1 3 0 4
102 1 0 0 0 0 0
************************************************************************
RESOURCE AVAILABILITIES
R 1 R 2 N 1 N 2
28 26 272 279
************************************************************************
| 7,223
|
https://github.com/xopr/gigatron-rom/blob/master/Utils/lcc/src/stab.h
|
Github Open Source
|
Open Source
|
BSD-2-Clause
| 2,022
|
gigatron-rom
|
xopr
|
C
|
Code
| 621
| 1,567
|
/* @(#)stab.h 1.11 92/05/11 SMI */
/* $Id$ */
/*
* Copyright (c) 1990 by Sun Microsystems, Inc.
*/
/*
* This file gives definitions supplementing <a.out.h>
* for permanent symbol table entries.
* These must have one of the N_STAB bits on,
* and are subject to relocation according to the masks in <a.out.h>.
*/
#ifndef _STAB_H
#define _STAB_H
#if !defined(_a_out_h) && !defined(_A_OUT_H)
/* this file contains fragments of a.out.h and stab.h relevant to
* support of stabX processing within ELF files - see the
* Format of a symbol table entry
*/
struct nlist {
union {
char *n_name; /* for use when in-core */
long n_strx; /* index into file string table */
} n_un;
unsigned char n_type; /* type flag (N_TEXT,..) */
char n_other; /* unused */
short n_desc; /* see <stab.h> */
unsigned long n_value; /* value of symbol (or sdb offset) */
};
/*
* Simple values for n_type.
*/
#define N_UNDF 0x0 /* undefined */
#define N_ABS 0x2 /* absolute */
#define N_TEXT 0x4 /* text */
#define N_DATA 0x6 /* data */
#define N_BSS 0x8 /* bss */
#define N_COMM 0x12 /* common (internal to ld) */
#define N_FN 0x1f /* file name symbol */
#define N_EXT 01 /* external bit, or'ed in */
#define N_TYPE 0x1e /* mask for all the type bits */
#endif
/*
* for symbolic debugger, sdb(1):
*/
#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
#define N_MAIN 0x2a /* name of main routine : name,,0,0,0 */
#define N_ROSYM 0x2c /* ro_data objects */
#define N_OBJ 0x38 /* object file path or name */
#define N_OPT 0x3c /* compiler options */
#define N_RSYM 0x40 /* register sym: name,,0,type,register */
#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
#define N_FLINE 0x4c /* function start.end */
#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
#define N_ENDM 0x62 /* last stab emitted for module */
#define N_SO 0x64 /* source file name: name,,0,0,address */
#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
#define N_BINCL 0x82 /* header file: name,,0,0,0 */
#define N_SOL 0x84 /* #included file name: name,,0,0,address */
#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
#define N_EINCL 0xa2 /* end of include file */
#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
#define N_EXCL 0xc2 /* excluded include file */
#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
#define N_BCOMM 0xe2 /* begin common: name,, */
#define N_ECOMM 0xe4 /* end common: name,, */
#define N_ECOML 0xe8 /* end common (local name): ,,address */
#define N_LENG 0xfe /* second stab entry with length information */
/*
* for the berkeley pascal compiler, pc(1):
*/
#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */
#define N_WITH 0xea /* pascal with statement: type,,0,0,offset */
/*
* for code browser only
*/
#define N_BROWS 0x48 /* path to associated .cb file */
/*
* Optional langauge designations for N_SO
*/
#define N_SO_AS 1 /* Assembler */
#define N_SO_C 2 /* C */
#define N_SO_ANSI_C 3 /* ANSI C */
#define N_SO_CC 4 /* C++ */
#define N_SO_FORTRAN 5 /* Fortran 77 */
#define N_SO_PASCAL 6 /* Pascal */
/*
* Floating point type values
*/
#define NF_NONE 0 /* Undefined type */
#define NF_SINGLE 1 /* IEEE 32 bit float */
#define NF_DOUBLE 2 /* IEEE 64 bit float */
#define NF_COMPLEX 3 /* Fortran complex */
#define NF_COMPLEX16 4 /* Fortran double complex */
#define NF_COMPLEX32 5 /* Fortran complex*16 */
#define NF_LDOUBLE 6 /* Long double */
#endif
| 3,338
|
https://github.com/nfleet/java-sdk/blob/master/fi/cosky/sdk/TaskEventUpdateRequest.java
|
Github Open Source
|
Open Source
|
MIT
| 2,015
|
java-sdk
|
nfleet
|
Java
|
Code
| 201
| 538
|
package fi.cosky.sdk;
import java.util.List;
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
public class TaskEventUpdateRequest extends BaseData {
private int TaskEventId;
private Type Type;
private List<TimeWindowData> TimeWindows;
private LocationData Location;
private int ServiceTime;
private int StoppingTime;
private List<CapacityData> Capacities;
//Constructor uses only the required fields, others can be accessed via getters and setters
public TaskEventUpdateRequest(Type type, LocationData location, List<CapacityData> capacities) {
this.Type = type;
this.Location = location;
this.Capacities = capacities;
}
public Type getType() {
return Type;
}
public void setType(Type type) {
this.Type = type;
}
public int getTaskEventId() {
return TaskEventId;
}
public void setTaskEventId(int taskEventId) {
TaskEventId = taskEventId;
}
public List<TimeWindowData> getTimeWindows() {
return TimeWindows;
}
public void setTimeWindows(List<TimeWindowData> timeWindows) {
TimeWindows = timeWindows;
}
public LocationData getLocation() {
return Location;
}
public void setLocation(LocationData location) {
Location = location;
}
public int getServiceTime() {
return ServiceTime;
}
public void setServiceTime(int serviceTime) {
ServiceTime = serviceTime;
}
public int getStoppingTime() {
return StoppingTime;
}
public void setStoppingTime(int stoppingTime) {
StoppingTime = stoppingTime;
}
public List<CapacityData> getCapacities() {
return Capacities;
}
public void setCapacities(List<CapacityData> capacities) {
Capacities = capacities;
}
}
| 40,786
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.