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
multi_tenancy.py
# -*- coding: utf-8 -*- # # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE project. # # 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: # # ...
@step(u'"(?P<number_of_notifications>.*)" notification is sent to RabbitMQ with the secondary tenant') @step(u'"(?P<number_of_notifications>.*)" notifications are sent to RabbitMQ with the secondary tenant') def notifications_are_received_by_secondary_consumer(context, number_of_notifications): assert_that(contex...
"Secondary RabbitMQ consumer has retrieved messages from the bus, and it should NOT")
random_line_split
multi_tenancy.py
# -*- coding: utf-8 -*- # # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE project. # # 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: # # ...
@step(u'no messages have been received by the secondary RabbitMQ consumer') def no_messages_received_for_secondary_tenant(context): print ("> Received main list: " + str(context.secondaty_rabbitmq_consumer.message_list)) print ("> Received seconday list: " + str(context.rabbitmq_consumer.message_list)) ass...
r element in context.table.rows: expected_message = dict(element.as_dict()) expected_message = _dataset_utils.prepare_data(expected_message) assert_that(expected_message, is_message_in_consumer_list(context.secondaty_rabbitmq_consumer.message_list), "A message with the expec...
identifier_body
multi_tenancy.py
# -*- coding: utf-8 -*- # # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE project. # # 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: # # ...
ontext): context.secondary_tenant_id = \ configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_FACTS_SERVICE_OS_SECONDARY_TENANT_ID] print ("> Initiating Cloto REST Client for the secondary Tenant") context.secondary_cloto_client = ClotoClient( username=configuratio...
ven_tenant_id_is_registered_in_cloto(c
identifier_name
bind_tcp.py
""" Custom-written pure python meterpreter/bind_tcp stager """ from tools.evasion.evasion_common import evasion_helpers from tools.evasion.evasion_common import encryption class PayloadModule: def __init__(self, cli_obj): # required options self.description = "pure windows/meterpreter/bind_tcp...
(self): # randomize all of the variable names used shellCodeName = evasion_helpers.randomString() socketName = evasion_helpers.randomString() clientSocketName = evasion_helpers.randomString() getDataMethodName = evasion_helpers.randomString() fdBufName = evasion_helpers....
generate
identifier_name
bind_tcp.py
""" Custom-written pure python meterpreter/bind_tcp stager """ from tools.evasion.evasion_common import evasion_helpers from tools.evasion.evasion_common import encryption class PayloadModule: def __init__(self, cli_obj):
self.description = "pure windows/meterpreter/bind_tcp stager, no shellcode" self.rating = "Excellent" self.name = "Pure Python Reverse TCP stager" self.path = "python/meterpreter/bind_tcp" self.cli_opts = cli_obj self.payload_source_code = "" self.language = "pyth...
# required options
random_line_split
bind_tcp.py
""" Custom-written pure python meterpreter/bind_tcp stager """ from tools.evasion.evasion_common import evasion_helpers from tools.evasion.evasion_common import encryption class PayloadModule: def __init__(self, cli_obj): # required options self.description = "pure windows/meterpreter/bind_tcp...
self.payload_source_code = payload_code return
payload_code = encryption.pyherion(payload_code)
conditional_block
bind_tcp.py
""" Custom-written pure python meterpreter/bind_tcp stager """ from tools.evasion.evasion_common import evasion_helpers from tools.evasion.evasion_common import encryption class PayloadModule: def __init__(self, cli_obj): # required options
def generate(self): # randomize all of the variable names used shellCodeName = evasion_helpers.randomString() socketName = evasion_helpers.randomString() clientSocketName = evasion_helpers.randomString() getDataMethodName = evasion_helpers.randomString() fdBufName ...
self.description = "pure windows/meterpreter/bind_tcp stager, no shellcode" self.rating = "Excellent" self.name = "Pure Python Reverse TCP stager" self.path = "python/meterpreter/bind_tcp" self.cli_opts = cli_obj self.payload_source_code = "" self.language = "python" ...
identifier_body
setup.py
# -*- coding: utf-8 -*- # Copyright (C) 2013 Michael Hogg # This file is part of bonemapy - See LICENSE.txt for information on usage and redistribution import bonemapy from distutils.core import setup setup( name = 'bonemapy', version = bonemapy.__version__, description = 'An ABAQUS plug-in to map bo...
"Development Status :: 4 - Beta", "Environment :: Other Environment", "Environment :: Plugins", "Intended Audience :: Healthcare Industry", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "...
"Programming Language :: Python :: 2.6",
random_line_split
fieldinfo.rs
// GObject Introspection Rust bindings. // Copyright (C) 2014 Luis Araujo <araujoc.luisf@gmail.com> // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the Licen...
/// Obtain the offset in bits of the field member, this is relative to the /// beginning of the struct or union. pub fn get_offset(info: *GIFieldInfo) -> int { unsafe { g_field_info_get_offset(info) as int } } /// Obtain the type of a field as a GITypeInfo. pub fn get_type(info: *GIFieldInfo) -> *GITypeInfo { ...
{ unsafe { g_field_info_get_size(info) as int } }
identifier_body
fieldinfo.rs
// GObject Introspection Rust bindings. // Copyright (C) 2014 Luis Araujo <araujoc.luisf@gmail.com> // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the Licen...
value: *GIArgument) -> GBoolean; } /// Obtain the flags for this GIFieldInfo. pub fn get_flags(info: *GIFieldInfo) -> Option<GIFieldInfoFlags> { let flag: Option<GIFieldInfoFlags> = FromPrimitive::from_i32(unsafe { g_field_info_get_flags(info) }); return flag } /// Obtai...
mem: GPointer, value: *GIArgument) -> GBoolean; fn g_field_info_set_field(info: *GIFieldInfo, mem: GPointer,
random_line_split
fieldinfo.rs
// GObject Introspection Rust bindings. // Copyright (C) 2014 Luis Araujo <araujoc.luisf@gmail.com> // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the Licen...
(info: *GIFieldInfo) -> int { unsafe { g_field_info_get_offset(info) as int } } /// Obtain the type of a field as a GITypeInfo. pub fn get_type(info: *GIFieldInfo) -> *GITypeInfo { unsafe { g_field_info_get_type(info) } } /// Reads a field identified by a GIFieldInfo from a C structure or union. pub fn get_fi...
get_offset
identifier_name
angular2.webpack.config.js
const path = require( 'path' ); const pkg = require( './package.json' ); const webpack = require( 'laxar-infrastructure' ).webpack( { context: __dirname, resolve: { extensions: [ '.js', '.jsx', '.ts', '.tsx' ] }, module: { rules: [ { test: /\.tsx?$/, exclude: /n...
] } } ); module.exports = [ webpack.library(), webpack.browserSpec( [ `./spec/${pkg.name}.spec.js` ] ) ];
exclude: path.resolve( __dirname, 'node_modules' ), loader: 'laxar-mocks/spec-loader' }
random_line_split
core.d.ts
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, } from "./types"; ex...
{ opts: InstanceOptions; errors?: ErrorObject[] | null; logger: Logger; readonly scope: ValueScope; readonly schemas: { [key: string]: SchemaEnv | undefined; }; readonly refs: { [ref: string]: SchemaEnv | string | undefined; }; readonly formats: { [name: stri...
Ajv
identifier_name
core.d.ts
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, } from "./types"; ex...
import type { Schema, AnySchema, AnySchemaObject, SchemaObject, AsyncSchema, Vocabulary, KeywordDefinition, AddedKeywordDefinition, AnyValidateFunction, ValidateFunction, AsyncValidateFunction, ErrorObject, Format, AddedFormat } from "./types"; import type { JSONSchemaType } from "./types/json-schema"; import { Validat...
export { JSONType } from "./compile/rules"; export { JSONSchemaType } from "./types/json-schema"; export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
random_line_split
1_name_phone_number.py
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'} def Handler() : while (1) : choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n")) print(choice) if (choice == 1) : if (student_phoneNumber_name) : phone_number = input("Enter student's p...
(x, y): student_phoneNumber_name[x] = y return; def SearchRecord(x): print(x) if (x in student_phoneNumber_name) : return student_phoneNumber_name[x] return False Handler() print(student_phoneNumber_name)
InsertRecord
identifier_name
1_name_phone_number.py
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'} def Handler() : while (1) : choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n")) print(choice) if (choice == 1) : if (student_phoneNumber_name) : phone_number = input("Enter student's ph...
InsertRecord(phone_number, name) elif (choice == 0) : break else: print("Enter correct choice") def InsertRecord(x, y): student_phoneNumber_name[x] = y return; def SearchRecord(x): print(x) if (x in student_phoneNumber_name) : return student_phoneNumber_name[x] return False Handler() p...
print("Record is empty ") elif (choice == 2) : phone_number = input("Enter student's phone number : ") name = input("Enter student's name : ") #best example to understand input() and raw_input()
random_line_split
1_name_phone_number.py
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'} def Handler() : while (1) : choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n")) print(choice) if (choice == 1) : if (student_phoneNumber_name) : phone_number = input("Enter student's p...
Handler() print(student_phoneNumber_name)
print(x) if (x in student_phoneNumber_name) : return student_phoneNumber_name[x] return False
identifier_body
1_name_phone_number.py
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'} def Handler() : while (1) : choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n")) print(choice) if (choice == 1) :
elif (choice == 2) : phone_number = input("Enter student's phone number : ") name = input("Enter student's name : ") #best example to understand input() and raw_input() InsertRecord(phone_number, name) elif (choice == 0) : break else: print("Enter correct choice") def InsertRecord(x, y): stud...
if (student_phoneNumber_name) : phone_number = input("Enter student's phone number : ") name = SearchRecord(phone_number) if (name) : print("name : " + name ) else : print(str(phone_number) + "Does not exist in record" + str(name)) else : print("Record is empty ")
conditional_block
gc.py
# Copyright 2011 Nicholas Bray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
for prev in merge._prev: assert isinstance(prev, tuple), merge._prev # HACK exposes the internals of merge filtered = [prev for prev in merge._prev if live(prev[0])] merge._prev = filtered
conditional_block
gc.py
# Copyright 2011 Nicholas Bray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
(self): self.merges = [] @defaultdispatch def default(self, node): pass @dispatch(cfg.MultiEntryBlock) def visitMerge(self, node): self.merges.append(node) def evaluate(compiler, g): logger = Logger() dfs = CFGDFS(post=logger) dfs.process(g.entryTerminal) def live(node): return node in dfs.processed...
__init__
identifier_name
gc.py
# Copyright 2011 Nicholas Bray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
def evaluate(compiler, g): logger = Logger() dfs = CFGDFS(post=logger) dfs.process(g.entryTerminal) def live(node): return node in dfs.processed for merge in logger.merges: for prev in merge._prev: assert isinstance(prev, tuple), merge._prev # HACK exposes the internals of merge filtered = [prev fo...
def __init__(self): self.merges = [] @defaultdispatch def default(self, node): pass @dispatch(cfg.MultiEntryBlock) def visitMerge(self, node): self.merges.append(node)
identifier_body
gc.py
# Copyright 2011 Nicholas Bray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
pass @dispatch(cfg.MultiEntryBlock) def visitMerge(self, node): self.merges.append(node) def evaluate(compiler, g): logger = Logger() dfs = CFGDFS(post=logger) dfs.process(g.entryTerminal) def live(node): return node in dfs.processed for merge in logger.merges: for prev in merge._prev: assert isin...
@defaultdispatch def default(self, node):
random_line_split
server.js
#!/usr/bin/env node "use strict"; // för pid-filen const fs = require('fs'); const path = require('path'); var pid = `${process.pid}`; // skriv pid-filen var filepathPID = path.join(__dirname, "pid"); fs.writeFile(filepathPID, pid, (err) => { if (err) {
console.log("PID saved at: " + __dirname); }); // skapa express-severn const bodyparser = require('body-parser'); var express = require('express'); var app = express(); var port = 1337; var staticfiles = path.join(__dirname, 'public'); app.set("views", path.join(__dirname, "views")); app.set("view engine", "pug"); ...
throw err; }
conditional_block
server.js
#!/usr/bin/env node "use strict"; // för pid-filen const fs = require('fs'); const path = require('path'); var pid = `${process.pid}`; // skriv pid-filen var filepathPID = path.join(__dirname, "pid"); fs.writeFile(filepathPID, pid, (err) => { if (err) { throw err; } console.log("PID saved at: " + __...
const move = require('./routes/move.js'); app.use("/move", move); const movereq = require('./routes/movereq.js'); app.use("/movereq", movereq); */ app.listen(port); module.exports = app;
app.use("/createacc", createacc); /*
random_line_split
event.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use gdk_ffi as ffi; use EventType; use Window; glib_wrapper! { ...
impl ::std::ops::Deref for $name { type Target = ::event::Event; fn deref(&self) -> &::event::Event { &self.0 } } impl ::std::ops::DerefMut for $name { fn deref_mut(&mut self) -> &mut ::event::Event { &mut self.0 ...
} }
random_line_split
event.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use gdk_ffi as ffi; use EventType; use Window; glib_wrapper! { ...
(&self) -> EventType { self.as_ref().type_ } /// Returns the associated `Window` if applicable. pub fn get_window(&self) -> Option<Window> { unsafe { from_glib_none(self.as_ref().window) } } /// Returns whether the event was sent explicitly. pub fn get_send_event(&self) -> bool...
get_event_type
identifier_name
event.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use gdk_ffi as ffi; use EventType; use Window; glib_wrapper! { ...
/// Returns the associated `Window` if applicable. pub fn get_window(&self) -> Option<Window> { unsafe { from_glib_none(self.as_ref().window) } } /// Returns whether the event was sent explicitly. pub fn get_send_event(&self) -> bool { from_glib(self.as_ref().send_event as i32) ...
{ self.as_ref().type_ }
identifier_body
boolean.js
// Copyright 2011 the V8 project authors. 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 list of ...
assertEquals(false, f("")); assertEquals(true, f("narf")); assertEquals(true, f(12345678)); assertEquals(true, f(undefined));
{ return !!("" + x); }
identifier_body
boolean.js
// Copyright 2011 the V8 project authors. 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 list of ...
(x) { return !!("" + x); } assertEquals(false, f("")); assertEquals(true, f("narf")); assertEquals(true, f(12345678)); assertEquals(true, f(undefined));
f
identifier_name
boolean.js
// Copyright 2011 the V8 project authors. All rights reserved.
// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation...
// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:
random_line_split
test_triggersqls.py
""" Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the 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 ...
""" Since some operation in this scenario is blocked, we want to run only aimed SQLs without unexpected setup. Just make this no-op. """ pass
identifier_body
test_triggersqls.py
""" Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the 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 ...
(cls): """ Since some operation in this scenario is blocked, we want to run only aimed SQLs without unexpected setup. Just make this no-op. """ pass
setUpClass
identifier_name
test_triggersqls.py
""" Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the 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 ...
class TestTriggerSQLClass(SQLTestCase): ''' This class contains all the sqls that are part of the trigger phase The sqls in here will get suspended by one of the faults that are triggered in the main run @gpdiff False ''' sql_dir = 'sql/' @classmethod def setUpClass(cls): """ ...
'''
random_line_split
MainView.js
/**************************************************************************** ** Acilos app: https://github.com/omnibond/acilos ** Copyright (C) 2014 Omnibond Systems LLC. and/or its subsidiary(-ies). ** All rights reserved. ** Omnibond Systems - www.omnibond.com for Acilos.com ** ** This file defines the mainView for ...
}, initialize: function() { var latlng = new google.maps.LatLng(39, -106); var mapOptions = { zoom: 3, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } this.map = new google.maps.Map(this.mapDiv, mapOptions); //google.maps.event.trigger(this.map, "resize"); }, postC...
{ if(marker.getAnimation() != null){ marker.setAnimation(null); }else{ marker.setAnimation(google.maps.Animation.BOUNCE); } }
identifier_body
MainView.js
/**************************************************************************** ** Acilos app: https://github.com/omnibond/acilos ** Copyright (C) 2014 Omnibond Systems LLC. and/or its subsidiary(-ies). ** All rights reserved. ** Omnibond Systems - www.omnibond.com for Acilos.com ** ** This file defines the mainView for ...
(){ if(marker.getAnimation() != null){ marker.setAnimation(null); }else{ marker.setAnimation(google.maps.Animation.BOUNCE); } } }, initialize: function() { var latlng = new google.maps.LatLng(39, -106); var mapOptions = { zoom: 3, center: latlng, mapTypeId: google.maps...
toggleBounce
identifier_name
MainView.js
/**************************************************************************** ** Acilos app: https://github.com/omnibond/acilos ** Copyright (C) 2014 Omnibond Systems LLC. and/or its subsidiary(-ies). ** All rights reserved. ** Omnibond Systems - www.omnibond.com for Acilos.com ** ** This file defines the mainView for ...
else{ var loc = this.locationBox.get("value"); var location = loc.replace(" ", "+"); //anything that gets put after the function in lang.hitch moves all args down one and puts itself at the begining. //so now obj will be the SECOND param and "Foursquare" will be the first this.getAroundMe(...
{ this.item.set("rightText", "You must enter a location"); }
conditional_block
MainView.js
/**************************************************************************** ** Acilos app: https://github.com/omnibond/acilos ** Copyright (C) 2014 Omnibond Systems LLC. and/or its subsidiary(-ies). ** All rights reserved. ** Omnibond Systems - www.omnibond.com for Acilos.com ** ** This file defines the mainView for ...
buildLocationBox: function(){ this.locationBox = new TextBox({ placeHolder: "Enter a location", style: "margin-left:9px" }) }, populate: function(call, obj){ for(var f = 0; f < obj.length; f++){ if(call == "InstagramLocal"){ this.addMarkerWithClick(obj[f]['latlng'], obj[f]['user']['user...
}) },
random_line_split
aio.rs
//! IGD async API example. //! //! It demonstrates how to: //! * get external IP //! * add port mappings //! * remove port mappings //! //! If everything works fine, 2 port mappings are added, 1 removed and we're left with single //! port mapping: External 1234 ---> 4321 Internal use std::env; use std::net::SocketAddr...
{ let ip = match env::args().nth(1) { Some(ip) => ip, None => { println!("Local socket address is missing!"); println!("This example requires a socket address representing the local machine and the port to bind to as an argument"); println!("Example: target/debug/...
identifier_body
aio.rs
//! IGD async API example. //! //! It demonstrates how to: //! * get external IP //! * add port mappings //! * remove port mappings //! //! If everything works fine, 2 port mappings are added, 1 removed and we're left with single //! port mapping: External 1234 ---> 4321 Internal use std::env; use std::net::SocketAddr...
() { let ip = match env::args().nth(1) { Some(ip) => ip, None => { println!("Local socket address is missing!"); println!("This example requires a socket address representing the local machine and the port to bind to as an argument"); println!("Example: target/deb...
main
identifier_name
aio.rs
//! IGD async API example. //! //! It demonstrates how to: //! * get external IP
//! * add port mappings //! * remove port mappings //! //! If everything works fine, 2 port mappings are added, 1 removed and we're left with single //! port mapping: External 1234 ---> 4321 Internal use std::env; use std::net::SocketAddrV4; use igd::aio::search_gateway; use igd::PortMappingProtocol; use simplelog::{...
random_line_split
env.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
pub fn has_vpe(&self) -> bool { self.base.vpe != 0 } pub fn vpe(&self) -> &'static mut vpe::VPE { unsafe { intrinsics::transmute(self.base.vpe as usize) } } pub fn load_rbufs(&self) -> arch::rbufs::RBufSpace { arch::rbufs::RBufSpace::new_with( ...
random_line_split
env.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
(&mut self, sel: Selector) { self.base.caps = sel as u64; } pub fn set_eps(&mut self, eps: u64) { self.base.eps = eps; } pub fn set_rbufs(&mut self, rbufs: &arch::rbufs::RBufSpace) { self.base.rbuf_cur = rbufs.cur as u64; self.base.rbuf_end = rbufs.end as u64; } ...
set_next_sel
identifier_name
env.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
pub fn load_mounts(&self) -> MountTable { if self.base.mounts_len != 0 { let slice = unsafe { util::slice_for(self.base.mounts as *const u64, self.base.mounts_len as usize) }; MountTable::unserialize(&mut SliceSource::new(slice)) } else {...
{ ( // it's initially 0. make sure it's at least the first usable selector util::max(2 + (EP_COUNT - FIRST_FREE_EP) as Selector, self.base.caps as Selector), self.base.eps ) }
identifier_body
redirect.rs
use rustless::server::header; use rustless::server::status; use rustless::{Nesting}; #[test] fn
() { let app = app!(|api| { api.prefix("api"); api.post("redirect_me/:href", |endpoint| { endpoint.handle(|client, params| { client.redirect(params.find(&"href".to_string()).unwrap().as_string().unwrap()) }) }); }); let response = call_app!(a...
it_allows_redirect
identifier_name
redirect.rs
use rustless::server::header; use rustless::server::status; use rustless::{Nesting}; #[test] fn it_allows_redirect() { let app = app!(|api| { api.prefix("api"); api.post("redirect_me/:href", |endpoint| { endpoint.handle(|client, params| { client.redirect(params.find(&"h...
{ let app = app!(|api| { api.prefix("api"); api.post("redirect_me/:href", |endpoint| { endpoint.handle(|client, params| { client.permanent_redirect(params.find(&"href".to_string()).unwrap().as_string().unwrap()) }) }); }); let response = call...
identifier_body
redirect.rs
use rustless::server::header; use rustless::server::status; use rustless::{Nesting}; #[test] fn it_allows_redirect() { let app = app!(|api| { api.prefix("api"); api.post("redirect_me/:href", |endpoint| {
}); }); let response = call_app!(app, Post, "http://127.0.0.1:3000/api/redirect_me/google.com").ok().unwrap(); assert_eq!(response.status, status::StatusCode::Found); let &header::Location(ref location) = response.headers.get::<header::Location>().unwrap(); assert_eq!(location, "google.com"...
endpoint.handle(|client, params| { client.redirect(params.find(&"href".to_string()).unwrap().as_string().unwrap()) })
random_line_split
list.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 https://mozilla.org/MPL/2.0/. */ //! `list` computed values. #[cfg(feature = "gecko")] pub use crate::values::specified::list::ListStyleType; pub...
lazy_static! { static ref INITIAL_QUOTES: Arc<Box<[QuotePair]>> = Arc::new( vec![ QuotePair { opening: "\u{201c}".to_owned().into_boxed_str(), closing: "\u{201d}".to_owned().into_boxed_str(), }, QuotePair { opening: "\u{2018...
use servo_arc::Arc;
random_line_split
list.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 https://mozilla.org/MPL/2.0/. */ //! `list` computed values. #[cfg(feature = "gecko")] pub use crate::values::specified::list::ListStyleType; pub...
}
{ Quotes(INITIAL_QUOTES.clone()) }
identifier_body
list.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 https://mozilla.org/MPL/2.0/. */ //! `list` computed values. #[cfg(feature = "gecko")] pub use crate::values::specified::list::ListStyleType; pub...
() -> Quotes { Quotes(INITIAL_QUOTES.clone()) } }
get_initial_value
identifier_name
platform_location.js
/** * This class should not be used directly by an application developer. Instead, use
* * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different * platforms * that angular supports. For example, the default `PlatformLocation` is {@link * BrowserPlatform...
* {@link Location}.
random_line_split
platform_location.js
/** * This class should not be used directly by an application developer. Instead, use * {@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different *...
() { return null; } }
hash
identifier_name
platform_location.js
/** * This class should not be used directly by an application developer. Instead, use * {@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different *...
}
{ return null; }
identifier_body
oauth2_getAllUsers.py
#import some things we need import httplib2 from oauth2client.client import SignedJwtAssertionCredentials #included with the Google Apps Directory API from apiclient.discovery import build import csv def downloadUsers(domain, account, customerId):
#open and read the csv file that contains the list of domains, account numbers, and customer IDs domainListFile = open('domainList.csv', 'rb') domainList = csv.reader(domainListFile) for row in domainList: domain = row[0] #the first entry in this row is the domain account = row[1] customerId = row[2] ...
superAdmin = 'is@' + domain serviceAccount = account + '@developer.gserviceaccount.com' p12File = domain + '.p12' scope = 'https://www.googleapis.com/auth/admin.directory.user https://www.googleapis.com/auth/admin.directory.orgunit https://www.googleapis.com/auth/admin.directory.group https://www.googleapis...
identifier_body
oauth2_getAllUsers.py
#import some things we need import httplib2 from oauth2client.client import SignedJwtAssertionCredentials #included with the Google Apps Directory API from apiclient.discovery import build import csv def downloadUsers(domain, account, customerId): superAdmin = 'is@' + domain serviceAccount = account + '@develo...
primaryEmail = page.get(user['primaryEmail']) lastLoginTime = page.get('lastLoginTime') name = page.get('name') isAdmin = page.get('isAdmin') orgUnitPath = page.get('orgUnitPath') newPage = page.get('nextPageToken') print primaryEmail, lastLoginTime, name, isAdmin, orgUnitPath ''' ''' #create a user userinfo = ...
''' for user in page:
random_line_split
oauth2_getAllUsers.py
#import some things we need import httplib2 from oauth2client.client import SignedJwtAssertionCredentials #included with the Google Apps Directory API from apiclient.discovery import build import csv def downloadUsers(domain, account, customerId): superAdmin = 'is@' + domain serviceAccount = account + '@develo...
outputFile.close() #open and read the csv file that contains the list of domains, account numbers, and customer IDs domainListFile = open('domainList.csv', 'rb') domainList = csv.reader(domainListFile) for row in domainList: domain = row[0] #the first entry in this row is the domain account = row[1] ...
try: page = directoryService.users().list(domain=domain, customer=customerId, maxResults='500', pageToken=pageToken).execute() users = page['users'] for user in users: #parse the users from the page variable primaryEmail = user['primaryEmail'] ...
conditional_block
oauth2_getAllUsers.py
#import some things we need import httplib2 from oauth2client.client import SignedJwtAssertionCredentials #included with the Google Apps Directory API from apiclient.discovery import build import csv def
(domain, account, customerId): superAdmin = 'is@' + domain serviceAccount = account + '@developer.gserviceaccount.com' p12File = domain + '.p12' scope = 'https://www.googleapis.com/auth/admin.directory.user https://www.googleapis.com/auth/admin.directory.orgunit https://www.googleapis.com/auth/admin.dir...
downloadUsers
identifier_name
checker.py
# Create your views here. import socket from pyasn1.error import PyAsn1Error import requests from .heartbleed import test_heartbleed from .models import Check try: from OpenSSL.SSL import Error as SSLError except ImportError: # In development, we might not have OpenSSL - it's only needed for SNI class SSLE...
return response.url[:5] == "https" def find_session_cookie(self): for cookie in self.session.cookies: if cookie.name == 'sessionid': return cookie return False def find_csrf_cookie(self): for cookie in self.session.cookies: if cookie.name...
def _response_used_https(self, response):
random_line_split
checker.py
# Create your views here. import socket from pyasn1.error import PyAsn1Error import requests from .heartbleed import test_heartbleed from .models import Check try: from OpenSSL.SSL import Error as SSLError except ImportError: # In development, we might not have OpenSSL - it's only needed for SNI class SSLE...
def check_trace(self, url): response = self.session.request('TRACE', url, timeout=7) return 'Content-Type' in response.headers and response.headers['Content-Type'] == "message/http" def check_admin(self, url): response = self.session.get(url + "/admin", timeout=7) if response....
data = self.session.get(url+"/[][][][][]-this-tries-to-trigger-404....", timeout=7) return "You're seeing this error because you have <code>DEBUG = True</code>" in data.content
identifier_body
checker.py
# Create your views here. import socket from pyasn1.error import PyAsn1Error import requests from .heartbleed import test_heartbleed from .models import Check try: from OpenSSL.SSL import Error as SSLError except ImportError: # In development, we might not have OpenSSL - it's only needed for SNI class SSLE...
(self, url): try: self.session.get(url.replace("http", "https"), timeout=7) except: return False return True def check_heartbleed_vuln(self, url): try: url = url.replace("http://", "").replace("/", "") return bool(test_heartbleed(url))...
check_supports_https
identifier_name
checker.py
# Create your views here. import socket from pyasn1.error import PyAsn1Error import requests from .heartbleed import test_heartbleed from .models import Check try: from OpenSSL.SSL import Error as SSLError except ImportError: # In development, we might not have OpenSSL - it's only needed for SNI class SSLE...
return False def find_csrf_cookie(self): for cookie in self.session.cookies: if cookie.name == 'csrftoken': return cookie return False
return cookie
conditional_block
user-card.component.spec.ts
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under...
import { UserCardComponent } from "./user-card.component"; import { User } from "../../models"; describe("UserCardComponent", () => { let component: UserCardComponent; let fixture: ComponentFixture<UserCardComponent>; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ UserCardC...
* limitations under the License. */ import { HttpClientModule } from "@angular/common/http"; import { waitForAsync, ComponentFixture, TestBed } from "@angular/core/testing";
random_line_split
mod.rs
// The MIT License (MIT) //
// in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright noti...
// Copyright (c) 2014 Jeremy Letang // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal
random_line_split
jingletransportrawudp.ts
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pl" version="2.0"> <context> <name>JingleTransportRawUdp</name> <message> <location filename="../../plugins/jingletransportrawudp/jingletransportrawudp.cpp" line="16"/> <location filename="../../plugins/jingletransportrawudp/jingletransportrawudp.cpp" line="28...
</message> <message> <location filename="../../plugins/jingletransportrawudp/jingletransportrawudp.cpp" line="287"/> <source>Allows using RAW-UDP transport in Jingle sesions</source> <translation type="unfinished"/> </message> </context> </TS>
<translation type="unfinished"/>
random_line_split
diagnostic.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 highlight_lines(err: &mut EmitterWriter, cm: &codemap::CodeMap, sp: Span, lvl: Level, lines: codemap::FileLinesResult) -> io::Result<()> { let lines = match lines { Ok(lines) => lines, Err(_) => { ...
} Ok(()) }
random_line_split
diagnostic.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 data = Arc::new(Mutex::new(Vec::new())); let mut ew = EmitterWriter::new(Box::new(Sink(data.clone())), None); let cm = CodeMap::new(); let content = "abcdefg koksi line3 line4 cinq line6 line7 line8 line9 ...
{ Ok(()) }
identifier_body
diagnostic.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 EmitterWriter, topic: &str, lvl: Level, msg: &str, code: Option<&str>) -> io::Result<()> { if !topic.is_empty() { try!(write!(&mut dst.dst, "{} ", topic)); } try!(print_maybe_styled(dst, &format!("{}: ", lvl.to_string()), ...
print_diagnostic
identifier_name
diagnostic.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 ...
Ok(()) } fn highlight_lines(err: &mut EmitterWriter, cm: &codemap::CodeMap, sp: Span, lvl: Level, lines: codemap::FileLinesResult) -> io::Result<()> { let lines = match lines { Ok(lines) => lines, E...
{ let elided_line_num = format!("{}", first_line.line_index + MAX_LINES + 1); try!(write!(&mut err.dst, "{0:1$} {0:2$} ...\n", "", fm.name.len(), elided_line_num.len())); }
conditional_block
index.d.ts
// Generated by typings // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a872802c0c84ba98ff207d5e673a1fa867c67fd6/polymer/polymer.d.ts declare namespace polymer { type PropConstructorType = StringConstructor|ObjectConstructor|BooleanConstructor|NumberConstructor|DateConstructor|ArrayConst...
childNodes:Node[]; children:Element[]; parentNode:Node; firstChild:Node; lastChild:Node; nextSibling:Node; previousSibling:Node; firstElementChild:Element; lastElementChild:Element; nextElementSibling:Element; previousElementSibling:Element; textContent:string;...
random_line_split
stemmer.rs
use std::sync::Arc; use stemmer; pub struct StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { tail: TailTokenStream, stemmer: Arc<stemmer::Stemmer>, } impl<TailTokenStream> TokenStream for StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { fn token(&...
else { false } } } impl<TailTokenStream> StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { fn wrap(stemmer: Arc<stemmer::Stemmer>, tail: TailTokenStream) -> StemmerTokenStream<TailTokenStream> { StemmerTokenStream { tail, ...
{ // self.tail.token_mut().term.make_ascii_lowercase(); let new_str = self.stemmer.stem_str(&self.token().term); true }
conditional_block
stemmer.rs
use std::sync::Arc; use stemmer; pub struct StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { tail: TailTokenStream, stemmer: Arc<stemmer::Stemmer>, } impl<TailTokenStream> TokenStream for StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { fn token(&...
}
random_line_split
stemmer.rs
use std::sync::Arc; use stemmer; pub struct StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { tail: TailTokenStream, stemmer: Arc<stemmer::Stemmer>, } impl<TailTokenStream> TokenStream for StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { fn token(&...
fn token_mut(&mut self) -> &mut Token { self.tail.token_mut() } fn advance(&mut self) -> bool { if self.tail.advance() { // self.tail.token_mut().term.make_ascii_lowercase(); let new_str = self.stemmer.stem_str(&self.token().term); true } ...
{ self.tail.token() }
identifier_body
stemmer.rs
use std::sync::Arc; use stemmer; pub struct
<TailTokenStream> where TailTokenStream: TokenStream { tail: TailTokenStream, stemmer: Arc<stemmer::Stemmer>, } impl<TailTokenStream> TokenStream for StemmerTokenStream<TailTokenStream> where TailTokenStream: TokenStream { fn token(&self) -> &Token { self.tail.token() } fn to...
StemmerTokenStream
identifier_name
language.py
from django.conf import settings from django.template import loader from django.views.i18n import set_language from xadmin.plugins.utils import get_context_dict from xadmin.sites import site from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView class SetLangNavPlugin(BaseAdminPlugin): def block...
(BaseAdminView): def post(self, request, *args, **kwargs): if 'nav_menu' in request.session: del request.session['nav_menu'] return set_language(request) if settings.LANGUAGES and 'django.middleware.locale.LocaleMiddleware' in settings.MIDDLEWARE_CLASSES: site.register_plugin(SetLa...
SetLangView
identifier_name
language.py
from django.conf import settings from django.template import loader from django.views.i18n import set_language from xadmin.plugins.utils import get_context_dict from xadmin.sites import site from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView class SetLangNavPlugin(BaseAdminPlugin): def block...
if settings.LANGUAGES and 'django.middleware.locale.LocaleMiddleware' in settings.MIDDLEWARE_CLASSES: site.register_plugin(SetLangNavPlugin, CommAdminView) site.register_view(r'^i18n/setlang/$', SetLangView, 'set_language')
def post(self, request, *args, **kwargs): if 'nav_menu' in request.session: del request.session['nav_menu'] return set_language(request)
identifier_body
language.py
from django.conf import settings from django.template import loader from django.views.i18n import set_language from xadmin.plugins.utils import get_context_dict from xadmin.sites import site from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView class SetLangNavPlugin(BaseAdminPlugin): def block...
site.register_plugin(SetLangNavPlugin, CommAdminView) site.register_view(r'^i18n/setlang/$', SetLangView, 'set_language')
conditional_block
language.py
from django.conf import settings from django.template import loader from django.views.i18n import set_language from xadmin.plugins.utils import get_context_dict from xadmin.sites import site from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView class SetLangNavPlugin(BaseAdminPlugin): def block_...
def post(self, request, *args, **kwargs): if 'nav_menu' in request.session: del request.session['nav_menu'] return set_language(request) if settings.LANGUAGES and 'django.middleware.locale.LocaleMiddleware' in settings.MIDDLEWARE_CLASSES: site.register_plugin(SetLangNavPlugin, Comm...
context = get_context_dict(context) context['redirect_to'] = self.request.get_full_path() nodes.append(loader.render_to_string('xadmin/blocks/comm.top.setlang.html', context=context)) class SetLangView(BaseAdminView):
random_line_split
user_configuration.ts
///<reference path="../typings/node/node.d.ts" /> import fs = require('fs'); import path = require("path"); import utils = require('./utils'); var Promise = require("promise"); export class UserConfiguration { fontColor: string; fontsize: number; backgroundColor: string; fontFamily: string; constructor(args...
}); }); }
{ resolve(content.toString()); }
conditional_block
user_configuration.ts
///<reference path="../typings/node/node.d.ts" /> import fs = require('fs'); import path = require("path"); import utils = require('./utils'); var Promise = require("promise"); export class UserConfiguration { fontColor: string; fontsize: number; backgroundColor: string; fontFamily: string; constructor(args...
function readFile(filename: string) { return new Promise(function(resolve, reject) { fs.readFile(filename, (err,content) => { if(err) { return reject(err); } else { resolve(content.toString()); } }); }); }
}
random_line_split
user_configuration.ts
///<reference path="../typings/node/node.d.ts" /> import fs = require('fs'); import path = require("path"); import utils = require('./utils'); var Promise = require("promise"); export class
{ fontColor: string; fontsize: number; backgroundColor: string; fontFamily: string; constructor(args: any = {}) { this.defaults(); this.fontsize = args.fontsize || this.fontsize; this.fontColor = args.fontColor || this.fontColor; this.backgroundColor = args.backgroundColor || this.background...
UserConfiguration
identifier_name
range-min-max.test.tsx
import React from 'react'; import { render } from '@testing-library/react'; import { clickDay } from 'react-day-picker/test/actions'; import { getAllEnabledDays, getDayButton } from 'react-day-picker/test/po'; import { freezeBeforeAll } from 'react-day-picker/test/utils'; import Example from '@examples/range-min-max...
}); }); describe('when clicking a day before the from date', () => { const toDay = new Date(2021, 10, 11); const expectedSelectedDays = [ new Date(2021, 10, 11), new Date(2021, 10, 12), new Date(2021, 10, 13), new Date(2021, 10, 14), new Date(2021, 10, 15) ]; before...
test('should enable the days up to the clicked day', () => { const enabledDays = getAllEnabledDays(); expect(enabledDays[enabledDays.length - 1]).toHaveTextContent('19th');
random_line_split
context.rs
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use language_tags::...
<'f>(&self, message: &Message, args: Option<&Args<'f>>) -> String { let mut output = String::new(); let _ = message.write_message(self, &mut output, args); output } /// Write a message to a stream. pub fn write<'f>( &self, message: &Message, stream: &mut fmt:...
format
identifier_name
context.rs
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use language_tags::...
} impl Default for Context { fn default() -> Self { Context { language_tag: Default::default(), placeholder_value: None, } } }
{ message.write_message(self, stream, args) }
identifier_body
context.rs
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use language_tags::...
/// Write a message to a stream. pub fn write<'f>( &self, message: &Message, stream: &mut fmt::Write, args: Option<&Args<'f>>, ) -> fmt::Result { message.write_message(self, stream, args) } } impl Default for Context { fn default() -> Self { Context ...
}
random_line_split
ex31.py
print "You enter a dark room with two doors. Do you go through door #1 or door #2?" door = raw_input("> ")
print "2. Scream at the bear." bear = raw_input("> ") if bear == "1": print "The bear eats your face off. Good job!" elif bear == "2": print "The bear eats your legs off. Good job!" else: print "Well, doing %s is probably better. Bear runs away." %bear elif door =="2": print "You stare into the endle...
if door == "1": print "There`s a giant bear here eating a chees cake. What do you do?" print "1. Take the cake."
random_line_split
ex31.py
print "You enter a dark room with two doors. Do you go through door #1 or door #2?" door = raw_input("> ") if door == "1": print "There`s a giant bear here eating a chees cake. What do you do?" print "1. Take the cake." print "2. Scream at the bear." bear = raw_input("> ") if bear == "1":
elif bear == "2": print "The bear eats your legs off. Good job!" else: print "Well, doing %s is probably better. Bear runs away." %bear elif door =="2": print "You stare into the endless abyss at Cthulhu's retina." print "1. Blueberries." print "2. Yellow jacket clothespins." print "3. Understanding revol...
print "The bear eats your face off. Good job!"
conditional_block
api.py
# -*- encoding: utf-8 -*- # # Copyright 2013 IBM Corp. # # # 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...
action = taxonomy.ACTION_DELETE elif method == 'HEAD': action = taxonomy.ACTION_READ else: action = taxonomy.UNKNOWN return action def create_event(self, req, correlation_id): action = self._get_action(req) initiator_host = host.Host(addr...
else: action = taxonomy.ACTION_READ elif method == 'PUT': action = taxonomy.ACTION_UPDATE elif method == 'DELETE':
random_line_split
api.py
# -*- encoding: utf-8 -*- # # Copyright 2013 IBM Corp. # # # 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...
class KeystoneCredential(credential.Credential): def __init__(self, identity_status=None, **kwargs): super(KeystoneCredential, self).__init__(**kwargs) if identity_status is not None: self.identity_status = identity_status class PycadfAuditApiConfigError(Exception): """Error rai...
def __init__(self, project_id=None, **kwargs): super(ClientResource, self).__init__(**kwargs) if project_id is not None: self.project_id = project_id
identifier_body
api.py
# -*- encoding: utf-8 -*- # # Copyright 2013 IBM Corp. # # # 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, req): """Take a given Request, parse url path to calculate action type. Depending on req.method: if POST: path ends with action, read the body and get action from map; request ends with known path, assume is create action; request ends with unknown path,...
_get_action
identifier_name
api.py
# -*- encoding: utf-8 -*- # # Copyright 2013 IBM Corp. # # # 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...
event = factory.EventFactory().new_event( eventType=cadftype.EVENTTYPE_ACTIVITY, outcome=taxonomy.OUTCOME_PENDING, action=action, initiator=initiator, target=target, observer='target') event.add_tag(tag.generate_name_value_tag('cor...
target.add_address(public_end)
conditional_block
maps.js
var hubMap = { version: ".1" }; function HubMap(options) { this.options = options; this.data = ""; this.map = false; this.legend = ""; this.options.scale = (options.scale !== "" ? parseInt(options.scale) : null); this.options.legendCategories = options.legendCategories || []; this.baseLayer = ""; thi...
() { //Todo: abstract this so that I can pass in names of layers earlier on, for now, these are hard coded var baseDefinition = { style: { weight: 2, opacity: 0.4, color: '#808080', fillOpacity: 0 }, onEachFeature: onEachFeature } ...
setOverlayLayers
identifier_name
maps.js
var hubMap = { version: ".1" }; function HubMap(options) { this.options = options; this.data = ""; this.map = false; this.legend = ""; this.options.scale = (options.scale !== "" ? parseInt(options.scale) : null); this.options.legendCategories = options.legendCategories || []; this.baseLayer = ""; thi...
title.html('<b>Legend (click to filter)</b>'); container.append(title); for (var i = 0; i < categories.length; i++) { var item = $('<div class="legend-item">'); var symbol = item.append($('<i>').css("background", $$.getColor(i + 1, categories.length))); var checkbox = item.app...
var title = $('<span>');
random_line_split
maps.js
var hubMap = { version: ".1" }; function HubMap(options) { this.options = options; this.data = ""; this.map = false; this.legend = ""; this.options.scale = (options.scale !== "" ? parseInt(options.scale) : null); this.options.legendCategories = options.legendCategories || []; this.baseLayer = ""; thi...
} else { feature.properties.scaledValue = -1; feature.properties.value = -1; feature.properties.scale = parseInt(options.scale); } }); return geojson; } }; /* Render the map */ HubMap.prototype.render = function() { var $$ = this, options = ...
{ feature.properties.margin = parseFloat(dataObject[margin]); }
conditional_block
maps.js
var hubMap = { version: ".1" }; function HubMap(options)
HubMap.prototype.getMap = function() { return this.map } /* Load and process data for use in the map */ HubMap.prototype.loadData = function() { var $$ = this, options = $$.options; var data = (/^https?:\/\//.test(options.data)) ? options.data : '/data-browser/data/' + options.data; $$.options.dataType = (da...
{ this.options = options; this.data = ""; this.map = false; this.legend = ""; this.options.scale = (options.scale !== "" ? parseInt(options.scale) : null); this.options.legendCategories = options.legendCategories || []; this.baseLayer = ""; this.valuesOnlyArray = []; /* default overlays */ this.over...
identifier_body
itemgroup.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
val = getattr(self, prop) setattr(new_i, prop, val) # but no members new_i.members = [] return new_i def replace_members(self, members): self.members = members # If a prop is absent and is not required, put the default value def fill_...
# Copy all properties for prop in cls.properties: if prop is not 'members': if self.has(prop):
random_line_split
itemgroup.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
class Itemgroups(Items): # If a prop is absent and is not required, put the default value def fill_default(self): for i in self: i.fill_default() def add(self, ig): self.add_item(ig) def get_members_by_name(self, gname): g = self.find_by_name(gname) if...
id = 0 properties = Item.properties.copy() properties.update({ 'members': ListProp(fill_brok=['full_status'], default=None, split_on_coma=True), # Shinken specific 'unknown_members': ListProp(default=None), }) def __init__(self, params={}): self.id = self.__class__.id ...
identifier_body
itemgroup.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
add_fun(self.members, member) def add_string_unknown_member(self, member): add_fun = list.extend if isinstance(member, list) else list.append if not self.unknown_members: self.unknown_members = [] add_fun(self.unknown_members, member) def __str__(self): ret...
self.members = []
conditional_block
itemgroup.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
(self, i): try: self.members.remove(i) except ValueError: pass # a item group is correct if all members actually exists, # so if unknown_members is still [] def is_correct(self): res = True if self.unknown_members: for m in self.unknown_m...
__delitem__
identifier_name
Bootstrap.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ retu...
/***/ }) /******/ ]); //# sourceMappingURL=Bootstrap.js.map
module.exports = __webpack_require__(2);
random_line_split
Bootstrap.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ retu...
/******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { ...
{ /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ }
conditional_block
Bootstrap.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function
(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/...
__webpack_require__
identifier_name