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
test_rng.rs
extern crate cryptopals; extern crate rand; extern crate time; use cryptopals::crypto::rng::{MT, untemper}; use rand::{Rng, SeedableRng, thread_rng}; use time::{get_time}; #[test] fn test_rng_deterministic()
#[test] fn test_seed_recovery_from_time() { let mut time = get_time().sec; time += thread_rng().gen_range(40, 1000); let mut m: MT = SeedableRng::from_seed(time as u32); let output = m.gen::<u32>(); for seed in get_time().sec + 2000 .. 0 { let mut checker: MT = SeedableRng::from_seed(seed ...
{ let mut m1: MT = SeedableRng::from_seed(314159); let mut m2: MT = SeedableRng::from_seed(314159); for _ in 0 .. 1024 { assert_eq!(m1.gen::<u32>(), m2.gen::<u32>()); } }
identifier_body
test_rng.rs
extern crate cryptopals; extern crate rand; extern crate time; use cryptopals::crypto::rng::{MT, untemper}; use rand::{Rng, SeedableRng, thread_rng}; use time::{get_time}; #[test] fn test_rng_deterministic() { let mut m1: MT = SeedableRng::from_seed(314159); let mut m2: MT = SeedableRng::from_seed(314159); ...
} } #[test] fn test_untemper() { let mut m: MT = SeedableRng::from_seed(314159); for i in 0 .. 624 { let output = m.gen::<u32>(); assert_eq!(untemper(output), m.state[i]); } } #[test] fn test_rng_clone_from_output() { let mut m: MT = SeedableRng::from_seed(314159); let mut sta...
{ assert_eq!(seed, time); break; }
conditional_block
test_rng.rs
extern crate cryptopals; extern crate rand; extern crate time; use cryptopals::crypto::rng::{MT, untemper}; use rand::{Rng, SeedableRng, thread_rng}; use time::{get_time}; #[test] fn test_rng_deterministic() { let mut m1: MT = SeedableRng::from_seed(314159); let mut m2: MT = SeedableRng::from_seed(314159); ...
() { let mut time = get_time().sec; time += thread_rng().gen_range(40, 1000); let mut m: MT = SeedableRng::from_seed(time as u32); let output = m.gen::<u32>(); for seed in get_time().sec + 2000 .. 0 { let mut checker: MT = SeedableRng::from_seed(seed as u32); if checker.gen::<u32>() ...
test_seed_recovery_from_time
identifier_name
configparser.py
#!/usr/bin/env python # encoding: utf-8 # # AuthorDetector # Copyright (C) 2013 Larroque Stephen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your ...
## Initialize the ConfigParser object by checking that the configuration file exists # @param configfile Path to the configuration file (must exists or else the application will crash!) def init(self, configfile=None, *args, **kwargs): if configfile: try: with open(conf...
return object.__init__(self, *args, **kwargs)
identifier_body
configparser.py
#!/usr/bin/env python # encoding: utf-8 # # AuthorDetector # Copyright (C) 2013 Larroque Stephen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your ...
elif cn == '*': inCommentMulti = True t.append(s[fromIndex:i]) i += 1 elif inCommentSingle and (c == '\n' or c == '\r'): inCommentSingle = False fromIndex = i ...
inCommentSingle = True t.append(s[fromIndex:i]) i += 1
conditional_block
configparser.py
#!/usr/bin/env python # encoding: utf-8 # # AuthorDetector # Copyright (C) 2013 Larroque Stephen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your ...
# Set a value in the config dict (this is a proxy method) def update(self, *args, **kwargs): return self.config.update(*args, **kwargs) ## Filter efficiently Javascript-like inline and multiline comments from a JSON file # Author: WizKid https://gist.github.com/WizKid/1170297 # @param s str...
return self.config.update(*args, **kwargs)
random_line_split
configparser.py
#!/usr/bin/env python # encoding: utf-8 # # AuthorDetector # Copyright (C) 2013 Larroque Stephen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your ...
(self, *args, **kwargs): return object.__init__(self, *args, **kwargs) ## Initialize the ConfigParser object by checking that the configuration file exists # @param configfile Path to the configuration file (must exists or else the application will crash!) def init(self, configfile=None, *args, **k...
__init__
identifier_name
angularFactoryService.js
angular.module('MODULE.SUBMODULE').factory( 'FACTORY_SERVICE', function FACTORY_SERVICEProvider( $log, otherService ) { 'use strict'; var constructor; constructor = function constructor (spec) { var initialize, instanceVar1, ...
// ---------- initialize(spec); return { public1: public1, public2: public2, destroy: destroy }; } return constructor } ); // Usage angular.module('MODULE.SUBMODULE').contoller( 'CONTROLLER', ...
random_line_split
angularFactoryService.js
angular.module('MODULE.SUBMODULE').factory( 'FACTORY_SERVICE', function FACTORY_SERVICEProvider( $log, otherService ) { 'use strict'; var constructor; constructor = function constructor (spec) { var initialize, instanceVar1, ...
currentObject = FACTORY_SERVICE(spec); } );
{ currentObject.destroy(); currentObject = undefined; }
conditional_block
manager.rs
// Copyright 2015-2018 Deyan Ginev. See the LICENSE // file at the top-level directory of this distribution. // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed // except according to those terms. use std::collections::HashM...
else if sink_thread.join().is_err() { println!("Sink thread died unexpectedly!"); Err(zmq::Error::ETERM) } else if finalize_thread.join().is_err() { println!("DB thread died unexpectedly!"); Err(zmq::Error::ETERM) } else { println!("Manager successfully terminated!"); Ok(())...
{ println!("Ventilator thread died unexpectedly!"); Err(zmq::Error::ETERM) }
conditional_block
manager.rs
// Copyright 2015-2018 Deyan Ginev. See the LICENSE // file at the top-level directory of this distribution. // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed // except according to those terms. use std::collections::HashM...
}
{ // We'll use some local memoization shared between source and sink: let services: HashMap<String, Option<Service>> = HashMap::new(); let progress_queue: HashMap<i64, TaskProgress> = HashMap::new(); let done_queue: Vec<TaskReport> = Vec::new(); let services_arc = Arc::new(Mutex::new(services)); ...
identifier_body
manager.rs
// Copyright 2015-2018 Deyan Ginev. See the LICENSE // file at the top-level directory of this distribution. // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed // except according to those terms. use std::collections::HashM...
{ /// port for requesting/dispatching jobs pub source_port: usize, /// port for responding/receiving results pub result_port: usize, /// the size of the dispatch queue /// (also the batch size for Task store queue requests) pub queue_size: usize, /// size of an individual message chunk sent via zeromq ...
TaskManager
identifier_name
manager.rs
// Copyright 2015-2018 Deyan Ginev. See the LICENSE // file at the top-level directory of this distribution. // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed // except according to those terms. use std::collections::HashM...
Ok(()) } } }
random_line_split
file.js
/** * @file * Provides JavaScript additions to the managed file field type. * * This file provides progress bar support (if available), popup windows for * file previews, and disabling of other file fields during Ajax uploads (which * prevents separate file fields from accidentally uploading files). */ (functio...
if (settings.file && settings.file.elements) { elements = settings.file.elements; Object.keys(elements).forEach(initFileValidation); } }, detach: function (context, settings, trigger) { var $context = $(context); var elements; function removeFileValidation(select...
{ $context.find(selector) .once('fileValidate') .on('change.fileValidate', { extensions: elements[selector] }, Drupal.file.validateExtension); }
identifier_body
file.js
/** * @file * Provides JavaScript additions to the managed file field type. * * This file provides progress bar support (if available), popup windows for * file previews, and disabling of other file fields during Ajax uploads (which * prevents separate file fields from accidentally uploading files). */ (functio...
// @todo If the previous sentence is true, why not set the timeout to 0? var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled'); $fieldsToTemporarilyDisable.prop('disabled', true); setTimeout(function () { $fieldsToTemporarilyDis...
random_line_split
file.js
/** * @file * Provides JavaScript additions to the managed file field type. * * This file provides progress bar support (if available), popup windows for * file previews, and disabling of other file fields during Ajax uploads (which * prevents separate file fields from accidentally uploading files). */ (functio...
(selector) { $context.find(selector) .removeOnce('fileValidate') .off('change.fileValidate', Drupal.file.validateExtension); } if (trigger === 'unload' && settings.file && settings.file.elements) { elements = settings.file.elements; Object.keys(elements).forEach(...
removeFileValidation
identifier_name
file.js
/** * @file * Provides JavaScript additions to the managed file field type. * * This file provides progress bar support (if available), popup windows for * file previews, and disabling of other file fields during Ajax uploads (which * prevents separate file fields from accidentally uploading files). */ (functio...
}, /** * Trigger the upload_button mouse event to auto-upload as a managed file. */ triggerUploadButton: function (event) { $(event.target).closest('.form-managed-file').find('.form-submit').trigger('mousedown'); }, /** * Prevent file uploads when using buttons not intended to ...
{ var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi'); if (!acceptableMatch.test(this.value)) { var error = Drupal.t("The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.", { // According to the spec...
conditional_block
index.d.ts
// Type definitions for redlock 3.0 // Project: https://github.com/mike-marcacci/node-redlock // Definitions by: Ilya Mochalov <https://github.com/chrootsu> // BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.2 ...
retryDelay: number; retryJitter: number; servers: Redlock.CompatibleRedisClient[]; constructor(clients: Redlock.CompatibleRedisClient[], options?: Redlock.Options); acquire(resource: string | string[], ttl: number, callback?: Redlock.Callback<Redlock.Lock>): Promise<Redlock.Lock>; lock(resourc...
random_line_split
index.d.ts
// Type definitions for redlock 3.0 // Project: https://github.com/mike-marcacci/node-redlock // Definitions by: Ilya Mochalov <https://github.com/chrootsu> // BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.2 ...
{ redlock: Redlock; resource: string; value: string | null; expiration: number; constructor(redlock: Redlock, resource: string, value: string | null, expiration: number); unlock(callback?: Callback<void>): Promise<void>; extend(ttl: number, callback?: Callback<Lo...
Lock
identifier_name
progressbar.py
""" progressbar2 related utils""" from codekit.codetools import warn from public import public from time import sleep import progressbar import functools @public def setup_logging(verbosity=0): """Configure progressbar sys.stderr wrapper which is required to play nice with logging and not have strange format...
pbar.finish() @public def wait_for_user_panic(**kwargs): """Display a scary message and count down progresss bar so an interative user a chance to panic and kill the program. Parameters ---------- kwargs Passed verbatim to countdown_timer() """ warn('Now is the time to panic...
pbar.update(i) sleep(tick)
conditional_block
progressbar.py
""" progressbar2 related utils""" from codekit.codetools import warn from public import public from time import sleep import progressbar import functools @public def setup_logging(verbosity=0): """Configure progressbar sys.stderr wrapper which is required to play nice with logging and not have strange format...
pbar.update(i) sleep(tick) pbar.finish() @public def wait_for_user_panic(**kwargs): """Display a scary message and count down progresss bar so an interative user a chance to panic and kill the program. Parameters ---------- kwargs Passed verbatim to countdown_timer() ...
for i in range(n_ticks):
random_line_split
progressbar.py
""" progressbar2 related utils""" from codekit.codetools import warn from public import public from time import sleep import progressbar import functools @public def setup_logging(verbosity=0): """Configure progressbar sys.stderr wrapper which is required to play nice with logging and not have strange format...
"""Display an adaptive ETA / countdown bar with a message. Parameters ---------- msg: str Message to prefix countdown bar line with max_value: max_value The max number of progress bar steps/updates """ widgets = [ "{msg}:".format(msg=msg), progressbar.Bar(), ' ...
identifier_body
progressbar.py
""" progressbar2 related utils""" from codekit.codetools import warn from public import public from time import sleep import progressbar import functools @public def setup_logging(verbosity=0): """Configure progressbar sys.stderr wrapper which is required to play nice with logging and not have strange format...
(msg, max_value): """Display an adaptive ETA / countdown bar with a message. Parameters ---------- msg: str Message to prefix countdown bar line with max_value: max_value The max number of progress bar steps/updates """ widgets = [ "{msg}:".format(msg=msg), ...
eta_bar
identifier_name
messageController.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): void { if (this._editor.hasModel()) { this.showMessage(nls.localize('editor.readonly', "Cannot edit in read-only editor"), this._editor.getPosition()); } } } const MessageCommand = EditorCommand.bindToContribution<MessageController>(MessageController.get); registerEditorCommand(new MessageCommand({ id: ...
_onDidAttemptReadOnlyEdit
identifier_name
messageController.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
getDomNode(): HTMLElement { return this._domNode; } getPosition(): IContentWidgetPosition { return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE] }; } } registerEditorContribution(MessageController); registerThemingParticipant((theme, collector) => { const border = theme.g...
{ return 'messageoverlay'; }
identifier_body
messageController.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} } const MessageCommand = EditorCommand.bindToContribution<MessageController>(MessageController.get); registerEditorCommand(new MessageCommand({ id: 'leaveEditorMessage', precondition: MessageController.MESSAGE_VISIBLE, handler: c => c.closeMessage(), kbOpts: { weight: KeybindingWeight.EditorContrib + 30, ...
{ this.showMessage(nls.localize('editor.readonly', "Cannot edit in read-only editor"), this._editor.getPosition()); }
conditional_block
messageController.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} dispose() { this._editor.removeContentWidget(this); } getId(): string { return 'messageoverlay'; } getDomNode(): HTMLElement { return this._domNode; } getPosition(): IContentWidgetPosition { return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE] }; } } registerEdi...
this._editor.addContentWidget(this); this._domNode.classList.add('fadeIn');
random_line_split
__init__.py
from holoviews.element import ( ElementConversion, Points as HvPoints, Polygons as HvPolygons, Path as HvPath ) from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API import) WMTS, Points, Image, Text, LineContours, RGB, FilledContours, Path, Polygons, Sh...
def linecontours(self, kdims=None, vdims=None, mdims=None, **kwargs): return self(LineContours, kdims, vdims, mdims, **kwargs) def filledcontours(self, kdims=None, vdims=None, mdims=None, **kwargs): return self(FilledContours, kdims, vdims, mdims, **kwargs) def image(self, kdims=None, vd...
group_type = args[0] if 'crs' not in kwargs and issubclass(group_type, _Element): kwargs['crs'] = self._element.crs is_gpd = self._element.interface.datatype == 'geodataframe' if is_gpd: kdims = args[1] if len(args) > 1 else kwargs.get('kdims', None) if len(ar...
identifier_body
__init__.py
from holoviews.element import ( ElementConversion, Points as HvPoints, Polygons as HvPolygons, Path as HvPath ) from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API import) WMTS, Points, Image, Text, LineContours, RGB, FilledContours, Path, Polygons, Sh...
el_type = Polygons if is_geographic(self._element, kdims) else HvPolygons return self(el_type, kdims, vdims, mdims, **kwargs) def path(self, kdims=None, vdims=None, mdims=None, **kwargs): if kdims is None: kdims = self._element.kdims el_type = Path if is_geographic(self._element, k...
kdims = self._element.kdims
conditional_block
__init__.py
from holoviews.element import ( ElementConversion, Points as HvPoints, Polygons as HvPolygons, Path as HvPath ) from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API import) WMTS, Points, Image, Text, LineContours, RGB, FilledContours, Path, Polygons, Sh...
return self(LineContours, kdims, vdims, mdims, **kwargs) def filledcontours(self, kdims=None, vdims=None, mdims=None, **kwargs): return self(FilledContours, kdims, vdims, mdims, **kwargs) def image(self, kdims=None, vdims=None, mdims=None, **kwargs): return self(Image, kdims, vdims, md...
return converted def linecontours(self, kdims=None, vdims=None, mdims=None, **kwargs):
random_line_split
__init__.py
from holoviews.element import ( ElementConversion, Points as HvPoints, Polygons as HvPolygons, Path as HvPath ) from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API import) WMTS, Points, Image, Text, LineContours, RGB, FilledContours, Path, Polygons, Sh...
(self, *args, **kwargs): group_type = args[0] if 'crs' not in kwargs and issubclass(group_type, _Element): kwargs['crs'] = self._element.crs is_gpd = self._element.interface.datatype == 'geodataframe' if is_gpd: kdims = args[1] if len(args) > 1 else kwargs.get('kd...
__call__
identifier_name
kalloc.rs
// The MIT License (MIT) // // Copyright (c) 2015 Kashyap // // 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, m...
} } fn kfree(v : Address) { //struct run *r; if ((v % PG_SIZE) > 0) || (v2p(v) >= PHYSTOP) { panic("kfree"); } unsafe { if v < end { panic("kfree"); } } unsafe { // Fill with junk to catch dangling refs. memset(v as * mut u8, 1, PG_SIZE as usize); }...
{ break; }
conditional_block
kalloc.rs
// The MIT License (MIT) // // Copyright (c) 2015 Kashyap // // 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, m...
fn kfree(v : Address) { //struct run *r; if ((v % PG_SIZE) > 0) || (v2p(v) >= PHYSTOP) { panic("kfree"); } unsafe { if v < end { panic("kfree"); } } unsafe { // Fill with junk to catch dangling refs. memset(v as * mut u8, 1, PG_SIZE as usize); } // /...
{ let mut address = pg_roundup(vstart); // Keep it around for future debugging //unsafe { // asm!("mov $0 , %rax" : /* no outputs */ : "r"(vend) : "eax"); // asm!("mov $0 , %rbx" : /* no outputs */ : "r"(address) : "eax"); //} unsafe { end = vstart; } loop { kfree(address); address = address + PG_SIZE;...
identifier_body
kalloc.rs
// The MIT License (MIT) // // Copyright (c) 2015 Kashyap // // 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, m...
static mut kmem : KmemT = KmemT{ lock: DUMMY_LOCK, use_lock: 0} ; static mut end : Address = 0; pub fn kinit1(vstart: Address, vend: Address) { unsafe { init_lock(& mut kmem.lock, "kmem"); kmem.use_lock = 0; } free_range(vstart, vend); } fn free_range(vstart: Address, vend: Address) { let mut address = pg_ro...
random_line_split
kalloc.rs
// The MIT License (MIT) // // Copyright (c) 2015 Kashyap // // 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, m...
(vstart: Address, vend: Address) { unsafe { init_lock(& mut kmem.lock, "kmem"); kmem.use_lock = 0; } free_range(vstart, vend); } fn free_range(vstart: Address, vend: Address) { let mut address = pg_roundup(vstart); // Keep it around for future debugging //unsafe { // asm!("mov $0 , %rax" : /* no outputs */...
kinit1
identifier_name
boiler_dispatch.rs
//! Experimental boiler library for dispatching messages to handlers use boiler::{Message, EMsg}; pub trait MessageHandler { fn invoke(&mut self, message: Message); } impl<F: FnMut(Message)> MessageHandler for F { fn invoke(&mut self, message: Message) { self(message); } } pub struct MessageDisp...
// We were unable to find anything, call the fallback self.invoke_fallback(message); } fn invoke_fallback(&mut self, message: Message) { if let &mut Some(ref mut handler) = &mut self.fallback { handler(message); } } }
{ handler.invoke(message); return; }
conditional_block
boiler_dispatch.rs
//! Experimental boiler library for dispatching messages to handlers use boiler::{Message, EMsg}; pub trait MessageHandler { fn invoke(&mut self, message: Message); } impl<F: FnMut(Message)> MessageHandler for F { fn invoke(&mut self, message: Message) { self(message); } } pub struct MessageDisp...
} fn invoke_fallback(&mut self, message: Message) { if let &mut Some(ref mut handler) = &mut self.fallback { handler(message); } } }
} // We were unable to find anything, call the fallback self.invoke_fallback(message);
random_line_split
boiler_dispatch.rs
//! Experimental boiler library for dispatching messages to handlers use boiler::{Message, EMsg}; pub trait MessageHandler { fn invoke(&mut self, message: Message); } impl<F: FnMut(Message)> MessageHandler for F { fn
(&mut self, message: Message) { self(message); } } pub struct MessageDispatcher<'a> { handlers: Vec<Option<Box<MessageHandler + 'a>>>, fallback: Option<Box<FnMut(Message)>> } impl<'a> MessageDispatcher<'a> { pub fn new() -> Self { // Fill the vector with Nones, we can't use vec! for th...
invoke
identifier_name
boiler_dispatch.rs
//! Experimental boiler library for dispatching messages to handlers use boiler::{Message, EMsg}; pub trait MessageHandler { fn invoke(&mut self, message: Message); } impl<F: FnMut(Message)> MessageHandler for F { fn invoke(&mut self, message: Message) { self(message); } } pub struct MessageDisp...
pub fn handle(&mut self, message: Message) { if let &mut Some(ref mut handler) = &mut self.handlers[message.header.emsg() as usize] { handler.invoke(message); return; } // We were unable to find anything, call the fallback self.invoke_fallback(message); ...
{ self.fallback = Some(handler); }
identifier_body
response.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) 2016 Jacob Peddicord <jacob@peddicord.net> */ use serde_json::{self, Error}; use submission::Sub...
}
}
random_line_split
response.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) 2016 Jacob Peddicord <jacob@peddicord.net> */ use serde_json::{self, Error}; use submission::Sub...
{ None, GeneralFailure { stderr: String }, TestFailures { pass: u8, fail: u8, diff: String }, InternalError(String), } #[derive(Debug, Serialize)] pub struct Response { id: u32, user: u32, problem: String, result: SubmissionStatus, meta: SubmissionMeta, } impl Response { pub f...
SubmissionMeta
identifier_name
Gruntfile.js
/* * grunt-static-i18next * * * Copyright (c) 2014 Stas Yermakov * Licensed under the MIT license. */ 'use strict'; module.exports = function (grunt) { // load all npm grunt tasks require('load-grunt-tasks')(grunt); // Project configuration. grunt.initConfig({ yeoman: { // configurable path...
jshint: { all: [ 'Gruntfile.js', 'tasks/*.js', '<%= nodeunit.tests %>' ], options: { jshintrc: '.jshintrc', reporter: require('jshint-stylish') } }, // Unit tests. nodeunit: { tests: ['test/*_test.js'] }, // Compile TypeScr...
} },
random_line_split
hbase_master.py
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");...
HbaseMaster().execute()
conditional_block
hbase_master.py
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");...
(self, env, action = None): import params env.set_params(params) hbase('master', action) def start(self, env): import params env.set_params(params) self.configure(env, action = 'start') # for security hbase_service( 'master', action = 'start' ) def stop(self, env): ...
configure
identifier_name
hbase_master.py
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");...
env.set_params(params) self.configure(env, action = 'start') # for security hbase_service( 'master', action = 'start' ) def stop(self, env): import params env.set_params(params) hbase_service( 'master', action = 'stop' ) def status(self, env): import status_pa...
hbase('master', action) def start(self, env): import params
random_line_split
hbase_master.py
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");...
def stop(self, env): import params env.set_params(params) hbase_service( 'master', action = 'stop' ) def status(self, env): import status_params env.set_params(status_params) pid_file = format("{pid_dir}/hbase-{hbase_user}-master.pid") check_process_status(pid_file) ...
import params env.set_params(params) self.configure(env, action = 'start') # for security hbase_service( 'master', action = 'start' )
identifier_body
project-suggested-contributions.js
/** * window.c.ProjectSuggestedContributions component * A Project-show page helper to show suggested amounts of contributions * * Example of use: * view: () => { * ... * m.component(c.ProjectSuggestedContributions, {project: project}) * ... * } */ import m from 'mithril'; import _ from 'underscore'; c...
(ctrl, args) { const project = args.project(); const suggestionUrl = amount => `/projects/${project.project_id}/contributions/new?amount=${amount}`, suggestedValues = [10, 25, 50, 100]; return m('#suggestions', _.map(suggestedValues, amount => project ? m(`a[href="${suggestionUrl(a...
view
identifier_name
project-suggested-contributions.js
/** * window.c.ProjectSuggestedContributions component * A Project-show page helper to show suggested amounts of contributions * * Example of use: * view: () => { * ... * m.component(c.ProjectSuggestedContributions, {project: project}) * ... * } */ import m from 'mithril'; import _ from 'underscore'; c...
export default projectSuggestedContributions;
random_line_split
project-suggested-contributions.js
/** * window.c.ProjectSuggestedContributions component * A Project-show page helper to show suggested amounts of contributions * * Example of use: * view: () => { * ... * m.component(c.ProjectSuggestedContributions, {project: project}) * ... * } */ import m from 'mithril'; import _ from 'underscore'; c...
}; export default projectSuggestedContributions;
{ const project = args.project(); const suggestionUrl = amount => `/projects/${project.project_id}/contributions/new?amount=${amount}`, suggestedValues = [10, 25, 50, 100]; return m('#suggestions', _.map(suggestedValues, amount => project ? m(`a[href="${suggestionUrl(amount)}"].car...
identifier_body
root_moves_list.rs
use std::slice; use std::ops::{Deref,DerefMut,Index,IndexMut}; use std::iter::{Iterator,IntoIterator,FusedIterator,TrustedLen,ExactSizeIterator}; use std::ptr; use std::mem; use std::sync::atomic::{Ordering,AtomicUsize}; use pleco::{MoveList, BitMove}; use super::{RootMove, MAX_MOVES}; pub struct RootMoveList { ...
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { (self.len - self.idx, Some(self.len - self.idx)) } } impl<'a> IntoIterator for &'a RootMoveList { type Item = RootMove; type IntoIter = MoveIter<'a>; #[inline] fn into_iter(self) -> Self::IntoIter { MoveIter { ...
{ if self.idx >= self.len { None } else { unsafe { let m = *self.movelist.get_unchecked(self.idx); self.idx += 1; Some(m) } } }
identifier_body
root_moves_list.rs
use std::slice; use std::ops::{Deref,DerefMut,Index,IndexMut}; use std::iter::{Iterator,IntoIterator,FusedIterator,TrustedLen,ExactSizeIterator}; use std::ptr; use std::mem; use std::sync::atomic::{Ordering,AtomicUsize}; use pleco::{MoveList, BitMove}; use super::{RootMove, MAX_MOVES}; pub struct RootMoveList { ...
(&mut self, moves: &MoveList) { self.len.store(moves.len(), Ordering::SeqCst); for (i, mov) in moves.iter().enumerate() { self[i] = RootMove::new(*mov); } } /// Applies `RootMove::rollback()` to each `RootMove` inside. #[inline] pub fn rollback(&mut self) { s...
replace
identifier_name
root_moves_list.rs
use std::slice; use std::ops::{Deref,DerefMut,Index,IndexMut}; use std::iter::{Iterator,IntoIterator,FusedIterator,TrustedLen,ExactSizeIterator}; use std::ptr; use std::mem; use std::sync::atomic::{Ordering,AtomicUsize}; use pleco::{MoveList, BitMove}; use super::{RootMove, MAX_MOVES}; pub struct RootMoveList { ...
/// Converts to a `MoveList`. pub fn to_list(&self) -> MoveList { let vec = self.iter().map(|m| m.bit_move).collect::<Vec<BitMove>>(); MoveList::from(vec) } /// Returns the previous best score. #[inline] pub fn prev_best_score(&self) -> i32 { unsafe { self.g...
random_line_split
root_moves_list.rs
use std::slice; use std::ops::{Deref,DerefMut,Index,IndexMut}; use std::iter::{Iterator,IntoIterator,FusedIterator,TrustedLen,ExactSizeIterator}; use std::ptr; use std::mem; use std::sync::atomic::{Ordering,AtomicUsize}; use pleco::{MoveList, BitMove}; use super::{RootMove, MAX_MOVES}; pub struct RootMoveList { ...
else { unsafe { let m = *self.movelist.get_unchecked(self.idx); self.idx += 1; Some(m) } } } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { (self.len - self.idx, Some(self.len - self.idx)) } } impl<'a>...
{ None }
conditional_block
cloudpipe.py
# Copyright 2011 Openstack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
else: rv['state'] = 'pending' return rv @wsgi.serializers(xml=CloudpipeTemplate) def create(self, req, body): """Create a new cloudpipe instance, if none exists. Parameters: {cloudpipe: {project_id: XYZ}} """ ctxt = req.environ['nova.context'] ...
rv['instance_id'] = vpn_instance['uuid'] rv['created_at'] = utils.isotime(vpn_instance['created_at']) address = vpn_instance.get('fixed_ip', None) if address: rv['internal_ip'] = address['address'] if project.vpn_ip and project.vpn_port: if...
conditional_block
cloudpipe.py
# Copyright 2011 Openstack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
(self): """Ensure the keychains and folders exist.""" # NOTE(vish): One of the drawbacks of doing this in the api is # the keys will only be on the api node that launched # the cloudpipe. if not os.path.exists(FLAGS.keys_path): os.makedirs(FLAG...
setup
identifier_name
cloudpipe.py
# Copyright 2011 Openstack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
class CloudpipeController(object): """Handle creating and listing cloudpipe instances.""" def __init__(self): self.compute_api = compute.API() self.auth_manager = manager.AuthManager() self.cloudpipe = pipelib.CloudPipe() self.setup() def setup(self): """Ensure t...
root = xmlutil.TemplateElement('cloudpipes') elem = xmlutil.make_flat_dict('cloudpipe', selector='cloudpipes', subselector='cloudpipe') root.append(elem) return xmlutil.MasterTemplate(root, 1)
identifier_body
cloudpipe.py
# Copyright 2011 Openstack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
# License for the specific language governing permissions and limitations # under the License. """Connect your vlan to the world.""" import os from nova.api.openstack import wsgi from nova.api.openstack import xmlutil from nova.api.openstack import extensions from nova.auth import manager from nova.cloudpipe imp...
random_line_split
misc.py
# misc.py # Copyright (C) 2012-2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope tha...
return _cached_getloginuid def decompress(filename, dest=None, check_timestamps=False): """take a filename and decompress it into the same relative location. When the compression type is not recognized (or file is not compressed), the content of the file is copied to the destination""" if ...
_cached_getloginuid = _getloginuid()
conditional_block
misc.py
# misc.py # Copyright (C) 2012-2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope tha...
def import_key_to_pubring(rawkey, keyid, gpgdir=None, make_ro_copy=True): if not os.path.exists(gpgdir): os.makedirs(gpgdir) with dnf.crypto.pubring_dir(gpgdir), dnf.crypto.Context() as ctx: # import the key with open(os.path.join(gpgdir, 'gpg.conf'), 'wb') as fp: fp.writ...
''' Return if the GPG key described by the given keyid and timestamp are installed in the rpmdb. The keyid and timestamp should both be passed as integers. The ts is an rpm transaction set object Return values: - -1 key is not installed - 0 key with matching ID and times...
identifier_body
misc.py
# misc.py # Copyright (C) 2012-2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope tha...
no-permission-warning preserve-permissions """ with open(os.path.join(rodir, 'gpg.conf'), 'w', 0o755) as fp: fp.write(opts) return True def getCacheDir(): """return a path to a valid and safe cachedir - only used when not running as root or when --t...
no-auto-check-trustdb trust-model direct no-expensive-trust-checks
random_line_split
misc.py
# misc.py # Copyright (C) 2012-2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope tha...
(self, iter=None): self.__iter = iter def __iter__(self): if self.__iter is not None: return iter(self[self.__iter]) def __getitem__(self, item): if hasattr(self, item): return getattr(self, item) else: raise KeyError(item) def all_lists...
__init__
identifier_name
rebuild_storage.py
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
sys.stdout.write('can not write log with exception: {0} {1}'.format(type(ex), ex)) @staticmethod def WriteLine(log, consoleColor = -1, writeToFile = True, printToStdout = True): ''' consoleColor: value in class ConsoleColor, such as ConsoleColor.DarkGreen if consoleCol...
except Exception as ex: logFile.close()
random_line_split
rebuild_storage.py
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
p.wait(BuildTimeout) except subprocess.TimeoutExpired as e: Logger.Log('{0}'.format(e), ConsoleColor.Yellow) p.kill() else: buildFailed = p.wait() if not UseMSBuild: #IncrediBuild的返回值不能说明编译是否成功,需要提取输出判断 fin = open('...
返回,可能是IncrediBuild的bug if IsPy3: try: buildFailed =
conditional_block
rebuild_storage.py
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
rt), ] class ConsoleScreenBufferInfo(ctypes.Structure): _fields_ = [('dwSize', Coord), ('dwCursorPosition', Coord), ('wAttributes', ctypes.c_uint), ('srWindow', SmallRect), ('dwMaximumWindowSize', Coord), ] class Wi...
genta = 13 Yellow = 14 White = 15 class Coord(ctypes.Structure): _fields_ = [('X', ctypes.c_short), ('Y', ctypes.c_short)] class SmallRect(ctypes.Structure): _fields_ = [('Left', ctypes.c_short), ('Top', ctypes.c_short), ('Right', ctypes.c_short), ...
identifier_body
rebuild_storage.py
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
t pull') os.chdir(oldDir) if ret != 0: Logger.Log('update {0} failed'.format(dir), ConsoleColor.Yellow) return false return True def BuildProject(cmd): for i in range(6): Logger.WriteLine(cmd, ConsoleColor.Cyan) buildFailed = True start...
system('gi
identifier_name
validate-uncompressed.js
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ Object.append(Browser.Features, { inputemail: (function() { var i = document.createElement("input"); i.setAttribute("type", "email"); return i.type !== ...
if (this.validate(elements[i]) == false) { valid = false; } } // Run custom form validators if present new Hash(this.custom).each(function(validator){ if (validator.exec() != true) { valid = false; } }); return valid; }, handleResponse: function(state, el) { // Find the label object for the given field if it exists ...
random_line_split
validate-uncompressed.js
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ Object.append(Browser.Features, { inputemail: (function() { var i = document.createElement("input"); i.setAttribute("type", "email"); return i.type !== ...
else if (!(el.get('value'))) { this.handleResponse(false, el); return false; } } // Only validate the field if the validate class is set var handler = (el.className && el.className.search(/validate-([a-zA-Z0-9\_\-]+)/) != -1) ? el.className.match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : ""; if (handler == '') { this.handl...
{ for(var i=0;;i++) { if (document.id(el.get('id')+i)) { if (document.id(el.get('id')+i).checked) { break; } } else { this.handleResponse(false, el); return false; } } }
conditional_block
index.d.ts
// Type definitions for retry 0.10 // Project: https://github.com/tim-kos/node-retry // Definitions by: Stan Goldmann <https://github.com/krenor> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 export interface RetryOperation { /** * Defines the function that is to be...
forever?: boolean; /** * Whether to unref the setTimeout's. * @default false */ unref?: boolean; }
randomize?: boolean; /** * Whether to retry forever. * @default false */
random_line_split
v1.ts
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
/** * acceleratedmobilepageurl.ampUrls.batchGet * @desc Returns AMP URL(s) and equivalent [AMP Cache * URL(s)](/amp/cache/overview#amp-cache-url-format). * @alias acceleratedmobilepageurl.ampUrls.batchGet * @memberOf! () * * @param {object} params Parameters for request * ...
{ return this.root; }
identifier_body
v1.ts
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
} } export interface Params$Resource$Ampurls$Batchget { /** * Auth client or API Key for the request */ auth?: string|OAuth2Client|JWT|Compute|UserRefreshClient; /** * Request body metadata */ requestBody?: Schema$BatchGetAmpUrlsRequest; } }
{ return createAPIRequest<Schema$BatchGetAmpUrlsResponse>(parameters); }
conditional_block
v1.ts
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
(options: GlobalOptions, google?: GoogleConfigurable) { this._options = options || {}; this.google = google; this.getRoot.bind(this); this.ampUrls = new Resource$Ampurls(this); } getRoot() { return this.root; } } /** * AMP URL response for a requested URL. */ exp...
constructor
identifier_name
v1.ts
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
errorCode?: string; /** * An optional descriptive error message. */ errorMessage?: string; /** * The original non-AMP URL. */ originalUrl?: string; } /** * AMP URL request for a batch of URLs. */ export interface Schema$BatchGetAmpUrlsRequest { /** * The look...
random_line_split
Modal.api.js
/** * modal api */ export default { methods: { /** * 点击 Full 的导航按钮 */ clickFullNav() { if (this.commit) { this.no() } else { this.hide() } }, /** * 显示pop * * @param {Number} - 当前页码 * @return {Object} */ show() { this.mo...
his.stateMessage = message this.stateUI = ui this.stateTheme = theme return this } } }
t
identifier_name
Modal.api.js
/** * modal api */ export default { methods: { /** * 点击 Full 的导航按钮 */ clickFullNav() { if (this.commit) { this.no() } else { this.hide() } }, /** * 显示pop * * @param {Number} - 当前页码 * @return {Object} */ show() { this.mo...
*/ ok() { this.$emit('ok') if (this.okCbFun) { if (typeof this.okCbFun === 'function') { this.okCbFun(this) } return this } return this.hide() }, /** * 弹窗点击取消触发的函数 * * @return {Object} */ no() { this.$emit('no')...
* 弹窗点击确定触发的函数 * * @return {Object}
random_line_split
Modal.api.js
/** * modal api */ export default { methods: { /** * 点击 Full 的导航按钮 */ clickFullNav() { if (this.commit) { this.no() } else { this.hide() } }, /** * 显示pop * * @param {Number} - 当前页码 * @return {Object} */ show() { this.mo...
('ok') if (this.okCbFun) { if (typeof this.okCbFun === 'function') { this.okCbFun(this) } return this } return this.hide() }, /** * 弹窗点击取消触发的函数 * * @return {Object} */ no() { this.$emit('no') if (this.noCbFun) { ...
this.isMousedown = false return this }, /** * 弹窗点击确定触发的函数 * * @return {Object} */ ok() { this.$emit
identifier_body
Modal.api.js
/** * modal api */ export default { methods: { /** * 点击 Full 的导航按钮 */ clickFullNav() { if (this.commit) { this
this.hide() } }, /** * 显示pop * * @param {Number} - 当前页码 * @return {Object} */ show() { this.modalDisplay = true return this.$nextTick(() => { this.$refs.fadeTransition.enter() this.$refs.pop.show() return this }) }, /** ...
.no() } else {
conditional_block
ppapi_ppp_instance.js
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. function startsWith(str, prefix) { return (str.indexOf(prefix) === 0); } function setupTests(tester, plugin) { //////////////////////////////////////...
(test, testFunction, runCheck) { return addTestListeners(1, test, testFunction, runCheck); } ////////////////////////////////////////////////////////////////////////////// // Tests ////////////////////////////////////////////////////////////////////////////// tester.addTest('PPP_Instance::DidCreate', fu...
addTestListener
identifier_name
ppapi_ppp_instance.js
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. function startsWith(str, prefix) { return (str.indexOf(prefix) === 0); } function setupTests(tester, plugin) { //////////////////////////////////////...
plugin.width = 15; plugin.height = 20; addTestListener(test, 'DidChangeView'); }); // This test does not appear to be reliable on the bots. // http://crbug.com/329511 /* tester.addAsyncTest('PPP_Instance::DidChangeFocus', function(test) { // TODO(polina): How can I simulate focusing on Window...
tester.addAsyncTest('PPP_Instance::DidChangeView', function(test) { // The .cc file hardcodes an expected 15x20 size.
random_line_split
ppapi_ppp_instance.js
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. function startsWith(str, prefix)
function setupTests(tester, plugin) { ////////////////////////////////////////////////////////////////////////////// // Test Helpers ////////////////////////////////////////////////////////////////////////////// var numMessages = 0; function addTestListeners(numListeners, test, testFunction, runCheck) { ...
{ return (str.indexOf(prefix) === 0); }
identifier_body
flags.ts
// // Copyright (c) Microsoft Corporation. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless re...
export enum ErrorRecoverySet { None = 0, Comma = 1, // Comma SColon = 1 << 1, // SColon Asg = 1 << 2, // Asg BinOp = 1 << 3, // Lsh, Rsh, Rs2, Le, Ge, INSTANCEOF, EQ, NE, Eqv, NEqv, LogAnd, LogOr, AsgMul, AsgDiv // AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2,...
return (val & flag) != 0; }
identifier_body
flags.ts
// // Copyright (c) Microsoft Corporation. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless re...
return builder; } }
if ((flags & i) != 0) { for (var k in e) { if (e[k] == i) { if (builder.length > 0) { builder += "|"; } builder += k; break; ...
conditional_block
flags.ts
// // Copyright (c) Microsoft Corporation. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless re...
OrVarOrSymbolOrModuleFlags: any) { return <DeclFlags>fncOrVarOrSymbolOrModuleFlags; } export enum TypeFlags { None = 0, HasImplementation = 1, HasSelfReference = 1 << 1, MergeResult = 1 << 2, IsEnum = 1 << 3, BuildingName = 1 << 4, HasB...
clFlags(fnc
identifier_name
flags.ts
// // Copyright (c) Microsoft Corporation. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless re...
} builder += k; break; } } } } return builder; } }
if (e[k] == i) { if (builder.length > 0) { builder += "|";
random_line_split
bfe_photo_resources_brief.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the
## ## Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## a...
## License, or (at your option) any later version.
random_line_split
bfe_photo_resources_brief.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## Licens...
(bfo): """ Called by BibFormat in order to check if output of this element should be escaped. """ return 0
escape_values
identifier_name
bfe_photo_resources_brief.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## Licens...
return out def escape_values(bfo): """ Called by BibFormat in order to check if output of this element should be escaped. """ return 0
if resource.get("x", "") == "icon": out += '<a href="'+CFG_SITE_URL+'/'+ CFG_SITE_RECORD +'/'+bfo.control_field("001")+ \ '?ln='+ bfo.lang + '"><img src="' + resource.get("u", "").replace(" ","") \ + '" alt="" border="0"/></a>'
conditional_block
bfe_photo_resources_brief.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## Licens...
""" Called by BibFormat in order to check if output of this element should be escaped. """ return 0
identifier_body
unix.rs
use libloading::Library; use std::fs::ReadDir; use types::Identifier; /// Grabs all `Library` entries found within a given directory pub(crate) struct LibraryIterator { directory: ReadDir, } impl LibraryIterator { pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } } } im...
}
{ while let Some(entry) = self.directory.next() { let entry = if let Ok(entry) = entry { entry } else { continue }; let path = entry.path(); // An entry is a library if it is a file with a 'so' extension. if path.is_file() && path.extension().map_or(false, |ext| e...
identifier_body
unix.rs
use libloading::Library; use std::fs::ReadDir; use types::Identifier; /// Grabs all `Library` entries found within a given directory pub(crate) struct LibraryIterator { directory: ReadDir, } impl LibraryIterator { pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } } } im...
} None } }
{ continue; }
conditional_block
unix.rs
use libloading::Library; use std::fs::ReadDir; use types::Identifier; /// Grabs all `Library` entries found within a given directory pub(crate) struct LibraryIterator { directory: ReadDir, } impl LibraryIterator { pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } } } im...
} } else { continue; } } None } }
eprintln!("ion: failed to load library: {:?}, {:?}", path, why); continue; }
random_line_split
unix.rs
use libloading::Library; use std::fs::ReadDir; use types::Identifier; /// Grabs all `Library` entries found within a given directory pub(crate) struct
{ directory: ReadDir, } impl LibraryIterator { pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } } } impl Iterator for LibraryIterator { // The `Identifier` is the name of the namespace for which values may be pulled. // The `Library` is a handle to dynamic libr...
LibraryIterator
identifier_name
win.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...
self.foreground = color; self.apply(); Ok(true) } fn bg(&mut self, color: color::Color) -> io::Result<bool> { self.background = color; self.apply(); Ok(true) } fn attr(&mut self, attr: attr::Attr) -> io::Result<bool> { match attr { ...
} impl<T: Write+Send+'static> Terminal<T> for WinConsole<T> { fn fg(&mut self, color: color::Color) -> io::Result<bool> {
random_line_split
win.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...
} impl<T: Write> Write for WinConsole<T> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.buf.write(buf) } fn flush(&mut self) -> io::Result<()> { self.buf.flush() } } impl<T: Write+Send+'static> Terminal<T> for WinConsole<T> { fn fg(&mut self, color: color::Color) -...
{ let fg; let bg; unsafe { let mut buffer_info = ::std::mem::uninitialized(); if GetConsoleScreenBufferInfo(GetStdHandle(-11), &mut buffer_info) != 0 { fg = bits_to_color(buffer_info.wAttributes); bg = bits_to_color(buffer_info.wAttributes ...
identifier_body
win.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...
(bits: u16) -> color::Color { let color = match bits & 0x7 { 0 => color::BLACK, 0x1 => color::BLUE, 0x2 => color::GREEN, 0x4 => color::RED, 0x6 => color::YELLOW, 0x5 => color::MAGENTA, 0x3 => color::CYAN, 0x7 => color::WHITE, _ => unreachable!(...
bits_to_color
identifier_name
primitive_functions.js
Board.scheme_primitive_functions = (function ($) { var m_canvas = null; var m_context = null; var m_main_frame = null; var m_board_main = Board.board_main; var m_editor = Board.editor; var m_div_repl = Board.div_repl; var JS_functions = { 'set-painter-frame': function(args){ // (make-frame) ...
var createBind = function (variable, value) { var result = {}; result.variable = variable; result.value = value; return result; }; var builtinFunc = function (variable, value) { result.push(createBind(variable, new LPrimitiveFunc(value))); }; console...
m_editor = Board.editor; }, install_JS_functions: function(result){
random_line_split
email-input.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor...
(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "obje...
_classCallCheck
identifier_name
email-input.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor...
function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } var EmailInput = function (_TextInput) { _inherits(EmailInput, _TextInput); function Ema...
{ if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable...
identifier_body
email-input.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor...
} }]); return EmailInput; }(_textInput2.default); exports.default = EmailInput; EmailInput.propTypes = { type: _propTypes2.default.string.isRequired }; EmailInput.defaultProps = { type: "email" };
random_line_split
email-input.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor...
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function validateEmail(email) { ...
{ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); }
conditional_block
setup.py
# vim: set fileencoding=utf-8 : """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from ...
# To provide executable scripts, use entry points in preference to the # "scripts" keyword. Entry points provide cross-platform support and allow # pip to create the appropriate form of executable for the target platform. entry_points={ 'console_scripts': [ 'endymion=endymion:main', ...
random_line_split