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 |
|---|---|---|---|---|
getRelayQueries.js | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ... | return cache[cacheKey];
}
var querySet = {};
Component.getFragmentNames().forEach(fragmentName => {
querySet[fragmentName] = null;
});
Object.keys(route.queries).forEach(queryName => {
if (!Component.hasFragment(queryName)) {
warning(
false,
'Relay.QL: query `%s.queries.%s` i... | queryCache.set(Component, {});
}
var cacheKey = route.name + ':' + stableStringify(route.params);
var cache = queryCache.get(Component);
if (cache.hasOwnProperty(cacheKey)) { | random_line_split |
getRelayQueries.js | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ... | queryName,
Component.displayName,
queryName
);
return;
}
var queryBuilder = route.queries[queryName];
if (queryBuilder) {
var concreteQuery = buildRQL.Query(
queryBuilder,
Component,
queryName,
route.params
);
invariant(
... | {
if (!queryCache.has(Component)) {
queryCache.set(Component, {});
}
var cacheKey = route.name + ':' + stableStringify(route.params);
var cache = queryCache.get(Component);
if (cache.hasOwnProperty(cacheKey)) {
return cache[cacheKey];
}
var querySet = {};
Component.getFragmentNames().forEach(fra... | identifier_body |
getRelayQueries.js | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ... | (
Component: RelayLazyContainer,
route: RelayQueryConfig
): RelayQuerySet {
if (!queryCache.has(Component)) {
queryCache.set(Component, {});
}
var cacheKey = route.name + ':' + stableStringify(route.params);
var cache = queryCache.get(Component);
if (cache.hasOwnProperty(cacheKey)) {
return cache[... | getRelayQueries | identifier_name |
getRelayQueries.js | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ... | var rootCall = rootQuery.getRootCall();
if (rootCall.value !== undefined) {
querySet[queryName] = rootQuery;
return;
}
}
}
querySet[queryName] = null;
});
cache[cacheKey] = querySet;
return querySet;
}
module.exports = RelayProfiler.instrument('Relay.get... | {
var concreteQuery = buildRQL.Query(
queryBuilder,
Component,
queryName,
route.params
);
invariant(
concreteQuery !== undefined,
'Relay.QL: query `%s.queries.%s` is invalid, a typical query is ' +
'defined using: () => Relay.QL`query { ... }`.',... | conditional_block |
hello-js.js | var stream = require('stream'),
util = require('util'),
Transform = stream.Transform;
function HelloJsTransform () | ;
util.inherits(HelloJsTransform, Transform);
HelloJsTransform.prototype._transform = function (chunk, enc, cb) {
if (this.data != '') {
this.push(this.data);
this.data = '';
}
for (var i = 0, char; i < chunk.length; i++) {
char = chunk[i];
if (this.startedReading) {
this.push(',')
}... | {
if (!(this instanceof HelloJsTransform)) {
return new HelloJsTransform();
}
this.data = 'var str=[';
this.endData = '];\nstr.forEach(function (char) {\n' +
' process.stdout.write(String.fromCharCode(char));\n' +
'});';
this.startedReading = false;
Transform.call(this);
} | identifier_body |
hello-js.js | var stream = require('stream'),
util = require('util'),
Transform = stream.Transform;
function HelloJsTransform () {
if (!(this instanceof HelloJsTransform)) {
return new HelloJsTransform();
}
this.data = 'var str=[';
this.endData = '];\nstr.forEach(function (char) {\n' +
' process.stdout.w... |
cb();
};
HelloJsTransform.prototype._flush = function (cb) {
this.push(this.endData);
cb();
};
module.exports = HelloJsTransform;
| {
char = chunk[i];
if (this.startedReading) {
this.push(',')
}
this.push(char.toString());
this.startedReading = true;
} | conditional_block |
hello-js.js | var stream = require('stream'),
util = require('util'),
Transform = stream.Transform;
function | () {
if (!(this instanceof HelloJsTransform)) {
return new HelloJsTransform();
}
this.data = 'var str=[';
this.endData = '];\nstr.forEach(function (char) {\n' +
' process.stdout.write(String.fromCharCode(char));\n' +
'});';
this.startedReading = false;
Transform.call(this);
};
util.inherits... | HelloJsTransform | identifier_name |
hello-js.js | var stream = require('stream'),
util = require('util'),
Transform = stream.Transform;
| this.data = 'var str=[';
this.endData = '];\nstr.forEach(function (char) {\n' +
' process.stdout.write(String.fromCharCode(char));\n' +
'});';
this.startedReading = false;
Transform.call(this);
};
util.inherits(HelloJsTransform, Transform);
HelloJsTransform.prototype._transform = function (chunk, en... | function HelloJsTransform () {
if (!(this instanceof HelloJsTransform)) {
return new HelloJsTransform();
}
| random_line_split |
EntryWidgetPieAlertsXDR.py | import demistomock as demisto
incident = demisto.incidents()
data = {
"Type": 17,
"ContentsFormat": "pie",
"Contents": {
"stats": [
{
"data": [ | "name": "high",
"label": "incident.severity.high",
"color": "rgb(255, 23, 68)"
},
{
"data": [
int(incident[0].get('CustomFields', {}).get('xdrmediumseverityalertcount', 0))
],
"gro... | int(incident[0].get('CustomFields', {}).get('xdrhighseverityalertcount', 0))
],
"groups": None, | random_line_split |
power.model.ts | export class Power{
public id:string;
public code:string;
public url:string;
public title:string;
public explain:string;
public menuId:string;
public type:string;
public isValid:boolean;
public isChecked:boolean=false;
public operation:Array<string>=new Array<string>();
pub... | this.name=name;
this.isLeaf=isLeaf;
}
} | random_line_split | |
power.model.ts | export class Power{
public id:string;
public code:string;
public url:string;
public title:string;
public explain:string;
public menuId:string;
public type:string;
public isValid:boolean;
public isChecked:boolean=false;
public operation:Array<string>=new Array<string>();
pub... | {
public id:string;
public roleName:string;
public name:string;
public desc:string;
}
export class Tree{
public id:string;
public pid:string;
public name:string;
public isLeaf:boolean;
public IsSubMenu:boolean;
public subTrees:Array<Tree>=[];
constructor(id:string,pid:string... | RoleInfo | identifier_name |
patterngenerator.py | "
Multiplicative strength of input pattern, defaulting to 1.0""")
offset = param.Number(default=0.0,softbounds=(-1.0,1.0),precedence=0.11,doc="""
Additive offset to input pattern, defaulting to 0.0""")
mask = param.Parameter(default=None,precedence=-1,doc="""
Optional object (expected ... |
image = raster(data, bounds=self.bounds,
**dict(group=self.group,
label=self.__class__.__name__, **value_dims))
# Works round a bug fixed shortly after HoloViews 1.0.0 release
return image if isinstance(coords, slice) else image.__getitem__(... | raster = RGB
data = np.dstack(self.channels().values()[1:]) | conditional_block |
patterngenerator.py | that are being sampled.
Note that the offset, timestep and time_fn only affect
patterns parameterized by time-dependent number
generators. Otherwise, the frames are generated by successive
call to the pattern which may or may not be varying (e.g to
view the patterns contained w... | size=pg.size*p.size)
for pg in generators]
image_array = p.operator.reduce(patterns)
return image_array | random_line_split | |
patterngenerator.py | mul__ (self,other): return Composite(generators=self._promote(other),operator=np.multiply)
def __mod__ (self,other): return Composite(generators=self._promote(other),operator=np.mod)
def __pow__ (self,other): return Composite(generators=self._promote(other),operator=np.power)
def __div__ (self,other): r... | """
Abstract base class for patterns supporting multiple channels natively.
"""
__abstract = True
channel_transforms = param.HookList(class_=ChannelTransform,default=[],doc="""
Optional functions to apply post processing to the set of channels.""")
def __init__(self, **params):
s... | identifier_body | |
patterngenerator.py | ,p.y,p.orientation)
fn_result = self.function(p)
self._apply_mask(p,fn_result)
if p.scale != 1.0:
result = p.scale * fn_result
else:
result = fn_result
if p.offset != 0.0:
result += p.offset
for of in p.output_fns:
of(resul... | __rsub__ | identifier_name | |
polls.py | from faker import Faker
from machina.core.db.models import get_model
from machina.test.factories.auth import UserFactory
from machina.test.factories.conversation import TopicFactory
faker = Faker()
TopicPoll = get_model('forum_polls', 'TopicPoll')
TopicPollOption = get_model('forum_polls', 'TopicPollOption')
TopicP... | import factory
import factory.django | random_line_split | |
polls.py | import factory
import factory.django
from faker import Faker
from machina.core.db.models import get_model
from machina.test.factories.auth import UserFactory
from machina.test.factories.conversation import TopicFactory
faker = Faker()
TopicPoll = get_model('forum_polls', 'TopicPoll')
TopicPollOption = get_model('fo... |
class TopicPollOptionFactory(factory.django.DjangoModelFactory):
poll = factory.SubFactory(TopicPollFactory)
text = faker.text(max_nb_chars=100)
class Meta:
model = TopicPollOption
class TopicPollVoteFactory(factory.django.DjangoModelFactory):
poll_option = factory.SubFactory(TopicPollOpti... | model = TopicPoll | identifier_body |
polls.py | import factory
import factory.django
from faker import Faker
from machina.core.db.models import get_model
from machina.test.factories.auth import UserFactory
from machina.test.factories.conversation import TopicFactory
faker = Faker()
TopicPoll = get_model('forum_polls', 'TopicPoll')
TopicPollOption = get_model('fo... | :
model = TopicPollVote
| Meta | identifier_name |
log-knows-the-names-of-variants.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 ... | assert_eq!(~"d", fmt!("%?", d));
} | random_line_split | |
log-knows-the-names-of-variants.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 ... | {
assert_eq!(~"a(22)", fmt!("%?", a(22u)));
assert_eq!(~"b(~\"hi\")", fmt!("%?", b(~"hi")));
assert_eq!(~"c", fmt!("%?", c));
assert_eq!(~"d", fmt!("%?", d));
} | identifier_body | |
log-knows-the-names-of-variants.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 ... | {
a(uint),
b(~str),
c,
}
enum bar {
d, e, f
}
pub fn main() {
assert_eq!(~"a(22)", fmt!("%?", a(22u)));
assert_eq!(~"b(~\"hi\")", fmt!("%?", b(~"hi")));
assert_eq!(~"c", fmt!("%?", c));
assert_eq!(~"d", fmt!("%?", d));
}
| foo | identifier_name |
test_naive_completion.py | from __future__ import unicode_literals
import pytest
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
@pytest.fixture
def completer():
import mycli.sqlcompleter as sqlcompleter
return sqlcompleter.SQLCompleter(smart_completion=False)
@pytest.fixture
def complete_e... | (completer, complete_event):
text = 'SELECT MA'
position = len('SELECT MA')
result = set(completer.get_completions(
Document(text=text, cursor_position=position),
complete_event))
assert result == set([
Completion(text='MAX', start_position=-2),
Completion(text='MASTER', ... | test_function_name_completion | identifier_name |
test_naive_completion.py | from __future__ import unicode_literals
import pytest
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
@pytest.fixture
def completer():
import mycli.sqlcompleter as sqlcompleter
return sqlcompleter.SQLCompleter(smart_completion=False)
@pytest.fixture
def complete_e... | Completion(text='MAX', start_position=-2),
Completion(text='MASTER', start_position=-2)])
def test_column_name_completion(completer, complete_event):
text = 'SELECT FROM users'
position = len('SELECT ')
result = set(completer.get_completions(
Document(text=text, cursor_position=pos... | Document(text=text, cursor_position=position),
complete_event))
assert result == set([ | random_line_split |
test_naive_completion.py | from __future__ import unicode_literals
import pytest
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
@pytest.fixture
def completer():
import mycli.sqlcompleter as sqlcompleter
return sqlcompleter.SQLCompleter(smart_completion=False)
@pytest.fixture
def complete_e... |
def test_function_name_completion(completer, complete_event):
text = 'SELECT MA'
position = len('SELECT MA')
result = set(completer.get_completions(
Document(text=text, cursor_position=position),
complete_event))
assert result == set([
Completion(text='MAX', start_position=-2),... | text = 'SEL'
position = len('SEL')
result = set(completer.get_completions(
Document(text=text, cursor_position=position),
complete_event))
assert result == set([Completion(text='SELECT', start_position=-3)]) | identifier_body |
borrowck-field-sensitivity.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 ... | drop(x.b);
drop(x.b); //~ ERROR use of moved value: `x.b`
}
fn move_after_fu_move() {
let x = A { a: 1, b: box 2 };
let _y = A { a: 3, .. x };
drop(x.b); //~ ERROR use of moved value: `x.b`
}
fn fu_move_after_move() {
let x = A { a: 1, b: box 2 };
drop(x.b);
let _z = A { a: 3, .. x }... | fn move_after_move() {
let x = A { a: 1, b: box 2 }; | random_line_split |
borrowck-field-sensitivity.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 ... | () {
let x = A { a: 1, b: box 2 };
drop(x.b);
let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b`
}
fn fu_move_after_fu_move() {
let x = A { a: 1, b: box 2 };
let _y = A { a: 3, .. x };
let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b`
}
// The following functions are... | fu_move_after_move | identifier_name |
borrowck-field-sensitivity.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn move_after_borrow() {
let x = A { a: 1, b: box 2 };
let p = &x.b;
drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
drop(**p);
}
fn fu_move_after_borrow() {
let x = A { a: 1, b: box 2 };
let p = &x.b;
let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` beca... | {
let x = A { a: 1, b: box 2 };
let _y = A { a: 3, .. x };
let p = &x.b; //~ ERROR use of moved value: `x.b`
drop(**p);
} | identifier_body |
mixer.js | /*
* Copyright © 2020 Luciano Iam <oss@lucianoiam.com>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* Thi... | return false;
}
}
|
if (node.startsWith('strip')) {
if (node == StateNode.STRIP_DESCRIPTION) {
this._strips[addr] = new Strip(this, addr, val);
this.notifyPropertyChanged('strips');
return true;
} else {
const stripAddr = [addr[0]];
if (stripAddr in this._strips) {
return this._strips[stripAddr].... | identifier_body |
mixer.js | /*
* Copyright © 2020 Luciano Iam <oss@lucianoiam.com>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* Thi... | else {
const stripAddr = [addr[0]];
if (stripAddr in this._strips) {
return this._strips[stripAddr].handle(node, addr, val);
}
}
} else {
// all initial strip description messages have been received at this point
if (!this._ready) {
this.updateLocal('ready', true);
// passth... |
this._strips[addr] = new Strip(this, addr, val);
this.notifyPropertyChanged('strips');
return true;
} | conditional_block |
mixer.js | /*
* Copyright © 2020 Luciano Iam <oss@lucianoiam.com>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* Thi... | constructor (parent) {
super(parent);
this._strips = {};
this._ready = false;
}
get ready () {
return this._ready;
}
get strips () {
return Object.values(this._strips);
}
getStripByName (name) {
name = name.trim().toLowerCase();
return this.strips.find(strip => strip.name.trim().toLowerCase() ==... | export default class Mixer extends ChildComponent {
| random_line_split |
mixer.js | /*
* Copyright © 2020 Luciano Iam <oss@lucianoiam.com>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* Thi... | () {
return this._ready;
}
get strips () {
return Object.values(this._strips);
}
getStripByName (name) {
name = name.trim().toLowerCase();
return this.strips.find(strip => strip.name.trim().toLowerCase() == name);
}
handle (node, addr, val) {
if (node.startsWith('strip')) {
if (node == StateNod... | eady | identifier_name |
ember-cli-build-options.js | 'use strict';
/**
* Configuration options for Ember CLI App used to manage broccoli build tree for DataHub web.
* Returns a method to import build dependencies and an options
* object with configuration attributes
*
* @param {string} env current build application environment
* @returns { options: object }
*/
m... | css: '/assets/vendor.css',
js: '/assets/vendor.js'
}
},
svgJar: {
sourceDirs: ['public/assets/images/svgs']
},
// Configuration options specifying inclusion of Mirage addon files in the application tree
'mirage-from-addon': {
includeAll: true,
... | random_line_split | |
cros_test_lib.py | % (exc_val,))
stdout = self.GetStdout()
if stdout:
print('Captured stdout was:\n%s' % stdout)
else:
print('No captured stdout')
stderr = self.GetStderr()
if stderr:
print('Captured stderr was:\n%s' % stderr)
else:
print('No captured stderr')
def St... | If |invert| is true, then assert the line is NOT found.
| random_line_split | |
cros_test_lib.py | ])
result = self._ContainsMsgLine(lines, check_msg_func)
# Some extra logic to make an error message useful.
output_desc = self._GenOutputDescription(check_stdout, check_stderr)
msg = ('expected %s to end with %s,\nbut did not find it in:\n%s' %
(output_desc, check_msg_func.description, li... | main | identifier_name | |
cros_test_lib.py |
normalized.add(norm)
expected = _FlattenStructure('', dir_struct)
_VerifyDirectoryIterables(normalized, expected)
def _walk_mro_stacking(obj, attr, reverse=False):
iterator = iter if reverse else reversed
methods = (getattr(x, attr, None) for x in iterator(obj.__class__.__mro__))
seen = set()
for x ... | raise AssertionError('Duplicate entry %r found in %r!' % (norm, tarball)) | conditional_block | |
cros_test_lib.py | (stderr_lines[-1])
result = self._ContainsMsgLine(lines, check_msg_func)
# Some extra logic to make an error message useful.
output_desc = self._GenOutputDescription(check_stdout, check_stderr)
msg = ('expected %s to end with %s,\nbut did not find it in:\n%s' %
(output_desc, check_msg_func... | """Temporarily disable chromite logging."""
backup = cros_build_lib.logger.disabled
try:
cros_build_lib.logger.disabled = True
yield
finally:
cros_build_lib.logger.disabled = backup | identifier_body | |
de-LI.js | /*!
* numbro.js language configuration
* language : German
* locale: Liechtenstein
* author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky)
*/
(function () {
'use strict';
var language = {
langLocaleCode: 'de-LI',
cultureCode: 'de-LI... | },
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function () {
return '.';
},
currency: {
symbol: 'CHF',
position: 'postfix',
code: 'CHF... | thousands: '\'',
decimal: '.' | random_line_split |
de-LI.js | /*!
* numbro.js language configuration
* language : German
* locale: Liechtenstein
* author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky)
*/
(function () {
'use strict';
var language = {
langLocaleCode: 'de-LI',
cultureCode: 'de-LI... |
// Browser
if (typeof window !== 'undefined' && window.numbro && window.numbro.culture) {
window.numbro.culture(language.cultureCode, language);
}
}.call(typeof window === 'undefined' ? this : window));
| {
module.exports = language;
} | conditional_block |
linux_base.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 ... | }
}
| {
TargetOptions {
linker: "cc".to_string(),
dynamic_linking: true,
executables: true,
morestack: true,
linker_is_gnu: true,
has_rpath: true,
pre_link_args: vec![
// We want to be able to strip as much executable code as possible
// from... | identifier_body |
linux_base.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 ... | ],
position_independent_executables: true,
.. Default::default()
}
} | random_line_split | |
linux_base.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 ... | () -> TargetOptions {
TargetOptions {
linker: "cc".to_string(),
dynamic_linking: true,
executables: true,
morestack: true,
linker_is_gnu: true,
has_rpath: true,
pre_link_args: vec![
// We want to be able to strip as much executable code as possible... | opts | identifier_name |
RiskScatterPanel.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | FigureCanvasWxAgg as FigCanvas, \
NavigationToolbar2WxAgg as NavigationToolbar
def riskColourCode(riskScore):
if (riskScore <= 1):
return '#fef2ec'
elif (riskScore == 2):
return '#fcd9c8'
elif (riskScore == 3):
return '#f7ac91'
elif (riskScore == 4):
return '#f67e61'
elif (riskScore == 5)... | import matplotlib
matplotlib.use('WXAgg')
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import \ | random_line_split |
RiskScatterPanel.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
def onEnvironmentChange(self,evt):
envName = self.envCombo.GetStringSelection()
self.drawScatter(envName)
def on_save_plot(self, event):
fileChoices = "PNG (*.png)|*.png"
dlg = wx.FileDialog(self,message="Save risk scatter",defaultDir=os.getcwd(),defaultFile="scatter.png",wildcard=fileChoices... | self.axes.clear()
self.axes.grid(True)
self.axes.set_xlabel('Severity')
self.axes.set_ylabel('Likelihood')
self.axes.set_xbound(0,4)
self.axes.set_ybound(0,5)
xs,ys,cs = self.dbProxy.riskScatter(envName)
ccs = []
for c in cs:
ccs.append(riskColourCode(c))
if ((len(xs) ... | identifier_body |
RiskScatterPanel.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
elif (riskScore == 2):
return '#fcd9c8'
elif (riskScore == 3):
return '#f7ac91'
elif (riskScore == 4):
return '#f67e61'
elif (riskScore == 5):
return '#f2543d'
elif (riskScore == 6):
return '#e42626'
elif (riskScore == 7):
return '#b9051a'
elif (riskScore == 8):
return '#90001... | return '#fef2ec' | conditional_block |
RiskScatterPanel.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | (self, event):
fileChoices = "PNG (*.png)|*.png"
dlg = wx.FileDialog(self,message="Save risk scatter",defaultDir=os.getcwd(),defaultFile="scatter.png",wildcard=fileChoices,style=wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
self.canvas.print_figure(path, dpi=self.dpi)
| on_save_plot | identifier_name |
function-parsers.ts | import * as _ from "lodash";
import * as positionHelper from "./position-helper";
import { DataCell } from "./table-models";
import { Step } from "./models";
import { parseCallExpression } from "./primitive-parsers";
import {
isVariable,
parseTypeAndName,
parseVariableDeclaration,
} from "./variable-parsers";
... |
return new Step(stepContent, stepLocation);
}
| {
stepContent = parseCallExpression([firstDataCell, ...restDataCells]);
} | conditional_block |
function-parsers.ts | import * as _ from "lodash";
import * as positionHelper from "./position-helper";
import { DataCell } from "./table-models";
import { Step } from "./models";
import { parseCallExpression } from "./primitive-parsers";
import {
isVariable,
parseTypeAndName,
parseVariableDeclaration,
} from "./variable-parsers";
... | (
firstDataCell: DataCell,
restDataCells: DataCell[]
): Step {
let stepContent;
const lastCell = _.last(restDataCells) || firstDataCell;
const stepLocation = positionHelper.locationFromStartEnd(
firstDataCell.location,
lastCell.location
);
if (isVariable(firstDataCell)) {
const typeAndName =... | parseStep | identifier_name |
function-parsers.ts | import * as _ from "lodash";
import * as positionHelper from "./position-helper";
import { DataCell } from "./table-models";
import { Step } from "./models";
import { parseCallExpression } from "./primitive-parsers";
import {
isVariable,
parseTypeAndName,
parseVariableDeclaration,
} from "./variable-parsers";
... | const stepLocation = positionHelper.locationFromStartEnd(
firstDataCell.location,
lastCell.location
);
if (isVariable(firstDataCell)) {
const typeAndName = parseTypeAndName(firstDataCell);
const callExpression = parseCallExpression(restDataCells);
stepContent = parseVariableDeclaration(
... | random_line_split | |
function-parsers.ts | import * as _ from "lodash";
import * as positionHelper from "./position-helper";
import { DataCell } from "./table-models";
import { Step } from "./models";
import { parseCallExpression } from "./primitive-parsers";
import {
isVariable,
parseTypeAndName,
parseVariableDeclaration,
} from "./variable-parsers";
... | }
return new Step(stepContent, stepLocation);
}
| {
let stepContent;
const lastCell = _.last(restDataCells) || firstDataCell;
const stepLocation = positionHelper.locationFromStartEnd(
firstDataCell.location,
lastCell.location
);
if (isVariable(firstDataCell)) {
const typeAndName = parseTypeAndName(firstDataCell);
const callExpression = pars... | identifier_body |
edit.js | var edit = (function(){
// Cache DOM
var $defaultSection = $('#about_you_dashboard');
var $defaultLink = $("#user_menu li a[href='#about_you']");
var $rowSections = $('.container-fluid .hidden');
var $currentRow = $('.container-fluid .hidden' + window.location.hash + '_dashboard');
var $menuLinks = $('#user_men... | $menuLinks.on('click', toggleMenuActive);
// Functions
function showHashLocation() {
if(window.location.hash == '') {
$defaultSection.removeClass('hidden');
$($defaultLink).parent().addClass('active');
} else {
$currentRow.removeClass('hidden');
$($hashLink).parent().addClass('active... | // Bind Events | random_line_split |
edit.js | var edit = (function(){
// Cache DOM
var $defaultSection = $('#about_you_dashboard');
var $defaultLink = $("#user_menu li a[href='#about_you']");
var $rowSections = $('.container-fluid .hidden');
var $currentRow = $('.container-fluid .hidden' + window.location.hash + '_dashboard');
var $menuLinks = $('#user_men... |
}
function toggleMenuActive() {
$menuLinks.parent().removeClass('active');
$rowSections.addClass('hidden');
$(this).parent().addClass('active');
$('.container-fluid' + this.hash + '_dashboard').removeClass('hidden');
}
showHashLocation();
return{};
})(); | {
$currentRow.removeClass('hidden');
$($hashLink).parent().addClass('active');
} | conditional_block |
edit.js | var edit = (function(){
// Cache DOM
var $defaultSection = $('#about_you_dashboard');
var $defaultLink = $("#user_menu li a[href='#about_you']");
var $rowSections = $('.container-fluid .hidden');
var $currentRow = $('.container-fluid .hidden' + window.location.hash + '_dashboard');
var $menuLinks = $('#user_men... |
function toggleMenuActive() {
$menuLinks.parent().removeClass('active');
$rowSections.addClass('hidden');
$(this).parent().addClass('active');
$('.container-fluid' + this.hash + '_dashboard').removeClass('hidden');
}
showHashLocation();
return{};
})(); | {
if(window.location.hash == '') {
$defaultSection.removeClass('hidden');
$($defaultLink).parent().addClass('active');
} else {
$currentRow.removeClass('hidden');
$($hashLink).parent().addClass('active');
}
} | identifier_body |
edit.js | var edit = (function(){
// Cache DOM
var $defaultSection = $('#about_you_dashboard');
var $defaultLink = $("#user_menu li a[href='#about_you']");
var $rowSections = $('.container-fluid .hidden');
var $currentRow = $('.container-fluid .hidden' + window.location.hash + '_dashboard');
var $menuLinks = $('#user_men... | () {
if(window.location.hash == '') {
$defaultSection.removeClass('hidden');
$($defaultLink).parent().addClass('active');
} else {
$currentRow.removeClass('hidden');
$($hashLink).parent().addClass('active');
}
}
function toggleMenuActive() {
$menuLinks.parent().removeClass(... | showHashLocation | identifier_name |
mail_mail.py | notification
# and during unlink() we will not cascade delete the parent and its attachments
'notification': fields.boolean('Is Notification')
}
def _get_default_from(self, cr, uid, context=None):
this = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if this.a... | """ Return a dictionary for specific email values, depending on a
partner, or generic to the whole recipients given by mail.email_to.
:param browse_record mail: mail.mail browse_record
:param browse_record partner: specific recipient partner
"""
body = self.send_get_... | identifier_body | |
mail_mail.py | # published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.... | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as | random_line_split | |
mail_mail.py | ('sent', 'Sent'),
('received', 'Received'),
('exception', 'Delivery Failed'),
('cancel', 'Cancelled'),
], 'Status', readonly=True),
'auto_delete': fields.boolean('Auto Delete',
help="Permanently delete this email after sending it, to save space"),
... | (self, cr, uid, mail, partner=None, context=None):
""" Return a specific ir_email body. The main purpose of this method
is to be inherited by Portal, to add a link for signing in, in
each notification email a partner receives.
:param browse_record mail: mail.mail browse_reco... | send_get_mail_body | identifier_name |
mail_mail.py | ('sent', 'Sent'),
('received', 'Received'),
('exception', 'Delivery Failed'),
('cancel', 'Cancelled'),
], 'Status', readonly=True),
'auto_delete': fields.boolean('Auto Delete',
help="Permanently delete this email after sending it, to save space"),
... |
elif this.email:
return this.email
raise osv.except_osv(_('Invalid Action!'), _("Unable to send email, please configure the sender's email address or alias."))
_defaults = {
'state': 'outgoing',
'email_from': lambda self, cr, uid, ctx=None: self._get_default_from(cr, ui... | return '%s@%s' % (this.alias_name, this.alias_domain) | conditional_block |
course.ts | import { Request, Response, Router } from 'express';
import Parameter = require('pinput');
import { SuccessResponse } from '../../../common/responses';
import EquivalencyDao from '../../../queries/EquivalencyDao';
import { numberParam, subjectParam } from '../../params';
import RouteModule from '../../RouteModule';
im... | return true;
};
const institutionsParam = (req: Request) =>
new Parameter({
name: 'institutions',
rawInput: req.params.institutions,
validate: validateInstitutions,
preprocess: (inst) => inst.toUpperCase(),
array: true
});
... | random_line_split | |
backend.rs | use std::env;
use dotenv::dotenv;
use diesel;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use super::models::*;
use ::services::schema;
pub struct Backend {
connection: PgConnection
}
impl Backend {
pub fn new() -> Self {
dotenv().ok();
let database_url = env::var("DATABASE_URL")
... |
}
| {
use self::schema::voteables::dsl::*;
let entity = &entity.to_lowercase();
let mut res = voteables.filter(value.eq(entity))
.load(&self.connection).unwrap();
match res.len() {
0 => None,
_ => Some(res.pop().unwrap()),
}
... | identifier_body |
backend.rs | use std::env;
use dotenv::dotenv;
use diesel;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use super::models::*;
use ::services::schema;
pub struct Backend {
connection: PgConnection
}
impl Backend {
pub fn new() -> Self {
dotenv().ok();
let database_url = env::var("DATABASE_URL")
... | (&self, user: &str, entity: &str, up: i32, down: i32) {
use self::schema::{users, voteables, votes};
let entity = &entity.to_lowercase();
use self::schema::users::dsl as us;
let mut res: Vec<User> = us::users.filter(us::user_id.eq(user))
.load(... | vote | identifier_name |
backend.rs | use std::env;
use dotenv::dotenv;
use diesel;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use super::models::*;
use ::services::schema;
pub struct Backend {
connection: PgConnection
}
impl Backend {
pub fn new() -> Self {
dotenv().ok();
let database_url = env::var("DATABASE_URL")
... | voteable.save_changes::<Voteable>(&self.connection);
use ::services::schema::votes::dsl as vts;
let mut res: Vec<Vote> = vts::votes.filter(vts::user_id.eq(user.id))
.filter(vts::voteable_id.eq(voteable.id))
.l... | voteable.total_down += down; | random_line_split |
test_kms.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | agent_test.main() | conditional_block | |
test_kms.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | '',
'enableProxy[comment]=Use a HTTP Proxy',
'enableProxy=0',
'',
'serverURL[comment]=Remote server URL',
'serverURL=https://proxy1.example.com/XMLRPC;'
'https://proxy2.example.com/XMLRPC;',
'',
'proxyPasswor... | """Test updating up2date config for Red Hat"""
outfiles = commands.redhat.kms.configure_up2date([
'proxy1.example.com', 'proxy2.example.com'])
self.assertEqual(outfiles['/etc/sysconfig/rhn/up2date'], '\n'.join([
'# Automatically generated Red Hat Update Agent config file, '
... | identifier_body |
test_kms.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | (self):
"""Test updating up2date config for Red Hat"""
outfiles = commands.redhat.kms.configure_up2date([
'proxy1.example.com', 'proxy2.example.com'])
self.assertEqual(outfiles['/etc/sysconfig/rhn/up2date'], '\n'.join([
'# Automatically generated Red Hat Update Agent conf... | test_redhat_up2date | identifier_name |
test_kms.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | 'httpProxy[comment]=HTTP proxy in host:port format, e.g. '
'squid.redhat.com:3128',
'httpProxy=',
'',
'systemIdPath[comment]=Location of system id',
'systemIdPath=/etc/sysconfig/rhn/systemid',
'',
'noReboot[comment]=Disa... | random_line_split | |
TrainAlchemy1.js | Lexicon.add('dregus/alchemist/TrainAlchemy1', { | ],
lost: [
{ currency:true, count:100 },
],
links: [
{ name:'Complete', action:'event:complete' },
],
body:[
{ tag:"p", text:"Proctor motions for you to follow him upstairs into the tower, and after a lengthy climb you "+
"reach a small but well stocked laboratory. There you and the... |
layout: 'event',
gained: [
{ skill:'alchemy' }, | random_line_split |
selector_parser.rs | state:tt, $flags:tt),)*],
string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => {
#[doc = "Our representation of a non tree-structural pseudo-class."]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NonTSPseudoClass {
$(
#[do... |
true
}
}
impl NonTSPseudoClass {
/// A pseudo-class is internal if it can only be used inside
/// user agent style sheets.
pub fn is_internal(&self) -> bool {
macro_rules! check_flag {
(_) => (false);
($flags:expr) => ($flags.contains(PSEUDO_CLASS_INTERNAL));
... | {
for selector in selectors.iter() {
if !selector.visit(visitor) {
return false;
}
}
} | conditional_block |
selector_parser.rs | state:tt, $flags:tt),)*],
string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => {
#[doc = "Our representation of a non tree-structural pseudo-class."]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NonTSPseudoClass {
$(
#[do... | (&self) -> bool {
matches!(*self, NonTSPseudoClass::Hover |
NonTSPseudoClass::Active |
NonTSPseudoClass::Focus)
}
/// Get the state flag associated with a pseudo-class, if any.
pub fn state_flag(&self) -> ElementState {
macro_rules! flag {
... | is_safe_user_action_state | identifier_name |
selector_parser.rs | state:tt, $flags:tt),)*],
string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => {
#[doc = "Our representation of a non tree-structural pseudo-class."]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NonTSPseudoClass {
$(
#[do... |
/// Get the state flag associated with a pseudo-class, if any.
pub fn state_flag(&self) -> ElementState {
macro_rules! flag {
(_) => (ElementState::empty());
($state:ident) => (::element_state::$state);
}
macro_rules! pseudo_class_state {
(bare: [$((... | {
matches!(*self, NonTSPseudoClass::Hover |
NonTSPseudoClass::Active |
NonTSPseudoClass::Focus)
} | identifier_body |
selector_parser.rs | , $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => {
#[doc = "Our representation of a non tree-structural pseudo-class."]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NonTSPseudoClass {
$(
#[doc = $css]
$name,
)*
$(
... | (bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*],
string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => { | random_line_split | |
auth.js | /*!
* jixiu-h5 Javascript Library
* weiyining - v1.0.0 (2016)
* https://www.jixiuapp.com/ | Released under MIT license
*/
import UserService from '../service/user';
/**
* 验证组件,检测当前用户是否登陆,如没有登陆就跳转到登陆页
* @function Auth
* @author seven
* @version 1.0
*/
const Auth = (nextState, replace, callback) =>
{
if(... | }
if(callback)
{
callback();
}
};
ex
port default Auth; | sult = api.activation();
if(userResult==null)
{
replace({
pathname:`/${nextState.params.app}/login`,
state: {nextPathname: nextState.location.pathname}
});
}
//api.activation().then(r=>
//{
// if(r==null)
... | conditional_block |
auth.js | /*!
* jixiu-h5 Javascript Library
* weiyining - v1.0.0 (2016)
* https://www.jixiuapp.com/ | Released under MIT license
*/
import UserService from '../service/user';
| * @function Auth
* @author seven
* @version 1.0
*/
const Auth = (nextState, replace, callback) =>
{
if(!UserService.IsAuthenticated())
{
var api = new UserService();
let userResult = api.activation();
if(userResult==null)
{
replace({
pathname:`... | /**
* 验证组件,检测当前用户是否登陆,如没有登陆就跳转到登陆页 | random_line_split |
overloaded-index-in-field.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 ... | else {
&self.y
}
}
}
trait Int {
fn get(self) -> isize;
fn get_from_ref(&self) -> isize;
fn inc(&mut self);
}
impl Int for isize {
fn get(self) -> isize { self }
fn get_from_ref(&self) -> isize { *self }
fn inc(&mut self) { *self += 1; }
}
fn main() {
let f = Bar ... | {
&self.x
} | conditional_block |
overloaded-index-in-field.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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test using ov... | random_line_split | |
overloaded-index-in-field.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 ... | {
x: isize,
y: isize,
}
struct Bar {
foo: Foo
}
impl Index<isize> for Foo {
type Output = isize;
fn index(&self, z: isize) -> &isize {
if z == 0 {
&self.x
} else {
&self.y
}
}
}
trait Int {
fn get(self) -> isize;
fn get_from_ref(&self)... | Foo | identifier_name |
overloaded-index-in-field.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 Int {
fn get(self) -> isize;
fn get_from_ref(&self) -> isize;
fn inc(&mut self);
}
impl Int for isize {
fn get(self) -> isize { self }
fn get_from_ref(&self) -> isize { *self }
fn inc(&mut self) { *self += 1; }
}
fn main() {
let f = Bar { foo: Foo {
x: 1,
y: 2,
... | {
if z == 0 {
&self.x
} else {
&self.y
}
} | identifier_body |
server.js | var fs = require("fs");
var express = require("express"),
optimist = require("optimist"),
gitstatic = require("../");
var argv = optimist.usage("Usage: $0")
.options("h", {
alias: "help",
describe: "display this help text"
})
.options("repository", {
default: ".git",
descri... | var server = express();
server.get(/^\/.*/, gitstatic.route()
.repository(argv.repository));
server.listen(argv.port); | try { var stats = fs.statSync(argv.repository); } catch (e) { throw "Error: " + e.message; }
if (!stats.isDirectory()) throw "Error: invalid --repository directory.";
})
.argv;
| random_line_split |
associated-types-normalize-in-bounds-ufcs.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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we nor... | // | random_line_split |
associated-types-normalize-in-bounds-ufcs.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 ... | () { }
| main | identifier_name |
progress.service.ts | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ProgressService {
private progress: number = 0;
private _total: number = 0;
set total(t: number) {
this._total = t;
}
get percentValue(): number {
let p: number = Math.floor((this.progress / this._total) *... | () { }
addToProgress(n: number) {
if (n < 0 || isNaN(n) || n === Infinity) {
n = 0;
}
this.progress += n;
}
updateProgress(n: number) {
if (n < 0 || isNaN(n) || n === Infinity) {
n = 0
} else if (n > 100) {
n = 100
}
this.progress = n;
}
isComplete(): boolean... | constructor | identifier_name |
progress.service.ts | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ProgressService {
private progress: number = 0;
private _total: number = 0;
set total(t: number) {
this._total = t;
}
get percentValue(): number {
let p: number = Math.floor((this.progress / this._total) *... |
return false;
}
} | {
return true;
} | conditional_block |
progress.service.ts | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ProgressService {
private progress: number = 0;
private _total: number = 0;
set total(t: number) {
this._total = t;
}
get percentValue(): number {
let p: number = Math.floor((this.progress / this._total) *... |
} | {
if (this.progress >= this._total && this.progress > 0 && this._total > 0) {
return true;
}
return false;
} | identifier_body |
progress.service.ts | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ProgressService {
private progress: number = 0;
private _total: number = 0;
set total(t: number) {
this._total = t;
}
get percentValue(): number {
let p: number = Math.floor((this.progress / this._total) *... | if (n < 0 || isNaN(n) || n === Infinity) {
n = 0
} else if (n > 100) {
n = 100
}
this.progress = n;
}
isComplete(): boolean {
if (this.progress >= this._total && this.progress > 0 && this._total > 0) {
return true;
}
return false;
}
} | random_line_split | |
index.tsx | import React, { Component } from 'react'
import { ActivityIndicator, View } from 'react-native'
import { decode } from 'he'
import styled from 'styled-components/native'
import Image from 'react-native-fast-image'
import TruncatedHTML from '../TruncatedHTML'
import BlockItemIcon from '../BlockItemIcon'
import { Touchab... | const Metadata = styled.View<IMetadataProps>`
height: ${BLOCK_METADATA_HEIGHT};
padding-top: ${Units.scale[2]};
`
const MetadataTitle = styled.View`
flex-direction: row;
align-items: center;
justify-content: center;
`
interface ITitleProps {
size: TBlockItemSize
}
const Title = styled(StyledText)<ITitleP... |
interface IMetadataProps {
size: TBlockItemSize
}
| random_line_split |
urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# myapp.urls
##
##
# Copyright (C) $YEAR$, $AUTHOR_NAME$ <$AUTHOR_EMAIL$>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of version 3 of the GNU Affero General Public License as
# published by the Free Software Found... | # You should have received a copy of the GNU General Public License along
# with this source code; if not, see <http://www.gnu.org/licenses/>,
# or write to
#
# Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301 USA
##
##
# End of File
## | # GNU Affero General Public License for more details.
# | random_line_split |
vue-form.js | import Vue from 'vue';
import VueForm from 'vue-form';
Vue.use(VueForm, {
validators: {
'step': function(value, stepValue) {
return stepValue === `any` || Number(value) % Number(stepValue) === 0;
},
'data-exclusive-minimum': function(value, exclusiveMinimum) {
return Number(value) > Number(ex... |
if (Number.isNaN(range[0]) || Number.isNaN(range[1])) {
// let number validator handle this
return true;
}
return range[0] <= range[1];
},
'categories-not-empty': function(categories) {
return categories.length > 0;
},
'complete-dimensions': function(dimensions... | {
// let complete-range validator handle this
return true;
} | conditional_block |
vue-form.js | import Vue from 'vue';
import VueForm from 'vue-form';
Vue.use(VueForm, {
validators: {
'step': function(value, stepValue) {
return stepValue === `any` || Number(value) % Number(stepValue) === 0;
},
'data-exclusive-minimum': function(value, exclusiveMinimum) {
return Number(value) > Number(ex... | maxSize *= 1000 * 1000;
}
else if (attributeValue.includes(`k`)) {
maxSize *= 1000;
}
return file.size <= maxSize;
}
return true;
},
},
}); | if (typeof file === `object`) {
let maxSize = Number.parseInt(attributeValue, 10);
if (attributeValue.includes(`M`)) { | random_line_split |
layout.ts | /**
* @license
* Copyright 2020 Google LLC
*
* 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 o... | GeneratedTextModule,
AnnotatedTextGoldModule,
AnnotatedTextModule,
GeneratedImageModule,
];
const DEFAULT_MAIN_GROUP: LitModuleType[] = [
DataTableModule,
DatapointEditorModule,
SliceModule,
ColorModule,
];
// clang-format on
// clang-format off
/**
* Possible layouts for LIT (component groups and se... | random_line_split | |
custom-typings.d.ts | /*
* Custom Type Definitions
* When including 3rd party modules you also need to include the type definition for the module
* if they don't provide one within the module. You can try to install it with typings
typings install node --save
* If you can't find the type definition in the registry we can make an ambie... | start: number;
length: number;
time: number;
results: Result[];
}
export interface Result {
title: string;
kwic: string;
content: string;
url: string;
iurl: string;
author: string;
date: number;
domain: string;
news: boolean;
n... | suggestions: any[];
count: number; | random_line_split |
middleware.ts | import * as path from 'path';
import * as vfs from 'vinyl-fs';
import * as sourcemaps from 'gulp-sourcemaps';
import * as plumber from 'gulp-plumber';
import * as postcss from 'gulp-postcss';
import * as concat from 'gulp-concat';
import * as tap from 'gulp-tap';
import * as gulpif from 'gulp-if';
const ERROR_PREFIX =... |
return next(err);
})
.pipe(plumber({ errorHandler: err => next(err) }))
.pipe(gulpif(options.inlineSourcemaps, sourcemaps.init()))
.pipe(postcss(options.plugins, options.options))
.pipe(concat('.css'))
.pipe(gulpif(options.inlineSourcemaps, sourcemaps.write()))
.pipe(tap(file => {
isFile... | {
return next();
} | conditional_block |
middleware.ts | import * as path from 'path';
import * as vfs from 'vinyl-fs';
import * as sourcemaps from 'gulp-sourcemaps';
import * as plumber from 'gulp-plumber';
import * as postcss from 'gulp-postcss';
import * as concat from 'gulp-concat';
import * as tap from 'gulp-tap';
import * as gulpif from 'gulp-if';
const ERROR_PREFIX =... | return next();
}
return next(err);
})
.pipe(plumber({ errorHandler: err => next(err) }))
.pipe(gulpif(options.inlineSourcemaps, sourcemaps.init()))
.pipe(postcss(options.plugins, options.options))
.pipe(concat('.css'))
.pipe(gulpif(options.inlineSourcemaps, sourcemaps.write()))
.pipe... | .on('error', err => {
if (err.message.match(/File not found/i)) { | random_line_split |
middleware.ts | import * as path from 'path';
import * as vfs from 'vinyl-fs';
import * as sourcemaps from 'gulp-sourcemaps';
import * as plumber from 'gulp-plumber';
import * as postcss from 'gulp-postcss';
import * as concat from 'gulp-concat';
import * as tap from 'gulp-tap';
import * as gulpif from 'gulp-if';
const ERROR_PREFIX =... | return (req, res, next: Function) => {
if (req.method !== 'GET' && req.method !== 'HEAD') {
next();
return;
}
const globs = src(req);
if (typeof globs !== 'string' && !Array.isArray(globs)) {
next(new TypeError(`${ERROR_PREFIX} src callback must return a glob string or array`));
return;
}
let... | {
if (!options.plugins) {
throw new Error(`${ERROR_PREFIX} missing required option: plugins`);
}
if (!Array.isArray(options.plugins)) {
throw new TypeError(`${ERROR_PREFIX} plugins option must be an array`);
}
if (options.src && typeof options.src !== 'function') {
throw new TypeError(`${ERROR_PREFIX} src... | identifier_body |
middleware.ts | import * as path from 'path';
import * as vfs from 'vinyl-fs';
import * as sourcemaps from 'gulp-sourcemaps';
import * as plumber from 'gulp-plumber';
import * as postcss from 'gulp-postcss';
import * as concat from 'gulp-concat';
import * as tap from 'gulp-tap';
import * as gulpif from 'gulp-if';
const ERROR_PREFIX =... | (options: PostCssMiddleware.Options = <any>{}) {
if (!options.plugins) {
throw new Error(`${ERROR_PREFIX} missing required option: plugins`);
}
if (!Array.isArray(options.plugins)) {
throw new TypeError(`${ERROR_PREFIX} plugins option must be an array`);
}
if (options.src && typeof options.src !== 'function... | PostCssMiddleware | identifier_name |
environment.js | var fs = null;
function showWarning(resolution, APISupport) | $('section#warning').show();
}
}
function setupEnvironment() {
// check resolution
if(screen.width<1280 || screen.height < 768) {
showWarning(true, false);
}
// setup file system
try {
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSys... | {
// set up text according to actual issue
if(resolution && APISupport) {
$('section#warning').html('\
<h1>Oops</h1>\
<p>In order to take advantage of framing app, you need to have a resolution of at least 1280x768px</p>\
<p>You also have to use a browser supporting t... | identifier_body |
environment.js | var fs = null;
function showWarning(resolution, APISupport) {
// set up text according to actual issue
if(resolution && APISupport) {
$('section#warning').html('\
<h1>Oops</h1>\
<p>In order to take advantage of framing app, you need to have a resolution of at least 1280x768px</p... | () {
// check resolution
if(screen.width<1280 || screen.height < 768) {
showWarning(true, false);
}
// setup file system
try {
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder;... | setupEnvironment | identifier_name |
environment.js | var fs = null;
function showWarning(resolution, APISupport) {
// set up text according to actual issue
if(resolution && APISupport) | else if(resolution) {
$('section#warning').html('\
<h1>Oops</h1>\
<p>In order to take advantage of framing app, you need to have a resolution of at least 1280x768px</p>');
} else if (APISupport) {
$('section#warning').html('\
<h1>Oops</h1>\
<p>In orde... | {
$('section#warning').html('\
<h1>Oops</h1>\
<p>In order to take advantage of framing app, you need to have a resolution of at least 1280x768px</p>\
<p>You also have to use a browser supporting the HTML5 FileSystem & FileWriter API.</p>\
<p>In plain english: Goog... | conditional_block |
environment.js | var fs = null;
| <p>In order to take advantage of framing app, you need to have a resolution of at least 1280x768px</p>\
<p>You also have to use a browser supporting the HTML5 FileSystem & FileWriter API.</p>\
<p>In plain english: Google Chrome (at least version 13.0) </p>');
} else if(resolution... | function showWarning(resolution, APISupport) {
// set up text according to actual issue
if(resolution && APISupport) {
$('section#warning').html('\
<h1>Oops</h1>\ | random_line_split |
BaseController.ts | /**
* BaseController
*
* Classe abstrata com as funções comuns a todos os controllers
*
* @author Henrique de Castro | */
import * as express from 'express';
export class BaseController {
/**
* showSuccess
*
* Exibe um retorno de sucesso
*
* @author Henrique de Castro
* @since 12/2016
* @param array
* @param object
* @return void
*/
public showSucess(data: Object, res: expr... | * @since 12/2016 | random_line_split |
BaseController.ts | /**
* BaseController
*
* Classe abstrata com as funções comuns a todos os controllers
*
* @author Henrique de Castro
* @since 12/2016
*/
import * as express from 'express';
export class BaseController {
/**
* showSuccess
*
* Exibe um retorno de sucesso
*
* @author Henrique de Castr... | }
|
// Adiciona erro nos dados
let data = {};
data['status'] = false;
data['error'] = 'Acesso negado';
// Exibe o retorno
res.statusCode = 401;
res.json(data);
}
| identifier_body |
BaseController.ts | /**
* BaseController
*
* Classe abstrata com as funções comuns a todos os controllers
*
* @author Henrique de Castro
* @since 12/2016
*/
import * as express from 'express';
export class Ba |
/**
* showSuccess
*
* Exibe um retorno de sucesso
*
* @author Henrique de Castro
* @since 12/2016
* @param array
* @param object
* @return void
*/
public showSucess(data: Object, res: express.Response) {
// Adiciona o sucesso nos dados
let ... | seController { | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.