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
analisi.py
import numpy import math import pylab from scipy.optimize import curve_fit import math import scipy.stats import lab def fit_function(x, a, b): re
FileName='/home/federico/Documenti/Laboratorio2/Diodo/dati_arduino/dati.txt' N1, N2 = pylab.loadtxt(FileName, unpack="True") errN2 = numpy.array([1.0 for i in range(len(N2))]) errN1 = numpy.array([1.0 for i in range(len(N1))]) Rd = 3280.0 errRd = 30.0 eta = 4.89/1000 erreta = 0.02/1000 V1 = eta*N1 V2 = eta*N2 I = ...
turn b*(numpy.exp(x/a)-1)
identifier_body
job-timeline.component.ts
/* * 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 ...
private readonly destroy$ = new Subject<void>(); constructor(private readonly jobService: JobService, private readonly cdr: ChangeDetectorRef) {} public ngAfterViewInit(): void { this.setUpMainChart(); this.setUpSubTaskChart(); this.jobService.jobDetail$ .pipe( filter(() => !!this.main...
@ViewChild('mainTimeLine', { static: true }) private readonly mainTimeLine: ElementRef; @ViewChild('subTaskTimeLine', { static: true }) private readonly subTaskTimeLine: ElementRef;
random_line_split
job-timeline.component.ts
/* * 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 ...
}
{ this.subTaskChartInstance = new G2.Chart({ container: this.subTaskTimeLine.nativeElement, autoFit: true, height: 10, padding: [50, 50, 50, 300] }); this.subTaskChartInstance.animate(false); this.subTaskChartInstance.coordinate('rect').transpose().scale(1, -1); this.subTaskC...
identifier_body
job-timeline.component.ts
/* * 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 ...
(private readonly jobService: JobService, private readonly cdr: ChangeDetectorRef) {} public ngAfterViewInit(): void { this.setUpMainChart(); this.setUpSubTaskChart(); this.jobService.jobDetail$ .pipe( filter(() => !!this.mainChartInstance), distinctUntilChanged((pre, next) => pre.j...
constructor
identifier_name
job-timeline.component.ts
/* * 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 ...
else { this.listOfSubTaskTimeLine.push({ name: `${task.subtask} - ${task.host}`, status: item.status, range: [item.startTime, listOfTimeLine[index + 1].startTime] }); } }); }); this.subTaskChartInstance.changeSize( ...
{ this.listOfSubTaskTimeLine.push({ name: `${task.subtask} - ${task.host}`, status: item.status, range: [item.startTime, task.duration + listOfTimeLine[0].startTime] }); }
conditional_block
square.rs
use malachite_base::num::arithmetic::traits::UnsignedAbs; use malachite_base::num::basic::floats::PrimitiveFloat; use malachite_base::num::basic::integers::PrimitiveInt; use malachite_base::num::basic::signeds::PrimitiveSigned; use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base::num::conve...
#[test] fn square_properties() { apply_fn_to_unsigneds!(square_properties_helper_unsigned); apply_fn_to_unsigned_signed_pairs!(square_properties_helper_signed); apply_fn_to_primitive_floats!(square_properties_helper_primitive_float); }
{ primitive_float_gen::<T>().test_properties(|x| { let mut square = x; square.square_assign(); assert_eq!(NiceFloat(square), NiceFloat(x.square())); assert_eq!(NiceFloat(square), NiceFloat(x.pow(2))); assert_eq!(NiceFloat((-x).square()), NiceFloat(square)); }); }
identifier_body
square.rs
use malachite_base::num::arithmetic::traits::UnsignedAbs; use malachite_base::num::basic::floats::PrimitiveFloat; use malachite_base::num::basic::integers::PrimitiveInt; use malachite_base::num::basic::signeds::PrimitiveSigned; use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base::num::conve...
assert_eq!( U::wrapping_from(square).checked_sqrt().unwrap(), x.unsigned_abs() ); }); } fn square_properties_helper_primitive_float<T: PrimitiveFloat>() { primitive_float_gen::<T>().test_properties(|x| { let mut square = x; square.square_assign(); ...
{ assert_eq!((-x).square(), square); }
conditional_block
square.rs
use malachite_base::num::arithmetic::traits::UnsignedAbs; use malachite_base::num::basic::floats::PrimitiveFloat; use malachite_base::num::basic::integers::PrimitiveInt; use malachite_base::num::basic::signeds::PrimitiveSigned; use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base::num::conve...
<T: PrimitiveFloat>() { primitive_float_gen::<T>().test_properties(|x| { let mut square = x; square.square_assign(); assert_eq!(NiceFloat(square), NiceFloat(x.square())); assert_eq!(NiceFloat(square), NiceFloat(x.pow(2))); assert_eq!(NiceFloat((-x).square()), NiceFloat(square...
square_properties_helper_primitive_float
identifier_name
square.rs
use malachite_base::num::arithmetic::traits::UnsignedAbs; use malachite_base::num::basic::floats::PrimitiveFloat; use malachite_base::num::basic::integers::PrimitiveInt; use malachite_base::num::basic::signeds::PrimitiveSigned; use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base::num::conve...
}); } fn square_properties_helper_signed< U: PrimitiveUnsigned + WrappingFrom<S>, S: PrimitiveSigned + UnsignedAbs<Output = U> + WrappingFrom<U>, >() { signed_gen_var_10::<U, S>().test_properties(|x| { let mut square = x; square.square_assign(); assert_eq!(square, x.square()); ...
assert_eq!(square.checked_log_base(x), Some(2)); }
random_line_split
token.rs
use std; /// A token. #[derive(Clone,Debug,PartialEq,Eq)] pub enum Token { /// A word. Word(String), /// A string literal. String(String), /// An integer literal. // TODO: use BigNum Integer(i64), /// A comment. /// /// If the comment is inline, it existed on the same line /...
pub fn is_symbol(&self) -> bool { if let Token::Symbol(..) = *self { true } else { false } } pub fn is_comment(&self) -> bool { if let Token::Comment { .. } = *self { true } else { false } } pub fn is_new_line(&self) -> bool { if let Token::NewLine = *self { true } else { f...
pub fn is_integer(&self) -> bool { if let Token::String(..) = *self { true } else { false } }
random_line_split
token.rs
use std; /// A token. #[derive(Clone,Debug,PartialEq,Eq)] pub enum Token { /// A word. Word(String), /// A string literal. String(String), /// An integer literal. // TODO: use BigNum Integer(i64), /// A comment. /// /// If the comment is inline, it existed on the same line /...
() -> Self { Token::symbol(")") } pub fn at_sign() -> Self { Token::symbol("@") } pub fn percent_sign() -> Self { Token::symbol("%") } pub fn left_curly_brace() -> Self { Token::symbol("{") } pub fn right_curly_brace() -> Self { Token::symbol("}") } pub fn equal_sign() -> Self { Token::symbol("=") }...
right_parenthesis
identifier_name
token.rs
use std; /// A token. #[derive(Clone,Debug,PartialEq,Eq)] pub enum Token { /// A word. Word(String), /// A string literal. String(String), /// An integer literal. // TODO: use BigNum Integer(i64), /// A comment. /// /// If the comment is inline, it existed on the same line /...
} pub fn is_integer(&self) -> bool { if let Token::String(..) = *self { true } else { false } } pub fn is_symbol(&self) -> bool { if let Token::Symbol(..) = *self { true } else { false } } pub fn is_comment(&self) -> bool { if let Token::Comment { .. } = *self { true ...
{ false }
conditional_block
xmppstreams.ts
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pl" sourcelanguage="en" version="2.1"> <context> <name>XmppStream</name> <message> <source>Connection not specified</source> <translation>Połączenie nie zostało zdefiniowane</translation> </message> </context> <context> <name>XmppStreamMan...
</message> <message> <source>XMPP stream destroyed</source> <translation type="unfinished"/> </message> <message> <source>Secure connection is not established</source> <translation type="unfinished"/> </message> <message> <source>Connection closed unexpect...
<translation type="unfinished"/> </message> <message> <source>Allows other modules to create XMPP streams and get access to them</source> <translation type="unfinished"/>
random_line_split
test_chart_date04.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from datetime import date from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(Exc...
""" Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'chart_date04.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + ...
identifier_body
test_chart_date04.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from datetime import date from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(Exc...
test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + 'xlsx_files/' + filename self.ignore_files = [] self.ignore_elements = {'xl/charts/chart1.xml': ['<c:formatCode']} def test_create_file(self): ...
filename = 'chart_date04.xlsx'
random_line_split
test_chart_date04.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from datetime import date from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class
(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'chart_date04.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self...
TestCompareXLSXFiles
identifier_name
components.source.js
/* * 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 ...
// module define('@weex-component/subvm', function (require, exports, module) { ; module.exports = { "components": { innertpl: otherNameFunction() }, data: function () {return { item: {a: 'a', b: 'b'}, className: 'fromOuter', marginTop: 10 }} } ;module.exports.style = {...
{ var module = {} var exports = {} module.exports = exports ;module.exports.style = {} ;module.exports.template = { "type": "container", "children": [ { "type": "text", "attr": { "value": function () {return this.outerData.a} } }, { "type":...
identifier_body
components.source.js
/* * 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 ...
() { var module = {} var exports = {} module.exports = exports ;module.exports.style = {} ;module.exports.template = { "type": "container", "children": [ { "type": "text", "attr": { "value": function () {return this.outerData.a} } }, { "ty...
otherNameFunction
identifier_name
components.source.js
/* * 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 ...
var module = {} var exports = {} module.exports = exports ;module.exports.style = {} ;module.exports.template = { "type": "container", "children": [ { "type": "text", "attr": { "value": function () {return this.outerData.a} } }, { "type": "...
* under the License. */ function otherNameFunction () {
random_line_split
oc-quantity-input.js
angular.module('orderCloud') .directive('ocQuantityInput', OCQuantityInput) ; function
(toastr, OrderCloudSDK, $rootScope) { return { scope: { product: '=', lineitem: '=', label: '@', order: '=', onUpdate: '&' }, templateUrl: 'common/templates/quantityInput.tpl.html', replace: true, link: function (sco...
OCQuantityInput
identifier_name
oc-quantity-input.js
angular.module('orderCloud') .directive('ocQuantityInput', OCQuantityInput) ; function OCQuantityInput(toastr, OrderCloudSDK, $rootScope) { return { scope: { product: '=', lineitem: '=', label: '@', order: '=', onUpdate: '&' }, ...
} }) } else { toastr.error('Please input either a product or lineitem attribute in the directive','Error'); console.error('Please input either a product or lineitem attribute in the quantityInput directive ') ...
{ OrderCloudSDK.LineItems.Patch('outgoing', scope.order.ID, scope.item.ID, {Quantity: scope.item.Quantity}) .then(function (data) { if(data.ProductID === 'AACPunchoutProduct'){ ...
conditional_block
oc-quantity-input.js
angular.module('orderCloud') .directive('ocQuantityInput', OCQuantityInput) ; function OCQuantityInput(toastr, OrderCloudSDK, $rootScope) { return { scope: { product: '=', lineitem: '=', label: '@', order: '=', onUpdate: '&' },
scope.content = "product" } else if(scope.lineitem){ OrderCloudSDK.Me.GetProduct(scope.lineitem.ProductID) .then(function(product) { scope.item = scope.lineitem; if (product.PriceSchedule && !prod...
templateUrl: 'common/templates/quantityInput.tpl.html', replace: true, link: function (scope) { if (scope.product){ scope.item = scope.product;
random_line_split
oc-quantity-input.js
angular.module('orderCloud') .directive('ocQuantityInput', OCQuantityInput) ; function OCQuantityInput(toastr, OrderCloudSDK, $rootScope)
{ return { scope: { product: '=', lineitem: '=', label: '@', order: '=', onUpdate: '&' }, templateUrl: 'common/templates/quantityInput.tpl.html', replace: true, link: function (scope) { if (scope.product)...
identifier_body
articles-form.component.ts
import { Component, Input, OnInit, OnDestroy } from '@angular/core' import { FormGroup, FormBuilder, Validators } from '@angular/forms' import { Subscription, Observable } from 'rxjs' import { MeteorObservable } from 'meteor-rxjs' import { Tags } from '/both/collections/tags.collection' import { Tag } from '/both/model...
if (this.myTag.has(tagValue)) { this.myTag.delete(tagValue) } else { this.myTag.add(tagValue) } } constructor( private formBuilder: FormBuilder ) {} ngOnInit() { this.printForm() } onImage(imageId : string) : void { this.image = ima...
lang : string = 'en' // TODO: Add test if tagValue exist in collection ! addTag(tagValue: string): void {
random_line_split
articles-form.component.ts
import { Component, Input, OnInit, OnDestroy } from '@angular/core' import { FormGroup, FormBuilder, Validators } from '@angular/forms' import { Subscription, Observable } from 'rxjs' import { MeteorObservable } from 'meteor-rxjs' import { Tags } from '/both/collections/tags.collection' import { Tag } from '/both/model...
e { this.addForm = this.formBuilder.group({ title: ['', [Validators.required, Validators.minLength(2)] ], description: ['', Validators.required], image: [this.image], lang: [this.lang, Validators.required], article: ['', Validat...
this.kill() this.image = this.edit.image this.imageSub = MeteorObservable.subscribe('image', this.image).subscribe() this.addForm = this.formBuilder.group({ title: [this.edit.lang[retLang(this.lang)].title], description: [this.edit.lang[retLa...
conditional_block
articles-form.component.ts
import { Component, Input, OnInit, OnDestroy } from '@angular/core' import { FormGroup, FormBuilder, Validators } from '@angular/forms' import { Subscription, Observable } from 'rxjs' import { MeteorObservable } from 'meteor-rxjs' import { Tags } from '/both/collections/tags.collection' import { Tag } from '/both/model...
if (this.tagsSub) this.tagsSub.unsubscribe() if (this.imageSub) this.imageSub.unsubscribe() } ngOnDestroy() { this.kill() } }
() {
identifier_name
articles-form.component.ts
import { Component, Input, OnInit, OnDestroy } from '@angular/core' import { FormGroup, FormBuilder, Validators } from '@angular/forms' import { Subscription, Observable } from 'rxjs' import { MeteorObservable } from 'meteor-rxjs' import { Tags } from '/both/collections/tags.collection' import { Tag } from '/both/model...
langSelected(lang : string) { if (isLang(lang)) { this.lang = lang } } private kill() { if (this.tagsSub) this.tagsSub.unsubscribe() if (this.imageSub) this.imageSub.unsubscribe() } ngOnDestroy() { this.kill() } }
if (this.addForm.valid) { this.arrayOfTags = Array.from(this.myTag) this.addForm.value.lang = this.lang let img = this.addForm.value.image console.log('We will add img -> ' + img) if (this.edit) { console.log('we edit an article') ...
identifier_body
15.2.3.5-4-46.js
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright an...
} return accessed; } runTestCase(testcase);
{ accessed = true; }
conditional_block
15.2.3.5-4-46.js
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright an...
runTestCase(testcase);
{ var accessed = false; var newObj = Object.create({}, { prop: { enumerable: true } }); for (var property in newObj) { if (property === "prop") { accessed = true; } } return accessed; }
identifier_body
15.2.3.5-4-46.js
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright an...
() { var accessed = false; var newObj = Object.create({}, { prop: { enumerable: true } }); for (var property in newObj) { if (property === "prop") { accessed = true; } } return accessed; ...
testcase
identifier_name
15.2.3.5-4-46.js
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright an...
} } return accessed; } runTestCase(testcase);
if (property === "prop") { accessed = true;
random_line_split
conf.py
# -*- coding: utf-8 -*- # # Kolibri 'developer docs' build configuration file # # This file is execfile()d with the current directory set to its containing dir. import inspect import os import sys from datetime import datetime import django from django.utils.encoding import force_text from django.utils.html import str...
(app): # Register the docstring processor with sphinx app.connect('autodoc-process-docstring', process_docstring) # Add our custom CSS overrides app.add_stylesheet('theme_overrides.css') # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. ht...
setup
identifier_name
conf.py
# -*- coding: utf-8 -*- # # Kolibri 'developer docs' build configuration file # # This file is execfile()d with the current directory set to its containing dir. import inspect import os import sys from datetime import datetime import django from django.utils.encoding import force_text from django.utils.html import str...
return lines # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] linkcheck_i...
lines.append(u':type %s: %s' % (field.attname, type(field).__name__))
conditional_block
conf.py
# -*- coding: utf-8 -*- # # Kolibri 'developer docs' build configuration file # # This file is execfile()d with the current directory set to its containing dir. import inspect import os import sys from datetime import datetime import django from django.utils.encoding import force_text from django.utils.html import str...
builddir = os.path.join(cwd, '_build') # When we start loading stuff from kolibri, we're gonna need this os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kolibri.deployment.default.settings.base") os.environ["KOLIBRI_HOME"] = os.path.join(builddir, 'kolibri_home') # This is necessary because the directory needs to ...
random_line_split
conf.py
# -*- coding: utf-8 -*- # # Kolibri 'developer docs' build configuration file # # This file is execfile()d with the current directory set to its containing dir. import inspect import os import sys from datetime import datetime import django from django.utils.encoding import force_text from django.utils.html import str...
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # If true, links to the reST sou...
app.connect('autodoc-process-docstring', process_docstring) # Add our custom CSS overrides app.add_stylesheet('theme_overrides.css')
identifier_body
posture-to-jacobian-recurrent.py
import climate import lmj.cubes import lmj.plot import numpy as np import pandas as pd import theanets logging = climate.get_logger('posture->jac') BATCH = 256 THRESHOLD = 100 def load_markers(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('marker') and c[...
idx = [] while len(idx) <= T: s = np.random.randint(len(bodys)) body = bodys[s] goal = goals[s] jac = jacs[s] idx = body.index & goal.index & jac.index i = np.random.randin...
outputs = np.zeros((B, T, njac), 'f') def batch(): for b in range(B):
random_line_split
posture-to-jacobian-recurrent.py
import climate import lmj.cubes import lmj.plot import numpy as np import pandas as pd import theanets logging = climate.get_logger('posture->jac') BATCH = 256 THRESHOLD = 100 def load_markers(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('marker') and c[...
return [inputs, outputs] return batch net.train( #[np.vstack(inputs), np.vstack(outputs)], batches(32), algo='layerwise', momentum=0.9, learning_rate=0.0001, patience=5, min_improvement=0.01, #max_gradient_norm=1, #input_...
idx = [] while len(idx) <= T: s = np.random.randint(len(bodys)) body = bodys[s] goal = goals[s] jac = jacs[s] idx = body.index & goal.index & jac.index i = np.random.randint(len(idx) - T) ...
conditional_block
posture-to-jacobian-recurrent.py
import climate import lmj.cubes import lmj.plot import numpy as np import pandas as pd import theanets logging = climate.get_logger('posture->jac') BATCH = 256 THRESHOLD = 100 def
(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('marker') and c[-1] in 'xyz'] return df[cols].astype('f') def load_jacobian(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('pc')] return df[co...
load_markers
identifier_name
posture-to-jacobian-recurrent.py
import climate import lmj.cubes import lmj.plot import numpy as np import pandas as pd import theanets logging = climate.get_logger('posture->jac') BATCH = 256 THRESHOLD = 100 def load_markers(fn):
def load_jacobian(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('pc')] return df[cols].astype('f') def main(root): match = lmj.cubes.utils.matching bodys = [load_markers(f) for f in sorted(match(root, '*_body.csv.gz'))] nbody = bodys[0]....
df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('marker') and c[-1] in 'xyz'] return df[cols].astype('f')
identifier_body
updatereplicas_controller_test.js
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
let ctrl; /** @type {!md.$dialog} */ let mdDialog; /** @type {!ui.router.$state} */ let state; /** @type {!angular.$resource} */ let resource; /** @type {!angular.$httpBackend} */ let httpBackend; /** @type {!angular.$log} */ let log; /** @type {string} */ let namespaceMock = 'foo-namespace';...
* @type {!UpdateReplicasDialogController} */
random_line_split
listeners.py
import io from molotov.api import get_fixture _UNREADABLE = "***WARNING: Molotov can't display this body***" _BINARY = "**** Binary content ****" _FILE = "**** File content ****" _COMPRESSED = ('gzip', 'compress', 'deflate', 'identity', 'br') class BaseListener(object): async def __call__(self, event, **options...
raw = '>' * 45 raw += '\n' + request.method + ' ' + str(request.url) if len(request.headers) > 0: headers = '\n'.join('%s: %s' % (k, v) for k, v in request.headers.items()) raw += '\n' + headers if request.headers.get('Content-Enco...
return
conditional_block
listeners.py
import io from molotov.api import get_fixture _UNREADABLE = "***WARNING: Molotov can't display this body***" _BINARY = "**** Binary content ****" _FILE = "**** File content ****" _COMPRESSED = ('gzip', 'compress', 'deflate', 'identity', 'br') class BaseListener(object): async def
(self, event, **options): attr = getattr(self, 'on_' + event, None) if attr is not None: await attr(**options) class StdoutListener(BaseListener): def __init__(self, **options): self.verbose = options.get('verbose', 0) self.console = options['console'] def _body2st...
__call__
identifier_name
listeners.py
import io from molotov.api import get_fixture _UNREADABLE = "***WARNING: Molotov can't display this body***" _BINARY = "**** Binary content ****" _FILE = "**** File content ****" _COMPRESSED = ('gzip', 'compress', 'deflate', 'identity', 'br') class BaseListener(object): async def __call__(self, event, **options...
raw += '\n\n' + _BINARY elif response.content: content = await response.content.read() if len(content) > 0: # put back the data in the content response.content.unread_data(content) try: raw += '\n\n' + conten...
if response.headers.get('Content-Encoding') in _COMPRESSED:
random_line_split
listeners.py
import io from molotov.api import get_fixture _UNREADABLE = "***WARNING: Molotov can't display this body***" _BINARY = "**** Binary content ****" _FILE = "**** File content ****" _COMPRESSED = ('gzip', 'compress', 'deflate', 'identity', 'br') class BaseListener(object): async def __call__(self, event, **options...
class CustomListener(object): def __init__(self, fixture): self.fixture = fixture async def __call__(self, event, **options): await self.fixture(event, **options) class EventSender(object): def __init__(self, console, listeners=None): self.console = console if listeners...
def __init__(self, **options): self.verbose = options.get('verbose', 0) self.console = options['console'] def _body2str(self, body): try: from aiohttp.payload import Payload except ImportError: Payload = None if Payload is not None and isinstance(bod...
identifier_body
constants.ts
// Copyright (c) 2017, Daniel Andersen (daniel@trollsahead.dk) // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, t...
{ //public static apiUrl = 'http://10.0.1.4:5001/service' public static apiUrl = 'http://10.192.92.93:5001/service' }
Constants
identifier_name
constants.ts
// Copyright (c) 2017, Daniel Andersen (daniel@trollsahead.dk) // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met:
// this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // 3. The name of the author may not be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROV...
// // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice,
random_line_split
cardActionElement.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(d...
() { } CardActionElement.prototype.attached = function () { this.element.classList.add("card-action"); }; CardActionElement.prototype.detached = function () { this.element.classList.remove("card-action"); }; CardActionElement = __decorate([ ...
CardActionElement
identifier_name
cardActionElement.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(d...
}; CardActionElement = __decorate([ aurelia_framework_1.customElement(config_1.config.cardAction), aurelia_framework_1.containerless(), aurelia_framework_1.inlineView("<template><div ref='element'><slot></slot></div></template>"), __metadata('design:param...
random_line_split
cardActionElement.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(d...
CardActionElement.prototype.attached = function () { this.element.classList.add("card-action"); }; CardActionElement.prototype.detached = function () { this.element.classList.remove("card-action"); }; CardActionElement = __decorate([ aurelia_f...
{ }
identifier_body
arguments.rs
use thiserror::Error; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Comm { Type1, Type2, None, } /// A type of paired token #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Field { /// Processes (ex: `$(..)`) Proc, /// Literal array (ex: `[ 1 .. 3 ]`) Array, /// Brace ex...
<B: Iterator<Item = u8>>(&mut self, bytes: &mut B) { while let Some(character) = bytes.next() { match character { b'\\' => { self.read += 2; let _ = bytes.next(); continue; } b'\'' => break, ...
scan_singlequotes
identifier_name
arguments.rs
use thiserror::Error; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Comm { Type1, Type2, None, } /// A type of paired token #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Field { /// Processes (ex: `$(..)`) Proc, /// Literal array (ex: `[ 1 .. 3 ]`) Array, /// Brace ex...
b' ' => { if !self.quotes && !self.method && levels.are_rooted() { break; } } _ => (), } self.read += 1; // disable COMM_1 and COMM_2 self.comm = Comm::None; ...
random_line_split
arguments.rs
use thiserror::Error; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Comm { Type1, Type2, None, } /// A type of paired token #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Field { /// Processes (ex: `$(..)`) Proc, /// Literal array (ex: `[ 1 .. 3 ]`) Array, /// Brace ex...
}
{ let input = "echo 'one two \"three four\"' \"five six 'seven eight'\""; let expected = vec!["echo", "'one two \"three four\"'", "\"five six 'seven eight'\""]; compare(input, expected); }
identifier_body
_windows.py
#***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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....
""" Linux JVM library finder class """ def __init__(self): """ Sets up members """ # Call the parent constructor _jvmfinder.JVMFinder.__init__(self) # Library file name self._libfile = "jvm.dll" # Search methods self._methods = (self....
identifier_body
_windows.py
#***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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....
(_jvmfinder.JVMFinder): """ Linux JVM library finder class """ def __init__(self): """ Sets up members """ # Call the parent constructor _jvmfinder.JVMFinder.__init__(self) # Library file name self._libfile = "jvm.dll" # Search methods ...
WindowsJVMFinder
identifier_name
_windows.py
#***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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....
try : jreKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\JavaSoft\Java Runtime Environment") cv = winreg.QueryValueEx(jreKey, "CurrentVersion") versionKey = winreg.OpenKey(jreKey, cv[0]) winreg.CloseKey(jreKey) ...
Windows registry :return: The path found in the registry, or None """
random_line_split
test.ts
import SimplenoteImporter, { convertModificationDates } from './'; import CoreImporter from '../'; jest.mock('../'); describe('SimplenoteImporter', () => { let importer; beforeEach(() => { importer = new SimplenoteImporter(() => {}); importer.emit = jest.spyOn(importer, 'emit'); CoreImporter.mockClear...
otherProp: 'value', }, ]); expect(processedNotes).toEqual([ { modificationDate: 1539612550.382, otherProp: 'value', }, { modificationDate: '1539612550', otherProp: 'value', }, ]); }); it('should not add ...
modificationDate: '1539612550',
random_line_split
lib.rs
//! #rust-hackchat //! A client library for Hack.chat. //! //! This library allows you to make custom clients and bots for Hack.chat using Rust. //! //! #Examples //! //! ``` //! extern crate hackchat; //! use hackchat::{ChatClient, ChatEvent}; //! //! fn main() { //! let mut conn = ChatClient::new("TestBot", "botD...
} }, Type::Ping => { self.sender.lock().unwrap().send_message(&Message::pong(message.payload)).unwrap(); }, _ => { return None; } }; return None; }...
{ println!("Unsupported message type"); continue; }
conditional_block
lib.rs
//! #rust-hackchat //! A client library for Hack.chat. //! //! This library allows you to make custom clients and bots for Hack.chat using Rust. //! //! #Examples //! //! ``` //! extern crate hackchat; //! use hackchat::{ChatClient, ChatEvent}; //! //! fn main() { //! let mut conn = ChatClient::new("TestBot", "botD...
/// ChatEvent::LeaveRoom(nick) => { /// chat.send_message(format!("Goodbye {}, see you later!", nick)); /// }, /// _ => {} /// } /// } /// ``` pub fn iter(&mut self) -> ChatClient { return self.clone(); } } impl Iterator for ChatClient...
/// for event in chat.iter() { /// match event { /// ChatEvent::JoinRoom(nick) => { /// chat.send_message(format!("Welcome to the chat {}!", nick)); /// },
random_line_split
lib.rs
//! #rust-hackchat //! A client library for Hack.chat. //! //! This library allows you to make custom clients and bots for Hack.chat using Rust. //! //! #Examples //! //! ``` //! extern crate hackchat; //! use hackchat::{ChatClient, ChatEvent}; //! //! fn main() { //! let mut conn = ChatClient::new("TestBot", "botD...
(&mut self) { let stats_packet = json!({ "cmd": "stats" }); let message = Message::text(stats_packet.to_string()); self.sender.lock().unwrap().send_message(&message).unwrap(); } /// Starts the ping thread, which sends regular pings to keep the connection open. pu...
send_stats_request
identifier_name
webpack.common.config.js
var HtmlWebpackPlugin = require("html-webpack-plugin"), autoprefixer = require("autoprefixer"), path = require("path"); module.exports = { loaders: [{ test: /\.js$/, exclude: /node_modules/, loaders: ['react-hot', 'babel'], include: path.join(__dirname, 'src') },{ test...
loader: "style!css!postcss-loader" },{ test: /\.less$/, loader: "css!less" }], postcss: [ autoprefixer({browsers: ['last 4 versions', 'iOS 6', 'Android 2.1']}) ], indexPagePlugin: new HtmlWebpackPlugin({ inject: true, title: 'himynameisdave', ...
loader: "file-loader" },{ test: /\.css$/,
random_line_split
q17.py
""" 问题描述:给定一个矩阵matrix,其中的值有正、负和0,返回子矩阵的最大累加和. 例如,矩阵matrix为 -90 48 78 64 -40 64 -81 -7 66 其中,最大累加和的子矩阵为: 48 78 -40 64 -7 66 所以返回累加和209. 例如,matrix为: -1 -1 -1 -1 2 2 -1 -1 -1 其中,最大累加和的子矩阵为: 2 2 所以返回累加和为4. """ import sys from arrandmatrix.q16 import MaxSum class MaxMatrixSum: @classmethod def g...
return [arr1[i]+arr2[i] for i in range(len(arr1))] if __name__ == '__main__': my_matrix = [ [-90, 48, 78], [64, -40, 64], [-81, -7, 66] ] print(MaxMatrixSum.get_max_sum(my_matrix))
@classmethod def arr_add(cls, arr1, arr2):
random_line_split
q17.py
""" 问题描述:给定一个矩阵matrix,其中的值有正、负和0,返回子矩阵的最大累加和. 例如,矩阵matrix为 -90 48 78 64 -40 64 -81 -7 66 其中,最大累加和的子矩阵为: 48 78 -40 64 -7 66 所以返回累加和209. 例如,matrix为: -1 -1 -1 -1 2 2 -1 -1 -1 其中,最大累加和的子矩阵为: 2 2 所以返回累加和为4. """ import sys from arrandmatrix.q16 import MaxSum class MaxMatrixSum: @classmethod def g...
(len(matrix)): j = i pre_arr = [0 for _ in range(len(matrix[0]))] while j < len(matrix): arr = cls.arr_add(matrix[j], pre_arr) max_value = max([MaxSum.get_max_sum(arr), max_value]) j += 1 pre_arr = arr return ma...
r i in range
identifier_name
q17.py
""" 问题描述:给定一个矩阵matrix,其中的值有正、负和0,返回子矩阵的最大累加和. 例如,矩阵matrix为 -90 48 78 64 -40 64 -81 -7 66 其中,最大累加和的子矩阵为: 48 78 -40 64 -7 66 所以返回累加和209. 例如,matrix为: -1 -1 -1 -1 2 2 -1 -1 -1 其中,最大累加和的子矩阵为: 2 2 所以返回累加和为4. """ import sys from arrandmatrix.q16 import MaxSum class MaxMatrixSum: @classmethod def g...
'__main__': my_matrix = [ [-90, 48, 78], [64, -40, 64], [-81, -7, 66] ] print(MaxMatrixSum.get_max_sum(my_matrix))
max_value = max([MaxSum.get_max_sum(arr), max_value]) j += 1 pre_arr = arr return max_value @classmethod def arr_add(cls, arr1, arr2): return [arr1[i]+arr2[i] for i in range(len(arr1))] if __name__ ==
conditional_block
q17.py
""" 问题描述:给定一个矩阵matrix,其中的值有正、负和0,返回子矩阵的最大累加和. 例如,矩阵matrix为 -90 48 78 64 -40 64 -81 -7 66 其中,最大累加和的子矩阵为: 48 78 -40 64 -7 66 所以返回累加和209. 例如,matrix为: -1 -1 -1 -1 2 2 -1 -1 -1 其中,最大累加和的子矩阵为: 2 2 所以返回累加和为4. """ import sys from arrandmatrix.q16 import MaxSum class MaxMatrixSum: @classmethod def g...
sum(my_matrix))
atrix)): j = i pre_arr = [0 for _ in range(len(matrix[0]))] while j < len(matrix): arr = cls.arr_add(matrix[j], pre_arr) max_value = max([MaxSum.get_max_sum(arr), max_value]) j += 1 pre_arr = arr return max_valu...
identifier_body
rectification_geometry.py
################################################################################ # # # Copyright (C) 2010,2011,2012,2013,2014, 2015,2016 The ESPResSo project # # ...
################################################################################ # # Now we set up the three LB boundaries that form the rectifying geometry. # The cylinder boundary/constraint is actually already capped, but we put # in two planes for safety's sake. If you want to create an cylinder of # 'infinit...
system.actors.add(lbf)
random_line_split
testVarArgs.ts
interface IMeteor { /** * Subscribe to a record set. Returns a handle that provides `stop()` and `ready()` methods. * * @locus Client * * @param {String} name - <p>Name of the subscription. Matches the name of the server's <code>publish()</code> call.</p> * @param {Any} [arg1, arg2....
*/ subscribe(name:string, ...args:any[]):any; } declare var Meteor:IMeteor;
* @param {function or Object} [callbacks] - <p>Optional. May include <code>onError</code> and <code>onReady</code> callbacks. If a function is passed instead of an object, it is interpreted as an <code>onReady</code> callback.</p>
random_line_split
TestHelpers.ts
import * as assert from "assert"; var nock = require("nock"); import fs = require('fs'); const Readable = require('stream').Readable; const Writable = require('stream').Writable; const Stats = require('fs').Stats; import azureBlobUploadHelper = require('../../azure-blob-upload-helper'); /** * Exit code is used to d...
return fsos(path, flags); }; let fsrs = fs.readSync; fs.readSync = (fd: number, buffer: Buffer, offset: number, length: number, position: number)=> { if (fd == 1234567.89) { buffer = new Buffer(100); return; } return fsrs(fd, buffer, offset, length, position); }; fs.statSync...
{ return 1234567.89; }
conditional_block
TestHelpers.ts
import * as assert from "assert"; var nock = require("nock"); import fs = require('fs'); const Readable = require('stream').Readable; const Writable = require('stream').Writable; const Stats = require('fs').Stats; import azureBlobUploadHelper = require('../../azure-blob-upload-helper'); /** * Exit code is used to d...
export function mockAzure() { azureBlobUploadHelper.AzureBlobUploadHelper.prototype.upload = async () => { return Promise.resolve(); } } function wrapAssertWithExitCode(assert, ...args) { try { assert.apply(undefined, args); } catch (error) { process.exit(1); } }
{ let fsos = fs.openSync; fs.openSync = (path: string, flags: string) => { if (path.endsWith(".ipa")){ return 1234567.89; } return fsos(path, flags); }; let fsrs = fs.readSync; fs.readSync = (fd: number, buffer: Buffer, offset: number, length: number, position: number)=> { if (fd == ...
identifier_body
TestHelpers.ts
import * as assert from "assert"; var nock = require("nock"); import fs = require('fs'); const Readable = require('stream').Readable; const Writable = require('stream').Writable; const Stats = require('fs').Stats; import azureBlobUploadHelper = require('../../azure-blob-upload-helper'); /** * Exit code is used to d...
() { const uploadDomain = 'https://example.upload.test/release_upload'; const assetId = "00000000-0000-0000-0000-000000000123"; const uploadId = 7; nock('https://example.test') .post('/v0.1/apps/testuser/testapp/uploads/releases') .reply(201, { id: uploadId, package_asset_id: assetId, ...
basicSetup
identifier_name
TestHelpers.ts
import * as assert from "assert"; var nock = require("nock"); import fs = require('fs'); const Readable = require('stream').Readable; const Writable = require('stream').Writable; const Stats = require('fs').Stats; import azureBlobUploadHelper = require('../../azure-blob-upload-helper'); /** * Exit code is used to d...
.patch(`/v0.1/apps/testuser/testapp/uploads/releases/${uploadId}`, { upload_status: "uploadFinished", }) .query(true) .reply(200, { upload_status: "uploadFinished" }); nock('https://example.test') .put('/v0.1/apps/testuser/testapp/releases/1', JSON.stringify({ ...
}); nock('https://example.test')
random_line_split
extern-stress.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 ...
do task::spawn { assert!(count(5u) == 16u); }; } }
random_line_split
extern-stress.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 count(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for old_iter::repeat(100u) { do task::spawn { assert!(count(5u) == 16u); }; } }
{ task::yield(); count(data - 1u) + count(data - 1u) }
conditional_block
extern-stress.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 ...
{ for old_iter::repeat(100u) { do task::spawn { assert!(count(5u) == 16u); }; } }
identifier_body
extern-stress.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 ...
(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for old_iter::repeat(100u) { do task::spawn { assert!(count(5u) == 16u); }; } }
count
identifier_name
XDCC.py
# -*- coding: utf-8 -*- import os import re import select import socket import struct import time from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import exists, fsjoin class XDCC(Hoster): __name__ = "XDCC" __type__ = "hoster" __version__ = "0.42"
__status__ = "testing" __pattern__ = r'xdcc://(?P<SERVER>.*?)/#?(?P<CHAN>.*?)/(?P<BOT>.*?)/#?(?P<PACK>\d+)/?' __config__ = [("nick", "str", "Nickname", "pyload" ), ("ident", "str", "Ident", "pyloadident" ), ...
random_line_split
XDCC.py
# -*- coding: utf-8 -*- import os import re import select import socket import struct import time from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import exists, fsjoin class XDCC(Hoster): __name__ = "XDCC" __type__ = "hoster" __version__ = "0.42" __status__ ...
def process(self, pyfile): #: Change request type self.req = self.pyload.requestFactory.getRequest(self.classname, type="XDCC") for _i in xrange(0, 3): try: nmn = self.do_download(pyfile.url) self.log_info("Download of %s finished." % nmn) ...
self.timeout = 30 self.multiDL = False
identifier_body
XDCC.py
# -*- coding: utf-8 -*- import os import re import select import socket import struct import time from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import exists, fsjoin class XDCC(Hoster): __name__ = "XDCC" __type__ = "hoster" __version__ = "0.42" __status__ ...
(self, pyfile): #: Change request type self.req = self.pyload.requestFactory.getRequest(self.classname, type="XDCC") for _i in xrange(0, 3): try: nmn = self.do_download(pyfile.url) self.log_info("Download of %s finished." % nmn) return...
process
identifier_name
XDCC.py
# -*- coding: utf-8 -*- import os import re import select import socket import struct import time from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import exists, fsjoin class XDCC(Hoster): __name__ = "XDCC" __type__ = "hoster" __version__ = "0.42" __status__ ...
else: if (dl_time + self.timeout) < time.time(): #@TODO: add in config sock.send("QUIT :byebye\r\n") sock.close() self.log_error(_("XDCC Bot did not answer")) self.fail(_("XDCC Bot did not answer")) ...
retry = None dl_time = time.time() sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
conditional_block
__init__.py
# -*- coding: utf-8 -*- import re from DelogX.utils.i18n import I18n from DelogX.utils.path import Path from DelogX.utils.plugin import Plugin class DelogReadMore(Plugin):
i18n = None def run(self): conf = self.blog.default_conf self.i18n = I18n( Path.format_url(self.workspace, 'locale'), conf('local.locale')) self.manager.add_action('dx_post_update', self.parse_readmore) def parse_readmore(self, post): if not post: ...
identifier_body
__init__.py
# -*- coding: utf-8 -*- import re from DelogX.utils.i18n import I18n from DelogX.utils.path import Path from DelogX.utils.plugin import Plugin class DelogReadMore(Plugin): i18n = None def run(self): conf = self.blog.default_conf self.i18n = I18n( Path.format_url(s...
more_class = ' '.join(more_class) content = content.format( summary, more_class, post_url, self.i18n.get('Read More'), more) post.content = content
more_class.append('no-more-content')
conditional_block
__init__.py
# -*- coding: utf-8 -*- import re from DelogX.utils.i18n import I18n from DelogX.utils.path import Path from DelogX.utils.plugin import Plugin class
(Plugin): i18n = None def run(self): conf = self.blog.default_conf self.i18n = I18n( Path.format_url(self.workspace, 'locale'), conf('local.locale')) self.manager.add_action('dx_post_update', self.parse_readmore) def parse_readmore(self, post): if no...
DelogReadMore
identifier_name
__init__.py
# -*- coding: utf-8 -*- import re from DelogX.utils.i18n import I18n from DelogX.utils.path import Path
from DelogX.utils.plugin import Plugin class DelogReadMore(Plugin): i18n = None def run(self): conf = self.blog.default_conf self.i18n = I18n( Path.format_url(self.workspace, 'locale'), conf('local.locale')) self.manager.add_action('dx_post_update', self.parse_...
random_line_split
main.rs
use std::env; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; fn
(c: char) -> bool { match c { ' ' => true, 'x' => true, 'y' => true, '=' => true, _ => false, } } const WIDTH: usize = 50; const HEIGHT: usize = 6; fn main() { let args: Vec<String> = env::args().collect(); let f = File::open(&args[1]).expect("Could not open fil...
is_splitpoint
identifier_name
main.rs
use std::env; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; fn is_splitpoint(c: char) -> bool { match c { ' ' => true, 'x' => true, 'y' => true, '=' => true, _ => false, } } const WIDTH: usize = 50; const HEIGHT: usize = 6; fn main() { let arg...
println!(""); } println!("{} lights active.", count); }
print!(" "); } }
random_line_split
main.rs
use std::env; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; fn is_splitpoint(c: char) -> bool
const WIDTH: usize = 50; const HEIGHT: usize = 6; fn main() { let args: Vec<String> = env::args().collect(); let f = File::open(&args[1]).expect("Could not open file"); let reader = BufReader::new(f); let mut lights = [[false; HEIGHT]; WIDTH]; for line in reader.lines() { let contents = ...
{ match c { ' ' => true, 'x' => true, 'y' => true, '=' => true, _ => false, } }
identifier_body
pl.js
OC.L10N.register( "encryption", { "Missing recovery key password" : "Brakujące hasło klucza odzyskiwania", "Please repeat the recovery key password" : "Proszę powtórz nowe hasło klucza odzyskiwania", "Repeated recovery key password does not match the provided recovery key password" : "Hasła klucza o...
"Password successfully changed." : "Zmiana hasła udana.", "Could not change the password. Maybe the old password was not correct." : "Nie można zmienić hasła. Może stare hasło nie było poprawne.", "Recovery Key disabled" : "Klucz odzyskiwania wyłączony", "Recovery Key enabled" : "Klucz odzyskiwania włąc...
"Please provide the old recovery password" : "Podaj stare hasło odzyskiwania", "Please provide a new recovery password" : "Podaj nowe hasło odzyskiwania", "Please repeat the new recovery password" : "Proszę powtórz nowe hasło odzyskiwania",
random_line_split
read_analog.js
var wpi = require('wiring-pi'); // var ref = require('ref'); // required if passing pointers to lib functions // var ffi = require('ffi'); // var gert = ffi.Library('libwiringPiDev', { // 'gertboardAnalogSetup': [ 'int', [ 'int' ] ] // }); // var res = gert.atod(); // console.log('Gertboard ADC is currently measu...
console.log("analog input = " + value); }, 500);
random_line_split
make-middleware.ts
/*! * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
* the `request` object. It optionally can do HttpRequest timing that can be * used for generating request logs. This can be used to integrate with logging * libraries such as winston and bunyan. * * @param projectId Generated traceIds will be associated with this project. * @param makeChildLogger A function that ...
/** * Generates an express middleware that installs a request-specific logger on
random_line_split
make-middleware.ts
/*! * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
<LoggerType>( projectId: string, makeChildLogger: ( trace: string, span?: string, traceSampled?: boolean ) => LoggerType, emitRequestLog?: ( httpRequest: CloudLoggingHttpRequest, trace: string, span?: string, traceSampled?: boolean ) => void ) { return (req: ServerRequest, res: h...
makeMiddleware
identifier_name
make-middleware.ts
/*! * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
next(); }; }
{ onFinished(res, () => { const latencyMs = Date.now() - requestStartMs; const httpRequest = makeHttpRequestData(req, res, latencyMs); emitRequestLog( httpRequest, traceContext.trace, traceContext.spanId, traceContext.traceSampled ); })...
conditional_block
make-middleware.ts
/*! * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
{ return (req: ServerRequest, res: http.ServerResponse, next: Function) => { // TODO(ofrobots): use high-resolution timer. const requestStartMs = Date.now(); // Detect & establish context if we were the first actor to detect lack of // context so traceContext is always available when using middleware...
identifier_body
pingdom.py
# The MIT License # # Copyright (c) 2010 Daniel R. Craig # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
def get_method(self): if self.method: return self.method return urllib2.Request.get_method(self) def method(self, url, method="GET", parameters=None): if parameters: data = urlencode(parameters) else: data = None ...
urllib2.Request.__init__(self, url, data, headers, origin_req_host, unverifiable) if http_method: self.method = http_method
identifier_body
pingdom.py
# The MIT License # # Copyright (c) 2010 Daniel R. Craig # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
(self): if self.method: return self.method return urllib2.Request.get_method(self) def method(self, url, method="GET", parameters=None): if parameters: data = urlencode(parameters) else: data = None method_url = urljoin(sel...
get_method
identifier_name
pingdom.py
# The MIT License # # Copyright (c) 2010 Daniel R. Craig # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
class Pingdom(object): def __init__(self, url=API_URL, username=None, password=None, appkey=None): self.url = url self.appkey= appkey password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager.add_password(None, url, username, password) auth_handler = urlli...
random_line_split
pingdom.py
# The MIT License # # Copyright (c) 2010 Daniel R. Craig # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
else: req = self.RequestWithMethod(method_url, http_method=method, data=data) req.add_header('App-Key', self.appkey) response = self.opener.open(req).read() return json.loads(response) def check_by_name(self, name): resp = self.method('checks') c...
method_url = method_url+'?'+data req = self.RequestWithMethod(method_url, http_method=method, data=None)
conditional_block
scan_for_lcmtypes.py
#!/usr/bin/python import re import os import sys import pyclbr def find_lcmtypes(): alpha_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") valid_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_") lcmtypes = [] regex = re.compile("_get_packed_fingerprint") ...
# only recurse into subdirectories that correspond to python # packages (i.e., they contain a file named "__init__.py") subdirs_to_traverse = [ subdir_name for subdir_name in dirs \ if os.path.exists(os.path.join(root, subdir_name, "__init__.py")) ] ...
if not fname.endswith(".py"): continue mod_basename = fname[:-3] valid_modname = True for c in mod_basename: if c not in valid_chars: valid_modname = False break ...
conditional_block
scan_for_lcmtypes.py
#!/usr/bin/python import re import os import sys import pyclbr def
(): alpha_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") valid_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_") lcmtypes = [] regex = re.compile("_get_packed_fingerprint") dirs_to_check = sys.path for dir_name in dirs_to_check: for...
find_lcmtypes
identifier_name
scan_for_lcmtypes.py
#!/usr/bin/python import re import os import sys import pyclbr def find_lcmtypes():
def make_lcmtype_dictionary(): """Create a dictionary of LCM types keyed by fingerprint. Searches the specified python package directories for modules corresponding to LCM types, imports all the discovered types into the global namespace, and returns a dictionary mapping packed fingerprints to L...
alpha_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") valid_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_") lcmtypes = [] regex = re.compile("_get_packed_fingerprint") dirs_to_check = sys.path for dir_name in dirs_to_check: for root, d...
identifier_body
scan_for_lcmtypes.py
#!/usr/bin/python import re import os import sys import pyclbr def find_lcmtypes(): alpha_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") valid_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_") lcmtypes = [] regex = re.compile("_get_packed_fingerprint") ...
# LCM type module genereated by lcm-gen. Parse the # file using pyclbr, and check if it contains a class # with the right name and methods if python_package: modname = "%s.%s" % (python_package, mod_basename) else: ...
if not regex.search(contents): continue # More thorough check to see if the file corresponds to a
random_line_split
msi.py
"""SCons.Tool.packaging.msi The msi packager. """ # # Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # with...
file.write( doc.toprettyxml() ) # call a user specified function if 'CHANGE_SPECFILE' in env: env['CHANGE_SPECFILE'](target, source) except KeyError, e: raise SCons.Errors.UserError( '"%s" package field for MSI is missing.' % e.args[0] ) # # setup function # def create...
# write the xml to a file
random_line_split