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 |
|---|---|---|---|---|
npts.py | '''Experimental!
This is an experimental module for converting ColumnTS into
dynts.timeseries. It requires dynts_.
.. _dynts: https://github.com/quantmind/dynts
'''
from collections import Mapping
from . import models as columnts
import numpy as ny
from dynts import timeseries, tsname
class ColumnT... |
def back(self, *fields):
'''Return the back pair of the structure'''
ts = self.irange(-1, -1, fields=fields)
if ts:
return ts.end(), ts[0]
def load_data(self, result):
loads = self.pickler.loads
vloads = self.value_pickler.loads
dt, va = ... | '''Return the front pair of the structure'''
ts = self.irange(0, 0, fields=fields)
if ts:
return ts.start(), ts[0] | identifier_body |
npts.py | '''Experimental!
This is an experimental module for converting ColumnTS into
dynts.timeseries. It requires dynts_.
.. _dynts: https://github.com/quantmind/dynts
'''
from collections import Mapping
from . import models as columnts
import numpy as ny
from dynts import timeseries, tsname
class ColumnT... |
for f in sorted(va):
fields.append(f)
data = va[f]
vals.append((vloads(v) for v in data))
values = ny.array(list(zip(*vals)))
name = tsname(*fields)
else:
name = None
dates = None
v... | va = dict(va) | conditional_block |
npts.py | '''Experimental!
This is an experimental module for converting ColumnTS into
dynts.timeseries. It requires dynts_.
.. _dynts: https://github.com/quantmind/dynts
'''
from collections import Mapping
from . import models as columnts
import numpy as ny
from dynts import timeseries, tsname
class ColumnT... | (columnts.ColumnTSField):
def structure_class(self):
return ColumnTS
| ColumnTSField | identifier_name |
npts.py | '''Experimental!
This is an experimental module for converting ColumnTS into
dynts.timeseries. It requires dynts_.
.. _dynts: https://github.com/quantmind/dynts
'''
from collections import Mapping
from . import models as columnts
import numpy as ny
from dynts import timeseries, tsname
class ColumnT... | ts = self.irange(-1, -1, fields=fields)
if ts:
return ts.end(), ts[0]
def load_data(self, result):
loads = self.pickler.loads
vloads = self.value_pickler.loads
dt, va = result
if result[0] and va:
dates = ny.array([loads(t) for t in d... | def back(self, *fields):
'''Return the back pair of the structure'''
| random_line_split |
0004_llphpage.py | # Generated by Django 3.0.4 on 2020-11-05 15:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0022_uploadedimage'),
('wagtailcore', '0052_pagelogentry'),
('pages', '0003_merge_20200930_... | ] | bases=('wagtailcore.page',),
), | random_line_split |
0004_llphpage.py | # Generated by Django 3.0.4 on 2020-11-05 15:48
from django.db import migrations, models
import django.db.models.deletion
class | (migrations.Migration):
dependencies = [
('wagtailimages', '0022_uploadedimage'),
('wagtailcore', '0052_pagelogentry'),
('pages', '0003_merge_20200930_1001'),
]
operations = [
migrations.CreateModel(
name='LLPHPage',
fields=[
('page_p... | Migration | identifier_name |
0004_llphpage.py | # Generated by Django 3.0.4 on 2020-11-05 15:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
| 'abstract': False,
},
bases=('wagtailcore.page',),
),
]
| dependencies = [
('wagtailimages', '0022_uploadedimage'),
('wagtailcore', '0052_pagelogentry'),
('pages', '0003_merge_20200930_1001'),
]
operations = [
migrations.CreateModel(
name='LLPHPage',
fields=[
('page_ptr', models.OneToOneField(aut... | identifier_body |
libraries.js | /**
* Exports lists of modules to be bundled as external "dynamic" libraries
*
* (@see webpack DllPlugin and DllReferencePlugin)
*/
module.exports = {
'angular_dll': [
'angular',
'angular/angular.min',
'angular-animate',
'angular-bootstrap',
'angular-bootstrap-colorpicker',
'angular-breadc... | 'angular-ui-tree',
'angular-ui-pageslide',
'ng-file-upload',
'at-table/dist/angular-table',
'angular-dragula'
]
} | 'angular-touch',
'angular-ui-router',
'angular-ui-select',
'angular-ui-tinymce',
'angular-ui-translation', | random_line_split |
procurement_pull.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... |
return super(procurement_order, self).check_produce(cr, uid, ids)
def check_move(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location... | if line.location_id==procurement.location_id:
return line.type_proc=='produce' | conditional_block |
procurement_pull.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... |
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
procurement_order() | random_line_split |
procurement_pull.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | return False
def action_move_create(self, cr, uid, ids, context=None):
proc_obj = self.pool.get('procurement.order')
move_obj = self.pool.get('stock.move')
picking_obj=self.pool.get('stock.picking')
wf_service = netsvc.LocalService("workflow")
for proc in proc_obj.br... | _inherit = 'procurement.order'
def check_buy(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
return line.type_proc... | identifier_body |
procurement_pull.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | (self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
return line.type_proc=='buy'
return super(procurement_order, ... | check_buy | identifier_name |
index.ts | import "typings-global"
var plugins = {
path: require("path"),
beautylog: require("beautylog"),
indentString: require("indent-string"),
g: {
wavethrough: require("gulp-wavethrough"),
},
through: require("through2")
}
var doNothing = function(){
};
module.exports = (activateArg:boolean... |
};
| {
plugins.beautylog.error("gulp-inspect: please provide a valid boolean value as argument");
return plugins.g.wavethrough(); //wave through
} | conditional_block |
index.ts | import "typings-global"
var plugins = {
path: require("path"),
beautylog: require("beautylog"),
indentString: require("indent-string"),
g: {
wavethrough: require("gulp-wavethrough"),
},
through: require("through2")
}
var doNothing = function(){
};
module.exports = (activateArg:boolean... | //do some string calculating
var localFile = {
contents: String(file.contents)
};
localFile.contents = plugins.indentString(localFile.contents, ' ', 2);
localFile.contents = plugins.indentString(localFile.contents, '>'.red, 2);
loca... | random_line_split | |
LoginUserForm.js | import React from 'react'
import { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { reduxForm } from 'redux-form'
import { loginUser } from '../../actions/authenticationActions'
const formName = 'login-user-form'
/**
* Component used to authenticate users bef... | <input type='password'
className='ncss-input pt2-sm pr4-sm pb2-sm pl4-sm r'
placeholder='Please enter your password'
{...password}/>
{password.touched && password.error && <div cl... | {
const {fields: {username, password}, handleSubmit, isAuthenticating, dispatch} = this.props
return (
<form id={formName} onSubmit={handleSubmit( data => {
dispatch(loginUser(data.username, data.password))
})}>
<div id='email-div'... | identifier_body |
LoginUserForm.js | import React from 'react'
import { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { reduxForm } from 'redux-form'
import { loginUser } from '../../actions/authenticationActions'
const formName = 'login-user-form'
/**
* Component used to authenticate users bef... | () {
const {fields: {username, password}, handleSubmit, isAuthenticating, dispatch} = this.props
return (
<form id={formName} onSubmit={handleSubmit( data => {
dispatch(loginUser(data.username, data.password))
})}>
<div id='email-d... | render | identifier_name |
LoginUserForm.js | import React from 'react'
import { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { reduxForm } from 'redux-form'
import { loginUser } from '../../actions/authenticationActions'
const formName = 'login-user-form'
/**
* Component used to authenticate users bef... | const {fields: {username, password}, handleSubmit, isAuthenticating, dispatch} = this.props
return (
<form id={formName} onSubmit={handleSubmit( data => {
dispatch(loginUser(data.username, data.password))
})}>
<div id='email-div' c... |
render() { | random_line_split |
social_sabatical_name.py | # maximum number of letters(ignoring spaces and duplicates) if tie choose alphabetical order.
# import sys
# text = "".join(sys.stdin.readlines())
# name_list = text.split("\n")
inputList = ["kylan charles", "raymond strickland", "julissa shepard", "andrea meza", "destiny alvarado"]
inputList2 = ["maria garcia", "smit... | print(res[0]) | res.append(name)
res.sort() | random_line_split |
social_sabatical_name.py | # maximum number of letters(ignoring spaces and duplicates) if tie choose alphabetical order.
# import sys
# text = "".join(sys.stdin.readlines())
# name_list = text.split("\n")
inputList = ["kylan charles", "raymond strickland", "julissa shepard", "andrea meza", "destiny alvarado"]
inputList2 = ["maria garcia", "smit... |
res.sort()
print(res[0]) | res.append(name) | conditional_block |
Gruntfile.js | module.exports = function(grunt) {
const {Externals} = require('../gui.ajax/res/js/dist/libdefs.js');
grunt.initConfig({
copy: {
smartbannercss: {
expand: true,
src: 'node_modules/smart-app-banner/dist/smart-app-banner.css',
dest: 'res/',
... | expand: true,
cwd: 'res/js/',
src: ['**/*.js'],
dest: 'res/build/',
ext: '.js'
}
]
}
},
browserify: {
mobile: {
... | files: [
{ | random_line_split |
dst-dtor-1.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 ... |
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
unsafe { DROP_RAN = true; }
}
}
trait Trait {}
impl Trait for Foo {}
struct Fat<T: ?Sized> {
f: T
}
pub fn main() {
{
let _x: Box<Fat<Trait>> = box Fat { f: Foo };
}
unsafe {
assert!(DROP_RAN);
}
} | random_line_split | |
dst-dtor-1.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 ... |
}
trait Trait {}
impl Trait for Foo {}
struct Fat<T: ?Sized> {
f: T
}
pub fn main() {
{
let _x: Box<Fat<Trait>> = box Fat { f: Foo };
}
unsafe {
assert!(DROP_RAN);
}
}
| {
unsafe { DROP_RAN = true; }
} | identifier_body |
dst-dtor-1.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 ... | ;
impl Drop for Foo {
fn drop(&mut self) {
unsafe { DROP_RAN = true; }
}
}
trait Trait {}
impl Trait for Foo {}
struct Fat<T: ?Sized> {
f: T
}
pub fn main() {
{
let _x: Box<Fat<Trait>> = box Fat { f: Foo };
}
unsafe {
assert!(DROP_RAN);
}
}
| Foo | identifier_name |
handle.rs | pub mod prelude {
pub use super::{Handle,HandleMut};
}
/// Types that manages access to a resource.
///
/// This trait is intended to be used by structs that manage the ownership of a resource from a C
/// library. Often, a pointer to the resource is needed to implement methods in other modules that
/// wrap the s... | pub trait HandleMut<T>: Handle<T> {
unsafe fn as_mut_ptr(&mut self) -> *mut T;
} | random_line_split | |
DataDownloadCqlBuilderSpec.js | describe("Portal.filter.combiner.DataDownloadCqlBuilder", function() {
var builder;
beforeEach(function() {
var filters =[
{
constructor: Portal.filter.GeometryFilter, // Is Geometry filter
isVisualised: returns(true),
hasValue: returns(true... | {
isVisualised: returns(false), // Not visualised
hasValue: returns(true),
getCql: returns('cql2')
},
{
isVisualised: returns(true),
hasValue: returns(false), // No value
getCql: returns('... | }, | random_line_split |
container.ts | import {Reflection, ReflectionKind, TraverseCallback, TraverseProperty} from './abstract';
import {ReflectionGroup} from '../ReflectionGroup';
import {DeclarationReflection} from './declaration';
export class ContainerReflection extends Reflection {
/**
* The children of this reflection.
*/
children:... | */
toObject(): any {
const result = super.toObject();
if (this.groups) {
const groups: any[] = [];
this.groups.forEach((group) => {
groups.push(group.toObject());
});
result['groups'] = groups;
}
if (this.sources... | random_line_split | |
container.ts | import {Reflection, ReflectionKind, TraverseCallback, TraverseProperty} from './abstract';
import {ReflectionGroup} from '../ReflectionGroup';
import {DeclarationReflection} from './declaration';
export class ContainerReflection extends Reflection {
/**
* The children of this reflection.
*/
children:... |
}
/**
* Return a raw object representation of this reflection.
*/
toObject(): any {
const result = super.toObject();
if (this.groups) {
const groups: any[] = [];
this.groups.forEach((group) => {
groups.push(group.toObject());
}... | {
this.children.forEach((child: DeclarationReflection) => {
callback(child, TraverseProperty.Children);
});
} | conditional_block |
container.ts | import {Reflection, ReflectionKind, TraverseCallback, TraverseProperty} from './abstract';
import {ReflectionGroup} from '../ReflectionGroup';
import {DeclarationReflection} from './declaration';
export class ContainerReflection extends Reflection {
/**
* The children of this reflection.
*/
children:... | });
result['sources'] = sources;
}
return result;
}
}
| {
const result = super.toObject();
if (this.groups) {
const groups: any[] = [];
this.groups.forEach((group) => {
groups.push(group.toObject());
});
result['groups'] = groups;
}
if (this.sources) {
const sources:... | identifier_body |
container.ts | import {Reflection, ReflectionKind, TraverseCallback, TraverseProperty} from './abstract';
import {ReflectionGroup} from '../ReflectionGroup';
import {DeclarationReflection} from './declaration';
export class ContainerReflection extends Reflection {
/**
* The children of this reflection.
*/
children:... | (): any {
const result = super.toObject();
if (this.groups) {
const groups: any[] = [];
this.groups.forEach((group) => {
groups.push(group.toObject());
});
result['groups'] = groups;
}
if (this.sources) {
const ... | toObject | identifier_name |
flexuin_fill2.rs | grid_pattern = {
{0, 0.028, "C", "floatiss_"},
{0.024, 0.040, "B", "floatiss_"},
{0.024, 0.028, "C", "floatiss_"},
{0.024, 0.028, "B", "floatiss_"},
{0.024, 0.028, "C", "floatiss_"},
{0.024, 0.028, "B", "floatiss_"},
{0.024, 0.028, "C", "floatiss_"},
{0.024, 0.074, "B", "floatiss_"},
... | //far_fill_density_target = 1.0;
density_window_size = 2.1;
path = "./";
half_dr_end_to_end = 0.028;
//write_milkyway_output = false;
//mw_cellname = "";
//mw_library = "";
//mw_path = "";
//mw_view = "FILL";
//mw_append = true;
//region_grids = {};
// use_fill_markers = true;
consider_off_grid = false;
write_out_c_tr... | //no_extend_cells_list = {"cx*",};
//near_fill_density_target = 1.0; | random_line_split |
refcounted.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 generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task ... |
Trusted {
ptr: self.ptr,
refcount: self.refcount.clone(),
script_chan: self.script_chan.clone(),
owner_thread: self.owner_thread,
phantom: PhantomData,
}
}
}
impl<T: Reflectable> Drop for Trusted<T> {
fn drop(&mut self) {
let ... | let mut refcount = self.refcount.lock().unwrap();
*refcount += 1;
} | random_line_split |
refcounted.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 generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task ... | : Reflectable>(&self, ptr: *const T) -> Arc<Mutex<usize>> {
let mut table = self.table.borrow_mut();
match table.entry(ptr as *const libc::c_void) {
Occupied(mut entry) => {
let refcount = entry.get_mut();
*refcount.lock().unwrap() += 1;
refcou... | dref<T | identifier_name |
refcounted.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 generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task ... |
/// The set of live, pinned DOM objects that are currently prevented
/// from being garbage collected due to outstanding references.
pub struct LiveDOMReferences {
// keyed on pointer to Rust DOM object
table: RefCell<HashMap<*const libc::c_void, Arc<Mutex<usize>>>>
}
impl LiveDOMReferences {
/// Set up ... | let mut refcount = self.refcount.lock().unwrap();
assert!(*refcount > 0);
*refcount -= 1;
if *refcount == 0 {
// It's possible this send will fail if the script task
// has already exited. There's not much we can do at this
// point though.
... | identifier_body |
refcounted.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 generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task ... | let _ = entry.remove();
}
Vacant(_) => {
// there could be a cleanup message dispatched, then a new
// pinned reference obtained and released before the message
// is processed, at which point there would be ... | // there could have been a new reference taken since
// this message was dispatched.
return;
}
| conditional_block |
index.d.ts | // Type definitions for NavigationReact 2.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { StateNavigator } from 'navigation';
import { Com... | extends Component<NavigationLinkProps> { }
/**
* Defines the Navigation Back Link Props contract
*/
export interface NavigationBackLinkProps extends RefreshLinkProps {
/**
* Starting at 1, The number of Crumb steps to go back
*/
distance: number;
}
/**
* Hyperlink Component the navigates back al... | NavigationLink | identifier_name |
index.d.ts | // Type definitions for NavigationReact 2.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { StateNavigator } from 'navigation';
import { Com... | * Indicates whether the Link is disabled when active
*/
disableActive?: boolean;
}
/**
* Hyperlink Component the navigates to the current State
*/
export class RefreshLink extends Component<RefreshLinkProps> { }
/**
* Defines the Navigation Link Props contract
*/
export interface NavigationLinkProps... | */
activeCssClass?: string;
/** | random_line_split |
Octet.ts | import {Validator} from "./Validator"
import bigInt = require("big-integer");
/**
* A binary representation of a 8 bit value.
*
* {@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets
*
* An octet is used in the textual representation of an {@link IPv4} number, where the IP number ... | else {
octetValue = givenValue;
}
let [isValid, message] = Validator.isValidIPv4Octet(bigInt(octetValue));
if (!isValid) {
throw Error(message.filter(msg => {return msg !== '';}).toString());
}
this.value = octetValue;
}
/**
* Method to get ... | {
octetValue = parseInt(givenValue);
} | conditional_block |
Octet.ts | import {Validator} from "./Validator"
import bigInt = require("big-integer");
/**
* A binary representation of a 8 bit value.
*
* {@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets
*
* An octet is used in the textual representation of an {@link IPv4} number, where the IP number ... | {
private readonly value: number;
/**
* Convenience method for creating an Octet out of a string value representing the value of the octet
*
* @param {string} rawValue the octet value in string
* @returns {Octet} the Octet instance
*/
static fromString(rawValue:string):Octet {
... | Octet | identifier_name |
Octet.ts | import {Validator} from "./Validator"
import bigInt = require("big-integer");
/**
* A binary representation of a 8 bit value.
*
* {@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets
*
* An octet is used in the textual representation of an {@link IPv4} number, where the IP number ... |
/**
* Method to get the numeric value of the octet
*
* @returns {number} the numeric value of the octet
*/
public getValue():number {
return this.value;
}
/**
* Returns a decimal representation of the value of the octet in string
*
* @returns {string} a deci... | {
let octetValue: number;
if (typeof givenValue === 'string') {
octetValue = parseInt(givenValue);
} else {
octetValue = givenValue;
}
let [isValid, message] = Validator.isValidIPv4Octet(bigInt(octetValue));
if (!isValid) {
throw Error(... | identifier_body |
Octet.ts | import {Validator} from "./Validator"
import bigInt = require("big-integer");
/**
* A binary representation of a 8 bit value.
*
* {@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets
*
* An octet is used in the textual representation of an {@link IPv4} number, where the IP number ... | static fromString(rawValue:string):Octet {
return new Octet(rawValue);
};
/**
* Convenience method for creating an Octet out of a numeric value representing the value of the octet
*
* @param {number} rawValue the octet value in number
* @returns {Octet} the Octet instance
*... | *
* @param {string} rawValue the octet value in string
* @returns {Octet} the Octet instance
*/ | random_line_split |
test_nodelist.py | from unittest import TestCase
from django.template import Context, Template, VariableNode
from django.test import override_settings
class NodelistTest(TestCase):
def test_for(self):
template = Template('{% for i in 1 %}{{ a }}{% endfor %}')
vars = template.nodelist.get_nodes_by_type(VariableNode... | template = Template(source)
try:
template.render(context)
except (RuntimeError, TypeError) as e:
error_source_index = e.django_template_source[1]
self.assertEqual(error_source_index,
expected_error_source_index) | conditional_block | |
test_nodelist.py | from unittest import TestCase
from django.template import Context, Template, VariableNode
from django.test import override_settings
class NodelistTest(TestCase):
def test_for(self):
template = Template('{% for i in 1 %}{{ a }}{% endfor %}')
vars = template.nodelist.get_nodes_by_type(VariableNode... |
class ErrorIndexTest(TestCase):
"""
Checks whether index of error is calculated correctly in
template debugger in for loops. Refs ticket #5831
"""
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True)
def test_correct_exception_index(self):
tests = [
('{% load bad_tag %}{% f... | template = Template('{% ifchanged x %}{{ a }}{% endifchanged %}')
vars = template.nodelist.get_nodes_by_type(VariableNode)
self.assertEqual(len(vars), 1) | identifier_body |
test_nodelist.py | from unittest import TestCase
from django.template import Context, Template, VariableNode
from django.test import override_settings
class NodelistTest(TestCase):
def test_for(self):
template = Template('{% for i in 1 %}{{ a }}{% endfor %}')
vars = template.nodelist.get_nodes_by_type(VariableNode... | (self):
template = Template('{% ifequal x y %}{{ a }}{% endifequal %}')
vars = template.nodelist.get_nodes_by_type(VariableNode)
self.assertEqual(len(vars), 1)
def test_ifchanged(self):
template = Template('{% ifchanged x %}{{ a }}{% endifchanged %}')
vars = template.nodelis... | test_ifequal | identifier_name |
test_nodelist.py | from unittest import TestCase
from django.template import Context, Template, VariableNode
from django.test import override_settings
class NodelistTest(TestCase):
def test_for(self):
template = Template('{% for i in 1 %}{{ a }}{% endfor %}')
vars = template.nodelist.get_nodes_by_type(VariableNode... | class ErrorIndexTest(TestCase):
"""
Checks whether index of error is calculated correctly in
template debugger in for loops. Refs ticket #5831
"""
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True)
def test_correct_exception_index(self):
tests = [
('{% load bad_tag %}{% for ... | random_line_split | |
terminalProfiles.test.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | profileName: 'name',
path: 'path',
isDefault: true
};
deepStrictEqual(createProfileSchemaEnums([profile]), {
values: ['name'],
markdownDescriptions: ['$(terminal) name\n- path: path']
});
});
test('should show all profile information', () => {
const profile: ITerminalProfile = {
... | const profile: ITerminalProfile = { | random_line_split |
lib.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = self.cleanup_dir();
}
}
// the tests for this module need to change the path using change_dir,
// and this doesn't play nicely with other tests so these unit tests are located
// in src/test/run-pass/tempfile.rs
| {
match self.path {
Some(ref p) => fs::remove_dir_all(p),
None => Ok(())
}
} | identifier_body |
lib.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // and this doesn't play nicely with other tests so these unit tests are located
// in src/test/run-pass/tempfile.rs | // the tests for this module need to change the path using change_dir, | random_line_split |
lib.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
path: Option<PathBuf>,
}
// How many times should we (re)try finding an unused random name? It should be
// enough that an attacker will run out of luck before we run out of patience.
const NUM_RETRIES: u32 = 1 << 31;
// How many characters should we include in a random file name? It needs to
// be enough to di... | TempDir | identifier_name |
mention.py | from typing import Optional, Set, Text
import re
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def user_mention_matches_... | return None
return name
# We don't care about @all or @everyone
return None
def possible_mentions(content: Text) -> Set[Text]:
matches = re.findall(find_mentions, content)
names_with_none = (extract_name(match) for match in matches)
names = {name for name in names_with_none if ... | def extract_name(s: Text) -> Optional[Text]:
if s.startswith("**") and s.endswith("**"):
name = s[2:-2]
if name in wildcards: | random_line_split |
mention.py |
from typing import Optional, Set, Text
import re
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def | (mention: Text) -> bool:
return mention in wildcards
def extract_name(s: Text) -> Optional[Text]:
if s.startswith("**") and s.endswith("**"):
name = s[2:-2]
if name in wildcards:
return None
return name
# We don't care about @all or @everyone
return None
def possib... | user_mention_matches_wildcard | identifier_name |
mention.py |
from typing import Optional, Set, Text
import re
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def user_mention_matches... |
# We don't care about @all or @everyone
return None
def possible_mentions(content: Text) -> Set[Text]:
matches = re.findall(find_mentions, content)
names_with_none = (extract_name(match) for match in matches)
names = {name for name in names_with_none if name}
return names
def extract_user_gr... | name = s[2:-2]
if name in wildcards:
return None
return name | conditional_block |
mention.py |
from typing import Optional, Set, Text
import re
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def user_mention_matches... |
def possible_mentions(content: Text) -> Set[Text]:
matches = re.findall(find_mentions, content)
names_with_none = (extract_name(match) for match in matches)
names = {name for name in names_with_none if name}
return names
def extract_user_group(matched_text: Text) -> Text:
return matched_text[1:-1... | if s.startswith("**") and s.endswith("**"):
name = s[2:-2]
if name in wildcards:
return None
return name
# We don't care about @all or @everyone
return None | identifier_body |
user-services.ts | /// <reference path="../apimanPlugin.ts"/>
/// <reference path="../services.ts"/>
module Apiman {
export var UserServicesController = _module.controller("Apiman.UserServicesController",
['$q', '$scope', '$location', 'UserSvcs', 'PageLifecycle', '$routeParams',
($q, $scope, $location, UserSvcs, Page... |
resolve(user);
}, reject);
}),
services: $q(function(resolve, reject) {
UserSvcs.query({ user: $routeParams.user, entityType: 'services' }, function(userServices) {
$scope.filteredServices = userServ... | {
user.fullName = user.username;
} | conditional_block |
user-services.ts | /// <reference path="../apimanPlugin.ts"/>
/// <reference path="../services.ts"/>
module Apiman {
export var UserServicesController = _module.controller("Apiman.UserServicesController",
['$q', '$scope', '$location', 'UserSvcs', 'PageLifecycle', '$routeParams',
($q, $scope, $location, UserSvcs, Page... | if (!value) {
$scope.filteredServices = $scope.services;
} else {
var filtered = [];
angular.forEach($scope.services, function(svc) {
if (svc.name.toLowerCase().indexOf(value.toLowerCase()) > -1 || svc.or... | $scope.tab = 'services';
$scope.filterServices = function(value) { | random_line_split |
thread_local_dummy.rs | // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | <R, F>(&'static self, cb: F) -> R where F: FnOnce(&T) -> R {
unsafe {
let ptr = *self.inner.get();
assert!(!ptr.is_null(), "cannot access a scoped thread local \
variable without calling `set` first");
cb(&*ptr)
... | with | identifier_name |
thread_local_dummy.rs | // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | pub fn with<R, F>(&'static self, cb: F) -> R where F: FnOnce(&T) -> R {
unsafe {
let ptr = *self.inner.get();
assert!(!ptr.is_null(), "cannot access a scoped thread local \
variable without calling `set` first");
cb... | }
cb()
}
| random_line_split |
thread_local_dummy.rs | // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
unsafe fn init(&self) -> &T {
let value = (self.init)();
let ptr = self.inner.get();
*ptr = Some(value);
(*ptr).as_ref().unwrap()
}
#[unstable(feature = "std_misc",
reason = "state querying was recently added")]
pub fn state(&'static self) -> State {... | {
unsafe {
f(match *self.inner.get() {
Some(ref inner) => inner,
None => self.init(),
})
}
} | identifier_body |
test_schedule.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.sprite import Sprite
import pyglet
import random
class TestLayer(cocos.layer.Layer):
|
if __name__ == "__main__":
director.init()
test_layer = TestLayer ()
main_scene = cocos.scene.Scene (test_layer)
director.run (main_scene)
| def __init__(self):
super( TestLayer, self ).__init__()
x,y = director.get_window_size()
self.sprite = Sprite('grossini.png')
self.sprite.position = x/2, y/2
self.add( self.sprite )
self.schedule( self.change_x )
self.schedule_interval(... | identifier_body |
test_schedule.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos | import random
class TestLayer(cocos.layer.Layer):
def __init__(self):
super( TestLayer, self ).__init__()
x,y = director.get_window_size()
self.sprite = Sprite('grossini.png')
self.sprite.position = x/2, y/2
self.add( self.sprite )
self.s... | from cocos.director import director
from cocos.sprite import Sprite
import pyglet | random_line_split |
test_schedule.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.sprite import Sprite
import pyglet
import random
class TestLayer(cocos.layer.Layer):
def _... | director.init()
test_layer = TestLayer ()
main_scene = cocos.scene.Scene (test_layer)
director.run (main_scene) | conditional_block | |
test_schedule.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.sprite import Sprite
import pyglet
import random
class | (cocos.layer.Layer):
def __init__(self):
super( TestLayer, self ).__init__()
x,y = director.get_window_size()
self.sprite = Sprite('grossini.png')
self.sprite.position = x/2, y/2
self.add( self.sprite )
self.schedule( self.change_x )
... | TestLayer | identifier_name |
quote-editor.ts | import { h } from 'snabbdom/h';
import { Store } from '../store/index';
import {
setQuoteText,
setQuoteSource,
cancelEditing,
toggleBulkEdit,
addQuotesBulk,
} from '../store/actions';
import { ActionType } from '../store/action-types';
import { ErrorAlert } from './alert';
import parseCsv from '../lib/parse-csv';... | eturn h('div.v-stack-2', [header, tabs, quoteEditor, sourceEditor, buttons]);
};
export default QuoteEditor;
| return h('div.v-stack-2', [header, tabs, error, quoteEditorBulk, importCSV, buttons]);
}
r | conditional_block |
quote-editor.ts | import { h } from 'snabbdom/h';
import { Store } from '../store/index';
import {
setQuoteText,
setQuoteSource,
cancelEditing,
toggleBulkEdit,
addQuotesBulk,
} from '../store/actions';
import { ActionType } from '../store/action-types';
import { ErrorAlert } from './alert';
import parseCsv from '../lib/parse-csv';... |
const importCSV = h('div.nfe-csv-import', [
h('div.nfe-csv-or', 'Or, Import from a CSV'),
h('input.nfe-csv-import-input', {
on: {
change: csvUploadListener,
},
props: {
name: 'nfecsvimporter',
type: 'file',
id: 'nfe-csv-importer',
accept: '.csv, application/vnd.openxmlformats-officedo... | }
}
}
} | random_line_split |
header.component.js | (function() {
'use strict';
/**
* idHeader
*
* This component renders the application header.
*/
angular
.module('app.components')
.component('idHeader', header());
/**
* Internal function that returns the component.
* @returns {object} the angular compone... |
vm.headerVisible = true;
vm.searchValue = '';
vm.searchResultsVisible = false;
eventingService.registerListener('accountChange', 'header', function(user) {
vm.currentUserName = !user ? '' : user.firstName + ' ' + user.lastName;
});
}... | {
vm.currentUserName = currentUser.firstName + ' ' + currentUser.lastName;
} | conditional_block |
header.component.js | (function() {
'use strict';
/**
* idHeader
*
* This component renders the application header.
*/
angular
.module('app.components')
.component('idHeader', header());
/**
* Internal function that returns the component.
* @returns {object} the angular compone... | ($state, eventingService, authService) {
var vm = this;
// lifecycle hooks
vm.$onInit = onInit;
// scope functions
vm.executeSearch = executeSearch;
vm.goToIdeas = goToIdeas;
vm.goToPeople = goToPeople;
vm.goToAccount = goToAccount;
vm.logout = l... | HeaderCtrl | identifier_name |
header.component.js | (function() {
'use strict';
/**
* idHeader
*
* This component renders the application header.
*/
angular
.module('app.components')
.component('idHeader', header());
/**
* Internal function that returns the component.
* @returns {object} the angular compone... |
/**
* Navigates to the Account view.
*/
function goToAccount() {
$state.go('account');
}
/**
* Logs the current user out of the application.
*/
function logout() {
authService.logout()
.then(function()... | {
$state.go('people');
} | identifier_body |
header.component.js | (function() {
'use strict';
/**
* idHeader
*
* This component renders the application header.
*/
angular
.module('app.components')
.component('idHeader', header());
/**
* Internal function that returns the component.
* @returns {object} the angular compone... | */
function clearSearchValue() {
vm.searchValue = '';
}
}
})(); | * Clears the search text field. | random_line_split |
rerun.py | import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def main():
usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for e... |
#if log['reuse'] == 'False':
# log['reuse'] = False
#else:
# log['reuse'] = True
# convert list stirng to list
#list_vars = ['feature_list', 'additional_label_files', 'additional_label_weights']
#for v in list_vars:
# if v in log:
# print v
# print log[v]
... | if log[v] is not None:
log[v] = float(log[v])
else:
log[v] = None | conditional_block |
rerun.py | import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def main():
usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for e... | project = args[0]
log_filename = args[1]
new_name = options.new_name
log = fh.read_json(log_filename)
if new_name is None:
new_name = log['name'] + '_rerun'
log['name'] = new_name
float_vars = ['best_alpha', 'alpha_exp_base', 'max_alpha_exp', 'min_alpha_exp', 'orig_T', 'tau']
... | #parser.add_option('--boolarg', action="store_true", dest="boolarg", default=False,
# help='Keyword argument: default=%default')
(options, args) = parser.parse_args() | random_line_split |
rerun.py | import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def main():
| for v in float_vars:
if v in log:
if log[v] is not None:
log[v] = float(log[v])
else:
log[v] = None
#if log['reuse'] == 'False':
# log['reuse'] = False
#else:
# log['reuse'] = True
# convert list stirng to list
#list_vars ... | usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for experiment: default= old name + _rerun')
#parser.add_option('--boolarg', action="store_true", dest="boolarg", default=False,
# ... | identifier_body |
rerun.py | import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def | ():
usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for experiment: default= old name + _rerun')
#parser.add_option('--boolarg', action="store_true", dest="boolarg", default=False,
# ... | main | identifier_name |
rules.py | from .rest import RestClient
class Rules(object):
"""Rules endpoint implementation.
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
t... | options, such as rate-limit retries.
(defaults to None)
"""
def __init__(self, domain, token, telemetry=True, timeout=5.0, protocol="https", rest_options=None):
self.domain = domain
self.protocol = protocol
self.client = RestClient(jwt=token, telemetry=telemetry,... |
rest_options (RestClientOptions): Pass an instance of
RestClientOptions to configure additional RestClient | random_line_split |
rules.py | from .rest import RestClient
class Rules(object):
"""Rules endpoint implementation.
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
t... | (self, id):
"""Delete a rule.
Args:
id (str): The id of the rule to delete.
See: https://auth0.com/docs/api/management/v2#!/Rules/delete_rules_by_id
"""
return self.client.delete(self._url(id))
def update(self, id, body):
"""Update an existing rule
... | delete | identifier_name |
rules.py | from .rest import RestClient
class Rules(object):
"""Rules endpoint implementation.
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
t... |
return url
def all(self, stage='login_success', enabled=True, fields=None,
include_fields=True, page=None, per_page=None, include_totals=False):
"""Retrieves a list of all rules.
Args:
stage (str, optional): Retrieves rules that match the execution stage.
... | return '{}/{}'.format(url, id) | conditional_block |
rules.py | from .rest import RestClient
class Rules(object):
"""Rules endpoint implementation.
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
t... |
def _url(self, id=None):
url = '{}://{}/api/v2/rules'.format(self.protocol, self.domain)
if id is not None:
return '{}/{}'.format(url, id)
return url
def all(self, stage='login_success', enabled=True, fields=None,
include_fields=True, page=None, per_page=None, ... | self.domain = domain
self.protocol = protocol
self.client = RestClient(jwt=token, telemetry=telemetry, timeout=timeout, options=rest_options) | identifier_body |
selection-column.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {MatCellDef, MatColumnDef, MatHeaderCellDef, MatTable} from '@angular/material/table';
import {
Component,
... | this._table.removeColumnDef(this._columnDef);
}
}
private _syncColumnDefName() {
if (this._columnDef) {
this._columnDef.name = this._name;
}
}
} |
ngOnDestroy() {
if (this._table) { | random_line_split |
selection-column.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {MatCellDef, MatColumnDef, MatHeaderCellDef, MatTable} from '@angular/material/table';
import {
Component,
... | (): string {
return this._name;
}
set name(name: string) {
this._name = name;
this._syncColumnDefName();
}
private _name: string;
@ViewChild(MatColumnDef, {static: true}) private readonly _columnDef: MatColumnDef;
@ViewChild(MatCellDef, {static: true}) private readonly _cell: MatCellDef;
@Vi... | name | identifier_name |
selection-column.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {MatCellDef, MatColumnDef, MatHeaderCellDef, MatTable} from '@angular/material/table';
import {
Component,
... |
private _syncColumnDefName() {
if (this._columnDef) {
this._columnDef.name = this._name;
}
}
}
| {
if (this._table) {
this._table.removeColumnDef(this._columnDef);
}
} | identifier_body |
contact-list.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table';
import { cars } from './contact-data-table-data';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'contact-list',
templateUrl: './contact-li... | this.carResource.query(params).then(cars => this.cars = cars);
}
// custom features:
carClicked(car : any) {
alert(car.model);
}
yearLimit = 1999;
rowColors(car : any) {
if (car.year >= this.yearLimit) return 'rgb(255, 255, 197)';
}
ngOnInit() {
}
} | this.carResource.count().then(count => this.carCount = count);
}
reloadCars(params:any) { | random_line_split |
contact-list.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table';
import { cars } from './contact-data-table-data';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'contact-list',
templateUrl: './contact-li... | (car : any) {
alert(car.model);
}
yearLimit = 1999;
rowColors(car : any) {
if (car.year >= this.yearLimit) return 'rgb(255, 255, 197)';
}
ngOnInit() {
}
}
| carClicked | identifier_name |
contact-list.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table';
import { cars } from './contact-data-table-data';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'contact-list',
templateUrl: './contact-li... |
ngOnInit() {
}
}
| {
if (car.year >= this.yearLimit) return 'rgb(255, 255, 197)';
} | identifier_body |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | """Routines for parsing Affymetrix data files based upon file format
information. Primary focus is on accessing the CEL and CDF file
formats."""
homepage = "https://bioconductor.org/packages/affyio/"
url = "https://bioconductor.org/packages/3.5/bioc/src/contrib/affyio_1.46.0.tar.gz"
ver... | identifier_body | |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | (RPackage):
"""Routines for parsing Affymetrix data files based upon file format
information. Primary focus is on accessing the CEL and CDF file
formats."""
homepage = "https://bioconductor.org/packages/affyio/"
url = "https://bioconductor.org/packages/3.5/bioc/src/contrib/affyio_1.46.0.... | RAffyio | identifier_name |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | homepage = "https://bioconductor.org/packages/affyio/"
url = "https://bioconductor.org/packages/3.5/bioc/src/contrib/affyio_1.46.0.tar.gz"
version('1.46.0', 'e1f7a89ae16940aa29b998a4dbdc0ef9')
depends_on('r-zlibbioc', type=('build', 'run'))
depends_on('r@3.4.0:3.4.9', when='@1.46.0') | random_line_split | |
process_dialogs.py | import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def | (processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_liberated", "enemy_defeated", "party_relieved",
"event_triggered", "close_window", "trade", "exchange_members", "trade_prisoners", "buy_mercenaries",
"view_char", "training", "mem... | compile_dialog_states | identifier_name |
process_dialogs.py | import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def compile_dialog_states(processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_... |
def process_entry(processor, txt_file, entry, index):
name = get_dialog_name(entry[start_state_pos], entry[end_state_pos], entry[text_pos])
trp_pt = entry[speaker_pos]
flags = entry[flags_pos]
speaker = 0
if flags & other:
speaker = processor.process_id(trp_pt[1], "trp") << other_bits
flags ^= other... | global dialog_names
name = "dlga_%s:%s" % (pc.convert_to_identifier(start_state), pc.convert_to_identifier(end_state))
text_list = dialog_names.setdefault(name, [])
for i, existing_text in enumerate(text_list):
if text == existing_text:
name = "%s.%d" % (name, i + 1)
break
else:
text_list.ap... | identifier_body |
process_dialogs.py | import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def compile_dialog_states(processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_... | output_list.extend(processor.process_block(entry[consequences_pos], "%s consequences" % name))
output_list.append("%s " % entry[voice_pos] if len(entry) > voice_pos else "NO_VOICEOVER ")
output_list.append("\r\n")
txt_file.write("".join(output_list))
export = po.make_export(data=module_dialogs.dialogs, data_na... | speaker |= flags
output_list = ["%s %d %d " % (name, speaker, start_states[index])]
output_list.extend(processor.process_block(entry[conditions_pos], "%s conditions" % name))
output_list.append("%s " % pc.replace_spaces(entry[text_pos]) if entry[text_pos] else "NO_TEXT ")
output_list.append(" %d " % end_state... | random_line_split |
process_dialogs.py | import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def compile_dialog_states(processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_... |
for entry in module_dialogs.dialogs:
start_state = entry[2]
try:
index = unique_states[start_state]
unique_state_usages[index] += 1
start_states.append(index)
except KeyError:
pc.ERROR("starting dialog state '%s' has no matching ending state" % start_state)
for state, usages in ... | end_state = entry[5]
index = unique_states.setdefault(end_state, last_index)
if index == last_index:
last_index += 1
unique_state_list.append(end_state)
unique_state_usages.append(0)
end_states.append(index) | conditional_block |
httpServer.ts | /**
* HttpServer
*
* TODO: 1. Deal with Cache
* 2. SetRequestHeader
* 3. ArrayBuffer
* 4. Timeout
* 5. File API - Fast upload
*/
interface HttpOption {
url: string;
data?: any;
success?: any;
progress?: any;
// async?: boolean; *In the main thread will always be TRU... | (opt: HttpOption) {
this.AsyncRequest(opt.success);
this.xhr.open('post', opt.url, true);
this.xhr.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
this.xhr.send(JSON.stringify(opt.data));
}
Abort() {
this.xhr.abort();
}
private AsyncR... | Post | identifier_name |
httpServer.ts | /**
* HttpServer
*
* TODO: 1. Deal with Cache
* 2. SetRequestHeader
* 3. ArrayBuffer
* 4. Timeout
* 5. File API - Fast upload
*/
interface HttpOption {
url: string;
data?: any;
success?: any;
progress?: any;
// async?: boolean; *In the main thread will always be TRU... |
private SetRequestHeader() {
// Todo
}
}
export { HttpServer } | {
let updateProgress = (function(progress?: any) {
return function(evt: any) {
progress && progress(evt);
}
})(progress);
this.xhr.onprogress = updateProgress;
} | identifier_body |
httpServer.ts | /**
* HttpServer
*
* TODO: 1. Deal with Cache
* 2. SetRequestHeader
* 3. ArrayBuffer
* 4. Timeout
* 5. File API - Fast upload
*/
interface HttpOption {
url: string;
data?: any;
success?: any;
progress?: any;
// async?: boolean; *In the main thread will always be TRU... |
else {
console.error('HttpServer Error: ' + this.xhr.status);
}
}
private Progress(progress?: any) {
let updateProgress = (function(progress?: any) {
return function(evt: any) {
progress && progress(evt);
}
})(prog... | {
success && success(this.xhr.responseText);
} | conditional_block |
httpServer.ts | /**
* HttpServer
*
* TODO: 1. Deal with Cache
* 2. SetRequestHeader
* 3. ArrayBuffer
* 4. Timeout
* 5. File API - Fast upload
*/
interface HttpOption {
url: string; |
class HttpServer {
xhr: any;
constructor() {
this.xhr = new XMLHttpRequest();
}
Get(opt: HttpOption) {
this.AsyncRequest(opt.success);
this.Progress(opt.progress);
if( typeof(opt.data) === 'object' ) {
for( let i in opt.data ) {
... | data?: any;
success?: any;
progress?: any;
// async?: boolean; *In the main thread will always be TRUE
} | random_line_split |
lib.rs | //! Implementation of JSON Web Tokens.
//!
//! # Example
//!
//! ```rust
//! #![allow(unstable)]
//!
//! extern crate jwt;
//! use jwt::Claims;
//! use jwt::jws::hs256::{encode, decode};
//!
//! fn main() {
//! let mut claims = Claims::new();
//! claims.insert_unsafe("com.example.my-claim", "value".to_string()... |
}
| {
if a.len() != b.len() { return false; }
let mut r: u8 = 0;
for i in (0..a.len()) {
r |= a[i] ^ b[i];
}
r == 0
} | identifier_body |
lib.rs | //! Implementation of JSON Web Tokens.
//!
//! # Example
//!
//! ```rust
//! #![allow(unstable)]
//!
//! extern crate jwt;
//! use jwt::Claims;
//! use jwt::jws::hs256::{encode, decode};
//!
//! fn main() {
//! let mut claims = Claims::new();
//! claims.insert_unsafe("com.example.my-claim", "value".to_string()... | (a: &[u8], b: &[u8]) -> bool {
if a.len() != b.len() { return false; }
let mut r: u8 = 0;
for i in (0..a.len()) {
r |= a[i] ^ b[i];
}
r == 0
}
}
| safe_cmp | identifier_name |
lib.rs | //! Implementation of JSON Web Tokens.
//!
//! # Example
//!
//! ```rust
//! #![allow(unstable)]
//!
//! extern crate jwt;
//! use jwt::Claims;
//! use jwt::jws::hs256::{encode, decode};
//!
//! fn main() {
//! let mut claims = Claims::new();
//! claims.insert_unsafe("com.example.my-claim", "value".to_string()... |
let mut r: u8 = 0;
for i in (0..a.len()) {
r |= a[i] ^ b[i];
}
r == 0
}
}
| { return false; } | conditional_block |
lib.rs | //! Implementation of JSON Web Tokens.
//!
//! # Example
//!
//! ```rust
//! #![allow(unstable)]
//!
//! extern crate jwt;
//! use jwt::Claims;
//! use jwt::jws::hs256::{encode, decode};
//!
//! fn main() {
//! let mut claims = Claims::new();
//! claims.insert_unsafe("com.example.my-claim", "value".to_string()... | }
r == 0
}
} | r |= a[i] ^ b[i]; | random_line_split |
app.module.ts | import {BrowserModule} from "@angular/platform-browser";
import {Routes, RouterModule} from "@angular/router";
import {NgModule, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER} from "@angular/core";
import {FormsModule} from "@angular/forms";
import {AppComponent} from "./app.component";
import {TextIdeComponent} from "./tex... | }
];
@NgModule({
imports: [
MaterializeModule,
BrowserModule,
FormsModule,
ProgramModule,
TextIdeModule,
BlocklyModule,
HedgehogControlModule,
RouterModule.forRoot(appRoutes),
HttpClientModule,
ContextMenuModule.forRoot()
],
... | {
path: 'versions/:programName/blobs/:blobId',
component: FileViewComponent | random_line_split |
app.module.ts | import {BrowserModule} from "@angular/platform-browser";
import {Routes, RouterModule} from "@angular/router";
import {NgModule, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER} from "@angular/core";
import {FormsModule} from "@angular/forms";
import {AppComponent} from "./app.component";
import {TextIdeComponent} from "./tex... | { }
| AppModule | identifier_name |
rustwin.rs | WinEvent {
EventNone,
MouseMotion(Window, Buttons,ScreenPos),
MouseButtonDown(Window,Buttons,ScreenPos),
MouseButtonUp(Window,Buttons,ScreenPos),
KeyDown(Window,Key_t,Modifiers,ScreenPos),
KeyUp(Window,Key_t,Modifiers,ScreenPos),
Accelerometer(Window,(i32,i32,i32)),
JoypadEvent(Window,Vec2d,Vec2d,Buttons),
Mu... | // println!("pop event from {:?}", g_rustwin);
// println!("pos={:?}",g_cursor);
let mut rw=&mut g_rustwin;
if rw.head==rw.tail {
EventNone
} else {
let ev=rw.event_queue.get(rw.tail).unwrap().clone();
rw.tail=(rw.tail+1)&255;
ev
}
}
}
/// Sample main loop wrapper. Possible to write a mainloop ... | unsafe {
if g_init_input==false {init_input() }
glut::glutMainLoopEvent(); | random_line_split |
rustwin.rs | Event {
EventNone,
MouseMotion(Window, Buttons,ScreenPos),
MouseButtonDown(Window,Buttons,ScreenPos),
MouseButtonUp(Window,Buttons,ScreenPos),
KeyDown(Window,Key_t,Modifiers,ScreenPos),
KeyUp(Window,Key_t,Modifiers,ScreenPos),
Accelerometer(Window,(i32,i32,i32)),
JoypadEvent(Window,Vec2d,Vec2d,Buttons),
MultiT... |
pub fn init_input() {
| {
ev_println(format!("specialKeyUp:{} at {}",k,(x,y)));
// todo - translate special key into modifiers, thru glut enum
unsafe{
g_key_modifiers&=special_key_to_mask(k);
push_event(KeyUp(curr_win(), k as Key_t,g_key_modifiers,(x,y)));
}
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.