file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
tagging_converter_test.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
ain()
conditional_block
tagging_converter_test.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
(parameterized.TestCase): @parameterized.parameters( # A simple test. { 'input_texts': ['Turing was born in 1912 .', 'Turing died in 1954 .'], 'target': 'Turing was born in 1912 and died in 1954 .', 'phrase_vocabulary': ['and'], 'target_tags': [ 'KEEP...
TaggingConverterTest
identifier_name
iso_8859_7.rs
969, 970, 971, 972, 973, 974, 65535, ]; #[inline] pub fn forward(code: u8) -> u16 { FORWARD_TABLE[(code - 0x80) as uint] } static BACKWARD_TABLE_LOWER: &'static [u8] = &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, 135,...
backward
identifier_name
iso_8859_7.rs
: u8) -> u16 { FORWARD_TABLE[(code - 0x80) as uint] } static BACKWARD_TABLE_LOWER: &'static [u8] = &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, ...
{BACKWARD_TABLE_UPPER[offset] as uint}
conditional_block
iso_8859_7.rs
56, 157, 158, 159, 160, 8216, 8217, 163, 8364, 8367, 166, 167, 168, 169, 890, 171, 172, 173, 65535, 8213, 176, 177, 178, 179, 900, 901, 902, 183, 904, 905, 906, 187, 908, 189, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 65535, 931, 932, 933, 934, ...
static BACKWARD_TABLE_LOWER: &'static [u8] = &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159...
{ FORWARD_TABLE[(code - 0x80) as uint] }
identifier_body
iso_8859_7.rs
// // For details on index-iso-8859-7.txt see the Encoding Standard // http://encoding.spec.whatwg.org/ static FORWARD_TABLE: &'static [u16] = &[ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 1...
// // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/
random_line_split
helpers.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import argparse, re, os, glob, sys, pprint, itertools import inspect import numpy as np config = { 'end': '\n', 'fmt': '%s ', 'sep': '->', 'file': None,...
(theta, radius, units='deg'): """Convert from polar to cartesian coordinates **usage**: x,y = pol2cart(theta, radius, units='deg') """ if units in ['deg', 'degs']: theta = theta * np.pi / 180.0 xx = radius * np.cos(theta) yy = radius * np.sin(theta) return xx, yy
pol2cart
identifier_name
helpers.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import argparse, re, os, glob, sys, pprint, itertools import inspect import numpy as np config = { 'end': '\n', 'fmt': '%s ', 'sep': '->', 'file': None,...
except Exception as err: raise err def pol2cart(theta, radius, units='deg'): """Convert from polar to cartesian coordinates **usage**: x,y = pol2cart(theta, radius, units='deg') """ if units in ['deg', 'degs']: theta = theta * np.pi / 180.0 xx = radius * np.cos(theta...
v_str = str(v) v_str = "`%s`" % v_str if v_str.count('\n') == 0 else v_str print(config['fmt'] % (n.strip()) + config['sep'], v_str, end=config['end'], file=config['file'])
conditional_block
helpers.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import argparse, re, os, glob, sys, pprint, itertools import inspect import numpy as np config = { 'end': '\n', 'fmt': '%s ', 'sep': '->', 'file': None,...
def pol2cart(theta, radius, units='deg'): """Convert from polar to cartesian coordinates **usage**: x,y = pol2cart(theta, radius, units='deg') """ if units in ['deg', 'degs']: theta = theta * np.pi / 180.0 xx = radius * np.cos(theta) yy = radius * np.sin(theta) return xx,...
except Exception as err: raise err
random_line_split
helpers.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import argparse, re, os, glob, sys, pprint, itertools import inspect import numpy as np config = { 'end': '\n', 'fmt': '%s ', 'sep': '->', 'file': None,...
def pol2cart(theta, radius, units='deg'): """Convert from polar to cartesian coordinates **usage**: x,y = pol2cart(theta, radius, units='deg') """ if units in ['deg', 'degs']: theta = theta * np.pi / 180.0 xx = radius * np.cos(theta) yy = radius * np.sin(theta) return xx...
try: st = inspect.stack()[1] funcName = st[3] funcCallStr = st[4] varnames = re.search('debug\((.*)\)', funcCallStr[0]) varnames = varnames.groups()[0].split(',') for n, v in zip(varnames, args): v_str = str(v) v_str = "`%s`" % v_str if v_str.cou...
identifier_body
index.js
import { R, BPromise, log, chalk, promisifyAll } from '../utils'; var GithubApi = require("github"); class Github { constructor(api_key) { this.api_key = api_key; this.api = new GithubApi({ version: '3.0.0', // debug: true }); this.api.authenticate({ type: "basic", username: ...
parseUrl(url) { var regex = /^(?:.*\/)?([\w-_.]*)\/([\w-_.]*)$/g; var params = regex.exec(url); if (!params) { throw new Error(`Invalid url to parse: ${url}`); } return { user: params[1], repo: params[2] }; } } module.exports = { __esModule: true, get default ...
random_line_split
index.js
import { R, BPromise, log, chalk, promisifyAll } from '../utils'; var GithubApi = require("github"); class Github { constructor(api_key) { this.api_key = api_key; this.api = new GithubApi({ version: '3.0.0', // debug: true }); this.api.authenticate({ type: "basic", username: ...
getCommentsByIssue(issue, params) { var params_with_issue = R.merge(params, { number: issue.number }); log(" Get comments to issue", chalk.green(`#${issue.number}`), issue.title); return this.client.issues.getCommentsAsync(params_with_issue); } issuesWithCommentsByRepo(repo, params) { retur...
{ var msg_arr = [ " Get issues (and pull_request) to repository", chalk.green(`${params.user}/${params.repo}`) ]; if (params.state) { msg_arr.push("with state", params.state); } log(...msg_arr); return this.client.issues.repoIssuesAsync(params); }
identifier_body
index.js
import { R, BPromise, log, chalk, promisifyAll } from '../utils'; var GithubApi = require("github"); class Github { constructor(api_key) { this.api_key = api_key; this.api = new GithubApi({ version: '3.0.0', // debug: true }); this.api.authenticate({ type: "basic", username: ...
log(...msg_arr); return this.client.issues.repoIssuesAsync(params); } getCommentsByIssue(issue, params) { var params_with_issue = R.merge(params, { number: issue.number }); log(" Get comments to issue", chalk.green(`#${issue.number}`), issue.title); return this.client.issues.getCommentsAs...
{ msg_arr.push("with state", params.state); }
conditional_block
index.js
import { R, BPromise, log, chalk, promisifyAll } from '../utils'; var GithubApi = require("github"); class Github { constructor(api_key) { this.api_key = api_key; this.api = new GithubApi({ version: '3.0.0', // debug: true }); this.api.authenticate({ type: "basic", username: ...
() { return Github; }, get GithubToPivotal() { return require('./to/pivotal').GithubToPivotal; } };
Github
identifier_name
plotDragCoefficient.py
""" Plots the instantaneous drag coefficient between 0 and 3 time-units of flow simulation and compares with numerical results from Koumoutsakos and Leonard (1995). _References:_ * Koumoutsakos, P., & Leonard, A. (1995). High-resolution simulations of the flow around an impulsively started cylinder using vortex me...
data = collections.OrderedDict({}) # Reads forces from file. label = 'PetIBM' filepath = simu_dir / 'forces-0.txt' with open(filepath, 'r') as infile: t, fx = numpy.loadtxt(infile, dtype=numpy.float64, unpack=True, usecols=(0, 1)) data[label] = {'t': t, 'cd': 2 * fx} data[label]['kwargs...
root_dir = simu_dir.parents[1]
conditional_block
plotDragCoefficient.py
""" Plots the instantaneous drag coefficient between 0 and 3 time-units of flow simulation and compares with numerical results from Koumoutsakos and Leonard (1995). _References:_ * Koumoutsakos, P., & Leonard, A. (1995). High-resolution simulations of the flow around an impulsively started cylinder using vortex me...
data = collections.OrderedDict({}) # Reads forces from file. label = 'PetIBM' filepath = simu_dir / 'forces-0.txt' with open(filepath, 'r') as infile: t, fx = numpy.loadtxt(infile, dtype=numpy.float64, unpack=True, usecols=(0, 1)) data[label] = {'t': t, 'cd': 2 * fx} data[label]['kwargs']...
simu_dir = pathlib.Path(__file__).absolute().parents[1] root_dir = os.environ.get('PETIBM_EXAMPLES') if not root_dir: root_dir = simu_dir.parents[1]
random_line_split
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
}) } /// Given a settings page and a name, returns the row that has that name. pub fn get_row_by_name(page: &'static SettingsPage, name: &str) -> &'static SettingRow { for row in page.iter() { if row.name == name { return row } } panic!("No setting row with that name in...
{ directory_exit(s, settings__.clone()); }
conditional_block
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
.parse() .expect("Unable to parse last-page value into usize!"); let last_page = PAGE_LIST[last_page_ix]; let changed = check_changes(s, last_page, settings_.clone()); if changed { let ix = get_page_index(new_page.name) ...
.on_submit(move |s, new_page| { let new_page: &&'static SettingsPage = new_page; let last_page_ix: usize = settings_.get(String::from("last-page")) .expect("`last-page` wasn't in settings.")
random_line_split
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
/// Commits all changes for a page to the internal Settings object and then writes them to all files. fn save_changes(s: &mut Cursive, page: &SettingsPage, settings: Settings) { for row in page.iter() { let cur_val = get_by_id(row.id, s).expect(&format!("Couldn't get value by id for: {}", row.id)); ...
{ for row in page.iter() { let cur_val = get_by_id(row.id, s) .expect(&format!("Unable to get {} by id!", row.id)); let last_val_opt = settings.get(String::from(row.id)); let last_val = if last_val_opt.is_none() { String::from(row.default.expect(&format!("No past val ...
identifier_body
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
(s: &mut Cursive, page: &SettingsPage, settings: Settings) -> bool { for row in page.iter() { let cur_val = get_by_id(row.id, s) .expect(&format!("Unable to get {} by id!", row.id)); let last_val_opt = settings.get(String::from(row.id)); let last_val = if last_val_opt.is_none() {...
check_changes
identifier_name
service.py
# service.py is part of Panopticon. # Panopticon 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. # Panopticon is distributed in the h...
def __str__(self): if self.service is None: return self.name else: return ".".join((str(self.service), self.name)) class ServiceDecoratorAction(DecoratorAction, ServiceAction): def __init__(self, function, name=None, service=None, launcher=None): super(ServiceDec...
random_line_split
service.py
# service.py is part of Panopticon. # Panopticon 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. # Panopticon is distributed in the h...
return actions
new_action = service_action_class(name=raname, service=self.service) actions[raname] = new_action defined_action_names.append(raname)
conditional_block
service.py
# service.py is part of Panopticon. # Panopticon 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. # Panopticon is distributed in the h...
def launch(self, *args, **kwargs): super(ServiceActionLauncher, self).launch(*args, **kwargs) class ServiceActionManager(ActionManager): action_launcher_class = ServiceActionLauncher _managed_obj_name = "service" _manager_attribute_class = ServiceAction def _get_base_dict(self): ...
super(ServiceActionLauncher, self).__init__(name, service.roles) ServiceAction.__init__(self, name=name, service=service, launcher=launcher)
identifier_body
service.py
# service.py is part of Panopticon. # Panopticon 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. # Panopticon is distributed in the h...
(self, name=None, service=None, launcher=None): super(ServiceActionLauncher, self).__init__(name, service.roles) ServiceAction.__init__(self, name=name, service=service, launcher=launcher) def launch(self, *args, **kwargs): super(ServiceActionLauncher, self).launch...
__init__
identifier_name
regions-addr-of-self.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 ...
} fn dog() -> dog { dog { cats_chased: 0u } } fn main() { let mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
{ let p: &mut uint = &mut self.cats_chased; *p += 1u; }
identifier_body
regions-addr-of-self.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 ...
*p += 1u; } pub fn chase_cat_2(&mut self) { let p: &mut uint = &mut self.cats_chased; *p += 1u; } } fn dog() -> dog { dog { cats_chased: 0u } } fn main() { let mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
pub fn chase_cat(&mut self) { let p: &'static mut uint = &mut self.cats_chased; //~ ERROR cannot infer an appropriate lifetime
random_line_split
regions-addr-of-self.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 mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
main
identifier_name
speechBubble.js
function SpeechBubbleObject(masta) { GameObject.call(this); this.font = "18px Arial"; this.text = ""; this.master = masta; this.position = new Vector2(0,0); this.size = new Vector2(0,0); this.depth = 90; this.displayTimeLimit = 0; this.display = false; this.displayTimer = 0; this.setText = function(tex...
context.lineWidth = 2; context.font = this.font; context.fillStyle = "#FFFFFF"; context.drawBubble(this.position.x, this.position.y-200, this.size.x, this.size.y, this.position.x, this.position.y,25); context.fillStyle = "#000000"; context.wrapText(this.text,this.position.x+10,this.position.y-167,...
{ this.display = false; this.displayTimer = 0; }
conditional_block
speechBubble.js
function SpeechBubbleObject(masta)
this.size.y = 96; this.text = text; this.displayTimeLimit = (text.length+60)*2; } this.draw = function() { this.isDoomed = this.master.isDoomed; if (!this.display) return; this.displayTimer++; if (this.displayTimeLimit <= this.displayTimer) { this.display = false; this.displayTimer = 0;...
{ GameObject.call(this); this.font = "18px Arial"; this.text = ""; this.master = masta; this.position = new Vector2(0,0); this.size = new Vector2(0,0); this.depth = 90; this.displayTimeLimit = 0; this.display = false; this.displayTimer = 0; this.setText = function(text) { context.font = this.font; ...
identifier_body
speechBubble.js
function SpeechBubbleObject(masta) { GameObject.call(this); this.font = "18px Arial"; this.text = ""; this.master = masta; this.position = new Vector2(0,0);
this.depth = 90; this.displayTimeLimit = 0; this.display = false; this.displayTimer = 0; this.setText = function(text) { context.font = this.font; this.size.x = 225; this.size.y = 96; this.text = text; this.displayTimeLimit = (text.length+60)*2; } this.draw = function() { this.isDoomed...
this.size = new Vector2(0,0);
random_line_split
speechBubble.js
function
(masta) { GameObject.call(this); this.font = "18px Arial"; this.text = ""; this.master = masta; this.position = new Vector2(0,0); this.size = new Vector2(0,0); this.depth = 90; this.displayTimeLimit = 0; this.display = false; this.displayTimer = 0; this.setText = function(text) { context.font = this...
SpeechBubbleObject
identifier_name
ping.js
const ping = require('ping') const speech = require('../speech') /** * Ping the server. * @param {string} host IP or Domain * @param {number} [num=1] Ping count * @returns {Promise<object, object>} Object or Error */ const getPing = (host, num = 1) => { return new Promise((resolve, reject) => { if (/^(\d{1,...
} else { reject(new Error(speech.ping.error)) } }) } module.exports = getPing if (require.main === module) { require('./ping')('google.com', 3).then(res => { console.log(res) }).catch(err => { console.log(err.message) }) }
})
random_line_split
ping.js
const ping = require('ping') const speech = require('../speech') /** * Ping the server. * @param {string} host IP or Domain * @param {number} [num=1] Ping count * @returns {Promise<object, object>} Object or Error */ const getPing = (host, num = 1) => { return new Promise((resolve, reject) => { if (/^(\d{1,...
{ require('./ping')('google.com', 3).then(res => { console.log(res) }).catch(err => { console.log(err.message) }) }
conditional_block
slider.ts
? !this._invertAxis : this._invertAxis; } /** The language direction for this slider element. */ private get _direction() { return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr'; } constructor(renderer: Renderer2, elementRef: ElementRef, private _focusMonitor: Focus...
_getSliderDimensions
identifier_name
slider.ts
know. this._changeDetectorRef.markForCheck(); } private _max: number = 100; /** The minimum value that the slider can have. */ @Input() get min() { return this._min; } set min(v: number) { this._min = coerceNumberProperty(v, this._min); // If the value wasn't explicitly set by the user, set i...
set tickInterval(value) { if (value === 'auto') { this._tickInterval = 'auto'; } else if (typeof value === 'number' || typeof value === 'string') { this._tickInterval = coerceNumberProperty(value, this._tickInterval as number); } else { this._tickInterval = 0; } } private _tickI...
{ return this._tickInterval; }
identifier_body
slider.ts
know. this._changeDetectorRef.markForCheck(); } private _max: number = 100; /** The minimum value that the slider can have. */ @Input() get min() { return this._min; } set min(v: number) { this._min = coerceNumberProperty(v, this._min); // If the value wasn't explicitly set by the user, set i...
// Since this could modify the label, we need to notify the change detection. this._changeDetectorRef.markForCheck(); } private _step: number = 1; /** Whether or not to show the thumb label. */ @Input() get thumbLabel(): boolean { return this._thumbLabel; } set thumbLabel(value) { this._thumbLabe...
{ this._roundLabelTo = this._step.toString().split('.').pop()!.length; }
conditional_block
slider.ts
detection know. this._changeDetectorRef.markForCheck(); } private _max: number = 100; /** The minimum value that the slider can have. */ @Input() get min() { return this._min; } set min(v: number) { this._min = coerceNumberProperty(v, this._min); // If the value wasn't explicitly set by the u...
if (value === 'auto') { this._tickInterval = 'auto'; } else if (typeof value === 'number' || typeof value === 'string') { this._tickInterval = coerceNumberProperty(value, this._tickInterval as number); } else { this._tickInterval = 0; } } private _tickInterval: 'auto' | number = 0;...
random_line_split
core_player_handler_spec.ts
/** * @license * Copyright Google Inc. 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 */ import {PlayState} from '../../../src/render3/interfaces/player'; import {CorePlayerHandler} from '../../../src/rende...
const p1 = new MockPlayer(); const p2 = new MockPlayer(); expect(p1.state).toEqual(PlayState.Pending); expect(p2.state).toEqual(PlayState.Pending); handler.queuePlayer(p1); handler.queuePlayer(p2); expect(p1.state).toEqual(PlayState.Pending); expect(p2.state).toEqual(PlayState.Pending...
it('should kick off any animation players that have been queued once flushed', () => { const handler = new CorePlayerHandler();
random_line_split
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
() -> Result<()> { // create local execution context let mut ctx = ExecutionContext::new(); // define schema for data source (csv file) let schema = Arc::new(Schema::new(vec![ Field::new("c1", DataType::Utf8, false), Field::new("c2", DataType::UInt32, false), Field::new("c3", Da...
main
identifier_name
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use datafusion::error::Result; use datafusion::execution::context::ExecutionContext; /// This example demonstrates executing a simple query against an Arrow data source (CSV) and /// fetching results fn main() -> Result<()> { // create local execution context let mut ctx = ExecutionContext::new(); // def...
use arrow::array::{BinaryArray, Float64Array}; use arrow::datatypes::{DataType, Field, Schema};
random_line_split
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
let testdata = ::std::env::var("ARROW_TEST_DATA").expect("ARROW_TEST_DATA not defined"); // register csv file with the execution context ctx.register_csv( "aggregate_test_100", &format!("{}/csv/aggregate_test_100.csv", testdata), &schema, true, ); let sql =...
{ // create local execution context let mut ctx = ExecutionContext::new(); // define schema for data source (csv file) let schema = Arc::new(Schema::new(vec![ Field::new("c1", DataType::Utf8, false), Field::new("c2", DataType::UInt32, false), Field::new("c3", DataType::Int8, fal...
identifier_body
system.py
import re, time, os, shutil, string from subprocess import Popen, PIPE, STDOUT from random import randint, seed __all__ = ['find', 'removedirs', 'source', 'tempfile', 'copy', 'rm', 'template, template_dir'] def find(path='.', regex='*', ctime=0): r = [] regex = str(regex).strip() if regex == '*': regex = ...
raise OSError('cannot create a temporary directory')
conditional_block
system.py
import re, time, os, shutil, string from subprocess import Popen, PIPE, STDOUT from random import randint, seed __all__ = ['find', 'removedirs', 'source', 'tempfile', 'copy', 'rm', 'template, template_dir'] def find(path='.', regex='*', ctime=0): r = [] regex = str(regex).strip() if regex == '*': regex = ...
(prefix='', suffix=''): n = 7 i = 0 while 1: try: path = os.path.join(tempfile.tempdir, prefix + tempfile.randstr(n) + suffix) os.mkdir(path) return path except OSError: i = i + 1 if i%10==0: n = n + 1 if ...
mkdtemp
identifier_name
system.py
import re, time, os, shutil, string from subprocess import Popen, PIPE, STDOUT from random import randint, seed __all__ = ['find', 'removedirs', 'source', 'tempfile', 'copy', 'rm', 'template, template_dir'] def find(path='.', regex='*', ctime=0): r = [] regex = str(regex).strip() if regex == '*': regex = ...
if ctime>0 and int((now-tmtime)/3600/24) > ctime: r.append(os.path.join(path, filename)) elif ctime<0 and int((now-tmtime)/3600/24) < ctime: r.append(os.path.join(path, filename)) elif ctime==0: r.append(os.path....
if re.search(regex, filename): tmtime = os.path.getmtime(os.path.join(path, filename))
random_line_split
system.py
import re, time, os, shutil, string from subprocess import Popen, PIPE, STDOUT from random import randint, seed __all__ = ['find', 'removedirs', 'source', 'tempfile', 'copy', 'rm', 'template, template_dir'] def find(path='.', regex='*', ctime=0): r = [] regex = str(regex).strip() if regex == '*': regex = ...
def removedirs(*args): print 'Deprecated: use rm' rm(*args) def source(filename): cmd = "source {filename}; env".format(filename=filename) p = Popen(cmd, executable='/bin/tcsh', stdout=PIPE, stderr=STDOUT, shell=True, env=os.environ) stdout = p.communicate()[0].splitlines() for line in st...
for src in files: try: if os.path.isdir(src): shutil.rmtree(src) else: os.remove(src) except OSError as e: print('%s not removed. Error: %s'%(src, e))
identifier_body
facility.py
from chronotope.model.base import PublicationWorkflowBehavior from chronotope.model.base import SQLBase from chronotope.model.category import CategoryRecord from chronotope.model.location import LocationRecord from chronotope.utils import ensure_uuid from chronotope.utils import html_index_transform from cone.app.model...
if submitter: query = query.filter(FacilityRecord.submitter == submitter) query = query.order_by(FacilityRecord.title) if limit is not None: query = query.limit(limit) return query.all() @node_info( name='facility', title=_('facility_label', default='Facility'), descriptio...
query = query.filter(FacilityRecord.state.in_(state))
conditional_block
facility.py
from chronotope.model.base import PublicationWorkflowBehavior from chronotope.model.base import SQLBase from chronotope.model.category import CategoryRecord from chronotope.model.location import LocationRecord from chronotope.utils import ensure_uuid from chronotope.utils import html_index_transform from cone.app.model...
@instance_property def metadata(self): md = Metadata() md.title = _('facilities_label', default='Facilities') md.description = _( 'facilities_description', default='Container for Facilities' ) return md
props = Properties() props.in_navtree = True props.action_up = True props.action_up_tile = 'content' props.action_add = True props.default_content_tile = 'listing' return props
identifier_body
facility.py
from chronotope.model.base import PublicationWorkflowBehavior from chronotope.model.base import SQLBase from chronotope.model.category import CategoryRecord from chronotope.model.location import LocationRecord from chronotope.utils import ensure_uuid from chronotope.utils import html_index_transform from cone.app.model...
(request, uid): session = get_session(request) return session.query(FacilityRecord).get(ensure_uuid(uid)) def facilities_by_uid(request, uids): if not uids: return list() uids = [ensure_uuid(uid) for uid in uids] session = get_session(request) return session.query(FacilityRecord)\ ...
facility_by_uid
identifier_name
facility.py
from chronotope.model.base import PublicationWorkflowBehavior from chronotope.model.base import SQLBase from chronotope.model.category import CategoryRecord from chronotope.model.location import LocationRecord from chronotope.utils import ensure_uuid from chronotope.utils import html_index_transform from cone.app.model...
facility_category_references = Table( 'facility_category_references', metadata, Column('facility_uid', GUID, ForeignKey('facility.uid')), Column('category_uid', GUID, ForeignKey('category.uid')) ) class FacilityRecord(SQLBase): __tablename__ = 'facility' __index_attrs__ = ['title', 'descriptio...
'facility_location_references', metadata, Column('facility_uid', GUID, ForeignKey('facility.uid')), Column('location_uid', GUID, ForeignKey('location.uid')) )
random_line_split
ir_filters.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import ast from odoo import api, fields, models, _ from odoo.exceptions import UserError class IrFilters(models.Model): _name = 'ir.filters' _description = 'Filters' _order = 'model_id, name, id desc' ...
(self, model, action_id=None): """Obtain the list of filters available for the user on the given model. :param action_id: optional ID of action to restrict filters to this action plus global filters. If missing only global filters are returned. The action does not have to corres...
get_filters
identifier_name
ir_filters.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import ast from odoo import api, fields, models, _ from odoo.exceptions import UserError class IrFilters(models.Model): _name = 'ir.filters' _description = 'Filters' _order = 'model_id, name, id desc' ...
@api.model def _check_global_default(self, vals, matching_filters): """ _check_global_default(dict, list(dict), dict) -> None Checks if there is a global default for the model_id requested. If there is, and the default is different than the record being written (-> we're not ...
"""Obtain the list of filters available for the user on the given model. :param action_id: optional ID of action to restrict filters to this action plus global filters. If missing only global filters are returned. The action does not have to correspond to the model, it may only be ...
identifier_body
ir_filters.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import ast from odoo import api, fields, models, _ from odoo.exceptions import UserError class IrFilters(models.Model): _name = 'ir.filters' _description = 'Filters' _order = 'model_id, name, id desc' ...
else: self._check_global_default(vals, matching_filters) # When a filter exists for the same (name, model, user) triple, we simply # replace its definition (considering action_id irrelevant here) if matching_filters: matching_filter = self.browse(matchin...
defaults.write({'is_default': False})
conditional_block
ir_filters.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import ast from odoo import api, fields, models, _ from odoo.exceptions import UserError class IrFilters(models.Model): _name = 'ir.filters' _description = 'Filters' _order = 'model_id, name, id desc' ...
# and filters for the action (action_id=action_id) or global (action_id=NULL) action_domain = self._get_action_domain(action_id) filters = self.search(action_domain + [('model_id', '=', model), ('user_id', 'in', [self._uid, False])]) user_context = self.env.user.context_get() ret...
# available filters: private filters (user_id=uid) and public filters (uid=NULL),
random_line_split
conf.py
-*- coding: utf-8 -*- # # Armstrong Platform Documentation documentation build configuration file, created by # sphinx-quickstart on Mon Sep 26 13:38:48 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # aut...
# The format is a list of tuples containing the path and title. #epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_post_files = [] # A list of files that should not be packed into the epub file. #epub_exclu...
# A unique identification for the text. #epub_uid = '' # HTML files that should be inserted before the pages created by sphinx.
random_line_split
TransferMarketOfferDurationSelect.ts
import { IEasyLogger } from '../../Common/Logger/EasyLogger'; import { ITransferMarketSellingDurationSettings } from '../../Common/Settings/TransferMarketSellingDurationSettings'; import { IExtendWebElement } from '../../Common/Toolkit/IExtendWebElement'; import { IHtmlSelect } from '../../Common/Toolkit/HtmlSelect'; i...
log: IEasyLogger ) { this.url = targetUrl; this.select = select; this.tmSellingDurationSettings = transferMarketSellingDurationSettings; this.log = log; } public targetUrl(): IUrl { return this.url; } public extend(): void { this.log.info("start extension"); this.tmSellingDura...
transferMarketSellingDurationSettings: ISetting<ITransferMarketSellingDurationSettings>,
random_line_split
TransferMarketOfferDurationSelect.ts
import { IEasyLogger } from '../../Common/Logger/EasyLogger'; import { ITransferMarketSellingDurationSettings } from '../../Common/Settings/TransferMarketSellingDurationSettings'; import { IExtendWebElement } from '../../Common/Toolkit/IExtendWebElement'; import { IHtmlSelect } from '../../Common/Toolkit/HtmlSelect'; i...
}) .catch(e => { throw new Error(`"Error while settings the transfer market duration: ${e}. ${e.stack}"`); }); } }
{ let currentSellingDurationIndex = selectElement.selectedIndex; let configuredSellingDurationIndex = setting.defaultSellingDuration(); this.log.info(`adjustment of selling duration selection activated: will change selection index from currently '${currentSellingDurationIndex}' to '${confi...
conditional_block
TransferMarketOfferDurationSelect.ts
import { IEasyLogger } from '../../Common/Logger/EasyLogger'; import { ITransferMarketSellingDurationSettings } from '../../Common/Settings/TransferMarketSellingDurationSettings'; import { IExtendWebElement } from '../../Common/Toolkit/IExtendWebElement'; import { IHtmlSelect } from '../../Common/Toolkit/HtmlSelect'; i...
public extend(): void { this.log.info("start extension"); this.tmSellingDurationSettings .value() .then(setting => { let changeDefaultSellingDuration = setting.activated(); const selectElement = this.select.select(); if (changeDefaultSellingDuration && selectElement) { ...
{ return this.url; }
identifier_body
TransferMarketOfferDurationSelect.ts
import { IEasyLogger } from '../../Common/Logger/EasyLogger'; import { ITransferMarketSellingDurationSettings } from '../../Common/Settings/TransferMarketSellingDurationSettings'; import { IExtendWebElement } from '../../Common/Toolkit/IExtendWebElement'; import { IHtmlSelect } from '../../Common/Toolkit/HtmlSelect'; i...
implements IExtendWebElement { private readonly url: IUrl; private readonly select: IHtmlSelect; private readonly tmSellingDurationSettings: ISetting<ITransferMarketSellingDurationSettings>; private readonly log: IEasyLogger; constructor( targetUrl: IUrl, select: IHtmlSelect, transferMarketSelli...
TransferMarketOfferDurationSelect
identifier_name
quickformat.py
# # 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 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
# Renan Çakırerk <renan at pardus.org.tr>
random_line_split
quickformat.py
quickformat.notifier import PARTITION_TABLE_ERROR, NO_DEVICE, FORMAT_STARTED, FORMAT_SUCCESSFUL, FORMAT_FAILED, LOADING_DEVICES from quickformat.about import aboutData from quickformat.ui_volumeitem import Ui_VolumeItem from quickformat.notifier_backend import OUT, TOPCENTER, MIDCENTER, CURRENT, OUT import sys, os ...
elf): self.volumePathArg = "" if len(self.__sysargs) == 2: if not self.__sysargs[1].startswith("-"): self.volumePathArg = self.__sysargs[1] def __init_signals__(self): self.connect(self.ui.volumeName, SIGNAL("activated(int)"), self.set_info) self.connect(...
process_args__(s
identifier_name
quickformat.py
quickformat.notifier import PARTITION_TABLE_ERROR, NO_DEVICE, FORMAT_STARTED, FORMAT_SUCCESSFUL, FORMAT_FAILED, LOADING_DEVICES from quickformat.about import aboutData from quickformat.ui_volumeitem import Ui_VolumeItem from quickformat.notifier_backend import OUT, TOPCENTER, MIDCENTER, CURRENT, OUT import sys, os ...
def size_to_human(self, size): size = size / 1024.0 ** 2 if size >= 1000 and size < 100000: size = str("%.2f" % (size / 1024.0)) + " GB" elif size > 100000: size = str(int(size / 1024)) + " GB" else: size = str(int(size)) + " MB" return s...
Gui.QWidget.__init__(self, parent) self.setupUi(self) self.device.hide() self.name.setText(volume.device_name) self.device.setText(volume.device_path) self.label.setText(volume.name) self.path.setText(volume.path) size_human = self.size_to_human(volume.size) ...
identifier_body
quickformat.py
quickformat.notifier import PARTITION_TABLE_ERROR, NO_DEVICE, FORMAT_STARTED, FORMAT_SUCCESSFUL, FORMAT_FAILED, LOADING_DEVICES from quickformat.about import aboutData from quickformat.ui_volumeitem import Ui_VolumeItem from quickformat.notifier_backend import OUT, TOPCENTER, MIDCENTER, CURRENT, OUT import sys, os ...
self.set_info() self.first_run = False def format_device(self): """ Starts the formatting operation """ selected_file_system = FILE_SYSTEMS[str(self.ui.fileSystem.currentText())] selected_label = self.ui.volumeLabel.text() self.formatter.set_volume_to_format(se...
Core.QTimer.singleShot(2000, self.hide_notifier)
conditional_block
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct Route { criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { r...
self.criteria.push(criterion); } pub fn execute(&self, req: Request, res: Response) { (self.handler)(req, res); } pub fn resolve(&self, request: &Request) -> bool { let mut bool = true; for criterion in self.criteria.iter() { if !check(criterion, request) { bool = false; } } retu...
pub fn add_criterion(&mut self, criterion: Criterion) {
random_line_split
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct Route { criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { r...
} return bool; } }
{ bool = false; }
conditional_block
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct
{ criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { return Route{criteria: Vec::new(), handler: handler}; } pub fn new_with_method_path(handler: BoxedHandler, method: hyperMethod, path: String) -> Self { let mut route = Route::new(handler); ...
Route
identifier_name
imp.py
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import sys from powerline.lint.selfcheck import havemarks class WithPath(object): def __init__(self, import_paths): self.import_paths = import_paths def __enter__(self): self.oldpath = sys.path ...
eturn func def import_segment(*args, **kwargs): return import_function('segment', *args, **kwargs)
echoerr(context='Error while checking segments (key {key})'.format(key=context.key), context_mark=name.mark, problem='imported “function” {0} from module {1} is not callable'.format(name, module), problem_mark=module.mark) return None r
conditional_block
imp.py
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import sys from powerline.lint.selfcheck import havemarks class WithPath(object): def __init__(self, import_paths): self.import_paths = import_paths def __enter__(self): self.oldpath = sys.path ...
def import_segment(*args, **kwargs): return import_function('segment', *args, **kwargs)
return func
random_line_split
imp.py
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import sys from powerline.lint.selfcheck import havemarks class WithPath(object): def __init__(self, import_paths):
def __enter__(self): self.oldpath = sys.path sys.path = self.import_paths + sys.path def __exit__(self, *args): sys.path = self.oldpath def import_function(function_type, name, data, context, echoerr, module): havemarks(name, module) with WithPath(data['import_paths']): try: func = getattr(__import...
self.import_paths = import_paths
identifier_body
imp.py
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import sys from powerline.lint.selfcheck import havemarks class WithPath(object): def __init__(self, import_paths): self.import_paths = import_paths def __enter__(self): self.oldpath = sys.path ...
gs, **kwargs): return import_function('segment', *args, **kwargs)
rt_segment(*ar
identifier_name
Action.Redo.js
/* * This file is part of min. * * min 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. * * min is distributed in the hope that it wi...
Redo.prototype.Undo = function() { alert("Redo action should never be on the undo stack"); } Redo.prototype.shouldKeep = function() { return true; } Redo.prototype.Apply = function() { alert("Redo action should never be on the redo stack"); } Redo.prototype.toXML = function() { return "<Action type...
{ }
identifier_body
Action.Redo.js
/* * This file is part of min. * * min 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. * * min is distributed in the hope that it wi...
}
random_line_split
Action.Redo.js
/* * This file is part of min. * * min 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. * * min is distributed in the hope that it wi...
() { } Redo.prototype.Undo = function() { alert("Redo action should never be on the undo stack"); } Redo.prototype.shouldKeep = function() { return true; } Redo.prototype.Apply = function() { alert("Redo action should never be on the redo stack"); } Redo.prototype.toXML = function() { return "<Acti...
Redo
identifier_name
calc_HW_deviations.py
#takes in an eQTL file and outputs allele freq and deviation from HWE #0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #scaf pac locus freq fold effect dom d_over_a f p hom1 het hom2 Rsquared f(hom1/het/hom2) #scaf8 20911662 9414108 0.80...
(): eqtlFile = open(sys.argv[1],'r') out = open(sys.argv[1]+".hwe",'w') out.write("maf obs exp p\n") for line in eqtlFile: ent = line.split() if ent[0] == "scaf": continue p = float(ent[3]) maf = float(ent[4]) #hwFreqs = [maf*maf, 2.0*maf*(1.0-maf), (1.0-maf)*(1.0-maf)] hwObs = numpy.array([floa...
__main__
identifier_name
calc_HW_deviations.py
#takes in an eQTL file and outputs allele freq and deviation from HWE #0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #scaf pac locus freq fold effect dom d_over_a f p hom1 het hom2 Rsquared f(hom1/het/hom2) #scaf8 20911662 9414108 0.80...
eqtlFile = open(sys.argv[1],'r') out = open(sys.argv[1]+".hwe",'w') out.write("maf obs exp p\n") for line in eqtlFile: ent = line.split() if ent[0] == "scaf": continue p = float(ent[3]) maf = float(ent[4]) #hwFreqs = [maf*maf, 2.0*maf*(1.0-maf), (1.0-maf)*(1.0-maf)] hwObs = numpy.array([float(x) fo...
identifier_body
calc_HW_deviations.py
#takes in an eQTL file and outputs allele freq and deviation from HWE #0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #scaf pac locus freq fold effect dom d_over_a f p hom1 het hom2 Rsquared f(hom1/het/hom2) #scaf8 20911662 9414108 0.80...
p = float(ent[3]) maf = float(ent[4]) #hwFreqs = [maf*maf, 2.0*maf*(1.0-maf), (1.0-maf)*(1.0-maf)] hwObs = numpy.array([float(x) for x in ent[14].split(',')]) sampleSize = sum(hwObs) hwExp = numpy.array([x*sampleSize for x in [p*p, 2*p*(1.0-p),(1.0-p)*(1.0-p)]]) chisq = stats.chisquare(hwObs, hwExp,1...
continue
conditional_block
calc_HW_deviations.py
#takes in an eQTL file and outputs allele freq and deviation from HWE #0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #scaf pac locus freq fold effect dom d_over_a f p hom1 het hom2 Rsquared f(hom1/het/hom2) #scaf8 20911662 9414108 0.80...
out = open(sys.argv[1]+".hwe",'w') out.write("maf obs exp p\n") for line in eqtlFile: ent = line.split() if ent[0] == "scaf": continue p = float(ent[3]) maf = float(ent[4]) #hwFreqs = [maf*maf, 2.0*maf*(1.0-maf), (1.0-maf)*(1.0-maf)] hwObs = numpy.array([float(x) for x in ent[14].split(',')]) sam...
eqtlFile = open(sys.argv[1],'r')
random_line_split
using-promote-false.ts
// Copyright 2017 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 // 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...
'code': 0, 'stdout': '[gcloud output]' }; runner.setAnswers(answers); mock.registerCommonMocks(runner); runner.run();
answers.exec[execString] = {
random_line_split
config_schema.py
from marshmallow import ( Schema, fields, validates_schema, ValidationError, validates_schema, EXCLUDE, ) from marshmallow.validate import Regexp MAP_1 = { "name": "OpenStreetMap", "layer": "//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", "attribution": "&copy OpenStreetMap", } M...
ationError( { "Le champ TAXHUB_URL doit être rempli si REDIMENSIONNEMENT_IMAGE = True" } )
conditional_block
config_schema.py
from marshmallow import ( Schema, fields, validates_schema, ValidationError, validates_schema, EXCLUDE, ) from marshmallow.validate import Regexp MAP_1 = { "name": "OpenStreetMap", "layer": "//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", "attribution": "&copy OpenStreetMap", } M...
{"regne": ["Plantae"]}, ], ) RANG_STAT_FR = fields.List( fields.String, load_default=["Faune invertébrée", "Faune vertébrée", "Flore"] ) LIMIT_RANG_TAXONOMIQUE_HIERARCHIE = fields.Integer(load_default=13) LIMIT_FICHE_LISTE_HIERARCHY = fields.Integer(load_default=28) R...
load_default=[ {"phylum": ["Arthropoda", "Mollusca"]}, {"phylum": ["Chordata"]},
random_line_split
config_schema.py
from marshmallow import ( Schema, fields, validates_schema, ValidationError, validates_schema, EXCLUDE, ) from marshmallow.validate import Regexp MAP_1 = { "name": "OpenStreetMap", "layer": "//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", "attribution": "&copy OpenStreetMap", } M...
hema): class Meta: unknown = EXCLUDE STRUCTURE = fields.String(load_default="Nom de la structure") NOM_APPLICATION = fields.String(load_default="Nom de l'application") CUSTOM_LOGO_LINK = fields.String(load_default="") URL_APPLICATION = fields.String(load_default="") DEFAULT_LANGUAGE = f...
asConfig(Sc
identifier_name
config_schema.py
from marshmallow import ( Schema, fields, validates_schema, ValidationError, validates_schema, EXCLUDE, ) from marshmallow.validate import Regexp MAP_1 = { "name": "OpenStreetMap", "layer": "//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", "attribution": "&copy OpenStreetMap", } M...
database_connection = fields.String( required=True, validate=Regexp( "^postgresql:\/\/.*:.*@[^:]+:\w+\/\w+$", error="Database uri is invalid ex: postgresql://monuser:monpass@server:port/db_name", ), ) GUNICORN_PORT = fields.Integer(load_default=8080) modeDe...
nown = EXCLUDE
identifier_body
registry.py
""" raven.transport.registry ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import sys # TODO(dcramer): we really should need to import all of these by default from raven.trans...
if scheme in self._schemes: raise DuplicateScheme() urlparse.register_scheme(scheme) # TODO (vng): verify the interface of the new class self._schemes[scheme] = cls def supported_scheme(self, scheme): return scheme in self._schemes def get_transport(self, p...
def __init__(self, transports=None): # setup a default list of senders self._schemes = {} self._transports = {} if transports: for transport in transports: self.register_transport(transport) def register_transport(self, transport): if not hasattr...
identifier_body
registry.py
""" raven.transport.registry ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import sys # TODO(dcramer): we really should need to import all of these by default from raven.trans...
(object): def __init__(self, transports=None): # setup a default list of senders self._schemes = {} self._transports = {} if transports: for transport in transports: self.register_transport(transport) def register_transport(self, transport): ...
TransportRegistry
identifier_name
registry.py
""" raven.transport.registry ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
# TODO(dcramer): we really should need to import all of these by default from raven.transport.eventlet import EventletHTTPTransport from raven.transport.exceptions import DuplicateScheme from raven.transport.http import HTTPTransport from raven.transport.gevent import GeventedHTTPTransport from raven.transport.request...
:license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import sys
random_line_split
registry.py
""" raven.transport.registry ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import sys # TODO(dcramer): we really should need to import all of these by default from raven.trans...
default_transports += [AioHttpTransport]
conditional_block
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
None } pub fn get_menu(&mut self, handle: BackendHandle, menu_id_offset: u32) -> Option<Box<Menu>> { if let Some(backend) = self.get_backend(Some(handle)) { unsafe { let plugin_funcs = backend.plugin_type.plugin_funcs as *mut CBackendCallbacks; if ...
{ for i in 0..self.instances.len() { if self.instances[i].handle == handle { return Some(&mut self.instances[i]); } } }
conditional_block
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
(&mut self) { let t = self.reload_state.clone(); for reload_plugin in &t { Self::create_instance(self, &reload_plugin.name); } } fn reload_failed(&mut self) {} } impl BackendPlugins { pub fn new() -> BackendPlugins { BackendPlugins { instances: Vec::...
reload_plugin
identifier_name
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
menu_id_offset: 0, }; self.handle_counter.0 += 1; self.instances.push(instance); Some(handle) } pub fn create_instance_from_index(mut self, index: usize) -> Option<BackendHandle> { Self::create_instance_from_type(&mut self, index) } pub fn create_...
let instance = BackendInstance { plugin_data: user_data, handle: handle, plugin_type: self.plugin_types[index].clone(),
random_line_split
node-package-manager.ts
import Future = require("fibers/future"); import * as npm from "npm"; interface INpmOpts { config?: any; subCommandName?: string; path?: string; } export class NodePackageManager implements INodePackageManager { constructor(private $childProcess: IChildProcess, private $logger: ILogger, private $options: IOpt...
public executeNpmCommand(npmCommandName: string, currentWorkingDirectory: string): IFuture<any> { return this.$childProcess.exec(npmCommandName, { cwd: currentWorkingDirectory }); } private loadAndExecute(commandName: string, args: any[], opts?: INpmOpts): IFuture<any> { return (() => { opts = opts || {}; ...
{ return this.loadAndExecute("view", [[packageName, propertyName], [false]]); }
identifier_body
node-package-manager.ts
import Future = require("fibers/future"); import * as npm from "npm"; interface INpmOpts { config?: any; subCommandName?: string; path?: string; } export class NodePackageManager implements INodePackageManager { constructor(private $childProcess: IChildProcess, private $logger: ILogger, private $options: IOpt...
// Not installed peer dependencies are treated by npm 2 as errors, but npm 3 treats them as warnings. // We'll show them as warnings and let the user install them in case they are needed. // The strucutre of the error object in such case is: // { [Error: The package @angular/core@2.1.0-beta.0 does n...
try { return this.loadAndExecute("install", [pathToSave, packageName], { config: config }).wait(); } catch (err) { if (err.code === "EPEERINVALID") {
random_line_split
node-package-manager.ts
import Future = require("fibers/future"); import * as npm from "npm"; interface INpmOpts { config?: any; subCommandName?: string; path?: string; } export class
implements INodePackageManager { constructor(private $childProcess: IChildProcess, private $logger: ILogger, private $options: IOptions) { } public getCache(): string { return npm.cache; } public load(config?: any): IFuture<void> { if (npm.config.loaded) { let data = npm.config.sources.cli.data; Ob...
NodePackageManager
identifier_name
node-package-manager.ts
import Future = require("fibers/future"); import * as npm from "npm"; interface INpmOpts { config?: any; subCommandName?: string; path?: string; } export class NodePackageManager implements INodePackageManager { constructor(private $childProcess: IChildProcess, private $logger: ILogger, private $options: IOpt...
try { return this.loadAndExecute("install", [pathToSave, packageName], { config: config }).wait(); } catch (err) { if (err.code === "EPEERINVALID") { // Not installed peer dependencies are treated by npm 2 as errors, but npm 3 treats them as warnings. // We'll show them as warnings and let the...
{ config = config || {}; config["ignore-scripts"] = true; }
conditional_block
skill_queue.py
import xml.etree.ElementTree as ElementTree from model.dynamic.api import api from model.dynamic.skills.skill_queue_item import SkillQueueItem class SkillQueue(object): def __init__(self, user_id, api_key, character_id):
api.fetch("char", "SkillQueue", user_id, api_key, character_id) tree = ElementTree.parse("%s/SkillQueue.xml.aspx" % \ api.build_path("char", user_id, character_id)) root = tree.getroot() rowset = root.find("result").find("rowset") self.skill_queue = list...
identifier_body
skill_queue.py
import xml.etree.ElementTree as ElementTree from model.dynamic.api import api from model.dynamic.skills.skill_queue_item import SkillQueueItem class SkillQueue(object): def
(self, user_id, api_key, character_id): api.fetch("char", "SkillQueue", user_id, api_key, character_id) tree = ElementTree.parse("%s/SkillQueue.xml.aspx" % \ api.build_path("char", user_id, character_id)) root = tree.getroot() rowset = root.find("result"...
__init__
identifier_name
skill_queue.py
import xml.etree.ElementTree as ElementTree from model.dynamic.api import api from model.dynamic.skills.skill_queue_item import SkillQueueItem class SkillQueue(object): def __init__(self, user_id, api_key, character_id): api.fetch("char", "SkillQueue", user_id, api_key, character_id) tree = Elemen...
self.skill_queue.insert\ (int(element.get("queuePosition")), SkillQueueItem(int(element.get("typeID")), int(element.get("level")), int(element.get("startSP")), int(element.get...
if rowset.getchildren(): for element in rowset:
random_line_split
skill_queue.py
import xml.etree.ElementTree as ElementTree from model.dynamic.api import api from model.dynamic.skills.skill_queue_item import SkillQueueItem class SkillQueue(object): def __init__(self, user_id, api_key, character_id): api.fetch("char", "SkillQueue", user_id, api_key, character_id) tree = Elemen...
self.skill_queue.insert\ (int(element.get("queuePosition")), SkillQueueItem(int(element.get("typeID")), int(element.get("level")), int(element.get("startSP")), int(element.get("endSP")), ...
conditional_block
structutil_1_1_spacial_bounding_box.js
var structutil_1_1_spacial_bounding_box = [ [ "Vec", "structutil_1_1_spacial_bounding_box.html#a37bdeec9750c91b23613c49351b166cf", null ], [ "SpacialBoundingBox", "structutil_1_1_spacial_bounding_box.html#a2d745996db194a5da6ea64ce8e9fef6f", null ], [ "containsPoint", "structutil_1_1_spacial_bounding_box.htm...
[ "getEnd", "structutil_1_1_spacial_bounding_box.html#a9f5296c5056c713698c38380883500c5", null ], [ "getStart", "structutil_1_1_spacial_bounding_box.html#a86ef148f941767f9bbc3d1839598face", null ], [ "withOffset", "structutil_1_1_spacial_bounding_box.html#ad9512a3e4c7878b15e2be7a295e8a52c", null ] ];
random_line_split
managed-pointer-within-unique.rs
// Copyright 2013-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...
let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4i }; zzz(); // #break } fn zzz() {()}
} fn main() { let ordinary_unique = box() (-1i, -2i);
random_line_split
managed-pointer-within-unique.rs
// Copyright 2013-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...
() { let ordinary_unique = box() (-1i, -2i); let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4i }; zzz(); // #break } fn zzz() {()}
main
identifier_name
watchman.js
'use strict'; const denodeify = require('denodeify'); const path = require('../fastpath'); const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting.html'; function watchmanRecReadDir(roots, {ignore, fileWatcher, exts}) { const files = []; return Promise.all( roots.map( root => file...
} resp.files.forEach(filePath => { filePath = watchedRoot + path.sep + filePath; if (!ignore(filePath)) { files.push(filePath); } return false; }); }); }) ); }).then( () => file...
}]).then(resp => { if ('warning' in resp) { console.warn('watchman warning: ', resp.warning);
random_line_split