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 |
|---|---|---|---|---|
safeEval.py | #!/usr/bin/env python3
# Copyright 2016 - 2021 Bas van Meerten and Wouter Franssen
# This file is part of ssNake.
#
# ssNake 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, o... |
return None
if Type == 'C': #single complex number
if isinstance(val, (float, int, complex)) and not np.isnan(val) and not np.isinf(val):
return val
return None
except Exception:
return None
| return val | conditional_block |
safeEval.py | #!/usr/bin/env python3
# Copyright 2016 - 2021 Bas van Meerten and Wouter Franssen
# This file is part of ssNake.
#
# ssNake 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, o... | # GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ssNake. If not, see <http://www.gnu.org/licenses/>.
import re
import numpy as np
import scipy.special
import hypercomplex as hc
def safeEval(inp, length=None, Type='All', x=None):
"""
... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | random_line_split |
__init__.py | from flask import Flask, jsonify, request
from btree import Tree
from asteval_wrapper import Script
# Startup stuff
app = Flask(__name__)
app.config.from_object('config')
# Jinja initialization to use PyJade
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
# Global jinja functions
app.jinja_env.global... | def compact():
Tree.from_file().compact()
return jsonify(success='compacted')
@app.route('/map/', methods=['POST'])
def map():
script = Script()
tree = Tree.from_file()
temp_tree = Tree(filename='map.db')
temp_tree.compact()
script.add_string(request.get_data())
data = []
for k, v... |
@app.route('/compact/', methods=['GET']) | random_line_split |
__init__.py | from flask import Flask, jsonify, request
from btree import Tree
from asteval_wrapper import Script
# Startup stuff
app = Flask(__name__)
app.config.from_object('config')
# Jinja initialization to use PyJade
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
# Global jinja functions
app.jinja_env.global... | ():
script = Script()
tree = Tree.from_file()
temp_tree = Tree(filename='map.db')
temp_tree.compact()
script.add_string(request.get_data())
data = []
for k, v in tree:
temp_tree[k] = script.invoke('mapper', k, v)
data = script.invoke('reducer', temp_tree.__iter__())
return ... | map | identifier_name |
__init__.py | from flask import Flask, jsonify, request
from btree import Tree
from asteval_wrapper import Script
# Startup stuff
app = Flask(__name__)
app.config.from_object('config')
# Jinja initialization to use PyJade
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
# Global jinja functions
app.jinja_env.global... |
data = script.invoke('reducer', temp_tree.__iter__())
return jsonify(result=data)
| temp_tree[k] = script.invoke('mapper', k, v) | conditional_block |
__init__.py | from flask import Flask, jsonify, request
from btree import Tree
from asteval_wrapper import Script
# Startup stuff
app = Flask(__name__)
app.config.from_object('config')
# Jinja initialization to use PyJade
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
# Global jinja functions
app.jinja_env.global... |
@app.route('/map/', methods=['POST'])
def map():
script = Script()
tree = Tree.from_file()
temp_tree = Tree(filename='map.db')
temp_tree.compact()
script.add_string(request.get_data())
data = []
for k, v in tree:
temp_tree[k] = script.invoke('mapper', k, v)
data = script.invo... | Tree.from_file().compact()
return jsonify(success='compacted') | identifier_body |
plan.py | # -*- coding: utf-8 -*-
### required - do no delete
@auth.requires_login()
def plan():
return dict()
def new():
form = SQLFORM.factory(db.contacts,db.groups)
if form.accepts(request.vars):
_id_user = db.contacts.insert(**db.contacts._filter_fields(form.vars))
form.vars.contact = _i... | ():
id = request.args(0)
group = db(db.groups.id == id).select()[0]
form = SQLFORM(db.contacts, group.contact.id)
group = SQLFORM(db.group, group.id)
# Adding the group form
form.append(group)
if form.accepts(request.vars):
# Updating the contacts
db.contacts.update(**db... | update | identifier_name |
plan.py | # -*- coding: utf-8 -*-
### required - do no delete
@auth.requires_login()
def plan():
return dict()
def new():
form = SQLFORM.factory(db.contacts,db.groups)
if form.accepts(request.vars):
_id_user = db.contacts.insert(**db.contacts._filter_fields(form.vars))
form.vars.contact = _i... |
return locals()
| db.contacts.update(**db.contacts._filter_fields(form.vars))
# Atualizando o grupo
old_group = db(db.groups.id == group.id).select().first()
old_group.update_record(group=group.vars.group)
response.session = 'Updated with success!' | conditional_block |
plan.py | # -*- coding: utf-8 -*-
### required - do no delete
@auth.requires_login()
def plan():
return dict()
def new():
form = SQLFORM.factory(db.contacts,db.groups)
if form.accepts(request.vars):
_id_user = db.contacts.insert(**db.contacts._filter_fields(form.vars))
form.vars.contact = _i... | response.flash = 'User registered successfully'
return locals()
def update():
id = request.args(0)
group = db(db.groups.id == id).select()[0]
form = SQLFORM(db.contacts, group.contact.id)
group = SQLFORM(db.group, group.id)
# Adding the group form
form.append(group)
if form.... | random_line_split | |
plan.py | # -*- coding: utf-8 -*-
### required - do no delete
@auth.requires_login()
def plan():
|
def new():
form = SQLFORM.factory(db.contacts,db.groups)
if form.accepts(request.vars):
_id_user = db.contacts.insert(**db.contacts._filter_fields(form.vars))
form.vars.contact = _id_user
id = db.groups.insert(**db.groups._filter_fields(form.vars))
response.flash = 'User re... | return dict() | identifier_body |
errorScenarios.js | (function () {
'use strict';
describe('error scenarios', function () {
var loginPage = require("../login/loginPage.js");
afterEach(function () {
browser.clearMockModules(); | var mockServerInfo = function () {
var serverInfoService = angular.module('opentele.restApiServices.serverInfo', []);
serverInfoService.service('serverInfo', function () {
return {
get: function (onSuccess, onError) {
... | browser.refresh();
});
describe('server unavailable', function () { | random_line_split |
header-bar.component.ts | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-header-bar',
templateUrl: './header-bar.component.html', | isCollapsed: boolean;
githubUrl = 'https://github.com/IckleChris/ic-datepicker';
links = [{
label: 'Installation',
routerLink: 'installation'
}, {
label: 'Example',
routerLink: 'example'
}, {
label: 'Options',
routerLink: 'options'
}, {
label: 'Interfaces',
routerLink: 'inter... | styleUrls: ['./header-bar.component.scss']
})
export class HeaderBarComponent implements OnInit { | random_line_split |
header-bar.component.ts | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-header-bar',
templateUrl: './header-bar.component.html',
styleUrls: ['./header-bar.component.scss']
})
export class HeaderBarComponent implements OnInit {
isCollapsed: boolean;
githubUrl = 'https://github.com/IckleChris/ic-datepic... |
}
| {
this.isCollapsed = true;
} | identifier_body |
header-bar.component.ts | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-header-bar',
templateUrl: './header-bar.component.html',
styleUrls: ['./header-bar.component.scss']
})
export class HeaderBarComponent implements OnInit {
isCollapsed: boolean;
githubUrl = 'https://github.com/IckleChris/ic-datepic... | () {
this.isCollapsed = true;
}
}
| ngOnInit | identifier_name |
Trigger.js | /* Trigger.js
*
* copyright (c) 2010-2022, Christian Mayer and the CometVisu contributers.
*
* 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 3 of the License, or (at your... | _getInnerDomString: function () {
return '<div class="actor switchUnpressed"><div class="value">-</div></div>';
},
/**
* Handle a short tap event and send the value for short pressing the trigger to the backend.
* If there is no short threshold set, this send the value for long presses to t... |
// overridden | random_line_split |
mono.rs | /*
* Monochrome filter
*/
#pragma version(1)
#pragma rs java_package_name(se.embargo.onebit.filter)
rs_allocation gIn;
rs_allocation gOut;
rs_script gScript;
const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
void root(const uchar4 *v_in, uchar4 *v_out, const void *usrData, uint32_t x, uint32_t y) { | }
void filter() {
int64_t t1 = rsUptimeMillis();
rsForEach(gScript, gIn, gOut, 0);
int64_t t2 = rsUptimeMillis();
rsDebug("Monochrome filter in (ms)", t2 - t1);
} | float4 pixel = rsUnpackColor8888(*v_in);
float3 mono = dot(pixel.rgb, gMonoMult);
*v_out = rsPackColorTo8888(mono); | random_line_split |
Tooltips.py |
from muntjac.ui.abstract_component import AbstractComponent
from muntjac.demo.sampler.APIResource import APIResource
from muntjac.demo.sampler.Feature import Feature, Version
class Tooltips(Feature):
def getSinceVersion(self):
return Version.OLD
def getName(self):
return 'Tooltips'
... | return None | identifier_body | |
Tooltips.py | from muntjac.ui.abstract_component import AbstractComponent
from muntjac.demo.sampler.APIResource import APIResource
from muntjac.demo.sampler.Feature import Feature, Version
class Tooltips(Feature):
def getSinceVersion(self):
return Version.OLD
def getName(self):
return 'Tooltips' | ' which is usually shown as a <i>\"tooltip\"</i>.'
' In the Form component, the description is shown at the'
' top of the form.'
' Descriptions can have HTML formatted (\'rich\') content.<br/>')
def getRelatedAPI(self):
return [APIResource(AbstractComponent)... |
def getDescription(self):
return ('Most components can have a <i>description</i>,' | random_line_split |
Tooltips.py |
from muntjac.ui.abstract_component import AbstractComponent
from muntjac.demo.sampler.APIResource import APIResource
from muntjac.demo.sampler.Feature import Feature, Version
class Tooltips(Feature):
def getSinceVersion(self):
return Version.OLD
def getName(self):
return 'Tooltips'
... | (self):
# TODO Auto-generated method stub
return None
| getRelatedResources | identifier_name |
test_api_version_compare.py | from django.test import TestCase
from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.restapi.views.footer_views import get_version_compare_data
class VersionCompareTests(TestCase):
fixtures = ['eric.json', 'test_data.json']
def | (self):
project = Project.objects.get(slug='read-the-docs')
version = project.versions.get(slug='0.2.1')
data = get_version_compare_data(project, version)
self.assertEqual(data['is_highest'], False)
def test_latest_version_highest(self):
project = Project.objects.get(slug='... | test_not_highest | identifier_name |
test_api_version_compare.py | from django.test import TestCase
from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.restapi.views.footer_views import get_version_compare_data
class VersionCompareTests(TestCase):
fixtures = ['eric.json', 'test_data.json']
def test_not_highest(se... | project = Project.objects.get(slug='read-the-docs')
version = project.versions.get(slug='0.2.2')
data = get_version_compare_data(project, version)
self.assertEqual(data['is_highest'], True) | identifier_body | |
test_api_version_compare.py | from django.test import TestCase
from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.restapi.views.footer_views import get_version_compare_data
class VersionCompareTests(TestCase):
fixtures = ['eric.json', 'test_data.json'] | data = get_version_compare_data(project, version)
self.assertEqual(data['is_highest'], False)
def test_latest_version_highest(self):
project = Project.objects.get(slug='read-the-docs')
data = get_version_compare_data(project)
self.assertEqual(data['is_highest'], True)
... |
def test_not_highest(self):
project = Project.objects.get(slug='read-the-docs')
version = project.versions.get(slug='0.2.1')
| random_line_split |
OLDgenseq.servicos.js | //(function () {
'use strict';
angular
.module('genseq.servicos')
.factory('Autenticacao', Autenticacao);
//Autenticacao.$inject = ['$cookies', '$http'];
//CORRIGIR COOKIES DEPOIS
Autenticacao.$inject = ['$http'];
//function Autenticacao($cookies,$http) {
//CORRIGIR COOKIES DEPOIS
function Autenticacao($... |
return JSON.parse($cookies.authenticatedUser);
}
function isAuthenticated() {
return !!$cookies.authenticatedUser;
}
function unauthenticate() {
delete $cookies.authenticatedUser;
}
}
//})(); | {
return;
} | conditional_block |
OLDgenseq.servicos.js | //(function () {
'use strict';
angular
.module('genseq.servicos')
.factory('Autenticacao', Autenticacao);
//Autenticacao.$inject = ['$cookies', '$http'];
//CORRIGIR COOKIES DEPOIS
Autenticacao.$inject = ['$http'];
//function Autenticacao($cookies,$http) {
//CORRIGIR COOKIES DEPOIS
function Autenticacao($... |
function unauthenticate() {
delete $cookies.authenticatedUser;
}
}
//})(); | {
return !!$cookies.authenticatedUser;
} | identifier_body |
OLDgenseq.servicos.js | //(function () {
'use strict';
angular
.module('genseq.servicos')
.factory('Autenticacao', Autenticacao);
//Autenticacao.$inject = ['$cookies', '$http'];
//CORRIGIR COOKIES DEPOIS
Autenticacao.$inject = ['$http'];
//function Autenticacao($cookies,$http) {
//CORRIGIR COOKIES DEPOIS
function Autenticacao($... | () {
return !!$cookies.authenticatedUser;
}
function unauthenticate() {
delete $cookies.authenticatedUser;
}
}
//})(); | isAuthenticated | identifier_name |
OLDgenseq.servicos.js | //(function () {
'use strict';
angular
.module('genseq.servicos')
.factory('Autenticacao', Autenticacao);
//Autenticacao.$inject = ['$cookies', '$http'];
//CORRIGIR COOKIES DEPOIS
Autenticacao.$inject = ['$http'];
//function Autenticacao($cookies,$http) {
//CORRIGIR COOKIES DEPOIS
function Autenticacao($... | window.location = '/novo_usuario'; //CHECK EFFECT
}
function loginError(data, status, headers, config) {
console.error('Login Error! *sad face* ');
}
}
function setAuthenticatedUser(usuario) {
$cookies.authenticatedUser = JSON.stringify(usuario);
}
function getAuthenticatedUser(){
if (... | random_line_split | |
game_data.rs | use chess_pgn_parser::{Game, GameTermination};
use regex::{Captures,Regex};
use super::{GameData, MoveData};
pub struct GameMappingError { | pub error: GameError,
}
pub enum GameError {
UnknownGameTermination,
MissingComment { ply: u32 },
BadComment { ply: u32 },
}
pub fn map_game_data(games: &Vec<Game>)
-> Result<Vec<GameData>, GameMappingError> {
let mut result: Vec<GameData> = Vec::with_capacity(games.len());
let comment_p... | pub game_number: u32, | random_line_split |
game_data.rs | use chess_pgn_parser::{Game, GameTermination};
use regex::{Captures,Regex};
use super::{GameData, MoveData};
pub struct GameMappingError {
pub game_number: u32,
pub error: GameError,
}
pub enum GameError {
UnknownGameTermination,
MissingComment { ply: u32 },
BadComment { ply: u32 },
}
pub fn map_... | {
re: Regex
}
impl CommentParser {
pub fn new() -> CommentParser {
let re = Regex::new(r"(?x)
^(?P<sign>(-|\+)?)
((?P<mate>M\d+)|((?P<eval>\d+)(\.(?P<eval_dec>\d{2}))))
/\d+\s
((?P<time>\d+)(\.(?P<time_dec>\d{1,3}))?s)
").unwr... | CommentParser | identifier_name |
game_data.rs | use chess_pgn_parser::{Game, GameTermination};
use regex::{Captures,Regex};
use super::{GameData, MoveData};
pub struct GameMappingError {
pub game_number: u32,
pub error: GameError,
}
pub enum GameError {
UnknownGameTermination,
MissingComment { ply: u32 },
BadComment { ply: u32 },
}
pub fn map_... |
fn get_eval(captures: &Captures) -> i32 {
let mut result = 0;
result += match captures.name("mate") {
None | Some("") => 0,
Some(_) => 10000,
};
result += match captures.name("eval") {
None | Some("") => 0,
Some(value) => 100 * valu... | {
let captures_opt = self.re.captures(comment);
if captures_opt.is_none() {
return Err(());
}
let captures = captures_opt.unwrap();
let eval = CommentParser::get_eval(&captures);
let time = CommentParser::get_time(&captures);
Ok(MoveData { eval: eva... | identifier_body |
c_windows.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 ... | lpMode: libc::DWORD) -> libc::BOOL;
} | pub fn SetConsoleMode(hConsoleHandle: libc::HANDLE, | random_line_split |
c_windows.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 ... | {
fd_count: libc::c_uint,
fd_array: [libc::SOCKET, ..FD_SETSIZE],
}
pub fn fd_set(set: &mut fd_set, s: libc::SOCKET) {
set.fd_array[set.fd_count as uint] = s;
set.fd_count += 1;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSAStartup(wVersionRequested: libc::WORD,
lpW... | fd_set | identifier_name |
c_windows.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 ... | else {
func
})
})
}
/// Macro for creating a compatibility fallback for a Windows function
///
/// # Example
/// ```
/// compat_fn!(adll32::SomeFunctionW(_arg: LPCWSTR) {
/// // Fallback implementation
/// })
/// ```
///
/// Note that... | {
fallback
} | conditional_block |
TestOutOfRangeDiscretizableColorTransferFunction.py | #!/usr/bin/env python
import sys
| useBelowRangeColor = 0
if sys.argv.count("--useBelowRangeColor") > 0:
useBelowRangeColor = 1
useAboveRangeColor = 0
if sys.argv.count("--useAboveRangeColor") > 0:
useAboveRangeColor = 1
cmap = vtk.vtkDiscretizableColorTransferFunction()
cmap.AddRGBPoint(-.4, 0.8, 0.8, 0.8)
cmap.AddRGBPoint(0.4, 1, 0... | import vtk
from vtk.test import Testing
| random_line_split |
TestOutOfRangeDiscretizableColorTransferFunction.py | #!/usr/bin/env python
import sys
import vtk
from vtk.test import Testing
useBelowRangeColor = 0
if sys.argv.count("--useBelowRangeColor") > 0:
useBelowRangeColor = 1
useAboveRangeColor = 0
if sys.argv.count("--useAboveRangeColor") > 0:
|
cmap = vtk.vtkDiscretizableColorTransferFunction()
cmap.AddRGBPoint(-.4, 0.8, 0.8, 0.8)
cmap.AddRGBPoint(0.4, 1, 0, 0)
cmap.SetUseBelowRangeColor(useBelowRangeColor)
cmap.SetBelowRangeColor(0.0, 1.0, 0.0)
cmap.SetUseAboveRangeColor(useAboveRangeColor)
cmap.SetAboveRangeColor(1.0, 1.0, 0.0)
sphere = vtk.v... | useAboveRangeColor = 1 | conditional_block |
fr.js | /*!
* froala_editor v3.2.7 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2021 Froala Labs
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) :
typeof define === 'function... | 'Smiling face with heart-shaped eyes': 'Visage souriant avec des yeux en forme de coeur',
'Smiling face with sunglasses': 'Sourire visage avec des lunettes de soleil',
'Smirking face': 'Souriant visage',
'Neutral face': 'Visage neutre',
'Expressionless face': 'Visage sans expression',
... | 'Winking face': 'Clin d\'oeil visage',
'Smiling face with smiling eyes': 'Sourire visage aux yeux souriants',
'Face savoring delicious food': "Visage savourant de d\xE9licieux plats",
'Relieved face': "Soulag\xE9 visage", | random_line_split |
polySum.py | '''
Week-2:Exercise-grader-polysum
A regular polygon has n number of sides. Each side has length s.
The area of a regular polygon is: (0.25∗n∗s^2)/tan(π/n)
The perimeter of a polygon is: length of the boundary of the polygon | '''
Input: n - number of sides(should be an integer)
s- length of each sides(can be an intger or a float)
Output: Returns Sum of area and the square of the perimeter of the regular polygon(gives a float)
'''
#Code
def areaOfPolygon(n,s):
#Pi = 3.1428
area = (0.25 * n * s... | Write a function called polysum that takes 2 arguments, n and s. This function should sum the area and square of the perimeter of the regular polygon. The function returns the sum, rounded to 4 decimal places.
'''
#code
import math
def polysum(n,s): | random_line_split |
polySum.py | '''
Week-2:Exercise-grader-polysum
A regular polygon has n number of sides. Each side has length s.
The area of a regular polygon is: (0.25∗n∗s^2)/tan(π/n)
The perimeter of a polygon is: length of the boundary of the polygon
Write a function called polysum that takes 2 arguments, n and s. This function should sum the ... | :
'''
Input: n - number of sides(should be an integer)
s- length of each sides(can be an intger or a float)
Output: Returns Sum of area and the square of the perimeter of the regular polygon(gives a float)
'''
#Code
def areaOfPolygon(n,s):
#Pi = 3.1428
area = (0.25 * n *... | um(n,s) | identifier_name |
polySum.py | '''
Week-2:Exercise-grader-polysum
A regular polygon has n number of sides. Each side has length s.
The area of a regular polygon is: (0.25∗n∗s^2)/tan(π/n)
The perimeter of a polygon is: length of the boundary of the polygon
Write a function called polysum that takes 2 arguments, n and s. This function should sum the ... | sum = areaOfPolygon(n,s) + (perimeterOfPolygon(n,s) ** 2)
return round(sum,4)
| eter = n * s
return perimeter
| identifier_body |
rowNodeBlockLoader.ts | import { RowNodeBlock } from "./rowNodeBlock";
import { Bean, PostConstruct, Qualifier } from "../context/context";
import { BeanStub } from "../context/beanStub";
import { Logger, LoggerFactory } from "../logger";
import { _ } from "../utils";
@Bean('rowNodeBlockLoader')
export class RowNodeBlockLoader extends BeanSt... | }
public checkBlockToLoad(): void {
if (this.checkBlockToLoadDebounce) {
this.checkBlockToLoadDebounce();
} else {
this.performCheckBlocksToLoad();
}
}
private performCheckBlocksToLoad(): void {
if (!this.active) { return; }
this.printCa... | if (this.activeBlockLoadsCount == 0) {
this.dispatchEvent({type: RowNodeBlockLoader.BLOCK_LOADER_FINISHED_EVENT});
} | random_line_split |
rowNodeBlockLoader.ts | import { RowNodeBlock } from "./rowNodeBlock";
import { Bean, PostConstruct, Qualifier } from "../context/context";
import { BeanStub } from "../context/beanStub";
import { Logger, LoggerFactory } from "../logger";
import { _ } from "../utils";
@Bean('rowNodeBlockLoader')
export class RowNodeBlockLoader extends BeanSt... |
}
private performCheckBlocksToLoad(): void {
if (!this.active) { return; }
this.printCacheStatus();
if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
this.logger.log(`checkBlockToLoad: max loads exceeded`);
r... | {
this.performCheckBlocksToLoad();
} | conditional_block |
rowNodeBlockLoader.ts | import { RowNodeBlock } from "./rowNodeBlock";
import { Bean, PostConstruct, Qualifier } from "../context/context";
import { BeanStub } from "../context/beanStub";
import { Logger, LoggerFactory } from "../logger";
import { _ } from "../utils";
@Bean('rowNodeBlockLoader')
export class RowNodeBlockLoader extends BeanSt... |
public getBlockState(): any {
const result: any = {};
this.blocks.forEach((block: RowNodeBlock) => {
const {id, state} = block.getBlockStateJson();
result[id] = state;
});
return result;
}
private printCacheStatus(): void {
if (this.logger.... | {
if (!this.active) { return; }
this.printCacheStatus();
if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
this.logger.log(`checkBlockToLoad: max loads exceeded`);
return;
}
let blockToLoad: RowNodeBlo... | identifier_body |
rowNodeBlockLoader.ts | import { RowNodeBlock } from "./rowNodeBlock";
import { Bean, PostConstruct, Qualifier } from "../context/context";
import { BeanStub } from "../context/beanStub";
import { Logger, LoggerFactory } from "../logger";
import { _ } from "../utils";
@Bean('rowNodeBlockLoader')
export class RowNodeBlockLoader extends BeanSt... | (): void {
if (!this.active) { return; }
this.printCacheStatus();
if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
this.logger.log(`checkBlockToLoad: max loads exceeded`);
return;
}
let blockToLoad: R... | performCheckBlocksToLoad | identifier_name |
yaml.py | # (c) 2017, Brian Coca
#
# This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is dist... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
'''
DOC... | random_line_split | |
yaml.py | # (c) 2017, Brian Coca
#
# This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is dist... | """
A caching module backed by yaml files.
"""
def _load(self, filepath):
with codecs.open(filepath, 'r', encoding='utf-8') as f:
return AnsibleLoader(f).get_single_data()
def _dump(self, value, filepath):
with codecs.open(filepath, 'w', encoding='utf-8') as f:
... | identifier_body | |
yaml.py | # (c) 2017, Brian Coca
#
# This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is dist... | (self, filepath):
with codecs.open(filepath, 'r', encoding='utf-8') as f:
return AnsibleLoader(f).get_single_data()
def _dump(self, value, filepath):
with codecs.open(filepath, 'w', encoding='utf-8') as f:
yaml.dump(value, f, Dumper=AnsibleDumper, default_flow_style=False)
| _load | identifier_name |
feature_anchors.py | #!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... |
self.log.info("Check node connections")
check_node_connections(node=self.nodes[0], num_in=5, num_out=2)
# 127.0.0.1
ip = "7f000001"
# Since the ip is always 127.0.0.1 for this case,
# we store only the port to identify the peers
block_relay_nodes_port = []
... | self.log.debug(f"inbound: {i}")
self.nodes[0].add_p2p_connection(P2PInterface()) | conditional_block |
feature_anchors.py | #!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... |
# Since the ip is always 127.0.0.1 for this case,
# we store only the port to identify the peers
block_relay_nodes_port = []
inbound_nodes_port = []
for p in self.nodes[0].getpeerinfo():
addr_split = p["addr"].split(":")
if p["connection_type"] == "block-... | check_node_connections(node=self.nodes[0], num_in=5, num_out=2)
# 127.0.0.1
ip = "7f000001" | random_line_split |
feature_anchors.py | #!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... |
def run_test(self):
node_anchors_path = os.path.join(
self.nodes[0].datadir, "regtest", "anchors.dat"
)
self.log.info("When node starts, check if anchors.dat doesn't exist")
assert not os.path.exists(node_anchors_path)
self.log.info(f"Add {BLOCK_RELAY_CONNECTI... | self.num_nodes = 1
self.disable_autoconnect = False | identifier_body |
feature_anchors.py | #!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... | (self):
self.num_nodes = 1
self.disable_autoconnect = False
def run_test(self):
node_anchors_path = os.path.join(
self.nodes[0].datadir, "regtest", "anchors.dat"
)
self.log.info("When node starts, check if anchors.dat doesn't exist")
assert not os.path.e... | set_test_params | identifier_name |
lib.rs | //! Board Support Crate for the bluepill
//!
//! # Usage
//!
//! Follow `cortex-m-quickstart` [instructions][i] but remove the `memory.x`
//! linker script and the `build.rs` build script file as part of the
//! configuration of the quickstart crate. Additionally, uncomment the "if using
//! ITM" block in the `.gdbinit... | pub mod serial;
pub mod frequency; | random_line_split | |
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 http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive)]
#![feature(plugin)]
#![feature(step_trait)]
#![plugin(heapsize_plugin)]
#![plugin(serd... | () -> usize { 1 }
#[inline]
fn max_value() -> usize { ::std::usize::MAX }
#[inline]
fn from_usize(n: usize) -> Option<usize> { Some(n) }
}
/// An index type to be used by a `Range`
pub trait RangeIndex: Int + fmt::Debug {
type Index;
fn new(x: Self::Index) -> Self;
fn get(self) -> Self::Ind... | one | 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 http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive)]
#![feature(plugin)]
#![feature(step_trait)]
#![plugin(heapsize_plugin)]
#![plugin(serd... |
#[inline]
pub fn intersect(&self, other: &Range<I>) -> Range<I> {
let begin = max(self.begin(), other.begin());
let end = min(self.end(), other.end());
if end < begin {
Range::empty()
} else {
Range::new(begin, end - begin)
}
}
}
/// Method... | {
self.begin = begin;
self.length = length;
} | 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 http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive)]
#![feature(plugin)]
#![feature(step_trait)]
#![plugin(heapsize_plugin)]
#![plugin(serd... | }
impl ::std::ops::Sub<$Self_> for $Self_ {
type Output = $Self_;
#[inline]
fn sub(self, other: $Self_) -> $Self_ {
$Self_(self.get() - other.get())
}
}
impl ::std::ops::Neg for $Self_ {
type Output = $Self_;
... | fn add(self, other: $Self_) -> $Self_ {
$Self_(self.get() + other.get())
} | random_line_split |
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 http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive)]
#![feature(plugin)]
#![feature(step_trait)]
#![plugin(heapsize_plugin)]
#![plugin(serd... | else {
Range::new(begin, end - begin)
}
}
}
/// Methods for `Range`s with indices based on integer values
impl<T: Int, I: RangeIndex<Index=T>> Range<I> {
/// Returns an iterater that increments over `[begin, end)`.
#[inline]
pub fn each_index(&self) -> EachIndex<T, I> {
eac... | {
Range::empty()
} | conditional_block |
http-errors_v1.x.x.js | // flow-typed signature: 573c576fe34eb3c3c65dd7a9c90a46d2
// flow-typed version: b43dff3e0e/http-errors_v1.x.x/flow_>=v0.25.x
declare module 'http-errors' {
declare class | extends HttpError {
constructor(): SpecialHttpError;
}
declare class HttpError extends Error {
expose: bool;
message: string;
status: number;
statusCode: number;
}
declare module.exports: {
(status?: number, message?: string, props?: Object): HttpError;
HttpError: typeof HttpError;
... | SpecialHttpError | identifier_name |
http-errors_v1.x.x.js | // flow-typed signature: 573c576fe34eb3c3c65dd7a9c90a46d2
// flow-typed version: b43dff3e0e/http-errors_v1.x.x/flow_>=v0.25.x
declare module 'http-errors' {
declare class SpecialHttpError extends HttpError {
constructor(): SpecialHttpError;
}
declare class HttpError extends Error {
expose: bool;
mess... | ServiceUnavailable: typeof SpecialHttpError;
GatewayTimeout: typeof SpecialHttpError;
HTTPVersionNotSupported: typeof SpecialHttpError;
VariantAlsoNegotiates: typeof SpecialHttpError;
InsufficientStorage: typeof SpecialHttpError;
LoopDetected: typeof SpecialHttpError;
BandwidthLimitExceeded:... | InternalServerError: typeof SpecialHttpError;
NotImplemented: typeof SpecialHttpError;
BadGateway: typeof SpecialHttpError; | random_line_split |
pascal_str.rs | use std::borrow::{Cow, ToOwned};
use std::cmp::{Ordering, PartialEq, PartialOrd};
use std::ffi::{CStr, CString};
use std::str;
use ::utf8::PascalString;
use ::PASCAL_STRING_BUF_SIZE;
#[derive(Hash, Eq, Ord)]
pub struct PascalStr {
string: str
}
impl PascalStr {
#[inline]
pub fn as_ptr(&self) -> *const u8 ... | (&self) -> bool {
self.len() == PASCAL_STRING_BUF_SIZE
}
#[inline]
pub fn chars(&self) -> Chars {
self.string.chars()
}
#[inline]
pub fn bytes(&self) -> Bytes {
self.string.bytes()
}
#[inline]
pub fn lines(&self) -> Lines {
self.string.lines()
}... | is_full | identifier_name |
pascal_str.rs | use std::borrow::{Cow, ToOwned};
use std::cmp::{Ordering, PartialEq, PartialOrd};
use std::ffi::{CStr, CString};
use std::str;
use ::utf8::PascalString;
use ::PASCAL_STRING_BUF_SIZE;
#[derive(Hash, Eq, Ord)]
pub struct PascalStr {
string: str
}
impl PascalStr {
#[inline]
pub fn as_ptr(&self) -> *const u8 ... |
#[inline]
pub fn chars(&self) -> Chars {
self.string.chars()
}
#[inline]
pub fn bytes(&self) -> Bytes {
self.string.bytes()
}
#[inline]
pub fn lines(&self) -> Lines {
self.string.lines()
}
}
impl<S: AsRef<str> + ?Sized> PartialEq<S> for PascalStr {
#[... | {
self.len() == PASCAL_STRING_BUF_SIZE
} | identifier_body |
pascal_str.rs | use std::borrow::{Cow, ToOwned};
use std::cmp::{Ordering, PartialEq, PartialOrd};
use std::ffi::{CStr, CString};
use std::str;
use ::utf8::PascalString;
use ::PASCAL_STRING_BUF_SIZE;
#[derive(Hash, Eq, Ord)]
pub struct PascalStr {
string: str
}
impl PascalStr {
#[inline]
pub fn as_ptr(&self) -> *const u8 ... | }
}
impl AsRef<str> for PascalStr {
#[inline]
fn as_ref(&self) -> &str {
&self.string
}
}
pub type Chars<'a> = str::Chars<'a>;
pub type Bytes<'a> = str::Bytes<'a>;
pub type Lines<'a> = str::Lines<'a>;
pub struct InteriorNullError; | #[inline]
fn to_owned(&self) -> Self::Owned {
PascalString::from_str(self.as_str()).unwrap() | random_line_split |
fraction-circle.ts | import {BaseCircle} from "../base-class/base-circle";
import SvgTags from "../base-class/svg-tags";
import SvgTagsHelper from "../helper/svg-tags-helper";
import {IAvailableOptions} from "../interface/iavailable-options";
import {ISize} from "../interface/isize";
/**
* Every circle gets dynamically called by the give... |
this.animateInView();
}
/**
* @inheritDoc
*/
public drawCircle() {
this.drawContainer();
this.drawFraction();
this.append();
}
/**
* @description Draws the arc parts by given fraction count
*/
public drawFraction() {
this.fractionAn... | {
this.additionalCssClasses = this.options.additionalCssClasses;
} | conditional_block |
fraction-circle.ts | import {BaseCircle} from "../base-class/base-circle";
import SvgTags from "../base-class/svg-tags";
import SvgTagsHelper from "../helper/svg-tags-helper";
import {IAvailableOptions} from "../interface/iavailable-options";
import {ISize} from "../interface/isize";
/**
* Every circle gets dynamically called by the give... | y: 0,
};
private fractionAngle: number;
private rotateDegree: number;
protected radius: number;
protected additionalCssClasses: IAvailableOptions["additionalCssClasses"] = {};
private static isOdd(count: number) {
return count % 2;
}
/**
* @inheritDoc
*/
p... | random_line_split | |
fraction-circle.ts | import {BaseCircle} from "../base-class/base-circle";
import SvgTags from "../base-class/svg-tags";
import SvgTagsHelper from "../helper/svg-tags-helper";
import {IAvailableOptions} from "../interface/iavailable-options";
import {ISize} from "../interface/isize";
/**
* Every circle gets dynamically called by the give... | (element: Element): void {
}
}
export default FractionCircle;
| animate | identifier_name |
__main__.py | import ast
import heisenberg.library.heisenberg_dynamics_context
import heisenberg.library.orbit_plot
import heisenberg.option_parser
import heisenberg.plot
import heisenberg.util
import matplotlib
import numpy as np
import sys
# https://github.com/matplotlib/matplotlib/issues/5907 says this should fix "Exceeded cell ... |
elif options.initial is not None:
try:
options.initial = heisenberg.util.csv_as_ndarray(heisenberg.util.pop_brackets_off_of(options.initial), float)
expected_shape = (6,)
if options.initial.shape != expected_shape:
raise ValueError('--initial value had the wrong number of compon... | try:
options.initial_preimage = np.array(ast.literal_eval(options.initial_preimage))
expected_shape = (options.embedding_dimension,)
if options.initial_preimage.shape != expected_shape:
raise ValueError('--initial-preimage value had the wrong number of components (got {0} but expecte... | conditional_block |
__main__.py | import ast
import heisenberg.library.heisenberg_dynamics_context
import heisenberg.library.orbit_plot
import heisenberg.option_parser
import heisenberg.plot
import heisenberg.util
import matplotlib
import numpy as np
import sys
# https://github.com/matplotlib/matplotlib/issues/5907 says this should fix "Exceeded cell ... | except ValueError as e:
print('error parsing --initial value: {0}'.format(str(e)))
op.print_help()
sys.exit(-1)
else:
assert False, 'this should never happen because of the check with num_initial_conditions_specified'
rng = np.random.RandomState(options.seed)
heisenberg.plot.plot(dynami... | options.qp_0 = options.initial.reshape(2,3) | random_line_split |
__init__.py | # -*- Mode: Python -*-
import socket
import unittest
__version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROT... |
def bind (self, *args, **kwargs):
return self.sock.bind (*args, **kwargs)
def listen (self, *args, **kwargs):
return self.sock.listen (*args, **kwargs)
def accept (self):
sock, addr = self.sock.accept()
conn = Connection (MODE.SERVER)
conn.set_config (self.cfg)
... | return '<s2n sock=%r conn=%r @%x>' % (self.sock, self.conn, id (self)) | identifier_body |
__init__.py | # -*- Mode: Python -*-
| __version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROTOCOL, name, val)
PROTOCOL.reverse_map[val] = name
... | import socket
import unittest
| random_line_split |
__init__.py | # -*- Mode: Python -*-
import socket
import unittest
__version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROT... | (self):
if not self.negotiated:
self.conn.negotiate()
self.negotiated = True
def recv (self, block_size):
self._check_negotiated()
r = []
left = block_size
while left:
b, more = self.conn.recv (left)
r.append (b)
i... | negotiate | identifier_name |
__init__.py | # -*- Mode: Python -*-
import socket
import unittest
__version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROT... |
else:
pass
left -= n
return pos
def shutdown (self, how=None):
more = 1
while more:
more = self.conn.shutdown()
def close (self):
try:
self.shutdown()
finally:
self.sock.close()
| break | conditional_block |
ek-instance-filters.controller.js | /*
Copyright 2016 ElasticBox All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | this.instancesFilteredByState = _.chain(this.instancesToFilter)
.filter((x) => {
return _.isUndefined(this.selectedState) || this.selectedState.state.kind === 'all'
|| this.selectedState.state.kind.toLowerCase() === (x.kind || '').toLowerCase()
... | $scope.$watchCollection('ctrl.selectedOwners', () => this.filterInstancesByOwners());
$scope.$watchCollection('ctrl.instancesFilteredByState', () => this.filterInstancesByOwners());
}
filterInstancesByState() { | random_line_split |
ek-instance-filters.controller.js | /*
Copyright 2016 ElasticBox All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
}
export default InstanceFiltersController;
| {
this.filteredInstances = _.isEmpty(this.selectedOwners)
? this.instancesFilteredByState
: _.filter(this.instancesFilteredByState, (x) => _.includes(this.selectedOwners, x.owner));
} | identifier_body |
ek-instance-filters.controller.js | /*
Copyright 2016 ElasticBox All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | () {
this.instancesFilteredByState = _.chain(this.instancesToFilter)
.filter((x) => {
return _.isUndefined(this.selectedState) || this.selectedState.state.kind === 'all'
|| this.selectedState.state.kind.toLowerCase() === (x.kind || '').toLowerCase()
... | filterInstancesByState | identifier_name |
htmlobjectelement.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 http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
u... |
}
pub fn is_image_data(uri: &str) -> bool {
static types: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
types.iter().any(|&type_| uri.starts_with(type_))
}
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
fn Validity(self) -> Temporary<ValiditySta... | {
let elem: JSRef<Element> = ElementCast::from_ref(*self);
// TODO: support other values
match (elem.get_attribute(ns!(""), &atom!("type")).map(|x| x.root().Value()),
elem.get_attribute(ns!(""), &atom!("data")).map(|x| x.root().Value())) {
(None, Some(uri)) => {
... | identifier_body |
htmlobjectelement.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 http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
u... | (uri: &str) -> bool {
static types: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
types.iter().any(|&type_| uri.starts_with(type_))
}
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
fn Validity(self) -> Temporary<ValidityState> {
let window... | is_image_data | identifier_name |
htmlobjectelement.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 http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
u... | // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-object-type
make_setter!(SetType, "type")
}
impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods> {
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_borrowe... | // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-object-type
make_getter!(Type)
| random_line_split |
youtube-service.ts | import { Http, URLSearchParams, Response } from '@angular/http';
import { Injectable, NgZone } from '@angular/core';
import { window } from '@angular/platform-browser/src/facade/browser';
@Injectable()
export class YoutubeService {
youtube: any = {
ready: false,
player: null,
playerId: null,
videoId... | (): void {
console.log ("create player after ready");
return new window.YT.Player(this.youtube.playerId, {
height: this.youtube.playerHeight,
width: this.youtube.playerWidth,
playerVars: {
rel: 0,
showinfo: 0
}
});
}
loadPlayer(): void {
if (this.youtube.rea... | createPlayer | identifier_name |
youtube-service.ts | import { Http, URLSearchParams, Response } from '@angular/http';
import { Injectable, NgZone } from '@angular/core';
import { window } from '@angular/platform-browser/src/facade/browser';
| playerId: null,
videoId: null,
videoTitle: null,
playerHeight: '100%',
playerWidth: '100%'
}
constructor () {
this.setupPlayer();
}
bindPlayer(elementId): void {
this.youtube.playerId = elementId;
};
createPlayer(): void {
console.log ("create player after ready");
... | @Injectable()
export class YoutubeService {
youtube: any = {
ready: false,
player: null, | random_line_split |
youtube-service.ts | import { Http, URLSearchParams, Response } from '@angular/http';
import { Injectable, NgZone } from '@angular/core';
import { window } from '@angular/platform-browser/src/facade/browser';
@Injectable()
export class YoutubeService {
youtube: any = {
ready: false,
player: null,
playerId: null,
videoId... |
this.youtube.player = this.createPlayer();
}
}
setupPlayer () {
// in production mode, the youtube iframe api script tag is loaded
// before the bundle.js, so the 'onYouTubeIfarmeAPIReady' has
// already been triggered
// TODO: handle this in build or in nicer in code
console.log ("R... | {
this.youtube.player.destroy();
} | conditional_block |
youtube-service.ts | import { Http, URLSearchParams, Response } from '@angular/http';
import { Injectable, NgZone } from '@angular/core';
import { window } from '@angular/platform-browser/src/facade/browser';
@Injectable()
export class YoutubeService {
youtube: any = {
ready: false,
player: null,
playerId: null,
videoId... | ;
createPlayer(): void {
console.log ("create player after ready");
return new window.YT.Player(this.youtube.playerId, {
height: this.youtube.playerHeight,
width: this.youtube.playerWidth,
playerVars: {
rel: 0,
showinfo: 0
}
});
}
loadPlayer(): void {
if ... | {
this.youtube.playerId = elementId;
} | identifier_body |
cecog.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... | fullpath = path + f
# process folders in root dir:
if os.path.isdir(fullpath):
subDirs.append(fullpath)
# get the dataset name and project name from path
if len(subDirs) == 0:
p = path[:-1] # will remove the last folder
p = o... | # if we don't have any folders in the 'dir' E.g.
# CecogPackage/Data/Demo_data/0037/
# then 'Demo_data' becomes a dataset
subDirs = []
for f in os.listdir(path): | random_line_split |
cecog.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... | (self, args):
"""Uses PIL to read multiple planes from a local folder.
Planes are combined and uploaded to OMERO as new images with additional T, C,
Z dimensions.
It should be run as a local script (not via scripting service) in order that
it has access to the local users file system. Therefore need EMAN2 or ... | merge | identifier_name |
cecog.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... |
try:
register("cecog", CecogControl, CecogControl.__doc__)
except NameError:
if __name__ == "__main__":
cli = CLI()
cli.register("cecog", CecogControl, CecogControl.__doc__)
cli.invoke(sys.argv[1:])
| """CeCog integration plugin.
Provides actions for prepairing data and otherwise integrating with Cecog. See
the Run_Cecog_4.1.py script.
"""
# [MetaMorph_PlateScanPackage]
# regex_subdirectories = re.compile('(?=[^_]).*?(?P<D>\d+).*?')
# regex_position = re.compile('P(?P<P>.+?)_')
# continuous_fra... | identifier_body |
cecog.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... |
# get the dataset name and project name from path
if len(subDirs) == 0:
p = path[:-1] # will remove the last folder
p = os.path.dirname(p)
else:
if os.path.basename(path) == "":
p = path[:-1] # remove slash
datasetName = os.path.... | subDirs.append(fullpath) | conditional_block |
settings.py | """
Django settings for ltc_huobi project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | 'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
... | 'ltc.apps.LtcConfig', | random_line_split |
stepper-demo.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
*/
import {Component, OnInit} from '@angular/core';
import {ThemePalette} from '@angular/material/core';
import {Abstrac... |
ngOnInit() {
this.formGroup = this._formBuilder.group({
formArray: this._formBuilder.array([
this._formBuilder.group({
firstNameFormCtrl: ['', Validators.required],
lastNameFormCtrl: ['', Validators.required],
}),
this._formBuilder.group({
emailFormCtr... | {} | identifier_body |
stepper-demo.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
*/
import {Component, OnInit} from '@angular/core';
import {ThemePalette} from '@angular/material/core';
import {Abstrac... | theme = this.availableThemes[0].value;
/** Returns a FormArray with the name 'formArray'. */
get formArray(): AbstractControl | null {
return this.formGroup.get('formArray');
}
constructor(private _formBuilder: FormBuilder) {}
ngOnInit() {
this.formGroup = this._formBuilder.group({
formArra... | ];
| random_line_split |
stepper-demo.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
*/
import {Component, OnInit} from '@angular/core';
import {ThemePalette} from '@angular/material/core';
import {Abstrac... | implements OnInit {
formGroup: FormGroup;
isNonLinear = false;
isNonEditable = false;
disableRipple = false;
showLabelBottom = false;
isVertical = false;
nameFormGroup: FormGroup;
emailFormGroup: FormGroup;
steps = [
{label: 'Confirm your name', content: 'Last name, First name.'},
{label: '... | StepperDemo | identifier_name |
environment_variable_config_spec.ts | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* 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 agr... | () {
return new EnvironmentVariableConfig(true, "KEY", "value");
}
it("should validate presence of name", () => {
let envVar = validEnvironmentVariableConfig();
expect(envVar.isValid()).toBe(true);
expect(envVar.errors().count()).toBe(0);
validSecureEnvironmentVariableConfig();
expect(envV... | validSecureEnvironmentVariableConfig | identifier_name |
environment_variable_config_spec.ts | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* 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 agr... |
import {EnvironmentVariableConfig} from "models/new_pipeline_configs/environment_variable_config";
describe("EnvironmentVariableConfig model", () => {
function validEnvironmentVariableConfig() {
return new EnvironmentVariableConfig(false, "KEY", "value");
}
function validSecureEnvironmentVariableConfig() {... | * limitations under the License.
*/ | random_line_split |
environment_variable_config_spec.ts | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* 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 agr... |
function validSecureEnvironmentVariableConfig() {
return new EnvironmentVariableConfig(true, "KEY", "value");
}
it("should validate presence of name", () => {
let envVar = validEnvironmentVariableConfig();
expect(envVar.isValid()).toBe(true);
expect(envVar.errors().count()).toBe(0);
validS... | {
return new EnvironmentVariableConfig(false, "KEY", "value");
} | identifier_body |
VideoTexture.d.ts | import { Texture } from './Texture';
import { Mapping, Wrapping, TextureFilter, PixelFormat, TextureDataType } from '../constants';
export class VideoTexture extends Texture {
/**
* @param video
* @param [mapping=THREE.Texture.DEFAULT_MAPPING]
* @param [wrapS=THREE.ClampToEdgeWrapping]
* @param... | constructor(
video: HTMLVideoElement,
mapping?: Mapping,
wrapS?: Wrapping,
wrapT?: Wrapping,
magFilter?: TextureFilter,
minFilter?: TextureFilter,
format?: PixelFormat,
type?: TextureDataType,
anisotropy?: number,
);
readonly isVideoTe... | * @param [anisotropy=1]
*/ | random_line_split |
VideoTexture.d.ts | import { Texture } from './Texture';
import { Mapping, Wrapping, TextureFilter, PixelFormat, TextureDataType } from '../constants';
export class | extends Texture {
/**
* @param video
* @param [mapping=THREE.Texture.DEFAULT_MAPPING]
* @param [wrapS=THREE.ClampToEdgeWrapping]
* @param [wrapT=THREE.ClampToEdgeWrapping]
* @param [magFilter=THREE.LinearFilter]
* @param [minFilter=THREE.LinearFilter]
* @param [format=THREE.RGBFo... | VideoTexture | identifier_name |
views.py | from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount import requests
from allauth.socialaccount.models import SocialLog... | (self, request, app, token):
resp = requests.get(self.profile_url,
{ 'access_token': token.token,
'alt': 'json' })
extra_data = resp.json
# extra_data is something of the form:
#
# {u'family_name': u'Penners', u'name': u'R... | complete_login | identifier_name |
views.py | from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount import requests
from allauth.socialaccount.models import SocialLog... |
oauth2_login = OAuth2LoginView.adapter_view(GoogleOAuth2Adapter)
oauth2_callback = OAuth2CallbackView.adapter_view(GoogleOAuth2Adapter)
| provider_id = GoogleProvider.id
access_token_url = 'https://accounts.google.com/o/oauth2/token'
authorize_url = 'https://accounts.google.com/o/oauth2/auth'
profile_url = 'https://www.googleapis.com/oauth2/v1/userinfo'
def complete_login(self, request, app, token):
resp = requests.get(self.profi... | identifier_body |
views.py | from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount import requests
from allauth.socialaccount.models import SocialLog... | uid=uid,
provider=self.provider_id,
user=user)
return SocialLogin(account)
oauth2_login = OAuth2LoginView.adapter_view(GoogleOAuth2Adapter)
oauth2_callback = OAuth2CallbackView.adapter_view(GoogleOAuth2Adapter) | random_line_split | |
local.js | var TemplateLibraryTemplateView = require( 'elementor-templates/views/template/base' ),
TemplateLibraryTemplateLocalView;
TemplateLibraryTemplateLocalView = TemplateLibraryTemplateView.extend( {
template: '#tmpl-elementor-template-library-template-local',
ui: function() {
return _.extend( TemplateLibraryTemplate... | 'click @ui.toggleMore': 'onToggleMoreClick',
} );
},
onDeleteButtonClick: function() {
var toggleMoreIcon = this.ui.toggleMoreIcon;
elementor.templates.deleteTemplate( this.model, {
onConfirm: function() {
toggleMoreIcon.removeClass( 'eicon-ellipsis-h' ).addClass( 'eicon-loading eicon-animation-spin... |
events: function() {
return _.extend( TemplateLibraryTemplateView.prototype.events.apply( this, arguments ), {
'click @ui.deleteButton': 'onDeleteButtonClick', | random_line_split |
addn_packed_gpu.ts | /**
* @license
* Copyright 2019 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | this.userCode = `
void main() {
${snippets.join('\n ')}
vec4 result = ${operation};
setOutput(result);
}
`;
}
} | random_line_split | |
addn_packed_gpu.ts | /**
* @license
* Copyright 2019 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | (outputShape: number[], shapes: number[][]) {
this.outputShape = outputShape;
this.variableNames = shapes.map((_, i) => `T${i}`);
const snippets: string[] = [];
// Get target elements from every input tensor.
this.variableNames.forEach(variable => {
snippets.push(`vec4 v${variable} = get${var... | constructor | identifier_name |
performance.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 http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::... |
pub fn new(window: &JSRef<Window>) -> Temporary<Performance> {
let performance = Performance::new_inherited(window);
reflect_dom_object(box performance, window, PerformanceBinding::Wrap)
}
}
pub trait PerformanceMethods {
fn Timing(&self) -> Temporary<PerformanceTiming>;
fn Now(&self)... | {
let timing = JS::from_rooted(&PerformanceTiming::new(window).root().root_ref());
Performance {
reflector_: Reflector::new(),
timing: timing,
}
} | identifier_body |
performance.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 http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::... | fn Timing(&self) -> Temporary<PerformanceTiming> {
Temporary::new(self.timing.clone())
}
fn Now(&self) -> DOMHighResTimeStamp {
let navStart = self.timing.root().NavigationStartPrecise() as f64;
(time::precise_time_s() - navStart) as DOMHighResTimeStamp
}
}
impl Reflectable for... |
impl<'a> PerformanceMethods for JSRef<'a, Performance> { | random_line_split |
performance.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 http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::... | (&self) -> Temporary<PerformanceTiming> {
Temporary::new(self.timing.clone())
}
fn Now(&self) -> DOMHighResTimeStamp {
let navStart = self.timing.root().NavigationStartPrecise() as f64;
(time::precise_time_s() - navStart) as DOMHighResTimeStamp
}
}
impl Reflectable for Performance ... | Timing | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.