file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
TaskManagerPlugin.py | """ Container for TaskManager plug-ins, to handle the destination of the tasks
"""
import six
from DIRAC import gLogger
from DIRAC.Core.Utilities.List import fromChar
from DIRAC.Core.Utilities.SiteSEMapping import getSitesForSE
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from DIRAC.Configura... | """A TaskManagerPlugin object should be instantiated by every TaskManager object.
self.params here could be
{'Status': 'Created', 'TargetSE': 'Unknown', 'TransformationID': 1086L, 'RunNumber': 0L,
'Site': 'DIRAC.Test.ch', 'TaskID': 21L, 'InputData': '', 'JobType': 'MCSimulation'}
which corresponds to p... | identifier_body | |
TaskManagerPlugin.py | """ Container for TaskManager plug-ins, to handle the destination of the tasks
"""
import six
from DIRAC import gLogger
from DIRAC.Core.Utilities.List import fromChar
from DIRAC.Core.Utilities.SiteSEMapping import getSitesForSE
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from DIRAC.Configura... | % (jobType, self.params["TargetSE"], ",".join(destSites))
)
return destSites | random_line_split | |
decorators.py |
class PermissionRequired(Exception):
"""
Exception to be thrown by views which check permissions internally.
Takes a single C{perm} argument which defines the permission that caused
the exception.
"""
def __init__(self, perm):
self.perm = perm
def require_permissions(user, *permissio... | (self, view_func):
def decorator(request, *args, **kwargs):
if not request.user.has_perm(self.perm):
raise PermissionRequired(self.perm)
return view_func(request, *args, **kwargs)
return checks_permissions(self.error_view)(decorator)
| __call__ | identifier_name |
decorators.py |
class PermissionRequired(Exception):
"""
Exception to be thrown by views which check permissions internally.
Takes a single C{perm} argument which defines the permission that caused
the exception.
"""
def __init__(self, perm):
self.perm = perm
def require_permissions(user, *permissio... |
class checks_permissions(object):
"""
Decorator for views which handle C{PermissionRequired} errors and renders
the given error view if necessary.
The original request and arguments are passed to the error with the
additional C{_perm} and C{_view} keyword arguments.
"""
def __init__(self... | if not user.has_perm(perm):
raise PermissionRequired(perm) | conditional_block |
decorators.py | class PermissionRequired(Exception):
"""
Exception to be thrown by views which check permissions internally.
Takes a single C{perm} argument which defines the permission that caused
the exception.
"""
def __init__(self, perm):
self.perm = perm
def require_permissions(user, *permissions... | class checks_permissions(object):
"""
Decorator for views which handle C{PermissionRequired} errors and renders
the given error view if necessary.
The original request and arguments are passed to the error with the
additional C{_perm} and C{_view} keyword arguments.
"""
def __init__(self, v... | random_line_split | |
decorators.py |
class PermissionRequired(Exception):
"""
Exception to be thrown by views which check permissions internally.
Takes a single C{perm} argument which defines the permission that caused
the exception.
"""
def __init__(self, perm):
|
def require_permissions(user, *permissions):
for perm in permissions:
if not user.has_perm(perm):
raise PermissionRequired(perm)
class checks_permissions(object):
"""
Decorator for views which handle C{PermissionRequired} errors and renders
the given error view if necessary.
... | self.perm = perm | identifier_body |
Users.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _mongoose = require('mongoose');
var _mongoose2 = _interopRequireDefault(_mongoose);
var _validator = require('validator');
var _findOrCreatePlugin = require('./find-or-create-plugin');
var _findOrCreatePlugin2 = _interopRequireDef... | (obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Schema = _mongoose2.default.Schema;
var userSchema = new Schema({
id: {
type: String,
required: true,
match: /\d+/
},
displayName: { type: String, required: true, match: /^([A-Za-z]+((\s[A-Za-z]+)+)?)$/ },
emails: [{ value: {
... | _interopRequireDefault | identifier_name |
Users.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _mongoose = require('mongoose');
var _mongoose2 = _interopRequireDefault(_mongoose);
var _validator = require('validator');
var _findOrCreatePlugin = require('./find-or-create-plugin');
var _findOrCreatePlugin2 = _interopRequireDef... | exports.default = User; | var User = _mongoose2.default.model('User', userSchema);
| random_line_split |
Users.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _mongoose = require('mongoose');
var _mongoose2 = _interopRequireDefault(_mongoose);
var _validator = require('validator');
var _findOrCreatePlugin = require('./find-or-create-plugin');
var _findOrCreatePlugin2 = _interopRequireDef... |
var Schema = _mongoose2.default.Schema;
var userSchema = new Schema({
id: {
type: String,
required: true,
match: /\d+/
},
displayName: { type: String, required: true, match: /^([A-Za-z]+((\s[A-Za-z]+)+)?)$/ },
emails: [{ value: {
type: String,
required: true,
unique: true,
... | { return obj && obj.__esModule ? obj : { default: obj }; } | identifier_body |
050_fk_consistent_indexes.py | # Copyright 2014 Mirantis.inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
user_group_membership = sa.Table('user_group_membership',
meta, autoload=True)
if any(i for i in user_group_membership.indexes if
i.columns.keys() == ['group_id'] and i.name != 'group_id'):
sa.Index('group_id', user_group_membership.c... | # MySQL rules.
sa.Index('service_id', endpoint.c.service_id).create() | random_line_split |
050_fk_consistent_indexes.py | # Copyright 2014 Mirantis.inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | (migrate_engine):
if migrate_engine.name == 'mysql':
meta = sa.MetaData(bind=migrate_engine)
endpoint = sa.Table('endpoint', meta, autoload=True)
# NOTE(i159): MySQL requires indexes on referencing columns, and those
# indexes create automatically. That those indexes will have diff... | upgrade | identifier_name |
050_fk_consistent_indexes.py | # Copyright 2014 Mirantis.inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
def downgrade(migrate_engine):
# NOTE(i159): index exists only in MySQL schemas, and got an inconsistent
# name only when MySQL 5.5 renamed it after re-creation
# (during migrations). So we just fixed inconsistency, there is no
# necessity to revert it.
pass
| if migrate_engine.name == 'mysql':
meta = sa.MetaData(bind=migrate_engine)
endpoint = sa.Table('endpoint', meta, autoload=True)
# NOTE(i159): MySQL requires indexes on referencing columns, and those
# indexes create automatically. That those indexes will have different
# names, ... | identifier_body |
050_fk_consistent_indexes.py | # Copyright 2014 Mirantis.inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
user_group_membership = sa.Table('user_group_membership',
meta, autoload=True)
if any(i for i in user_group_membership.indexes if
i.columns.keys() == ['group_id'] and i.name != 'group_id'):
sa.Index('group_id', user_group_membership.... | sa.Index('service_id', endpoint.c.service_id).create() | conditional_block |
ignore.d.ts | export class | {
/**
* @param {Options} options
*/
constructor(options: Options)
/** @type {string} */
cwd: string
/** @type {ResolveFrom|undefined} */
ignorePathResolveFrom: ResolveFrom | undefined
/** @type {FindUp<IgnoreConfig>} */
findUp: FindUp<IgnoreConfig>
/**
* @param {string} filePath
* @param ... | Ignore | identifier_name |
ignore.d.ts | export class Ignore {
/**
* @param {Options} options
*/
constructor(options: Options)
/** @type {string} */
cwd: string
/** @type {ResolveFrom|undefined} */
ignorePathResolveFrom: ResolveFrom | undefined
/** @type {FindUp<IgnoreConfig>} */
findUp: FindUp<IgnoreConfig>
/**
* @param {string} fi... | cwd: string
detectIgnore: boolean | undefined
ignoreName: string | undefined
ignorePath: string | undefined
ignorePathResolveFrom: ResolveFrom | undefined
}
export type Callback = (
error: Error | null,
result?: boolean | undefined
) => any
import {FindUp} from './find-up.js' | export type IgnoreConfig = import('ignore').Ignore & {
filePath: string
}
export type ResolveFrom = 'cwd' | 'dir'
export type Options = { | random_line_split |
react-dom.d.ts | // Type definitions for React-DOM v0.14.0-rc
// Project: https://www.npmjs.com/package/react-dom
// Definitions by: Stefan-Bieliauskas <http://www.conts.de>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="./../react/react.d.ts" />
declare namespace __ReactDom {
function render<... | } | random_line_split | |
CheckIfUserExists_mod.py | from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
|
# To check whether there exists a user with same email or phone no, before Updating the user..!!!
def VerifyTheUserUpdate(data, person):
cursor = connection.cursor()
email = data['email']
phone = data['phone']
cursor.execute("SELECT * from pahera_person WHERE email = %s OR phone_no = %s", [email, pho... | cursor = connection.cursor()
email = data['email']
phone = data['phone']
cursor.execute("SELECT * from pahera_person WHERE email = %s OR phone_no = %s", [email, phone])
person_Data = {}
person_Data = DictFetchAll.dictfetchall(cursor)
if person_Data:
if person_Data[0]['email'] == email or... | identifier_body |
CheckIfUserExists_mod.py | from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def | (data):
cursor = connection.cursor()
email = data['email']
phone = data['phone']
cursor.execute("SELECT * from pahera_person WHERE email = %s OR phone_no = %s", [email, phone])
person_Data = {}
person_Data = DictFetchAll.dictfetchall(cursor)
if person_Data:
if person_Data[0]['email']... | VerifyTheUser | identifier_name |
CheckIfUserExists_mod.py |
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
cursor = connection.cursor()
email = data['email']
phone = data['phone']
cursor.execute("SELECT * from pahera_person WHERE email = %s OR phone_no = %s", [email, phone])
p... | from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll | random_line_split | |
CheckIfUserExists_mod.py | from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
cursor = connection.cursor()
email = data['email']
phone ... |
else:
return True
else:
return True
| return False | conditional_block |
error.rs | //
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the ... | }
ProcessExitFailure {
description("Process did not exit properly")
display("Process did not exit properly")
}
InstantiateError {
description("Instantation error")
display("Instantation error")
}
}
} | description("No editor set")
display("No editor set") | random_line_split |
p041.rs | //! [Problem 41](https://projecteuler.net/problem=41) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate iter;
extern crate integer;
extern crate prime;
use iter::Permutations;
... |
}
unreachable!()
}
fn solve() -> String {
compute().to_string()
}
problem!("7652413", solve);
| {
return n
} | conditional_block |
p041.rs | //! [Problem 41](https://projecteuler.net/problem=41) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate iter;
extern crate integer;
extern crate prime;
use iter::Permutations;
... | () -> String {
compute().to_string()
}
problem!("7652413", solve);
| solve | identifier_name |
p041.rs | //! [Problem 41](https://projecteuler.net/problem=41) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate iter;
extern crate integer;
extern crate prime;
use iter::Permutations;
... |
fn solve() -> String {
compute().to_string()
}
problem!("7652413", solve);
| {
let radix = 10;
let ps = PrimeSet::new();
for (perm, _) in Permutations::new(&[7, 6, 5, 4, 3, 2, 1], 7) {
let n = Integer::from_digits(perm.iter().rev().map(|&x| x), radix);
if ps.contains(n) {
return n
}
}
unreachable!()
} | identifier_body |
p041.rs | //! [Problem 41](https://projecteuler.net/problem=41) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate iter;
extern crate integer;
extern crate prime;
use iter::Permutations;
... | }
unreachable!()
}
fn solve() -> String {
compute().to_string()
}
problem!("7652413", solve); | random_line_split | |
i18n.test.ts | import * as assert from 'assert'
import { concat, delay, empty, just } from 'most'
import { join } from 'path'
import { makeI18nDriver } from './makeI18nDriver'
// tslint:disable-next-line
const fsBackend = require('i18next-node-fs-backend')
describe('makeI18nDriver', () => { | it('returns a driver function', () => {
assert.strictEqual(typeof makeI18nDriver(), 'function')
})
describe('driver function', () => {
describe('given a stream of languages', () => {
it('returns a source function', () => {
assert.strictEqual(typeof makeI18nDriver()(empty()), 'function')
... | random_line_split | |
dedicatedworkerglobalscope.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding;
use ... |
}
trait PrivateDedicatedWorkerGlobalScopeHelpers {
fn handle_event(self, msg: ScriptMsg);
fn dispatch_error_to_worker(self, JSRef<ErrorEvent>);
}
impl<'a> PrivateDedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerGlobalScope> {
fn handle_event(self, msg: ScriptMsg) {
match msg {
... | {
box SendableWorkerScriptChan {
sender: self.own_sender.clone(),
worker: self.worker.borrow().as_ref().unwrap().clone(),
}
} | identifier_body |
dedicatedworkerglobalscope.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding;
use ... | cx: Rc<Cx>,
resource_task: ResourceTask,
parent_sender: Box<ScriptChan+Send>,
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>)
-> Temporary<DedicatedWorkerGlobalScope> {... | }
}
pub fn new(worker_url: Url, | random_line_split |
dedicatedworkerglobalscope.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding;
use ... |
_ => panic!("Unexpected message"),
}
}
fn dispatch_error_to_worker(self, errorevent: JSRef<ErrorEvent>) {
let msg = errorevent.Message();
let file_name = errorevent.Filename();
let line_num = errorevent.Lineno();
let col_num = errorevent.Colno();
let... | {
let scope: JSRef<WorkerGlobalScope> = WorkerGlobalScopeCast::from_ref(self);
scope.handle_fire_timer(timer_id);
} | conditional_block |
dedicatedworkerglobalscope.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding;
use ... | (self) -> Box<ScriptChan+Send> {
box SendableWorkerScriptChan {
sender: self.own_sender.clone(),
worker: self.worker.borrow().as_ref().unwrap().clone(),
}
}
}
trait PrivateDedicatedWorkerGlobalScopeHelpers {
fn handle_event(self, msg: ScriptMsg);
fn dispatch_error_to... | script_chan | identifier_name |
beer.service.ts | import { Injectable } from 'angular2/core'
import { Http, Response } from 'angular2/http';
import { Beer } from './beer'
import 'rxjs/Rx';
@Injectable()
export class BeerService {
private _breweryDbKey = '2d18b2531035b441a50dddc3aed32a1b';
private _beerUrl = "http://localhost:1337/api.brewerydb.com/v2/beers?availa... |
} | {
return this.http.get(this._searchUrl + term)
.map((response: Response) => {
return response.json().data.map(item => {
return new Beer({
name: item.nameDisplay,
brewery: item.breweries[0].nameShortDisplay,
description: item.description,
abv: i... | identifier_body |
beer.service.ts | import { Injectable } from 'angular2/core'
import { Http, Response } from 'angular2/http';
import { Beer } from './beer'
import 'rxjs/Rx';
@Injectable()
export class BeerService {
private _breweryDbKey = '2d18b2531035b441a50dddc3aed32a1b';
private _beerUrl = "http://localhost:1337/api.brewerydb.com/v2/beers?availa... | brewery: item.breweries[0].nameShortDisplay,
description: item.description,
abv: item.abv,
ibu: item.ibu,
type: item.style.shortName
});
})
})
.catch((err: Response) => console.log(err));
}
} | return new Beer({
name: item.nameDisplay, | random_line_split |
beer.service.ts | import { Injectable } from 'angular2/core'
import { Http, Response } from 'angular2/http';
import { Beer } from './beer'
import 'rxjs/Rx';
@Injectable()
export class BeerService {
private _breweryDbKey = '2d18b2531035b441a50dddc3aed32a1b';
private _beerUrl = "http://localhost:1337/api.brewerydb.com/v2/beers?availa... | (private http: Http) {}
getBeer() {
return this.http.get(this._beerUrl)
.map((response: Response) => {
return response.json().data.map(item => {
return new Beer({
name: item.nameDisplay,
brewery: item.breweries[0].nameShortDisplay,
description: item.desc... | constructor | identifier_name |
gulpfile.js | 'use strict';
const gulp = require('gulp');
const spawn = require('child_process').spawn;
const del = require('del');
const plugins = require('gulp-load-plugins')();
const babelConfig = {
'retainLines': true,
plugins: ['transform-decorators-legacy']
};
gulp.task('clean', function () {
return del(['dist/**']);
... |
server = spawn('node', ['--inspect=0.0.0.0:5858', '--nolazy', 'app.js'], {
stdio: 'inherit',
cwd: 'dist',
env: process.env
});
server.on('close', (code) => {
if (code > 0) {
console.error('Error detected, waiting for changes...'); // eslint-disable-line no-console
}
});
});
process.on... | {
server.kill();
} | conditional_block |
gulpfile.js | 'use strict';
const gulp = require('gulp');
const spawn = require('child_process').spawn;
const del = require('del');
const plugins = require('gulp-load-plugins')();
const babelConfig = {
'retainLines': true,
plugins: ['transform-decorators-legacy']
};
gulp.task('clean', function () {
return del(['dist/**']);
... | });
// END watch stuff
gulp.task('default', ['watch']); | gulp.watch('src/**/*.js', {interval: 1000, mode: 'poll'}, ['serve']); // run tests on file save
gulp.watch('/.ravelrc.json', {interval: 1000, mode: 'poll'}, ['serve']); | random_line_split |
examples-view.js | 'use strict';
window.ExamplesView = Backbone.View.extend({
block: "i-examples",
el: 'body',
'events': {
'click .i-example-test__run': 'runTest'
},
'initialize': function(){
this.listenTo(this.collection, "sync", this.render);
this.listenTo(this.collection, "testsComplete"... | mocha.suite.tests = [];
mocha.suite.title = "";
},
'runTest': function(e){
var elem = e.target,
testSign = elem.getAttribute('data-test'),
blockName = elem.getAttribute('data-name'),
testFunc = tests[testSign],
$container = $(".sign-"+te... | random_line_split | |
examples-view.js | 'use strict';
window.ExamplesView = Backbone.View.extend({
block: "i-examples",
el: 'body',
'events': {
'click .i-example-test__run': 'runTest'
},
'initialize': function(){
this.listenTo(this.collection, "sync", this.render);
this.listenTo(this.collection, "testsComplete"... |
this.renderExamples();
this.$content.on(
'scroll',
function(){
$(document.body).trigger('scroll');
}
);
Prism.highlightAll();
return true;
},
'renderSUITE': function(suite){
this.$(".sign-"+suite.sign).prep... | {
this.listenToOnce(
this.nodes.test,
'action',
this.showTests
);
this.collection.listenToOnce(
this.nodes.test,
'action',
this.collection.runTest
)
} | conditional_block |
sequence.rs | // Copyright 2016 Pierre Talbot (IRCAM)
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to... |
pub fn parser(seq: Vec<usize>) -> SequenceCompiler {
SequenceCompiler {
seq: seq,
compiler: parser_compiler
}
}
}
impl CompileExpr for SequenceCompiler
{
fn compile_expr<'a>(&self, context: &mut Context<'a>,
continuation: Continuation) -> syn::Expr
{
self.seq.clone().into_iter()
... | {
SequenceCompiler {
seq: seq,
compiler: recognizer_compiler
}
} | identifier_body |
sequence.rs | // Copyright 2016 Pierre Talbot (IRCAM)
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to... | } | .rev()
.fold(continuation, |continuation, idx|
continuation.compile_success(context, self.compiler, idx))
.unwrap_success()
} | random_line_split |
sequence.rs | // Copyright 2016 Pierre Talbot (IRCAM)
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to... | (seq: Vec<usize>) -> SequenceCompiler {
SequenceCompiler {
seq: seq,
compiler: recognizer_compiler
}
}
pub fn parser(seq: Vec<usize>) -> SequenceCompiler {
SequenceCompiler {
seq: seq,
compiler: parser_compiler
}
}
}
impl CompileExpr for SequenceCompiler
{
fn compile_ex... | recognizer | identifier_name |
main.ts | /// <reference path="../../../typings/main/ambient/TweenLite/TweenLite.d.ts" />
/// <reference path="../../../typings/main/ambient/TimelineMax/TimelineMax.d.ts" />
/// <reference path="../../../typings/main/ambient/jquery/index.d.ts" />
import * as $ from 'jquery';
import * as TimelineMax from 'TimelineMax';
import 'CS... | const duration = 0.5;
const infiniteRepeatLoop = -1;
//endregion
//region Timeline Setup
const jumpTl = new TimelineMax({ repeat: infiniteRepeatLoop });
jumpTl
.set([$container, $loader], {
position: 'absolute',
top: '50%',
left: '50%',
xPercent: -50,
yPercent: -50
}... |
//region Animation Config | random_line_split |
default.py | # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as p... |
print('default config loaded') | random_line_split | |
particle_parser.py | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles.txt')
if p.exists() and p.is_file():
parse(str(p))
def parse(filepath):
raw = ''
try:
with open(filepath) as f:
... |
pp.pprint(data)
if __name__ == '__main__':
main()
| parts = line.split()
if parts[0] == '*':
category = ' '.join(parts[1:])
if category not in data:
data[category] = {}
else:
log.warn('Category "{}" already defined!'.format(category))
elif parts[0] == '**':
if category:
... | conditional_block |
particle_parser.py | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles.txt')
if p.exists() and p.is_file():
parse(str(p))
def | (filepath):
raw = ''
try:
with open(filepath) as f:
raw = f.read()
except IOError as e:
log.exception(e)
return 1
else:
parse_lines(raw.splitlines())
def parse_lines(lines):
'''
parser for particle list of stylianos
'''
data = {}
category ... | parse | identifier_name |
particle_parser.py | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles.txt')
if p.exists() and p.is_file():
parse(str(p)) | raw = ''
try:
with open(filepath) as f:
raw = f.read()
except IOError as e:
log.exception(e)
return 1
else:
parse_lines(raw.splitlines())
def parse_lines(lines):
'''
parser for particle list of stylianos
'''
data = {}
category = ''
par... |
def parse(filepath): | random_line_split |
particle_parser.py | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles.txt')
if p.exists() and p.is_file():
parse(str(p))
def parse(filepath):
raw = ''
try:
with open(filepath) as f:
... |
if __name__ == '__main__':
main()
| '''
parser for particle list of stylianos
'''
data = {}
category = ''
particle = ''
simple_particle_lemma = []
for line in lines:
parts = line.split()
if parts[0] == '*':
category = ' '.join(parts[1:])
if category not in data:
data[cate... | identifier_body |
lib.rs | /*
* Panopticon - A libre disassembler
* Copyright (C) 2014, 2015 Panopticon authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your opti... |
mod disassembler;
pub use crate::disassembler::{Mos, Variant}; | mod semantic; | random_line_split |
const-cast.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 ... | () {}
static x: extern "C" fn() = foo;
static y: *libc::c_void = x as *libc::c_void;
static a: &'static int = &10;
static b: *int = a as *int;
pub fn main() {
assert_eq!(x as *libc::c_void, y);
assert_eq!(a as *int, b);
}
| foo | identifier_name |
const-cast.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. | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate libc;
extern fn foo() {}
static x: extern "C" fn() = foo;
static y: *libc::c_void = x as *libc::c_void;
static a: &'static int = &10;
stati... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | random_line_split |
const-cast.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 ... |
static x: extern "C" fn() = foo;
static y: *libc::c_void = x as *libc::c_void;
static a: &'static int = &10;
static b: *int = a as *int;
pub fn main() {
assert_eq!(x as *libc::c_void, y);
assert_eq!(a as *int, b);
}
| {} | identifier_body |
FontChar.ts | /*
* Copyright (C) 2016 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
import { BaseImage } from "../image/BaseImage";
import { COLOR_PALETTE } from "../image/colors";
/**
* Container for a single font character image.
*/
export class FontChar extends BaseImage {
/**
* The imag... |
/**
* Parses a single font character from the given array and returns it.
*
* @param buffer The array with the content of the colorf.fnt file.
* @param offset The offset in the array pointing to the font character.
* @return The parsed font character.
*/
public static fromArray... | {
if (x < 0 || y < 0 || x > 7 && y > 7) {
throw new Error(`Coordinates outside of image boundary: ${x}, ${y}`);
}
const bit = 7 - (x & 7);
const data = this.data;
const pixel = (((data[y] >> bit) & 1) << 0) // Blue
| (((data[y + 8] >> bit) & 1) << 1) /... | identifier_body |
FontChar.ts | /*
* Copyright (C) 2016 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
import { BaseImage } from "../image/BaseImage";
import { COLOR_PALETTE } from "../image/colors";
/**
* Container for a single font character image.
*/
export class FontChar extends BaseImage {
/**
* The imag... |
const bit = 7 - (x & 7);
const data = this.data;
const pixel = (((data[y] >> bit) & 1) << 0) // Blue
| (((data[y + 8] >> bit) & 1) << 1) // Green
| (((data[y + 16] >> bit) & 1) << 2) // Red
| (((data[y + 24] >> bit) & 1) << 3); // Intensity
r... | {
throw new Error(`Coordinates outside of image boundary: ${x}, ${y}`);
} | conditional_block |
FontChar.ts | /*
* Copyright (C) 2016 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
import { BaseImage } from "../image/BaseImage";
import { COLOR_PALETTE } from "../image/colors";
/**
* Container for a single font character image.
*/
export class FontChar extends BaseImage {
/**
* The imag... | }
const bit = 7 - (x & 7);
const data = this.data;
const pixel = (((data[y] >> bit) & 1) << 0) // Blue
| (((data[y + 8] >> bit) & 1) << 1) // Green
| (((data[y + 16] >> bit) & 1) << 2) // Red
| (((data[y + 24] >> bit) & 1) << 3); // Intensity
... | public getColor(x: number, y: number): number {
if (x < 0 || y < 0 || x > 7 && y > 7) {
throw new Error(`Coordinates outside of image boundary: ${x}, ${y}`); | random_line_split |
FontChar.ts | /*
* Copyright (C) 2016 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
import { BaseImage } from "../image/BaseImage";
import { COLOR_PALETTE } from "../image/colors";
/**
* Container for a single font character image.
*/
export class | extends BaseImage {
/**
* The image data. 32 bytes. Each byte contains one color component for 8 pixels. So first pixel contains the red
* component bits of the first image row, second pixel contains the green component bits, third bit contains the
* blue component bits, forth bit contains the inten... | FontChar | identifier_name |
moment.module.ts |
module rl.utilities.services.momentWrapper {
export var moduleName: string = 'rl.utilities.services.momentWrapper';
export var serviceName: string = 'momentWrapper';
export function momentWrapper(): void |
angular.module(moduleName, [])
.factory(serviceName, momentWrapper);
}
| {
'use strict';
// Using `any` instead of MomentStatic because
// createFromInputFallback doesn't appear to be
// defined in MomentStatic... :-(
var momentWrapper: any = moment; // moment must already be loaded
// Set default method for handling non-ISO date conversions.
// See 4/28 comment in https:/... | identifier_body |
moment.module.ts |
module rl.utilities.services.momentWrapper {
export var moduleName: string = 'rl.utilities.services.momentWrapper';
export var serviceName: string = 'momentWrapper';
export function | (): void {
'use strict';
// Using `any` instead of MomentStatic because
// createFromInputFallback doesn't appear to be
// defined in MomentStatic... :-(
var momentWrapper: any = moment; // moment must already be loaded
// Set default method for handling non-ISO date conversions.
// See 4/28 comment i... | momentWrapper | identifier_name |
moment.module.ts | module rl.utilities.services.momentWrapper {
export var moduleName: string = 'rl.utilities.services.momentWrapper';
export var serviceName: string = 'momentWrapper';
|
// Using `any` instead of MomentStatic because
// createFromInputFallback doesn't appear to be
// defined in MomentStatic... :-(
var momentWrapper: any = moment; // moment must already be loaded
// Set default method for handling non-ISO date conversions.
// See 4/28 comment in https://github.com/moment... | export function momentWrapper(): void {
'use strict'; | random_line_split |
static-mut-foreign.rs | // Copyright 2013 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 ... | (_: &'static libc::c_int) {}
fn static_bound_set(a: &'static mut libc::c_int) {
*a = 3;
}
unsafe fn run() {
assert!(rust_dbg_static_mut == 3);
rust_dbg_static_mut = 4;
assert!(rust_dbg_static_mut == 4);
rust_dbg_static_mut_check_four();
rust_dbg_static_mut += 1;
assert!(rust_dbg_static_mut... | static_bound | identifier_name |
static-mut-foreign.rs | // Copyright 2013 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 static_bound_set(a: &'static mut libc::c_int) {
*a = 3;
}
unsafe fn run() {
assert!(rust_dbg_static_mut == 3);
rust_dbg_static_mut = 4;
assert!(rust_dbg_static_mut == 4);
rust_dbg_static_mut_check_four();
rust_dbg_static_mut += 1;
assert!(rust_dbg_static_mut == 5);
rust_dbg_static_... | {} | identifier_body |
static-mut-foreign.rs | // Copyright 2013 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 ... | rust_dbg_static_mut = 4;
assert!(rust_dbg_static_mut == 4);
rust_dbg_static_mut_check_four();
rust_dbg_static_mut += 1;
assert!(rust_dbg_static_mut == 5);
rust_dbg_static_mut *= 3;
assert!(rust_dbg_static_mut == 15);
rust_dbg_static_mut = -3;
assert!(rust_dbg_static_mut == -3);
s... | assert!(rust_dbg_static_mut == 3); | random_line_split |
filtered_record_array.js | import RecordArray from "./record_array";
/**
@module ember-data
*/
var get = Ember.get;
/**
Represents a list of records whose membership is determined by the
store. As records are created, loaded, or modified, the store
evaluates them to determine if they should be part of the record
array.
@class Fil... | @return {Boolean} `true` if the record should be in the array
*/
filterFunction: null,
isLoaded: true,
replace: function() {
var type = get(this, 'type').toString();
throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
},
/**
@method updateFilter
@priv... | @method filterFunction
@param {DS.Model} record | random_line_split |
utils.py | import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class WLQuit(WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer... | if c <= 127:
return c
elif 194 <= c <= 223:
bytes.append(c)
bytes.append(get_check_next_byte())
elif 224 <= c <= 239:
bytes.append(c)
bytes.append(get_check_next_byte())
bytes.append(get_check_next_byte())
elif 240 <= c <= 244:
bytes.append(c)
... | random_line_split | |
utils.py | import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class WLQuit(WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer... |
def get_char(win):
"""Use win.getch() to get a character even if it's multibyte.
A magic function that I found somewhere on the Internet. But it works
well, at least for Russian characters in a UTF-8-based shell.
Needs testing.
"""
def get_check_next_byte():
c = win.getch()
if... | """Try to recognize a date using several formats."""
if date == 'today':
return datetime.date.today()
if date == 'yesterday':
return datetime.date.today() - datetime.timedelta(days=1)
for p in ['(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})',
'(?P<month>\d{2})/(?P<day>\d{2})/... | identifier_body |
utils.py | import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class WLQuit(WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer... |
elif len(args) == 2 and type(args[0]) is int and type(args[1]) is int:
year, month = args
else:
raise TypeError('Give me either datetime.date or year and month')
next_first = datetime.date(year if month != 12 else year + 1,
month + 1 if month != 12 else 1, 1)
... | year, month = args[0].year, args[0].month | conditional_block |
utils.py | import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class | (WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer.
>>> lastday(2011, 11)
30
>>> lastday(datetime.date(2011, 2, 1))
28
"""
if not args:
raise TypeEr... | WLQuit | identifier_name |
field.ts | export type Field =
BooleanField |
BasicStringField |
DateTimeField |
FileField |
HiddenField |
NumberField |
SelectFieldSingle |
SelectFieldMulti |
RangeStringField |
TextAreaField |
TextField;
/**
* A Field describes a single field in an action or form.
*
* Fields can be used to automaticall... | */
options: Record<string, string> | string[]
} | {
/**
* If dataSource is specified, we'll grab the list of options from a
* simple csv or json resource.
*/
dataSource: {
/**
* URI where the list of options can be acquired.
*/
href: string;
/**
* Could be text/csv or any j... | /**
* Keys and values are labels and values.
*
* If specified as a plain array, use array values as labels and values. | random_line_split |
project.rs | /*
* Panopticon - A libre disassembler
* Copyright (C) 2015 Panopticon authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) an... | assert!(maybe_project.ok().is_some());
} | let maybe_project = Project::open(Path::new("../test-data/save.panop"));
| random_line_split |
project.rs | /*
* Panopticon - A libre disassembler
* Copyright (C) 2015 Panopticon authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) an... | () {
let maybe_project = Project::open(Path::new("../test-data/save.panop"));
assert!(maybe_project.ok().is_some());
}
| project_open | identifier_name |
project.rs | /*
* Panopticon - A libre disassembler
* Copyright (C) 2015 Panopticon authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) an... | {
let maybe_project = Project::open(Path::new("../test-data/save.panop"));
assert!(maybe_project.ok().is_some());
} | identifier_body | |
host.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as path from 'path';
import * as ts from 'typescript';
export interface ShimGenerator {
/**
* Returns... |
getDefaultLibFileName(options: ts.CompilerOptions): string {
return this.delegate.getDefaultLibFileName(options);
}
writeFile(
fileName: string, data: string, writeByteOrderMark: boolean,
onError: ((message: string) => void)|undefined,
sourceFiles: ReadonlyArray<ts.SourceFile>): void {
... | {
for (let i = 0; i < this.shimGenerators.length; i++) {
const generator = this.shimGenerators[i];
if (generator.recognize(fileName)) {
const readFile = (originalFile: string) => {
return this.delegate.getSourceFile(
originalFile, languageVersion, onError, shouldCr... | identifier_body |
host.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as path from 'path';
import * as ts from 'typescript';
export interface ShimGenerator {
/**
* Returns... | onError?: ((message: string) => void)|undefined,
shouldCreateNewSourceFile?: boolean|undefined): ts.SourceFile|undefined {
for (let i = 0; i < this.shimGenerators.length; i++) {
const generator = this.shimGenerators[i];
if (generator.recognize(fileName)) {
const readFile = (originalF... |
getSourceFile(
fileName: string, languageVersion: ts.ScriptTarget, | random_line_split |
host.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as path from 'path';
import * as ts from 'typescript';
export interface ShimGenerator {
/**
* Returns... | (): boolean { return this.delegate.useCaseSensitiveFileNames(); }
getNewLine(): string { return this.delegate.getNewLine(); }
fileExists(fileName: string): boolean {
const canonical = this.getCanonicalFileName(fileName);
// Consider the file as existing whenever 1) it really does exist in the delegate hos... | useCaseSensitiveFileNames | identifier_name |
host.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as path from 'path';
import * as ts from 'typescript';
export interface ShimGenerator {
/**
* Returns... |
if (delegate.directoryExists !== undefined) {
this.directoryExists = (directoryName: string) => delegate.directoryExists !(directoryName);
}
}
resolveTypeReferenceDirectives?:
(names: string[], containingFile: string) => ts.ResolvedTypeReferenceDirective[];
directoryExists?: (directoryName:... | {
// Backward compatibility with TypeScript 2.9 and older since return
// type has changed from (ts.ResolvedTypeReferenceDirective | undefined)[]
// to ts.ResolvedTypeReferenceDirective[] in Typescript 3.0
type ts3ResolveTypeReferenceDirectives = (names: string[], containingFile: string) =>
... | conditional_block |
defer.rs | #![feature(test)]
extern crate test;
use crossbeam_epoch::{self as epoch, Owned};
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_alloc_defer_free(b: &mut Bencher) {
b.iter(|| {
let guard = &epoch::pin();
let p = Owned::new(1).into_shared(guard);
unsafe {
... | for _ in 0..STEPS {
let guard = &epoch::pin();
guard.defer(move || ());
}
});
}
})
.unwrap();
});
} | s.spawn(|_| { | random_line_split |
defer.rs | #![feature(test)]
extern crate test;
use crossbeam_epoch::{self as epoch, Owned};
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_alloc_defer_free(b: &mut Bencher) {
b.iter(|| {
let guard = &epoch::pin();
let p = Owned::new(1).into_shared(guard);
unsafe {
... |
#[bench]
fn multi_alloc_defer_free(b: &mut Bencher) {
const THREADS: usize = 16;
const STEPS: usize = 10_000;
b.iter(|| {
scope(|s| {
for _ in 0..THREADS {
s.spawn(|_| {
for _ in 0..STEPS {
let guard = &epoch::pin();
... | {
b.iter(|| {
let guard = &epoch::pin();
guard.defer(move || ());
});
} | identifier_body |
defer.rs | #![feature(test)]
extern crate test;
use crossbeam_epoch::{self as epoch, Owned};
use crossbeam_utils::thread::scope;
use test::Bencher;
#[bench]
fn single_alloc_defer_free(b: &mut Bencher) {
b.iter(|| {
let guard = &epoch::pin();
let p = Owned::new(1).into_shared(guard);
unsafe {
... | (b: &mut Bencher) {
const THREADS: usize = 16;
const STEPS: usize = 10_000;
b.iter(|| {
scope(|s| {
for _ in 0..THREADS {
s.spawn(|_| {
for _ in 0..STEPS {
let guard = &epoch::pin();
let p = Owned::new(1... | multi_alloc_defer_free | identifier_name |
syntax-extension-minor.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 ... | "use_mention_distinction");
} | let asdf_fdsa = ~"<.<";
assert_eq!(concat_idents!(asd, f_f, dsa), ~"<.<");
assert!(stringify!(use_mention_distinction) == | random_line_split |
syntax-extension-minor.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 asdf_fdsa = ~"<.<";
assert_eq!(concat_idents!(asd, f_f, dsa), ~"<.<");
assert!(stringify!(use_mention_distinction) ==
"use_mention_distinction");
} | identifier_body | |
syntax-extension-minor.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 asdf_fdsa = ~"<.<";
assert_eq!(concat_idents!(asd, f_f, dsa), ~"<.<");
assert!(stringify!(use_mention_distinction) ==
"use_mention_distinction");
}
| main | identifier_name |
static_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';... | (url: string) {
browser.ng12Hybrid = true;
browser.rootEl = 'example-app';
browser.get(url);
}
describe('upgrade(static)', () => {
beforeEach(() => { loadPage('/upgrade/static/ts/'); });
afterEach(verifyNoBrowserErrors);
it('should render the `ng2-heroes` component', () => {
expect(element(by.css('h1'... | loadPage | identifier_name |
static_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';... | }); | expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
}); | random_line_split |
static_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';... |
describe('upgrade(static)', () => {
beforeEach(() => { loadPage('/upgrade/static/ts/'); });
afterEach(verifyNoBrowserErrors);
it('should render the `ng2-heroes` component', () => {
expect(element(by.css('h1')).getText()).toEqual('Heroes');
expect(element.all(by.css('p')).get(0).getText()).toEqual('Ther... | {
browser.ng12Hybrid = true;
browser.rootEl = 'example-app';
browser.get(url);
} | identifier_body |
push.js | exports.level = {
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C3\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\",\"localBranchesThatTrackThis\":null},\"o/master\":{\"target\":\"C3\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null,\"localBranchesThatTrackThis\":[\"master\"]}},\"commits\"... | "",
"Du kannst dir `git push` als einen Befehl zum \"Veröffentlichen\" deiner Arbeit vorstellen. Es gibt da noch ein paar Feinheiten, aber lass uns mal mit kleinen Schritten anfangen."
]
}
},
{
"type": "GitDemonstrationView",
"options... | "Nun hab ich also Änderungen vom entfernten Server geholt und in meine lokale Arbeit integriert. Das ist schön und gut ... aber wie teile ich _meine_ Wahnsinns-Entwicklungen mit allen anderen?",
"",
"Naja, das Hochladen von Zeug ist das Gegenteil zum Herunterladen von Zeug. Und... | random_line_split |
fields.py | # coding: utf-8
"""
Fields represent CronTrigger options which map to :class:`~datetime.datetime`
fields.
"""
from calendar import monthrange
from apscheduler.triggers.cron.expressions import (
AllExpression, RangeExpression, WeekdayPositionExpression, LastDayOfMonthExpression, WeekdayRangeExpression)
__all__ =... | REAL = False
COMPILERS = BaseField.COMPILERS + [WeekdayRangeExpression]
def get_value(self, dateval):
return dateval.weekday() | identifier_body | |
fields.py | # coding: utf-8
"""
Fields represent CronTrigger options which map to :class:`~datetime.datetime`
fields.
"""
|
from apscheduler.triggers.cron.expressions import (
AllExpression, RangeExpression, WeekdayPositionExpression, LastDayOfMonthExpression, WeekdayRangeExpression)
__all__ = ('MIN_VALUES', 'MAX_VALUES', 'DEFAULT_VALUES', 'BaseField', 'WeekField', 'DayOfMonthField', 'DayOfWeekField')
MIN_VALUES = {'year': 1970, 'm... | from calendar import monthrange | random_line_split |
fields.py | # coding: utf-8
"""
Fields represent CronTrigger options which map to :class:`~datetime.datetime`
fields.
"""
from calendar import monthrange
from apscheduler.triggers.cron.expressions import (
AllExpression, RangeExpression, WeekdayPositionExpression, LastDayOfMonthExpression, WeekdayRangeExpression)
__all__ =... |
raise ValueError('Unrecognized expression "%s" for field "%s"' % (expr, self.name))
def __str__(self):
expr_strings = (str(e) for e in self.expressions)
return ','.join(expr_strings)
def __repr__(self):
return "%s('%s', '%s')" % (self.__class__.__name__, self.name, self)
cl... | match = compiler.value_re.match(expr)
if match:
compiled_expr = compiler(**match.groupdict())
self.expressions.append(compiled_expr)
return | conditional_block |
fields.py | # coding: utf-8
"""
Fields represent CronTrigger options which map to :class:`~datetime.datetime`
fields.
"""
from calendar import monthrange
from apscheduler.triggers.cron.expressions import (
AllExpression, RangeExpression, WeekdayPositionExpression, LastDayOfMonthExpression, WeekdayRangeExpression)
__all__ =... | (self, dateval):
return monthrange(dateval.year, dateval.month)[1]
class DayOfWeekField(BaseField):
REAL = False
COMPILERS = BaseField.COMPILERS + [WeekdayRangeExpression]
def get_value(self, dateval):
return dateval.weekday()
| get_max | identifier_name |
trace_macros-format.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 ... |
// should be fine:
macro_rules! expando {
($x: ident) => { trace_macros!($x) }
}
expando!(true);
} | trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false`
| random_line_split |
trace_macros-format.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 ... | {
trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false`
t... | identifier_body | |
trace_macros-format.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 ... | () {
trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false`
trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false`
... | main | identifier_name |
test_cssr.py | # Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Created on Jan 24, 2012
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jan 24, 2... |
if __name__ == "__main__":
unittest.main()
| filename = os.path.join(PymatgenTest.TEST_FILES_DIR, "Si.cssr")
cssr = Cssr.from_file(filename)
self.assertIsInstance(cssr.structure, Structure) | identifier_body |
test_cssr.py | # Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Created on Jan 24, 2012
"""
__author__ = "Shyue Ping Ong" | __maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jan 24, 2012"
import os
import unittest
from pymatgen.core.structure import Structure
from pymatgen.io.cssr import Cssr
from pymatgen.io.vasp.inputs import Poscar
from pymatgen.util.testing import PymatgenTest
class CssrTest(unittest.TestC... | __copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1" | random_line_split |
test_cssr.py | # Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Created on Jan 24, 2012
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jan 24, 2... | (self):
filename = os.path.join(PymatgenTest.TEST_FILES_DIR, "Si.cssr")
cssr = Cssr.from_file(filename)
self.assertIsInstance(cssr.structure, Structure)
if __name__ == "__main__":
unittest.main()
| test_from_file | identifier_name |
test_cssr.py | # Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Created on Jan 24, 2012
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jan 24, 2... | unittest.main() | conditional_block | |
GlyphSeries.test.tsx | import React, { useContext, useEffect } from 'react';
import { animated } from 'react-spring';
import { mount } from 'enzyme';
import { AnimatedGlyphSeries, DataContext, GlyphSeries, useEventEmitter } from '../../src';
import getDataContext from '../mocks/getDataContext';
import setupTooltipTest from '../mocks/setupToo... | );
expect(wrapper.find('.custom-glyph')).toHaveLength(series.data.length);
});
it('should invoke showTooltip/hideTooltip on pointermove/pointerout', () => {
expect.assertions(2);
const showTooltip = jest.fn();
const hideTooltip = jest.fn();
const ConditionalEventEmitter = () => {
co... | </DataContext.Provider>, | random_line_split |
GlyphSeries.test.tsx | import React, { useContext, useEffect } from 'react';
import { animated } from 'react-spring';
import { mount } from 'enzyme';
import { AnimatedGlyphSeries, DataContext, GlyphSeries, useEventEmitter } from '../../src';
import getDataContext from '../mocks/getDataContext';
import setupTooltipTest from '../mocks/setupToo... |
});
return null;
};
setupTooltipTest(
<>
<GlyphSeries dataKey={series.key} {...series} />
<ConditionalEventEmitter />
</>,
{ showTooltip, hideTooltip },
);
});
});
describe('<AnimatedGlyphSeries />', () => {
it('should be defined', () => {
expect(Ani... | {
// @ts-ignore not a React.MouseEvent
emit('pointermove', new MouseEvent('pointermove'), XYCHART_EVENT_SOURCE);
expect(showTooltip).toHaveBeenCalledTimes(1);
// @ts-ignore not a React.MouseEvent
emit('pointerout', new MouseEvent('pointerout'), XYCHART_EVENT_SOURCE);
... | conditional_block |
namespaced_enum_emulate_flat.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 ... | D,
E(int),
F { a: int },
}
impl Bar {
pub fn foo() {}
}
} |
pub mod nest {
pub use self::Bar::*;
pub enum Bar { | random_line_split |
namespaced_enum_emulate_flat.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 ... | {
D,
E(int),
F { a: int },
}
impl Bar {
pub fn foo() {}
}
}
| Bar | identifier_name |
main.rs | // Copyright (C) 2015, Alberto Corona <ac@albertocorona.com>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "bin"]
#![crate_name = "mkdir"]
static UTIL: Prog = Prog { name: "mkdir", vers: "0.1.0", yr: "2015"... | (opts: Options) {
print!("{}: {} {}... {}...\n\
Create DIRECTORY(ies) if they do not already exist.", "Usage".bold(),
UTIL.name.bold(), "[OPTION]".underline(), "DIRECTORY".underline());
println!("{}", opts.options());
}
fn main() {
let args: Vec<String> = env::args().collect();
let mut opts = ... | print_usage | identifier_name |
main.rs | // Copyright (C) 2015, Alberto Corona <ac@albertocorona.com>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "bin"]
#![crate_name = "mkdir"]
static UTIL: Prog = Prog { name: "mkdir", vers: "0.1.0", yr: "2015"... | Err(e) => {
UTIL.error(e.to_string(), ExitStatus::Error);
}
};
}
}
fn print_usage(opts: Options) {
print!("{}: {} {}... {}...\n\
Create DIRECTORY(ies) if they do not already exist.", "Usage".bold(),
UTIL.name.bold(), "[OPTION]".underline(), "DIRECTORY".un... | }
}, | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.