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 |
|---|---|---|---|---|
Player.js | export default class | extends Phaser.Sprite {
constructor(game) {
super(game, 0, 0, 'hero');
// enable physics for the player
this.game.physics.arcade.enableBody(this);
this.scale.setTo(1.1);
this.body.collideWorldBounds = true;
this.game.physics.arcade.enable(this);
// camera f... | Player | identifier_name |
Player.js | export default class Player extends Phaser.Sprite {
constructor(game) {
super(game, 0, 0, 'hero');
// enable physics for the player
this.game.physics.arcade.enableBody(this);
this.scale.setTo(1.1);
this.body.collideWorldBounds = true;
this.game.physics.arcade.enable(... | this.animations.stop();
}
}
} | this.body.velocity.y = 0;
}
if (this.body.velocity.x === 0 && this.body.velocity.y === 0) { | random_line_split |
Player.js | export default class Player extends Phaser.Sprite {
constructor(game) {
super(game, 0, 0, 'hero');
// enable physics for the player
this.game.physics.arcade.enableBody(this);
this.scale.setTo(1.1);
this.body.collideWorldBounds = true;
this.game.physics.arcade.enable(... |
}
| {
this.body.velocity.x = 0;
this.body.velocity.y = 0;
// player moves in specified direction or stands still
if (this.cursors.left.isDown) {
this.animations.play("walk-left");
this.body.velocity.x =- 180;
} else if (this.cursors.right.isDown) {
... | identifier_body |
Player.js | export default class Player extends Phaser.Sprite {
constructor(game) {
super(game, 0, 0, 'hero');
// enable physics for the player
this.game.physics.arcade.enableBody(this);
this.scale.setTo(1.1);
this.body.collideWorldBounds = true;
this.game.physics.arcade.enable(... |
}
}
| {
this.animations.stop();
} | conditional_block |
lambda-proxy.ts | export interface Event {
resource?: string;
path: string;
httpMethod: string;
headers: EventHeaders;
queryStringParameters?: EventQueryStringParameters;
pathParameters?: EventPathParameters;
stageVariables?: EventStageVariables;
requestContext?: {
accountId: string;
resourceId: string;
stage... | accessKey: string;
cognitoAuthenticationType: string;
cognitoAuthenticationProvider: string;
userArn: string;
userAgent: string;
user: string;
}
resourcePath: string;
httpMethod: string;
apiId: string;
};
isBase64Encoded?: boolean;
body?: string;
}
export inter... | sourceIp: string, | random_line_split |
youtube-player.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="youtube" />
import {... |
// An observable of the currently loaded player.
const playerObs =
createPlayerObservable(
this._youtubeContainer,
this._videoId,
iframeApiAvailableObs,
this._width,
this._height,
this._playerVars,
this._ngZone
).pipe(tap(player => {
... | {
if (this.showBeforeIframeApiLoads) {
throw new Error('Namespace YT not found, cannot construct embedded youtube player. ' +
'Please install the YouTube Player API Reference for iframe Embeds: ' +
'https://developers.google.com/youtube/iframe_api_reference');
}
const ... | conditional_block |
youtube-player.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="youtube" />
import {... | (
youtubeContainer: Observable<HTMLElement>,
videoIdObs: Observable<string | undefined>,
iframeApiAvailableObs: Observable<boolean>,
widthObs: Observable<number>,
heightObs: Observable<number>,
playerVarsObs: Observable<YT.PlayerVars | undefined>,
ngZone: NgZone
): Observable<UninitializedPlayer | undefin... | createPlayerObservable | identifier_name |
youtube-player.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="youtube" />
import {... | return newPlayer;
}
/**
* Call cueVideoById if the videoId changes, or when start or end seconds change. cueVideoById will
* change the loaded video id to the given videoId, and set the start and end times to the given
* start/end seconds.
*/
function bindCueVideoCall(
playerObs: Observable<Player | undefined>... | random_line_split | |
youtube-player.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="youtube" />
import {... |
/** See https://developers.google.com/youtube/iframe_api_reference#getVideoLoadedFraction */
getVideoLoadedFraction(): number {
return this._player ? this._player.getVideoLoadedFraction() : 0;
}
/** See https://developers.google.com/youtube/iframe_api_reference#getPlayerState */
getPlayerState(): YT.Pl... | {
return this._player ? this._player.getAvailablePlaybackRates() : [];
} | identifier_body |
lib.rs | /* 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/. */
/// A random number generator which shares one instance of an `OsRng`.
///
/// A problem with `OsRng`, which is i... | {
rng: Rc<RefCell<ServoRng>>,
}
// A thread-local RNG, designed as a drop-in replacement for rand::thread_rng.
pub fn thread_rng() -> ServoThreadRng {
SERVO_THREAD_RNG.with(|t| t.clone())
}
thread_local! {
static SERVO_THREAD_RNG: ServoThreadRng = ServoThreadRng { rng: Rc::new(RefCell::new(ServoRng::new(... | ServoThreadRng | identifier_name |
lib.rs | /* 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/. */
/// A random number generator which shares one instance of an `OsRng`.
///
/// A problem with `OsRng`, which is i... | {
let mut bytes = [0; 16];
thread_rng().fill_bytes(&mut bytes);
Uuid::from_random_bytes(bytes)
} | identifier_body | |
lib.rs | /* 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/. */
/// A random number generator which shares one instance of an `OsRng`.
///
/// A problem with `OsRng`, which is i... | #[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
#[cfg(target_pointer_width = "64")]
use rand::isaac::Isaac64Rng as IsaacWordRng;
#[cfg(target_pointer_width = "32")]
use rand::isaac::IsaacRng as IsaacWordRng;
use rand::os::OsRng;
use rand::reseeding::{Reseeder, ReseedingRng};
pub use rand::{Rand, ... | random_line_split | |
widgets.py | # Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib... |
def render(self, name, value, attrs=None):
if value is None: value = ''
value = smart_unicode(value)
final_attrs = self.build_attrs(attrs)
final_attrs['name'] = name
assert 'id' in final_attrs, "TinyMCE widget attributes must contain 'id'"
mce_config = tinymce.sett... | super(TinyMCE, self).__init__(attrs)
self.mce_attrs = mce_attrs
if content_language is None:
content_language = mce_attrs.get('language', None)
self.content_language = content_language | identifier_body |
widgets.py | # Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib... | (self, name, value, attrs=None):
if value is None: value = ''
value = smart_unicode(value)
final_attrs = self.build_attrs(attrs)
final_attrs['name'] = name
assert 'id' in final_attrs, "TinyMCE widget attributes must contain 'id'"
mce_config = tinymce.settings.DEFAULT_CON... | render | identifier_name |
widgets.py | # Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib... |
else:
default = ''
sp_langs.append(u'%s%s=%s' % (default, ' / '.join(names), lang))
config['spellchecker_languages'] = ','.join(sp_langs)
if content_language in settings.LANGUAGES_BIDI:
config['directionality'] = 'rtl'
else:
config['directionality'] = 'ltr'
... | default = '+' | conditional_block |
widgets.py | # Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib... |
In addition to the default settings from settings.TINYMCE_DEFAULT_CONFIG,
this widget sets the 'language', 'directionality' and
'spellchecker_languages' parameters by default. The first is derived from
the current Django language, the others from the 'content_language'
parameter.
"""
def _... | random_line_split | |
UserSettingsEditComponent.ts | import {Input, Component} from 'angular2/core';
import {Router, RouterLink, CanActivate} from 'angular2/router';
import {UserSettingsComponent} from '../userSettings/UserSettingsComponent';
import {UserSettingsService} from '../../shared/services/UserSettingsService';
import {AuthService} from '../../shared/services/... | (): void {
this.userSettingsService.saveUserSettingsForUser(this.userName, this.userSettings)
.subscribe(data => {
this.alertingService.addSuccess('SAVE_USER_SETTINGS_SUCCESS_MESSAGE');
}, err => {
this.alertingService.addDanger('SAVE_USER_SETTINGS_ERROR_MESSAGE');
});
}
}
| saveUserSettings | identifier_name |
UserSettingsEditComponent.ts | import {Input, Component} from 'angular2/core';
import {Router, RouterLink, CanActivate} from 'angular2/router';
import {UserSettingsComponent} from '../userSettings/UserSettingsComponent';
import {UserSettingsService} from '../../shared/services/UserSettingsService';
import {AuthService} from '../../shared/services/... |
return isLogged;
}
)
export class UserSettingsEditComponent {
public userName: string;
public userSettings: UserSettings;
public userSettingsForJar: string;
constructor(
private alertingService: AlertingService,
private authService: AuthService,
private userSettingsService: UserSettingsServi... | {
router.navigate(['/Login']);
} | conditional_block |
UserSettingsEditComponent.ts | import {Input, Component} from 'angular2/core';
import {Router, RouterLink, CanActivate} from 'angular2/router';
import {UserSettingsComponent} from '../userSettings/UserSettingsComponent';
import {UserSettingsService} from '../../shared/services/UserSettingsService';
import {AuthService} from '../../shared/services/... |
saveUserSettings(): void {
this.userSettingsService.saveUserSettingsForUser(this.userName, this.userSettings)
.subscribe(data => {
this.alertingService.addSuccess('SAVE_USER_SETTINGS_SUCCESS_MESSAGE');
}, err => {
this.alertingService.addDanger('SAVE_USER_SETTINGS_ERROR_MESSAGE');
... | {
this.userName = authService.getLoggedUser();
this.userSettingsService.getUserSettingsFor(this.userName)
.subscribe(data => this.userSettings = data);
this.userSettingsService.getUserSettingsForJar(this.userName)
.subscribe(data => this.userSettingsForJar = data);
} | identifier_body |
UserSettingsEditComponent.ts | import {Input, Component} from 'angular2/core';
import {Router, RouterLink, CanActivate} from 'angular2/router';
import {UserSettingsComponent} from '../userSettings/UserSettingsComponent';
import {UserSettingsService} from '../../shared/services/UserSettingsService';
import {AuthService} from '../../shared/services/... | constructor(
private alertingService: AlertingService,
private authService: AuthService,
private userSettingsService: UserSettingsService) {
this.userName = authService.getLoggedUser();
this.userSettingsService.getUserSettingsFor(this.userName)
.subscribe(data => this.userSettings = data);
... | random_line_split | |
XMLname.py | import re
from six import text_type
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <htt... |
retval = re.sub(r'_x[0-9A-Fa-f]{4}_', fun, retval)
return retval | retval = re.sub(r'_xFFFF_', '', string)
def fun(matchobj):
return _fromUnicodeHex(matchobj.group(0)) | random_line_split |
XMLname.py | import re
from six import text_type
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <htt... |
return u''.join(X)
def fromXMLname(string):
"""Convert XML name to unicode string."""
retval = re.sub(r'_xFFFF_', '', string)
def fun(matchobj):
return _fromUnicodeHex(matchobj.group(0))
retval = re.sub(r'_x[0-9A-Fa-f]{4}_', fun, retval)
return retval
| return "%s:%s" % (prefix, u''.join(X)) | conditional_block |
XMLname.py | import re
from six import text_type
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <htt... | """Convert XML name to unicode string."""
retval = re.sub(r'_xFFFF_', '', string)
def fun(matchobj):
return _fromUnicodeHex(matchobj.group(0))
retval = re.sub(r'_x[0-9A-Fa-f]{4}_', fun, retval)
return retval | identifier_body | |
XMLname.py | import re
from six import text_type
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <htt... | (matchobj):
return _fromUnicodeHex(matchobj.group(0))
retval = re.sub(r'_x[0-9A-Fa-f]{4}_', fun, retval)
return retval
| fun | identifier_name |
measure-inequality-filter.ts | /* | * 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 writing, software
* distributed... | random_line_split | |
measure-inequality-filter.ts | /*
* 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 writing, software
* distribu... | this.type = 'measure_inequality';
}
}
export enum InequalityType {
EQUAL_TO = 'EQUAL_TO',
GREATER_THAN = 'GREATER_THAN',
LESS_THAN = 'LESS_THAN',
EQUAL_GREATER_THAN = 'EQUAL_GREATER_THAN',
EQUAL_LESS_THAN = 'EQUAL_LESS_THAN',
}
| super();
| identifier_name |
channel.rs | use futures::channel::mpsc;
use futures::executor::block_on;
use futures::future::poll_fn;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
#[test]
fn sequence() {
let (tx, rx) = mpsc::channel(1);
let amt = 20;
let t = thread::spa... |
#[test]
fn drop_rx() {
let (mut tx, rx) = mpsc::channel::<u32>(1);
block_on(tx.send(1)).unwrap();
drop(rx);
assert!(block_on(tx.send(1)).is_err());
}
#[test]
fn drop_order() {
static DROPS: AtomicUsize = AtomicUsize::new(0);
let (mut tx, rx) = mpsc::channel(1);
struct A;
impl Drop f... | {
let (tx, mut rx) = mpsc::channel::<u32>(1);
drop(tx);
let f = poll_fn(|cx| rx.poll_next_unpin(cx));
assert_eq!(block_on(f), None)
} | identifier_body |
channel.rs | use futures::channel::mpsc;
use futures::executor::block_on;
use futures::future::poll_fn;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
#[test]
fn | () {
let (tx, rx) = mpsc::channel(1);
let amt = 20;
let t = thread::spawn(move || block_on(send_sequence(amt, tx)));
let list: Vec<_> = block_on(rx.collect());
let mut list = list.into_iter();
for i in (1..=amt).rev() {
assert_eq!(list.next(), Some(i));
}
assert_eq!(list.next(),... | sequence | identifier_name |
channel.rs | use futures::channel::mpsc;
use futures::executor::block_on;
use futures::future::poll_fn;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
#[test]
fn sequence() {
let (tx, rx) = mpsc::channel(1);
let amt = 20;
let t = thread::spa... | static DROPS: AtomicUsize = AtomicUsize::new(0);
let (mut tx, rx) = mpsc::channel(1);
struct A;
impl Drop for A {
fn drop(&mut self) {
DROPS.fetch_add(1, Ordering::SeqCst);
}
}
block_on(tx.send(A)).unwrap();
assert_eq!(DROPS.load(Ordering::SeqCst), 0);
drop... | }
#[test]
fn drop_order() { | random_line_split |
netconsole.py | from argparse import ArgumentParser
import socket
import struct
import sys
import threading
import time
from ._fakeds import FakeDS
__all__ = ["Netconsole", "main", "run"]
def _output_fn(s):
sys.stdout.write(
s.encode(sys.stdout.encoding, errors="replace").decode(sys.stdout.encoding)
)
sys.stdo... |
class Netconsole:
"""
Implements the 2018+ netconsole protocol
"""
TAG_ERROR = 11
TAG_INFO = 12
def __init__(self, printfn=_output_fn):
self.frames = {self.TAG_ERROR: self._onError, self.TAG_INFO: self._onInfo}
self.cond = threading.Condition()
self.sock = None
... | pass | identifier_body |
netconsole.py | from argparse import ArgumentParser
import socket
import struct
import sys
import threading
import time
from ._fakeds import FakeDS
__all__ = ["Netconsole", "main", "run"]
def _output_fn(s):
sys.stdout.write(
s.encode(sys.stdout.encoding, errors="replace").decode(sys.stdout.encoding)
)
sys.stdo... | (self):
print(".. connection dropped", file=sys.stderr)
self.sock.close()
with self.cond:
self.sockrfp = None
self.cond.notify_all()
def _keepAliveReady(self):
if not self.running:
return -1
elif not self.connected:
return -2
... | _connectionDropped | identifier_name |
netconsole.py | from argparse import ArgumentParser
import socket
import struct
import sys
import threading
import time
from ._fakeds import FakeDS
__all__ = ["Netconsole", "main", "run"]
def _output_fn(s):
sys.stdout.write(
s.encode(sys.stdout.encoding, errors="replace").decode(sys.stdout.encoding)
)
sys.stdo... |
self.sockaddr = (address, port)
self.connect_event = connect_event
self.running = True
self._rt = threading.Thread(
target=self._readThread, name="nc-read-thread", daemon=True
)
self._rt.start()
if block:
self._keepAlive()
... | raise ValueError("Cannot start without stopping first") | conditional_block |
netconsole.py | from argparse import ArgumentParser
import socket
import struct
import sys
import threading
import time
from ._fakeds import FakeDS
__all__ = ["Netconsole", "main", "run"]
def _output_fn(s):
sys.stdout.write(
s.encode(sys.stdout.encoding, errors="replace").decode(sys.stdout.encoding)
)
sys.stdo... | sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
sock.settimeout(None)
sockrfp = sock.makefile("rb")
sockwfp = sock.makefile("wb")
if self.connect_event:
self.connect_event.set()
with self.cond:
self.soc... | random_line_split | |
env.rs | // Copyright 2013 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 ... | () -> uint {
unsafe { MIN_STACK }
}
pub fn debug_borrow() -> bool {
unsafe { DEBUG_BORROW }
}
pub fn poison_on_free() -> bool {
unsafe { POISON_ON_FREE }
}
| min_stack | identifier_name |
env.rs | // Copyright 2013 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 ... | } | unsafe { POISON_ON_FREE } | random_line_split |
env.rs | // Copyright 2013 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 ... | {
unsafe { POISON_ON_FREE }
} | identifier_body | |
test_converter.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 30, 2015 08:25:33 EDT$"
import collections
import json
import os
import os.path
import shutil
import tempfile
import numpy
import h5py
import vigra
import vigra.impex
import nanshe.util.iters
import nanshe.util.xnumpy
import nanshe.io.xtiff
... |
def test_main(self):
params = {
"axis" : 0,
"channel" : 0,
"z_index" : 0,
"pages_to_channel" : 1
}
config_filename = os.path.join(self.temp_dir, "config.json")
hdf5_filename = os.path.join(self.temp_dir, "test.h5")
hdf5_fil... | self.temp_dir = ""
self.filedata = collections.OrderedDict()
self.data = None
self.data = numpy.random.random_integers(0, 255, (1000, 1, 102, 101, 1)).astype(numpy.uint8)
self.temp_dir = tempfile.mkdtemp()
for i, i_str, (a_b, a_e) in nanshe.util.iters.filled_stringify_enumerate... | identifier_body |
test_converter.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 30, 2015 08:25:33 EDT$"
import collections
import json
import os
import os.path
import shutil
import tempfile
import numpy
import h5py
import vigra
import vigra.impex
import nanshe.util.iters
import nanshe.util.xnumpy
import nanshe.io.xtiff
... |
def test_main(self):
params = {
"axis" : 0,
"channel" : 0,
"z_index" : 0,
"pages_to_channel" : 1
}
config_filename = os.path.join(self.temp_dir, "config.json")
hdf5_filename = os.path.join(self.temp_dir, "test.h5")
hdf5_fil... | each_filename = os.path.join(self.temp_dir, "test_tiff_" + str(i) + ".tif")
each_data = self.data[a_b:a_e]
self.filedata[each_filename] = each_data
vigra.impex.writeVolume(nanshe.util.xnumpy.tagging_reorder_array(each_data, to_axis_order="czyxt")[0, 0],
... | conditional_block |
test_converter.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 30, 2015 08:25:33 EDT$"
import collections
import json
import os
import os.path
import shutil
import tempfile
import numpy
import h5py
import vigra
import vigra.impex
import nanshe.util.iters
import nanshe.util.xnumpy
import nanshe.io.xtiff
... |
self.temp_dir = ""
self.filedata = collections.OrderedDict()
self.data = None | os.remove(hdf5_filename)
def teardown(self):
shutil.rmtree(self.temp_dir) | random_line_split |
test_converter.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 30, 2015 08:25:33 EDT$"
import collections
import json
import os
import os.path
import shutil
import tempfile
import numpy
import h5py
import vigra
import vigra.impex
import nanshe.util.iters
import nanshe.util.xnumpy
import nanshe.io.xtiff
... | (self):
params = {
"axis" : 0,
"channel" : 0,
"z_index" : 0,
"pages_to_channel" : 1
}
config_filename = os.path.join(self.temp_dir, "config.json")
hdf5_filename = os.path.join(self.temp_dir, "test.h5")
hdf5_filepath = hdf5_filenam... | test_main | identifier_name |
campus.py | from models.basemodel import BaseModel
class Campus(BaseModel):
CAMPUS_CODES = ['BD', 'DN', 'CS']
LONG_NAMES = {
'BD': 'University of Colorado, Boulder',
'DN': 'University of Colorado, Denver', |
def requiredFields(self):
return ['campus', 'fcqs', 'courses', 'instructors', 'departments', 'colleges', 'id']
def fields(self):
return {
'campus': (self.is_in_list(self.CAMPUS_CODES), ),
'fcqs': (self.is_list, self.schema_list_check(self.is_string, )),
'gra... | 'CS': 'University of Colorado, Colorado Springs'
} | random_line_split |
campus.py | from models.basemodel import BaseModel
class Campus(BaseModel):
CAMPUS_CODES = ['BD', 'DN', 'CS']
LONG_NAMES = {
'BD': 'University of Colorado, Boulder',
'DN': 'University of Colorado, Denver',
'CS': 'University of Colorado, Colorado Springs'
}
def | (self):
return ['campus', 'fcqs', 'courses', 'instructors', 'departments', 'colleges', 'id']
def fields(self):
return {
'campus': (self.is_in_list(self.CAMPUS_CODES), ),
'fcqs': (self.is_list, self.schema_list_check(self.is_string, )),
'grades': (self.is_list, se... | requiredFields | identifier_name |
campus.py | from models.basemodel import BaseModel
class Campus(BaseModel):
CAMPUS_CODES = ['BD', 'DN', 'CS']
LONG_NAMES = {
'BD': 'University of Colorado, Boulder',
'DN': 'University of Colorado, Denver',
'CS': 'University of Colorado, Colorado Springs'
}
def requiredFields(self):
... | return {
'campus': '',
'fcqs': [],
'grades': [],
'courses': [],
'instructors': [],
'departments': [],
'colleges': [],
'id': '',
} | identifier_body | |
string.js | // Compiled by ClojureScript 0.0-2138
goog.provide('clojure.string');
goog.require('cljs.core');
goog.require('goog.string.StringBuffer');
goog.require('goog.string.StringBuffer');
goog.require('goog.string');
goog.require('goog.string');
clojure.string.seq_reverse = (function seq_reverse(coll){return cljs.core.... |
});
clojure.string.discard_trailing_if_needed = (function discard_trailing_if_needed(limit,v){if(cljs.core._EQ_.call(null,0,limit))
{return clojure.string.pop_last_while_empty.call(null,v);
} else
{return v;
}
});
clojure.string.split_with_empty_regex = (function split_with_empty_regex(s,limit){if(((limit <= 0... | {
if(cljs.core._EQ_.call(null,"",cljs.core.peek.call(null,v__$1)))
{{
var G__22153 = cljs.core.pop.call(null,v__$1);
v__$1 = G__22153;
continue;
}
} else
{return v__$1;
}
break;
} | conditional_block |
string.js | // Compiled by ClojureScript 0.0-2138
goog.provide('clojure.string');
goog.require('cljs.core');
goog.require('goog.string.StringBuffer');
goog.require('goog.string.StringBuffer');
goog.require('goog.string');
goog.require('goog.string');
clojure.string.seq_reverse = (function seq_reverse(coll){return cljs.core.... | {return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s)))),"");
} else
{var pred__22157 = cljs.core._EQ_;var expr__22158 = limit;if(cljs.core.truth_(pred__22157.call(null,1,expr__22158)))
{return (new cljs.core.PersistentVe... | clojure.string.split_with_empty_regex = (function split_with_empty_regex(s,limit){if(((limit <= 0)) || ((limit >= (2 + cljs.core.count.call(null,s)))))
| random_line_split |
cemiFactory.py | # -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | cEMI frame management
Implements
==========
- B{CEMIFactory}
- B{CEMIFactoryValueError}
Documentation
=============
Usage
=====
@author: Frédéric Mantegazza
@author: B. Malinowsky
@copyright: (C) 2013-2015 Frédéric Mantegazza
@copyright: (C) 2006, 2011 B. Malinowsky
@license: GPL
"""
from pyknyx.common.excep... | ==============
| random_line_split |
cemiFactory.py | # -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | frame creation handling class
"""
def __init__(self):
"""
"""
super(CEMIFactory, self).__init__()
| identifier_body | |
cemiFactory.py | # -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | :
""" cEMI frame creation handling class
"""
def __init__(self):
"""
"""
super(CEMIFactory, self).__init__()
| ory(object) | identifier_name |
tail.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bookmarks::{BookmarkUpdateLog, BookmarkUpdateLogEntry, Freshness};
use cloned::cloned;
use context::CoreC... |
None => {
debug!(
ctx.logger(),
"tail_entries: no more entries during iteration {}. Sleeping.", iteration
);
log_noop_iteration_to_scuba(scuba_sample, repo_id);
tokio::time::s... | {
debug!(
ctx.logger(),
"tail_entries generating, iteration {}", iteration
);
let entries_with_queue_size: std::iter::Map<_, _> =
add_queue_sizes(entries, queue_size as usize).map(Ok);
... | conditional_block |
tail.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bookmarks::{BookmarkUpdateLog, BookmarkUpdateLogEntry, Freshness};
use cloned::cloned;
use context::CoreC... | {
unfold_forever((0, start_id), move |(iteration, current_id)| {
cloned!(ctx, bookmark_update_log, scuba_sample);
async move {
let entries: Vec<Result<_, Error>> = bookmark_update_log
.read_next_bookmark_log_entries(
ctx.clone(),
cu... | identifier_body | |
tail.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bookmarks::{BookmarkUpdateLog, BookmarkUpdateLogEntry, Freshness};
use cloned::cloned;
use context::CoreC... | <T, F, Fut, Item>(
init: T,
mut f: F,
) -> impl stream::Stream<Item = Result<Item, Error>>
where
T: Copy,
F: FnMut(T) -> Fut,
Fut: future::Future<Output = Result<(Item, T), Error>>,
{
stream::unfold(init, move |iteration_value| {
f(iteration_value).then(move |result| {
match ... | unfold_forever | identifier_name |
tail.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bookmarks::{BookmarkUpdateLog, BookmarkUpdateLogEntry, Freshness};
use cloned::cloned;
use context::CoreC... |
pub(crate) fn tail_entries(
ctx: CoreContext,
start_id: u64,
repo_id: RepositoryId,
bookmark_update_log: Arc<dyn BookmarkUpdateLog>,
scuba_sample: MononokeScubaSampleBuilder,
) -> impl stream::Stream<Item = Result<(BookmarkUpdateLogEntry, QueueSize), Error>> {
unfold_forever((0, start_id), move... | } | random_line_split |
droptarget.py | __author__ = 'Exter, 0xBADDCAFE'
import wx
class FTDropTarget(wx.DropTarget):
"""
Implements drop target functionality to receive files and text
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
class variable ID_DROP_FILE | def __init__(self, receiver, evt):
"""
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
"""
wx.DropTarget.__init__(self)
self.composite = wx.DataObjectComposite()
self.text_do = wx.TextDataObject(... | class variable ID_DROP_TEXT
"""
ID_DROP_FILE = wx.NewId()
ID_DROP_TEXT = wx.NewId()
| random_line_split |
droptarget.py | __author__ = 'Exter, 0xBADDCAFE'
import wx
class FTDropTarget(wx.DropTarget):
| """
Implements drop target functionality to receive files and text
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
class variable ID_DROP_FILE
class variable ID_DROP_TEXT
"""
ID_DROP_FILE = wx.NewId()
ID_DROP_TEXT = wx.Ne... | identifier_body | |
droptarget.py | __author__ = 'Exter, 0xBADDCAFE'
import wx
class FTDropTarget(wx.DropTarget):
"""
Implements drop target functionality to receive files and text
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
class variable ID_DROP_FILE
class... |
elif drop_type == wx.DF_FILENAME:
wx.PostEvent(self.receiver, self.evt(id=self.ID_DROP_FILE, files=self.file_do.GetFilenames()))
assert isinstance(result, object)
return result
| wx.PostEvent(self.receiver, self.evt(id=self.ID_DROP_TEXT, text=self.text_do.GetText())) | conditional_block |
droptarget.py | __author__ = 'Exter, 0xBADDCAFE'
import wx
class | (wx.DropTarget):
"""
Implements drop target functionality to receive files and text
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
class variable ID_DROP_FILE
class variable ID_DROP_TEXT
"""
ID_DROP_FILE = wx.NewId()
... | FTDropTarget | identifier_name |
math-transaction.ts | /*
* math-transaction.ts
*
* Copyright (C) 2020 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. ... | {
return {
name: 'math-marks',
filter: node => node.isTextblock && node.type.allowsMarkType(node.type.schema.marks.math),
append: (tr: MarkTransaction, node: ProsemirrorNode, pos: number) => {
// find all math blocks and convert them to text if they no longer conform
const schema = node.type... | identifier_body | |
math-transaction.ts | /*
* math-transaction.ts
*
* Copyright (C) 2020 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. ... |
}
}
},
};
}
| {
const mathDelim = delimiterForType(mathAttr.type);
const mathText = tr.doc.textBetween(mathRange.from, mathRange.to);
const charAfter = tr.doc.textBetween(mathRange.to, mathRange.to + 1);
const noDelims = !mathText.startsWith(mathDelim) || !mathText.endsWith(mathDelim);... | conditional_block |
math-transaction.ts | /*
* math-transaction.ts
*
* Copyright (C) 2020 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. ... | const maths = findChildrenByMark(node, schema.marks.math, true);
for (const math of maths) {
const from = pos + 1 + math.pos;
const mathRange = getMarkRange(tr.doc.resolve(from), schema.marks.math);
if (mathRange) {
const mathAttr = getMarkAttrs(tr.doc, mathRange, schema.ma... | // find all math blocks and convert them to text if they no longer conform
const schema = node.type.schema; | random_line_split |
math-transaction.ts | /*
* math-transaction.ts
*
* Copyright (C) 2020 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. ... | (): AppendMarkTransactionHandler {
return {
name: 'math-marks',
filter: node => node.isTextblock && node.type.allowsMarkType(node.type.schema.marks.math),
append: (tr: MarkTransaction, node: ProsemirrorNode, pos: number) => {
// find all math blocks and convert them to text if they no longer confo... | mathAppendMarkTransaction | identifier_name |
test.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 http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
from . import tran... | (cls, kind, path, config, params, loaded_tasks):
# the kind on which this one depends
if len(config.get('kind-dependencies', [])) != 1:
raise Exception("TestTask kinds must have exactly one item in kind-dependencies")
dep_kind = config['kind-dependencies'][0]
# get build ta... | get_inputs | identifier_name |
test.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 http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
from . import tran... | test_names.update(test_sets_cfg[test_set])
rv[test_platform] = cfg.copy()
rv[test_platform]['test-names'] = test_names
return rv | "Test sets {} for test platform {} are not defined".format(
', '.join(test_sets), test_platform))
test_names = set()
for test_set in test_sets: | random_line_split |
test.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 http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
from . import tran... |
builds_by_platform[platform] = task
return builds_by_platform
@classmethod
def get_test_platforms(cls, test_platforms_cfg, builds_by_platform):
"""Get the test platforms for which test tasks should be generated,
based on the available build platforms. Returns a dictionary ... | raise Exception("multiple build jobs for " + platform) | conditional_block |
test.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 http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
from . import tran... | """
A task implementing a Gecko test.
"""
@classmethod
def get_inputs(cls, kind, path, config, params, loaded_tasks):
# the kind on which this one depends
if len(config.get('kind-dependencies', [])) != 1:
raise Exception("TestTask kinds must have exactly one item in kind-de... | identifier_body | |
keycodes.rs | // https://stackoverflow.
// com/questions/3202629/where-can-i-find-a-list-of-mac-virtual-key-codes
/* keycodes for keys that are independent of keyboard layout */
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
pub const kVK_Return: u16 = 0x24;
pub const kVK_Tab: u16 = 0x30;
pub const kVK_Space: u16 = 0x31;
... | pub const kVK_F5: u16 = 0x60;
pub const kVK_F6: u16 = 0x61;
pub const kVK_F7: u16 = 0x62;
pub const kVK_F3: u16 = 0x63;
pub const kVK_F8: u16 = 0x64;
pub const kVK_F9: u16 = 0x65;
pub const kVK_F11: u16 = 0x67;
pub const kVK_F13: u16 = 0x69;
pub const kVK_F16: u16 = 0x6A;
pub const kVK_F14: u16 = 0x6B;
pub const kVK_F1... | pub const kVK_Mute: u16 = 0x4A;
pub const kVK_F18: u16 = 0x4F;
pub const kVK_F19: u16 = 0x50;
pub const kVK_F20: u16 = 0x5A; | random_line_split |
conf_manager.py | #!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""
Raspymc is a multimedia centre exposed via a http server built with bottlepy
Copyright (C) 2013 Giancarlo Fringuello
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... | ():
return SERVER_PATH
def get_playlist_path():
return CNF_PLAYLIST_PATH | get_server_path | identifier_name |
conf_manager.py | #!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""
Raspymc is a multimedia centre exposed via a http server built with bottlepy
Copyright (C) 2013 Giancarlo Fringuello
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... |
except:
# if unable to read file (e.g. file damaged)
l_clean_configuration = True
log(LOG_WARNING, inspect.currentframe().f_lineno, "conf_manager.py::load_configuration()", "exception: unable to load CNF_FOLDER_PATH from " + CNF_CONFIG_FILE + ", using home path as default, new config.ini will be generated.... | l_clean_configuration = True
log(LOG_VERBOSE, inspect.currentframe().f_lineno, "conf_manager.py::load_configuration()", "unable to load CNF_FOLDER_PATH, using home as default, new config.ini will be generated.") | conditional_block |
conf_manager.py | #!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""
Raspymc is a multimedia centre exposed via a http server built with bottlepy
Copyright (C) 2013 Giancarlo Fringuello
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... |
log(LOG_VERBOSE, inspect.currentframe().f_lineno, "conf_manager.py::load_configuration()", "CNF_FOLDER_PATH = " + CNF_FOLDER_PATH)
log(LOG_VERBOSE, inspect.currentframe().f_lineno, "conf_manager.py::load_configuration()", "CNF_PLAYLIST_PATH = " + CNF_PLAYLIST_PATH)
log(LOG_VERBOSE, inspect.currentframe().f_lineno, ... | if "" == CNF_FOLDER_PATH:
CNF_FOLDER_PATH = os.path.expanduser("~")
| random_line_split |
conf_manager.py | #!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""
Raspymc is a multimedia centre exposed via a http server built with bottlepy
Copyright (C) 2013 Giancarlo Fringuello
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... |
def store_playlist(p_list):
log(LOG_INFO, inspect.currentframe().f_lineno, "conf_manager.py::store_playlist()")
try:
with open(CNF_PLAYLIST_PATH, 'wb') as l_output:
pickle.dump(p_list, l_output, pickle.HIGHEST_PROTOCOL)
except:
log(LOG_WARNING, inspect.currentframe().f_lineno, "conf_manager.py::store_playli... | log(LOG_INFO, inspect.currentframe().f_lineno, "conf_manager.py::load_playlist()")
l_playlist = []
try:
with open(CNF_PLAYLIST_PATH, 'rb') as l_input:
l_playlist = pickle.load(l_input)
except:
log(LOG_WARNING, inspect.currentframe().f_lineno, "conf_manager.py::load_playlist()", "unexisting playlist file: " + ... | identifier_body |
lb.config.ts | /* eslint-disable */
/**
* @module LoopBackConfig
* @description
*
* The LoopBackConfig module help developers to externally
* configure the base url and api version for loopback.io
*
* Example
*
* import { LoopBackConfig } from './sdk';
*
* @Component() // No metadata needed for this module
*
* export class MyApp {
... | LoopBackConfig.debug = isEnabled;
}
public static debuggable(): boolean {
return LoopBackConfig.debug;
}
public static filterOnUrl(): void {
LoopBackConfig.filterOn = 'url';
}
public static filterOnHeaders(): void {
LoopBackConfig.filterOn = 'headers';
}
public static whereOnUrl(): v... | public static setDebugMode(isEnabled: boolean): void { | random_line_split |
lb.config.ts | /* eslint-disable */
/**
* @module LoopBackConfig
* @description
*
* The LoopBackConfig module help developers to externally
* configure the base url and api version for loopback.io
*
* Example
*
* import { LoopBackConfig } from './sdk';
*
* @Component() // No metadata needed for this module
*
* export class MyApp {
... | ): void {
LoopBackConfig.whereOn = 'headers';
}
public static isHeadersFilteringSet(): boolean {
return (LoopBackConfig.filterOn === 'headers');
}
public static isHeadersWhereSet(): boolean {
return (LoopBackConfig.whereOn === 'headers');
}
public static setSecureWebSockets(): void {
Loop... | hereOnHeaders( | identifier_name |
lb.config.ts | /* eslint-disable */
/**
* @module LoopBackConfig
* @description
*
* The LoopBackConfig module help developers to externally
* configure the base url and api version for loopback.io
*
* Example
*
* import { LoopBackConfig } from './sdk';
*
* @Component() // No metadata needed for this module
*
* export class MyApp {
... |
public static getPath(): string {
return LoopBackConfig.path;
}
public static setAuthPrefix(authPrefix: string = ''): void {
LoopBackConfig.authPrefix = authPrefix;
}
public static getAuthPrefix(): string {
return LoopBackConfig.authPrefix;
}
public static setDebugMode(isEnabled: boolean... |
LoopBackConfig.path = url;
}
| identifier_body |
index.tsx | import { FC, useMemo } from 'react';
type Img = '20x20' | '30x30' | '36x60' | '40x40' | '82x20';
type ImageMap = {
[key in Img]: {
src: string;
height: number;
width: number;
};
};
export type LINEButtonProps = {
text?: string;
image?: Img;
alt?: string;
};
const imgSet: ImageMap = {
'20x20'... | height: 30,
width: 30,
},
'36x60': {
src: 'http://i.imgur.com/5sEp1TC.png',
height: 60,
width: 36,
},
'40x40': {
src: 'http://i.imgur.com/ZoU91JG.png',
height: 40,
width: 40,
},
'82x20': {
src: 'http://i.imgur.com/cfjCxrh.png',
height: 20,
width: 82,
},
};
const... | height: 20,
width: 20,
},
'30x30': {
src: 'http://i.imgur.com/Lkq9vFO.png', | random_line_split |
self_authentication.rs | // Copyright 2018 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... | // FIXME - pass secret key of the wallet as an argument
let client_id = ClientFullId::new_bls(&mut thread_rng());
// Account Creation
println!("\nTrying to create an account...");
match Authenticator::create_acc(secret_0.as_str(), secret_1.as_str(), client_id, || ()) {
... | println!("\n------------ Enter password ---------------");
let _ = std::io::stdin().read_line(&mut secret_1);
secret_1 = secret_1.trim().to_string();
| random_line_split |
self_authentication.rs | // Copyright 2018 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... | {
unwrap!(safe_core::utils::logging::init(true));
let mut secret_0 = String::new();
let mut secret_1 = String::new();
println!("\nDo you already have an account created (enter Y for yes)?");
let mut user_option = String::new();
let _ = std::io::stdin().read_line(&mut user_option);
user_op... | identifier_body | |
self_authentication.rs | // Copyright 2018 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... | () {
unwrap!(safe_core::utils::logging::init(true));
let mut secret_0 = String::new();
let mut secret_1 = String::new();
println!("\nDo you already have an account created (enter Y for yes)?");
let mut user_option = String::new();
let _ = std::io::stdin().read_line(&mut user_option);
user... | main | identifier_name |
Lab.EmployeeCollection.js | (function (window, undefined) {
'use strict';
namespace('Lab');
function EmployeeCollection(json) {
/**
*
* @type {Array<Lab.Employee>}
*/
this.collection = [];
this.init(json);
}
EmployeeCollection.prototype = {
constructor : EmployeeCollection,
/**
*
* @param json {Array}
*/
... | this.json = json;
for (var i = 0, ii = json.length; i < ii; i++) {
this.collection.push(new Lab.Employee(json[i].properties));
}
},
getCollection : function () {
return this.collection;
},
getSize : function () {
return this.collection.length;
},
getMaxDistanceToWork : function () {
... | random_line_split | |
Lab.EmployeeCollection.js | (function (window, undefined) {
'use strict';
namespace('Lab');
function | (json) {
/**
*
* @type {Array<Lab.Employee>}
*/
this.collection = [];
this.init(json);
}
EmployeeCollection.prototype = {
constructor : EmployeeCollection,
/**
*
* @param json {Array}
*/
init : function (json) {
this.json = json;
for (var i = 0, ii = json.length; i < ii; i++... | EmployeeCollection | identifier_name |
Lab.EmployeeCollection.js | (function (window, undefined) {
'use strict';
namespace('Lab');
function EmployeeCollection(json) |
EmployeeCollection.prototype = {
constructor : EmployeeCollection,
/**
*
* @param json {Array}
*/
init : function (json) {
this.json = json;
for (var i = 0, ii = json.length; i < ii; i++) {
this.collection.push(new Lab.Employee(json[i].properties));
}
},
getCollection : function ... | {
/**
*
* @type {Array<Lab.Employee>}
*/
this.collection = [];
this.init(json);
} | identifier_body |
Lab.EmployeeCollection.js | (function (window, undefined) {
'use strict';
namespace('Lab');
function EmployeeCollection(json) {
/**
*
* @type {Array<Lab.Employee>}
*/
this.collection = [];
this.init(json);
}
EmployeeCollection.prototype = {
constructor : EmployeeCollection,
/**
*
* @param json {Array}
*/
... |
},
getCollection : function () {
return this.collection;
},
getSize : function () {
return this.collection.length;
},
getMaxDistanceToWork : function () {
var collection = this.getCollection(),
item = _.max(collection, function (item) {
return parseFloat(item.getDistanceToWork());
... | {
this.collection.push(new Lab.Employee(json[i].properties));
} | conditional_block |
bezier.py | # pygsear
# Copyright (C) 2003 Lee Harr
#
#
# This file is part of pygsear.
#
# pygsear 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.... |
# Draw the control lines
if len(self.points) > 2:
pygame.draw.lines(self.image, GREEN, False, self.points)
# Draw the curve
step = 1.0 / self.w
t = step
pold = self.points[0]
for k in range(self.w):
pi = copy.deepcopy(self.points)
... | pygame.draw.rect(self.image, BLUE, (p, (3, 3))) | conditional_block |
bezier.py | # pygsear
# Copyright (C) 2003 Lee Harr
#
#
# This file is part of pygsear.
#
# pygsear 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.... | (self, ev):
self.points.append([250, 250])
self.drawSpline()
self.drawFun()
def remove_point(self, ev):
if len(self.points) > 1:
try:
self.points.pop(self.selected)
except IndexError:
try:
self.points.pop()
... | add_point_end | identifier_name |
bezier.py | # pygsear
# Copyright (C) 2003 Lee Harr
#
#
# This file is part of pygsear.
#
# pygsear 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.... |
def toggle_fun_display(self, ev):
self.display_fun = not self.display_fun
self.drawFun()
def mouseClicked(self, ev):
self.button_held = 1
x, y = pygame.mouse.get_pos()
selected = None
rmin = 1000000
for point in self.points:
px, py = poin... | if len(self.points) > 1:
try:
self.points.pop(self.selected)
except IndexError:
try:
self.points.pop()
except IndexError:
pass
self.drawSpline()
self.drawFun() | identifier_body |
bezier.py | # pygsear
# Copyright (C) 2003 Lee Harr
#
#
# This file is part of pygsear.
#
# pygsear 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.... | dx, dy = x-px, y-py
r = dx*dx + dy*dy
if r < rmin:
selected = point
rmin = r
self.selected = self.points.index(selected)
def mouseReleased(self, ev):
self.button_held = 0
def move_point(self):
if self.button_held:
... | random_line_split | |
database.rs | // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
use std::collections::HashMap;
use std::path::Path;
fn trace(s: &str) {
println... | (&mut self, entry: &MediaEntry) -> Result<()> {
let stmt = cached_sql!(
self.update_entry_stmt,
self.db,
"
insert or replace into media (fname, csum, mtime, dirty)
values (?, ?, ?, ?)"
);
let sha1_str = entry.sha1.map(hex::encode);
stmt.execute(params... | set_entry | identifier_name |
database.rs | // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
use std::collections::HashMap;
use std::path::Path;
fn trace(s: &str) {
println... |
}
if res.is_err() {
self.rollback()?;
}
res
}
fn begin(&mut self) -> Result<()> {
self.db.execute_batch("begin immediate").map_err(Into::into)
}
fn commit(&mut self) -> Result<()> {
self.db.execute_batch("commit").map_err(Into::into)
}... | {
res = Err(e);
} | conditional_block |
database.rs | // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
use std::collections::HashMap;
use std::path::Path;
fn trace(s: &str) {
println... |
db.pragma_update(None, "page_size", &4096)?;
db.pragma_update(None, "legacy_file_format", &false)?;
db.pragma_update_and_check(None, "journal_mode", &"wal", |_| Ok(()))?;
initial_db_setup(&mut db)?;
Ok(db)
}
fn initial_db_setup(db: &mut Connection) -> Result<()> {
// tables already exist?
... |
if std::env::var("TRACESQL").is_ok() {
db.trace(Some(trace));
} | random_line_split |
database.rs | // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
use std::collections::HashMap;
use std::path::Path;
fn trace(s: &str) {
println... |
}
fn row_to_entry(row: &Row) -> rusqlite::Result<MediaEntry> {
// map the string checksum into bytes
let sha1_str: Option<String> = row.get(1)?;
let sha1_array = if let Some(s) = sha1_str {
let mut arr = [0; 20];
match hex::decode_to_slice(s, arr.as_mut()) {
Ok(_) => Some(arr),... | {
self.db
.execute_batch("delete from media; update meta set lastUsn = 0, dirMod = 0")
.map_err(Into::into)
} | identifier_body |
Solution.py | """
Given the root of a binary tree, return the inorder traversal of its nodes' values.
Example 1:
Input: root = [1,null,2,3]
Output: [1,3,2]
Example 2:
Input: root = []
Output: []
Example 3:
Input: root = [1]
Output: [1]
Example 4:
Input: root = [1,2]
Output: [2,1]
Example 5:
Input: root = [1,null,2]
Ou... | class Solution(object):
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
def inorder(node, ls):
if node is None:
return
inorder(node.left, ls)
ls.append(node.val)
inorder(node.righ... | # self.right = None
| random_line_split |
Solution.py | """
Given the root of a binary tree, return the inorder traversal of its nodes' values.
Example 1:
Input: root = [1,null,2,3]
Output: [1,3,2]
Example 2:
Input: root = []
Output: []
Example 3:
Input: root = [1]
Output: [1]
Example 4:
Input: root = [1,2]
Output: [2,1]
Example 5:
Input: root = [1,null,2]
Ou... | inorder(node.left, ls)
ls.append(node.val)
inorder(node.right, ls)
ls = []
inorder(root, ls)
return ls | rn
| conditional_block |
Solution.py | """
Given the root of a binary tree, return the inorder traversal of its nodes' values.
Example 1:
Input: root = [1,null,2,3]
Output: [1,3,2]
Example 2:
Input: root = []
Output: []
Example 3:
Input: root = [1]
Output: [1]
Example 4:
Input: root = [1,2]
Output: [2,1]
Example 5:
Input: root = [1,null,2]
Ou... | e, ls):
if node is None:
return
inorder(node.left, ls)
ls.append(node.val)
inorder(node.right, ls)
ls = []
inorder(root, ls)
return ls | der(nod | identifier_name |
Solution.py | """
Given the root of a binary tree, return the inorder traversal of its nodes' values.
Example 1:
Input: root = [1,null,2,3]
Output: [1,3,2]
Example 2:
Input: root = []
Output: []
Example 3:
Input: root = [1]
Output: [1]
Example 4:
Input: root = [1,2]
Output: [2,1]
Example 5:
Input: root = [1,null,2]
Ou... |
ls = []
inorder(root, ls)
return ls | ode is None:
return
inorder(node.left, ls)
ls.append(node.val)
inorder(node.right, ls)
| identifier_body |
lib.rs | // Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
/... | html_root_url = "https://rust-random.github.io/rand/"
)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![no_std]
#[cfg(not(target_os = "emscripten"))] mod pcg128;
mod pcg64;
#[cfg(not(target_os = "emscripten"))]
pub use self::pcg128::{Lcg128Xsl64, Mcg128Xsl64, Pcg64, Pcg64Mcg};
pub use self::pcg... | html_favicon_url = "https://www.rust-lang.org/favicon.ico", | random_line_split |
search_highlight.js | /* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20030227 by sgala@hisitech.com to skip words with "-" and cut %2B (+) preceding pages */
function highlightWord(node,word)
{
// Iterate into this nodes childNodes
if... | {
pn = node.parentNode;
if (pn.className != "searchword")
{
// word has not already been highlighted!
nv = node.nodeValue;
ni = tempNodeVal.indexOf(tempWordVal);
// Create a load of replacement nodes
... | { // text node
tempNodeVal = node.nodeValue.toLowerCase();
tempWordVal = word.toLowerCase();
if (tempNodeVal.indexOf(tempWordVal) != -1) | random_line_split |
search_highlight.js | /* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20030227 by sgala@hisitech.com to skip words with "-" and cut %2B (+) preceding pages */
function | (node,word)
{
// Iterate into this nodes childNodes
if (node.hasChildNodes)
{
var hi_cn;
for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++)
{
highlightWord(node.childNodes[hi_cn],word);
}
}
// And do this node itself
if (node.nodeType == 3)
{... | highlightWord | identifier_name |
search_highlight.js | /* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20030227 by sgala@hisitech.com to skip words with "-" and cut %2B (+) preceding pages */
function highlightWord(node,word)
{
// Iterate into this nodes childNodes
if... |
}
}
function googleSearchHighlight()
{
if (!document.createElement) return;
ref = document.referrer; //or URL for highlighting in place
if (ref.indexOf('?') == -1) return;
qs = ref.substr(ref.indexOf('?')+1);
qsa = qs.split('&');
for (i=0;i<qsa.length;i++)
{
qsip = qsa[i].spl... | {
pn = node.parentNode;
if (pn.className != "searchword")
{
// word has not already been highlighted!
nv = node.nodeValue;
ni = tempNodeVal.indexOf(tempWordVal);
// Create a load of replacement nodes
bef... | conditional_block |
search_highlight.js | /* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20030227 by sgala@hisitech.com to skip words with "-" and cut %2B (+) preceding pages */
function highlightWord(node,word)
{
// Iterate into this nodes childNodes
if... |
window.onload = googleSearchHighlight;
| {
if (!document.createElement) return;
ref = document.referrer; //or URL for highlighting in place
if (ref.indexOf('?') == -1) return;
qs = ref.substr(ref.indexOf('?')+1);
qsa = qs.split('&');
for (i=0;i<qsa.length;i++)
{
qsip = qsa[i].split('=');
if (qsip.length == 1) conti... | identifier_body |
index.d.ts | /*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... | * // returns ~2.152
*
* @example
* var y = median( 5.0, 2.0, -5.0 );
* // returns ~-2.848
*
* @example
* var y = median( 1.0, 1.0, 0.0 );
* // returns ~1.443
*
* @example
* var y = median( NaN, 1.0, 0.0 );
* // returns NaN
*
* @example
* var y = median( 1.0, NaN, 0.0 );
* // returns NaN
*
* @example
* var y = median( 1... | *
* @example
* var y = median( 5.0, 2.0, 0.0 ); | random_line_split |
context.js | var url = require('url')
, path = require('path')
, fs = require('fs')
, utils = require('./utils')
, EventEmitter = require('events').EventEmitter
exports = module.exports = Context
function Context(app, req, res) {
var self = this
this.app = app
this.req = req
this.res = res
this.done = ... | ,
get path() {
return url.parse(this.url).pathname
},
set path(val) {
var obj = url.parse(this.url)
obj.pathname = val
this.url = url.format(obj)
},
get status() {
return this._status
},
set status(code) {
this._status = this.res.statusCode = code
},
get type() {
return ... | {
var socket = this.res.socket
return socket && socket.writable && !this.res.headersSent
} | identifier_body |
context.js | var url = require('url')
, path = require('path')
, fs = require('fs')
, utils = require('./utils')
, EventEmitter = require('events').EventEmitter
exports = module.exports = Context
function Context(app, req, res) {
var self = this
this.app = app
this.req = req
this.res = res
this.done = ... | () {
return url.parse(this.url).pathname
},
set path(val) {
var obj = url.parse(this.url)
obj.pathname = val
this.url = url.format(obj)
},
get status() {
return this._status
},
set status(code) {
this._status = this.res.statusCode = code
},
get type() {
return this.getResHe... | path | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.