The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: TypeError
Message: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2011, in _prepare_split_single
writer.write_table(table)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
pa_table = table_cast(pa_table, self._schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
return cast_table_to_schema(table, schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in cast_table_to_schema
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in <listcomp>
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in wrapper
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in <listcomp>
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2122, in cast_array_to_feature
raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
TypeError: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
package org.sqsh.commands;
import org.sqsh.Buffer;
import org.sqsh.BufferManager;
import org.sqsh.Command;
import org.sqsh.Session;
import org.sqsh.SessionRedrawBufferMessage;
import org.sqsh.SqshOptions;
import org.sqsh.options.Argv;
import java.util.ArrayList;
import java.util.List;
/**
* Implements the \buf-append command.
*/
public class BufCopyOrAppend extends Command {
private static class Options extends SqshOptions {
@Argv(program = "\\buf-copy", min = 1, max = 3, usage = "[-G] [alias=command_line")
public List<String> arguments = new ArrayList<>();
}
/**
* Returns the set of options required for this command.
*/
@Override
public SqshOptions getOptions() {
return new Options();
}
@Override
public int execute(Session session, SqshOptions opts) throws Exception {
Options options = (Options) opts;
if (options.arguments.size() < 1 || options.arguments.size() > 2) {
session.err.println("Use: " + getName() + " src-buf [dst-buf]");
return 1;
}
String srcBuf = options.arguments.get(0);
String destBuf = "!.";
if (options.arguments.size() == 2) {
destBuf = options.arguments.get(1);
}
BufferManager bufMan = session.getBufferManager();
Buffer src = bufMan.getBuffer(srcBuf);
if (src == null) {
session.err.println("The specified source buffer '" + srcBuf + "' does not exist");
return 1;
}
Buffer dst = bufMan.getBuffer(destBuf);
if (dst == null) {
session.err.println("The specified destination buffer '" + destBuf + "' does not exist");
return 1;
}
// If this is the "buf-copy" command, then clear the destination buffer before proceeding.
if (getName().contains("copy")) {
dst.clear();
}
boolean doRedraw = (dst == bufMan.getCurrent());
dst.add(src.toString());
// If we just manipulated the current buffer, then ask the session to redraw the current buffer.
if (doRedraw) {
throw new SessionRedrawBufferMessage();
}
return 0;
}
}
|
{
"content_hash": "4bf37995f15acf96102389da57b93d22",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 104,
"avg_line_length": 29.30263157894737,
"alnum_prop": 0.6021553659631792,
"repo_name": "scgray/jsqsh",
"id": "2a57a47eb8256b9fda8e574081900b6a7f278dc5",
"size": "2828",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jsqsh-core/src/main/java/org/sqsh/commands/BufCopyOrAppend.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1335731"
}
]
}
|
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import { exec, ChildProcess } from 'child_process';
import { normalize } from 'path';
import * as ps from 'ps-node';
import * as fs from 'fs';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
context.subscriptions.push(vscode.commands.registerCommand('extension.startMTA', () => {
// The code you place here will be executed every time your command is executed
const config = vscode.workspace.getConfiguration('launch');
let info = config.get<Array<any>>('configurations');
if (!info) {
vscode.window.showErrorMessage('Could not find a launch configuration. Please make sure you created one.');
return;
}
// Filter 'mtasa' configs
info = info.filter(v => v.type === "mtasa");
// Show error if there's no mtasa configuration
if (!info[0]) {
vscode.window.showErrorMessage('Could not find a launch configuration of type \'mtasa\'. Make sure you created one.');
return;
}
// Show error if no serverpath is provided
const serverpath = info[0].serverpath;
if (!serverpath) {
vscode.window.showErrorMessage('The path to the MTA:SA server directory is missing. Make sure you added one to your launch configuration.');
return;
}
// Show error if the serverpath is invalid
if (!fs.existsSync(serverpath) || !fs.statSync(serverpath).isDirectory()) {
vscode.window.showErrorMessage('The value of the \'serverpath\' variable is invalid. It either doesn\'t exist or it is not a directory');
return;
}
// Check process state
ps.lookup({
command: 'DebugServer'
}, (err, resultList) => {
// Show error if debug server is running already
if (!resultList || resultList.length > 0) {
vscode.window.showErrorMessage('Could not start the debug server, because there is one running already!');
return;
}
// Get extension path (the DebugServer lays there)
const extensionPath = normalize(vscode.extensions.getExtension('jusonex.mtatd').extensionPath);
// Start server
const path = normalize(serverpath + '/MTA Server.exe');
exec(`start "MTA:SA Server [SCRIPT-DEBUG]" "${extensionPath}\\DebugServer.exe" "${path}" 51237`);
});
}));
context.subscriptions.push(vscode.commands.registerCommand('extension.addMTATDBundle', () => {
// Get extension path (the MTATD bundle lays there)
const extensionPath = vscode.extensions.getExtension('jusonex.mtatd').extensionPath;
const workspacePath = vscode.workspace.rootPath;
if (!extensionPath || !workspacePath || extensionPath == '' || workspacePath == '') {
vscode.window.showErrorMessage('Please open a folder/workspace first!');
return;
}
// Copy file
fs.createReadStream(`${extensionPath}/MTATD.bundle.lua`).pipe(fs.createWriteStream(`${workspacePath}/MTATD.bundle.lua`));
}));
}
// this method is called when your extension is deactivated
export function deactivate() {
}
|
{
"content_hash": "44b2aa04ba5b19dc3e73e95b6424da0a",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 152,
"avg_line_length": 43.74418604651163,
"alnum_prop": 0.6451355661881978,
"repo_name": "Jusonex/MTATD",
"id": "be29270d54819bf5783a2326d00552c5bb07f950",
"size": "3762",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "VSCode_Extension/src/extension.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "527"
},
{
"name": "Go",
"bytes": "13752"
},
{
"name": "Lua",
"bytes": "21985"
},
{
"name": "Python",
"bytes": "1016"
},
{
"name": "TypeScript",
"bytes": "21006"
}
]
}
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<studio>
<functionalitySettings>
<functionality id="oneToOneIndex"
state="ENABLE"/>
<functionality id="joinedInheritanceDeleteCascade"
state="ENABLE"/>
<functionality id="newFkConstraintNaming"
state="ENABLE"/>
</functionalitySettings>
</studio>
|
{
"content_hash": "b91791764930e85997d4d83e9491fcd7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 58,
"avg_line_length": 36.54545454545455,
"alnum_prop": 0.5771144278606966,
"repo_name": "balvi/cuba-component-user-session-information",
"id": "26eccf6f4fc8cfa1fbb2d79d3bd9e31f9884a45b",
"size": "402",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "studio-settings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "56512"
},
{
"name": "Shell",
"bytes": "682"
}
]
}
|
#include <errno.h>
#include <unistd.h>
#include <sys/statfs.h>
/* Used like: return __statfs_link_max (__statfs (name, &buf), &buf,
name, -1); */
extern long int __statfs_link_max (int result, const struct statfs *fsbuf,
const char *file, int fd);
/* Used like: return __statfs_filesize_max (__statfs (name, &buf), &buf); */
extern long int __statfs_filesize_max (int result, const struct statfs *fsbuf);
/* Used like: return __statfs_link_max (__statfs (name, &buf), &buf); */
extern long int __statfs_symlinks (int result, const struct statfs *fsbuf);
/* Used like: return __statfs_chown_restricted (__statfs (name, &buf), &buf);*/
extern long int __statfs_chown_restricted (int result,
const struct statfs *fsbuf);
|
{
"content_hash": "e4ad6839487f5343f5aa9ebac9024304",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.6577540106951871,
"repo_name": "endplay/omniplay",
"id": "34289d8005d469eed20b0ae96e166f93d0c3ed7e",
"size": "1697",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "eglibc-2.15/sysdeps/unix/sysv/linux/pathconf.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "4528"
},
{
"name": "Assembly",
"bytes": "17491433"
},
{
"name": "Awk",
"bytes": "79791"
},
{
"name": "Batchfile",
"bytes": "903"
},
{
"name": "C",
"bytes": "444772157"
},
{
"name": "C++",
"bytes": "10631343"
},
{
"name": "GDB",
"bytes": "17950"
},
{
"name": "HTML",
"bytes": "47935"
},
{
"name": "Java",
"bytes": "2193"
},
{
"name": "Lex",
"bytes": "44513"
},
{
"name": "M4",
"bytes": "9029"
},
{
"name": "Makefile",
"bytes": "1758605"
},
{
"name": "Objective-C",
"bytes": "5278898"
},
{
"name": "Perl",
"bytes": "649746"
},
{
"name": "Perl 6",
"bytes": "1101"
},
{
"name": "Python",
"bytes": "585875"
},
{
"name": "RPC",
"bytes": "97869"
},
{
"name": "Roff",
"bytes": "2522798"
},
{
"name": "Scilab",
"bytes": "21433"
},
{
"name": "Shell",
"bytes": "426172"
},
{
"name": "TeX",
"bytes": "283872"
},
{
"name": "UnrealScript",
"bytes": "6143"
},
{
"name": "XS",
"bytes": "1240"
},
{
"name": "Yacc",
"bytes": "93190"
},
{
"name": "sed",
"bytes": "9202"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/healthcheck/config">
</filter>
<filter root="/etc/healthstatus">
</filter>
</workspaceFilter>
|
{
"content_hash": "ba8e20a5a2c18273fee84ee3321996db",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 41,
"avg_line_length": 27.428571428571427,
"alnum_prop": 0.6822916666666666,
"repo_name": "joerghoh/cq5-healthcheck",
"id": "f0525f58332eaea40956ccb9cbedbe71b34f86e3",
"size": "192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sample-content/META-INF/vault/filter.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "58891"
}
]
}
|
namespace Google.Cloud.Compute.V1.Snippets
{
// [START compute_v1_generated_TargetVpnGateways_Insert_async]
using Google.Cloud.Compute.V1;
using System.Threading.Tasks;
using lro = Google.LongRunning;
public sealed partial class GeneratedTargetVpnGatewaysClientSnippets
{
/// <summary>Snippet for InsertAsync</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public async Task InsertRequestObjectAsync()
{
// Create client
TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync();
// Initialize request argument(s)
InsertTargetVpnGatewayRequest request = new InsertTargetVpnGatewayRequest
{
TargetVpnGatewayResource = new TargetVpnGateway(),
RequestId = "",
Region = "",
Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await targetVpnGatewaysClient.InsertAsync(request);
// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
lro::Operation<Operation, Operation> retrievedResponse = await targetVpnGatewaysClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Operation retrievedResult = retrievedResponse.Result;
}
}
}
// [END compute_v1_generated_TargetVpnGateways_Insert_async]
}
|
{
"content_hash": "5e47c1c03d299cf3004fb93ebf3c9163",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 134,
"avg_line_length": 45.895833333333336,
"alnum_prop": 0.64593735814798,
"repo_name": "jskeet/google-cloud-dotnet",
"id": "ba73599e3a7fb6f4bb9c0eab5ff0755572198bb1",
"size": "2825",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "apis/Google.Cloud.Compute.V1/Google.Cloud.Compute.V1.GeneratedSnippets/TargetVpnGatewaysClient.InsertRequestObjectAsyncSnippet.g.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "268415427"
},
{
"name": "CSS",
"bytes": "1346"
},
{
"name": "Dockerfile",
"bytes": "3173"
},
{
"name": "HTML",
"bytes": "3823"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65260"
},
{
"name": "sed",
"bytes": "1030"
}
]
}
|
<?php
/**
* English number - words to integer
*/
class EnglishTextFormula extends Formula {
public static $name = 'Anglické číslovky';
protected $max;
protected $min;
public static $subject = 'Angličtina';
public static $advanced = 'do {number}';
/**
* @var EnglishTextElement
*/
protected $element;
/**
* @param integer $max Default 100
* @param integer $min Default 0
* @return void
*/
function __construct($max = null, $min = null) {
if ($max === null) $max = 100;
if (($min === null)||($min < 0)) $min = 0;
if ($max < $min) $max = $min;
$this->max = $max;
$this->min = $min;
$this->element = new EnglishTextElement($this->getNumber($max, $min, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)));
}
/**
* @return string
*/
public function getName() {
$text[] = static::$name;
if ($this->min >= 0) $text[] = 'od '. $this->min;
$text[] = 'do '. $this->max;
return implode(' ', $text);
}
/**
* @return integer
*/
public function getResult() {
return $this->element->getValue();
}
public function toStr($result = FALSE) {
$text = $this->element->toStr();
if ($result) {
$text .= ' is '. $this->element->getValue();
}
return $text;
}
public function toHTML($result = FALSE) {
$text = '<span class="formula">'. $this->element->toHTML();
$text .= ' is ';
if ($result) {
$text .= '<span class="result">'. $this->element->getValue(). '</span>';
}
$text .= '</span>';
return $text;
}
public function getResultHTMLForm() {
return '<input type="number" class="result" name="result1" autofocus /> (napiš číslo)';
}
} // class EnglishTextFormula
/**
* English numbers - integer to words
*/
class ReverseEnglishTextFormula extends EnglishTextFormula {
public static $name = 'Anglické číslovky (z čísel)';
/**
* @return string
*/
public function getResult() {
return $this->element->toStr();
}
public function toStr($result = FALSE) {
$text = $this->element->getValue();
if ($result) {
$text .= ' is '. $this->element->toStr();
}
return $text;
}
public function toHTML($result = FALSE) {
$text = '<span class="formula">'. $this->element->getValue();
$text .= ' is ';
if ($result) {
$text .= '<span class="result">'. $this->element->toHTML(). '</span>';
}
$text .= '</span>';
return $text;
}
public function getResultHTMLForm() {
return '<input type="text" class="result" name="result1" autocomplete="off" autofocus /> (napiš slovy)';
}
public function validateResult($input) {
if (is_array($input)) $input = implode(' ', $input);
$input = preg_replace('/\s+/', ' ', strtolower(trim($input)));
return ( $this->getResult() == $input );
}
} // class ReverseEnglishTextFormula
/**
* English numbers - listen and type integer
*/
class EnglishSpeechFormula extends EnglishTextFormula {
public static $name = 'Anglické číslovky (diktát - čísla)';
public function voiceEnabled() { return true; }
public function toHTML($result = FALSE) {
if ($result) {
return parent::toHTML(true);
} else {
$text = '<span class="formula">';
$text .= "<input class='speech' onclick='responsiveVoice.speak(\"". $this->element->toStr(true). "\", \"UK English Male\", {rate: 0.6, volume: 1});document.forms[0].elements[1].focus();' type='button' value='Poslech' />";
$text .= '</span>';
return $text;
}
}
} // class EnglishSpeechFormula
/**
* English numbers - listen and type words
*/
class ReverseEnglishSpeechFormula extends ReverseEnglishTextFormula {
public static $name = 'Anglické číslovky (diktát - slova)';
public function voiceEnabled() { return true; }
public function toHTML($result = FALSE) {
if ($result) {
return parent::toHTML(true);
} else {
$text = '<span class="formula">';
$text .= "<input class='speech' onclick='responsiveVoice.speak(\"". $this->element->toStr(true). "\", \"UK English Male\", {rate: 0.6, volume: 1});document.forms[0].elements[1].focus();' type='button' value='Poslech' />";
$text .= '</span>';
return $text;
}
}
} // class ReverseEnglishSpeechFormula
?>
|
{
"content_hash": "ac0cac971579ab1d3c663ad98bb7ba0f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 227,
"avg_line_length": 28.73856209150327,
"alnum_prop": 0.5990448032749602,
"repo_name": "buralien/mat",
"id": "ed88d7fcf9064badb0812382c5236c01ab221501",
"size": "4397",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mat/include/formula/en.class.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1859"
},
{
"name": "PHP",
"bytes": "114519"
}
]
}
|
package com.intel.realsense.librealsense;
public class Colorizer extends Filter {
public Colorizer() {
mHandle = nCreate(mQueue.getHandle());
}
private static native long nCreate(long queueHandle);
}
|
{
"content_hash": "0a4cea27fd86a79f7e6fd2fc96bf74ef",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 22.3,
"alnum_prop": 0.7085201793721974,
"repo_name": "IntelRealSense/librealsense",
"id": "28a52715a8d701b9bf40268b7e22fd9a2c7e59a1",
"size": "223",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Colorizer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "736"
},
{
"name": "C",
"bytes": "6226973"
},
{
"name": "C#",
"bytes": "541746"
},
{
"name": "C++",
"bytes": "9343375"
},
{
"name": "CMake",
"bytes": "181677"
},
{
"name": "CSS",
"bytes": "9575"
},
{
"name": "Cuda",
"bytes": "38173"
},
{
"name": "Dockerfile",
"bytes": "2393"
},
{
"name": "HTML",
"bytes": "3550"
},
{
"name": "Java",
"bytes": "309233"
},
{
"name": "JavaScript",
"bytes": "480021"
},
{
"name": "MATLAB",
"bytes": "106616"
},
{
"name": "PowerShell",
"bytes": "7989"
},
{
"name": "Python",
"bytes": "485240"
},
{
"name": "ShaderLab",
"bytes": "15538"
},
{
"name": "Shell",
"bytes": "108709"
}
]
}
|
import {bootstrap} from 'aurelia-bootstrapper';
import {StageComponent} from 'aurelia-testing';
import {PLATFORM} from 'aurelia-pal';
describe('Stage Attachment Item Component', () => {
let component, boundData;
beforeEach(() => {
boundData = {
attach: {
displayName: 'testFile.txt',
getFormatedTime: () => 'formatTime'
},
rmAttach: jest.fn(),
dlAttach: jest.fn()
};
component = StageComponent
.withResources(PLATFORM.moduleName('../../src/attachment/attachment-item'))
.inView('<attachment-item model.bind="attach" removed.trigger="rmAttach($event)" download.trigger="dlAttach($event)"></attachment-item>')
.boundTo(boundData);
});
afterEach(() => component.dispose());
it('should render', done => {
component.create(bootstrap).then(() => {
const view = component.element.querySelector('.attachment-item');
expect(view.textContent.trim()).toBe('testFile.txt');
done();
}).catch(e => {
fail(e);
done();
});
});
it('should send download message', done => {
component.create(bootstrap).then(() => {
const view = component.element.querySelector('.attachment-item');
view.click();
setTimeout(() => {
expect(boundData.dlAttach.call.length).toBe(1);
done();
});
}).catch(e => {
fail(e);
done();
});
});
it('should send remove message', done => {
component.create(bootstrap).then(() => {
const view = component.element.querySelector('.attachment-remove');
view.click();
setTimeout(() => {
expect(boundData.rmAttach.call.length).toBe(1);
done();
});
}).catch(e => {
fail(e);
done();
});
});
});
|
{
"content_hash": "36e190f8e9b4ff8a0d159a23939c0948",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 143,
"avg_line_length": 26.893939393939394,
"alnum_prop": 0.5735211267605633,
"repo_name": "JeffreyRiggle/sona-client",
"id": "a54b4665c428655c85125e75c1905b0374cfbf8b",
"size": "1775",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/unit/attachment-item.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16140"
},
{
"name": "Dockerfile",
"bytes": "220"
},
{
"name": "HTML",
"bytes": "14609"
},
{
"name": "JavaScript",
"bytes": "95189"
},
{
"name": "Shell",
"bytes": "518"
}
]
}
|
package org.neo4j.driver.internal.reactive;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.neo4j.driver.AccessMode;
import org.neo4j.driver.Bookmark;
import org.neo4j.driver.Query;
import org.neo4j.driver.TransactionConfig;
import org.neo4j.driver.exceptions.TransactionNestingException;
import org.neo4j.driver.internal.InternalBookmark;
import org.neo4j.driver.internal.async.NetworkSession;
import org.neo4j.driver.internal.async.UnmanagedTransaction;
import org.neo4j.driver.internal.cursor.RxResultCursor;
import org.neo4j.driver.internal.util.Futures;
import org.neo4j.driver.reactive.RxResult;
import org.neo4j.driver.reactive.RxSession;
import org.neo4j.driver.reactive.RxTransaction;
import org.neo4j.driver.reactive.RxTransactionWork;
import org.reactivestreams.Publisher;
@Deprecated
public class InternalRxSession extends AbstractReactiveSession<RxTransaction> implements RxSession {
public InternalRxSession(NetworkSession session) {
super(session);
}
@Override
protected RxTransaction createTransaction(UnmanagedTransaction unmanagedTransaction) {
return new InternalRxTransaction(unmanagedTransaction);
}
@Override
protected Publisher<Void> closeTransaction(RxTransaction transaction, boolean commit) {
return ((InternalRxTransaction) transaction).close(commit);
}
@Override
public Publisher<RxTransaction> beginTransaction(TransactionConfig config) {
return doBeginTransaction(config);
}
@Override
public <T> Publisher<T> readTransaction(RxTransactionWork<? extends Publisher<T>> work) {
return readTransaction(work, TransactionConfig.empty());
}
@Override
public <T> Publisher<T> readTransaction(RxTransactionWork<? extends Publisher<T>> work, TransactionConfig config) {
return runTransaction(AccessMode.READ, work::execute, config);
}
@Override
public <T> Publisher<T> writeTransaction(RxTransactionWork<? extends Publisher<T>> work) {
return writeTransaction(work, TransactionConfig.empty());
}
@Override
public <T> Publisher<T> writeTransaction(RxTransactionWork<? extends Publisher<T>> work, TransactionConfig config) {
return runTransaction(AccessMode.WRITE, work::execute, config);
}
@Override
public RxResult run(String query, TransactionConfig config) {
return run(new Query(query), config);
}
@Override
public RxResult run(String query, Map<String, Object> parameters, TransactionConfig config) {
return run(new Query(query, parameters), config);
}
@Override
public RxResult run(Query query) {
return run(query, TransactionConfig.empty());
}
@Override
public RxResult run(Query query, TransactionConfig config) {
return new InternalRxResult(() -> {
CompletableFuture<RxResultCursor> resultCursorFuture = new CompletableFuture<>();
session.runRx(query, config).whenComplete((cursor, completionError) -> {
if (cursor != null) {
resultCursorFuture.complete(cursor);
} else {
releaseConnectionBeforeReturning(resultCursorFuture, completionError);
}
});
return resultCursorFuture;
});
}
private <T> void releaseConnectionBeforeReturning(CompletableFuture<T> returnFuture, Throwable completionError) {
// We failed to create a result cursor so we cannot rely on result cursor to cleanup resources.
// Therefore we will first release the connection that might have been created in the session and then notify
// the error.
// The logic here shall be the same as `SessionPullResponseHandler#afterFailure`.
// The reason we need to release connection in session is that we made `rxSession.close()` optional;
// Otherwise, session.close shall handle everything for us.
Throwable error = Futures.completionExceptionCause(completionError);
if (error instanceof TransactionNestingException) {
returnFuture.completeExceptionally(error);
} else {
session.releaseConnectionAsync()
.whenComplete((ignored, closeError) ->
returnFuture.completeExceptionally(Futures.combineErrors(error, closeError)));
}
}
@Override
public Bookmark lastBookmark() {
return InternalBookmark.from(session.lastBookmarks());
}
@Override
public <T> Publisher<T> close() {
return doClose();
}
}
|
{
"content_hash": "015f221939822e92941dd13ed9e745dd",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 120,
"avg_line_length": 38.739495798319325,
"alnum_prop": 0.7078091106290673,
"repo_name": "neo4j/neo4j-java-driver",
"id": "7dd371c34a6300d952408cb47b5b708f60d1cd30",
"size": "5271",
"binary": false,
"copies": "1",
"ref": "refs/heads/5.0",
"path": "driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxSession.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1357"
},
{
"name": "Java",
"bytes": "4015392"
},
{
"name": "Python",
"bytes": "2424"
},
{
"name": "Shell",
"bytes": "218"
}
]
}
|
namespace P07.HackTests.Math
{
using System;
using NUnit.Framework;
using System.Collections;
using Moq;
[TestFixture]
class FloorTests
{
public static IEnumerable TestListsOfDecimals
{
get
{
yield return new TestCaseData(0M, 0M);
yield return new TestCaseData(-10.1M, -11M);
yield return new TestCaseData(9.9M, 9M);
yield return new TestCaseData(9.1M, 9M);
yield return new TestCaseData(9.01M, 9M);
yield return new TestCaseData(9.001M, 9M);
yield return new TestCaseData(decimal.MaxValue, decimal.MaxValue);
}
}
[TestCaseSource(nameof(TestListsOfDecimals))]
public void AbsTestsWithValues(decimal input, decimal expected)
{
// Mocking statick objects?
Assert.That(Math.Floor(input), Is.EqualTo(expected));
}
}
}
|
{
"content_hash": "d014bf1e1c6715c7ec459315b05222f3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 82,
"avg_line_length": 30.53125,
"alnum_prop": 0.5711361310133061,
"repo_name": "Steffkn/SoftUni",
"id": "ce0f600507755295ccb967a08de2445ce5217c7c",
"size": "979",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "03.CSharpDev/03.OOP_Advanced/05.UnitTesting-Exercises/05.UnitTesting/P07.HackTests/Math/FloorTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "816"
},
{
"name": "C#",
"bytes": "1964698"
},
{
"name": "CSS",
"bytes": "1292593"
},
{
"name": "HTML",
"bytes": "318247"
},
{
"name": "Handlebars",
"bytes": "33787"
},
{
"name": "Java",
"bytes": "71640"
},
{
"name": "JavaScript",
"bytes": "350010"
},
{
"name": "PHP",
"bytes": "254978"
},
{
"name": "TSQL",
"bytes": "318790"
},
{
"name": "Twig",
"bytes": "44322"
}
]
}
|
package org.pentaho.di.ui.spoon.delegates;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.pentaho.di.cluster.SlaveServer;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.util.Utils;
import org.pentaho.di.core.EngineMetaInterface;
import org.pentaho.di.core.NotePadMeta;
import org.pentaho.di.core.Result;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.extension.ExtensionPointHandler;
import org.pentaho.di.core.extension.KettleExtensionPoint;
import org.pentaho.di.core.gui.Point;
import org.pentaho.di.core.gui.SpoonInterface;
import org.pentaho.di.core.logging.LogLevel;
import org.pentaho.di.core.logging.TransLogTable;
import org.pentaho.di.core.undo.TransAction;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransExecutionConfiguration;
import org.pentaho.di.trans.TransHopMeta;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.cluster.TransSplitter;
import org.pentaho.di.trans.debug.StepDebugMeta;
import org.pentaho.di.trans.debug.TransDebugMeta;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.ui.core.PropsUI;
import org.pentaho.di.ui.core.gui.GUIResource;
import org.pentaho.di.ui.spoon.Spoon;
import org.pentaho.di.ui.spoon.TabMapEntry;
import org.pentaho.di.ui.spoon.TabMapEntry.ObjectType;
import org.pentaho.di.ui.spoon.job.JobGraph;
import org.pentaho.di.ui.spoon.trans.TransGraph;
import org.pentaho.di.ui.trans.debug.TransDebugDialog;
import org.pentaho.di.ui.trans.dialog.TransExecutionConfigurationDialog;
import org.pentaho.xul.swt.tab.TabItem;
public class SpoonTransformationDelegate extends SpoonDelegate {
private static Class<?> PKG = Spoon.class; // for i18n purposes, needed by Translator2!!
/**
* This contains a map between the name of a transformation and the TransMeta object. If the transformation has no
* name it will be mapped under a number [1], [2] etc.
*/
private List<TransMeta> transformationMap;
/**
* Remember the debugging configuration per transformation
*/
private Map<TransMeta, TransDebugMeta> transDebugMetaMap;
/**
* Remember the preview configuration per transformation
*/
private Map<TransMeta, TransDebugMeta> transPreviewMetaMap;
public SpoonTransformationDelegate( Spoon spoon ) {
super( spoon );
transformationMap = new ArrayList<TransMeta>();
transDebugMetaMap = new Hashtable<TransMeta, TransDebugMeta>();
transPreviewMetaMap = new Hashtable<TransMeta, TransDebugMeta>();
}
/**
* Add a transformation to the
*
* @param transMeta
* the transformation to add to the map
* @return true if the transformation was added, false if it couldn't be added (already loaded)
**/
public boolean addTransformation( TransMeta transMeta ) {
int index = getTransformationList().indexOf( transMeta );
if ( index < 0 ) {
getTransformationList().add( transMeta );
return true;
} else {
/*
* ShowMessageDialog dialog = new ShowMessageDialog(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION,
* BaseMessages.getString(PKG, "Spoon.Dialog.TransAlreadyLoaded.Title"), "'" + transMeta.toString() + "'" +
* Const.CR + Const.CR + BaseMessages.getString(PKG, "Spoon.Dialog.TransAlreadyLoaded.Message"));
* dialog.setTimeOut(6); dialog.open();
*/
return false;
}
}
/**
* @param transMeta
* the transformation to close, make sure it's ok to dispose of it BEFORE you call this.
*/
public synchronized void closeTransformation( TransMeta transMeta ) {
// Close the associated tabs...
//
TabMapEntry entry = getSpoon().delegates.tabs.findTabMapEntry( transMeta );
if ( entry != null ) {
getSpoon().delegates.tabs.removeTab( entry );
}
// Also remove it from the item from the transformationMap
// Otherwise it keeps showing up in the objects tree
// Look for the transformation, not the key (name might have changed)
//
int index = getTransformationList().indexOf( transMeta );
while ( index >= 0 ) {
getTransformationList().remove( index );
index = getTransformationList().indexOf( transMeta );
}
getSpoon().refreshTree();
getSpoon().enableMenus();
}
public Spoon getSpoon() {
return this.spoon;
}
public void addTransGraph( TransMeta transMeta ) {
boolean added = addTransformation( transMeta );
if ( added ) {
// See if there already is a tab for this graph with the short default name.
// If there is, set that one to show the location as well.
// If not, simply add it without
// If no, add it
// If yes, select that tab
//
boolean showLocation = false;
boolean addTab = true;
String tabName = spoon.delegates.tabs.makeTabName( transMeta, showLocation );
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry( tabName, ObjectType.TRANSFORMATION_GRAPH );
if ( tabEntry != null ) {
// We change the already loaded transformation to also show the location.
//
showLocation = true;
// Try again, including the location of the object...
//
tabName = spoon.delegates.tabs.makeTabName( transMeta, showLocation );
TabMapEntry exactSameEntry = spoon.delegates.tabs.findTabMapEntry( tabName, ObjectType.TRANSFORMATION_GRAPH );
if ( exactSameEntry != null ) {
// Already loaded, simply select the tab item in question...
//
addTab = false;
} else {
// We might need to rename the tab of the entry already loaded!
//
tabEntry.setShowingLocation( true );
String newTabName = spoon.delegates.tabs.makeTabName( tabEntry.getObject().getMeta(), showLocation );
tabEntry.getTabItem().setText( newTabName );
}
}
TransGraph transGraph = null;
if ( addTab ) {
transGraph = new TransGraph( spoon.tabfolder.getSwtTabset(), spoon, transMeta );
PropsUI props = PropsUI.getInstance();
TabItem tabItem = new TabItem( spoon.tabfolder, tabName, tabName, props.getSashWeights() );
String toolTipText =
BaseMessages.getString( PKG, "Spoon.TabTrans.Tooltip", spoon.delegates.tabs.makeTabName( transMeta,
showLocation ) );
if ( !Utils.isEmpty( transMeta.getFilename() ) ) {
toolTipText += Const.CR + Const.CR + transMeta.getFilename();
}
tabItem.setToolTipText( toolTipText );
tabItem.setImage( GUIResource.getInstance().getImageTransGraph() );
tabItem.setControl( transGraph );
TransLogTable logTable = transMeta.getTransLogTable();
String versionLabel = transMeta.getObjectRevision() == null ? null : transMeta.getObjectRevision().getName();
tabEntry =
new TabMapEntry( tabItem, transMeta.getFilename(), transMeta.getName(), transMeta.getRepositoryDirectory(),
versionLabel, transGraph, ObjectType.TRANSFORMATION_GRAPH );
tabEntry.setShowingLocation( showLocation );
spoon.delegates.tabs.addTab( tabEntry );
}
int idx = spoon.tabfolder.indexOf( tabEntry.getTabItem() );
// keep the focus on the graph
spoon.tabfolder.setSelected( idx );
if ( addTab ) {
TransLogTable logTable = transMeta.getTransLogTable();
// OK, also see if we need to open a new history window.
if ( isLogTableDefined( logTable ) && !transMeta.isSlaveTransformation() ) {
addTabsToTransGraph( transGraph );
}
}
spoon.setUndoMenu( transMeta );
spoon.enableMenus();
} else {
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry( transMeta );
if ( tabEntry != null ) {
int idx = spoon.tabfolder.indexOf( tabEntry.getTabItem() );
// keep the focus on the graph
spoon.tabfolder.setSelected( idx );
spoon.setUndoMenu( transMeta );
spoon.enableMenus();
}
}
}
boolean isLogTableDefined( TransLogTable logTable ) {
return logTable.getDatabaseMeta() != null && !Utils.isEmpty( logTable.getTableName() );
}
void addTabsToTransGraph( TransGraph transGraph ) {
transGraph.addAllTabs();
transGraph.extraViewTabFolder.setSelection( transGraph.transHistoryDelegate.getTransHistoryTab() );
}
public void tabSelected( TabItem item ) {
List<TabMapEntry> collection = spoon.delegates.tabs.getTabs();
// See which core objects to show
//
for ( TabMapEntry entry : collection ) {
if ( item.equals( entry.getTabItem() ) ) {
// TabItemInterface itemInterface = entry.getObject();
//
// Another way to implement this may be to keep track of the
// state of the core object tree in method
// addCoreObjectsToTree()
//
if ( entry.getObject() instanceof TransGraph || entry.getObject() instanceof JobGraph ) {
EngineMetaInterface meta = entry.getObject().getMeta();
if ( meta != null ) {
meta.setInternalKettleVariables();
}
if ( spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON ) {
spoon.refreshCoreObjects();
}
}
}
}
// Also refresh the tree
spoon.refreshTree();
spoon.enableMenus();
}
public List<TransMeta> getTransformationList() {
return transformationMap;
}
public TransMeta getTransformation( String name ) {
TabMapEntry entry = spoon.delegates.tabs.findTabMapEntry( name, ObjectType.TRANSFORMATION_GRAPH );
if ( entry != null ) {
return (TransMeta) entry.getObject().getManagedObject();
}
// Try again, TODO: remove part below
//
for ( TransMeta xform : transformationMap ) {
if ( name != null && name.equals( xform.getName() ) ) {
return xform;
}
}
return null;
}
public void removeTransformation( TransMeta transMeta ) {
transformationMap.remove( transMeta );
}
public TransMeta[] getLoadedTransformations() {
return transformationMap.toArray( new TransMeta[transformationMap.size()] );
}
public TransGraph findTransGraphOfTransformation( TransMeta transMeta ) {
// Now loop over the entries in the tab-map
for ( TabMapEntry mapEntry : spoon.delegates.tabs.getTabs() ) {
if ( mapEntry.getObject() instanceof TransGraph ) {
TransGraph transGraph = (TransGraph) mapEntry.getObject();
if ( transGraph.getMeta().equals( transMeta ) ) {
return transGraph;
}
}
}
return null;
}
public boolean isDefaultTransformationName( String name ) {
if ( !name.startsWith( Spoon.STRING_TRANSFORMATION ) ) {
return false;
}
// see if there are only digits behind the transformation...
// This will detect:
// "Transformation"
// "Transformation "
// "Transformation 1"
// "Transformation 2"
// ...
for ( int i = Spoon.STRING_TRANSFORMATION.length() + 1; i < name.length(); i++ ) {
if ( !Character.isDigit( name.charAt( i ) ) ) {
return false;
}
}
return true;
}
public void undoTransformationAction( TransMeta transMeta, TransAction transAction ) {
switch ( transAction.getType() ) {
// We created a new step : undo this...
case TransAction.TYPE_ACTION_NEW_STEP:
// Delete the step at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeStep( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We created a new connection : undo this...
case TransAction.TYPE_ACTION_NEW_CONNECTION:
// Delete the connection at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeDatabase( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We created a new note : undo this...
case TransAction.TYPE_ACTION_NEW_NOTE:
// Delete the note at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeNote( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We created a new hop : undo this...
case TransAction.TYPE_ACTION_NEW_HOP:
// Delete the hop at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeTransHop( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We created a new slave : undo this...
case TransAction.TYPE_ACTION_NEW_SLAVE:
// Delete the slave at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.getSlaveServers().remove( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We created a new slave : undo this...
case TransAction.TYPE_ACTION_NEW_CLUSTER:
// Delete the slave at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.getClusterSchemas().remove( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
//
// DELETE
//
// We delete a step : undo this...
case TransAction.TYPE_ACTION_DELETE_STEP:
// un-Delete the step at correct location: re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
StepMeta stepMeta = (StepMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addStep( idx, stepMeta );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We deleted a connection : undo this...
case TransAction.TYPE_ACTION_DELETE_CONNECTION:
// re-insert the connection at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
DatabaseMeta ci = (DatabaseMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addDatabase( idx, ci );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We delete new note : undo this...
case TransAction.TYPE_ACTION_DELETE_NOTE:
// re-insert the note at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
NotePadMeta ni = (NotePadMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addNote( idx, ni );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We deleted a hop : undo this...
case TransAction.TYPE_ACTION_DELETE_HOP:
// re-insert the hop at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
TransHopMeta hi = (TransHopMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
// Build a new hop:
StepMeta from = transMeta.findStep( hi.getFromStep().getName() );
StepMeta to = transMeta.findStep( hi.getToStep().getName() );
TransHopMeta hinew = new TransHopMeta( from, to );
transMeta.addTransHop( idx, hinew );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
//
// CHANGE
//
// We changed a step : undo this...
case TransAction.TYPE_ACTION_CHANGE_STEP:
// Delete the current step, insert previous version.
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
StepMeta prev = (StepMeta) ( (StepMeta) transAction.getPrevious()[i] ).clone();
int idx = transAction.getCurrentIndex()[i];
transMeta.getStep( idx ).replaceMeta( prev );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a connection : undo this...
case TransAction.TYPE_ACTION_CHANGE_CONNECTION:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
DatabaseMeta prev = (DatabaseMeta) transAction.getPrevious()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.getDatabase( idx ).replaceMeta( (DatabaseMeta) prev.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a note : undo this...
case TransAction.TYPE_ACTION_CHANGE_NOTE:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeNote( idx );
NotePadMeta prev = (NotePadMeta) transAction.getPrevious()[i];
transMeta.addNote( idx, (NotePadMeta) prev.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a hop : undo this...
case TransAction.TYPE_ACTION_CHANGE_HOP:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
TransHopMeta prev = (TransHopMeta) transAction.getPrevious()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.removeTransHop( idx );
transMeta.addTransHop( idx, (TransHopMeta) prev.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
//
// POSITION
//
// The position of a step has changed: undo this...
case TransAction.TYPE_ACTION_POSITION_STEP:
// Find the location of the step:
for ( int i = 0; i < transAction.getCurrentIndex().length; i++ ) {
StepMeta stepMeta = transMeta.getStep( transAction.getCurrentIndex()[i] );
stepMeta.setLocation( transAction.getPreviousLocation()[i] );
}
spoon.refreshGraph();
break;
// The position of a note has changed: undo this...
case TransAction.TYPE_ACTION_POSITION_NOTE:
for ( int i = 0; i < transAction.getCurrentIndex().length; i++ ) {
int idx = transAction.getCurrentIndex()[i];
NotePadMeta npi = transMeta.getNote( idx );
Point prev = transAction.getPreviousLocation()[i];
npi.setLocation( prev );
}
spoon.refreshGraph();
break;
default:
break;
}
// OK, now check if we need to do this again...
if ( transMeta.viewNextUndo() != null ) {
if ( transMeta.viewNextUndo().getNextAlso() ) {
spoon.undoAction( transMeta );
}
}
}
public void redoTransformationAction( TransMeta transMeta, TransAction transAction ) {
switch ( transAction.getType() ) {
case TransAction.TYPE_ACTION_NEW_STEP:
// re-delete the step at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
StepMeta stepMeta = (StepMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addStep( idx, stepMeta );
spoon.refreshTree();
spoon.refreshGraph();
}
break;
case TransAction.TYPE_ACTION_NEW_CONNECTION:
// re-insert the connection at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
DatabaseMeta ci = (DatabaseMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addDatabase( idx, ci );
spoon.refreshTree();
spoon.refreshGraph();
}
break;
case TransAction.TYPE_ACTION_NEW_NOTE:
// re-insert the note at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
NotePadMeta ni = (NotePadMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addNote( idx, ni );
spoon.refreshTree();
spoon.refreshGraph();
}
break;
case TransAction.TYPE_ACTION_NEW_HOP:
// re-insert the hop at correct location:
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
TransHopMeta hi = (TransHopMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.addTransHop( idx, hi );
spoon.refreshTree();
spoon.refreshGraph();
}
break;
//
// DELETE
//
case TransAction.TYPE_ACTION_DELETE_STEP:
// re-remove the step at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeStep( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
case TransAction.TYPE_ACTION_DELETE_CONNECTION:
// re-remove the connection at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeDatabase( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
case TransAction.TYPE_ACTION_DELETE_NOTE:
// re-remove the note at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeNote( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
case TransAction.TYPE_ACTION_DELETE_HOP:
// re-remove the hop at correct location:
for ( int i = transAction.getCurrent().length - 1; i >= 0; i-- ) {
int idx = transAction.getCurrentIndex()[i];
transMeta.removeTransHop( idx );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
//
// CHANGE
//
// We changed a step : undo this...
case TransAction.TYPE_ACTION_CHANGE_STEP:
// Delete the current step, insert previous version.
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
StepMeta stepMeta = (StepMeta) ( (StepMeta) transAction.getCurrent()[i] ).clone();
transMeta.getStep( transAction.getCurrentIndex()[i] ).replaceMeta( stepMeta );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a connection : undo this...
case TransAction.TYPE_ACTION_CHANGE_CONNECTION:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
DatabaseMeta databaseMeta = (DatabaseMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.getDatabase( idx ).replaceMeta( (DatabaseMeta) databaseMeta.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a note : undo this...
case TransAction.TYPE_ACTION_CHANGE_NOTE:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
NotePadMeta ni = (NotePadMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.removeNote( idx );
transMeta.addNote( idx, (NotePadMeta) ni.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
// We changed a hop : undo this...
case TransAction.TYPE_ACTION_CHANGE_HOP:
// Delete & re-insert
for ( int i = 0; i < transAction.getCurrent().length; i++ ) {
TransHopMeta hi = (TransHopMeta) transAction.getCurrent()[i];
int idx = transAction.getCurrentIndex()[i];
transMeta.removeTransHop( idx );
transMeta.addTransHop( idx, (TransHopMeta) hi.clone() );
}
spoon.refreshTree();
spoon.refreshGraph();
break;
//
// CHANGE POSITION
//
case TransAction.TYPE_ACTION_POSITION_STEP:
for ( int i = 0; i < transAction.getCurrentIndex().length; i++ ) {
// Find & change the location of the step:
StepMeta stepMeta = transMeta.getStep( transAction.getCurrentIndex()[i] );
stepMeta.setLocation( transAction.getCurrentLocation()[i] );
}
spoon.refreshGraph();
break;
case TransAction.TYPE_ACTION_POSITION_NOTE:
for ( int i = 0; i < transAction.getCurrentIndex().length; i++ ) {
int idx = transAction.getCurrentIndex()[i];
NotePadMeta npi = transMeta.getNote( idx );
Point curr = transAction.getCurrentLocation()[i];
npi.setLocation( curr );
}
spoon.refreshGraph();
break;
default:
break;
}
// OK, now check if we need to do this again...
if ( transMeta.viewNextUndo() != null ) {
if ( transMeta.viewNextUndo().getNextAlso() ) {
spoon.redoAction( transMeta );
}
}
}
public void executeTransformation( final TransMeta transMeta, final boolean local, final boolean remote,
final boolean cluster, final boolean preview, final boolean debug, final Date replayDate, final boolean safe,
LogLevel logLevel ) throws KettleException {
if ( transMeta == null ) {
return;
}
// See if we need to ask for debugging information...
//
TransDebugMeta transDebugMeta = null;
TransExecutionConfiguration executionConfiguration = null;
if ( preview ) {
executionConfiguration = spoon.getTransPreviewExecutionConfiguration();
} else if ( debug ) {
executionConfiguration = spoon.getTransDebugExecutionConfiguration();
} else {
executionConfiguration = spoon.getTransExecutionConfiguration();
}
// Set defaults so the run configuration can set it up correctly
executionConfiguration.setExecutingLocally( true );
executionConfiguration.setExecutingRemotely( false );
executionConfiguration.setExecutingClustered( false );
// Set repository and safe mode information in both the exec config and the metadata
transMeta.setRepository( spoon.rep );
transMeta.setMetaStore( spoon.metaStore );
executionConfiguration.setRepository( spoon.rep );
executionConfiguration.setSafeModeEnabled( safe );
if ( debug ) {
// See if we have debugging information stored somewhere?
//
transDebugMeta = transDebugMetaMap.get( transMeta );
if ( transDebugMeta == null ) {
transDebugMeta = new TransDebugMeta( transMeta );
transDebugMetaMap.put( transMeta, transDebugMeta );
}
// Set the default number of rows to retrieve on all selected steps...
//
List<StepMeta> selectedSteps = transMeta.getSelectedSteps();
if ( selectedSteps != null && selectedSteps.size() > 0 ) {
transDebugMeta.getStepDebugMetaMap().clear();
for ( StepMeta stepMeta : transMeta.getSelectedSteps() ) {
StepDebugMeta stepDebugMeta = new StepDebugMeta( stepMeta );
stepDebugMeta.setRowCount( PropsUI.getInstance().getDefaultPreviewSize() );
stepDebugMeta.setPausingOnBreakPoint( true );
stepDebugMeta.setReadingFirstRows( false );
transDebugMeta.getStepDebugMetaMap().put( stepMeta, stepDebugMeta );
}
}
} else if ( preview ) {
// See if we have preview information stored somewhere?
//
transDebugMeta = transPreviewMetaMap.get( transMeta );
if ( transDebugMeta == null ) {
transDebugMeta = new TransDebugMeta( transMeta );
transPreviewMetaMap.put( transMeta, transDebugMeta );
}
// Set the default number of preview rows on all selected steps...
//
List<StepMeta> selectedSteps = transMeta.getSelectedSteps();
if ( selectedSteps != null && selectedSteps.size() > 0 ) {
transDebugMeta.getStepDebugMetaMap().clear();
for ( StepMeta stepMeta : transMeta.getSelectedSteps() ) {
StepDebugMeta stepDebugMeta = new StepDebugMeta( stepMeta );
stepDebugMeta.setRowCount( PropsUI.getInstance().getDefaultPreviewSize() );
stepDebugMeta.setPausingOnBreakPoint( false );
stepDebugMeta.setReadingFirstRows( true );
transDebugMeta.getStepDebugMetaMap().put( stepMeta, stepDebugMeta );
}
}
}
int debugAnswer = TransDebugDialog.DEBUG_CONFIG;
if ( debug || preview ) {
transDebugMeta.getTransMeta().setRepository( spoon.rep ); // pass repository for mappings
TransDebugDialog transDebugDialog = new TransDebugDialog( spoon.getShell(), transDebugMeta );
debugAnswer = transDebugDialog.open();
if ( debugAnswer != TransDebugDialog.DEBUG_CANCEL ) {
executionConfiguration.setExecutingLocally( true );
executionConfiguration.setExecutingRemotely( false );
executionConfiguration.setExecutingClustered( false );
} else {
// If we cancel the debug dialog, we don't go further with the execution either.
//
return;
}
}
Object[] data = spoon.variables.getData();
String[] fields = spoon.variables.getRowMeta().getFieldNames();
Map<String, String> variableMap = new HashMap<String, String>();
variableMap.putAll( executionConfiguration.getVariables() ); // the default
for ( int idx = 0; idx < fields.length; idx++ ) {
String value = executionConfiguration.getVariables().get( fields[idx] );
if ( Utils.isEmpty( value ) ) {
value = data[idx].toString();
}
variableMap.put( fields[idx], value );
}
executionConfiguration.setVariables( variableMap );
executionConfiguration.getUsedVariables( transMeta );
executionConfiguration.getUsedArguments( transMeta, spoon.getArguments() );
executionConfiguration.setReplayDate( replayDate );
executionConfiguration.setLogLevel( logLevel );
boolean execConfigAnswer = true;
if ( debugAnswer == TransDebugDialog.DEBUG_CONFIG && replayDate == null && transMeta.isShowDialog() ) {
TransExecutionConfigurationDialog dialog =
new TransExecutionConfigurationDialog( spoon.getShell(), executionConfiguration, transMeta );
execConfigAnswer = dialog.open();
}
if ( execConfigAnswer ) {
ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransMetaExecutionStart.id, transMeta );
ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransExecutionConfiguration.id,
executionConfiguration );
try {
ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransBeforeStart.id, new Object[] {
executionConfiguration, transMeta, transMeta
} );
} catch ( KettleException e ) {
log.logError( e.getMessage(), transMeta.getFilename() );
return;
}
// Verify if there is at least one step specified to debug or preview...
//
if ( debug || preview ) {
if ( transDebugMeta.getNrOfUsedSteps() == 0 ) {
MessageBox box = new MessageBox( spoon.getShell(), SWT.ICON_WARNING | SWT.YES | SWT.NO );
box.setText( BaseMessages.getString( PKG, "Spoon.Dialog.Warning.NoPreviewOrDebugSteps.Title" ) );
box.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.Warning.NoPreviewOrDebugSteps.Message" ) );
int answer = box.open();
if ( answer != SWT.YES ) {
return;
}
}
}
// addTransLog(transMeta, executionConfiguration.isExecutingLocally());
// TransLog transLog = spoon.getActiveTransLog();
//
TransGraph activeTransGraph = spoon.getActiveTransGraph();
// Is this a local execution?
//
if ( executionConfiguration.isExecutingLocally() ) {
if ( debug || preview ) {
activeTransGraph.debug( executionConfiguration, transDebugMeta );
} else {
activeTransGraph.start( executionConfiguration );
}
// Are we executing remotely?
//
} else if ( executionConfiguration.isExecutingRemotely() ) {
activeTransGraph.handleTransMetaChanges( transMeta );
if ( transMeta.hasChanged() ) {
showSaveTransformationBeforeRunningDialog( spoon.getShell() );
} else if ( executionConfiguration.getRemoteServer() != null ) {
String carteObjectId =
Trans.sendToSlaveServer( transMeta, executionConfiguration, spoon.rep, spoon.metaStore );
monitorRemoteTrans( transMeta, carteObjectId, executionConfiguration.getRemoteServer() );
spoon.delegates.slaves.addSpoonSlave( executionConfiguration.getRemoteServer() );
} else {
MessageBox mb = new MessageBox( spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION );
mb.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.NoRemoteServerSpecified.Message" ) );
mb.setText( BaseMessages.getString( PKG, "Spoon.Dialog.NoRemoteServerSpecified.Title" ) );
mb.open();
}
// Are we executing clustered?
//
} else if ( executionConfiguration.isExecutingClustered() ) {
activeTransGraph.handleTransMetaChanges( transMeta );
if ( transMeta.hasChanged() ) {
showSaveTransformationBeforeRunningDialog( spoon.getShell() );
} else {
splitTrans( transMeta, executionConfiguration );
}
}
}
}
private static void showSaveTransformationBeforeRunningDialog( Shell shell ) {
MessageBox m = new MessageBox( shell, SWT.OK | SWT.ICON_WARNING );
m.setText( BaseMessages.getString( PKG, "TransLog.Dialog.SaveTransformationBeforeRunning.Title" ) );
m.setMessage( BaseMessages.getString( PKG, "TransLog.Dialog.SaveTransformationBeforeRunning.Message" ) );
m.open();
}
private void monitorRemoteTrans( final TransMeta transMeta, final String carteObjectId,
final SlaveServer remoteSlaveServer ) {
// There is a transformation running in the background. When it finishes, clean it up and log the result on the
// console.
// Launch in a separate thread to prevent GUI blocking...
//
Thread thread = new Thread( new Runnable() {
public void run() {
Trans.monitorRemoteTransformation( spoon.getLog(), carteObjectId, transMeta.toString(), remoteSlaveServer );
}
} );
thread.setName( "Monitor remote transformation '" + transMeta.getName() + "', carte object id=" + carteObjectId
+ ", slave server: " + remoteSlaveServer.getName() );
thread.start();
}
protected void splitTrans( final TransMeta transMeta, final TransExecutionConfiguration executionConfiguration )
throws KettleException {
try {
final TransSplitter transSplitter = new TransSplitter( transMeta );
transSplitter.splitOriginalTransformation();
TransMeta master = transSplitter.getMaster();
SlaveServer masterServer = null;
List<StepMeta> masterSteps = master.getTransHopSteps( false );
// add transgraph of transmetas if showing is true
SlaveServer[] slaves = transSplitter.getSlaveTargets();
if ( executionConfiguration.isClusterShowingTransformation() ) {
if ( masterSteps.size() > 0 ) {
// If there is something that needs to be done on the master...
masterServer = transSplitter.getMasterServer();
addTransGraph( master );
}
// Then the slaves...
//
for ( int i = 0; i < slaves.length; i++ ) {
TransMeta slaveTrans = transSplitter.getSlaveTransMap().get( slaves[i] );
addTransGraph( slaveTrans );
}
}
// Inject certain internal variables to make it more intuitive.
//
for ( String var : Const.INTERNAL_TRANS_VARIABLES ) {
executionConfiguration.getVariables().put( var, transMeta.getVariable( var ) );
}
for ( String var : Const.INTERNAL_JOB_VARIABLES ) {
executionConfiguration.getVariables().put( var, transMeta.getVariable( var ) );
}
// Parameters override the variables.
// For the time being we're passing the parameters over the wire as variables...
//
TransMeta ot = transSplitter.getOriginalTransformation();
for ( String param : ot.listParameters() ) {
String value =
Const.NVL( ot.getParameterValue( param ), Const.NVL( ot.getParameterDefault( param ), ot.getVariable(
param ) ) );
if ( !Utils.isEmpty( value ) ) {
executionConfiguration.getVariables().put( param, value );
}
}
try {
Trans.executeClustered( transSplitter, executionConfiguration );
} catch ( Exception e ) {
// Something happened posting the transformation to the cluster.
// We need to make sure to de-allocate ports and so on for the next try...
// We don't want to suppress original exception here.
try {
Trans.cleanupCluster( log, transSplitter );
} catch ( Exception ee ) {
throw new Exception( "Error executing transformation and error to clenaup cluster", e );
}
// we still have execution error but cleanup ok here...
throw e;
}
if ( executionConfiguration.isClusterPosting() ) {
// Now add monitors for the master and all the slave servers
//
if ( masterServer != null ) {
spoon.addSpoonSlave( masterServer );
for ( int i = 0; i < slaves.length; i++ ) {
spoon.addSpoonSlave( slaves[i] );
}
}
}
// OK, we should also start monitoring of the cluster in the background.
// Stop them all if one goes bad.
// Also clean up afterwards, close sockets, etc.
//
// Launch in a separate thread to prevent GUI blocking...
//
new Thread( new Runnable() {
public void run() {
Trans.monitorClusteredTransformation( log, transSplitter, null );
Result result = Trans.getClusteredTransformationResult( log, transSplitter, null );
log.logBasic( "-----------------------------------------------------" );
log.logBasic( "Got result back from clustered transformation:" );
log.logBasic( transMeta.toString() + "-----------------------------------------------------" );
log.logBasic( transMeta.toString() + " Errors : " + result.getNrErrors() );
log.logBasic( transMeta.toString() + " Input : " + result.getNrLinesInput() );
log.logBasic( transMeta.toString() + " Output : " + result.getNrLinesOutput() );
log.logBasic( transMeta.toString() + " Updated : " + result.getNrLinesUpdated() );
log.logBasic( transMeta.toString() + " Read : " + result.getNrLinesRead() );
log.logBasic( transMeta.toString() + " Written : " + result.getNrLinesWritten() );
log.logBasic( transMeta.toString() + " Rejected : " + result.getNrLinesRejected() );
log.logBasic( transMeta.toString() + "-----------------------------------------------------" );
}
} ).start();
} catch ( Exception e ) {
throw new KettleException( e );
}
}
}
|
{
"content_hash": "235cd929b689cd23d7971e1ec6057c85",
"timestamp": "",
"source": "github",
"line_count": 1046,
"max_line_length": 119,
"avg_line_length": 38.27820267686425,
"alnum_prop": 0.6309348385324309,
"repo_name": "ViswesvarSekar/pentaho-kettle",
"id": "32e97f14dd1b01534391ad40fe84131c26a05822",
"size": "40943",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ui/src/org/pentaho/di/ui/spoon/delegates/SpoonTransformationDelegate.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "29188"
},
{
"name": "CSS",
"bytes": "53600"
},
{
"name": "GAP",
"bytes": "4005"
},
{
"name": "HTML",
"bytes": "77252"
},
{
"name": "Java",
"bytes": "40161730"
},
{
"name": "JavaScript",
"bytes": "103754"
},
{
"name": "Shell",
"bytes": "32285"
},
{
"name": "XSLT",
"bytes": "5600"
}
]
}
|
package com.wandrell.pattern.repository.pagination;
import java.util.Collection;
import com.wandrell.pattern.repository.FilteredRepository;
/**
* Extension of {@link com.wandrell.pattern.repository.FilteredRepository
* FilteredRepository} allowing paginating it's contents to get a subset of
* them.
* <p>
* The pagination is added to all the methods which return any set of entities,
* meaning that it is possible paginate a subset created with the methods from
* {@code FilteredRepository}.
*
* @author Bernardo Martínez Garrido
*
* @param <V>
* the type stored on the repository
* @param <F>
* the type being used to filter the entities
*/
public interface PaginatedRepository<V, F> extends FilteredRepository<V, F> {
/**
* Returns all the entities contained in the repository paginated.
*
* @param pagination
* pagination data
* @return all the entities contained in the repository paginated
*/
public Collection<V> getAll(final PaginationData pagination);
/**
* Queries the entities in the repository and returns a paginated subset of
* them.
* <p>
* The collection is created filtering the stored data with the specified
* filter.
* <p>
* How this filter exactly work will depend on the implementation, it may be
* an structure containing information to build an SQL query, or may just be
* a predicate which the entities should validate.
*
* @param filter
* the filter which discriminates the entities to be returned
* @param pagination
* pagination data
* @return the filtered and paginated subset of entities
*/
public Collection<V> getCollection(final F filter,
final PaginationData pagination);
}
|
{
"content_hash": "083142dfa9d460ec9ac91be733210c3e",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 32.625,
"alnum_prop": 0.6836343732895457,
"repo_name": "Bernardo-MG/persistence-utils-java",
"id": "7f5d558c9298dae017df64844421390a01095018",
"size": "3013",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/com/wandrell/pattern/repository/pagination/PaginatedRepository.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1186"
},
{
"name": "Java",
"bytes": "271868"
},
{
"name": "Shell",
"bytes": "5610"
}
]
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>weak-up-to: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.15.1 / weak-up-to - 8.7.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
weak-up-to
<small>
8.7.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-05-27 23:47:52 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-05-27 23:47:52 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.1 Formal proof management system
dune 3.2.0 Fast, portable, and opinionated build system
ocaml 4.10.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.2 Official release 4.10.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/weak-up-to"
license: "GPL"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/WeakUpTo"]
depends: [
"ocaml"
"coq" {>= "8.7" & < "8.8~"}
]
tags: [
"keyword: weak bisimilarity"
"keyword: weak bisimulation"
"keyword: up-to techniques"
"keyword: termination"
"keyword: commutation"
"keyword: Newman's lemma"
"category: Computer Science/Concurrent Systems and Protocols/Theory of concurrent systems"
"date: 2005-02-22"
]
authors: [ "Damien Pous <damien.pous at ens-lyon.fr> [http://perso.ens-lyon.fr/damien.pous/]" ]
bug-reports: "https://github.com/coq-contribs/weak-up-to/issues"
dev-repo: "git+https://github.com/coq-contribs/weak-up-to.git"
synopsis: "New Up-to Techniques for Weak Bisimulation"
description: """
http://perso.ens-lyon.fr/damien.pous/upto/
This contribution is the formalisation of a paper that appeared in
Proc. of ICALP 2005: "Up-to Techniques for Weak Bisimulation".
First we define a framework for defining up-to techniques for weak
bisimulation in a modular way. Then we prove the correctness of some
new up-to techniques, based on termination guarantees. Notably, a
generalisation of Newman's Lemma to commutation results is
established."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/weak-up-to/archive/v8.7.0.tar.gz"
checksum: "md5=fb27516b4ab94d45bf34a1e3e8a20504"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-weak-up-to.8.7.0 coq.8.15.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.15.1).
The following dependencies couldn't be met:
- coq-weak-up-to -> coq < 8.8~ -> ocaml < 4.10
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-weak-up-to.8.7.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
{
"content_hash": "67b77287c351f35cd9ee76fabe62fe64",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 159,
"avg_line_length": 42.039106145251395,
"alnum_prop": 0.5581395348837209,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "5c01417649c08586290bace5f2ff837a9e0c0281",
"size": "7550",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.10.2-2.0.6/released/8.15.1/weak-up-to/8.7.0.html",
"mode": "33188",
"license": "mit",
"language": []
}
|
// LICENSE : MIT
"use strict";
var normalizeDir = require("./normalize-dir");
var defaultTestDir = "test/";
/**
* Return `dir/` string
* always suffix with `/`
* @param {object} pkg
* @returns {string}
*/
function getTestDirFromPkg(pkg) {
if (pkg &&
typeof pkg.directories === 'object' &&
typeof pkg.directories.test === 'string') {
return normalizeDir(pkg.directories.test);
}
return defaultTestDir;
}
module.exports = getTestDirFromPkg;
|
{
"content_hash": "b7236d9d40d66209e38f3cb6c5478050",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 51,
"avg_line_length": 24,
"alnum_prop": 0.6395833333333333,
"repo_name": "power-assert-js/intelli-espower-loader",
"id": "7f2b2cd3c8fae04fa4fe370d17a4c6212aebee37",
"size": "480",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/get-test-dir.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "4507"
}
]
}
|
package pub.pjoc.pay.channels.wechat.service;
import com.xiongyingqi.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import pub.pjoc.pay.channels.wechat.util.WeixinPayUtils;
import pub.pjoc.pay.channels.wechat.vo.OrderCallBackRequest;
import pub.pjoc.pay.channels.wechat.vo.OrderRequest;
import pub.pjoc.pay.channels.wechat.vo.OrderResponse;
import pub.pjoc.pay.channels.wechat.vo.ReturnResult;
import java.io.IOException;
import java.io.InputStream;
/**
* we chat channel service
*
* @author blademainer
* @version 2016-08-02 14:20
*/
@Service
public class WeixinOrderService {
private static final Logger logger = LoggerFactory
.getLogger(WeixinOrderService.class);
@Autowired
private WeixinPayConfigInfo weixinPayConfigInfo;
/**
* request a new order.
*
* @param orderRequest {@link OrderRequest}
* @return {@link OrderResponse}
*/
public final OrderResponse requestOrder(OrderRequest orderRequest) {
Assert.hasText(orderRequest.getBody(), "商品描述不能为空");
Assert.isTrue(orderRequest.getTotalFee() != null && orderRequest
.getTotalFee() > 0, "金额必须大于0");
Assert.hasText(orderRequest.getTradeType(), "支付类型必须是: "
+ "JSAPI,NATIVE,APP");
if (WeixinPayUtils.isNeedOpenId(orderRequest)) {
Assert.hasText(orderRequest.getOpenId(), "openId不能为空");
}
orderRequest.setAppId(weixinPayConfigInfo.getAppId());
orderRequest.setMchId(weixinPayConfigInfo.getPayMchId());
String nonceStr = StringUtil.randomString(32);
orderRequest.setNonceStr(nonceStr);
String orderId = WeixinPayUtils.generateOrderId();
orderRequest.setOutTradeNo(orderId);
orderRequest.setNotifyUrl(weixinPayConfigInfo.getPayCallBackUrl());
String payKey = weixinPayConfigInfo.getPayKey();
//sign
String sign = WeixinPayUtils.sign(orderRequest, payKey, "sign");
orderRequest.setSign(sign);
String orderRequestUrl = weixinPayConfigInfo.getOrderRequestUrl();
try {
InputStream inputStream = WeixinPayUtils.xmlHttpPostRequest(orderRequestUrl, orderRequest);
OrderResponse orderResponse = WeixinPayUtils
.parseOrderResponse(inputStream, payKey);
if (logger.isDebugEnabled()) {
logger.debug("Requesting a order by request: {} and get "
+ "response: {}", orderRequest, orderResponse);
}
return orderResponse;
} catch (IOException e) {
logger.error("Caught exception when requesting a order! message: "
+ e.getMessage(), e);
}
return null;
}
/**
* do call back the response.
*
* @param callBackRequest {@link OrderCallBackRequest}
* @return {@link ReturnResult}
*/
public final ReturnResult doCallBack(OrderCallBackRequest callBackRequest) {
Assert.notNull(callBackRequest, "回调通知为空");
String payKey = weixinPayConfigInfo.getPayKey();
String sign = WeixinPayUtils.sign(callBackRequest, payKey, "sign");
if (sign == null || !sign.equals(callBackRequest.getSign())) {
ReturnResult returnResult = new ReturnResult();
returnResult.setReturnCode(ReturnResult.FAIL);
returnResult.setReturnMsg("sign error");
logger.error(
"Doing call back... check sign error! "
+ "remote sign: {}, local sign: {}",
callBackRequest.getSign(), sign);
return returnResult;
}
ReturnResult returnResult = new ReturnResult();
returnResult.setReturnCode(ReturnResult.SUCCESS);
return returnResult;
}
}
|
{
"content_hash": "6711c45f48147b4ba57eff59c933b9f7",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 97,
"avg_line_length": 33.13636363636363,
"alnum_prop": 0.7171467764060356,
"repo_name": "pjoc-team/pjoc-pay",
"id": "fbdf66172e5620f1ec3805b21e1100fed9e21e37",
"size": "4868",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "pjoc-pay-sdk/pjoc-pay-weixin-sdk/src/main/java/pub/pjoc/pay/channels/wechat/service/WeixinOrderService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "387414"
},
{
"name": "Shell",
"bytes": "1791"
}
]
}
|
<!DOCTYPE html>
<!--
Copyright (c) 2013 Intel Corporation.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of works must retain the original copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the original 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 Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this work without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "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 INTEL CORPORATION 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.
Authors:
Lin, ShenX A <linx.a.shen@intel.com>
-->
<html>
<head>
<meta charset='utf-8'>
<title>Crosswalk_SampleApp_Gallery_Close</title>
<link rel="author" title="Intel" href="http://www.intel.com">
</head>
<body>
<p>
<strong>Test steps:</strong>
</p>
<ol>
<li>Longpress home button to open task manager.</li>
<li>Slide to the right or left the application.</li>
</ol>
<p>
<strong>Expected Output:</strong>
</p>
<ol>
<li>Task manager is able to open.</li>
<li>Gallery should be closed.</li>
</ol>
</body>
</html>
|
{
"content_hash": "616107c96065ed3a3a7e7a5f3215fae5",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 80,
"avg_line_length": 38.074074074074076,
"alnum_prop": 0.7358949416342413,
"repo_name": "yugang/crosswalk-test-suite",
"id": "5bd52baaa290b8b0ad29d351cc996f43ff11a629",
"size": "2056",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "misc/wrt-androidarmmanual-UA-tests/androidarm/Crosswalk_SampleApp_Gallery_Close.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "3495"
},
{
"name": "CSS",
"bytes": "1694855"
},
{
"name": "Erlang",
"bytes": "2850"
},
{
"name": "Java",
"bytes": "155590"
},
{
"name": "JavaScript",
"bytes": "32256550"
},
{
"name": "PHP",
"bytes": "43783"
},
{
"name": "Perl",
"bytes": "1696"
},
{
"name": "Python",
"bytes": "4215706"
},
{
"name": "Shell",
"bytes": "638387"
},
{
"name": "XSLT",
"bytes": "2143471"
}
]
}
|
#pragma once
#include "PolyGlobals.h"
#include "PolyString.h"
#include "PolyMatrix4.h"
#include "PolyQuaternion.h"
#include "PolyColor.h"
#include <vector>
namespace Polycode {
class Renderer;
class _PolyExport EntityProp {
public:
String propName;
String propValue;
};
/**
* Base class for both 2D and 3D objects in Polycode. It provides position and color transformations as well as hierarchy for all Polycode objects.
*/
class _PolyExport Entity {
public:
Entity();
virtual ~Entity();
/**
* Main render method. Override this to do your own drawing.
*/
virtual void Render(){};
/**
* Main update method. Override this to do your updates before the render cycle.
*/
virtual void Update(){};
virtual void transformAndRender();
void renderChildren();
// ----------------------------------------------------------------------------------------------------------------
/** @name Matrix operations.
* These methods operate directly on the entity's matrix.
*/
//@{
/**
* Sets the state of the dirty matrix flag. The dirty matrix flag gets set automatically when a transformation is applied to the entity and the transfrom matrix needs to be rebuilt. This method is provided to manually override that flag.
@param val New value of the dirty matrix flag.
*/
void dirtyMatrix(bool val);
/**
* Forces the transformation matrix to be rebuilt.
*/
void rebuildTransformMatrix();
/**
* Forces the matrix to be rebuilt if the matrix flag is dirty. This is also called on all of the entity's children.
*/
void updateEntityMatrix();
/**
* Returns the entity's transform matrix.
@return Transform matrix.
*/
const Matrix4& getTransformMatrix() const;
/**
* Returns the entity's matrix multiplied by its parent's concatenated matrix. This, in effect, returns the entity's actual world transformation.
@return Entity's concatenated matrix.
*/
Matrix4 getConcatenatedMatrix() const;
/**
* Returns Same as getConcatenatedMatrix(), but contains only roll information for rotation. Used internally for billboards.
@return Entity's concatenated roll matrix.
@see getConcatenatedMatrix()
*/
Matrix4 getConcatenatedRollMatrix() const;
/**
* Sets all of the individual transform properties from the matrix and rebuilds the transform matrix.
@param matrix 4x4 transform matrix to apply.
*/
void setTransformByMatrix(const Matrix4& matrix);
/**
* Sets the transform matrix directly, without setting all of the individual transfrom properties of the entity.
@param matrix 4x4 transform matrix to apply.
*/
void setTransformByMatrixPure(const Matrix4& matrix);
/** Returns the matrix for the entity looking at a location based on a location and an up vector.
* @param loc Location to look at.
* @param upVector Up vector.
* @return The resulting lookAt matrix.
*/
Matrix4 getLookAtMatrix(const Vector3 &loc, const Vector3 &upVector = Vector3(0,1,0));
//@}
// ----------------------------------------------------------------------------------------------------------------
/** @name Hierarchy operations.
* These methods add and remove entities to and from each other.
*/
//@{
/**
* @see addChild()
*/
void addEntity(Entity *newChild);
/**
* Adds another entity as a child. The children inherit the parent's transforms.
@param newChild The entity to be added.
*/
void addChild(Entity *newChild);
/**
* Removes an entity from the entity's children.
@param entityToRemove Entity to be removed.
*/
void removeChild(Entity *entityToRemove);
/**
* Manually sets the entity's parent. This method does not add the entity to the parent and should not be called manually.
@param entity Parent entity.
*/
void setParentEntity(Entity *entity);
/**
* Returns the parent entity of the entity.
@return Parent entity of this entity.
*/
Entity *getParentEntity() const;
/**
* Returns the number of child entities belonging to this entity.
* @return Number of child entities.
*/
unsigned int getNumChildren();
/**
* Returns the child entity at specified index.
* @param index Index to return entity at.
* @return Child entity at specified index or NULL of index out of range.
*/
Entity *getChildAtIndex(unsigned int index);
//@}
// ----------------------------------------------------------------------------------------------------------------
/** @name Transform operations.
* These methods apply various transformations to the entity.
*/
//@{
/**
* Returns the entity's position.
@return Entity's position as a vector.
*/
Vector3 getPosition() const;
/**
* Returns the entity's position added to the combined position of its parent. This method is here only for convenience of calculating certain properties and should not be used to get an entity's actual position in the world. To get the actual world position of the entity, use the entity's concatendated matrix.
@see getConcatenatedMatrix()
@return Entity's position as a vector.
*/
Vector3 getCombinedPosition() const;
/**
* Sets the entity's position.
@param x X-axis value.
@param y Y-axis value.
@param z Z-axis value.
*/
void setPosition(Number x, Number y, Number z);
/**
* Sets the entity's position with a vector.
@param posVec New position as a vector.
*/
void setPosition(const Vector3 &posVec);
/**
* Returns the entity's position on the X axis.
@param x X-axis value.
*/
void setPositionX(Number x);
/**
* Returns the entity's position on the Y axis.
@param y Y-axis value.
*/
void setPositionY(Number y);
/**
* Translates the entity relative to its current position.
@param x X-axis value.
@param y Y-axis value.
@param z Z-axis value.
*/
void Translate(Number x, Number y, Number z);
/**
* Translates the entity relative to its current position with a vector.
@param tVec New position as a vector.
*/
void Translate(const Vector3 &tVec);
/**
* Returns the entity's position on the Z axis.
@param z Z-axis value.
*/
void setPositionZ(Number z);
/**
* Returns the entity's scale on the X axis.
@param x X-axis scale value.
*/
void setScaleX(Number x);
/**
* Returns the entity's scale on the Y axis.
@param y Y-axis scale value.
*/
void setScaleY(Number y);
/**
* Returns the entity's scale on the Z axis.
@param z Z-axis scale value.
*/
void setScaleZ(Number z);
/**
* Scales the entity relative to its current scale.
@param x X-axis value.
@param y Y-axis value.
@param z Z-axis value.
*/
void Scale(Number x, Number y, Number z);
/**
* Sets the entity's scale.
@param x X-axis value.
@param y Y-axis value.
@param z Z-axis value.
*/
void setScale(Number x, Number y, Number z);
/**
* Sets the entity's scale.
@param v New scale vector.
*/
void setScale(const Vector3 &v);
/**
* Returns the entity's scale multiplied by its parent's compound scale.
* @return Compound scale as vector.
*/
Vector3 getCompoundScale() const;
/**
* Returns the entity's scale.
@return Entity's scale as a vector.
*/
Vector3 getScale() const;
/**
* Returns the entity's pitch combined with the combined pitch of its parent.
@return Entity's combined pitch.
*/
Number getCombinedPitch() const;
/**
* Returns the entity's yaw combined with the combined yaw of its parent.
@return Entity's combined yaw.
*/
Number getCombinedYaw() const;
/**
* Returns the entity's roll combined with the combined roll of its parent.
@return Entity's combined roll.
*/
Number getCombinedRoll() const;
/**
* Forces the rotation quaternion to be rebuilt.
*/
void rebuildRotation();
/**
* Sets the pitch rotation of the entity.
* @param pitch New pitch value in degrees.
*/
void setPitch(Number pitch);
/**
* Sets the yaw rotation of the entity.
* @param yaw New yaw value in degrees.
*/
void setYaw(Number yaw);
/**
* Sets the roll rotation of the entity.
* @param roll New roll value in degrees.
*/
void setRoll(Number roll);
/**
* Rolls the entity relative to its current roll.
* @param roll Roll value in degrees.
*/
void Roll(Number roll);
/**
* Yaws the entity relative to its current yaw.
* @param yaw Yaw value in degrees.
*/
void Yaw(Number yaw);
/**
* Pitches the entity relative to its current pitch.
* @param pitch Pitch value in degrees.
*/
void Pitch(Number pitch);
/**
* Returns the current pitch of the entity.
* @return Current pitch value.
*/
Number getPitch() const;
/**
* Returns the current yaw of the entity.
* @return Current yaw value.
*/
Number getYaw() const;
/**
* Returns the current roll of the entity.
* @return Current roll value.
*/
Number getRoll() const;
/**
* Sets the rotation with quaternion value.
* @param Current yaw value.
*/
void setRotationQuat(Number w, Number x, Number y, Number z);
/**
* Returns the current rotation as a quaternion.
* @return Current rotation value.
*/
Quaternion getRotationQuat() const;
/**
* Orients the entity towards the specified location with the provided up vector. The up vector determines which side of the entity will be pointing in that direction.
* @param loc Location to look at.
* @param upVector The up vector.
*/
void lookAt(const Vector3 &loc, const Vector3 &upVector = Vector3(0,1,0));
/**
* Orients the entity towards another entity with the provided up vector. The up vector determines which side of the entity will be pointing in that direction.
* @param loc Location to look at.
* @param upVector The up vector.
* @see lookAt()
*/
void lookAtEntity(Entity *entity, const Vector3 &upVector = Vector3(0,1,0));
/**
* Returns the entity's color multiplied by its parent entity's combined color.
* @return Entity's combined color.
*/
Color getCombinedColor() const;
/**
* Sets the color of the entity as normalized floating point values.
* @param r Red value as a 0-1 floating point number.
* @param g Green value as a 0-1 floating point number.
* @param b Blue value as a 0-1 floating point number.
* @param a Alpha value as a 0-1 floating point number.
*/
void setColor(Number r, Number g, Number b, Number a);
/**
* Sets the color of the entity as 0-255 integers.
* @param r Red value as a 0-255 integer.
* @param g Green value as a 0-255 integer.
* @param b Blue value as a 0-255 integer.
* @param a Alpha value as a 0-255 integer.
*/
void setColorInt(int r, int g, int b, int a);
/**
* Sets the color of the entity as 0-255 integers.
* @param r Red value as a 0-255 integer.
* @param g Green value as a 0-255 integer.
* @param b Blue value as a 0-255 integer.
* @param a Alpha value as a 0-255 integer.
*/
void setColor(Color color);
//@}
// ----------------------------------------------------------------------------------------------------------------
/** @name Bounding box operations.
* These methods modify the bounding box of the entity. The bounding box is used for culling and collision detection.
*/
//@{
/**
* Recalculates the bounding box of the entity based on its size.
*/
void recalculateBBox();
/**
* Returns the bounding box radius.
* @return The bounding box radius.
*/
Number getBBoxRadius() const;
/**
* Returns the entity's bounding box radius compounded from its children's bounding box radii.
* @return The compound bounding box radius.
*/
Number getCompoundBBoxRadius() const;
/**
* Sets the bounding box radius.
* @param rad New bounding box radius.
*/
void setBBoxRadius(Number rad);
//@}
// ----------------------------------------------------------------------------------------------------------------
/** @name Rendering properties
* Methods and properties affecting the way the entity is rendered.
*/
//@{
/**
* Sets another entity as a mask for this entity (This is not really working properly right now).
*/
void setMask(Entity *mask);
/**
* Removes the entity's mask.
*/
void clearMask();
/**
* You can set a custom string identifier for user purposes.
*/
String custEntityType;
/**
* If this flag is true, the entity will always face the camera. False by default.
*/
bool billboardMode;
/**
* Normally, if billboardMode is on, no rotation is allowed at all. If this flag is also true, you can rotate the entity around the axis pointing to the camera.
*/
bool billboardRoll;
/**
* Normally, translucent textures do not affect the depth buffer, but if this flag is set to true, this entity's alpha channel is written to the depth buffer at a preset threshold. This flag is set to false by default.
*/
bool alphaTest;
/**
* If this flag is set to false, backface culling is disabled when rendering this entity, rendering both sides of each face. Set to true by default.
*/
bool backfaceCulled;
/**
* If this flag is set to true, the entity will render in wireframe.
*/
bool renderWireframe;
/**
* The entity's color.
*/
Color color;
/**
* If this flag is set to false, this entity will not be rendered or updated.
*/
bool enabled;
/**
* If this flag is set to false, this entity will not be rendered.
*/
bool visible;
/**
* If this flag is set to false, this entity will not write to the depth buffer when it's rendered.
*/
bool depthWrite;
/**
* If this flag is set to false, this entity will not check the depth buffer when it's rendering.
*/
bool depthTest;
/**
* Blending mode for rendering this entity. Possible blending modes are:
* Renderer::BLEND_MODE_NORMAL - Draw entity normally
* Renderer::BLEND_MODE_LIGHTEN - Add the entity's color on top of the background color.
* Renderer::BLEND_MODE_COLOR - Only change the color of the background.
*/
int blendingMode;
/**
* If set to false, the children of this entity will not multiply by this entity's color. Set to true by default.
*/
bool colorAffectsChildren;
/**
* If set to false, the children will be rendered even if the entity is invisible.
*/
bool visibilityAffectsChildren;
/**
* If this flag is set to true, this entity will render only into the depth buffer. This, effectively, means that it will be invisible, but still obscuring other entities.
*/
bool depthOnly;
/**
* If this flag is set to true, this entity's transformations will not take into account its parent, making its transforms always relative to 0.
*/
//@}
// ----------------------------------------------------------------------------------------------------------------
/**
* Sets user data pointer.
* @param userData User data pointer
*/
void setUserData(void *userData);
/**
* Returns the user data pointer.
* @return User data pointer
*/
void *getUserData();
void setBlendingMode(int newBlendingMode);
Vector3 getChildCenter() const;
std::vector <EntityProp> entityProps;
String getEntityProp(const String& propName);
void doUpdates();
virtual Matrix4 buildPositionMatrix();
virtual void adjustMatrixForChildren(){}
void setRenderer(Renderer *renderer);
Vector3 bBox;
bool ignoreParentMatrix;
bool isMask;
protected:
void *userData;
std::vector<Entity*> children;
Vector3 childCenter;
Number bBoxRadius;
Vector3 position;
Vector3 scale;
bool hasMask;
bool lockMatrix;
bool matrixDirty;
Matrix4 transformMatrix;
Number matrixAdj;
Number pitch;
Number yaw;
Number roll;
Entity *parentEntity;
Quaternion qYaw;
Quaternion qPitch;
Quaternion qRoll;
Quaternion rotationQuat;
Entity *maskEntity;
Renderer *renderer;
};
}
|
{
"content_hash": "a72bbb9b5fcf5afae21b2cad45391531",
"timestamp": "",
"source": "github",
"line_count": 613,
"max_line_length": 314,
"avg_line_length": 28.172920065252853,
"alnum_prop": 0.6024319629415171,
"repo_name": "mcclure/backup-Polycode",
"id": "d8838c00575106481e333e2ac32c941b73478313",
"size": "18353",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Core/Contents/Include/PolyEntity.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "421361"
},
{
"name": "C++",
"bytes": "2842462"
},
{
"name": "Lua",
"bytes": "30125"
},
{
"name": "Objective-C",
"bytes": "1056731"
},
{
"name": "Python",
"bytes": "47793"
}
]
}
|
class GarbageBag < ActiveRecord::Base
#TODO: name and dorm id combination should be unique instead of name unique
validates :name, presence: true, length: { maximum: 50}, uniqueness: true
validates :status, presence: true
validates_presence_of :user, message: 'user should exist'
validates_inclusion_of :status, :in => %w( ok full),
message: 'status should be either ok or full'
belongs_to :user
belongs_to :dorm
has_many :garbage_bag_duties
end
|
{
"content_hash": "8e1721195d044203b88d8dff6b97e25c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 44.27272727272727,
"alnum_prop": 0.6981519507186859,
"repo_name": "TomGijselinck/dorm-management-tool",
"id": "8e089f8905808ec2746bb2e502ae9067222b6408",
"size": "487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/dorm-management/app/models/garbage_bag.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5790"
},
{
"name": "CoffeeScript",
"bytes": "1266"
},
{
"name": "HTML",
"bytes": "36704"
},
{
"name": "JavaScript",
"bytes": "38607"
},
{
"name": "Nginx",
"bytes": "195"
},
{
"name": "Ruby",
"bytes": "53089"
}
]
}
|
from cffi import FFI
ffi = FFI()
ffi.set_source("_pypy_winbase_cffi", None)
# ---------- MSVCRT ----------
ffi.cdef("""
typedef unsigned short wint_t;
int _open_osfhandle(intptr_t osfhandle, int flags);
intptr_t _get_osfhandle(int fd);
int _setmode(int fd, int mode);
int _locking(int fd, int mode, long nbytes);
int _kbhit(void);
int _getch(void);
wint_t _getwch(void);
int _getche(void);
wint_t _getwche(void);
int _putch(int);
wint_t _putwch(wchar_t);
int _ungetch(int);
wint_t _ungetwch(wint_t);
""")
# ---------- SUBPROCESS ----------
ffi.cdef("""
typedef struct {
DWORD cb;
char * lpReserved;
char * lpDesktop;
char * lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFO, *LPSTARTUPINFO;
typedef struct {
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
DWORD WINAPI GetVersion(void);
BOOL WINAPI CreatePipe(PHANDLE, PHANDLE, void *, DWORD);
BOOL WINAPI CloseHandle(HANDLE);
HANDLE WINAPI GetCurrentProcess(void);
BOOL WINAPI DuplicateHandle(HANDLE, HANDLE, HANDLE, LPHANDLE,
DWORD, BOOL, DWORD);
BOOL WINAPI CreateProcessW(wchar_t *, wchar_t *, void *,
void *, BOOL, DWORD, wchar_t *,
wchar_t *, LPSTARTUPINFO, LPPROCESS_INFORMATION);
DWORD WINAPI WaitForSingleObject(HANDLE, DWORD);
BOOL WINAPI GetExitCodeProcess(HANDLE, LPDWORD);
BOOL WINAPI TerminateProcess(HANDLE, UINT);
HANDLE WINAPI GetStdHandle(DWORD);
DWORD WINAPI GetModuleFileNameW(HANDLE, wchar_t *, DWORD);
""")
# --------------------
if __name__ == "__main__":
ffi.compile()
|
{
"content_hash": "8915fddbff924149e1ff550c51045a25",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 76,
"avg_line_length": 24.73076923076923,
"alnum_prop": 0.6480041472265422,
"repo_name": "timm/timmnix",
"id": "088d48fb806d997c977c5cb0b4fb2a7ae4b5e199",
"size": "2564",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pypy3-v5.5.0-linux64/lib_pypy/_pypy_winbase_build.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "1641"
},
{
"name": "Batchfile",
"bytes": "1234"
},
{
"name": "C",
"bytes": "436685"
},
{
"name": "CSS",
"bytes": "96"
},
{
"name": "Common Lisp",
"bytes": "4"
},
{
"name": "Emacs Lisp",
"bytes": "290698"
},
{
"name": "HTML",
"bytes": "111577"
},
{
"name": "Makefile",
"bytes": "1681"
},
{
"name": "PLSQL",
"bytes": "22886"
},
{
"name": "PowerShell",
"bytes": "1540"
},
{
"name": "Prolog",
"bytes": "14301"
},
{
"name": "Python",
"bytes": "21267592"
},
{
"name": "Roff",
"bytes": "21080"
},
{
"name": "Shell",
"bytes": "27687"
},
{
"name": "TeX",
"bytes": "3052861"
},
{
"name": "VBScript",
"bytes": "481"
}
]
}
|
<o2 use O2Doc::Tutorial />
<o2 docSection title="multiColumnLayout, column">
<o2 multiColumnLayout> allows you to lay out as many columns as you would like in a table-like way without the table-tag being used (which is good
for screen readers and search engine ratings). It's also a very easy-to-use alternative to writing div tags and styling them manually. This tag gives you
good control over the widths of each individual column and the width of all the columns as a whole. Javascript is used to set the width and height of the
columns.
<o2 docSection title="Syntax">
<o2 docCode lang="o2ml">
<o2 addCss>
.column {
padding : 10px;
}
</o2:addCss>
<o2 multiColumnLayout width="500">
<o2 column width="200">
Column 1 - lskdnfgksnd edkfbsdkjb d bsdjgfbs kdjb skjdb skjdb kjb
</o2:column>
<o2 column width="33%">
Column 2
</o2:column>
<o2 column>
Column 3
</o2:column>
<o2 column>
Column 4
</o2:column>
</o2:multiColumnLayout>
</o2:docCode>
<o2 docCodeResult useModule="Html::MultiColumnLayout" />
</o2:docSection>
<o2 docSection title="multiColumnLayout attributes">
<o2 docList class="attributes">
<o2 docListItem class="optional">width</o2:docListItem>
</o2:docList>
Other attributes will be passed on to the <div> that's created.
</o2:docSection>
<o2 docSection title="column attributes">
<o2 docList class="attributes">
<o2 docListItem class="optional">width - you may specify the width in pixels or as a percentage value of the available width after absolute column widths
(specified in pixels) have been subtracted. All columns without a specified width are distributed evenly in the available horizontal space.</o2:docListItem>
</o2:docList>
Other attributes will be passed on to the <div> that's created.
</o2:docSection>
</o2:docSection>
|
{
"content_hash": "fda17ebf39090c296264767bb705aaea",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 164,
"avg_line_length": 37.148148148148145,
"alnum_prop": 0.6739780658025922,
"repo_name": "haakonsk/O2-Framework",
"id": "d1e4a4cfd4866af41aa72c640d3cf2e545e786fa",
"size": "2006",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "var/doc/tutorials/taglib/Html/MultiColumnLayout/multiColumnLayout.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "321037"
},
{
"name": "CSS",
"bytes": "83670"
},
{
"name": "Emacs Lisp",
"bytes": "140999"
},
{
"name": "JavaScript",
"bytes": "1127586"
},
{
"name": "PHP",
"bytes": "1316824"
},
{
"name": "Perl",
"bytes": "1879776"
},
{
"name": "Prolog",
"bytes": "1284"
},
{
"name": "Rebol",
"bytes": "350"
},
{
"name": "Shell",
"bytes": "1220"
}
]
}
|
export const RADIOBUTTONGROUP = '[data-component="radiogroup"]';
export const RADIOBUTTONCOMPONENT = '[data-component="radio-button"]';
export const RADIOBUTTONROLE = '[role="radio"]';
|
{
"content_hash": "d76b33b3e39680f21a338fa5f6a3c7ae",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 70,
"avg_line_length": 61.666666666666664,
"alnum_prop": 0.7567567567567568,
"repo_name": "Sage/carbon",
"id": "237678a2a8dc50edd8c45c3a50c0586dc0416868",
"size": "215",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cypress/locators/radiobutton/locators.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1508"
},
{
"name": "Gherkin",
"bytes": "12106"
},
{
"name": "HTML",
"bytes": "3068"
},
{
"name": "JavaScript",
"bytes": "2451316"
},
{
"name": "TypeScript",
"bytes": "1699384"
}
]
}
|
<?php
namespace Winnerpicker\Instagram\Contracts\Entities;
interface UserContract
{
/**
* ID пользователя.
*
* @return int
*/
public function id(): int;
/**
* API-токен пользователя.
*
* @return string
*/
public function token(): string;
}
|
{
"content_hash": "66d0f16c1c2c641cd524428967d497be",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 52,
"avg_line_length": 14.95,
"alnum_prop": 0.568561872909699,
"repo_name": "winnerpicker/instagram-sdk",
"id": "3f01cc9b00c52cfbc2432eef38b2ea81d09bbc5a",
"size": "328",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Contracts/Entities/UserContract.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "59350"
}
]
}
|
OPTIONS_KEEPDASHDASH=
OPTIONS_SPEC="\
git merge [options] <remote>...
git merge [options] <msg> HEAD <remote>
--
stat show a diffstat at the end of the merge
n don't show a diffstat at the end of the merge
summary (synonym to --stat)
log add list of one-line log to merge commit message
squash create a single commit instead of doing a merge
commit perform a commit if the merge succeeds (default)
ff allow fast-forward (default)
ff-only abort if fast-forward is not possible
rerere-autoupdate update index with any reused conflict resolution
s,strategy= merge strategy to use
X= option for selected merge strategy
m,message= message to be used for the merge commit (if any)
"
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
cd_to_toplevel
test -z "$(git ls-files -u)" ||
die "Merge is not possible because you have unmerged files."
! test -e "$GIT_DIR/MERGE_HEAD" ||
die 'You have not concluded your merge (MERGE_HEAD exists).'
LF='
'
all_strategies='recur recursive octopus resolve stupid ours subtree'
all_strategies="$all_strategies recursive-ours recursive-theirs"
not_strategies='base file index tree'
default_twohead_strategies='recursive'
default_octopus_strategies='octopus'
no_fast_forward_strategies='subtree ours'
no_trivial_strategies='recursive recur subtree ours recursive-ours recursive-theirs'
use_strategies=
xopt=
allow_fast_forward=t
fast_forward_only=
allow_trivial_merge=t
squash= no_commit= log_arg= rr_arg=
dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
"$GIT_DIR/MERGE_STASH" "$GIT_DIR/MERGE_MODE" || exit 1
}
savestate() {
# Stash away any local modifications.
git stash create >"$GIT_DIR/MERGE_STASH"
}
restorestate() {
if test -f "$GIT_DIR/MERGE_STASH"
then
git reset --hard $head >/dev/null
git stash apply $(cat "$GIT_DIR/MERGE_STASH")
git update-index --refresh >/dev/null
fi
}
finish_up_to_date () {
case "$squash" in
t)
echo "$1 (nothing to squash)" ;;
'')
echo "$1" ;;
esac
dropsave
}
squash_message () {
echo Squashed commit of the following:
echo
git log --no-merges --pretty=medium ^"$head" $remoteheads
}
finish () {
if test '' = "$2"
then
rlogm="$GIT_REFLOG_ACTION"
else
echo "$2"
rlogm="$GIT_REFLOG_ACTION: $2"
fi
case "$squash" in
t)
echo "Squash commit -- not updating HEAD"
squash_message >"$GIT_DIR/SQUASH_MSG"
;;
'')
case "$merge_msg" in
'')
echo "No merge message -- not updating HEAD"
;;
*)
git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
git gc --auto
;;
esac
;;
esac
case "$1" in
'')
;;
?*)
if test "$show_diffstat" = t
then
# We want color (if set), but no pager
GIT_PAGER='' git diff --stat --summary -M "$head" "$1"
fi
;;
esac
# Run a post-merge hook
if test -x "$GIT_DIR"/hooks/post-merge
then
case "$squash" in
t)
"$GIT_DIR"/hooks/post-merge 1
;;
'')
"$GIT_DIR"/hooks/post-merge 0
;;
esac
fi
}
merge_name () {
remote="$1"
rh=$(git rev-parse --verify "$remote^0" 2>/dev/null) || return
if truname=$(expr "$remote" : '\(.*\)~[0-9]*$') &&
git show-ref -q --verify "refs/heads/$truname" 2>/dev/null
then
echo "$rh branch '$truname' (early part) of ."
return
fi
if found_ref=$(git rev-parse --symbolic-full-name --verify \
"$remote" 2>/dev/null)
then
expanded=$(git check-ref-format --branch "$remote") ||
exit
if test "${found_ref#refs/heads/}" != "$found_ref"
then
echo "$rh branch '$expanded' of ."
return
elif test "${found_ref#refs/remotes/}" != "$found_ref"
then
echo "$rh remote branch '$expanded' of ."
return
fi
fi
if test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
then
sed -e 's/ not-for-merge / /' -e 1q \
"$GIT_DIR/FETCH_HEAD"
return
fi
echo "$rh commit '$remote'"
}
parse_config () {
while test $# != 0; do
case "$1" in
-n|--no-stat|--no-summary)
show_diffstat=false ;;
--stat|--summary)
show_diffstat=t ;;
--log|--no-log)
log_arg=$1 ;;
--squash)
test "$allow_fast_forward" = t ||
die "You cannot combine --squash with --no-ff."
squash=t no_commit=t ;;
--no-squash)
squash= no_commit= ;;
--commit)
no_commit= ;;
--no-commit)
no_commit=t ;;
--ff)
allow_fast_forward=t ;;
--no-ff)
test "$squash" != t ||
die "You cannot combine --squash with --no-ff."
test "$fast_forward_only" != t ||
die "You cannot combine --ff-only with --no-ff."
allow_fast_forward=f ;;
--ff-only)
test "$allow_fast_forward" != f ||
die "You cannot combine --ff-only with --no-ff."
fast_forward_only=t ;;
--rerere-autoupdate|--no-rerere-autoupdate)
rr_arg=$1 ;;
-s|--strategy)
shift
case " $all_strategies " in
*" $1 "*)
use_strategies="$use_strategies$1 "
;;
*)
case " $not_strategies " in
*" $1 "*)
false
esac &&
type "git-merge-$1" >/dev/null 2>&1 ||
die "available strategies are: $all_strategies"
use_strategies="$use_strategies$1 "
;;
esac
;;
-X)
shift
xopt="${xopt:+$xopt }$(git rev-parse --sq-quote "--$1")"
;;
-m|--message)
shift
merge_msg="$1"
have_message=t
;;
--)
shift
break ;;
*) usage ;;
esac
shift
done
args_left=$#
}
test $# != 0 || usage
have_message=
if branch=$(git-symbolic-ref -q HEAD)
then
mergeopts=$(git config "branch.${branch#refs/heads/}.mergeoptions")
if test -n "$mergeopts"
then
parse_config $mergeopts --
fi
fi
parse_config "$@"
while test $args_left -lt $#; do shift; done
if test -z "$show_diffstat"; then
test "$(git config --bool merge.diffstat)" = false && show_diffstat=false
test "$(git config --bool merge.stat)" = false && show_diffstat=false
test -z "$show_diffstat" && show_diffstat=t
fi
# This could be traditional "merge <msg> HEAD <commit>..." and the
# way we can tell it is to see if the second token is HEAD, but some
# people might have misused the interface and used a committish that
# is the same as HEAD there instead. Traditional format never would
# have "-m" so it is an additional safety measure to check for it.
if test -z "$have_message" &&
second_token=$(git rev-parse --verify "$2^0" 2>/dev/null) &&
head_commit=$(git rev-parse --verify "HEAD" 2>/dev/null) &&
test "$second_token" = "$head_commit"
then
merge_msg="$1"
shift
head_arg="$1"
shift
elif ! git rev-parse --verify HEAD >/dev/null 2>&1
then
# If the merged head is a valid one there is no reason to
# forbid "git merge" into a branch yet to be born. We do
# the same for "git pull".
if test 1 -ne $#
then
echo >&2 "Can merge only exactly one commit into empty head"
exit 1
fi
test "$squash" != t ||
die "Squash commit into empty head not supported yet"
test "$allow_fast_forward" = t ||
die "Non-fast-forward into an empty head does not make sense"
rh=$(git rev-parse --verify "$1^0") ||
die "$1 - not something we can merge"
git update-ref -m "initial pull" HEAD "$rh" "" &&
git read-tree --reset -u HEAD
exit
else
# We are invoked directly as the first-class UI.
head_arg=HEAD
# All the rest are the commits being merged; prepare
# the standard merge summary message to be appended to
# the given message. If remote is invalid we will die
# later in the common codepath so we discard the error
# in this loop.
merge_msg="$(
for remote
do
merge_name "$remote"
done |
if test "$have_message" = t
then
git fmt-merge-msg -m "$merge_msg" $log_arg
else
git fmt-merge-msg $log_arg
fi
)"
fi
head=$(git rev-parse --verify "$head_arg"^0) || usage
# All the rest are remote heads
test "$#" = 0 && usage ;# we need at least one remote head.
set_reflog_action "merge $*"
remoteheads=
for remote
do
remotehead=$(git rev-parse --verify "$remote"^0 2>/dev/null) ||
die "$remote - not something we can merge"
remoteheads="${remoteheads}$remotehead "
eval GITHEAD_$remotehead='"$remote"'
export GITHEAD_$remotehead
done
set x $remoteheads ; shift
case "$use_strategies" in
'')
case "$#" in
1)
var="`git config --get pull.twohead`"
if test -n "$var"
then
use_strategies="$var"
else
use_strategies="$default_twohead_strategies"
fi ;;
*)
var="`git config --get pull.octopus`"
if test -n "$var"
then
use_strategies="$var"
else
use_strategies="$default_octopus_strategies"
fi ;;
esac
;;
esac
for s in $use_strategies
do
for ss in $no_fast_forward_strategies
do
case " $s " in
*" $ss "*)
allow_fast_forward=f
break
;;
esac
done
for ss in $no_trivial_strategies
do
case " $s " in
*" $ss "*)
allow_trivial_merge=f
break
;;
esac
done
done
case "$#" in
1)
common=$(git merge-base --all $head "$@")
;;
*)
common=$(git merge-base --all --octopus $head "$@")
;;
esac
echo "$head" >"$GIT_DIR/ORIG_HEAD"
case "$allow_fast_forward,$#,$common,$no_commit" in
?,*,'',*)
# No common ancestors found. We need a real merge.
;;
?,1,"$1",*)
# If head can reach all the merge then we are up to date.
# but first the most common case of merging one remote.
finish_up_to_date "Already up-to-date."
exit 0
;;
t,1,"$head",*)
# Again the most common case of merging one remote.
echo "Updating $(git rev-parse --short $head)..$(git rev-parse --short $1)"
git update-index --refresh 2>/dev/null
msg="Fast-forward"
if test -n "$have_message"
then
msg="$msg (no commit created; -m option ignored)"
fi
new_head=$(git rev-parse --verify "$1^0") &&
git read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
finish "$new_head" "$msg" || exit
dropsave
exit 0
;;
?,1,?*"$LF"?*,*)
# We are not doing octopus and not fast-forward. Need a
# real merge.
;;
?,1,*,)
# We are not doing octopus, not fast-forward, and have only
# one common.
git update-index --refresh 2>/dev/null
case "$allow_trivial_merge,$fast_forward_only" in
t,)
# See if it is really trivial.
git var GIT_COMMITTER_IDENT >/dev/null || exit
echo "Trying really trivial in-index merge..."
if git read-tree --trivial -m -u -v $common $head "$1" &&
result_tree=$(git write-tree)
then
echo "Wonderful."
result_commit=$(
printf '%s\n' "$merge_msg" |
git commit-tree $result_tree -p HEAD -p "$1"
) || exit
finish "$result_commit" "In-index merge"
dropsave
exit 0
fi
echo "Nope."
esac
;;
*)
# An octopus. If we can reach all the remote we are up to date.
up_to_date=t
for remote
do
common_one=$(git merge-base --all $head $remote)
if test "$common_one" != "$remote"
then
up_to_date=f
break
fi
done
if test "$up_to_date" = t
then
finish_up_to_date "Already up-to-date. Yeeah!"
exit 0
fi
;;
esac
if test "$fast_forward_only" = t
then
die "Not possible to fast-forward, aborting."
fi
# We are going to make a new commit.
git var GIT_COMMITTER_IDENT >/dev/null || exit
# At this point, we need a real merge. No matter what strategy
# we use, it would operate on the index, possibly affecting the
# working tree, and when resolved cleanly, have the desired tree
# in the index -- this means that the index must be in sync with
# the $head commit. The strategies are responsible to ensure this.
case "$use_strategies" in
?*' '?*)
# Stash away the local changes so that we can try more than one.
savestate
single_strategy=no
;;
*)
rm -f "$GIT_DIR/MERGE_STASH"
single_strategy=yes
;;
esac
result_tree= best_cnt=-1 best_strategy= wt_strategy=
merge_was_ok=
for strategy in $use_strategies
do
test "$wt_strategy" = '' || {
echo "Rewinding the tree to pristine..."
restorestate
}
case "$single_strategy" in
no)
echo "Trying merge strategy $strategy..."
;;
esac
# Remember which strategy left the state in the working tree
wt_strategy=$strategy
eval 'git-merge-$strategy '"$xopt"' $common -- "$head_arg" "$@"'
exit=$?
if test "$no_commit" = t && test "$exit" = 0
then
merge_was_ok=t
exit=1 ;# pretend it left conflicts.
fi
test "$exit" = 0 || {
# The backend exits with 1 when conflicts are left to be resolved,
# with 2 when it does not handle the given merge at all.
if test "$exit" -eq 1
then
cnt=`{
git diff-files --name-only
git ls-files --unmerged
} | wc -l`
if test $best_cnt -le 0 -o $cnt -le $best_cnt
then
best_strategy=$strategy
best_cnt=$cnt
fi
fi
continue
}
# Automerge succeeded.
result_tree=$(git write-tree) && break
done
# If we have a resulting tree, that means the strategy module
# auto resolved the merge cleanly.
if test '' != "$result_tree"
then
if test "$allow_fast_forward" = "t"
then
parents=$(git merge-base --independent "$head" "$@")
else
parents=$(git rev-parse "$head" "$@")
fi
parents=$(echo "$parents" | sed -e 's/^/-p /')
result_commit=$(printf '%s\n' "$merge_msg" | git commit-tree $result_tree $parents) || exit
finish "$result_commit" "Merge made by $wt_strategy."
dropsave
exit 0
fi
# Pick the result from the best strategy and have the user fix it up.
case "$best_strategy" in
'')
restorestate
case "$use_strategies" in
?*' '?*)
echo >&2 "No merge strategy handled the merge."
;;
*)
echo >&2 "Merge with strategy $use_strategies failed."
;;
esac
exit 2
;;
"$wt_strategy")
# We already have its result in the working tree.
;;
*)
echo "Rewinding the tree to pristine..."
restorestate
echo "Using the $best_strategy to prepare resolving by hand."
git-merge-$best_strategy $common -- "$head_arg" "$@"
;;
esac
if test "$squash" = t
then
finish
else
for remote
do
echo $remote
done >"$GIT_DIR/MERGE_HEAD"
printf '%s\n' "$merge_msg" >"$GIT_DIR/MERGE_MSG" ||
die "Could not write to $GIT_DIR/MERGE_MSG"
if test "$allow_fast_forward" != t
then
printf "%s" no-ff
else
:
fi >"$GIT_DIR/MERGE_MODE" ||
die "Could not write to $GIT_DIR/MERGE_MODE"
fi
if test "$merge_was_ok" = t
then
echo >&2 \
"Automatic merge went well; stopped before committing as requested"
exit 0
else
{
echo '
Conflicts:
'
git ls-files --unmerged |
sed -e 's/^[^ ]* / /' |
uniq
} >>"$GIT_DIR/MERGE_MSG"
git rerere $rr_arg
die "Automatic merge failed; fix conflicts and then commit the result."
fi
|
{
"content_hash": "bdbe756d386865aacee0484f0425efa2",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 95,
"avg_line_length": 23.36260162601626,
"alnum_prop": 0.62896714922049,
"repo_name": "anatm/administrator",
"id": "7b922c39480c8b78d0687cbabac59672f9ae6ede",
"size": "14419",
"binary": false,
"copies": "59",
"ref": "refs/heads/master",
"path": "git-1.8.1/contrib/examples/git-merge.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "6064"
},
{
"name": "Assembly",
"bytes": "7443"
},
{
"name": "C",
"bytes": "4510704"
},
{
"name": "C++",
"bytes": "225575"
},
{
"name": "CSS",
"bytes": "12784"
},
{
"name": "Emacs Lisp",
"bytes": "86984"
},
{
"name": "Go",
"bytes": "15064"
},
{
"name": "JavaScript",
"bytes": "49702"
},
{
"name": "Makefile",
"bytes": "123973"
},
{
"name": "Objective-C",
"bytes": "504"
},
{
"name": "PHP",
"bytes": "170335"
},
{
"name": "Perl",
"bytes": "1036241"
},
{
"name": "Python",
"bytes": "258210"
},
{
"name": "Shell",
"bytes": "3482375"
},
{
"name": "Tcl",
"bytes": "642985"
}
]
}
|
package io.proleap.cobol.asg.metamodel.procedure.compute;
import io.proleap.cobol.asg.metamodel.CobolDivisionElement;
import io.proleap.cobol.asg.metamodel.call.Call;
public interface Store extends CobolDivisionElement {
Call getStoreCall();
boolean isRounded();
void setRounded(boolean rounded);
void setStoreCall(Call storeCall);
}
|
{
"content_hash": "88585b096272209c29a545e86558c2dd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 59,
"avg_line_length": 20.352941176470587,
"alnum_prop": 0.8005780346820809,
"repo_name": "uwol/cobol85parser",
"id": "c9fc7d499bc30287451c8d16bbd8883afb78c6d8",
"size": "571",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/io/proleap/cobol/asg/metamodel/procedure/compute/Store.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "89712"
},
{
"name": "COBOL",
"bytes": "28337364"
},
{
"name": "Java",
"bytes": "2908548"
}
]
}
|
// Copyright 2017 Google Inc. 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.
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Text;
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Text.RegularExpressions;
namespace Google.Cloud.Tools.Analyzers
{
/// <summary>
/// Warns about missing copyright notices, but will ignore certain auto-generated files as well as empty files.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class MissingCopyrightNoticeAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "GCP0002";
private const string Category = "Usage";
private static readonly LocalizableString Title = "Missing copyright notice";
private static readonly LocalizableString MessageFormat = "The Google copyright notice is missing";
private static readonly LocalizableString Description = "Every code file should contain a Google copyright notice.";
private static DiagnosticDescriptor Rule =
new DiagnosticDescriptor(
DiagnosticId,
Title,
MessageFormat,
Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: Description);
internal const string OldCopyrightApacheTemplate =
@"// Copyright ____ 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.";
internal const string NewCopyrightApacheTemplate =
@"// Copyright ____ Google LLC
//
// 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
//
// https://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.";
internal const string CopyrightBsdTemplate =
@"";
private static readonly Regex OldCopyrightApacheRegex = CreateCopyrightRegex(OldCopyrightApacheTemplate);
private static readonly Regex NewCopyrightApacheRegex = CreateCopyrightRegex(NewCopyrightApacheTemplate);
private static readonly Regex CopyrightBsdRegex = CreateCopyrightRegex(CopyrightBsdTemplate);
private static readonly ImmutableArray<string> AutoGenerationCommentPrefixes =
ImmutableArray.Create(
"// <autogenerated />",
"// <auto-generated>",
"//------------------------------------------------------------------------------\n// <auto-generated>",
"//------------------------------------------------------------------------------\r\n// <auto-generated>",
"// Generated by the protocol buffer compiler. DO NOT EDIT!",
"// Generated by the MSBuild WriteCodeFragment class.",
"// This file was automatically created from");
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxTreeAction(AnalyzeTree);
}
private static void AnalyzeTree(SyntaxTreeAnalysisContext context)
{
var rootNode = context.Tree.GetRoot(context.CancellationToken);
if (RequiredCopyrightIsMissing(rootNode))
{
context.ReportDiagnostic(
Diagnostic.Create(
Rule,
context.Tree.GetLocation(new TextSpan(0, 1))));
}
}
private static bool RequiredCopyrightIsMissing(SyntaxNode rootNode)
{
if (rootNode.FullSpan.Length == 0)
{
// Ignore empty files. Temporary files for the build process are sometimes empty.
return false;
}
var leadingTriviaList = rootNode.GetLeadingTrivia();
if (leadingTriviaList.Count == 0)
{
return true;
}
var leadingTriviaText = leadingTriviaList.ToFullString();
if (AutoGenerationCommentPrefixes.Any(leadingTriviaText.StartsWith) ||
OldCopyrightApacheRegex.IsMatch(leadingTriviaText) ||
NewCopyrightApacheRegex.IsMatch(leadingTriviaText) ||
CopyrightBsdRegex.IsMatch(leadingTriviaText))
{
return false;
}
return true;
}
private static Regex CreateCopyrightRegex(string copyrightTemplate)
{
var pattern = Regex.Escape(copyrightTemplate)
.Replace("____", @"\d{4}\,?")
.Replace(@"Google\ LLC", @"Google\ (Inc\.|LLC)");
pattern = Regex.Replace(pattern, @"(\\r\\n|\\n)", @"\ *\r?\n");
return new Regex(@"\A\s*" + pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
}
}
}
|
{
"content_hash": "bd0a07269f8dabd141eb4ac7c0711f53",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 134,
"avg_line_length": 43.54,
"alnum_prop": 0.6447710917164293,
"repo_name": "jskeet/google-cloud-dotnet",
"id": "2b0548e25b8d4cae15ce25bc0274b099fb911339",
"size": "6754",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "tools/Google.Cloud.Tools.Analyzers/MissingCopyrightNoticeAnalyzer.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "268415427"
},
{
"name": "CSS",
"bytes": "1346"
},
{
"name": "Dockerfile",
"bytes": "3173"
},
{
"name": "HTML",
"bytes": "3823"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65260"
},
{
"name": "sed",
"bytes": "1030"
}
]
}
|
package com.gs.fw.common.mithra.test.domain;
import java.sql.Timestamp;
public class BitemporalProductCategory extends BitemporalProductCategoryAbstract
{
public BitemporalProductCategory(Timestamp businessDate
, Timestamp processingDate
)
{
super(businessDate
,processingDate
);
// You must not modify this constructor. Mithra calls this internally.
// You can call this constructor. You can also add new constructors.
}
public BitemporalProductCategory(Timestamp businessDate)
{
super(businessDate);
}
}
|
{
"content_hash": "fcea06c300ed4b706062369d369d692b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 80,
"avg_line_length": 25.142857142857142,
"alnum_prop": 0.7916666666666666,
"repo_name": "goldmansachs/reladomo",
"id": "f03dd6419132d72647e52ea539111397bbb2d1f2",
"size": "1098",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/BitemporalProductCategory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5540"
},
{
"name": "CSS",
"bytes": "13402"
},
{
"name": "HTML",
"bytes": "64206"
},
{
"name": "Java",
"bytes": "18211611"
},
{
"name": "JavaScript",
"bytes": "18247"
},
{
"name": "Ruby",
"bytes": "11034"
},
{
"name": "Shell",
"bytes": "8454"
},
{
"name": "XSLT",
"bytes": "383852"
}
]
}
|
let fs = require("fs");
let PluginLoader = require("./PluginLoader");
class PluginManager {
constructor(_core) {
this.paths = [];
this.plugins = [];
this.pluginnames = {};
this.loaded = [];
// this.config = _config;
this.core = _core;
this.config = _core.config; // temporary
}
start() {
for (let i = 0; i < this.config.core.paths.length; i++) {
let path = this.config.core.paths[i];
this.addPath(path);
}
this.scanPlugins();
for (let n = 0; n < this.config.core.plugins.length; n++) {
let plugin = this.config.core.plugins[n];
let inst = this.getPluginLoader(plugin);
if (inst) {
inst.load();
}
}
}
addPath(path) {
this.paths.push(path);
}
scanPlugins() {
let newplugins = [];
let plugin = null;
// iterate directories and scan meta.json files (use PluginLoader method)
for (let n = 0; n < this.paths.length; n++) {
let dir = this.paths[n];
let files = fs.readdirSync(dir);
for (let j = 0; j < files.length; j++) {
let file = dir + "/" + files[j];
if (fs.lstatSync(file).isDirectory()) {
plugin = this.getPluginByPath(file);
if (plugin != null) {
try {
plugin.reloadMeta(plugin);
newplugins.push(plugin);
}
catch (e) {
// maybe a bit harsh, but unload plugin..
plugin.unload();
}
}
else {
try {
plugin = new PluginLoader(this, file);
newplugins.push(plugin);
}
catch (e) {
// TODO: print warning to console here
}
}
}
}
}
// unload plugins that no-longer exist.
for (let i = 0; i < this.plugins.length; i++) {
plugin = this.plugins[i];
if (newplugins.indexOf(plugin) === -1) {
console.info(plugin.meta.name + " no longer exists, unload");
plugin.unload();
}
}
this.plugins = newplugins;
}
// temporary until a proper config system is in place
getConfig() {
return this.core.loadConfig();
}
getPluginLoader(pluginName) {
pluginName = pluginName.toLowerCase();
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i];
if (plugin.meta.name.toLowerCase() === pluginName) {
return plugin;
}
}
}
getPlugin(pluginName) {
let plugin = this.getPluginLoader(pluginName);
if (!plugin || !plugin.loaded) {
return undefined;
}
return plugin.plugin;
}
getPluginByPath(path) {
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i];
if (plugin.directory === path) {
return plugin;
}
}
}
fireEvent() {
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i];
if (plugin.loaded) {
plugin.fireEvent.apply(plugin, arguments);
}
}
}
getDependencies(plugin, missing) {
let plugins = [plugin];
missing = missing || [];
for (let i = 0; i < plugins.length; i++) {
plugin = plugins[i];
if (!plugin.meta.wallace || !plugin.meta.wallace.dependencies) {
continue;
}
//for (let j in plugin.meta.dependencies) {
for (let j = 0; j < plugin.meta.wallace.dependencies.length; j++) {
let dependency = plugin.meta.wallace.dependencies[j];
let cplugin = this.getPluginLoader(dependency);
if (cplugin) {
if (plugins.indexOf(cplugin) === -1) {
plugins.push(cplugin);
}
}
else {
missing.push(dependency);
}
}
}
return plugins.reverse();
}
getDependants(plugin) {
let dependants = [];
for (let i = 0; i < this.plugins.length; i++) {
let cplugin = this.plugins[i];
let dependencies = this.getDependencies(cplugin);
if (dependencies.indexOf(plugin) !== -1) {
dependants.push(cplugin);
}
}
return dependants;
}
filterLoaded(plugins) {
let out = [];
for (let i = 0; i < plugins.length; i++) {
let cplugin = plugins[i];
if (cplugin.loaded) {
out.push(cplugin);
}
}
return out;
}
}
module.exports = PluginManager;
|
{
"content_hash": "03bf10981c3282a00bfded35b38d4137",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 81,
"avg_line_length": 29.18435754189944,
"alnum_prop": 0.44352986217457885,
"repo_name": "WritheM/Wallace",
"id": "4471587fb1bb646598092d4b7ebcb33157fa57bb",
"size": "5224",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/PluginManager.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "507"
},
{
"name": "JavaScript",
"bytes": "83922"
},
{
"name": "Shell",
"bytes": "403"
}
]
}
|
Ext.app.Module = function(config){
Ext.apply(this, config);
Ext.app.Module.superclass.constructor.call(this);
this.init();
}
Ext.extend(Ext.app.Module, Ext.util.Observable, {
init : Ext.emptyFn
});
|
{
"content_hash": "9b8eb52bec03c6fdd7cf61f3ceae468c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 53,
"avg_line_length": 22.3,
"alnum_prop": 0.6502242152466368,
"repo_name": "G4Studio/tobacco",
"id": "b5e3b6a14a7dbfa57c1350ca197440bf0267bead",
"size": "347",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "G4Studio5/WebRoot/resource/desktop/js/Module.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1434139"
},
{
"name": "Java",
"bytes": "3526354"
},
{
"name": "JavaScript",
"bytes": "3105545"
}
]
}
|
/**
* @file rcDataObjLseek.c
*
*/
/*** Copyright (c), The Regents of the University of California ***
*** For more information please refer to files in the COPYRIGHT directory ***/
/* This is script-generated code. */
/* See dataObjLseek.h for a description of this API call.*/
#include "dataObjLseek.h"
/**
* \fn rcDataObjLseek (rcComm_t *conn, openedDataObjInp_t *dataObjLseekInp,
fileLseekOut_t **dataObjLseekOut)
*
* \brief Repositions the offset of the open file associated
* with the file descriptor to the argument offset according to the
* directive whence. This is equivalent to lseek of UNIX.
*
* \user client
*
* \category data object operations
*
* \since 1.0
*
* \author Mike Wan
* \date 2007
*
* \remark none
*
* \note none
*
* \usage
* Advance the offset 12345 bytes from current position of an open
* data object:
* \n int status;
* \n dataObjInp_t dataObjInp;
* \n openedDataObjInp_t dataObjLseekInp;
* \n fileLseekOut_t *dataObjLseekOut = NULL;
* \n bzero (&dataObjInp, sizeof (dataObjInp));
* \n bzero (&dataObjLseekInp, sizeof (dataObjLseekInp));
* \n rstrcpy (dataObjInp.objPath, "/myZone/home/john/myfile", MAX_NAME_LEN);
* \n dataObjInp.openFlags = O_RDONLY;
* \n dataObjLseekInp.l1descInx = rcDataObjOpen (conn, &dataObjInp);
* \n if (dataObjLseekInp.l1descInx < 0) {
* \n .... handle the error
* \n }
* \n dataObjLseekInp.offset = 12345;
* \n dataObjLseekInp.whence = SEEK_CUR;
* \n status = rcDataObjLseek (conn, &dataObjLseekInp, &dataObjLseekOut);
* \n if (status < 0) {
* \n .... handle the error
* \n }
*
* \param[in] conn - A rcComm_t connection handle to the server.
* \param[in] dataObjLseekInp - Elements of openedDataObjInp_t used :
* \li int \b l1descInx - the opened data object descriptor from
* rcDataObjOpen or rcDataObjCreate.
* \li int \b whence - Similar to lseek of UNIX. Valid values are:
* \n SEEK_SET - The offset is set to offset bytes.
* \n SEEK_CUR - The offset is set to its current location plus
* offset bytes.
* \n SEEK_END - The offset is set to the size of the file plus
* offset bytes.
* \li rodsLong \b offset - the offset.
* \param[out] fileLseekOut_t **dataObjLseekOut - pointer to a fileLseekOut_t
* containing the resulting offset location in bytes from the beginning
* of the file.
* \return integer
* \retval 0 on success.
* \sideeffect none
* \pre none
* \post none
* \sa none
* \bug no known bugs
**/
int
rcDataObjLseek (rcComm_t *conn, openedDataObjInp_t *dataObjLseekInp,
fileLseekOut_t **dataObjLseekOut)
{
int status;
status = procApiRequest (conn, DATA_OBJ_LSEEK_AN, dataObjLseekInp, NULL,
(void **) dataObjLseekOut, NULL);
return (status);
}
|
{
"content_hash": "660e4e54b52682e4b8f2f311afc357f7",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 32.01136363636363,
"alnum_prop": 0.665956691515797,
"repo_name": "iPlantCollaborativeOpenSource/irods-3.3.1-iplant",
"id": "510acb9be5cf4a448662438a9571e2379a16b9aa",
"size": "2817",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "lib/api/src/rcDataObjLseek.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "10239839"
},
{
"name": "C++",
"bytes": "1165071"
},
{
"name": "FORTRAN",
"bytes": "6804"
},
{
"name": "Java",
"bytes": "1418"
},
{
"name": "JavaScript",
"bytes": "3808"
},
{
"name": "Perl",
"bytes": "774376"
},
{
"name": "Puppet",
"bytes": "22336"
},
{
"name": "Python",
"bytes": "11177"
},
{
"name": "R",
"bytes": "281422"
},
{
"name": "Ruby",
"bytes": "14152"
},
{
"name": "Shell",
"bytes": "111922"
},
{
"name": "XSLT",
"bytes": "12558"
},
{
"name": "nesC",
"bytes": "4808"
}
]
}
|
package com.darksci.pardot.api.request.customredirect;
import com.darksci.pardot.api.request.BaseRequest;
/**
* Used to generate a Custom Redirect read request.
*/
public class CustomRedirectReadRequest extends BaseRequest<CustomRedirectReadRequest> {
@Override
public String getApiEndpoint() {
return "customRedirect/do/read";
}
public CustomRedirectReadRequest selectById(final Long id) {
return setParam("id", id);
}
}
|
{
"content_hash": "97a4ebfa871b1b756ce4c878b943bb39",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 87,
"avg_line_length": 22.238095238095237,
"alnum_prop": 0.7259100642398287,
"repo_name": "Crim/pardot-java-client",
"id": "abfacc2dd968d8b9c719709061c9deccaefc1868",
"size": "1627",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/darksci/pardot/api/request/customredirect/CustomRedirectReadRequest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1037992"
}
]
}
|
package org.apache.camel.dataformat.bindy.fixed.marshall.simple;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class BindySimpleFixedLengthMarshallWithNoClipTest extends CamelTestSupport {
private List<Map<String, Object>> models = new ArrayList<>();
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
from("direct:start")
.marshal(bindy)
.to("mock:result");
}
};
}
@Test
public void testMarshallMessage() throws Exception {
try {
template.sendBody("direct:start", generateModel());
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Length for the firstName must not be larger than allowed, was: 13, allowed: 9", cause.getMessage());
}
}
public List<Map<String, Object>> generateModel() {
Map<String, Object> modelObjects = new HashMap<>();
Order order = new Order();
order.setOrderNr(10);
order.setOrderType("BUY");
order.setClientNr("A98");
order.setFirstName("Madame de Sol");
order.setLastName("M");
order.setAmount(new BigDecimal("2500.45"));
order.setInstrumentCode("ISIN");
order.setInstrumentNumber("XD12345678");
order.setInstrumentType("Share");
order.setCurrency("USD");
Calendar calendar = new GregorianCalendar();
calendar.set(2009, 7, 1);
order.setOrderDate(calendar.getTime());
modelObjects.put(order.getClass().getName(), order);
models.add(modelObjects);
return models;
}
@FixedLengthRecord(length = 65, paddingChar = ' ')
public static class Order {
@DataField(pos = 1, length = 2)
private int orderNr;
@DataField(pos = 3, length = 2, clip = true)
private String clientNr;
@DataField(pos = 5, length = 9)
private String firstName;
@DataField(pos = 14, length = 5, align = "L")
private String lastName;
@DataField(pos = 19, length = 4)
private String instrumentCode;
@DataField(pos = 23, length = 10)
private String instrumentNumber;
@DataField(pos = 33, length = 3)
private String orderType;
@DataField(pos = 36, length = 5)
private String instrumentType;
@DataField(pos = 41, precision = 2, length = 12, paddingChar = '0')
private BigDecimal amount;
@DataField(pos = 53, length = 3)
private String currency;
@DataField(pos = 56, length = 10, pattern = "dd-MM-yyyy")
private Date orderDate;
public int getOrderNr() {
return orderNr;
}
public void setOrderNr(int orderNr) {
this.orderNr = orderNr;
}
public String getClientNr() {
return clientNr;
}
public void setClientNr(String clientNr) {
this.clientNr = clientNr;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getInstrumentCode() {
return instrumentCode;
}
public void setInstrumentCode(String instrumentCode) {
this.instrumentCode = instrumentCode;
}
public String getInstrumentNumber() {
return instrumentNumber;
}
public void setInstrumentNumber(String instrumentNumber) {
this.instrumentNumber = instrumentNumber;
}
public String getOrderType() {
return orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
@Override
public String toString() {
return "Model : " + Order.class.getName() + " : " + this.orderNr + ", " + this.orderType + ", " + String.valueOf(this.amount) + ", " + this.instrumentCode + ", "
+ this.instrumentNumber + ", " + this.instrumentType + ", " + this.currency + ", " + this.clientNr + ", " + this.firstName + ", " + this.lastName + ", "
+ String.valueOf(this.orderDate);
}
}
}
|
{
"content_hash": "11e5745243aeee29849257cdfcbc6c1e",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 173,
"avg_line_length": 29.18095238095238,
"alnum_prop": 0.6006853785900783,
"repo_name": "sverkera/camel",
"id": "ea2a06d5cefd7f384abaf48fb05970ad0b8452b7",
"size": "6931",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "1518"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "44835"
},
{
"name": "HTML",
"bytes": "903016"
},
{
"name": "Java",
"bytes": "74372940"
},
{
"name": "JavaScript",
"bytes": "90399"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323982"
},
{
"name": "Shell",
"bytes": "17120"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "288715"
}
]
}
|
End of preview.