file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
user.client.controller.js
(function () { 'use strict'; angular .module('users.admin') .controller('UserController', UserController); UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', '$mdToast']; function UserController($scope, $state, $window, Authentication, user, $mdToast) { var ...
(user) { if ($window.confirm('Are you sure you want to delete this user?')) { if (user) { user.$remove(); vm.users.splice(vm.users.indexOf(user), 1); } else { vm.user.$remove(function () { $state.go('admin.users'); }); } } } ...
remove
identifier_name
user.client.controller.js
(function () { 'use strict'; angular .module('users.admin') .controller('UserController', UserController); UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', '$mdToast']; function UserController($scope, $state, $window, Authentication, user, $mdToast) { var ...
}); } } }());
{ if (!isValid) { $scope.$broadcast('show-errors-check-validity', 'vm.userForm'); return false; } var user = vm.user; user.$update(function () { $state.go('admin.user', { userId: user._id }); }, function (errorResponse) { vm.error = erro...
identifier_body
user.client.controller.js
(function () { 'use strict'; angular .module('users.admin') .controller('UserController', UserController); UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', '$mdToast']; function UserController($scope, $state, $window, Authentication, user, $mdToast) { var ...
} function update(isValid) { if (!isValid) { $scope.$broadcast('show-errors-check-validity', 'vm.userForm'); return false; } var user = vm.user; user.$update(function () { $state.go('admin.user', { userId: user._id }); }, function (err...
{ if (user) { user.$remove(); vm.users.splice(vm.users.indexOf(user), 1); } else { vm.user.$remove(function () { $state.go('admin.users'); }); } }
conditional_block
user.client.controller.js
(function () { 'use strict'; angular .module('users.admin') .controller('UserController', UserController); UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', '$mdToast']; function UserController($scope, $state, $window, Authentication, user, $mdToast) { var ...
var user = vm.user; user.$update(function () { $state.go('admin.user', { userId: user._id }); }, function (errorResponse) { vm.error = errorResponse.data.message; $mdToast.show( $mdToast.simple() .textContent(vm.error) .hide...
if (!isValid) { $scope.$broadcast('show-errors-check-validity', 'vm.userForm'); return false; }
random_line_split
sanity-check-users-and-groups.py
#### #### Give a report on the "sanity" of the users and groups YAML #### metadata files. #### #### Example usage to analyze the usual suspects: #### python3 sanity-check-users-and-groups.py --help #### Get report of current problems: #### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml...
def main(): ## Deal with incoming. parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-v', '--verbose', action='store_true', help='More verbose output') parser.add_argument('-u', '--...
""" Die and take our toys home. """ global DIED_SCREAMING_P LOGGER.error(string) DIED_SCREAMING_P = True #sys.exit(1)
identifier_body
sanity-check-users-and-groups.py
#### #### Give a report on the "sanity" of the users and groups YAML #### metadata files. #### #### Example usage to analyze the usual suspects: #### python3 sanity-check-users-and-groups.py --help #### Get report of current problems: #### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml...
else: ## 4: If so, are all entries in groups? for gid in user.get('groups'): if not groups_lookup.get(gid, False): die_screaming(user.get('nickname', '???') +\ ' has mi...
violations["groups"].append(nick)
conditional_block
sanity-check-users-and-groups.py
#### #### Give a report on the "sanity" of the users and groups YAML #### metadata files. #### #### Example usage to analyze the usual suspects: #### python3 sanity-check-users-and-groups.py --help #### Get report of current problems: #### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml...
matching_groups = list(filter(lambda g: org == g["label"] or org == g["shorthand"], groups_linear)) if len(matching_groups) > 0: print("REPAIR?: Use group: {}".format(matching_groups[0]["id"])) if args.repair: ...
' has no "groups"') #print(nick + ' has no "groups"') if user.get("organization", False): org = user["organization"] print(nick + " could try org {}".format(org))
random_line_split
sanity-check-users-and-groups.py
#### #### Give a report on the "sanity" of the users and groups YAML #### metadata files. #### #### Example usage to analyze the usual suspects: #### python3 sanity-check-users-and-groups.py --help #### Get report of current problems: #### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml...
(): ## Deal with incoming. parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-v', '--verbose', action='store_true', help='More verbose output') parser.add_argument('-u', '--users', ...
main
identifier_name
classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest.js
var classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest =
[ "testMonitorIpv4HostExists", "classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest.html#a5547e29e54ef5632732fac77f60a753e", null ], [ "testMonitorIpv6HostDoesNotExist", "classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest.html#a0ba14f3372764b2be30ae7ce1489d90e", null ], [ "testM...
[ [ "setUp", "classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest.html#af91e64e70973a90efc9748aeef66bbc9", null ], [ "shutdown", "classorg_1_1onosproject_1_1net_1_1host_1_1impl_1_1HostMonitorTest.html#ac837c9c21e60a8962feed93f46065757", null ], [ "testMonitorIpv4HostDoesNotExist", "classorg_1_...
random_line_split
tree_sortable.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TreeModel; use ffi; use glib; use glib::object::Downcast; use glib::object::IsA; use glib::signal::connect; use glib::translate::*; use glib_ffi; use std::boxed::Box as Box_; use std::mem::transmute;
glib_wrapper! { pub struct TreeSortable(Object<ffi::GtkTreeSortable>): TreeModel; match fn { get_type => || ffi::gtk_tree_sortable_get_type(), } } pub trait TreeSortableExt { fn has_default_sort_func(&self) -> bool; //fn set_default_sort_func<'a, P: Into<Option</*Unimplemented*/Fundamenta...
random_line_split
tree_sortable.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TreeModel; use ffi; use glib; use glib::object::Downcast; use glib::object::IsA; use glib::signal::connect; use glib::translate::*; use glib_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { pub struct...
{ callback_guard!(); let f: &Box_<Fn(&P) + 'static> = transmute(f); f(&TreeSortable::from_glib_none(this).downcast_unchecked()) }
identifier_body
tree_sortable.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use TreeModel; use ffi; use glib; use glib::object::Downcast; use glib::object::IsA; use glib::signal::connect; use glib::translate::*; use glib_ffi; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { pub struct...
<F: Fn(&Self) + 'static>(&self, f: F) -> u64 { unsafe { let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "sort-column-changed", transmute(sort_column_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) ...
connect_sort_column_changed
identifier_name
Gruntfile.js
'use strict'; module.exports = function (grunt) { // Load npm tasks. [ 'grunt-contrib-jshint', 'grunt-jscs', 'grunt-contrib-jasmine' ].forEach(function (name) { grunt.loadNpmTasks(name);
var config = { javascripts: ['*.js', 'test/**/*.js'] }; grunt.initConfig({ jshint: { options: { jshintrc: '.jshintrc' }, all: config.javascripts }, jscs: { all: config.javascripts }, jasmine: { all: { src: [ 'testmator.js', ...
});
random_line_split
gu.js
/** * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.setLang( 'a11yhelp', 'gu', { title: 'એક્ક્ષેબિલિટી ની વિગતો', contents: 'હેલ્પ. આ બંધ કરવા ESC દબાવો.', legend: [ { ...
{ name: 'Editor Context Menu', // MISSING legend: 'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE ...
legend: 'Inside a dialog, press TAB to navigate to the next dialog element, press SHIFT+TAB to move to the previous dialog element, press ENTER to submit the dialog, press ESC to cancel the dialog. When a dialog has multiple tabs, the tab list can be reached either with ALT+F10 or with TAB as part of the dialog ...
random_line_split
variables.py
# This file is part of the markuz_youtube_downlaoder project # # Copyright (c) 2011 Marco Antonio Islas Cruz # # markuz_youtube_downlaoder 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 th...
YOUTUBE_DEVELOPER_KEY =
#Before going on, you should create your own youtube developer_key, #Get one at http://code.google.com/apis/youtube/dashboard/
random_line_split
findandreplacedlg.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 2 of the License, or # version 3 of the Lic...
(self): enable = not self.findLineEdit.text().isEmpty() self.findButton.setEnabled(enable) self.replaceButton.setEnabled(enable) self.replaceAllButton.setEnabled(enable) def text(self): return self.__text if __name__ == "__main__": import sys text = """US experie...
updateUi
identifier_name
findandreplacedlg.py
#!/usr/bin/env python3
# modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 2 of the License, or # version 3 of the License, or (at your option) any later version. It is # provided for educational purposes and is distributed in the hope that # it will be useful, but WITH...
# Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or
random_line_split
findandreplacedlg.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 2 of the License, or # version 3 of the Lic...
if __name__ == "__main__": import sys text = """US experience shows that, unlike traditional patents, software patents do not encourage innovation and R&D, quite the contrary. In particular they hurt small and medium-sized enterprises and generally newcomers in the market. They will just weaken the market a...
return self.__text
identifier_body
findandreplacedlg.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 2 of the License, or # version 3 of the Lic...
return re.compile(findText, flags) @pyqtSignature("") def on_findButton_clicked(self): regex = self.makeRegex() match = regex.search(self.__text, self.__index) if match is not None: self.__index = match.end() self.emit(SIGNAL("found"), match.start()) ...
findText = r"\b{0}\b".format(findText)
conditional_block
calendar.daytimewise.component.ts
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; @Component({ selector: 'amexio-calendar-day-timewise', templateUrl: './calendar.daytimewise.component.html', styleUrls: ['./calendar.common.css'], }) export class AmexioCalendarDayTimeWiseComponent implem...
}); return ariadate; } }
{ ariadate = ariadate + individualday; }
conditional_block
calendar.daytimewise.component.ts
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; @Component({ selector: 'amexio-calendar-day-timewise', templateUrl: './calendar.daytimewise.component.html', styleUrls: ['./calendar.common.css'], }) export class AmexioCalendarDayTimeWiseComponent implem...
eventClicked(event1: any, eventData: any) { const eventObject = { event: event1, this: eventData.details, }; this.onEventClicked.emit(eventObject); } onHeaderClick(event: any) { this.onHeaderClicked.emit(event); } fulldate(date: Date) { ...
{ this.width = (this.headerRow.nativeElement.offsetWidth - 50) / 7; if ((this.width - 50) > 50) { this.width = this.width - 50; } }
identifier_body
calendar.daytimewise.component.ts
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; @Component({ selector: 'amexio-calendar-day-timewise', templateUrl: './calendar.daytimewise.component.html', styleUrls: ['./calendar.common.css'], }) export class AmexioCalendarDayTimeWiseComponent implem...
(date: Date) { const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; const months = ['january', 'febuary', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; let ariadate = date.getDate(); ...
fulldate
identifier_name
calendar.daytimewise.component.ts
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; @Component({ selector: 'amexio-calendar-day-timewise', templateUrl: './calendar.daytimewise.component.html', styleUrls: ['./calendar.common.css'], }) export class AmexioCalendarDayTimeWiseComponent implem...
constructor() { } ngOnInit() { this.width = (this.headerRow.nativeElement.offsetWidth - 50) / 7; if ((this.width - 50) > 50) { this.width = this.width - 50; } } eventClicked(event1: any, eventData: any) { const eventObject = { event: event1,...
@Output('onEventClicked') onEventClicked = new EventEmitter<any>(); @Output('onHeaderClicked') onHeaderClicked = new EventEmitter<any>(); width: number;
random_line_split
index.ios.js
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet,
} from 'react-native'; export default class TodoList extends Component { render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.ios.js ...
Text, View
random_line_split
index.ios.js
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; export default class
extends Component { render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.ios.js </Text> <Text style={styles.instructions}> ...
TodoList
identifier_name
step1.component.ts
/* * Copyright (C) 2015 The Gravitee team (http://gravitee.io) * * 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 requi...
} }
} return certificate.name;
random_line_split
step1.component.ts
/* * Copyright (C) 2015 The Gravitee team (http://gravitee.io) * * 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 requi...
return certificate.name; } }
{ return this.certificateTypes[certificate.id]; }
conditional_block
step1.component.ts
/* * Copyright (C) 2015 The Gravitee team (http://gravitee.io) * * 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 requi...
(certificate) { if (this.certificateTypes[certificate.id]) { return this.certificateTypes[certificate.id]; } return certificate.name; } }
displayName
identifier_name
regexp.js
writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; // MODULES // var reUncPath = requi...
* - `(` * - begin capture (7) (file name) * * - `(?:[0-9a-z]{1,255}){1}` * - capture but do not remember a sequence of 1 to 255 characters matching `` !#$%'()\+,\-\.0-9;=@A-Z\[\]^_`a-z{`` (8) * * - `(?:` * - begin capture but do not remember (9) * * - `\:(?=[\u0001-\u002E\u0030-\u0039\u003B-\u...
* - match a `\\` literal *
random_line_split
tx.rs
use std::collections::HashMap; use protobuf::Message; use crypto::{PublicKey, SecretKey, Signature, sign, verify_signature}; use ironcoin_pb::{Commitment, DetachedSignature, Transaction, Transfer}; use error::{IroncError, IroncResult}; pub trait TransactionExt { fn verify_signatures(&self) -> IroncResult<()>; } ...
, None => return Err(IroncError::new("Missing key.")) } } Ok(()) } } #[derive(Default)] pub struct TransactionBuilder { transfer_secret_keys: Vec<SecretKey>, bounty_secret_key: Option<SecretKey>, commit: Commitment } impl TransactionBuilder { pub fn new(...
{ let public_key = try!(PublicKey::from_slice(transfer.get_source_pk())); let signature = try!(Signature::from_slice(sign_bytes)); try!(verify_signature(&public_key, commit_bytes, &signature)); }
conditional_block
tx.rs
use std::collections::HashMap; use protobuf::Message; use crypto::{PublicKey, SecretKey, Signature, sign, verify_signature}; use ironcoin_pb::{Commitment, DetachedSignature, Transaction, Transfer}; use error::{IroncError, IroncResult}; pub trait TransactionExt { fn verify_signatures(&self) -> IroncResult<()>; } ...
( &mut self, sk: &SecretKey, source: &PublicKey, destination: &PublicKey, tokens: u64, op_index:u32) -> &mut Self { let mut transfer = Transfer::new(); transfer.set_op_index(op_index); transfer.set_tokens(tokens); transfer.mut_source_pk().push_all(&source.0); tran...
add_transfer
identifier_name
tx.rs
use std::collections::HashMap; use protobuf::Message; use crypto::{PublicKey, SecretKey, Signature, sign, verify_signature}; use ironcoin_pb::{Commitment, DetachedSignature, Transaction, Transfer}; use error::{IroncError, IroncResult}; pub trait TransactionExt { fn verify_signatures(&self) -> IroncResult<()>; } ...
pub fn add_transfer( &mut self, sk: &SecretKey, source: &PublicKey, destination: &PublicKey, tokens: u64, op_index:u32) -> &mut Self { let mut transfer = Transfer::new(); transfer.set_op_index(op_index); transfer.set_tokens(tokens); transfer.mut_source_pk().push_all...
{ TransactionBuilder { transfer_secret_keys: Vec::<SecretKey>::new(), bounty_secret_key: None, commit: Commitment::new() } }
identifier_body
tx.rs
use std::collections::HashMap; use protobuf::Message; use crypto::{PublicKey, SecretKey, Signature, sign, verify_signature}; use ironcoin_pb::{Commitment, DetachedSignature, Transaction, Transfer}; use error::{IroncError, IroncResult}; pub trait TransactionExt { fn verify_signatures(&self) -> IroncResult<()>; } ...
commit: Commitment } impl TransactionBuilder { pub fn new() -> TransactionBuilder { TransactionBuilder { transfer_secret_keys: Vec::<SecretKey>::new(), bounty_secret_key: None, commit: Commitment::new() } } pub fn add_transfer( &mut self, sk:...
#[derive(Default)] pub struct TransactionBuilder { transfer_secret_keys: Vec<SecretKey>, bounty_secret_key: Option<SecretKey>,
random_line_split
api.ts
/* istanbul ignore file - tricky to import some things from this module during testing */ // semantic version export { VERSION } from "./version" export { CstParser, EmbeddedActionsParser, ParserDefinitionErrorType, EMPTY_ALT } from "./parse/parser/parser" export { Lexer, LexerDefinitionErrorType } from "./s...
export { createSyntaxDiagramsCode } from "./diagrams/render_public" export class Parser { constructor() { throw new Error( "The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.\t\n" + "See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0" ) }...
{ console.warn( "The clearCache function was 'soft' removed from the Chevrotain API." + "\n\t It performs no action other than printing this message." + "\n\t Please avoid using it as it will be completely removed in the future" ) }
identifier_body
api.ts
/* istanbul ignore file - tricky to import some things from this module during testing */ // semantic version export { VERSION } from "./version" export { CstParser, EmbeddedActionsParser, ParserDefinitionErrorType, EMPTY_ALT } from "./parse/parser/parser" export { Lexer, LexerDefinitionErrorType } from "./s...
() { console.warn( "The clearCache function was 'soft' removed from the Chevrotain API." + "\n\t It performs no action other than printing this message." + "\n\t Please avoid using it as it will be completely removed in the future" ) } export { createSyntaxDiagramsCode } from "./diagrams/render_pub...
clearCache
identifier_name
api.ts
/* istanbul ignore file - tricky to import some things from this module during testing */ // semantic version export { VERSION } from "./version" export { CstParser, EmbeddedActionsParser, ParserDefinitionErrorType, EMPTY_ALT } from "./parse/parser/parser" export { Lexer, LexerDefinitionErrorType } from "./s...
export { GAstVisitor } from "./parse/grammar/gast/gast_visitor_public" /* istanbul ignore next */ export function clearCache() { console.warn( "The clearCache function was 'soft' removed from the Chevrotain API." + "\n\t It performs no action other than printing this message." + "\n\t Please avoid u...
random_line_split
ClAutoTopupInfoCommandSerializer.ts
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder"; import { PokerCommandHeaderSerializer } from "../../core/serializers/PokerCommandHeaderSerializer"; import { PokerCommandHeader } from "../../core/data/PokerCommandHeader"; import { ClAutoTopupInfoCommand } from "../commands/ClAutoTopupInfoComma...
}
PokerCommandHeaderSerializer.deserialize(buffer, command.header); command.data = new ClAutoTopupInfoData(); ClAutoTopupInfoDataSerializer.deserialize(buffer, command.data); }
random_line_split
ClAutoTopupInfoCommandSerializer.ts
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder"; import { PokerCommandHeaderSerializer } from "../../core/serializers/PokerCommandHeaderSerializer"; import { PokerCommandHeader } from "../../core/data/PokerCommandHeader"; import { ClAutoTopupInfoCommand } from "../commands/ClAutoTopupInfoComm...
{ public static serialize(buffer: ArrayBufferBuilder, command: ClAutoTopupInfoCommand ): void { buffer.pointer += PokerCommandHeader.HEADER_SIZE_BYTES; ClAutoTopupInfoDataSerializer.serialize(buffer, command.data); PokerCommandHeaderSerializer.serialize(buffer, command.header); } public static deserializ...
ClAutoTopupInfoCommandSerializer
identifier_name
mod.rs
mod asset; mod combat_screen; mod input; mod start_screen; mod teams_screen; mod text; mod types; use sdl2::render::Texture; pub use asset::*; pub use input::*; pub use text::*; pub use types::*; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render::WindowCanvas; use std::time::Instant; use crate::core::{...
fn update_scrolling(ui: UI, g: &Game, i: &Option<UserInput>) -> UI { let scrolling = ui.scrolling; let (_, _, w, h) = ui.viewport; UI { scrolling: match (scrolling, g, i) { (Some(sd), Game::Combat(..), None) => Some(sd), (None, Game::Combat(combat_data), _) => Some(Scroll...
{ if ui.frames == 50 { let time_for_50_frames = ui.last_check.elapsed().as_nanos(); UI { frames: 0, fps: 50_000_000_000 / time_for_50_frames, last_check: std::time::Instant::now(), ..ui } } else { UI { frames: ui.frames...
identifier_body
mod.rs
mod asset; mod combat_screen; mod input; mod start_screen; mod teams_screen; mod text; mod types; use sdl2::render::Texture; pub use asset::*; pub use input::*; pub use text::*; pub use types::*; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render::WindowCanvas; use std::time::Instant; use crate::core::{...
( cvs: &mut WindowCanvas, assets: &mut AssetRepo, scene: Scene, ) -> Result<(), String> { let (r, g, b) = scene.background; cvs.set_draw_color(Color::RGB(r, g, b)); cvs.clear(); for (tex_name, ScreenSprite(pos, align, sprite)) in scene.images { if let Some(ref mut t) = assets.textu...
draw_scene
identifier_name
mod.rs
mod asset; mod combat_screen; mod input; mod start_screen; mod teams_screen; mod text; mod types; use sdl2::render::Texture; pub use asset::*; pub use input::*; pub use text::*; pub use types::*; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render::WindowCanvas; use std::time::Instant; use crate::core::{...
); // let time_create_scene = Instant::now() - now; // let now = Instant::now(); draw_scene(cvs, assets, scene)?; // let time_draw_scene = Instant::now() - now; // cvs.present(); // println!("create scene: {}ms, draw scene {}ms", time_create_scene.as_millis(), time_draw_scene.as_millis());...
random_line_split
elitetorrent.py
# coding=utf-8 # Author: CristianBB # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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...
search_url = self.urls['search'] + '?' + urllib.parse.urlencode(self.search_params) logger.log(u"Search URL: %s" % search_url, logger.DEBUG) data = self.get_url(search_url, timeout=30) if not data: continue try: ...
search_string = re.sub(r'S0*(\d*)E(\d*)', r'\1x\2', search_string) self.search_params['buscar'] = search_string.strip() if mode != 'RSS' else ''
random_line_split
elitetorrent.py
# coding=utf-8 # Author: CristianBB # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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...
search_url = self.urls['search'] + '?' + urllib.parse.urlencode(self.search_params) logger.log(u"Search URL: %s" % search_url, logger.DEBUG) data = self.get_url(search_url, timeout=30) if not data: continue try: ...
results = [] lang_info = '' if not ep_obj or not ep_obj.show else ep_obj.show.lang for mode in search_strings: items = [] logger.log(u"Search Mode: %s" % mode, logger.DEBUG) # Only search if user conditions are true if self.onlyspasearch and lang_info !=...
identifier_body
elitetorrent.py
# coding=utf-8 # Author: CristianBB # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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...
(title): # Quality, if no literal is defined it's HDTV if 'calidad' not in title: title += ' HDTV x264' title = title.replace('(calidad baja)', 'HDTV x264') title = title.replace('(Buena calidad)', '720p HDTV x264') title = title.replace('(Alta calidad)', '720p HDTV...
_processTitle
identifier_name
elitetorrent.py
# coding=utf-8 # Author: CristianBB # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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...
if not torrent_rows: logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG) continue for row in torrent_rows[1:]: try: do...
torrent_rows = torrent_table.findAll('tr')
conditional_block
common.js
var loggedInUserInfo; function setupMenu() { jQuery.ajaxSetup({async:false}); $.get('/adoration/getLoggedInUserInfo', function(data) { loggedInUserInfo = data.loggedInUserInfo; if (loggedInUserInfo.isLoggedIn) { $("#loggedInUserLegend").text("Belépve: " + loggedInUserInfo.loggedInUs...
case "es": z = 'spanyol'; break; case "fr": z = 'francia'; break; case "ge": z = 'német'; break; default: z = '???'; } return z; } function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\....
case "hu": z = 'magyar'; break; case "en": z = 'angol'; break; case "it": z = 'olasz'; break;
random_line_split
common.js
var loggedInUserInfo; function setupMenu() { jQuery.ajaxSetup({async:false}); $.get('/adoration/getLoggedInUserInfo', function(data) { loggedInUserInfo = data.loggedInUserInfo; if (loggedInUserInfo.isLoggedIn) { $("#loggedInUserLegend").text("Belépve: " + loggedInUserInfo.loggedInUs...
cing confirm var confirmModal; var confirmSpan; var confirmAfterCloseFunctionOk; var confirmAfterCloseFunctionCancel; function showConfirm(title, message, afterCloseFunctionOk, afterCloseFunctionCancel) { $("#commonConfirmTitle").text(title); $("#commonConfirmBody").text(message); confirmModal = document.g...
rtModal.style.display="none"; if (typeof alertAfterCloseFunction != "undefined") { alertAfterCloseFunction(); } } //repla
identifier_body
common.js
var loggedInUserInfo; function setupMenu() { jQuery.ajaxSetup({async:false}); $.get('/adoration/getLoggedInUserInfo', function(data) { loggedInUserInfo = data.loggedInUserInfo; if (loggedInUserInfo.isLoggedIn) { $("#loggedInUserLegend").text("Belépve: " + loggedInUserInfo.loggedInUs...
confirmModal.style.display="none"; if (typeof confirmAfterCloseFunctionOk != "undefined") { confirmAfterCloseFunctionOk(); } } function reloadLocation() { location.reload(); }
rmOk() {
identifier_name
common.js
var loggedInUserInfo; function setupMenu() { jQuery.ajaxSetup({async:false}); $.get('/adoration/getLoggedInUserInfo', function(data) { loggedInUserInfo = data.loggedInUserInfo; if (loggedInUserInfo.isLoggedIn) { $("#loggedInUserLegend").text("Belépve: " + loggedInUserInfo.loggedInUs...
if (loggedInUserInfo.isAdoratorAdmin) { $("#nav-application-log").show(); } }); jQuery.ajaxSetup({async:true}); } function getReadableLanguageCode(code) { var z; switch (code) { case "hu": z = 'magyar'; break; case "en": z = 'angol'; break; case "it":...
$("#nav-ador-registration").show(); }
conditional_block
search.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Request, RequestOptions, Headers, URLSearchParams, RequestMethod } from '@angular/http'; import { Course } from '../../classes/course'; import { Observable } from "rxjs/Observable"; @Injectable() export class SearchService { private baseUrl: string;...
.map((res: Response) => res.json()) .map((courses) => courses.map((item) => new Course(item))); } }
requestOptions.search = urlParams; request = new Request(requestOptions); return this.http.request(request)
random_line_split
search.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Request, RequestOptions, Headers, URLSearchParams, RequestMethod } from '@angular/http'; import { Course } from '../../classes/course'; import { Observable } from "rxjs/Observable"; @Injectable() export class SearchService { private baseUrl: string;...
(query: string): Observable<Course[]> { let requestOptions = new RequestOptions(), request: Request, urlParams: URLSearchParams = new URLSearchParams(); urlParams.set('title_like', query); requestOptions.url = `${this.baseUrl}/courses`; requestOptions.method = RequestMethod.Get; requestOptions.search =...
search
identifier_name
curry.spec.ts
import { expect } from 'chai'; import { Curry } from './curry'; describe('curry', () => { it('should curry the method with default arity', () => { class
{ @Curry() add(a: any, b?: any) { return a + b; } } const myClass = new MyClass(); const add5 = myClass.add(5); expect(add5).to.be.an.instanceOf(Function); expect(add5(10)).to.equal(15); }); it('should curry the method with default arity (paramless)', () => { cl...
MyClass
identifier_name
curry.spec.ts
import { expect } from 'chai'; import { Curry } from './curry'; describe('curry', () => { it('should curry the method with default arity', () => { class MyClass { @Curry() add(a: any, b?: any) { return a + b; } } const myClass = new MyClass(); const add5 = myClass.add(5); ...
class MyClass { @Curry add(a: any, b?: any) { return a + b; } } const myClass = new MyClass(); const add5 = myClass.add(5); expect(add5).to.be.an.instanceOf(Function); expect(add5(10)).to.equal(15); }); it('should curry the method with fixed arity', () => { c...
random_line_split
curry.spec.ts
import { expect } from 'chai'; import { Curry } from './curry'; describe('curry', () => { it('should curry the method with default arity', () => { class MyClass { @Curry() add(a: any, b?: any) { return a + b; } } const myClass = new MyClass(); const add5 = myClass.add(5); ...
} const myClass = new MyClass(); const add5 = myClass.add(5); expect(add5).to.be.an.instanceOf(Function); expect(add5(10)).to.equal(15); }); it('should curry the method with fixed arity', () => { class MyClass { @Curry(2) add(a: any, b?: any, c?: any) { return a + b *...
{ return a + b; }
identifier_body
logHist.py
import matplotlib.pyplot as plt import numpy as np def logHist(X, N=30,fig=None, noclear=False, pdf=False, **kywds):
x = np.logspace(np.log10(np.min(X)),np.log10(np.max(X)),N+1) n,x = np.histogram(X,bins=x) n = n/float(X.size) plt.figure(fig) if not noclear: plt.clf() if pdf: n /= np.diff(x) x = x[:-1]+np.diff(x)/2 plt.semilogx(x,n,**kywds) else: plt.bar(x[:len(x)-1],n,wi...
''' Plot logarithmic histogram or probability density function from sampled data. Args: X (numpy.ndarray): 1-D array of sampled values N (Optional[int]): Number of bins (default 30) fig (Optional[int]): Figure number (default None) noclear (Optioanl[bool]): Clear figure (def...
identifier_body
logHist.py
import matplotlib.pyplot as plt import numpy as np def
(X, N=30,fig=None, noclear=False, pdf=False, **kywds): ''' Plot logarithmic histogram or probability density function from sampled data. Args: X (numpy.ndarray): 1-D array of sampled values N (Optional[int]): Number of bins (default 30) fig (Optional[int]): Figure number (defaul...
logHist
identifier_name
logHist.py
import matplotlib.pyplot as plt import numpy as np def logHist(X, N=30,fig=None, noclear=False, pdf=False, **kywds): ''' Plot logarithmic histogram or probability density function from sampled data. Args: X (numpy.ndarray): 1-D array of sampled values N (Optional[int]): Number of bins ...
x = x[:-1]+np.diff(x)/2 plt.semilogx(x,n,**kywds) else: plt.bar(x[:len(x)-1],n,width=np.diff(x),**kywds) a = plt.gca() a.set_xlim(10.**np.floor(np.log10(np.min(X))),10.**np.ceil(np.log10(np.max(X)))) a.set_xscale('log') plt.axis() return x,n
plt.figure(fig) if not noclear: plt.clf() if pdf: n /= np.diff(x)
random_line_split
logHist.py
import matplotlib.pyplot as plt import numpy as np def logHist(X, N=30,fig=None, noclear=False, pdf=False, **kywds): ''' Plot logarithmic histogram or probability density function from sampled data. Args: X (numpy.ndarray): 1-D array of sampled values N (Optional[int]): Number of bins ...
a = plt.gca() a.set_xlim(10.**np.floor(np.log10(np.min(X))),10.**np.ceil(np.log10(np.max(X)))) a.set_xscale('log') plt.axis() return x,n
plt.bar(x[:len(x)-1],n,width=np.diff(x),**kywds)
conditional_block
implore.es6.js
/** * 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 ...
let formatted = request.route; let name; let value; let regexp; for (name in request.params) { if (request.params.hasOwnProperty(name)) { value = request.params[name]; regexp = new RegExp(':' + name + '(?=(\\\/|$))'); formatted = formatted.replace(regexp, value); } } return formatted + (queryStrin...
function getURLFromRequest(request) { const queryString = makeQueryString(request.query || {});
random_line_split
implore.es6.js
/** * 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 ...
(obj, prefix='') { const str = []; let prop; let key; let value; for (prop in obj) { if (obj.hasOwnProperty(prop)) { key = prefix ? prefix + '[' + prop + ']' : prop; value = obj[prop]; str.push(typeof value === 'object' ? makeQueryString(value, key) : encodeURIComponent(key) + '=' + enc...
makeQueryString
identifier_name
implore.es6.js
/** * 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 ...
{ const str = []; let prop; let key; let value; for (prop in obj) { if (obj.hasOwnProperty(prop)) { key = prefix ? prefix + '[' + prop + ']' : prop; value = obj[prop]; str.push(typeof value === 'object' ? makeQueryString(value, key) : encodeURIComponent(key) + '=' + encodeURIComponent(v...
identifier_body
implore.es6.js
/** * 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 ...
else { xhr.send(); } } catch (err) { response.body = {}; response.status = 0; response.error = err; return resolve({ request, response }); } }); } implore.get = function get(options) { options.method = 'GET'; return implore(options); }; implore.post = function post(options)...
{ xhr.send(JSON.stringify(request.body)); }
conditional_block
index.js
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["items", "disabled", "className", "name", "error", "variant", "design", "label", "children", "size", "fontWeight", "paragraphStyle", "labelProps"], ...
}, labelProps, { className: classNames('k-Form-RadioButtonSet__label', labelProps.className) }), label), children && !label && /*#__PURE__*/React.createElement("legend", null, children), /*#__PURE__*/React.createElement("div", { className: "k-Form-RadioButtonSet__radioContainer" }, items.map(function (_re...
}, props), label && /*#__PURE__*/React.createElement(Label, _extends({ tag: "legend"
random_line_split
inner_test.py
# test rasl inner loop on simulated data # # pylint:disable=import-error from __future__ import division, print_function import numpy as np from rasl.inner import inner_ialm from rasl import (warp_image_gradient, EuclideanTransform, SimilarityTransform, AffineTransform, ProjectiveTransform) def setup...
(): inner_aligned(AffineTransform) def test_inner_aligned_projective(): inner_aligned(ProjectiveTransform) def inner_jittered(T, inset=10, rtol=1e-3, atol=0): """move a stack of jittered noisy images in the direction of aligned""" image0 = gauss_image() Image = [image0 + image_noise(image0, p=.05)...
test_inner_aligned_affine
identifier_name
inner_test.py
# test rasl inner loop on simulated data # # pylint:disable=import-error from __future__ import division, print_function import numpy as np from rasl.inner import inner_ialm from rasl import (warp_image_gradient, EuclideanTransform, SimilarityTransform, AffineTransform, ProjectiveTransform) def setup...
(np.random.random() * 2 - 1) * ds + 1.0, (np.random.random() * 2 - 1) * dx] for _ in range(N)] inner_jittered([AffineTransform(paramv=jitter) for jitter in Jitters]) def test_inner_jittered_projective(): # projective is a pain to test this way. the two projective ...
(np.random.random() * 2 - 1) * dx, (np.random.random() * 2 - 1) * dtheta,
random_line_split
inner_test.py
# test rasl inner loop on simulated data # # pylint:disable=import-error from __future__ import division, print_function import numpy as np from rasl.inner import inner_ialm from rasl import (warp_image_gradient, EuclideanTransform, SimilarityTransform, AffineTransform, ProjectiveTransform) def setup...
def test_inner_aligned_similarity(): inner_aligned(SimilarityTransform) def test_inner_aligned_euclidean(): inner_aligned(EuclideanTransform) def test_inner_aligned_affine(): inner_aligned(AffineTransform) def test_inner_aligned_projective(): inner_aligned(ProjectiveTransform) def inner_jittered(T...
"""don't mess (much) with a stack of aligned images""" N = 40 image0 = gauss_image() insetT = Ttype().inset(image0.shape, inset) Image = [image0 for _ in range(N)] TI, J = zip(*[warp_image_gradient(insetT, image, normalize=True) for image in Image]) _, _, dParamv = inner_ialm(T...
identifier_body
test_stdio.py
def processEnded(self, reason): self.onCompletion.callback(reason) class StandardInputOutputTests(unittest.TestCase): skip = skipWindowsNopywin32 def _spawnProcess(self, proto, sibling, *args, **kw): """ Launch a child Python process and communicate with it using the given ...
if value == howMany: connection.loseConnection() return connection.write(intToBytes(value)) break
conditional_block
test_stdio.py
WindowsNopywin32 = None if platform.isWindows(): if requireModule('win32process') is None: skipWindowsNopywin32 = ("On windows, spawnProcess is not available " "in the absence of win32process.") properEnv = dict(os.environ) properEnv["PYTHONPATH"] = os.pathsep.join(sy...
def processEnded(reason): self.assertEqual(p.data[1], b''.join(written)) self.assertFalse( toWrite, "Connection lost with %d writes left to go." % (len(toWrite),)) reason.trap(error.ProcessDone) return self._requireFailure(d, processEnd...
""" Verify that the transport of a protocol connected to L{StandardIO} is a working L{IProducer} provider. """ p = StandardIOTestProcessProtocol() d = p.onCompletion written = [] toWrite = list(range(100)) def connectionMade(ign): if toWrite:...
identifier_body
test_stdio.py
WindowsNopywin32 = None if platform.isWindows(): if requireModule('win32process') is None: skipWindowsNopywin32 = ("On windows, spawnProcess is not available " "in the absence of win32process.") properEnv = dict(os.environ) properEnv["PYTHONPATH"] = os.pathsep.join(sy...
(unittest.TestCase): skip = skipWindowsNopywin32 def _spawnProcess(self, proto, sibling, *args, **kw): """ Launch a child Python process and communicate with it using the given ProcessProtocol. @param proto: A L{ProcessProtocol} instance which will be connected to the ...
StandardInputOutputTests
identifier_name
test_stdio.py
WindowsNopywin32 = None if platform.isWindows(): if requireModule('win32process') is None: skipWindowsNopywin32 = ("On windows, spawnProcess is not available " "in the absence of win32process.") properEnv = dict(os.environ) properEnv["PYTHONPATH"] = os.pathsep.join(sy...
if toWrite: written.append(intToBytes(toWrite.pop()) + b"\n") proc.write(written[-1]) reactor.callLater(0.01, connectionMade, None) proc = self._spawnProcess(p, b'stdio_test_producer') p.onConnection.addCallback(connectionMade) def p...
written = [] toWrite = list(range(100)) def connectionMade(ign):
random_line_split
datastore.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
class DatastoreService(object): """ Class provides public methods for accessing datastore items. """ DATASTORE_NAME_SEPARATOR = DATASTORE_KEY_SEPARATOR def __init__(self, logger, pack_name, class_name, api_username): self._api_username = api_username self._pack_name = pack_name ...
from st2common.util.api import get_full_public_api_url from st2common.util.date import get_datetime_utc_now from st2common.constants.keyvalue import DATASTORE_KEY_SEPARATOR, SYSTEM_SCOPE
random_line_split
datastore.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
name = self._get_full_key_name(name=name, local=local) client = self._get_api_client() instance = KeyValuePair() instance.id = name instance.name = name self._logger.audit('Deleting value from the datastore (name=%s)', name) try: params = {'scope...
raise ValueError('Scope %s is unsupported.', scope)
conditional_block
datastore.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
################################## # Methods for datastore management ################################## def list_values(self, local=True, prefix=None): """ Retrieve all the datastores items. :param local: List values from a namespace local to this pack/class. Defaults to Tru...
self._api_username = api_username self._pack_name = pack_name self._class_name = class_name self._logger = logger self._client = None self._token_expire = get_datetime_utc_now()
identifier_body
datastore.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
(self, name): """ Retrieve a full key name which is local to the current pack/class. :param name: Base datastore key name. :type name: ``str`` :rtype: ``str`` """ prefix = self._get_datastore_key_prefix() full_name = prefix + self.DATASTORE_NAME_SEPARATO...
_get_key_name_with_prefix
identifier_name
machine_auth.py
# Copyright 2016 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Implements authentication based on LUCI machine tokens. LUCI machine tokens are short lived signed protobuf blobs that (among other informatio...
# Check the token was actually signed by the server. try: certs = signature.get_service_account_certificates(body.issued_by) is_valid_sig = certs.check_signature( blob=envelope.token_body, key_name=envelope.key_id, signature=envelope.rsa_sha256) if not is_valid_sig: log_e...
log_error(request, body, None, 'The token has expired') raise BadTokenError()
conditional_block
machine_auth.py
# Copyright 2016 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Implements authentication based on LUCI machine tokens. LUCI machine tokens are short lived signed protobuf blobs that (among other informatio...
(Exception): """Raised on transient errors. Supposed to trigger HTTP 500 response. """ def machine_authentication(request): """Implementation of the machine authentication. See components.auth.handler.AuthenticatingHandler.get_auth_methods for details of the expected interface. Args: request: web...
TransientError
identifier_name
machine_auth.py
# Copyright 2016 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Implements authentication based on LUCI machine tokens. LUCI machine tokens are short lived signed protobuf blobs that (among other informatio...
import base64 import logging from google.protobuf import message from components import utils from . import api from . import model from . import signature from .proto import machine_token_pb2 # Part of public API of 'auth' component, exposed by this module. __all__ = [ 'BadTokenError', 'TransientError', 'm...
* https://github.com/luci/luci-go/tree/main/appengine/cmd/tokenserver * https://github.com/luci/luci-go/tree/main/client/cmd/luci_machine_tokend * https://github.com/luci/luci-go/tree/main/server/auth/machine """
random_line_split
machine_auth.py
# Copyright 2016 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Implements authentication based on LUCI machine tokens. LUCI machine tokens are short lived signed protobuf blobs that (among other informatio...
return None, None # Deserialize both envelope and the body. try: token = b64_decode(token) except TypeError as exc: log_error(request, None, exc, 'Failed to decode base64') raise BadTokenError() try: envelope = machine_token_pb2.MachineTokenEnvelope() envelope.MergeFromString(token) ...
"""Implementation of the machine authentication. See components.auth.handler.AuthenticatingHandler.get_auth_methods for details of the expected interface. Args: request: webapp2.Request with the incoming request. Returns: (auth.Identity, None) with machine ID ("bot:<fqdn>") on success or (None, N...
identifier_body
app.module.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
AppModule = __decorate([ core_1.NgModule({ imports: [platform_browser_1.BrowserModule, forms_1.FormsModule], declarations: [app_component_1.AppComponent, person_detail_component_1.PersonDetailComponent], bootstrap: [app_component_1.AppComponent] }), __me...
{ }
identifier_body
app.module.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
var core_1 = require('@angular/core'); var platform_browser_1 = require('@angular/platform-browser'); var forms_1 = require('@angular/forms'); var app_component_1 = require('./app.component'); var person_detail_component_1 = require('./person-detail.component'); var AppModule = (function () { function AppModule() {...
};
random_line_split
app.module.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
() { } AppModule = __decorate([ core_1.NgModule({ imports: [platform_browser_1.BrowserModule, forms_1.FormsModule], declarations: [app_component_1.AppComponent, person_detail_component_1.PersonDetailComponent], bootstrap: [app_component_1.AppComponent] }), ...
AppModule
identifier_name
script.js
const Slider = require('./hooters/slider.js'); window.SETTINGS.addDomScanListener(function ($scanContainer) { window.SETTINGS.initElement($scanContainer, '[data-slider]', function() { var options = { stagePadding: 330, margin: 0, items: 1, loop: true, smartSpeed: 450, fluidSpeed: 450, dragEn...
}; new Slider(this, options); }); window.SETTINGS.initElement($scanContainer, '[data-slider-linked]', function() { var $slider = this.find('.owl-carousel'); var $thumbs = this.find('.thumbs'); var animation = $slider.data('animation-style') ? $slider.data('animation-style') : false; console.log(ani...
dots: true, dotsContainer: '.bullet-nav', dotsContainerTemplate: '.bullet-nav-template'
random_line_split
scraper.py
""" Original python command-line scraper for UNSW lecture times. Unused in the webapp. """ import re import sys from collections import Counter import requests SEMESTER = "15s2" BASE_URL = "http://www.cse.unsw.edu.au/~teachadmin/lecture_times/" + SEMESTER DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday...
if __name__ == '__main__': main()
if len(sys.argv) <= 1: exit("Usage: python lectures.py COMP1917 COMP1921 COMP1927 ...") lectures = get_lectures(sys.argv[1:]) total = total_count(lectures) ordered_count = sorted(total.items(), key=lambda item: (DAYS.index(item[0][0]), int(item[0][1].split(':')[0]))) print("\n".join(["{} {}: {}"...
identifier_body
scraper.py
""" Original python command-line scraper for UNSW lecture times. Unused in the webapp. """ import re import sys from collections import Counter import requests SEMESTER = "15s2" BASE_URL = "http://www.cse.unsw.edu.au/~teachadmin/lecture_times/" + SEMESTER DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday...
count.update(subject_count) return dict(count) def main(): if len(sys.argv) <= 1: exit("Usage: python lectures.py COMP1917 COMP1921 COMP1927 ...") lectures = get_lectures(sys.argv[1:]) total = total_count(lectures) ordered_count = sorted(total.items(), key=lambda item: (DAYS.index(...
count = Counter() for subject in lectures.values(): subject_count = {dayTime: sum([count[1] for count in subjectList]) for dayTime, subjectList in subject.items()}
random_line_split
scraper.py
""" Original python command-line scraper for UNSW lecture times. Unused in the webapp. """ import re import sys from collections import Counter import requests SEMESTER = "15s2" BASE_URL = "http://www.cse.unsw.edu.au/~teachadmin/lecture_times/" + SEMESTER DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday...
(course_category): index = requests.get('{}/{}'.format(BASE_URL, course_category)) subpages = re.findall(r'A HREF="(.*?\.html)"', index.text) return ['{}/{}'.format(course_category, subpage) for subpage in subpages] def get_lectures(user_courses): courses = [] for arg in user_courses: if l...
get_courses
identifier_name
scraper.py
""" Original python command-line scraper for UNSW lecture times. Unused in the webapp. """ import re import sys from collections import Counter import requests SEMESTER = "15s2" BASE_URL = "http://www.cse.unsw.edu.au/~teachadmin/lecture_times/" + SEMESTER DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday...
table_texts = {} for course in courses: print(course) response = requests.get('{}/{}'.format(BASE_URL, course)) if response.status_code == 200: table_match = re.search(r'<table border=1.*?>(.*?)</table>', response.text, re.DOTALL) table_texts[course] = table_mat...
print("Invalid argument: {}".format(arg))
conditional_block
backgroundjobs.js
/** * ownCloud * * @author Jakob Sack * @copyright 2012 Jakob Sack owncloud@jakobsack.de * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or an...
$.get( OC.webroot+'/cron.php' ); });
random_line_split
server.js
ui: true, ws: true } }; //Command line interface var args = process.argv.slice(2); for (var i = 0; i < args.length; i++) { switch (args[i]) { case "--help": help(); process.exit(0); break; case "--list": return listSerialPorts(); case "-p": case "--port": ...
function startUdpSocket(config) { try { var listen = require('./lib/udp.js'); config.host = "0.0.0.0"; listen(config); } catch (e) { console.error(e.message); process.exit(1); } } function startTcpSocket(config) { try { var listen = require('./lib/tcp.js'); listen(config); } ...
{ console.log("Serial ports:"); SerialPort.list(function (err, ports) { if (err) { console.error(err); process.exit(2); } ports.forEach(function(port) { console.log(" " + port.comName); }); process.exit(0); }); }
identifier_body
server.js
ui: true, ws: true } };
//Command line interface var args = process.argv.slice(2); for (var i = 0; i < args.length; i++) { switch (args[i]) { case "--help": help(); process.exit(0); break; case "--list": return listSerialPorts(); case "-p": case "--port": config.port = parseInt(args[+...
random_line_split
server.js
ports = args[++i]; if (!ports) { console.error("Expected serial port names after --allow-ports"); process.exit(2); } config.permissions.allowedPorts = ports.split(","); break; case "--config": var ssp = args[++i]; ssp = ssp.split(","); config.options...
startEcho
identifier_name
server.js
ui: true, ws: true } }; //Command line interface var args = process.argv.slice(2); for (var i = 0; i < args.length; i++) { switch (args[i]) { case "--help": help(); process.exit(0); break; case "--list": return listSerialPorts(); case "-p": case "--port": ...
res.render("index"); }); //API status and version app.get(config.prefix, function(req, res, next) { var pkg = require('./package.json'); res.json({ name: pkg.name, version: pkg.version, uptime: app.uptime() }); }); //Register REST API var webserver = require('./lib/webserver.js'); var subap...
{ return next(new Error("No web interface permissions!")); }
conditional_block
streams.test.ts
import { jsonStream } from "../streams"; import highland from "highland"; import jsonFormat from "json-format"; test('jsonStream', async () => { const template = { test1: "%var1%", test2: { one: "one", two: "%var2%", three: "three" }, test3: "%var3%", test4: "%var4%", test5: "%var5%", test6: "%...
test6: "async", test7: "bla" })); });
test3: 'asdf', test4: "bla", test5: "promise",
random_line_split
nations.py
#!/usr/bin/env python3 # This file is part of OpenSoccerManager-Editor. # # OpenSoccerManager 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 # option) any la...
self.set_border_width(5) Nations.search = uigtk.search.Search(data.nations.get_nations) Nations.search.treeview.connect("row-activated", self.on_row_activated) Nations.search.treeselection.connect("changed", self.on_treeselection_changed) self.attach(Nations.search, 0, 0, 1, 1) ...
def __init__(self): uigtk.widgets.Grid.__init__(self)
random_line_split
nations.py
#!/usr/bin/env python3 # This file is part of OpenSoccerManager-Editor. # # OpenSoccerManager 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 # option) any la...
(self): Nations.search.liststore.clear() for nationid, nation in data.nations.get_nations(): Nations.search.liststore.append([nationid, nation.name]) Nations.search.activate_first_item() class NationEdit(uigtk.widgets.Grid): def __init__(self): uigtk.widgets.Grid.__in...
populate_data
identifier_name
nations.py
#!/usr/bin/env python3 # This file is part of OpenSoccerManager-Editor. # # OpenSoccerManager 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 # option) any la...
else: self.delete_nation(nationid) def delete_nation(self, nationid): ''' Remove nation from working data and repopulate list. ''' data.nations.remove_nation(nationid) self.populate_data() def on_row_activated(self, treeview, treepath, tree...
nation = data.nations.get_nation_by_id(nationid) dialog = uigtk.dialogs.RemoveItem("Nation", nation.name) if dialog.show(): self.delete_nation(nationid)
conditional_block
nations.py
#!/usr/bin/env python3 # This file is part of OpenSoccerManager-Editor. # # OpenSoccerManager 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 # option) any la...
self.actionbuttons = uigtk.interface.ActionButtons() self.actionbuttons.buttonUpdate.connect("clicked", self.on_update_clicked) self.attach(self.actionbuttons, 0, 1, 1, 1) def on_update_clicked(self, *args): ''' Update current values into working data. ''' na...
def __init__(self): uigtk.widgets.Grid.__init__(self) grid = uigtk.widgets.Grid() grid.set_hexpand(True) grid.set_vexpand(True) self.attach(grid, 0, 0, 1, 1) label = uigtk.widgets.Label("_Name", leftalign=True) grid.attach(label, 0, 0, 1, 1) self.entryNa...
identifier_body
createTestEnvQuery.graphql.ts
/* tslint:disable */ /* eslint-disable */ import { ConcreteRequest } from "relay-runtime"; import { FragmentRefs } from "relay-runtime"; export type createTestEnvQueryVariables = {}; export type createTestEnvQueryResponse = { readonly artwork: { readonly " $fragmentRefs": FragmentRefs<"createTestEnv_artwor...
"storageKey": "artwork(id:\"unused\")" } ] }, "params": { "id": null, "metadata": {}, "name": "createTestEnvQuery", "operationKind": "query", "text": "query createTestEnvQuery {\n artwork(id: \"unused\") {\n ...createTestEnv_artwork\n id\n }\n}\n\nfragment createTestEnv...
], "storageKey": null }, (v1/*: any*/) ],
random_line_split
label.rs
use std::fmt::{Write, self}; use std::iter; use std::str; #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Label { bits: u8, // amount of bits in tail (last element of vec). always between 0 and 7 buffer: Vec<u8> // backing buffer } impl Label { /** * Small layout intermezzo * A lab...
(&mut self) -> Option<bool> { if self.bits == 0 { if self.buffer.len() > 1 { self.buffer.pop(); self.bits = 8; } else { return None; } } let len = self.buffer.len(); let tail = &mut self.buffer[len - 1];...
pop
identifier_name
label.rs
use std::fmt::{Write, self}; use std::iter; use std::str; #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Label { bits: u8, // amount of bits in tail (last element of vec). always between 0 and 7 buffer: Vec<u8> // backing buffer } impl Label { /** * Small layout intermezzo * A lab...
pub fn len(&self) -> usize { let len = self.buffer.len(); if len == 0 { return 0; } return len * 8 - 8 + self.bits as usize } pub fn push(&mut self, val: bool) { if self.buffer.len() == 0 { self.buffer.push(0) } self.bits +=...
{ Label {bits: 0, buffer: Vec::new()} }
identifier_body
label.rs
use std::fmt::{Write, self}; use std::iter; use std::str; #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Label { bits: u8, // amount of bits in tail (last element of vec). always between 0 and 7 buffer: Vec<u8> // backing buffer } impl Label { /** * Small layout intermezzo * A lab...
*tail ^= val; self.bits -= 1; return Some(val != 0); } } impl fmt::Display for Label { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let len = self.buffer.len(); if self.bits == 0 && len > 0 { if self.buffer[..len - 1].iter().all(|c| match *c { ...
let val: u8 = *tail & (1 << (8 - self.bits));
random_line_split