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 |
|---|---|---|---|---|
colors.py | import jobs
import config
from utils.various import bound
from utils.colors import mix_colors
from notifiers import notifier
from db.models import StatusColor
class ColorNotifier(notifier.Notifier):
def _check(self):
current = self.job.status
if current.error:
|
self.assign_color(current)
def assign_color(self, status):
raise NotImplementedError()
def set_color(self, color, blink=False, pulse=False):
db_col = StatusColor.get_or_create(status=self.job.status)[0]
db_col.color = color
db_col.blink = blink
db_col.pulse = ... | self.set_color(config.ERROR_COLOR, blink=True)
return | conditional_block |
colors.py | import jobs
import config
from utils.various import bound
from utils.colors import mix_colors
from notifiers import notifier
from db.models import StatusColor
class ColorNotifier(notifier.Notifier):
def _check(self):
|
def assign_color(self, status):
raise NotImplementedError()
def set_color(self, color, blink=False, pulse=False):
db_col = StatusColor.get_or_create(status=self.job.status)[0]
db_col.color = color
db_col.blink = blink
db_col.pulse = pulse
db_col.save()
class ... | current = self.job.status
if current.error:
self.set_color(config.ERROR_COLOR, blink=True)
return
self.assign_color(current) | identifier_body |
gpr_3931_test.js | 'use strict';
var $$Array = require("../../lib/js/array.js");
var Curry = require("../../lib/js/curry.js");
var Caml_module = require("../../lib/js/caml_module.js");
var PA = Caml_module.init_mod([
"gpr_3931_test.ml",
3,
6
], {
TAG: /* Module */0,
_0: [[
/* Function */0,
... | Caml_module.update_mod({
TAG: /* Module */0,
_0: [[
/* Function */0,
"print"
]]
}, PA, {
print: print
});
function print$1(i) {
console.log(String(i));
}
Caml_module.update_mod({
TAG: /* Module */0,
_0: [[
/* Function */0,
"print"... | function print(a) {
$$Array.iter(P.print, a);
}
| random_line_split |
gpr_3931_test.js | 'use strict';
var $$Array = require("../../lib/js/array.js");
var Curry = require("../../lib/js/curry.js");
var Caml_module = require("../../lib/js/caml_module.js");
var PA = Caml_module.init_mod([
"gpr_3931_test.ml",
3,
6
], {
TAG: /* Module */0,
_0: [[
/* Function */0,
... |
Caml_module.update_mod({
TAG: /* Module */0,
_0: [[
/* Function */0,
"print"
]]
}, P, {
print: print$1
});
Curry._1(PA.print, [
1,
2
]);
exports.PA = PA;
exports.P = P;
/* PA Not a pure module */
| {
console.log(String(i));
} | identifier_body |
gpr_3931_test.js | 'use strict';
var $$Array = require("../../lib/js/array.js");
var Curry = require("../../lib/js/curry.js");
var Caml_module = require("../../lib/js/caml_module.js");
var PA = Caml_module.init_mod([
"gpr_3931_test.ml",
3,
6
], {
TAG: /* Module */0,
_0: [[
/* Function */0,
... | (i) {
console.log(String(i));
}
Caml_module.update_mod({
TAG: /* Module */0,
_0: [[
/* Function */0,
"print"
]]
}, P, {
print: print$1
});
Curry._1(PA.print, [
1,
2
]);
exports.PA = PA;
exports.P = P;
/* PA Not a pure module */
| print$1 | identifier_name |
arangoDocument.js | /*global window, Backbone, arangoHelper, _ */
window.arangoDocumentModel = Backbone.Model.extend({
initialize: function () {
'use strict';
},
urlRoot: "/_api/document",
defaults: {
_id: "",
_rev: "",
_key: ""
},
getSorted: function () {
'use strict';
var self = this;
var keys = ... |
return 1;
}
return l < r ? -1 : 1;
});
var sorted = {};
_.each(keys, function (k) {
sorted[k] = self.attributes[k];
});
return sorted;
}
});
| {
return -1;
} | conditional_block |
arangoDocument.js | /*global window, Backbone, arangoHelper, _ */
window.arangoDocumentModel = Backbone.Model.extend({
initialize: function () {
'use strict';
},
urlRoot: "/_api/document",
defaults: {
_id: "",
_rev: "",
_key: ""
},
getSorted: function () {
'use strict';
var self = this;
var keys = ... | }
}); | random_line_split | |
GpServiceChooser.js | ///////////////////////////////////////////////////////////////////////////
// Copyright © Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License"); | //
// 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 governing permissions and
// limitations under the Licen... | // 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 | random_line_split |
ja.js | /*
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'forms', 'ja', {
button: {
title: 'ボタン プロパティ',
text: 'テキスト (値)',
type: 'タイプ',
typeBtn: 'ボタン',
typeSbm: '送信', | },
checkboxAndRadio: {
checkboxTitle: 'チェックボックスのプロパティ',
radioTitle: 'ラジオボタンのプロパティ',
value: '値',
selected: '選択済み',
required: 'Required' // MISSING
},
form: {
title: 'フォームのプロパティ',
menu: 'フォームのプロパティ',
action: 'アクション (action)',
method: 'メソッド (method)',
encoding: 'エンコード方式 (encoding)'
},
hidden: {
... | typeRst: 'リセット' | random_line_split |
core.js | /**
* Fac.js
* (c) 2017 Owen Luke
* https://github.com/tasjs/fac
* Released under the MIT License.
*/
var copy = require('./copy');
var chain = require('./chain');
var super_ = require('./super');
var core = {
new: function(options){
typeof options === 'string' && (options = {name: options});
var obj = cha... | spawn: function(options) {
typeof options === 'string' && (options = {name: options});
var obj = Object.create(this);
copy.do(obj, options);
chain.init(this, options, obj);
return obj;
},
isChildOf: function(obj){
return chain.isChildOf(obj, this);
},
isParentOf: function(obj){
return chain.isPare... | random_line_split | |
core.js | /**
* Fac.js
* (c) 2017 Owen Luke
* https://github.com/tasjs/fac
* Released under the MIT License.
*/
var copy = require('./copy');
var chain = require('./chain');
var super_ = require('./super');
var core = {
new: function(options){
typeof options === 'string' && (options = {name: options});
var obj = cha... |
options = args[i];
}
copy.do(obj, options);
obj.protoName = options.name;
obj.super = super_;
typeof options.default === 'function' && options.default.call(obj, options);
return obj;
},
ext: function(options){
copy.do(this, options);
return this;
},
spawn: function(options) {
typeof opti... | {
options = args[i];
copy.do(obj, options);
} | conditional_block |
GameMode.py | from python_cowbull_server import error_handler
from flask_helpers.check_kwargs import check_kwargs
class GameMode(object):
"""
A representation of a game mode (complexity, number of digits, guesses allowed, etc.). The
mode contains the following information:
* mode <str> A text name fo... |
else:
_value = value
if required and not _value and not default:
self.handler.log(method="_property_setter", message="Required property {} not provided".format(keyword, _value))
raise KeyError("GameMode: '{}' not provided to __init__ and no default provided (or allo... | _value = str(value) # To handle unicode to str conversion in Python 2.7 | conditional_block |
GameMode.py | from python_cowbull_server import error_handler
from flask_helpers.check_kwargs import check_kwargs
class GameMode(object):
"""
A representation of a game mode (complexity, number of digits, guesses allowed, etc.). The
mode contains the following information:
* mode <str> A text name fo... |
@property
def digits(self):
"""
The number of digits used by the DigitWord used in this mode; e.g. a value of 3 would
indicate there are three digits (e.g. 1, 2, and 3), while a value of 5 would indicate
five values (e.g. 0, 1, 2, 3, 4).
:return: <int>
"""
... | @priority.setter
def priority(self, value):
self._priority = self._property_setter(
keyword="priority", required=True, datatype=int, value=value
) | random_line_split |
GameMode.py | from python_cowbull_server import error_handler
from flask_helpers.check_kwargs import check_kwargs
class GameMode(object):
"""
A representation of a game mode (complexity, number of digits, guesses allowed, etc.). The
mode contains the following information:
* mode <str> A text name fo... |
@property
def instruction_text(self):
"""
Instructions on how to use the mode (if present).
:return: <str>
"""
return self._instruction_text
@instruction_text.setter
def instruction_text(self, value):
self._instruction_text = self._property_setter(
... | self._guesses_allowed = self._property_setter(
keyword="guesses_allowed", required=False, default=10, datatype=int, value=value
) | identifier_body |
GameMode.py | from python_cowbull_server import error_handler
from flask_helpers.check_kwargs import check_kwargs
class GameMode(object):
"""
A representation of a game mode (complexity, number of digits, guesses allowed, etc.). The
mode contains the following information:
* mode <str> A text name fo... | (self):
"""
The digit_type is a flag used to specify the type of digit to be used; for example, a
digit (DigitWord.DIGIT) enables a single digit between 0 and 9, while a hex digit
(DigitWord.HEXDIGIT) enables a single digit between 0 and F.
:return: <int>
"""
ret... | digit_type | identifier_name |
progress.py | #!/usr/bin/env python3
def | (pos, scale):
pixels_per_char = 6
max_chars = 16
max_progress = max_chars * pixels_per_char
progress = (pos/scale)*max_progress
print(int ((pos/scale)*max_chars) )
for i in range(0,max_chars):
if i==int((pos/scale)*max_chars):
print("|",end="")
elif i< ((pos/scale)*max_chars):
print(" ",end="")
elif... | progress | identifier_name |
progress.py | #!/usr/bin/env python3
def progress(pos, scale):
pixels_per_char = 6
max_chars = 16
max_progress = max_chars * pixels_per_char
progress = (pos/scale)*max_progress
print(int ((pos/scale)*max_chars) )
for i in range(0,max_chars):
if i==int((pos/scale)*max_chars):
print("|",end="")
elif i< ((pos/scale)*max_... | {
c = 0;
}
// write character to display
LCDsendChar(c);
}
return;
""" | {
c = 5;
}
else | random_line_split |
progress.py | #!/usr/bin/env python3
def progress(pos, scale):
|
for x in range(0,20):
progress(x,20)
"""
96-------------------------------------
20
20/96*16
const uint8_t progresspixels_per_char = 6;
cm_LcdGotoXY(0,1);
//~ LCDprogressBar(sNum, sMax,16);
//~ return;
uint8_t progress=sNum; uint8_t maxprogress=sMax; uint8_t length=16;
uint8_t i;
uint16_t pixelprogress;... | pixels_per_char = 6
max_chars = 16
max_progress = max_chars * pixels_per_char
progress = (pos/scale)*max_progress
print(int ((pos/scale)*max_chars) )
for i in range(0,max_chars):
if i==int((pos/scale)*max_chars):
print("|",end="")
elif i< ((pos/scale)*max_chars):
print(" ",end="")
elif i> ((pos/scale... | identifier_body |
progress.py | #!/usr/bin/env python3
def progress(pos, scale):
pixels_per_char = 6
max_chars = 16
max_progress = max_chars * pixels_per_char
progress = (pos/scale)*max_progress
print(int ((pos/scale)*max_chars) )
for i in range(0,max_chars):
if i==int((pos/scale)*max_chars):
print("|",end="")
elif i< ((pos/scale)*max_... |
"""
96-------------------------------------
20
20/96*16
const uint8_t progresspixels_per_char = 6;
cm_LcdGotoXY(0,1);
//~ LCDprogressBar(sNum, sMax,16);
//~ return;
uint8_t progress=sNum; uint8_t maxprogress=sMax; uint8_t length=16;
uint8_t i;
uint16_t pixelprogress;
uint8_t c;
uint8_t progresswidth = l... | progress(x,20) | conditional_block |
Gruntfile.js | /* global module:false */
module.exports = function(grunt) {
var port = grunt.option('port') || 8000;
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner:
'/*!\n' +
' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +... | unescape: false
}
},
files: [ 'Gruntfile.js', 'js/reveal.js' ]
},
connect: {
server: {
options: {
port: port,
base: '.'
}
}
},
zip: {
'reveal-js-presentation.zip': [
'index.html',
'css/**',
'js/**',
'lib/**',
'images/**',
'plugin/**'
]
},
... | globals: {
head: false,
module: false,
console: false, | random_line_split |
work.component.spec.ts | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '../../.... | fixture = TestBed.createComponent(WorkComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
}); | })
.compileComponents();
}));
beforeEach(() => { | random_line_split |
selectnav.js | /**
* @preserve SelectNav.js (v. 0.1)
* Converts your <ul>/<ol> navigation into a dropdown list for small screens
* https://github.com/lukaszfiszer/selectnav.js
*/
window.selectnav = (function(){
"use strict";
var selectnav = function(element,options){
element = document.getElementById(element);
// r... | if (nav.attachEvent) {
nav.attachEvent('onchange', goTo);
}
return nav;
function goTo(e){
// Crossbrowser issues - http://www.quirksmode.org/js/events_properties.html
var targ;
if (!e) e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.... | nav.addEventListener('change',goTo);
}
| conditional_block |
selectnav.js | /**
* @preserve SelectNav.js (v. 0.1)
* Converts your <ul>/<ol> navigation into a dropdown list for small screens
* https://github.com/lukaszfiszer/selectnav.js
*/
window.selectnav = (function(){
"use strict";
var selectnav = function(element,options){
element = document.getElementById(element);
// r... | ){
// Crossbrowser issues - http://www.quirksmode.org/js/events_properties.html
var targ;
if (!e) e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType === 3) // defeat Safari bug
targ = targ.parentNode;
if(tar... | To(e | identifier_name |
selectnav.js | /**
* @preserve SelectNav.js (v. 0.1)
* Converts your <ul>/<ol> navigation into a dropdown list for small screens
* https://github.com/lukaszfiszer/selectnav.js
*/
window.selectnav = (function(){
"use strict";
var selectnav = function(element,options){
element = document.getElementById(element);
// r... | if(targ.value) window.location.href = targ.value;
}
function islist(list){
var n = list.nodeName.toLowerCase();
return (n === 'ul' || n === 'ol');
}
function id(nextId){
for(var j=1; document.getElementById('selectnav'+j);j++);
return (nextId) ? 'selectnav'+j : 'selectna... | random_line_split | |
selectnav.js | /**
* @preserve SelectNav.js (v. 0.1)
* Converts your <ul>/<ol> navigation into a dropdown list for small screens
* https://github.com/lukaszfiszer/selectnav.js
*/
window.selectnav = (function(){
"use strict";
var selectnav = function(element,options){
element = document.getElementById(element);
// r... | function islist(list){
var n = list.nodeName.toLowerCase();
return (n === 'ul' || n === 'ol');
}
function id(nextId){
for(var j=1; document.getElementById('selectnav'+j);j++);
return (nextId) ? 'selectnav'+j : 'selectnav'+(j-1);
}
function parselist(list){
// go one ... |
// Crossbrowser issues - http://www.quirksmode.org/js/events_properties.html
var targ;
if (!e) e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType === 3) // defeat Safari bug
targ = targ.parentNode;
if(targ.v... | identifier_body |
br-app.component.ts | import {Component, OnInit} from "angular2/core";
import { BeerService } from "./beer.service";
import { SearchPipe } from "./search.pipe";
import { Beer } from './beer';
import { BeerDetailComponent } from './br-detail.component';
@Component({
selector: "br-app",
providers: [BeerService],
directives: [Beer... |
}
| {
this.selectedBeer = b;
} | identifier_body |
br-app.component.ts | import {Component, OnInit} from "angular2/core";
import { BeerService } from "./beer.service";
import { SearchPipe } from "./search.pipe";
import { Beer } from './beer';
import { BeerDetailComponent } from './br-detail.component';
@Component({
selector: "br-app",
providers: [BeerService],
directives: [Beer... | <ul class="beer" *ngIf="beer">
<li *ngFor="#b of beer | search: query"
class="beer-item"
(click)="selectBeer(b)"
[class.selected]="b === selectedBeer">
<br-detail [beer]="b"></br-detail>
</li>
</ul>
</div>
`
})
expo... | template: `
<div class="home">
<h1>Beer life is the life for me</h1>
<input type="text" [(ngModel)]="query"/> | random_line_split |
br-app.component.ts | import {Component, OnInit} from "angular2/core";
import { BeerService } from "./beer.service";
import { SearchPipe } from "./search.pipe";
import { Beer } from './beer';
import { BeerDetailComponent } from './br-detail.component';
@Component({
selector: "br-app",
providers: [BeerService],
directives: [Beer... | () {
this._beerService.getBeer()
.subscribe(
beer => this.beer = beer,
error => this.errorMessage = <any>error);
}
selectBeer(b: Beer) {
this.selectedBeer = b;
}
}
| getBeer | identifier_name |
solution.js | //
// XYO Build
//
// Copyright (c) 2014 Grigore Stefan, <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// The MIT License (MIT) <http://opensource.org/licenses/MIT>
//
function Solution() {
.name_="";
.project_= {};
.option_= {};
.dependencyOption_= {}; | .projectBasePath_=null;
.projectBasePathStack_=[];
.projectBasePathStackIndex_=0;
.projectBasePathStack_[.projectBasePathStackIndex_]=null;
.solutionPath_=Shell.getcwd();
.name=function(name) {
.name_=name;
};
.project=function(name,type,proc) {
var typeX;
typeX=Platform.projectTypeX(type);
.project_[... | random_line_split | |
solution.js | //
// XYO Build
//
// Copyright (c) 2014 Grigore Stefan, <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// The MIT License (MIT) <http://opensource.org/licenses/MIT>
//
function Solution() {
.name_="";
.project_= {};
.option_= {};
.dependencyOption_= {};
.projectBasePath_=null;
.projec... | ;
.option_[category][name]=value;
};
.dependencyOption=function(category,name,value) {
if(Script.isNil(.dependencyOption_[category])) {
.dependencyOption_[category]= {};
};
.dependencyOption_[category][name]=value;
};
.pushProjectPath_=function(path) {
.projectBasePathStackIndex_++;
if(Script.isNil... | {
.option_[category]= {};
} | conditional_block |
solution.js | //
// XYO Build
//
// Copyright (c) 2014 Grigore Stefan, <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// The MIT License (MIT) <http://opensource.org/licenses/MIT>
//
function Solution() | .project_[name+"."+typeX].type(type);
.project_[name+"."+typeX].basePath_=.projectBasePath_;
var restorePath_=null;
if(.projectBasePath_) {
restorePath_=Shell.getcwd();
Shell.chdir(.projectBasePath_);
};
proc.apply(.project_[name+"."+typeX]);
if(restorePath_) {
Shell.chdir(restorePath_);
};
... | {
.name_="";
.project_= {};
.option_= {};
.dependencyOption_= {};
.projectBasePath_=null;
.projectBasePathStack_=[];
.projectBasePathStackIndex_=0;
.projectBasePathStack_[.projectBasePathStackIndex_]=null;
.solutionPath_=Shell.getcwd();
.name=function(name) {
.name_=name;
};
.project=function(name,type,... | identifier_body |
solution.js | //
// XYO Build
//
// Copyright (c) 2014 Grigore Stefan, <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// The MIT License (MIT) <http://opensource.org/licenses/MIT>
//
function | () {
.name_="";
.project_= {};
.option_= {};
.dependencyOption_= {};
.projectBasePath_=null;
.projectBasePathStack_=[];
.projectBasePathStackIndex_=0;
.projectBasePathStack_[.projectBasePathStackIndex_]=null;
.solutionPath_=Shell.getcwd();
.name=function(name) {
.name_=name;
};
.project=function(name,ty... | Solution | identifier_name |
label.test.ts | import {
async,
beforeEach,
addProviders,
describe,
expect,
it,
inject,
} from '@angular/core/testing';
import { ComponentFixture, TestComponentBuilder }
from '@angular/compiler/testing';
import { Component } from '@angular/core';
import { By } from '@angular/platform-browser';
import { RioLabel } from '.... | { }
| RioLabelTestController | identifier_name |
label.test.ts | import {
async,
beforeEach,
addProviders,
describe,
expect,
it,
inject,
} from '@angular/core/testing';
import { ComponentFixture, TestComponentBuilder }
from '@angular/compiler/testing';
import { Component } from '@angular/core';
import { By } from '@angular/platform-browser';
import { RioLabel } from '.... | (component: RioLabel) => {
expect(component).toBeTruthy();
}));
it('should create the component', async(inject([], () => {
return builder.createAsync(RioLabelTestController)
.then((fixture: ComponentFixture<any>) => {
fixture.autoDetectChanges();
let query = fixture.debugEleme... | builder = tcb;
}));
it('should inject the component', inject([RioLabel], | random_line_split |
index.ts | import { dedent } from 'ts-dedent';
import { basename } from 'path';
/**
* This loader tries to load an `app.scss` or and `app.css` relative to the main entry
*/
export default function loader(content: string, map: any) | callback(null, code, map);
});
}
| {
const { platform } = this.getOptions();
const callback = this.async();
const resolve = this.getResolve({
extensions: [`.${platform}.scss`, `.${platform}.css`, '.scss', '.css'],
});
resolve(this.context, './app', (err, res) => {
if (err || !res) {
// if we ran into an error or there's no css file found, w... | identifier_body |
index.ts | import { dedent } from 'ts-dedent';
import { basename } from 'path';
/**
* This loader tries to load an `app.scss` or and `app.css` relative to the main entry
*/
export default function loader(content: string, map: any) {
const { platform } = this.getOptions();
const callback = this.async();
const resolve = this.g... |
const code = dedent`
// Added by app-css-loader
import "./${basename(res)}";
${content}
`;
callback(null, code, map);
});
}
| {
// if we ran into an error or there's no css file found, we just return
// original content and not append any additional imports.
return callback(null, content, map);
} | conditional_block |
index.ts | import { dedent } from 'ts-dedent';
import { basename } from 'path';
/**
* This loader tries to load an `app.scss` or and `app.css` relative to the main entry
*/
export default function loader(content: string, map: any) {
const { platform } = this.getOptions();
const callback = this.async();
const resolve = this.g... | });
} | `;
callback(null, code, map); | random_line_split |
index.ts | import { dedent } from 'ts-dedent';
import { basename } from 'path';
/**
* This loader tries to load an `app.scss` or and `app.css` relative to the main entry
*/
export default function | (content: string, map: any) {
const { platform } = this.getOptions();
const callback = this.async();
const resolve = this.getResolve({
extensions: [`.${platform}.scss`, `.${platform}.css`, '.scss', '.css'],
});
resolve(this.context, './app', (err, res) => {
if (err || !res) {
// if we ran into an error or ... | loader | identifier_name |
test_syntax.py | import unittest
from jsonschema import SchemaError
from minibus import MiniBusClient
class SyntaxTest(unittest.TestCase):
def setUp(self):
self.client = MiniBusClient()
def callback(self):
pass
def callback2(self):
pass
def test_sub_good(self):
self.client.subscribe("... |
def test_sub_schema_dupcallback(self):
self.client.subscribe("test_sub_schema_dupcallback", {"type": "number"}, self.callback)
self.assertRaises(Exception, self.client.subscribe,
"test_sub_schema_dupcallback", {"type": "number"}, self.callback)
if __name__ == "__main__":
unitt... | self.client.subscribe("test_sub_schema_mismatch", {"type": "number"}, self.callback)
self.assertRaises(Exception, self.client.subscribe,
"test_sub_schema_mismatch", {"type": "string"}, self.callback2) | identifier_body |
test_syntax.py | import unittest
from jsonschema import SchemaError
from minibus import MiniBusClient
class SyntaxTest(unittest.TestCase):
def setUp(self):
self.client = MiniBusClient()
def callback(self):
pass
def callback2(self):
pass
def test_sub_good(self):
self.client.subscribe("... |
def test_sub_schema_dupcallback(self):
self.client.subscribe("test_sub_schema_dupcallback", {"type": "number"}, self.callback)
self.assertRaises(Exception, self.client.subscribe,
"test_sub_schema_dupcallback", {"type": "number"}, self.callback)
if __name__ == "__main__":
unitte... | self.client.subscribe("test_sub_schema_mismatch", {"type": "number"}, self.callback)
self.assertRaises(Exception, self.client.subscribe,
"test_sub_schema_mismatch", {"type": "string"}, self.callback2) | random_line_split |
test_syntax.py | import unittest
from jsonschema import SchemaError
from minibus import MiniBusClient
class SyntaxTest(unittest.TestCase):
def setUp(self):
self.client = MiniBusClient()
def callback(self):
pass
def callback2(self):
pass
def test_sub_good(self):
self.client.subscribe("... | unittest.main() | conditional_block | |
test_syntax.py | import unittest
from jsonschema import SchemaError
from minibus import MiniBusClient
class | (unittest.TestCase):
def setUp(self):
self.client = MiniBusClient()
def callback(self):
pass
def callback2(self):
pass
def test_sub_good(self):
self.client.subscribe("test_sub_good", {'type': "number"}, self.callback)
def test_sub_bad_schema(self):
self.as... | SyntaxTest | identifier_name |
background.js | // Copyright (c) 2013 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.
/**
* Extension ID of Files.app.
* @type {string}
* @const
*/
var FILE_MANAGER_EXTENSIONS_ID = 'hhaomjibdihmijegdhdafkllkbggdgoj';
/**
* Calls a... |
chrome.test.runTests([
// Waits for the C++ code to send a string identifying a test, then runs that
// test.
function testRunner() {
var command = chrome.extension.inIncognitoContext ? 'which test guest' :
'which test non-guest';
chrome.test.sendMessage(command, function(testCaseName) {
/... | {
chrome.runtime.sendMessage(
FILE_MANAGER_EXTENSIONS_ID, {
func: func,
appId: appId,
args: args
},
callback);
} | identifier_body |
background.js | // Copyright (c) 2013 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.
/**
* Extension ID of Files.app.
* @type {string}
* @const
*/
var FILE_MANAGER_EXTENSIONS_ID = 'hhaomjibdihmijegdhdafkllkbggdgoj';
/**
* Calls a... | ]); | random_line_split | |
background.js | // Copyright (c) 2013 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.
/**
* Extension ID of Files.app.
* @type {string}
* @const
*/
var FILE_MANAGER_EXTENSIONS_ID = 'hhaomjibdihmijegdhdafkllkbggdgoj';
/**
* Calls a... | (func, appId, args, callback) {
chrome.runtime.sendMessage(
FILE_MANAGER_EXTENSIONS_ID, {
func: func,
appId: appId,
args: args
},
callback);
}
chrome.test.runTests([
// Waits for the C++ code to send a string identifying a test, then runs that
// test.
function testRun... | callRemoteTestUtil | identifier_name |
conf.py | # autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# General information about the project.
project = 'shablona'
copyright = '2015, Ariel Rokem'
currentdir = os.path.abspath(os.path.dirname(__file__))
ver_file = os.path.j... | #html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same a... |
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation. | random_line_split |
PaginatedList.py | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
def __getitem__(self, index):
assert isinstance(index, (int, slice))
if isinstance(index, (int, long)):
self.__fetchToIndex(index)
return self.__elements[index]
else:
return self._Slice(self, index)
def __iter__(self):
for element in self.__... | self.__elements = list() | identifier_body |
PaginatedList.py | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
while self._couldGrow():
newElements = self._grow()
for element in newElements:
yield element
def _isBiggerThan(self, index):
return len(self.__elements) > index or self._couldGrow()
def __fetchToIndex(self, index):
while len(self.__elements) <=... | yield element | conditional_block |
PaginatedList.py | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | (self, index):
while len(self.__elements) <= index and self._couldGrow():
self._grow()
def _grow(self):
newElements = self._fetchNextPage()
self.__elements += newElements
return newElements
class _Slice:
def __init__(self, theList, theSlice):
sel... | __fetchToIndex | identifier_name |
PaginatedList.py | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
You can simply enumerate through instances of this class::
for repo in user.get_repos():
print repo.name
You can also index them or take slices::
second_repo = user.get_repos()[1]
first_repos = user.get_repos()[:10]
If you want to iterate in reversed order, just do::... |
class PaginatedList(PaginatedListBase):
"""
This class abstracts the `pagination of the API <http://developer.github.com/v3/#pagination>`_. | random_line_split |
__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################... | # but WITHOUT ANY WARRANTY; without even the implied warranty of | random_line_split |
protocol.rs | //============================================================================
//
// A simple Mandelbrot image generator in Rust
//
// Protocol for communicating with Engine task
//
// Copyright (c) 2014 Gavin Baker <gavinb@antonym.org>
// Published under the MIT license
//
//===========================================... | #[derive(Debug)]
pub enum EngineCommand {
UpdateRegion(f32, f32, f32, f32),
ZoomIn,
ZoomOut,
PanLeft,
PanRight,
PanUp,
PanDown,
Render(RenderType),
Shutdown,
}
//---------------------------------------------------------------------------- | random_line_split | |
protocol.rs | //============================================================================
//
// A simple Mandelbrot image generator in Rust
//
// Protocol for communicating with Engine task
//
// Copyright (c) 2014 Gavin Baker <gavinb@antonym.org>
// Published under the MIT license
//
//===========================================... | {
Startup,
Processing(u32),
RenderComplete(RenderType, Vec<u8>),
Error(u32)
}
//----------------------------------------------------------------------------
#[derive(Debug)]
pub enum EngineCommand {
UpdateRegion(f32, f32, f32, f32),
ZoomIn,
ZoomOut,
PanLeft,
PanRight,
PanUp,
... | EngineStatus | identifier_name |
FreeCADDriver.py | from ..abstractdriver import AbstractDriver
import numpy as np
import os
class FreeCADDriver(AbstractDriver):
def __init__(self, debug=False):
super(FreeCADDriver, self).__init__()
self._debug = debug
self._program_name = "FreeCAD"
def get_program_name(self):
return self._pro... |
outfile.write(outstring)
return 0
| if step % freq == 0:
_stepdata = datasource.get("Step#{}".format(step))
_ids = _stepdata.get("id").value
# npart = len(_ids)
indices = np.nonzero(np.isin(_ids, _chosen))[0]
if self._debug:
prin... | conditional_block |
FreeCADDriver.py | from ..abstractdriver import AbstractDriver
import numpy as np
import os
class FreeCADDriver(AbstractDriver):
def __init__(self, debug=False):
super(FreeCADDriver, self).__init__()
self._debug = debug
self._program_name = "FreeCAD"
def get_program_name(self):
return self._pro... |
_chosen = np.random.choice(maxnumpart, ntrj)
with open(os.path.splitext(filename)[0] + ".dat", "w") as outfile:
outfile.write("step, ID, x (m), y (m), z (m)\n")
for step in range(nsteps):
if step % freq == 0:
_stepdata = datasource.get("S... | nsteps = dataset.get_nsteps()
maxnumpart = len(datasource.get("Step#0").get("x").value) | random_line_split |
FreeCADDriver.py | from ..abstractdriver import AbstractDriver
import numpy as np
import os
class FreeCADDriver(AbstractDriver):
def __init__(self, debug=False):
super(FreeCADDriver, self).__init__()
self._debug = debug
self._program_name = "FreeCAD"
def get_program_name(self):
return self._pro... | (self, dataset, filename):
# TODO: Make number of trajectories and time frequency user input -DW
ntrj = 1000 # only use 1000 random trajectories
freq = 5 # only use every 5th step
if self._debug:
print("Exporting data for program: {}".format(self._program_name))
... | export_data | identifier_name |
FreeCADDriver.py | from ..abstractdriver import AbstractDriver
import numpy as np
import os
class FreeCADDriver(AbstractDriver):
def __init__(self, debug=False):
|
def get_program_name(self):
return self._program_name
def import_data(self, filename, species=None):
if self._debug:
print("Importing data from program: {}".format(self._program_name))
print("FreeCAD driver is export-only!")
return None
def export_data(self... | super(FreeCADDriver, self).__init__()
self._debug = debug
self._program_name = "FreeCAD" | identifier_body |
index.js | import { css, StyleSheet } from 'aphrodite/no-important';
import React, { PropTypes } from 'react';
import octicons from './octicons';
import colors from './colors';
import sizes from './sizes';
import styles from './styles';
const classes = StyleSheet.create(styles);
// FIXME static octicon classes leaning on Eleme... | ;
Glyph.propTypes = {
aphroditeStyles: PropTypes.shape({
_definition: PropTypes.object,
_name: PropTypes.string,
}),
color: PropTypes.oneOfType([
PropTypes.oneOf(Object.keys(colors)),
PropTypes.string, // support random color strings
]),
name: PropTypes.oneOf(Object.keys(octicons)).isRequired,
size: Prop... | {
const colorIsValidType = Object.keys(colors).includes(color);
props.className = css(
classes.glyph,
colorIsValidType && classes['color__' + color],
classes['size__' + size],
aphroditeStyles
) + ` ${octicons[name]}`;
if (className) {
props.className += (' ' + className);
}
// support random color stri... | identifier_body |
index.js | import { css, StyleSheet } from 'aphrodite/no-important';
import React, { PropTypes } from 'react';
import octicons from './octicons';
import colors from './colors';
import sizes from './sizes';
import styles from './styles';
const classes = StyleSheet.create(styles);
// FIXME static octicon classes leaning on Eleme... | props.className += (' ' + className);
}
// support random color strings
props.style = {
color: !colorIsValidType ? color : null,
...style,
};
return <Component {...props} />;
};
Glyph.propTypes = {
aphroditeStyles: PropTypes.shape({
_definition: PropTypes.object,
_name: PropTypes.string,
}),
color:... | colorIsValidType && classes['color__' + color],
classes['size__' + size],
aphroditeStyles
) + ` ${octicons[name]}`;
if (className) { | random_line_split |
index.js | import { css, StyleSheet } from 'aphrodite/no-important';
import React, { PropTypes } from 'react';
import octicons from './octicons';
import colors from './colors';
import sizes from './sizes';
import styles from './styles';
const classes = StyleSheet.create(styles);
// FIXME static octicon classes leaning on Eleme... | ({
aphroditeStyles,
className,
color,
component: Component,
name,
size,
style,
...props
}) {
const colorIsValidType = Object.keys(colors).includes(color);
props.className = css(
classes.glyph,
colorIsValidType && classes['color__' + color],
classes['size__' + size],
aphroditeStyles
) + ` ${octicons[... | Glyph | identifier_name |
index.js | import { css, StyleSheet } from 'aphrodite/no-important';
import React, { PropTypes } from 'react';
import octicons from './octicons';
import colors from './colors';
import sizes from './sizes';
import styles from './styles';
const classes = StyleSheet.create(styles);
// FIXME static octicon classes leaning on Eleme... |
// support random color strings
props.style = {
color: !colorIsValidType ? color : null,
...style,
};
return <Component {...props} />;
};
Glyph.propTypes = {
aphroditeStyles: PropTypes.shape({
_definition: PropTypes.object,
_name: PropTypes.string,
}),
color: PropTypes.oneOfType([
PropTypes.oneOf(O... | {
props.className += (' ' + className);
} | conditional_block |
descrobject.rs | use libc::{c_char, c_int, c_void};
use crate::methodobject::PyMethodDef;
use crate::object::{PyObject, PyTypeObject, Py_TYPE};
use crate::structmember::PyMemberDef;
pub type getter = unsafe extern "C" fn(slf: *mut PyObject, closure: *mut c_void) -> *mut PyObject;
pub type setter =
unsafe extern "C" fn(slf: *mut ... | {
pub name: *mut c_char,
pub offset: c_int,
pub function: *mut c_void,
pub wrapper: Option<wrapperfunc>,
pub doc: *mut c_char,
pub flags: c_int,
pub name_strobj: *mut PyObject,
}
impl Clone for wrapperbase {
#[inline]
fn clone(&self) -> wrapperbase {
*self
}
}
pub cons... | wrapperbase | identifier_name |
descrobject.rs | use libc::{c_char, c_int, c_void};
use crate::methodobject::PyMethodDef;
use crate::object::{PyObject, PyTypeObject, Py_TYPE};
use crate::structmember::PyMemberDef;
pub type getter = unsafe extern "C" fn(slf: *mut PyObject, closure: *mut c_void) -> *mut PyObject;
pub type setter =
unsafe extern "C" fn(slf: *mut ... |
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
ignore! {
// PyDictProxy_New is also defined in dictobject.h
pub fn PyDictProxy_New(arg1: *mut PyObject) -> *mut PyObject;
}
pub fn PyWrapper_New(arg1: *mut PyObject, arg2: *mut PyObject) -> *mut PyObject;
}
| {
(*Py_TYPE(d)).tp_descr_set.is_some() as c_int
} | identifier_body |
descrobject.rs | use libc::{c_char, c_int, c_void};
use crate::methodobject::PyMethodDef;
use crate::object::{PyObject, PyTypeObject, Py_TYPE};
use crate::structmember::PyMemberDef;
pub type getter = unsafe extern "C" fn(slf: *mut PyObject, closure: *mut c_void) -> *mut PyObject;
pub type setter =
unsafe extern "C" fn(slf: *mut ... | slf: *mut PyObject,
args: *mut PyObject,
wrapped: *mut c_void,
kwds: *mut PyObject,
) -> *mut PyObject;
#[repr(C)]
#[derive(Copy)]
pub struct wrapperbase {
pub name: *mut c_char,
pub offset: c_int,
pub function: *mut c_void,
pub wrapper: Option<wrapperfunc>,
pub doc: *mut c_char,
... | args: *mut PyObject,
wrapped: *mut c_void,
) -> *mut PyObject;
pub type wrapperfunc_kwds = unsafe extern "C" fn( | random_line_split |
stylesheet_set.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A centralized set of stylesheets for a document.
use dom::TElement;
use invalidation::stylesheets::Stylesheet... | (&self) -> StylesheetIterator<S> {
StylesheetIterator(self.entries.iter())
}
/// Mark the stylesheets as dirty, because something external may have
/// invalidated it.
///
/// FIXME(emilio): Make this more granular.
pub fn force_dirty(&mut self) {
for (data, _) in self.invalidat... | iter | identifier_name |
stylesheet_set.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A centralized set of stylesheets for a document.
use dom::TElement;
use invalidation::stylesheets::Stylesheet... |
}
/// The set of stylesheets effective for a given document.
pub struct StylesheetSet<S>
where
S: StylesheetInDocument + PartialEq + 'static,
{
/// The actual list of all the stylesheets that apply to the given document,
/// each stylesheet associated with a unique ID.
///
/// This is only a list ... | {
self.0.next().map(|entry| &entry.sheet)
} | identifier_body |
stylesheet_set.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A centralized set of stylesheets for a document.
use dom::TElement;
use invalidation::stylesheets::Stylesheet... | impl<S> StylesheetSet<S>
where
S: StylesheetInDocument + PartialEq + 'static,
{
/// Create a new empty StylesheetSet.
pub fn new() -> Self {
StylesheetSet {
entries: vec![],
invalidation_data: Default::default(),
author_style_disabled: false,
}
}
... | }
| random_line_split |
stylesheet_set.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A centralized set of stylesheets for a document.
use dom::TElement;
use invalidation::stylesheets::Stylesheet... |
}
self.iter()
}
/// Returns an iterator over the current list of stylesheets.
pub fn iter(&self) -> StylesheetIterator<S> {
StylesheetIterator(self.entries.iter())
}
/// Mark the stylesheets as dirty, because something external may have
/// invalidated it.
///
... | {
data.invalidations.flush(document_element);
data.dirty = false;
} | conditional_block |
index.d.ts | // Type definitions for moment-timezone.js 0.5
// Project: http://momentjs.com/timezone/
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Alan Brazil Lins <https://github.com/alanblins>
// Agustin Carrasco <https://github.com/asermax>
// Borys Kupar <ht... |
setDefault(timezone?: string): Moment;
}
interface Moment {
tz(): string | undefined;
tz(timezone: string, keepLocalTime?: boolean): moment.Moment;
zoneAbbr(): string;
zoneName(): string;
}
const tz: MomentTimezone;
}
// require("moment-timezone") === require(... | guess(ignoreCache?: boolean): string; | random_line_split |
push.rs | /*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | (&self, o: usize) -> Self {
PushAlignment::new(max(self.0, o))
}
}
/// Macro to implement Push for EndianScalar types.
macro_rules! impl_push_for_endian_scalar {
($ty:ident) => {
impl Push for $ty {
type Output = $ty;
#[inline]
fn push(&self, dst: &mut [u8],... | max_of | identifier_name |
push.rs | /*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
}
/// Ensure Push alignment calculations are typesafe (because this helps reduce
/// implementation issues when using FlatBufferBuilder::align).
pub struct PushAlignment(usize);
impl PushAlignment {
#[inline]
pub fn new(x: usize) -> Self {
PushAlignment { 0: x }
}
#[inline]
pub fn value(&s... | {
PushAlignment::new(align_of::<Self::Output>())
} | identifier_body |
push.rs | /*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | impl_push_for_endian_scalar!(i16);
impl_push_for_endian_scalar!(u32);
impl_push_for_endian_scalar!(i32);
impl_push_for_endian_scalar!(u64);
impl_push_for_endian_scalar!(i64);
impl_push_for_endian_scalar!(f32);
impl_push_for_endian_scalar!(f64); | impl_push_for_endian_scalar!(u16); | random_line_split |
tiny_servod.py | # Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-indent
# pylint: disable... |
def reinitialize(self):
"""Reinitialize the connect after a reset/disconnect/etc."""
self.close()
self._init()
def close(self):
"""Close out the connection and release resources.
Note: if another TinyServod process or servod itself needs the same device
it's necessary to call this ... | self.suart = stm32uart.Suart(vendor=self._vid,
product=self._pid,
interface=self._interface,
serialname=self._serial,
debuglog=self._debug)
self.suart.run()
self.pty = pty_driver.p... | identifier_body |
tiny_servod.py | # Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-indent
# pylint: disable... | it's necessary to call this to ensure the usb device is available.
"""
self.suart.close() | Note: if another TinyServod process or servod itself needs the same device | random_line_split |
tiny_servod.py | # Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-indent
# pylint: disable... | (self):
self.suart = stm32uart.Suart(vendor=self._vid,
product=self._pid,
interface=self._interface,
serialname=self._serial,
debuglog=self._debug)
self.suart.run()
self.pty = ... | _init | identifier_name |
redis.js | /******************************************************************************
Redis dispatch client
*******************************************************************************/
'use strict';
var _ = require('underscore'),
Base = require('./base'),
logger = require('../../logger'),
redis = require(... | sub.on('message', function(channel, message) {
if (channel !== 'fruum') return;
try {
message = JSON.parse(message);
_.each(that.getCallbacks(), function(cb) {
cb(message);
});
}
catch(err) {}
});
sub.subscribe('fruum');
//override emit function
this.emit = function(... | random_line_split | |
redis.js | /******************************************************************************
Redis dispatch client
*******************************************************************************/
'use strict';
var _ = require('underscore'),
Base = require('./base'),
logger = require('../../logger'),
redis = require(... |
});
sub.on('message', function(channel, message) {
if (channel !== 'fruum') return;
try {
message = JSON.parse(message);
_.each(that.getCallbacks(), function(cb) {
cb(message);
});
}
catch(err) {}
});
sub.subscribe('fruum');
//override emit function
this.emit = fu... | {
ready = true;
logger.system('Redis dispatch connected');
} | conditional_block |
Tabs.Skeleton.js | import React from 'react';
export default class TabsSkeleton extends React.Component {
render() {
const tab = (
<li className="wfp--tabs__nav-item">
<div className="wfp--tabs__nav-link"> </div>
</li>
);
return (
<nav className="wfp--tabs wfp--skeleton">
<div classNa... | </li>
{tab}
{tab}
{tab}
</ul>
</nav>
);
}
} | <ul className="wfp--tabs__nav wfp--tabs__nav--hidden">
<li className="wfp--tabs__nav-item wfp--tabs__nav-item--selected">
<div className="wfp--tabs__nav-link"> </div> | random_line_split |
Tabs.Skeleton.js | import React from 'react';
export default class TabsSkeleton extends React.Component {
render() | {tab}
</ul>
</nav>
);
}
}
| {
const tab = (
<li className="wfp--tabs__nav-item">
<div className="wfp--tabs__nav-link"> </div>
</li>
);
return (
<nav className="wfp--tabs wfp--skeleton">
<div className="wfp--tabs-trigger">
<div className="wfp--tabs-trigger-text"> </div>
<s... | identifier_body |
Tabs.Skeleton.js | import React from 'react';
export default class | extends React.Component {
render() {
const tab = (
<li className="wfp--tabs__nav-item">
<div className="wfp--tabs__nav-link"> </div>
</li>
);
return (
<nav className="wfp--tabs wfp--skeleton">
<div className="wfp--tabs-trigger">
<div className="wfp--tabs-t... | TabsSkeleton | identifier_name |
builder.py | # -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension
from webassets.loaders import YAMLLoader
class TemplateBuilder(object):
def | (self, path, output,
static_path='static', static_url='static',
asset_config='config.yml'):
self.path = path
self.output = output
self.output_path = os.path.join(path, output)
self.env = Environment(loader=FileSystemLoader(path),
... | __init__ | identifier_name |
builder.py | # -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension | class TemplateBuilder(object):
def __init__(self, path, output,
static_path='static', static_url='static',
asset_config='config.yml'):
self.path = path
self.output = output
self.output_path = os.path.join(path, output)
self.env = Environment(loader=... | from webassets.loaders import YAMLLoader
| random_line_split |
builder.py | # -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension
from webassets.loaders import YAMLLoader
class TemplateBuilder(object):
def __init__(self, path, output,
... |
for other in others:
dirname = os.path.join(self.output_path, os.path.dirname(other))
if not os.path.exists(dirname):
os.makedirs(dirname)
shutil.copyfile(os.path.join(self.path, other), os.path.join(self.output_path, other))
| self.tmpl_builder.build_template(template) | conditional_block |
builder.py | # -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension
from webassets.loaders import YAMLLoader
class TemplateBuilder(object):
def __init__(self, path, output,
... | self.env.assets_environment = self.assets_env
def build_template(self, template, context={}):
tmpl = self.env.get_template(template)
dump_path = os.path.join(self.output_path, template)
tmpl.stream().dump(dump_path)
def list_files(self):
templates, other = set(), set()... | self.path = path
self.output = output
self.output_path = os.path.join(path, output)
self.env = Environment(loader=FileSystemLoader(path),
extensions=[AssetsExtension])
try:
config_path = os.path.join(self.path, asset_config)
asset_c... | identifier_body |
auth.interceptor.service.ts | // http interceptor functions https://code.angularjs.org/1.2.23/docs/api/ng/service/$http
// http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/
module common {
'use strict';
var moduleId = 'common';
var serviceId = 'authInterceptor';
angular
... | httpProvider: ng.IHttpProvider) {
$httpProvider.interceptors.push(serviceId);
}
} | nfigAuthInterceptor($ | identifier_name |
auth.interceptor.service.ts | // http interceptor functions https://code.angularjs.org/1.2.23/docs/api/ng/service/$http
// http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/
module common {
'use strict';
var moduleId = 'common';
var serviceId = 'authInterceptor';
angular
... | lse {
log.error('An error has occurred. Please try to save your work and then refresh your browser.', rejection, true);
}
}
// always reject like this so that the default error handling happens too.
return $q.reject(rejection);
}
... | log.error('We couldn\'t find that. Sorry. It doesn\'t exist or you don\'t have permission to access it.', rejection,
true);
} e | conditional_block |
auth.interceptor.service.ts | // http interceptor functions https://code.angularjs.org/1.2.23/docs/api/ng/service/$http
// http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/
module common {
'use strict';
var moduleId = 'common';
var serviceId = 'authInterceptor';
angular
... | function responseError(rejection: ng.IHttpPromiseCallbackArg<any>) {
if (isApiCall(rejection.config.url)) {
if (rejection.status === 401) {
log.error('Unauthorized request. Please try to save your work and then refresh your browser.', rejection, true);
... | if (isApiCall(config.url)) {
// TODO set bearer token
}
return config;
}
| identifier_body |
auth.interceptor.service.ts | // http interceptor functions https://code.angularjs.org/1.2.23/docs/api/ng/service/$http
// http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/
module common {
'use strict';
var moduleId = 'common';
var serviceId = 'authInterceptor';
angular
... | if (isApiCall(rejection.config.url)) {
if (rejection.status === 401) {
log.error('Unauthorized request. Please try to save your work and then refresh your browser.', rejection, true);
} else if (rejection.status === 404) {
log.error('We... | }
return config;
}
function responseError(rejection: ng.IHttpPromiseCallbackArg<any>) { | random_line_split |
StrayKittyState.ts | import { Direction } from "./Direction";
import { Action } from "./actions/Action";
export class | {
intervalID: number;
x: number;
y: number;
action: Action;
type: number;
animMax: number;
frame: number;
xVector: number;
yVector: number;
animTimer: number;
dir: Direction;
scale: number;
private get animTimerOverdue() {
return this.animTimer > this.animMa... | StrayKittyState | identifier_name |
StrayKittyState.ts | import { Direction } from "./Direction";
import { Action } from "./actions/Action";
export class StrayKittyState {
intervalID: number;
x: number;
y: number;
action: Action;
type: number;
animMax: number;
frame: number;
xVector: number;
yVector: number;
animTimer: number; |
private get animTimerOverdue() {
return this.animTimer > this.animMax;
}
static randomDir() {
return Math.random() > 0.5 ? Direction.Left : Direction.Right;
}
checkAndChangeState() {
let animTimerOverdue = this.animTimerOverdue;
if (animTimerOverdue) {
... | dir: Direction;
scale: number; | random_line_split |
StrayKittyState.ts | import { Direction } from "./Direction";
import { Action } from "./actions/Action";
export class StrayKittyState {
intervalID: number;
x: number;
y: number;
action: Action;
type: number;
animMax: number;
frame: number;
xVector: number;
yVector: number;
animTimer: number;
dir... |
static randomDir() {
return Math.random() > 0.5 ? Direction.Left : Direction.Right;
}
checkAndChangeState() {
let animTimerOverdue = this.animTimerOverdue;
if (animTimerOverdue) {
this.animMax = Math.floor(Math.random() * 3000) + 1000;
this.animTimer = 0;
... | {
return this.animTimer > this.animMax;
} | identifier_body |
StrayKittyState.ts | import { Direction } from "./Direction";
import { Action } from "./actions/Action";
export class StrayKittyState {
intervalID: number;
x: number;
y: number;
action: Action;
type: number;
animMax: number;
frame: number;
xVector: number;
yVector: number;
animTimer: number;
dir... |
return animTimerOverdue;
}
}
| {
this.animMax = Math.floor(Math.random() * 3000) + 1000;
this.animTimer = 0;
this.xVector = 0;
this.dir = StrayKittyState.randomDir();
} | conditional_block |
tree_0a5cf070976fd6198437c00ce2cc4fcb.js | /media/sobipro/tree/joinbottom.gif';
sobiCats_stmImgs[ 'plus' ] = 'http://localhost/SocialGarbage/media/sobipro/tree/plus.gif';
sobiCats_stmImgs[ 'plusBottom' ] = 'http://localhost/SocialGarbage/media/sobipro/tree/plusbottom.gif';
sobiCats_stmImgs[ 'minus' ] = 'http://localhost/SocialGarbage/media/sobipro/tree/minus.gi... | {
window.setTimeout( function() { sobiCats_stmGetSubcats( sobiCats_stmHttpRequest, deep, catid ); } , 200 );
} | conditional_block | |
tree_0a5cf070976fd6198437c00ce2cc4fcb.js | mPid + "&tmpl=component&format=raw";
sobiCats_stmMakeRequest( url, deep, catid );
}
function sobiCats_stmCatData( node, val )
{
return node.getElementsByTagName( val ).item( 0 ).firstChild.data;
}
function sobiCats_stmAddSubcats( XMLDoc, deep, ccatid )
{
var categories = XMLDoc.getElementsByTagName( 'category' )... | }
else if(SP_id( "sobiCats_imgExpand" + sobiCats_stmcid ).src == sobiCats_stmImgs[ 'minusBottom' ] ){
SP_id( "sobiCats_imgExpand" + sobiCats_stmcid ).src = sobiCats_stmImgs[ 'plusBottom' ]; | random_line_split | |
tree_0a5cf070976fd6198437c00ce2cc4fcb.js | Imgs = new Array();
var sobiCats_stmImgMatrix = new Array();
var sobiCats_stmParents = new Array();
var sobiCats_stmSemaphor = 0;
var sobiCats_stmPid = 0;
var sobiCats_stmWait = 'http://localhost/SocialGarbage/media/sobipro/styles/spinner.gif';
sobiCats_stmImgs[ 'root' ] = 'http://localhost/SocialGarbage/media/sobipro... | ( url, deep, catid )
{
var sobiCats_stmHttpRequest;
if ( window.XMLHttpRequest ) {
sobiCats_stmHttpRequest = new XMLHttpRequest();
if ( sobiCats_stmHttpRequest.overrideMimeType ) {
sobiCats_stmHttpRequest.overrideMimeType( 'text/xml' );
}
}
else if ( window.ActiveXObjec... | sobiCats_stmMakeRequest | identifier_name |
tree_0a5cf070976fd6198437c00ce2cc4fcb.js | mImgs = new Array();
var sobiCats_stmImgMatrix = new Array();
var sobiCats_stmParents = new Array();
var sobiCats_stmSemaphor = 0;
var sobiCats_stmPid = 0;
var sobiCats_stmWait = 'http://localhost/SocialGarbage/media/sobipro/styles/spinner.gif';
sobiCats_stmImgs[ 'root' ] = 'http://localhost/SocialGarbage/media/sobipr... | if( sobiCats_stmImgMatrix[ parentid ][ j ] ) {
switch( sobiCats_stmImgMatrix[ parentid ][ j ] )
{
case 'plus':
case 'minus':
case 'line':
image = 'line';
break;
default:
image = 'empty';
break;
}
}
else {
image = 'empty';
}
if( !sobiCats_stmImg... | {
var categories = XMLDoc.getElementsByTagName( 'category' );
var subcats = "";
deep++;
for( i = 0; i < categories.length; i++ ) {
var category = categories[ i ];
var catid = sobiCats_stmCatData( category, 'catid' );
var name = sobiCats_stmCatData( category, 'name' );
var introtext = sobiCats_stmCatDa... | identifier_body |
event.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/async/event.rs
//! Asynchronous event waiter
#[allow(unused_imports)]
use prelude::*;
use core::sync::atomic::{AtomicBool,ATOMIC_BOOL_INIT,Ordering};
use core::fmt;
/// A general-purpose wait event (when flag is set, waiters will be informed)
///
/// On... |
}
| {
if let Some(r) = self.source {
*r.waiter.lock() = None;
}
} | identifier_body |
event.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/async/event.rs
//! Asynchronous event waiter
#[allow(unused_imports)]
use prelude::*;
use core::sync::atomic::{AtomicBool,ATOMIC_BOOL_INIT,Ordering};
use core::fmt;
/// A general-purpose wait event (when flag is set, waiters will be informed)
///
/// On... | (&self)
{
//log_debug!("Trigger");
self.flag.store(true, Ordering::SeqCst); // prevents reodering around this
self.waiter.lock().as_mut().map(|r| r.signal());
}
/// Register to wake the specified sleep object
pub fn wait_upon(&self, waiter: &mut ::threads::SleepObject) -> bool {
{
let mut lh = self.wai... | trigger | identifier_name |
event.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/async/event.rs
//! Asynchronous event waiter
#[allow(unused_imports)]
use prelude::*;
use core::sync::atomic::{AtomicBool,ATOMIC_BOOL_INIT,Ordering};
use core::fmt;
/// A general-purpose wait event (when flag is set, waiters will be informed)
///
/// On... | }
/// Event waiter
pub struct Waiter<'a>
{
/// Event source
source: Option<&'a Source>,
}
//static S_EVENT_NONE: Source = Source { flag: ATOMIC_BOOL_INIT, waiter: mutex_init!(None) };
impl Source
{
/// Create a new event source
pub fn new() -> Source
{
Source {
flag: ATOMIC_BOOL_INIT,
waiter: ::sync::mu... | pub struct ManySource
{
flag: AtomicBool,
waiters: super::queue::Source, | random_line_split |
event.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/async/event.rs
//! Asynchronous event waiter
#[allow(unused_imports)]
use prelude::*;
use core::sync::atomic::{AtomicBool,ATOMIC_BOOL_INIT,Ordering};
use core::fmt;
/// A general-purpose wait event (when flag is set, waiters will be informed)
///
/// On... |
else
{
// Completed, don't impede sleeping
true
}
}
fn unbind_signal(&mut self) {
if let Some(r) = self.source {
*r.waiter.lock() = None;
}
}
}
| {
// Store the sleep object reference
*r.waiter.lock() = Some( sleeper.get_ref() );
// If the waiter's flag is already set, return 'false' to force polling
! r.flag.load(::core::sync::atomic::Ordering::Relaxed)
} | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.