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 |
|---|---|---|---|---|
host_test_plugins.py | ###########################################################################
name = "HostTestPluginBase" # Plugin name, can be plugin class name
type = "BasePlugin" # Plugin type: ResetMethod, CopyMethod etc.
capabilities = [] # Capabilities names: what plugin can achieve
# (e.g. reset using some ... |
def print_plugin_info(self, text, NL=True):
"""Print notifications to the console.
Args:
text: Text to print.
NL: (Deprecated) Newline will be added behind text if this flag is True.
"""
self.plugin_logger.prn_inf(text)
return True
def print_pl... | """Print error messages to the console.
Args:
text: Text to print.
"""
self.plugin_logger.prn_err(text)
return False | identifier_body |
host_test_plugins.py | ###########################################################################
name = "HostTestPluginBase" # Plugin name, can be plugin class name
type = "BasePlugin" # Plugin type: ResetMethod, CopyMethod etc.
capabilities = [] # Capabilities names: what plugin can achieve
# (e.g. reset using some ... | """
self.plugin_logger.prn_err(text)
return False
def print_plugin_info(self, text, NL=True):
"""Print notifications to the console.
Args:
text: Text to print.
NL: (Deprecated) Newline will be added behind text if this flag is True.
"""
... | def print_plugin_error(self, text):
"""Print error messages to the console.
Args:
text: Text to print. | random_line_split |
Etaoin3DPrint.ts | class Etaoin3DPrint_IntentionAction extends IntentionAction {
canHandle(intention:Term, ai:RuleBasedAI) : boolean
{
if ((intention.functor.is_a(ai.o.getSort("action.print")) ||
intention.functor.is_a(ai.o.getSort("verb.make")) ||
intention.functor.is_a(ai.o.getSort("verb.create"))) &&
intention.attribut... |
static loadFromXML(xml:Element, ai:RuleBasedAI) : IntentionAction
{
return new Etaoin3DPrint_IntentionAction();
}
}
| {
return "<IntentionAction type=\"Etaoin3DPrint_IntentionAction\"/>";
} | identifier_body |
Etaoin3DPrint.ts | class Etaoin3DPrint_IntentionAction extends IntentionAction {
canHandle(intention:Term, ai:RuleBasedAI) : boolean
{
if ((intention.functor.is_a(ai.o.getSort("action.print")) ||
intention.functor.is_a(ai.o.getSort("verb.make")) ||
intention.functor.is_a(ai.o.getSort("verb.create"))) &&
intention.attribut... |
}
}
if (bestMissingMaterials.length > 0) {
if (requester != null) {
let term:Term = Term.fromString("action.talk('"+ai.selfID+"'[#id], perf.ack.denyrequest("+requester+"))", ai.o);
ai.intentions.push(new IntentionRecord(term, null, null, null, ai.timeStamp));
term = Term.fromString("action... | {
bestPrinter = printer;
bestMissingMaterials = missing;
} | conditional_block |
Etaoin3DPrint.ts | class Etaoin3DPrint_IntentionAction extends IntentionAction {
canHandle(intention:Term, ai:RuleBasedAI) : boolean
{
if ((intention.functor.is_a(ai.o.getSort("action.print")) ||
intention.functor.is_a(ai.o.getSort("verb.make")) ||
intention.functor.is_a(ai.o.getSort("verb.create"))) &&
intention.attribut... |
if (recipe == null) {
if (requester != null) {
let term:Term = Term.fromString("action.talk('"+ai.selfID+"'[#id], perf.ack.denyrequest("+requester+"))", ai.o);
ai.intentions.push(new IntentionRecord(term, null, null, null, ai.timeStamp));
term = Term.fromString("action.talk('"+ai.selfID+"'[#id], ... | recipe = tmp[1];
recipe_idx = ai.game.three_d_printer_recipies.indexOf(tmp);
break;
}
} | random_line_split |
Etaoin3DPrint.ts | class Etaoin3DPrint_IntentionAction extends IntentionAction {
canHandle(intention:Term, ai:RuleBasedAI) : boolean
{
if ((intention.functor.is_a(ai.o.getSort("action.print")) ||
intention.functor.is_a(ai.o.getSort("verb.make")) ||
intention.functor.is_a(ai.o.getSort("verb.create"))) &&
intention.attribut... | (ai:RuleBasedAI) : string
{
return "<IntentionAction type=\"Etaoin3DPrint_IntentionAction\"/>";
}
static loadFromXML(xml:Element, ai:RuleBasedAI) : IntentionAction
{
return new Etaoin3DPrint_IntentionAction();
}
}
| saveToXML | identifier_name |
var_alt_dir_ind.rs | use std::collections::HashMap;
use pest::Error;
use var_instr::variable::{Variable, AsComplete, LabelNotFound};
use var_instr::variable::FromPair;
use machine::instruction::mem_size::MemSize;
use machine::instruction::parameter::{AltDirect, Indirect, AltDirInd};
use label::Label;
#[derive(Debug)]
pub enum VarAltDirInd... | (pair: ::AsmPair) -> Result<Self, ::AsmError> {
match pair.as_rule() {
::Rule::direct => Ok(VarAltDirInd::AltDirect(Variable::from_pair(pair)?)),
::Rule::indirect => Ok(VarAltDirInd::Indirect(Variable::from_pair(pair)?)),
_ => Err(Error::CustomErrorSpan {
mess... | from_pair | identifier_name |
var_alt_dir_ind.rs | use std::collections::HashMap;
use pest::Error;
use var_instr::variable::{Variable, AsComplete, LabelNotFound};
use var_instr::variable::FromPair;
use machine::instruction::mem_size::MemSize;
use machine::instruction::parameter::{AltDirect, Indirect, AltDirInd};
use label::Label;
#[derive(Debug)]
pub enum VarAltDirInd... |
}
impl AsComplete<AltDirInd> for VarAltDirInd {
fn as_complete(&self, offset: usize, label_offsets: &HashMap<Label, usize>) -> Result<AltDirInd, LabelNotFound> {
use self::VarAltDirInd::*;
match *self {
AltDirect(ref alt_direct) => Ok(AltDirInd::AltDirect(alt_direct.as_complete(offset,... | {
match pair.as_rule() {
::Rule::direct => Ok(VarAltDirInd::AltDirect(Variable::from_pair(pair)?)),
::Rule::indirect => Ok(VarAltDirInd::Indirect(Variable::from_pair(pair)?)),
_ => Err(Error::CustomErrorSpan {
message: format!("expected direct, indirect found ... | identifier_body |
var_alt_dir_ind.rs | use std::collections::HashMap;
use pest::Error;
use var_instr::variable::{Variable, AsComplete, LabelNotFound};
use var_instr::variable::FromPair;
use machine::instruction::mem_size::MemSize;
use machine::instruction::parameter::{AltDirect, Indirect, AltDirInd};
use label::Label;
|
impl MemSize for VarAltDirInd {
fn mem_size(&self) -> usize {
match *self {
VarAltDirInd::AltDirect(ref alt_direct) => alt_direct.mem_size(),
VarAltDirInd::Indirect(ref indirect) => indirect.mem_size(),
}
}
}
impl FromPair for VarAltDirInd {
fn from_pair(pair: ::Asm... | #[derive(Debug)]
pub enum VarAltDirInd {
AltDirect(Variable<AltDirect>),
Indirect(Variable<Indirect>),
} | random_line_split |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | (AutotoolsPackage):
"""Xapian is a highly adaptable toolkit which allows developers to easily
add advanced indexing and search facilities to their own applications.
It supports the Probabilistic Information Retrieval model and also
supports a rich set of boolean query operators."""
homepage = "http... | XapianCore | identifier_name |
package.py | #
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# ... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory. | random_line_split | |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | """Xapian is a highly adaptable toolkit which allows developers to easily
add advanced indexing and search facilities to their own applications.
It supports the Probabilistic Information Retrieval model and also
supports a rich set of boolean query operators."""
homepage = "https://xapian.org"
url ... | identifier_body | |
tabview.d.ts | import * as React from 'react';
type TabPanelHeaderTemplateType = React.ReactNode | ((options: TabPanelHeaderTemplateOptions) => React.ReactNode);
interface TabPanelHeaderTemplateOptions {
className: string;
titleClassName: string;
onClick(event: React.MouseEvent<HTMLElement>): void;
leftIconElement: ... | extends React.Component<TabViewProps, any> { }
| TabView | identifier_name |
tabview.d.ts | import * as React from 'react';
type TabPanelHeaderTemplateType = React.ReactNode | ((options: TabPanelHeaderTemplateOptions) => React.ReactNode);
interface TabPanelHeaderTemplateOptions {
className: string;
titleClassName: string;
onClick(event: React.MouseEvent<HTMLElement>): void;
leftIconElement: ... | renderActiveOnly?: boolean;
scrollable?: boolean;
onTabChange?(e: TabViewTabChangeParams): void;
}
// tslint:disable-next-line:max-classes-per-file
export declare class TabView extends React.Component<TabViewProps, any> { } | random_line_split | |
mod.rs | #[derive(Debug, PartialEq)]
pub enum CentrifugeError {
WrongProtocol,
ParsingError,
UnknownProtocol,
InvalidPacket,
}
pub mod prelude {
pub use crate::structs::raw::Raw::*; | pub use crate::structs::ether::Ether::*;
}
/// `Zero` - This packet is very interesting
/// `One` - This packet is somewhat interesting
/// `Two` - Stuff you want to see if you're looking really hard
/// `AlmostMaximum` - Some binary data
/// `Maximum` - We couldn't par... | random_line_split | |
mod.rs | #[derive(Debug, PartialEq)]
pub enum CentrifugeError {
WrongProtocol,
ParsingError,
UnknownProtocol,
InvalidPacket,
}
pub mod prelude {
pub use crate::structs::raw::Raw::*;
pub use crate::structs::ether::Ether::*;
}
/// `Zero` - This packet is very interesting
/// `One` ... | (self) -> u8 {
self as u8
}
}
pub mod raw;
pub mod ether;
pub mod arp;
pub mod cjdns;
pub mod icmp;
pub mod ipv4;
pub mod ipv6;
pub mod ip;
pub mod tcp;
pub mod udp;
pub mod tls;
pub mod http;
pub mod dhcp;
pub mod dns;
pub mod ssdp;
pub mod dropbox;
| into_u8 | identifier_name |
login.module.ts | import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
// used to create fake backend
import { fakeBackendProvider } from '../_helpers/fake-backend'; | import { RegisterComponent } from './register.component';
import { AlertComponent } from './alert.component';
import { AuthGuard } from './auth.guard';
import { AuthService } from './auth.service';
import { UserService } from './user.service';
@NgModule ({
imports: [
FormsModule,
BrowserModule,
... | import { MockBackend, MockConnection } from '@angular/http/testing';
import { BaseRequestOptions } from '@angular/http';
import { LoginComponent } from './login.component'; | random_line_split |
login.module.ts | import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
// used to create fake backend
import { fakeBackendProvider } from '../_helpers/fake-backend';
import { MockBackend, MockCon... | {
} | LoginModule | identifier_name |
test-bend90a.py | #
# pyfeyner - a simple Python interface for making Feynman diagrams.
# Copyright (C) 2005-2010 Andy Buckley, Georg von Hippel
# Copyright (C) 2013 Ismo Toijala
#
# pyfeyner 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... | #pt_out = Vertex(6, 0)
vtx = Vertex(3, 3)
f = Fermion(pt_in, pt_out).arcThru(vtx)
fd.draw("test-bend90a.pdf") | pt_in = Vertex(0, 0)
pt_out = Vertex(0, 6) | random_line_split |
plotter2.py | import matplotlib.pyplot as pl
import numpy as np
import math
from matplotlib.collections import LineCollection
from matplotlib.colors import colorConverter
def plot(X, m, x_star, t, z_t):
fig = pl.figure(figsize=(10,10))
# Draw the grid first
ax = pl.axes()
ax.set_xlim(-4,20)
ax.set_ylim(-4,20)... | ax.yaxis.set_major_locator(pl.MultipleLocator(5.0))
ax.yaxis.set_minor_locator(pl.MultipleLocator(1.0))
ax.grid(which='major', axis='x', linewidth=0.75, linestyle='-', color='0.75')
ax.grid(which='minor', axis='x', linewidth=0.25, linestyle='-', color='0.75')
ax.grid(which='major', axis='y', linewid... | random_line_split | |
plotter2.py | import matplotlib.pyplot as pl
import numpy as np
import math
from matplotlib.collections import LineCollection
from matplotlib.colors import colorConverter
def plot(X, m, x_star, t, z_t):
| rect = pl.Rectangle((x,y), 1, 1, fill=True,color='#cacaca')
ax.add_patch(rect)
# Draw the robot and its direction
x,y,theta = x_star['x'], x_star['y'], x_star['theta']
dx = 1 * math.cos(theta)
dy = 1 * math.sin(theta)
ax.arrow(x,y,dx,dy, head_width=.4, head_length=0.... | fig = pl.figure(figsize=(10,10))
# Draw the grid first
ax = pl.axes()
ax.set_xlim(-4,20)
ax.set_ylim(-4,20)
ax.xaxis.set_major_locator(pl.MultipleLocator(5.0))
ax.xaxis.set_minor_locator(pl.MultipleLocator(1.0))
ax.yaxis.set_major_locator(pl.MultipleLocator(5.0))
ax.yaxis.set_minor_loc... | identifier_body |
plotter2.py | import matplotlib.pyplot as pl
import numpy as np
import math
from matplotlib.collections import LineCollection
from matplotlib.colors import colorConverter
def plot(X, m, x_star, t, z_t):
fig = pl.figure(figsize=(10,10))
# Draw the grid first
ax = pl.axes()
ax.set_xlim(-4,20)
ax.set_ylim(-4,20)... |
# Draw the robot and its direction
x,y,theta = x_star['x'], x_star['y'], x_star['theta']
dx = 1 * math.cos(theta)
dy = 1 * math.sin(theta)
ax.arrow(x,y,dx,dy, head_width=.4, head_length=0.5, length_includes_head=True)
circle = pl.Circle((x, y), radius=0.35, fc='y')
ax.add_patch(circle)
... | for x, cell in enumerate(row):
if (cell == 'W'):
rect = pl.Rectangle((x,y), 1, 1, fill=True,color='#cacaca')
ax.add_patch(rect) | conditional_block |
plotter2.py | import matplotlib.pyplot as pl
import numpy as np
import math
from matplotlib.collections import LineCollection
from matplotlib.colors import colorConverter
def | (X, m, x_star, t, z_t):
fig = pl.figure(figsize=(10,10))
# Draw the grid first
ax = pl.axes()
ax.set_xlim(-4,20)
ax.set_ylim(-4,20)
ax.xaxis.set_major_locator(pl.MultipleLocator(5.0))
ax.xaxis.set_minor_locator(pl.MultipleLocator(1.0))
ax.yaxis.set_major_locator(pl.MultipleLocator(5.0)... | plot | identifier_name |
authenticate.ts | import * as express from 'express';
import App from './models/app';
import User from './models/user';
import Userkey from './models/userkey';
export interface IAuthContext {
/**
* App which requested
*/
app: any;
/**
* Authenticated user
*/
user: any;
/**
* Weather if the request is via the (Misskey W... |
return resolve({
app: null,
user: user,
isSecure: true
});
}
const userkey = req.headers['userkey'] || req.body['_userkey'];
if (userkey) {
const userkeyDoc = await Userkey.findOne({
key: userkey
});
if (userkeyDoc === null) {
return reject('invalid userkey');
}
const app = await Ap... | {
return reject('user not found');
} | conditional_block |
authenticate.ts | import * as express from 'express';
import App from './models/app';
import User from './models/user';
import Userkey from './models/userkey';
export interface IAuthContext {
/**
* App which requested
*/
app: any;
/**
* Authenticated user
*/
user: any;
/**
* Weather if the request is via the (Misskey W... | });
}
const userkey = req.headers['userkey'] || req.body['_userkey'];
if (userkey) {
const userkeyDoc = await Userkey.findOne({
key: userkey
});
if (userkeyDoc === null) {
return reject('invalid userkey');
}
const app = await App
.findOne({ _id: userkeyDoc.app_id });
const user = await Use... | user: user,
isSecure: true | random_line_split |
method-on-tuple-struct.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
// STACK BY VAL
// lldb-command:print self
// lldb-check:[...]$3 = TupleStruct(100, -100.5)
// lldb-command:print arg1
// lldb-check:[...]$4 = -3
// lldb-command:print arg2
// lldb-check:[...]$5 = -4
// lldb-command:continue
// OWNED BY REF
// lldb-command:print *self
// lldb-check:[...]$6 = TupleStruct(200, -200.5)
... | random_line_split | |
method-on-tuple-struct.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | (int, f64);
impl TupleStruct {
fn self_by_ref(&self, arg1: int, arg2: int) -> int {
zzz(); // #break
arg1 + arg2
}
fn self_by_val(self, arg1: int, arg2: int) -> int {
zzz(); // #break
arg1 + arg2
}
fn self_owned(self: Box<TupleStruct>, arg1: int, arg2: int) -> int... | TupleStruct | identifier_name |
method-on-tuple-struct.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
fn self_by_val(self, arg1: int, arg2: int) -> int {
zzz(); // #break
arg1 + arg2
}
fn self_owned(self: Box<TupleStruct>, arg1: int, arg2: int) -> int {
zzz(); // #break
arg1 + arg2
}
}
fn main() {
let stack = TupleStruct(100, -100.5);
let _ = stack.self_by_ref... | {
zzz(); // #break
arg1 + arg2
} | identifier_body |
models.py | # -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.conf import settings
from django.utils.encoding import force_str
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.apps... |
BleachChecker.activate()
| verbose_name = _("Find unbleached html content")
model = dd.Model
def get_checkable_models(self):
for m in super(BleachChecker, self).get_checkable_models():
if len(m._bleached_fields):
yield m
def get_checkdata_problems(self, obj, fix=False):
t = tuple(obj.fie... | identifier_body |
models.py | # -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.conf import settings
from django.utils.encoding import force_str
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.apps... |
def get_checkdata_problems(self, obj, fix=False):
t = tuple(obj.fields_to_bleach())
if len(t):
fldnames = ', '.join([f.name for f, old, new in t])
yield (True, _("Fields {} have unbleached content.").format(fldnames))
if fix:
obj.before_ui_save(N... | yield m | conditional_block |
models.py | # -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.conf import settings
from django.utils.encoding import force_str
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.apps... | (self, ar):
settings.SITE.kernel.default_renderer.build_site_cache(True)
return ar.success(
"""\
Seems that it worked. Refresh your browser.
<br>
Note that other users might experience side effects because
of the unexpected .js update, but there are no known problems so far.
Please report an... | run_from_ui | identifier_name |
models.py | # -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.conf import settings
from django.utils.encoding import force_str
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.apps... | <br>
Note that other users might experience side effects because
of the unexpected .js update, but there are no known problems so far.
Please report any anomalies.""",
alert=_("Success"))
class SiteConfigManager(models.Manager):
def get(self, *args, **kwargs):
return settings.SITE.site_config... | settings.SITE.kernel.default_renderer.build_site_cache(True)
return ar.success(
"""\
Seems that it worked. Refresh your browser. | random_line_split |
0014_auto_20160918_0010.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-17 16:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('overseas', '0013_auto_20160914_1706'),
]
operations ... | ('cdn_name', models.CharField(max_length=100)),
('active', models.BooleanField(default=True)),
],
),
migrations.AlterField(
model_name='networkidentifiers',
name='service',
field=models.ForeignKey(blank=True, null=True, on_d... | name='CDN',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | random_line_split |
0014_auto_20160918_0010.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-17 16:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class | (migrations.Migration):
dependencies = [
('overseas', '0013_auto_20160914_1706'),
]
operations = [
migrations.CreateModel(
name='CDN',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
... | Migration | identifier_name |
0014_auto_20160918_0010.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-17 16:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
| name='cdn',
field=models.ManyToManyField(blank=True, null=True, to='overseas.CDN'),
),
]
| dependencies = [
('overseas', '0013_auto_20160914_1706'),
]
operations = [
migrations.CreateModel(
name='CDN',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cdn_name', models.... | identifier_body |
index.ts | import {NgbdProgressbarBasic} from './basic/progressbar-basic';
import {NgbdProgressbarStriped} from './striped/progressbar-striped';
import {NgbdProgressbarConfig} from './config/progressbar-config';
export const DEMO_DIRECTIVES = [NgbdProgressbarBasic, NgbdProgressbarStriped, NgbdProgressbarConfig];
export const DE... | config: {
code: require('!!prismjs?lang=typescript!./config/progressbar-config'),
markup: require('!!prismjs?lang=markup!./config/progressbar-config.html')}
}; | markup: require('!!prismjs?lang=markup!./striped/progressbar-striped.html')}, | random_line_split |
linkedMap.d.ts | export declare namespace Touch {
const None: 0;
const First: 1;
const Last: 2;
}
export declare type Touch = 0 | 1 | 2;
export declare class | <K, V> {
private _map;
private _head;
private _tail;
private _size;
constructor();
clear(): void;
isEmpty(): boolean;
get size(): number;
has(key: K): boolean;
get(key: K): V | undefined;
set(key: K, value: V, touch?: Touch): void;
delete(key: K): boolean;
... | LinkedMap | identifier_name |
linkedMap.d.ts | export declare namespace Touch {
const None: 0;
const First: 1;
| }
export declare type Touch = 0 | 1 | 2;
export declare class LinkedMap<K, V> {
private _map;
private _head;
private _tail;
private _size;
constructor();
clear(): void;
isEmpty(): boolean;
get size(): number;
has(key: K): boolean;
get(key: K): V | undefined;
set(... | const Last: 2;
| random_line_split |
stub_activity.rs | // Copyright (C) 2011 The Android Open Source Project
//
// 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 applic... |
// Return value tells RS roughly how often to redraw
// in this case 20 ms
return 20;
} | rsgDrawText("Hello World!", 50, 50); | random_line_split |
assignability-trait.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 ... | trait iterable<A> {
fn iterate(&self, blk: |x: &A| -> bool) -> bool;
}
impl<'a,A> iterable<A> for &'a [A] {
fn iterate(&self, f: |x: &A| -> bool) -> bool {
self.iter().advance(f)
}
}
impl<A> iterable<A> for Vec<A> {
fn iterate(&self, f: |x: &A| -> bool) -> bool {
self.iter().advance(f)... | // making method calls, but only if there aren't any matches without
// it.
| random_line_split |
assignability-trait.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 ... | (&self, f: |x: &A| -> bool) -> bool {
self.iter().advance(f)
}
}
impl<A> iterable<A> for Vec<A> {
fn iterate(&self, f: |x: &A| -> bool) -> bool {
self.iter().advance(f)
}
}
fn length<A, T: iterable<A>>(x: T) -> uint {
let mut len = 0;
x.iterate(|_y| {
len += 1;
true... | iterate | identifier_name |
assignability-trait.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 ... |
}
impl<A> iterable<A> for Vec<A> {
fn iterate(&self, f: |x: &A| -> bool) -> bool {
self.iter().advance(f)
}
}
fn length<A, T: iterable<A>>(x: T) -> uint {
let mut len = 0;
x.iterate(|_y| {
len += 1;
true
});
return len;
}
pub fn main() {
let x: Vec<int> = vec!(0,1... | {
self.iter().advance(f)
} | identifier_body |
hrtb-precedence-of-plus-where-clause.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // distinct bounds on `F`.
fn foo1<F>(f: F)
where F : FnOnce(isize) -> isize + Send
{
bar(f);
}
fn foo2<F>(f: F)
where F : FnOnce(isize) -> isize + Send
{
baz(f);
}
fn bar<F:Send>(f: F) { }
fn baz<F:FnOnce(isize) -> isize>(f: F) { }
fn main() {} |
// Test that `F : Fn(isize) -> isize + Send` is interpreted as two | random_line_split |
hrtb-precedence-of-plus-where-clause.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn foo2<F>(f: F)
where F : FnOnce(isize) -> isize + Send
{
baz(f);
}
fn bar<F:Send>(f: F) { }
fn baz<F:FnOnce(isize) -> isize>(f: F) { }
fn main() {}
| {
bar(f);
} | identifier_body |
hrtb-precedence-of-plus-where-clause.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <F>(f: F)
where F : FnOnce(isize) -> isize + Send
{
bar(f);
}
fn foo2<F>(f: F)
where F : FnOnce(isize) -> isize + Send
{
baz(f);
}
fn bar<F:Send>(f: F) { }
fn baz<F:FnOnce(isize) -> isize>(f: F) { }
fn main() {}
| foo1 | identifier_name |
doughnutchartdemo.ts | import {Component, OnInit} from '@angular/core';
import {Subscription} from 'rxjs';
import {AppConfigService} from '../../../service/appconfigservice';
import {AppConfig} from '../../../domain/appconfig';
@Component({
templateUrl: './doughnutchartdemo.html'
})
export class DoughnutChartDemo {
data: any;
... | () {
return {
legend: {
labels: {
fontColor: '#ebedef'
}
}
}
}
} | getDarkTheme | identifier_name |
doughnutchartdemo.ts | import {Component, OnInit} from '@angular/core';
import {Subscription} from 'rxjs';
import {AppConfigService} from '../../../service/appconfigservice';
import {AppConfig} from '../../../domain/appconfig';
@Component({
templateUrl: './doughnutchartdemo.html'
})
export class DoughnutChartDemo {
data: any;
... |
getDarkTheme() {
return {
legend: {
labels: {
fontColor: '#ebedef'
}
}
}
}
} | } | random_line_split |
foundation.magellan.js | 'use strict';
import $ from 'jquery';
import { GetYoDigits } from './foundation.util.core';
import { Plugin } from './foundation.plugin';
import { SmoothScroll } from './foundation.smoothScroll';
/**
* Magellan module.
* @module foundation.magellan
* @requires foundation.smoothScroll
*/
class Magellan extends P... | * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
* @option
* @type {number}
* @default 0
*/
offset: 0
}
export {Magellan}; | /** | random_line_split |
foundation.magellan.js | 'use strict';
import $ from 'jquery';
import { GetYoDigits } from './foundation.util.core';
import { Plugin } from './foundation.plugin';
import { SmoothScroll } from './foundation.smoothScroll';
/**
* Magellan module.
* @module foundation.magellan
* @requires foundation.smoothScroll
*/
class Magellan extends P... |
}
/**
* Default settings for plugin
*/
Magellan.defaults = {
/**
* Amount of time, in ms, the animated scrolling should take between locations.
* @option
* @type {number}
* @default 500
*/
animationDuration: 500,
/**
* Animation style to use when scrolling between locations. Can be `'swing'`... | {
this.$element.off('.zf.trigger .zf.magellan')
.find(`.${this.options.activeClass}`).removeClass(this.options.activeClass);
if(this.options.deepLinking){
var hash = this.$active[0].getAttribute('href');
window.location.hash.replace(hash, '');
}
$(window).off('popstate', this._deepL... | identifier_body |
foundation.magellan.js | 'use strict';
import $ from 'jquery';
import { GetYoDigits } from './foundation.util.core';
import { Plugin } from './foundation.plugin';
import { SmoothScroll } from './foundation.smoothScroll';
/**
* Magellan module.
* @module foundation.magellan
* @requires foundation.smoothScroll
*/
class Magellan extends P... | (loc) {
this._inTransition = true;
var _this = this;
var options = {
animationEasing: this.options.animationEasing,
animationDuration: this.options.animationDuration,
threshold: this.options.threshold,
offset: this.options.offset
};
SmoothScroll.scrollToLoc(loc, options, fu... | scrollToLoc | identifier_name |
foundation.magellan.js | 'use strict';
import $ from 'jquery';
import { GetYoDigits } from './foundation.util.core';
import { Plugin } from './foundation.plugin';
import { SmoothScroll } from './foundation.smoothScroll';
/**
* Magellan module.
* @module foundation.magellan
* @requires foundation.smoothScroll
*/
class Magellan extends P... |
else if(winPos < this.points[0]){ curIdx = undefined; }
else{
var isDown = this.scrollPos < winPos,
_this = this,
curVisible = this.points.filter(function(p, i){
return isDown ? p - _this.options.offset <= winPos : p - _this.options.offset - _this.options.threshold <= winP... | { curIdx = this.points.length - 1; } | conditional_block |
EditContainer.js | import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users'
import { USER_TYPE_USER } from 'Server/constants'
import EditView from '../components/EditView'
class EditContainer extends Component {
stati... | () {
if (!this.isAdding) {
this.props.getUserRequest(this.props.params.id)
}
}
handleSubmit(user) {
if (this.isAdding) {
this.props.addUserRequest(user)
} else {
this.props.updateUserRequest(this.props.params.id, user)
}
}
render() {
const { user } = this.props
r... | componentDidMount | identifier_name |
EditContainer.js | import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users'
import { USER_TYPE_USER } from 'Server/constants'
import EditView from '../components/EditView'
class EditContainer extends Component {
stati... | handleSubmit(user) {
if (this.isAdding) {
this.props.addUserRequest(user)
} else {
this.props.updateUserRequest(this.props.params.id, user)
}
}
render() {
const { user } = this.props
return (
<div>
<div className="page-header">
<h2>
{this.isAdd... | }
}
| random_line_split |
EditContainer.js | import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users'
import { USER_TYPE_USER } from 'Server/constants'
import EditView from '../components/EditView'
class EditContainer extends Component {
stati... | else {
this.props.updateUserRequest(this.props.params.id, user)
}
}
render() {
const { user } = this.props
return (
<div>
<div className="page-header">
<h2>
{this.isAdding ? 'Add New User' : `Edit User - ${user.username}`}
</h2>
</div>
... | {
this.props.addUserRequest(user)
} | conditional_block |
EditContainer.js | import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users'
import { USER_TYPE_USER } from 'Server/constants'
import EditView from '../components/EditView'
class EditContainer extends Component {
stati... |
}
const mapStateToProps = (state, ownProps) => {
let user
if (ownProps.params.id === undefined) {
user = {
username: '',
password: '',
type: USER_TYPE_USER,
}
} else {
user = state.users.find(_user => _user._id === ownProps.params.id)
user.password = ''
}
return {
user... | {
const { user } = this.props
return (
<div>
<div className="page-header">
<h2>
{this.isAdding ? 'Add New User' : `Edit User - ${user.username}`}
</h2>
</div>
<EditView
isAdding={this.isAdding}
user={user}
onSubmit={thi... | identifier_body |
load_timeline_for_day_and_user.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import json
import bson.json_util as bju
import emission.core.get_database as... | entries = json.load(open(fn), object_hook = bju.object_hook)
for i, entry in enumerate(entries):
entry["user_id"] = override_uuid
if not args.retain:
del entry["_id"]
if args.verbose is not None and i % args.verbose == 0:
print("About to save %s" % entry)
... | parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representation of the timeline")
parser.add_argument("user_email",
help="specify the user email to load the data as")
parser.add_argument("-r", "--retain", action="s... | conditional_block |
load_timeline_for_day_and_user.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import json
import bson.json_util as bju
import emission.core.get_database as... | parser.add_argument("-v", "--verbose", type=int,
help="after how many lines we should print a status message.")
args = parser.parse_args()
fn = args.timeline_filename
print(fn)
print("Loading file " + fn)
tsdb = edb.get_timeseries_db()
user = ecwu.User.register(args.user_email)
... | random_line_split | |
RangeSlider.tsx | readOnly?: boolean
validationType?: ValidationType
className?: string
}
type ThumbIndices = 0 | 1 | undefined
const sort = (arr: number[]) => arr.sort((a, b) => a - b)
/*
* Takes a new number (newPoint) and decides which min or max value should be replaced
*/
const findClosestIndex = (value: number[], newPoi... | return roundToStep(min, max, step, newPoint)
}
/*
*Prevent value from exceeding min—max range
*/
const boundValueProp = (min: number, max: number, value?: number[]) => {
return map(value || [min, max], (point: number) => {
const boundedPoint = Math.max(Math.min(point, max), min)
if (boundedPoint !== poin... | const newPoint =
(mousePosition / containerRect.width) * possibleValueRange + min
| random_line_split |
RangeSlider.tsx | ?: boolean
validationType?: ValidationType
className?: string
}
type ThumbIndices = 0 | 1 | undefined
const sort = (arr: number[]) => arr.sort((a, b) => a - b)
/*
* Takes a new number (newPoint) and decides which min or max value should be replaced
*/
const findClosestIndex = (value: number[], newPoint: numbe... | }, [isMouseDown, refreshDomRect])
useEffect(() => {
if (isMouseDown) {
handleMouseDown() // fire mouseDown event after containerRect measurements are refreshed
}
}, [isMouseDown, handleMouseDown, containerRect])
/*
* Only fire mouse drag event when mouse moves AFTER initial cli... | refreshDomRect() // re-measure rectangle when isMouseDown changes from false to true
}
| conditional_block |
user-handler.js | handlers.getRegister = function (ctx) {
ctx.loadPartials({
header: '../views/common/header.hbs',
footer: '../views/common/footer.hbs'
}).then(function () {
this.partial('../views/user/register.hbs');
});
}
handlers.getLogin = function (ctx) {
ctx.loadPartials({
header: '../views/common/header.h... |
if (password !== repeatPassword) {
notify.showError('The repeat password should be equal to the password');
return;
}
userService.register(username, password, firstName, lastName).then((res) => {
userService.saveSession(res);
notify.showInfo('User registration successful.');
ctx.redir... | {
notify.showError('The password should be at least 6 characters long');
return;
} | conditional_block |
user-handler.js | handlers.getRegister = function (ctx) {
ctx.loadPartials({
header: '../views/common/header.hbs',
footer: '../views/common/footer.hbs'
}).then(function () {
this.partial('../views/user/register.hbs');
});
}
handlers.getLogin = function (ctx) {
ctx.loadPartials({
header: '../views/common/header.h... | let username = ctx.params.username;
let firstName = ctx.params.firstName;
let lastName = ctx.params.lastName;
let password = ctx.params.password;
let repeatPassword = ctx.params.repeatPassword;
if (firstName.length < 2) {
notify.showError("The firstName should be at least 2 characters long");
retur... |
handlers.registerUser = function (ctx) { | random_line_split |
dm.py | _this_flavor'
else:
for x in (set(flavors) - set(['sci'])):
whttype = x
number = len(set(fruits))
scifiles = []
whtfiles = []
for fruit in set(fruits):
x = fruit+'_sci.fits'
if os.path.exists(x):
scifiles.append(x)
else:
scifiles.append(None)
... | tempmtoc = 1.
except:
tempmtoc = 1.
background, diffimage = background/tempmtoc, diffimage/tempmtoc # units: counts
variance = np.median(diffimage*diffimage) # sky count variance
var = diffimage + variance # variance in the whole image number-counts
#... | hdulist = pyfits.open(scifile)
sci = hdulist[0].data
hdr = hdulist[0].header
hdulist.close()
NX,NY = sci.shape
if (varfile is not None):
hdulist = pyfits.open(varfile)
var = hdulist[0].data
hdulist.close()
else:
# Make a var image from the sci image...
background = np.... | identifier_body |
dm.py | _choose_this_flavor'
else:
for x in (set(flavors) - set(['sci'])):
whttype = x
number = len(set(fruits))
scifiles = []
whtfiles = []
for fruit in set(fruits):
x = fruit+'_sci.fits'
if os.path.exists(x):
scifiles.append(x)
else:
scifiles.append(Non... | except:
FWHM = 1.4
elif SURVEY=='KIDS':
FWHM = lenstractor.KIDS_IQ(hdr)
elif SURVEY=='SDSS':
try:
FWHM = lenstractor.SDSS_IQ(hdr)
except:
FWHM = 'NaN'
if FWHM == 'NaN':
print "Problem with initialising PSF for SDS... | name = scifile.replace('_sci.fits','')
if vb:
print " "
print "Making Tractor image from "+name+"_*.fits:"
# Read in sci and wht images. Note assumptions about file format:
sci,invvar,hdr,total_flux = Read_in_data(scifile,varfile,SURVEY=SURVEY,vb=vb)
if total_flux == 0... | conditional_block |
dm.py | range(number):
print " ",i+1,"th pair:",[scifiles[i],whtfiles[i]]
return scifiles,whtfiles
# ============================================================================
# Read in data and organise into Tractor Image objects.
# Some of this is survey specific: subroutines to be stored in $survey.py.
d... | Initial_PSF | identifier_name | |
dm.py | _choose_this_flavor'
else:
for x in (set(flavors) - set(['sci'])):
whttype = x
number = len(set(fruits))
scifiles = []
whtfiles = []
for fruit in set(fruits):
x = fruit+'_sci.fits'
if os.path.exists(x):
scifiles.append(x)
else:
scifiles.append(Non... | band,photocal = lenstractor.SDSS_photocal(hdr)
if vb: print photocal
bands.append(band)
if SURVEY=='PS1':
try:
epochs.append(lenstractor.PS1_epoch(hdr))
except:
epochs.append(lenstractor.SDSS_epoch(hdr))
elif SURVEY=='KIDS':
epochs.a... | band,photocal = lenstractor.SDSS_photocal(hdr)
else:
print "Unrecognised survey name "+SURVEY+", assuming SDSS" | random_line_split |
list-cdn-endpoints.mock.ts | export const request = {
"headers": {
"Content-Type": "application/json",
},
};
export const response = {
"body": {
"endpoints": [
{
"id": "19f06b6a-3ace-4315-b086-499a0e521b76",
"origin": "static-images.nyc3.digitaloceanspaces.com",
"endpoint": "static-images.nyc3.cdn.digita... | },
}; | random_line_split | |
main.js | jQuery(document).ready(function($){
//check if the .cd-image-container is in the viewport
//if yes, animate it
checkPosition($('.cd-image-container'));
$(window).on('scroll', function(){
checkPosition($('.cd-image-container'));
});
//make the .cd-handle element draggable and modify... | });
}
function updateLabel(label, resizeElement, position) {
if(position == 'left') {
( label.offset().left + label.outerWidth() < resizeElement.offset().left + resizeElement.outerWidth() ) ? label.removeClass('is-hidden') : label.addClass('is-hidden') ;
} else {
( label.offset().left > res... | random_line_split | |
main.js | jQuery(document).ready(function($){
//check if the .cd-image-container is in the viewport
//if yes, animate it
checkPosition($('.cd-image-container'));
$(window).on('scroll', function(){
checkPosition($('.cd-image-container'));
});
//make the .cd-handle element draggable and modify... |
//draggable funtionality - credits to http://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/
function drags(dragElement, resizeElement, container, labelContainer, labelResizeElement) {
dragElement.on("mousedown vmousedown", function(e) {
dragElement.addClass('draggable');
resizeElement... | {
container.each(function(){
var actualContainer = $(this);
if( $(window).scrollTop() + $(window).height()*0.5 > actualContainer.offset().top) {
actualContainer.addClass('is-visible');
}
});
} | identifier_body |
main.js | jQuery(document).ready(function($){
//check if the .cd-image-container is in the viewport
//if yes, animate it
checkPosition($('.cd-image-container'));
$(window).on('scroll', function(){
checkPosition($('.cd-image-container'));
});
//make the .cd-handle element draggable and modify... | else {
( label.offset().left > resizeElement.offset().left + resizeElement.outerWidth() ) ? label.removeClass('is-hidden') : label.addClass('is-hidden') ;
}
} | {
( label.offset().left + label.outerWidth() < resizeElement.offset().left + resizeElement.outerWidth() ) ? label.removeClass('is-hidden') : label.addClass('is-hidden') ;
} | conditional_block |
main.js | jQuery(document).ready(function($){
//check if the .cd-image-container is in the viewport
//if yes, animate it
checkPosition($('.cd-image-container'));
$(window).on('scroll', function(){
checkPosition($('.cd-image-container'));
});
//make the .cd-handle element draggable and modify... | (dragElement, resizeElement, container, labelContainer, labelResizeElement) {
dragElement.on("mousedown vmousedown", function(e) {
dragElement.addClass('draggable');
resizeElement.addClass('resizable');
var dragWidth = dragElement.outerWidth(),
xPosition = dragElement.offset().l... | drags | identifier_name |
config.js | /**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor =... | { name: 'links', groups: ['links'] },
{ name: 'insert', groups: ['insert'] },
'/',
{ name: 'styles', groups: ['styles'] },
{ name: 'colors', groups: ['colors'] },
{ name: 'tools', groups: ['tools'] },
{ name: 'others', groups: ['others'... | random_line_split | |
Tile.tsx | import * as classNames from 'classnames';
import * as React from 'react';
import { Bulma, withHelpersModifiers } from './../bulma';
import { getHTMLProps } from './../helpers';
import { getGridSizesModifiers, Grid, removeGridSizesProps } from './grid';
export interface Tile<T> extends Bulma.Render, Bulma.Tag,
Rea... | ({ tag = 'div', render, ...props }: Tile<HTMLElement>) {
const className = classNames(
'tile',
{
'is-ancestor': props.isAncestor,
'is-child': props.isChild,
'is-parent': props.isParent,
'is-vertical': props.isVertical,
...getGridSizesModifi... | Tile | identifier_name |
Tile.tsx | import * as classNames from 'classnames';
import * as React from 'react';
import { Bulma, withHelpersModifiers } from './../bulma';
import { getHTMLProps } from './../helpers';
import { getGridSizesModifiers, Grid, removeGridSizesProps } from './grid';
export interface Tile<T> extends Bulma.Render, Bulma.Tag,
Rea... |
const HTMLProps = getHTMLProps(rest, removeGridSizesProps);
if (render) return render({ ...HTMLProps, className });
return React.createElement(tag, { ...HTMLProps, className });
}
const HOC = /*@__PURE__*/withHelpersModifiers(Tile);
export default HOC;
| {
const className = classNames(
'tile',
{
'is-ancestor': props.isAncestor,
'is-child': props.isChild,
'is-parent': props.isParent,
'is-vertical': props.isVertical,
...getGridSizesModifiers(props.isSize),
},
props.className,
... | identifier_body |
Tile.tsx | import * as classNames from 'classnames';
import * as React from 'react';
import { Bulma, withHelpersModifiers } from './../bulma';
import { getHTMLProps } from './../helpers';
import { getGridSizesModifiers, Grid, removeGridSizesProps } from './grid';
export interface Tile<T> extends Bulma.Render, Bulma.Tag, | isParent?: boolean;
isVertical?: boolean;
}
export function Tile({ tag = 'div', render, ...props }: Tile<HTMLElement>) {
const className = classNames(
'tile',
{
'is-ancestor': props.isAncestor,
'is-child': props.isChild,
'is-parent': props.isParent,
... | React.HTMLProps<T> {
isSize?: Grid.Sizes;
isAncestor?: boolean;
isChild?: boolean; | random_line_split |
slide-toggle-required-validator.d.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Provider } from '@angular/core';
import { CheckboxRequiredValidator } from '@angular/forms';
import * as i0 f... | extends CheckboxRequiredValidator {
static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggleRequiredValidator, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<MatSlideToggleRequiredValidator, "mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required]... | MatSlideToggleRequiredValidator | identifier_name |
slide-toggle-required-validator.d.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Provider } from '@angular/core';
import { CheckboxRequiredValidator } from '@angular/forms';
import * as i0 f... | static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggleRequiredValidator, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<MatSlideToggleRequiredValidator, "mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]", never, {}, {}, never>;
} | *
* Required slide-toggle form controls are valid when checked.
*/
export declare class MatSlideToggleRequiredValidator extends CheckboxRequiredValidator { | random_line_split |
orbitalWidget.py | class orbitalWidget(QGroupBox):
def __init__(self):
|
def initUI(self):
table= orbitalTable(0, 3)
table.horizontalHeader().setResizeMode(QHeaderView.Stretch)
btn_active = QPushButton('Active', self)
btn_active.setStyleSheet("background-color: red")
btn_active.clicked.connect(table.setActif)
btn_active.setStatusTip(d... | super(QGroupBox, self).__init__()
self.initUI() | identifier_body |
orbitalWidget.py | class orbitalWidget(QGroupBox):
def | (self):
super(QGroupBox, self).__init__()
self.initUI()
def initUI(self):
table= orbitalTable(0, 3)
table.horizontalHeader().setResizeMode(QHeaderView.Stretch)
btn_active = QPushButton('Active', self)
btn_active.setStyleSheet("background-color: red")
btn_... | __init__ | identifier_name |
orbitalWidget.py | class orbitalWidget(QGroupBox):
def __init__(self):
super(QGroupBox, self).__init__()
self.initUI()
def initUI(self):
table= orbitalTable(0, 3)
table.horizontalHeader().setResizeMode(QHeaderView.Stretch)
btn_active = QPushButton('Active', self)
btn_active.se... |
w.setLayout(vbox)
self.setTitle("Orbital class")
vbox = QVBoxLayout()
vbox.addWidget(w)
self.setLayout(vbox) | vbox.addWidget(btn_frozen)
vbox.addWidget(btn_inactive)
w=QWidget() | random_line_split |
sassTask.js | /**
* Created by Phil on 1/27/2016.
*/
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
main = require('../gulpfile.js')
;
require('run-sequence').use(gulp);
// SASS Build task
gulp.task('sass:build', function() {
var isCompile = main.isCompile();
... | }); | .pipe(gulp.dest('build/styles')) | random_line_split |
scene_test.rs | extern crate ggez;
extern crate ggez_goodies;
use ggez::conf;
/*
use ggez::event;
use ggez::graphics;
use ggez::timer;
use ggez::GameResult;
use std::time::Duration;
use ggez_goodies::scene::*;
struct MainState {
font: graphics::Font,
message_text: graphics::Text,
}
/// A bootstrap scene whose only purpose i... | let s1 = SavedScene1::new("Scene 1", "Scene 2");
let s2 = SavedScene1::new("Scene 2", "Scene 1");
state.add(s1);
state.add(s2);
Ok(Some("Scene 1".to_string()))
}
fn draw(&mut self,
_ctx: &mut ggez::Context,
_store: &mut SceneStore<MainState>)
... | state: &mut SceneStore<MainState>)
-> GameResult<Option<String>> { | random_line_split |
scene_test.rs | extern crate ggez;
extern crate ggez_goodies;
use ggez::conf;
/*
use ggez::event;
use ggez::graphics;
use ggez::timer;
use ggez::GameResult;
use std::time::Duration;
use ggez_goodies::scene::*;
struct MainState {
font: graphics::Font,
message_text: graphics::Text,
}
/// A bootstrap scene whose only purpose i... | () {
let _c = conf::Conf::new();
/*let mut game: Game<SceneManager<MainState>> = Game::new("scenetest", c).unwrap();
if let Err(e) = game.run() {
println!("Error encountered: {:?}", e);
} else {
println!("Game exited cleanly.");
}
*/
}
| main | identifier_name |
scene_test.rs | extern crate ggez;
extern crate ggez_goodies;
use ggez::conf;
/*
use ggez::event;
use ggez::graphics;
use ggez::timer;
use ggez::GameResult;
use std::time::Duration;
use ggez_goodies::scene::*;
struct MainState {
font: graphics::Font,
message_text: graphics::Text,
}
/// A bootstrap scene whose only purpose i... | {
let _c = conf::Conf::new();
/*let mut game: Game<SceneManager<MainState>> = Game::new("scenetest", c).unwrap();
if let Err(e) = game.run() {
println!("Error encountered: {:?}", e);
} else {
println!("Game exited cleanly.");
}
*/
} | identifier_body | |
urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
import views
urlpatterns = patterns('',
url(r'^add_model_abox', 'tadaa.views.add_model_abox'),
url(r'^add_model', 'tadaa.views.add_model'),
url(r'^list_models', 'tadaa.views.list_models', name='list_models'),
url(r'^ab... | url(r'^view_classes_stat', views.online_annotation_entity_stat),
url(r'^view_annotation_stat', views.online_annotation_annotation_stat),
url(r'^view_annotation', views.view_annotation),
url(r'^list_annotations', views.list_annotations),
url(r'^annotation_results', views.annotation_results),
url(... | url(r'^online_entity_annotation', views.OnlineEntityAnnotation.as_view()), | random_line_split |
mmpmon.py | class mmpmon(object):
def __init__(self):
self.name = 'mmpmon'
self.nodefields = { '_n_': 'nodeip', '_nn_': 'nodename',
'_rc_': 'status', '_t_': 'seconds', '_tu_': 'microsecs',
'_br_': 'bytes_read', '_bw_': 'bytes_written',
'_oc_': 'opens', '_cc_': 'closes', '_r... | """Reset the IO stats"""
return | identifier_body | |
mmpmon.py | class mmpmon(object):
def __init__(self):
self.name = 'mmpmon'
self.nodefields = { '_n_': 'nodeip', '_nn_': 'nodename',
'_rc_': 'status', '_t_': 'seconds', '_tu_': 'microsecs',
'_br_': 'bytes_read', '_bw_': 'bytes_written',
'_oc_': 'opens', '_cc_': 'closes', '_r... |
def _add_nodes(self, nodelist):
"""Add nodes to the mmpmon nodelist"""
return
def _reset_stats(self):
"""Reset the IO stats"""
return | '_oc_': 'opens', '_cc_': 'closes', '_rdc_': 'reads',
'_wc_': 'writes', '_dir_': 'readdir', '_iu_': 'inode_updates' }
self.fslabels = {} | random_line_split |
mmpmon.py | class | (object):
def __init__(self):
self.name = 'mmpmon'
self.nodefields = { '_n_': 'nodeip', '_nn_': 'nodename',
'_rc_': 'status', '_t_': 'seconds', '_tu_': 'microsecs',
'_br_': 'bytes_read', '_bw_': 'bytes_written',
'_oc_': 'opens', '_cc_': 'closes', '_rdc_': 'reads... | mmpmon | identifier_name |
binops.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 ... |
fn test_bool() {
assert!((!(true < false)));
assert!((!(true <= false)));
assert!((true > false));
assert!((true >= false));
assert!((false < true));
assert!((false <= true));
assert!((!(false > true)));
assert!((!(false >= true)));
// Bools support bitwise binops
assert_eq!(... | {
assert_eq!((), ());
assert!((!(() != ())));
assert!((!(() < ())));
assert!((() <= ()));
assert!((!(() > ())));
assert!((() >= ()));
} | identifier_body |
binops.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 ... | () {
let q = p(1, 2);
let mut r = p(1, 2);
unsafe {
println!("q = {:x}, r = {:x}",
(::std::mem::transmute::<*const p, uint>(&q)),
(::std::mem::transmute::<*const p, uint>(&r)));
}
assert_eq!(q, r);
r.y = 17;
assert!((r.y != q.y));
assert_eq!(r.y, 17);
assert!((q != r));
}
pub fn ... | test_class | identifier_name |
binops.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 ... | x: int,
y: int,
}
fn p(x: int, y: int) -> p {
p {
x: x,
y: y
}
}
fn test_class() {
let q = p(1, 2);
let mut r = p(1, 2);
unsafe {
println!("q = {:x}, r = {:x}",
(::std::mem::transmute::<*const p, uint>(&q)),
(::std::mem::transmute::<*const p, uint>(&r)));
}
a... | struct p { | random_line_split |
index.js | 'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var postcss = _interopRequireWildcard(_postcss);
function | (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
exports.default = postcss.plugin('postcss-define-units', function () {
var opti... | _interopRequireWildcard | identifier_name |
index.js | 'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var postcss = _interopRequireWildcard(_postcss);
function _interopRequireWildcard(obj) |
exports.default = postcss.plugin('postcss-define-units', function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return function (css) {
var save = {};
css.walkDecls(function (decl) {
if (decl.prop === '--define') {
var _postcss$list$space = post... | { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | identifier_body |
index.js | 'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var postcss = _interopRequireWildcard(_postcss);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(o... | expression = _value$match[1],
postfix = _value$match[2];
save[type] = [new Function('value', ['return', '(', expression, ')'].join(' ')), postfix];
} else {
var _value$match2 = value.match(/(\d+)(\w+)/),
_2 = _value$match2[0],
count = ... |
if (value.charAt(0) == '(') {
var _value$match = value.match(/\((.+)\)(\w+|\%)/),
_ = _value$match[0], | random_line_split |
timeseries-form.component.ts | import { Component, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit } from "@angular/core";
import {ProcessorsService} from '../processors.service';
import * as flatpickr from 'flatpickr';
@Component({
selector: 'timeseries-form',
templateUrl: './timeseries-form.component.html',
styleUrls: ['.... |
} | {
/*
this.formsubmit.emit({
start: this.startDateInput.nativeElement._flatpickr.selectedDates[0],
end: this.endDateInput.nativeElement._flatpickr.selectedDates[0]
});
*/
} | identifier_body |
timeseries-form.component.ts | import { Component, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit } from "@angular/core";
import {ProcessorsService} from '../processors.service';
import * as flatpickr from 'flatpickr';
@Component({
selector: 'timeseries-form',
templateUrl: './timeseries-form.component.html',
styleUrls: ['.... | },
mode: 'range'
});
let val = this.processorService.getTimeSeriesStateValue();
setTimeout(()=>{
rangePicker.setDate([val.start, val.end]);
}, 0)
this.processorService.getTimeSeriesState().subscribe((value)=>{
rangePicker.setDate... | });
} | random_line_split |
timeseries-form.component.ts | import { Component, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit } from "@angular/core";
import {ProcessorsService} from '../processors.service';
import * as flatpickr from 'flatpickr';
@Component({
selector: 'timeseries-form',
templateUrl: './timeseries-form.component.html',
styleUrls: ['.... | (private processorService: ProcessorsService) {
}
ngAfterViewInit() {
let rangePicker = flatpickr(this.timeRangeInput.nativeElement, {
onChange: (value)=> {
if (value.length == 2) {
this.processorService.setTimeSeriesState({
... | constructor | identifier_name |
timeseries-form.component.ts | import { Component, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit } from "@angular/core";
import {ProcessorsService} from '../processors.service';
import * as flatpickr from 'flatpickr';
@Component({
selector: 'timeseries-form',
templateUrl: './timeseries-form.component.html',
styleUrls: ['.... |
})
}
onSubmitClick() {
/*
this.formsubmit.emit({
start: this.startDateInput.nativeElement._flatpickr.selectedDates[0],
end: this.endDateInput.nativeElement._flatpickr.selectedDates[0]
});
*/
}
} | {
rangePicker.set('minDate', processor.timeRange.start.toDate());
rangePicker.set('maxDate', processor.timeRange.end.toDate());
} | conditional_block |
filter_news.py | """Generate year files with news counts
Usage:
filter_news.py <directory> <output> <lang>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
|
if __name__ == "__main__":
# Parse the command line
args = docopt(__doc__)
# Array with the week we are considering
weeks = [42,43,44,45,46,47,48,49,50,51,52,1,23,4,5,6,7,8,9,10,11,12,13,14,15]
# Final count dictionary
news_count = {}
# Get only the files in the directory which have a dimension greater tha... | for i in range(0, len(lis)):
if id == lis[i]:
return i
return -1 | identifier_body |
filter_news.py | """Generate year files with news counts
Usage:
filter_news.py <directory> <output> <lang>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(l... | if i < 10:
number = "0" + str(i)
else:
number = str(i)
df_index.append(number)
# Generate the dataframe
final_df = pd.DataFrame(news_count)
final_df.set_index([df_index])
# Print the dataframe to show the result
print(final_df)
# Save it to file
final_df.to_csv(args["<output>"], index_label="Week"... | # Add a zero in front of number less than 10
for i in weeks: | random_line_split |
filter_news.py | """Generate year files with news counts
Usage:
filter_news.py <directory> <output> <lang>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(l... |
# Increment the week count
news_count[year][find_index(week_number, weeks)] += int(total_news["lang_detected"])
# Generate the index for the future dataframe
df_index = []
# Add a zero in front of number less than 10
for i in weeks:
if i < 10:
number = "0" + str(i)
else:
number = str(i)
df_ind... | news_count[year] = [0 for x in range(0, len(weeks))] | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.