file_name large_stringlengths 4 140 | prefix large_stringlengths 0 12.1k | suffix large_stringlengths 0 12k | middle large_stringlengths 0 7.51k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
create-feedback-thread-modal.component.spec.ts | // Copyright 2021 The Oppia 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 ap... |
}
describe('Create Feedback Thread Modal Controller', function() {
let component: CreateFeedbackThreadModalComponent;
let fixture: ComponentFixture<CreateFeedbackThreadModalComponent>;
let alertsService: AlertsService;
let ngbActiveModal: NgbActiveModal;
beforeEach(waitForAsync(() => {
TestBed.configur... | {
return;
} | identifier_body |
create-feedback-thread-modal.component.spec.ts | // Copyright 2021 The Oppia Authors. All Rights Reserved.
// | //
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language go... | // 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 | random_line_split |
create-feedback-thread-modal.component.spec.ts | // Copyright 2021 The Oppia 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 ap... | (): void {
return;
}
}
describe('Create Feedback Thread Modal Controller', function() {
let component: CreateFeedbackThreadModalComponent;
let fixture: ComponentFixture<CreateFeedbackThreadModalComponent>;
let alertsService: AlertsService;
let ngbActiveModal: NgbActiveModal;
beforeEach(waitForAsync(()... | dismiss | identifier_name |
crew.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Gang } from '../models/gang';
import { Session } from '../models/session';
import { CREW_2_ROUTE } from '../../app/app.routes.model';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class CrewServ... |
private sortSessions(sessions: Session[]): Session[] {
return sessions.map((session: Session) => {
session.date = Date.parse(<any> session.date);
return session;
}).sort((a, b) => a.date - b.date);
}
}
| {
return this.http.get('/assets/data/' + filename + '.json').map((gang: Gang) => {
gang.sessions = this.sortSessions(gang.sessions);
return gang;
});
} | identifier_body |
crew.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Gang } from '../models/gang';
import { Session } from '../models/session';
import { CREW_2_ROUTE } from '../../app/app.routes.model';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class CrewServ... | }
} | session.date = Date.parse(<any> session.date);
return session;
}).sort((a, b) => a.date - b.date); | random_line_split |
crew.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Gang } from '../models/gang';
import { Session } from '../models/session';
import { CREW_2_ROUTE } from '../../app/app.routes.model';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class CrewServ... | else {
return this.getCrewOneData();
}
}
public getCrewOneData(): Observable<Gang> {
if (!this.crewOne) {
this.crewOne = this.getCrew('assassins');
}
return this.crewOne;
}
public getCrewTwoData(): Observable<Gang> {
if (!this.crewTwo) {
this.crewTwo = this.getCrew('assa... | {
return this.getCrewTwoData();
} | conditional_block |
crew.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Gang } from '../models/gang';
import { Session } from '../models/session';
import { CREW_2_ROUTE } from '../../app/app.routes.model';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class CrewServ... | (): Observable<Gang> {
if (!this.crewTwo) {
this.crewTwo = this.getCrew('assassins2');
}
return this.crewTwo;
}
private getCrew(filename: string): Observable<Gang> {
return this.http.get('/assets/data/' + filename + '.json').map((gang: Gang) => {
gang.sessions = this.sortSessions(gang.s... | getCrewTwoData | identifier_name |
AndroidfilehostCom.py | # -*- coding: utf-8 -*
#
# Test links:
# https://www.androidfilehost.com/?fid=95916177934518197
import re
from module.plugins.internal.SimpleHoster import SimpleHoster
class | (SimpleHoster):
__name__ = "AndroidfilehostCom"
__type__ = "hoster"
__version__ = "0.05"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+'
__config__ = [("activated" , "bool", "Activated" , True),
... | AndroidfilehostCom | identifier_name |
AndroidfilehostCom.py | # -*- coding: utf-8 -*
#
# Test links:
# https://www.androidfilehost.com/?fid=95916177934518197
import re
from module.plugins.internal.SimpleHoster import SimpleHoster
class AndroidfilehostCom(SimpleHoster):
|
OFFLINE_PATTERN = r'404 not found'
WAIT_PATTERN = r'users must wait <strong>(\d+) secs'
def setup(self):
self.multiDL = True
self.resume_download = True
self.chunk_limit = 1
def handle_free(self, pyfile):
wait = re.search(self.WAIT_PATTERN, self.data)
... | __name__ = "AndroidfilehostCom"
__type__ = "hoster"
__version__ = "0.05"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+'
__config__ = [("activated" , "bool", "Activated" , True),
("use_prem... | identifier_body |
AndroidfilehostCom.py | # -*- coding: utf-8 -*
#
# Test links:
# https://www.androidfilehost.com/?fid=95916177934518197
import re
from module.plugins.internal.SimpleHoster import SimpleHoster
class AndroidfilehostCom(SimpleHoster):
__name__ = "AndroidfilehostCom"
__type__ = "hoster"
__version__ = "0.05"
__status__ ... | 'fid' : fid})
self.link = re.findall('"url":"(.*?)"', html)[0].replace("\\", "")
mirror_host = self.link.split("/")[2]
self.log_debug("Mirror Host: %s" % mirror_host)
html = self.load("https://www.androidfilehost.com/libs/otf/stats.otf.php",
... |
html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php",
post={'submit': 'submit',
'action': 'getdownloadmirrors', | random_line_split |
commands.rs | _dir = TextureDirectory::for_path("resources/textures", hashset!["png".into()]);
let font_dir = FontDirectory::for_path("resources/fonts");
let file_resources = FileResources {
resources: resources_path,
shader_pair : shader_pair,
texture_directory: texture_dir,
font_directory: ... | (&self) -> GeometryTesselator {
let upp = self.units_per_point();
let tesselator_scale = Vec3::new(upp, upp, upp);
GeometryTesselator::new(tesselator_scale)
}
fn update(&mut self, input_state:&InputState, dimensions:Dimensions, delta_time: Seconds) {
use glutin::VirtualKeyCode;
... | tesselator | identifier_name |
commands.rs | _dir = TextureDirectory::for_path("resources/textures", hashset!["png".into()]);
let font_dir = FontDirectory::for_path("resources/fonts");
let file_resources = FileResources {
resources: resources_path,
shader_pair : shader_pair,
texture_directory: texture_dir,
font_directory: ... | }
fn units_per_point(&self) -> f64 {
1.0 / self.points_per_unit
}
fn tesselator(&self) -> GeometryTesselator {
let upp = self.units_per_point();
let tesselator_scale = Vec3::new(upp, upp, upp);
GeometryTesselator::new(tesselator_scale)
}
fn update(&mut self, i... | {
let mut last_time = time::precise_time_ns();
'main: loop {
let (dimensions, input_state) = self.renderer.begin_frame(rgb(132, 193, 255));
if input_state.close {
break;
}
// println!("dimensions -> {:?}", dimensions);
let time... | identifier_body |
commands.rs | = TextureDirectory::for_path("resources/textures", hashset!["png".into()]);
let font_dir = FontDirectory::for_path("resources/fonts");
let file_resources = FileResources {
resources: resources_path,
shader_pair : shader_pair,
texture_directory: texture_dir,
font_directory: font... |
}
}
// draw ui text
// if let Some((font, layer)) = self.renderer.get_font(&font_description) {
// // println!("ok we got a font to use to draw layer -> {:?}", layer);
// let scale = 1.0 / self.camera.viewport.scale();
// let mut t = GeometryTessela... | {
let blend = match rem {
0 => Blend::Alpha,
1 => Blend::Add,
_ => Blend::None,
};
self.renderer.draw(geo, Uniforms {
transform: down_size_m4(self.camera.view_pr... | conditional_block |
commands.rs | _dir = TextureDirectory::for_path("resources/textures", hashset!["png".into()]);
let font_dir = FontDirectory::for_path("resources/fonts");
let file_resources = FileResources {
resources: resources_path,
shader_pair : shader_pair,
texture_directory: texture_dir,
font_directory: ... | //
// frame.draw_vertices(&vertices, Uniforms {
// transform : down_size_m4(self.camera.ui_projection().into()),
// color: color::WHITE,
// }, Blend::Alpha);
// }
self.renderer.finish_frame().expect("a finished frame");
Ok | // ); | random_line_split |
importer.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
return principal
elif old_principal.__class__.__name__ == 'Group':
assert int(old_principal.id) in self.global_ns.all_groups
return GroupProxy(int(old_principal.id))
elif old_principal.__class__.__name__ in {'CERNGroup', 'LDAPGroup', 'NiceGroup'}:
return ... | self.print_error("User {} doesn't exist".format(old_principal.id)) | conditional_block |
importer.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | if len(candidates) != 1 or not isinstance(candidates[0].type, db.Integer):
continue
serial_col = candidates[0]
sequence_name = '{}.{}_{}_seq'.format(table.schema, cls.__tablename__, serial_col.name)
query = select([func.setval(sequence_name, func.max(seri... | continue
# Check if we have a single autoincrementing primary key
candidates = [col for col in table.c if col.autoincrement and col.primary_key] | random_line_split |
importer.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | (self):
pass
def migrate(self):
raise NotImplementedError
def post_migrate(self):
pass
| pre_migrate | identifier_name |
importer.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
def post_migrate(self):
pass
| raise NotImplementedError | identifier_body |
all_b.js | var searchData=
[
['magenta',['magenta',['../_logger_8cpp.html#a9c3c2560b6f423f7902776457532fdba',1,'Logger.cpp']]],
['maxsamples',['maxsamples',['../class_audio_signal.html#a5d68faf1ab7f19197b93cc2cc0a7e645',1,'AudioSignal']]],
['mps_5fvt',['mps_vt',['../struct_h_r_t_f_model.html#ae01efd7375e498a14624bbeebb93fa8... | ]; | random_line_split | |
user.ts | import {Injectable} from 'angular2/core';
import {HttpService} from '../services/http';
import {Model} from './model';
@Injectable()
export class | extends Model
{
public firstName: string = "";
public lastName: string = "";
public email: string = "";
public password: string = "";
public constructor(private httpService: HttpService)
{
super();
}
public getAuthToken()
{
return this.httpService.getAuthToken();
}
public setAuthToken(token: str... | User | identifier_name |
user.ts | import {Injectable} from 'angular2/core';
import {HttpService} from '../services/http';
import {Model} from './model';
@Injectable()
export class User extends Model
{
public firstName: string = "";
public lastName: string = "";
public email: string = "";
public password: string = "";
public constructor(... |
public setAuthToken(token: string)
{
this.httpService.setAuthToken(token);
}
public register()
{
let params = this.buildParams([
'firstName',
'lastName',
'email',
'password'
]);
return this.httpService.sendRequest("POST", "/auth/register", params);
}
public login()
{
let params = this... | {
return this.httpService.getAuthToken();
} | identifier_body |
user.ts | import {Injectable} from 'angular2/core';
import {HttpService} from '../services/http';
import {Model} from './model';
@Injectable() | export class User extends Model
{
public firstName: string = "";
public lastName: string = "";
public email: string = "";
public password: string = "";
public constructor(private httpService: HttpService)
{
super();
}
public getAuthToken()
{
return this.httpService.getAuthToken();
}
public setAut... | random_line_split | |
_context.py | representation form. We need to re-decimalify it, one reason being
# to enable "empty" paragraphs with whitespace only.
text = decimalify_leading(codepoints.UNICODE_WHITESPACE, text)
text = decimalify_trailing(codepoints.UNICODE_WHITESPACE, text)
lines = text.split("\n")
for i in range(len(lines))... | with_default_renderer_for | identifier_name | |
_context.py | = "".join(child.render(context) for child in node.children)
if context.do_wrap:
# Prevent line breaks
text = text.replace(WRAP_POINT, " ")
ref_label = node.meta.get("label")
if ref_label:
context.env["used_refs"].add(ref_label)
ref_label_repr = ref_label.lower()
if... | marker_type = get_list_marker_type(node)
first_line_indent = " "
indent = " " * len(marker_type + first_line_indent)
block_separator = "\n" if is_tight_list(node) else "\n\n"
with context.indented(len(indent)):
text = ""
for child_idx, child in enumerate(node.children):
list... | identifier_body | |
_context.py | if TYPE_CHECKING:
from mdformat.renderer import RenderTreeNode
LOGGER = logging.getLogger(__name__)
# A marker used to point a location where word wrap is allowed
# to occur.
WRAP_POINT = "\x00"
# A marker used to indicate location of a character that should be preserved
# during word wrap. Should be converted to... | random_line_split | ||
_context.py | text)
lines = text.split("\n")
for i in range(len(lines)):
# Strip whitespace to prevent issues like a line starting tab that is
# interpreted as start of a code block.
lines[i] = lines[i].strip()
# If a line looks like an ATX heading, escape the first hash.
if re.matc... | renderers.pop(syntax, None) | conditional_block | |
stats.rs | use clap::ArgMatches;
use chrono::Local;
use serde_json;
use serde::ser::{MapVisitor, Serialize, Serializer};
use ilc_base;
use ilc_ops::stats::Stats;
use Environment;
use Cli;
use error;
struct StatFormat {
version: String,
master_hash: Option<String>,
time: String,
stats: Stats,
}
impl Serialize ... | }
}
pub fn output_as_json(args: &ArgMatches, cli: &Cli, stats: Stats) -> ilc_base::Result<()> {
let e = Environment(args);
// let count = value_t!(args, "count", usize).unwrap_or(usize::MAX);
// let mut stats: Vec<(String, Person)> = stats.into_iter().collect();
// stats.sort_by(|&(_, ref a), &(_... | {
struct Visitor<'a>(&'a StatFormat);
impl<'a> MapVisitor for Visitor<'a> {
fn visit<S>(&mut self, s: &mut S) -> Result<Option<()>, S::Error>
where S: Serializer
{
try!(s.serialize_struct_elt("version", &self.0.version));
if let &So... | identifier_body |
stats.rs | use clap::ArgMatches;
use chrono::Local;
use serde_json;
use serde::ser::{MapVisitor, Serialize, Serializer};
use ilc_base;
use ilc_ops::stats::Stats;
use Environment;
use Cli;
use error;
struct StatFormat {
version: String,
master_hash: Option<String>,
time: String,
stats: Stats,
}
impl Serialize ... |
try!(s.serialize_struct_elt("time", &self.0.time));
try!(s.serialize_struct_elt("stats", &self.0.stats));
Ok(None)
}
fn len(&self) -> Option<usize> {
Some(4)
}
}
s.serialize_struct("StatFormat", Visitor... | {
try!(s.serialize_struct_elt("master_hash", h));
} | conditional_block |
stats.rs | use clap::ArgMatches;
use chrono::Local;
use serde_json;
use serde::ser::{MapVisitor, Serialize, Serializer};
use ilc_base;
use ilc_ops::stats::Stats;
use Environment;
use Cli;
use error;
struct StatFormat {
version: String,
master_hash: Option<String>,
time: String,
stats: Stats,
}
impl Serialize ... | <S>(&self, s: &mut S) -> Result<(), S::Error>
where S: Serializer
{
struct Visitor<'a>(&'a StatFormat);
impl<'a> MapVisitor for Visitor<'a> {
fn visit<S>(&mut self, s: &mut S) -> Result<Option<()>, S::Error>
where S: Serializer
{
try!(s... | serialize | identifier_name |
stats.rs | use clap::ArgMatches; |
use serde_json;
use serde::ser::{MapVisitor, Serialize, Serializer};
use ilc_base;
use ilc_ops::stats::Stats;
use Environment;
use Cli;
use error;
struct StatFormat {
version: String,
master_hash: Option<String>,
time: String,
stats: Stats,
}
impl Serialize for StatFormat {
fn serialize<S>(&self... |
use chrono::Local; | random_line_split |
herald-vote.js | jQuery(document).ready(function($) {
$('#addmoreitem').click(function() {
var lastid = $('.uploadevent').last().attr('id');
for(var i = 1; i < 5; i++) | r({
format: "yyyy-mm-dd"
});
$('#vote_type1').click(function(){
$('#vote_limit_number_div').remove();
});
$('#vote_type2').click(function(){
var divnum = $('#vote_limit_number_div');
if(!divnum.length){
var addHtml = '<div class="form-group" id="vote_limit_number_div"><br><label for="vote-topic">限投... | {
var addId = Number(lastid)+Number(i);
var addHtml = '<div class="panel-group" id="accordion"><div class="panel panel-default"><div class="panel-heading"><div class="input-group"><input type="text" name="vote_item_name['+addId+']" class="form-control" placeholder="选项'+addId+'"><div class="input-group-btn"><a typ... | conditional_block |
description.ts | // (C) Copyright 2015 Martin Dougiamas
//
// 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 agre... |
}
}
}
| {
this.question.seenInput = {
name: input.name,
value: input.value
};
} | conditional_block |
description.ts | // (C) Copyright 2015 Martin Dougiamas
//
// 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 agre... |
import { Component, OnInit, Injector } from '@angular/core';
import { CoreLoggerProvider } from '@providers/logger';
import { CoreQuestionBaseComponent } from '@core/question/classes/base-question-component';
/**
* Component to render a description question.
*/
@Component({
selector: 'addon-qtype-description',
... | // See the License for the specific language governing permissions and
// limitations under the License. | random_line_split |
description.ts | // (C) Copyright 2015 Martin Dougiamas
//
// 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 agre... | (): void {
const questionEl = this.initComponent();
if (questionEl) {
// Get the "seen" hidden input.
const input = <HTMLInputElement> questionEl.querySelector('input[type="hidden"][name*=seen]');
if (input) {
this.question.seenInput = {
... | ngOnInit | identifier_name |
WorksForSaleRail.tsx | import { ContextModule } from "@artsy/cohesion"
import { WorksForSaleRail_artist } from "v2/__generated__/WorksForSaleRail_artist.graphql"
import { WorksForSaleRailRendererQuery } from "v2/__generated__/WorksForSaleRailRendererQuery.graphql"
import { SystemContext } from "v2/Artsy"
import { track } from "v2/Artsy/Analy... |
render() {
return (
<WorksForSaleRail
{...this.props}
onArtworkClicked={this.trackArtworkClicked.bind(this)}
/>
)
}
}
export const WorksForSaleRailFragmentContainer = createFragmentContainer(
WorksForSaleRailWithTracking,
{
artist: graphql`
fragment WorksForSaleR... | {
// noop
} | identifier_body |
WorksForSaleRail.tsx | import { ContextModule } from "@artsy/cohesion"
import { WorksForSaleRail_artist } from "v2/__generated__/WorksForSaleRail_artist.graphql"
import { WorksForSaleRailRendererQuery } from "v2/__generated__/WorksForSaleRailRendererQuery.graphql"
import { SystemContext } from "v2/Artsy"
import { track } from "v2/Artsy/Analy... | () {
return (
<WorksForSaleRail
{...this.props}
onArtworkClicked={this.trackArtworkClicked.bind(this)}
/>
)
}
}
export const WorksForSaleRailFragmentContainer = createFragmentContainer(
WorksForSaleRailWithTracking,
{
artist: graphql`
fragment WorksForSaleRail_artist... | render | identifier_name |
WorksForSaleRail.tsx | import { ContextModule } from "@artsy/cohesion"
import { WorksForSaleRail_artist } from "v2/__generated__/WorksForSaleRail_artist.graphql"
import { WorksForSaleRailRendererQuery } from "v2/__generated__/WorksForSaleRailRendererQuery.graphql"
import { SystemContext } from "v2/Artsy"
import { track } from "v2/Artsy/Analy... | {...this.props}
onArtworkClicked={this.trackArtworkClicked.bind(this)}
/>
)
}
}
export const WorksForSaleRailFragmentContainer = createFragmentContainer(
WorksForSaleRailWithTracking,
{
artist: graphql`
fragment WorksForSaleRail_artist on Artist {
artworksConnection(fi... | render() {
return (
<WorksForSaleRail | random_line_split |
ng_style.ts | /**
* @license
* Copyright Google Inc. 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 {Directive, DoCheck, ElementRef, Input, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Renderer2} from '@an... |
}
}
private _setStyle(nameAndUnit: string, value: string|number|null|undefined): void {
const [name, unit] = nameAndUnit.split('.');
value = value != null && unit ? `${value}${unit}` : value;
if (value != null) {
this._renderer.setStyle(this._ngEl.nativeElement, name, value as string);
... | {
this._applyChanges(changes);
} | conditional_block |
ng_style.ts | /**
* @license
* Copyright Google Inc. 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 {Directive, DoCheck, ElementRef, Input, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Renderer2} from '@an... | (values: {[klass: string]: any}|null) {
this._ngStyle = values;
if (!this._differ && values) {
this._differ = this._differs.find(values).create();
}
}
ngDoCheck() {
if (this._differ) {
const changes = this._differ.diff(this._ngStyle!);
if (changes) {
this._applyChanges(cha... | ngStyle | identifier_name |
ng_style.ts | /**
* @license
* Copyright Google Inc. 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 {Directive, DoCheck, ElementRef, Input, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Renderer2} from '@an... | * The key is a style name, with an optional `.<unit>` suffix
* (such as 'top.px', 'font-style.em').
* The value is an expression to be evaluated.
* The resulting non-null value, expressed in the given unit,
* is assigned to the given style property.
* If the result of evaluation is null, the corresponding style i... | * An attribute directive that updates styles for the containing HTML element.
* Sets one or more style properties, specified as colon-separated key-value pairs. | random_line_split |
ng_style.ts | /**
* @license
* Copyright Google Inc. 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 {Directive, DoCheck, ElementRef, Input, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Renderer2} from '@an... |
@Input('ngStyle')
set ngStyle(values: {[klass: string]: any}|null) {
this._ngStyle = values;
if (!this._differ && values) {
this._differ = this._differs.find(values).create();
}
}
ngDoCheck() {
if (this._differ) {
const changes = this._differ.diff(this._ngStyle!);
if (change... | {} | identifier_body |
GreekItalic.js | MathJax.Hub.Insert(
MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['STIXGeneral-italic'],
{
0x1D6E2: [667,0,717,35,685], // MATHEMATICAL ITALIC CAPITAL ALPHA
0x1D6E3: [653,0,696,38,686], // MATHEMATICAL ITALIC CAPITAL BETA
0x1D6E4: [653,0,616,38,721], // MATHEMATICAL ITALIC CAPITAL GAMMA... | 0x1D6EC: [667,0,718,35,686], // MATHEMATICAL ITALIC CAPITAL LAMDA
0x1D6ED: [653,0,1005,38,1055], // MATHEMATICAL ITALIC CAPITAL MU
0x1D6EE: [653,0,851,38,901], // MATHEMATICAL ITALIC CAPITAL NU
0x1D6EF: [653,0,706,52,741], // MATHEMATICAL ITALIC CAPITAL XI
0x1D6F0: [669,11,732,... | random_line_split | |
extjs-components.ts | /* eslint-disable no-param-reassign */
// import * as _ from 'lodash';
import { ComponentAPI } from './component';
import { FormFieldBaseAPI } from './form-field-base';
import { BoundListAPI } from './boundlist';
import { ButtonAPI } from './button';
import { CheckBoxAPI } from './checkbox';
import { ComboBoxAPI } fr... | static tableview = TableViewAPI;
static tabpanel = TabPanelAPI;
static textfield = TextFieldAPI;
static treeview = TreeViewAPI;
} | static form = FormAPI;
static gridcolumn = GridColumnAPI;
static tab = TabAPI; | random_line_split |
extjs-components.ts |
/* eslint-disable no-param-reassign */
// import * as _ from 'lodash';
import { ComponentAPI } from './component';
import { FormFieldBaseAPI } from './form-field-base';
import { BoundListAPI } from './boundlist';
import { ButtonAPI } from './button';
import { CheckBoxAPI } from './checkbox';
import { ComboBoxAPI } ... | {
static component = ComponentAPI;
static formFieldBase = FormFieldBaseAPI;
static boundlist = BoundListAPI;
static button = ButtonAPI;
static checkbox = CheckBoxAPI;
static combobox = ComboBoxAPI;
static form = FormAPI;
static gridcolumn = GridColumnAPI;
static tab = TabAPI;
static tableview = Tab... | ExtJsCmpAPI | identifier_name |
minusAssign.js | /*
| Ast minus assignment ( -= )
*/
/*
| The jion definition.
*/
if( JION )
{
throw{
id : 'jion$ast_minusAssign',
attributes : | type : require( '../typemaps/astExpression' )
},
right :
{
comment : 'right-hand side',
type : require( '../typemaps/astExpression' )
}
}
};
}
/*
| Capsule
*/
(function() {
'use strict';
var
ast_minusAssign,
prototype;
ast_minusAssign = require( '../this' )( module, 'ouroboros' );
pr... | {
left :
{
comment : 'left-hand side', | random_line_split |
minusAssign.js | /*
| Ast minus assignment ( -= )
*/
/*
| The jion definition.
*/
if( JION )
|
/*
| Capsule
*/
(function() {
'use strict';
var
ast_minusAssign,
prototype;
ast_minusAssign = require( '../this' )( module, 'ouroboros' );
prototype = ast_minusAssign.prototype;
/**/if( CHECK )
/**/{
/**/ var
/**/ util;
/**/
/**/ util = require( 'util' );
/**/
/*** /
**** | Custom inspect
**** /
***/ proto... | {
throw{
id : 'jion$ast_minusAssign',
attributes :
{
left :
{
comment : 'left-hand side',
type : require( '../typemaps/astExpression' )
},
right :
{
comment : 'right-hand side',
type : require( '../typemaps/astExpression' )
}
}
};
} | conditional_block |
triple-slash-reference.ts | import * as ts from 'typescript';
import { ElementKind } from '../constants';
import {
create_element,
is_element,
IElement, | types?: string;
}
export interface ITripleSlashReference
extends IElement<ElementKind.TripleSlashReference>,
ITripleSlashReferenceOptions {}
export const create_triple_slash_reference = (
options: ITripleSlashReferenceOptions,
): ITripleSlashReference => ({
...create_element(ElementKind.TripleSlashReferen... | IElementOptions,
} from '../element';
export interface ITripleSlashReferenceOptions extends IElementOptions {
path?: string; | random_line_split |
test.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved. | function content_test() {
window.addEventListener('message', function(event) {
var msg = event.data;
if (msg == 'original') {
console.log('VICTIM: No content changed.');
chrome.test.succeed();
} else {
console.log('VICTIM: Detected injected content - ' + msg);... | // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([ | random_line_split |
test.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function content_test() {
window.addEventListener('message', function(event) {
var msg = event.data;
if (... | else {
console.log('VICTIM: Detected injected content - ' + msg);
chrome.test.fail('Content changed: ' + msg);
}
},
false);
chrome.test.getConfig(function(config) {
chrome.test.log("Creating tab...");
var test_url = ("http://a.com:PORT/extensions/api_test" +
... | {
console.log('VICTIM: No content changed.');
chrome.test.succeed();
} | conditional_block |
private_export.ts | /**
* @license | */
export {Animation as ɵAnimation} from './dsl/animation';
export {AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer';
export {WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer} f... | * Copyright Google Inc. 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 | random_line_split |
AngularHelpers.ts | /// <reference path="../../../lib/DefinitelyTyped/angularjs/angular.d.ts"/>
/// <reference path="../../_all.d.ts"/>
import AdhHttp = require("../Http/Http");
export var recursionHelper = ($compile) => {
return {
/**
* Manually compiles the element, fixing the recursion loop.
* @param el... |
};
var errorControllers = getErrorControllers(form);
var names = _.unique(_.map(errorControllers, "$name"));
var selector = _.map(names, (name) => "[name=\"" + name + "\"]").join(", ");
return element.find(selector).first();
};
export var submitIfValid = (
$q : angular.IQService
) => (
s... | {
var childCtrls = _.flatten(_.values(ctrl.$error));
return _.flatten(_.map(childCtrls, getErrorControllers));
} | conditional_block |
AngularHelpers.ts | /// <reference path="../../../lib/DefinitelyTyped/angularjs/angular.d.ts"/>
/// <reference path="../../_all.d.ts"/>
import AdhHttp = require("../Http/Http");
export var recursionHelper = ($compile) => {
return {
/**
* Manually compiles the element, fixing the recursion loop.
* @param el... | restrict: "E",
scope: {
itemPath: "@"
},
transclude: true,
template: "<adh-inject></adh-inject>",
link: (scope) => {
adhHttp.getNewestVersionPathNoFork(scope.itemPath).then(
(versionPath) => {
scope.versionPath =... | return { | random_line_split |
mir.rs | the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
/// ///////////////////////////////////////////////////////////////////////////
///... | // given by the user and by other num_workers-1 states generated in a random way
let mut initial_state = problem.initial_state();
let mut initial_states_pool = common::StatesPool::new();
initial_states_pool.push(initial_state.clone());
for i in 1..num_workers {
initia... | {
let cooler = StepsCooler {
max_steps: self.tuner_params.max_step,
min_temp: self.tuner_params.min_temp.unwrap(),
max_temp: self.tuner_params.max_temp.unwrap(),
};
("{}",Green.paint("\n-----------------------------------------------------------------------... | identifier_body |
mir.rs | License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
/// ///////////////////////////////////////////////////////////////////////////
/// ***... | (&mut self, problem: &mut Problem, num_workers: usize) -> MrResult {
let cooler = StepsCooler {
max_steps: self.tuner_params.max_step,
min_temp: self.tuner_params.min_temp.unwrap(),
max_temp: self.tuner_params.max_temp.unwrap(),
};
("{}",Green.paint("\n----... | solve | identifier_name |
mir.rs | the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
/// ///////////////////////////////////////////////////////////////////////////
///... | worker_nrg,
last_nrg);
println!("{}",Green.paint("-------------------------------------------------------------------------------------------------------------------------------------------------------"));
pb.message(&format!("TID [{}] - Sta... | random_line_split | |
base.py | path = hashlib.md5(iri_to_uri(path)).hexdigest()
if metadata._meta.use_i18n:
self.__cache_prefix = 'rollyourown.seo.%s.%s.%s' % (self.__metadata.__class__.__name__, hexpath, language)
else:
self.__cache_prefix = 'rollyourown.seo.%s.%s' % (self.__metadata.__class_... | if bases == (object,):
return type.__new__(cls, name, bases, attrs)
# Save options as a dict for now (we will be editing them)
# TODO: Is this necessary, should we bother relaying Django Meta options?
Meta = attrs.pop('Meta', {})
if Meta:
Meta = Meta.__di... |
class MetadataBase(type):
def __new__(cls, name, bases, attrs):
# TODO: Think of a better test to avoid processing Metadata parent class | random_line_split |
base.py | path = hashlib.md5(iri_to_uri(path)).hexdigest()
if metadata._meta.use_i18n:
self.__cache_prefix = 'rollyourown.seo.%s.%s.%s' % (self.__metadata.__class__.__name__, hexpath, language)
else:
self.__cache_prefix = 'rollyourown.seo.%s.%s' % (self.__metadata.__class_... | (self):
return self.__unicode__().encode("ascii", "ignore")
class MetadataBase(type):
def __new__(cls, name, bases, attrs):
# TODO: Think of a better test to avoid processing Metadata parent class
if bases == (object,):
return type.__new__(cls, name, bases, attrs)
# Sa... | __str__ | identifier_name |
base.py | out a key
if self.__cache_prefix:
cache_key = '%s.%s' % (self.__cache_prefix, name)
value = cache.get(cache_key)
else:
cache_key = None
value = None
# Look for a group called "name"
if name in self.__metadata._meta.groups:
if ... | metadata, md_created = metadata_class.objects.get_or_create(_content_type=content_type, _object_id=instance.pk)
metadata._path = path
metadata.save() | conditional_block | |
base.py | path = hashlib.md5(iri_to_uri(path)).hexdigest()
if metadata._meta.use_i18n:
self.__cache_prefix = 'rollyourown.seo.%s.%s.%s' % (self.__metadata.__class__.__name__, hexpath, language)
else:
self.__cache_prefix = 'rollyourown.seo.%s.%s' % (self.__metadata.__class_... |
def __getattr__(self, name):
# If caching is enabled, work out a key
if self.__cache_prefix:
cache_key = '%s.%s' % (self.__cache_prefix, name)
value = cache.get(cache_key)
else:
cache_key = None
value = None
# Look for a group called... | """ Returns an appropriate value for the given name.
This simply asks each of the instances for a value.
"""
for instance in self.__instances():
value = instance._resolve_value(name)
if value:
return value
# Otherwise, return an appropriate d... | identifier_body |
cli.rs | extern crate tetrs;
use std::io::prelude::*;
// FIXME! Little hack to clear the screen :)
extern "C" { fn system(s: *const u8); }
fn clear_screen() { unsafe {
system("@clear||cls\0".as_ptr());
}}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
enum Input {
None,
Left,
Right,
RotateCW,
RotateCCW,
SoftDrop,
HardD... |
fn bot(state: &mut tetrs::State) -> bool {
let weights = tetrs::Weights::default();
let bot = tetrs::PlayI::play(&weights, state.well(), *state.player().unwrap());
if bot.play.len() == 0 {
state.hard_drop();
return false;
}
let mut result = true;
for play in bot.play {
use tetrs::Play;
result &= match p... | {
print!(">>> ");
std::io::stdout().flush().unwrap();
let mut action = String::new();
std::io::stdin().read_line(&mut action).unwrap();
match &*action.trim().to_uppercase() {
"" => Input::None,
"A" | "Q" | "LEFT" => Input::Left,
"D" | "RIGHT" => Input::Right,
"CW" | "RR" | "ROT" => Input::RotateCW,
"CCW"... | identifier_body |
cli.rs | extern crate tetrs;
use std::io::prelude::*;
// FIXME! Little hack to clear the screen :)
extern "C" { fn system(s: *const u8); }
fn clear_screen() { unsafe {
system("@clear||cls\0".as_ptr());
}}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
enum | {
None,
Left,
Right,
RotateCW,
RotateCCW,
SoftDrop,
HardDrop,
Gravity,
Quit,
Help,
Invalid,
}
fn input() -> Input {
print!(">>> ");
std::io::stdout().flush().unwrap();
let mut action = String::new();
std::io::stdin().read_line(&mut action).unwrap();
match &*action.trim().to_uppercase() {
"" => Input:... | Input | identifier_name |
cli.rs | extern crate tetrs;
use std::io::prelude::*;
// FIXME! Little hack to clear the screen :)
extern "C" { fn system(s: *const u8); }
fn clear_screen() { unsafe {
system("@clear||cls\0".as_ptr());
}}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
enum Input {
None,
Left,
Right,
RotateCW,
RotateCCW,
SoftDrop,
HardD... | "H" | "HELP" => Input::Help,
_ => Input::Invalid,
}
}
fn bot(state: &mut tetrs::State) -> bool {
let weights = tetrs::Weights::default();
let bot = tetrs::PlayI::play(&weights, state.well(), *state.player().unwrap());
if bot.play.len() == 0 {
state.hard_drop();
return false;
}
let mut result = true;
for... | random_line_split | |
main.py | import sys
def row_matrix_to_col_matrix(row_matrix):
col_matrix = []
for c in range(len(row_matrix)): col_matrix.append([])
for r in range(len(row_matrix)):
for c in range(len(row_matrix)):
col_matrix[c].append(row_matrix[r][c])
return col_matrix
def col_matrix_to_row_matrix(col_... | for test in test_cases:
test = test.strip()
if len(test) == 0: continue
m = row_matrix_to_col_matrix([[int(i) for i in s.strip().split(' ')] for s in test.split('|')])
print(' | '.join([' '.join([str(e) for e in r]) for r in col_matrix_to_row_matrix(sorted(m, cmp=matrix_compare))]))
... | return 0
def main():
test_cases = open(sys.argv[1], 'r') | random_line_split |
main.py | import sys
def row_matrix_to_col_matrix(row_matrix):
|
def col_matrix_to_row_matrix(col_matrix):
row_matrix = []
for r in range(len(col_matrix)): row_matrix.append([])
for c in range(len(col_matrix)):
for r in range(len(col_matrix)):
row_matrix[r].append(col_matrix[c][r])
return row_matrix
def matrix_compare(a, b):
length = min(... | col_matrix = []
for c in range(len(row_matrix)): col_matrix.append([])
for r in range(len(row_matrix)):
for c in range(len(row_matrix)):
col_matrix[c].append(row_matrix[r][c])
return col_matrix | identifier_body |
main.py | import sys
def row_matrix_to_col_matrix(row_matrix):
col_matrix = []
for c in range(len(row_matrix)): col_matrix.append([])
for r in range(len(row_matrix)):
for c in range(len(row_matrix)):
col_matrix[c].append(row_matrix[r][c])
return col_matrix
def col_matrix_to_row_matrix(col_... | (a, b):
length = min(len(a), len(b))
index = 0
while index < length:
if a[index] != b[index]:
return a[index] - b[index]
index += 1
return 0
def main():
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
test = test.strip()
if len(test) == 0... | matrix_compare | identifier_name |
main.py | import sys
def row_matrix_to_col_matrix(row_matrix):
col_matrix = []
for c in range(len(row_matrix)): col_matrix.append([])
for r in range(len(row_matrix)):
for c in range(len(row_matrix)):
col_matrix[c].append(row_matrix[r][c])
return col_matrix
def col_matrix_to_row_matrix(col_... |
test_cases.close()
if __name__ == '__main__':
main()
| test = test.strip()
if len(test) == 0: continue
m = row_matrix_to_col_matrix([[int(i) for i in s.strip().split(' ')] for s in test.split('|')])
print(' | '.join([' '.join([str(e) for e in r]) for r in col_matrix_to_row_matrix(sorted(m, cmp=matrix_compare))])) | conditional_block |
index.tsx | import React from 'react'
import onClickOutside from 'react-onclickoutside'
import isEqual from 'lodash/isEqual'
import styled, { ThemeProvider } from 'styled-components'
import { StatefulUIElement } from 'src/util/ui-logic'
import ListPickerLogic, {
ListPickerDependencies,
ListPickerEvent,
ListPickerState... | this.props.actOnAllTabs && (
<IconStyleWrapper show>
<ButtonTooltip
tooltipText="List all tabs in window"
position="left"
>
<ActOnAllTabsButton
size={20}
onClic... | />
)
renderNewListAllTabsButton = () => | random_line_split |
index.tsx | import React from 'react'
import onClickOutside from 'react-onclickoutside'
import isEqual from 'lodash/isEqual'
import styled, { ThemeProvider } from 'styled-components'
import { StatefulUIElement } from 'src/util/ui-logic'
import ListPickerLogic, {
ListPickerDependencies,
ListPickerEvent,
ListPickerState... |
private isListRemote = (name: string): boolean =>
this.state.remoteLists.has(name)
handleClickOutside = (e) => {
if (this.props.onClickOutside) {
this.props.onClickOutside(e)
}
}
handleSetSearchInputRef = (ref: HTMLInputElement) =>
this.processEvent('setSe... | {
if (prevProps.query !== this.props.query) {
this.processEvent('searchInputChanged', { query: this.props.query })
}
const prev = prevState.selectedEntries
const curr = this.state.selectedEntries
if (prev.length !== curr.length || !isEqual(prev, curr)) {
... | identifier_body |
index.tsx | import React from 'react'
import onClickOutside from 'react-onclickoutside'
import isEqual from 'lodash/isEqual'
import styled, { ThemeProvider } from 'styled-components'
import { StatefulUIElement } from 'src/util/ui-logic'
import ListPickerLogic, {
ListPickerDependencies,
ListPickerEvent,
ListPickerState... | (this.state.newEntryName !== '') {
return
}
return (
<EmptyListsView>
<strong>No Collections yet</strong>
<br />
Add new collections
<br />
via the search bar
</EmptyListsView>
)... | if | identifier_name |
index.tsx | import React from 'react'
import onClickOutside from 'react-onclickoutside'
import isEqual from 'lodash/isEqual'
import styled, { ThemeProvider } from 'styled-components'
import { StatefulUIElement } from 'src/util/ui-logic'
import ListPickerLogic, {
ListPickerDependencies,
ListPickerEvent,
ListPickerState... |
}
private isListRemote = (name: string): boolean =>
this.state.remoteLists.has(name)
handleClickOutside = (e) => {
if (this.props.onClickOutside) {
this.props.onClickOutside(e)
}
}
handleSetSearchInputRef = (ref: HTMLInputElement) =>
this.processEvent(... | {
this.props.onSelectedEntriesChange?.({
selectedEntries: this.state.selectedEntries,
})
} | conditional_block |
object-lifetime-default.rs | // Copyright 2015 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 | |
object-lifetime-default.rs | // Copyright 2015 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 ... | <'a,T>(&'a (), T); //~ ERROR None
#[rustc_object_lifetime_default]
struct C<'a,T:'a>(&'a T); //~ ERROR 'a
#[rustc_object_lifetime_default]
struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous
#[rustc_object_lifetime_default]
struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b
#[rustc_object_lifetime_default]
... | B | identifier_name |
object-lifetime-default.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn main() { } | random_line_split | |
AdhocQueryAdapter.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 may not... | (secretToken, handle) {
let downloadURL = baseUrl + urls.query + '/' + handle +
'/httpresultset?sessionid=' + secretToken;
return Promise.resolve(downloadURL);
},
getSavedQueryById (secretToken, id) {
let url = baseUrl + urls.saveQuery + '/' + id;
return BaseAdapter.get(url + '?sessionid=' ... | getDownloadURL | identifier_name |
AdhocQueryAdapter.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 may not... |
},
_inMemoryOrPersistent (secretToken, handle, queryMode) {
return queryMode === 'PERSISTENT' ?
this.getDownloadURL(secretToken, handle) :
this.getInMemoryResults(secretToken, handle);
},
getTables (secretToken, database) {
let url = baseUrl + urls.getTables;
return BaseAdapter.get(ur... | {
return this._inMemoryOrPersistent(secretToken, handle, queryMode);
} | conditional_block |
AdhocQueryAdapter.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 may not... |
return Promise.resolve(downloadURL);
},
getSavedQueryById (secretToken, id) {
let url = baseUrl + urls.saveQuery + '/' + id;
return BaseAdapter.get(url + '?sessionid=' + secretToken);
},
getInMemoryResults (secretToken, handle) {
let resultUrl = baseUrl + urls.query + '/' + handle + '/results... | let downloadURL = baseUrl + urls.query + '/' + handle +
'/httpresultset?sessionid=' + secretToken; | random_line_split |
AdhocQueryAdapter.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 may not... | ,
getQuery (secretToken, handle) {
let url = baseUrl + urls.query + '/' + handle;
return BaseAdapter.get(url + '?sessionid=' + secretToken);
},
getQueries (secretToken, email, options) {
let queryOptions = {};
queryOptions.sessionid = secretToken;
queryOptions.user = email;
var state;
... | {
let url = baseUrl + urls.saveQuery + '/' + id;
let queryToBeSaved = {
savedQuery: {
owner: user,
name: options.name || '',
query: query,
description: options.description || '',
parameters: options.parameters || []
}
};
return BaseAdapter.put(url, JS... | identifier_body |
multi_request.rs | use rand::seq::SliceRandom;
use rand::thread_rng;
use yaml_rust::Yaml;
use crate::interpolator::INTERPOLATION_REGEX;
use crate::actions::Request;
use crate::benchmark::Benchmark;
pub fn is_that_you(item: &Yaml) -> bool |
pub fn expand(item: &Yaml, benchmark: &mut Benchmark) {
if let Some(with_items) = item["with_items"].as_vec() {
let mut with_items_list = with_items.clone();
if let Some(shuffle) = item["shuffle"].as_bool() {
if shuffle {
let mut rng = thread_rng();
with_items_list.shuffle(&mut rng);
... | {
item["request"].as_hash().is_some() && item["with_items"].as_vec().is_some()
} | identifier_body |
multi_request.rs | use rand::seq::SliceRandom;
use rand::thread_rng;
use yaml_rust::Yaml;
use crate::interpolator::INTERPOLATION_REGEX;
use crate::actions::Request;
use crate::benchmark::Benchmark;
pub fn is_that_you(item: &Yaml) -> bool {
item["request"].as_hash().is_some() && item["with_items"].as_vec().is_some()
}
pub fn expand(... | () {
let text = "---\nname: foobar\nrequest:\n url: /api/{{ item }}\nwith_items:\n - 1\n - 2\n - foo{{ memory }}";
let docs = yaml_rust::YamlLoader::load_from_str(text).unwrap();
let doc = &docs[0];
let mut benchmark: Benchmark = Benchmark::new();
expand(&doc, &mut benchmark);
}
}
| runtime_expand | identifier_name |
multi_request.rs | use rand::seq::SliceRandom;
use rand::thread_rng;
use yaml_rust::Yaml;
use crate::interpolator::INTERPOLATION_REGEX;
use crate::actions::Request;
use crate::benchmark::Benchmark;
pub fn is_that_you(item: &Yaml) -> bool {
item["request"].as_hash().is_some() && item["with_items"].as_vec().is_some()
}
pub fn expand(... |
benchmark.push(Box::new(Request::new(item, Some(with_item.clone()), Some(index))));
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn expand_multi() {
let text = "---\nname: foobar\nrequest:\n url: /api/{{ item }}\nwith_items:\n - 1\n - 2\n - 3";
let docs = yaml_rust::YamlLoader:... | {
panic!("Interpolations not supported in 'with_items' children!");
} | conditional_block |
multi_request.rs | use rand::seq::SliceRandom;
use rand::thread_rng;
use yaml_rust::Yaml;
use crate::interpolator::INTERPOLATION_REGEX;
use crate::actions::Request;
use crate::benchmark::Benchmark;
pub fn is_that_you(item: &Yaml) -> bool {
item["request"].as_hash().is_some() && item["with_items"].as_vec().is_some()
}
pub fn expand(... | let docs = yaml_rust::YamlLoader::load_from_str(text).unwrap();
let doc = &docs[0];
let mut benchmark: Benchmark = Benchmark::new();
expand(&doc, &mut benchmark);
}
} | fn runtime_expand() {
let text = "---\nname: foobar\nrequest:\n url: /api/{{ item }}\nwith_items:\n - 1\n - 2\n - foo{{ memory }}"; | random_line_split |
test_color.py | import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound |
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
# Ignoring duplicates
if n not in (16, 21, 46, 51, 196, 201, 226, 231, 244):
rgb = (int(color[1:3],16), int(color[3:5],16), int(colo... | from plumbum.colorlib.names import color_html, FindNearest | random_line_split |
test_color.py | import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
... | :
def test_allcolors(self):
myrange = (0,1,2,5,17,39,48,73,82,140,193,210,240,244,250,254,255)
for r in myrange:
for g in myrange:
for b in myrange:
near = FindNearest(r,g,b)
assert near.all_slow() == near.all_fast(), 'Tested: {0}, ... | TestNearestColor | identifier_name |
test_color.py | import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
... |
class TestANSIColor:
@classmethod
def setup_class(cls):
ANSIStyle.use_color = True
def test_ansi(self):
assert str(ANSIStyle(fgcolor=Color('reset'))) == '\033[39m'
assert str(ANSIStyle(fgcolor=Color.from_full('green'))) == '\033[38;5;2m'
assert str(ANSIStyle(fgcolor=Color... | assert Color("Yellow") == Color.from_full("Yellow")
assert (Color.from_full("yellow").representation !=
Color.from_simple("yellow").representation) | identifier_body |
test_color.py | import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
... | for b in myrange:
near = FindNearest(r,g,b)
assert near.all_slow() == near.all_fast(), 'Tested: {0}, {1}, {2}'.format(r,g,b) | conditional_block | |
fractal_plant.rs | /// https://en.wikipedia.org/wiki/L-system#Example_7:_Fractal_plant
extern crate cgmath;
#[macro_use]
extern crate glium;
extern crate glutin;
extern crate lsystems;
extern crate rand;
mod support;
use support::prelude::*;
use lsystems::alphabet;
use lsystems::grammar;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ha... |
fn scale(s: f32) -> alphabet::Transform {
alphabet::Transform {
rotation : 0.0,
scale : Vector::new(s, s),
}
}
fn new() -> grammar::T<TextureId> {
let s = grammar::Nonterminal(0);
let s2 = grammar::Nonterminal(1);
let l = grammar::Nonterminal(2);
let r = grammar::Nonterm... | {
alphabet::Transform {
rotation : std::f32::consts::PI * degrees / 180.0,
scale : Vector::new(1.0, 1.0),
}
} | identifier_body |
fractal_plant.rs | /// https://en.wikipedia.org/wiki/L-system#Example_7:_Fractal_plant
extern crate cgmath;
#[macro_use]
extern crate glium;
extern crate glutin;
extern crate lsystems;
extern crate rand;
mod support;
use support::prelude::*;
use lsystems::alphabet;
use lsystems::grammar;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ha... | {
Stem,
}
impl rand::Rand for TextureId {
fn rand<Rng: rand::Rng>(_: &mut Rng) -> Self {
TextureId::Stem
}
}
impl support::Texture for TextureId {
fn to_fragment_shader(&self) -> String {
match self {
&TextureId::Stem => "
#version 330
in vec2 f_texture_posn;
out vec4 ... | TextureId | identifier_name |
fractal_plant.rs | /// https://en.wikipedia.org/wiki/L-system#Example_7:_Fractal_plant
extern crate cgmath;
#[macro_use]
extern crate glium;
extern crate glutin;
extern crate lsystems;
extern crate rand;
mod support;
use support::prelude::*;
use lsystems::alphabet;
use lsystems::grammar;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ha... | }
float random( float f ) {
const uint mantissaMask = 0x007FFFFFu;
const uint one = 0x3F800000u;
uint h = hash( floatBitsToUint( f ) );
h &= mantissaMask;
h |= one;
float r2 = uintBitsToFloat( h );
return r2 - 1.0;
... | x ^= ( x >> 11u );
x += ( x << 15u );
return x; | random_line_split |
config.py | IN.CHROMATIC = False
# Scales to compute real features
__C.TRAIN.SCALES_BASE = (0.25, 0.5, 1.0, 2.0, 3.0)
# The number of scales per octave in the image pyramid
# An octave is the set of scales up to half of the initial scale
__C.TRAIN.NUM_PER_OCTAVE = 4
# parameters for ROI generating
__C.TRAIN.SPATIAL_SCALE = 0.0... | (imdb, net):
"""Return the directory where experimental artifacts are placed.
A canonical path is built using the name from an imdb and a network
(if not None).
"""
path = osp.abspath(osp.join(__C.ROOT_DIR, 'output', __C.EXP_DIR, imdb.name))
if net is None:
return path
else:
... | get_output_dir | identifier_name |
config.py | .TRAIN.CHROMATIC = False
# Scales to compute real features
__C.TRAIN.SCALES_BASE = (0.25, 0.5, 1.0, 2.0, 3.0)
# The number of scales per octave in the image pyramid
# An octave is the set of scales up to half of the initial scale
__C.TRAIN.NUM_PER_OCTAVE = 4
# parameters for ROI generating
__C.TRAIN.SPATIAL_SCALE =... | __C.TRAIN.SNAPSHOT_ITERS = 10000
# solver.prototxt specifies the snapshot path prefix, this adds an optional
# infix to yield the path: <prefix>[_<infix>]_iters_XYZ.caffemodel
__C.TRAIN.SNAPSHOT_INFIX = ''
# Use a prefetch thread in roi_data_layer.layer
# So far I haven't found this useful; likely more engineering wo... | # be used as a bounding-box regression training example
__C.TRAIN.BBOX_THRESH = (0.5,)
# Iterations between snapshots | random_line_split |
config.py | 000
# Number of top scoring boxes to keep after applying NMS to RPN proposals
__C.TRAIN.RPN_POST_NMS_TOP_N = 2000
# Proposal height and width both need to be greater than RPN_MIN_SIZE (at orig image scale)
__C.TRAIN.RPN_MIN_SIZE = 16
# Deprecated (outside weights)
__C.TRAIN.RPN_BBOX_INSIDE_WEIGHTS = (1.0, 1.0, 1.0, 1.0... | """Merge config dictionary a into config dictionary b, clobbering the
options in b whenever they are also specified in a.
"""
if type(a) is not edict:
return
for k, v in a.iteritems():
# a must specify keys that are in b
if not b.has_key(k):
raise KeyError('{} is not... | identifier_body | |
config.py | .USE_PREFETCH = False
# Train using subclasses
__C.TRAIN.SUBCLS = True
# Train using viewpoint
__C.TRAIN.VIEWPOINT = False
# Threshold of ROIs in training RCNN
__C.TRAIN.ROI_THRESHOLD = 0.1
# IOU >= thresh: positive example
__C.TRAIN.RPN_POSITIVE_OVERLAP = 0.7
# IOU < thresh: negative example
__C.TRAIN.RPN_NEGATIV... | widths[i] = math.sqrt(area / aspect[i])
heights[i] = widths[i] * aspect[i] | conditional_block | |
Capsule.py | -c616-4977-9420-844712a735bf}')
## create inf file describes what goes into capsule and call GenFv to generate capsule
#
#
class Capsule (CapsuleClassObject):
## The constructor
#
# @param self The object pointer
#
def __init__(self):
CapsuleClassObject.__init__(self)
... | CapsuleDataObj.CapsuleName = self.CapsuleName
FileName = CapsuleDataObj.GenCapsuleSubItem()
CapsuleDataObj.CapsuleName = None
CapFileList.append(FileName)
CapInfFile.writelines("EFI_FILE_NAME = " + \
FileName + \
... | conditional_block | |
Capsule.py | 4712a735bf}')
## create inf file describes what goes into capsule and call GenFv to generate capsule
#
#
class Capsule (CapsuleClassObject):
## The constructor
#
# @param self The object pointer
#
def __init__(self):
CapsuleClassObject.__init__(self)
# For GenF... | if self.UiCapsuleName.upper() + 'cap' in GenFdsGlobalVariable.ImageBinDict:
return GenFdsGlobalVariable.ImageBinDict[self.UiCapsuleName.upper() + 'cap']
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)
if ('CAPSULE_GUID' in self.TokensDict and
uu... | identifier_body | |
Capsule.py |
import uuid
from struct import pack
from Common import EdkLogger
from Common.BuildToolError import GENFDS_ERROR
from Common.DataType import TAB_LINE_BREAK
WIN_CERT_REVISION = 0x0200
WIN_CERT_TYPE_EFI_GUID = 0x0EF1
EFI_CERT_TYPE_PKCS7_GUID = uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}')
EFI_CERT_TYPE_R... | (self):
CapsuleClassObject.__init__(self)
# For GenFv
self.BlockSize = None
# For GenFv
self.BlockNum = None
self.CapsuleName = None
## Generate FMP capsule
#
# @retval string Generated Capsule file path
#
def GenFmpCapsule(self):
... | __init__ | identifier_name |
Capsule.py |
import uuid
from struct import pack
from Common import EdkLogger
from Common.BuildToolError import GENFDS_ERROR
from Common.DataType import TAB_LINE_BREAK
WIN_CERT_REVISION = 0x0200
WIN_CERT_TYPE_EFI_GUID = 0x0EF1
EFI_CERT_TYPE_PKCS7_GUID = uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}')
EFI_CERT_TYPE_R... | # UINT16 wRevision;
# UINT16 wCertificateType;
# //UINT8 bCertificate[ANYSIZE_ARRAY];
# } WIN_CERTIFICATE;
#
# typedef struct _WIN_CERTIFICATE_UEFI_GUID {
# WIN_CERTIFICATE Hdr;
# EFI_GUID CertType;
# //UINT8 CertData[ANYSIZE... | FwMgrHdrSize = 4+2+2+8*(len(self.CapsuleDataList)+len(self.FmpPayloadList))
#
# typedef struct _WIN_CERTIFICATE {
# UINT32 dwLength;
| random_line_split |
controllers.js | angular.module('starter.controllers', [])
// A simple controller that fetches a list of data from a service
.controller('PetIndexCtrl', function($scope, PetService) {
// "Pets" is a service returning mock data (services.js)
$scope.pets = PetService.all();
})
// A simple controller that shows a tapped item's dat... | }); | random_line_split | |
about.tsx | import '../src/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/styles';
import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
... | </Typography>
<Button variant="contained" color="primary">
Do nothing button
</Button>
</div>
);
}
export default About; | <Typography gutterBottom>
<Link href="/">
<a>Go to the main page</a>
</Link> | random_line_split |
about.tsx | import '../src/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/styles';
import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
... | () {
const classes = useStyles({});
return (
<div className={classes.root}>
<Typography variant="h4" gutterBottom>
Material-UI
</Typography>
<Typography variant="subtitle1" gutterBottom>
about page
</Typography>
<Typography gutterBottom>
<Link href="/">
... | About | identifier_name |
about.tsx | import '../src/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/styles';
import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
... | );
}
export default About;
| {
const classes = useStyles({});
return (
<div className={classes.root}>
<Typography variant="h4" gutterBottom>
Material-UI
</Typography>
<Typography variant="subtitle1" gutterBottom>
about page
</Typography>
<Typography gutterBottom>
<Link href="/">
... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.