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
build.js
process.env.NODE_ENV = 'production' var ora = require('ora') var rm = require('rimraf') var path = require('path') var chalk = require('chalk') var webpack = require('webpack') var config = require('../config') var webpackConfig = require('./webpack.prod.conf') var spinner = ora('building for production...')
spinner.start() rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, ...
random_line_split
run_tests_py.py
# # run all the regression tests # # [or, you can request specific ones by giving their names on the command line] # import sys import compile import os import subprocess import context def run_test (cmd, *args): cmd = PJ ('tests', cmd) p = subprocess.Popen ([cmd] + list(args), stdout=subprocess.PIPE) out...
try: compile.compile_file (open (path, 'rb'), path, c) except: if not fail: #raise failed.append ((base, "compile failed")) else: succeeded += 1 else: if fail: failed.append ((base, '...
c.optimize = True
conditional_block
run_tests_py.py
# # run all the regression tests # # [or, you can request specific ones by giving their names on the command line] # import sys import compile import os import subprocess import context def run_test (cmd, *args): cmd = PJ ('tests', cmd) p = subprocess.Popen ([cmd] + list(args), stdout=subprocess.PIPE) out...
(): # generate the output run_test ('t_dump_image') # load the image and run it exp0 = run_test ('t_dump_image','-l') exp1 = open ('tests/t_dump_image.exp').read() assert (exp0 == exp1) def test_t21(): out = run_test ('t21') exp = open ('gc.c').read() # make sure the first part matc...
test_t_dump_image
identifier_name
run_tests_py.py
# # run all the regression tests # # [or, you can request specific ones by giving their names on the command line] # import sys import compile import os import subprocess import context def run_test (cmd, *args): cmd = PJ ('tests', cmd) p = subprocess.Popen ([cmd] + list(args), stdout=subprocess.PIPE) out...
def test_t22(): out = run_test ('t22') lines = out.split ('\n') assert (lines[0].count ('<closure pc=') == 5) r6 = [ str(x) for x in range (6) ] assert (lines[1:] == (r6 + r6 + ['#u', ''])) def test_t_lex(): out = run_test ('t_lex') assert (out.split('\n')[-4:] == ['{u0 NUMBER "42"}', '{u...
out = run_test ('t21') exp = open ('gc.c').read() # make sure the first part matches the contents of gc.c assert (out[:len(exp)] == exp) # the chars are too hard to tests for, and unlikely to be wrong. # should really make a separate char test.
identifier_body
run_tests_py.py
# # run all the regression tests # # [or, you can request specific ones by giving their names on the command line] # import sys import compile import os import subprocess import context def run_test (cmd, *args): cmd = PJ ('tests', cmd) p = subprocess.Popen ([cmd] + list(args), stdout=subprocess.PIPE) out...
# load the image and run it exp0 = run_test ('t_dump_image','-l') exp1 = open ('tests/t_dump_image.exp').read() assert (exp0 == exp1) def test_t21(): out = run_test ('t21') exp = open ('gc.c').read() # make sure the first part matches the contents of gc.c assert (out[:len(exp)] == exp) ...
# generate the output run_test ('t_dump_image')
random_line_split
admin-seourlsmanager.js
/** * @package Woodkit * @author Sébastien Chandonay www.seb-c.com License: GPL2 Text Domain: woodurls * * Copyright 2016 Sébastien Chandonay (email : please contact me from my website) * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,...
lse { return id; } } plugin.init(); return plugin; }; $.fn.seourlsmanager = function(options) { var seourlsmanager = $(this).data('seourlsmanager'); if (empty(seourlsmanager)) { seourlsmanager = new $.seourlsmanager($(this), options); $(this).data('seourlsmanager', seourlsmanager); } else ...
id++; return plugin.get_unique_id(prefix, id); } e
conditional_block
admin-seourlsmanager.js
/** * @package Woodkit * @author Sébastien Chandonay www.seb-c.com License: GPL2 Text Domain: woodurls * * Copyright 2016 Sébastien Chandonay (email : please contact me from my website) * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,...
html += '<input type="hidden" name="sitemap-url-id-' + url_id + '" value="' + url_id + '" />'; html += '</div>'; var $url_container = $(html).appendTo($seourlsmanager_container); return $url_container; } /** * Remove url */ plugin.remove_url = function($url_id) { if ($("#" + $url_id...
html += '<option value="exclude_if_regexp"'+action_checked+'>'+settings['label_action_exclude_if_regexp']+'</option>'; html += '</select>'; html += '<input type="text" class="large" name="sitemap-url-' + url_id + '" value="'+url+'" placeholder="' + settings['label_url'] + '" />';
random_line_split
UTEventReporting.test.js
import { UTSessionPing, UTUserEventPing, } from "test/schemas/pings"; import {GlobalOverrider} from "test/unit/utils"; import {UTEventReporting} from "lib/UTEventReporting.jsm"; const FAKE_EVENT_PING_PC = { "event": "CLICK", "source": "TOP_SITES", "addon_version": "123", "user_prefs": 63, "session_id": "...
globals.restore(); }); describe("#sendUserEvent()", () => { it("should queue up the correct data to send to Events Telemetry", async () => { utEvents.sendUserEvent(FAKE_EVENT_PING_PC); assert.calledWithExactly(global.Services.telemetry.recordEvent, ...FAKE_EVENT_PING_UT); let ping = glob...
afterEach(() => {
random_line_split
list_from_json.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
def Format(self, unused_args): return 'json'
if args.json_file: with open(args.json_file, 'r') as f: resources = json.load(f) else: resources = json.load(sys.stdin) return resources
identifier_body
list_from_json.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
return resources def Format(self, unused_args): return 'json'
resources = json.load(sys.stdin)
conditional_block
list_from_json.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
(): """No resource URIs.""" return None def Run(self, args): if args.json_file: with open(args.json_file, 'r') as f: resources = json.load(f) else: resources = json.load(sys.stdin) return resources def Format(self, unused_args): return 'json'
GetUriCacheUpdateOp
identifier_name
list_from_json.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
*{command}* is a test harness for resource output formatting and filtering. It behaves like any other `gcloud ... list` command except that the resources are read from a JSON data file. The input JSON data is either a single resource object or a list of resource objects of the same type. The resources are p...
class ListFromJson(base.ListCommand): """Read JSON data and list it on the standard output.
random_line_split
main.rs
use std::fs::File; // File::open(&str) use std::io::prelude::*; // std::fs::File.read_to_string(&mut str) static VOWELS: [char; 6] = ['a', 'e', 'i', 'o', 'u', 'y']; fn get_input() -> String { let mut file = match File::open("input.txt") { Ok(input) => input, Err(err) => panic!("Error: {}", err), ...
} println!(""); }
println!(""); for ans in counters { print!("{} ", ans);
random_line_split
main.rs
use std::fs::File; // File::open(&str) use std::io::prelude::*; // std::fs::File.read_to_string(&mut str) static VOWELS: [char; 6] = ['a', 'e', 'i', 'o', 'u', 'y']; fn
() -> String { let mut file = match File::open("input.txt") { Ok(input) => input, Err(err) => panic!("Error: {}", err), }; let mut input = String::new(); match file.read_to_string(&mut input) { Ok(input) => input, Err(err) => panic!("Error: {}", err), }; input }...
get_input
identifier_name
main.rs
use std::fs::File; // File::open(&str) use std::io::prelude::*; // std::fs::File.read_to_string(&mut str) static VOWELS: [char; 6] = ['a', 'e', 'i', 'o', 'u', 'y']; fn get_input() -> String
fn main() { let input = get_input() .to_lowercase(); let data: Vec<&str> = input .trim() .lines() .collect(); let mut counters: Vec<isize> = Vec::new(); for (i, string) in data[1..].iter().enumerate() { counters.push(0); for ch in string.chars() { ...
{ let mut file = match File::open("input.txt") { Ok(input) => input, Err(err) => panic!("Error: {}", err), }; let mut input = String::new(); match file.read_to_string(&mut input) { Ok(input) => input, Err(err) => panic!("Error: {}", err), }; input }
identifier_body
App.js
import React, { Component } from 'react' import './App.css' // 组件 import Message from './message' import Timer from './timer' import TodoApp from './todo' import MarkdownEditor from './editor' import Logo from './logo' class App extends Component { // constructor 是类被初始化后自动调用的函数 constructor(props) { super(p...
一个变量决定是否显示 timer 组件 // 组件就是说呢 我们不写页面了 // 我们写一个个组件 最后把小组件拼成一个 html // ? 三元表达式 // button 绑定事件 var timer = this.state.showTimer ? <Timer /> : null return ( <div className="App"> <Logo /> <Message name="Young" /> <Message name="洋" /> <button onClick={this.handle...
state = { showTimer: true, } } // jsx 语法 render() { // 用
identifier_body
App.js
import React, { Component } from 'react' import './App.css' // 组件 import Message from './message' import Timer from './timer' import TodoApp from './todo' import MarkdownEditor from './editor' import Logo from './logo' class App extends Component { // constructor 是类被初始化后自动调用的函数 constructor(props) { super(p...
// 组件就是说呢 我们不写页面了 // 我们写一个个组件 最后把小组件拼成一个 html // ? 三元表达式 // button 绑定事件 var timer = this.state.showTimer ? <Timer /> : null return ( <div className="App"> <Logo /> <Message name="Young" /> <Message name="洋" /> <button onClick={this.handleToggleTimer}>开关 timer</...
组件
identifier_name
App.js
import React, { Component } from 'react' import './App.css' // 组件 import Message from './message' import Timer from './timer' import TodoApp from './todo' import MarkdownEditor from './editor' import Logo from './logo'
class App extends Component { // constructor 是类被初始化后自动调用的函数 constructor(props) { super(props) this.state = { showTimer: true, } } // jsx 语法 render() { // 用一个变量决定是否显示 timer 组件 // 组件就是说呢 我们不写页面了 // 我们写一个个组件 最后把小组件拼成一个 html // ? 三元表达式 // button 绑定事件 var timer = th...
random_line_split
logg-tests.ts
import logging = require("logg"); var logger = logging.getLogger('my.class'); logger = logging.getTransientLogger('my.class'); logger.setLogLevel(logging.Level.SEVERE); logger.setLogLevel(logging.Level.WARN); logger.setLogLevel(logging.Level.INFO); logger = logging.rootLogger;
logger.fine("test", {}, []); logger.error("dsfs", {}); logging.registerWatcher(function(logRecord) { console.log(logRecord); }); logger.registerWatcher(function(logRecord) { console.log(logRecord); }); logger.getWatchers()[0](); logger.isLoggable(500) === true; var logger2 = logging.getLogger("hi"); lo...
logger.setLogLevel(logging.Level.FINE); logger.setLogLevel(logging.Level.FINER); logger.setLogLevel(logging.Level.FINEST); logger.info('This will not show up'); logger.warn('But warnings will', new Error('aargg'));
random_line_split
add-polyline.js
sap.ui.define(['sap/ui/webc/common/thirdparty/base/asset-registries/Icons'], function (Icons) { 'use strict'; const name = "add-polyline"; const pathData = "M0 144V98l179 117L292 64l109 145 79-113 32 19-110 156-110-147-105 141-111-74zm402 257v-73h36v73h74v36h-74v73h-36v-73h-73v-36h73z"; const ltr = false; const co...
return addPolyline; });
var addPolyline = { pathData };
random_line_split
attr.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 ...
/** * From a list of crate attributes get only the meta_items that affect crate * linkage */ pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<@MetaItem> { let mut result = Vec::new(); for attr in attrs.iter().filter(|at| at.name().equiv(&("link"))) { match attr.meta().node { MetaList...
}).collect() }
random_line_split
attr.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 ...
<AM: AttrMetaMethods>(metas: &[AM], name: &str) -> bool { debug!("attr::contains_name (name={})", name); metas.iter().any(|item| { debug!(" testing: {}", item.name()); item.name().equiv(&name) }) } pub fn first_attr_value_str_by_name(attrs: &[Attribute], name: &str) ...
contains_name
identifier_name
attr.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 ...
/** * From a list of crate attributes get only the meta_items that affect crate * linkage */ pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<@MetaItem> { let mut result = Vec::new(); for attr in attrs.iter().filter(|at| at.name().equiv(&("link"))) { match attr.meta().node { MetaLi...
{ // This is sort of stupid here, but we need to sort by // human-readable strings. let mut v = items.iter() .map(|&mi| (mi.name(), mi)) .collect::<Vec<(InternedString, @MetaItem)> >(); v.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b)); // There doesn't seem to be a more optimal way t...
identifier_body
test-fast-csv.js
// Generated by CoffeeScript 1.7.1 (function() { var $, CSV, ES, TEXT, TRM, TYPES, alert, badge, create_readstream, debug, echo, help, info, log, njs_fs, rainbow, route, rpr, urge, warn, whisper; njs_fs = require('fs'); TYPES = require('coffeenode-types'); TEXT = require('coffeenode-text'); TRM = require(...
$ = ES.map.bind(ES); this.$count = function(input_stream, title) { var count; count = 0; input_stream.on('end', function() { return info((title != null ? title : 'Count') + ':', count); }); return $((function(_this) { return function(record, handler) { count += 1; r...
ES = require('event-stream');
random_line_split
test-fast-csv.js
// Generated by CoffeeScript 1.7.1 (function() { var $, CSV, ES, TEXT, TRM, TYPES, alert, badge, create_readstream, debug, echo, help, info, log, njs_fs, rainbow, route, rpr, urge, warn, whisper; njs_fs = require('fs'); TYPES = require('coffeenode-types'); TEXT = require('coffeenode-text'); TRM = require(...
return log('ok'); }); } }).call(this);
{ throw error; }
conditional_block
str_concat.rs
// // 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 gov...
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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
random_line_split
str_concat.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
}
{ let mut handlebars = Handlebars::new(); handlebars.register_helper("strConcat", Box::new(STR_CONCAT)); let expected = "foobarbaz"; assert_eq!( expected, handlebars .template_render("{{strConcat \"foo\" \"bar\" \"baz\"}}", &json!({})) ...
identifier_body
str_concat.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
(&self, h: &Helper, _: &Handlebars, rc: &mut RenderContext) -> RenderResult<()> { let list: Vec<String> = h.params() .iter() .map(|v| v.value()) .filter(|v| !v.is_object()) .map(|v| v.to_string().replace("\"", "")) .collect(); rc.writer.write(...
call
identifier_name
topic_count.js
/*globals rabbitmq_test_bindings: false, rabbitmq_bindings_to_remove: false */ /*jslint mocha: true */ "use strict"; var expect = require('chai').expect, util = require('util'), Qlobber = require('..').Qlobber; function
(options) { Qlobber.call(this, options); this.topic_count = 0; } util.inherits(QlobberTopicCount, Qlobber); QlobberTopicCount.prototype._initial_value = function (val) { this.topic_count += 1; return Qlobber.prototype._initial_value(val); }; QlobberTopicCount.prototype._remove_value = function (vals...
QlobberTopicCount
identifier_name
topic_count.js
/*globals rabbitmq_test_bindings: false, rabbitmq_bindings_to_remove: false */ /*jslint mocha: true */ "use strict"; var expect = require('chai').expect, util = require('util'), Qlobber = require('..').Qlobber; function QlobberTopicCount (options) { Qlobber.call(this, options); this.topic_co...
expect(matcher.topic_count).to.equal(1); matcher.remove('foo.bar', 23); expect(matcher.topic_count).to.equal(0); matcher.remove('foo.bar', 24); expect(matcher.topic_count).to.equal(0); matcher.remove('foo.bar2', 23); expect(matcher.topic_count).to.equal(0); ...
random_line_split
topic_count.js
/*globals rabbitmq_test_bindings: false, rabbitmq_bindings_to_remove: false */ /*jslint mocha: true */ "use strict"; var expect = require('chai').expect, util = require('util'), Qlobber = require('..').Qlobber; function QlobberTopicCount (options)
util.inherits(QlobberTopicCount, Qlobber); QlobberTopicCount.prototype._initial_value = function (val) { this.topic_count += 1; return Qlobber.prototype._initial_value(val); }; QlobberTopicCount.prototype._remove_value = function (vals, val) { var removed = Qlobber.prototype._remove_value(vals, val); ...
{ Qlobber.call(this, options); this.topic_count = 0; }
identifier_body
topic_count.js
/*globals rabbitmq_test_bindings: false, rabbitmq_bindings_to_remove: false */ /*jslint mocha: true */ "use strict"; var expect = require('chai').expect, util = require('util'), Qlobber = require('..').Qlobber; function QlobberTopicCount (options) { Qlobber.call(this, options); this.topic_co...
return removed; }; QlobberTopicCount.prototype.clear = function () { this.topic_count = 0; return Qlobber.prototype.clear.call(this); }; describe('qlobber-topic-count', function () { it('should be able to count topics added', function () { var matcher = new QlobberTopicCount(); r...
{ this.topic_count -= 1; }
conditional_block
calendar-pt_BR.utf8.js
// ** I18N // Calendar pt-BR language // Author: Fernando Dourado, <fernando.dourado@ig.com.br> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also pl...
"Quinta", "Sexta", "Sabádo", "Domingo"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of t...
"Segunda", "Terça", "Quarta",
random_line_split
15.9.5.5-02.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
//----------------------------------------------------------------------------- var BUGNUMBER = 398485; var summary = 'Date.prototype.toLocaleString should not clamp year'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //---------------------...
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
random_line_split
15.9.5.5-02.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //--------------------------------...
{ enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var d; var y; var l; var maxms = 8640000000000000; d = new Date(-maxms ); y = d.getFullYear(); l = d.toLocaleString(); print(l); actual = y; expect = -271821; reportCompare(expect, actual, summary + ': check year'); ...
identifier_body
15.9.5.5-02.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //--------------------------------...
() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var d; var y; var l; var maxms = 8640000000000000; d = new Date(-maxms ); y = d.getFullYear(); l = d.toLocaleString(); print(l); actual = y; expect = -271821; reportCompare(expect, actual, summary + ': check year')...
test
identifier_name
imp_warant_officer_ii_1st_class_33.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from resources.datatables import FactionStatus from java.util import Vector def addTemplate(co...
core.spawnService.addMobileTemplate('imp_warrant_offi_1st_class_ii_33', mobileTemplate) return
mobileTemplate.setDefaultAttack('rangedShot') mobileTemplate.setAttacks(attacks)
random_line_split
imp_warant_officer_ii_1st_class_33.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from resources.datatables import FactionStatus from java.util import Vector def addTemplate(co...
mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('crackdown_imperial_warrant_officer_ii_hard') mobileTemplate.setLevel(33) mobileTemplate.setDifficulty(Difficulty.ELITE) mobileTemplate.setMinSpawnDistance(4) mobileTemplate.setMaxSpawnDistance(8) mobileTemplate.setDeathblow(True) mobileTemplate....
identifier_body
imp_warant_officer_ii_1st_class_33.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from resources.datatables import FactionStatus from java.util import Vector def
(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('crackdown_imperial_warrant_officer_ii_hard') mobileTemplate.setLevel(33) mobileTemplate.setDifficulty(Difficulty.ELITE) mobileTemplate.setMinSpawnDistance(4) mobileTemplate.setMaxSpawnDistance(8) mobileTemplate.setDeathblow(True) mobile...
addTemplate
identifier_name
sas.py
""" pygments.styles.sas ~~~~~~~~~~~~~~~~~~~ Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, s...
""" Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. """ default_style = '' styles = { Whitespace: '#bbbbbb', Comment: 'italic #008800', ...
identifier_body
sas.py
""" pygments.styles.sas ~~~~~~~~~~~~~~~~~~~ Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, s...
meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. """ default_style = '' styles = { Whitespace: '#bbbbbb', Comment: 'italic #008800', String: '#800080', Number: 'b...
random_line_split
sas.py
""" pygments.styles.sas ~~~~~~~~~~~~~~~~~~~ Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, s...
(Style): """ Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. """ default_style = '' styles = { Whitespace: '#bbbbbb', Comment: 'italic...
SasStyle
identifier_name
timerdeco.py
import time import random def timer(calls=1): def decorator(func):
return decorator # demos: if __name__ == "__main__": @timer(calls=100000) def addition(a): for i in range(a): for j in range(a): x = 1 @timer(calls=100000) def multiply(b): for i in range(b): y = 1 addition(100) multiply(100) """ r...
def wrapper(*args): t1 = time.time() for i in range(calls): func(*args) t2 = time.time() print(t2 - t1) return wrapper
identifier_body
timerdeco.py
import time import random def timer(calls=1): def decorator(func): def wrapper(*args): t1 = time.time() for i in range(calls): func(*args) t2 = time.time() print(t2 - t1) return wrapper return decorator # demos: if __name__ == "__...
addition(100) multiply(100) """ result: =============== RESTART: C:/Users/Spencer/Desktop/timerdeco.py =============== 17.63799524307251 0.20052003860473633 """
y = 1
conditional_block
timerdeco.py
import time import random def
(calls=1): def decorator(func): def wrapper(*args): t1 = time.time() for i in range(calls): func(*args) t2 = time.time() print(t2 - t1) return wrapper return decorator # demos: if __name__ == "__main__": @timer(calls=100000) ...
timer
identifier_name
timerdeco.py
import time import random def timer(calls=1): def decorator(func): def wrapper(*args): t1 = time.time() for i in range(calls): func(*args) t2 = time.time()
return decorator # demos: if __name__ == "__main__": @timer(calls=100000) def addition(a): for i in range(a): for j in range(a): x = 1 @timer(calls=100000) def multiply(b): for i in range(b): y = 1 addition(100) multiply(100) """ re...
print(t2 - t1) return wrapper
random_line_split
tabnanny.py
#! /usr/bin/env python3 """The Tab Nanny despises ambiguous indentation. She knows no mercy. tabnanny -- Detection of ambiguous indentation For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below. Wa...
(self, lineno, msg, line): self.lineno, self.msg, self.line = lineno, msg, line def get_lineno(self): return self.lineno def get_msg(self): return self.msg def get_line(self): return self.line def check(file): """check(file_or_dir) If file_or_dir is a di...
__init__
identifier_name
tabnanny.py
#! /usr/bin/env python3 """The Tab Nanny despises ambiguous indentation. She knows no mercy. tabnanny -- Detection of ambiguous indentation For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below. Wa...
opts, args = getopt.getopt(sys.argv[1:], "qv") except getopt.error as msg: errprint(msg) return for o, a in opts: if o == '-q': filename_only = filename_only + 1 if o == '-v': verbose = verbose + 1 if not args: errprint("Usage...
random_line_split
tabnanny.py
#! /usr/bin/env python3 """The Tab Nanny despises ambiguous indentation. She knows no mercy. tabnanny -- Detection of ambiguous indentation For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below. Wa...
# return length of longest contiguous run of spaces (whether or not # preceding a tab) def longest_run_of_spaces(self): count, trailing = self.norm return max(len(count)-1, trailing) def indent_level(self, tabsize): # count, il = self.norm # for i in range(le...
self.raw = ws S, T = Whitespace.S, Whitespace.T count = [] b = n = nt = 0 for ch in self.raw: if ch == S: n = n + 1 b = b + 1 elif ch == T: n = n + 1 nt = nt + 1 if b >= le...
identifier_body
tabnanny.py
#! /usr/bin/env python3 """The Tab Nanny despises ambiguous indentation. She knows no mercy. tabnanny -- Detection of ambiguous indentation For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below. Wa...
elif type == INDENT: check_equal = 0 thisguy = Whitespace(token) if not indents[-1].less(thisguy): witness = indents[-1].not_less_witness(thisguy) msg = "indent not greater e.g. " + format_witnesses(witness) raise Nann...
check_equal = 1
conditional_block
frinkiac.py
""" Frinkiac (Images)
@parse url, title, img_src """ from json import loads from urllib import urlencode categories = ['images'] BASE = 'https://frinkiac.com/' SEARCH_URL = '{base}api/search?{query}' RESULT_URL = '{base}?{query}' THUMB_URL = '{base}img/{episode}/{timestamp}/medium.jpg' IMAGE_URL = '{base}img/{episode}/{timestamp}.j...
@website https://www.frinkiac.com @provide-api no @using-api no @results JSON @stable no
random_line_split
frinkiac.py
""" Frinkiac (Images) @website https://www.frinkiac.com @provide-api no @using-api no @results JSON @stable no @parse url, title, img_src """ from json import loads from urllib import urlencode categories = ['images'] BASE = 'https://frinkiac.com/' SEARCH_URL = '{base}api/search?{query}' RESULT...
(query, params): params['url'] = SEARCH_URL.format(base=BASE, query=urlencode({'q': query})) return params def response(resp): results = [] response_data = loads(resp.text) for result in response_data: episode = result['Episode'] timestamp = result['Timestamp'] results.app...
request
identifier_name
frinkiac.py
""" Frinkiac (Images) @website https://www.frinkiac.com @provide-api no @using-api no @results JSON @stable no @parse url, title, img_src """ from json import loads from urllib import urlencode categories = ['images'] BASE = 'https://frinkiac.com/' SEARCH_URL = '{base}api/search?{query}' RESULT...
return results
episode = result['Episode'] timestamp = result['Timestamp'] results.append({'template': 'images.html', 'url': RESULT_URL.format(base=BASE, query=urlencode({'p': 'caption', 'e': episode, 't': timestamp})), '...
conditional_block
frinkiac.py
""" Frinkiac (Images) @website https://www.frinkiac.com @provide-api no @using-api no @results JSON @stable no @parse url, title, img_src """ from json import loads from urllib import urlencode categories = ['images'] BASE = 'https://frinkiac.com/' SEARCH_URL = '{base}api/search?{query}' RESULT...
def response(resp): results = [] response_data = loads(resp.text) for result in response_data: episode = result['Episode'] timestamp = result['Timestamp'] results.append({'template': 'images.html', 'url': RESULT_URL.format(base=BASE, ...
params['url'] = SEARCH_URL.format(base=BASE, query=urlencode({'q': query})) return params
identifier_body
input-debugger.js
// monkey patching String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; var libsw = new LibSpaceWalk(); var storedValues = {}; var colors = { orange: '#e89f49', lime: '#b6ce4e', turquise: '#5dd1a4', blue: '#3fc0c9', lightBlue: '#C1DFE1', laven...
function last(arr) { return arr[arr.length-1]; } // map value, from [a, b] to [r, s] function map(a, b, r, s, value) { var t = (value - a) / (b -a); return r + (s - r) * t; }
decimals = decimals || 0; var v = value * Math.pow(10, decimals); return Math.round(v) / Math.pow(10, decimals); }
identifier_body
input-debugger.js
// monkey patching String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; var libsw = new LibSpaceWalk(); var storedValues = {}; var colors = { orange: '#e89f49', lime: '#b6ce4e', turquise: '#5dd1a4', blue: '#3fc0c9', lightBlue: '#C1DFE1', laven...
alue, decimals) { decimals = decimals || 0; var v = value * Math.pow(10, decimals); return Math.round(v) / Math.pow(10, decimals); } function last(arr) { return arr[arr.length-1]; } // map value, from [a, b] to [r, s] function map(a, b, r, s, value) { var t = (value - a) / (b -a); return r + (s - r) * t; }
und(v
identifier_name
input-debugger.js
// monkey patching String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; var libsw = new LibSpaceWalk(); var storedValues = {}; var colors = { orange: '#e89f49',
lavender: '#8885ed', rose: '#c673d8', red: '#e25454' } libsw.onMessage = function(data) { if (data.type === 'ext.input.gamePad.sample') { var payload = data.payload; if (payload.type === 'digital') { // aka button press/release var digitalDiv = d3.select('#digital'); var selection = digitalDiv.selectAl...
lime: '#b6ce4e', turquise: '#5dd1a4', blue: '#3fc0c9', lightBlue: '#C1DFE1',
random_line_split
input-debugger.js
// monkey patching String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; var libsw = new LibSpaceWalk(); var storedValues = {}; var colors = { orange: '#e89f49', lime: '#b6ce4e', turquise: '#5dd1a4', blue: '#3fc0c9', lightBlue: '#C1DFE1', laven...
libsw.onSessionStarted = function() { } // ================================= util ================================ function round(value, decimals) { decimals = decimals || 0; var v = value * Math.pow(10, decimals); return Math.round(v) / Math.pow(10, decimals); } function last(arr) { return arr[arr.length-1]; ...
{ var payload = data.payload; if (payload.type === 'digital') { // aka button press/release var digitalDiv = d3.select('#digital'); var selection = digitalDiv.selectAll('#' + payload.name).data([payload]); selection.enter() .append('div') .attr('id', function(d) { return d.name; }) .attr('clas...
conditional_block
__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # Ingenieria ADHOC - ADHOC SA # https://launchpad.net/~ingenieria-adhoc # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lice...
# ############################################################################## import waybill import wizard import travel import vehicle import requirement import res_partner import waybill_expense import account_invoice # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>.
random_line_split
comments.rs
// Copyright 2012-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-MI...
#[test] fn test_block_doc_comment_2() { let comment = "/**\n * Test\n * Test\n*/"; let stripped = strip_doc_comment_decoration(comment); assert_eq!(stripped, " Test\n Test".to_string()); } #[test] fn test_block_doc_comment_3() { let comment = "/**\n let a: *int;\n *a = 5...
{ let comment = "/**\n * Test \n ** Test\n * Test\n*/"; let stripped = strip_doc_comment_decoration(comment); assert_eq!(stripped, " Test \n* Test\n Test".to_string()); }
identifier_body
comments.rs
// Copyright 2012-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-MI...
if c == '*' { if first { i = j; first = false; } else if i != j { can_trim = false; } break; } } if i > line.le...
{ can_trim = false; break; }
conditional_block
comments.rs
// Copyright 2012-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-MI...
{ /// No code on either side of each line of the comment Isolated, /// Code exists to the left of the comment Trailing, /// Code before /* foo */ and after the comment Mixed, /// Just a manual blank line "\n\n", for layout BlankLine, } #[deriving(Clone)] pub struct Comment { pub st...
CommentStyle
identifier_name
comments.rs
// Copyright 2012-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-MI...
curr_line.push('/'); level -= 1; } else { rdr.bump(); } } } } if curr_line.len() != 0 { trim_whitespace_prefix_and_push_line(&mut lines, curr_line,...
rdr.bump(); rdr.bump();
random_line_split
intl-enzyme-test-helper.js
/** * Components using the react-intl module require access to the intl context. * This is not available when mounting single components in Enzyme. * These helper functions aim to address that and wrap a valid, * English-locale intl context around them. */ import React from 'react'; import { IntlProvider, intlSha...
/** * Mount the node with Intl provider context. * @param {Component} node - Any React Component * @param {Object} context * @param {Object} messages - A map with keys (id) and messages (value) * @param {string} locale - Locale string */ export function mountWithIntl(node, { context, childContextTypes } = {}, m...
{ return shallow( nodeWithIntlProp(node), { context: Object.assign({}, context, { intl: createIntlContext(messages, locale) }), } ); }
identifier_body
intl-enzyme-test-helper.js
/** * Components using the react-intl module require access to the intl context. * This is not available when mounting single components in Enzyme. * These helper functions aim to address that and wrap a valid, * English-locale intl context around them. */ import React from 'react'; import { IntlProvider, intlSha...
(node, { context, childContextTypes } = {}, messages = {}, locale = 'en') { return mount( nodeWithIntlProp(node), { context: Object.assign({}, context, { intl: createIntlContext(messages, locale) }), childContextTypes: Object.assign({}, { intl: intlShape }, childContextTypes) } ); }
mountWithIntl
identifier_name
intl-enzyme-test-helper.js
/** * Components using the react-intl module require access to the intl context. * This is not available when mounting single components in Enzyme. * These helper functions aim to address that and wrap a valid, * English-locale intl context around them. */ import React from 'react'; import { IntlProvider, intlSha...
* @param {Component} node - Any React Component * @param {Object} context * @param {Object} messages - A map with keys (id) and messages (value) * @param {string} locale - Locale string */ export function mountWithIntl(node, { context, childContextTypes } = {}, messages = {}, locale = 'en') { return mount( n...
); } /** * Mount the node with Intl provider context.
random_line_split
overload.rs
// https://rustbyexample.com/macros/overload.html // http://rust-lang-ja.org/rust-by-example/macros/overload.html // `test!` will compare `$left` and `$right` // in different ways depending on how you invoke it: macro_rules! test { // Arguments don't need to be separated by a comma. // Any template can be used...
() { test!(1i32 + 1 == 2i32; and 2i32 * 2 == 4i32); test!(true; or false); }
main
identifier_name
overload.rs
// https://rustbyexample.com/macros/overload.html // http://rust-lang-ja.org/rust-by-example/macros/overload.html // `test!` will compare `$left` and `$right` // in different ways depending on how you invoke it: macro_rules! test { // Arguments don't need to be separated by a comma. // Any template can be used...
{ test!(1i32 + 1 == 2i32; and 2i32 * 2 == 4i32); test!(true; or false); }
identifier_body
overload.rs
// https://rustbyexample.com/macros/overload.html // http://rust-lang-ja.org/rust-by-example/macros/overload.html // `test!` will compare `$left` and `$right` // in different ways depending on how you invoke it: macro_rules! test { // Arguments don't need to be separated by a comma. // Any template can be used...
); // ^ each arm must end with a semicolon. ($left:expr; or $right:expr) => ( println!("{:?} or {:?} is {:?}", stringify!($left), stringify!($right), $left || $right) ); } fn main() { test!(1i32 + 1 == 2i32; and 2i32 * 2 == 4i32); te...
($left:expr; and $right:expr) => ( println!("{:?} and {:?} is {:?}", stringify!($left), stringify!($right), $left && $right)
random_line_split
weird-exprs.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 ...
() { strange(); funny(); what(); zombiejesus(); notsure(); canttouchthis(); angrydome(); evil_lincoln(); }
main
identifier_name
weird-exprs.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() { strange(); funny(); what(); zombiejesus(); notsure(); canttouchthis(); angrydome(); evil_lincoln(); }
{ let evil = debug!("lincoln"); }
identifier_body
weird-exprs.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 ...
let _a = (assert!((true)) == (assert!(p()))); let _c = (assert!((p())) == ()); let _b: bool = (debug!("%d", 0) == (return 0u)); } fn angrydome() { loop { if break { } } let mut i = 0; loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail!("wat") } } break; } } fn evil_lincoln() {...
let _b = util::swap(&mut _y, &mut _z) == util::swap(&mut _y, &mut _z); } fn canttouchthis() -> uint { fn p() -> bool { true }
random_line_split
weird-exprs.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 ...
}; } else if (return) { return; } } if (return) { break; } } } fn notsure() { let mut _x; let mut _y = (_x = 0) == (_x = 0); let mut _z = (_x = 0) < (_x = 0); let _a = (_x += 0) == (_x = 0); let _b = util::swap(&mut _y, &m...
{ return }
conditional_block
build_utils_codes.py
''' Copyright (C) 2016 Bastille Networks This program 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 3 of the License, or (at your option) any later version. This program is distribut...
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' def i_code (code3): return code3[0] def o_code (code3): if len (code3) >= 2: return code3[1] else: return code3[0] def tap_code (code3): if l...
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
random_line_split
build_utils_codes.py
''' Copyright (C) 2016 Bastille Networks This program 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 3 of the License, or (at your option) any later version. This program is distribut...
else: return code3[0] def tap_code (code3): if len (code3) >= 3: return code3[2] else: return code3[0] def i_type (code3): return char_to_type[i_code (code3)] def o_type (code3): return char_to_type[o_code (code3)] def tap_type (code3): return char_to_type[tap_code (...
return code3[1]
conditional_block
build_utils_codes.py
''' Copyright (C) 2016 Bastille Networks This program 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 3 of the License, or (at your option) any later version. This program is distribut...
(code3): return code3[0] def o_code (code3): if len (code3) >= 2: return code3[1] else: return code3[0] def tap_code (code3): if len (code3) >= 3: return code3[2] else: return code3[0] def i_type (code3): return char_to_type[i_code (code3)] def o_type (code3)...
i_code
identifier_name
build_utils_codes.py
''' Copyright (C) 2016 Bastille Networks This program 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 3 of the License, or (at your option) any later version. This program is distribut...
char_to_type = {} char_to_type['s'] = 'short' char_to_type['i'] = 'int' char_to_type['f'] = 'float' char_to_type['c'] = 'gr_complex' char_to_type['b'] = 'unsigned char'
return char_to_type[tap_code (code3)]
identifier_body
script.js
/** * @file * A JavaScript file for the theme. * * In order for this JavaScript to be loaded on pages, see the instructions in * the README.txt next to this file. */ // JavaScript should be made compatible with libraries other than jQuery by // wrapping it with an "anonymous closure". See: // - http://drupal.org...
meanRemoveAttrs: true, meanDisplay: "table", meanMenuOpen: "<span></span><span></span><span></span>", meanRevealPosition: "left", meanMenuClose: "<span></span><span></span><span></span>" }); jQuery("#block-block-10 .social-icon .search").click(function(event...
random_line_split
script.js
/** * @file * A JavaScript file for the theme. * * In order for this JavaScript to be loaded on pages, see the instructions in * the README.txt next to this file. */ // JavaScript should be made compatible with libraries other than jQuery by // wrapping it with an "anonymous closure". See: // - http://drupal.org...
}); }); // Place your code here. })(jQuery, Drupal, this, this.document);
{ jQuery('#content-text').addClass('.open').show('slow'); jQuery('#toggle-text').html('Read Less'); }
conditional_block
scalar.rs
use std::usize; use test::{black_box, Bencher}; use tipb::ScalarFuncSig; fn get_scalar_args_with_match(sig: ScalarFuncSig) -> (usize, usize) { // Only select some functions to benchmark let (min_args, max_args) = match sig { ScalarFuncSig::LtInt => (2, 2), ScalarFuncSig::CastIntAsInt => (1, 1),...
use collections::HashMap;
random_line_split
scalar.rs
use collections::HashMap; use std::usize; use test::{black_box, Bencher}; use tipb::ScalarFuncSig; fn get_scalar_args_with_match(sig: ScalarFuncSig) -> (usize, usize) { // Only select some functions to benchmark let (min_args, max_args) = match sig { ScalarFuncSig::LtInt => (2, 2), ScalarFuncSi...
#[bench] fn bench_get_scalar_args_with_map(b: &mut Bencher) { let m = init_scalar_args_map(); b.iter(|| { for _ in 0..1000 { black_box(get_scalar_args_with_map( black_box(&m), black_box(ScalarFuncSig::AbsInt), )); } }) }
{ b.iter(|| { for _ in 0..1000 { black_box(get_scalar_args_with_match(black_box(ScalarFuncSig::AbsInt))); } }) }
identifier_body
scalar.rs
use collections::HashMap; use std::usize; use test::{black_box, Bencher}; use tipb::ScalarFuncSig; fn get_scalar_args_with_match(sig: ScalarFuncSig) -> (usize, usize) { // Only select some functions to benchmark let (min_args, max_args) = match sig { ScalarFuncSig::LtInt => (2, 2), ScalarFuncSi...
() -> HashMap<ScalarFuncSig, (usize, usize)> { let mut m: HashMap<ScalarFuncSig, (usize, usize)> = HashMap::default(); let tbls = vec![ (ScalarFuncSig::LtInt, (2, 2)), (ScalarFuncSig::CastIntAsInt, (1, 1)), (ScalarFuncSig::IfInt, (3, 3)), (ScalarFuncSig::JsonArraySig, (0, usize:...
init_scalar_args_map
identifier_name
response.js
'use strict'; // Load modules const Http = require('http'); const Stream = require('stream'); // Declare internals const internals = {}; exports = module.exports = class Response extends Http.ServerResponse { constructor(req, onEnd) { super({ method: req.method, httpVersionMajor: 1, httpVersionMino...
res.trailers = response._shot.trailers; return res; }; // Throws away all written data to prevent response from buffering payload internals.nullSocket = function () { return new Stream.Writable({ write(chunk, encoding, callback) { setImmediate(callback); } }); };
const rawBuffer = Buffer.concat(response._shot.payloadChunks); res.rawPayload = rawBuffer; res.payload = rawBuffer.toString();
random_line_split
response.js
'use strict'; // Load modules const Http = require('http'); const Stream = require('stream'); // Declare internals const internals = {}; exports = module.exports = class Response extends Http.ServerResponse { constructor(req, onEnd) { super({ method: req.method, httpVersionMajor: 1, httpVersionMino...
}); return result; } write(data, encoding, callback) { super.write(data, encoding, callback); this._shot.payloadChunks.push(new Buffer(data, encoding)); return true; // Write always returns false when disconnected ...
{ this._shot.headers[name.toLowerCase()] = field[1]; }
conditional_block
response.js
'use strict'; // Load modules const Http = require('http'); const Stream = require('stream'); // Declare internals const internals = {}; exports = module.exports = class Response extends Http.ServerResponse { constructor(req, onEnd) { super({ method: req.method, httpVersionMajor: 1, httpVersionMino...
write(data, encoding, callback) { super.write(data, encoding, callback); this._shot.payloadChunks.push(new Buffer(data, encoding)); return true; // Write always returns false when disconnected } end(data, encoding, callback) { ...
{ const result = super.writeHead.apply(this, arguments); this._shot.headers = Object.assign({}, this._headers); // Should be .getHeaders() since node v7.7 // Add raw headers ['Date', 'Connection', 'Transfer-Encoding'].forEach((name) => { const regex = new RegExp('\...
identifier_body
response.js
'use strict'; // Load modules const Http = require('http'); const Stream = require('stream'); // Declare internals const internals = {}; exports = module.exports = class Response extends Http.ServerResponse { constructor(req, onEnd) { super({ method: req.method, httpVersionMajor: 1, httpVersionMino...
(data, encoding, callback) { if (data) { this.write(data, encoding); } super.end(callback); this.emit('finish'); } destroy() { } addTrailers(trailers) { for (const key in trailers) { this._shot.trailers[key.toLowerCase().trim()] = tra...
end
identifier_name
imports_config.py
# Example import configuration. import_templates = [{ 'id': 'my_import', 'label': 'My Import (Trident)', 'defaults': [ ('ds', '16607027920896001'), ('itt', '1'), ('mr', '1'), ('impstp', '1'), ('asa', '1'),
{ 'id': 'dr', 'label': 'Directory containing files to import', 'type': 'directory', 'default': 'files', }, ('clean_old_data', '1'), ('from_today', '1'), ], 'admins': [('root', 'admin@example.com')], 'uploaders': [('uploader', [...
('impjun', '0'), ('dtd', '5'),
random_line_split
index.js
var express = require('express'); var request = require('request'); // Constants var PORT = 8080;
// App var app = express(); app.get('/', function (req, res) { res.send('A prototype of a micro-service hosting service. An example can be retrieved from https://funcist.ns.mg/7c9600b9d2a5f3b991ab\n'); }); app.get('/:gist_id', function (req, res) { request({ url: 'https://api.github.com/gists/' + req....
random_line_split
exploration-category.service.spec.ts
// Copyright 2020 The Oppia Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by ap...
}); });
let Normalize = 'Exploration Category Service'; expect(service._normalize(NotNormalize)).toBe(Normalize);
random_line_split
nl-AW.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
[['a.m.', 'p.m.'], u, u], u, [ ['Z', 'M', 'D', 'W', 'D', 'V', 'Z'], ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'] ], u, [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', '...
return 5; } export default [ 'nl-AW',
random_line_split
nl-AW.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
export default [ 'nl-AW', [['a.m.', 'p.m.'], u, u], u, [ ['Z', 'M', 'D', 'W', 'D', 'V', 'Z'], ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'] ], u, [ ['J', 'F', 'M', '...
{ let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; }
identifier_body
nl-AW.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
(n: number): number { let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } export default [ 'nl-AW', [['a.m.', 'p.m.'], u, u], u, [ ['Z', 'M', 'D', 'W', 'D', 'V', 'Z'], ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], ['zondag...
plural
identifier_name
daily_attendance_plot_presenter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-sheet Analyser: Python library which allows to analyse time-sheets. # Copyright (C) 2017 Carlos Serra Toro. # # This program 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 S...
# Plots the averaged starting & ending times. average_line_fmt = {'fmt': 'm-', 'linewidth': 2, 'visible': True} average_start_times = average_sequence(start_times, win_size=days_in_week) axes.plot_date(dates, average_start_times, **average_line_fmt) average_end_times = average_sequence(end_times, ...
for time_span in time_sheet[date]: start_time = time_to_float_time(time_span.start_time) end_time = time_to_float_time(time_span.end_time) normalised_start_time = normalise_number(start_time, input_range=hours_range) n...
conditional_block
daily_attendance_plot_presenter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-sheet Analyser: Python library which allows to analyse time-sheets. # Copyright (C) 2017 Carlos Serra Toro. # # This program 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 S...
""" Represent a TimeSheet as a graphic view of all the attendance entries separately, grouped by days, as a bar plot. :param time_sheet: An object of type TimeSheet. :return: True """ dates = time_sheet.get_dates(sort=True) days_in_week = 5 min_hour = 24 max_hour = 0 ...
identifier_body
daily_attendance_plot_presenter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-sheet Analyser: Python library which allows to analyse time-sheets. # Copyright (C) 2017 Carlos Serra Toro. # # This program 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 S...
(time_sheet): """ Represent a TimeSheet as a graphic view of all the attendance entries separately, grouped by days, as a bar plot. :param time_sheet: An object of type TimeSheet. :return: True """ dates = time_sheet.get_dates(sort=True) days_in_week = 5 min_hour = 24 ...
daily_attendance_plot_presenter
identifier_name
daily_attendance_plot_presenter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-sheet Analyser: Python library which allows to analyse time-sheets. # Copyright (C) 2017 Carlos Serra Toro. # # This program 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 S...
average_start_times = average_sequence(start_times, win_size=days_in_week) axes.plot_date(dates, average_start_times, **average_line_fmt) average_end_times = average_sequence(end_times, win_size=days_in_week) axes.plot_date(dates, average_end_times, **average_line_fmt) axes.grid(True) axes.set_...
random_line_split
remote_fs_test.py
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software...
body='{"value": "SGVsbG9Xb3JsZA=="}', ) dest_path = '/path/to/file.txt' assert driver.pull_file(dest_path) == str(base64.b64encode(bytes('HelloWorld', 'utf-8')).decode('utf-8')) d = get_httpretty_request_body(httpretty.last_request()) assert d['path'] == dest_path ...
def test_pull_file(self): driver = android_w3c_driver() httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/appium/device/pull_file'),
random_line_split
remote_fs_test.py
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software...
(self): driver = android_w3c_driver() httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/appium/device/push_file'), ) dest_path = '/path/to/file.txt' with pytest.raises(InvalidArgumentException): driver.push_file(dest_...
test_push_file_invalid_arg_exception_without_src_path_and_base64data
identifier_name
remote_fs_test.py
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software...
@httpretty.activate def test_pull_file(self): driver = android_w3c_driver() httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/appium/device/pull_file'), body='{"value": "SGVsbG9Xb3JsZA=="}', ) dest_path = '/path/to/f...
driver = android_w3c_driver() httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/appium/device/push_file'), ) dest_path = '/dest_path/to/file.txt' src_path = '/src_path/to/file.txt' with pytest.raises(InvalidArgumentException): ...
identifier_body
pib.py
# pib.py - functions for handling Serbian VAT numbers # coding: utf-8 # # Copyright (C) 2017 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the L...
(number): """Check if the number is a valid VAT number.""" try: return bool(validate(number)) except ValidationError: return False
is_valid
identifier_name