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
notestoreid.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the ...
impl NoteStoreId for StoreId { fn is_note_id(&self) -> bool { self.is_in_collection(&["notes"]) } }
pub trait NoteStoreId { fn is_note_id(&self) -> bool; }
random_line_split
gssapi.py
# # (C) Copyright 2008 Jelmer Vernooij <jelmer@samba.org> # (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License Version # 2.1 as published by the Free Software Foundation. # # This p...
if self.step == 0: ret = kerberos.authGSSClientStep(self._gss, base64.b64encode(challenge)) if ret != kerberos.AUTH_GSS_CONTINUE: self.step = 1 elif self.step == 1: ret = kerberos.authGSSClientUnwrap(self...
"""Provides client-side GSSAPI SASL (Kerberos 5) authentication.""" def __init__(self, password_manager): ClientAuthenticator.__init__(self, password_manager) self.password_manager = password_manager self.username = None self._gss = None self.step = None self.authzid...
identifier_body
gssapi.py
# # (C) Copyright 2008 Jelmer Vernooij <jelmer@samba.org> # (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License Version
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # "...
# 2.1 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of
random_line_split
gssapi.py
# # (C) Copyright 2008 Jelmer Vernooij <jelmer@samba.org> # (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License Version # 2.1 as published by the Free Software Foundation. # # This p...
(self, username, authzid): self.username = username self.authzid = authzid _unused, self._gss = kerberos.authGSSClientInit(authzid or "{0}@{1}".format("xmpp", self.password_manager.get_serv_host())) self.step = 0 retur...
start
identifier_name
gssapi.py
# # (C) Copyright 2008 Jelmer Vernooij <jelmer@samba.org> # (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License Version # 2.1 as published by the Free Software Foundation. # # This p...
else: return Response(base64.b64decode(response)) def finish(self, data): self.username = kerberos.authGSSClientUserName(self._gss) logger.debug("Authenticated as {0!r}".format( kerberos.authGSSClientUserName(self._gss))) return Succe...
return Response("")
conditional_block
relationship-new.component.ts
import { Component, OnInit } from '@angular/core'; import { Location } from '@angular/common'; import { MatDialog, MatDialogRef, MatSnackBar } from '@angular/material'; import { Router, ActivatedRoute } from '@angular/router'; import { BaseStixComponent } from '../../../base-stix.component'; import { StixService } from...
} ); } public onSelectedSourceChange(): void { this.stixService.url = 'cti-stix-store-api/' + this.selectedSource; super.load().subscribe( (data) => { this.selectedSources = data as any[]; } ); } public onSelectedTarg...
{ subscription.unsubscribe(); }
conditional_block
relationship-new.component.ts
import { Component, OnInit } from '@angular/core'; import { Location } from '@angular/common'; import { MatDialog, MatDialogRef, MatSnackBar } from '@angular/material'; import { Router, ActivatedRoute } from '@angular/router'; import { BaseStixComponent } from '../../../base-stix.component'; import { StixService } from...
( public stixService: StixService, public route: ActivatedRoute, public router: Router, public dialog: MatDialog, public location: Location, public snackBar: MatSnackBar) { super(stixService, route, router, dialog, location, snackBar); } public ngOnInit(...
constructor
identifier_name
relationship-new.component.ts
import { Component, OnInit } from '@angular/core'; import { Location } from '@angular/common';
import { StixService } from '../../../stix.service'; import { Relationship } from '../../../../models'; @Component({ selector: 'relationship-new', templateUrl: './relationship-new.component.html' }) export class RelationshipNewComponent extends BaseStixComponent implements OnInit { public relationship: Relatio...
import { MatDialog, MatDialogRef, MatSnackBar } from '@angular/material'; import { Router, ActivatedRoute } from '@angular/router'; import { BaseStixComponent } from '../../../base-stix.component';
random_line_split
text.rs
// #[cfg(all(test, has_display))] // use crate::*; // use crate::tests; // use std::env; // use std::path; /* TODO; the font API has changed and I don't want to deal with it now #[test] fn test_calculated_text_width() { let ctx = &mut make_context(); let font = graphics::Font::default(); let text = "Hell...
let width3 = font.width(text3); let width4 = font.width(text4); assert_eq!(width1, width2); assert_eq!(width2, width3); assert_eq!(width3, width4); } */
let width1 = font.width(text1); let width2 = font.width(text2);
random_line_split
skill_data.py
# Copyright 2018 Mycroft AI Inc. # # 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 writin...
def to_alnum(skill_id): """Convert a skill id to only alphanumeric characters Non alpha-numeric characters are converted to "_" Args: skill_id (str): identifier to be converted Returns: (str) String of letters """ return ''.join(c if c.isalnum() else '_' for c in str(skill_...
"""Load regex from all files in the specified directory. Args: basedir (str): path of directory to load from bus (messagebus emitter): messagebus instance used to send the vocab to the intent service skill_id (str): skill identifier """ for path, _,...
identifier_body
skill_data.py
# Copyright 2018 Mycroft AI Inc. # # 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 writin...
(basedir, bus, skill_id): """Load vocabulary from all files in the specified directory. Args: basedir (str): path of directory to load from (will recurse) bus (messagebus emitter): messagebus instance used to send the vocab to the intent service skill_i...
load_vocabulary
identifier_name
skill_data.py
# Copyright 2018 Mycroft AI Inc. # # 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 writin...
""" for path, _, files in walk(basedir): for f in files: if f.endswith(".rx"): load_regex_from_file(join(path, f), bus, skill_id) def to_alnum(skill_id): """Convert a skill id to only alphanumeric characters Non alpha-numeric characters are converted to "_" A...
Args: basedir (str): path of directory to load from bus (messagebus emitter): messagebus instance used to send the vocab to the intent service skill_id (str): skill identifier
random_line_split
skill_data.py
# Copyright 2018 Mycroft AI Inc. # # 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 writin...
parts = line.strip().split("|") entity = parts[0] bus.emit(Message("register_vocab", { 'start': entity, 'end': vocab_type })) for alias in parts[1:]: bus.emit(Message("register_vocab", { ...
continue
conditional_block
settings.component.js
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 = Reflect.decorate(d...
(settingsService, dataService) { this.settingsService = settingsService; this.dataService = dataService; // Do stuff } SettingsComponent.prototype.save = function () { this.settingsService.save(); this.dataService.getParameterNames(); }; return SettingsComponent; ...
SettingsComponent
identifier_name
settings.component.js
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 = Reflect.decorate(d...
this.dataService = dataService; // Do stuff } SettingsComponent.prototype.save = function () { this.settingsService.save(); this.dataService.getParameterNames(); }; return SettingsComponent; }()); SettingsComponent = __decorate([ Component({ selector: 'my-home...
this.settingsService = settingsService;
random_line_split
settings.component.js
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 = Reflect.decorate(d...
SettingsComponent.prototype.save = function () { this.settingsService.save(); this.dataService.getParameterNames(); }; return SettingsComponent; }()); SettingsComponent = __decorate([ Component({ selector: 'my-home', templateUrl: 'settings.component.html', styleU...
{ this.settingsService = settingsService; this.dataService = dataService; // Do stuff }
identifier_body
whiteframe.js
/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-rc4-master-4aa7160 */ goog.provide('ng.material.components.whiteframe'); goog.require('ng.material.core'); /** * @ngdoc module * @name material.components.whiteframe */ angular .module('material.components.whiteframe',...
elevation = DEFAULT_DP; } element.addClass('md-whiteframe-' + elevation + 'dp'); } } MdWhiteframeDirective.$inject = ["$log"]; ng.material.components.whiteframe = angular.module("material.components.whiteframe");
var elevation = parseInt(attr.mdWhiteframe, 10) || DEFAULT_DP; if (elevation > MAX_DP || elevation < MIN_DP) { $log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]);
random_line_split
whiteframe.js
/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-rc4-master-4aa7160 */ goog.provide('ng.material.components.whiteframe'); goog.require('ng.material.core'); /** * @ngdoc module * @name material.components.whiteframe */ angular .module('material.components.whiteframe',...
(scope, element, attr) { var elevation = parseInt(attr.mdWhiteframe, 10) || DEFAULT_DP; if (elevation > MAX_DP || elevation < MIN_DP) { $log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]); elevation = DEFAULT_DP; } e...
postLink
identifier_name
whiteframe.js
/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-rc4-master-4aa7160 */ goog.provide('ng.material.components.whiteframe'); goog.require('ng.material.core'); /** * @ngdoc module * @name material.components.whiteframe */ angular .module('material.components.whiteframe',...
element.addClass('md-whiteframe-' + elevation + 'dp'); } } MdWhiteframeDirective.$inject = ["$log"]; ng.material.components.whiteframe = angular.module("material.components.whiteframe");
{ $log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]); elevation = DEFAULT_DP; }
conditional_block
whiteframe.js
/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-rc4-master-4aa7160 */ goog.provide('ng.material.components.whiteframe'); goog.require('ng.material.core'); /** * @ngdoc module * @name material.components.whiteframe */ angular .module('material.components.whiteframe',...
MdWhiteframeDirective.$inject = ["$log"]; ng.material.components.whiteframe = angular.module("material.components.whiteframe");
{ var MIN_DP = 1; var MAX_DP = 24; var DEFAULT_DP = 4; return { link: postLink }; function postLink(scope, element, attr) { var elevation = parseInt(attr.mdWhiteframe, 10) || DEFAULT_DP; if (elevation > MAX_DP || elevation < MIN_DP) { $log.warn('md-whiteframe attribute value is invalid....
identifier_body
gaussian_mutation.rs
/// Performs gaussian mutation on solution parameters /// /// Performs gaussian mutation on real-valued solution parameters, /// currently hard-coded for 30 problem variables for the ZDT1 /// synthetic test function. extern crate rand; use rand::{random, thread_rng, Rng}; // bounds hard-coded for ZDT1 i.e. (0,1) pub f...
{ let std = 1_f32 - 0_f32 / 10_f32; for parameter in &mut parameters[..] { if random::<f32>() <= mutation_rate { let mutation = thread_rng().gen_range(-1.0f32, 1.0f32) * std; *parameter = *parameter + mutation; // Enforce bounds *parameter = f32::max(*par...
identifier_body
gaussian_mutation.rs
/// Performs gaussian mutation on solution parameters /// /// Performs gaussian mutation on real-valued solution parameters, /// currently hard-coded for 30 problem variables for the ZDT1 /// synthetic test function. extern crate rand; use rand::{random, thread_rng, Rng}; // bounds hard-coded for ZDT1 i.e. (0,1) pub f...
(mut parameters: [f32; 30], mutation_rate: f32) -> [f32; 30] { let std = 1_f32 - 0_f32 / 10_f32; for parameter in &mut parameters[..] { if random::<f32>() <= mutation_rate { let mutation = thread_rng().gen_range(-1.0f32, 1.0f32) * std; *parameter = *parameter + mutation; ...
gaussian_mutation
identifier_name
gaussian_mutation.rs
/// Performs gaussian mutation on solution parameters /// /// Performs gaussian mutation on real-valued solution parameters, /// currently hard-coded for 30 problem variables for the ZDT1 /// synthetic test function. extern crate rand; use rand::{random, thread_rng, Rng}; // bounds hard-coded for ZDT1 i.e. (0,1) pub f...
return parameters; }
*parameter = f32::min(*parameter, 1_f32); } }
random_line_split
gaussian_mutation.rs
/// Performs gaussian mutation on solution parameters /// /// Performs gaussian mutation on real-valued solution parameters, /// currently hard-coded for 30 problem variables for the ZDT1 /// synthetic test function. extern crate rand; use rand::{random, thread_rng, Rng}; // bounds hard-coded for ZDT1 i.e. (0,1) pub f...
} return parameters; }
{ let mutation = thread_rng().gen_range(-1.0f32, 1.0f32) * std; *parameter = *parameter + mutation; // Enforce bounds *parameter = f32::max(*parameter, 0_f32); *parameter = f32::min(*parameter, 1_f32); }
conditional_block
test_exceptions.py
# -*- coding: utf-8 -*- """ werkzeug.exceptiosn test ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD license. """ from nose.tools import assert_raises from werkzeug import exceptions from werkzeug.exceptions import Aborter, abort from wer...
myabort = Aborter(extra={1: exceptions.NotFound}) assert_raises(exceptions.NotFound, myabort, 404) assert_raises(exceptions.NotFound, myabort, 1) def test_exception_repr(): """Repr and unicode of exceptions""" exc = exceptions.NotFound() assert unicode(exc) == '404: Not Found' assert repr...
assert_raises(LookupError, myabort, 404) assert_raises(exceptions.NotFound, myabort, 1)
random_line_split
test_exceptions.py
# -*- coding: utf-8 -*- """ werkzeug.exceptiosn test ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD license. """ from nose.tools import assert_raises from werkzeug import exceptions from werkzeug.exceptions import Aborter, abort from wer...
(): """Repr and unicode of exceptions""" exc = exceptions.NotFound() assert unicode(exc) == '404: Not Found' assert repr(exc) == "<NotFound '404: Not Found'>" exc = exceptions.NotFound('Not There') assert unicode(exc) == '404: Not There' assert repr(exc) == "<NotFound '404: Not There'>" d...
test_exception_repr
identifier_name
test_exceptions.py
# -*- coding: utf-8 -*- """ werkzeug.exceptiosn test ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD license. """ from nose.tools import assert_raises from werkzeug import exceptions from werkzeug.exceptions import Aborter, abort from wer...
def test_special_exceptions(): """Special HTTP exceptions""" exc = exceptions.MethodNotAllowed(['GET', 'HEAD', 'POST']) h = dict(exc.get_headers({})) assert h['Allow'] == 'GET, HEAD, POST' assert 'The method DELETE is not allowed' in exc.get_description({ 'REQUEST_METHOD': 'DELETE' })...
"""Repr and unicode of exceptions""" exc = exceptions.NotFound() assert unicode(exc) == '404: Not Found' assert repr(exc) == "<NotFound '404: Not Found'>" exc = exceptions.NotFound('Not There') assert unicode(exc) == '404: Not There' assert repr(exc) == "<NotFound '404: Not There'>"
identifier_body
test_exceptions.py
# -*- coding: utf-8 -*- """ werkzeug.exceptiosn test ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD license. """ from nose.tools import assert_raises from werkzeug import exceptions from werkzeug.exceptions import Aborter, abort from wer...
assert resp is orig_resp assert resp.data == 'Hello World' def test_aborter(): """Exception aborter""" assert_raises(exceptions.BadRequest, abort, 400) assert_raises(exceptions.Unauthorized, abort, 401) assert_raises(exceptions.Forbidden, abort, 403) assert_raises(exceptions.NotFound, abo...
assert False, 'exception not raised'
conditional_block
exon_utils_tests.py
"""Testing for overlap intervals """ import unittest from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \ collapseIntervals class TestOverlapFunctions(unittest.TestCase): def setUp(self): # Simple Overlap self.simple = [(1,10), (6,15)] # One interval enclosed ...
unittest.main()
conditional_block
exon_utils_tests.py
"""Testing for overlap intervals """ import unittest from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \ collapseIntervals class TestOverlapFunctions(unittest.TestCase): def setUp(self): # Simple Overlap
def test_bpOverlap(self): # Make sure overlaps are calculated correctly self.assertEqual(calcOverlap(self.simple), 4) self.assertEqual(calcOverlap(self.enclosed), 40) self.assertEqual(calcOverlap(self.partial),400) def test_collideIntervals(self): self.assertEqual(coll...
self.simple = [(1,10), (6,15)] # One interval enclosed in another self.enclosed = [(100,200), (110,150)] # Partial overlap self.partial = [(150,300), (160,300), (170,330)] # No overlap self.no = [(150,300), (10,30)] # Equal self.equal = [(1,15), (1,5)] ...
identifier_body
exon_utils_tests.py
"""Testing for overlap intervals """ import unittest from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \ collapseIntervals class
(unittest.TestCase): def setUp(self): # Simple Overlap self.simple = [(1,10), (6,15)] # One interval enclosed in another self.enclosed = [(100,200), (110,150)] # Partial overlap self.partial = [(150,300), (160,300), (170,330)] # No overlap self.no = [...
TestOverlapFunctions
identifier_name
exon_utils_tests.py
"""Testing for overlap intervals """ import unittest from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \ collapseIntervals class TestOverlapFunctions(unittest.TestCase): def setUp(self): # Simple Overlap self.simple = [(1,10), (6,15)] # One interval enclosed i...
def test_bpOverlap(self): # Make sure overlaps are calculated correctly self.assertEqual(calcOverlap(self.simple), 4) self.assertEqual(calcOverlap(self.enclosed), 40) self.assertEqual(calcOverlap(self.partial),400) def test_collideIntervals(self): self.assertEqual(colli...
random_line_split
test_engine.py
""" Unit tests for ``wheezy.templates.engine.Engine``. """ import unittest class EngineTestCase(unittest.TestCase): """ Test the ``Engine``. """ def setUp(self): from wheezy.template.engine import Engine from wheezy.template.loader import DictLoader self.engine = Engine( ...
""" self.engine.remove('x') def test_remove_name(self): """ Invalidate name that is known to engine. """ self.engine.templates['x'] = 'x' self.engine.renders['x'] = 'x' self.engine.modules['x'] = 'x' self.engine.remove('x')
""" Invalidate name that is not known to engine.
random_line_split
test_engine.py
""" Unit tests for ``wheezy.templates.engine.Engine``. """ import unittest class EngineTestCase(unittest.TestCase): """ Test the ``Engine``. """ def setUp(self): from wheezy.template.engine import Engine from wheezy.template.loader import DictLoader self.engine = Engine( ...
def test_remove_name(self): """ Invalidate name that is known to engine. """ self.engine.templates['x'] = 'x' self.engine.renders['x'] = 'x' self.engine.modules['x'] = 'x' self.engine.remove('x')
""" Invalidate name that is not known to engine. """ self.engine.remove('x')
identifier_body
test_engine.py
""" Unit tests for ``wheezy.templates.engine.Engine``. """ import unittest class
(unittest.TestCase): """ Test the ``Engine``. """ def setUp(self): from wheezy.template.engine import Engine from wheezy.template.loader import DictLoader self.engine = Engine( loader=DictLoader(templates={}), extensions=[]) def test_template_not_found(s...
EngineTestCase
identifier_name
privacy-ns1.rs
// Copyright 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-MIT or ...
; pub fn Bar() { } } fn test_glob2() { use foo2::*; let _x: Box<Bar>; //~ ERROR use of undeclared type name `Bar` } // neither public pub mod foo3 { trait Bar { } pub struct Baz; fn Bar() { } } fn test_glob3() { use foo3::*; Bar(); //~ ERROR unresolved name `Bar` let _x:...
Baz
identifier_name
privacy-ns1.rs
// Copyright 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-MIT or ...
} fn test_glob2() { use foo2::*; let _x: Box<Bar>; //~ ERROR use of undeclared type name `Bar` } // neither public pub mod foo3 { trait Bar { } pub struct Baz; fn Bar() { } } fn test_glob3() { use foo3::*; Bar(); //~ ERROR unresolved name `Bar` let _x: Box<Bar>; //~ ERROR ...
{ }
identifier_body
privacy-ns1.rs
// http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accordin...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
random_line_split
observe.js
/** * Method to set dom events * * @example * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, ...
else { element.detachEvent("on" + eventName, handlerWrapper); } } } }; };
{ element.removeEventListener(eventName, handler, false); }
conditional_block
observe.js
/** * Method to set dom events * * @example * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, ...
}; event.stopPropagation = event.stopPropagation || function() { this.cancelBubble = true; }; handler.call(element, event); }; element.attachEvent("on" + eventName, handlerWrapper); } } return { stop: function() { var eventName, i ...
random_line_split
Operator1.ts
module L { export class Operator1 extends LogicElement { constructor( private operation: string, // string reprasenting given operation, like -, + etc. public log_operand: LogicElement, private hadSideEffects: boolean ) { super(); this...
xtends Operator1 { getJSONName() { return 'Print' } constructor(a: E.Element = null) { super(Print, 'print', false, a, true); } } export class Scan extends Operator1 { getJSONName() { return 'Scan' } constructor(a: E.Element = null) { super(Scan, ...
int e
identifier_name
Operator1.ts
module L { export class Operator1 extends LogicElement { constructor( private operation: string, // string reprasenting given operation, like -, + etc. public log_operand: LogicElement, private hadSideEffects: boolean ) { super(); this...
} getCopy(): Element { return new this.elemType( this.c_operand.getContentCopy()).copyMetadata(this); } } /////////////// Operators //////////////////// export class Increment extends Operator1 { getJSONName() { return 'Increment' } const...
this.hadSideEffects ); logic.setObserver(this); return logic;
random_line_split
text.rs
Number(l) => font_size.scale_by(l.0), LineHeight::Length(l) => Au::from(l) } } fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragment>) { if fragments.is_empty() { return } let new_fragment = { let first_fragment = fragments.front_mut().unwrap(); ...
a == b || !is_specific(a) || !is_specific(b) } /
identifier_body
text.rs
(&mut self, font_context: &mut FontContext, out_fragments: &mut Vec<Fragment>, paragraph_bytes_processed: &mut usize, bidi_levels: Option<&[bidi::Level]>, mut last_whitespace: bool, ...
flush_clump_to_list
identifier_name
text.rs
) if mapping.old_fragment_index == logical_offset => {} Some(_) | None => { if is_first_mapping_of_this_old_fragment { // There were no mappings for this unscanned fragment. Transfer its // flags to the previous/next sib...
old_fragment_index: fragment_index,
random_line_split
production.js
'use strict'; module.exports = { db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/friend-around', assets: { lib: { css: [ 'public/lib/bootstrap/dist/css/bootstrap.min.css', 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css', ], js: [ 'public/lib/angular/angu...
linkedin: { clientID: process.env.LINKEDIN_ID || 'APP_ID', clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/linkedin/callback' } };
},
random_line_split
cookies.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Laurent Bachelier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your o...
def _cookies_from_attrs_set(self, attrs_set, request): for tup in self._normalized_cookie_tuples(attrs_set): cookie = self._cookie_from_cookie_tuple(tup, request) if cookie: yield cookie def make_cookies(self, response, request): """Return sequence of C...
""" Export all cookies to a file, regardless of expiration, etc. """ cj = requests.cookies.merge_cookies(cookielib.LWPCookieJar(), self) cj.save(filename, ignore_discard=True, ignore_expires=True)
identifier_body
cookies.py
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Laurent Bachelier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version...
random_line_split
cookies.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Laurent Bachelier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your o...
(self, filename): """ Export all cookies to a file, regardless of expiration, etc. """ cj = requests.cookies.merge_cookies(cookielib.LWPCookieJar(), self) cj.save(filename, ignore_discard=True, ignore_expires=True) def _cookies_from_attrs_set(self, attrs_set, request): ...
export
identifier_name
cookies.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Laurent Bachelier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your o...
if rfc2965: for cookie in self._cookies_from_attrs_set(cookielib.split_header_words(rfc2965_hdrs), request): yield cookie def copy(self): new_cj = type(self)() new_cj.update(self) return new_cj
for cookie in self._cookies_from_attrs_set(cookielib.parse_ns_headers(ns_hdrs), request): self._process_rfc2109_cookies([cookie]) yield cookie
conditional_block
Component.js
import React from 'react'; import PropTypes from 'prop-types'; import SPELLS from 'common/SPELLS'; import SpellLink from 'common/SpellLink'; import Checklist from 'parser/shared/modules/features/Checklist'; import Rule from 'parser/shared/modules/features/Checklist/Rule'; import Requirement from 'parser/shared/modules...
{...props} /> ); AbilityRequirement.propTypes = { spell: PropTypes.number.isRequired, }; return ( <Checklist> <Rule name="Use core abilities and offensive cooldowns as often as possible" description={( <> Spells such as <SpellLink id={SPELLS.COLOSSU...
random_line_split
StyleFormats.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { Toggling } from '@ephox/alloy'; import { Arr, Fun, Id, Merge...
export { register, ui };
};
random_line_split
StyleFormats.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { Toggling } from '@ephox/alloy'; import { Arr, Fun, Id, Merge...
else if (Obj.hasNonNullableKey(item, 'format')) { return enrichSupported(item); } else { return enrichCustom(item); } }); return doEnrich(Settings.getStyleFormats(editor)); }; const prune = (editor: Editor, formats) => { const doPrune = (items) => Arr.bind(items, (item) => { if (item.i...
{ const newItems = doEnrich(item.items); return Merger.deepMerge( enrichMenu(item), { items: newItems } ); }
conditional_block
google-books.spec.ts
import { TestBed, inject } from '@angular/core/testing'; import { Http, BaseRequestOptions, Response, ResponseOptions, RequestMethod } from '@angular/http'; import { MockBackend, MockConnection } from '@angular/http/testing'; import { GoogleBooksService } from './google-books'; describe('Service: GoogleBooks', () => {...
beforeEach(inject([GoogleBooksService, MockBackend], (googleBooksService: GoogleBooksService, mockBackend: MockBackend) => { service = googleBooksService; backend = mockBackend; })); let data = { "title": "Book Title", "author": "John Smith", "volumeId": "12345" }; let books = { item...
random_line_split
input.rs
#![allow(unused_variables)] /// Motion directions pub enum Direction { North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, } /// Commands /// /// They can be generated by a user input, or as the consequences of /// some other actions. pub enum Command { // List of...
(&self, key: char) { unimplemented!(); } }
process_help
identifier_name
input.rs
#![allow(unused_variables)] /// Motion directions pub enum Direction { North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, } /// Commands /// /// They can be generated by a user input, or as the consequences of /// some other actions. pub enum Command { // List of...
self.mode = new_mode; } pub fn process_key(&self, key: char) { match self.mode { InputMode::Normal => self.process_normal(key), InputMode::Explore => self.process_explore(key), InputMode::Menu => self.process_menu(key), InputMode::YesOrNo => self....
random_line_split
input.rs
#![allow(unused_variables)] /// Motion directions pub enum Direction { North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, } /// Commands /// /// They can be generated by a user input, or as the consequences of /// some other actions. pub enum Command { // List of...
fn process_menu(&self, key: char) { unimplemented!(); } fn process_yesorno(&self, key: char) { unimplemented!(); } fn process_help(&self, key: char) { unimplemented!(); } }
{ unimplemented!(); }
identifier_body
document.ts
import 'css.escape' import { createFootnote, FootnoteElements } from './footnote' import { bindScrollHandler } from './scroll' import { Adapter } from '../core' import { addClass, removeClass, unmount } from './element' export const CLASS_CONTENT = 'littlefoot__content' export const CLASS_WRAPPER = 'littlefoot__wrappe...
anchorPattern, buttonTemplate, contentTemplate, footnoteSelector, numberResetSelector, scope, }: HTMLAdapterSettings): Adapter<HTMLElement> { const footnoteElements = findFootnoteLinks(document, anchorPattern, scope) .map( findReference( document, allowDuplicates, anchorP...
export function setup({ allowDuplicates, anchorParentSelector,
random_line_split
document.ts
import 'css.escape' import { createFootnote, FootnoteElements } from './footnote' import { bindScrollHandler } from './scroll' import { Adapter } from '../core' import { addClass, removeClass, unmount } from './element' export const CLASS_CONTENT = 'littlefoot__content' export const CLASS_WRAPPER = 'littlefoot__wrappe...
(reference: HTMLElement, host: HTMLElement): void { reference.insertAdjacentElement('beforebegin', host) } export function setup({ allowDuplicates, anchorParentSelector, anchorPattern, buttonTemplate, contentTemplate, footnoteSelector, numberResetSelector, scope, }: HTMLAdapterSettings): Adapter<HTML...
attachFootnote
identifier_name
document.ts
import 'css.escape' import { createFootnote, FootnoteElements } from './footnote' import { bindScrollHandler } from './scroll' import { Adapter } from '../core' import { addClass, removeClass, unmount } from './element' export const CLASS_CONTENT = 'littlefoot__content' export const CLASS_WRAPPER = 'littlefoot__wrappe...
} } function recursiveHideFootnoteContainer(element: HTMLElement): void { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const container = element.parentElement! const visibleElements = children(container, `:not(.${CLASS_PRINT_ONLY})`) const visibleSeparators = visibleElements.filter((...
{ processed.push(body) const reference = link.closest<HTMLElement>(anchorParentSelector) || link const referenceId = reference.id || link.id return { reference, referenceId, body } }
conditional_block
document.ts
import 'css.escape' import { createFootnote, FootnoteElements } from './footnote' import { bindScrollHandler } from './scroll' import { Adapter } from '../core' import { addClass, removeClass, unmount } from './element' export const CLASS_CONTENT = 'littlefoot__content' export const CLASS_WRAPPER = 'littlefoot__wrappe...
function isDefined<T>(value?: T): value is T { return value !== undefined } function findFootnoteLinks( document: Document, pattern: RegExp, scope: string ): readonly HTMLAnchorElement[] { return queryAll<HTMLAnchorElement>(document, scope + ' a[href*="#"]').filter( (link) => (link.href + link.rel).mat...
{ return Array.from(element.children).filter( (child) => child.nodeType !== 8 && child.matches(selector) ) }
identifier_body
mailbox.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::fsm::{Fsm, FsmScheduler, FsmState}; use crossbeam::channel::{SendError, TrySendError}; use std::borrow::Cow; use std::sync::Arc; use tikv_util::mpsc; /// A basic mailbox. /// /// Every mailbox should have one and only one owner, who will re...
(&self) -> BasicMailbox<Owner> { BasicMailbox { sender: self.sender.clone(), state: self.state.clone(), } } } /// A more high level mailbox. pub struct Mailbox<Owner, Scheduler> where Owner: Fsm, Scheduler: FsmScheduler<Fsm = Owner>, { mailbox: BasicMailbox<Owner...
clone
identifier_name
mailbox.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::fsm::{Fsm, FsmScheduler, FsmState}; use crossbeam::channel::{SendError, TrySendError}; use std::borrow::Cow; use std::sync::Arc; use tikv_util::mpsc; /// A basic mailbox. /// /// Every mailbox should have one and only one owner, who will re...
pub(crate) fn release(&self, fsm: Box<Owner>) { self.state.release(fsm) } pub(crate) fn take_fsm(&self) -> Option<Box<Owner>> { self.state.take_fsm() } #[inline] pub fn len(&self) -> usize { self.sender.len() } #[inline] pub fn is_empty(&self) -> bool { ...
{ self.sender.is_sender_connected() }
identifier_body
mailbox.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::fsm::{Fsm, FsmScheduler, FsmState}; use crossbeam::channel::{SendError, TrySendError}; use std::borrow::Cow; use std::sync::Arc; use tikv_util::mpsc; /// A basic mailbox. /// /// Every mailbox should have one and only one owner, who will re...
#[inline] pub fn force_send(&self, msg: Owner::Message) -> Result<(), SendError<Owner::Message>> { self.mailbox.force_send(msg, &self.scheduler) } /// Try to send a message. #[inline] pub fn try_send(&self, msg: Owner::Message) -> Result<(), TrySendError<Owner::Message>> { self....
pub fn new(mailbox: BasicMailbox<Owner>, scheduler: Scheduler) -> Mailbox<Owner, Scheduler> { Mailbox { mailbox, scheduler } } /// Force sending a message despite channel capacity limit.
random_line_split
0034_service_account_token.py
import django.db.models.deletion import oauthlib.common from django.db import migrations, models def move_existing_token(apps, schema_editor): ServiceAccount = apps.get_model("account", "ServiceAccount") for service_account in ServiceAccount.objects.iterator():
class Migration(migrations.Migration): dependencies = [("account", "0033_serviceaccount")] operations = [ migrations.CreateModel( name="ServiceAccountToken", fields=[ ( "id", models.AutoField( au...
service_account.tokens.create( name="Default", auth_token=service_account.auth_token )
conditional_block
0034_service_account_token.py
import django.db.models.deletion import oauthlib.common from django.db import migrations, models def move_existing_token(apps, schema_editor): ServiceAccount = apps.get_model("account", "ServiceAccount")
class Migration(migrations.Migration): dependencies = [("account", "0033_serviceaccount")] operations = [ migrations.CreateModel( name="ServiceAccountToken", fields=[ ( "id", models.AutoField( aut...
for service_account in ServiceAccount.objects.iterator(): service_account.tokens.create( name="Default", auth_token=service_account.auth_token )
random_line_split
0034_service_account_token.py
import django.db.models.deletion import oauthlib.common from django.db import migrations, models def move_existing_token(apps, schema_editor): ServiceAccount = apps.get_model("account", "ServiceAccount") for service_account in ServiceAccount.objects.iterator(): service_account.tokens.create( ...
(migrations.Migration): dependencies = [("account", "0033_serviceaccount")] operations = [ migrations.CreateModel( name="ServiceAccountToken", fields=[ ( "id", models.AutoField( auto_created=True, ...
Migration
identifier_name
0034_service_account_token.py
import django.db.models.deletion import oauthlib.common from django.db import migrations, models def move_existing_token(apps, schema_editor):
class Migration(migrations.Migration): dependencies = [("account", "0033_serviceaccount")] operations = [ migrations.CreateModel( name="ServiceAccountToken", fields=[ ( "id", models.AutoField( au...
ServiceAccount = apps.get_model("account", "ServiceAccount") for service_account in ServiceAccount.objects.iterator(): service_account.tokens.create( name="Default", auth_token=service_account.auth_token )
identifier_body
globals.js
// Mucking with different levels let currentLevel = { cells: undefined, dims: undefined }; if (0) { currentLevel.cells = level; currentLevel.dims = level_dims; } else
// Return a reference to the (logical) cell's unique object const _getCellReference = (i, j, k = 1) => { if (i < 0 || j < 0) { return undefined; } if (i >= currentLevel.dims.i || j >= currentLevel.dims.j) { return undefined; } return currentLevel.cells[i + j * (currentLevel.dims.j)]; }; /** * The drawin...
{ currentLevel.cells = LEVEL_ONE; currentLevel.dims = LEVEL_ONE_DIMS; }
conditional_block
globals.js
// Mucking with different levels let currentLevel = { cells: undefined, dims: undefined }; if (0) { currentLevel.cells = level; currentLevel.dims = level_dims; } else { currentLevel.cells = LEVEL_ONE; currentLevel.dims = LEVEL_ONE_DIMS; } // Return a reference to the (logical) cell's unique object const _getCellR...
w: { f: 'w', b: 'e', r: 'n', l: 's' } }; // JavaScript divmod is boned const divMod = (n, d) => { return n - d * Math.floor(n / d); }; // Give an [i, j] coordinate and wrap it if exceeds grid dimensions const gridWrap = (i, j) => { return [divMod(i, grid.i), divMod(j, grid.j)]; };
const XLATE_UCS2PARTY = { n: { f: 'n', b: 's', r: 'e', l: 'w' }, s: { f: 's', b: 'n', r: 'w', l: 'e' }, e: { f: 'e', b: 'w', r: 's', l: 'n' },
random_line_split
media.dev.js
var findPosts; (function($){ findPosts = { open : function(af_name, af_val) { var st = document.documentElement.scrollTop || $(document).scrollTop(); if ( af_name && af_val ) { $('#affected').attr('name', af_name).val(af_val); } $('#find-posts').show().draggable({ handle: '#find-post...
r = r.responses[0]; $('#find-posts-response').html(r.data); }, error : function(r) { var er = r.statusText; if ( r.responseText ) { er = r.responseText.replace( /<.[^<>]*?>/g, '' ); } if ( er ) { $('#find-posts-response').html(er); } } }; $(document).ready(funct...
{ this.error({'responseText': wpAjax.broken}); }
conditional_block
media.dev.js
var findPosts; (function($){ findPosts = { open : function(af_name, af_val) { var st = document.documentElement.scrollTop || $(document).scrollTop(); if ( af_name && af_val ) { $('#affected').attr('name', af_name).val(af_val); } $('#find-posts').show().draggable({ handle: '#find-posts-...
} r = r.responses[0]; $('#find-posts-response').html(r.data); }, error : function(r) { var er = r.statusText; if ( r.responseText ) { er = r.responseText.replace( /<.[^<>]*?>/g, '' ); } if ( er ) { $('#find-posts-response').html(er); } } }; $(document).ready(f...
random_line_split
DF2004.py
for ele in allSa] StdSaLS = [ele[i] for ele in allbTSa] log_m = np.average(SaLS,weights = w) log_s = np.sqrt(np.sum(w*(np.power((SaLS-log_m),2)+np.power(StdSaLS,2)))) logmeans.append(log_m) logstddev.append(log_s) fragility_model = {'damage_states': None, 'logmean': None, '...
(T, Gamma, EDPlim, ISDvec, RDvec, SPO, bUthd, mc, r, g, Tc, Td, MC): #------------------------------------------------------------------------------ # INPUT # Cy : base shear coefficient at yield (presently covered by Gamma and dry) # Cy = Say/g = Vy/W, where Say=Sa @ yield, Vy = base shear @ yiel...
DFfragility
identifier_name
DF2004.py
] for ele in allSa] StdSaLS = [ele[i] for ele in allbTSa] log_m = np.average(SaLS,weights = w) log_s = np.sqrt(np.sum(w*(np.power((SaLS-log_m),2)+np.power(StdSaLS,2)))) logmeans.append(log_m) logstddev.append(log_s) fragility_model = {'damage_states': None, 'logmean': None, ...
fragility_model['logmean'] = logmeans fragility_model['logstddev'] = logstddev fragility_model['IMT'] = 'Sa('+str(Tav)+')' return fragility_model def DFfragility(T, Gamma, EDPlim, ISDvec, RDvec, SPO, bUthd, mc, r, g, Tc, Td, MC): #------------------------------------------------------------------...
'IMT': None} fragility_model['damage_states'] = damage_model['damage_states']
random_line_split
DF2004.py
for ele in allSa] StdSaLS = [ele[i] for ele in allbTSa] log_m = np.average(SaLS,weights = w) log_s = np.sqrt(np.sum(w*(np.power((SaLS-log_m),2)+np.power(StdSaLS,2)))) logmeans.append(log_m) logstddev.append(log_s) fragility_model = {'damage_states': None, 'logmean': None, '...
if r<0.25: print 'Warning: rp should be higher than 0.25, but let us proceed' if mc<1: print 'Error: mc should be higher than 1' os._exit(1) if mc>2.5: print 'warning: mc should be lower than 2.5, but let us proceed' # Relationship between EDP and RD defined by pushover...
print 'Error: rp should be less than 1' os._exit(1)
conditional_block
DF2004.py
SPO.insert(3,SPO[1]) SPO.insert(-1,SPO[-1]) SPO.insert(-1,SPO[-1]) [ISDvec, Sdvec] = sdof_utils.from_ISD_to_Sd(capacity_curves,icc) RDvec = Sdvec*Gamma [mc,a,ac,r,mf] = get_spo2ida_parameters(SPO, T, Gamma) # Convert MDoF into SDoF [SaT50,bTSa] = DFf...
Tc, Td = corner_periods allSa, allbTSa, allLR50, allbLR = [],[],[],[] no_capacity_curves = len(capacity_curves['Vb']) g = 9.81 w = capacity_curves['weights'] Tav = capacity_curves['mean_period'] for icc in range(0,no_capacity_curves): # Derive median Sa value (median of Sa) of capac...
identifier_body
resultmodulation.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors # # This file is part of Alignak. # # Alignak is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
class Resultmodulations(Items): """Resultmodulations class allowed to handle easily several CheckModulation objects """ name_property = "resultmodulation_name" inner_class = Resultmodulation def linkify(self, timeperiods): """Wrapper for linkify_rm_by_tp Replace check_period by r...
elf.exit_code_modulation = None
conditional_block
resultmodulation.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors # # This file is part of Alignak. # # Alignak is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
def linkify_rm_by_tp(self, timeperiods): """Replace check_period by real Timeperiod object into each Resultmodulation :param timeperiods: timeperiods to link to :type timeperiods: alignak.objects.timeperiod.Timeperiods :return: None """ for resultmod in self: ...
""Wrapper for linkify_rm_by_tp Replace check_period by real Timeperiod object into each Resultmodulation :param timeperiods: timeperiods to link to :type timeperiods: alignak.objects.timeperiod.Timeperiods :return: None """ self.linkify_rm_by_tp(timeperiods)
identifier_body
resultmodulation.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors # # This file is part of Alignak. # # Alignak is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
# Try to change the exit code only if a new one is defined if self.exit_code_modulation is not None: # First with the exit_code_match if return_code in self.exit_codes_match: return_code = self.exit_code_modulation return return_code ...
:rtype: int """ # Only if in modulation_period of modulation_period == None if self.modulation_period is None or self.modulation_period.is_time_valid(time.time()):
random_line_split
resultmodulation.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors # # This file is part of Alignak. # # Alignak is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
self, return_code): """Module the exit code if necessary :: * modulation_period is legit * exit_code_modulation * return_code in exit_codes_match :param return_code: actual code returned by the check :type return_code: int :return: return_code modulated if neces...
odule_return(
identifier_name
gdal_ds.rs
{ path: self.path.clone(), geom_transform: BTreeMap::new(), } } fn detect_layers(&self, _detect_geometry_types: bool) -> Vec<Layer> { let mut layers: Vec<Layer> = Vec::new(); let dataset = Dataset::open(Path::new(&self.path)).unwrap(); for gdal_layer in d...
(&self, layer: &Layer, grid_srid: i32) -> Option<Extent> { let dataset = Dataset::open(Path::new(&self.path)).unwrap(); let layer_name = layer.table_name.as_ref().unwrap(); let ogr_layer = dataset.layer_by_name(layer_name).unwrap(); let extent = match ogr_layer.get_extent() { ...
layer_extent
identifier_name
gdal_ds.rs
: {:?}", e); return None; } Ok(sref) => sref, }; let layer_sref = geom_spatialref(&ogr_layer, layer.geometry_field.as_ref()); let src_sref = match layer_sref { Some(ref sref) if !layer.no_transform => sref, _ => &grid_sref, ...
{ let xs = &mut [extent.minx, extent.maxx]; let ys = &mut [extent.miny, extent.maxy]; transformation.transform_coords(xs, ys, &mut [0.0, 0.0])?; Ok(Extent { minx: *xs.get(0).unwrap(), miny: *ys.get(0).unwrap(), maxx: *xs.get(1).unwrap(), maxy: *ys.get(1).unwrap(), }) ...
identifier_body
gdal_ds.rs
ource { path: self.path.clone(), geom_transform: BTreeMap::new(), } } fn detect_layers(&self, _detect_geometry_types: bool) -> Vec<Layer> { let mut layers: Vec<Layer> = Vec::new(); let dataset = Dataset::open(Path::new(&self.path)).unwrap(); for gdal_layer...
} if layer.simplify { if layer.geometry_type != Some("POINT".to_string()) { warn!( "Layer '{}': Simplification not supported for GDAL layers", layer.name ); } } if layer.buffer_size.is_some()...
} } else { warn!("Layer '{}': Couldn't detect spatialref", layer.name); }
random_line_split
gdal_ds.rs
{ path: self.path.clone(), geom_transform: BTreeMap::new(), } } fn detect_layers(&self, _detect_geometry_types: bool) -> Vec<Layer> { let mut layers: Vec<Layer> = Vec::new(); let dataset = Dataset::open(Path::new(&self.path)).unwrap(); for gdal_layer in d...
} if layer.simplify { if layer.geometry_type != Some("POINT".to_string()) { warn!( "Layer '{}': Simplification not supported for GDAL layers", layer.name ); } } if layer.buffer_size.is_some(...
{ warn!("Layer '{}': Couldn't detect spatialref", layer.name); }
conditional_block
media_reference_models.js
hqDefine("hqmedia/js/media_reference_models", [
'knockout', 'underscore', 'hqwebapp/js/assert_properties', 'hqmedia/js/hqmediauploaders', 'hqwebapp/js/initial_page_data', ], function ( $, ko, _, assertProperties, mediaUploaders, initialPageData ) { var HQMediaUploaders = mediaUploaders.get(); function BaseMediaRef...
'jquery',
random_line_split
media_reference_models.js
hqDefine("hqmedia/js/media_reference_models", [ 'jquery', 'knockout', 'underscore', 'hqwebapp/js/assert_properties', 'hqmedia/js/hqmediauploaders', 'hqwebapp/js/initial_page_data', ], function ( $, ko, _, assertProperties, mediaUploaders, initialPageData ) { var HQMed...
AudioReference.prototype = Object.create(BaseMediaReference.prototype); AudioReference.prototype.constructor = AudioReference; function VideoReference(ref) { 'use strict'; var self = {}; self = BaseMediaReference(ref); self.upload_controller = HQMediaUploaders['hqvideo']; ...
{ 'use strict'; var self = {}; self = BaseMediaReference(ref); self.upload_controller = HQMediaUploaders['hqaudio']; self.preview_template = "audio-preview-template"; return self; }
identifier_body
media_reference_models.js
hqDefine("hqmedia/js/media_reference_models", [ 'jquery', 'knockout', 'underscore', 'hqwebapp/js/assert_properties', 'hqmedia/js/hqmediauploaders', 'hqwebapp/js/initial_page_data', ], function ( $, ko, _, assertProperties, mediaUploaders, initialPageData ) { var HQMed...
(ref) { 'use strict'; var self = {}; self.media_class = ref.media_class; self.media_type = ref.media_type; self.module = ref.module; self.form = ref.form; self.is_menu_media = ref.is_menu_media; self.path = ref.path; self.type_icon = ref.icon_clas...
BaseMediaReference
identifier_name
media_reference_models.js
hqDefine("hqmedia/js/media_reference_models", [ 'jquery', 'knockout', 'underscore', 'hqwebapp/js/assert_properties', 'hqmedia/js/hqmediauploaders', 'hqwebapp/js/initial_page_data', ], function ( $, ko, _, assertProperties, mediaUploaders, initialPageData ) { var HQMed...
else if (self.module.unique_id) { self.app_url = initialPageData.reverse("view_module", self.module.unique_id); } self.preview_template = null; // override // for searching self.query = ko.observable(); self.searching = ko.observable(0); self.searched = ko....
{ self.app_url = initialPageData.reverse("form_source", self.form.unique_id); }
conditional_block
enum-headings.rs
#![crate_name = "foo"] // @has foo/enum.Token.html /// A token! /// # First /// Some following text...
// @has - '//h4[@id="variant-first"]' "Variant-First" Declaration { /// A version! /// # Variant-Field-First /// Some following text... // @has - '//h5[@id="variant-field-first"]' "Variant-Field-First" version: String, }, /// A Zoople! /// # Variant-First ...
// @has - '//h2[@id="first"]' "First" pub enum Token { /// A declaration! /// # Variant-First /// Some following text...
random_line_split
enum-headings.rs
#![crate_name = "foo"] // @has foo/enum.Token.html /// A token! /// # First /// Some following text... // @has - '//h2[@id="first"]' "First" pub enum
{ /// A declaration! /// # Variant-First /// Some following text... // @has - '//h4[@id="variant-first"]' "Variant-First" Declaration { /// A version! /// # Variant-Field-First /// Some following text... // @has - '//h5[@id="variant-field-first"]' "Variant-Field-Firs...
Token
identifier_name
union_dtor_1_0.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>); impl<T> __BindgenUnionField<T> { #[inline] pub fn new() -> Self { __BindgenUni...
} impl<T> ::std::cmp::Eq for __BindgenUnionField<T> {} #[repr(C)] #[derive(Debug, Default)] pub struct UnionWithDtor { pub mFoo: __BindgenUnionField<::std::os::raw::c_int>, pub mBar: __BindgenUnionField<*mut ::std::os::raw::c_void>, pub bindgen_union_field: u64, } #[test] fn bindgen_test_layout_UnionWithDt...
{ true }
identifier_body
union_dtor_1_0.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>); impl<T> __BindgenUnionField<T> { #[inline] pub fn new() -> Self { __BindgenUni...
pub fn UnionWithDtor_UnionWithDtor_destructor(this: *mut UnionWithDtor); } impl UnionWithDtor { #[inline] pub unsafe fn destruct(&mut self) { UnionWithDtor_UnionWithDtor_destructor(self) } }
) ); } extern "C" { #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"]
random_line_split
union_dtor_1_0.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>); impl<T> __BindgenUnionField<T> { #[inline] pub fn new() -> Self { __BindgenUni...
(&mut self) { UnionWithDtor_UnionWithDtor_destructor(self) } }
destruct
identifier_name
barebone_blink.rs
//! Flash the BeagleBone USR1 LED 5 times at 2Hz. //! //! The PRU code notifies the host processor every time the LED is flashed by triggering Evtout0. //! The 6-th event out is interpreted as a completion notification. extern crate prusst; use prusst::{Pruss, IntcConfig, Evtout, Sysevt}; use std::fs::File; use std...
let irq = pruss.intc.register_irq(Evtout::E0); // Open and load the PRU binary. let mut pru_binary = File::open("examples/barebone_blink_pru0.bin").unwrap(); // Temporarily take control of the LED. echo("none", LED_TRIGGER_PATH); // Run the PRU binary. unsafe { pruss.pru0.load_code(&m...
{ // Get a view of the PRU subsystem. let mut pruss = match Pruss::new(&IntcConfig::new_populated()) { Ok(p) => p, Err(e) => match e { prusst::Error::AlreadyInstantiated => panic!("You can't instantiate more than one `Pruss` object at a time."), prusst::Er...
identifier_body
barebone_blink.rs
//! Flash the BeagleBone USR1 LED 5 times at 2Hz. //! //! The PRU code notifies the host processor every time the LED is flashed by triggering Evtout0. //! The 6-th event out is interpreted as a completion notification. extern crate prusst; use prusst::{Pruss, IntcConfig, Evtout, Sysevt}; use std::fs::File; use std...
Ok(p) => p, Err(e) => match e { prusst::Error::AlreadyInstantiated => panic!("You can't instantiate more than one `Pruss` object at a time."), prusst::Error::PermissionDenied => panic!("You do not have permission to access the PRU subsystem: \ ...
fn main() { // Get a view of the PRU subsystem. let mut pruss = match Pruss::new(&IntcConfig::new_populated()) {
random_line_split
barebone_blink.rs
//! Flash the BeagleBone USR1 LED 5 times at 2Hz. //! //! The PRU code notifies the host processor every time the LED is flashed by triggering Evtout0. //! The 6-th event out is interpreted as a completion notification. extern crate prusst; use prusst::{Pruss, IntcConfig, Evtout, Sysevt}; use std::fs::File; use std...
() { // Get a view of the PRU subsystem. let mut pruss = match Pruss::new(&IntcConfig::new_populated()) { Ok(p) => p, Err(e) => match e { prusst::Error::AlreadyInstantiated => panic!("You can't instantiate more than one `Pruss` object at a time."), prusst:...
main
identifier_name
mongos.js
var mongoose = require('mongoose'), Schema = mongoose.Schema; var log = require("../log"); var red_util = require("../util"); var bcrypt; try { bcrypt = require('bcrypt'); } catch (e) { bcrypt = require('bcryptjs'); } var settings; var NodeSchema = new Schema({ key: String, version: Number, deplo...
nodeModel: mongoose.model('Nodes', NodeSchema), credentialModel: mongoose.model('Credentials', CredentialSchema), settingModel: mongoose.model('Settings', SettingSchema), libraryModel:mongoose.model('Library', LibrarySchema) }; module.exports = mongos;
log.info("connected successfully to DB => " + settings.storage.ivr_mongo.database + ":" + _host + ":" + _port); }); } },
random_line_split
mongos.js
var mongoose = require('mongoose'), Schema = mongoose.Schema; var log = require("../log"); var red_util = require("../util"); var bcrypt; try { bcrypt = require('bcrypt'); } catch (e) { bcrypt = require('bcryptjs'); } var settings; var NodeSchema = new Schema({ key: String, version: Number, deplo...
}, nodeModel: mongoose.model('Nodes', NodeSchema), credentialModel: mongoose.model('Credentials', CredentialSchema), settingModel: mongoose.model('Settings', SettingSchema), libraryModel:mongoose.model('Library', LibrarySchema) }; module.exports = mongos;
{ var uri = "mongodb://" + _host + "/" + settings.storage.ivr_mongo.database; var options = { db: { native_parser: true }, server: { poolSize: 5 }, user: settings.storage.ivr_m...
conditional_block
insert-module-globals-tests.ts
import insert = require('insert-module-globals'); import { VarsOption } from 'insert-module-globals'; function example() { function inserter(file: string) { return insert(file, { basedir: __dirname + '/files' }); } return inserter; } function insert_custom_globals() { const customProcessConte...
}); return insert('index.js', { vars: insertGlobalVars }); }
{ insertGlobalVars[x] = undefined; }
conditional_block
insert-module-globals-tests.ts
import insert = require('insert-module-globals'); import { VarsOption } from 'insert-module-globals'; function example() { function inserter(file: string) { return insert(file, { basedir: __dirname + '/files' }); } return inserter; } function insert_custom_globals() { const customProcessConte...
return inserter; } function disable_select_globals() { const insertGlobalVars: VarsOption = {}; const wantedGlobalVars = ['__filename', '__dirname']; Object.keys(insert.vars).forEach((x) => { if (wantedGlobalVars.indexOf(x) === -1) { insertGlobalVars[x] = undefined; } ...
{ return insert(file, { vars }); }
identifier_body