file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
log.js
/** * @file log.js */ import window from 'global/window'; /** * Log plain debug messages */ const log = function(){ _logType(null, arguments); }; /** * Keep a history of log messages * @type {Array} */ log.history = []; /** * Log error messages */ log.error = function(){ _logType('...
else { // ie8 doesn't allow error.apply, but it will just join() the array anyway console[type](argsArray.join(' ')); } } export default log;
{ console[type].apply(console, argsArray); }
conditional_block
main.js
var dp = jQuery; dp.noConflict(); dp(document).ready(function() { //SMOOTH SCROLL dp('a[href^="#"]').bind('click.smoothscroll', function(e) { e.preventDefault(); dp('html,body').animate({ scrollTop: dp(this.hash).offset().top }, 1200); }); //SUPER SLIDES // dp('...
/* REMOVE THIS if you want to repeat the animation after the element not in view else { $(this).stop().animate({ opacity: 0 }); $(this).removeAttr('style'); }*/ }); dp('.animaze').stop().animate({ opacity: 0 }); //SERVICES ...
{ dp(this).stop().animate({ opacity: 1, top: '0px' }, 500); }
conditional_block
main.js
var dp = jQuery; dp.noConflict(); dp(document).ready(function() { //SMOOTH SCROLL dp('a[href^="#"]').bind('click.smoothscroll', function(e) { e.preventDefault(); dp('html,body').animate({ scrollTop: dp(this.hash).offset().top }, 1200); }); //SUPER SLIDES // dp('...
effect: "fadeOutIn", continuous: true, updateBefore: true }); //TEXT ROTATOR dp(".rotatez").textrotator({ animation: "fade", separator: ",", speed: 1700 }); //PORTFOLIO dp('.portfolioContainer').mixitup({ filterSelector: '.portfolioFilter...
speed: 350, prevNext: false, useCSS: true,
random_line_split
util.py
# Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing # # Add python-bitcoinrpc to module search path: import os import sys sys.path.append...
for i in range(4): from_dir = os.path.join("cache", "node"+str(i)) to_dir = os.path.join(test_dir, "node"+str(i)) shutil.copytree(from_dir, to_dir) def start_nodes(num_nodes, dir): # Start bitcoinds, and wait for RPC interface to be up and running: devnull = open("/dev/null", "w+...
os.remove(debug_log("cache", i))
conditional_block
util.py
# Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing # # Add python-bitcoinrpc to module search path: import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__f...
# Copyright (c) 2014 The Bitcoin Core developers
random_line_split
util.py
# Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing # # Add python-bitcoinrpc to module search path: import os import sys sys.path.append...
(rpc_connections): """ Wait until everybody has the same transactions in their memory pools """ while True: pool = set(rpc_connections[0].getrawmempool()) num_match = 1 for i in range(1, len(rpc_connections)): if set(rpc_connections[i].getrawmempool()) == pool: ...
sync_mempools
identifier_name
util.py
# Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing # # Add python-bitcoinrpc to module search path: import os import sys sys.path.append...
def connect_nodes(from_connection, node_num): ip_port = "127.0.0.1:"+str(START_P2P_PORT+node_num) from_connection.addnode(ip_port, "onetry") def assert_equal(thing1, thing2): if thing1 != thing2: raise AssertionError("%s != %s"%(str(thing1),str(thing2)))
for bitcoind in bitcoind_processes: bitcoind.wait() del bitcoind_processes[:]
identifier_body
install-shrinkwrapped-git.js
var fs = require('fs') var path = require('path') var resolve = path.resolve var osenv = require('osenv') var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test var npm = require('../../lib/npm') var common = require('../common-tap') var chain = require('slide').chain var mockPath...
(cb) { // Setup parent package mkdirp.sync(parentPath) fs.writeFileSync(resolve(parentPath, 'package.json'), parentPackageJSON) process.chdir(parentPath) // Setup child mkdirp.sync(childPath) fs.writeFileSync(resolve(childPath, 'package.json'), childPackageJSON) // Setup npm and then git npm.load({...
setup
identifier_name
install-shrinkwrapped-git.js
var fs = require('fs') var path = require('path') var resolve = path.resolve var osenv = require('osenv') var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test var npm = require('../../lib/npm') var common = require('../common-tap') var chain = require('slide').chain var mockPath...
function prepareChildAndGetRefs (cb) { var opts = { cwd: childPath, env: { PATH: process.env.PATH } } chain([ [fs.writeFile, path.join(childPath, 'README.md'), ''], git.chainableExec(['add', 'README.md'], opts), git.chainableExec(['commit', '-m', 'Add README'], opts), git.chainableExec(['log', '--p...
process.chdir(osenv.tmpdir()) rimraf.sync(mockPath) rimraf.sync(common['npm_config_cache']) }
random_line_split
install-shrinkwrapped-git.js
var fs = require('fs') var path = require('path') var resolve = path.resolve var osenv = require('osenv') var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test var npm = require('../../lib/npm') var common = require('../common-tap') var chain = require('slide').chain var mockPath...
}) }
{ this.removeListener('data', findChild) cb(null, [daemon, cpid[1]]) }
conditional_block
install-shrinkwrapped-git.js
var fs = require('fs') var path = require('path') var resolve = path.resolve var osenv = require('osenv') var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test var npm = require('../../lib/npm') var common = require('../common-tap') var chain = require('slide').chain var mockPath...
function cleanup () { process.chdir(osenv.tmpdir()) rimraf.sync(mockPath) rimraf.sync(common['npm_config_cache']) } function prepareChildAndGetRefs (cb) { var opts = { cwd: childPath, env: { PATH: process.env.PATH } } chain([ [fs.writeFile, path.join(childPath, 'README.md'), ''], git.chainableExec(...
{ // Setup parent package mkdirp.sync(parentPath) fs.writeFileSync(resolve(parentPath, 'package.json'), parentPackageJSON) process.chdir(parentPath) // Setup child mkdirp.sync(childPath) fs.writeFileSync(resolve(childPath, 'package.json'), childPackageJSON) // Setup npm and then git npm.load({ r...
identifier_body
machine_specs.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2013 Contributor # # 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 Li...
model = relation(Model, backref=backref('machine_specs', uselist=False)) cpu = relation(Cpu) machine_specs = MachineSpecs.__table__ machine_specs.primary_key.name='machine_specs_pk' #for now, need a UK on model_id. WILL be a name AND a model_id as UK. machine_specs.append_constraint( UniqueConstraint('m...
comments = Column('comments', String(255), nullable=True)
random_line_split
machine_specs.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2013 Contributor # # 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 Li...
if len(sess.query(MachineSpecs).all()) < 1: from sqlalchemy import insert specs = [["hs20-884345u", "xeon_2660", 2, 8192, 'scsi', 36, 2], ["hs21-8853l5u", "xeon_2660", 2, 8192, 'scsi', 68, 2], ["poweredge_6650", "xeon_3000", 4, 16384, 'scsi', 36, 2], ["bl45p", "op...
identifier_body
machine_specs.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2013 Contributor # # 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 Li...
(Base): """ Captures the configuration hardware components for a given model """ #TODO: Maybe this entire table is in fact a part of the model "subtype" _def_cpu_cnt = { 'workstation':1, 'blade': 2, 'rackmount' : 4 } _def_nic_cnt = { 'workstation':1, 'blade': 2, 'rackmount' : 2 } _def_memory = { '...
MachineSpecs
identifier_name
machine_specs.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2013 Contributor # # 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 Li...
try: dbmodel = sess.query(Model).filter_by(name=ms[0]).one() dbcpu = sess.query(Cpu).filter_by(name=ms[1]).one() cpu_quantity = ms[2] memory = ms[3] disk_type = 'local' controller_type = ms[4] disk_capacity =...
conditional_block
rastrigin.rs
// Copyright 2016 Martin Ankerl. // // 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...
{ // command line args: dimension, number of evaluations let args: Vec<String> = env::args().collect(); let dim = args[1].parse::<usize>().unwrap(); // initial search space for each dimension let initial_min_max = vec![(-5.12, 5.12); dim]; // initialize differential evolution let mut de = ...
identifier_body
rastrigin.rs
// Copyright 2016 Martin Ankerl. // // 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...
(pos: &[f32]) -> f32 { pos.iter().fold(0.0, |sum, x| sum + x * x - 10.0 * (2.0 * PI * x).cos() + 10.0) } fn main() { // command line args: dimension, number of evaluations let args: Vec<String> = env::args().collect(); let dim = args[1].parse::<usize>().unwrap(); // initial search space f...
rastrigin
identifier_name
rastrigin.rs
// Copyright 2016 Martin Ankerl. //
// 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. extern crate differ...
random_line_split
big64.js
import test from 'ava';
expected = get64(...expected); t.deepEqual(big64(a, o), expected); } macro.title = (providedTitle, a, o, expected) => `${providedTitle || ''} big64(${a}, ${o}) === ${expected}`.trim(); test( macro, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], 0, [0x00_00_00_00, 0x00_00_00_00], ); test( macro, [0xff, 0x0...
import {big64, get64} from '../../src/index.js'; function macro(t, a, o, expected) {
random_line_split
big64.js
import test from 'ava'; import {big64, get64} from '../../src/index.js'; function macro(t, a, o, expected)
macro.title = (providedTitle, a, o, expected) => `${providedTitle || ''} big64(${a}, ${o}) === ${expected}`.trim(); test( macro, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], 0, [0x00_00_00_00, 0x00_00_00_00], ); test( macro, [0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], 0, [0xff_00_00_00, 0x00_00_0...
{ expected = get64(...expected); t.deepEqual(big64(a, o), expected); }
identifier_body
big64.js
import test from 'ava'; import {big64, get64} from '../../src/index.js'; function
(t, a, o, expected) { expected = get64(...expected); t.deepEqual(big64(a, o), expected); } macro.title = (providedTitle, a, o, expected) => `${providedTitle || ''} big64(${a}, ${o}) === ${expected}`.trim(); test( macro, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], 0, [0x00_00_00_00, 0x00_00_00_00], ); tes...
macro
identifier_name
color_world.py
from __future__ import division from direct.showbase.ShowBase import ShowBase from direct.actor.Actor import ActorNode from panda3d.core import WindowProperties, NodePath, LVector3 from panda3d.core import LineSegs, OrthographicLens, CardMaker from inputs import Inputs from sys import path import square try: path.i...
self.reward = None if pydaq: self.reward = pydaq.GiveReward() self.reward_count = 0 # self.color_map always corresponds to (r, g, b) # does not change during game, each game uses a particular color space self.color_dict = square.make_color_map(self.config['co...
self.config = config
conditional_block
color_world.py
from __future__ import division from direct.showbase.ShowBase import ShowBase from direct.actor.Actor import ActorNode from panda3d.core import WindowProperties, NodePath, LVector3 from panda3d.core import LineSegs, OrthographicLens, CardMaker from inputs import Inputs from sys import path import square try: path.i...
return task.again else: self.end_loop() return task.done def move_avatar(self, dt): # print 'velocity', self.velocity # this makes for smooth (correct speed) diagonal movement # print 'velocity', self.velocity magnitude = max(abs(self.velo...
self.reward.pumpOut() print 'give reward'
random_line_split
color_world.py
from __future__ import division from direct.showbase.ShowBase import ShowBase from direct.actor.Actor import ActorNode from panda3d.core import WindowProperties, NodePath, LVector3 from panda3d.core import LineSegs, OrthographicLens, CardMaker from inputs import Inputs from sys import path import square try: path.i...
if __name__ == "__main__": CW = ColorWorld() CW.base.run()
print 'setup display2' props = WindowProperties() props.set_cursor_hidden(True) props.set_foreground(False) if self.config.get('resolution'): props.setSize(700, 700) props.setOrigin(-int(self.config['resolution'][0] - 5), 5) else: props.setSize...
identifier_body
color_world.py
from __future__ import division from direct.showbase.ShowBase import ShowBase from direct.actor.Actor import ActorNode from panda3d.core import WindowProperties, NodePath, LVector3 from panda3d.core import LineSegs, OrthographicLens, CardMaker from inputs import Inputs from sys import path import square try: path.i...
(self): # print 'match this', self.color_tolerance # print self.color_list check_color = [j[0] < self.color_list[i] < j[1] for i, j in enumerate(self.color_tolerance)] # print check_color if all(check_color): return True else: return False def...
check_color_match
identifier_name
functions_e.js
['relative_5fname',['relative_name',['../classmemoryoracle_1_1descriptions_1_1MemoryDescription.html#a342c00383637914cc5b77d165016a41f',1,'memoryoracle::descriptions::MemoryDescription']]] ];
var searchData= [ ['read_5fregister',['read_register',['../classmemoryoracle_1_1frame_1_1Frame.html#ad5bb885a0accba9ff8f15c6b0e51bfc4',1,'memoryoracle::frame::Frame']]], ['read_5fvar',['read_var',['../classmemoryoracle_1_1frame_1_1Frame.html#ae54a6f6a355f6bb63162d2a78a761c30',1,'memoryoracle::frame::Frame']]], ['...
random_line_split
ShadowNode.js
var UTIL = require('./util'); var ShadowNode; module.exports = ShadowNode = function(patch,options){ this.shadow = options.shadow; this.native = options.native; this.elem = new patch.type(this); this.elem.props = patch.props; this.elem.props.children = patch.children; this.elem.state = this.elem.getInitia...
// component will update this.figure.setPatch(newPatch); // component did update } };
shadow : this,native : this.native }); return this.figure; } if (UTIL.differentPatch(lastPatch,newPatch)){
random_line_split
index.js
import { InvalidArgumentError } from '../errors/InvalidArgumentError'; import { NotImplementedError } from '../errors/NotImplementedError'; import mustache from 'mustache'; import '../utils/Function'; // The base class for a control export class Control { // The constructor of a control // id: The id of the control ...
// Removes a child control from the control // val: Either a controlId or a Control instance removeControl(val) { if (val instanceof Control) { delete this.controls[val.id]; } else { delete this.controls[val]; } } // Renders the control (and all its contained controls) // data: The object that cont...
{ if (!(control instanceof Control)) { throw new InvalidArgumentError('Cannot add sub-control because it is invalid'); } this.controls[control.id] = control; }
identifier_body
index.js
import { InvalidArgumentError } from '../errors/InvalidArgumentError'; import { NotImplementedError } from '../errors/NotImplementedError'; import mustache from 'mustache'; import '../utils/Function'; // The base class for a control export class Control { // The constructor of a control // id: The id of the control ...
(val) { if (val instanceof Control) { delete this.controls[val.id]; } else { delete this.controls[val]; } } // Renders the control (and all its contained controls) // data: The object that contains the data to substitute into the template // eventObj: Event related data for the event that caused the co...
removeControl
identifier_name
index.js
import { InvalidArgumentError } from '../errors/InvalidArgumentError'; import { NotImplementedError } from '../errors/NotImplementedError'; import mustache from 'mustache'; import '../utils/Function'; // The base class for a control export class Control { // The constructor of a control // id: The id of the control ...
this.id = id; this.template = template; if (template && localCSS) { // localize the CSS class names in the templates for (const oCN in localCSS) { const nCN = localCSS[oCN]; this.template = this.template .replace(new RegExp(`class="${oCN}"`, 'gi'), `class="${nCN}"`) .replace(new RegExp(...
{ throw new InvalidArgumentError('Cannot create the control because the template is not a string'); }
conditional_block
index.js
import { InvalidArgumentError } from '../errors/InvalidArgumentError'; import { NotImplementedError } from '../errors/NotImplementedError'; import mustache from 'mustache'; import '../utils/Function'; // The base class for a control export class Control { // The constructor of a control // id: The id of the control ...
this.onDOMUpdatedNotification(domContainerElement, eventObj); } if (this.controls) { for (let controlId in this.controls) { const control = this.controls[controlId]; control.onDOMUpdated(domContainerElement, eventObj); } } } // The Control classes that extend this type can add custom logic he...
random_line_split
ScriptBinding.py
"""Extension to execute code outside the Python shell window. This adds the following commands: - Check module does a full syntax check of the current module. It also runs the tabnanny to catch any inconsistent tabs. - Run module executes the module's code in the __main__ namespace. The window must have...
return filename def ask_save_dialog(self): msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?" mb = tkMessageBox.Message(title="Save Before Run or Check", message=msg, icon=tkMessageBox.QUESTION, ...
autosave = idleConf.GetOption('main', 'General', 'autosave', type='bool') if autosave and filename: self.editwin.io.save(None) else: reply = self.ask_save_dialog() self.editwin.text.focus_set() ...
conditional_block
ScriptBinding.py
"""Extension to execute code outside the Python shell window. This adds the following commands: - Check module does a full syntax check of the current module. It also runs the tabnanny to catch any inconsistent tabs. - Run module executes the module's code in the __main__ namespace. The window must have...
(self, event): filename = self.getfilename() if not filename: return 'break' if not self.checksyntax(filename): return 'break' if not self.tabnanny(filename): return 'break' def tabnanny(self, filename): f = open(filename, 'r') ...
check_module_event
identifier_name
ScriptBinding.py
"""Extension to execute code outside the Python shell window. This adds the following commands: - Check module does a full syntax check of the current module. It also runs the tabnanny to catch any inconsistent tabs. - Run module executes the module's code in the __main__ namespace. The window must have...
err.filename = filename self.colorize_syntax_error(msg, lineno, offset) except: msg = "*** " + str(err) self.errorbox("Syntax error", "There's an error in your program:\n" + msg) ...
random_line_split
ScriptBinding.py
"""Extension to execute code outside the Python shell window. This adds the following commands: - Check module does a full syntax check of the current module. It also runs the tabnanny to catch any inconsistent tabs. - Run module executes the module's code in the __main__ namespace. The window must have...
def colorize_syntax_error(self, msg, lineno, offset): text = self.editwin.text pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1) text.tag_add("ERROR", pos) char = text.get(pos) if char and char in IDENTCHARS: text.tag_add("ERROR", pos + " wordstar...
self.shell = shell = self.flist.open_shell() saved_stream = shell.get_warning_stream() shell.set_warning_stream(shell.stderr) f = open(filename, 'r') source = f.read() f.close() if '\r' in source: source = re.sub(r"\r\n", "\n", source) sour...
identifier_body
test_check_topic_list_on_zk_restart.py
import logging import pytest import sdk_cmd import sdk_install import sdk_plan import sdk_security import sdk_utils from tests import config from tests import test_utils LOG = logging.getLogger(__name__) @pytest.fixture(scope="module", autouse=True) def zookeeper_server(configure_security): service_options = ...
(kafka_server: dict): topic_create(kafka_server) topic_list_before = fetch_topic(kafka_server) for id in range(0, int(config.ZOOKEEPER_TASK_COUNT / 2)): restart_zookeeper_node(id, kafka_server) topic_list_after = fetch_topic(kafka_server) assert topic_list_before == topic_list_after
test_check_topic_list_on_zk_restart
identifier_name
test_check_topic_list_on_zk_restart.py
import logging import pytest import sdk_cmd import sdk_install import sdk_plan import sdk_security import sdk_utils from tests import config from tests import test_utils LOG = logging.getLogger(__name__) @pytest.fixture(scope="module", autouse=True) def zookeeper_server(configure_security): service_options = ...
def restart_zookeeper_node(id: int, kafka_server: dict): sdk_cmd.svc_cli( config.ZOOKEEPER_PACKAGE_NAME, config.ZOOKEEPER_SERVICE_NAME, "pod restart zookeeper-{}".format(id), ) sdk_plan.wait_for_completed_recovery(config.ZOOKEEPER_SERVICE_NAME) @pytest.mark.sanity @pytest.mark.z...
_, topic_list, _ = sdk_cmd.svc_cli( config.PACKAGE_NAME, kafka_server["service"]["name"], "topic list", parse_json=True ) return topic_list
identifier_body
test_check_topic_list_on_zk_restart.py
import logging import pytest import sdk_cmd import sdk_install import sdk_plan import sdk_security import sdk_utils from tests import config from tests import test_utils
LOG = logging.getLogger(__name__) @pytest.fixture(scope="module", autouse=True) def zookeeper_server(configure_security): service_options = { "service": {"name": config.ZOOKEEPER_SERVICE_NAME, "virtual_network_enabled": True} } zk_account = "test-zookeeper-service-account" zk_secret = "test-zo...
random_line_split
test_check_topic_list_on_zk_restart.py
import logging import pytest import sdk_cmd import sdk_install import sdk_plan import sdk_security import sdk_utils from tests import config from tests import test_utils LOG = logging.getLogger(__name__) @pytest.fixture(scope="module", autouse=True) def zookeeper_server(configure_security): service_options = ...
sdk_install.install( config.ZOOKEEPER_PACKAGE_NAME, config.ZOOKEEPER_SERVICE_NAME, config.ZOOKEEPER_TASK_COUNT, package_version=config.ZOOKEEPER_PACKAGE_VERSION, additional_options=service_options, timeout_seconds=30 * 60, ins...
service_options = sdk_utils.merge_dictionaries( {"service": {"service_account": zk_account, "service_account_secret": zk_secret}}, service_options, ) sdk_security.setup_security( config.ZOOKEEPER_SERVICE_NAME, service_account=zk_ac...
conditional_block
Charting.py
# Copyright (c) 2011 Nokia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribu...
import Common from common import Log # Try to import matplotlib for charting try: import matplotlib matplotlib.use("Agg") import pylab except ImportError, e: matplotlib = None pylab = None Log.warn("Matplotlib or one of it's dependencies not found (%s). Charts will not be generated." % e)...
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE.
random_line_split
Charting.py
# Copyright (c) 2011 Nokia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribu...
assert len(x) == len(y) if style == "line": plotFunc = pylab.plot elif style == "bar": plotFunc = pylab.bar else: raise RuntimeError("Unknown plotting style: %s" % style) if len(x) < sliceLength: plotFunc(x, y, *args, **kwargs) return slices = int(len(x) / sliceLeng...
identifier_body
Charting.py
# Copyright (c) 2011 Nokia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribu...
(x, y, sliceLength = 100, style = "line", *args, **kwargs): assert len(x) == len(y) if style == "line": plotFunc = pylab.plot elif style == "bar": plotFunc = pylab.bar else: raise RuntimeError("Unknown plotting style: %s" % style) if len(x) < sliceLength: plotFunc(x, y, *args,...
slicePlot
identifier_name
Charting.py
# Copyright (c) 2011 Nokia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribu...
slices = int(len(x) / sliceLength) pylab.figure(figsize = (8, slices * 1)) for i in range(slices): pylab.subplot(slices, 1, i + 1) plotFunc(x[i * sliceLength: (i + 1) * sliceLength], y[i * sliceLength: (i + 1) * sliceLength], *args, **kwargs)
plotFunc(x, y, *args, **kwargs) return
conditional_block
MobilePromptSample.tsx
/** * Copyright 2020 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...
import {ReactComponent as CelebrateSvg} from 'assets/celebrate.svg'; /** * MobilePromptSample that shows how a mobile prompt can be used. */ const MobilePromptSample: React.FC = () => { const [isVisible, setIsVisible] = useState(false); const onClickOpen = () => setIsVisible(true); const onClickClose = () =>...
import MobilePrompt from 'components/common/MobilePrompt'; import Button from 'muicss/lib/react/button';
random_line_split
broken.rs
// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, inc...
{ error: Error, message: ::capnp::message::Builder<::capnp::message::HeapAllocator>, } impl Request { pub fn new(error: Error, _size_hint: Option<::capnp::MessageSize>) -> Request { Request { error: error, message: ::capnp::message::Builder::new_default(), } } }...
Request
identifier_name
broken.rs
// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, inc...
} } } impl RequestHook for Request { fn get<'a>(&'a mut self) -> any_pointer::Builder<'a> { self.message.get_root().unwrap() } fn get_brand(&self) -> usize { 0 } fn send<'a>(self: Box<Self>) -> RemotePromise<any_pointer::Owned> { let pipeline = Pipeline::new(self...
message: ::capnp::message::Builder::new_default(),
random_line_split
store.ts
import {BaseObject} from "../lib/object"; import * as trusted from "../lib/trusted"; export interface IPkiItem extends IPkiCrl, IPkiCertificate, IPkiRequest, IPkiKey{ /** * DER | PEM */ format: string; /** * CRL | CERTIFICATE | KEY | REQUEST */ type: string; uri: string; pro...
export declare class ProviderSystem extends Provider { constructor(folder: string); } export declare class ProviderMicrosoft extends Provider { constructor(); } export declare class ProviderTSL extends Provider { constructor(url: string); } export declare class PkiStore { constructor(json: string); ...
random_line_split
store.ts
import {BaseObject} from "../lib/object"; import * as trusted from "../lib/trusted"; export interface IPkiItem extends IPkiCrl, IPkiCertificate, IPkiRequest, IPkiKey{ /** * DER | PEM */ format: string; /** * CRL | CERTIFICATE | KEY | REQUEST */ type: string; uri: string; pro...
icrosoft extends Provider { constructor(); } export declare class ProviderTSL extends Provider { constructor(url: string); } export declare class PkiStore { constructor(json: string); cash: CashJson; items: IPkiItem[]; /** * Возвращает набор элементов по фильтру * - если фильтр пус...
lass ProviderM
identifier_name
image_widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) Grigoriy A. Armeev, 2015 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as· # published by the Free Software Foundation. # # This program is distributed in the hope th...
# Cheers, Satary. # # This widget provides simple interface for showing pictures. # It can be resized saving aspect ratio and it provides signals for mouse click and hover. import sys, os from PyQt4 import QtGui,QtCore ''' This widget implements folders and pictures ''' class ImageWidget(QtGui.QWidget): def __init_...
random_line_split
image_widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) Grigoriy A. Armeev, 2015 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as· # published by the Free Software Foundation. # # This program is distributed in the hope th...
elf.emit(QtCore.SIGNAL("mouseHoverSignal"),self.coord,self.path)
conditional_block
image_widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) Grigoriy A. Armeev, 2015 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as· # published by the Free Software Foundation. # # This program is distributed in the hope th...
self,x,y): lblwidth=self.size().width() picwidth=self.picSize.width() lblheight=self.size().height() picheight=self.picSize.height() initwidth=self.initsize.width() initheight=self.initsize.height() x=int((x-(lblwidth-picwidth)/2.0)*initwidth/picwidth) y=i...
alcCoord(
identifier_name
image_widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) Grigoriy A. Armeev, 2015 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as· # published by the Free Software Foundation. # # This program is distributed in the hope th...
elf.timer.stop() if self.underMouse() and (self.coord!=None): self.emit(QtCore.SIGNAL("mouseHoverSignal"),self.coord,self.path)
identifier_body
faces.component.ts
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {FacesService} from './faces.service'; import {QueryService} from '../../model/query.service'; import {map} from 'rxjs/operators'; import {PersonDTO} from '../../../../common/entities/PersonDTO'; import {Observable} from 'rxjs/Observable'; ...
this.nonFavourites = this.facesService.persons.pipe( map(value => value.filter(p => !p.isFavourite) .sort(personCmp)) ); } ngOnInit() { this.updateSize(); } private updateSize() { const size = 220 + 5; // body - container margin const containerWidth = this.cont...
random_line_split
faces.component.ts
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {FacesService} from './faces.service'; import {QueryService} from '../../model/query.service'; import {map} from 'rxjs/operators'; import {PersonDTO} from '../../../../common/entities/PersonDTO'; import {Observable} from 'rxjs/Observable'; ...
ngOnInit() { this.updateSize(); } private updateSize() { const size = 220 + 5; // body - container margin const containerWidth = this.container.nativeElement.clientWidth - 30; this.size = (containerWidth / Math.round((containerWidth / size))) - 5; } }
{ this.facesService.getPersons().catch(console.error); const personCmp = (p1: PersonDTO, p2: PersonDTO) => { return p1.name.localeCompare(p2.name); }; this.favourites = this.facesService.persons.pipe( map(value => value.filter(p => p.isFavourite) .sort(personCmp)) ); this.non...
identifier_body
faces.component.ts
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {FacesService} from './faces.service'; import {QueryService} from '../../model/query.service'; import {map} from 'rxjs/operators'; import {PersonDTO} from '../../../../common/entities/PersonDTO'; import {Observable} from 'rxjs/Observable'; ...
() { const size = 220 + 5; // body - container margin const containerWidth = this.container.nativeElement.clientWidth - 30; this.size = (containerWidth / Math.round((containerWidth / size))) - 5; } }
updateSize
identifier_name
XFileSharingProFolder.py
# -*- coding: utf-8 -*- import re from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\...
if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) if self.account: if not self.account.PLUGIN_DOMAIN: self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN if not self.account.user: #@TODO: Move to `Account` ...
self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME)
conditional_block
XFileSharingProFolder.py
# -*- coding: utf-8 -*- import re from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\...
(self): account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME self.chunk_limit = 1 self.multiDL = True if self.account: self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) self.pr...
_setup
identifier_name
XFileSharingProFolder.py
# -*- coding: utf-8 -*- import re from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter):
getInfo = create_getInfo(XFileSharingProFolder)
__name__ = "XFileSharingProFolder" __type__ = "crypter" __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' __config__ = [("use_subfolder" , "bool", "Save pa...
identifier_body
XFileSharingProFolder.py
# -*- coding: utf-8 -*- import re from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\...
def load_account(self): if self.req: self.req.close() if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) ...
self.premium = False self.resume_download = False
random_line_split
tweetService.ts
import {Injectable} from '@angular/core'; import {Http} from '@angular/http'; import {Events, Platform} from 'ionic-angular'; @Injectable() export class TweetService { tweets: any; timer: any; error: any; errorCount: number; constructor(public http: Http, public events: Events, public platform: P...
() { return this.tweets; } }
getTweets
identifier_name
tweetService.ts
import {Injectable} from '@angular/core'; import {Http} from '@angular/http'; import {Events, Platform} from 'ionic-angular'; @Injectable() export class TweetService { tweets: any; timer: any; error: any; errorCount: number; constructor(public http: Http, public events: Events, public platform: P...
} } getError() { return this.error; } getTweets() { return this.tweets; } }
{ this.events.publish('tweets:error'); }
conditional_block
tweetService.ts
import {Injectable} from '@angular/core'; import {Http} from '@angular/http'; import {Events, Platform} from 'ionic-angular'; @Injectable() export class TweetService { tweets: any; timer: any; error: any;
this.timer = null; this.errorCount = 0; this.tweets = []; this.loadTweets(); // Reload Trains when we come out of the background this.platform.resume.subscribe(() => { this.loadTweets(); }); } loadTweets() { if (this.timer !== null) {...
errorCount: number; constructor(public http: Http, public events: Events, public platform: Platform) {
random_line_split
index.js
/* global Mousetrap */ import { typeOf } from '@ember/utils'; import { get } from "@ember/object"; export function bindKeyboardShortcuts(context) { const shortcuts = get(context, 'keyboardShortcuts'); if (typeOf(shortcuts) !== 'object') { return; } context._mousetraps = []; Object.keys(shortcuts).forEa...
} else if (actionObject.targetElement) { mousetrap = new Mousetrap(actionObject.targetElement); } else { mousetrap = new Mousetrap(document.body); } if (actionObject.preventDefault === false) { preventDefault = false; } invokeAction(actionObject.action, act...
{ mousetrap = new Mousetrap( document.querySelector(actionObject.scoped) ); }
conditional_block
index.js
/* global Mousetrap */ import { typeOf } from '@ember/utils'; import { get } from "@ember/object"; export function bindKeyboardShortcuts(context) { const shortcuts = get(context, 'keyboardShortcuts'); if (typeOf(shortcuts) !== 'object') { return; } context._mousetraps = []; Object.keys(shortcuts).forEa...
(context) { const _removeEvent = (object, type, callback) => { if (object.removeEventListener) { object.removeEventListener(type, callback, false); return; } object.detachEvent('on' + type, callback); }; Array.isArray(context._mousetraps) && context._mousetraps.forEach(mousetrap => { /...
unbindKeyboardShortcuts
identifier_name
index.js
/* global Mousetrap */ import { typeOf } from '@ember/utils'; import { get } from "@ember/object"; export function bindKeyboardShortcuts(context) { const shortcuts = get(context, 'keyboardShortcuts'); if (typeOf(shortcuts) !== 'object') { return; } context._mousetraps = []; Object.keys(shortcuts).forEa...
{ const _removeEvent = (object, type, callback) => { if (object.removeEventListener) { object.removeEventListener(type, callback, false); return; } object.detachEvent('on' + type, callback); }; Array.isArray(context._mousetraps) && context._mousetraps.forEach(mousetrap => { // manually...
identifier_body
index.js
/* global Mousetrap */ import { typeOf } from '@ember/utils'; import { get } from "@ember/object"; export function bindKeyboardShortcuts(context) { const shortcuts = get(context, 'keyboardShortcuts'); if (typeOf(shortcuts) !== 'object') { return; } context._mousetraps = []; Object.keys(shortcuts).forEa...
// manually unbind JS event _removeEvent(mousetrap.target, 'keypress', mousetrap._handleKeyEvent); _removeEvent(mousetrap.target, 'keydown', mousetrap._handleKeyEvent); _removeEvent(mousetrap.target, 'keyup', mousetrap._handleKeyEvent); mousetrap.reset(); }); context._mousetraps = []; }
random_line_split
border-base.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function
(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _postcss = require('postcss'); var _clone = require('../clone'); var _clone2 = _interopRequireDefault(_clone); var _hasAllProps = require('../hasAllProps'); var _hasAllProps2 = _interopRequireDefault(_hasAllProps); var _getLastNode = require('...
_interopRequireDefault
identifier_name
border-base.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj)
var _postcss = require('postcss'); var _clone = require('../clone'); var _clone2 = _interopRequireDefault(_clone); var _hasAllProps = require('../hasAllProps'); var _hasAllProps2 = _interopRequireDefault(_hasAllProps); var _getLastNode = require('../getLastNode'); var _getLastNode2 = _interopRequireDefault(_get...
{ return obj && obj.__esModule ? obj : { 'default': obj }; }
identifier_body
border-base.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _postcss = require('postcss'); var _clone = require('../clone'); var _clone2 = _interopRequireDefault(_clone); var _hasAllProps = r...
}; module.exports = exports['default'];
random_line_split
border-base.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _postcss = require('postcss'); var _clone = require('../clone'); var _clone2 = _interopRequireDefault(_clone); var _hasAllProps = r...
rule.insertAfter(decl, node); }); decl.remove(); }); }, merge: function merge(rule) { var decls = rule.nodes.filter(function (node) { return node.prop && ~wsc.indexOf(node.prop); }); var...
{ node.value = defaults[index]; }
conditional_block
index.ts
import analytics from './analytics'; import auth from './auth'; import channel from './channel'; import channelsApi from './channelsApi'; import clipboard from './clipboard'; import confirmModal from './confirm-modal'; import distangle from './distangle'; import documentItemsApi from './document-items-api'; import docu...
clipboard(app); confirmModal(app); distangle(app); documentUploadModal(app); documentItemsApi(app); documentSubscriptionsApi(app); featureFlags(app); feedbackModal(app); meta(app); notifications(app); peopleApi(app); person(app); scroll(app); websockets(app); }
channel(app); channelsApi(app);
random_line_split
autoderef-method-priority.rs
// Copyright 2012 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 ...
(self) -> uint { *self * 2u } } pub fn main() { let x = box 3u; assert_eq!(x.double(), 6u); }
double
identifier_name
autoderef-method-priority.rs
// Copyright 2012 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 ...
}
random_line_split
autoderef-method-priority.rs
// Copyright 2012 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 ...
} pub fn main() { let x = box 3u; assert_eq!(x.double(), 6u); }
{ *self * 2u }
identifier_body
deploy_local.ts
// tslint:disable:no-var-requires /* Allows easier local debugging over SSH. Running `npm run deploy_local` updates remote adapter files and restarts the instance */ /* CONFIGURATION: - provide a deploy_password.json file in the local dir with contents { "host": "<HOSTNAME>", "username": "<USERNAME>"...
await ssh.connect(sshConfig); for (const dir of uploadDirs) { console.log(`cleaning ${dir} dir...`); await ssh.execCommand(`rm -rf ${path.join(remoteRoot, dir)}`); console.log(`uploading ${dir} dir...`); try { await ssh.putDirectory(path.join(localRoot, dir), path.join(remoteRoot, dir), { recursive: t...
const remoteRoot = `/opt/iobroker/node_modules/iobroker.${ADAPTER_NAME}`; (async function main() {
random_line_split
simd-binop.rs
// Copyright 2014 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-tidy-linelength #![allow(experimental)] use std::unstable::simd::f32x4; fn ...
random_line_split
simd-binop.rs
// Copyright 2014 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 ...
() { let _ = f32x4(0.0, 0.0, 0.0, 0.0) == f32x4(0.0, 0.0, 0.0, 0.0); //~^ ERROR binary comparison operation `==` not supported for floating point SIMD vector `std::unstable::simd::f32x4` let _ = f32x4(0.0, 0.0, 0.0, 0.0) != f32x4(0.0, 0.0, 0.0, 0.0); //~^ ERROR binary comparison operation `!=` not sup...
main
identifier_name
simd-binop.rs
// Copyright 2014 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 ...
{ let _ = f32x4(0.0, 0.0, 0.0, 0.0) == f32x4(0.0, 0.0, 0.0, 0.0); //~^ ERROR binary comparison operation `==` not supported for floating point SIMD vector `std::unstable::simd::f32x4` let _ = f32x4(0.0, 0.0, 0.0, 0.0) != f32x4(0.0, 0.0, 0.0, 0.0); //~^ ERROR binary comparison operation `!=` not suppor...
identifier_body
socks4.rs
//! Socks4a Protocol Definition //! //! <http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol> #![allow(dead_code)] use std::{ fmt, io::{self, ErrorKind}, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, }; use byteorder::{BigEndian, ByteOrder}; use bytes::{BufMut, BytesMut}; use thiserror::Error; use t...
(&self) -> usize { let mut s = 1 + 1 + 2 + 4 + self.user_id.len() + 1; // USERID.LEN + NULL if let Address::DomainNameAddress(ref dname, _) = self.dst { s += dname.len() + 1; } s } } /// Handshake Response /// /// ```plain /// +----+----+----+----+----+----+-...
serialized_len
identifier_name
socks4.rs
//! Socks4a Protocol Definition //! //! <http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol> #![allow(dead_code)] use std::{ fmt, io::{self, ErrorKind}, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, }; use byteorder::{BigEndian, ByteOrder}; use bytes::{BufMut, BytesMut}; use thiserror::Error; use t...
/// Length in bytes #[inline] pub fn serialized_len(&self) -> usize { 1 + 1 + 2 + 4 } } /// SOCKS 4/4a Error #[derive(Error, Debug)] pub enum Error { // I/O Error #[error("{0}")] IoError(#[from] io::Error), #[error("host must be UTF-8 encoding")] AddressHostInvalidEncoding...
{ let HandshakeResponse { ref cd } = *self; buf.put_slice(&[ // VN: Result Code's version, must be 0 0x00, // CD: Result Code cd.as_u8(), // DSTPORT: Ignored 0x00, 0x00, // DSTIP: Ignored 0x00, ...
identifier_body
socks4.rs
//! Socks4a Protocol Definition //! //! <http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol> #![allow(dead_code)] use std::{ fmt, io::{self, ErrorKind}, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, }; use byteorder::{BigEndian, ByteOrder}; use bytes::{BufMut, BytesMut}; use thiserror::Error; use t...
} /// Writes to buffer pub fn write_to_buf<B: BufMut>(&self, buf: &mut B) { let HandshakeResponse { ref cd } = *self; buf.put_slice(&[ // VN: Result Code's version, must be 0 0x00, // CD: Result Code cd.as_u8(), // DSTPORT: Ignore...
w.write_all(&buf).await
random_line_split
text_mark.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TextBuffer; use ffi; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct TextMark(Object<ffi::GtkTextMark>); match fn { get_type => || ffi::gtk_text_mark_get_type(), } } impl TextMark { ...
(&self) -> Option<String> { unsafe { from_glib_none(ffi::gtk_text_mark_get_name(self.to_glib_none().0)) } } fn get_visible(&self) -> bool { unsafe { from_glib(ffi::gtk_text_mark_get_visible(self.to_glib_none().0)) } } fn set_visible(&self, settin...
get_name
identifier_name
text_mark.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TextBuffer; use ffi; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct TextMark(Object<ffi::GtkTextMark>); match fn { get_type => || ffi::gtk_text_mark_get_type(), } } impl TextMark { ...
} } fn get_name(&self) -> Option<String> { unsafe { from_glib_none(ffi::gtk_text_mark_get_name(self.to_glib_none().0)) } } fn get_visible(&self) -> bool { unsafe { from_glib(ffi::gtk_text_mark_get_visible(self.to_glib_none().0)) } } ...
random_line_split
text_mark.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TextBuffer; use ffi; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct TextMark(Object<ffi::GtkTextMark>); match fn { get_type => || ffi::gtk_text_mark_get_type(), } } impl TextMark { ...
fn get_name(&self) -> Option<String> { unsafe { from_glib_none(ffi::gtk_text_mark_get_name(self.to_glib_none().0)) } } fn get_visible(&self) -> bool { unsafe { from_glib(ffi::gtk_text_mark_get_visible(self.to_glib_none().0)) } } fn set_visi...
{ unsafe { from_glib(ffi::gtk_text_mark_get_left_gravity(self.to_glib_none().0)) } }
identifier_body
gamma.rs
// Copyright 2013 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 ...
let mut f = FisherF::new(2.0, 32.0); let mut rng = ::test::rng(); for _ in range(0u, 1000) { f.sample(&mut rng); f.ind_sample(&mut rng); } } #[test] fn test_t() { let mut t = StudentT::new(11.0); let mut rng = ::test::rng(); fo...
fn test_f() {
random_line_split
gamma.rs
// Copyright 2013 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 ...
entT { assert!(n > 0.0, "StudentT::new called with `n <= 0`"); StudentT { chi: ChiSquared::new(n), dof: n } } } impl Sample<f64> for StudentT { fn sample<R: Rng>(&mut self, rng: &mut R) -> f64 { self.ind_sample(rng) } } impl IndependentSample<f64> for StudentT { ...
tud
identifier_name
gamma.rs
// Copyright 2013 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 ...
mma = Gamma::new(0.1, 1.0); let mut rng = ::test::weak_rng(); b.iter(|| { for _ in range(0, ::RAND_BENCH_N) { gamma.ind_sample(&mut rng); } }); b.bytes = size_of::<f64>() as u64 * ::RAND_BENCH_N; } }
identifier_body
gamma.rs
// Copyright 2013 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 ...
let v = v_cbrt * v_cbrt * v_cbrt; let Open01(u) = rng.gen::<Open01<f64>>(); let x_sqr = x * x; if u < 1.0 - 0.0331 * x_sqr * x_sqr || u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln()) { return self.d * v * self.scale } } ...
^3 <= 0 iff a <= 0 continue }
conditional_block
dom_element_schema_registry_spec.ts
import { beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, it, xit } from 'angular2/testing_internal'; import {IS_DART} from 'angular2/src/facade/lang'; import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry'; export function main()
{ // DOMElementSchema can only be used on the JS side where we can safely // use reflection for DOM elements if (IS_DART) return; var registry: DomElementSchemaRegistry; beforeEach(() => { registry = new DomElementSchemaRegistry(); }); describe('DOMElementSchema', () => { it('should detect propertie...
identifier_body
dom_element_schema_registry_spec.ts
import { beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, it, xit } from 'angular2/testing_internal'; import {IS_DART} from 'angular2/src/facade/lang'; import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry'; export function
() { // DOMElementSchema can only be used on the JS side where we can safely // use reflection for DOM elements if (IS_DART) return; var registry: DomElementSchemaRegistry; beforeEach(() => { registry = new DomElementSchemaRegistry(); }); describe('DOMElementSchema', () => { it('should detect proper...
main
identifier_name
dom_element_schema_registry_spec.ts
import { beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, it, xit } from 'angular2/testing_internal'; import {IS_DART} from 'angular2/src/facade/lang'; import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry'; export function main() { // DOM...
it('should detect properties on namespaced elements', () => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); }); }); }
it('should not re-map property names that are not specified in DOM facade', () => { expect(registry.getMappedPropName('title')).toEqual('title'); expect(registry.getMappedPropName('exotic-unknown')).toEqual('exotic-unknown'); });
random_line_split
hello.ctrl.ts
import { Sample } from './../services/serviceClient'; import { GlobalConfig } from '../index.config'; export class HelloController { public selectedItem: string; public searchText: string; public foodInfo: Sample.FoodInfo; public weights: Sample.FoodWeight[];
Description: '100 g', Amount: 1, GramWeight: 100 }; /* @ngInject */ constructor(private ServiceClient: Sample.ServiceClient) { this.weights = [this.defaultWeight]; this.selectedWeight = this.defaultWeight; } public getFactor() { if (!this.amount || !this.selectedWeight) { re...
public selectedWeight: Sample.FoodWeight; public amount: number; private defaultWeight: Sample.FoodWeight = {
random_line_split
hello.ctrl.ts
import { Sample } from './../services/serviceClient'; import { GlobalConfig } from '../index.config'; export class HelloController { public selectedItem: string; public searchText: string; public foodInfo: Sample.FoodInfo; public weights: Sample.FoodWeight[]; public selectedWeight: Sample.FoodWeight; publ...
}
{ this.bindings = {}; this.controller = HelloController; this.templateUrl = 'app/hello/hello.html'; this.controllerAs = 'vm'; }
identifier_body
hello.ctrl.ts
import { Sample } from './../services/serviceClient'; import { GlobalConfig } from '../index.config'; export class HelloController { public selectedItem: string; public searchText: string; public foodInfo: Sample.FoodInfo; public weights: Sample.FoodWeight[]; public selectedWeight: Sample.FoodWeight; publ...
() { this.bindings = {}; this.controller = HelloController; this.templateUrl = 'app/hello/hello.html'; this.controllerAs = 'vm'; } }
constructor
identifier_name
hello.ctrl.ts
import { Sample } from './../services/serviceClient'; import { GlobalConfig } from '../index.config'; export class HelloController { public selectedItem: string; public searchText: string; public foodInfo: Sample.FoodInfo; public weights: Sample.FoodWeight[]; public selectedWeight: Sample.FoodWeight; publ...
return this.amount * this.selectedWeight.GramWeight / 100; } public selectedItemChange(item: Sample.Food) { if (!item) { this.foodInfo = null; return; } this.ServiceClient.getFoodIdById(item.Id) .then(x => this.foodInfo = x.data); this.ServiceClient.getFoodByFoodIdWeight(ite...
{ return 1; }
conditional_block
mod.rs
// This file is part of Rubik. // Copyright Peter Beard, licensed under the GPLv3. See LICENSE for details. // //! Algorithms for solving Rubik's cubes use super::cube::{Cube, Move}; /// Trait for things that can solve Rubik's cubes pub trait Solver { /// Calculate a sequence of moves that puts the cube in the sol...
} /// Solver that uses a simple iterative deepening algorithm /// /// This algorithm is very slow and probably won't halt in a reasonable time for /// most cubes /// /// # Example /// ``` /// use rubik::cube::Cube; /// use rubik::solver::IDSolver; /// /// let mut c = Cube::new(); /// let mut ids = IDSolver::new(); /...
{ vec![] }
identifier_body
mod.rs
// This file is part of Rubik. // Copyright Peter Beard, licensed under the GPLv3. See LICENSE for details. // //! Algorithms for solving Rubik's cubes use super::cube::{Cube, Move}; /// Trait for things that can solve Rubik's cubes pub trait Solver { /// Calculate a sequence of moves that puts the cube in the sol...
if let Some(ms) = dbsearch(&s, maxdepth - 1) { moves.append(&mut ms.clone()); break; } else { moves.pop(); } } if moves.len() > 0 { Some(moves) } else { None } }
{ break; }
conditional_block
mod.rs
// This file is part of Rubik. // Copyright Peter Beard, licensed under the GPLv3. See LICENSE for details. // //! Algorithms for solving Rubik's cubes use super::cube::{Cube, Move}; /// Trait for things that can solve Rubik's cubes pub trait Solver { /// Calculate a sequence of moves that puts the cube in the sol...
impl IDSolver { /// Create a new solver with the default maximum depth of 26 /// (all cubes are solveable in at most 26 moves) pub fn new() -> IDSolver { IDSolver { max_depth: 26u8, } } /// Create a solver with the given maximum depth (max number of moves) pub fn wi...
/// assert!(c.is_solved()); /// ``` pub struct IDSolver { max_depth: u8, }
random_line_split
mod.rs
// This file is part of Rubik. // Copyright Peter Beard, licensed under the GPLv3. See LICENSE for details. // //! Algorithms for solving Rubik's cubes use super::cube::{Cube, Move}; /// Trait for things that can solve Rubik's cubes pub trait Solver { /// Calculate a sequence of moves that puts the cube in the sol...
() -> NullSolver { NullSolver } } impl Solver for NullSolver { fn find_solution(&mut self, _: &Cube) -> Vec<Move> { vec![] } } /// Solver that uses a simple iterative deepening algorithm /// /// This algorithm is very slow and probably won't halt in a reasonable time for /// most cubes //...
new
identifier_name
config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = os.getenv('APP_SECRET_KEY', '') # db config DB_PORT = os.getenv('DB_PORT', '') DB_HOST = os.getenv('DB_HOST', '') DB_ROLE = os.getenv('DB_...
(Config): DEBUG = False class StagingConfig(Config): DEVELOPMENT = True DEBUG = True class DevelopmentConfig(Config): DEVELOPMENT = True DEBUG = True class TestingConfig(Config): TESTING = True
ProductionConfig
identifier_name