file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
launch_suite.js
;(function($){ var page_container, current_select = null; $(document).ready(function(){ page_container = $('#launch_suite_pages'); $('#funnel_select').change(function(){ if(parseInt($('#funnel_id').val()) > 0){ if($(this).val() != $('#funnel_id').val()){ ...
(url,name,value){ return url + (url.indexOf('?') != -1 ? '&' : '?') + name+'='+encodeURIComponent(value); }; window.op_launch_suite_update_selects = function(page_id){ var data = { action: OptimizePress.SN+'-launch-suite-refresh_dropdown', _wpnonce: $('#_wpnonce').v...
add_param
identifier_name
launch_suite.js
;(function($){ var page_container, current_select = null; $(document).ready(function(){ page_container = $('#launch_suite_pages'); $('#funnel_select').change(function(){ if(parseInt($('#funnel_id').val()) > 0){ if($(this).val() != $('#funnel_id').val()){ ...
; function add_param(url,name,value){ return url + (url.indexOf('?') != -1 ? '&' : '?') + name+'='+encodeURIComponent(value); }; window.op_launch_suite_update_selects = function(page_id){ var data = { action: OptimizePress.SN+'-launch-suite-refresh_dropdown', _...
{ if(url == ''){ return ''; } if($('#op_gateway_key_enabled').is(':checked')){ return add_param(url,'gw',$('#op_launch_settings_gateway_key_key').val()); } return url; }
identifier_body
launch_suite.js
;(function($){ var page_container, current_select = null; $(document).ready(function(){ page_container = $('#launch_suite_pages'); $('#funnel_select').change(function(){ if(parseInt($('#funnel_id').val()) > 0){ if($(this).val() != $('#funnel_id').val()){ ...
}).trigger('change'); $('#launch_suite_sales select.value_page').change(function(){ var url = OptimizePress.launch_page_urls[$(this).val()] || ''; $(this).parent().find('input.value_page_url').val(url).end().find('input.value_page_access_url').val(add_key(url)); }...
{ $('#hide_cart').show(); }
conditional_block
deriving-primitive.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { let x: Option<A> = FromPrimitive::from_int(int::max_value); assert_eq!(x, Some(Foo)); let x: Option<A> = FromPrimitive::from_int(1); assert_eq!(x, Some(Bar)); let x: Option<A> = FromPrimitive::from_int(3); assert_eq!(x, Some(Baz)); let x: Option<A> = FromPrimitive::from_i...
Baz = 3, Qux, }
random_line_split
deriving-primitive.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ Foo = int::max_value, Bar = 1, Baz = 3, Qux, } pub fn main() { let x: Option<A> = FromPrimitive::from_int(int::max_value); assert_eq!(x, Some(Foo)); let x: Option<A> = FromPrimitive::from_int(1); assert_eq!(x, Some(Bar)); let x: Option<A> = FromPrimitive::from_int(3); asser...
A
identifier_name
test.py
# ------------------------------------------------------------------------------------------------- # Rick, a Rust intercal compiler. Save your souls! # # Copyright (c) 2015-2021 Georg Brandl # # This program is free software; you can redistribute it and/or modify it under the terms of the # GNU General Public License...
if __name__ == '__main__': sys.exit(main())
start = time.time() compile_flag = '--nocompile' not in sys.argv skip_flag = '--all' not in sys.argv tests = [path.splitext(test.replace('/', os.sep))[0] for test in sys.argv[1:] if not test.startswith('-')] print('Building...') if os.system('cargo build --release') != 0: return...
identifier_body
test.py
# ------------------------------------------------------------------------------------------------- # Rick, a Rust intercal compiler. Save your souls! # # Copyright (c) 2015-2021 Georg Brandl # # This program is free software; you can redistribute it and/or modify it under the terms of the # GNU General Public License...
print('Running tests, please wait...') passed = 0 total = 0 failed = [] for root, dirs, files in os.walk('code'): dirs.sort() for fn in sorted(files): if not fn.endswith('.chk'): continue if skip_flag and fn.startswith(('fft-', 'flonck', 'unla...
return 2
conditional_block
test.py
# ------------------------------------------------------------------------------------------------- # Rick, a Rust intercal compiler. Save your souls! # # Copyright (c) 2015-2021 Georg Brandl # # This program is free software; you can redistribute it and/or modify it under the terms of the # GNU General Public License...
def main(): start = time.time() compile_flag = '--nocompile' not in sys.argv skip_flag = '--all' not in sys.argv tests = [path.splitext(test.replace('/', os.sep))[0] for test in sys.argv[1:] if not test.startswith('-')] print('Building...') if os.system('cargo build --release') !=...
False)
random_line_split
test.py
# ------------------------------------------------------------------------------------------------- # Rick, a Rust intercal compiler. Save your souls! # # Copyright (c) 2015-2021 Georg Brandl # # This program is free software; you can redistribute it and/or modify it under the terms of the # GNU General Public License...
(testname, testcode, compiled): stdin = b'' if path.isfile(testname + '.tst'): with open(testname + '.tst', 'rb') as stdinfile: stdin = stdinfile.read() with open(testname + '.chk', 'r') as stdoutfile: stdout = stdoutfile.read() def check(proc, remove_cargo): real_st...
run_test
identifier_name
__init__.py
# -*-coding:Utf-8 -* # Copyright (c) 2014 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # lis...
self, personnage, masques, commande): """Répartition du masque.""" nom = liste_vers_chaine(commande) if not nom: raise ErreurValidation( "Précisez un nom de familier.") nom = nom.split(" ")[0].lower() self.a_interpreter = nom commande[:] = co...
epartir(
identifier_name
__init__.py
# -*-coding:Utf-8 -* # Copyright (c) 2014 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # lis...
def init(self): """Initialisation des attributs""" self.nom_familier = "" self.familier = None def repartir(self, personnage, masques, commande): """Répartition du masque.""" nom = liste_vers_chaine(commande) if not nom: raise ErreurValidation( ...
""Constructeur du masque""" Masque.__init__(self) self.proprietes["nouveau"] = "False" self.proprietes["salle_identique"] = "True"
identifier_body
__init__.py
# -*-coding:Utf-8 -* # Copyright (c) 2014 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # lis...
"""Masque <nom_familier>. On attend un nom unique de familier. Quand le joueur change le nom de son familier, il doit veiller à ce qu'il reste unique. """ nom = "nom_familier" nom_complet = "nom d'un familier" def __init__(self): """Constructeur du masque""" Masque.__ini...
class NomFamilier(Masque):
random_line_split
__init__.py
# -*-coding:Utf-8 -* # Copyright (c) 2014 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # lis...
self.nom_familier = nom self.familier = familier return True
ErreurValidation( "|err|Le familier {} existe déjà.|ff|".format(nom))
conditional_block
tree-demo-module.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {CdkTreeModule} from '@angular/cdk/tree'; import {CommonModule} from '@angular/common'; import {NgModule} from ...
{ }
TreeDemoModule
identifier_name
tree-demo-module.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {CdkTreeModule} from '@angular/cdk/tree'; import {CommonModule} from '@angular/common'; import {NgModule} from ...
], declarations: [TreeDemo], }) export class TreeDemoModule { }
MatIconModule, MatInputModule, MatTreeModule, MatProgressBarModule, RouterModule.forChild([{path: '', component: TreeDemo}]),
random_line_split
scale_strict.py
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represen...
num = str(num) iscaps = False positive = True # Input if cur == res: return num if num == "0": return "0" assert cur in range(2, 65) and res in range(2, 65), "Base not defined." if num[0] == "-": positive = False num = num[1:] result = 0 unit = 1 if cur != 10: ...
identifier_body
scale_strict.py
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represen...
elif value == 64: value = 62 elif value == 95: value = 63 assert value <= cur, "Digit larger than original base. v:%d(%s) b:%d\nCall: scale(%d, %d, %s)" % (value, i, cur, cur, res, num) result += value * unit unit *= cur result = str(result) # Out...
elif value in range(65, 92): value -= 55 elif value in range(97, 123): value -= 61
random_line_split
scale_strict.py
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represen...
(cur, res, num): # int, int, str -> str # Default Settings num = str(num) iscaps = False positive = True # Input if cur == res: return num if num == "0": return "0" assert cur in range(2, 65) and res in range(2, 65), "Base not defined." if num[0] == "-": positive = False...
scale
identifier_name
scale_strict.py
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represen...
elif value == 64: value = 62 elif value == 95: value = 63 assert value <= cur, "Digit larger than original base. v:%d(%s) b:%d\nCall: scale(%d, %d, %s)" % (value, i, cur, cur, res, num) result += value * unit unit *= cur result = str(result) # Ou...
value -= 61
conditional_block
Keep2ShareCc.py
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" __version__ = "0.25" __status__...
def handle_captcha(self): post_data = {'free' : 1, 'freeDownloadRequest': 1, 'uniqueId' : self.fid, 'yt0' : ''} m = re.search(r'id="(captcha\-form)"', self.html) self.log_debug("captcha-...
self.fid = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1) self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) # self.log_debug(self.fid) # self.log_debug(pyfile.url) self.check_errors() m = re.search(self.LINK_FREE_PA...
identifier_body
Keep2ShareCc.py
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" __version__ = "0.25" __status__...
LINK_FREE_PATTERN = r'"(.+?url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';' LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' TEMP_ERROR_PATTERN = r'>...
SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' TEMP_OFFLINE_PATTERN = r'Downloading blocked due to'
random_line_split
Keep2ShareCc.py
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" __version__ = "0.25" __status__...
(self): m = re.search(self.TEMP_ERROR_PATTERN, self.html) if m: self.info['error'] = m.group(1) self.wantReconnect = True self.retry(wait_time=30 * 60, msg=m.group(0)) m = re.search(self.ERROR_PATTERN, self.html) if m: errmsg = self.info['...
check_errors
identifier_name
Keep2ShareCc.py
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" __version__ = "0.25" __status__...
m = re.search(self.ERROR_PATTERN, self.html) if m: errmsg = self.info['error'] = m.group(1) self.error(errmsg) m = re.search(self.WAIT_PATTERN, self.html) if m: self.log_debug("Hoster told us to wait for %s" % m.group(1)) #: String to t...
self.info['error'] = m.group(1) self.wantReconnect = True self.retry(wait_time=30 * 60, msg=m.group(0))
conditional_block
context.rs
use std::path::Path; use std::fs; use std::io; use std::path::PathBuf; use std::result; use std::time::Duration; use uuid; pub use io::KeyWrapper; use io::{FileExtensions, Disks, TerminalPrompt}; use model::{DbLocation, PeroxideDb, YubikeySlot, YubikeyEntryType}; use cryptsetup_rs::device::CryptDevice; pub type Resu...
db_location: DbLocation, password_input_timeout: Option<Duration>, } impl MainContext { pub fn new(location: DbLocation) -> MainContext { MainContext { db_location: location, password_input_timeout: Some(Duration::new(30, 0)), } } pub fn trace_on() { ...
fn save_peroxide_db(&self, db: &PeroxideDb) -> Result<()>; } #[derive(Debug)] pub struct MainContext {
random_line_split
context.rs
use std::path::Path; use std::fs; use std::io; use std::path::PathBuf; use std::result; use std::time::Duration; use uuid; pub use io::KeyWrapper; use io::{FileExtensions, Disks, TerminalPrompt}; use model::{DbLocation, PeroxideDb, YubikeySlot, YubikeyEntryType}; use cryptsetup_rs::device::CryptDevice; pub type Resu...
<'a>(&'a self) -> &'a DbLocation { &self.db_location } } impl KeyfileInput for MainContext { fn read_keyfile(&self, path: &Path) -> Result<KeyWrapper> { self.db_location .open_relative_path(path) .and_then(|mut file| KeyWrapper::read(&mut file)) .map_err(|err...
db_location
identifier_name
context.rs
use std::path::Path; use std::fs; use std::io; use std::path::PathBuf; use std::result; use std::time::Duration; use uuid; pub use io::KeyWrapper; use io::{FileExtensions, Disks, TerminalPrompt}; use model::{DbLocation, PeroxideDb, YubikeySlot, YubikeyEntryType}; use cryptsetup_rs::device::CryptDevice; pub type Resu...
pub fn trace_on() { CryptDevice::enable_debug(true); } } impl HasDbLocation for MainContext { fn db_location<'a>(&'a self) -> &'a DbLocation { &self.db_location } } impl KeyfileInput for MainContext { fn read_keyfile(&self, path: &Path) -> Result<KeyWrapper> { self.db_loc...
{ MainContext { db_location: location, password_input_timeout: Some(Duration::new(30, 0)), } }
identifier_body
macro-crate-does-hygiene-work.rs
// Copyright 2013-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...
{ let x = 3; assert_eq!(3, identity!(x)); assert_eq!(6, identity!(x+x)); let x = 4; assert_eq!(4, identity!(x)); }
identifier_body
macro-crate-does-hygiene-work.rs
// Copyright 2013-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...
// Issue #15750: a macro that internally parses its input and then // uses `quote_expr!` to rearrange it should be hygiene-preserving. #![feature(plugin)] #![plugin(macro_crate_test)] fn main() { let x = 3; assert_eq!(3, identity!(x)); assert_eq!(6, identity!(x+x)); let x = 4; assert_eq!(4, identi...
random_line_split
macro-crate-does-hygiene-work.rs
// Copyright 2013-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...
() { let x = 3; assert_eq!(3, identity!(x)); assert_eq!(6, identity!(x+x)); let x = 4; assert_eq!(4, identity!(x)); }
main
identifier_name
forms.py
from __future__ import absolute_import, unicode_literals import logging from django import forms from django.contrib import messages from django.http import Http404 from django.utils.encoding import smart_str from easy_maps.models import Address from . import lib log = logging.getLogger(__name__) class AddressFor...
(): return Address.objects.only('address').order_by('-id').all()
get_addresses
identifier_name
forms.py
from __future__ import absolute_import, unicode_literals import logging from django import forms from django.contrib import messages from django.http import Http404 from django.utils.encoding import smart_str from easy_maps.models import Address from . import lib log = logging.getLogger(__name__) class AddressFor...
@staticmethod def get_addresses(): return Address.objects.only('address').order_by('-id').all()
if instance.geocode_error or not instance.computed_address: message_ = 'Geocode Error' log.debug("%s : %s" % (smart_str(str(message_)), self.cleaned_data['address'])) self._update_errors(message_) return False return True
identifier_body
forms.py
from __future__ import absolute_import, unicode_literals import logging from django import forms from django.contrib import messages from django.http import Http404 from django.utils.encoding import smart_str from easy_maps.models import Address from . import lib log = logging.getLogger(__name__) class AddressFor...
return True @staticmethod def get_addresses(): return Address.objects.only('address').order_by('-id').all()
message_ = 'Geocode Error' log.debug("%s : %s" % (smart_str(str(message_)), self.cleaned_data['address'])) self._update_errors(message_) return False
conditional_block
forms.py
from __future__ import absolute_import, unicode_literals import logging from django import forms from django.contrib import messages from django.http import Http404 from django.utils.encoding import smart_str from easy_maps.models import Address from . import lib log = logging.getLogger(__name__) class AddressFor...
part, instance.__class__.__name__, instance.address ) if added_to_fusion_table: f_part = part + "%s to fusion table: %s" f_message_ = f_part % (...
added_to_fusion_table = True if instance: part = "Successfully added a new " message_ = "%s %s: %s" % (
random_line_split
VirtualTimeScheduler.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var AsyncAction_1 = require('./AsyncAction'); va...
(scheduler, work, index) { if (index === void 0) { index = scheduler.index += 1; } _super.call(this, scheduler, work); this.scheduler = scheduler; this.work = work; this.index = index; this.index = scheduler.index = index; } VirtualAction.prototype.schedule = func...
VirtualAction
identifier_name
VirtualTimeScheduler.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var AsyncAction_1 = require('./AsyncAction'); va...
actions.push(this); actions.sort(VirtualAction.sortActions); return true; }; VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } return undefined; }; VirtualAction.sortActions = function (a, b) { ...
random_line_split
VirtualTimeScheduler.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var AsyncAction_1 = require('./AsyncAction'); va...
VirtualAction.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } if (!this.id) { return _super.prototype.schedule.call(this, state, delay); } // If an action is rescheduled, we save allocations by mutating its state, // pushing it...
{ if (index === void 0) { index = scheduler.index += 1; } _super.call(this, scheduler, work); this.scheduler = scheduler; this.work = work; this.index = index; this.index = scheduler.index = index; }
identifier_body
VirtualTimeScheduler.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var AsyncAction_1 = require('./AsyncAction'); va...
}; return VirtualAction; }(AsyncAction_1.AsyncAction)); exports.VirtualAction = VirtualAction; //# sourceMappingURL=VirtualTimeScheduler.js.map
{ return -1; }
conditional_block
test5.py
__author__ = 'phoetrymaster' import subprocess nodatain = -3000 nodataout = -3000 inputshape = "'/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/DepartmentSelection/ARG_adm/pellegrini.shp'" inputimg = "'/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS 7_2012-2013/argentina_1/test.tif'" o...
subprocess.call("gdalwarp -t_srs {0} -srcnodata {1} -dstnodata {2} -crop_to_cutline -cutline {3} {4} {5} -of {6}".format(outprj, nodatain, nodataout, inputshape, inputimg, outputimg, outformat), shell=True)
random_line_split
emptyGroups.js
var async = require('async'); var helpers = require('../../../helpers/aws'); module.exports = { title: 'Empty Groups', category: 'IAM', description: 'Ensures all groups have at least one member', more_info: 'While having empty groups does not present a direct security risk, it does broaden the manageme...
if (!listGroups.data.length) { helpers.addResult(results, 0, 'No groups found'); return callback(null, results, source); } async.each(listGroups.data, function(group, cb){ if (!group.GroupName) return cb(); var getGroup = helpers.addSou...
{ helpers.addResult(results, 3, 'Unable to query for groups: ' + helpers.addError(listGroups)); return callback(null, results, source); }
conditional_block
emptyGroups.js
var async = require('async'); var helpers = require('../../../helpers/aws'); module.exports = { title: 'Empty Groups', category: 'IAM', description: 'Ensures all groups have at least one member', more_info: 'While having empty groups does not present a direct security risk, it does broaden the manageme...
var region = helpers.defaultRegion(settings); var listGroups = helpers.addSource(cache, source, ['iam', 'listGroups', region]); if (!listGroups) return callback(null, results, source); if (listGroups.err || !listGroups.data) { helpers.addResult(results, 3, ...
var source = {};
random_line_split
NB.py
from sklearn import datasets import numpy as np iris = datasets.load_iris() from sklearn.naive_bayes import GaussianNB from sklearn.naive_bayes import MultinomialNB import scipy.io epsilon=0.001 data=scipy.io.loadmat('arr.mat') test=scipy.io.loadmat('test.mat') labels=scipy.io.loadmat('labels.mat') gnb = GaussianNB() ...
foo.close() #print("Number of mislabeled points out of a total %d points : %d" % (dictarray.shape[0],(labels_1!= y_pred).sum())) #print y_pred
if results[i]==1: str_var="hit" elif results[i]==0: str_var="no hit" foo.write(str(results[i])+" "+str(25*i)+"-"+str(25*i+25)+" "+str_var+" "+"\n")
conditional_block
NB.py
from sklearn import datasets import numpy as np iris = datasets.load_iris() from sklearn.naive_bayes import GaussianNB from sklearn.naive_bayes import MultinomialNB import scipy.io epsilon=0.001 data=scipy.io.loadmat('arr.mat') test=scipy.io.loadmat('test.mat') labels=scipy.io.loadmat('labels.mat') gnb = GaussianNB() ...
print results foo=open("audio.txt","rw+") ''' y_pred=temp_fit.predict(test_array) print y_pred ''' time_var=0 for i in range(len(results)): if results[i]==1: str_var="hit" elif results[i]==0: str_var="no hit" foo.write(str(results[i])+" "+str(25*i)+"-"+str(25*i+25)+" "+str_var+" "+"\n") foo.close...
for i in range(test_array.shape[0]): y_pred=temp_fit.predict(test_array[i]) results.append(y_pred[0])
random_line_split
create-product-price.component.ts
import { NotificationsService } from 'angular2-notifications'; import { selector } from 'rxjs/operator/multicast'; import { LocalDataSource } from 'ng2-smart-table'; import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { any } from 'codelyzer/util/function'; import { ...
resetProduct() { this.product = {}; } isAllFeildsChecked() { if (this.product.ProductPrice) { this.isFormValid = false; } else { this.isFormValid = true; } } isProductExist(product) { var a = this.productList.filter(prod => p...
{ this.isFormValid = true; this.formIsDirty = false; this.isSuccess = false; this.isFormTouched = true; this.productFeildTouched = true; setTimeout(this.formChanged.emit('changed'), 1000); }
identifier_body
create-product-price.component.ts
import { NotificationsService } from 'angular2-notifications'; import { selector } from 'rxjs/operator/multicast'; import { LocalDataSource } from 'ng2-smart-table'; import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { any } from 'codelyzer/util/function'; import { ...
(val: boolean) { } @Input() productDetails: any; @Output() onSaveProduct: EventEmitter<any> = new EventEmitter(); @Output() onUpdateProduct: EventEmitter<any> = new EventEmitter(); @Output() closeNewProduct: EventEmitter<any> = new EventEmitter(); @Output() formChanged = new EventEmitter(); ...
mIOpen
identifier_name
create-product-price.component.ts
import { NotificationsService } from 'angular2-notifications'; import { selector } from 'rxjs/operator/multicast'; import { LocalDataSource } from 'ng2-smart-table'; import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { any } from 'codelyzer/util/function'; import { ...
selector: 'create-product-price', }) export class CreateProductPriceComponent implements OnInit, AfterContentInit { private _product: any = {}; isFormValid: boolean = true; isSuccess = false; productFeildTouched: boolean = false; @Input() productList: MapProducts[] = []; @Input() ge...
random_line_split
create-product-price.component.ts
import { NotificationsService } from 'angular2-notifications'; import { selector } from 'rxjs/operator/multicast'; import { LocalDataSource } from 'ng2-smart-table'; import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { any } from 'codelyzer/util/function'; import { ...
; this.isNewProduct ? this.onSaveProduct.emit(this.product) : this.onUpdateProduct.emit(this.product); if (!this.isNewProduct) { this.isSuccess = false; } } spaceRemoverFn(value) { this.product.ProductName = value.replace(/^\s+|\s+$/g, ''); } validateProduct(product) { i...
{ this.isSuccess = false; return }
conditional_block
manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2011-2015 Slack # # 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 ...
execute_from_command_line(sys.argv)
random_line_split
manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2011-2015 Slack # # 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 ...
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.develop") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
conditional_block
sphere.rs
// Copyright Colin Sherratt 2014 // // 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...
(&self, u: usize, v: usize) -> (f32, f32, f32) { let u = (u as f32 / self.sub_u as f32) * PI * 2.; let v = (v as f32 / self.sub_v as f32) * PI; (u.cos() * v.sin(), u.sin() * v.sin(), v.cos()) } } impl Iterator for SphereUV { type Item = Polygon<(f32, f32, f32)>; ...
vert
identifier_name
sphere.rs
// Copyright Colin Sherratt 2014 // // 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...
} impl Iterator for SphereUV { type Item = Polygon<(f32, f32, f32)>; fn size_hint(&self) -> (usize, Option<usize>) { let n = (self.sub_v - self.v) * self.sub_u + (self.sub_u - self.u); (n, Some(n)) } fn next(&mut self) -> Option<Polygon<(f32, f32, f32)>> { if self.u == self....
{ let u = (u as f32 / self.sub_u as f32) * PI * 2.; let v = (v as f32 / self.sub_v as f32) * PI; (u.cos() * v.sin(), u.sin() * v.sin(), v.cos()) }
identifier_body
sphere.rs
// Copyright Colin Sherratt 2014 // // 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...
pub fn new(u: usize, v: usize) -> SphereUV { SphereUV { u: 0, v: 0, sub_u: u, sub_v: v } } fn vert(&self, u: usize, v: usize) -> (f32, f32, f32) { let u = (u as f32 / self.sub_u as f32) * PI * 2.; let v = (v as f32 / self.sub_v...
/// Create a new sphere. /// `u` is the number of points across the equator of the sphere. /// `v` is the number of points from pole to pole.
random_line_split
iso.js
$(function(){ var $container = $('#instafeed'); $container.on("insta-ready", function() { $container.isotope({ layoutMode: 'masonry', //resizable: false, // disable normal resizing // set columnWidth to a percentage of container width masonry: { columnWidth: 125 } }); /* $(window)....
return false; }); }) });
{ // otherwise, apply new options $container.isotope( options ); }
conditional_block
iso.js
$(function(){ var $container = $('#instafeed'); $container.on("insta-ready", function() { $container.isotope({ layoutMode: 'masonry', //resizable: false, // disable normal resizing // set columnWidth to a percentage of container width masonry: { columnWidth: 125 } }); /* $(window).s...
$('body,html').animate({ scrollTop: pos.top - 100 }, 1000); // make option object dynamically, i.e. { filter: '.my-filter-class' } var options = {}, key = $optionSet.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' as false boolean value = value === 'fal...
pos = container.offset();
random_line_split
App.ts
import { AvatarAztecJade } from "./AvatarAztecJade"; import { AvatarOwl } from "./AvatarOwl"; import { Coord } from "./Coord"; import { GameMode } from "./GameMode"; // import { GameMode2pLocal } from "./GameMode2pLocal"; import { GameMode2pAi } from "./GameMode2pAi"; import { PieceSprite } from "./PieceSprite"; import...
} } render() { // Draw the board background. this.context.fillStyle = "rgba(0, 0, 0, 1)"; this.context.fillRect(0, 0, this.getWidth(), this.getHeight()); // Boards and avatars. this.gameMode.draw( this.context, new Coord({ x: this.getWidth(), y: this.getHeight(), }), ); // FPS cou...
{ // TODO // console.log("Game Over"); }
conditional_block
App.ts
import { AvatarAztecJade } from "./AvatarAztecJade"; import { AvatarOwl } from "./AvatarOwl"; import { Coord } from "./Coord"; import { GameMode } from "./GameMode"; // import { GameMode2pLocal } from "./GameMode2pLocal"; import { GameMode2pAi } from "./GameMode2pAi"; import { PieceSprite } from "./PieceSprite"; import...
static sprites: SpriteSet; static spriteSheet: SpriteSheet; static getSprites() { if (!this.sprites) { this.sprites = this.getSpriteSheet().getSprites(); } return this.sprites; } static getSpriteSheet() { if (!this.spriteSheet) { this.spriteSheet = new SpriteSheet(this.getSpriteSheetSettings());...
{ this.context = options.context; // this.gameMode = new GameMode2pLocal(); this.gameMode = new GameMode2pAi(); this.lastRenderTime = 0; // Make the canvas resolution match the displayed size. const makeCanvasFullWindow = () => { this.context.canvas.width = window.innerWidth * window.devicePixelRatio;...
identifier_body
App.ts
import { AvatarAztecJade } from "./AvatarAztecJade"; import { AvatarOwl } from "./AvatarOwl"; import { Coord } from "./Coord"; import { GameMode } from "./GameMode"; // import { GameMode2pLocal } from "./GameMode2pLocal"; import { GameMode2pAi } from "./GameMode2pAi"; import { PieceSprite } from "./PieceSprite"; import...
() { const requestAnimFrame = () => new Promise<number>(resolve => { (window.requestAnimationFrame || (window as any).webkitRequestAnimationFrame || (window as any).mozRequestAnimationFrame || (window as any).oRequestAnimationFrame || (window as any).msRequestAnimationFrame || (callbac...
startRenderLoop
identifier_name
App.ts
import { AvatarAztecJade } from "./AvatarAztecJade"; import { AvatarOwl } from "./AvatarOwl"; import { Coord } from "./Coord"; import { GameMode } from "./GameMode"; // import { GameMode2pLocal } from "./GameMode2pLocal"; import { GameMode2pAi } from "./GameMode2pAi"; import { PieceSprite } from "./PieceSprite"; import...
// this.gameMode = new GameMode2pLocal(); this.gameMode = new GameMode2pAi(); this.lastRenderTime = 0; // Make the canvas resolution match the displayed size. const makeCanvasFullWindow = () => { this.context.canvas.width = window.innerWidth * window.devicePixelRatio; this.context.canvas.height = win...
this.context = options.context;
random_line_split
database.py
import os from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker metadata = MetaData() def get_sa_db_uri(driver='', username='', password='', host='', port='', database=''): """get SQLAlchemy DB URI: driver://username:password@host:port/database""" assert driv...
(self): metadata.create_all(bind=self.engine)
init_database
identifier_name
database.py
import os from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker metadata = MetaData() def get_sa_db_uri(driver='', username='', password='', host='', port='', database=''): """get SQLAlchemy DB URI: driver://username:password@host:port/database""" assert driv...
def __init__(self, db_uri): self.engine = create_engine(db_uri, convert_unicode=True) self.session = scoped_session( sessionmaker(autocommit=False, autoflush=False, bind=self.engine)) def init_database(self): metadata.create_all(...
identifier_body
database.py
import os from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker metadata = MetaData() def get_sa_db_uri(driver='', username='', password='', host='', port='', database=''): """get SQLAlchemy DB URI: driver://username:password@host:port/database""" assert driv...
return db_uri class DB(object): def __init__(self, db_uri): self.engine = create_engine(db_uri, convert_unicode=True) self.session = scoped_session( sessionmaker(autocommit=False, autoflush=False, bind=self.engine)) def init_d...
db_uri = ('%s://%s:%s@%s:%s/%s' % (driver, username, password, host, port, database))
conditional_block
database.py
import os from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker metadata = MetaData() def get_sa_db_uri(driver='', username='', password='', host='', port='', database=''): """get SQLAlchemy DB URI: driver://username:password@host:port/database""" assert driv...
db_file = database db_uri = '%s:///%s' % (driver, db_file) else: db_uri = ('%s://%s:%s@%s:%s/%s' % (driver, username, password, host, port, database)) return db_uri class DB(object): def __init__(self, db_uri): self.engine = create_engine(db_uri, conve...
db_file = os.path.abspath(database) else:
random_line_split
test_rfc4043.py
# # This file is part of pyasn1-modules software. # # Created by Russ Housley # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # import sys import unittest from pyasn1.codec.der.decoder import decode as der_decoder from pyasn1.codec.der.encoder import encode as der_encoder f...
self.assertEqual(assigner_oid, on['value']['assigner']) permanent_identifier_found = True self.assertTrue(permanent_identifier_found) suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) if __name__ == '__main__': result = unittest.Text...
self.assertEqual(perm_id_oid, on['type-id'])
random_line_split
test_rfc4043.py
# # This file is part of pyasn1-modules software. # # Created by Russ Housley # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # import sys import unittest from pyasn1.codec.der.decoder import decode as der_decoder from pyasn1.codec.der.encoder import encode as der_encoder f...
(self): self.asn1Spec = rfc5280.Certificate() def testDerCodec(self): substrate = pem.readBase64fromText(self.cert_pem_text) asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec) self.assertFalse(rest) self.assertTrue(asn1Object.prettyPrint()) self.asser...
setUp
identifier_name
test_rfc4043.py
# # This file is part of pyasn1-modules software. # # Created by Russ Housley # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # import sys import unittest from pyasn1.codec.der.decoder import decode as der_decoder from pyasn1.codec.der.encoder import encode as der_encoder f...
def testDerCodec(self): substrate = pem.readBase64fromText(self.cert_pem_text) asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec) self.assertFalse(rest) self.assertTrue(asn1Object.prettyPrint()) self.assertEqual(substrate, der_encoder(asn1Object)) p...
self.asn1Spec = rfc5280.Certificate()
identifier_body
test_rfc4043.py
# # This file is part of pyasn1-modules software. # # Created by Russ Housley # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # import sys import unittest from pyasn1.codec.der.decoder import decode as der_decoder from pyasn1.codec.der.encoder import encode as der_encoder f...
self.assertTrue(permanent_identifier_found) suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) if __name__ == '__main__': result = unittest.TextTestRunner(verbosity=2).run(suite) sys.exit(not result.wasSuccessful())
if gn['otherName'].hasValue(): on = gn['otherName'] self.assertEqual(perm_id_oid, on['type-id']) self.assertEqual(assigner_oid, on['value']['assigner']) permanent_identifier_found = True
conditional_block
mod.rs
// Copyright 2013-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...
//! //! Several other collection methods also return iterators to yield a sequence //! of results but avoid allocating an entire collection to store the result in. //! This provides maximum flexibility as `collect` or `extend` can be called to //! "pipe" the sequence into any collection if desired. Otherwise, the seque...
//! } //! ```
random_line_split
resolve_lock_lite.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::WriteData; use crate::storage::lock_manager::LockManager; use crate::storage::mvcc::MvccTxn; use crate::storage::txn::commands::{ Command, CommandExt, ReleasedLocks, ResponsePolicy, TypedCommand, WriteCommand, WriteContext, ...
}
{ let mut txn = MvccTxn::new( snapshot, self.start_ts, !self.ctx.get_not_fill_cache(), context.concurrency_manager, ); let rows = self.resolve_keys.len(); // ti-client guarantees the size of resolve_keys will not too large, so no necessary...
identifier_body
resolve_lock_lite.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::WriteData; use crate::storage::lock_manager::LockManager; use crate::storage::mvcc::MvccTxn; use crate::storage::txn::commands::{ Command, CommandExt, ReleasedLocks, ResponsePolicy, TypedCommand, WriteCommand, WriteContext, ...
(self, snapshot: S, context: WriteContext<'_, L>) -> Result<WriteResult> { let mut txn = MvccTxn::new( snapshot, self.start_ts, !self.ctx.get_not_fill_cache(), context.concurrency_manager, ); let rows = self.resolve_keys.len(); // ti-clien...
process_write
identifier_name
resolve_lock_lite.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::WriteData; use crate::storage::lock_manager::LockManager; use crate::storage::mvcc::MvccTxn; use crate::storage::txn::commands::{ Command, CommandExt, ReleasedLocks, ResponsePolicy, TypedCommand, WriteCommand, WriteContext, ...
); } released_locks.wake_up(context.lock_mgr); context.statistics.add(&txn.take_statistics()); let write_data = WriteData::from_modifies(txn.into_modifies()); Ok(WriteResult { ctx: self.ctx, to_be_write: write_data, rows, pr: Proce...
{ cleanup(&mut txn, key, TimeStamp::zero(), false)? }
conditional_block
resolve_lock_lite.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::WriteData; use crate::storage::lock_manager::LockManager;
WriteResult, }; use crate::storage::txn::{cleanup, commit, Result}; use crate::storage::{ProcessResult, Snapshot}; use txn_types::{Key, TimeStamp}; command! { /// Resolve locks on `resolve_keys` according to `start_ts` and `commit_ts`. ResolveLockLite: cmd_ty => (), display => "kv::resolve_...
use crate::storage::mvcc::MvccTxn; use crate::storage::txn::commands::{ Command, CommandExt, ReleasedLocks, ResponsePolicy, TypedCommand, WriteCommand, WriteContext,
random_line_split
viewmanager.js
var ViewManager = { views: [], mapper: {}, dispatcher: null, find: function(name) { var result = null; this.views.forEach(function(v) { if (v.name == name) result = v.view; }); return result; }, // get is an alias of find get: fun...
(map) { map.forEach(function(elem) { var vm_name = capitalize(elem.name) + 'ViewModel'; // use javascript reflection to get viewmodel object and create instance var vm = new window[namespace][vm_name](); ko.applyBindings(vm, document.getElem...
create_and_bind_viewmodels
identifier_name
viewmanager.js
var ViewManager = { views: [], mapper: {}, dispatcher: null, find: function(name) { var result = null; this.views.forEach(function(v) { if (v.name == name) result = v.view; }); return result; }, // get is an alias of find get: fun...
else v.view.visible(false); }); }, doSwitch: function(map, type, jso) { var self = this; map.forEach(function(elem) { if (elem.type == type) self.showView(elem.name, jso); }); }, switchView: function(jso) { ...
{ v.view.init(jso); v.view.visible(true); }
conditional_block
viewmanager.js
var ViewManager = { views: [], mapper: {}, dispatcher: null, find: function(name) { var result = null; this.views.forEach(function(v) { if (v.name == name) result = v.view; }); return result; }, // get is an alias of find get: fun...
var jso = APPLICATION_ENVIRON.rdf_converter.make_simple_jso(request); if (ViewManager.switchView(jso)) { // resource accepted history_tracker.accept_url(); } else { // we cannot handle this resource ...
function get_resource_and_show_view(resource_url, history_tracker) { ld_util.get(resource_url, function(request){ if (request.status==200) {
random_line_split
viewmanager.js
var ViewManager = { views: [], mapper: {}, dispatcher: null, find: function(name) { var result = null; this.views.forEach(function(v) { if (v.name == name) result = v.view; }); return result; }, // get is an alias of find get: fun...
this.mapper = mapper; var ns = window[namespace]; create_and_bind_viewmodels(mapper.containers); create_and_bind_viewmodels(mapper.types); /* var DispatcherFactory = (Dispatcher === undefined) ? misc_util.Dispatcher : Dispatcher; var my_dispatcher = new DispatcherFact...
{ // precondition: don't claim click with href of #xyz or '' var href = element.getAttribute('href'); if (!href || href === '' || href[0] == '#') return false; var segments = element.pathname.split('/'); var result = false; if (se...
identifier_body
thread.rs
// Testing the the display of JoinHandle and Thread in cdb. // cdb-only // min-cdb-version: 10.0.18317.1001 // compile-flags:-g // === CDB TESTS ================================================================================== // // cdb-command:g // // cdb-command:dx join_handle,d // cdb-check:join_handle,d [Type...
() {}
zzz
identifier_name
thread.rs
// Testing the the display of JoinHandle and Thread in cdb. // cdb-only // min-cdb-version: 10.0.18317.1001 // compile-flags:-g // === CDB TESTS ================================================================================== // // cdb-command:g // // cdb-command:dx join_handle,d // cdb-check:join_handle,d [Type...
{}
identifier_body
thread.rs
// Testing the the display of JoinHandle and Thread in cdb.
// min-cdb-version: 10.0.18317.1001 // compile-flags:-g // === CDB TESTS ================================================================================== // // cdb-command:g // // cdb-command:dx join_handle,d // cdb-check:join_handle,d [Type: std::thread::JoinHandle<tuple$<> >] // cdb-check: [...] __0 ...
// cdb-only
random_line_split
busy-backdrop.component.ts
/** * @file Component: BusyBackdrop * @author yumao<yuzhang.lille@gmail.com> */ import { Component, trigger, state, style, transition, animate } from '@angular/core'; import {PromiseTrackerService} from './promise-tracker.service'; const inactiveStyle = style({ opacity: 0, }); const ti...
}
{ return this.tracker.isActive(); }
identifier_body
busy-backdrop.component.ts
/** * @file Component: BusyBackdrop * @author yumao<yuzhang.lille@gmail.com> */ import { Component, trigger, state, style, transition, animate } from '@angular/core'; import {PromiseTrackerService} from './promise-tracker.service'; const inactiveStyle = style({ opacity: 0, }); const ti...
() { return this.tracker.isActive(); } }
isActive
identifier_name
busy-backdrop.component.ts
/** * @file Component: BusyBackdrop * @author yumao<yuzhang.lille@gmail.com> */ import {
state, style, transition, animate } from '@angular/core'; import {PromiseTrackerService} from './promise-tracker.service'; const inactiveStyle = style({ opacity: 0, }); const timing = '.3s ease'; @Component({ selector: 'ng-busy-backdrop', template: ` <div class="ng-busy-backdrop" ...
Component, trigger,
random_line_split
Array.js
/** The MIT License (MIT) Copyright (c) 2014 MyChannel-Apps.de 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 to use, copy, mod...
if(!Array.prototype.random) { Object.defineProperty(Array.prototype, 'random', { enumerable: false, configurable: false, writable: false, value: function() { return this[RandomOperations.nextInt(this.length)]; } }); } if(!Array.prototype.exists) { Object.defineProperty(Array.prototype, 'exists', { ...
Object.defineProperty(Array.prototype, 'each', { enumerable: false, configurable: false, writable: false, value: function(callback) { for(var index = 0; index < this.length; index++) { if(callback.apply(this[index], index) === false) { break; } } } }); }
conditional_block
Array.js
/** The MIT License (MIT) Copyright (c) 2014 MyChannel-Apps.de 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 to use, copy, mod...
if(!Array.prototype.size) { Object.defineProperty(Array.prototype, 'size', { enumerable: false, configurable: false, writable: false, value: function() { return this.length; } }); }
} }); }
random_line_split
remove.rs
use libc::{c_ulong, c_ulonglong, c_void}; use super::super::error_type::ErrorType; use super::super::instance::Instance; use super::format_error; #[repr(C)] #[derive(Debug, Clone, Copy)] pub struct RemoveInternal { pub cookie: *mut c_void, pub key: *const c_void, pub nkey: c_ulong, pub cas: c_ulonglo...
key: internal.key(), cas: internal.cas, rc: internal.rc, version: internal.version, rflags: internal.rflags } } }
Remove {
random_line_split
remove.rs
use libc::{c_ulong, c_ulonglong, c_void}; use super::super::error_type::ErrorType; use super::super::instance::Instance; use super::format_error; #[repr(C)] #[derive(Debug, Clone, Copy)] pub struct RemoveInternal { pub cookie: *mut c_void, pub key: *const c_void, pub nkey: c_ulong, pub cas: c_ulonglo...
{ pub key: Option<String>, pub cas: u64, pub rc: ErrorType, pub version: u16, pub rflags: u16, } impl Remove { pub fn new(internal: &RemoveInternal) -> Remove { Remove { key: internal.key(), cas: internal.cas, rc: internal.rc, version: in...
Remove
identifier_name
RgbaColour.ts
import { Optional } from '@ephox/katamari'; import { Hex, Hsv, Rgba } from './ColourTypes'; import * as HexColour from './HexColour'; const min = Math.min; const max = Math.max; const round = Math.round; const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i; const rgbaRegex = /^\s*rgba\s*\(\s*(\d...
const side = hue / 60; const chroma = brightness * saturation; const x = chroma * (1 - Math.abs(side % 2 - 1)); const match = brightness - chroma; switch (Math.floor(side)) { case 0: r = chroma; g = x; b = 0; break; case 1: r = x; g = chroma; b = 0; ...
{ r = g = b = round(255 * brightness); return rgbaColour(r, g, b, 1); }
conditional_block
RgbaColour.ts
import { Optional } from '@ephox/katamari'; import { Hex, Hsv, Rgba } from './ColourTypes'; import * as HexColour from './HexColour'; const min = Math.min; const max = Math.max; const round = Math.round; const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i; const rgbaRegex = /^\s*rgba\s*\(\s*(\d...
case 5: r = chroma; g = 0; b = x; break; default: r = g = b = 0; } r = round(255 * (r + match)); g = round(255 * (g + match)); b = round(255 * (b + match)); return rgbaColour(r, g, b, 1); }; // Temporarily using: https://stackoverflow.com/questions/5623838/rgb-to-hex-...
break;
random_line_split
conf.py
# -*- coding: utf-8 -*- # # Stetl documentation build configuration file, created by # sphinx-quickstart on Sun Jun 2 11:01:36 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
# non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for th...
# There are two options for replacing |today|: either, you set today to some
random_line_split
remove.rs
use crate::database::models::ToU64; use diesel::prelude::*; use lalafell::commands::prelude::*; use lalafell::error::*; use serenity::model::id::GuildId; pub struct RemoveCommand; #[derive(Debug, StructOpt)] pub struct Params { #[structopt(help = "The ID of the auto reply to remove")] id: i32 } impl<'a> Remov...
if affected > 0 { Ok(CommandSuccess::default()) } else { Err("No auto replies were deleted.".into()) } } }
diesel::delete( dsl::auto_replies.filter(dsl::id.eq(params.id).and(dsl::server_id.eq(guild.to_u64()))) ) .execute(c) }).chain_err(|| "could not delete auto_replies")?;
random_line_split
remove.rs
use crate::database::models::ToU64; use diesel::prelude::*; use lalafell::commands::prelude::*; use lalafell::error::*; use serenity::model::id::GuildId; pub struct RemoveCommand; #[derive(Debug, StructOpt)] pub struct Params { #[structopt(help = "The ID of the auto reply to remove")] id: i32 } impl<'a> Remov...
} }
{ Err("No auto replies were deleted.".into()) }
conditional_block
remove.rs
use crate::database::models::ToU64; use diesel::prelude::*; use lalafell::commands::prelude::*; use lalafell::error::*; use serenity::model::id::GuildId; pub struct
; #[derive(Debug, StructOpt)] pub struct Params { #[structopt(help = "The ID of the auto reply to remove")] id: i32 } impl<'a> RemoveCommand { #[allow(clippy::needless_pass_by_value)] pub fn run(&self, guild: GuildId, params: Params) -> CommandResult<'a> { let affected = crate::bot::with_connection(|c| { ...
RemoveCommand
identifier_name
supersocket.py
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Philippe Biondi <phil@secdev.org> # This program is published under a GPLv2 license """ SuperSocket. """ from __future__ import absolute_import from select import select, error as select_error import errno imp...
(self, sock): self.ins = sock self.outs = sock class StreamSocket(SimpleSocket): desc = "transforms a stream socket into a layer 2" nonblocking_socket = True def __init__(self, sock, basecls=None): if basecls is None: basecls = conf.raw_layer SimpleSocket.__ini...
__init__
identifier_name
supersocket.py
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Philippe Biondi <phil@secdev.org> # This program is published under a GPLv2 license """ SuperSocket. """ from __future__ import absolute_import from select import select, error as select_error import errno imp...
x = len(self._buf) pkt = self.basecls(self._buf) pad = pkt.getlayer(conf.padding_layer) if pad is not None and pad.underlayer is not None: del(pad.underlayer.payload) while pad is not None and not isinstance(pad, scapy.packet.NoPayload): x -= len(pad.lo...
buf = self.ins.recv(x) if len(buf) == 0: raise socket.error((100, "Underlying stream socket tore down")) self._buf += buf
conditional_block
supersocket.py
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Philippe Biondi <phil@secdev.org> # This program is published under a GPLv2 license """ SuperSocket. """ from __future__ import absolute_import from select import select, error as select_error import errno imp...
""" desc = "Act as the host's peer of a tun / tap interface" def __init__(self, iface=None, mode_tun=None, *arg, **karg): self.iface = conf.iface if iface is None else iface self.mode_tun = ("tun" in self.iface) if mode_tun is None else mode_tun self.closed = True self.open...
self.tcpdump_proc.kill() class TunTapInterface(SuperSocket): """A socket to act as the host's peer of a tun / tap interface.
random_line_split
supersocket.py
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Philippe Biondi <phil@secdev.org> # This program is published under a GPLv2 license """ SuperSocket. """ from __future__ import absolute_import from select import select, error as select_error import errno imp...
def open(self): """Open the TUN or TAP device.""" if not self.closed: return self.outs = self.ins = open( "/dev/net/tun" if LINUX else ("/dev/%s" % self.iface), "r+b", buffering=0 ) if LINUX: from fcntl import ioctl ...
self.iface = conf.iface if iface is None else iface self.mode_tun = ("tun" in self.iface) if mode_tun is None else mode_tun self.closed = True self.open()
identifier_body
builtin-methods-reject-null-undefined-this.js
/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| o...
var methodNames = ClassToMethodMap[className]; for (var i = 0, sz = methodNames.length; i < sz; i++) { var method = methodNames[i]; testMethod(Class, className, method); } } /******************************************************************************/ if (typeof reportCompare === "function") rep...
for (var className in ClassToMethodMap) { var Class = this[className];
random_line_split
builtin-methods-reject-null-undefined-this.js
/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| o...
(Class, className, method) { var expr; // Try out explicit this values for (var i = 0, sz = badThisValues.length; i < sz; i++) { var badThis = badThisValues[i]; expr = className + ".prototype." + method + ".call(" + badThis + ")"; try { Class.prototype[method].call(badThis); throw ...
testMethod
identifier_name
builtin-methods-reject-null-undefined-this.js
/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| o...
for (var className in ClassToMethodMap) { var Class = this[className]; var methodNames = ClassToMethodMap[className]; for (var i = 0, sz = methodNames.length; i < sz; i++) { var method = methodNames[i]; testMethod(Class, className, method); } } /****************************************************...
{ var expr; // Try out explicit this values for (var i = 0, sz = badThisValues.length; i < sz; i++) { var badThis = badThisValues[i]; expr = className + ".prototype." + method + ".call(" + badThis + ")"; try { Class.prototype[method].call(badThis); throw new Error(expr + " didn't t...
identifier_body
builtin-methods-reject-null-undefined-this.js
/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| o...
// ..and for good measure.. expr = "(0, " + className + ".prototype." + method + ")()" try { // comma operator to call GetValue() on the method and de-Reference it (0, Class.prototype[method])(); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof Ty...
{ var badThis = badThisValues[i]; expr = className + ".prototype." + method + ".call(" + badThis + ")"; try { Class.prototype[method].call(badThis); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wr...
conditional_block
Switch.style.ts
import styled from 'styled-components'; import { shade } from 'polished'; import tokens from '../../tokens'; export const SwitchIndicator = styled.span` position: absolute; top: 0; left: 0; width: 0; bottom: 0; z-index: ${tokens.zIndices.above}; &[data-animated='true'] { transition: ${tokens.transitions.fas...
color: ${({ theme }) => theme.colors.inputBackgroundColor}; opacity: ${tokens.opacity.opaque}; } [aria-selected] ~ ${SwitchIndicator} { visibility: hidden; } [aria-selected="true"] ~ ${SwitchIndicator} { visibility: visible; } `;
transition: color ${tokens.transitions.normal}; } [aria-selected="true"] {
random_line_split
dates.py
import logging from datetime import datetime from django import template from django.utils import timezone register = template.Library() logger = logging.getLogger(__name__) @register.filter(expects_localtime=True) def fuzzy_time(time): """Formats a `datetime.time` object relative to the current time.""" dt...
@register.filter(expects_localtime=True) def fuzzy_date(date): """Formats a `datetime.datetime` object relative to the current time.""" if date.tzinfo is None: date = timezone.make_aware(date) now = timezone.localtime() if date <= now: diff = now - date seconds = diff.total...
"""Returns a `datetime.datetime` object from a `datetime.time` object using the current date.""" return datetime.combine(timezone.localdate(), time)
identifier_body