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 |
|---|---|---|---|---|
AnnotationValuesResource.js | define(["mui"], function(){
function component($q, $resource, $stateParams, AnnotationProjectIdResource){
var _self=this;
var url="/annotations/:datasetName/annotation/:dimension/new/dataset/command/core/get-rows";
this.AnnotationValuesResource = $resource(url, {
datasetName: $stateParams.datasetId,
limit:... | component.$provider="service";
return component;
}); | };
}
component.$name="AnnotationValuesResource";
component.$inject=["$q", "$resource", "$stateParams", "AnnotationProjectIdResource"]; | random_line_split |
AnnotationValuesResource.js | define(["mui"], function(){
function component($q, $resource, $stateParams, AnnotationProjectIdResource) | }
component.$name="AnnotationValuesResource";
component.$inject=["$q", "$resource", "$stateParams", "AnnotationProjectIdResource"];
component.$provider="service";
return component;
}); | {
var _self=this;
var url="/annotations/:datasetName/annotation/:dimension/new/dataset/command/core/get-rows";
this.AnnotationValuesResource = $resource(url, {
datasetName: $stateParams.datasetId,
limit: 30000
});
//to get rows we first must chain a call to get-project-id
this.get=function(dimens... | identifier_body |
AnnotationValuesResource.js | define(["mui"], function(){
function | ($q, $resource, $stateParams, AnnotationProjectIdResource){
var _self=this;
var url="/annotations/:datasetName/annotation/:dimension/new/dataset/command/core/get-rows";
this.AnnotationValuesResource = $resource(url, {
datasetName: $stateParams.datasetId,
limit: 30000
});
//to get rows we first must... | component | identifier_name |
smtp_notification.py | import requests
import json
import time
import subprocess
import re
import os
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
from test_framework.smtp_server import SMTP_DUMPFILE
class SMTPTest(OpenBazaarTestFramework):
def __init__(self):
... | r = requests.get(api_url)
if r.status_code == 404:
raise TestFailure("SMTPTest - FAIL: Settings GET endpoint not found")
elif r.status_code != 200:
resp = json.loads(r.text)
raise TestFailure("SMTPTest - FAIL: Settings GET failed. Reason: %s", resp["reason"])
... | # check SMTP settings
api_url = alice["gateway_url"] + "ob/settings" | random_line_split |
smtp_notification.py | import requests
import json
import time
import subprocess
import re
import os
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
from test_framework.smtp_server import SMTP_DUMPFILE
class SMTPTest(OpenBazaarTestFramework):
def __init__(self):
... |
# check notifications
addr = "0.0.0.0:1024"
class_name = "test_framework.smtp_server.SMTPTestServer"
proc = subprocess.Popen(["python", "-m", "smtpd", "-n", "-c", class_name, addr])
# generate some coins and send them to bob
time.sleep(4)
api_url = bob["gateway... | resp = json.loads(r.text)
raise TestFailure("SMTPTest - FAIL: Settings GET failed. Reason: %s", resp["reason"]) | conditional_block |
smtp_notification.py | import requests
import json
import time
import subprocess
import re
import os
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
from test_framework.smtp_server import SMTP_DUMPFILE
class SMTPTest(OpenBazaarTestFramework):
| "serverAddress": "0.0.0.0:1024",
"username": "usr",
"password": "passwd",
"senderEmail": "openbazaar@test.org",
"recipientEmail": "user.openbazaar@test.org"
}
}
r = requests.post(api_url, data=json.dumps(smtp, i... | def __init__(self):
super().__init__()
self.num_nodes = 3
def run_test(self):
alice = self.nodes[1]
bob = self.nodes[2]
# post profile for alice
with open('testdata/'+ self.vendor_version +'/profile.json') as profile_file:
profile_json = json.load(profil... | identifier_body |
smtp_notification.py | import requests
import json
import time
import subprocess
import re
import os
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
from test_framework.smtp_server import SMTP_DUMPFILE
class SMTPTest(OpenBazaarTestFramework):
def | (self):
super().__init__()
self.num_nodes = 3
def run_test(self):
alice = self.nodes[1]
bob = self.nodes[2]
# post profile for alice
with open('testdata/'+ self.vendor_version +'/profile.json') as profile_file:
profile_json = json.load(profile_file, obje... | __init__ | identifier_name |
multiple_create.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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-... | """Allow multiple create in the Create Server v1.1 API."""
name = "MultipleCreate"
alias = "os-multiple-create"
namespace = ("http://docs.openstack.org/compute/ext/"
"multiplecreate/api/v1.1")
updated = "2012-08-07T00:00:00+00:00" | identifier_body | |
multiple_create.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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-... | (extensions.ExtensionDescriptor):
"""Allow multiple create in the Create Server v1.1 API."""
name = "MultipleCreate"
alias = "os-multiple-create"
namespace = ("http://docs.openstack.org/compute/ext/"
"multiplecreate/api/v1.1")
updated = "2012-08-07T00:00:00+00:00"
| Multiple_create | identifier_name |
multiple_create.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
| # not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# ... | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may | random_line_split |
freelancer.js | /*!
* Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
$('body').on('click', '.page-scroll... | }, 1200, 'easeInOutExpo');
event.preventDefault();
});
});
// Floating label headings for the contact form
$(function() {
$("body").on("input propertychange", ".floating-label-form-group", function(e) {
$(this).toggleClass("floating-label-form-group-with-value", !! $(e.target).val());
... | $('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top | random_line_split |
csharp.js | /*
* _ _ _
* | | | | | |
* | | __ _| |__ ___ ___ __ _| |_ Labcoat (R)
* | |/ _` | '_ \ / __/ _ \ / _` | __| Powerful development environment for Quirrel.
* | | (_| | |_) | (_| (_) | (_| | |_ Copyright (C) 2010 - 2013... |
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
... | {
indent += tab;
} | conditional_block |
csharp.js | /*
* _ _ _
* | | | | | |
* | | __ _| |__ ___ ___ __ _| |_ Labcoat (R)
* | |/ _` | '_ \ / __/ _ \ / _` | __| Powerful development environment for Quirrel.
* | | (_| | |_) | (_| (_) | (_| | |_ Copyright (C) 2010 - 2013... | }
if (state == "start") {
var match = line.match(/^.*[\{\(\[]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, i... | var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent; | random_line_split |
test_evalf.py | 5) == '0.841470984807897'
assert NS('cos(1)',15) == '0.540302305868140'
assert NS('sin(10**-6)',15) == '9.99999999999833e-7'
assert NS('cos(10**-6)',15) == '0.999999999999500'
assert NS('sin(E*10**100)',15) == '0.409160531722613'
# Some input near roots
assert NS(sin(exp(pi*sqrt(163))*pi), 15) =... | raises(ValueError, 'Sum(1/n, (n, 1, oo)).evalf()')
raises(ValueError, 'Sum(n/(n**2+1), (n, 1, oo)).evalf()') | random_line_split | |
test_evalf.py |
def test_evalf_powers():
assert NS('pi**(10**20)',10) == '1.339148777e+49714987269413385435'
assert NS(pi**(10**100),10) == ('4.946362032e+4971498726941338543512682882'
'9089887365167832438044244613405349992494711208'
'95526746555473864642912223')
assert NS('2**(1/10**50)',15) == '1.00... | assert NS(Add(pi,Rational(1,10**1000),-pi,evaluate=False),15,maxn=1200) == '1.00000000000000e-1000' | identifier_body | |
test_evalf.py | (-pi*sqrt(163))
B = 196884*exp(-2*pi*sqrt(163))
C = 103378831900730205293632*exp(-3*pi*sqrt(163))
assert NS(1-A-B+C,10) == '1.613679005e-59'
# Input that for various reasons have failed at some point
def test_evalf_bugs():
assert NS(sin(1)+exp(-10**10),10) == NS(sin(1),10)
assert NS(exp(10**10)+sin... | assert Add(3, 2, evaluate=no).is_Add
assert Mul(3, 2, evaluate=no).is_Mul
assert Pow(3, 2, evaluate=no).is_Pow | conditional_block | |
test_evalf.py | 999999997857'
assert NS('1+sin(2017*2**(1/5))',15) == '2.14322287389390e-17'
assert NS('45 - 613*E/37 + 35/991', 15) == '6.03764498766326e-11'
def test_evalf_ramanujan():
assert NS(exp(pi*sqrt(163)) - 640320**3 - 744, 10) == '-7.499274028e-13'
# A related identity
A = 262537412640768744*exp(-pi*sqr... | test_evalf_arguments | identifier_name | |
main.rs | #![recursion_limit = "1024"]
#[cfg(test)]
extern crate float_cmp;
#[cfg(test)]
#[macro_use]
extern crate quickcheck;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate derive_error_chain;
#[macro_use]
extern crate lazy_static;
extern crate clap;
#[macro_use]
extern crate combine;
extern crate conv;
e... | () {
use std::sync::Arc;
println!("Expr: {}", ::std::mem::size_of::<types::Expr>());
println!("String: {}", ::std::mem::size_of::<String>());
println!("Symbol: {}", ::std::mem::size_of::<types::Symbol>());
println!("Arc<Fn>: {}", ::std::mem::size_of::<Arc<types::Function>>());
println!("Arc<Macr... | main | identifier_name |
main.rs | #![recursion_limit = "1024"]
#[cfg(test)]
extern crate float_cmp;
#[cfg(test)]
#[macro_use]
extern crate quickcheck;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate derive_error_chain;
#[macro_use]
extern crate lazy_static;
extern crate clap;
#[macro_use]
extern crate combine;
extern crate conv;
e... |
let env = ops::env();
if let Some(file) = matches.value_of("input") {
if file == "-" {
} else {
match input::file(file, env.clone()) {
Ok(_) => (),
Err(err) => println!("{}", err),
}
}
}
if !matches.is_presen... | "[input] 'Read program from file (- for stdin)'",
))
.get_matches(); | random_line_split |
main.rs | #![recursion_limit = "1024"]
#[cfg(test)]
extern crate float_cmp;
#[cfg(test)]
#[macro_use]
extern crate quickcheck;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate derive_error_chain;
#[macro_use]
extern crate lazy_static;
extern crate clap;
#[macro_use]
extern crate combine;
extern crate conv;
e... | ))
.get_matches();
let env = ops::env();
if let Some(file) = matches.value_of("input") {
if file == "-" {
} else {
match input::file(file, env.clone()) {
Ok(_) => (),
Err(err) => println!("{}", err),
}
... | {
use std::sync::Arc;
println!("Expr: {}", ::std::mem::size_of::<types::Expr>());
println!("String: {}", ::std::mem::size_of::<String>());
println!("Symbol: {}", ::std::mem::size_of::<types::Symbol>());
println!("Arc<Fn>: {}", ::std::mem::size_of::<Arc<types::Function>>());
println!("Arc<Macro>:... | identifier_body |
OrderItemDetailsSummary.tsx | import React from 'react';
import { connect } from 'react-redux';
import { getFormValues, isValid } from 'redux-form';
import { OfferingLogo } from '@waldur/marketplace/common/OfferingLogo';
import { FORM_ID } from '@waldur/marketplace/details/constants';
import { SummaryTable } from '@waldur/marketplace/details/Order... | <SummaryTable {...props} />
</>
);
interface OrderItemDetailsSummary {
customer: Customer;
project?: Project;
total: number;
formData: OfferingFormData;
formValid: boolean;
}
const mapStateToProps = (state, ownProps) => ({
customer: getCustomer(state),
project: getProject(state),
total: pricesSe... | ) => (
<>
<OfferingLogo src={props.offering.thumbnail} size="small" /> | random_line_split |
color.py |
def original(self) -> ColorType:
"""
Original value passed to Color
"""
return self._original
def as_named(self, *, fallback: bool = False) -> str:
if self._rgba.alpha is None:
rgb = cast(Tuple[int, int, int], self.as_rgb_tuple())
try:
... | field_schema.update(type='string', format='color') | identifier_body | |
color.py | imgrey': (105, 105, 105),
'dodgerblue': (30, 144, 255),
'firebrick': (178, 34, 34),
'floralwhite': (255, 250, 240),
'forestgreen': (34, 139, 34),
'fuchsia': (255, 0, 255),
'gainsboro': (220, 220, 220),
'ghostwhite': (248, 248, 255),
'gold': (255, 215, 0),
'goldenrod': (218, 165, 32),... | 'white': (255, 255, 255),
'whitesmoke': (245, 245, 245),
'yellow': (255, 255, 0),
'yellowgreen': (154, 205, 50),
} | random_line_split | |
color.py | :
"""
Internal use only as a representation of a color.
"""
__slots__ = 'r', 'g', 'b', 'alpha', '_tuple'
def __init__(self, r: float, g: float, b: float, alpha: Optional[float]):
self.r = r
self.g = g
self.b = b
self.alpha = alpha
self._tuple: Tuple[float, ... | RGBA | identifier_name | |
color.py | rgb(<r>, <g>, <b>) or rgba(<r>, <g>, <b>, <a>) string.
"""
if self._rgba.alpha is None:
return f'rgb({float_to_255(self._rgba.r)}, {float_to_255(self._rgba.g)}, {float_to_255(self._rgba.b)})'
else:
return (
f'rgba({float_to_255(self._rgba.r)}, {float_to_2... | h_value = h_value % 1 | conditional_block | |
createPalette.js | 0.54)',
// Disabled text have even lower visual prominence.
disabled: 'rgba(0, 0, 0, 0.38)',
// Text hints.
hint: 'rgba(0, 0, 0, 0.38)'
},
// The color used to divide different elements.
divider: 'rgba(0, 0, 0, 0.12)',
// The background colors used to style the surfaces.
// Consistency betwee... | (intent, direction, shade, tonalOffset) {
var tonalOffsetLight = tonalOffset.light || tonalOffset;
var tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
if (!intent[direction]) {
if (intent.hasOwnProperty(shade)) {
intent[direction] = intent[shade];
} else if (direction === 'light') {
... | addLightOrDark | identifier_name |
createPalette.js | 0.54)',
// Disabled text have even lower visual prominence.
disabled: 'rgba(0, 0, 0, 0.38)',
// Text hints.
hint: 'rgba(0, 0, 0, 0.38)'
},
// The color used to divide different elements.
divider: 'rgba(0, 0, 0, 0.12)',
// The background colors used to style the surfaces.
// Consistency betwee... | console.error(["Material-UI: The contrast ratio of ".concat(contrast, ":1 for ").concat(contrastText, " on ").concat(background), 'falls below the WCAG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n'));
}
... | if (process.env.NODE_ENV !== 'production') {
var contrast = getContrastRatio(background, contrastText);
if (contrast < 3) { | random_line_split |
createPalette.js | 0.54)',
// Disabled text have even lower visual prominence.
disabled: 'rgba(0, 0, 0, 0.38)',
// Text hints.
hint: 'rgba(0, 0, 0, 0.38)'
},
// The color used to divide different elements.
divider: 'rgba(0, 0, 0, 0.12)',
// The background colors used to style the surfaces.
// Consistency betwee... | warning = _palette$warning === void 0 ? {
light: orange[300],
main: orange[500],
dark: orange[700]
} : _palette$warning,
_palette$info = palette.info,
info = _palette$info === void 0 ? {
light: blue[300],
main: blue[500],
dark: blue[700]
} : _palette$info,
_palette$su... | {
var _palette$primary = palette.primary,
primary = _palette$primary === void 0 ? {
light: indigo[300],
main: indigo[500],
dark: indigo[700]
} : _palette$primary,
_palette$secondary = palette.secondary,
secondary = _palette$secondary === void 0 ? {
light: pink.A200,
main: pink.... | identifier_body |
mail.py | #!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... |
self._send_master_list(pairings)
def _do_send(self, toaddr, body, subject):
try:
msg = MIMEText(body)
msg['Subject'] = subject
msg['From'] = self.email
msg['To'] = toaddr
server = smtplib.SMTP(self.smtp)
server.starttls()
... | self._send_to_secret_santa(pair) | conditional_block |
mail.py | #!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | pair_list = []
for pair in pairings:
(giver, recipient) = pair
pair_list.append("%s -> %s" % (giver.name, recipient.name))
template = j2env.get_template(self.template_master)
body = template.render(pairs=pair_list)
year = dt.utcnow().year
subject ... | Sends an email to the game master.
""" | random_line_split |
mail.py | #!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | """
Sends an email to the game master.
"""
pair_list = []
for pair in pairings:
(giver, recipient) = pair
pair_list.append("%s -> %s" % (giver.name, recipient.name))
template = j2env.get_template(self.template_master)
body = template.render(pairs=... | identifier_body | |
mail.py | #!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | (self, pairings):
"""
Sends the emails out to the secret santa participants.
The secret santa host (the user configured to send the email from)
will receive a copy of the master list.
Each Secret Santa will receive an email with the contents of the
template_santa templa... | send | identifier_name |
index.js | const ftime = function(timestamp) {
timestamp = new Date(timestamp).getTime()
var now = new Date(),
diff = now.getTime() - timestamp,
last = new Date(timestamp),
lastm = '0' + last.getMinutes();
var out = '';
if (diff < 60000) { //1分钟内
out = '刚刚';
} else if (diff >= 60000 && diff < 3600000)... |
//
// ;(function(win) {
// var h;
// var dpr = win.navigator.appVersion.match(/iphone/gi)?win.devicePixelRatio:1;
// var scale = 1 / dpr;
// var docEl = document.documentElement;
// var metaEl = document.createElement('meta');
// function setUnitA(){
// win.rem = docEl.getBoundingCli... | export {
ftime
} | random_line_split |
index.js | const ftime = function(timestamp) {
timestamp = new Date(timestamp).getTime()
var now = new Date(),
diff = now.getTime() - timestamp,
last = new Date(timestamp),
lastm = '0' + last.getMinutes();
var out = '';
if (diff < 60000) { //1分钟内
out = '刚刚';
} else if (diff >= 60000 && diff < 3600000)... | 86400000 + (23 - last.getHours()) * 3600000) {
out = '昨天' + last.getHours() + ':' + lastm.slice(-2);
} else {
out = last.getFullYear() + '/' + (last.getMonth() + 1) + '/' + last.getDate();
}
return out;
}
export {
ftime
}
//
// ;(function(win) {
// var h;
// var dpr = win.navigator.appVer... | + ':' + lastm.slice(-2);
} else if (diff >= 21600000 && diff <= | conditional_block |
HTML-CSS.js | /*
* /MathJax/localization/br/HTML-CSS.js
*
* Copyright (c) 2009-2015 The MathJax Consortium
*
* 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/licen... | *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the ... | random_line_split | |
mail.py | ) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_description: Sends failure events via ema... | elif result._result.get('failed_when_result') is True:
body += "due to the following condition:\n\n" + self.indent('failed_when:\n- ' + '\n- '.join(result._task.failed_when)) + '\n\n'
elif result._result.get('msg'):
body += self.body_blob(result._result['msg'], 'message')
... | body += '\n'
# Add item / message
if self.itembody:
body += self.itembody | random_line_split |
mail.py | ) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_description: Sends failure events via ema... |
body += '\n'
# Add item / message
if self.itembody:
body += self.itembody
elif result._result.get('failed_when_result') is True:
body += "due to the following condition:\n\n" + self.indent('failed_when:\n- ' + '\n- '.join(result._task.failed_when)) + '\n\n'
... | body += self.indent('%s\n' % result._task.action) | conditional_block |
mail.py | ://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_description: Sends failure events via email
description:
- This callback will report failures via email
version_added: '2.0'
author:
... | self.itemsubject = result._result['msg']
self.itembody += self.body_blob(json.dumps(result._result, cls=AnsibleJSONEncoder, indent=4), "failed item dump '%(item)s'" % result._result) | identifier_body | |
mail.py | ) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_description: Sends failure events via ema... | (self, result, ignore_errors=False):
if ignore_errors:
return
self.mail_result(result, 'Failed')
def v2_runner_on_unreachable(self, result):
self.mail_result(result, 'Unreachable')
def v2_runner_on_async_failed(self, result):
self.mail_result(result, 'Async failure... | v2_runner_on_failed | identifier_name |
wizard.js | /*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the t... | (wiz_mode){showdiv('step1');var current_step=document.getElementById('wiz_current_step');current_step.value="1";var save_button=document.getElementById('wiz_submit_button');var next_button=document.getElementById('wiz_next_button');var save_button_div=document.getElementById('save_button_div');var next_button_div=docum... | showfirst | identifier_name |
wizard.js | /*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the t... |
function link_navs(beg,end){if(beg==''){beg=1;}
if(end==''){var last=document.getElementById('wiz_total_steps').value;end=last;}
beg=parseInt(beg);end=parseInt(end);for(i=beg;i<=end;i++){var nav_step=document.getElementById('nav_step'+i);nav_step.innerHTML="<a href='#' onclick=\"javascript:direct('"+i+"');\">"+nav_st... | {var last=parseInt(document.getElementById('wiz_total_steps').value);for(i=1;i<=last;i++){var nav_step=document.getElementById('nav_step'+i);nav_step.className='';}
var nav_step=document.getElementById('nav_step'+hilite);nav_step.className='';if(already_linked.indexOf(hilite)<0){nav_step.innerHTML="<a href='#' onclick... | identifier_body |
wizard.js | /*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the t... | else{}}
function validate_wiz(step,direction){var total=document.getElementById('wiz_total_steps').value;var wiz_message=document.getElementById('wiz_message');if(direction=='back'){if(step=='1'){var msg=SUGAR.language.get('mod_strings','LBL_WIZARD_FIRST_STEP_MESSAGE');wiz_message.innerHTML="<font color=\'red\' size=\'... | {current_step.value=stepnumber;navigate('direct');} | conditional_block |
wizard.js | /*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by | *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVER... | * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc. | random_line_split |
geo.py | #!/usr/bin/env python
# encoding: utf-8
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.... |
def dump_country(self, country):
return {
'confidence': country.confidence,
'geoname_id': country.geoname_id,
'iso_code': country.iso_code,
'name': country.name,
'names': country.names
}
def dump_location(self, location):
ret... | return {
'code': continent.code,
'geoname_id': continent.geoname_id,
'name': continent.name,
'names': continent.names,
} | identifier_body |
geo.py | import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.geoname_id,
'name': city.name,
... | #!/usr/bin/env python
# encoding: utf-8
import os | random_line_split | |
geo.py | #!/usr/bin/env python
# encoding: utf-8
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.... | (self, location):
return {
'accuracy_radius': location.accuracy_radius,
'latitude': location.latitude,
'longitude': location.longitude,
'metro_code': location.metro_code,
'time_zone': location.time_zone
}
def dump_traits(self, traits):
... | dump_location | identifier_name |
geo.py | #!/usr/bin/env python
# encoding: utf-8
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.... |
return {"taxonomies": taxonomies}
def run(self):
Analyzer.run(self)
if self.data_type == 'ip':
try:
data = self.get_data()
city = geoip2.database.Reader(os.path.dirname(__file__) + '/GeoLite2-City.mmdb').city(data)
self.report... | value = "{}/{}".format(raw["country"]["name"], raw["continent"]["name"])
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value)) | conditional_block |
jquery.date_input.pack.js | (el, opts) {
if (typeof(opts) != "object") opts = {};
$.extend(this, jdPicker.DEFAULT_OPTS, opts);
this.input = $(el);
this.bindMethodsToObj("show", "hide", "hideIfClickOutside", "keydownHandler", "selectDate");
this.build();
this.selectDate();
this.hide();
};
jdPicker.DEFAULT_OPTS = {
month_na... | jdPicker | identifier_name | |
jquery.date_input.pack.js | _encode = 'this.strpad(date.getDate()) + " " + this.short_month_names[date.getMonth()] + " " + date.getFullYear();';
this.date_encode_s = 'this.strpad(date.getDate()) + " " + this.short_month_names[date.getMonth()];';
break;
case "MM dd YYYY":
this.reg = new RegExp(/^([a-zA-Z]{3}) (\d{1,2}) (\d{4})$/);
... |
this.monthNameSpan.dblclick(this.bindToObj(function(){
this.monthNameSpan.empty().append(this.getMonthSelect());
$('select', this.monthNameSpan).change(this.bindToObj(function(){
this.moveMonthBy(parseInt($('select :selected', this.monthNameSpan).val()) - this.currentMonth.getMonth());
}));
}));
v... | random_line_split | |
jquery.date_input.pack.js | ;
jdPicker.DEFAULT_OPTS = {
month_names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
short_month_names: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
short_day_names: ["S", "M", "T", "W", "T", "... | {
if (typeof(opts) != "object") opts = {};
$.extend(this, jdPicker.DEFAULT_OPTS, opts);
this.input = $(el);
this.bindMethodsToObj("show", "hide", "hideIfClickOutside", "keydownHandler", "selectDate");
this.build();
this.selectDate();
this.hide();
} | identifier_body | |
topbar.spec.js | /*global describe, it, runs, waitsFor, expect, require, document*/
describe("Topbar module", function () {
'use strict';
var qs = function(){return {
getHash: function(){},
setHash: function(){}
}},
loader = {},
toc = {},
track = {
event: function(){}
},
throbber = {},
body = getBody(),
wind... | expect(typeof topbar.initAutocomplete).toBe('function');
expect(typeof topbar.openLogin).toBe('function');
expect(typeof topbar.openProfile).toBe('function');
expect(typeof topbar.openSearch).toBe('function');
expect(typeof topbar.close).toBe('function');
});
}); | expect(topbar).toBeDefined(); | random_line_split |
cci_intrinsic.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 ... | {
unsafe {
rusti::atomic_xchg(dst, src)
}
} | identifier_body | |
cci_intrinsic.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 ... | (dst: &mut int, src: int) -> int {
unsafe {
rusti::atomic_xchg(dst, src)
}
}
| atomic_xchg | identifier_name |
cci_intrinsic.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 ... | pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
... | pub fn atomic_xadd(dst: &mut int, src: int) -> int; | random_line_split |
S15.5.4.4_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The String.prototype.charAt.length property has the attribute DontEnum
es5id: 15.5.4.4_A8
description: >
Checking if enumerating the String.prototype.charAt.length
pro... |
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CHECK#2
var count=0;
for (var p in String.prototype.charAt){
if (p==="length") count++;
}
if (count !== 0) {
$ERROR('#2: count=0; for (p in String.p... | {
$ERROR('#1: String.prototype.charAt.propertyIsEnumerable(\'length\') return false. Actual: '+String.prototype.charAt.propertyIsEnumerable('length'));
} | conditional_block |
S15.5.4.4_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The String.prototype.charAt.length property has the attribute DontEnum
es5id: 15.5.4.4_A8
description: >
Checking if enumerating the String.prototype.charAt.length | if (!(String.prototype.charAt.hasOwnProperty('length'))) {
$ERROR('#0: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.charAt.hasOwnProperty('length'));
}
//
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////... | property fails
---*/
//////////////////////////////////////////////////////////////////////////////
//CHECK#0 | random_line_split |
staff-roles.js | $(document).ready(function () {
// "show more" links
$('.more-permissions').click(function (e) {
e.preventDefault();
$('#' + $(this).attr('data-target')).slideDown();
$(this).closest('span').hide();
})
});
var onFormLoadSetup = function() {
$('.select-all').click(function() {
if($(this).prop('chec... |
if(!findNumOfSelectedCheckboxes(formObject)){
toastr.error("Please select at least one permission");
error = true;
}
return !error;
};
var findNumOfSelectedCheckboxes = function(formObject) {
var matches = 0;
var key;
for (key in formObject) {
if (key.match('^permissio... | toastr.error("Role title should only contain numbers, letters and spaces");
error = true;
} | random_line_split |
staff-roles.js | $(document).ready(function () {
// "show more" links
$('.more-permissions').click(function (e) {
e.preventDefault();
$('#' + $(this).attr('data-target')).slideDown();
$(this).closest('span').hide();
})
});
var onFormLoadSetup = function() {
$('.select-all').click(function() {
if($(this).prop('chec... |
return !error;
};
var findNumOfSelectedCheckboxes = function(formObject) {
var matches = 0;
var key;
for (key in formObject) {
if (key.match('^permission-')) {
matches++;
}
}
return matches;
};
$(document).ready(function () {
setUpDataTable('#staff-roles-table', ... | {
toastr.error("Please select at least one permission");
error = true;
} | conditional_block |
unsendable-class.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn main() {
let cat = "kitty".to_string();
let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented
tx.send(foo(42, Rc::new(cat))); //~ ERROR `core::kinds::Send` is not implemented
}
| {
foo {
i: i,
j: j
}
} | identifier_body |
unsendable-class.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 ... | // sent
use std::rc::Rc;
struct foo {
i: int,
j: Rc<String>,
}
fn foo(i:int, j: Rc<String>) -> foo {
foo {
i: i,
j: j
}
}
fn main() {
let cat = "kitty".to_string();
let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented
tx.send(foo(42, Rc::new(cat))); //~ ERROR `... |
// Test that a class with an unsendable field can't be | random_line_split |
unsendable-class.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let cat = "kitty".to_string();
let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented
tx.send(foo(42, Rc::new(cat))); //~ ERROR `core::kinds::Send` is not implemented
}
| main | identifier_name |
border.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Keyword, Method, PHYSICAL_SIDES, ALL_SID... | BorderImageSideWidth::Length(
LengthOrPercentage::from_gecko_style_coord(&sides.data_at(${i}))
.expect("sides[${i}] could not convert to LengthOrPercentager"))
},
},
% endfor
... | random_line_split | |
border.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Keyword, Method, PHYSICAL_SIDES, ALL_SID... | (&self, sides: &mut ::gecko_bindings::structs::nsStyleSides) {
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use gecko::values::GeckoStyleCoordConvertible;
use values::generics::border::BorderImageSideWidth;
% for i in range(0, 4):
match self.${i} {
... | to_gecko_rect | identifier_name |
border.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Keyword, Method, PHYSICAL_SIDES, ALL_SID... |
pub fn from_gecko_rect(sides: &::gecko_bindings::structs::nsStyleSides)
-> Option<::values::computed::BorderImageWidth> {
use gecko_bindings::structs::nsStyleUnit::{eStyleUnit_Factor, eStyleUnit_Auto};
use gecko_bindings::sugar::ns_style_coord::CoordData;
use gec... | {
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use gecko::values::GeckoStyleCoordConvertible;
use values::generics::border::BorderImageSideWidth;
% for i in range(0, 4):
match self.${i} {
BorderImageSideWidth::Auto => {
s... | identifier_body |
border.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Keyword, Method, PHYSICAL_SIDES, ALL_SID... | ,
},
% endfor
)
)
}
}
| {
BorderImageSideWidth::Length(
LengthOrPercentage::from_gecko_style_coord(&sides.data_at(${i}))
.expect("sides[${i}] could not convert to LengthOrPercentager"))
} | conditional_block |
model.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Portello membership system
# Copyright (C) 2014 Klubb Alfa Romeo Norge
#
# 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
# t... |
if field.name == 'zip':
ret.zipcode = field.value
if field.name == 'city':
ret.city = field.value
return ret
def create_document(self):
""" Create document to enable full-text search """
if not self.membertype:
print 'Miss... | ret.phone = field.value | conditional_block |
model.py | # -*- coding: utf-8 -*- | # Portello membership system
# Copyright (C) 2014 Klubb Alfa Romeo Norge
#
# 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 versio... | # ------------------------------------------------------------------------- | random_line_split |
model.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Portello membership system
# Copyright (C) 2014 Klubb Alfa Romeo Norge
#
# 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
# t... | (self):
count = memcache.get(str(self.key()) + '_count')
if count is not None:
return count
return 0
class CarModel(db.Model):
"""A concrete model, like 'GTV 2.0i Twin Spark' or 'GTV 3.2i V6'"""
model_range = db.ReferenceProperty(ModelRange, collection_name='models')
n... | model_count | identifier_name |
model.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Portello membership system
# Copyright (C) 2014 Klubb Alfa Romeo Norge
#
# 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
# t... |
class CarModel(db.Model):
"""A concrete model, like 'GTV 2.0i Twin Spark' or 'GTV 3.2i V6'"""
model_range = db.ReferenceProperty(ModelRange, collection_name='models')
name = db.StringProperty()
engine_code = db.StringProperty()
typeno = db.StringProperty()
image_url = db.LinkProperty()
y... | """A model range. In almost all cases there are more than one model in
each range; this is the generic (like 'Spider', 'GTV', 'GT' and so on.)"""
name = db.StringProperty()
year_start = db.IntegerProperty()
year_end = db.IntegerProperty()
notes = db.TextProperty(required=False)
def model_count... | identifier_body |
datetime-short.js | /************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute... | var readableFormat = this.getDateTime().getReadableShortDateFormat();
if (d.format('YYYY') == now.format('YYYY')) {
string = d.format(readableFormat);
} else {
string = d.format(readableFormat + ', YY');
... | {
var value = this.model.get(this.name)
if (value) {
var string;
var timeFormat = this.getDateTime().timeFormat;
if (this.params.hasSeconds) {
timeFormat = timeFormat.replace(/:mm/, ':mm:ss');
... | conditional_block |
datetime-short.js | /************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute... | getDateStringValue: function () {
if (this.mode == 'list' || this.mode == 'detail') {
var value = this.model.get(this.name)
if (value) {
var string;
var timeFormat = this.getDateTime().timeFormat;
if (this.... | },
| random_line_split |
widget.js | WAF.define('WakendoColorPicker', ['waf-core/widget', 'wakendoCore'], function(widget, $) {
'use strict';
var KendoColorPicker = widget.create('WakendoColorPicker', {
value: widget.property({
type: 'string'
}),
flat: widget.property({
type: 'boolean',
defaultValue: fal... |
close: function() {
this.kendoWidget.close();
},
enable: function() {
this.kendoWidget.enable();
},
disable: function() {
this.kendoWidget.enable(false);
}
});
return KendoColorPicker;
}); | },
open: function() {
this.kendoWidget.open();
}, | random_line_split |
widget.js | WAF.define('WakendoColorPicker', ['waf-core/widget', 'wakendoCore'], function(widget, $) {
'use strict';
var KendoColorPicker = widget.create('WakendoColorPicker', {
value: widget.property({
type: 'string'
}),
flat: widget.property({
type: 'boolean',
defaultValue: fal... | else {
var $el = $('<input />').appendTo(self.node);
$el.kendoColorPicker(options);
self.kendoWidget = $el.data("kendoColorPicker");
}
},
open: function() {
this.kendoWidget.open();
},
close: function() {
this.kendoWidget.close();
... | {
var $el = $(self.node);
$el.kendoFlatColorPicker(options);
self.kendoWidget = $el.data("kendoFlatColorPicker");
} | conditional_block |
decompression.rs | /* Copyright (C) 2021 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; w... |
pub fn http2_encoding_fromvec(&mut self, input: &Vec<u8>) {
//use first encoding...
if self.encoding == HTTP2ContentEncoding::HTTP2ContentEncodingUnknown {
if *input == "gzip".as_bytes().to_vec() {
self.encoding = HTTP2ContentEncoding::HTTP2ContentEncodingGzip;
... | encoding: HTTP2ContentEncoding::HTTP2ContentEncodingUnknown,
decoder: HTTP2Decompresser::UNASSIGNED,
}
} | random_line_split |
decompression.rs | /* Copyright (C) 2021 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; w... | else {
self.encoding = HTTP2ContentEncoding::HTTP2ContentEncodingUnrecognized;
}
}
}
pub fn decompress<'a>(
&'a mut self, input: &'a [u8], output: &'a mut Vec<u8>,
) -> io::Result<&'a [u8]> {
match self.decoder {
HTTP2Decompresser::GZIP(ref m... | {
self.encoding = HTTP2ContentEncoding::HTTP2ContentEncodingBr;
self.decoder = HTTP2Decompresser::BROTLI(brotli::Decompressor::new(
HTTP2cursor::new(),
HTTP2_DECOMPRESSION_CHUNK_SIZE,
));
} | conditional_block |
decompression.rs | /* Copyright (C) 2021 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; w... |
}
pub enum HTTP2Decompresser {
UNASSIGNED,
GZIP(GzDecoder<HTTP2cursor>),
BROTLI(brotli::Decompressor<HTTP2cursor>),
}
struct HTTP2DecoderHalf {
encoding: HTTP2ContentEncoding,
decoder: HTTP2Decompresser,
}
pub trait GetMutCursor {
fn get_mut(&mut self) -> &mut HTTP2cursor;
}
impl GetMutCurs... | {
//use the cursor, except it turns eof into blocking error
let r = self.cursor.read(buf);
match r {
Err(ref err) => {
if err.kind() == io::ErrorKind::UnexpectedEof {
return Err(io::ErrorKind::WouldBlock.into());
}
}
... | identifier_body |
decompression.rs | /* Copyright (C) 2021 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; w... | () -> HTTP2Decoder {
HTTP2Decoder {
decoder_tc: HTTP2DecoderHalf::new(),
decoder_ts: HTTP2DecoderHalf::new(),
}
}
pub fn http2_encoding_fromvec(&mut self, input: &Vec<u8>, dir: u8) {
if dir == STREAM_TOCLIENT {
self.decoder_tc.http2_encoding_fromvec(i... | new | identifier_name |
cfgs-on-items.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | #[cfg(fooC)]
#[cfg(fooB, not(bar))]
fn foo2() -> int { 3 }
// fooA AND bar
#[cfg(fooA, bar)]
fn foo3() -> int { 2 }
// !(fooA AND bar)
#[cfg(not(fooA, bar))]
fn foo3() -> int { 3 }
pub fn main() {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
assert_eq!(3, foo3());
} | random_line_split | |
cfgs-on-items.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
assert_eq!(3, foo3());
} | identifier_body | |
cfgs-on-items.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | () -> int { 3 }
pub fn main() {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
assert_eq!(3, foo3());
}
| foo3 | identifier_name |
neproblem.rs | Problem {
/// RandomNEProblem{}
/// }
/// }
///
/// impl NeuroProblem for RandomNEProblem {
/// // return number of NN inputs.
/// fn get_inputs_num(&self) -> usize {1}
/// // return number of NN outputs.
/// fn get_outputs_num(&self) -> usize {1}
/// // return NN with random weights and... | }
}
impl NeuroProblem for SymbolicRegressionProblem {
fn get_inputs_num(&self) -> usize { 1 }
fn get_outputs_num(&self) -> usize { 1 }
fn get_default_net(&self) -> MultilayeredNetwork {
let mut rng = rand::thread_rng();
let mut net: MultilayeredNetwork = MultilayeredNetwork::new(self.ge... | random_line_split | |
neproblem.rs | Problem {
/// RandomNEProblem{}
/// }
/// }
///
/// impl NeuroProblem for RandomNEProblem {
/// // return number of NN inputs.
/// fn get_inputs_num(&self) -> usize {1}
/// // return number of NN outputs.
/// fn get_outputs_num(&self) -> usize {1}
/// // return NN with random weights and... |
fn get_default_net(&self) -> MultilayeredNetwork {
let mut rng = rand::thread_rng();
let mut net: MultilayeredNetwork = MultilayeredNetwork::new(self.get_inputs_num(), self.get_outputs_num());
net.add_hidden_layer(5 as usize, ActivationFunctionType::Sigmoid)
.build(&mut rng, Neu... | { 1 } | identifier_body |
neproblem.rs | Problem {
/// RandomNEProblem{}
/// }
/// }
///
/// impl NeuroProblem for RandomNEProblem {
/// // return number of NN inputs.
/// fn get_inputs_num(&self) -> usize {1}
/// // return number of NN outputs.
/// fn get_outputs_num(&self) -> usize {1}
/// // return NN with random weights and... | (&self) -> MultilayeredNetwork {
let mut rng = rand::thread_rng();
let mut net: MultilayeredNetwork = MultilayeredNetwork::new(self.get_inputs_num(), self.get_outputs_num());
net.add_hidden_layer(5 as usize, ActivationFunctionType::Sigmoid)
.build(&mut rng, NeuralArchitecture::Multil... | get_default_net | identifier_name |
tryer-tests.ts | import * as tryer from "tryer";
tryer(); // $ExpectError
// $ExpectError
tryer({
action: null
});
// $ExpectError
tryer({
fail: null
});
// $ExpectError
tryer({
fail: null
});
// $ExpectError
tryer({
interval: null
});
// $ExpectError
tryer({
limit: null
});
// $ExpectError
tryer({
pass: ... |
// $ExpectError
tryer({
when: () => 1
});
// $ExpectError
tryer({
until: () => 1
});
// $ExpectError
tryer({
limit: "notNumber"
});
// $ExpectError
tryer({
interval: "notNumber"
});
tryer({});
tryer({
action: done => {
done();
},
fail: error => {
error.message;
... |
// $ExpectError
tryer({
when: null
}); | random_line_split |
live-hostmeta.ts | import expect from 'expect';
import * as JXT from '../src/jxt';
import { getHostMeta } from '../src/plugins/hostmeta';
import XRD from '../src/protocol';
const registry = new JXT.Registry();
registry.define(XRD);
const xml =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<XRD xmlns="http://docs.oasis-open.org/n... | subject: 'http://blog.example.com/article/id/314'
};
test('XRD', () => {
expect.assertions(2);
const xrd = registry.import(JXT.parse(xml))!;
expect(xrd.subject).toBe(json.subject);
expect(xrd.links).toEqual(json.links);
});
test('retrieve JSON only', done => {
expect.assertions(1);
getH... | rel: 'author'
}
], | random_line_split |
profile-settings.component.ts | import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { UserService } from '../../services/user-service';
import { Constants } from '../../constants/constants'
import { FormGroup, Validators, FormControl, FormBuilder } from '@angular/forms';
import { HttpHeadersService } from '../../services/h... | () {
this.uploader.uploadAll();
this.userService.updateSettings(this.user.id, this.userSettingsToUpdate.value)
.subscribe(x => {
// this.router.navigate(['/profile'])
this.authService.logout();
this.router.navigate(['/login']);
... | updateSettings | identifier_name |
profile-settings.component.ts | import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { UserService } from '../../services/user-service';
import { Constants } from '../../constants/constants'
import { FormGroup, Validators, FormControl, FormBuilder } from '@angular/forms';
import { HttpHeadersService } from '../../services/h... |
public ngOnInit(): void {
this.userService
.getLoggedUser()
.subscribe(x => {
this.user = x.user;
this.uploader = new FileUploader({url: Constants.hostUrl + 'api/users/user/' + this.user.id + '/avatar'})
console.log(Constants.hostUrl ... | {
} | identifier_body |
profile-settings.component.ts | import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { UserService } from '../../services/user-service';
import { Constants } from '../../constants/constants' | @Component({
templateUrl: 'app/profile/profile-settings/profile-settings.component.html'
})
export class ProfileSettingsComponent implements OnInit {
private formUploaderConfig = {url:''};
public user: any;
public imagesUrl = Constants.imagesUrl;
public userSettingsToUpdate: FormGroup;
public u... | import { FormGroup, Validators, FormControl, FormBuilder } from '@angular/forms';
import { HttpHeadersService } from '../../services/http-headers.service';
import { Router } from '@angular/router'
import { AuthenticationService } from '../../services/authentication.service'
import { FileUploader } from 'ng2-file-upload... | random_line_split |
shortcuts.rs | // Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
use std::ops::Range;
use ndarray::Zip;
use ndarray_parallel::NdarrayIntoParallelIterator;
use rayon::iter::Map;
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
/// Utility trait that adds shortcuts ... | R: Send;
}
impl<T> ParallelShortcuts for Range<T>
where
Range<T>: IntoParallelIterator,
{
type Iter = <Range<T> as IntoParallelIterator>::Iter;
fn par_map<F, R>(self, map_op: F) -> Map<Self::Iter, F>
where
F: Fn(<Self::Iter as ParallelIterator>::Item) -> R + Sync + Send,
R: Sen... | F: Fn(<Self::Iter as ParallelIterator>::Item) -> R + Sync + Send, | random_line_split |
shortcuts.rs | // Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
use std::ops::Range;
use ndarray::Zip;
use ndarray_parallel::NdarrayIntoParallelIterator;
use rayon::iter::Map;
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
/// Utility trait that adds shortcuts ... | , R>(self, map_op: F) -> Map<Self::Iter, F>
where
F: Fn(<Self::Iter as ParallelIterator>::Item) -> R + Sync + Send,
R: Send,
{
self.into_par_iter().map(map_op)
}
}
impl<Parts, D> ParallelShortcuts for Zip<Parts, D>
where
Zip<Parts, D>: NdarrayIntoParallelIterator,
{
type Ite... | r_map<F | identifier_name |
shortcuts.rs | // Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
use std::ops::Range;
use ndarray::Zip;
use ndarray_parallel::NdarrayIntoParallelIterator;
use rayon::iter::Map;
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
/// Utility trait that adds shortcuts ... | self.into_par_iter().map(map_op)
}
} | identifier_body | |
io_split.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{split, AsyncRead, AsyncWrite, ReadBuf, ReadHalf, WriteHalf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct | ;
impl AsyncRead for RW {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<io::Result<()>> {
buf.put_slice(&[b'z']);
Poll::Ready(Ok(()))
}
}
impl AsyncWrite for RW {
fn poll_write(
self: Pin<&mut Self>,
... | RW | identifier_name |
io_split.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{split, AsyncRead, AsyncWrite, ReadBuf, ReadHalf, WriteHalf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct RW;
impl AsyncRead for RW {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
... | fn split_stream_id() {
let (r1, w1) = split(RW);
let (r2, w2) = split(RW);
assert!(r1.is_pair_of(&w1));
assert!(!r1.is_pair_of(&w2));
assert!(r2.is_pair_of(&w2));
assert!(!r2.is_pair_of(&w1));
}
#[test]
fn unsplit_ok() {
let (r, w) = split(RW);
r.unsplit(w);
}
#[test]
#[should_panic]
f... | }
#[test] | random_line_split |
io_split.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{split, AsyncRead, AsyncWrite, ReadBuf, ReadHalf, WriteHalf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct RW;
impl AsyncRead for RW {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
... |
}
#[test]
fn is_send_and_sync() {
fn assert_bound<T: Send + Sync>() {}
assert_bound::<ReadHalf<RW>>();
assert_bound::<WriteHalf<RW>>();
}
#[test]
fn split_stream_id() {
let (r1, w1) = split(RW);
let (r2, w2) = split(RW);
assert!(r1.is_pair_of(&w1));
assert!(!r1.is_pair_of(&w2));
asse... | {
Poll::Ready(Ok(()))
} | identifier_body |
CardService.ts | import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import { AppConfig } from '../config/app.config';
import { VTRequest } from '../domain/V... | ( id:String ):Observable<Response> {
let url:string = this.url + "/" + id;
let options = new RequestOptions({ headers: this.buildHeaders() });
return this.http.get(url, options).map(response => response.json());
}
// performs purchase txn type with the given card info
purchase( req:VTReques... | load | identifier_name |
CardService.ts | import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import { AppConfig } from '../config/app.config';
import { VTRequest } from '../domain/V... |
} | {
return new Headers({
'Content-Type': 'application/json',
'Authorization': this.config.getConfig("authKey")
});
} | identifier_body |
CardService.ts | import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import { AppConfig } from '../config/app.config';
import { VTRequest } from '../domain/VTRequest';
import { CardResponse } from './CardResponse';
@Injectable()
export class CardService {
url:string = "... | import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
| random_line_split | |
operate-orgstar-new.js | $(document).ready(function(){
var isUeReady = false; //ueditor编辑器是否初始化完成
var $btn_publish = $('#btn_publish'); //按钮发布
var $btn_draft = $('#btn_draft'); //按钮暂存
var $btn_preview = $('#btn_preview'); //按钮预览
$btn_publish.attr('disabled','disabled');
$btn_draft.attr('disabled','disabled'... | identifier_body | ||
operate-orgstar-new.js | $(document).ready(function(){
var isUeReady = false; //ueditor编辑器是否初始化完成
var $btn_publish = $('#btn_publish'); //按钮发布
var $btn_draft = $('#btn_draft'); //按钮暂存
var $btn_preview = $('#btn_preview'); //按钮预览
$btn_publish.attr('disabled','disabled');
$btn_draft.attr('disabled','disabled'... | identifier_name | ||
operate-orgstar-new.js | $(document).ready(function(){
var isUeReady = false; //ueditor编辑器是否初始化完成
var $btn_publish = $('#btn_publish'); //按钮发布
var $btn_draft = $('#btn_draft'); //按钮暂存
var $btn_preview = $('#btn_preview'); //按钮预览
$btn_publish.attr('disabled','disabled');
$btn_draft.attr('disabled','disabled'... | '<div class="row">' +
'<div class="col-xs-12">' +
'<div class="org-li static">' +
'<div class="org-li-img">' +
... | }
var htmlStr = '<div class="row-space-common">' + | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.