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 |
|---|---|---|---|---|
items.py | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from viaspider.settings import SUMMARY_LIMIT
class ViaspiderItem(scrapy.Item):
# define the fields for your item here like:
url = scrapy.Field()... |
@property
def summary(self):
result = self.response.xpath('//head/meta[@property="og:description"]/@content').extract()[0]
return result[:-(SUMMARY_LIMIT + 3)] + '...' if len(result) > SUMMARY_LIMIT else result
@property
def categories(self):
results = self.response.xp... | return result | conditional_block |
items.py | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from viaspider.settings import SUMMARY_LIMIT
class ViaspiderItem(scrapy.Item):
# define the fields for your item here like:
url = scrapy.Field()... | (self):
result = self.response.xpath('//head/meta[@property="article:published_time"]/@content').extract()[0]
return result
def parse(self):
item = ViaspiderItem()
item['url'] = self.url
item['source'] = self.source
item['title'] = self.title
item['su... | created | identifier_name |
use-keyword.rs | // Copyright 2016 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 ... |
mod a {
mod b {
use self as A;
//~^ ERROR `self` imports are only allowed within a { } list
use super as B;
//~^ ERROR unresolved import `super` [E0432]
//~| no `super` in the root
use super::{self as C};
//~^ ERROR unresolved import `super` [E0432]
/... | // FIXME: this shouldn't fail during name resolution either | random_line_split |
use-keyword.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {}
| main | identifier_name |
use-keyword.rs | // Copyright 2016 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 ... | {} | identifier_body | |
plot_quantiles.py | #!/usr/bin/env python
"""
=================================================
Draw a Quantile-Quantile Plot and Confidence Band
=================================================
This is an example of drawing a quantile-quantile plot with a confidence level
(CL) band.
"""
print __doc__
import ROOT
from rootpy.interactive... |
pad = c.cd(1)
h1.Draw('hist')
h2.Draw('hist same')
leg = Legend([h1, h2], pad=pad, leftmargin=0.5,
topmargin=0.11, rightmargin=0.05,
textsize=20)
leg.Draw()
pad = c.cd(2)
gr = qqgraph(h1, h2)
gr.xaxis.title = h1.title
gr.yaxis.title = h2.title
gr.fillcolor = 17
gr.fillstyle = 'solid'
gr... | h1.Fill(rand.Gaus(0, 0.8))
h2.Fill(rand.Gaus(0, 1)) | conditional_block |
plot_quantiles.py | #!/usr/bin/env python
"""
=================================================
Draw a Quantile-Quantile Plot and Confidence Band
=================================================
This is an example of drawing a quantile-quantile plot with a confidence level
(CL) band.
"""
print __doc__
import ROOT
from rootpy.interactive... | textsize=20)
leg.AddEntry(gr, "QQ points", "p")
leg.AddEntry(gr, "68% CL band", "f")
leg.AddEntry(f_dia, "Diagonal line", "l")
leg.Draw()
c.Modified()
c.Update()
c.Draw()
wait() | f_dia.SetLineStyle(2)
f_dia.Draw("same")
leg = Legend(3, pad=pad, leftmargin=0.45,
topmargin=0.45, rightmargin=0.05, | random_line_split |
externalUriOpenerService.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | (href: string, ctx: { sourceUri: URI; preferredOpenerId?: string }, token: CancellationToken): Promise<boolean> {
const targetUri = typeof href === 'string' ? URI.parse(href) : href;
const allOpeners = await this.getOpeners(targetUri, false, ctx, token);
if (allOpeners.length === 0) {
return false;
} else ... | openExternal | identifier_name |
externalUriOpenerService.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | const targetUri = typeof href === 'string' ? URI.parse(href) : href;
const allOpeners = await this.getOpeners(targetUri, false, ctx, token);
if (allOpeners.length === 0) {
return false;
} else if (allOpeners.length === 1) {
return allOpeners[0].openExternalUri(targetUri, ctx, token);
}
// Otherwise ... | random_line_split | |
externalUriOpenerService.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}
}
return undefined;
}
private async showOpenerPrompt(
openers: ReadonlyArray<IExternalUriOpener>,
targetUri: URI,
ctx: { sourceUri: URI },
token: CancellationToken
): Promise<boolean> {
type PickItem = IQuickPickItem & { opener?: IExternalUriOpener | 'configureDefault' };
const items: Array<P... | {
return entry;
} | conditional_block |
externalUriOpenerService.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
registerExternalOpenerProvider(provider: IExternalOpenerProvider): IDisposable {
const remove = this._providers.push(provider);
return { dispose: remove };
}
private async getOpeners(targetUri: URI, allowOptional: boolean, ctx: { sourceUri: URI; preferredOpenerId?: string }, token: CancellationToken): Promise... | {
super();
this._register(openerService.registerExternalOpener(this));
} | identifier_body |
analysis.py | #
# Copyright (C) 2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... |
return sources
def is_dependant(inscription1, inscription2):
if inscription1.edge is inscription2.edge and \
inscription2.index < inscription1.index:
return True
if not inscription2.is_expr_variable():
return False
return inscription2.expr in inscription1.get_foreign_variables(... | if not inscription.is_expr_variable():
continue
if sources.get(inscription.expr):
continue
if inscription.is_bulk():
sources[inscription.expr] = None
else:
sources[inscription.expr] = inscription.uid | conditional_block |
analysis.py | #
# Copyright (C) 2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... | continue
if variable in variable_sources_out:
# Variable already prepared for output
continue
if inscription.is_bulk():
# No token, just build variable
variable_sources_out[variable] = None
continue
if inscription.is_local()... | continue # We are interested only in variables
variable = inscription.expr
if variable in variable_sources:
# Variable take from input so we do not have to deal here with it | random_line_split |
analysis.py | #
# Copyright (C) 2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... | (tr):
variable_sources = {} # string -> uid - which inscriptions carry input variables
reuse_tokens = {} # uid -> uid - identification number of token for output inscpription
fresh_tokens = [] # (uid, type) - what tokens has to be created for output
used_tokens = [] # [uid] - Tokens from input inscript... | analyze_transition | identifier_name |
analysis.py | #
# Copyright (C) 2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... |
def inscription_in_weight(inscription):
if inscription.is_conditioned():
return 1
else:
return 0
inscriptions_in = sum((edge.inscriptions for edge in tr.edges_in), [])
inscriptions_in.sort(key=inscription_in_weight)
inscriptions_out = sum((edge.inscriptions for... | s = inscription.config.get("seq")
if s is None:
seq = 0
else:
seq = int(s) * 3
if inscription.is_bulk():
return seq
# Unconditional edges has higher priority
if inscription.is_conditioned():
return seq + 2
else:
... | identifier_body |
plist.js | /*
* Copyright (c) 2015 by Rafael Angel Aznar Aparici (rafaaznar at gmail dot com)
*
* openAUSIAS: The stunning micro-library that helps you to develop easily
* AJAX web applications by using Java and jQuery
* openAUSIAS is distributed under the MIT License (MIT)
* Sources at https://github.com/raf... | else {
$scope.filterParams = "";
}
if ($routeParams.systemfilter && $routeParams.systemfilteroperator && $routeParams.systemfiltervalue) {
$scope.systemFilterParams = "&systemfilter=" + $routeParams.systemfilter + "&systemfilteroperator=" + $routeParams.systemfilteroperator + "... | {
$scope.filter = $routeParams.filter;
$scope.filteroperator = $routeParams.filteroperator;
$scope.filtervalue = $routeParams.filtervalue;
$scope.filterParams = "&filter=" + $routeParams.filter + "&filteroperator=" + $routeParams.filteroperator + "&filtervalue=" + $routeP... | conditional_block |
plist.js | /*
* Copyright (c) 2015 by Rafael Angel Aznar Aparici (rafaaznar at gmail dot com)
*
* openAUSIAS: The stunning micro-library that helps you to develop easily
* AJAX web applications by using Java and jQuery
* openAUSIAS is distributed under the MIT License (MIT)
* Sources at https://github.com/raf... | $scope.filteroperator = $routeParams.filteroperator;
$scope.filtervalue = $routeParams.filtervalue;
$scope.filterParams = "&filter=" + $routeParams.filter + "&filteroperator=" + $routeParams.filteroperator + "&filtervalue=" + $routeParams.filtervalue;
$scope.paramsWithout... | if ($routeParams.filter && $routeParams.filteroperator && $routeParams.filtervalue) {
$scope.filter = $routeParams.filter; | random_line_split |
requests.ts | /// <reference path="./../typings/index.d.ts" />
import {Request} from "hapi";
import * as Bluebird from "bluebird";
/**
* Returns the request's protocol (e.g. https) by trying to read the x-forwarded-proto header. This is the protocol the user typed into their address bar.
* Useful when your server doesn't serve r... | {
return new Bluebird<string>((resolve, reject) =>
{
let body = "";
request.raw.req.on("data", (data: Uint8Array) =>
{
body += data.toString();
});
request.raw.req.once("end", () =>
{
resolve(body);
});
})
} | identifier_body | |
requests.ts | /// <reference path="./../typings/index.d.ts" />
import {Request} from "hapi";
import * as Bluebird from "bluebird";
/**
* Returns the request's protocol (e.g. https) by trying to read the x-forwarded-proto header. This is the protocol the user typed into their address bar.
* Useful when your server doesn't serve r... |
/**
* Gets the raw request body string.
*/
export async function getRawBody(request: Request)
{
return new Bluebird<string>((resolve, reject) =>
{
let body = "";
request.raw.req.on("data", (data: Uint8Array) =>
{
body += data.toString();
});
request.raw.r... | const protocol = getRequestProtocol(request);
const host = getRequestHost(request);
return `${protocol}://${host}`
} | random_line_split |
requests.ts | /// <reference path="./../typings/index.d.ts" />
import {Request} from "hapi";
import * as Bluebird from "bluebird";
/**
* Returns the request's protocol (e.g. https) by trying to read the x-forwarded-proto header. This is the protocol the user typed into their address bar.
* Useful when your server doesn't serve r... | (request: Request)
{
return request.info.host;
}
/**
* Returns the request's protocol + host (e.g. https://www.example.com). This is the domain the user typed into their address bar.
* Useful when your server doesn't serve requests directly, but rather passes them through a proxy to your app.
*/
export function... | getRequestHost | identifier_name |
main.js | /* ========================================================================
* DOM-based Routing
* Based on http://goo.gl/EUTi53 by Paul Irish
*
* Only fires on body classes that match. If a body class contains a dash,
* replace the dash with an underscore when adding it to the object below.
*
* .noConflict()
* ... |
},
loadEvents: function() {
// Fire common init JS
UTIL.fire('common');
// Fire page-specific init JS, and then finalize JS
$.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) {
UTIL.fire(classnm);
UTIL.fire(classnm, 'finalize');
}... | {
namespace[func][funcname](args);
} | conditional_block |
main.js | /* ========================================================================
* DOM-based Routing
* Based on http://goo.gl/EUTi53 by Paul Irish
*
* Only fires on body classes that match. If a body class contains a dash,
* replace the dash with an underscore when adding it to the object below.
*
* .noConflict()
* ... | // About us page, note the change from about-us to about_us.
'about_us': {
init: function() {
// JavaScript to be fired on the about us page
}
}
};
// The routing fires all common scripts, followed by the page specific scripts.
// Add additional events for more control over timing... | // JavaScript to be fired on the home page, after the init JS
}
}, | random_line_split |
demand.rs | // Copyright 2012 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 ... | (fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
suptype_with_fn(fcx, sp, true, actual, expected,
|sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) })
}
pub fn suptype_with_fn(fcx: &FnCtxt,
sp: Span,
b_is_expected: bool,
... | subtype | identifier_name |
demand.rs | // Copyright 2012 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 { expected };
match fcx.mk_assignty(expr, expr_ty, expected) {
result::Ok(()) => { /* ok */ }
result::Err(ref err) => {
fcx.report_mismatched_types(sp, expected, expr_ty, err);
}
}
}
| {
resolve_type(fcx.infcx(), expected,
try_resolve_tvar_shallow).unwrap_or(expected)
} | conditional_block |
demand.rs | // Copyright 2012 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 ... |
pub fn suptype_with_fn(fcx: &FnCtxt,
sp: Span,
b_is_expected: bool,
ty_a: ty::t,
ty_b: ty::t,
handle_err: |Span, ty::t, ty::t, &ty::type_err|) {
// n.b.: order of actual, expected is reversed
mat... | {
suptype_with_fn(fcx, sp, true, actual, expected,
|sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) })
} | identifier_body |
demand.rs | // Copyright 2012 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 ... |
pub fn subtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
suptype_with_fn(fcx, sp, true, actual, expected,
|sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) })
}
pub fn suptype_with_fn(fcx: &FnCtxt,
sp: Span,
b_is_expected: bool,
... | suptype_with_fn(fcx, sp, false, expected, actual,
|sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) })
} | random_line_split |
core.py | # -*- coding: utf8 -*-
# This file is part of Mnemosyne.
#
# Copyright (C) 2013 Daniel Lombraña González
#
# Mnemosyne is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | "
Create the Flask app object after configuring it.
Keyword arguments:
db_name -- Database name
testing -- Enable/Disable testing mode
Return value:
app -- Flask application object
"""
try:
app = Flask(__name__)
app.config.from_object(settings)
except:
... | identifier_body | |
core.py | # -*- coding: utf8 -*-
# This file is part of Mnemosyne.
#
# Copyright (C) 2013 Daniel Lombraña González
#
# Mnemosyne is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | b_name=None, testing=False):
"""
Create the Flask app object after configuring it.
Keyword arguments:
db_name -- Database name
testing -- Enable/Disable testing mode
Return value:
app -- Flask application object
"""
try:
app = Flask(__name__)
app.config... | eate_app(d | identifier_name |
core.py | # -*- coding: utf8 -*-
# This file is part of Mnemosyne.
#
# Copyright (C) 2013 Daniel Lombraña González
#
# Mnemosyne is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... |
if db_name:
app.config['SQLALCHEMY_DATABASE_URI'] = db_name
db.init_app(app)
app.register_blueprint(frontend)
return app | app.config.from_object(settings)
except:
print "Settings file is missing, trying with env config..."
app.config.from_envvar('MNEMOSYNE_SETTINGS', silent=False) | random_line_split |
core.py | # -*- coding: utf8 -*-
# This file is part of Mnemosyne.
#
# Copyright (C) 2013 Daniel Lombraña González
#
# Mnemosyne is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | db.init_app(app)
app.register_blueprint(frontend)
return app
| p.config['SQLALCHEMY_DATABASE_URI'] = db_name
| conditional_block |
Profile.js | function Profile(data, raw) |
module.exports = Profile; | {
this.displayName = data.name;
this.id = data.user_id || data.sub;
this.user_id = this.id;
if (data.identities) {
this.provider = data.identities[0].provider;
} else if (typeof this.id === 'string' && this.id.indexOf('|') > -1 ) {
this.provider = this.id.split('|')[0];
}
this.name = {
famil... | identifier_body |
Profile.js | function Profile(data, raw) {
this.displayName = data.name;
this.id = data.user_id || data.sub;
this.user_id = this.id;
if (data.identities) {
this.provider = data.identities[0].provider;
} else if (typeof this.id === 'string' && this.id.indexOf('|') > -1 ) {
this.provider = this.id.split('|')[0];
... | module.exports = Profile; | random_line_split | |
Profile.js | function | (data, raw) {
this.displayName = data.name;
this.id = data.user_id || data.sub;
this.user_id = this.id;
if (data.identities) {
this.provider = data.identities[0].provider;
} else if (typeof this.id === 'string' && this.id.indexOf('|') > -1 ) {
this.provider = this.id.split('|')[0];
}
this.name =... | Profile | identifier_name |
mig-form.component.spec.ts | import { ComponentFixture, TestBed, async, inject } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { MigFormComponent } from './mig-form.component';
import { SpinnerComponent } from './spinner.comp... |
}
let sensorServiceStub = {
getSensorID(host: string, sensor: string) {
return "58504ec048e01100073bec96"
}
}
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MigFormComponent, SpinnerComponent], // declare the test component
providers: [{ provide: MigSe... | {
return Observable.of([
{
"_id": "58504d6948e01100073bec93",
"temperature": 24.4,
"soil": 367,
"humidity": 33.2,
"host": "rpi02",
"timestamp": "2016-12-13T19:35:03.895033",
"sensor": [
"soil",
"humidity",
... | identifier_body |
mig-form.component.spec.ts | import { ComponentFixture, TestBed, async, inject } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { MigFormComponent } from './mig-form.component';
import { SpinnerComponent } from './spinner.comp... |
comp = fixture.componentInstance; // BannerComponent test
}));
it('comp type is correct', () => {
expect(comp instanceof MigFormComponent).toBe(true);
})
it('panel title correct', () => {
// query for the title <h1> by CSS element selector
let de = fixture.debugElement.query(By.css('.panel... | fixture = TestBed.createComponent(MigFormComponent); | random_line_split |
mig-form.component.spec.ts | import { ComponentFixture, TestBed, async, inject } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { MigFormComponent } from './mig-form.component';
import { SpinnerComponent } from './spinner.comp... | (host: string, sensor: string) {
return "58504ec048e01100073bec96"
}
}
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MigFormComponent, SpinnerComponent], // declare the test component
providers: [{ provide: MigService, useValue: migServiceStub },
{ provide... | getSensorID | identifier_name |
typescript.ts | import * as ts from 'typescript';
import { getLibraryName } from './node-modules';
const namedDeclarationKinds = [
ts.SyntaxKind.InterfaceDeclaration,
ts.SyntaxKind.ClassDeclaration,
ts.SyntaxKind.EnumDeclaration,
ts.SyntaxKind.TypeAliasDeclaration,
ts.SyntaxKind.ModuleDeclaration,
ts.SyntaxKind.FunctionDeclara... | }
export function splitTransientSymbol(symbol: ts.Symbol, typeChecker: ts.TypeChecker): ts.Symbol[] {
// actually I think we even don't need to operate/use "Transient" symbols anywhere
// it's kind of aliased symbol, but just merged
// but it's hard to refractor everything to use array of symbols instead of just sy... | }
return getActualSymbol(symbol, typeChecker); | random_line_split |
typescript.ts | import * as ts from 'typescript';
import { getLibraryName } from './node-modules';
const namedDeclarationKinds = [
ts.SyntaxKind.InterfaceDeclaration,
ts.SyntaxKind.ClassDeclaration,
ts.SyntaxKind.EnumDeclaration,
ts.SyntaxKind.TypeAliasDeclaration,
ts.SyntaxKind.ModuleDeclaration,
ts.SyntaxKind.FunctionDeclara... | onst decl = declarations[0];
if (!isNodeNamedDeclaration(decl)) {
return undefined;
}
return decl.name;
}
export function getExportsForStatement(
exportedSymbols: readonly SourceFileExport[],
typeChecker: ts.TypeChecker,
statement: ts.Statement
): SourceFileExport[] {
if (ts.isVariableStatement(statement)) {... | return undefined;
}
c | conditional_block |
typescript.ts | import * as ts from 'typescript';
import { getLibraryName } from './node-modules';
const namedDeclarationKinds = [
ts.SyntaxKind.InterfaceDeclaration,
ts.SyntaxKind.ClassDeclaration,
ts.SyntaxKind.EnumDeclaration,
ts.SyntaxKind.TypeAliasDeclaration,
ts.SyntaxKind.ModuleDeclaration,
ts.SyntaxKind.FunctionDeclara... | e: ts.Node): node is ts.ModuleDeclaration {
// `declare module ""`, `declare global` and `namespace {}` are ModuleDeclaration
// but here we need to check only `declare module` statements
return ts.isModuleDeclaration(node) && !(node.flags & ts.NodeFlags.Namespace) && !isGlobalScopeAugmentation(node);
}
/**
* Retu... | clareModule(nod | identifier_name |
typescript.ts | import * as ts from 'typescript';
import { getLibraryName } from './node-modules';
const namedDeclarationKinds = [
ts.SyntaxKind.InterfaceDeclaration,
ts.SyntaxKind.ClassDeclaration,
ts.SyntaxKind.EnumDeclaration,
ts.SyntaxKind.TypeAliasDeclaration,
ts.SyntaxKind.ModuleDeclaration,
ts.SyntaxKind.FunctionDeclara... |
export function splitTransientSymbol(symbol: ts.Symbol, typeChecker: ts.TypeChecker): ts.Symbol[] {
// actually I think we even don't need to operate/use "Transient" symbols anywhere
// it's kind of aliased symbol, but just merged
// but it's hard to refractor everything to use array of symbols instead of just sym... | {
const symbol = typeChecker.getSymbolAtLocation(name);
if (symbol === undefined) {
return null;
}
return getActualSymbol(symbol, typeChecker);
} | identifier_body |
test.js | /*eslint no-console: 0 no-unused-vars: 0*/
import {compileREPL, getError, repl2_setup, readFromRepl} from './repl2'
import {parse} from '../src/parser'
import {lex} from '../src/lex'
import * as analyzer from '../src/analyzer'
import * as structures from '../src/structures'
import types from '../src/runtime/types'
imp... | if(expected === "LOCAL IS BETTER"){
parseEl.style.background = 'lightblue'
return true
}
if(expected === "PASS"){ return setTestFailureLink(row, expected, recieved)}
else{
let localJSON = JSON.parse(recieved["structured-error"])
let serverJSON = JSON.parse(JSON.pa... | random_line_split | |
test.js | /*eslint no-console: 0 no-unused-vars: 0*/
import {compileREPL, getError, repl2_setup, readFromRepl} from './repl2'
import {parse} from '../src/parser'
import {lex} from '../src/lex'
import * as analyzer from '../src/analyzer'
import * as structures from '../src/structures'
import types from '../src/runtime/types'
imp... |
function runTests(verbose){
function test(expr, expected, desugarRef, bytecodeRef, pyretSrcRef, pyretJSONRef){
// show the result
var row = document.createElement('tr')
var num = document.createElement('td')
var test = document.createElement('td')
var lexEl = document.createElement('td')
... | {
var which = document.getElementById('whichTests')
console.log(json)
for(var i=0; i<json.feed.entry.length; i++){
rows.push(json.feed.entry[i].content.$t)
var chunks = rows[i].split(/expr\:|, local\: |, server\: |, diff\: |, reason\: |, desugar\: |, bytecode\: |, pyret\: |, pyretast\: /)
var expr =... | identifier_body |
test.js | /*eslint no-console: 0 no-unused-vars: 0*/
import {compileREPL, getError, repl2_setup, readFromRepl} from './repl2'
import {parse} from '../src/parser'
import {lex} from '../src/lex'
import * as analyzer from '../src/analyzer'
import * as structures from '../src/structures'
import types from '../src/runtime/types'
imp... | (obj){
var fields = [], obj2={}
for (i in obj) { if (obj.hasOwnProperty(i) && obj[i] !== "") fields.push(i) }
fields.sort()
for (var i=0;i<fields.length; i++) { obj2[fields[i]] = obj[fields[i]] }
return obj2
}
function canonicalizeLiteral(lit){
return lit.toString().replace(/\s*/g,"")
}
... | canonicalizeObject | identifier_name |
argument.ts | /**
* Copyright 2018 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 applica... |
return (arg as ArgumentsIndexable)[key];
}
// Manually handle the PERMISSION argument because of a bug not returning boolValue
if (arg.name === 'PERMISSION') {
return !!arg.boolValue;
}
return arg.textValue;
};
export class Parsed {
/** @public */
list: Argument[];
/** @public */
input: Arg... | {
continue;
} | conditional_block |
argument.ts | /**
* Copyright 2018 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 applica... |
/** @public */
get(name: string) {
return this.input[name];
}
}
export class Raw {
/** @public */
input: ArgumentsRaw;
/** @hidden */
constructor(public list: Api.GoogleActionsV2Argument[]) {
this.input = list.reduce((o, arg) => {
o[arg.name!] = arg;
return o;
}, {} as Argument... | {
this.list = raw.map((arg, i) => {
const name = arg.name!;
const status = arg.status;
this.input[name] = status;
return status;
});
} | identifier_body |
argument.ts | /**
* Copyright 2018 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 applicable law or agreed to in writing, software
* distributed u... | random_line_split | |
argument.ts | /**
* Copyright 2018 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 applica... | (name: string) {
return this.input[name];
}
}
export class Raw {
/** @public */
input: ArgumentsRaw;
/** @hidden */
constructor(public list: Api.GoogleActionsV2Argument[]) {
this.input = list.reduce((o, arg) => {
o[arg.name!] = arg;
return o;
}, {} as ArgumentsRaw);
}
/** @publi... | get | identifier_name |
app_store.py | #!/usr/bin/env python
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# P... | defaultimg = "img/unknown.png";
pixmap = QtGui.QPixmap(defaultimg);
icon = QtGui.QIcon(pixmap);
button = QtGui.QToolButton();
action = QtGui.QAction( icon, str(name), self );
action.setStatusTip('Install App')
button.setDefaultAction(action);
butto... | self._cb = callback;
pkgimg = "img/" + name + ".png";
if os.path.exists(pkgimg):
pixmap = QtGui.QPixmap(pkgimg);
else: | random_line_split |
app_store.py | #!/usr/bin/env python
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# P... |
class Remover:
def __init__(self, parent, name):
self.parent = parent;
self.name = name;
def cb(self):
print "removing "+ self.name;
remove(self.name);
self.parent.refresh();
class ASMain(QtGui.QWidget):
#class ASMain(QtGui.QMainWindow):
def __init__(self):
... | def __init__(self, parent, name):
self.parent = parent;
self.name = name;
def cb(self):
print "installing "+ self.name;
install(self.name);
self.parent.refresh(); | identifier_body |
app_store.py | #!/usr/bin/env python
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# P... | (QtGui.QWidget):
def __init__(self, parent, name):
super(AppList, self).__init__()
self.parent = parent;
self.lay = QtGui.QGridLayout();
self.setLayout(self.lay);
self.width = 8;
self.idx = 0;
self.cbd = {};
def cb(self):
self._cb();
def addB... | AppList | identifier_name |
app_store.py | #!/usr/bin/env python
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# P... |
self.cbs = cbs;
app = QtGui.QApplication(sys.argv)
mw = ASMain();
sys.exit(app.exec_());
| cbs[c] = {};
cidx = categories.index(c);
pkgs = catpkg[c];
pkgs.sort();
for p in pkgs:
installed = global_recipes[p].satisfy();
if(installed):
cbs[c][p] = Remover(self, p);
pcidx = 2*cidx+1;
... | conditional_block |
attribute-form.js | /**
* Copyright (c) 2008-2009 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
* of the license.
*/
/** api: example[attribute-form]
* Attribute Form
* --------------
* Create a form with fields from attri... | attributeStore.load();
}); | random_line_split | |
InputSearchUi.js | import React from 'react';
// A seach input presentational component.
export default React.createClass({
propTypes: {
search: React.PropTypes.func.isRequired,
placeholder: React.PropTypes.string.isRequired
},
searchClear: function() {
return $("#search-clear");
},
searchInput: function() {
r... |
}
}/>
<span id="search-clear" className="glyphicon glyphicon-remove-circle"
onClick={this.resetSearch}></span>
</form>
);
}
});
| {
event.preventDefault();
event.stopPropagation();
} | conditional_block |
InputSearchUi.js | import React from 'react';
// A seach input presentational component.
export default React.createClass({
propTypes: {
search: React.PropTypes.func.isRequired,
placeholder: React.PropTypes.string.isRequired
},
searchClear: function() {
return $("#search-clear");
},
searchInput: function() {
r... | }
}/>
<span id="search-clear" className="glyphicon glyphicon-remove-circle"
onClick={this.resetSearch}></span>
</form>
);
}
}); | if (event.nativeEvent.keyCode === 13) {
event.preventDefault();
event.stopPropagation();
} | random_line_split |
topn_ops.py | # Copyright 2016 The TensorFlow Authors. 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 applica... |
return _topn_ops
| ops_path = tf.resource_loader.get_path_to_datafile(TOPN_OPS_FILE)
tf.logging.info('data path: %s', ops_path)
_topn_ops = tf.load_op_library(ops_path)
assert _topn_ops, 'Could not load topn_ops.so' | conditional_block |
topn_ops.py | # Copyright 2016 The TensorFlow Authors. 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 applica... | ():
"""Load the TopN ops library and return the loaded module."""
with _ops_lock:
global _topn_ops
if not _topn_ops:
ops_path = tf.resource_loader.get_path_to_datafile(TOPN_OPS_FILE)
tf.logging.info('data path: %s', ops_path)
_topn_ops = tf.load_op_library(ops_path)
assert _topn_ops... | Load | identifier_name |
topn_ops.py | # Copyright 2016 The TensorFlow Authors. 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 applica... | """Load the TopN ops library and return the loaded module."""
with _ops_lock:
global _topn_ops
if not _topn_ops:
ops_path = tf.resource_loader.get_path_to_datafile(TOPN_OPS_FILE)
tf.logging.info('data path: %s', ops_path)
_topn_ops = tf.load_op_library(ops_path)
assert _topn_ops, 'Cou... | identifier_body | |
topn_ops.py | # Copyright 2016 The TensorFlow Authors. 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 applica... | # ==============================================================================
"""Ops for TopN class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import tensorflow as tf
from tensorflow.python.framework import common_shapes
from t... | # See the License for the specific language governing permissions and
# limitations under the License. | random_line_split |
express.ts | 'use strict';
import express = require('express');
import stylus = require('stylus');
import bodyParser = require('body-parser');
import cookieParser = require('cookie-parser');
import session = require('express-session');
import passport = require('passport');
import config = require('config');
| app.set('views', config.rootPath + '/server/views');
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(session({
secret: 'team-hestia',
name: 'session',
proxy: true,
resave: true,
saveUninitialized: true
}));
app.use(stylus.middleware(
... | export function init(app: express.Express, config: config.IConfig) {
app.set('view engine', 'jade'); | random_line_split |
express.ts | 'use strict';
import express = require('express');
import stylus = require('stylus');
import bodyParser = require('body-parser');
import cookieParser = require('cookie-parser');
import session = require('express-session');
import passport = require('passport');
import config = require('config');
export function init(... | ; | {
app.set('view engine', 'jade');
app.set('views', config.rootPath + '/server/views');
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(session({
secret: 'team-hestia',
name: 'session',
proxy: true,
resave: true,
saveUninitialized: true
}... | identifier_body |
express.ts | 'use strict';
import express = require('express');
import stylus = require('stylus');
import bodyParser = require('body-parser');
import cookieParser = require('cookie-parser');
import session = require('express-session');
import passport = require('passport');
import config = require('config');
export function | (app: express.Express, config: config.IConfig) {
app.set('view engine', 'jade');
app.set('views', config.rootPath + '/server/views');
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(session({
secret: 'team-hestia',
name: 'session',
proxy: tru... | init | identifier_name |
lifetime-update.rs | #![feature(type_changing_struct_update)]
#![allow(incomplete_features)]
#[derive(Clone)]
struct Machine<'a, S> { | }
#[derive(Clone)]
struct State1;
#[derive(Clone)]
struct State2;
fn update_to_state2() {
let s = String::from("hello");
let m1: Machine<State1> = Machine {
state: State1,
lt_str: &s,
//~^ ERROR `s` does not live long enough [E0597]
// FIXME: The error here actu... | state: S,
lt_str: &'a str,
common_field: i32, | random_line_split |
lifetime-update.rs | #![feature(type_changing_struct_update)]
#![allow(incomplete_features)]
#[derive(Clone)]
struct Machine<'a, S> {
state: S,
lt_str: &'a str,
common_field: i32,
}
#[derive(Clone)]
struct | ;
#[derive(Clone)]
struct State2;
fn update_to_state2() {
let s = String::from("hello");
let m1: Machine<State1> = Machine {
state: State1,
lt_str: &s,
//~^ ERROR `s` does not live long enough [E0597]
// FIXME: The error here actually comes from line 34. The
... | State1 | identifier_name |
movie.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import {UtilityComponent} from '../../shared/components/utility.component';
import { Movie } from './movie.model';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class MovieService {
// Constru... | (id: number): Observable<Array<any>> {
let moviesUrl = UtilityComponent.getUrl('movie/'+id+'/videos');
return this.http.get(moviesUrl)
.map(this.extractData)
.catch(this.handleError);
}
// Get the movie's credit list
getMovieCredits(id: number){
let moviesUrl = Ut... | getMovieVideos | identifier_name |
movie.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import {UtilityComponent} from '../../shared/components/utility.component';
import { Movie } from './movie.model';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class MovieService {
// Constru... | return this.http.get(moviesUrl)
.map(this.extractData)
.catch(this.handleError);
}
// Get the movie's videos by id
getMovieVideos (id: number): Observable<Array<any>> {
let moviesUrl = UtilityComponent.getUrl('movie/'+id+'/videos');
return this.http.get(moviesUrl)
... | random_line_split | |
movie.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import {UtilityComponent} from '../../shared/components/utility.component';
import { Movie } from './movie.model';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class MovieService {
// Constru... | else{
// Get popular movies
moviesUrl = UtilityComponent.getUrl('discover/movie','&page='+page);
}
return this.http.get(moviesUrl)
.map(this.extractData)
.catch(this.handleError);
}
// Get the movie's videos by id
getMovieVideos (id: number): Observabl... | {
// Get movies by name
moviesUrl = UtilityComponent.getUrl('search/movie','&query='+name+'&page='+page);
} | conditional_block |
movie.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import {UtilityComponent} from '../../shared/components/utility.component';
import { Movie } from './movie.model';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class MovieService {
// Constru... |
// Get movie's details by id
getMovieById (id: number): Observable<Movie> {
let moviesUrl = UtilityComponent.getUrl('movie/'+id);
return this.http.get(moviesUrl)
.map(res => res.json())
.catch(this.handleError);
}
// Get movie list by name
getMovies (name: stri... | {} | identifier_body |
ActionParameterRowEditorDialog.js | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | this.rowIndex = rowIndex;
var model = this.grid.store.getAt(rowIndex);
if (isNotEmpty(model)) {
this.paramName.setValue(model.get('name'));
this.paramLocation.setValue(model.get('location'));
this.paramType.setValue(model.get('fieldType... |
fillingEditor: function(rowIndex) {
if (isNotEmpty(rowIndex)) { | random_line_split |
ActionParameterRowEditorDialog.js | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
}
},
startEditing: function(rowIndex) {
this.show();
this.fillingEditor(rowIndex);
var constraints = Ext.create('OPF.core.validation.FormInitialisation', OPF.core.utils.RegistryNodeType.ACTION_PARAMETER.getConstraintName());
constraints.initConstraints(this.form, null)... | {
this.paramName.setValue(model.get('name'));
this.paramLocation.setValue(model.get('location'));
this.paramType.setValue(model.get('fieldType'));
this.paramDescription.setValue(model.get('description'));
} | conditional_block |
lib.rs | #![doc(html_root_url = "http://cpjreynolds.github.io/rustty/rustty/index.html")]
//! # Rustty
//!
//! Rustty is a terminal UI library that provides a simple, concise abstraction over an
//! underlying terminal device.
//!
//! Rustty is based on the concepts of cells and events. A terminal display is an array of cells,... | pub use core::position::{Pos, Size, HasSize, HasPosition};
pub use core::input::Event;
pub use util::errors::Error; | Color,
Attr,
CellAccessor,
}; | random_line_split |
WAxesButtons.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from roars.gui.pyqtutils import PyQtWidget, PyQtImageConverter
from WBaseWidget import WBaseWidget
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore
class WAxesButtons(WBaseWidget):
def | (self, name='axes', label='Axes Buttons', changeCallback=None, step=0.001):
super(WAxesButtons, self).__init__(
'ui_axes_buttons'
)
self.name = name
self.label = label
self.step = step
self.ui_label.setText(label)
#⬢⬢⬢⬢⬢➤ Callback
self.change... | __init__ | identifier_name |
WAxesButtons.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from roars.gui.pyqtutils import PyQtWidget, PyQtImageConverter
from WBaseWidget import WBaseWidget
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore
class WAxesButtons(WBaseWidget):
def __init__(self, name='axes', label='Axes Buttons', ... | .buttons_name_map[str(self.sender().objectName())]
delta = float(label[1] + str(self.step))
val = (self.name, label[0], delta)
self.changeCallback(val)
| conditional_block | |
WAxesButtons.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*- | from PyQt4.QtCore import *
from PyQt4 import QtCore
class WAxesButtons(WBaseWidget):
def __init__(self, name='axes', label='Axes Buttons', changeCallback=None, step=0.001):
super(WAxesButtons, self).__init__(
'ui_axes_buttons'
)
self.name = name
self.label = label
... |
from roars.gui.pyqtutils import PyQtWidget, PyQtImageConverter
from WBaseWidget import WBaseWidget
from PyQt4.QtGui import * | random_line_split |
WAxesButtons.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from roars.gui.pyqtutils import PyQtWidget, PyQtImageConverter
from WBaseWidget import WBaseWidget
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore
class WAxesButtons(WBaseWidget):
def __init__(self, name='axes', label='Axes Buttons', ... | ttonPressed(self):
if self.changeCallback != None:
label = self.buttons_name_map[str(self.sender().objectName())]
delta = float(label[1] + str(self.step))
val = (self.name, label[0], delta)
self.changeCallback(val)
| super(WAxesButtons, self).__init__(
'ui_axes_buttons'
)
self.name = name
self.label = label
self.step = step
self.ui_label.setText(label)
#⬢⬢⬢⬢⬢➤ Callback
self.changeCallback = changeCallback
self.buttons = {
'x+': self.ui_button... | identifier_body |
component.js | /**
* Component displaying the entity mapping inside a modal
* @module components/modals/entity-mapping-modal
* @property {Boolean} showEntityMappingModal - Flag toggling the modal view
* @property {Object} metric - primary metric Object
* @property {Function} onSubmit - closure ac... |
} catch (error) {
return this.setError('error');
}
await this._fetchRelatedEntities();
this.reset();
this.clearError();
},
/**
* Action handler for metric selection change
* @param {Object} metric
*/
onEntitySelection(entity) {
setProperties(this,... | {
throw new Error('Uh Oh. Something went wrong.');
} | conditional_block |
component.js | /**
* Component displaying the entity mapping inside a modal
* @module components/modals/entity-mapping-modal
* @property {Boolean} showEntityMappingModal - Flag toggling the modal view
* @property {Object} metric - primary metric Object
* @property {Function} onSubmit - closure ac... | () {
this._super(...arguments);
const datasets = await fetch(entityMappingApi.getDatasetsUrl).then(checkStatus);
if (this.isDestroyed || this.isDestroying) {
return;
}
set(this, 'datasets', datasets);
},
/**
* Fetches new entities with caching and diff checking
*/
didReceiveAttr... | init | identifier_name |
component.js | /**
* Component displaying the entity mapping inside a modal
* @module components/modals/entity-mapping-modal
* @property {Boolean} showEntityMappingModal - Flag toggling the modal view
* @property {Object} metric - primary metric Object
* @property {Function} onSubmit - closure ac... | /**
* Fetches related Entities
*/
_fetchRelatedEntities: async function () {
const metricUrn = get(this, 'metricUrn');
const entities = await fetch(`${entityMappingApi.getRelatedEntitiesUrl}/${metricUrn}`).then(checkStatus);
const url = this.makeUrlString(entities);
this.buildUrnToId(entities)... | return entityMappingApi.getRelatedEntitiesDataUrl(urnStrings);
}
},
| random_line_split |
component.js | /**
* Component displaying the entity mapping inside a modal
* @module components/modals/entity-mapping-modal
* @property {Boolean} showEntityMappingModal - Flag toggling the modal view
* @property {Object} metric - primary metric Object
* @property {Function} onSubmit - closure ac... | ,
set(key, value) {
if (value.startsWith(this.get('urnPrefix'))) {
const newUrn = value.split(':').pop();
this.set('_id', newUrn);
}
return value;
}
}),
/**
* Checks if the currently selected entity is already in the mapping
*/
mappingExists: computed(
'selecte... | {
return `${this.get('urnPrefix')}${this.get('_id')}`;
} | identifier_body |
edittime.js | function Ge |
{
return {
"name": "Replacer",
"id": "Rex_Replacer",
"description": "Replace instancne by fade-out itself, and create the target instance then fade-in it.",
"author": "Rex.Rainbow",
"help url": "https://dl.dropbox.com/u/5779181/C2Repo/rex_replacer.html",
"category": "Rex - Movement - opacity",
"f... | tBehaviorSettings() | identifier_name |
edittime.js | function GetBehaviorSettings()
{
return {
"name": "Replacer",
"id": "Rex_Replacer",
"description": "Replace instancne by fade-out itself, and create the target instance then fade-in it.",
"author": "Rex.Rainbow",
"help url": "https://dl.dropbox.com/u/5779181/C2Repo/rex_replacer.html",
"category": "... | // Clamp values
if (this.properties["Fade duration"] < 0)
this.properties["Fade duration"] = 0;
} | // Called by the IDE after a property has been changed
IDEInstance.prototype.OnPropertyChanged = function(property_name)
{ | random_line_split |
edittime.js | function GetBehaviorSettings()
{
|
//////////////////////////////////////////////////////////////
// Conditions
AddCondition(1, cf_trigger, "On fade-out started", "Fade out", "On {my} fade-out started",
"Triggered when fade-out started", "OnFadeOutStart");
AddCondition(2, cf_trigger, "On fade-out finished", "Fade out", "On {my} fade-out f... | return {
"name": "Replacer",
"id": "Rex_Replacer",
"description": "Replace instancne by fade-out itself, and create the target instance then fade-in it.",
"author": "Rex.Rainbow",
"help url": "https://dl.dropbox.com/u/5779181/C2Repo/rex_replacer.html",
"category": "Rex - Movement - opacity",
"flag... | identifier_body |
PRESUBMIT.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... |
def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api):
"""Attempts to prevent use of functions intended only for testing in
non-testing code. For now this is just a best-effort implementation
that ignores header files and may have some false positives. A
better implementation would probably... | """Runs checkdeps on #include statements added in this
change. Breaking - rules is an error, breaking ! rules is a
warning.
"""
# We need to wait until we have an input_api object and use this
# roundabout construct to import checkdeps because this file is
# eval-ed and thus doesn't have __file__.
origina... | identifier_body |
PRESUBMIT.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | (input_api, output_api):
"""Attempts to prevent use of functions intended only for testing in
non-testing code. For now this is just a best-effort implementation
that ignores header files and may have some false positives. A
better implementation would probably need a proper C++ parser.
"""
# We only scan .... | _CheckNoProductionCodeUsingTestOnlyFunctions | identifier_name |
PRESUBMIT.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | from presubmit import CppLintProcessor
from presubmit import SourceProcessor
from presubmit import CheckRuntimeVsNativesNameClashes
from presubmit import CheckExternalReferenceRegistration
from presubmit import CheckAuthorizedAuthor
results = []
if not CppLintProcessor().Run(input_api.PresubmitLocalPath(... | random_line_split | |
PRESUBMIT.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... |
if not CheckExternalReferenceRegistration(input_api.PresubmitLocalPath()):
results.append(output_api.PresubmitError(
"External references registration check failed"))
results.extend(CheckAuthorizedAuthor(input_api, output_api))
return results
def _CheckUnwantedDependencies(input_api, output_api):
... | results.append(output_api.PresubmitError(
"Runtime/natives name clash check failed")) | conditional_block |
quotemarkRule.ts | /**
* @license
* Copyright 2013 Palantir Technologies, 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... | extends Lint.Rules.AbstractRule {
public static SINGLE_QUOTE_FAILURE = "\" should be '";
public static DOUBLE_QUOTE_FAILURE = "' should be \"";
public isEnabled(): boolean {
if (super.isEnabled()) {
const quoteMarkString = this.getOptions().ruleArguments[0];
return (quoteMa... | Rule | identifier_name |
quotemarkRule.ts | /**
* @license
* Copyright 2013 Palantir Technologies, 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... | private quoteMark = QuoteMark.DOUBLE_QUOTES;
private avoidEscape: boolean;
constructor(sourceFile: ts.SourceFile, options: Lint.IOptions) {
super(sourceFile, options);
const ruleArguments = this.getOptions();
const quoteMarkString = ruleArguments[0];
if (quoteMarkString ===... | class QuotemarkWalker extends Lint.RuleWalker { | random_line_split |
quotemarkRule.ts | /**
* @license
* Copyright 2013 Palantir Technologies, 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... |
super.visitStringLiteral(node);
}
}
| {
// allow the "other" quote mark to be used, but only to avoid having to escape
const includesOtherQuoteMark = text.slice(1, -1).indexOf(expectedQuoteMark) !== -1;
if (!(this.avoidEscape && includesOtherQuoteMark)) {
const failureMessage = (this.quoteMark === QuoteM... | conditional_block |
max_aggregate_only.py | import numpy as np
from scipy.stats import skew, kurtosis, shapiro, pearsonr, ansari, mood, levene, fligner, bartlett, mannwhitneyu
from scipy.spatial.distance import braycurtis, canberra, chebyshev, cityblock, correlation, cosine, euclidean, hamming, jaccard, kulsinski, matching, russellrao, sqeuclidean
from sklearn.p... | anova,
dice_,
jaccard,
kulsinski,
matching,
rogerstanimoto_,
russellrao,
sokalmichener_,
sokalsneath_,
yule_,
adjusted_mutual_info_score,
adjusted_rand_score,
completeness_score,
homogeneity_completeness_v_measure,
homogeneity_score,
mutual_info_score,
... | anova,
]
BINARY_CC_FEATURES = [
categorical_categorical_homogeneity, | random_line_split |
expressionset.rs | use ordered_float::NotNaN;
use bio::stats::probs;
use crate::model;
pub type MeanExpression = NotNaN<f64>;
pub type CDF = probs::cdf::CDF<MeanExpression>;
pub fn cdf(expression_cdfs: &[model::expression::NormalizedCDF], pseudocounts: f64) -> CDF |
// #[cfg(test)]
// mod tests {
// #![allow(non_upper_case_globals)]
//
// use bio::stats::{Prob, LogProb};
//
// use super::*;
// use model;
// use io;
//
//
// const GENE: &'static str = "COL5A1";
//
// fn setup() -> Box<model::readout::Model> {
// model::readout::new_model(
// ... | {
let pseudocounts = NotNaN::new(pseudocounts).unwrap();
if expression_cdfs.len() == 1 {
let mut cdf = expression_cdfs[0].clone();
for e in cdf.iter_mut() {
e.value += pseudocounts;
}
return cdf;
}
let cdf = model::meanvar::cdf(expression_cdfs, |mean, _| mea... | identifier_body |
expressionset.rs | use ordered_float::NotNaN;
use bio::stats::probs;
use crate::model;
pub type MeanExpression = NotNaN<f64>;
pub type CDF = probs::cdf::CDF<MeanExpression>;
pub fn cdf(expression_cdfs: &[model::expression::NormalizedCDF], pseudocounts: f64) -> CDF {
let pseudocounts = NotNaN::new(pseudocounts).unwrap();
if e... | // io::codebook::Codebook::from_file("tests/codebook/140genesData.1.txt").unwrap()
// )
// }
//
// #[test]
// fn test_cdf() {
// let readout = setup();
// let cdfs = [
// model::expression::cdf(GENE, 5, 5, &readout, 100).0,
// model::expression::cd... | random_line_split | |
expressionset.rs | use ordered_float::NotNaN;
use bio::stats::probs;
use crate::model;
pub type MeanExpression = NotNaN<f64>;
pub type CDF = probs::cdf::CDF<MeanExpression>;
pub fn | (expression_cdfs: &[model::expression::NormalizedCDF], pseudocounts: f64) -> CDF {
let pseudocounts = NotNaN::new(pseudocounts).unwrap();
if expression_cdfs.len() == 1 {
let mut cdf = expression_cdfs[0].clone();
for e in cdf.iter_mut() {
e.value += pseudocounts;
}
re... | cdf | identifier_name |
expressionset.rs | use ordered_float::NotNaN;
use bio::stats::probs;
use crate::model;
pub type MeanExpression = NotNaN<f64>;
pub type CDF = probs::cdf::CDF<MeanExpression>;
pub fn cdf(expression_cdfs: &[model::expression::NormalizedCDF], pseudocounts: f64) -> CDF {
let pseudocounts = NotNaN::new(pseudocounts).unwrap();
if e... |
let cdf = model::meanvar::cdf(expression_cdfs, |mean, _| mean + pseudocounts);
assert_relative_eq!(cdf.total_prob().exp(), 1.0, epsilon = 0.001);
cdf.reduce().sample(1000)
}
// #[cfg(test)]
// mod tests {
// #![allow(non_upper_case_globals)]
//
// use bio::stats::{Prob, LogProb};
//
// use su... | {
let mut cdf = expression_cdfs[0].clone();
for e in cdf.iter_mut() {
e.value += pseudocounts;
}
return cdf;
} | conditional_block |
buildconfigsetrecords.py | __author__ = 'thauser'
from argh import arg
import logging
from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(util... | def get_build_configuration_set_record(id):
"""
Get a specific BuildConfigSetRecord
"""
response = utils.checked_api_call(bcsr_api, 'get_specific', id=id)
if not response:
logging.error("A BuildConfigurationSetRecord with ID {} does not exist.".format(id))
return
return response.... | if response:
return response.content
@arg("id", help="ID of build configuration set record to retrieve.") | random_line_split |
buildconfigsetrecords.py | __author__ = 'thauser'
from argh import arg
import logging
from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(util... |
response = utils.checked_api_call(bcsr_api, 'get_build_records', id=id, page_size=page_size, sort=sort, q=q)
if response:
return response.content
| logging.error("A BuildConfigurationSet with ID {} does not exist.".format(id))
return | conditional_block |
buildconfigsetrecords.py | __author__ = 'thauser'
from argh import arg
import logging
from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(util... | (id):
"""
Get a specific BuildConfigSetRecord
"""
response = utils.checked_api_call(bcsr_api, 'get_specific', id=id)
if not response:
logging.error("A BuildConfigurationSetRecord with ID {} does not exist.".format(id))
return
return response.content
@arg("id", help="ID of Build... | get_build_configuration_set_record | identifier_name |
buildconfigsetrecords.py | __author__ = 'thauser'
from argh import arg
import logging
from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(util... |
@arg("id", help="ID of build configuration set record to retrieve.")
def get_build_configuration_set_record(id):
"""
Get a specific BuildConfigSetRecord
"""
response = utils.checked_api_call(bcsr_api, 'get_specific', id=id)
if not response:
logging.error("A BuildConfigurationSetRecord wit... | """
List all build configuration set records.
"""
response = utils.checked_api_call(bcsr_api, 'get_all', page_size=page_size, sort=sort, q=q)
if response:
return response.content | identifier_body |
upload_clinic_codes.py | from csv import DictReader
from django.core.management.base import BaseCommand
from registrations.models import ClinicCode
class Command(BaseCommand):
help = (
"This command takes in a CSV with the columns: uid, code, facility, province,"
"and location, and creates/updates the cliniccodes in the... |
def normalise_location(self, location):
"""
Normalises the location from `[longitude,latitude]` to ISO6709
"""
def fractional_part(f):
if not float(f) % 1:
return ""
parts = f.split(".")
return f".{parts[1]}"
try:
... | parser.add_argument("data_csv", type=str, help=("The CSV with the data in it")) | identifier_body |
upload_clinic_codes.py | from csv import DictReader
from django.core.management.base import BaseCommand
from registrations.models import ClinicCode
class Command(BaseCommand):
help = (
"This command takes in a CSV with the columns: uid, code, facility, province,"
"and location, and creates/updates the cliniccodes in the... | "province": {
"ec": "ZA-EC",
"fs": "ZA-FS",
"gp": "ZA-GT",
"kz": "ZA-NL",
"lp": "ZA-LP",
"mp": "ZA-MP",
... | "code": row["code"].strip(),
"value": row["code"].strip(),
"name": row["facility"].strip(), | random_line_split |
upload_clinic_codes.py | from csv import DictReader
from django.core.management.base import BaseCommand
from registrations.models import ClinicCode
class Command(BaseCommand):
help = (
"This command takes in a CSV with the columns: uid, code, facility, province,"
"and location, and creates/updates the cliniccodes in the... | (self, parser):
parser.add_argument("data_csv", type=str, help=("The CSV with the data in it"))
def normalise_location(self, location):
"""
Normalises the location from `[longitude,latitude]` to ISO6709
"""
def fractional_part(f):
if not float(f) % 1:
... | add_arguments | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.