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 |
|---|---|---|---|---|
x86_64-linux-macos.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[allow(unused_mut)]
#[inline(always)]
pub unsafe fn | (
default: usize,
request: usize,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize) -> usize {
let args: [usize; 6] = [request, arg1, arg2, arg3, arg4, arg5];
let mut result: usize;
// Valgrind notices this magic instruction sequence a... | request | identifier_name |
x86_64-linux-macos.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[allow(unused_mut)]
#[inline(always)]
pub unsafe fn request(
default: usize,
request: usize,
... | result
}
| {
let args: [usize; 6] = [request, arg1, arg2, arg3, arg4, arg5];
let mut result: usize;
// Valgrind notices this magic instruction sequence and interprets
// it as a kind of hypercall. When not running under Valgrind,
// the instructions do nothing and `default` is returned.
asm!("
r... | identifier_body |
Gruntfile.js | // Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Configurable paths
var config = {
app: 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConf... | dist: {
options: {
base: '<%= config.dist %>',
livereload: false
}
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= config.dist %>/*',
'!<%= ... | }
}
}, | random_line_split |
Gruntfile.js | // Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Configurable paths
var config = {
app: 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConfi... |
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', function (target) {
grunt.log | {
return grunt.task.run(['build', 'connect:dist:keepalive']);
} | conditional_block |
RadioButtonGroup.js | import React, {Component, PropTypes} from 'react';
import RadioButton from '../RadioButton';
import warning from 'warning';
class RadioButtonGroup extends Component {
static propTypes = {
/**
* Should be used to pass `RadioButton` components.
*/
children: PropTypes.node,
/**
* The CSS clas... |
}
hasCheckAttribute(radioButton) {
return radioButton.props.hasOwnProperty('checked') &&
radioButton.props.checked;
}
updateRadioButtons(newSelection) {
if (this.state.numberCheckedRadioButtons === 0) {
this.setState({selected: newSelection});
} else {
warning(false, `Material-U... | {
this.setState({
selected: nextProps.valueSelected,
});
} | conditional_block |
RadioButtonGroup.js | import React, {Component, PropTypes} from 'react';
import RadioButton from '../RadioButton';
import warning from 'warning';
class RadioButtonGroup extends Component {
static propTypes = {
/**
* Should be used to pass `RadioButton` components.
*/
children: PropTypes.node,
/**
* The CSS clas... | });
}
componentWillReceiveProps(nextProps) {
if (nextProps.hasOwnProperty('valueSelected')) {
this.setState({
selected: nextProps.valueSelected,
});
}
}
hasCheckAttribute(radioButton) {
return radioButton.props.hasOwnProperty('checked') &&
radioButton.props.checked;
... |
this.setState({
numberCheckedRadioButtons: cnt,
selected, | random_line_split |
RadioButtonGroup.js | import React, {Component, PropTypes} from 'react';
import RadioButton from '../RadioButton';
import warning from 'warning';
class RadioButtonGroup extends Component {
static propTypes = {
/**
* Should be used to pass `RadioButton` components.
*/
children: PropTypes.node,
/**
* The CSS clas... |
clearValue() {
this.setSelectedValue('');
}
render() {
const {prepareStyles} = this.context.muiTheme;
const options = React.Children.map(this.props.children, (option) => {
const {
name, // eslint-disable-line no-unused-vars
value, // eslint-disable-line no-unused-vars
... | {
this.updateRadioButtons(newSelectionValue);
} | identifier_body |
RadioButtonGroup.js | import React, {Component, PropTypes} from 'react';
import RadioButton from '../RadioButton';
import warning from 'warning';
class RadioButtonGroup extends Component {
static propTypes = {
/**
* Should be used to pass `RadioButton` components.
*/
children: PropTypes.node,
/**
* The CSS clas... | () {
this.setSelectedValue('');
}
render() {
const {prepareStyles} = this.context.muiTheme;
const options = React.Children.map(this.props.children, (option) => {
const {
name, // eslint-disable-line no-unused-vars
value, // eslint-disable-line no-unused-vars
label, // esl... | clearValue | identifier_name |
issue-5554.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
constants!();
}
| main | identifier_name |
issue-5554.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(macro_ru... | // http://rust-lang.org/COPYRIGHT.
// | random_line_split |
UpdateFileRequest.js | /**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* ... |
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>UpdateFileRequest</code> from a pla... | {
UpdateFileRequest.initialize(this);
} | identifier_body |
UpdateFileRequest.js | /**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* ... | */
UpdateFileRequest.prototype['description'] = undefined;
export default UpdateFileRequest; | /**
* Description of the file
* @member {String} description | random_line_split |
UpdateFileRequest.js | /**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* ... | {
/**
* Constructs a new <code>UpdateFileRequest</code>.
* @alias module:model/UpdateFileRequest
*/
constructor() {
UpdateFileRequest.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses,... | UpdateFileRequest | identifier_name |
UpdateFileRequest.js | /**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* ... |
if (Object.keys(data).length > 0) {
obj['extra'] = data;
}
}
return obj;
}
}
/**
* Visible name of the file
* @member {String} name
*/
UpdateFileRequest.prototype['name'] = undefined;
/**
* Description of the file
* @member {String} description
*/... | {
obj['description'] = ApiClient.convertToType(data['description'], 'String');
delete data['description'];
} | conditional_block |
menu-trigger.directive.ts | ;
private _portal: TemplatePortal;
private _overlayRef: OverlayRef | null = null;
private _closeSubscription = Subscription.EMPTY;
private _hoverSubscription = Subscription.EMPTY;
private _menuCloseSubscription = Subscription.EMPTY;
constructor(
private _overlay: Overlay,
priv... | (event: MouseEvent): void {
if (this.triggersSubmenu()) {
// Stop event propagation to avoid closing the parent menu.
event.stopPropagation();
this.openMenu();
} else {
this.toggleMenu();
}
}
private _initMenu(): void {
this.menu.p... | _handleClick | identifier_name |
menu-trigger.directive.ts | import { delay, filter, take, takeUntil } from 'rxjs/operators';
import { MenuItemComponent } from './menu-item.component';
import { MenuPanel } from './menu-panel';
import { MenuPositionX, MenuPositionY } from './menu-positions';
import { MenuComponent } from './menu.component';
@Directive({
selector: '[gdMenuTr... | ViewContainerRef,
} from '@angular/core';
import { asapScheduler, merge, of, Subscription } from 'rxjs'; | random_line_split | |
menu-trigger.directive.ts | private _portal: TemplatePortal;
private _overlayRef: OverlayRef | null = null;
private _closeSubscription = Subscription.EMPTY;
private _hoverSubscription = Subscription.EMPTY;
private _menuCloseSubscription = Subscription.EMPTY;
constructor(
private _overlay: Overlay,
private... |
// set state rather than toggle to support triggers sharing a menu
private _setIsMenuOpen(isOpen: boolean): void {
this._menuOpen = isOpen;
if (this.triggersSubmenu()) {
this._menuItem._highlighted = isOpen;
}
}
/**
* This method creates the overlay from the ... | {
this._setIsMenuOpen(false);
// We should reset focus if the user is navigating using a keyboard or
// if we have a top-level trigger which might cause focus to be lost
// when clicking on the backdrop.
if (!this._openedBy) {
// Note that the focus style will show u... | identifier_body |
menu-trigger.directive.ts | private _portal: TemplatePortal;
private _overlayRef: OverlayRef | null = null;
private _closeSubscription = Subscription.EMPTY;
private _hoverSubscription = Subscription.EMPTY;
private _menuCloseSubscription = Subscription.EMPTY;
constructor(
private _overlay: Overlay,
private... |
}
ngAfterContentInit(): void {
this._checkMenu();
this._handleHover();
}
ngOnDestroy(): void {
if (this._overlayRef) {
this._overlayRef.dispose();
this._overlayRef = null;
}
this._cleanUpSubscriptions();
}
/** Whether the menu ... | {
this._menuCloseSubscription = menu.closed.asObservable().subscribe((reason) => {
this._destroyMenu();
// If a click closed the menu, we should close the entire chain of nested menus.
if ((reason === 'click' || reason === 'tab') && this._parentMenu) {
... | conditional_block |
virtual_machine_scale_set_extension_profile.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
class VirtualMachineScaleSetExtensionProfile(Model):
"""Describes a virtual machine scale set extension profile.
:param extensions: The virtual machine scale set child extension
resources.
:type extensions: list of :class:`VirtualMachineScaleSetExtension
<azure.mgmt.compute.compute.v2016_04_30_p... |
from msrest.serialization import Model
| random_line_split |
virtual_machine_scale_set_extension_profile.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | (Model):
"""Describes a virtual machine scale set extension profile.
:param extensions: The virtual machine scale set child extension
resources.
:type extensions: list of :class:`VirtualMachineScaleSetExtension
<azure.mgmt.compute.compute.v2016_04_30_preview.models.VirtualMachineScaleSetExtension... | VirtualMachineScaleSetExtensionProfile | identifier_name |
virtual_machine_scale_set_extension_profile.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | self.extensions = extensions | identifier_body | |
api.rs | //!
//! Public API for bitcrust-db
//!
//!
//!
//!
use config;
use store;
use store::Store;
use block_add;
// Creates a store; mock interface
pub fn init() -> Store {
let config = test_cfg!();
let store = Store::new(&config);
info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr... | (_: [u8; 32]) {
}
#[cfg(test)]
mod tests {
use util::*;
use super::*;
#[test]
pub fn test_add_block() {
let hex = "0100000000000000000000000000000000000000000000000000000000000000\
000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\
4b1e5e4a29ab5f49ffff0... | get_block | identifier_name |
api.rs | //!
//! Public API for bitcrust-db
//!
//!
//!
//!
use config;
use store;
use store::Store;
use block_add;
// Creates a store; mock interface
pub fn init() -> Store {
let config = test_cfg!();
let store = Store::new(&config);
info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr... |
pub fn get_block(_: [u8; 32]) {
}
#[cfg(test)]
mod tests {
use util::*;
use super::*;
#[test]
pub fn test_add_block() {
let hex = "0100000000000000000000000000000000000000000000000000000000000000\
000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\
4b1... | random_line_split | |
api.rs | //!
//! Public API for bitcrust-db
//!
//!
//!
//!
use config;
use store;
use store::Store;
use block_add;
// Creates a store; mock interface
pub fn init() -> Store {
let config = test_cfg!();
let store = Store::new(&config);
info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr... |
pub fn get_block(_: [u8; 32]) {
}
#[cfg(test)]
mod tests {
use util::*;
use super::*;
#[test]
pub fn test_add_block() {
let hex = "0100000000000000000000000000000000000000000000000000000000000000\
000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\
4... | {
} | identifier_body |
PublisherSystem.ts | export class | {
uuid: string; //system UUID
name: string; //Emis, TPP, etc
publisherMode: string; //regular, bulk, auto-fail, draft
//data receipt into DDS
lastReceivedExtract: number;
lastReceivedExtractDate: number;
lastReceivedExtractCutoff: number;
//INBOUND data processing
processingInErr... | PublisherSystem | identifier_name |
PublisherSystem.ts | export class PublisherSystem {
uuid: string; //system UUID
name: string; //Emis, TPP, etc
publisherMode: string; //regular, bulk, auto-fail, draft
//data receipt into DDS
lastReceivedExtract: number;
lastReceivedExtractDate: number;
lastReceivedExtractCutoff: number;
//INBOUND data pr... | lastProcessedOutExtractCutoff: number;
//cached things from client
inboundBehindDays: number; //number of days behind inbound processing is
inboundBehindWarning: string; //text message to go with the above
outboundBehindDays: number;
outboundBehindWarning: string;
} | lastProcessedOutExtract: number;
lastProcessedOutExtractDate: number; | random_line_split |
generic-exterior-box.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <T> {x: @T}
fn reclift<T:'static>(t: T) -> Recbox<T> { return Recbox {x: @t}; }
pub fn main() {
let foo: int = 17;
let rbfoo: Recbox<int> = reclift::<int>(foo);
assert_eq!(*rbfoo.x, foo);
}
| Recbox | identifier_name |
generic-exterior-box.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | #![feature(managed_boxes)]
struct Recbox<T> {x: @T}
fn reclift<T:'static>(t: T) -> Recbox<T> { return Recbox {x: @t}; }
pub fn main() {
let foo: int = 17;
let rbfoo: Recbox<int> = reclift::<int>(foo);
assert_eq!(*rbfoo.x, foo);
} | // option. This file may not be copied, modified, or distributed
// except according to those terms.
| random_line_split |
solutions.py | __problem_title__ = "Number Rotations"
__problem_url___ = "https://projecteuler.net/problem=168"
__problem_description__ = "Consider the number 142857. We can right-rotate this number by moving " \
"the last digit (7) to the front of it, giving us 714285. It can be " \
... | @staticmethod
def time_solutions():
setup = 'from __main__ import Solution'
print('Solution 1:', timeit.timeit('Solution.solution1()', setup=setup, number=1))
if __name__ == '__main__':
s = Solution()
print(s.solution1())
s.time_solutions() | @staticmethod
def solution1():
pass
| random_line_split |
solutions.py |
__problem_title__ = "Number Rotations"
__problem_url___ = "https://projecteuler.net/problem=168"
__problem_description__ = "Consider the number 142857. We can right-rotate this number by moving " \
"the last digit (7) to the front of it, giving us 714285. It can be " \
... | = Solution()
print(s.solution1())
s.time_solutions()
| conditional_block | |
solutions.py |
__problem_title__ = "Number Rotations"
__problem_url___ = "https://projecteuler.net/problem=168"
__problem_description__ = "Consider the number 142857. We can right-rotate this number by moving " \
"the last digit (7) to the front of it, giving us 714285. It can be " \
... | ):
setup = 'from __main__ import Solution'
print('Solution 1:', timeit.timeit('Solution.solution1()', setup=setup, number=1))
if __name__ == '__main__':
s = Solution()
print(s.solution1())
s.time_solutions()
| ime_solutions( | identifier_name |
solutions.py |
__problem_title__ = "Number Rotations"
__problem_url___ = "https://projecteuler.net/problem=168"
__problem_description__ = "Consider the number 142857. We can right-rotate this number by moving " \
"the last digit (7) to the front of it, giving us 714285. It can be " \
... |
@staticmethod
def time_solutions():
setup = 'from __main__ import Solution'
print('Solution 1:', timeit.timeit('Solution.solution1()', setup=setup, number=1))
if __name__ == '__main__':
s = Solution()
print(s.solution1())
s.time_solutions()
| ass
| identifier_body |
abstract.overlay-controller.ts | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | this._overlayService.close();
this._componentRef.destroy();
this._componentRef = undefined;
}
};
ngOnDestroy() {
this._cleanupComponentRef();
}
} | if (this._componentRef) { | random_line_split |
abstract.overlay-controller.ts | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
public showModal<T extends AbstractOverlayContentDirective>(
// Funky syntax to denote passing in a Class that extends AbstractOverlayContentDirective
// (i.e. a function/constructor with any amount of params that returns T where T extends AbstractOverlayContentDirective)
componentClass: ClassType<T>
... | {} | identifier_body |
abstract.overlay-controller.ts | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | (protected _overlayService: OverlayService) {}
public showModal<T extends AbstractOverlayContentDirective>(
// Funky syntax to denote passing in a Class that extends AbstractOverlayContentDirective
// (i.e. a function/constructor with any amount of params that returns T where T extends AbstractOverlayContent... | constructor | identifier_name |
abstract.overlay-controller.ts | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
};
ngOnDestroy() {
this._cleanupComponentRef();
}
}
| {
this._overlayService.close();
this._componentRef.destroy();
this._componentRef = undefined;
} | conditional_block |
traversal.rs | return true;
}
trace!("{:?} doesn't need traversal", el);
false
}
/// Returns true if we want to cull this subtree from the travesal.
fn should_cull_subtree(
&self,
context: &mut StyleContext<E>,
parent: E,
parent_data: &ElementData,
... | data,
propagated_hint, | random_line_split | |
traversal.rs |
/// A DOM Traversal trait, that is used to generically implement styling for
/// Gecko and Servo.
pub trait DomTraversal<E: TElement>: Sync {
/// Process `node` on the way down, before its children have been processed.
///
/// The callback is invoked for each child node that should be processed by
///... | {
false
} | identifier_body | |
traversal.rs | );
if invalidation_result.has_invalidated_siblings() {
let actual_root = root.traversal_parent().expect(
"How in the world can you invalidate \
siblings without a parent?",
);
unsafe { actual_r... | (node: E::ConcreteNode, _parent_data: &ElementData) -> bool {
debug_assert!(node.is_text_node());
false
}
/// Returns true if traversal is needed for the given element and subtree.
fn element_needs_traversal(
el: E,
traversal_flags: TraversalFlags,
data: Option<&Elem... | text_node_needs_traversal | identifier_name |
traversal.rs | o_nonincremental_layout() {
return true;
}
// Unwrap the data.
let data = match data {
Some(d) if d.has_styles() => d,
_ => return true,
};
// If the dirty descendants bit is set, we need to traverse no matter
// what. Skip examining ... | {
element.has_dirty_descendants()
} | conditional_block | |
test_module.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component, NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import * as locatio... | } | ],
declarations: [TestsAppComponent],
bootstrap: [TestsAppComponent]
})
export class TestsAppModule { | random_line_split |
test_module.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component, NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import * as locatio... | {
}
@NgModule({
imports: [
locationExample.AppModule, ngComponentOutletExample.AppModule, ngIfExample.AppModule,
ngTemplateOutletExample.AppModule, pipesExample.AppModule,
// Router configuration so that the individual e2e tests can load their
// app components.
RouterModule.forRoot([
{pa... | TestsAppComponent | identifier_name |
insert_grp_desg.py | # script.py
import argparse
import pyexcel as pe
import configparser
import os
import sys
import sqlite3
import my_connection_grp_desg as connection
from insert import sanction_grp as insert_sanc
DB_URL = None
global conn
conn = None
sheet = None
desg_ls=None
unit_ls=None
sect_ls=None
def load_tables():
# conn.ro... |
if row['WORKING UNIT'] not in unit_ls:
err.append(" unit("+row['WORKING UNIT']+")")
if row['ONROLL_UNIT'] not in unit_ls:
err.append(" roll_unit("+row['ONROLL_UNIT']+")")
# check duplicate eis in file
global eis_list
if str(row['EIS']) in eis_list:
err.append(" eis_repeat("+str(row['EIS'])+")")
else:
ei... | err.append(" sect("+row['SECTION_CD']+")") | conditional_block |
insert_grp_desg.py | # script.py
import argparse
import pyexcel as pe
import configparser
import os
import sys
import sqlite3
import my_connection_grp_desg as connection
from insert import sanction_grp as insert_sanc
DB_URL = None
global conn
conn = None
sheet = None
desg_ls=None
unit_ls=None
sect_ls=None
| desg_ls = [ x[0] for x in c.fetchall()]
c.execute("select code from unit")
global unit_ls
unit_ls = [ x[0] for x in c.fetchall()]
c.execute("select code from section")
global sect_ls
sect_ls = [ x[0] for x in c.fetchall()]
c.execute("select eis from employee")
global eis_ls
eis_ls = [ x[0] for x in c.fetch... | def load_tables():
# conn.row_factory = sqlite3.Row
c = conn.cursor()
c.execute("select dscd from desg")
global desg_ls | random_line_split |
insert_grp_desg.py | # script.py
import argparse
import pyexcel as pe
import configparser
import os
import sys
import sqlite3
import my_connection_grp_desg as connection
from insert import sanction_grp as insert_sanc
DB_URL = None
global conn
conn = None
sheet = None
desg_ls=None
unit_ls=None
sect_ls=None
def load_tables():
# conn.ro... |
if err_row:
error_ls.append(err_row)
print('ERR @ ROW {} => {}'.format(idx+2, err_row))
if error_ls:
print('correct the above errors and upload')
else:
print('{0} rows will be inserted. add "-u" to upload'.format(len(records)))
if upload:
ls=[]
for idx, r in enumerate(records):
#sno AREA UNIT... | try:
sheet = pe.get_sheet(file_name=os.path.normpath(xls_path), sheet_name=sheet_name, name_columns_by_row=0)
except ValueError as e:
print("Sheet name not in excel file: {0}".format(e))
sys.exit()
except AttributeError as e:
print("Sheet name not in excel file: {0}".format(e))
sys.exit()
#raise e
excep... | identifier_body |
insert_grp_desg.py | # script.py
import argparse
import pyexcel as pe
import configparser
import os
import sys
import sqlite3
import my_connection_grp_desg as connection
from insert import sanction_grp as insert_sanc
DB_URL = None
global conn
conn = None
sheet = None
desg_ls=None
unit_ls=None
sect_ls=None
def load_tables():
# conn.ro... | (row, ignore_multi_unit):
# hold all error list
err = []
# check wrong codes
if row['DSCD'] not in desg_ls:
err.append(" dscd("+row['DSCD']+")")
if row['SECTION_CD'] not in sect_ls:
err.append(" sect("+row['SECTION_CD']+")")
if row['WORKING UNIT'] not in unit_ls:
err.append(" unit("+row['WORKING UNIT']+")"... | validate_row | identifier_name |
FizzyText.js | ffdcfc";
// this.color1 = "#c8feff";
// this.color2 = "#ffffff";
// this.color3 = "#c8feff";
this.color0 = "#f0cf5b";
this.color1 = "#2abbf2";
this.color2 = "#660aaf";
this.color3 = "#f57596";
this.bgParticleColor = "#ffffff";
this.fontSize = 100;
this.fontWeight = 800;
//... | g.strokeText(message, textOffsetLeft, textAscent);
}
g.globalCompositeOperation = "darker";
// Choose particle color
for (var i = 0; i < particles.length; i++) {
g.fillStyle = colors[i % colors.length];
particles[i].render();
}
// Ch... | // g.strokeStyle = "#000"; // for trans
g.strokeStyle = "#fff";
g.font = _this.fontSize + "px helvetica, arial, sans-serif"; // took out font weight
g.lineWidth = .5; | random_line_split |
FizzyText.js | (message) {
var that = this;
// These are the variables that we manipulate with gui-dat.
// Notice they're all defined with "this". That makes them public.
// Otherwise, gui-dat can't see them.
this.growthSpeed = 0.98; // how fast do particles change size?
// this.maxSize = getRandomIntInclus... | FizzyText | identifier_name | |
FizzyText.js | .cos(angle) * mag;
particles[i].vy = Math.sin(angle) * mag;
}
};
////////////////////////////////
var _this = this;
var width = window.innerWidth;
var height = window.innerHeight;
// var textAscent = Math.random() * height; // for trans
var textAscent = height / 2; // ... | {
// Position
this.x = x;
this.y = y;
// Size of particle
this.r = 0;
// This velocity is used by the explode function.
this.vx = 0;
this.vy = 0;
this.constrain = function(v, o1, o2) {
if (v < o1) v = o1;
else if (v > o2... | identifier_body | |
shell-controller_test.js | /*"use strict"; | var expect = require("expect.js"),
ShellController = require("../lib/shell-controller"),
testView = require("./test-shell-view");
describe("ShellController", function() {
var ctrl;
it("is defined", function() {
expect(ShellController).to.be.an("function");
});
describe("constructor", function() {
before(f... | random_line_split | |
serve.js | var watchers = Object.create(null);
var wait = function (linkid, callback) {
watchers[linkid] = cross("options", "/:care-" + linkid).success(function (res) {
if (watchers[linkid]) wait(linkid, callback);
var a = JSAM.parse(res.responseText);
if (isFunction(callback)) a.forEach(b => callback(... | return new Promise(function (ok, oh) {
var blocks = [], _linkid;
serve(function (block) {
blocks.push(block);
if (block.length < block_size) {
var data = decode(blocks.join(''));
ok(JSAM.parse(data));
kill(_linkid);
... | random_line_split | |
serve.js | var watchers = Object.create(null);
var wait = function (linkid, callback) {
watchers[linkid] = cross("options", "/:care-" + linkid).success(function (res) {
if (watchers[linkid]) wait(linkid, callback);
var a = JSAM.parse(res.responseText);
if (isFunction(callback)) a.forEach(b => callback(... |
serve.servd = servd;
serve.servp = servp;
serve.kill = kill;
| {
return new Promise(function (ok, oh) {
var blocks = [], _linkid;
serve(function (block) {
blocks.push(block);
if (block.length < block_size) {
var data = decode(blocks.join(''));
ok(JSAM.parse(data));
kill(_linkid);
... | identifier_body |
serve.js | var watchers = Object.create(null);
var wait = function (linkid, callback) {
watchers[linkid] = cross("options", "/:care-" + linkid).success(function (res) {
if (watchers[linkid]) wait(linkid, callback);
var a = JSAM.parse(res.responseText);
if (isFunction(callback)) a.forEach(b => callback(... | (getdata) {
return serve(function (linkid) {
cast(linkid, JSAM.stringify(getdata()));
});
}
function servp(linkto) {
return new Promise(function (ok, oh) {
var blocks = [], _linkid;
serve(function (block) {
blocks.push(block);
if (block.length < block_size) {
... | servd | identifier_name |
service.py |
logger = logging.getLogger(__name__)
class ItemsService(BaseService):
"""
A service that knows how to perform CRUD operations on the `item`
content types.
Serves mainly as a proxy to the data layer.
"""
def find_one(self, req, **lookup):
"""Retrieve a specific item.
:param ... | random_line_split | ||
service.py | allowed_params = {'include_fields', 'exclude_fields'}
self._check_for_unknown_params(
req, whitelist=allowed_params, allow_filtering=False)
self._set_fields_filter(req) # Eve's "projection"
return super().find_one(req, **lookup)
def get(self, req, lookup):
"""... | """
A service that knows how to perform CRUD operations on the `item`
content types.
Serves mainly as a proxy to the data layer.
"""
def find_one(self, req, **lookup):
"""Retrieve a specific item.
:param req: object representing the HTTP request
:type req: `eve.utils.Parse... | identifier_body | |
service.py | (BaseService):
"""
A service that knows how to perform CRUD operations on the `item`
content types.
Serves mainly as a proxy to the data layer.
"""
def find_one(self, req, **lookup):
"""Retrieve a specific item.
:param req: object representing the HTTP request
:type re... | ItemsService | identifier_name | |
service.py | so that it
does not expose the internal DB query details, but instead reflects
what the client has sent in request.
:param dict result: dictionary contaning the list of MongoDB documents
(the fetched items) and some metadata, e.g. pagination info
"""
for document in... | include_fields = include_fields.split(',')
include_fields = set(remove_empty(strip_items(include_fields))) | conditional_block | |
lib.rs | #![feature(slice_patterns)]
#![feature(advanced_slice_patterns)]
use std::fs::File;
use std::path::Path;
use std::io::prelude::*;
use std::str::Chars;
use std::collections::VecDeque;
use std::error::Error;
mod defs;
mod parser;
mod repl;
#[macro_use]
pub use defs::*;
use parser::*;
use repl::eval;
// outputs csv fil... | (&self, tag: &Tag) -> String {
format!("NAVY,{},{},{},{},{},{},{},{},{},{},{}",
parser::to_string(tag),
self.cli,
self.fri,
self.man,
self.com,
self.tra,
self.mon,
self.iro,
... | to_csv_string | identifier_name |
lib.rs | #![feature(slice_patterns)]
#![feature(advanced_slice_patterns)]
use std::fs::File;
use std::path::Path;
use std::io::prelude::*;
use std::str::Chars;
use std::collections::VecDeque;
use std::error::Error;
mod defs;
mod parser;
mod repl;
#[macro_use]
pub use defs::*;
use parser::*;
use repl::eval;
// outputs csv fil... |
}
impl Army {
fn new() -> Army {
Army {
irr: 0,
cav: 0,
inf: 0,
hus: 0,
cui: 0,
dra: 0,
art: 0,
eng: 0,
gua: 0,
arm: 0,
pla: 0,
}
}
fn to_csv_string(&self, ta... | {
String::new()
} | identifier_body |
lib.rs | #![feature(slice_patterns)]
#![feature(advanced_slice_patterns)]
use std::fs::File;
use std::path::Path;
use std::io::prelude::*;
use std::str::Chars;
use std::collections::VecDeque;
use std::error::Error;
mod defs;
mod parser;
mod repl;
#[macro_use]
pub use defs::*;
use parser::*;
use repl::eval;
// outputs csv fil... | }
fn to_csv_string(&self, tag: &Tag) -> String {
format!("ARMY,{},{},{},{},{},{},{},{},{},{},{},{}",
parser::to_string(tag),
self.irr,
self.cav,
self.inf,
self.hus,
self.cui,
self.dra,
... | pla: 0,
} | random_line_split |
util.js | /*==================================================
* Exhibit Utility Functions
*==================================================
*/
Exhibit.Util = {};
/**
* Round a number n to the nearest multiple of precision (any positive value),
* such as 5000, 0.1 (one decimal), 1e-12 (twelve decimals), or 1024 (if you'... |
return res;
};
}
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
fun.call... | {
if (this.hasOwnProperty(i))
res[i] = f.call(thisp, this[i], i, this);
} | conditional_block |
util.js | /*==================================================
* Exhibit Utility Functions
*==================================================
*/
Exhibit.Util = {};
/**
* Round a number n to the nearest multiple of precision (any positive value),
* such as 5000, 0.1 (one decimal), 1e-12 (twelve decimals), or 1024 (if you'... | : Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
if (!Array.prototype.filter)
{
Array.prototype.filter = function(fun /*, thisp*/)
{
var len = this.le... | ? Math.ceil(from) | random_line_split |
init.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::RegisterBindings;
use crate::dom::bindings::conversions::is_dom_proxy;
use cra... | };
},
_ => warn!("Failed to get file count limit"),
};
}
}
#[cfg(not(target_os = "linux"))]
fn perform_platform_specific_initialization() {}
#[allow(unsafe_code)]
unsafe extern "C" fn is_dom_object(obj: *mut JSObject) -> bool {
!obj.is_null() && (is_platform_obj... | match libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) {
0 => (),
_ => warn!("Failed to set file count limit"), | random_line_split |
init.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::RegisterBindings;
use crate::dom::bindings::conversions::is_dom_proxy;
use cra... | () {
// 4096 is default max on many linux systems
const MAX_FILE_LIMIT: libc::rlim_t = 4096;
// Bump up our number of file descriptors to save us from impending doom caused by an onslaught
// of iframes.
unsafe {
let mut rlim = libc::rlimit {
rlim_cur: 0,
rlim_max: 0... | perform_platform_specific_initialization | identifier_name |
init.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::RegisterBindings;
use crate::dom::bindings::conversions::is_dom_proxy;
use cra... |
#[allow(unsafe_code)]
pub fn init() -> JSEngineSetup {
unsafe {
proxyhandler::init();
// Create the global vtables used by the (generated) DOM
// bindings to implement JS proxies.
RegisterBindings::RegisterProxyHandlers();
js::glue::InitializeMemoryReporter(Some(is_dom_ob... | {
!obj.is_null() && (is_platform_object_static(obj) || is_dom_proxy(obj))
} | identifier_body |
init.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::RegisterBindings;
use crate::dom::bindings::conversions::is_dom_proxy;
use cra... | else {
MAX_FILE_LIMIT
}
},
};
match libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) {
0 => (),
_ => warn!("Failed to set file count limit"),
};
},
... | {
rlim.rlim_max
} | conditional_block |
content-view-versions.controller.test.js | /**
* Copyright 2014 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public
* License as published by the Free Software Foundation; either version
* 2 of the License (GPLv2) or (at your option) any later version.
* There is NO WARRANTY for this software, express or implied,
* including t... | }); | random_line_split | |
index.rs |
use Context;
use ffi;
use std::ffi::CString;
pub trait LuaIndex {
fn get(&self, cxt: &Context, idx: i32);
fn set(&self, cxt: &Context, idx: i32);
}
macro_rules! integer_index {
($ty:ident) => (
impl LuaIndex for $ty {
fn get(&self, cxt: &Context, idx: i32) {
unsafe { f... | (&self, cxt: &Context, idx: i32) {
unsafe {
ffi::lua_getfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as_ptr() as _ })
}
}
fn set(&self, cxt: &Context, idx: i32) {
unsafe {
ffi::lua_setfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as... | get | identifier_name |
index.rs |
use Context;
use ffi;
use std::ffi::CString;
pub trait LuaIndex {
fn get(&self, cxt: &Context, idx: i32);
fn set(&self, cxt: &Context, idx: i32);
}
macro_rules! integer_index {
($ty:ident) => (
impl LuaIndex for $ty {
fn get(&self, cxt: &Context, idx: i32) {
unsafe { f... |
}
| {
unsafe {
ffi::lua_setfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as_ptr() as _ })
}
} | identifier_body |
index.rs | use Context; | use std::ffi::CString;
pub trait LuaIndex {
fn get(&self, cxt: &Context, idx: i32);
fn set(&self, cxt: &Context, idx: i32);
}
macro_rules! integer_index {
($ty:ident) => (
impl LuaIndex for $ty {
fn get(&self, cxt: &Context, idx: i32) {
unsafe { ffi::lua_rawgeti(cxt.han... | use ffi; | random_line_split |
search_normal.js | // Copyright 2011 Splunk, 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... | });
},
// Print out the statistics and get the results
function(results, job, done) {
// Print out the statics
console.log("Job Statistics: ");
console.log(" Event Count: " + job.properties().eventCount);
... | job.results({}, done); | random_line_split |
search_normal.js |
// Copyright 2011 Splunk, 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 i... |
service.search("search index=_internal | head 3", {}, done);
},
// Wait until the job is done
function(job, done) {
job.track({}, function(job) {
// Ask the server for the results
job.results({}... | {
done("Error logging in");
} | conditional_block |
bdmplot2_callback.py | # Copyright (c) 2008-2010, Regents of the University of Colorado.
# This work was supported by NASA contracts NNJ05HE10G, NNC06CB40C, and
# NNC07CB47C.
# This library is free software. You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Softwa... |
def cb_datapoint(datapoint, userdata):
value = bionet_datapoint_get_value(datapoint);
resource = bionet_value_get_resource(value);
node = bionet_resource_get_node(resource);
hab = bionet_node_get_hab(node);
value_str = bionet_value_to_str(value);
#"%s.%s.%s:%s = %s %s %s @ %s"
#p... | hab = bionet_node_get_hab(node)
for j in range(0, bionet_node_get_num_resources(node)):
resource = bionet_node_get_resource_by_index(node, j)
pybionet_set_user_data(resource, None)
print("lost node: " + bionet_node_get_name(node)) | identifier_body |
bdmplot2_callback.py | # Copyright (c) 2008-2010, Regents of the University of Colorado.
# This work was supported by NASA contracts NNJ05HE10G, NNC06CB40C, and
# NNC07CB47C.
# This library is free software. You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Softwa... | (bdm, user_data):
None
def cb_lost_hab(hab, user_data):
for i in range(0, bionet_hab_num_nodes(hab)):
node = bionet_hab_get_node_by_index(hab, i)
for j in range(0, bionet_node_get_num_resources(node)):
resource = bionet_node_get_resource_by_index(node, j)
pybionet_set_u... | cb_new_bdm | identifier_name |
bdmplot2_callback.py | # Copyright (c) 2008-2010, Regents of the University of Colorado.
# This work was supported by NASA contracts NNJ05HE10G, NNC06CB40C, and
# NNC07CB47C.
# This library is free software. You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Softwa... |
else: # user data is set, just append to it
u['datapoints'].append(dp)
if session_id in u['sessions']:
u['sessions'][session_id].append(dp)
else:
u... | u = { 'datapoints' : [ dp ], 'sessions' : { session_id : [ dp ] } }
bionet_resources[name] = u
print "Added datapoint to new user data" | conditional_block |
bdmplot2_callback.py | # Copyright (c) 2008-2010, Regents of the University of Colorado.
# This work was supported by NASA contracts NNJ05HE10G, NNC06CB40C, and
# NNC07CB47C.
# This library is free software. You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Softwa... |
for session_id in removal:
#print "removed subscription ", sessions[session_id]['resource']
del sessions[session_id]
# TODO: unsubscribe when bdm_unsubscribe() is implemented |
if (now > (session['last requested'] + 600)):
# this session hasn't been requested in more than 10 minutes. remove it
removal.append(session_id) | random_line_split |
All.js | /*
* /MathJax/jax/output/HTML-CSS/fonts/STIX/IntegralsD/Regular/All.js
*
* Copyright (c) 2009-2018 The MathJax Consortium
*
* 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
*
* ... | MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXIntegralsD,{32:[0,0,250,0,0],160:[0,0,250,0,0],8748:[2000,269,895,56,1345],8749:[2000,269,1205,56,1655],8751:[2000,269,945,56,1345],8752:[2000,269,1255,56,1655],8753:[2000,269,635,56,1035],8754:[2000,269,635,56,1035],8755:[2000,269,635,56,1035],10763:[... | random_line_split | |
write_log.py | #!/usr/bin/python3
import datetime
import sys
import os
homedir = os.environ['HOME']
log_path = homedir + "/Pigrow/logs/trigger_log.txt"
script = "write_log.py"
message = ""
for argu in sys.argv[1:]:
argu_l = str(argu).lower()
if argu_l == 'help' or argu_l == '-h' or argu_l == '--help':
print(" Script... | line = script + "@" + str(datetime.datetime.now()) + "@" + message + '\n'
with open(log_path, "a") as f:
f.write(line)
print("Log writen:" + line)
print("to " + log_path) | script = thevalue
elif thearg == 'message':
message = thevalue
| random_line_split |
write_log.py | #!/usr/bin/python3
import datetime
import sys
import os
homedir = os.environ['HOME']
log_path = homedir + "/Pigrow/logs/trigger_log.txt"
script = "write_log.py"
message = ""
for argu in sys.argv[1:]:
| if thearg == 'log' or thearg == 'log_path':
log_path = thevalue
elif thearg == 'script':
script = thevalue
elif thearg == 'message':
message = thevalue
line = script + "@" + str(datetime.datetime.now()) + "@" + message + '\n'
with open(log_path, "a") as f:
... | argu_l = str(argu).lower()
if argu_l == 'help' or argu_l == '-h' or argu_l == '--help':
print(" Script for writing to a log file")
print(" ")
print(" log=" + homedir + "/Pigrow/logs/trigger_log.txt")
print(" ")
print(' script="text with spaces"')
print(' to inc... | conditional_block |
reserved.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// Taken from `https://en.cppreference.com/w/cpp/keyword`
/// Some experimental keywords were filtered out and th... | (rust_identifier: &mut String) {
if RESERVED_KEYWORDS
.binary_search(&rust_identifier.as_ref())
.is_ok()
{
rust_identifier.push('_');
}
}
| escape | identifier_name |
reserved.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// Taken from `https://en.cppreference.com/w/cpp/keyword`
/// Some experimental keywords were filtered out and th... | {
if RESERVED_KEYWORDS
.binary_search(&rust_identifier.as_ref())
.is_ok()
{
rust_identifier.push('_');
}
} | identifier_body | |
reserved.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// Taken from `https://en.cppreference.com/w/cpp/keyword`
/// Some experimental keywords were filtered out and th... |
}
| {
rust_identifier.push('_');
} | conditional_block |
reserved.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// Taken from `https://en.cppreference.com/w/cpp/keyword`
/// Some experimental keywords were filtered out and th... | "try",
"typedef",
"typename",
"union",
"unsigned",
"using",
"virtual",
"void",
"volatile",
"wchar_t",
"while",
];
pub fn escape(rust_identifier: &mut String) {
if RESERVED_KEYWORDS
.binary_search(&rust_identifier.as_ref())
.is_ok()
{
rust_iden... | "template",
"this",
"thread_local",
"throw",
"true", | random_line_split |
dwarftools.py | from elftools.dwarf.ranges import RangeEntry, BaseAddressEntry
from elftools.dwarf import constants
def get_die_offset_by_reference(referer_die, attrname, use_abstract_origin=True):
'''Return the offset of the DIE referred by the given attribute in the referrer DIE.'''
ref = referer_die.attributes.get(attrname... |
elif 'DW_AT_low_pc' in die.attributes:
low = get_attr_val(die, 'DW_AT_low_pc', False)
high_form, high = get_attr_form_val(die, 'DW_AT_high_pc', False) or low + 1
if high_form.startswith('DW_FORM_data'):
high += low
yield low, high
elif die.get_parent():
for x... | rangelist_offset = die.attributes['DW_AT_ranges'].value
rl = die.dwarfinfo.range_lists().get_range_list_at_offset(rangelist_offset)
for low, high in iter_range_list(rl):
yield low, high | conditional_block |
dwarftools.py | from elftools.dwarf.ranges import RangeEntry, BaseAddressEntry
from elftools.dwarf import constants
def get_die_offset_by_reference(referer_die, attrname, use_abstract_origin=True):
'''Return the offset of the DIE referred by the given attribute in the referrer DIE.'''
ref = referer_die.attributes.get(attrname... | for low, high in sorted(ranges):
if next_range[1] == low:
next_range = (next_range[0], high)
else:
if next_range[0] is not None:
yield next_range
next_range = (low, high)
... |
def merge_ranges(ranges):
'''Yield ranges equivalent to the given ones, but simplified if possible.'''
next_range = (None, None) | random_line_split |
dwarftools.py | from elftools.dwarf.ranges import RangeEntry, BaseAddressEntry
from elftools.dwarf import constants
def get_die_offset_by_reference(referer_die, attrname, use_abstract_origin=True):
'''Return the offset of the DIE referred by the given attribute in the referrer DIE.'''
ref = referer_die.attributes.get(attrname... |
def get_attr_val(die, what, use_abstract_origin=True):
'''Return the value of the given attribute of the given DIE.'''
form, val = get_attr_form_val(die, what, use_abstract_origin)
return val
def iter_ranges(die):
def iter_range_list(ranges):
def iter_pairs():
# by default addre... | '''Return the form and value of the given attribute of the given DIE.'''
try:
return die.attributes[what].form, die.attributes[what].value
except KeyError:
if use_abstract_origin:
origin_die = get_origin_die(die)
if origin_die:
return get_attr_form_val(ori... | identifier_body |
dwarftools.py | from elftools.dwarf.ranges import RangeEntry, BaseAddressEntry
from elftools.dwarf import constants
def get_die_offset_by_reference(referer_die, attrname, use_abstract_origin=True):
'''Return the offset of the DIE referred by the given attribute in the referrer DIE.'''
ref = referer_die.attributes.get(attrname... | (die, what, use_abstract_origin=True):
'''Return the value of the given attribute of the given DIE.'''
form, val = get_attr_form_val(die, what, use_abstract_origin)
return val
def iter_ranges(die):
def iter_range_list(ranges):
def iter_pairs():
# by default addresses are relative t... | get_attr_val | identifier_name |
__init__.py | from mocket import Mocket, mocketize
from mocket.async_mocket import async_mocketize
from mocket.compat import byte_type, text_type
from mocket.mockhttp import Entry as MocketHttpEntry
from mocket.mockhttp import Request as MocketHttpRequest
from mocket.mockhttp import Response as MocketHttpResponse
def httprettifier... | (self):
super(Response, self).set_base_headers()
self.headers = httprettifier_headers(self.headers)
original_set_base_headers = set_base_headers
def set_extra_headers(self, headers):
self.headers.update(headers)
class Entry(MocketHttpEntry):
request_cls = Request
response_cls... | set_base_headers | identifier_name |
__init__.py | from mocket import Mocket, mocketize
from mocket.async_mocket import async_mocketize
from mocket.compat import byte_type, text_type
from mocket.mockhttp import Entry as MocketHttpEntry
from mocket.mockhttp import Request as MocketHttpRequest
from mocket.mockhttp import Response as MocketHttpResponse
def httprettifier... |
if forcing_headers is not None:
def force_headers(self):
self.headers = httprettifier_headers(forcing_headers)
Response.set_base_headers = force_headers
else:
Response.set_base_headers = Response.original_set_base_headers
if responses:
Entry.register(method, ... | headers.update(httprettifier_headers(adding_headers)) | conditional_block |
__init__.py | from mocket import Mocket, mocketize
from mocket.async_mocket import async_mocketize
from mocket.compat import byte_type, text_type
from mocket.mockhttp import Entry as MocketHttpEntry
from mocket.mockhttp import Request as MocketHttpRequest
from mocket.mockhttp import Response as MocketHttpResponse
def httprettifier... | class Entry(MocketHttpEntry):
request_cls = Request
response_cls = Response
activate = mocketize
httprettified = mocketize
async_httprettified = async_mocketize
enable = Mocket.enable
disable = Mocket.disable
reset = Mocket.reset
GET = Entry.GET
PUT = Entry.PUT
POST = Entry.POST
DELETE = Entry.DELETE
HEAD =... | self.headers.update(headers)
| random_line_split |
__init__.py | from mocket import Mocket, mocketize
from mocket.async_mocket import async_mocketize
from mocket.compat import byte_type, text_type
from mocket.mockhttp import Entry as MocketHttpEntry
from mocket.mockhttp import Request as MocketHttpRequest
from mocket.mockhttp import Response as MocketHttpResponse
def httprettifier... |
original_set_base_headers = set_base_headers
def set_extra_headers(self, headers):
self.headers.update(headers)
class Entry(MocketHttpEntry):
request_cls = Request
response_cls = Response
activate = mocketize
httprettified = mocketize
async_httprettified = async_mocketize
enable = Mocket... | super(Response, self).set_base_headers()
self.headers = httprettifier_headers(self.headers) | identifier_body |
tocsupport.py | 2001-2003 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... | def __init__(self, account, chatui, logonDeferred):
toc.TOCClient.__init__(self, account.username, account.password)
basesupport.AbstractClientMixin.__init__(self, account, chatui,
logonDeferred)
self.roomID = {}
self.roomIDreverse = {... |
class TOCProto(basesupport.AbstractClientMixin, toc.TOCClient): | random_line_split |
tocsupport.py | 2001-2003 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... |
def chatHearWhisper(self, roomid, username, message):
print '*** user whispered *** ', roomid, username, message
def chatInvited(self, roomid, roomname, username, message):
print '*** user invited us to chat *** ',roomid, roomname, username, message
def chatLeft(self, roomid):
group... | if toc.normalize(username) == toc.normalize(self.name):
return # ignore the message
group=self.roomIDreverse[roomid]
self.getGroupConversation(group).showGroupMessage(username, dehtml(message)) | identifier_body |
tocsupport.py | 2001-2003 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... |
self.account.client.chat_say(self.roomID,html(text))
return succeed(text)
def leave(self):
if self.account.client is None:
raise locals.OfflineError
self.account.client.chat_leave(self.roomID)
class TOCProto(basesupport.AbstractClientMixin, toc.TOCClient):
def __in... | if meta.get("style", None) == "emote":
text="* "+text+"* " | conditional_block |
tocsupport.py | 2001-2003 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... | (self, roomid, username, message):
print '*** user whispered *** ', roomid, username, message
def chatInvited(self, roomid, roomname, username, message):
print '*** user invited us to chat *** ',roomid, roomname, username, message
def chatLeft(self, roomid):
group=self.roomIDreverse[room... | chatHearWhisper | identifier_name |
clap-test.rs | #[allow(unused_imports, dead_code)]
mod test {
use std::str;
use std::io::{Cursor, Write};
use regex::Regex;
use clap::{App, Arg, SubCommand, ArgGroup};
fn compare<S, S2>(l: S, r: S2) -> bool
where S: AsRef<str>,
S2: AsRef<str>
{
let re = Regex::new("\x1b[^m]*m")... | .arg(Arg::from_usage("-f --flag... 'tests flags'")
.global(true))
.args(&[
Arg::from_usage("[flag2] -F 'tests flags with exclusions'").conflicts_with("flag").requires("long-option-2"),
Arg::from_usage("--long-option-2 [option2] 'tests long options ... | .args_from_usage(args) | random_line_split |
clap-test.rs | #[allow(unused_imports, dead_code)]
mod test {
use std::str;
use std::io::{Cursor, Write};
use regex::Regex;
use clap::{App, Arg, SubCommand, ArgGroup};
fn compare<S, S2>(l: S, r: S2) -> bool
where S: AsRef<str>,
S2: AsRef<str>
{
let re = Regex::new("\x1b[^m]*m")... |
b
}
pub fn compare_output(l: App, args: &str, right: &str, stderr: bool) -> bool {
let mut buf = Cursor::new(Vec::with_capacity(50));
let res = l.get_matches_from_safe(args.split(' ').collect::<Vec<_>>());
let err = res.unwrap_err();
err.write_to(&mut buf).unwrap();
... | {
println!("");
println!("--> left");
println!("{}", left);
println!("--> right");
println!("{}", right);
println!("--")
} | conditional_block |
clap-test.rs | #[allow(unused_imports, dead_code)]
mod test {
use std::str;
use std::io::{Cursor, Write};
use regex::Regex;
use clap::{App, Arg, SubCommand, ArgGroup};
fn | <S, S2>(l: S, r: S2) -> bool
where S: AsRef<str>,
S2: AsRef<str>
{
let re = Regex::new("\x1b[^m]*m").unwrap();
// Strip out any mismatching \r character on windows that might sneak in on either side
let ls = l.as_ref().trim().replace("\r", "");
let rs = r.as_ref... | compare | identifier_name |
clap-test.rs | #[allow(unused_imports, dead_code)]
mod test {
use std::str;
use std::io::{Cursor, Write};
use regex::Regex;
use clap::{App, Arg, SubCommand, ArgGroup};
fn compare<S, S2>(l: S, r: S2) -> bool
where S: AsRef<str>,
S2: AsRef<str>
{
let re = Regex::new("\x1b[^m]*m")... | Arg::from_usage("--minvals2 [minvals]... 'Tests 2 min vals'").min_values(2),
Arg::from_usage("--maxvals3 [maxvals]... 'Tests 3 max vals'").max_values(3)
])
.subcommand(SubCommand::with_name("subcmd")
.about("tests subcommands")
... | {
let args = "-o --option=[opt]... 'tests options'
[positional] 'tests positionals'";
let opt3_vals = ["fast", "slow"];
let pos3_vals = ["vi", "emacs"];
App::new("clap-test")
.version("v1.4.8")
.about("tests clap library")
.author("... | identifier_body |
AudioSource.ts | class AudioSource
{
public static maxInstances:number = 50;
private path:string;
private sounds:HTMLAudioElement[] = [];
constructor(path:string, first?:HTMLAudioElement)
{
this.path = path;
if (first)
this.sounds.push(first);
}
/**
* Gets a new instance of the sound from cache or file
*/
public ... |
/**
* Returns the sound instance so it can be used again
*/
public returnSound(sound:HTMLAudioElement):void
{
this.sounds.push(sound);
}
/**
* Not Implemented
*/
public dispose():void
{
}
} | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.