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
RootItem.js
import React from 'react'; import PropTypes from 'prop-types'; import style from 'PVWStyle/ReactWidgets/CompositePipelineWidget.mcss'; import ChildItem from './ChildItem'; /** * This React component expect the following input properties: * - model: * Expect a LokkupTable instance that you want to render a...
updateColorBy(event) { this.props.model.setActiveColor( this.props.layer, event.target.dataset.color ); this.toggleDropDown(); } toggleEditMode() { this.props.model.toggleEditMode(this.props.layer); } updateOpacity(e) { this.props.model.setOpacity(this.props.layer, e.target...
{ if (this.props.model.getColor(this.props.layer).length > 1) { this.setState({ dropDown: !this.state.dropDown, }); } }
identifier_body
svh-a-change-type-arg.rs
// Copyright 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-MIT or ...
4 }
random_line_split
svh-a-change-type-arg.rs
// Copyright 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-MIT or ...
{ 4 }
identifier_body
svh-a-change-type-arg.rs
// Copyright 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-MIT or ...
<T:U>(_: i32) -> int { 3 } pub fn an_unused_name() -> int { 4 }
foo
identifier_name
radec-conv.py
#!/usr/bin/env python import sys, math if len(sys.argv) != 3:
ra = sys.argv[1] dec = sys.argv[2] rai = ra.split(":") deci = dec.split(":") radeg = float(rai[0]) * 15.0 + float(rai[1]) * (1.0 / 60.0) + float(rai[2]) * (1.0 / 3600) decdeg = float(deci[0]) + float(deci[1]) * (1.0 / 60.0) + float(deci[2]) * (1.0 / 3600.0) print("RA,DEC: %f,%f deg" % (radeg, decdeg))
print("Usage:") print("%s [RA HH:MM:SS] [DEC Deg:Arcmin:Arcsec] " % sys.argv[0]) exit(0)
conditional_block
radec-conv.py
#!/usr/bin/env python import sys, math
print("%s [RA HH:MM:SS] [DEC Deg:Arcmin:Arcsec] " % sys.argv[0]) exit(0) ra = sys.argv[1] dec = sys.argv[2] rai = ra.split(":") deci = dec.split(":") radeg = float(rai[0]) * 15.0 + float(rai[1]) * (1.0 / 60.0) + float(rai[2]) * (1.0 / 3600) decdeg = float(deci[0]) + float(deci[1]) * (1.0 / 60.0) + float(deci...
if len(sys.argv) != 3: print("Usage:")
random_line_split
PositionalAudio.js
/** * @author mrdoob / http://mrdoob.com/ */ import { Vector3 } from '../math/Vector3.js'; import { Quaternion } from '../math/Quaternion.js'; import { Audio } from './Audio.js'; import { Object3D } from '../core/Object3D.js'; const _position = new Vector3(); const _quaternion = new Quaternion(); const _scale = new...
return this; }, getDistanceModel: function () { return this.panner.distanceModel; }, setDistanceModel: function ( value ) { this.panner.distanceModel = value; return this; }, getMaxDistance: function () { return this.panner.maxDistance; }, setMaxDistance: function ( value ) { this.panne...
setRolloffFactor: function ( value ) { this.panner.rolloffFactor = value;
random_line_split
PositionalAudio.js
/** * @author mrdoob / http://mrdoob.com/ */ import { Vector3 } from '../math/Vector3.js'; import { Quaternion } from '../math/Quaternion.js'; import { Audio } from './Audio.js'; import { Object3D } from '../core/Object3D.js'; const _position = new Vector3(); const _quaternion = new Quaternion(); const _scale = new...
PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), { constructor: PositionalAudio, getOutput: function () { return this.panner; }, getRefDistance: function () { return this.panner.refDistance; }, setRefDistance: function ( value ) { this.panner.refDistance = value; re...
{ Audio.call( this, listener ); this.panner = this.context.createPanner(); this.panner.panningModel = 'HRTF'; this.panner.connect( this.gain ); }
identifier_body
PositionalAudio.js
/** * @author mrdoob / http://mrdoob.com/ */ import { Vector3 } from '../math/Vector3.js'; import { Quaternion } from '../math/Quaternion.js'; import { Audio } from './Audio.js'; import { Object3D } from '../core/Object3D.js'; const _position = new Vector3(); const _quaternion = new Quaternion(); const _scale = new...
( listener ) { Audio.call( this, listener ); this.panner = this.context.createPanner(); this.panner.panningModel = 'HRTF'; this.panner.connect( this.gain ); } PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), { constructor: PositionalAudio, getOutput: function () { return this....
PositionalAudio
identifier_name
PositionalAudio.js
/** * @author mrdoob / http://mrdoob.com/ */ import { Vector3 } from '../math/Vector3.js'; import { Quaternion } from '../math/Quaternion.js'; import { Audio } from './Audio.js'; import { Object3D } from '../core/Object3D.js'; const _position = new Vector3(); const _quaternion = new Quaternion(); const _scale = new...
else { panner.setPosition( _position.x, _position.y, _position.z ); panner.setOrientation( _orientation.x, _orientation.y, _orientation.z ); } } } ); export { PositionalAudio };
{ // code path for Chrome and Firefox (see #14393) const endTime = this.context.currentTime + this.listener.timeDelta; panner.positionX.linearRampToValueAtTime( _position.x, endTime ); panner.positionY.linearRampToValueAtTime( _position.y, endTime ); panner.positionZ.linearRampToValueAtTime( _position...
conditional_block
test_Read.py
#!/usr/bin/python """test_Read.py to test the Read class. Requires: python 2 (https://www.python.org/downloads/) nose 1.3 (https://nose.readthedocs.org/en/latest/) Joy-El R.B. Talbot Copyright (c) 2014 The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this...
def check_parse_sam_bitwise_flag(test, (values, expected)): bitwise_result = Read.parse_sam_bitwise_flag(*values) test_description = "\nTest: \t{}\n".format(test) test_description += "Expected:\t{}\n".format(expected) test_description += "Position:\t{}\n".format(bitwise_result) assert bitwise_...
for test in bitwise_flag: yield (check_parse_sam_bitwise_flag, test, bitwise_flag[test])
identifier_body
test_Read.py
#!/usr/bin/python """test_Read.py to test the Read class. Requires: python 2 (https://www.python.org/downloads/) nose 1.3 (https://nose.readthedocs.org/en/latest/) Joy-El R.B. Talbot Copyright (c) 2014 The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this...
@raises(MetageneError) def check_catch_bad_bitwise_input(test, (values, expected)): print Read.parse_sam_bitwise_flag(*values) def build_samline(bitcode, chromosome, start, cigar, length, abundance, mappings): """Return a SAM format line""" string = "a" * length return "read\t{}\t{}\t{}\t255\t{}\t*...
yield (check_catch_bad_bitwise_input, test, bad_bitwise_flag[test])
conditional_block
test_Read.py
#!/usr/bin/python
Joy-El R.B. Talbot Copyright (c) 2014 The MIT License (MIT) 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, mer...
"""test_Read.py to test the Read class. Requires: python 2 (https://www.python.org/downloads/) nose 1.3 (https://nose.readthedocs.org/en/latest/)
random_line_split
test_Read.py
#!/usr/bin/python """test_Read.py to test the Read class. Requires: python 2 (https://www.python.org/downloads/) nose 1.3 (https://nose.readthedocs.org/en/latest/) Joy-El R.B. Talbot Copyright (c) 2014 The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this...
(bitcode, chromosome, start, cigar, length, abundance, mappings): """Return a SAM format line""" string = "a" * length return "read\t{}\t{}\t{}\t255\t{}\t*\t0\t0\t{}\t{}\tNH:i:{}\tNA:i:{}".format( bitcode, chromosome, start, cigar, string, string, mapp...
build_samline
identifier_name
bool.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from ..._input_field import InputField class BoolInput(InputField): """Simple input that controls a boolean variab...
else: raise ValueError(f"String '{val}' is not understood by {self.__class__.__name__}") elif not isinstance(val, bool): self._raise_type_error(val) return val
val = False
conditional_block
bool.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from ..._input_field import InputField class BoolInput(InputField): """Simple input that controls a boolean variab...
pass elif isinstance(val, str): val = val.lower() if val in self._true_strings: val = True elif val in self._false_strings: val = False else: raise ValueError(f"String '{val}' is not understood by {self._...
def parse(self, val): if val is None:
random_line_split
bool.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from ..._input_field import InputField class
(InputField): """Simple input that controls a boolean variable. GUI indications ---------------- It can be implemented as a switch or a checkbox, for example. """ _false_strings = ("f", "false") _true_strings = ("t", "true") dtype = bool _type = 'bool' _default = {} def ...
BoolInput
identifier_name
bool.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from ..._input_field import InputField class BoolInput(InputField):
"""Simple input that controls a boolean variable. GUI indications ---------------- It can be implemented as a switch or a checkbox, for example. """ _false_strings = ("f", "false") _true_strings = ("t", "true") dtype = bool _type = 'bool' _default = {} def parse(self, val): ...
identifier_body
index.test.ts
/** * Created by cshao on 2021-02-19. */
const ESSerializer = require('../src/index'); import ClassA from './env/ClassA'; import ClassB from './env/ClassB'; import ClassC from './env/ClassC'; import MyObject from './env/MyObject'; import Person from './env/Person'; describe('Test serialize', () => { test('can serialize all fields of object', () => { c...
'use strict'; import SuperClassA from './env/SuperClassA';
random_line_split
architecture.py
# -*- encoding: utf-8 -*- """Implements Architecture UI""" from robottelo.constants import FILTER from robottelo.ui.base import Base from robottelo.ui.locators import common_locators, locators from robottelo.ui.navigator import Navigator class Architecture(Base): """Manipulates architecture from UI""" def n...
(self): """Specify locator for Architecture entity search procedure""" return locators['arch.arch_name'] def create(self, name, os_names=None): """Creates new architecture from UI with existing OS""" self.click(locators['arch.new']) self.assign_value(locators['arch.name'], n...
_search_locator
identifier_name
architecture.py
# -*- encoding: utf-8 -*- """Implements Architecture UI""" from robottelo.constants import FILTER from robottelo.ui.base import Base from robottelo.ui.locators import common_locators, locators from robottelo.ui.navigator import Navigator class Architecture(Base): """Manipulates architecture from UI""" def n...
return locators['arch.arch_name'] def create(self, name, os_names=None): """Creates new architecture from UI with existing OS""" self.click(locators['arch.new']) self.assign_value(locators['arch.name'], name) self.configure_entity(os_names, FILTER['arch_os']) self.cl...
Navigator(self.browser).go_to_architectures() def _search_locator(self): """Specify locator for Architecture entity search procedure"""
random_line_split
architecture.py
# -*- encoding: utf-8 -*- """Implements Architecture UI""" from robottelo.constants import FILTER from robottelo.ui.base import Base from robottelo.ui.locators import common_locators, locators from robottelo.ui.navigator import Navigator class Architecture(Base): """Manipulates architecture from UI""" def n...
self.configure_entity( os_names, FILTER['arch_os'], new_entity_list=new_os_names ) self.click(common_locators['submit'])
self.assign_value(locators['arch.name'], new_name)
conditional_block
architecture.py
# -*- encoding: utf-8 -*- """Implements Architecture UI""" from robottelo.constants import FILTER from robottelo.ui.base import Base from robottelo.ui.locators import common_locators, locators from robottelo.ui.navigator import Navigator class Architecture(Base): """Manipulates architecture from UI""" def n...
def _search_locator(self): """Specify locator for Architecture entity search procedure""" return locators['arch.arch_name'] def create(self, name, os_names=None): """Creates new architecture from UI with existing OS""" self.click(locators['arch.new']) self.assign_value...
"""Navigate to Architecture entity page""" Navigator(self.browser).go_to_architectures()
identifier_body
clientListStore.js
import pagination from '@admin/store/modules/paginationStore' import {HTTP} from '@shared/config/api' const state = { clientList: [] } const getters = { getClientList: state => state.clientList } const mutations = { set(state, {type, value}) { state[type] = value }, delete(state, {id}) { ...
}) }, deleteMultipleClient({commit, dispatch}, clients) { HTTP.delete('api/Client', clients) .then(() => { commit('deleteMultiple', {ids: clients.params.ids}) dispatch('addToTotalItems', -clients.params.ids.length) }) .catch((error) => { ...
commit('delete', {id: client.params.id}) dispatch('addToTotalItems', -1) }) .catch((error) => { window.console.error(error)
random_line_split
clientListStore.js
import pagination from '@admin/store/modules/paginationStore' import {HTTP} from '@shared/config/api' const state = { clientList: [] } const getters = { getClientList: state => state.clientList } const mutations = { set(state, {type, value}) { state[type] = value }, delete(state, {id}) { ...
} export default { namespaced: true, state, mutations, actions, getters, modules: { Pagination: pagination() } }
{ HTTP.delete('api/Client', clients) .then(() => { commit('deleteMultiple', {ids: clients.params.ids}) dispatch('addToTotalItems', -clients.params.ids.length) }) .catch((error) => { window.console.error(error) }) }
identifier_body
clientListStore.js
import pagination from '@admin/store/modules/paginationStore' import {HTTP} from '@shared/config/api' const state = { clientList: [] } const getters = { getClientList: state => state.clientList } const mutations = { set(state, {type, value}) { state[type] = value }, delete(state, {id}) { ...
} } const actions = { getClients({commit, dispatch, getters}) { HTTP.get('api/Client', {params: getters.getParams}) .then((response) => { commit('set', { type: 'clientList', value: response.data.Items }) dispatch('setTotalItem...
{ state.clientList[index].Title = client.Title state.clientList[index].Email = client.Email state.clientList[index].Phone = client.Phone state.clientList[index].Note = client.Note }
conditional_block
clientListStore.js
import pagination from '@admin/store/modules/paginationStore' import {HTTP} from '@shared/config/api' const state = { clientList: [] } const getters = { getClientList: state => state.clientList } const mutations = { set(state, {type, value}) { state[type] = value }, delete(state, {id}) { ...
({commit, dispatch}, clients) { HTTP.delete('api/Client', clients) .then(() => { commit('deleteMultiple', {ids: clients.params.ids}) dispatch('addToTotalItems', -clients.params.ids.length) }) .catch((error) => { window.console.error(error) }) ...
deleteMultipleClient
identifier_name
input.pp.rs
// Copyright 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-MIT or ...
fn y /* 61#0 */() { }
{ let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ }
identifier_body
input.pp.rs
// Copyright 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-MIT or ...
// minimal junk #![feature(no_core)] #![no_core] macro_rules! foo /* 60#0 */(( $ x : ident ) => { y + $ x }); fn bar /* 62#0 */() { let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ } fn y /* 61#0 */() { }
// option. This file may not be copied, modified, or distributed // except according to those terms.
random_line_split
input.pp.rs
// Copyright 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-MIT or ...
/* 62#0 */() { let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ } fn y /* 61#0 */() { }
bar
identifier_name
rec.rs
use super::Fibonacci; pub struct
; impl Fibonacci for &Recursive { fn fib(self, n: u64) -> u64 { if n == 0 || n == 1 { 1 } else { self.fib(n - 1) + self.fib(n - 2) } } } #[cfg(test)] mod tests { use super::super::Fibonacci; use super::Recursive; macro_rules! fib_test { ($na...
Recursive
identifier_name
rec.rs
use super::Fibonacci; pub struct Recursive; impl Fibonacci for &Recursive { fn fib(self, n: u64) -> u64 { if n == 0 || n == 1 { 1 } else { self.fib(n - 1) + self.fib(n - 2) } } } #[cfg(test)] mod tests { use super::super::Fibonacci; use super::Recursive...
fib_test!(two, 2, 2); fib_test!(three, 3, 3); }
fib_test!(zero, 0, 1); fib_test!(one, 1, 1);
random_line_split
rec.rs
use super::Fibonacci; pub struct Recursive; impl Fibonacci for &Recursive { fn fib(self, n: u64) -> u64 { if n == 0 || n == 1
else { self.fib(n - 1) + self.fib(n - 2) } } } #[cfg(test)] mod tests { use super::super::Fibonacci; use super::Recursive; macro_rules! fib_test { ($name:ident, $($i:expr, $e:expr),+) => { #[test] fn $name() { let r = Recursive; ...
{ 1 }
conditional_block
InputHandler.js
function InputHandler(viewport) { var self = this; self.pressedKeys = {}; self.mouseX = 0; self.mouseY = 0; self.mouseDownX = 0; self.mouseDownY = 0; self.mouseMoved = false; self.mouseDown = false; self.mouseButton = 0; // 1 = left | 2 = middle | 3 = right self.viewport = viewp...
var screenSpace = this.convertToScreenSpace(mouseX, mouseY); this.target.onMouseMove(screenSpace[0], screenSpace[1], mouseMoveX, mouseMoveY, this.mouseButton); }; InputHandler.prototype.onScroll = function(event) { this.target.onScroll(event.deltaY); };
this.mouseY = mouseY;
random_line_split
InputHandler.js
function
(viewport) { var self = this; self.pressedKeys = {}; self.mouseX = 0; self.mouseY = 0; self.mouseDownX = 0; self.mouseDownY = 0; self.mouseMoved = false; self.mouseDown = false; self.mouseButton = 0; // 1 = left | 2 = middle | 3 = right self.viewport = viewport; var viewpor...
InputHandler
identifier_name
InputHandler.js
function InputHandler(viewport) { var self = this; self.pressedKeys = {}; self.mouseX = 0; self.mouseY = 0; self.mouseDownX = 0; self.mouseDownY = 0; self.mouseMoved = false; self.mouseDown = false; self.mouseButton = 0; // 1 = left | 2 = middle | 3 = right self.viewport = viewp...
if(this.mouseDown) { event.preventDefault(); } var mouseMoveX = mouseX - this.mouseX; var mouseMoveY = mouseY - this.mouseY; this.mouseX = mouseX; this.mouseY = mouseY; var screenSpace = this.convertToScreenSpace(mouseX, mouseY); this.target.onMouseMove(screenSpace[0], scre...
{ this.mouseMoved = true; }
conditional_block
InputHandler.js
function InputHandler(viewport)
InputHandler.prototype.update = function(event) { for(var key in this.pressedKeys) { this.target.onKeyDown(key); } }; InputHandler.prototype.onKeyUp = function(event) { delete this.pressedKeys[event.keyCode]; }; InputHandler.prototype.onKeyDown = function(event) { // Avoid capturing key eve...
{ var self = this; self.pressedKeys = {}; self.mouseX = 0; self.mouseY = 0; self.mouseDownX = 0; self.mouseDownY = 0; self.mouseMoved = false; self.mouseDown = false; self.mouseButton = 0; // 1 = left | 2 = middle | 3 = right self.viewport = viewport; var viewportElem = vie...
identifier_body
terminalService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} export class LinuxTerminalService implements ITerminalService { public _serviceBrand: any; private static readonly WAIT_MESSAGE = nls.localize('press.any.key', "Press any key to continue..."); constructor( @IConfigurationService private readonly _configurationService: IConfigurationService ) { } public op...
}); }
random_line_split
terminalService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(exec: string): WinSpawnType { const basename = path.basename(exec).toLowerCase(); if (basename === 'cmder' || basename === 'cmder.exe') { return WinSpawnType.CMDER; } return WinSpawnType.CMD; } } export class MacTerminalService implements ITerminalService { public _serviceBrand: any; private static rea...
getSpawnType
identifier_name
terminalService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
else { osaArgs.push('-e'); osaArgs.push(`${key}=${value}`); } } } let stderr = ''; const osa = cp.spawn(MacTerminalService.OSASCRIPT, osaArgs); osa.on('error', e); osa.stderr.on('data', (data) => { stderr += data.toString(); }); osa.on('exit', (code: number) =...
{ osaArgs.push('-u'); osaArgs.push(key); }
conditional_block
terminalService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} export class LinuxTerminalService implements ITerminalService { public _serviceBrand: any; private static readonly WAIT_MESSAGE = nls.localize('press.any.key', "Press any key to continue..."); constructor( @IConfigurationService private readonly _configurationService: IConfigurationService ) { } public o...
{ const terminalConfig = configuration.terminal.external; const terminalApp = terminalConfig.osxExec || DEFAULT_TERMINAL_OSX; return new TPromise<void>((c, e) => { const child = spawner.spawn('/usr/bin/open', ['-a', terminalApp, cwd]); child.on('error', e); child.on('exit', () => c(null)); }); }
identifier_body
catalog.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Floss } from '../models/floss'; import { DB } from '../models/db'; @Injectable() export class CatalogService { private flossUrl = 'app/floss'; // URL to web api constructor(private http: Http) { }
getFloss(id: number): Promise<Floss> { return this.getCatalog() .then(catalog => catalog.find(floss => floss.dmc === id)); } deleteFloss(floss: Floss, group : string): void { var my : Floss[] = this.load(group); if(!my){ my = []; } let newArr : Floss[] = my.filter(value => value.d...
getCatalog(): Promise<Floss[]> { return Promise.resolve(DB.db); }
random_line_split
catalog.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Floss } from '../models/floss'; import { DB } from '../models/db'; @Injectable() export class CatalogService { private flossUrl = 'app/floss'; // URL to web api constructor(private http: Http) { } g...
} return data; } }
{ return undefined; }
conditional_block
catalog.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Floss } from '../models/floss'; import { DB } from '../models/db'; @Injectable() export class CatalogService { private flossUrl = 'app/floss'; // URL to web api constructor(private http: Http) { } g...
store(name: string, data: any): void { let localData: any = localStorage.getItem('sara'); if (localData) { localData = JSON.parse(localData); } else { localData = {}; } localData[name] = data; localStorage.setItem('sara', JSON.stringify(localData)) } load(name: string): an...
{ var collection : Floss[] = this.load(group); if(!collection){ collection = []; } let found : Floss = collection.find(value => value.dmc === floss.dmc); return found ? true : false; }
identifier_body
catalog.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Floss } from '../models/floss'; import { DB } from '../models/db'; @Injectable() export class CatalogService { private flossUrl = 'app/floss'; // URL to web api constructor(private http: Http) { } g...
(id: number): Promise<Floss> { return this.getCatalog() .then(catalog => catalog.find(floss => floss.dmc === id)); } deleteFloss(floss: Floss, group : string): void { var my : Floss[] = this.load(group); if(!my){ my = []; } let newArr : Floss[] = my.filter(value => value.dmc != flos...
getFloss
identifier_name
ng_if.ts
* Removes or recreates a portion of the DOM tree based on an {expression}. * * If the expression assigned to `ng-if` evaluates to a false value then the element * is removed from the DOM, otherwise a clone of the element is reinserted into the DOM. * * # Example: * * ``` * <div *ng-if="errorCount > 0" class="e...
import {Directive} from 'angular2/annotations'; import {ViewContainerRef, TemplateRef} from 'angular2/core'; import {isBlank} from 'angular2/src/facade/lang'; /**
random_line_split
ng_if.ts
import {Directive} from 'angular2/annotations'; import {ViewContainerRef, TemplateRef} from 'angular2/core'; import {isBlank} from 'angular2/src/facade/lang'; /** * Removes or recreates a portion of the DOM tree based on an {expression}. * * If the expression assigned to `ng-if` evaluates to a false value then the ...
(viewContainer: ViewContainerRef, templateRef: TemplateRef) { this.viewContainer = viewContainer; this.prevCondition = null; this.templateRef = templateRef; } set ngIf(newCondition /* boolean */) { if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) { this.prevCondition ...
constructor
identifier_name
About.py
# -*- coding: utf-8 -*- import sys, os, time from Tools.HardwareInfo import HardwareInfo def getVersionString(): return getImageVersionString() def getImageVersionString(): try: if os.path.isfile('/var/lib/opkg/status'): st = os.stat('/var/lib/opkg/status') else: st = os.stat('/usr/lib/ipkg/status') tm ...
: import socket, fcntl, struct, array, sys is_64bits = sys.maxsize > 2**32 struct_size = 40 if is_64bits else 32 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) max_possible = 8 # initial value while True: _bytes = max_possible * struct_size names = array.array('B') for i in range(0, _bytes): names....
tIPsFromNetworkInterfaces()
identifier_name
About.py
# -*- coding: utf-8 -*- import sys, os, time from Tools.HardwareInfo import HardwareInfo def getVersionString(): return getImageVersionString() def getImageVersionString(): try: if os.path.isfile('/var/lib/opkg/status'): st = os.stat('/var/lib/opkg/status') else: st = os.stat('/usr/lib/ipkg/status') tm ...
else: break namestr = names.tostring() ifaces = [] for i in range(0, outbytes, struct_size): iface_name = bytes.decode(namestr[i:i+16]).split('\0', 1)[0].encode('ascii') if iface_name != 'lo': iface_addr = socket.inet_ntoa(namestr[i+20:i+24]) ifaces.append((iface_name, iface_addr)) return ifaces # Fo...
x_possible *= 2
conditional_block
About.py
# -*- coding: utf-8 -*- import sys, os, time from Tools.HardwareInfo import HardwareInfo def getVersionString(): return getImageVersionString() def getImageVersionString(): try: if os.path.isfile('/var/lib/opkg/status'): st = os.stat('/var/lib/opkg/status') else: st = os.stat('/usr/lib/ipkg/status') tm ...
def getImageTypeString(): try: return "Taapat based on " + open("/etc/issue").readlines()[-2].capitalize().strip()[:-6] except: return _("undefined") def getCPUInfoString(): try: cpu_count = 0 cpu_speed = 0 temperature = None for line in open("/proc/cpuinfo").readlines(): line = [x.strip() for x in...
return HardwareInfo().get_device_string()
identifier_body
About.py
# -*- coding: utf-8 -*- import sys, os, time from Tools.HardwareInfo import HardwareInfo def getVersionString(): return getImageVersionString() def getImageVersionString(): try: if os.path.isfile('/var/lib/opkg/status'): st = os.stat('/var/lib/opkg/status') else: st = os.stat('/usr/lib/ipkg/status') tm ...
return _("unknown") def getPythonVersionString(): try: import commands status, output = commands.getstatusoutput("python -V") return output.split(' ')[1] except: return _("unknown") def GetIPsFromNetworkInterfaces(): import socket, fcntl, struct, array, sys is_64bits = sys.maxsize > 2**32 struct_size =...
return "%s-%s-%s" % (driver[:4], driver[4:6], driver[6:]) except:
random_line_split
macro-pat.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...
mypat!() => 2, _ => 3, } } pub fn main() { assert_eq!(1u, f(Some('x'))); assert_eq!(2u, f(Some('y'))); assert_eq!(3u, f(None)); assert_eq!(1, match Some('x') { Some(char_x!()) => 1, _ => 2, }); assert_eq!(1, match Some('x') { some!(char_x!()) => 1, ...
Some('x') => 1,
random_line_split
macro-pat.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...
{ assert_eq!(1u, f(Some('x'))); assert_eq!(2u, f(Some('y'))); assert_eq!(3u, f(None)); assert_eq!(1, match Some('x') { Some(char_x!()) => 1, _ => 2, }); assert_eq!(1, match Some('x') { some!(char_x!()) => 1, _ => 2, }); assert_eq!(1, match Some('x') { ...
identifier_body
macro-pat.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...
(c: Option<char>) -> uint { match c { Some('x') => 1, mypat!() => 2, _ => 3, } } pub fn main() { assert_eq!(1u, f(Some('x'))); assert_eq!(2u, f(Some('y'))); assert_eq!(3u, f(None)); assert_eq!(1, match Some('x') { Some(char_x!()) => 1, _ => 2, }); ...
f
identifier_name
Action.js
/* * Ext JS Library 2.3.0 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /** * @class Ext.form.Action * <p>The subclasses of this class provide actions to perform upon {@link Ext.form.BasicForm Form}s.</p> * <p>Instances of this class are only created by ...
this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); } }, // private success : function(response){ var result = this.processResponse(response); if(result === true || result.success){ this.form.afterAction(this, tr...
params:!isGet ? this.getParams() : null, isUpload: this.form.fileUpload })); }else if (o.clientValidation !== false){ // client validation failed
random_line_split
Action.js
/* * Ext JS Library 2.3.0 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /** * @class Ext.form.Action * <p>The subclasses of this class provide actions to perform upon {@link Ext.form.BasicForm Form}s.</p> * <p>Instances of this class are only created by ...
} if(errors.length < 1){ errors = null; } return { success : rs.success, errors : errors }; } return Ext.decode(response.responseText); } }); /** * @class Ext.form.Action.Load * @extends ...
{ var r = rs.records[i]; errors[i] = r.data; }
conditional_block
0003_emailvalidationtoken.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-16 21:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_depende...
), ]
random_line_split
0003_emailvalidationtoken.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-16 21:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('user', '0002_profile_validated'), ] operations = [ migrations.CreateModel( name='EmailValidationToken', fields=[ ('id', models.AutoField(auto_created=True, primary_key=T...
identifier_body
0003_emailvalidationtoken.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-16 21:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('user', '0002_profile_validated'), ] operations = [ migrations.CreateModel( name='EmailValidationToken', fields=[ ('id', models.AutoField(aut...
Migration
identifier_name
photo.big.preview.dialogue.ts
import { Component, ElementRef, Renderer2, Input } from '@angular/core'; import { NgIf } from '@angular/common'; import { GenericDlgComponent } from './../dialog/generic.dlg.component'; @Component({ selector: 'photo-big-preview-dlg', templateUrl: './view/photo.big.preview.component.html' }) export class PhotoBigP...
return this._imgElement; } /** * clean up on the flag(s) and data for this dialogue */ private _resetFlags() { let _iE:any=this._getImgElement(); if (_iE) { this._renderer.setAttribute(_iE, "src", "", null); } } /** * STATIC method to show the dialog */ public static sh...
{ this._imgElement=this._element.nativeElement.querySelector('#imgContent'); }
conditional_block
photo.big.preview.dialogue.ts
import { Component, ElementRef, Renderer2, Input } from '@angular/core'; import { NgIf } from '@angular/common'; import { GenericDlgComponent } from './../dialog/generic.dlg.component'; @Component({ selector: 'photo-big-preview-dlg', templateUrl: './view/photo.big.preview.component.html' }) export class PhotoBigP...
(_e:Event):void { // nothing to do in this case } protected buttonTwoClick(_e:Event):void { // reset flags etc this._resetFlags(); PhotoBigPreviewComponent.hideDlg( this._element.nativeElement.querySelector('#dlgPhotoBigPreview'), this._renderer); } private _getImgElement() { ...
buttonOneClick
identifier_name
photo.big.preview.dialogue.ts
import { Component, ElementRef, Renderer2, Input } from '@angular/core'; import { NgIf } from '@angular/common'; import { GenericDlgComponent } from './../dialog/generic.dlg.component'; @Component({ selector: 'photo-big-preview-dlg', templateUrl: './view/photo.big.preview.component.html' }) export class PhotoBigP...
private _getImgElement() { if (!this._imgElement) { this._imgElement=this._element.nativeElement.querySelector('#imgContent'); } return this._imgElement; } /** * clean up on the flag(s) and data for this dialogue */ private _resetFlags() { let _iE:any=this._getImgElement(); i...
{ // reset flags etc this._resetFlags(); PhotoBigPreviewComponent.hideDlg( this._element.nativeElement.querySelector('#dlgPhotoBigPreview'), this._renderer); }
identifier_body
photo.big.preview.dialogue.ts
import { Component, ElementRef, Renderer2, Input } from '@angular/core'; import { NgIf } from '@angular/common'; import { GenericDlgComponent } from './../dialog/generic.dlg.component'; @Component({ selector: 'photo-big-preview-dlg', templateUrl: './view/photo.big.preview.component.html' }) export class PhotoBigP...
this._renderer); } private _getImgElement() { if (!this._imgElement) { this._imgElement=this._element.nativeElement.querySelector('#imgContent'); } return this._imgElement; } /** * clean up on the flag(s) and data for this dialogue */ private _resetFlags() { let _iE:any=th...
PhotoBigPreviewComponent.hideDlg( this._element.nativeElement.querySelector('#dlgPhotoBigPreview'),
random_line_split
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({ clean: ['dist'], ts: { default : { options: { compiler: './node_modules/typescript/bin/tsc', module: "commonjs", fast: 'never', preserveConstEnums: true }, ...
require('load-grunt-tasks')(grunt);
random_line_split
Gruntfile.js
module.exports = function(grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ clean: ['dist'], ts: { default : { options: { compiler: './node_modules/typescript/bin/tsc', module: "commonjs", fast...
return grunt.task.run("bump-only:" + target, "changelog", "shell:addChangelog", "bump-commit"); }); grunt.registerTask('default', ['ts:default', 'copy']); };
{ target = "minor"; }
conditional_block
factories.py
# Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under GNU Affero GPL v3 or later from django.utils.timezone import now from factory import LazyFunction, Sequence from factory.django import DjangoModelFactory from ..models import DebianLogIndex, DebianLogMods, DebianPopcon, DebianWnpp, IssueK...
class DebianPopconFactory(DjangoModelFactory): class Meta: model = DebianPopcon class DebianWnppFactory(DjangoModelFactory): class Meta: model = DebianWnpp ident = Sequence(int) cron_stamp = LazyFunction(now) mod_stamp = LazyFunction(now) open_stamp = LazyFunction(now) ...
model = DebianLogMods
identifier_body
factories.py
# Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under GNU Affero GPL v3 or later from django.utils.timezone import now from factory import LazyFunction, Sequence from factory.django import DjangoModelFactory from ..models import DebianLogIndex, DebianLogMods, DebianPopcon, DebianWnpp, IssueK...
: model = DebianPopcon class DebianWnppFactory(DjangoModelFactory): class Meta: model = DebianWnpp ident = Sequence(int) cron_stamp = LazyFunction(now) mod_stamp = LazyFunction(now) open_stamp = LazyFunction(now) kind = IssueKind.RFA.value # anything that matches the default...
Meta
identifier_name
factories.py
# Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under GNU Affero GPL v3 or later from django.utils.timezone import now from factory import LazyFunction, Sequence from factory.django import DjangoModelFactory from ..models import DebianLogIndex, DebianLogMods, DebianPopcon, DebianWnpp, IssueK...
mod_stamp = LazyFunction(now) open_stamp = LazyFunction(now) kind = IssueKind.RFA.value # anything that matches the default filters
ident = Sequence(int) cron_stamp = LazyFunction(now)
random_line_split
error.rs
// Copyright 2015-2017 Parity Technologies // // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except ...
(&self) -> &str { "builder error" } } impl fmt::Display for DecoderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self, f) } }
description
identifier_name
error.rs
// Copyright 2015-2017 Parity Technologies // // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except ...
#[derive(Debug, PartialEq, Eq)] /// Error concerning the RLP decoder. pub enum DecoderError { /// Data has additional bytes at the end of the valid RLP fragment. RlpIsTooBig, /// Data has too few bytes for valid RLP. RlpIsTooShort, /// Expect an encoded list, RLP was something else. RlpExpectedToBeList, /// Exp...
random_line_split
utility.rs
// Copyright 2016 Kyle Mayes // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
let end = self.get_last_span(); let delimited = Delimited { delim: delim, open_span: start, tts: try!(tts), close_span: end, }; Ok((span_spans(start, end), delimited)) } pub fn parse_token(&mut self, name: &str) -> PluginResult<(Sp...
let tts = self.apply(|p| { let sep = SeqSep { sep: None, trailing_sep_allowed: false }; p.parse_seq_to_end(&Token::CloseDelim(delim), sep, |p| p.parse_token_tree()) }).1.map_err(|mut err| { err.cancel(); SaveEmitter::get_error() });
random_line_split
utility.rs
// Copyright 2016 Kyle Mayes // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
(&mut self, name: &str) -> PluginResult<(Span, Delimited)> { let (start, delim) = match try!(self.next_token("opening delimiter", Some(name))) { (span, Token::OpenDelim(delim)) => (span, delim), (span, _) => return Err((span, "expected opening delimiter".into())), }; let ...
parse_delim
identifier_name
utility.rs
// Copyright 2016 Kyle Mayes // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
/// Creates a new transaction which saves the current state of this parser. pub fn transaction(&self) -> Transaction { Transaction(self.index) } /// Returns a parsing error. fn get_error(&self, mut span: Span, description: &str, name: Option<&str>) -> (Span, String) { let mut mess...
{ if self.is_eof() { None } else { Some(span_spans(self.get_span(), self.span)) } }
identifier_body
test.ts
/* * Copyright 2019, TeamDev. All rights reserved. * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following * disclaimer. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR...
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF A...
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
random_line_split
createDB.py
import sqlite3 import sys import os def
(): sane = 1 while sane == 1: print "[ - ] Please enter absolute path to cred. database to be created: " in_path = raw_input() if os.path.exists(in_path): os.system('cls' if os.name == 'nt' else 'clear') print "[ - ] Invalid path, try again." else: sane = 0 return(in_path) def main(dbPa...
menu
identifier_name
createDB.py
import sqlite3 import sys import os def menu(): sane = 1 while sane == 1: print "[ - ] Please enter absolute path to cred. database to be created: " in_path = raw_input() if os.path.exists(in_path): os.system('cls' if os.name == 'nt' else 'clear') print "[ - ] Invalid path, try again." else...
print "[ - ] Unable to create, check path and try again." sys.exit(1) cur = db_conn.cursor() cur.execute(createQ) print "[ - ] DB created at "+dbPath+"\nPress enter to exit." end = raw_input() try: main(menu()) except KeyboardInterrupt: print "[ - ] CTRL+C caught, exiting."
def main(dbPath): createQ = "CREATE TABLE "+'"main"'+" ('pri_Index' INTEGER PRIMARY KEY AUTOINCREMENT, 'identifier' TEXT , 'clearTextP' TEXT , 'srcMD5' TEXT , 'srcSHA1' TEXT , 'srcBCRYPT' TEXT , 'rainTableMD5' TEXT , 'rainTableSHA1' TEXT , 'rainTableBCRYPT' TEXT)" try: db_conn = sqlite3.connect(dbPath) except:...
random_line_split
createDB.py
import sqlite3 import sys import os def menu(): sane = 1 while sane == 1: print "[ - ] Please enter absolute path to cred. database to be created: " in_path = raw_input() if os.path.exists(in_path): os.system('cls' if os.name == 'nt' else 'clear') print "[ - ] Invalid path, try again." else...
return(in_path) def main(dbPath): createQ = "CREATE TABLE "+'"main"'+" ('pri_Index' INTEGER PRIMARY KEY AUTOINCREMENT, 'identifier' TEXT , 'clearTextP' TEXT , 'srcMD5' TEXT , 'srcSHA1' TEXT , 'srcBCRYPT' TEXT , 'rainTableMD5' TEXT , 'rainTableSHA1' TEXT , 'rainTableBCRYPT' TEXT)" try: db_conn = sqlite3.con...
sane = 0
conditional_block
createDB.py
import sqlite3 import sys import os def menu():
def main(dbPath): createQ = "CREATE TABLE "+'"main"'+" ('pri_Index' INTEGER PRIMARY KEY AUTOINCREMENT, 'identifier' TEXT , 'clearTextP' TEXT , 'srcMD5' TEXT , 'srcSHA1' TEXT , 'srcBCRYPT' TEXT , 'rainTableMD5' TEXT , 'rainTableSHA1' TEXT , 'rainTableBCRYPT' TEXT)" try: db_conn = sqlite3.connect(dbPath) exc...
sane = 1 while sane == 1: print "[ - ] Please enter absolute path to cred. database to be created: " in_path = raw_input() if os.path.exists(in_path): os.system('cls' if os.name == 'nt' else 'clear') print "[ - ] Invalid path, try again." else: sane = 0 return(in_path)
identifier_body
jquery.calendario.js
/** * jquery.calendario.js v1.0.0 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2012, Codrops * http://www.codrops.com */ ;( function( $, window, undefined ) { 'use strict'; $.Calendario = function( options, element ) { ...
html += cellClasses !== '' ? '<div class="' + cellClasses + '">' : '<div>'; html += inner; html += '</div>'; } // stop making rows if we've run out of days if (day > monthLength) { this.rowTotal = i + 1; break; } else { html += '</div><div class="fc-row">'; } ...
{ cellClasses += 'fc-content'; }
conditional_block
jquery.calendario.js
/** * jquery.calendario.js v1.0.0 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2012, Codrops * http://www.codrops.com */ ;( function( $, window, undefined ) { 'use strict'; $.Calendario = function( options, element ) { ...
logError( "cannot call methods on calendario prior to initialization; " + "attempted to call method '" + options + "'" ); return; } if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { logError( "no such method '" + options + "' for calendario instance" ); ...
random_line_split
pipeobject.py
# This file is a part of pysnapshotd, a program for automated backups # Copyright (C) 2015-2016 Jonas Thiem # # 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,...
print(" >> PIPE READ: " + str(amount)) if amount <= 0: print(" >> PIPE READ DATA: <empty read>") return b"" self.access_mutex.acquire() # Try to read data as long as needed to acquire requested amount: obtained_data = b"" while True: # If pipe...
identifier_body
pipeobject.py
# This file is a part of pysnapshotd, a program for automated backups # Copyright (C) 2015-2016 Jonas Thiem # # 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,...
(self, data): # First, check if pipe is still open at all: self.access_mutex.acquire() if self.closed: self.access_mutex.release() raise OSError("broken pipe - pipe has been closed") # Do nothing for an obvious dummy command: if len(data) == 0: ...
write
identifier_name
pipeobject.py
# This file is a part of pysnapshotd, a program for automated backups # Copyright (C) 2015-2016 Jonas Thiem # # 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, o...
# Do nothing for an obvious dummy command: if len(data) == 0: self.access_mutex.release() return 0 # Try to write with the write func if given: # (which means this pipe object itself will always remain empty and # .read() on it will block forever, since t...
raise OSError("broken pipe - pipe has been closed")
random_line_split
pipeobject.py
# This file is a part of pysnapshotd, a program for automated backups # Copyright (C) 2015-2016 Jonas Thiem # # 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,...
# Try to obtain as much data as requested: if len(self.contents) > 0: added_data = self.contents[:amount] obtained_data += added_data self.contents = self.contents[len(added_data):] amount -= len(added_data) # If there ...
self.access_mutex.release() raise OSError("broken pipe - pipe has been closed")
conditional_block
main.rs
extern crate rand; use std::io; use rand::Rng; // provide a random number generator use std::cmp::Ordering; fn
() { let lower_bound = 1; let upper_bound = 101; println!("Guess the num! {} ~ {}", lower_bound, upper_bound); let secret = rand::thread_rng() // get a copy of the rng .gen_range(lower_bound, upper_bound); // println!("The secret num is: {}", secret); loop { let mut guess = Str...
main
identifier_name
main.rs
extern crate rand; use std::io; use rand::Rng; // provide a random number generator use std::cmp::Ordering; fn main()
{ let lower_bound = 1; let upper_bound = 101; println!("Guess the num! {} ~ {}", lower_bound, upper_bound); let secret = rand::thread_rng() // get a copy of the rng .gen_range(lower_bound, upper_bound); // println!("The secret num is: {}", secret); loop { let mut guess = String...
identifier_body
main.rs
extern crate rand; use std::io; use rand::Rng; // provide a random number generator use std::cmp::Ordering; fn main() { let lower_bound = 1; let upper_bound = 101; println!("Guess the num! {} ~ {}", lower_bound, upper_bound); let secret = rand::thread_rng() // get a copy of the rng .gen_range...
}; println!("You guessed: {}", guess); match guess.cmp(&secret) { Ordering::Less => println!("Too small!"), Ordering::Greater => println!("Too big!"), Ordering::Equal => { println!("You win!"); break; }...
{ println!("Please Enter a number!\n"); continue; }
conditional_block
main.rs
extern crate rand; use std::io; use rand::Rng; // provide a random number generator use std::cmp::Ordering; fn main() { let lower_bound = 1; let upper_bound = 101; println!("Guess the num! {} ~ {}", lower_bound, upper_bound); let secret = rand::thread_rng() // get a copy of the rng .gen_range...
Ordering::Less => println!("Too small!"), Ordering::Greater => println!("Too big!"), Ordering::Equal => { println!("You win!"); break; } } } }
println!("You guessed: {}", guess); match guess.cmp(&secret) {
random_line_split
main.rs
extern crate tcod; extern crate rand; use std::cmp; use tcod::console::*; use tcod::colors::{self, Color}; use rand::Rng; // Actual size of the window const SCREEN_WIDTH: i32 = 80; const SCREEN_HEIGHT: i32 = 50; // Size of the map in the window const MAP_WIDTH: i32 = 80; const MAP_HEIGHT: i32 = 45; // Parameters ...
(&self, con: &mut Console) { con.set_default_foreground(self.color); con.put_char(self.x, self.y, self.char, BackgroundFlag::None); } pub fn clear(&self, con: &mut Console) { con.put_char(self.x, self.y, ' ', BackgroundFlag::None) } } fn create_room(room: Rect, map: &mut Ma...
draw
identifier_name
main.rs
extern crate tcod; extern crate rand; use std::cmp; use tcod::console::*; use tcod::colors::{self, Color}; use rand::Rng; // Actual size of the window const SCREEN_WIDTH: i32 = 80; const SCREEN_HEIGHT: i32 = 50; // Size of the map in the window const MAP_WIDTH: i32 = 80; const MAP_HEIGHT: i32 = 45; // Parameters ...
pub fn clear(&self, con: &mut Console) { con.put_char(self.x, self.y, ' ', BackgroundFlag::None) } } fn create_room(room: Rect, map: &mut Map) { for x in (room.x1 + 1)..room.x2 { for y in (room.y1 + 1)..room.y2 { map[x as usize][y as usize] = Tile::empty(); } } }...
con.put_char(self.x, self.y, self.char, BackgroundFlag::None); }
random_line_split
main.rs
extern crate tcod; extern crate rand; use std::cmp; use tcod::console::*; use tcod::colors::{self, Color}; use rand::Rng; // Actual size of the window const SCREEN_WIDTH: i32 = 80; const SCREEN_HEIGHT: i32 = 50; // Size of the map in the window const MAP_WIDTH: i32 = 80; const MAP_HEIGHT: i32 = 45; // Parameters ...
else { con.set_char_background(x, y, COLOR_DARK_GROUND, BackgroundFlag::Set); } } } for object in objects { object.draw(con); } blit (con, (0,0), (MAP_WIDTH, MAP_HEIGHT), root, (0,0), 1.0, 1.0); } fn handle_keys(root: &mut Root, player: &mut Object, map:...
{ con.set_char_background(x, y, COLOR_DARK_WALL, BackgroundFlag::Set); }
conditional_block
urls.py
"""simpleneed URL Configuration. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Clas...
router.register(r'genders', GenderViewSet) router.register(r'needlocations', NeedLocationViewSet) router.register(r'contacts', ContactViewSet) router.register(r'roams', RoamViewSet) router.register(r'stats', StatsViewSet) router.register(r'messages', MessageViewSet) router.register(r'locatedelements', LocatedElementVie...
router = routers.DefaultRouter() router.register(r'moods', MoodViewSet) router.register(r'needs', NeedViewSet)
random_line_split
PlaylistsNav.tsx
/* eslint-disable jsx-a11y/no-autofocus */ import * as electron from 'electron'; import * as React from 'react'; import * as Icon from 'react-fontawesome'; import * as PlaylistsActions from '../../actions/PlaylistsActions'; import PlaylistsNavLink from '../PlaylistsNavLink/PlaylistsNavLink'; import { PlaylistModel } ...
(e: React.FocusEvent<HTMLInputElement>) { if (this.state.renamed) { await this.rename(this.state.renamed, e.currentTarget.value); } this.setState({ renamed: null }); } focus(e: React.FocusEvent<HTMLInputElement>) { e.currentTarget.select(); } render() { const { playlists } = this.pr...
blur
identifier_name
PlaylistsNav.tsx
/* eslint-disable jsx-a11y/no-autofocus */ import * as electron from 'electron'; import * as React from 'react'; import * as Icon from 'react-fontawesome'; import * as PlaylistsActions from '../../actions/PlaylistsActions'; import PlaylistsNavLink from '../PlaylistsNavLink/PlaylistsNavLink'; import { PlaylistModel } ...
async createPlaylist() { // Todo 'new playlist 1', 'new playlist 2' ... await PlaylistsActions.create('New playlist', [], false, true); } async rename(_id: string, name: string) { await PlaylistsActions.rename(_id, name); } async keyDown(e: React.KeyboardEvent<HTMLInputElement>) { e.persis...
{ const template: electron.MenuItemConstructorOptions[] = [ { label: 'Rename', click: () => { this.setState({ renamed: playlistId }); } }, { label: 'Delete', click: async () => { await PlaylistsActions.remove(playlistId); } ...
identifier_body
PlaylistsNav.tsx
/* eslint-disable jsx-a11y/no-autofocus */ import * as electron from 'electron'; import * as React from 'react'; import * as Icon from 'react-fontawesome'; import * as PlaylistsActions from '../../actions/PlaylistsActions'; import PlaylistsNavLink from '../PlaylistsNavLink/PlaylistsNavLink'; import { PlaylistModel } ...
return ( <div className={styles.playlistsNav}> <div className={styles.playlistsNav__header}> <h4 className={styles.playlistsNav__title}>Playlists</h4> <div className={styles.actions}> <button className={styles.action} onClick={this.createPlaylist} title='New playlist'> ...
} return <div key={`playlist-${elem._id}`}>{navItemContent}</div>; });
random_line_split
Details.tsx
import React from 'react'; import { UISref } from '@uirouter/react'; import { Spinner } from 'core/widgets/spinners/Spinner'; interface IDetailsProps { loading: boolean; } interface IDetailsHeaderProps { icon: React.ReactNode; name: string; } interface IDetailsSFCWithExtras extends React.SFC<IDetailsProps> { ...
<UISref to="^"> <a className="btn btn-link"> <span className="glyphicon glyphicon-remove" /> </a> </UISref> </div> ); const DetailsHeader: React.SFC<IDetailsHeaderProps> = (props) => ( <div className="header"> {CloseButton} <div className="header-text horizontal middle"> {...
<div className="close-button">
random_line_split
async_core.py
#!/usr/local/bin/python3.4 # -*- coding: utf-8 -*- import threading import time import sys import trace from inspect import isgeneratorfunction import format class KillableThread(threading.Thread): """A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes.""" def __init_...
self.killed = True class FunctionExecutor(KillableThread): def __init__(self, _f: 'the function to execute', _callback, args, kwargs): super().__init__() self._f = _f self._callback = _callback self.args = args self.kwargs = kwargs def run(self): ret = ...
raise SystemExit() return self.localtrace def kill(self):
random_line_split
async_core.py
#!/usr/local/bin/python3.4 # -*- coding: utf-8 -*- import threading import time import sys import trace from inspect import isgeneratorfunction import format class KillableThread(threading.Thread): """A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes.""" def __init_...
def run(self): ret = self._f(*self.args, **self.kwargs) if ret is not None: if repr(type(ret)) == '<class \'generator\'>': for i in ret: self._callback(i.format(color=format.color)) else: # TODO: make function to be only generators, not ...
super().__init__() self._f = _f self._callback = _callback self.args = args self.kwargs = kwargs
identifier_body
async_core.py
#!/usr/local/bin/python3.4 # -*- coding: utf-8 -*- import threading import time import sys import trace from inspect import isgeneratorfunction import format class KillableThread(threading.Thread): """A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes.""" def __init_...
class ControlThread(threading.Thread): def __init__(self, _f, _callback, *args, **kwargs): super().__init__() self.watched_thread = FunctionExecutor(_f, _callback, args, kwargs) self._callback = _callback def run(self): self.watched_thread.start() time.sleep(3) ...
if repr(type(ret)) == '<class \'generator\'>': for i in ret: self._callback(i.format(color=format.color)) else: # TODO: make function to be only generators, not normal functions print('DEPRECATED: function "', self._f.cmdname, '" is using the return state...
conditional_block
async_core.py
#!/usr/local/bin/python3.4 # -*- coding: utf-8 -*- import threading import time import sys import trace from inspect import isgeneratorfunction import format class KillableThread(threading.Thread): """A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes.""" def __init_...
(self): """Start the thread.""" self.__run_backup = self.run self.run = self.__run # Force the Thread to install our trace. threading.Thread.start(self) def __run(self): """Hacked run function, which installs the trace.""" sys.settrace(self.globaltrace) ...
start
identifier_name