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
mrp_workcenter_load.py
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 distributed in the hope that i...
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). #
random_line_split
mrp_workcenter_load.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" To print the report of Work Center Load @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return : Report """ if context is None: context = {} ...
identifier_body
mrp_workcenter_load.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
(self, cr, uid, ids, context=None): """ To print the report of Work Center Load @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return : Report """ if conte...
print_report
identifier_name
mrp_workcenter_load.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
datas = {'ids' : context.get('active_ids',[])} res = self.read(cr, uid, ids, ['time_unit','measure_unit']) res = res and res[0] or {} datas['form'] = res return { 'type' : 'ir.actions.report.xml', 'report_name':'mrp.workcenter.load', 'datas' ...
context = {}
conditional_block
debugEditorContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): void { this.toDispose = lifecycle.dispose(this.toDispose); } }
dispose
identifier_name
debugEditorContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
return; } if (!this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel())) { return; } const lineNumber = e.target.position.lineNumber; const uri = this.editor.getModel().getAssociatedResource(); if (e.event.rightButton || (env.isMacintosh && e.event.leftButton &...
if (e.target.type !== editorcommon.MouseTargetType.GUTTER_GLYPH_MARGIN || /* after last line */ e.target.detail) {
random_line_split
debugEditorContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
this.hideHoverWidget(); } private onEditorMouseMove(mouseEvent: editorbrowser.IEditorMouseEvent): void { if (this.debugService.state !== debug.State.Stopped) { return; } const targetType = mouseEvent.target.type; const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey'; if (targetType === editorcom...
{ return; }
conditional_block
debugEditorContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
// hover business private onEditorMouseDown(mouseEvent: editorbrowser.IEditorMouseEvent): void { if (mouseEvent.target.type === editorcommon.MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) { return; } this.hideHoverWidget(); } private onEditorMouseMove(mouseEvent: e...
{ if (!this.hideHoverScheduler.isScheduled() && this.hoverWidget.isVisible) { this.hideHoverScheduler.schedule(); } this.showHoverScheduler.cancel(); this.hoveringOver = null; }
identifier_body
mouse.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* * CoCalc's Xpra HTML Client * * --- * * Xpra * Copyright (c) 2013-2017 Antoine Martin <antoine@devloop.org.uk> * Copyright (c) 2016 David Brushinski <dbrushinski@spik...
const elt_at = document.elementFromPoint(ev.clientX, ev.clientY); if (!elt_at) { // nothing under mouse, so no point. (possible? I don't know.) return; } // TODO: right now we abuse things a bit to store the wid on the canvas itself. const wid: number | undefined = (elt_at as any).wid; ...
// happens with touch events for now... return; }
conditional_block
mouse.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* * CoCalc's Xpra HTML Client * * --- * * Xpra * Copyright (c) 2013-2017 Antoine Martin <antoine@devloop.org.uk> * Copyright (c) 2016 David Brushinski <dbrushinski@spik...
ev, wid, x, y, buttons, modifiers, }: { ev: MouseEvent; wid: number; x: number; y: number; buttons: number[]; modifiers: string[]; }): void { // I think server support for wheel.precise is not available in // CoCalc -- I think it depends on the uinput Python m...
window_mouse_scroll({
identifier_name
mouse.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* * CoCalc's Xpra HTML Client * * --- * * Xpra * Copyright (c) 2013-2017 Antoine Martin <antoine@devloop.org.uk> * Copyright (c) 2016 David Brushinski <dbrushinski@spik...
} if (apy >= 40 && apy <= 160) { this.wheel_delta_y = py > 0 ? INCREMENT : -INCREMENT; } else { this.wheel_delta_y += py; } // Send synthetic click+release as many times as needed: let wx = Math.abs(this.wheel_delta_x); let wy = Math.abs(this.wheel_delta_y); const btn_x = thi...
if (apx >= 40 && apx <= 160) { this.wheel_delta_x = px > 0 ? INCREMENT : -INCREMENT; } else { this.wheel_delta_x += px;
random_line_split
context.ts
/* * 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/. * */ import * as React from 'react'; import { query } from '@csegames/camelot-unchained/lib/graphql/query'; impo...
(): Promise<HUDGraphQLQueryResult<Ability[]>> { const res = await query<Pick<CUQuery, 'myCharacter'>>({ query: abilitiesQuery, operationName: null, namedQuery: null, variables: {}, }, HUDGraphQLQueryConfig()); const abilities = res.data && res.data.myCharacter ? res.data.myCharacter.abilities : []...
fetchAbilities
identifier_name
context.ts
/* * 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/. * */ import * as React from 'react'; import { query } from '@csegames/camelot-unchained/lib/graphql/query'; impo...
{ const res = await query<Pick<CUQuery, 'game'>>({ query: itemDefRefsQuery, operationName: null, namedQuery: null, variables: {}, }, HUDGraphQLQueryConfig()); return { ...res, data: res.data && res.data.game ? res.data.game.items : [], refetch: fetchItemDefRefs, }; }
identifier_body
context.ts
/* * 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/. * */ import * as React from 'react'; import { query } from '@csegames/camelot-unchained/lib/graphql/query'; impo...
description name iconUrl itemType defaultResourceID numericItemDefID isStackableItem deploySettings { resourceID isDoor snapToGround rotateYaw rotatePitch rotateRoll } gearSlotSets...
items { id
random_line_split
srp-gre-admin.js
//Utilizing GMap API v3 (no API key needed) function srp_geocode(){ if(jQuery.trim(jQuery('#listings_address').val()) != '' && jQuery.trim(jQuery('#listings_city').val()) != '' && jQuery.trim(jQuery('#listings_state').val()) != '' && jQuery.trim(jQuery('#listings_postcode').val()) != '')
} function srp_geocode_test(lat, lng){ var test = '<a href="http://maps.google.com/maps?hl=en&q=' + lat + ' ' + lng + '" target="_blank">Check if location is correct</a>'; jQuery('#test_geo_link').html(test); jQuery("#listings_latitude").triggerHandler("focus"); } //Adding Get Coordinates button at...
{ var address = jQuery('#listings_address').val() + ', ' + jQuery('#listings_city').val() + ', ' + jQuery('#listings_state').val() + ' ' + jQuery('#listings_postcode').val(); var geocoder; geocoder = new google.maps.Geocoder(); if (geocode...
conditional_block
srp-gre-admin.js
//Utilizing GMap API v3 (no API key needed) function srp_geocode(){ if(jQuery.trim(jQuery('#listings_address').val()) != '' && jQuery.trim(jQuery('#listings_city').val()) != '' && jQuery.trim(jQuery('#listings_state').val()) != '' && jQuery.trim(jQuery('#listings_postcode').val()) != ''){ var address = jQuery(...
() { jQuery("#TB_imageOff").unbind("click"); jQuery("#TB_closeWindowButton").unbind("click"); jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').unload("#TB_ajaxContent").unbind().remove();}); jQuery("#TB_load").remove(); if (typeof document.body.style.maxHeig...
_fixed_tb_remove
identifier_name
srp-gre-admin.js
//Utilizing GMap API v3 (no API key needed) function srp_geocode(){ if(jQuery.trim(jQuery('#listings_address').val()) != '' && jQuery.trim(jQuery('#listings_city').val()) != '' && jQuery.trim(jQuery('#listings_state').val()) != '' && jQuery.trim(jQuery('#listings_postcode').val()) != ''){ var address = jQuery(...
} jQuery(document).unbind('.thickbox'); return false; } });
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 jQuery("body","html").css({height: "auto", width: "auto"}); jQuery("html").css("overflow","");
random_line_split
srp-gre-admin.js
//Utilizing GMap API v3 (no API key needed) function srp_geocode()
function srp_geocode_test(lat, lng){ var test = '<a href="http://maps.google.com/maps?hl=en&q=' + lat + ' ' + lng + '" target="_blank">Check if location is correct</a>'; jQuery('#test_geo_link').html(test); jQuery("#listings_latitude").triggerHandler("focus"); } //Adding Get Coordinates button at the ...
{ if(jQuery.trim(jQuery('#listings_address').val()) != '' && jQuery.trim(jQuery('#listings_city').val()) != '' && jQuery.trim(jQuery('#listings_state').val()) != '' && jQuery.trim(jQuery('#listings_postcode').val()) != ''){ var address = jQuery('#listings_address').val() + ', ' + jQuery('#listings_city').val() ...
identifier_body
card_validation_test.py
import unittest from card_validation import ( numberToMatrix, getOddDigits, getEvenDigits, sumOfDoubleOddPlace, sumOfEvenPlace, getDigit, isValid ) class CardValidationTest(unittest.TestCase): def __init__(self, *args, **kwargs): super(CardValidationTest, self).__init__(*args, ...
(self): self.assertEqual(getDigit(9), 9) def test_isValid(self): self.assertEqual(isValid(self.card_number), True) if __name__ == "__main__": unittest.main()
test_getDigit
identifier_name
card_validation_test.py
import unittest from card_validation import ( numberToMatrix, getOddDigits, getEvenDigits, sumOfDoubleOddPlace, sumOfEvenPlace, getDigit, isValid ) class CardValidationTest(unittest.TestCase): def __init__(self, *args, **kwargs): super(CardValidationTest, self).__init__(*args, ...
unittest.main()
conditional_block
card_validation_test.py
import unittest from card_validation import ( numberToMatrix, getOddDigits, getEvenDigits, sumOfDoubleOddPlace, sumOfEvenPlace, getDigit, isValid ) class CardValidationTest(unittest.TestCase): def __init__(self, *args, **kwargs):
super(CardValidationTest, self).__init__(*args, **kwargs) self.card_number = "4388576018410707" self.matrix = numberToMatrix(self.card_number) self.odds = getOddDigits(self.matrix) self.evens = getEvenDigits(self.matrix) def test_numberToMatrix(self): self.assert...
random_line_split
card_validation_test.py
import unittest from card_validation import ( numberToMatrix, getOddDigits, getEvenDigits, sumOfDoubleOddPlace, sumOfEvenPlace, getDigit, isValid ) class CardValidationTest(unittest.TestCase): def __init__(self, *args, **kwargs): super(CardValidationTest, self).__init__(*args, ...
def test_getOddDigits(self): self.assertEqual(self.odds.__class__, list) def test_getEvenDigits(self): self.assertEqual(self.evens.__class__, list) def test_sumOfDoubleOddPlace(self): self.assertEqual(sumOfDoubleOddPlace(self.odds), 29) def test_getDigit(self): self....
self.assertEqual(self.matrix.__class__, list)
identifier_body
bala.py
# -*- encoding: utf-8 -*- # Pilas engine - A video game framework. # # Copyright 2010 - Hugo Ruscitti # License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html) # # Website - http://www.pilas-engine.com.ar from pilasengine.actores.actor import Actor
def __init__(self, pilas, x=0, y=0, rotacion=0, velocidad_maxima=9, angulo_de_movimiento=90): """ Construye la Bala. :param x: Posición x del proyectil. :param y: Posición y del proyectil. :param velocidad_maxima: Velocidad máxima que alcanzará el proyectil...
class Bala(Actor): """ Representa una bala que va en línea recta. """
random_line_split
bala.py
# -*- encoding: utf-8 -*- # Pilas engine - A video game framework. # # Copyright 2010 - Hugo Ruscitti # License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html) # # Website - http://www.pilas-engine.com.ar from pilasengine.actores.actor import Actor class Bala(Actor): """ Representa una bala que va en línea ...
super(Bala, self).eliminar()
uando_se_elimina(self)
conditional_block
bala.py
# -*- encoding: utf-8 -*- # Pilas engine - A video game framework. # # Copyright 2010 - Hugo Ruscitti # License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html) # # Website - http://www.pilas-engine.com.ar from pilasengine.actores.actor import Actor class
(Actor): """ Representa una bala que va en línea recta. """ def __init__(self, pilas, x=0, y=0, rotacion=0, velocidad_maxima=9, angulo_de_movimiento=90): """ Construye la Bala. :param x: Posición x del proyectil. :param y: Posición y del proyectil. :pa...
Bala
identifier_name
bala.py
# -*- encoding: utf-8 -*- # Pilas engine - A video game framework. # # Copyright 2010 - Hugo Ruscitti # License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html) # # Website - http://www.pilas-engine.com.ar from pilasengine.actores.actor import Actor class Bala(Actor):
""" Representa una bala que va en línea recta. """ def __init__(self, pilas, x=0, y=0, rotacion=0, velocidad_maxima=9, angulo_de_movimiento=90): """ Construye la Bala. :param x: Posición x del proyectil. :param y: Posición y del proyectil. :param velocidad...
identifier_body
main.rs
// Copyright 2015 The Athena Developers. // // 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...
} } // ### Misc Command Handlers ### fn display_usage() -> Result<(), Box<Error>> { println!("{}", USAGE); return Ok(()); } fn display_not_found() -> Result<(), Box<Error>> { unimplemented!(); }
{ println!("{}", err); std::process::exit(1) }
conditional_block
main.rs
// Copyright 2015 The Athena Developers. // // 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...
// Run the actual command let result = match &flags.arg_command[..] { "list" => commands::list::execute(), "new" => commands::new::execute(), "setup" => commands::setup::execute(), "" => display_usage(), _ => display_not_found() }; // Set the exit code depending ...
random_line_split
main.rs
// Copyright 2015 The Athena Developers. // // 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...
{ arg_command: String, arg_args: Vec<String> } fn main() { // Parse in the command line flags let flags: Flags = Docopt::new(USAGE) .and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); // Run the actual command let result = match &flags.arg_command[..] { "list" => ...
Flags
identifier_name
main.rs
// Copyright 2015 The Athena Developers. // // 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...
// ### Misc Command Handlers ### fn display_usage() -> Result<(), Box<Error>> { println!("{}", USAGE); return Ok(()); } fn display_not_found() -> Result<(), Box<Error>> { unimplemented!(); }
{ // Parse in the command line flags let flags: Flags = Docopt::new(USAGE) .and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); // Run the actual command let result = match &flags.arg_command[..] { "list" => commands::list::execute(), "new" => commands::new::execute(...
identifier_body
show.js
import PlanRequiredRoute from "../plan-required"; import Notify from 'ember-notify'; export default PlanRequiredRoute.extend({ model: function(params) { var _this = this; return this.store.find('entry', params.entry_id).then(function(entry) { // Force a reload if the meta data is out of date var...
entryDate: params.entry_id }); return entry; } else { Notify.error(data.responseText, {closeAfter: 5000}); } }); }, setupController: function(controller, model) { this._super(controller, model); var meta = this.store.metadataFor("entry"); controller.set...
var meta = data.responseJSON.meta; _this.store.metaForType("entry", meta); // Build the dummy record, for use in the new form var entry = _this.store.createRecord('entry', {
random_line_split
show.js
import PlanRequiredRoute from "../plan-required"; import Notify from 'ember-notify'; export default PlanRequiredRoute.extend({ model: function(params) { var _this = this; return this.store.find('entry', params.entry_id).then(function(entry) { // Force a reload if the meta data is out of date var...
}); }, setupController: function(controller, model) { this._super(controller, model); var meta = this.store.metadataFor("entry"); controller.setProperties({ nextEntry: meta.next_entry, randomEntry: meta.random_entry, prevEntry: meta.prev_entry, entryDatePretty: moment(model....
{ Notify.error(data.responseText, {closeAfter: 5000}); }
conditional_block
coolmoviezone.py
# -*- coding: utf-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
def resolve(self, url): return url
try: sources = [] r = self.scraper.get(url).content match = re.compile('<td align="center"><strong><a href="(.+?)"').findall(r) for url in match: host = url.split('//')[1].replace('www.', '') host = host.split('/')[0].split('.')[0].title() ...
identifier_body
coolmoviezone.py
# -*- coding: utf-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
(self, imdb, title, localtitle, aliases, year): try: title = cleantitle.geturl(title) url = self.base_link + '/%s-%s' % (title, year) return url except: return def sources(self, url, hostDict, hostprDict): try: sources = [] ...
movie
identifier_name
coolmoviezone.py
# -*- coding: utf-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
except Exception: return return sources def resolve(self, url): return url
host = url.split('//')[1].replace('www.', '') host = host.split('/')[0].split('.')[0].title() quality = source_utils.check_sd_url(url) sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'direct': False, 'debri...
conditional_block
coolmoviezone.py
# -*- coding: utf-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
'debridonly': False}) except Exception: return return sources def resolve(self, url): return url
host = url.split('//')[1].replace('www.', '') host = host.split('/')[0].split('.')[0].title() quality = source_utils.check_sd_url(url) sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'direct': False,
random_line_split
first_attempt.py
# need to pass it a file, where data starts, path to write # things to import import sys import pandas import scipy import numpy from scipy import stats from scipy.stats import t # arguments being passed path_of_file=sys.argv[1] last_metadata_column=int(sys.argv[2]) path_to_write=sys.argv[3] # spearman p calc based...
df_corr_matrix=df_data_only.corr(method="spearman") #make column based on rows (called indexes in python) df_corr_matrix["otus"]=df_corr_matrix.index #melt dataframe but maintain indices now called otus df_melt=pandas.melt(df_corr_matrix,id_vars="otus") # remove NAs or NaNs which are result of non-existent otus (all 0 ...
# read in the data df=pandas.read_table(path_of_file,index_col=False) # remove metadata columns df_data_only=df.drop(df.columns[[range(0,last_metadata_column)]],axis=1) #make correlation matrix
random_line_split
first_attempt.py
# need to pass it a file, where data starts, path to write # things to import import sys import pandas import scipy import numpy from scipy import stats from scipy.stats import t # arguments being passed path_of_file=sys.argv[1] last_metadata_column=int(sys.argv[2]) path_to_write=sys.argv[3] # spearman p calc based...
# read in the data df=pandas.read_table(path_of_file,index_col=False) # remove metadata columns df_data_only=df.drop(df.columns[[range(0,last_metadata_column)]],axis=1) #make correlation matrix df_corr_matrix=df_data_only.corr(method="spearman") #make column based on rows (called indexes in python) df_corr_matrix["ot...
tstat=r*numpy.sqrt((n-2)/(1-r**2)) return t.cdf(-abs(tstat),n-2)*2
identifier_body
first_attempt.py
# need to pass it a file, where data starts, path to write # things to import import sys import pandas import scipy import numpy from scipy import stats from scipy.stats import t # arguments being passed path_of_file=sys.argv[1] last_metadata_column=int(sys.argv[2]) path_to_write=sys.argv[3] # spearman p calc based...
(r,n): tstat=r*numpy.sqrt((n-2)/(1-r**2)) return t.cdf(-abs(tstat),n-2)*2 # read in the data df=pandas.read_table(path_of_file,index_col=False) # remove metadata columns df_data_only=df.drop(df.columns[[range(0,last_metadata_column)]],axis=1) #make correlation matrix df_corr_matrix=df_data_only.corr(method="sp...
spearmanp
identifier_name
middleware.py
from collections import OrderedDict from django.middleware.locale import LocaleMiddleware from django.utils import translation from django.conf import settings from instance.models import WriteItInstanceConfig def get_language_from_request(request, check_path=False): if check_path: lang_code = translati...
# Call with check_path False as we've already done that above! return translation.get_language_from_request(request, check_path=False) class InstanceLocaleMiddleware(LocaleMiddleware): def process_request(self, request): """Same as parent, except calling our own get_language_from_request""" ...
return lang_code
conditional_block
middleware.py
from collections import OrderedDict from django.middleware.locale import LocaleMiddleware
from instance.models import WriteItInstanceConfig def get_language_from_request(request, check_path=False): if check_path: lang_code = translation.get_language_from_path(request.path_info) if lang_code is not None: return lang_code try: lang_code = WriteItInstanceConfig.ob...
from django.utils import translation from django.conf import settings
random_line_split
middleware.py
from collections import OrderedDict from django.middleware.locale import LocaleMiddleware from django.utils import translation from django.conf import settings from instance.models import WriteItInstanceConfig def
(request, check_path=False): if check_path: lang_code = translation.get_language_from_path(request.path_info) if lang_code is not None: return lang_code try: lang_code = WriteItInstanceConfig.objects.get(writeitinstance__slug=request.subdomain).default_language except Wr...
get_language_from_request
identifier_name
middleware.py
from collections import OrderedDict from django.middleware.locale import LocaleMiddleware from django.utils import translation from django.conf import settings from instance.models import WriteItInstanceConfig def get_language_from_request(request, check_path=False): if check_path: lang_code = translati...
"""Same as parent, except calling our own get_language_from_request""" check_path = self.is_language_prefix_patterns_used() language = get_language_from_request(request, check_path=check_path) translation.activate(language) request.LANGUAGE_CODE = translation.get_language()
identifier_body
iosxr.py
# # (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible 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. # # Ansible is d...
def on_open_shell(self): try: for cmd in (b'terminal length 0', b'terminal width 512', b'terminal exec prompt no-timestamp'): self._exec_cli_command(cmd) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters')
re.compile(br"'[^']' +returned error code: ?\d+"), re.compile(br"Failed to commit", re.I) ]
random_line_split
iosxr.py
# # (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible 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. # # Ansible is d...
(TerminalBase): terminal_stdout_re = [ re.compile(br"[\r\n]?[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"), re.compile(br"\[\w+\@[\w\-\.]+(?: [^\]])\] ?[>#\$] ?$"), re.compile(br']]>]]>[\r\n]?') ] terminal_stderr_re = [ re.compile(br"% ?Error"), re.compile(br"% ?Ba...
TerminalModule
identifier_name
iosxr.py
# # (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible 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. # # Ansible is d...
terminal_stdout_re = [ re.compile(br"[\r\n]?[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"), re.compile(br"\[\w+\@[\w\-\.]+(?: [^\]])\] ?[>#\$] ?$"), re.compile(br']]>]]>[\r\n]?') ] terminal_stderr_re = [ re.compile(br"% ?Error"), re.compile(br"% ?Bad secret"), r...
identifier_body
iosxr.py
# # (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible 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. # # Ansible is d...
except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters')
self._exec_cli_command(cmd)
conditional_block
StickyHeaderStep.ts
import { UiFinder, Waiter } from '@ephox/agar'; import { after, before, context, it } from '@ephox/bedrock-client'; import { SugarBody } from '@ephox/sugar'; import { TinyHooks } from '@ephox/wrap-mcagar'; import { assert } from 'chai'; import Editor from 'tinymce/core/api/Editor'; import FullscreenPlugin from 'tinymc...
}); after(async () => { if (toolbarMode !== ToolbarMode.default) { await MenuUtils.pCloseMore(toolbarMode); } }); it('Open align menu and check sticky states', async () => { await StickyUtils.pOpenMenuAndTestScrolling(() => MenuUtils.pOpenAlignMenu('open alig...
{ await MenuUtils.pOpenMore(toolbarMode); MenuUtils.assertMoreDrawerInViewport(toolbarMode); }
conditional_block
StickyHeaderStep.ts
import { UiFinder, Waiter } from '@ephox/agar'; import { after, before, context, it } from '@ephox/bedrock-client'; import { SugarBody } from '@ephox/sugar'; import { TinyHooks } from '@ephox/wrap-mcagar'; import { assert } from 'chai'; import Editor from 'tinymce/core/api/Editor'; import FullscreenPlugin from 'tinymc...
StickyUtils.assertEditorClasses(true); assert.equal( editor.getContentAreaContainer().clientHeight, contentAreaContainerHeight, 'ContentAreaContainer height should be the same before as after docking' ); }); it('Scroll down so the editor is hidden from view, it should ...
await StickyUtils.pAssertHeaderDocked(isToolbarTop);
random_line_split
file_util_test.py
# coding=utf-8 # Copyright 2022 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...
def test_append_line_to_file(self): r"""Tests the output file. The output file contains the following. hello world (hello) "world" (hello) !!!!!!!!!!! @~#$%^&*()_+"world" aaaaaaaa bbbbbbbbbb backslash\ backslash backslash\ backslash backslash\\ backslash backslash\\\ bac...
super(UtilTest, self).setUp() self._output_dir = tempfile.mkdtemp(dir=absltest.get_default_test_tmpdir())
identifier_body
file_util_test.py
# coding=utf-8 # Copyright 2022 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...
import itertools import os import sys import tempfile from absl.testing import absltest import numpy as np from six.moves import cPickle from simulation_research.traffic import file_util class UtilTest(absltest.TestCase): def setUp(self): super(UtilTest, self).setUp() self._output_dir = tempfile.mkdtemp(...
import collections
random_line_split
file_util_test.py
# coding=utf-8 # Copyright 2022 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...
target_line_number = len(target_lines) self.assertEqual(target_line_number, line_counter) def test_save_load_variable(self): file_path = os.path.join(self._output_dir, 'test_output_data.pkl') # Case 1: Nested dictionary. data = {'zz': 1, 'b': 234, 123: 'asdfa', 'dict': {'a': 123, 't': 123}} ...
self.assertEqual(line, target_lines[line_counter] + '\n') line_counter += 1
conditional_block
file_util_test.py
# coding=utf-8 # Copyright 2022 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...
(self): r"""Tests the output file. The output file contains the following. hello world (hello) "world" (hello) !!!!!!!!!!! @~#$%^&*()_+"world" aaaaaaaa bbbbbbbbbb backslash\ backslash backslash\ backslash backslash\\ backslash backslash\\\ backslash backslash\\ backslash...
test_append_line_to_file
identifier_name
account_connectivity.py
# ~*~ coding: utf-8 ~*~ from celery import shared_task from django.utils.translation import ugettext as _, gettext_noop from common.utils import get_logger from orgs.utils import org_aware_func from ..models import Connectivity from . import const from .utils import check_asset_can_run_ansible logger = get_logger(_...
shared_task(queue="ansible") def test_accounts_connectivity_manual(accounts): """ :param accounts: <AuthBook>对象 """ for account in accounts: task_name = gettext_noop("Test account connectivity: ") + str(account) test_account_connectivity_util(account, task_name) print(".\n")
unt.set_connectivity(Connectivity.failed) @
conditional_block
account_connectivity.py
# ~*~ coding: utf-8 ~*~ from celery import shared_task from django.utils.translation import ugettext as _, gettext_noop from common.utils import get_logger from orgs.utils import org_aware_func from ..models import Connectivity from . import const from .utils import check_asset_can_run_ansible logger = get_logger(_...
def test_user_connectivity(task_name, asset, username, password=None, private_key=None): """ :param task_name :param asset :param username :param password :param private_key """ from ops.inventory import JMSCustomInventory tasks = get_test_account_connectivity_tasks(asset) if...
""" :param task_name :param tasks :param inventory """ from ops.ansible.runner import AdHocRunner runner = AdHocRunner(inventory, options=const.TASK_OPTIONS) result = runner.run(tasks, 'all', task_name) return result.results_raw, result.results_summary
identifier_body
account_connectivity.py
# ~*~ coding: utf-8 ~*~ from celery import shared_task from django.utils.translation import ugettext as _, gettext_noop from common.utils import get_logger from orgs.utils import org_aware_func from ..models import Connectivity from . import const from .utils import check_asset_can_run_ansible logger = get_logger(_...
(account, task_name): """ :param account: <AuthBook>对象 :param task_name: :return: """ if not check_asset_can_run_ansible(account.asset): return account.load_auth() try: raw, summary = test_user_connectivity( task_name=task_name, asset=account.asset, ...
test_account_connectivity_util
identifier_name
account_connectivity.py
# ~*~ coding: utf-8 ~*~ from celery import shared_task from django.utils.translation import ugettext as _, gettext_noop from common.utils import get_logger from orgs.utils import org_aware_func from ..models import Connectivity from . import const from .utils import check_asset_can_run_ansible logger = get_logger(_...
logger.debug("No tasks ") return {}, {} inventory = JMSCustomInventory( assets=[asset], username=username, password=password, private_key=private_key ) raw, summary = run_adhoc( task_name=task_name, tasks=tasks, inventory=inventory ) return raw, summary @org...
from ops.inventory import JMSCustomInventory tasks = get_test_account_connectivity_tasks(asset) if not tasks:
random_line_split
__init__.py
# -*- coding: utf-8 -*- """digitalocean API to manage droplets""" __version__ = "1.16.0" __author__ = "Lorenzo Setale ( http://who.is.lorenzo.setale.me/? )" __author_email__ = "lorenzo@setale.me" __license__ = "LGPL v3" __copyright__ = "Copyright (c) 2012-2020 Lorenzo Setale" from .Manager import Manager from .Drople...
from .Balance import Balance from .Domain import Domain from .Record import Record from .SSHKey import SSHKey from .Kernel import Kernel from .FloatingIP import FloatingIP from .Volume import Volume from .baseapi import Error, EndPointError, TokenError, DataReadError, NotFoundError from .Tag import Tag from .LoadBalanc...
from .Region import Region from .Size import Size from .Image import Image from .Action import Action from .Account import Account
random_line_split
cli.py
import logging import sys from cliff.app import App from cliff.commandmanager import CommandManager # from .utils import ColorLogFormatter from nicelog.formatters import ColorLineFormatter class HarvesterApp(App): logger = logging.getLogger(__name__) def __init__(self): super(HarvesterApp, self).__...
if __name__ == '__main__': sys.exit(main())
myapp = HarvesterApp() return myapp.run(argv)
identifier_body
cli.py
import logging import sys from cliff.app import App from cliff.commandmanager import CommandManager # from .utils import ColorLogFormatter from nicelog.formatters import ColorLineFormatter class HarvesterApp(App): logger = logging.getLogger(__name__) def __init__(self): super(HarvesterApp, self).__...
# Always send higher-level messages to the console via stderr console = logging.StreamHandler(self.stderr) console_level = {0: logging.WARNING, 1: logging.INFO, 2: logging.DEBUG, }.get(self.options.verbose_level, logging....
file_handler.setFormatter(formatter) root_logger.addHandler(file_handler)
random_line_split
cli.py
import logging import sys from cliff.app import App from cliff.commandmanager import CommandManager # from .utils import ColorLogFormatter from nicelog.formatters import ColorLineFormatter class HarvesterApp(App): logger = logging.getLogger(__name__) def __init__(self): super(HarvesterApp, self).__...
sys.exit(main())
conditional_block
cli.py
import logging import sys from cliff.app import App from cliff.commandmanager import CommandManager # from .utils import ColorLogFormatter from nicelog.formatters import ColorLineFormatter class HarvesterApp(App): logger = logging.getLogger(__name__) def
(self): super(HarvesterApp, self).__init__( description='Harvester application CLI', version='0.1', command_manager=CommandManager('harvester.commands')) def configure_logging(self): """ Create logging handlers for any log output. Modified version...
__init__
identifier_name
MergeObserver.ts
import { Log } from "wonder-commonlib/dist/es2015/Log"; import { Observer } from "../core/Observer"; import { IObserver } from "./IObserver"; import { Stream } from "../core/Stream"; import { GroupDisposable } from "../Disposable/GroupDisposable"; import { JudgeUtils } from "../JudgeUtils"; import { fromPromise }...
if (parent.q.length > 0) { parent.handleSubscribe(parent.q.shift()); } else { parent.activeCount -= 1; if (this._isAsync() && parent.activeCount === 0) { parent.currentObserver.completed(); } } } priv...
{ this.disposable.dispose(); this._groupDisposable.remove(this.disposable); }
conditional_block
MergeObserver.ts
import { Log } from "wonder-commonlib/dist/es2015/Log"; import { Observer } from "../core/Observer"; import { IObserver } from "./IObserver"; import { Stream } from "../core/Stream"; import { GroupDisposable } from "../Disposable/GroupDisposable"; import { JudgeUtils } from "../JudgeUtils"; import { fromPromise }...
private _isAsync() { return this._parent.done; } }
{ var parent = this._parent; if (!!this.disposable) { this.disposable.dispose(); this._groupDisposable.remove(this.disposable); } if (parent.q.length > 0) { parent.handleSubscribe(parent.q.shift()); } else { pa...
identifier_body
MergeObserver.ts
import { Log } from "wonder-commonlib/dist/es2015/Log"; import { Observer } from "../core/Observer"; import { IObserver } from "./IObserver"; import { Stream } from "../core/Stream"; import { GroupDisposable } from "../Disposable/GroupDisposable"; import { JudgeUtils } from "../JudgeUtils"; import { fromPromise }...
() { return this._parent.done; } }
_isAsync
identifier_name
MergeObserver.ts
import { Log } from "wonder-commonlib/dist/es2015/Log"; import { Observer } from "../core/Observer"; import { IObserver } from "./IObserver"; import { Stream } from "../core/Stream"; import { GroupDisposable } from "../Disposable/GroupDisposable"; import { JudgeUtils } from "../JudgeUtils"; import { fromPromise }...
} constructor(currentObserver: IObserver, maxConcurrent: number, groupDisposable: GroupDisposable) { super(null, null, null); this.currentObserver = currentObserver; this._maxConcurrent = maxConcurrent; this._groupDisposable = groupDisposable; } public done: ...
random_line_split
tax-meta-clss.js
/** * All Tax meta class * * JS used for the custom fields and other form items. * * Copyright 2012 Ohad Raz (admin@bainternet.info) * @since 1.0 */ var $ =jQuery.noConflict(); function update_repeater_fields(){ /** * Datepicker Field. * * @since 1.0 */ $('.at-date').each( function() { ...
} } }); } load_images_muploader(); //delete img button jQuery('.at-delete_image_button').live('click', function(e){ var field_id = jQuery(this).attr("rel"); var at_id = jQuery(this).prev().prev(); var at_src = jQuery(this).prev(); var t_button = jQuery(this); data = { action: 'at_delete_mup...
random_line_split
tax-meta-clss.js
/** * All Tax meta class * * JS used for the custom fields and other form items. * * Copyright 2012 Ohad Raz (admin@bainternet.info) * @since 1.0 */ var $ =jQuery.noConflict(); function update_repeater_fields(){ /** * Datepicker Field. * * @since 1.0 */ $('.at-date').each( function() { ...
//new image upload field function load_images_muploader(){ jQuery(".mupload_img_holder").each(function(i,v){ if (jQuery(this).next().next().val() != ''){ if (!jQuery(this).children().size() > 0){ jQuery(this).append('<img src="' + jQuery(this).next().next().val() + '" style="height: 150px;width: 150p...
{ var match = RegExp('[?&]' + name + '=([^&#]*)').exec(location.href); return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); }
identifier_body
tax-meta-clss.js
/** * All Tax meta class * * JS used for the custom fields and other form items. * * Copyright 2012 Ohad Raz (admin@bainternet.info) * @since 1.0 */ var $ =jQuery.noConflict(); function update_repeater_fields(){ /** * Datepicker Field. * * @since 1.0 */ $('.at-date').each( function() { ...
(){ jQuery(".mupload_img_holder").each(function(i,v){ if (jQuery(this).next().next().val() != ''){ if (!jQuery(this).children().size() > 0){ jQuery(this).append('<img src="' + jQuery(this).next().next().val() + '" style="height: 150px;width: 150px;" />'); jQuery(this).next().next().next().val("Delete...
load_images_muploader
identifier_name
tax-meta-clss.js
/** * All Tax meta class * * JS used for the custom fields and other form items. * * Copyright 2012 Ohad Raz (admin@bainternet.info) * @since 1.0 */ var $ =jQuery.noConflict(); function update_repeater_fields(){ /** * Datepicker Field. * * @since 1.0 */ $('.at-date').each( function() { ...
} }); } load_images_muploader(); //delete img button jQuery('.at-delete_image_button').live('click', function(e){ var field_id = jQuery(this).attr("rel"); var at_id = jQuery(this).prev().prev(); var at_src = jQuery(this).prev(); var t_button = jQuery(this); data = { action: 'at_delete_mupload'...
{ jQuery(this).append('<img src="' + jQuery(this).next().next().val() + '" style="height: 150px;width: 150px;" />'); jQuery(this).next().next().next().val("Delete"); jQuery(this).next().next().next().removeClass('at-upload_image_button').addClass('at-delete_image_button'); }
conditional_block
page_hinkley.py
""" The Tornado Framework By Ali Pesaranghader University of Ottawa, Ontario, Canada E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com --- *** The Page Hinkley (PH) Method Implementation *** Paper: Page, Ewan S. "Continuous inspection schemes." Published in: Biometrika 41.1/2 (1954): 100-115...
"$\lambda$:" + str(self.lambda_).upper() + ", " + "$\\alpha$:" + str(self.alpha).upper()]
"$\delta$:" + str(self.delta).upper() + ", " +
random_line_split
page_hinkley.py
""" The Tornado Framework By Ali Pesaranghader University of Ottawa, Ontario, Canada E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com --- *** The Page Hinkley (PH) Method Implementation *** Paper: Page, Ewan S. "Continuous inspection schemes." Published in: Biometrika 41.1/2 (1954): 100-115...
(SuperDetector): """The Page Hinkley (PH) drift detection method class.""" DETECTOR_NAME = TornadoDic.PH def __init__(self, min_instance=30, delta=0.005, lambda_=50, alpha=1 - 0.0001): super().__init__() self.MINIMUM_NUM_INSTANCES = min_instance self.m_n = 1 ...
PH
identifier_name
page_hinkley.py
""" The Tornado Framework By Ali Pesaranghader University of Ottawa, Ontario, Canada E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com --- *** The Page Hinkley (PH) Method Implementation *** Paper: Page, Ewan S. "Continuous inspection schemes." Published in: Biometrika 41.1/2 (1954): 100-115...
return warning_status, drift_status def reset(self): super().reset() self.m_n = 1 self.x_mean = 0.0 self.sum = 0.0 def get_settings(self): return [str(self.MINIMUM_NUM_INSTANCES) + "." + str(self.delta) + "." + str(self.lambda_) + "...
drift_status = True
conditional_block
page_hinkley.py
""" The Tornado Framework By Ali Pesaranghader University of Ottawa, Ontario, Canada E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com --- *** The Page Hinkley (PH) Method Implementation *** Paper: Page, Ewan S. "Continuous inspection schemes." Published in: Biometrika 41.1/2 (1954): 100-115...
def run(self, pr): pr = 1 if pr is False else 0 warning_status = False drift_status = False # 1. UPDATING STATS self.x_mean = self.x_mean + (pr - self.x_mean) / self.m_n self.sum = self.alpha * self.sum + (pr - self.x_mean - self.delta) self.m...
super().__init__() self.MINIMUM_NUM_INSTANCES = min_instance self.m_n = 1 self.x_mean = 0.0 self.sum = 0.0 self.delta = delta self.lambda_ = lambda_ self.alpha = alpha
identifier_body
paginator-demo-module.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 */ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@ang...
{ }
PaginatorDemoModule
identifier_name
paginator-demo-module.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 */ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@ang...
MatPaginatorModule, MatSlideToggleModule, RouterModule.forChild([{path: '', component: PaginatorDemo}]), ], declarations: [PaginatorDemo], }) export class PaginatorDemoModule { }
FormsModule, MatCardModule, MatFormFieldModule, MatInputModule,
random_line_split
test_flow_action.py
# -*- coding:utf-8 -*- # Copyright 2015 NEC Corporation. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License...
def test_type(self): self.assertEqual(self.target.type, self.Type) if __name__ == '__main__': unittest.main()
self.assertEqual(self.target._body[self.target.TYPE], self.Type)
identifier_body
test_flow_action.py
# -*- coding:utf-8 -*- # Copyright 2015 NEC Corporation. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License...
(self): self.assertEqual(self.target._body[self.target.TYPE], self.Type) def test_type(self): self.assertEqual(self.target.type, self.Type) if __name__ == '__main__': unittest.main()
test_constructor
identifier_name
test_flow_action.py
# -*- coding:utf-8 -*- # Copyright 2015 NEC Corporation. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License...
unittest.main()
conditional_block
test_flow_action.py
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # # You may ob...
random_line_split
put_doc.js
var superagent = require('superagent') var env = process.env /** * put_doc * initialize with the couchdb to save to * * expects that the url, port, username, password are in environment * variables. If not, add these to the options object. * * var cuser = env.COUCHDB_USER ; * var cpass = env.COUCHDB_PASS ; ...
(doc,next){ var uri = couch+'/'+opts.cdb var req if(overwrite && doc._id !== undefined){ uri += '/'+doc._id superagent.head(uri) .end(function(err,res){ if(res.header.etag){ doc._rev=JSON.parse(res.headers.etag) ...
put
identifier_name
put_doc.js
var superagent = require('superagent') var env = process.env /** * put_doc * initialize with the couchdb to save to * * expects that the url, port, username, password are in environment * variables. If not, add these to the options object. * * var cuser = env.COUCHDB_USER ; * var cpass = env.COUCHDB_PASS ; ...
module.exports=put_doc
{ if(opts.cdb === undefined) throw new Error('must define the {"cdb":"dbname"} option') var cuser = env.COUCHDB_USER var cpass = env.COUCHDB_PASS var chost = env.COUCHDB_HOST || '127.0.0.1' var cport = env.COUCHDB_PORT || 5984 // override env. vars if(opts.cuser !== undefined) cus...
identifier_body
put_doc.js
var superagent = require('superagent') var env = process.env /** * put_doc * initialize with the couchdb to save to
* var cpass = env.COUCHDB_PASS ; * var chost = env.COUCHDB_HOST || '127.0.0.1'; * var cport = env.COUCHDB_PORT || 5984; * * Options: * * {"cuser":"somerthineg", * "cpass":"password", * "chost":"couchdb host", * "cport":"couchdb port", // must be a number * "cdb" :"the%2fcouchdb%2fto%2fuse" // be sure t...
* * expects that the url, port, username, password are in environment * variables. If not, add these to the options object. * * var cuser = env.COUCHDB_USER ;
random_line_split
subst.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self, tcx: ty::ctxt, substs: &ty::substs) -> ~[T] { self.map(|t| t.subst(tcx, substs)) } } impl<T:Subst> Subst for OptVec<T> { fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> OptVec<T> { self.map(|t| t.subst(tcx, substs)) } } impl<T:Subst + 'static> Subst for @T { fn subst(&se...
subst
identifier_name
subst.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 ...
/////////////////////////////////////////////////////////////////////////// // Other types impl<T:Subst> Subst for ~[T] { fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> ~[T] { self.map(|t| t.subst(tcx, substs)) } } impl<T:Subst> Subst for OptVec<T> { fn subst(&self, tcx: ty::ctxt, substs:...
} } } }
random_line_split
subst.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 ...
ty::NonerasedRegions(ref regions) => { ty::NonerasedRegions(regions.subst(tcx, substs)) } } } } impl Subst for ty::BareFnTy { fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> ty::BareFnTy { ty::fold_bare_fn_ty(self, |t| t.subst(tcx, substs)) } ...
{ ty::ErasedRegions }
conditional_block
subst.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 ...
} impl Subst for ty::Region { fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> ty::Region { // Note: This routine only handles the self region, because it // is only concerned with substitutions of regions that appear // in types. Region substitution of the bound regions that ...
{ ty::Generics { type_param_defs: self.type_param_defs.subst(tcx, substs), region_param: self.region_param } }
identifier_body
constants.ts
/** * @license * Copyright (C) 2020 The Android Open Source Project * * 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 require...
/** * The base which should be pre-selected in the 'Diff Against' drop-down list when the change screen is opened for a merge commit * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input */ export enum DefaultBase { AUTO_MERGE = 'AUTO_MERGE', FIRST_PARENT = 'FIRST_PARENT...
PLAINTEXT = 'PLAINTEXT', HTML_PLAINTEXT = 'HTML_PLAINTEXT', }
random_line_split
constants.ts
/** * @license * Copyright (C) 2020 The Android Open Source Project * * 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 require...
// These defaults should match the defaults in // java/com/google/gerrit/extensions/client/EditPreferencesInfo.java export function createDefaultEditPrefs(): EditPreferencesInfo { return { auto_close_brackets: false, cursor_blink_rate: 0, hide_line_numbers: false, hide_top_menu: false, indent_un...
{ return { context: 10, cursor_blink_rate: 0, font_size: 12, ignore_whitespace: 'IGNORE_NONE', line_length: 100, line_wrapping: false, show_line_endings: true, show_tabs: true, show_whitespace_errors: true, syntax_highlighting: true, tab_size: 8, }; }
identifier_body
constants.ts
/** * @license * Copyright (C) 2020 The Android Open Source Project * * 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 require...
(): DiffPreferencesInfo { return { context: 10, cursor_blink_rate: 0, font_size: 12, ignore_whitespace: 'IGNORE_NONE', line_length: 100, line_wrapping: false, show_line_endings: true, show_tabs: true, show_whitespace_errors: true, syntax_highlighting: true, tab_size: 8, }...
createDefaultDiffPrefs
identifier_name
util.ts
import {stub} from "sinon" import {logger} from "@bokehjs/core/logging" export type TrapOutput = { log: string trace: string debug: string info: string warn: string error: string } export function trap(fn: () => void): TrapOutput { const result = { log: "",
error: "", } function join(args: unknown[]): string { return args.map((arg) => `${arg}`).join(" ") + "\n" } // XXX: stubing both console and logger, and including logger's name manually is a hack, // but that's be best we can do (at least for now) while preserving logger's ability to // to reference...
trace: "", debug: "", info: "", warn: "",
random_line_split
util.ts
import {stub} from "sinon" import {logger} from "@bokehjs/core/logging" export type TrapOutput = { log: string trace: string debug: string info: string warn: string error: string } export function trap(fn: () => void): TrapOutput { const result = { log: "", trace: "", debug: "", info: ""...
(args: unknown[]): string { return args.map((arg) => `${arg}`).join(" ") + "\n" } // XXX: stubing both console and logger, and including logger's name manually is a hack, // but that's be best we can do (at least for now) while preserving logger's ability to // to reference the original location from where ...
join
identifier_name
util.ts
import {stub} from "sinon" import {logger} from "@bokehjs/core/logging" export type TrapOutput = { log: string trace: string debug: string info: string warn: string error: string } export function trap(fn: () => void): TrapOutput
{ const result = { log: "", trace: "", debug: "", info: "", warn: "", error: "", } function join(args: unknown[]): string { return args.map((arg) => `${arg}`).join(" ") + "\n" } // XXX: stubing both console and logger, and including logger's name manually is a hack, // but that's...
identifier_body
remove_lines_from_a_file.rs
// http://rosettacode.org/wiki/Remove_lines_from_a_file extern crate rustc_serialize; extern crate docopt; use docopt::Docopt; use std::io::{BufReader,BufRead}; use std::fs::File; const USAGE: &'static str = " Usage: remove_lines_from_a_file <start> <count> <file> "; #[derive(Debug, RustcDecodable)] struct
{ arg_start: usize, arg_count: usize, arg_file: String, } fn main() { let args: Args = Docopt::new(USAGE) .and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let file = BufReader::new(File::open(args.arg_file).unwrap()); for (i, line) in file.lines().enumerate() { ...
Args
identifier_name
remove_lines_from_a_file.rs
// http://rosettacode.org/wiki/Remove_lines_from_a_file extern crate rustc_serialize; extern crate docopt; use docopt::Docopt; use std::io::{BufReader,BufRead}; use std::fs::File; const USAGE: &'static str = " Usage: remove_lines_from_a_file <start> <count> <file> "; #[derive(Debug, RustcDecodable)] struct Args { ...
{ let args: Args = Docopt::new(USAGE) .and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let file = BufReader::new(File::open(args.arg_file).unwrap()); for (i, line) in file.lines().enumerate() { let cur = i + 1; if cur < args.arg_start || cur >= (args.arg_start + ar...
identifier_body
remove_lines_from_a_file.rs
// http://rosettacode.org/wiki/Remove_lines_from_a_file extern crate rustc_serialize; extern crate docopt; use docopt::Docopt; use std::io::{BufReader,BufRead}; use std::fs::File; const USAGE: &'static str = " Usage: remove_lines_from_a_file <start> <count> <file> "; #[derive(Debug, RustcDecodable)] struct Args { ...
arg_count: usize, arg_file: String, } fn main() { let args: Args = Docopt::new(USAGE) .and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let file = BufReader::new(File::open(args.arg_file).unwrap()); for (i, line) in file.lines().enumerate() { let cur = i + 1; ...
random_line_split
remove_lines_from_a_file.rs
// http://rosettacode.org/wiki/Remove_lines_from_a_file extern crate rustc_serialize; extern crate docopt; use docopt::Docopt; use std::io::{BufReader,BufRead}; use std::fs::File; const USAGE: &'static str = " Usage: remove_lines_from_a_file <start> <count> <file> "; #[derive(Debug, RustcDecodable)] struct Args { ...
} }
{ println!("{}", line.unwrap()); }
conditional_block
lib.rs
//! This crate provides generic implementations of clustering //! algorithms, allowing them to work with any back-end "point //! database" that implements the required operations, e.g. one might //! be happy with using the naive collection `BruteScan` from this //! crate, or go all out and implement a specialised R*-tr...
//! Clustering algorithms. //! //! ![A cluster](http://upload.wikimedia.org/wikipedia/commons/e/e1/Cassetteandfreehub.jpg) //!
random_line_split
streaming.py
# -*- coding: utf-8 -*- """ /*************************************************************************** Client for streaming based WPS. It exploits asynchronous capabilities of WPS and QGIS for visualizing intermediate results from a WPS ------------------- copyright : (C) 201...
def fetchPlaylist(self, playlistLink): url = QUrl(playlistLink) self.QNAM4Playlist.get(QNetworkRequest(url)) # SLOT: handlePlaylist def handlePlaylist(self, reply): """ Parse the chunk URLs and update the loadedChunks counter """ # Check if there is redi...
"" Are all chunks already loaded into the map? """ return ((self.__loadedChunks == self.__deliveredChunks and self.__playlistFinished) or self.__exceptionFound)
identifier_body
streaming.py
# -*- coding: utf-8 -*- """ /*************************************************************************** Client for streaming based WPS. It exploits asynchronous capabilities of WPS and QGIS for visualizing intermediate results from a WPS ------------------- copyright : (C) 201...
if not self.__bFirstChunk: if isMimeTypeVector(self.mimeType, True) != None: self.removeTempGeometry(self.__geometryType) QgsMapLayerRegistry.instance().addMapLayer(self.__memoryLayer) elif isMimeTypeRaster(self.mimeType, T...
rint "DONE!"
conditional_block