file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
ad_src_tf_phase_misfit.py
# # The current choice is historic as changing does (very slightly) chance # the calculated misfit and we don't want to disturb inversions in # progress. The difference is likely minimal in any case. We might have # same aliasing into the lower frequencies but the filters coupled with # the TF-d...
""" :rtype: dictionary :returns: Return a dictionary with three keys: * adjoint_source: The calculated adjoint source as a numpy array * misfit: The misfit value * messages: A list of strings giving additional hints to what happened in the calculation. """ # Assumes t...
identifier_body
ad_src_tf_phase_misfit.py
The difference is likely minimal in any case. We might have # same aliasing into the lower frequencies but the filters coupled with # the TF-domain weighting will get rid of them in essentially all # realistically occurring cases. dt_new = max(float(int(min_period / 3.0)), t[1] - t[0]) # New time ...
# The misfit can still be computed, even if not adjoint source is # available. if criterion > max_criterion: warning = ("Possible phase jump detected. Misfit included. No " "adjoint source computed. Criterion: %.1f - Max allowed " "criterion: %.1f" % (criterio...
msg = "The phase misfit is NaN." raise LASIFAdjointSourceCalculationError(msg)
conditional_block
ad_src_tf_phase_misfit.py
The difference is likely minimal in any case. We might have # same aliasing into the lower frequencies but the filters coupled with # the TF-domain weighting will get rid of them in essentially all # realistically occurring cases. dt_new = max(float(int(min_period / 3.0)), t[1] - t[0]) # New time ...
rect = l + w + 0.02, b, 1.0 - (l + w + 0.02) - 0.05, 4 * h cm_axis = fig.add_axes(rect) # Plot the weighted phase difference. weighted_phase_difference = (DP * weight).transpose() mappable = tf_axis.pcol
random_line_split
Toggle_button.py
#!/usr/bin/python3 # -*- coding: utf-8 -*-
In this example, we create three toggle buttons. They will control the background colour of a QFrame. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import (QWidget, QPushButton, QFrame, QApplication) from PyQt5.QtGui import QColor class Example(QWidget...
""" ZetCode PyQt5 tutorial
random_line_split
Toggle_button.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ZetCode PyQt5 tutorial In this example, we create three toggle buttons. They will control the background colour of a QFrame. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import (QWidget, QPushButton, QF...
else: val = 0 if source.text() == "Red": self.col.setRed(val) elif source.text() == "Green": self.col.setGreen(val) else: self.col.setBlue(val) self.square.setStyleSheet("QFra...
val = 255
conditional_block
Toggle_button.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ZetCode PyQt5 tutorial In this example, we create three toggle buttons. They will control the background colour of a QFrame. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import (QWidget, QPushButton, QF...
self.square = QFrame(self) self.square.setGeometry(150, 20, 100, 100) self.square.setStyleSheet("QWidget { background-color: %s }" % self.col.name()) self.setGeometry(300, 300, 280, 170) self.setWindowTitle('Toggle button') self.show() ...
self.col = QColor(0, 0, 0) redb = QPushButton('Red', self) redb.setCheckable(True) redb.move(10, 10) redb.clicked[bool].connect(self.setColor) redb = QPushButton('Green', self) redb.setCheckable(True) redb.move(10, 60) redb.clicked[bool].connect...
identifier_body
Toggle_button.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ZetCode PyQt5 tutorial In this example, we create three toggle buttons. They will control the background colour of a QFrame. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import (QWidget, QPushButton, QF...
(self): self.col = QColor(0, 0, 0) redb = QPushButton('Red', self) redb.setCheckable(True) redb.move(10, 10) redb.clicked[bool].connect(self.setColor) redb = QPushButton('Green', self) redb.setCheckable(True) redb.move(10, 60) red...
initUI
identifier_name
stdio-is-blocking.rs
// run-pass // ignore-emscripten no processes // ignore-sgx no processes use std::env; use std::io::prelude::*; use std::process::Command; use std::thread; const THREADS: usize = 20; const WRITES: usize = 100; const WRITE_SIZE: usize = 1024 * 32; fn main() { let args = env::args().collect::<Vec<_>>(); if arg...
assert_eq!(output.stderr.len(), 0); assert_eq!(output.stdout.len(), WRITES * THREADS * WRITE_SIZE); for byte in output.stdout.iter() { assert_eq!(*byte, b'a'); } } fn child() { let threads = (0..THREADS).map(|_| { thread::spawn(|| { let buf = [b'a'; WRITE_SIZE]; ...
let mut cmd = Command::new(me); cmd.arg("run-the-test"); let output = cmd.output().unwrap(); assert!(output.status.success());
random_line_split
stdio-is-blocking.rs
// run-pass // ignore-emscripten no processes // ignore-sgx no processes use std::env; use std::io::prelude::*; use std::process::Command; use std::thread; const THREADS: usize = 20; const WRITES: usize = 100; const WRITE_SIZE: usize = 1024 * 32; fn main() { let args = env::args().collect::<Vec<_>>(); if arg...
fn child() { let threads = (0..THREADS).map(|_| { thread::spawn(|| { let buf = [b'a'; WRITE_SIZE]; for _ in 0..WRITES { write_all(&buf); } }) }).collect::<Vec<_>>(); for thread in threads { thread.join().unwrap(); } } #[cfg(...
{ let me = env::current_exe().unwrap(); let mut cmd = Command::new(me); cmd.arg("run-the-test"); let output = cmd.output().unwrap(); assert!(output.status.success()); assert_eq!(output.stderr.len(), 0); assert_eq!(output.stdout.len(), WRITES * THREADS * WRITE_SIZE); for byte in output.st...
identifier_body
stdio-is-blocking.rs
// run-pass // ignore-emscripten no processes // ignore-sgx no processes use std::env; use std::io::prelude::*; use std::process::Command; use std::thread; const THREADS: usize = 20; const WRITES: usize = 100; const WRITE_SIZE: usize = 1024 * 32; fn main() { let args = env::args().collect::<Vec<_>>(); if arg...
() { let threads = (0..THREADS).map(|_| { thread::spawn(|| { let buf = [b'a'; WRITE_SIZE]; for _ in 0..WRITES { write_all(&buf); } }) }).collect::<Vec<_>>(); for thread in threads { thread.join().unwrap(); } } #[cfg(unix)] fn ...
child
identifier_name
stdio-is-blocking.rs
// run-pass // ignore-emscripten no processes // ignore-sgx no processes use std::env; use std::io::prelude::*; use std::process::Command; use std::thread; const THREADS: usize = 20; const WRITES: usize = 100; const WRITE_SIZE: usize = 1024 * 32; fn main() { let args = env::args().collect::<Vec<_>>(); if arg...
else { child(); } } fn parent() { let me = env::current_exe().unwrap(); let mut cmd = Command::new(me); cmd.arg("run-the-test"); let output = cmd.output().unwrap(); assert!(output.status.success()); assert_eq!(output.stderr.len(), 0); assert_eq!(output.stdout.len(), WRITES * TH...
{ parent(); }
conditional_block
smooth-scroll.js
match for ( ; elem && elem !== document; elem = elem.parentNode )
return null; }; /** * Escape special characters for use with querySelector * @private * @param {String} id The anchor ID to escape * @author Mathias Bynens * @link https://github.com/mathiasbynens/CSS.escape */ var escapeCharacters = function ( id ) { // Remove leading hash if ( id.charAt(0) =...
{ if ( elem.matches( selector ) ) return elem; }
conditional_block
smooth-scroll.js
closest match for ( ; elem && elem !== document; elem = elem.parentNode ) { if ( elem.matches( selector ) ) return elem; } return null; }; /** * Escape special characters for use with querySelector * @private * @param {String} id The anchor ID to escape * @author Mathias Bynens * @link https://...
return Math.max( document.documentElement.clientHeight, root.innerHeight || 0 ); }; /** * Determine the document's height * @private * @returns {Number} */ var getDocumentHeight = function () { return Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offset...
* @private * @returns {Number} */ var getViewportHeight = function() {
random_line_split
ErrorField.tsx
import React from 'react'; import { ErrorField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; const error = { error: 'validation-error', reason: 'X is required', details: [{ name: 'x', type: 'required', details: { value: null } }], message: 'X is requ...
expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); test('<ErrorField> - renders correct error message (specified)', () => { const element = ( <ErrorField name="x" error={error.details[0]} errorMessage="X is required" /> ); const wrapper = mount(element, createContext({...
expect(wrapper.find(ErrorField)).toHaveLength(1);
random_line_split
consulta_partidas_por_producto.py
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public Lice...
roducto = pclases.ProductoVenta.get(idproducto) and_fecha_inicio = "AND parte_de_produccion.fecha >= '%s'" % (self.get_unambiguous_fecha(self.inicio)) if producto.es_rollo(): parte_where_de_consulta = """ partida.id IN (SELECT rollo.partida_id FROM rollo WHER...
ogo_info(titulo = 'ERROR', texto = 'Seleccione un producto', padre = self.wids['ventana']) return p
conditional_block
consulta_partidas_por_producto.py
_INT64',False,True,False,None), ('Código','gobject.TYPE_STRING',False,True,False,None), ('Fecha fab.','gobject.TYPE_STRING',False,True,False,None), ('Longitudinal','gobject.TYPE_STRING',False,True,False,None), ('Transversal','gobject.TYPE_STRING',False,Tru...
repara la vista preliminar para la impresión del informe """ from formularios import reports datos = [] lista = self.resultado for elem in lista: datos.append((elem.numpartida, "%.2f" % elem.longitudinal, "%.2f" % elem.transvers...
identifier_body
consulta_partidas_por_producto.py
warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General...
(SELECT articulo.rollo_id FROM articulo WHERE articulo.producto_venta_id = %d AND articulo.parte_de_produccion_id IN (SELECT parte_de_produccion.id FROM parte_de_produccion WHERE parte_de_produccion.fecha <= '%s' %s ...
FROM bala WHERE bala.id IN
random_line_split
consulta_partidas_por_producto.py
of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public L...
n): temp = utils.mostrar_calendario(padre = self.wids['ventana']) self.wids['e_fechafin'].set_text(utils.str_fecha(temp)) self.fin = mx.DateTime.DateTimeFrom(day = temp[0], month = temp[1], year = temp[2]) def por_fecha(self,e1,e2): """ Permite ordenar una lista de albarane...
lf,boto
identifier_name
ComponentWrapper.tsx
import * as React from 'react'; import { ComponentProvider } from 'react-native'; import { polyfill } from 'react-lifecycles-compat'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { Store } from './Store'; import { ComponentEventsObserver } from '../events/ComponentEventsObserver'; interface HocS...
} } polyfill(WrappedComponent); hoistNonReactStatics( WrappedComponent, concreteComponentProvider === OriginalComponentGenerator ? GeneratedComponentClass : concreteComponentProvider() ); return ReduxProvider ? this.wrapWithRedux(WrappedComponent, ReduxProvi...
{ throw new Error(`Component ${componentName} does not have a componentId!`); }
conditional_block
ComponentWrapper.tsx
import * as React from 'react'; import { ComponentProvider } from 'react-native'; import { polyfill } from 'react-lifecycles-compat'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { Store } from './Store'; import { ComponentEventsObserver } from '../events/ComponentEventsObserver'; interface HocS...
(newProps: any) { this.setState((prevState) => ({ allProps: { ...prevState.allProps, ...newProps, }, })); } componentWillUnmount() { store.clearComponent(this.state.componentId); componentEventsObserver.unmounted(this.state.compone...
setProps
identifier_name
ComponentWrapper.tsx
import * as React from 'react'; import { ComponentProvider } from 'react-native'; import { polyfill } from 'react-lifecycles-compat'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { Store } from './Store'; import { ComponentEventsObserver } from '../events/ComponentEventsObserver'; interface HocS...
export class ComponentWrapper { wrap( componentName: string | number, OriginalComponentGenerator: ComponentProvider, store: Store, componentEventsObserver: ComponentEventsObserver, concreteComponentProvider: ComponentProvider = OriginalComponentGenerator, ReduxProvider?: any, reduxStore?:...
} export interface IWrappedComponent extends React.Component { setProps(newProps: Record<string, any>): void; }
random_line_split
get_color_fns.ts
import chalk from 'chalk' import { TestStepResultStatus } from '@cucumber/messages' export type IColorFn = (text: string) => string export interface IColorFns { forStatus: (status: TestStepResultStatus) => IColorFn location: IColorFn tag: IColorFn diffAdded: IColorFn diffRemoved: IColorFn errorMessage: IC...
(enabled: boolean): IColorFns { if (enabled) { return { forStatus(status: TestStepResultStatus) { return { AMBIGUOUS: chalk.red.bind(chalk), FAILED: chalk.red.bind(chalk), PASSED: chalk.green.bind(chalk), PENDING: chalk.yellow.bind(chalk), SKIPPED: c...
getColorFns
identifier_name
get_color_fns.ts
import chalk from 'chalk' import { TestStepResultStatus } from '@cucumber/messages' export type IColorFn = (text: string) => string export interface IColorFns { forStatus: (status: TestStepResultStatus) => IColorFn location: IColorFn tag: IColorFn diffAdded: IColorFn diffRemoved: IColorFn errorMessage: IC...
errorStack: IColorFn } export default function getColorFns(enabled: boolean): IColorFns { if (enabled) { return { forStatus(status: TestStepResultStatus) { return { AMBIGUOUS: chalk.red.bind(chalk), FAILED: chalk.red.bind(chalk), PASSED: chalk.green.bind(chalk), ...
random_line_split
get_color_fns.ts
import chalk from 'chalk' import { TestStepResultStatus } from '@cucumber/messages' export type IColorFn = (text: string) => string export interface IColorFns { forStatus: (status: TestStepResultStatus) => IColorFn location: IColorFn tag: IColorFn diffAdded: IColorFn diffRemoved: IColorFn errorMessage: IC...
}
{ return { forStatus(_status: TestStepResultStatus) { return (x) => x }, location: (x) => x, tag: (x) => x, diffAdded: (x) => x, diffRemoved: (x) => x, errorMessage: (x) => x, errorStack: (x) => x, } }
conditional_block
get_color_fns.ts
import chalk from 'chalk' import { TestStepResultStatus } from '@cucumber/messages' export type IColorFn = (text: string) => string export interface IColorFns { forStatus: (status: TestStepResultStatus) => IColorFn location: IColorFn tag: IColorFn diffAdded: IColorFn diffRemoved: IColorFn errorMessage: IC...
, location: chalk.gray.bind(chalk), tag: chalk.cyan.bind(chalk), diffAdded: chalk.green.bind(chalk), diffRemoved: chalk.red.bind(chalk), errorMessage: chalk.red.bind(chalk), errorStack: chalk.grey.bind(chalk), } } else { return { forStatus(_status: TestStepResultStatu...
{ return { AMBIGUOUS: chalk.red.bind(chalk), FAILED: chalk.red.bind(chalk), PASSED: chalk.green.bind(chalk), PENDING: chalk.yellow.bind(chalk), SKIPPED: chalk.cyan.bind(chalk), UNDEFINED: chalk.yellow.bind(chalk), UNKNOWN: chalk.yellow.bind(c...
identifier_body
apply.py
#!python from __future__ import with_statement from __future__ import division from __future__ import absolute_import from __future__ import print_function import pandas as pd import wordbatch.batcher def decorator_apply(func, batcher=None, cache=None, vectorize=None): def wrapper_func(*args, **kwargs): return Appl...
return batcher.process_batches(batch_transform, data, [self.function] + self.args + self.kwargs + self.cache + self.vectorize, input_split=input_split, merge_output=merge_output, minibatch_size= minibatch_size) # impo...
batcher = self.batcher
conditional_block
apply.py
#!python from __future__ import with_statement from __future__ import division from __future__ import absolute_import from __future__ import print_function import pandas as pd import wordbatch.batcher def decorator_apply(func, batcher=None, cache=None, vectorize=None): def wrapper_func(*args, **kwargs): return Appl...
return [f(row, *f_args, **f_kwargs) for row in args[0]] class Apply(object): #Applies a function to each row of a minibatch def __init__(self, function, batcher=None, args=[], kwargs={}, cache=None, vectorize=None): if batcher is None: self.batcher= wordbatch.batcher.Batcher() else: self.batcher= batcher s...
random_line_split
apply.py
#!python from __future__ import with_statement from __future__ import division from __future__ import absolute_import from __future__ import print_function import pandas as pd import wordbatch.batcher def decorator_apply(func, batcher=None, cache=None, vectorize=None): def
(*args, **kwargs): return Apply(func, args=args[1:], kwargs=kwargs, batcher=batcher, cache=cache, vectorize=vectorize)\ .transform(args[0]) return wrapper_func def batch_transform(args): f= args[1] f_args= args[2] f_kwargs= args[3] if args[5] is not None: from numba import vectorize return vectorize(args...
wrapper_func
identifier_name
apply.py
#!python from __future__ import with_statement from __future__ import division from __future__ import absolute_import from __future__ import print_function import pandas as pd import wordbatch.batcher def decorator_apply(func, batcher=None, cache=None, vectorize=None): def wrapper_func(*args, **kwargs): return Appl...
def fit(self, data, input_split= False, batcher= None): return self def fit_transform(self, data, input_split=False, merge_output=True, minibatch_size=None, batcher=None): return self.transform(data, input_split, merge_output, minibatch_size, batcher) def transform(self, data, input_split=False, merge_output...
if batcher is None: self.batcher= wordbatch.batcher.Batcher() else: self.batcher= batcher self.function= function self.args= [args] self.kwargs= [kwargs] self.cache = [cache] self.vectorize = [vectorize]
identifier_body
example.rs
use std::convert::AsRef; #[derive(PartialEq, Eq, Debug)] pub struct RibonucleicAcid { nucleotides: String } impl RibonucleicAcid { pub fn new(nucleotides: &str) -> RibonucleicAcid
} impl AsRef<str> for RibonucleicAcid { fn as_ref(&self) -> &str { self.nucleotides.as_ref() } } #[derive(PartialEq, Eq, Debug)] pub struct DeoxyribonucleicAcid { nucleotides: String } fn transcribe_dna_rna(c: char) -> char { match c { 'C' => 'G', 'G' => 'C', 'A' => '...
{ RibonucleicAcid { nucleotides: nucleotides.to_string() } }
identifier_body
example.rs
use std::convert::AsRef; #[derive(PartialEq, Eq, Debug)] pub struct RibonucleicAcid { nucleotides: String } impl RibonucleicAcid { pub fn new(nucleotides: &str) -> RibonucleicAcid { RibonucleicAcid { nucleotides: nucleotides.to_string() } } } impl AsRef<str> for RibonucleicAcid { fn as_ref(&s...
pub fn to_rna(&self) -> RibonucleicAcid { let rna_nucleotides = self.nucleotides.chars().map(transcribe_dna_rna).collect(); RibonucleicAcid { nucleotides: rna_nucleotides } } }
random_line_split
example.rs
use std::convert::AsRef; #[derive(PartialEq, Eq, Debug)] pub struct RibonucleicAcid { nucleotides: String } impl RibonucleicAcid { pub fn
(nucleotides: &str) -> RibonucleicAcid { RibonucleicAcid { nucleotides: nucleotides.to_string() } } } impl AsRef<str> for RibonucleicAcid { fn as_ref(&self) -> &str { self.nucleotides.as_ref() } } #[derive(PartialEq, Eq, Debug)] pub struct DeoxyribonucleicAcid { nucleotides: String } ...
new
identifier_name
util.py
import os from glob import glob from pyramid.path import AssetResolver from reportlab.lib.units import mm from reportlab.pdfgen import canvas from ..models import generate_random_digest __all__ = [ 'generate_random_filename', 'delete_files', 'NumberedCanvas' ] def generate_random_filename(path=None, ext...
(expression): files = glob(expression) if files: os.remove(*files) class NumberedCanvas(canvas.Canvas): def __init__(self, *args, **kwargs): canvas.Canvas.__init__(self, *args, **kwargs) self._saved_page_states = [] def showPage(self): self._saved_page_states.append(di...
delete_files
identifier_name
util.py
import os from glob import glob from pyramid.path import AssetResolver from reportlab.lib.units import mm from reportlab.pdfgen import canvas from ..models import generate_random_digest __all__ = [ 'generate_random_filename', 'delete_files', 'NumberedCanvas' ] def generate_random_filename(path=None, ext...
"Page %d of %d" % (self._pageNumber, page_count))
def __init__(self, *args, **kwargs): canvas.Canvas.__init__(self, *args, **kwargs) self._saved_page_states = [] def showPage(self): self._saved_page_states.append(dict(self.__dict__)) self._startPage() def save(self): """add page info to each page (page x of y)""" ...
identifier_body
util.py
import os from glob import glob from pyramid.path import AssetResolver from reportlab.lib.units import mm from reportlab.pdfgen import canvas
from ..models import generate_random_digest __all__ = [ 'generate_random_filename', 'delete_files', 'NumberedCanvas' ] def generate_random_filename(path=None, extension='pdf'): r = AssetResolver('erp') path = path or r.resolve('static/temp').abspath() if not os.path.exists(path): os....
random_line_split
util.py
import os from glob import glob from pyramid.path import AssetResolver from reportlab.lib.units import mm from reportlab.pdfgen import canvas from ..models import generate_random_digest __all__ = [ 'generate_random_filename', 'delete_files', 'NumberedCanvas' ] def generate_random_filename(path=None, ext...
filename = generate_random_digest() return '/'.join([path, '{filename}.{extension}'.format(filename=filename, extension=extension)]) def delete_files(expression): files = glob(expression) if files: os.remove(*files) class NumberedCanvas(canvas.Canvas): def __init__(self, *args, **kwargs...
os.mkdir(path)
conditional_block
frontend.ts
get compressionName(): string { return this.obj['Compression']; } constructor(public obj: any) { verifyObject(obj); verifyObjectProperty(obj, 'TypeName', verifyString); } } export class DataInstanceInfo { lowerVoxelBound: vec3; upperVoxelBoundInclusive: vec3; voxelSize: vec3; blockSize: ...
{ return this.obj['TypeName']; }
identifier_body
frontend.ts
labelmap': return new VolumeDataInstanceInfo( obj, name, baseInfo, VolumeChunkEncoding.COMPRESSED_SEGMENTATIONARRAY, instanceNames); default: throw new Error(`DVID data type ${JSON.stringify(baseInfo.typeName)} is not supported.`); } } export class RepositoryInfo { alias: string; descri...
{ throw new Error(`Invalid data instance ${dataInstanceKey}.`); }
conditional_block
frontend.ts
, instanceNames); default: throw new Error(`DVID data type ${JSON.stringify(baseInfo.typeName)} is not supported.`); } } export class RepositoryInfo { alias: string; description: string; errors: string[] = []; dataInstances = new Map<string, DataInstanceInfo>(); uuid: string; vnodes = new Set<s...
completeInstanceName
identifier_name
frontend.ts
downsampleFactor; chunkToMultiscaleTransform[12 + i] = lowerVoxelBound[i] * downsampleFactor; } let alternatives = makeDefaultVolumeChunkSpecifications({ rank: 3, chunkToMultiscaleTransform, dataType: this.dataType, baseVoxelOffset: lowerVo...
subsource: { mesh: options.chunkManager.getChunkSource(DVIDMeshSource, { parameters: {
random_line_split
oozie_setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (...
irectories = (REMOTE_DEPLOYMENT_DIR.get(), REMOTE_SAMPLE_DIR.get()) for directory in directories: if not fs.do_as_user("hdfs", fs.exists, directory): remote_home_dir = Hdfs.join('/user', "hdfs") if directory.startswith(remote_home_dir): # Home is 755 fs.do_as_user("hdfs", fs.create_ho...
identifier_body
oozie_setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (...
return REMOTE_SAMPLE_DIR.get()
f not fs.do_as_user("hdfs", fs.exists, directory): remote_home_dir = Hdfs.join('/user', "hdfs") if directory.startswith(remote_home_dir): # Home is 755 fs.do_as_user("hdfs", fs.create_home_dir, remote_home_dir) # Shared by all the users fs.do_as_user("hdfs", fs.mkdir, directory, ...
conditional_block
oozie_setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (...
directories = (REMOTE_DEPLOYMENT_DIR.get(), REMOTE_SAMPLE_DIR.get()) for directory in directories: if not fs.do_as_user("hdfs", fs.exists, directory): remote_home_dir = Hdfs.join('/user', "hdfs") if directory.startswith(remote_home_dir): # Home is 755 fs.do_as_user("hdfs", fs.create...
def create_directories(fs): # If needed, create the remote home, deployment and data directories
random_line_split
oozie_setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (...
NoArgsCommand): def handle_noargs(self, **options): fs = cluster.get_hdfs() remote_dir = create_directories(fs) # Copy examples binaries for name in os.listdir(LOCAL_SAMPLE_DIR.get()): local_dir = fs.join(LOCAL_SAMPLE_DIR.get(), name) remote_data_dir = fs.join(remote_dir, name) LOG....
ommand(
identifier_name
basic.py
(core.BaseData): """ Basic table Data Reader Set a few defaults for common ascii table formats (start at line 1, comments begin with ``#`` and possibly white space) """ start_line = 1 comment = r'\s*#' write_comment = '# ' class Basic(core.BaseReader): r""" Read a character-de...
(Basic): """ Read a CSV (comma-separated-values) file. Example:: num,ra,dec,radius,mag 1,32.23222,10.1211,0.8,18.1 2,38.12321,-88.1321,2.2,17.0 Plain csv (comma separated value) files typically contain as many entries as there are columns on each line. In contrast, common spread...
Csv
identifier_name
basic.py
' ' rdr.data.splitter.delimiter = ' ' rdr.header.start_line = 0 rdr.data.start_line = 1 rdr.data.end_line = None rdr.header.comment = r'\s*#' rdr.data.comment = r'\s*#' Example table:: # Column definition is the first uncommented line # Default delimite...
col.raw_type = raw_type col.type = self.get_col_type(col)
conditional_block
basic.py
Data(core.BaseData): """ Basic table Data Reader Set a few defaults for common ascii table formats (start at line 1, comments begin with ``#`` and possibly white space) """ start_line = 1 comment = r'\s*#' write_comment = '# ' class Basic(core.BaseReader): r""" Read a characte...
class TabData(BasicData): """ Reader for data of tables with tab separated data """ splitter_class = TabDataSplitter class Tab(Basic): """ Read a tab-separated file. Unlike the :class:`Basic` reader, whitespace is not stripped from the beginning and end of either lines or individual co...
""" Reader for header of tables with tab separated header """ splitter_class = TabHeaderSplitter
identifier_body
basic.py
Data(core.BaseData): """ Basic table Data Reader Set a few defaults for common ascii table formats (start at line 1, comments begin with ``#`` and possibly white space) """ start_line = 1 comment = r'\s*#' write_comment = '# ' class Basic(core.BaseReader): r""" Read a characte...
Header class for which the column definition line starts with the comment character. See the :class:`CommentedHeader` class for an example. """ def process_lines(self, lines): """ Return only lines that start with the comment regexp. For these lines strip out the matching cha...
data_class = NoHeaderData class CommentedHeaderHeader(BasicHeader): """
random_line_split
modify.rs
use clap::ArgMatches; use common::*; use colored::*; use io::*; use libhupa::*; /// Modify subcommand pub fn
(mut hupas: Vec<Hupa>, config: &Config, sub_m: &ArgMatches) { let hupas_to_modify = if let Some(hupas_names) = sub_m.values_of("hupa") { let hupas_names: Vec<String> = hupas_names.map(|s| s.to_string()).collect(); resolve_names(&hupas_names, &hupas) } else { select_hupas(&hupas, "Select ...
modify_subcommand
identifier_name
modify.rs
use clap::ArgMatches; use common::*; use colored::*; use io::*; use libhupa::*; /// Modify subcommand pub fn modify_subcommand(mut hupas: Vec<Hupa>, config: &Config, sub_m: &ArgMatches) { let hupas_to_modify = if let Some(hupas_names) = sub_m.values_of("hupa") { let hupas_names: Vec<String> = hupas_names.m...
hupa.set_category(category.split('/').map(|s| s.to_string()).collect()) .expect("Cannot reset category"); } 4 => { println!( "Current backup parent: {}", hupa.get_backup_parent...
.iter() .map(|s| format!("{}/", s)) .collect::<String>() ); let category = read_line("New category (ex: os/linux): ", true);
random_line_split
modify.rs
use clap::ArgMatches; use common::*; use colored::*; use io::*; use libhupa::*; /// Modify subcommand pub fn modify_subcommand(mut hupas: Vec<Hupa>, config: &Config, sub_m: &ArgMatches) { let hupas_to_modify = if let Some(hupas_names) = sub_m.values_of("hupa") { let hupas_names: Vec<String> = hupas_names.m...
4 => { println!( "Current backup parent: {}", hupa.get_backup_parent().display() ); hupa.set_backup_parent(read_line("New backup parent: ", true)) .expect("Cannot reset ba...
{ println!( "Current category: {}", hupa.get_category() .iter() .map(|s| format!("{}/", s)) .collect::<String>() ); let category...
conditional_block
modify.rs
use clap::ArgMatches; use common::*; use colored::*; use io::*; use libhupa::*; /// Modify subcommand pub fn modify_subcommand(mut hupas: Vec<Hupa>, config: &Config, sub_m: &ArgMatches)
let idxs = read_line_usize("Select action [1-8]: ", false, 8); for i in idxs { match i { 1 => { println!("Current name: {}", hupa.get_name()); hupa.set_name(read_line("New name: ", true)).expect( "Cannot rename h...
{ let hupas_to_modify = if let Some(hupas_names) = sub_m.values_of("hupa") { let hupas_names: Vec<String> = hupas_names.map(|s| s.to_string()).collect(); resolve_names(&hupas_names, &hupas) } else { select_hupas(&hupas, "Select hupas to modify") }; for hupa in &mut hupas { ...
identifier_body
lib.rs
#![feature(box_syntax)] #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate hyper; pub mod dictionaries; pub mod thesaureses; pub use dictionaries::{Definition, Dictionary}; pub use thesaureses::Thesaurus; mod error { use std::error; use std::error::Error as ErrorT; use std::fmt; ...
(val: ::std::io::Error) -> Self { Error::Error(Box::new(val)) } } } pub use error::Error; pub type Result<T> = std::result::Result<T, Error>;
from
identifier_name
lib.rs
#![feature(box_syntax)] #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate hyper; pub mod dictionaries; pub mod thesaureses; pub use dictionaries::{Definition, Dictionary}; pub use thesaureses::Thesaurus; mod error { use std::error; use std::error::Error as ErrorT; use std::fmt; ...
Hyper(::hyper::Error), Serde(::serde_json::Error), Error(Box<error::Error>) } impl error::Error for Error { fn description(&self) -> &str { match *self { Error::Hyper(ref hyper) => hyper.description(), Error::Serde(ref serde) => serde.d...
pub enum Error {
random_line_split
lib.rs
#![feature(box_syntax)] #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate hyper; pub mod dictionaries; pub mod thesaureses; pub use dictionaries::{Definition, Dictionary}; pub use thesaureses::Thesaurus; mod error { use std::error; use std::error::Error as ErrorT; use std::fmt; ...
} } pub use error::Error; pub type Result<T> = std::result::Result<T, Error>;
{ Error::Error(Box::new(val)) }
identifier_body
filter.service.ts
// import { Injectable } from '@angular/core'; // import { propertyResolver } from '../../core/services/property-resolver'; // @Injectable() // export class FilterService { // constructor() { } // filter<T>(items: T[], data: string, props: string[]) { // return items.filter((item: T) => { // ...
// return match; // }); // } // }
// } // };
random_line_split
parametric_polymorphism.rs
// http://rosettacode.org/wiki/Parametric_polymorphism struct TreeNode<T> { value: T, left: Option<Box<TreeNode<T>>>, right: Option<Box<TreeNode<T>>>, } impl<T> TreeNode<T> { fn my_map<U, F>(&self, f: &F) -> TreeNode<U> where F: Fn(&T) -> U
} fn main() { let root = TreeNode { value: 3, left: Some(Box::new(TreeNode { value: 55, left: None, right: None, })), right: Some(Box::new(TreeNode { value: 234, left: Some(Box::new(TreeNode { value: 0, ...
{ TreeNode { value: f(&self.value), left: match self.left { None => None, Some(ref n) => Some(Box::new(n.my_map(f))), }, right: match self.right { None => None, Some(ref n) => Some(Box::new(n.my_map(f...
identifier_body
parametric_polymorphism.rs
// http://rosettacode.org/wiki/Parametric_polymorphism struct TreeNode<T> { value: T, left: Option<Box<TreeNode<T>>>, right: Option<Box<TreeNode<T>>>, } impl<T> TreeNode<T> { fn my_map<U, F>(&self, f: &F) -> TreeNode<U> where F: Fn(&T) -> U { TreeNode { value: f(&self.v...
left: None, right: None, })), right: Some(Box::new(TreeNode { value: 234, left: Some(Box::new(TreeNode { value: 0, left: None, right: None, })), right: None, })), }; ro...
left: Some(Box::new(TreeNode { value: 55,
random_line_split
parametric_polymorphism.rs
// http://rosettacode.org/wiki/Parametric_polymorphism struct TreeNode<T> { value: T, left: Option<Box<TreeNode<T>>>, right: Option<Box<TreeNode<T>>>, } impl<T> TreeNode<T> { fn my_map<U, F>(&self, f: &F) -> TreeNode<U> where F: Fn(&T) -> U { TreeNode { value: f(&self.v...
() { let root = TreeNode { value: 3, left: Some(Box::new(TreeNode { value: 55, left: None, right: None, })), right: Some(Box::new(TreeNode { value: 234, left: Some(Box::new(TreeNode { value: 0, ...
main
identifier_name
cmumps2fhir-demographics-mocha.js
// cmumps2fhir-demographics-mocha.js var chai = require('chai'); var expect = chai.expect; var should = chai.should(); var sinon = require('sinon'); var _ = require('underscore'); var fs = require('fs'); var test = require('./common-test'); var compFactory = require('../components/cmumps2fhir-demographics'); var ...
}); });
throw Error(fail); }); }); });
random_line_split
user-view.js
var init = require('../base/init'); var error = require('../base/error'); var expb = require('../express/express-base'); var userb = require('../user/user-base'); expb.core.get('/api/users/:id([0-9]+)', function (req, res, done) { var id = parseInt(req.params.id) || 0; var user = res.locals.user userb.getCached(...
cdate: _tuser.cdate.getTime(), adate: _tuser.adate.getTime(), profile: _tuser.profile }; } else { tuser = { _id: _tuser._id, name: _tuser.name, home: _tuser.home, //email: _tuser.email, status: _tuser.status, cdate: _tuser.cdate.get...
home: _tuser.home, email: _tuser.email, status: _tuser.status,
random_line_split
user-view.js
var init = require('../base/init'); var error = require('../base/error'); var expb = require('../express/express-base'); var userb = require('../user/user-base'); expb.core.get('/api/users/:id([0-9]+)', function (req, res, done) { var id = parseInt(req.params.id) || 0; var user = res.locals.user userb.getCached(...
else { tuser = { _id: _tuser._id, name: _tuser.name, home: _tuser.home, //email: _tuser.email, status: _tuser.status, cdate: _tuser.cdate.getTime(), //adate: _tuser.adate.getTime(), profile: _tuser.profile }; } res.json({ user: t...
{ tuser = { _id: _tuser._id, name: _tuser.name, home: _tuser.home, email: _tuser.email, status: _tuser.status, cdate: _tuser.cdate.getTime(), adate: _tuser.adate.getTime(), profile: _tuser.profile }; }
conditional_block
vat_number_check.js
/* jshint jquery: true, strict: false */ /* global klass: false, jQuery: false */ var VatNumberCheckObject = { /** * A css class selector to trigger `check` logic. * * @type {string} */ elementSelector: '', /** * An url to use for checking. * * @type {string} */ checkUrl: '', /** * An object...
else { if (result.vatNumber.length === 0) { this._setBackground(element); } else { this._setBackground(element, this.checkImages.failure); } } element.val(result.vatNumber); }, /** * A request handler for `fail`. * * @access protected * @param {Object} element A DOM element */ _fail...
{ this._setBackground(element, this.checkImages.ok); }
conditional_block
vat_number_check.js
/* jshint jquery: true, strict: false */ /* global klass: false, jQuery: false */ var VatNumberCheckObject = { /** * A css class selector to trigger `check` logic. * * @type {string} */ elementSelector: '', /** * An url to use for checking. * * @type {string} */ checkUrl: '', /** * An object...
} }; var VatNumberCheck = klass(VatNumberCheckObject);
backgroundImage: backgroundImage, backgroundRepeat: 'no-repeat', backgroundPosition: 'right' });
random_line_split
getParameterName.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash); function
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (identifierNode, context) { if (_lodash2.default.has(identifierNode, 'name')) { return identifierNode.name; } if (_lodash2.default.has(identifierNode, 'left.name')) { return identifierNode.left.name; } if (_...
_interopRequireDefault
identifier_name
getParameterName.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (identifierNode, context) { if...
return context.getSourceCode().getFirstToken(identifierNode, tokenIndex).value; } if (identifierNode.type === 'ObjectTypeIndexer') { var _tokenIndex = void 0; _tokenIndex = 0; if (identifierNode.static) { _tokenIndex++; } if (identifierNode.variance) { _tokenIndex++; } ...
{ tokenIndex++; }
conditional_block
getParameterName.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj)
exports.default = function (identifierNode, context) { if (_lodash2.default.has(identifierNode, 'name')) { return identifierNode.name; } if (_lodash2.default.has(identifierNode, 'left.name')) { return identifierNode.left.name; } if (_lodash2.default.has(identifierNode, 'key.name')) { return id...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
getParameterName.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (identifierNode, context) { if...
if (_lodash2.default.get(identifierNode, 'left.type') === 'ObjectPattern') { return context.getSourceCode().getText(identifierNode.left); } return null; }; module.exports = exports.default;
random_line_split
form-field-control.ts
import { NgControl } from '@angular/forms'; import { Observable } from 'rxjs'; /** An interface which allows a control to work inside of a `MсFormField`. */ // tslint:disable-next-line:naming-convention export abstract class McFormFieldControl<T> { /** The value of the control. */ value: T | null; /** ...
/** Gets the NgControl for this control. */ readonly ngControl: NgControl | null; /** Whether the control is focused. */ readonly focused: boolean; /** Whether the control is empty. */ readonly empty: boolean; /** Whether the control is required. */ readonly required: boolean; /...
readonly id: string; /** The placeholder for this control. */ readonly placeholder: string;
random_line_split
async.d.ts
// tslint:disable:variable-name Describing an API that's defined elsewhere. /** * Async interface wrapper around `setTimeout`. */ declare namespace timeOut {
* @returns An async timeout interface */ function after(delay?: number): AsyncInterface; /** * Enqueues a function called in the next task. * * @returns Handle used for canceling task */ function run(fn: Function, delay?: number): number; /** * Cancels a previously enqueued `timeOut` ca...
/** * Returns a sub-module with the async interface providing the provided * delay. *
random_line_split
wrapping_from.rs
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::conversion::traits::{OverflowingFrom, WrappingFrom}; use malachite_base_test_util::generators::{signed_gen, unsigned_ge...
test_double(0u8, 0u16); test_double(1000u16, 1000i32); test_double(-5i16, -5i8); test_double(255u8, 255u64); test_double(-1i8, u32::MAX); test_double(u32::MAX, u16::MAX); test_double(i32::MIN, 0x80000000u32); test_double(i32::MIN, 0u16); test_double(i32::MIN, 0i16); test_double...
{ assert_eq!(U::wrapping_from(n_in), n_out); }
identifier_body
wrapping_from.rs
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::conversion::traits::{OverflowingFrom, WrappingFrom}; use malachite_base_test_util::generators::{signed_gen, unsigned_ge...
< T: OverflowingFrom<U> + WrappingFrom<U> + PrimitiveInt, U: PrimitiveSigned, >() { signed_gen::<U>().test_properties(|i| { let result = T::wrapping_from(i); assert_eq!(result, T::overflowing_from(i).0) }); } #[test] fn wrapping_from_properties() { apply_fn_to_primitive_ints_and_uns...
wrapping_from_helper_primitive_int_signed
identifier_name
wrapping_from.rs
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::conversion::traits::{OverflowingFrom, WrappingFrom}; use malachite_base_test_util::generators::{signed_gen, unsigned_ge...
fn wrapping_from_helper_primitive_int_unsigned< T: OverflowingFrom<U> + WrappingFrom<U> + PrimitiveInt, U: PrimitiveUnsigned, >() { unsigned_gen::<U>().test_properties(|u| { let result = T::wrapping_from(u); assert_eq!(result, T::overflowing_from(u).0) }); } fn wrapping_from_helper_pri...
random_line_split
multiple-ref-self.rs
// check-pass #![feature(arbitrary_self_types)] #![allow(non_snake_case)] use std::marker::PhantomData; use std::ops::Deref; use std::pin::Pin; struct Struct { } struct Wrap<T, P>(T, PhantomData<P>); impl<T, P> Deref for Wrap<T, P> { type Target = T; fn deref(&self) -> &T { &self.0 } } impl Struct { /...
() { }
main
identifier_name
multiple-ref-self.rs
// check-pass #![feature(arbitrary_self_types)] #![allow(non_snake_case)] use std::marker::PhantomData; use std::ops::Deref; use std::pin::Pin; struct Struct { } struct Wrap<T, P>(T, PhantomData<P>); impl<T, P> Deref for Wrap<T, P> { type Target = T; fn deref(&self) -> &T { &self.0 } } impl Struct { /...
{ }
identifier_body
multiple-ref-self.rs
// check-pass #![feature(arbitrary_self_types)]
use std::marker::PhantomData; use std::ops::Deref; use std::pin::Pin; struct Struct { } struct Wrap<T, P>(T, PhantomData<P>); impl<T, P> Deref for Wrap<T, P> { type Target = T; fn deref(&self) -> &T { &self.0 } } impl Struct { // Test using multiple `&Self`: fn wrap_ref_Self_ref_Self(self: Wrap<&S...
#![allow(non_snake_case)]
random_line_split
coherence-overlap-messages.rs
// Copyright 2015 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 ...
() {}
main
identifier_name
coherence-overlap-messages.rs
// Copyright 2015 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<T> Bar for (T, u8) {} impl<T> Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: trait Baz<T> { fn baz() {} } impl<T> Baz<u8> for T {} impl<T> Baz<T> for u8 {} //~ ERROR conflicting implementations of trait `Baz<u8>` for type `u8`: trait Quux<U, V> { fn quux() {} } ...
{}
identifier_body
coherence-overlap-messages.rs
// Copyright 2015 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 ...
trait Bar { fn bar() {} } impl<T> Bar for (T, u8) {} impl<T> Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: trait Baz<T> { fn baz() {} } impl<T> Baz<u8> for T {} impl<T> Baz<T> for u8 {} //~ ERROR conflicting implementations of trait `Baz<u8>` for type `u8`: trait Quux<...
impl<U> Foo for U {} //~ ERROR conflicting implementations of trait `Foo`:
random_line_split
git.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-stamp: <2019-11-06 15:23:39 vk> import logging import os import sys import time from orgformat import OrgFormat from memacs.lib.memacs import Memacs from memacs.lib.orgproperty import OrgProperties class Commit(object): """ class for representing one co...
# now go through the file # Logic (see example commit below) # first we are in an header and not in an body # every newline toggles output # if we are in body then add the body to commit class # if we are in header then add the header to commit class # #...
logging.debug("using sys.stdin as input_stream") input_stream = sys.stdin
conditional_block
git.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-stamp: <2019-11-06 15:23:39 vk> import logging import os import sys import time from orgformat import OrgFormat from memacs.lib.memacs import Memacs from memacs.lib.orgproperty import OrgProperties class Commit(object): """ class for representing one co...
(self): """ @return: True - empty commit False - not empty commit """ return self.__empty def get_output(self): """ @return tuple: output,properties,body for Orgwriter.write_sub_item() """ output = self.__author + ": " + self.__subje...
is_empty
identifier_name
git.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-stamp: <2019-11-06 15:23:39 vk> import logging import os import sys import time from orgformat import OrgFormat from memacs.lib.memacs import Memacs from memacs.lib.orgproperty import OrgProperties class Commit(object): """ class for representing one co...
add additional arguments """ Memacs._parser_add_arguments(self) self._parser.add_argument( "-f", "--file", dest="gitrevfile", action="store", help="path to a an file which contains output from " + \ " following git command: git rev-list --all...
class GitMemacs(Memacs): def _parser_add_arguments(self): """ overwritten method of class Memacs
random_line_split
git.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Time-stamp: <2019-11-06 15:23:39 vk> import logging import os import sys import time from orgformat import OrgFormat from memacs.lib.memacs import Memacs from memacs.lib.orgproperty import OrgProperties class Commit(object): """ class for representing one co...
"-e", "--encoding", dest="encoding", action="store", help="default encoding utf-8, see " + \ "http://docs.python.org/library/codecs.html#standard-encodings" + \ "for possible encodings") def _parser_parse_args(self): """ overwritten method of ...
""" overwritten method of class Memacs add additional arguments """ Memacs._parser_add_arguments(self) self._parser.add_argument( "-f", "--file", dest="gitrevfile", action="store", help="path to a an file which contains output from " + \ ...
identifier_body
extension.py
# -*- coding: utf-8 -*- #Copyright (C) Fiz Vazquez vud1@sindominio.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #T...
(self, pathExtension): logging.debug('>>') info = XMLParser(pathExtension+"/conf.xml") #import extension extension_dir = os.path.realpath(pathExtension) extension_filename = info.getValue("pytrainer-extension","executable") extension_classname = info.getValue("pytrainer-extension","extensioncode") exte...
importClass
identifier_name
extension.py
# -*- coding: utf-8 -*- #Copyright (C) Fiz Vazquez vud1@sindominio.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #T...
def getExtensionInfo(self,pathExtension): info = XMLParser(pathExtension+"/conf.xml") name = info.getValue("pytrainer-extension","name") description = info.getValue("pytrainer-extension","description") code = info.getValue("pytrainer-extension","extensioncode") extensiondir = self.pytrainer_main.profile.e...
extensiondir = self.data_path+"/extensions" extensionList = [] for extension in os.listdir(extensiondir): extensionxmlfile = extensiondir+"/"+extension+"/conf.xml" if os.path.isfile(extensionxmlfile): extensioninfo = XMLParser(extensionxmlfile) name = extensioninfo.getValue("pytrainer-extension","name...
identifier_body
extension.py
# -*- coding: utf-8 -*- #Copyright (C) Fiz Vazquez vud1@sindominio.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #T...
def getActiveExtensions(self): retorno = [] for extension in self.getExtensionList(): if self.getExtensionInfo(extension[0])[2] == "1": retorno.append(extension[0]) return retorno def manageExtensions(self): ExtensionList = self.getExtensionList() windowextension = WindowExtensions(self.data_pat...
self.pytrainer_main = parent
random_line_split
extension.py
# -*- coding: utf-8 -*- #Copyright (C) Fiz Vazquez vud1@sindominio.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #T...
return retorno def manageExtensions(self): ExtensionList = self.getExtensionList() windowextension = WindowExtensions(self.data_path, self) windowextension.setList(ExtensionList) windowextension.run() def getExtensionList(self): extensiondir = self.data_path+"/extensions" extensionList = [] for e...
if self.getExtensionInfo(extension[0])[2] == "1": retorno.append(extension[0])
conditional_block
lev_distance.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(me: &str, t: &str) -> uint { if me.is_empty() { return t.chars().count(); } if t.is_empty() { return me.chars().count(); } let mut dcol: Vec<_> = range(0, t.len() + 1).collect(); let mut t_last = 0; for (i, sc) in me.chars().enumerate() { let mut current = i; dcol[0] = current + ...
lev_distance
identifier_name
lev_distance.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
if t.is_empty() { return me.chars().count(); } let mut dcol: Vec<_> = range(0, t.len() + 1).collect(); let mut t_last = 0; for (i, sc) in me.chars().enumerate() { let mut current = i; dcol[0] = current + 1; for (j, tc) in t.chars().enumerate() { let next = dcol[...
{ return t.chars().count(); }
conditional_block
lev_distance.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} dcol[t_last + 1] } #[test] fn test_lev_distance() { use std::char::{ from_u32, MAX }; // Test bytelength agnosticity for c in range(0u32, MAX as u32) .filter_map(|i| from_u32(i)) .map(|i| i.to_string()) { assert_eq!(lev_distance(&c[], &c[]), 0); } let a...
random_line_split
lev_distance.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
dcol[j + 1] = cmp::min(dcol[j + 1], dcol[j]) + 1; } current = next; t_last = j; } } dcol[t_last + 1] } #[test] fn test_lev_distance() { use std::char::{ from_u32, MAX }; // Test bytelength agnosticity for c in range(0u32, MAX as u32) ...
{ if me.is_empty() { return t.chars().count(); } if t.is_empty() { return me.chars().count(); } let mut dcol: Vec<_> = range(0, t.len() + 1).collect(); let mut t_last = 0; for (i, sc) in me.chars().enumerate() { let mut current = i; dcol[0] = current + 1; for (j, tc) in t...
identifier_body
FavoriteModel.js
sap.ui.define([ "sap/ui/demo/iconexplorer/model/Sorter", "sap/ui/model/json/JSONModel", "sap/ui/util/Storage", "sap/base/Log" ], function(Sorter, JSONModel, Storage, Log) { "use strict"; return JSONModel.extend("sap.ui.demo.iconexplorer.model.FavoriteModel", { _STORAGE_KEY : "ICON_EXPLORER_FAVORITES", _stor...
oData.count = oData.icons.length; // sort icons by name oData.icons.sort(Sorter.sortByName); // update model this.setData(oData); // update local storage var sJSON = JSON.stringify(oData); this._storage.put(this._STORAGE_KEY, sJSON); return !bFavorite; } }); });
{ oData.icons.push(oBindingContext.getObject()); }
conditional_block
FavoriteModel.js
sap.ui.define([ "sap/ui/demo/iconexplorer/model/Sorter", "sap/ui/model/json/JSONModel", "sap/ui/util/Storage", "sap/base/Log" ], function(Sorter, JSONModel, Storage, Log) { "use strict"; return JSONModel.extend("sap.ui.demo.iconexplorer.model.FavoriteModel", { _STORAGE_KEY : "ICON_EXPLORER_FAVORITES", _stor...
} // set data this.setData(oData); return this; }, /** * Checks if a given icon is a favorite * @param {string} sName the icon name * @return {boolean} the favorite state of the icon */ isFavorite : function(sName) { var oData = this.getData(); return oData.icons.some(function(oI...
oData = { count : 0, icons : [] };
random_line_split
TableChunker.js
/** * Produces optimized XTemplates for chunks of tables to be * used in grids, trees and other table based widgets. */ Ext.define('Ext.view.TableChunker', { singleton: true, requires: ['Ext.XTemplate'], metaTableTpl: [ '{%if (this.openTableWrap)out.push(this.openTableWrap())%}', '<table ...
return result + '"'; }, openRows: function() { return '<tpl for="rows">'; }, closeRows: function() { return '</tpl>'; }, metaRowTpl: [ '<tr class="' + Ext.baseCSSPrefix + 'grid-row {[this.embedRowCls()]}" {[this.embedRowAttr()]}>', '<tpl for="colum...
{ result += 'height:1px;'; }
conditional_block
TableChunker.js
/** * Produces optimized XTemplates for chunks of tables to be * used in grids, trees and other table based widgets. */ Ext.define('Ext.view.TableChunker', { singleton: true, requires: ['Ext.XTemplate'], metaTableTpl: [ '{%if (this.openTableWrap)out.push(this.openTableWrap())%}', '<table ...
metaRowTpl = featureCount ? Array.prototype.slice.call(me.metaRowTpl, 0) : me.metaRowTpl; for (; i < featureCount; i++) { if (!features[i].disabled) { features[i].mutateMetaRowTpl(metaRowTpl); Ext.apply(memberFns, features[i].getMetaRowTplFragments()); ...
}, // copy the template spec array if there are Features which might mutate it
random_line_split
data.js
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true, white:true */ /*global X:true, XT:true */ (function () { "use strict"; // All of the "big 4" routes are in here: commit, dispatch, fetch, and retrieve /...
else if (res && res.rows && res.rows.length > 0) { // the data comes back in an awkward res.rows[0].dispatch form, // and we want to normalize that here so that the data is in response.data callback({data: JSON.parse(res.rows[0][functionName])}); } else { callback({isErr...
{ callback({isError: true, error: err, message: err.message}); }
conditional_block
data.js
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true, white:true */ /*global X:true, XT:true */ (function () { "use strict"; // All of the "big 4" routes are in here: commit, dispatch, fetch, and retrieve /...
res.send(500, {data: err}); } else { res.send({data: resp}); } }; engineFunction(req.query, req.session, callback); }; /** Accesses the commitEngine (above) for a request a la Express */ exports.commit = function (req, res) { routeAdapter(req, res, commitEngine); ...
so we centralize the code here: */ var routeAdapter = function (req, res, engineFunction) { var callback = function (err, resp) { if (err) {
random_line_split
diagnostics.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(what: string, fn: Function): (...args: any[]) => void { if (true) { return () => { // Intentional empty, disable for now because it is leaking memory }; } // register switch var flag = switches[what] || false; switches[what] = flag; // register function var tracers = map[what] || []; tracers.push(fn)...
register
identifier_name
diagnostics.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
var backInTime = allArgs.length > 1; var doIt:()=>void = function() { var thisArguments = allArgs.shift(); fn.apply(fn, thisArguments); if(allArgs.length > 0) { Platform.setTimeout(doIt, 500); } }; doIt(); } else { // know where to store idx = data.indexOf(fn); idx = idx !...
{ allArgs.unshift.apply(allArgs, data[idx + 1] || []); data[idx + 1] = []; }
conditional_block
diagnostics.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
function fifo(array:any[], size:number) { while(array.length > size) { array.shift(); } } export function register(what: string, fn: Function): (...args: any[]) => void { if (true) { return () => { // Intentional empty, disable for now because it is leaking memory }; } // register switch var flag = sw...
var map = {}; var data = [];
random_line_split