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
demo.component.ts
import { Component, OnInit } from '@angular/core'; import {DataTableResource} from "./data-table-resource"; import {TableService} from "./table.service"; @Component({ moduleId: module.id, selector: 'demo', template: `<table-component (reload)="reloadItems($event)" [itemsPromise]="rowsPromise" (mult...
}
{ console.log("gs",items); }
identifier_body
demo.component.ts
import { Component, OnInit } from '@angular/core'; import {DataTableResource} from "./data-table-resource"; import {TableService} from "./table.service"; @Component({ moduleId: module.id, selector: 'demo',
template: `<table-component (reload)="reloadItems($event)" [itemsPromise]="rowsPromise" (multiSelect)="getSelected($event)" [activableColumns]="activableColumns" [itemCount]="itemCount" [sortableColumns]="sortableColumns" ></table-component>` }) export class DemoComponent implements OnInit { rows...
random_line_split
demo.component.ts
import { Component, OnInit } from '@angular/core'; import {DataTableResource} from "./data-table-resource"; import {TableService} from "./table.service"; @Component({ moduleId: module.id, selector: 'demo', template: `<table-component (reload)="reloadItems($event)" [itemsPromise]="rowsPromise" (mult...
(private tableService:TableService) { // this.itemResource.count().then(count => this.itemCount = count); } ngOnInit(): void { this.tableService.getTable().then(items=> this.itemResource = new DataTableResource(items)); this.rowsPromise = this.tableService.getTable(); } getSelected(items:any[])...
constructor
identifier_name
merge.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- import os ; import sys ; import pickle def
(): num_partitions = 8 unique_users = {} print "Merging..." for filename in os.listdir("."): if filename[filename.rfind('.')+1:] == 'pickle': f = open(filename, 'rb') users = pickle.load(f) f.close() print len(users) for user in users: ...
main
identifier_name
merge.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- import os ; import sys ; import pickle def main(): num_partitions = 8 unique_users = {} print "Merging..." for filename in os.listdir("."): if filename[filename.rfind('.')+1:] == 'pickle': ...
partition_size = len(unique_users) / num_partitions for i in range(num_partitions): f_unique_users = open('outputs/%s.pickle'%(i), 'wb') pickle.dump(unique_users.values()[i*partition_size:(i+1)*partition_size], f_unique_users) f_unique_users.close() if __name__ == '__main__': ma...
print "Unique users: %s"%(len(unique_users)) print "Partitioning..."
random_line_split
merge.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- import os ; import sys ; import pickle def main(): num_partitions = 8 unique_users = {} print "Merging..." for filename in os.listdir("."): if filename[filename.rfind('.')+1:] == 'pickle': ...
main()
conditional_block
merge.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- import os ; import sys ; import pickle def main():
if __name__ == '__main__': main()
num_partitions = 8 unique_users = {} print "Merging..." for filename in os.listdir("."): if filename[filename.rfind('.')+1:] == 'pickle': f = open(filename, 'rb') users = pickle.load(f) f.close() print len(users) for user in users: ...
identifier_body
heapapi.rs
// Copyright © 2015-2017 winapi-rs developers // 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. // All files in the project carrying such notice may not be copied,...
STRUCT!{struct HEAP_SUMMARY { cb: DWORD, cbAllocated: SIZE_T, cbCommitted: SIZE_T, cbReserved: SIZE_T, cbMaxReserve: SIZE_T, }} pub type PHEAP_SUMMARY = *mut HEAP_SUMMARY; pub type LPHEAP_SUMMARY = PHEAP_SUMMARY;
// except according to those terms. //! ApiSet Contract for api-ms-win-core-heap-l1 use shared::basetsd::SIZE_T; use shared::minwindef::DWORD;
random_line_split
macro-crate.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() -> AFakeTypeThatHadBetterGoAway {} pub fn main() { assert_eq!(1, make_a_1!()); assert_eq!(2, exported_macro!()); assert_eq!(Bar, Bar); test(None::<Foo>); } fn test<T: Eq+Clone>(_: Option<T>) {}
foo
identifier_name
macro-crate.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
assert_eq!(1, make_a_1!()); assert_eq!(2, exported_macro!()); assert_eq!(Bar, Bar); test(None::<Foo>); } fn test<T: Eq+Clone>(_: Option<T>) {}
pub fn main() {
random_line_split
macro-crate.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
pub fn main() { assert_eq!(1, make_a_1!()); assert_eq!(2, exported_macro!()); assert_eq!(Bar, Bar); test(None::<Foo>); } fn test<T: Eq+Clone>(_: Option<T>) {}
{}
identifier_body
DialButton.tsx
import classnames from 'classnames'; import React, { Component } from 'react'; import audios from './audios'; import styles from './styles.scss'; const ALTERNATIVE_TIMEOUT = 1000; interface DialButtonProps { btn: { value: string; text?: string; alternativeValue?: string; dx?: string; }; classNa...
clearTimeout(this.timeout); this.timeout = null; } if (typeof this.props.onOutput === 'function') { this.props.onOutput(this.props.btn.value); } this.setState({ pressed: false, }); } }; onMouseLeave = () => { if (this.state.pressed) { if (...
if (this.state.pressed) { if (this.timeout) {
random_line_split
DialButton.tsx
import classnames from 'classnames'; import React, { Component } from 'react'; import audios from './audios'; import styles from './styles.scss'; const ALTERNATIVE_TIMEOUT = 1000; interface DialButtonProps { btn: { value: string; text?: string; alternativeValue?: string; dx?: string; }; classNa...
(props: DialButtonProps, ...args) { super(props, ...args); if ( typeof document !== 'undefined' && document.createElement && audios[props.btn.value] ) { this.audio = document.createElement('audio'); this.audio.src = audios[props.btn.value]; } } onMouseDown = (e) => { ...
constructor
identifier_name
DialButton.tsx
import classnames from 'classnames'; import React, { Component } from 'react'; import audios from './audios'; import styles from './styles.scss'; const ALTERNATIVE_TIMEOUT = 1000; interface DialButtonProps { btn: { value: string; text?: string; alternativeValue?: string; dx?: string; }; classNa...
if (typeof this.props.onPress === 'function') { this.props.onPress(this.props.btn.value); } this.timeout = setTimeout(() => { if (this.state.pressed) { if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } if (typeof this.props.onOut...
{ this.audio.volume = this.props.volume; this.audio.muted = this.props.muted; this.audio.currentTime = 0; // on Edge, audio.play() could only use at the first time // so we reset the src of the audio when using audio.play() if (this.isEdge) { this.audio.src = audios[this.prop...
conditional_block
DialButton.tsx
import classnames from 'classnames'; import React, { Component } from 'react'; import audios from './audios'; import styles from './styles.scss'; const ALTERNATIVE_TIMEOUT = 1000; interface DialButtonProps { btn: { value: string; text?: string; alternativeValue?: string; dx?: string; }; classNa...
onMouseDown = (e) => { e.preventDefault(); if (this.audio && this.audio.canPlayType('audio/ogg') !== '') { this.audio.volume = this.props.volume; this.audio.muted = this.props.muted; this.audio.currentTime = 0; // on Edge, audio.play() could only use at the first time // so we...
{ super(props, ...args); if ( typeof document !== 'undefined' && document.createElement && audios[props.btn.value] ) { this.audio = document.createElement('audio'); this.audio.src = audios[props.btn.value]; } }
identifier_body
main-view-model.ts
import { Observable } from '@nativescript/core/data/observable'; import { ObservableArray } from '@nativescript/core/data/observable-array'; export class Item extends Observable { private _name: string; private _id: number; private _age: number; constructor(name: string, id: number, age: number) { super(); th...
set name(value: string) { if (this._name !== value) { this._name = value; this.notifyPropertyChange('name', value); } } get id(): number { return this._id; } set id(value: number) { if (this._id !== value) { this._id = value; this.notifyPropertyChange('id', value); } } get age(): number...
random_line_split
main-view-model.ts
import { Observable } from '@nativescript/core/data/observable'; import { ObservableArray } from '@nativescript/core/data/observable-array'; export class Item extends Observable { private _name: string; private _id: number; private _age: number; constructor(name: string, id: number, age: number) { super(); th...
} export class ViewModel extends Observable { private _items: ObservableArray<Item>; get items(): ObservableArray<Item> { this._items = new ObservableArray<Item>(); for (let i = 0; i < 100; i++) { this._items.push(new Item(`Item`, i, 0)); } return this._items; } }
{ return `${this.name} ${this.id}`; }
identifier_body
main-view-model.ts
import { Observable } from '@nativescript/core/data/observable'; import { ObservableArray } from '@nativescript/core/data/observable-array'; export class Item extends Observable { private _name: string; private _id: number; private _age: number; constructor(name: string, id: number, age: number) { super(); th...
(): string { return this._name; } set name(value: string) { if (this._name !== value) { this._name = value; this.notifyPropertyChange('name', value); } } get id(): number { return this._id; } set id(value: number) { if (this._id !== value) { this._id = value; this.notifyPropertyChange('id...
name
identifier_name
main-view-model.ts
import { Observable } from '@nativescript/core/data/observable'; import { ObservableArray } from '@nativescript/core/data/observable-array'; export class Item extends Observable { private _name: string; private _id: number; private _age: number; constructor(name: string, id: number, age: number) { super(); th...
} public toString() { return `${this.name} ${this.id}`; } } export class ViewModel extends Observable { private _items: ObservableArray<Item>; get items(): ObservableArray<Item> { this._items = new ObservableArray<Item>(); for (let i = 0; i < 100; i++) { this._items.push(new Item(`Item`, i, 0)); } ...
{ this._age = value; this.notifyPropertyChange('age', value); }
conditional_block
numpy_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This is a doctest example with Numpy arrays. For more information about doctest, see https://docs.python.org/3/library/doctest.html (reference) and www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in French). To run doctest, execute this script...
Parameters ---------- image : array_like The image to process. `NaN` values are replaced **in-place** thus this function changes the provided object. Returns ------- array_like Returns a boolean mask array indicating whether values in `a` initially contained `Na...
Replace `NaN` ("Not a Number") values in `a` by zeros.
random_line_split
numpy_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This is a doctest example with Numpy arrays. For more information about doctest, see https://docs.python.org/3/library/doctest.html (reference) and www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in French). To run doctest, execute this script...
import doctest import numpy doctest.testmod()
conditional_block
numpy_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This is a doctest example with Numpy arrays. For more information about doctest, see https://docs.python.org/3/library/doctest.html (reference) and www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in French). To run doctest, execute this script...
(a): """A very basic example. Examples -------- >>> a = numpy.array([3, 1, 2]) >>> example3(a) >>> a array([1, 2, 3]) """ a.sort() def example4(a): """Replace *in-place* `NaN` values in `a` by zeros. Replace `NaN` ("Not a Number") values in `a` by zeros. Parameters ...
example3
identifier_name
numpy_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This is a doctest example with Numpy arrays. For more information about doctest, see https://docs.python.org/3/library/doctest.html (reference) and www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in French). To run doctest, execute this script...
def example4(a): """Replace *in-place* `NaN` values in `a` by zeros. Replace `NaN` ("Not a Number") values in `a` by zeros. Parameters ---------- image : array_like The image to process. `NaN` values are replaced **in-place** thus this function changes the provided object. ...
"""A very basic example. Examples -------- >>> a = numpy.array([3, 1, 2]) >>> example3(a) >>> a array([1, 2, 3]) """ a.sort()
identifier_body
loginCert.js
var selectdb = require('./selectDB'), accounts, DBPATIENTS = 0, DBDOCTORS = 1, DBPLANNERS = 2, DBADMINS = 3; var certAutoLogin = function(dni, db, callback){ 'use strict'; accounts = selectdb.selectDataBase(db); accounts.findOne({dni:dni}, function(e, o) { if (o){ c...
'use strict'; certAutoLogin(dni,DBPATIENTS,callback); }; exports.certAutoLoginDoctor = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBDOCTORS,callback); }; exports.certAutoLoginPlanner = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBPLANNERS,callback); }; exports.c...
}; /*module*/ exports.certAutoLoginPatient = function(dni, callback){
random_line_split
loginCert.js
var selectdb = require('./selectDB'), accounts, DBPATIENTS = 0, DBDOCTORS = 1, DBPLANNERS = 2, DBADMINS = 3; var certAutoLogin = function(dni, db, callback){ 'use strict'; accounts = selectdb.selectDataBase(db); accounts.findOne({dni:dni}, function(e, o) { if (o)
else{ callback(null); } }); }; /*module*/ exports.certAutoLoginPatient = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBPATIENTS,callback); }; exports.certAutoLoginDoctor = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBDOCTORS,callback); }; expo...
{ callback(o); }
conditional_block
sms.rs
extern crate url; extern crate request; extern crate rustc_serialize; use std::collections::HashMap; use rustc_serialize::json::Json; use twilio_config::TwilioConfig; #[derive(Debug)] pub enum SMSError { UnknownException } pub fn send_sms(from: &str, to: &str, body: &str) -> Result<String, SMSError> { let c...
params.insert("From".to_string(), from.to_string()); params.insert("To".to_string(), to.to_string()); params.insert("Body".to_string(), body.to_string()); headers.insert("Connection".to_string(), "close".to_string()); headers.insert("Authorization".to_string(), config.to_http_auth()); headers.i...
random_line_split
sms.rs
extern crate url; extern crate request; extern crate rustc_serialize; use std::collections::HashMap; use rustc_serialize::json::Json; use twilio_config::TwilioConfig; #[derive(Debug)] pub enum SMSError { UnknownException } pub fn send_sms(from: &str, to: &str, body: &str) -> Result<String, SMSError> { let c...
() { let mut params: HashMap<String, String> = HashMap::new(); params.insert("Foo".to_string(), "Bar".to_string()); assert_eq!(serialize_message_request_mody(params), "Foo=Bar".to_string()) }
test_serialize_message_request_body
identifier_name
validator.py
import os from zeroinstall.injector import namespaces from zeroinstall.injector.reader import InvalidInterface, load_feed from xml.dom import minidom, Node, XMLNS_NAMESPACE import tempfile from logging import warn, info group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice...
checkElement(doc.documentElement) return feed
if warnings: doc = minidom.parseString(data)
random_line_split
validator.py
import os from zeroinstall.injector import namespaces from zeroinstall.injector.reader import InvalidInterface, load_feed from xml.dom import minidom, Node, XMLNS_NAMESPACE import tempfile from logging import warn, info group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice...
return feed
fd, tmp_name = tempfile.mkstemp(prefix = '0publish-validate-') os.close(fd) try: tmp_file = file(tmp_name, 'w') tmp_file.write(data) tmp_file.close() try: feed = load_feed(tmp_name, local=True, implementation_id_alg=implementation_id_alg, generate_sizes=generate_sizes) except InvalidInterface, ex: rai...
identifier_body
validator.py
import os from zeroinstall.injector import namespaces from zeroinstall.injector.reader import InvalidInterface, load_feed from xml.dom import minidom, Node, XMLNS_NAMESPACE import tempfile from logging import warn, info group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice...
return feed
doc = minidom.parseString(data) checkElement(doc.documentElement)
conditional_block
validator.py
import os from zeroinstall.injector import namespaces from zeroinstall.injector.reader import InvalidInterface, load_feed from xml.dom import minidom, Node, XMLNS_NAMESPACE import tempfile from logging import warn, info group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice...
(data, warnings = True, implementation_id_alg=None, generate_sizes=False): fd, tmp_name = tempfile.mkstemp(prefix = '0publish-validate-') os.close(fd) try: tmp_file = file(tmp_name, 'w') tmp_file.write(data) tmp_file.close() try: feed = load_feed(tmp_name, local=True, implementation_id_alg=implementation_...
check
identifier_name
MoreIssuesContainer.tsx
import { connect, Dispatch } from 'react-redux'; import { bindActionCreators } from 'redux'; import { ApplicationState } from '../../redux/root'; import { MoreIssuesPage } from './index'; import { Issue } from '../../common/model'; import { getIssuesIfNeeded } from '../../redux/remoteData'; import { selectIssueActionCr...
export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)(MoreIssuesPage);
dispatch); };
random_line_split
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
else { None } } } impl Any+Send { /// Forwards to the method defined on the type `Any`. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is<T: Any>(&self) -> bool { Any::is::<T>(self) } /// Forwards to the method defined on the type `Any`. #[s...
{ unsafe { // Get the raw representation of the trait object let to: TraitObject = transmute(self); // Extract the data pointer Some(transmute(to.data)) } }
conditional_block
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// Get TypeId of the type this function is instantiated with let t = TypeId::of::<T>(); // Get TypeId of the type in the trait object let boxed = self.get_type_id(); // Compare both TypeIds on equality t == boxed } /// Returns some reference to the boxed value ...
pub fn is<T: Any>(&self) -> bool {
random_line_split
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<T: Any>(&self) -> bool { // Get TypeId of the type this function is instantiated with let t = TypeId::of::<T>(); // Get TypeId of the type in the trait object let boxed = self.get_type_id(); // Compare both TypeIds on equality t == boxed } /// Returns some ref...
is
identifier_name
users.js
// © 2000 NEOSYS Software Ltd. All Rights Reserved.//**Start Encode** function form_postinit() { //enable/disable password changing button neosyssetexpression('button_password', 'disabled', '!gusers_authorisation_update&&gkey!=gusername') //force retrieval of own record if (gro.dictitem('USER...
gwhatsnew = neosysgetcookie(glogincode, 'NEOSYS2', 'wn').toLowerCase() if (gwhatsnew) { if (window.location.href.toString().slice(0, 5) == 'file:') gwhatsnew = 'file:///' + gwhatsnew else gwhatsnew = '..' + gwhatsnew.slice(gwhatsnew.indexOf('\\data\\')) neosyssetcookie(glogincode, 'N...
random_line_split
users.js
// © 2000 NEOSYS Software Ltd. All Rights Reserved.//**Start Encode** function form_postinit() { //enable/disable password changing button neosyssetexpression('button_password', 'disabled', '!gusers_authorisation_update&&gkey!=gusername') //force retrieval of own record if (gro.dictitem('USER...
//we only allow one image type merely so that the signature file name //is always know and doesnt need saving in the user file //and no possibility of uploading two image files with different extensions params.allowablefileextensions = 'jpg' var targetfilename = neosysshowmodaldialog('../NEOSY...
//return openwindow('EXECUTE\r\MEDIA\r\OPENMATERIAL',scheduleno+'.'+materialletter) /* params=new Object() params.scheduleno=scheduleno params.materialletter=materialletter neosysshowmodaldialog('../NEOSYS/upload.htm',params) */ //images are not stored per dataset at the mom...
identifier_body
users.js
// © 2000 NEOSYS Software Ltd. All Rights Reserved.//**Start Encode** function form_postinit() { //enable/disable password changing button neosyssetexpression('button_password', 'disabled', '!gusers_authorisation_update&&gkey!=gusername') //force retrieval of own record if (gro.dictitem('USER...
) { //if change own password then login with the new one //otherwise cannot continue/unlock document so the lock hangs if (gtasks_newpassword) db.login(gusername, gtasks_newpassword) gtasks_newpassword = false //to avoid need full login to get new font/colors neosyssetcookie(glogincode...
orm_postwrite(
identifier_name
drmaa_wrapper.py
", working_directory), ): if parameter: tmpfile.write( "#%s=%s\n" % (title, parameter)) tmpfile.write( cmd_str + "\n" ) tmpfile.close() job_script_path = os.path.abspath( tmpfile.name ) stdout_path = job_script_path + ".stdout" stderr_path = job_script_path + ".stderr...
touch_output_files
identifier_name
drmaa_wrapper.py
session, or the module shared drmaa session """ import drmaa # # used specified session else module session # if drmaa_session is None: raise error_drmaa_job( "Please specify a drmaa_session in run_job()") # # make job template # job_template = setup_drmaa_job( drm...
output_files[i:i + 1] = output_files[i]
conditional_block
drmaa_wrapper.py
*errmsg): Exception.__init__(self, *errmsg) #_________________________________________________________________________________________ # read_stdout_stderr_from_files #_________________________________________________________________________________________ def read_stdout_stderr_from_files( stdout_path...
# separate stdout and stderr job_template.joinFiles=False return job_template #_________________________________________________________________________________________ # write_job_script_to_temp_file #_________________________________________________________________________________________ def writ...
job_template = drmaa_session.createJobTemplate() if not working_directory: job_template.workingDirectory = os.getcwd() else: job_template.workingDirectory = working_directory if job_environment: # dictionary e.g. { 'BASH_ENV' : '~/.bashrc' } job_template.jobEnvironment = job...
identifier_body
drmaa_wrapper.py
#_________________________________________________________________________________________ class error_drmaa_job(Exception): """ All exceptions throw in this module """ def __init__(self, *errmsg): Exception.__init__(self, *errmsg) #____________________________________________________________...
#_________________________________________________________________________________________ # error_drmaa_job
random_line_split
class-inheritance-inner-class.js
/* Copyright JS Foundation and other contributors, http://js.foundation * * 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 r...
() { assert (super.f () === 5); class G { g () { assert (super.f === undefined); assert (super.toString () === "[object Object]"); var a = super.valueOf (); try { a (); assert (false); } catch (e) { assert (e instanceof TypeError); ...
f
identifier_name
class-inheritance-inner-class.js
/* Copyright JS Foundation and other contributors, http://js.foundation * * 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 r...
var a = super.valueOf (); try { a (); assert (false); } catch (e) { assert (e instanceof TypeError); } } constructor () { // Test to overwrite the current lit-object console.assert (Object.getPrototypeOf (this) === G.prototype); ...
g () { assert (super.f === undefined); assert (super.toString () === "[object Object]");
random_line_split
fields.py
# gazetteer.fields # Copyright 2016, James Humphry # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This progr...
(self, field_name, sql_name='', nullable=True): self.field_name = field_name if sql_name == '': self.sql_name = field_name.lower().replace(' ', '_') else: self.sql_name = sql_name self.nullable = nullable def generate_sql(self): '''Return the SQL desc...
__init__
identifier_name
fields.py
# gazetteer.fields # Copyright 2016, James Humphry # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This progr...
return self.sql_name + ' CHARACTER VARYING({})'.format(self.width) else: return self.sql_name + ' CHARACTER VARYING({})'.format(self.width)\ + ' NOT NULL' class DateField(GazetteerField): '''A gazetteer field corresponding to the SQL type DATE.''' sql_type_name = ...
def generate_sql(self): if self.nullable:
random_line_split
fields.py
# gazetteer.fields # Copyright 2016, James Humphry # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This progr...
else: return self.sql_name + ' ' + self.sql_type_name + ' NOT NULL' class BigIntField(GazetteerField): '''A gazetteer field corresponding to the SQL type BIGINT.''' sql_type_name = 'BIGINT' class IntegerField(GazetteerField): '''A gazetteer field corresponding to the SQL type INTEG...
return self.sql_name + ' ' + self.sql_type_name
conditional_block
fields.py
# gazetteer.fields # Copyright 2016, James Humphry # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This progr...
def generate_sql(self): '''Return the SQL describing a field of this sort, suitable for inclusion in a CREATE TABLE statement''' if self.nullable: return self.sql_name + ' ' + self.sql_type_name else: return self.sql_name + ' ' + self.sql_type_name + ' NOT N...
self.field_name = field_name if sql_name == '': self.sql_name = field_name.lower().replace(' ', '_') else: self.sql_name = sql_name self.nullable = nullable
identifier_body
pdf.d.ts
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this perm...
interface PDFProgressData { loaded: number; total: number; } interface PDFDocumentProxy { /** * Total number of pages the PDF contains. **/ numPages: number; /** * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] **/ fingerprint: string; /** * True if embedded doc...
}
random_line_split
TemperatureResponseSensors.spec.js
/** * Samsara API * * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use t...
factory(require('expect.js'), require('../../src/index')); } else { // Browser globals (root is window) factory(root.expect, root.SamsaraApi); } }(this, function(expect, SamsaraApi) { 'use strict'; var instance; beforeEach(function() { instance = new SamsaraApi.TemperatureResponseSensors(); ...
define(['expect.js', '../../src/index'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node.
random_line_split
TemperatureResponseSensors.spec.js
/** * Samsara API * * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use t...
else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. factory(require('expect.js'), require('../../src/index')); } else { // Browser globals (root is window) factory(root.expect, root.SamsaraApi); } }(this, function(expect, Sa...
{ // AMD. define(['expect.js', '../../src/index'], factory); }
conditional_block
contextmenu.ts
import * as nls from 'vs/nls'; import {IAction} from 'vs/base/common/actions'; import {KeyCode, KeyMod, Keybinding} from 'vs/base/common/keyCodes'; import {IDisposable, dispose} from 'vs/base/common/lifecycle'; import {SortedList} from 'vs/base/common/sortedList'; import {TPromise} from 'vs/base/common/winjs.base'; imp...
}, getActionItem: (action) => { var keybinding = this._keybindingFor(action); if (keybinding) { return new ActionItem(action, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) }); } var customActionItem = <any>action; if (typeof customActionItem.getAction...
return TPromise.as(actions);
random_line_split
contextmenu.ts
import * as nls from 'vs/nls'; import {IAction} from 'vs/base/common/actions'; import {KeyCode, KeyMod, Keybinding} from 'vs/base/common/keyCodes'; import {IDisposable, dispose} from 'vs/base/common/lifecycle'; import {SortedList} from 'vs/base/common/sortedList'; import {TPromise} from 'vs/base/common/winjs.base'; imp...
} return sortedAndGroupedActions; } private _doShowContextMenu(actions:IAction[], forcedPosition:IPosition = null): void { // Make the editor believe one of its widgets is focused this._editor.beginForcedWidgetFocus(); // Disable hover var oldHoverSetting = this._editor.getConfiguration().hover; th...
{ sortedAndGroupedActions.push(new Separator()); }
conditional_block
contextmenu.ts
import * as nls from 'vs/nls'; import {IAction} from 'vs/base/common/actions'; import {KeyCode, KeyMod, Keybinding} from 'vs/base/common/keyCodes'; import {IDisposable, dispose} from 'vs/base/common/lifecycle'; import {SortedList} from 'vs/base/common/sortedList'; import {TPromise} from 'vs/base/common/winjs.base'; imp...
(forcedPosition?:IPosition): void { if (!this._editor.getConfiguration().contextmenu) { return; // Context menu is turned off through configuration } if (!this.contextMenuService) { this._editor.focus(); return; // We need the context menu service to function } var position = this._editor.getPositi...
showContextMenu
identifier_name
new-impl-syntax.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::fmt; struct Thingy { x: isize, y: isize } impl fmt::Debug for Thingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ...
// 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
random_line_split
new-impl-syntax.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 ...
{ x: isize, y: isize } impl fmt::Debug for Thingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y) } } struct PolymorphicThingy<T> { x: T } impl<T:fmt::Debug> fmt::Debug for PolymorphicThingy<T> { fn fmt(&self, f: &mut fmt::...
Thingy
identifier_name
new-impl-syntax.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 ...
} struct PolymorphicThingy<T> { x: T } impl<T:fmt::Debug> fmt::Debug for PolymorphicThingy<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.x) } } pub fn main() { println!("{:?}", Thingy { x: 1, y: 2 }); println!("{:?}", PolymorphicThingy { x: Thingy { x...
{ write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y) }
identifier_body
0048_ramp.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-17 19:24 from __future__ import unicode_literals import c3nav.mapdata.fields from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ ('mapdata', '0047_remove_mapupdate_changed_geometries'), ] operations = [ migrations.CreateModel( name='Ramp', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_nam...
Migration
identifier_name
0048_ramp.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-17 19:24 from __future__ import unicode_literals import c3nav.mapdata.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
}, ), ]
dependencies = [ ('mapdata', '0047_remove_mapupdate_changed_geometries'), ] operations = [ migrations.CreateModel( name='Ramp', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('m...
identifier_body
0048_ramp.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-17 19:24 from __future__ import unicode_literals import c3nav.mapdata.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
dependencies = [ ('mapdata', '0047_remove_mapupdate_changed_geometries'), ] operations = [ migrations.CreateModel( name='Ramp', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
random_line_split
whois_distance.py
.whois import * import dateutil.parser import config.settings as settings from peewee import * import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures import sys import argparse import os import json import time import warnings warnings.filterwarnings("i...
# ttl by proportion, more close tu cero, more close is the ttl def get_diff_ttl(creation_date_a, creation_date_b,expiration_date_a, expiration_date_b): if not creation_date_a and not creation_date_b and not expiration_date_a and not expiration_date_a: return float(0) elif not creation_date_a and not cr...
try: return datetime.datetime.strptime(date, '%d-%m-%Y') \ if not isinstance(date, datetime.datetime) else date except Exception as ex: return dateutil.parser.parse(date)
identifier_body
whois_distance.py
# for copying permission. # import Levenshtein import datetime from tld import get_tld import pprint as pp import pythonwhois from pythonwhois.shared import WhoisException from contextlib import contextmanager from collections import Iterable from passivetotal.common.utilities import is_ip import re from passivetotal....
# # You should have received a copy of the GNU Affero General Public License # along with this program. See the file 'docs/LICENSE' or see <http://www.gnu.org/licenses/>
random_line_split
whois_distance.py
.whois import * import dateutil.parser import config.settings as settings from peewee import * import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures import sys import argparse import os import json import time import warnings warnings.filterwarnings("i...
(emails_a=[], emails_b=[]): emails_seed = emails_a.split(',') if not isinstance(emails_a, list) else emails_a emails_file = emails_b.split(',') if not isinstance(emails_b, list) else emails_b if not emails_seed and not emails_file: return float(0) elif not emails_seed: emails_seed = ['']...
get_diff_emails_by_min_dist
identifier_name
whois_distance.py
.whois import * import dateutil.parser import config.settings as settings from peewee import * import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures import sys import argparse import os import json import time import warnings warnings.filterwarnings("i...
elif not orgs_file: orgs_file = [''] dist_org = __levenshtein__(str(orgs_seed[0]), str(orgs_file[0])) for org_s in orgs_seed: org_s = org_s.encode('utf-8') for org_f in orgs_file: org_f = org_f.encode('utf-8') dist_org = min(str(dist_org), str(__levenshtein_...
orgs_seed = ['']
conditional_block
action-hub.component.ts
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { SkyActionHubNeedsAttention } from './types/action-hub-needs-attention'; import { SkyPageLink } from './types/page-link'; import { SkyRecentLink } from './types/recent-link'; /** * Creates an action hub to direct user attention to imp...
( relatedLinks: SkyPageLink[] | 'loading' ): SkyPageLink[] | 'loading' { if (relatedLinks === 'loading') { return 'loading'; } if (!relatedLinks || relatedLinks.length === 0) { return []; } return relatedLinks.slice(0).sort((a, b) => { const aLabel = a.label.trim().toUpperCas...
getRelatedLinksSorted
identifier_name
action-hub.component.ts
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { SkyActionHubNeedsAttention } from './types/action-hub-needs-attention'; import { SkyPageLink } from './types/page-link'; import { SkyRecentLink } from './types/recent-link'; /** * Creates an action hub to direct user attention to imp...
* Provides a list of recently accessed links, or `"loading"` to display a wait indicator. */ @Input() public recentLinks: SkyRecentLink[] | 'loading' = []; /** * Provides a list of related links, or `"loading"` to display a wait indicator. */ @Input() public relatedLinks: SkyPageLink[] | 'loading...
/**
random_line_split
action-hub.component.ts
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { SkyActionHubNeedsAttention } from './types/action-hub-needs-attention'; import { SkyPageLink } from './types/page-link'; import { SkyRecentLink } from './types/recent-link'; /** * Creates an action hub to direct user attention to imp...
return aLabel < bLabel ? -1 : 1; }); } }
{ return 0; }
conditional_block
get.gen.spec.js
var falcor = require("./../../../lib/"); var Model = falcor.Model; var expect = require('chai').expect; describe('getVersionSync', function() { it('should get a version', function() { var model = new Model({cache: {hello: 'world'}}); model._root.unsafeMode = true; var version = model.getVer...
it('should get -1 if no path exists.', function() { var model = new Model({cache: {hello: 'world'}}); model._root.unsafeMode = true; var version = model.getVersion('world'); expect(version === -1).to.be.ok; }); });
var model = new Model({cache: {hello: 'world'}, unsafeMode: true}); var version = model.getVersion(); expect(version >= 0).to.be.ok; });
random_line_split
mn.rs
extern crate cpr; extern crate scoped_threadpool; extern crate getopts; extern crate bio; extern crate num_cpus; extern crate time; use std::env; use cpr::cpr; use getopts::Options; use std::path::Path; use bio::io::fasta::Reader; use scoped_threadpool::Pool; use std::io::prelude::*; use std::io::{BufReader, BufWriter...
let mtchs = match opts.parse(&args[1 ..]) { Ok(mtch) => {mtch} Err(fl) => {prnt_usg(&prgrm, &opts); panic!(fl.to_string())} }; if mtchs.opt_present("h") { prnt_usg(&prgrm, &opts); return; } let i = mtchs.opt_str("i").expect("Failed to retrieve input file from command args."); let o = mtchs.o...
opts.optopt("t", "", "# of threads in multithreading (Default: system val.)", "UINT"); opts.optflag("a", "", "Approximate estimation"); opts.optflag("h", "help", "Print help menu");
random_line_split
mn.rs
extern crate cpr; extern crate scoped_threadpool; extern crate getopts; extern crate bio; extern crate num_cpus; extern crate time; use std::env; use cpr::cpr; use getopts::Options; use std::path::Path; use bio::io::fasta::Reader; use scoped_threadpool::Pool; use std::io::prelude::*; use std::io::{BufReader, BufWriter...
{ let nw = now(); format!("{}-{}-{}-{}:{}:{}", nw.tm_year + 1900, nw.tm_mon + 1, nw.tm_mday, nw.tm_hour, nw.tm_min, nw.tm_sec) }
identifier_body
mn.rs
extern crate cpr; extern crate scoped_threadpool; extern crate getopts; extern crate bio; extern crate num_cpus; extern crate time; use std::env; use cpr::cpr; use getopts::Options; use std::path::Path; use bio::io::fasta::Reader; use scoped_threadpool::Pool; use std::io::prelude::*; use std::io::{BufReader, BufWriter...
Err(fl) => {prnt_usg(&prgrm, &opts); panic!(fl.to_string())} }; if mtchs.opt_present("h") { prnt_usg(&prgrm, &opts); return; } let i = mtchs.opt_str("i").expect("Failed to retrieve input file from command args."); let o = mtchs.opt_str("o").expect("Failed to retrieve output file from command args...
{mtch}
conditional_block
mn.rs
extern crate cpr; extern crate scoped_threadpool; extern crate getopts; extern crate bio; extern crate num_cpus; extern crate time; use std::env; use cpr::cpr; use getopts::Options; use std::path::Path; use bio::io::fasta::Reader; use scoped_threadpool::Pool; use std::io::prelude::*; use std::io::{BufReader, BufWriter...
() { let args = env::args().collect::<Vec<Arg>>(); let prgrm = args[0].clone(); let mut opts = Options::new(); opts.reqopt("i", "", "Input RNA seqs in single file of FASTA format", "STR"); opts.reqopt("o", "", "Output prob. dist. seqs in single file of tabular format", "STR"); opts.optopt("m", "", &format!(...
main
identifier_name
categoryslider.js
function createCategorySlider(selector) { $(document).ready(function(){ var checkforloadedcats = []; var firstImage = $(selector).find('img').filter(':first'); if(firstImage.length > 0){ checkforloadedcats[selector] = setInterval(function() { var image = firstImage.get(0); if (image.complete || i...
else if($('#center_column').width()>=963){ $(selector).data('flexslider').setOpts({minItems: grid_size_md, maxItems: grid_size_md});} } catch(e) { // handle all your exceptions here } }); }); }
{ $(selector).data('flexslider').setOpts({minItems: grid_size_lg, maxItems: grid_size_lg});}
conditional_block
categoryslider.js
function createCategorySlider(selector) { $(document).ready(function(){ var checkforloadedcats = []; var firstImage = $(selector).find('img').filter(':first'); if(firstImage.length > 0){ checkforloadedcats[selector] = setInterval(function() { var image = firstImage.get(0); if (image.complete || i...
// handle all your exceptions here } }); }); }
else if($('#center_column').width()>=963){ $(selector).data('flexslider').setOpts({minItems: grid_size_md, maxItems: grid_size_md});} } catch(e) {
random_line_split
categoryslider.js
function createCategorySlider(selector)
maxItems: flexmax, move: 0 }); } }, 20); } $(window).resize(function() { try { $(selector).flexslider(0); if($('#center_column').width()<=280){ $(selector).data('flexslider').setOpts({minItems: 1, maxItems: 1}); } else if($('#center_column').width()<=440){ $(select...
{ $(document).ready(function(){ var checkforloadedcats = []; var firstImage = $(selector).find('img').filter(':first'); if(firstImage.length > 0){ checkforloadedcats[selector] = setInterval(function() { var image = firstImage.get(0); if (image.complete || image.readyState == 'complete' || image.re...
identifier_body
categoryslider.js
function
(selector) { $(document).ready(function(){ var checkforloadedcats = []; var firstImage = $(selector).find('img').filter(':first'); if(firstImage.length > 0){ checkforloadedcats[selector] = setInterval(function() { var image = firstImage.get(0); if (image.complete || image.readyState == 'complete'...
createCategorySlider
identifier_name
rlperrors.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
impl StdError for DecoderError { fn description(&self) -> &str { "builder error" } } impl fmt::Display for DecoderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self, f) } } impl From<FromBytesError> for DecoderError { fn from(err: FromBytesError) -> DecoderError { Decoder...
random_line_split
rlperrors.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self, f) } } impl From<FromBytesError> for DecoderError { fn from(err: FromBytesError) -> DecoderError { DecoderError::FromBytesError(err) } }
fmt
identifier_name
rlperrors.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
}
{ DecoderError::FromBytesError(err) }
identifier_body
ConfigureProjectModal.tsx
import React from 'react'; import { AccountService, IAccount } from 'core/account'; import { ApplicationReader, IApplicationSummary } from 'core/application'; import { IProject } from 'core/domain'; import { WizardModal, WizardPage } from 'core/modal'; import { IModalComponentProps, ReactModal } from 'core/presentatio...
}; public render() { const { dismissModal, projectConfiguration } = this.props; const { allAccounts, allApplications, allProjects, loading, taskMonitor } = this.state; const appNames = allApplications.map((app) => app.name); return ( <WizardModal<IProject> closeModal={this.submit} ...
{ const taskMonitor = new TaskMonitor({ title: 'Deleting Project', modalInstance: TaskMonitor.modalInstanceEmulation(() => this.props.closeModal({ name, action: 'delete' })), }); this.setState({ taskMonitor }); taskMonitor.submit(() => ProjectWriter.deleteProject(projectConfigu...
conditional_block
ConfigureProjectModal.tsx
import React from 'react'; import { AccountService, IAccount } from 'core/account'; import { ApplicationReader, IApplicationSummary } from 'core/application'; import { IProject } from 'core/domain'; import { WizardModal, WizardPage } from 'core/modal'; import { IModalComponentProps, ReactModal } from 'core/presentatio...
this.setState({ taskMonitor }); taskMonitor.submit(() => ProjectWriter.deleteProject(projectConfiguration)); } }; public render() { const { dismissModal, projectConfiguration } = this.props; const { allAccounts, allApplications, allProjects, loading, taskMonitor } = this.state; const ...
});
random_line_split
ConfigureProjectModal.tsx
import React from 'react'; import { AccountService, IAccount } from 'core/account'; import { ApplicationReader, IApplicationSummary } from 'core/application'; import { IProject } from 'core/domain'; import { WizardModal, WizardPage } from 'core/modal'; import { IModalComponentProps, ReactModal } from 'core/presentatio...
(props?: IConfigureProjectModalProps): Promise<any> { const modalProps = { dialogClassName: 'wizard-modal modal-lg' }; if (props) { return ReactModal.show(ConfigureProjectModal, props, modalProps); } const title = 'Create Project'; const projectConfiguration = { config: { applic...
show
identifier_name
ConfigureProjectModal.tsx
import React from 'react'; import { AccountService, IAccount } from 'core/account'; import { ApplicationReader, IApplicationSummary } from 'core/application'; import { IProject } from 'core/domain'; import { WizardModal, WizardPage } from 'core/modal'; import { IModalComponentProps, ReactModal } from 'core/presentatio...
private submit = (project: IProject) => { const { name } = project; const taskMonitor = new TaskMonitor({ title: 'Updating Project', modalInstance: TaskMonitor.modalInstanceEmulation(() => this.props.closeModal({ name, action: 'upsert' })), }); this.setState({ taskMonitor }); taskM...
{ this.initialFetch().then(() => this.setState({ loading: false })); }
identifier_body
dao.py
#!/usr/bin/python # -*- coding: UTF-8 -*- from datetime import datetime from stacosys.model.comment import Comment TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def find_comment_by_id(id): return Comment.get_by_id(id) def notify_comment(comment: Comment): comment.notified = datetime.now().strftime(TIME_FORMAT) co...
(url): return Comment.select(Comment).where((Comment.url == url) & (Comment.published.is_null(False))).order_by( +Comment.published) def count_published_comments(url): return Comment.select(Comment).where( (Comment.url == url) & (Comment.published.is_null(False))).count() if url else Comment.s...
find_published_comments_by_url
identifier_name
dao.py
#!/usr/bin/python # -*- coding: UTF-8 -*- from datetime import datetime from stacosys.model.comment import Comment TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def find_comment_by_id(id): return Comment.get_by_id(id) def notify_comment(comment: Comment): comment.notified = datetime.now().strftime(TIME_FORMAT) co...
def create_comment(url, author_name, author_site, author_gravatar, message): created = datetime.now().strftime("%Y-%m-%d %H:%M:%S") comment = Comment( url=url, author_name=author_name, author_site=author_site, author_gravatar=author_gravatar, content=message, c...
return Comment.select(Comment).where( (Comment.url == url) & (Comment.published.is_null(False))).count() if url else Comment.select(Comment).where( Comment.published.is_null(False)).count()
identifier_body
dao.py
from stacosys.model.comment import Comment TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def find_comment_by_id(id): return Comment.get_by_id(id) def notify_comment(comment: Comment): comment.notified = datetime.now().strftime(TIME_FORMAT) comment.save() def publish_comment(comment: Comment): comment.publis...
#!/usr/bin/python # -*- coding: UTF-8 -*- from datetime import datetime
random_line_split
streaming_graph.ts
// Simple class for returning a time a window to use for a domain. Caches the // value from the last call to domain if all calls need to be synced to the same // time. export class TimeWindow { public cached: any[]; public windowMillis: number; constructor(windowMillis: number) { this.windowMillis = windowMi...
} // Filter the dataset to remove any points outside the window to display. // mainly for memory conservation. // TODO(ckitagawa): Consider making the identity function more aggressive in // filtering. public filter(filter: (dataset: any[]) => any[]): void { this._filter = filter; } private _filt...
{ this.dataUpdate(); }
conditional_block
streaming_graph.ts
// Simple class for returning a time a window to use for a domain. Caches the // value from the last call to domain if all calls need to be synced to the same // time. export class TimeWindow { public cached: any[]; public windowMillis: number; constructor(windowMillis: number) { this.windowMillis = windowMi...
this.dataUpdate(); } return this; } return super.data(); } // Append a single datum to the dataset. public addData(datum: any): void { super.data(this._filter(super.data())); const data = super.data(); data.push(datum); super.data(data); if (this.dataUpdate) { ...
if (data) { super.data(this._filter(data)); if (this.dataUpdate) {
random_line_split
streaming_graph.ts
// Simple class for returning a time a window to use for a domain. Caches the // value from the last call to domain if all calls need to be synced to the same // time. export class TimeWindow { public cached: any[]; public windowMillis: number; constructor(windowMillis: number) { this.windowMillis = windowMi...
(): number { return this.cached[0]; } // Method to make getting the end nicer. public end(): number { return this.cached[1]; } } // Decorator class to make a Plottable.Scale have dynamically updating domain. export class WindowedScale extends Plottable.Scales.Linear { public domainUpdater: (domain: any[]) => nu...
begin
identifier_name
streaming_graph.ts
// Simple class for returning a time a window to use for a domain. Caches the // value from the last call to domain if all calls need to be synced to the same // time. export class TimeWindow { public cached: any[]; public windowMillis: number; constructor(windowMillis: number) { this.windowMillis = windowMi...
// Updates the domain. public domain(): number[]; public domain(domain: any[]): Plottable.QuantitativeScale<number>; public domain(domain?: any[]): number[]|Plottable.QuantitativeScale<number> { if (domain) { return super.domain(domain); } else if (this.domainUpdater) { super.domain(this.d...
{ super(); this.domainUpdater = domainUpdater; }
identifier_body
repr-transparent-aggregates-2.rs
// Copyright 2017 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 ...
(_: BigUw) -> BigUw { loop {} }
test_BigUw
identifier_name
repr-transparent-aggregates-2.rs
// Copyright 2017 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 ...
#![crate_type="lib"] #[repr(C)] pub struct Big([u32; 16]); #[repr(transparent)] pub struct BigW(Big); // CHECK: define void @test_Big(%Big* [[BIG_RET_ATTRS:.*]], [16 x i32] #[no_mangle] pub extern fn test_Big(_: Big) -> Big { loop {} } // CHECK: define void @test_BigW(%BigW* [[BIG_RET_ATTRS]], [16 x i32] #[no_man...
// ignore-x86_64 // See repr-transparent.rs
random_line_split
repr-transparent-aggregates-2.rs
// Copyright 2017 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 ...
{ loop {} }
identifier_body
regex_with_defaults.py
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods. Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.) See [regex_search_hack.md](https://gist.github.com/thorwhalen/6c913e9be35873cea6efaf6b962fde07) for more explanato...
(*args, **kwargs): result = func(*args, **kwargs) if result is not None: return result else: if callable(dflt_if_none): return dflt_if_none() else: return dflt_if_none return wrapped_func def re_compile(pattern, flags=0, ...
wrapped_func
identifier_name
regex_with_defaults.py
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods. Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.) See [regex_search_hack.md](https://gist.github.com/thorwhalen/6c913e9be35873cea6efaf6b962fde07) for more explanato...
else: if callable(dflt_if_none): return dflt_if_none() else: return dflt_if_none return wrapped_func def re_compile(pattern, flags=0, **dflt_if_none): """Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's ...
return result
conditional_block
regex_with_defaults.py
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods. Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.) See [regex_search_hack.md](https://gist.github.com/thorwhalen/6c913e9be35873cea6efaf6b962fde07) for more explanato...
['bush'] """ compiled_regex = re.compile(pattern, flags=flags) intercepted_names = set(dflt_if_none) my_regex_compilation = type('MyRegexCompilation', (object,), {})() for _name, _dflt in dflt_if_none.items(): setattr(my_regex_compilation, _name, add_dflt(getattr(compiled_regex, _name)...
>>> p.findall('I am beating around the bush, am I?')
random_line_split
regex_with_defaults.py
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods. Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.) See [regex_search_hack.md](https://gist.github.com/thorwhalen/6c913e9be35873cea6efaf6b962fde07) for more explanato...
""" compiled_regex = re.compile(pattern, flags=flags) intercepted_names = set(dflt_if_none) my_regex_compilation = type('MyRegexCompilation', (object,), {})() for _name, _dflt in dflt_if_none.items(): setattr(my_regex_compilation, _name, add_dflt(getattr(compiled_regex, _name), _dflt)) ...
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods. Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.) Example; >>> dflt_result = type('dflt_search_result', (), {'groupdict': lambda x: {}})() >>> p = r...
identifier_body
RelationOptions.d.ts
import { OnDeleteType } from "../../metadata/types/OnDeleteType"; /** * Describes all relation's options. */ export interface RelationOptions { /** * If set to true then it means that related object can be allowed to be inserted / updated / removed to the db. * This is option a shortcut if you would lik...
* Database cascade action on delete. */ onDelete?: OnDeleteType; /** * Indicates if this relation will be a primary key. * Can be used only for many-to-one and owner one-to-one relations. */ primary?: boolean; /** * Set this relation to be lazy. Note: lazy relations are pro...
*/ nullable?: boolean; /**
random_line_split
editorsObserver.ts
/** * A observer of opened editors across all editor groups by most recently used. * Rules: * - the last editor in the list is the one most recently activated * - the first editor in the list is the one that was activated the longest time ago * - an editor that opens inactive will be placed behind the currently ac...
index: number; }
random_line_split
editorsObserver.ts
this.addMostRecentEditor(group, e.editor, this.editorGroupsService.activeGroup === group, false /* editor already opened */); } break; } // Editor opens: put it as second most recent // // Also check for maximum allowed number of editors and // start to close oldest ones if needed. ...
{ if (this.mostRecentEditorsMap.isEmpty()) { this.storageService.remove(EditorsObserver.STORAGE_KEY, StorageScope.WORKSPACE); } else { this.storageService.store(EditorsObserver.STORAGE_KEY, JSON.stringify(this.serialize()), StorageScope.WORKSPACE, StorageTarget.MACHINE); } }
identifier_body