file_name large_stringlengths 4 140 | prefix large_stringlengths 0 12.1k | suffix large_stringlengths 0 12k | middle large_stringlengths 0 7.51k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
ed25519.rs | &[u8]) -> [u8; 32] {
let ed_y = Fe::from_bytes(&public_key);
// Produce public key in Montgomery form.
let mont_x = edwards_to_montgomery_x(ed_y);
// Produce private key from seed component (bytes 0 to 32)
// of the Ed25519 extended private key (64 bytes).
let mut hasher = Sha512::new();
h... | () {
let seed = [0x26, 0x27, 0xf6, 0x85, 0x97, 0x15, 0xad, 0x1d, 0xd2, 0x94, 0xdd, 0xc4, 0x76, 0x19, 0x39, 0x31,
0xf1, 0xad, 0xb5 | keypair_matches_mont | identifier_name |
ed25519.rs | _secret.to_vec(), expected_secret.to_vec());
assert_eq!(actual_public.to_vec(), expected_public.to_vec());
}
#[test]
fn keypair_cases() {
do_keypair_case(
[0x26, 0x27, 0xf6, 0x85, 0x97, 0x15, 0xad, 0x1d, 0xd2, 0x94, 0xdd, 0xc4, 0x76, 0x19, 0x39, 0x31,
0xf1, 0xad, 0x... | {
let (secret_key, public_key) = keypair(seed.as_ref());
let mut actual_signature = signature(message, secret_key.as_ref());
assert_eq!(expected_signature.to_vec(), actual_signature.to_vec());
assert!(verify(message, public_key.as_ref(), actual_signature.as_ref()));
for &(index,... | identifier_body | |
index.d.ts | import {CamelCase, PascalCase} from 'type-fest';
// eslint-disable-next-line @typescript-eslint/ban-types
type EmptyTuple = [];
/**
Return a default type if input type is nil.
@template T - Input type.
@template U - Default type.
*/
type WithDefault<T, U extends T> = T extends undefined | void | null ? U : T;
/**
C... | ? First extends Target
? true
: IsInclude<Rest, Target>
: boolean;
/**
Append a segment to dot-notation path.
*/
type AppendPath<S extends string, Last extends string> = S extends ''
? Last
: `${S}.${Last}`;
/**
Convert keys of an object to camelcase strings.
*/
type CamelCaseKeys<
T extends Record<s... | : List extends Readonly<EmptyTuple>
? false
: List extends readonly [infer First, ...infer Rest] | random_line_split |
test_class.py | import pytest
from eos_data_distribution import DirTools
from gi.repository import GLib
ITER_COUNT = 10
class TestClass:
@pytest.mark.timeout(timeout=3, method='thread') | self.__called = 0
def cb_changed(M, p, m, f, o, evt, d=None, e=None):
print('signal', e, p, f, o, evt, d)
assert e == 'created'
self.__called += 1
d = tmpdir.mkdir("ndn")
m = DirTools.Monitor(str(d))
[m.connect(s, cb_changed, s) for s in ['cr... | def test_0(self, tmpdir):
loop = GLib.MainLoop() | random_line_split |
test_class.py | import pytest
from eos_data_distribution import DirTools
from gi.repository import GLib
ITER_COUNT = 10
class TestClass:
@pytest.mark.timeout(timeout=3, method='thread')
def test_0(self, tmpdir):
| loop = GLib.MainLoop()
self.__called = 0
def cb_changed(M, p, m, f, o, evt, d=None, e=None):
print('signal', e, p, f, o, evt, d)
assert e == 'created'
self.__called += 1
d = tmpdir.mkdir("ndn")
m = DirTools.Monitor(str(d))
[m.connect(s, cb_ch... | identifier_body | |
test_class.py | import pytest
from eos_data_distribution import DirTools
from gi.repository import GLib
ITER_COUNT = 10
class TestClass:
@pytest.mark.timeout(timeout=3, method='thread')
def | (self, tmpdir):
loop = GLib.MainLoop()
self.__called = 0
def cb_changed(M, p, m, f, o, evt, d=None, e=None):
print('signal', e, p, f, o, evt, d)
assert e == 'created'
self.__called += 1
d = tmpdir.mkdir("ndn")
m = DirTools.Monitor(str(d))
... | test_0 | identifier_name |
condition-list.component.spec.ts | // Copyright 2018 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | import {ConditionListComponent, RiskProbability} from './condition-list.component';
describe('ConditionListComponent', () => {
const RISK_PROBABILITY_PATH = 'prediction[0].qualitativeRisk.coding[0].code';
let component: ConditionListComponent;
let fixture: ComponentFixture<ConditionListComponent>;
const sched... | random_line_split | |
addServer.py | #!/usr/bin/python
#-*-encoding:utf-8-*-
#author: asher
#date: 20160429 on train D909
# this scripts useed for add server ip to webvirtmgr
# if not , each server must add by website,it's too slow, and very not interesting.
# use this , it's make you feel very happy
import sqlite3
try:
conn = sqlite3.connect('../... | while True:
if ips1 <= ips2:
ips1 = str(ips1)
newip = ips + "." + ips1
jifang1 = jifang + "_" + newip
print "Add %s into database\n" % jifang1
cur.execute('''insert into servers_compute (name,hostname,login,password,type) values('%s','%s','%s','%s'... | ips1 = int(raw_input("Input start last ip num: 1:>").strip())
ips2 = int(raw_input("Input end ip num: 100:>").strip())
jifang = str(raw_input("DataCenter like:jxq:>").strip())
login = str(raw_input("User:admin or others:>").strip())
password = str(raw_input("Password:>").strip()) | random_line_split |
addServer.py | #!/usr/bin/python
#-*-encoding:utf-8-*-
#author: asher
#date: 20160429 on train D909
# this scripts useed for add server ip to webvirtmgr
# if not , each server must add by website,it's too slow, and very not interesting.
# use this , it's make you feel very happy
import sqlite3
try:
conn = sqlite3.connect('../... |
finally:
allservers = cur.execute("select id,name,hostname,login,type from servers_compute").fetchall()
for i in allservers:
print i
conn.close()
| if ips1 <= ips2:
ips1 = str(ips1)
newip = ips + "." + ips1
jifang1 = jifang + "_" + newip
print "Add %s into database\n" % jifang1
cur.execute('''insert into servers_compute (name,hostname,login,password,type) values('%s','%s','%s','%s','%d')''' % (jifang1,new... | conditional_block |
puppet_client.py | # -*- coding: utf-8 -*-
# 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, ... |
def execute_command(self, command):
""" Execute a command in the given container
:param command: bash command to run
:return: execution result
"""
bash_txt = "/bin/bash -c \"{}\"".format(command.replace('"', '\\"'))
exec_txt = self.dc.exec_create(
cont... | self.dc.remove_container(self.container) | conditional_block |
puppet_client.py | # -*- coding: utf-8 -*-
# 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, ... |
def remove_container(self, kill=True):
"""destroy container on exit
:param kill: inhibits removal for testing purposes
"""
self.dc.stop(self.container)
if kill:
self.dc.remove_container(self.container)
def execute_command(self, command):
""" Execute... | """Run and start a container based on the given image
:param image: image to run
:return:
"""
contname = "{}-validate".format(image).replace("/", "_")
try:
try:
self.dc.remove_container(contname, force=True)
LOG.info(_LI('Removing old %... | identifier_body |
puppet_client.py | # -*- coding: utf-8 -*-
# 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, ... | (self, kill=True):
"""destroy container on exit
:param kill: inhibits removal for testing purposes
"""
self.dc.stop(self.container)
if kill:
self.dc.remove_container(self.container)
def execute_command(self, command):
""" Execute a command in the given co... | remove_container | identifier_name |
puppet_client.py | # -*- coding: utf-8 -*-
# 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, ... | 'success': True,
'response': resp_test
}
for line in resp_test.splitlines():
if "ERROR" in line:
msg['success'] = False
LOG.debug(_("Test result: %s") % resp_test)
except Exception as e:
self.remo... | try:
cmd_test = CONF.clients_puppet.cmd_test.format(cookbook)
resp_test = self.execute_command(cmd_test)
msg = { | random_line_split |
magenta.rs | extern crate drm;
use std::io::Result as IoResult;
use std::thread::sleep;
use std::time::Duration;
fn main() -> IoResult<()>
{
let mut dev0 = drm::Device::first_card().unwrap();
let dev = dev0.set_master()
.map_err(|err| {
eprintln!("Failed to set master: {:?}", err);
err
... | let mut buffer = drm::mode::DumbBuf::create_with_depth(
&dev,
mode.hdisplay as u32, mode.vdisplay as u32, 32, 32)
.expect("creating buffer");
dev.set_crtc(crtc.id(), Some(buffer.fb().id()),
0, 0,
&[ connector.id() ],
Some(&mode))
... | random_line_split | |
magenta.rs |
extern crate drm;
use std::io::Result as IoResult;
use std::thread::sleep;
use std::time::Duration;
fn main() -> IoResult<()>
| let encoder = dev.get(encoder_id)
.expect("failed get encoder");
let crtc_id = encoder.crtc_id().unwrap();
let crtc = dev.get(crtc_id)
.expect("failed get crtc");
let old_fbid = crtc.fb_id().expect("Currently no fb");
let mode = crtc.mode().expect("mode")
.clon... | {
let mut dev0 = drm::Device::first_card().unwrap();
let dev = dev0.set_master()
.map_err(|err| {
eprintln!("Failed to set master: {:?}", err);
err
})?;
let res = dev.get_resources()?;
let connector = res.connectors().iter()
.filter_map(|id| dev.get(*i... | identifier_body |
magenta.rs |
extern crate drm;
use std::io::Result as IoResult;
use std::thread::sleep;
use std::time::Duration;
fn main() -> IoResult<()>
{
let mut dev0 = drm::Device::first_card().unwrap();
let dev = dev0.set_master()
.map_err(|err| {
eprintln!("Failed to set master: {:?}", err);
err
... | <B:AsMut<[u32]>>(mut buffer_ref: B) {
let mut buffer = buffer_ref.as_mut();
for p in buffer.iter_mut() {
*p = 0xffff00ff;
}
}
| fill_buffer | identifier_name |
cli_ssh.py | '''
Created on Jun 16, 2014
@author: lwoydziak
'''
import pexpect
import sys
from dynamic_machine.cli_commands import assertResultNotEquals, Command
class SshCli(object):
LOGGED_IN = 0
def __init__(self, host, loginUser, debug = False, trace = False, log=None, port=22, pexpectObject=None):
se... | self.debug = True
self.trace = True
self._log = None
self._setupLog()
def connectWithSsh(self):
self._debugLog("Establishing connection to " + self.host)
self._connection = self.pexpect.spawn(
'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyCheck... | random_line_split | |
cli_ssh.py | '''
Created on Jun 16, 2014
@author: lwoydziak
'''
import pexpect
import sys
from dynamic_machine.cli_commands import assertResultNotEquals, Command
class SshCli(object):
LOGGED_IN = 0
def __init__(self, host, loginUser, debug = False, trace = False, log=None, port=22, pexpectObject=None):
|
def __del__(self):
self.closeCliConnectionTo()
def showOutputOnScreen(self):
self.debug = True
self.trace = True
self._log = None
self._setupLog()
def connectWithSsh(self):
self._debugLog("Establishing connection to " + self.host)
s... | self.pexpect = pexpect if not pexpectObject else pexpectObject
self.debug = debug
self.trace = trace
self.host = host
self._port = port
self._connection = None
self.modeList = []
self._log = log
self._bufferedCommands = None
self._bufferedMode = No... | identifier_body |
cli_ssh.py | '''
Created on Jun 16, 2014
@author: lwoydziak
'''
import pexpect
import sys
from dynamic_machine.cli_commands import assertResultNotEquals, Command
class SshCli(object):
LOGGED_IN = 0
def __init__(self, host, loginUser, debug = False, trace = False, log=None, port=22, pexpectObject=None):
se... |
else:
self._debugLog("Buffering command " + command)
def flush(self):
if self._bufferedCommands is None:
return
self._connection.sendline(str(self._bufferedCommands))
self._bufferedCommands = None
def buffering(self):
return self._bu... | self.flush() | conditional_block |
cli_ssh.py | '''
Created on Jun 16, 2014
@author: lwoydziak
'''
import pexpect
import sys
from dynamic_machine.cli_commands import assertResultNotEquals, Command
class SshCli(object):
LOGGED_IN = 0
def __init__(self, host, loginUser, debug = False, trace = False, log=None, port=22, pexpectObject=None):
se... | (self):
self.previousExpectLine = ""
if self._connection is not None and isinstance(self._connection.buffer, str):
self.previousExpectLine = self._connection.buffer
self._connection.buffer = ""
def _lastExpect(self):
constructLine = self.previousExpectLine
... | _resetExpect | identifier_name |
analyze_dxp.py | """
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction ... |
def merge_profile():
"""Reads sys.getdxp() and merges it into this module's cached copy.
We need this because sys.getdxp() 0s itself every time it's called."""
with _profile_lock:
new_profile = sys.getdxp()
if has_pairs(new_profile):
for first_inst in range(len(_cu... | """Forgets any execution profile that has been gathered so far."""
with _profile_lock:
sys.getdxp() # Resets the internal profile
global _cumulative_profile
_cumulative_profile = sys.getdxp() # 0s out our copy.
| identifier_body |
analyze_dxp.py | """
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction ... |
def seq():
for _, ops, count in common_pairs(profile):
yield "%s: %s\n" % (count, ops)
return ''.join(seq())
| profile = snapshot_profile() | conditional_block |
analyze_dxp.py | """
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction ... | (profile):
"""Returns the most common opcodes in order of descending frequency.
The result is a list of tuples of the form
(opcode, opname, # of occurrences)
"""
if has_pairs(profile) and profile:
inst_list = profile[-1]
else:
inst_list = profile
result = [(op,... | common_instructions | identifier_name |
analyze_dxp.py | """
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction ... |
def render_common_pairs(profile=None):
"""Renders the most common opcode pairs to a string in order of
descending frequency.
The result is a series of lines of the form:
# of occurrences: ('1st opname', '2nd opname')
"""
if profile is None:
profile = snapshot_profile()
... | return result
| random_line_split |
schema.js | (obj, options) {
if (!(this instanceof Schema))
return new Schema(obj, options);
this.paths = {};
this.subpaths = {};
this.virtuals = {};
this.nested = {};
this.inherits = {};
this.callQueue = [];
this._indexes = [];
this.methods = {};
this.statics = {};
this.tree = {};
this._requiredpaths ... | Schema | identifier_name | |
schema.js |
/*!
* Inherit from EventEmitter.
*/
Schema.prototype = Object.create( EventEmitter.prototype );
Schema.prototype.constructor = Schema;
/**
* Default middleware attached to a schema. Cannot be changed.
*
* This field is used to make sure discriminators don't get multiple copies of
* built-in middleware. Declare... | {
if (this.$__._id) {
return this.$__._id;
}
return this.$__._id = null == this._id
? null
: String(this._id);
} | identifier_body | |
schema.js | preSavingFromParent = true;
subdoc.save(function(err) {
cb(err);
});
}, function(error) {
for (var i = 0; i < subdocs.length; ++i) |
if (error) {
reject(error);
return;
}
resolve();
});
}).then(function() {
next();
done();
}, done);
}
}]
});
/**
* Schema as flat paths
*
* ####Example:
* {
* '_id' : SchemaType,
* , 'nested.... | {
delete subdocs[i].$__preSavingFromParent;
} | conditional_block |
schema.js | preSavingFromParent = true;
subdoc.save(function(err) {
cb(err);
});
}, function(error) {
for (var i = 0; i < subdocs.length; ++i) {
delete subdocs[i].$__preSavingFromParent;
}
if (error) {
reject(error);
return;
... | var oldObj = obj;
obj = {};
obj[options.typeKey] = oldObj;
}
}
// Get the type making sure to allow keys named "type"
// and default to mixed if not specified.
// { type: { type: String, default: 'freshcut' } }
var type = obj[options.typeKey] && (options.typeKey !== 'type' || !obj.type.... | random_line_split | |
contentRes.js | // import routes | import Routes from './../../client/routes/Routes';
import renderer from './renderer';
import template from './template';
import createStore from './createStore';
module.exports = (app, req, res) => {
// set up the redux store on the server side
const store = createStore(req);
// check all react routes vs req path a... | import { matchRoutes } from 'react-router-config'; | random_line_split |
RoomItem.js | /* @flow */
import React, { Component, PropTypes } from 'react';
import ReactNative from 'react-native';
import shallowEqual from 'shallowequal';
import Colors from '../../../Colors';
import AppText from '../AppText';
import ListItem from '../ListItem';
import Icon from '../Icon';
import Time from '../Time';
import Ac... | <ActionSheet visible={this.state.actionSheetVisible} onRequestClose={this._handleRequestClose}>
<ActionSheetItem onPress={this._handleInvite}>
Invite friends to group
</ActionSheetItem>
</ActionSheet>
</ListItem>
);
}
} | size={20}
/>
</TouchableOpacity>
| random_line_split |
react-imgix-bg.js | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__BackgroundImpl = exports.Background = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnPro... |
var PACKAGE_VERSION = "8.5.0";
var noop = function noop() {};
var findNearestWidth = function findNearestWidth(actualWidth) {
return (0, _findClosest2.default)(actualWidth, _targetWidths2.default);
};
var toFixed = function toFixed(dp, value) {
return +value.toFixed(dp);
};
var BackgroundImpl = function Backg... | { return obj && obj.__esModule ? obj : { default: obj }; } | identifier_body |
react-imgix-bg.js | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__BackgroundImpl = exports.Background = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnPro... |
var renderedSrc = function () {
var srcOptions = _extends({}, imgixParams, disableLibraryParam ? {} : { ixlib: "react-" + PACKAGE_VERSION }, {
width: width,
height: height,
fit: "crop",
dpr: dpr
});
return (0, _constructUrl2.default)(src, srcOptions);
}();
var style = _exten... | children
);
} | random_line_split |
react-imgix-bg.js | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__BackgroundImpl = exports.Background = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnPro... | (obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PACKAGE_VERSION = "8.5.0";
var noop = function noop() {};
var findNearestWidth = function findNearestWidth(actualWidth) {
return (0, _findClosest2.default)(actualWidth, _targetWidths2.default);
};
var toFixed = function toFixed(dp, value) {
re... | _interopRequireDefault | identifier_name |
react-imgix-bg.js | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__BackgroundImpl = exports.Background = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnPro... |
};
var _ref = function () {
var bothWidthAndHeightPassed = forcedWidth != null && forcedHeight != null;
if (bothWidthAndHeightPassed) {
return { width: forcedWidth, height: forcedHeight };
}
if (!hasDOMDimensions) {
return { width: undefined, height: undefined };
}
var ar = c... | {
ref(el);
} | conditional_block |
parameter-editor.component.ts | import { Component, Injector, Inject } from '@angular/core';
import { IGraphNode } from '../../../base-classes/node/NodeModule';
import { InputPort, OutputPort, InputPortTypes, OutputPortTypes } from '../../../base-classes/port/PortModule';
import { Viewer } from '../../../base-classes/viz/Viewer';
import { Flowchart... | (type: OutputPortTypes): string{
if(type == OutputPortTypes.Three){
return "Geometry";
}
else if(type == OutputPortTypes.Text){
return "Text Viewer";
}
else if(type == OutputPortTypes.Code){
return "Code Viewer";
}
else if(type == OutputPortTypes.Console... | getOutputTypeName | identifier_name |
parameter-editor.component.ts | import { Component, Injector, Inject } from '@angular/core';
import { IGraphNode } from '../../../base-classes/node/NodeModule';
import { InputPort, OutputPort, InputPortTypes, OutputPortTypes } from '../../../base-classes/port/PortModule';
import { Viewer } from '../../../base-classes/viz/Viewer';
import { Flowchart... |
updatePortName($event, port: InputPort|OutputPort): void{
let name: string = $event.srcElement.innerText;
// check for validity
name = name.replace(/[^\w]/gi, '');
if(name.trim().length > 0){
// put a timeout on this update or something similar to solve jumpiness
port.... | {
event.stopPropagation();
this.flowchartService.deletePort(type, portIndex);
} | identifier_body |
parameter-editor.component.ts | import { Component, Injector, Inject } from '@angular/core';
import { IGraphNode } from '../../../base-classes/node/NodeModule';
import { InputPort, OutputPort, InputPortTypes, OutputPortTypes } from '../../../base-classes/port/PortModule';
import { Viewer } from '../../../base-classes/viz/Viewer';
import { Flowchart... |
else{
return "Not Identifiable"
}
}
getOutputTypeName(type: OutputPortTypes): string{
if(type == OutputPortTypes.Three){
return "Geometry";
}
else if(type == OutputPortTypes.Text){
return "Text Viewer";
}
else if(type == OutputPortTypes.Code){
... | {
return "Slider";
} | conditional_block |
parameter-editor.component.ts | import { Component, Injector, Inject } from '@angular/core';
import { IGraphNode } from '../../../base-classes/node/NodeModule';
import { InputPort, OutputPort, InputPortTypes, OutputPortTypes } from '../../../base-classes/port/PortModule';
import { Viewer } from '../../../base-classes/viz/Viewer';
import { Flowchart... | OutputPortTypes.Text,
OutputPortTypes.Code,
OutputPortTypes.Console
];
constructor(injector: Injector, public dialog: MatDialog){
super(injector, "parameter-editor");
}
reset(){
this._node = undefined;
this._inputs = undefined;
this._outputs = und... |
outputPortOpts: OutputPortTypes[] = [
OutputPortTypes.Three, | random_line_split |
check_const.rs | != Mode::Var);
match self.tcx.const_qualif_map.borrow_mut().entry(expr.id) {
Entry::Occupied(entry) => return *entry.get(),
Entry::Vacant(entry) => {
// Prevent infinite recursion on re-entry.
entry.insert(PURE_CONST);
}
}
self... | let tcontents = ty::type_contents(self.tcx, node_ty);
let suffix = if tcontents.has_dtor() {
"destructors"
} else if tcontents.owns_owned() {
"owned pointers"
} else {
return
};
self.tcx.sess.span_err(e.span, &format!("mutable statics... | }
fn check_static_mut_type(&self, e: &ast::Expr) {
let node_ty = ty::node_id_to_type(self.tcx, e.id); | random_line_split |
check_const.rs | (..)) => {
// Count the function pointer.
v.add_qualif(NON_ZERO_SIZED);
}
Some(def::DefStatic(..)) => {
match v.mode {
Mode::Static | Mode::StaticMut => {}
Mode::Const => {
... | matched_pat | identifier_name | |
check_const.rs | != Mode::Var);
match self.tcx.const_qualif_map.borrow_mut().entry(expr.id) {
Entry::Occupied(entry) => return *entry.get(),
Entry::Vacant(entry) => {
// Prevent infinite recursion on re-entry.
entry.insert(PURE_CONST);
}
}
self... |
fn visit_pat(&mut self, p: &ast::Pat) {
match p.node {
ast::PatLit(ref lit) => {
self.global_expr(Mode::Const, &**lit);
}
ast::PatRange(ref start, ref end) => {
self.global_expr(Mode::Const, &**start);
self.global_expr(Mod... | {
assert!(self.mode == Mode::Var);
self.with_euv(Some(fn_id), |euv| euv.walk_fn(fd, b));
visit::walk_fn(self, fk, fd, b, s);
} | identifier_body |
PokerTableInfoDataSerializer.ts |
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder";
import { BitsReader } from "../../../../utils/BitsReader";
import { SerializerUtils } from "../../../../utils/SerializerUtils";
import { PokerTableInfoData } from "../data/PokerTableInfoData";
import { BinaryNetworkID } from "../../core/data/Bi... | (buffer: ArrayBufferBuilder, data: PokerTableInfoData): void {
data.gameNetworkIDVO = new BinaryNetworkID(data);
BinaryNetworkIDSerializer.deserialize(buffer, data.gameNetworkIDVO);
data.playersCount = buffer.getUint8();
data.mostChips = OptimizedBinaryNumberSerializer.deserialize( buff... | deserialize | identifier_name |
PokerTableInfoDataSerializer.ts | import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder";
import { BitsReader } from "../../../../utils/BitsReader";
import { SerializerUtils } from "../../../../utils/SerializerUtils";
import { PokerTableInfoData } from "../data/PokerTableInfoData";
import { BinaryNetworkID } from "../../core/data/Bin... |
}
} | data.playersCount = buffer.getUint8();
data.mostChips = OptimizedBinaryNumberSerializer.deserialize( buffer );
data.leastChips = OptimizedBinaryNumberSerializer.deserialize( buffer );
data.tableIndex = buffer.getUint16(); | random_line_split |
conf.py | # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Genera... | # base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'f... | # If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the | random_line_split |
DateTimeInput-dbg.js | short"),
displayFormat : oi18n.getTimePattern("short")
},
DateTime : {
valueFormat : oi18n.getDateTimePattern("short"), // does not include pattern but e.g "{1} {0}"
displayFormat : oi18n.getDateTimePattern("short") // does not include pattern but e.g "{1} {0}"
}
}
});
// build DateTi... | {
oPicker.setValueFormat(sPattern);
} | conditional_block | |
DateTimeInput-dbg.js | .getDateTimePattern("short"), // does not include pattern but e.g "{1} {0}"
displayFormat : oi18n.getDateTimePattern("short") // does not include pattern but e.g "{1} {0}"
}
}
});
// build DateTime formats from Date And Time values
["Time", "Date"].forEach(function(sType, nIndex) {
["valueFormat",... | {
var oBinding = this.getBinding("value");
if (oBinding && oBinding.oType && (oBinding.oType instanceof Date1)) {
var sPattern = oBinding.oType.getOutputPattern();
var oPicker = _getPicker.call(this);
if (oPicker.getValueFormat() != sPattern) {
oPicker.setValueFormat(sPattern);
}
if (oPicker.ge... | identifier_body | |
DateTimeInput-dbg.js | Prototype, $, oDevice) {
var oi18n = sap.m.getLocaleData();
$.extend(oPrototype, {
_types : {
Date : {
valueFormat : oi18n.getDatePattern("short"),
displayFormat : oi18n.getDatePattern("medium")
},
Time : {
valueFormat : oi18n.getTimePattern("short"),
displayFormat : oi18n.getTi... | _updateFormatFromBinding | identifier_name | |
DateTimeInput-dbg.js | * <b>Note:</b> Disabled controls cannot be focused and they are out of the tab-chain.
*/
enabled: { type: "boolean", group: "Behavior", defaultValue: true },
/**
* Defines whether the control can be modified by the user or not.
* <b>Note:</b> A user can tab to non-editable control, highlight it, and... |
// forward properties (also set default, may be different)
oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[sType].displayFormat);
oPicker.setValueFormat(this.getValueFormat() || this._types[sType].valueFormat);
if (this.getDateValue()) {
oPicker.setDateValue(this.getDateValue()); // don't se... | random_line_split | |
project-requirements-change.py | (c) 2013 OpenStack Foundation
#
# 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, so... | # openstack/requirements project so we can match them to the changes
with tempdir() as reqroot:
# Only clone requirements repo if no local repo is specified
# on the command line.
if args.reqs is None:
reqdir = os.path.join(reqroot, "openstack/requirements")
if ar... | args = grab_args()
branch = args.branch
failed = False
# build a list of requirements from the global list in the | random_line_split |
project-requirements-change.py | (c) 2013 OpenStack Foundation
#
# 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, so... | ():
"""Grab and return arguments"""
parser = argparse.ArgumentParser(
description="Check if project requirements have changed"
)
parser.add_argument('--local', action='store_true',
help='check local changes (not yet in git)')
parser.add_argument('branch', nargs='?', d... | grab_args | identifier_name |
project-requirements-change.py |
#
# 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 per... | if count != len(global_reqs[name]):
failed = True
print("Package %s%s requirement does not match "
"number of lines (%d) in "
"openstack/requirements" % (
name,
... | conditional_block | |
project-requirements-change.py | (c) 2013 OpenStack Foundation
#
# 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, so... | list_reqs_stripped = [r._replace(comment='') for r in list_reqs]
if len(list_reqs_stripped) != len(set(list_reqs_stripped)):
print("Requirements file has duplicate entries "
"for package %s : %r." % (name, list_reqs))
self.failed = True
... | def __init__(self, name, project):
self.name = name
self.reqs_by_file = {}
self.project = project
self.failed = False
@property
def reqs(self):
return {k: v for d in self.reqs_by_file.values()
for k, v in d.items()}
def extract_reqs(self, content):
... | identifier_body |
query-parameters-v2.spec.ts | import { asUrlQueryString } from './query-parameters-v2';
describe('asUrlQueryString', () => {
it('should create a empty query', () => {
expect(asUrlQueryString({})).toBe('');
}); | it('should create a query string with one argument', () => {
expect(asUrlQueryString({ foo: 'bar' })).toBe('?foo=bar');
});
it('should create a query string with multiple argument', () => {
expect(asUrlQueryString({ foo1: 'bar1', foo2: 'bar2' })).toBe('?foo1=bar1&foo2=bar2');
});
it('should expand a... | random_line_split | |
sigint.py | #
# Allows GTK 3 python applications to exit when CTRL-C is raised
# From https://bugzilla.gnome.org/show_bug.cgi?id=622084
#
# Author: Simon Feltman
# License: Presume same as pygobject
#
import sys
import signal
from typing import ClassVar, List
from gi.repository import GLib
class InterruptibleLoopContext:
... | raise KeyboardInterrupt | conditional_block | |
sigint.py | #
# Allows GTK 3 python applications to exit when CTRL-C is raised
# From https://bugzilla.gnome.org/show_bug.cgi?id=622084
#
# Author: Simon Feltman
# License: Presume same as pygobject
#
import sys
import signal
from typing import ClassVar, List
from gi.repository import GLib
class InterruptibleLoopContext:
... | (cls, user_data):
context = cls._loop_contexts[-1]
context._quit_by_sigint = True
context._loop_exit_func()
# keep the handler around until we explicitly remove it
return True
def __init__(self, loop_exit_func):
self._loop_exit_func = loop_exit_func
self._qu... | _glib_sigint_handler | identifier_name |
sigint.py | #
# Allows GTK 3 python applications to exit when CTRL-C is raised
# From https://bugzilla.gnome.org/show_bug.cgi?id=622084
#
# Author: Simon Feltman
# License: Presume same as pygobject
#
import sys
import signal
from typing import ClassVar, List
from gi.repository import GLib
class InterruptibleLoopContext: | """
Context Manager for GLib/Gtk based loops.
Usage of this context manager will install a single GLib unix signal handler
and allow for multiple context managers to be nested using this single handler.
"""
#: Global stack context loops. This is added to per InterruptibleLoopContext
#: ins... | random_line_split | |
sigint.py | #
# Allows GTK 3 python applications to exit when CTRL-C is raised
# From https://bugzilla.gnome.org/show_bug.cgi?id=622084
#
# Author: Simon Feltman
# License: Presume same as pygobject
#
import sys
import signal
from typing import ClassVar, List
from gi.repository import GLib
class InterruptibleLoopContext:
... |
def __exit__(self, exc_type, exc_value, traceback):
context = InterruptibleLoopContext._loop_contexts.pop()
assert self == context
# if the context stack is empty and we have a GLib signal source,
# remove the source from GLib and clear out the variable.
if (
n... | if sys.platform != 'win32' and not InterruptibleLoopContext._loop_contexts:
# Add a glib signal handler
source_id = GLib.unix_signal_add(
GLib.PRIORITY_DEFAULT, signal.SIGINT, self._glib_sigint_handler, None
)
InterruptibleLoopContext._signal_source_id = s... | identifier_body |
get_exact_record.rs |
use uuid::Uuid;
use rustorm::dao::{Dao, IsDao};
use rustorm::pool::ManagedPool;
use rustorm::em::EntityManager;
use rustorm::table::{Table, Column};
use rustorm::table::IsTable;
#[derive(Debug, Clone)]
pub struct Product {
pub product_id: Uuid,
pub name: String,
pub description: Option<String>,
}
impl... | extern crate rustorm;
extern crate uuid;
extern crate chrono;
extern crate rustc_serialize; | random_line_split | |
get_exact_record.rs | extern crate rustorm;
extern crate uuid;
extern crate chrono;
extern crate rustc_serialize;
use uuid::Uuid;
use rustorm::dao::{Dao, IsDao};
use rustorm::pool::ManagedPool;
use rustorm::em::EntityManager;
use rustorm::table::{Table, Column};
use rustorm::table::IsTable;
#[derive(Debug, Clone)]
pub struct Product {
... | data_type:"String".to_string(),
db_data_type:"character varying".to_string(),
is_primary:false, is_unique:false, not_null:true, is_inherited:false,
default:None,
comment:None,
foreign:None,
... | {
Table {
schema: "bazaar".to_string(),
name: "product".to_string(),
parent_table: None,
sub_table: vec![],
comment: None,
columns: vec![
Column{
name:"product_id".to_string(),
data_t... | identifier_body |
get_exact_record.rs | extern crate rustorm;
extern crate uuid;
extern crate chrono;
extern crate rustc_serialize;
use uuid::Uuid;
use rustorm::dao::{Dao, IsDao};
use rustorm::pool::ManagedPool;
use rustorm::em::EntityManager;
use rustorm::table::{Table, Column};
use rustorm::table::IsTable;
#[derive(Debug, Clone)]
pub struct Product {
... | () {
let url = "postgres://postgres:p0stgr3s@localhost/bazaar_v6";
let pool = ManagedPool::init(&url, 1).unwrap();
let db = pool.connect().unwrap();
let em = EntityManager::new(db.as_ref());
let pid = Uuid::parse_str("6db712e6-cc50-4c3a-8269-451c98ace5ad").unwrap();
let prod: Product = em.get_e... | main | identifier_name |
Gauge.tsx | } = this.props
const centerX = width / 2
const centerY = (height / 2) * 1.13
const radius = (Math.min(width, height) / 2) * 0.5
const {minLineWidth, minFontSize} = this.props.theme
const gradientThickness = Math.max(minLineWidth, radius / 4)
const labelValueFontSize = Math.max(minFontSize, rad... | ctx.fillStyle = valueColor
ctx.textBaseline = 'middle' | random_line_split | |
Gauge.tsx | {
private canvasRef: React.RefObject<HTMLCanvasElement>
public static defaultProps = {
theme: GAUGE_THEME_DARK,
}
constructor(props: Props) {
super(props)
this.canvasRef = React.createRef()
}
public componentDidMount() {
this.updateCanvas()
}
public | () {
this.updateCanvas()
}
public render() {
const {width, height} = this.props
return (
<canvas
className="gauge"
width={width}
height={height}
ref={this.canvasRef}
/>
)
}
private updateCanvas = () => {
this.resetCanvas()
const canvas = th... | componentDidUpdate | identifier_name |
Gauge.tsx | > {
private canvasRef: React.RefObject<HTMLCanvasElement>
public static defaultProps = {
theme: GAUGE_THEME_DARK,
}
constructor(props: Props) |
public componentDidMount() {
this.updateCanvas()
}
public componentDidUpdate() {
this.updateCanvas()
}
public render() {
const {width, height} = this.props
return (
<canvas
className="gauge"
width={width}
height={height}
ref={this.canvasRef}
/>
... | {
super(props)
this.canvasRef = React.createRef()
} | identifier_body |
Gauge.tsx | > {
private canvasRef: React.RefObject<HTMLCanvasElement>
public static defaultProps = {
theme: GAUGE_THEME_DARK,
}
constructor(props: Props) {
super(props)
this.canvasRef = React.createRef()
}
public componentDidMount() {
this.updateCanvas()
}
public componentDidUpdate() {
this.... | }
}
private drawGaugeLines = (ctx, xc, yc, radius, gradientThickness) => {
const {
degree,
lineCount,
lineColor,
lineStrokeSmall,
lineStrokeLarge,
tickSizeSmall,
tickSizeLarge,
smallLineCount,
} = this.props.theme
const arcStart = Math.PI * 0.75
... | {
// Use this color and the next to determine arc length
const color = sortedColors[c]
const nextColor = sortedColors[c + 1]
// adjust values by subtracting minValue from them
const adjustedValue = Number(color.value) - minValue
const adjustedNextValue = Number(nextColor.value) - mi... | conditional_block |
integration.py | import cgi
import hashlib
import http.server
import io
import os
import posixpath
import ssl
import threading
import time
import urllib.parse
import pyftpdlib.authorizers
import pyftpdlib.handlers
import pyftpdlib.servers
class FTPServer:
def __init__(self, port, root, report_size):
class FTPHandlerNoSI... | hsh = data[hashtype].value
hashtype = hashtype.split('sum')[0]
if verify_hash(data['file'].file, hashtype, hsh):
self.send_response(204)
self.end_headers()
else:
... | self.end_headers()
self.wfile.write(resp)
else:
hashtype = [k for k in data.keys() if k.endswith('sum')][0] | random_line_split |
integration.py | import cgi
import hashlib
import http.server
import io
import os
import posixpath
import ssl
import threading
import time
import urllib.parse
import pyftpdlib.authorizers
import pyftpdlib.handlers
import pyftpdlib.servers
class FTPServer:
def __init__(self, port, root, report_size):
class FTPHandlerNoSI... |
def main():
servers = [
FTPServer(2100, '/srv', True),
FTPServer(2101, '/srv', False),
HTTPServer(8000, None, '/srv', True),
HTTPServer(8001, None, '/srv', False),
HTTPServer(4430, '/cert.pem', '/srv', True),
HTTPServer(4431, '/cert.pem', '/srv', False),
]
... | self.server.serve_forever() | identifier_body |
integration.py | import cgi
import hashlib
import http.server
import io
import os
import posixpath
import ssl
import threading
import time
import urllib.parse
import pyftpdlib.authorizers
import pyftpdlib.handlers
import pyftpdlib.servers
class FTPServer:
def __init__(self, port, root, report_size):
class FTPHandlerNoSI... |
except KeyboardInterrupt:
pass
if __name__ == '__main__':
main()
| time.sleep(1) | conditional_block |
integration.py | import cgi
import hashlib
import http.server
import io
import os
import posixpath
import ssl
import threading
import time
import urllib.parse
import pyftpdlib.authorizers
import pyftpdlib.handlers
import pyftpdlib.servers
class FTPServer:
def __init__(self, port, root, report_size):
class FTPHandlerNoSI... | (http.server.BaseHTTPRequestHandler):
def do_GET(self):
path = self.path.split('?', 1)[0].split('#', 1)[0]
path = urllib.parse.unquote(path)
path = posixpath.normpath(path)
path = os.path.join(root, path.lstrip('/'))
try:
... | RequestHandler | identifier_name |
im_export.py | # -* coding: utf-8 *-
from PyQt4 import QtGui
from collector.ui.gen.im_export import Ui_Dialog
from collector.ui.views import Dialog
from collector.ui.helpers.customtoolbar import CustomToolbar
from collector.core.controller import get_manager
from collector.core.plugin import PluginExporter, PluginImporter
import logg... | (BaseDialog):
"""
ExportDialog
------------
"""
# TODO
filter_ = PluginExporter
def customize(self):
super(ExportDialog, self).customize()
self.setWindowTitle(self.tr("Export"))
class ImportDialog(BaseDialog):
"""
ImportDialog
------------
"""
filter_ ... | ExportDialog | identifier_name |
im_export.py | # -* coding: utf-8 *-
from PyQt4 import QtGui
from collector.ui.gen.im_export import Ui_Dialog
from collector.ui.views import Dialog
from collector.ui.helpers.customtoolbar import CustomToolbar
from collector.core.controller import get_manager
from collector.core.plugin import PluginExporter, PluginImporter
import logg... |
class ExportView(Dialog):
"""Properties view"""
def get_widget(self, params):
return ExportDialog(self.parent)
| """Properties view"""
def get_widget(self, params):
return ImportDialog(self.parent) | identifier_body |
im_export.py | # -* coding: utf-8 *-
from PyQt4 import QtGui
from collector.ui.gen.im_export import Ui_Dialog
from collector.ui.views import Dialog
from collector.ui.helpers.customtoolbar import CustomToolbar
from collector.core.controller import get_manager
from collector.core.plugin import PluginExporter, PluginImporter
import logg... |
# Toolbar
items.append({'class': 'spacer'})
CustomToolbar(self.toolbar, items, self.select_plugin)
if not len(plugins):
self.toolbar.hide()
self.label_noplugins.show()
def select_plugin(self, uri):
"""Select plugin callback"""
params = self.... | plugin = man.get(i)
items.append(
{'class': 'link', 'name': plugin.get_name(),
'path': 'plugin/' + plugin.get_id(),
'image': plugin.icon}
) | conditional_block |
im_export.py | # -* coding: utf-8 *-
from PyQt4 import QtGui
from collector.ui.gen.im_export import Ui_Dialog
from collector.ui.views import Dialog
from collector.ui.helpers.customtoolbar import CustomToolbar
from collector.core.controller import get_manager
from collector.core.plugin import PluginExporter, PluginImporter
import logg... | super(BaseDialog, self).__init__(parent)
self.setupUi(self)
self.customize()
def customize(self):
self.label_noplugins.hide()
plugins = self.get_plugins()
man = get_manager('plugin')
items = []
for i in plugins:
plugin = man.get(i)
... | Common parts for ImportDialog and ExportDialog
"""
def __init__(self, parent=None): | random_line_split |
Root.test.tsx | import React from 'react';
import { RenderResult } from '@testing-library/react';
import { addDays } from 'date-fns';
import { focusDay } from 'test/actions';
import { getDayButton, queryMonthGrids } from 'test/po';
import { customRender } from 'test/render';
import { freezeBeforeAll } from 'test/utils';
import { de... | (dayPickerProps: DayPickerProps = {}) {
renderResult = customRender(<Root />, dayPickerProps);
container = renderResult.container;
}
describe('when the number of months is 1', () => {
const props: DayPickerProps = { numberOfMonths: 1 };
beforeEach(() => {
setup(props);
});
test('should display one mont... | setup | identifier_name |
Root.test.tsx | import React from 'react';
import { RenderResult } from '@testing-library/react';
import { addDays } from 'date-fns';
import { focusDay } from 'test/actions';
import { getDayButton, queryMonthGrids } from 'test/po';
import { customRender } from 'test/render';
import { freezeBeforeAll } from 'test/utils';
import { de... | describe('when the number of months is 1', () => {
const props: DayPickerProps = { numberOfMonths: 1 };
beforeEach(() => {
setup(props);
});
test('should display one month grid', () => {
expect(queryMonthGrids()).toHaveLength(1);
});
});
describe('when the number of months is greater than 1', () => {... | container = renderResult.container;
}
| random_line_split |
Root.test.tsx | import React from 'react';
import { RenderResult } from '@testing-library/react';
import { addDays } from 'date-fns';
import { focusDay } from 'test/actions';
import { getDayButton, queryMonthGrids } from 'test/po';
import { customRender } from 'test/render';
import { freezeBeforeAll } from 'test/utils';
import { de... |
describe('when the number of months is 1', () => {
const props: DayPickerProps = { numberOfMonths: 1 };
beforeEach(() => {
setup(props);
});
test('should display one month grid', () => {
expect(queryMonthGrids()).toHaveLength(1);
});
});
describe('when the number of months is greater than 1', () =>... | {
renderResult = customRender(<Root />, dayPickerProps);
container = renderResult.container;
} | identifier_body |
experiments_service.py | # PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
... |
# This function performs an exact search by identifier
def find(f, seq):
""" Retrieves object by identifier
return experiment object
:type f: int
:param f: current value of identifier
:type seq: string
:param seq: value to search for
:rtype: Experiment
:return: Returns Experiment o... | """ Retrieves all experiments in json format
return experiments in json format
:type url: string
:param url: request url
:type args: string
:param args: request parameters
:rtype: list
:return: Returns list of Experiment objects in json format if success raises exception otherwise
"... | identifier_body |
experiments_service.py | # PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
... | # get all experiments as list of Experiment objects
def get_experiment_as_objects(url, args):
""" Retrieves all experiments as Experiment objects
return list of Experiment objects
:type url: string
:param url: request url
:type args: string
:param args: request parameters
:rtype: list
... | log.debug("JSON deserialization:")
log.debug(lookup_object_as_json_string)
return lookup_object_as_json_string
| random_line_split |
experiments_service.py | # PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
... | (f, seq):
""" Retrieves object by identifier
return experiment object
:type f: int
:param f: current value of identifier
:type seq: string
:param seq: value to search for
:rtype: Experiment
:return: Returns Experiment object if object found None otherwise
"""
for item in seq... | find | identifier_name |
experiments_service.py | # PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
... |
return response
# This function get all experiments in json format
def get_experiments_as_json(url, args):
""" Retrieves all experiments in json format
return experiments in json format
:type url: string
:param url: request url
:type args: string
:param args: request parameters
:rt... | raise Exception ("Error ocurred. Cannot load list of experiments.") | conditional_block |
statics-and-consts.rs | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
//~ MONO_ITEM static statics_and_consts::STATIC1[0]
//~ MONO_ITEM fn statics_and_consts::foo[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[1]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[2]
| {
foo();
let _ = STATIC1;
0
} | identifier_body |
statics-and-consts.rs | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | (_: isize, _: *const *const u8) -> isize {
foo();
let _ = STATIC1;
0
}
//~ MONO_ITEM static statics_and_consts::STATIC1[0]
//~ MONO_ITEM fn statics_and_consts::foo[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[1]
//~ MONO_ITEM stat... | start | identifier_name |
statics-and-consts.rs | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
static STATIC1: i64 = {
const STATIC1_CONST1: i64 = 2;
1 + CONST1 as i64 + STATIC1_CONST1
};
const CONST1: i64 = {
const CONST1_1: i64 = {
const CONST1_1_1: i64 = 2;
CONST1_1_1 + 1
};
1 + CONST1_1 as i64
};
fn foo() {
let _ = {
const CONST2: i64 = 0;
static STA... | // ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager
#![deny(dead_code)]
#![feature(start)] | random_line_split |
CivicDataFetcher.ts | import * as request from 'superagent';
import {
EvidenceLevel,
ICivicEvidenceSummary,
ICivicGeneSummary,
ICivicVariantSummary,
} from '../model/Civic';
type CivicAPIGene = {
id: number;
name: string;
description: string;
variants: Array<CivicAPIGeneVariant>;
};
type CivicAPIGeneVarian... | (
variantArray: CivicAPIGeneVariant[]
): { [variantName: string]: number } {
let variantMap: { [variantName: string]: number } = {};
if (variantArray && variantArray.length > 0) {
variantArray.forEach(function(variant) {
variantMap[variant.name] = variant.id;
});
}
return... | createVariantMap | identifier_name |
CivicDataFetcher.ts | import * as request from 'superagent';
import {
EvidenceLevel,
ICivicEvidenceSummary,
ICivicGeneSummary,
ICivicVariantSummary,
} from '../model/Civic';
type CivicAPIGene = {
id: number;
name: string;
description: string;
variants: Array<CivicAPIGeneVariant>;
};
type CivicAPIGeneVarian... | evidence =>
evidence.evidence_direction === EvidenceDirection.Supports &&
filter(evidence)
);
filteredEvidences.sort((a, b) => {
const aLevel = a.evidence_level;
const bLevel = b.evidence_level;
if (aLevel === undefined && bLevel === undefined) {
... | function findSupportingEvidences(
evidences: Evidence[],
filter: (evidence: Evidence) => boolean = () => true
): Evidence[] {
const filteredEvidences = evidences.filter( | random_line_split |
CivicDataFetcher.ts | import * as request from 'superagent';
import {
EvidenceLevel,
ICivicEvidenceSummary,
ICivicGeneSummary,
ICivicVariantSummary,
} from '../model/Civic';
type CivicAPIGene = {
id: number;
name: string;
description: string;
variants: Array<CivicAPIGeneVariant>;
};
type CivicAPIGeneVarian... | evidenceCounts: countEvidenceTypes(result.evidence_items),
evidences: supportingEvidences.map(summarizeEvidence),
};
});
}
}
export default CivicAPI;
| {
return request
.get('https://civicdb.org/api/variants/' + id)
.then(response => {
const result = response.body;
const supportingEvidences = findSupportingEvidences(
result.evidence_items
);
return {
... | identifier_body |
CreateGroupData.ts | import {create} from "../../common/utils/EntityUtils.js"
import {TypeRef, downcast} from "@tutao/tutanota-utils"
import type {TypeModel} from "../../common/EntityTypes.js"
export const CreateGroupDataTypeRef: TypeRef<CreateGroupData> = new TypeRef("sys", "CreateGroupData")
export const _TypeModel: TypeModel = {
"nam... | "id": 362,
"type": "Bytes",
"cardinality": "One",
"final": false,
"encrypted": false
},
"symEncPrivKey": {
"id": 361,
"type": "Bytes",
"cardinality": "One",
"final": false,
"encrypted": false
}
},
"associations": {},
"app": "sys",
"version": "72"
}
export function createCreateGr... | "symEncGKey": { | random_line_split |
CreateGroupData.ts | import {create} from "../../common/utils/EntityUtils.js"
import {TypeRef, downcast} from "@tutao/tutanota-utils"
import type {TypeModel} from "../../common/EntityTypes.js"
export const CreateGroupDataTypeRef: TypeRef<CreateGroupData> = new TypeRef("sys", "CreateGroupData")
export const _TypeModel: TypeModel = {
"nam... |
export type CreateGroupData = {
_type: TypeRef<CreateGroupData>;
_id: Id;
adminEncGKey: Uint8Array;
customerEncUserGroupInfoSessionKey: null | Uint8Array;
encryptedName: Uint8Array;
listEncSessionKey: Uint8Array;
mailAddress: null | string;
pubKey: Uint8Array;
symEncGKey: Uint8Array;
symEncPrivKey: Uint8Ar... | {
return Object.assign(create(_TypeModel, CreateGroupDataTypeRef), downcast<CreateGroupData>(values))
} | identifier_body |
CreateGroupData.ts | import {create} from "../../common/utils/EntityUtils.js"
import {TypeRef, downcast} from "@tutao/tutanota-utils"
import type {TypeModel} from "../../common/EntityTypes.js"
export const CreateGroupDataTypeRef: TypeRef<CreateGroupData> = new TypeRef("sys", "CreateGroupData")
export const _TypeModel: TypeModel = {
"nam... | (values?: Partial<CreateGroupData>): CreateGroupData {
return Object.assign(create(_TypeModel, CreateGroupDataTypeRef), downcast<CreateGroupData>(values))
}
export type CreateGroupData = {
_type: TypeRef<CreateGroupData>;
_id: Id;
adminEncGKey: Uint8Array;
customerEncUserGroupInfoSessionKey: null | Uint8Array;
... | createCreateGroupData | identifier_name |
win32.py | #!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get_screens(self):
screens = []
def en... | (self, mode):
assert mode.screen is self
if not self._initial_mode:
self._initial_mode = self.get_mode()
r = _user32.ChangeDisplaySettingsExW(self.get_device_name(),
byref(mode._mode),
None,
... | set_mode | identifier_name |
win32.py | #!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get_screens(self):
screens = []
def en... | def __init__(self, display, hwnd, hdc):
super(Win32Canvas, self).__init__(display)
self.hwnd = hwnd
self.hdc = hdc | identifier_body | |
win32.py | #!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
| def enum_proc(hMonitor, hdcMonitor, lprcMonitor, dwData):
r = lprcMonitor.contents
width = r.right - r.left
height = r.bottom - r.top
screens.append(
Win32Screen(self, hMonitor, r.left, r.top, width, height))
return True
enum_pr... | class Win32Display(Display):
def get_screens(self):
screens = [] | random_line_split |
win32.py | #!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get_screens(self):
screens = []
def en... |
modes.append(Win32ScreenMode(self, mode))
i += 1
return modes
def get_mode(self):
mode = DEVMODE()
mode.dmSize = sizeof(DEVMODE)
_user32.EnumDisplaySettingsW(self.get_device_name(),
ENUM_CURRENT_SETTINGS,
... | break | conditional_block |
app.spec.ts | import {
it,
inject,
injectAsync,
beforeEachProviders
} from '@angular/core/testing';
// to use Translate Service, we need Http, and to test Http we need to mock the backend
import {
BaseRequestOptions,
Http,
Response,
ResponseOptions
} from '@angular/http... | }));
}); |
it('should have a non-empty appHeaderMenuModel', inject([AppComponent], (app: AppComponent) => {
expect(app.appHeaderMenuModel.length).toBeGreaterThan(0); | random_line_split |
variables_0.js | var searchData=
[
['addra',['addrA',['../a00028.html#a3cae9d5d9bef65c080151c7a068aba59',1,'ip_addr']]],
['addrb',['addrB',['../a00028.html#affc4950defbac0add14648c302d1cca3',1,'ip_addr']]],
['addrc',['addrC',['../a00028.html#a2965c835c1e5f0a593e0ce78a9e22596',1,'ip_addr']]],
['addrd',['addrD',['../a00028.html#a... | ['arpcache',['arpcache',['../a00108.html#a7489612cbdbbec7ea6dc20811cafd90f',1,'network.h']]]
]; | random_line_split | |
index.ts | /* eslint-disable @typescript-eslint/ban-ts-ignore */
import crypto from 'crypto';
// @ts-ignore
import cryptoAsync from '@ronomon/crypto-async';
import {
CreateDigest,
CreateRandomBytes,
HashAlgorithms,
HexString,
KeyEncodings
} from '@otplib/core';
export const createDigest: CreateDigest<Promise<string>> =... | algorithm,
Buffer.from(hmacKey, 'hex'),
Buffer.from(counter, 'hex'),
(error: string, hmac: Buffer): void => {
if (error) {
reject(error);
return;
}
resolve(hmac);
}
);
});
return digest.toString('hex');
};
export const createRandomBytes... | const digest = await new Promise<Buffer>((resolve, reject): void => {
cryptoAsync.hmac( | random_line_split |
index.ts | /* eslint-disable @typescript-eslint/ban-ts-ignore */
import crypto from 'crypto';
// @ts-ignore
import cryptoAsync from '@ronomon/crypto-async';
import {
CreateDigest,
CreateRandomBytes,
HashAlgorithms,
HexString,
KeyEncodings
} from '@otplib/core';
export const createDigest: CreateDigest<Promise<string>> =... |
resolve(hmac);
}
);
});
return digest.toString('hex');
};
export const createRandomBytes: CreateRandomBytes<Promise<string>> = async (
size: number,
encoding: KeyEncodings
): Promise<string> => {
return crypto.randomBytes(size).toString(encoding);
};
| {
reject(error);
return;
} | conditional_block |
issue-23442.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <K:UnifyKey> {
values: Delegate<K>,
}
pub struct Delegate<K>(PhantomData<K>);
fn main() {}
| UnificationTable | identifier_name |
issue-23442.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-pass
... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. | random_line_split |
issue-23442.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {} | identifier_body | |
game.gb.integration.js | import {DisassembleBytesWithRecursiveTraversalIntoOptimizedArray, DisassembleBytesWithRecursiveTraversalFormatted, DisassembleBytesWithRecursiveTraversalFormattedWithHeader} from '../../disassembler/recursiveTraversalDisassembler/RecursiveTraversalDisassembler';
import * as assert from 'assert';
import {describe, it, b... | import {getRomTitle, parseGBHeader} from '../../disassembler/romInformation/romInformation'
use(chaiJestSnapshot);
const romPath = './roms/game/';
const romData = fs.readFileSync(`${romPath}/game.gb`);
const romName = 'game.gb';
before(function () {
chaiJestSnapshot.resetSnapshotRegistry();
});
beforeEach(function... | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.