file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
index.tsx | /*
* Copyright 2021 ThoughtWorks, 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 agr... |
export interface GroupedEnvironmentVariablesAttrs {
title: string;
environmentVariables: EnvironmentVariables;
onAdd: () => void;
onRemove: (environmentVariable: EnvironmentVariable) => void;
}
export class GroupedEnvironmentVariables extends MithrilComponent<GroupedEnvironmentVariablesAttrs> {
renderEnviro... | random_line_split | |
index.tsx | /*
* Copyright 2021 ThoughtWorks, 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 agr... | extends MithrilComponent<GroupedEnvironmentVariablesAttrs> {
renderEnvironmentVariableWidget(vnode: m.Vnode<GroupedEnvironmentVariablesAttrs>,
environmentVariable: EnvironmentVariable) {
return <EnvironmentVariableWidget environmentVariable={environmentVariable} onRemove={vnode.... | GroupedEnvironmentVariables | identifier_name |
index.tsx | /*
* Copyright 2021 ThoughtWorks, 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 agr... |
view(vnode: m.Vnode<EnvironmentVariablesWidgetAttrs, {}>): m.Children {
return <div>
<GroupedEnvironmentVariables environmentVariables={vnode.attrs.environmentVariables.plainTextVariables()}
title="Plain Text Variables"
onAdd={Environme... | {
vnode.attrs.environmentVariables.remove(envVar);
} | identifier_body |
index.tsx | /*
* Copyright 2021 ThoughtWorks, 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 agr... |
return <div class={styles.groupContainer}>
<h4 data-test-id={`${s.slugify(vnode.attrs.title)}-title`}>{vnode.attrs.title}</h4>
<FlashMessage dataTestId={`${s.slugify(vnode.attrs.title)}-msg`} type={MessageType.info} message={noEnvironmentVariablesConfiguredMessage}/>
{vnode.attrs.environmentVari... | {
noEnvironmentVariablesConfiguredMessage = `No ${vnode.attrs.title} are configured.`;
} | conditional_block |
toggle-buttons.js | import Component from '../../component'
/**
* Set of horizontally arranged buttons with only one active at a time
*/
export default class ToggleButtons extends Component {
constructor (texts) {
super()
this.selection.classed('toggle-group', true)
this.buttons = texts.map(txt => {
return this.sel... | }
set (idx) {
this.buttons[idx].classed('selected', true)
}
unset (idx) {
this.buttons[idx].classed('selected', false)
}
reset () {
this.buttons.forEach((btn, idx) => this.unset(idx))
}
} | that.reset()
that.set(idx)
})
}) | random_line_split |
toggle-buttons.js | import Component from '../../component'
/**
* Set of horizontally arranged buttons with only one active at a time
*/
export default class ToggleButtons extends Component {
constructor (texts) {
super()
this.selection.classed('toggle-group', true)
this.buttons = texts.map(txt => {
return this.sel... | () {
this.buttons.forEach((btn, idx) => this.unset(idx))
}
}
| reset | identifier_name |
x86_64_unknown_dragonfly.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 ... | () -> Target {
let mut base = super::dragonfly_base::opts();
base.cpu = "x86-64".to_string();
base.pre_link_args.push("-m64".to_string());
Target {
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
... | target | identifier_name |
x86_64_unknown_dragonfly.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 ... | } | random_line_split | |
x86_64_unknown_dragonfly.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 ... | {
let mut base = super::dragonfly_base::opts();
base.cpu = "x86-64".to_string();
base.pre_link_args.push("-m64".to_string());
Target {
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
... | identifier_body | |
__init__.py | # Copyright (c) 2011 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
# | # The ASKAP software distribution is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the License
# or (at your option) any later version.
#
# This program is distributed in the hope that it wi... | # This file is part of the ASKAP software distribution.
# | random_line_split |
rules.js | var _ = require('underscore'),
check = require('validator').check,
sanitize = require('validator').sanitize,
later = require('later'),
util = require('./util'),
condition = require('./condition');
| ],
alertTypes: {
'email': {
// later
},
'sms': {
// later
}
},
/**
* Validates a rule type
*
* @param string type
*
* @return boolean
*/
validateRuleType: function(type) {
return typeof type == 'string' && _.contains(Rules.types, type);
},
/**
* Validates an rule scedule
*
... | var Rules = {
types: [
'trigger',
'schedule' | random_line_split |
parallel.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/. */
//! Implements parallel traversal over the DOM tree.
//!
//! This traversal is based on Rayon, and therefore its s... | if may_dispatch_tail {
top_down_dom(&work, root, traversal_data, scope, pool, traversal, tls);
} else {
scope.spawn(move |scope| {
let work = work;
top_down_dom(&work, root, traversal_data, scope, pool, traversal, tls);
});
}
... | random_line_split | |
parallel.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/. */
//! Implements parallel traversal over the DOM tree.
//!
//! This traversal is based on Rayon, and therefore its s... | <E, D>(traversal: &D,
root: E,
token: PreTraverseToken,
pool: &rayon::ThreadPool)
where E: TElement,
D: DomTraversal<E>,
{
let dump_stats = traversal.shared_context().options.dump_style_statistics;
let start_time = if du... | traverse_dom | identifier_name |
notification_filters_spec.ts | /*
* Copyright 2022 ThoughtWorks, 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 agr... |
it('should validate presence of stage', () => {
const filter = new NotificationFilter(1, "pipeline", "", 'All', false);
expect(filter.isValid()).toBeFalse();
expect(filter.errors().count()).toBe(1);
expect(filter.errors().errorsForDisplay('stage')).toBe('Stage must be present.');
});
}); | expect(filter.isValid()).toBeFalse();
expect(filter.errors().count()).toBe(1);
expect(filter.errors().errorsForDisplay('pipeline')).toBe('Pipeline must be present.');
}); | random_line_split |
windhappers-location.ts | import './components/xsystems-google-maps.js';
import './windhappers-notification.js';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { windhappersStyles } from './windhappers-styles.js';
@customElement('windhappers-location')
export class Windhappers... |
}
| {
return html`
<xsystems-google-maps
key="AIzaSyDTj9__sWn_MKroJ6vlad1pCCidRBi6a5g"
latitude="52.079124"
longitude="4.236238"
.markers=${this._markers}
></xsystems-google-maps>
<windhappers-notification type="info" removable>
De Windhappers is een Haagse kan... | identifier_body |
windhappers-location.ts | import './components/xsystems-google-maps.js';
import './windhappers-notification.js';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { windhappersStyles } from './windhappers-styles.js'; | windhappersStyles,
css`
:host {
display: grid;
grid-template-columns: 1fr;
grid-auto-rows: 1fr auto auto;
height: 100%;
grid-gap: 1vh;
}
windhappers-notification {
margin-left: 1vh;
margin-right: 1vh;
box-shadow: var(--shadow-ele... |
@customElement('windhappers-location')
export class WindhappersLocation extends LitElement {
static styles = [ | random_line_split |
windhappers-location.ts | import './components/xsystems-google-maps.js';
import './windhappers-notification.js';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { windhappersStyles } from './windhappers-styles.js';
@customElement('windhappers-location')
export class Windhappers... | () {
return html`
<xsystems-google-maps
key="AIzaSyDTj9__sWn_MKroJ6vlad1pCCidRBi6a5g"
latitude="52.079124"
longitude="4.236238"
.markers=${this._markers}
></xsystems-google-maps>
<windhappers-notification type="info" removable>
De Windhappers is een Haagse ... | render | identifier_name |
corecd.py | #
# corecd.py
#
# Copyright (C) 2014 Fabio Erculiani
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program ... |
def __init__(self):
BaseInstallClass.__init__(self)
| from pyanaconda.sabayon.livecd import LiveCDCopyBackend
return LiveCDCopyBackend | identifier_body |
corecd.py | #
# corecd.py
#
# Copyright (C) 2014 Fabio Erculiani
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program ... | (self):
from pyanaconda.sabayon.livecd import LiveCDCopyBackend
return LiveCDCopyBackend
def __init__(self):
BaseInstallClass.__init__(self)
| getBackend | identifier_name |
corecd.py | #
# corecd.py
#
# Copyright (C) 2014 Fabio Erculiani
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program ... | #
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from pyanaconda.installclass import BaseInstallClass
from pyanaconda.i18n import N_
from pyanaconda.sabayon import Entropy
class InstallClass(BaseInstallClass):
id = "s... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. | random_line_split |
keypad.rs | use sdl::event::Key;
pub struct Keypad {
keys: [bool; 16],
}
impl Keypad {
pub fn new() -> Keypad {
Keypad { keys: [false; 16] }
}
pub fn pressed(&mut self, index: usize) -> bool {
self.keys[index]
}
pub fn press(&mut self, key: Key, state: bool) {
match key {
... | Key::A => self.set_key(0x7, state),
Key::S => self.set_key(0x8, state),
Key::D => self.set_key(0x9, state),
Key::F => self.set_key(0xe, state),
Key::Z => self.set_key(0xa, state),
Key::X => self.set_key(0x0, state),
Key::C => self.set_k... | Key::R => self.set_key(0xd, state), | random_line_split |
keypad.rs | use sdl::event::Key;
pub struct Keypad {
keys: [bool; 16],
}
impl Keypad {
pub fn new() -> Keypad {
Keypad { keys: [false; 16] }
}
pub fn pressed(&mut self, index: usize) -> bool {
self.keys[index]
}
pub fn press(&mut self, key: Key, state: bool) |
fn set_key(&mut self, index: usize, state: bool) {
self.keys[index] = state;
}
}
| {
match key {
Key::Num1 => self.set_key(0x1, state),
Key::Num2 => self.set_key(0x2, state),
Key::Num3 => self.set_key(0x3, state),
Key::Num4 => self.set_key(0xc, state),
Key::Q => self.set_key(0x4, state),
Key::W => self.set_key(0x5, state)... | identifier_body |
keypad.rs | use sdl::event::Key;
pub struct Keypad {
keys: [bool; 16],
}
impl Keypad {
pub fn | () -> Keypad {
Keypad { keys: [false; 16] }
}
pub fn pressed(&mut self, index: usize) -> bool {
self.keys[index]
}
pub fn press(&mut self, key: Key, state: bool) {
match key {
Key::Num1 => self.set_key(0x1, state),
Key::Num2 => self.set_key(0x2, state),
... | new | identifier_name |
test_unit_cloudtrail.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import pytest
from reactor.aws.cloudtrail import traverse_map, CloudTrailEvent
def test_traverse_map():
d = {'x': ... | },
{
'accountId': '1234567890123',
'type': 'AWS::DynamoDB::Stream',
'ARN': 'arn:aws:dynamodb:us-east-1:123456789012:table/table_name/stream/2018-02-19T05:56:02.100'
}
],
'eventtype': 'AwsApiCall',
'managementeven... | 'ARN': 'arn:aws:lambda:us-east-1:998146006915:function:function-name' | random_line_split |
test_unit_cloudtrail.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import pytest
from reactor.aws.cloudtrail import traverse_map, CloudTrailEvent
def test_traverse_map():
|
def test_CloudTrailEvent():
raw_event = {'eventName': 'name',
'eventType': 'type',
'userIdentity': {'type': 'identity_type'}}
cte = CloudTrailEvent(raw_event)
assert cte.identity_type == 'identity_type'
assert cte.name == 'name'
assert cte.type == 'type'
# ... | d = {'x': {'x': 7},
'y': 8,
't': [{'t': 10}, {'b': 11}],
'z': {'z': {'z': 9}}}
m = {'x': {'x': 'x_field'},
'y': 'y_field',
't': {'t': 't_field'},
'z': {'z': {'z': 'z_field'}}}
realish_data = {
'eventversion': '1.06',
'useridentity': {
... | identifier_body |
test_unit_cloudtrail.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import pytest
from reactor.aws.cloudtrail import traverse_map, CloudTrailEvent
def | ():
d = {'x': {'x': 7},
'y': 8,
't': [{'t': 10}, {'b': 11}],
'z': {'z': {'z': 9}}}
m = {'x': {'x': 'x_field'},
'y': 'y_field',
't': {'t': 't_field'},
'z': {'z': {'z': 'z_field'}}}
realish_data = {
'eventversion': '1.06',
'useridentity':... | test_traverse_map | identifier_name |
en_ca.js | /*!
* froala_editor v1.1.8 (http://editor.froala.com)
* Copyright 2014-2014 Froala
*/
/**
* English spoken in Canada
*/
$.Editable.LANGS['en_ca'] = {
translation: {
"Bold": "Bold",
"Italic": "Italic",
"Underline": "Underline",
"Strikethrough": "Strikethrough",
"Font Size": "Font Size",
... | "Insert Video": "Insert Video",
"Undo": "Undo",
"Redo": "Redo",
"Show HTML": "Show HTML",
"Float Left": "Float Left",
"Float None": "Float None",
"Float Right": "Float Right",
"Replace Image": "Replace Image",
"Remove Image": "Remove Image",
"Title": "Title",
"Insert image": ... | "Select All": "Select All",
"Insert Link": "Insert Link",
"Insert Image": "Insert Image", | random_line_split |
allocate.rs | // Our use cases
use super::expander;
pub fn allocate_expander(par_eax: i32, par_edx: i32) -> expander::SoundExpander {
let mut sound_expander = expander::SoundExpander::new();
let mut par_eax = par_eax;
let mut par_edx = par_edx;
sound_expander.wave_format_ex.format_tag = expander::WAVE_FORMAT_PCM as... | sound_expander.memb_5C = 1;
sound_expander.memb_4C = 0x7FFF;
sound_expander.memb_54 = 0;
sound_expander.previous = Box::new(expander::SoundExpander::new());
sound_expander.next = Box::new(expander::SoundExpander::new());
sound_expander
}
pub fn allocate_sound(par_ecx: i32, par_ebx: i32) -> ex... | random_line_split | |
allocate.rs | // Our use cases
use super::expander;
pub fn | (par_eax: i32, par_edx: i32) -> expander::SoundExpander {
let mut sound_expander = expander::SoundExpander::new();
let mut par_eax = par_eax;
let mut par_edx = par_edx;
sound_expander.wave_format_ex.format_tag = expander::WAVE_FORMAT_PCM as u16;
sound_expander.wave_format_ex.channels = 1;
if 8... | allocate_expander | identifier_name |
allocate.rs | // Our use cases
use super::expander;
pub fn allocate_expander(par_eax: i32, par_edx: i32) -> expander::SoundExpander {
let mut sound_expander = expander::SoundExpander::new();
let mut par_eax = par_eax;
let mut par_edx = par_edx;
sound_expander.wave_format_ex.format_tag = expander::WAVE_FORMAT_PCM as... | {
let mut edx = 0x0A;
let mut eax = 0;
match par_ebx {
0x0D => eax = 1,
0x0E => eax = 2,
_ => eax = 0,
}
match par_ecx {
0x0F => eax = eax | 4,
_ => edx = edx | 0x20,
}
allocate_expander(eax, edx)
} | identifier_body | |
de.rs | use serde::{Deserialize, Deserializer};
use serde_derive::Deserialize;
use tera::{Map, Value};
/// Used as an attribute when we want to convert from TOML to a string date
/// If a TOML datetime isn't present, it will accept a string and push it through
/// TOML's date time parser to ensure only valid dates are accepte... | {
Datetime(toml::value::Datetime),
String(String),
}
match MaybeDatetime::deserialize(deserializer)? {
MaybeDatetime::Datetime(d) => Ok(Some(d.to_string())),
MaybeDatetime::String(s) => match toml::value::Datetime::from_str(&s) {
Ok(d) => Ok(Some(d.to_string())),
... | MaybeDatetime | identifier_name |
de.rs | use serde::{Deserialize, Deserializer};
use serde_derive::Deserialize;
use tera::{Map, Value};
/// Used as an attribute when we want to convert from TOML to a string date
/// If a TOML datetime isn't present, it will accept a string and push it through
/// TOML's date time parser to ensure only valid dates are accepte... | new.insert(key, Value::Array(new_arr));
}
_ => {
new.insert(key, value);
}
}
}
Value::Object(new)
} | random_line_split | |
errhandlingapi.rs | // Copyright © 2015-2017 winapi-rs developers
// 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.
// All files in the project carrying such notice may not be copied,... | ) -> LONG;
pub fn SetUnhandledExceptionFilter(
lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER,
) -> LPTOP_LEVEL_EXCEPTION_FILTER;
pub fn GetLastError() -> DWORD;
pub fn SetLastError(
dwErrCode: DWORD,
);
pub fn GetErrorMode() -> UINT;
pub fn SetErrorMode(
... | nNumberOfArguments: DWORD,
lpArguments: *const ULONG_PTR,
);
pub fn UnhandledExceptionFilter(
ExceptionInfo: *mut EXCEPTION_POINTERS, | random_line_split |
ballAIComponent.py | '''
Created on Oct 30, 2014
@author: Arrington
'''
from pyHopeEngine import engineCommon as ECOM
from pyHopeEngine.actors.components.aiComponent import AIComponent
from superPong.actors.ballAI.ballProcesses.ballChooseStateProcess import BallChooseStateProcess
from superPong.actors.ballAI.pongBallBrain import MainBall... |
if state is not None:
self.setState(state)
def update(self):
if self.currentState is not None:
self.currentState.update()
def cleanUp(self):
super().cleanUp()
self.brain.cleanUp()
self.brain = None
self.curren... | random_line_split | |
ballAIComponent.py | '''
Created on Oct 30, 2014
@author: Arrington
'''
from pyHopeEngine import engineCommon as ECOM
from pyHopeEngine.actors.components.aiComponent import AIComponent
from superPong.actors.ballAI.ballProcesses.ballChooseStateProcess import BallChooseStateProcess
from superPong.actors.ballAI.pongBallBrain import MainBall... | super().cleanUp()
self.brain.cleanUp()
self.brain = None
self.currentState.cleanUp()
self.currentState = None
self.chooseStateProcess.succeed()
self.chooseStateProcess = None | identifier_body | |
ballAIComponent.py | '''
Created on Oct 30, 2014
@author: Arrington
'''
from pyHopeEngine import engineCommon as ECOM
from pyHopeEngine.actors.components.aiComponent import AIComponent
from superPong.actors.ballAI.ballProcesses.ballChooseStateProcess import BallChooseStateProcess
from superPong.actors.ballAI.pongBallBrain import MainBall... | (AIComponent):
def __init__(self):
super().__init__()
self.currentState = None
self.brain = None
self.chooseStateProcess = None
def init(self, element):
brainElement = element.find("Brain")
self.setBrain(brainElement.text)
self.chooseStateProcess = Ba... | BallAIComponent | identifier_name |
ballAIComponent.py | '''
Created on Oct 30, 2014
@author: Arrington
'''
from pyHopeEngine import engineCommon as ECOM
from pyHopeEngine.actors.components.aiComponent import AIComponent
from superPong.actors.ballAI.ballProcesses.ballChooseStateProcess import BallChooseStateProcess
from superPong.actors.ballAI.pongBallBrain import MainBall... |
elif name == "BasicBallBrain":
self.brain = BasicBallBrain()
def setState(self, state):
self.currentState.cleanUp()
self.currentState = state(self.owner)
self.currentState.init()
def chooseState(self):
if self.brain is not None:
state = ... | self.brain = MainBallBrain() | conditional_block |
atmega328p.rs | use chips;
use io;
pub struct Chip;
impl chips::Chip for Chip
{
fn flash_size() -> usize {
32 * 1024 // 32 KB
}
fn memory_size() -> usize {
2 * 1024 // 2KB
}
fn io_ports() -> Vec<io::Port> |
}
| {
vec![
io::Port::new(0x03), // PINB
io::Port::new(0x04), // DDRB
io::Port::new(0x05), // PORTB
io::Port::new(0x06), // PINC
io::Port::new(0x07), // DDRC
io::Port::new(0x08), // PORTC
io::Port::new(0x09), // PIND
i... | identifier_body |
atmega328p.rs | use chips;
use io;
pub struct Chip;
impl chips::Chip for Chip
{
fn flash_size() -> usize {
32 * 1024 // 32 KB
}
fn | () -> usize {
2 * 1024 // 2KB
}
fn io_ports() -> Vec<io::Port> {
vec![
io::Port::new(0x03), // PINB
io::Port::new(0x04), // DDRB
io::Port::new(0x05), // PORTB
io::Port::new(0x06), // PINC
io::Port::new(0x07), // DDRC
io::P... | memory_size | identifier_name |
atmega328p.rs | use chips;
use io;
pub struct Chip;
| {
fn flash_size() -> usize {
32 * 1024 // 32 KB
}
fn memory_size() -> usize {
2 * 1024 // 2KB
}
fn io_ports() -> Vec<io::Port> {
vec![
io::Port::new(0x03), // PINB
io::Port::new(0x04), // DDRB
io::Port::new(0x05), // PORTB
io... | impl chips::Chip for Chip | random_line_split |
context.rs | use std::collections::BTreeMap;
use std::fmt;
use std::sync::Arc;
use num::BigRational;
use lang::Filter;
#[derive(Clone, Debug)]
pub enum PrecedenceGroup {
AndThen,
Circumfix
}
#[derive(Clone)]
pub struct Context {
/// A function called each time the parser constructs a new filter anywhere in the synta... | (&self, w: &mut fmt::Formatter) -> fmt::Result {
write!(w, "Context {{ filter_allowed: [Fn(&Filter) -> bool], operators: {:?} }}", self.operators)
}
}
| fmt | identifier_name |
context.rs | use std::collections::BTreeMap;
use std::fmt;
use std::sync::Arc;
use num::BigRational;
use lang::Filter;
#[derive(Clone, Debug)]
pub enum PrecedenceGroup {
AndThen,
Circumfix
}
#[derive(Clone)]
pub struct Context {
/// A function called each time the parser constructs a new filter anywhere in the synta... | } |
impl fmt::Debug for Context {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
write!(w, "Context {{ filter_allowed: [Fn(&Filter) -> bool], operators: {:?} }}", self.operators)
} | random_line_split |
teal.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.teal
~~~~~~~~~~~~~~~~~~~~
Lexer for TEAL.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import Comment, ... | """
For the `Transaction Execution Approval Language (TEAL)
<https://developer.algorand.org/docs/reference/teal/specification/>`
For more information about the grammar, see:
https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go
.. versionadded:: 2.9
"""
n... | identifier_body | |
teal.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.teal
~~~~~~~~~~~~~~~~~~~~
Lexer for TEAL.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import Comment, ... | (RegexLexer):
"""
For the `Transaction Execution Approval Language (TEAL)
<https://developer.algorand.org/docs/reference/teal/specification/>`
For more information about the grammar, see:
https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go
.. versionadded::... | TealLexer | identifier_name |
teal.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.teal
~~~~~~~~~~~~~~~~~~~~
Lexer for TEAL.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import Comment, ... | 'Lease', 'Receiver', 'Amount', 'CloseRemainderTo', 'VotePK',
'SelectionPK', 'VoteFirst', 'VoteLast', 'VoteKeyDilution', 'Type',
'TypeEnum', 'XferAsset', 'AssetAmount', 'AssetSender', 'AssetReceiver',
'AssetCloseTo', 'GroupIndex', 'TxID', 'ApplicationID', 'OnCompletion',
'Applicat... | filenames = ['*.teal']
keywords = words({
'Sender', 'Fee', 'FirstValid', 'FirstValidTime', 'LastValid', 'Note', | random_line_split |
mod.rs | extern crate time;
extern crate slog;
extern crate slog_term;
extern crate slog_envlogger;
extern crate slog_stdlog;
pub mod replica;
pub mod api_server;
pub mod messages;
use std::thread::{self, JoinHandle};
use std::net::TcpStream;
use amy::{Poller, Receiver, Sender};
use self::slog::DrainExt;
use self::time::{Stea... | while let Ok(envelope) = test_rx.try_recv() {
assert_matches!(envelope.msg, Msg::ClusterStatus(_));
}
break;
}
}
}
} | let notifications = poller.wait(10).unwrap();
if notifications.len() != 0 {
// We have registered, otherwise we wouldn't have gotten a response
// Let's drain the receiver, because we may have returned from a previous poll
// before the previous Cl... | random_line_split |
mod.rs | extern crate time;
extern crate slog;
extern crate slog_term;
extern crate slog_envlogger;
extern crate slog_stdlog;
pub mod replica;
pub mod api_server;
pub mod messages;
use std::thread::{self, JoinHandle};
use std::net::TcpStream;
use amy::{Poller, Receiver, Sender};
use self::slog::DrainExt;
use self::time::{Stea... |
#[allow(dead_code)] // Not used in all tests
pub fn start_nodes(n: usize) -> (Vec<Node<RabbleUserMsg>>, Vec<JoinHandle<()>>) {
let term = slog_term::streamer().build();
let drain = slog_envlogger::LogBuilder::new(term)
.filter(None, slog::FilterLevel::Debug).build();
let root_logger = slog::Logger... | {
(1..n + 1).map(|n| {
NodeId {
name: format!("node{}", n),
addr: format!("127.0.0.1:1100{}", n)
}
}).collect()
} | identifier_body |
mod.rs | extern crate time;
extern crate slog;
extern crate slog_term;
extern crate slog_envlogger;
extern crate slog_stdlog;
pub mod replica;
pub mod api_server;
pub mod messages;
use std::thread::{self, JoinHandle};
use std::net::TcpStream;
use amy::{Poller, Receiver, Sender};
use self::slog::DrainExt;
use self::time::{Stea... | <F>(timeout: Duration, mut f: F) -> bool
where F: FnMut() -> bool
{
let sleep_time = Duration::milliseconds(10);
let start = SteadyTime::now();
while let false = f() {
thread::sleep(sleep_time.to_std().unwrap());
if SteadyTime::now() - start > timeout {
return false;
... | wait_for | identifier_name |
mod.rs | extern crate time;
extern crate slog;
extern crate slog_term;
extern crate slog_envlogger;
extern crate slog_stdlog;
pub mod replica;
pub mod api_server;
pub mod messages;
use std::thread::{self, JoinHandle};
use std::net::TcpStream;
use amy::{Poller, Receiver, Sender};
use self::slog::DrainExt;
use self::time::{Stea... |
// Just busy wait instead of using a poller in this test.
assert_eq!(true, wait_for(Duration::seconds(5), || {
// We don't know if it's writable, but we want to actually try the write
serializer.set_writable();
match serializer.write_msgs(sock, None) {
Ok(true) => true,
... | {
return;
} | conditional_block |
query.ts | 'use strict';
import * as path from 'path';
import { readFileSync } from 'fs';
import { Router, Request, Response } from 'express';
import { $, Expression, External, Datum, Dataset, TimeRange, basicExecutorFactory, Executor, AttributeJSs, helper } from 'plywood';
import { druidRequesterFactory } from 'plywood-druid-re... | (filename: string): any[] {
var filePath = path.join(__dirname, '../../../../', filename);
var fileData: string = null;
try {
fileData = readFileSync(filePath, 'utf-8');
} catch (e) {
console.log('could not find', filePath);
process.exit(1);
}
var fileJSON: any[] = null;
if (fileData[0] === '... | getFileData | identifier_name |
query.ts | 'use strict';
import * as path from 'path';
import { readFileSync } from 'fs';
import { Router, Request, Response } from 'express';
import { $, Expression, External, Datum, Dataset, TimeRange, basicExecutorFactory, Executor, AttributeJSs, helper } from 'plywood';
import { druidRequesterFactory } from 'plywood-druid-re... | for (var freeReference of freeReferences) {
if (freeReference === 'main') continue;
if (JSON.stringify(expression).indexOf('countDistinct') !== -1) {
attributes[freeReference] = { special: 'unique' };
} else {
attributes[freeReference] = { type: 'NUMBER' };
}
}
}
// M... |
for (var measure of dataSource.measures) {
var expression = measure.expression ? Expression.fromJSLoose(measure.expression) : $(measure.name);
var freeReferences = expression.getFreeReferences(); | random_line_split |
query.ts | 'use strict';
import * as path from 'path';
import { readFileSync } from 'fs';
import { Router, Request, Response } from 'express';
import { $, Expression, External, Datum, Dataset, TimeRange, basicExecutorFactory, Executor, AttributeJSs, helper } from 'plywood';
import { druidRequesterFactory } from 'plywood-druid-re... |
function makeExternal(dataSource: any): External {
var attributes: AttributeJSs = {};
// Right here we have the classic mega hack.
for (var dimension of dataSource.dimensions) {
attributes[dimension.name] = { type: dimension.type || 'STRING' };
}
for (var measure of dataSource.measures) {
var expr... | {
var filePath = path.join(__dirname, '../../../../', filename);
var fileData: string = null;
try {
fileData = readFileSync(filePath, 'utf-8');
} catch (e) {
console.log('could not find', filePath);
process.exit(1);
}
var fileJSON: any[] = null;
if (fileData[0] === '[') {
try {
file... | identifier_body |
sets-test.ts | /*
Copyright 2021 The Matrix.org Foundation C.I.C.
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 ... |
describe('sets', () => {
describe('setHasDiff', () => {
it('should flag true on A length > B length', () => {
const a = new Set([1, 2, 3, 4]);
const b = new Set([1, 2, 3]);
const result = setHasDiff(a, b);
expect(result).toBe(true);
});
it('s... | random_line_split | |
settings.py | # Django settings for celery_http_gateway project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
CARROT_BACKEND = "amqp"
CELERY_RESULT_BACKEND = "database"
BROKER_HOST = "localhost"
BROKER_VHOST = "/"
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
... | # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
... | DATABASE_HOST = ''
# Set to empty string for default. Not used with sqlite3.
DATABASE_PORT = ''
| random_line_split |
conrod.rs | extern crate lazybox_graphics as graphics;
extern crate lazybox_frameclock as frameclock;
#[macro_use] extern crate conrod;
extern crate glutin;
extern crate cgmath;
extern crate rayon;
use graphics::Graphics;
use graphics::combined::conrod::Renderer;
use graphics::types::ColorFormat;
use conrod::widget;
us... | {
let builder = WindowBuilder::new()
.with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGl, (2, 1)))
.with_title("Conrod".to_string())
.with_dimensions(512, 512);
let (window, mut graphics) = Graphics::new(builder);
let mut renderer = Renderer::new(window.hidpi_factor(), &... | identifier_body | |
conrod.rs | extern crate lazybox_graphics as graphics;
extern crate lazybox_frameclock as frameclock;
#[macro_use] extern crate conrod;
extern crate glutin;
extern crate cgmath;
extern crate rayon;
use graphics::Graphics;
use graphics::combined::conrod::Renderer;
use graphics::types::ColorFormat;
use conrod::widget;
us... |
}
{
let mut ui = &mut ui.set_widgets();
use conrod::{Colorable, Positionable, Sizeable, Widget};
widget::Canvas::new().color(conrod::color::DARK_CHARCOAL).set(ids.canvas, ui);
let demo_text = "Lorem ipsum dolor sit amet, consectetur adipiscing... | {
ui.handle_event(event);
} | conditional_block |
conrod.rs | extern crate lazybox_graphics as graphics;
extern crate lazybox_frameclock as frameclock;
#[macro_use] extern crate conrod;
extern crate glutin;
extern crate cgmath;
extern crate rayon;
use graphics::Graphics;
use graphics::combined::conrod::Renderer;
use graphics::types::ColorFormat;
use conrod::widget;
us... | let delta_time = frameclock.reset();
if let Some(fps_sample) = fps_counter.update(delta_time) {
mspf = 1000. / fps_sample;
fps = fps_sample as u32;
}
for event in window.poll_events() {
match event {
Event::KeyboardInput(_, _, ... | let mut fps = 0;
'main: loop {
| random_line_split |
conrod.rs | extern crate lazybox_graphics as graphics;
extern crate lazybox_frameclock as frameclock;
#[macro_use] extern crate conrod;
extern crate glutin;
extern crate cgmath;
extern crate rayon;
use graphics::Graphics;
use graphics::combined::conrod::Renderer;
use graphics::types::ColorFormat;
use conrod::widget;
us... | () {
let builder = WindowBuilder::new()
.with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGl, (2, 1)))
.with_title("Conrod".to_string())
.with_dimensions(512, 512);
let (window, mut graphics) = Graphics::new(builder);
let mut renderer = Renderer::new(window.hidpi_factor()... | main | identifier_name |
pixi-filters.d.ts | /// <reference path="./../../node_modules/pixi-typescript/pixi.js.d.ts" />
// Type definitions for pixi-filters
// Project: https://github.com/pixijs/pixi-filters
// Definitions by: bigtimebuddy <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "... | extends PIXI.Filter {
size: number;
}
export class BloomFilter extends PIXI.Filter {
blur: number;
blurX: number;
blurY: number;
}
export class ConvolutionFilter extends PIXI.Filter {
constructor(matrix: number[], width:number, height: number);
hei... | AsciiFilter | identifier_name |
pixi-filters.d.ts | /// <reference path="./../../node_modules/pixi-typescript/pixi.js.d.ts" />
// Type definitions for pixi-filters
// Project: https://github.com/pixijs/pixi-filters
// Definitions by: bigtimebuddy <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "... |
export class TiltShiftAxisFilter extends PIXI.Filter {
blur:number;
end:PIXI.Point;
gradientBlur:number;
start:PIXI.Point;
updateDelta(): void;
}
export class TiltShiftFilter extends PIXI.Filter {
tiltShiftXFilter:TiltShiftXFilter;
tiltShiftYFilter... | random_line_split | |
mkfifo.rs | #![crate_name = "mkfifo"]
#![feature(macro_rules)]
/*
* This file is part of the uutils coreutils package.
*
* (c) Michael Gehring <mg@ebfe.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate l... | println!("");
println!("Usage:");
println!(" {} [OPTIONS] NAME...", NAME);
println!("");
print!("{}", getopts::usage("Create a FIFO with the given name.", opts.as_slice()).as_slice());
if matches.free.is_empty() {
return 1;
}
return 0;
}
... |
if matches.opt_present("help") || matches.free.is_empty() {
println!("{} {}", NAME, VERSION); | random_line_split |
mkfifo.rs | #![crate_name = "mkfifo"]
#![feature(macro_rules)]
/*
* This file is part of the uutils coreutils package.
*
* (c) Michael Gehring <mg@ebfe.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate l... | (args: Vec<String>) -> int {
let opts = [
getopts::optopt("m", "mode", "file permissions for the fifo", "(default 0666)"),
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match get... | uumain | identifier_name |
mkfifo.rs | #![crate_name = "mkfifo"]
#![feature(macro_rules)]
/*
* This file is part of the uutils coreutils package.
*
* (c) Michael Gehring <mg@ebfe.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate l... |
let mode = match matches.opt_str("m") {
Some(m) => match FromStrRadix::from_str_radix(m.as_slice(), 8) {
Some(m) => m,
None => {
show_error!("invalid mode");
return 1;
}
},
None => 0o666,
};
let mut exit_status = ... | {
println!("{} {}", NAME, VERSION);
println!("");
println!("Usage:");
println!(" {} [OPTIONS] NAME...", NAME);
println!("");
print!("{}", getopts::usage("Create a FIFO with the given name.", opts.as_slice()).as_slice());
if matches.free.is_empty() {
r... | conditional_block |
mkfifo.rs | #![crate_name = "mkfifo"]
#![feature(macro_rules)]
/*
* This file is part of the uutils coreutils package.
*
* (c) Michael Gehring <mg@ebfe.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate l... | {
let opts = [
getopts::optopt("m", "mode", "file permissions for the fifo", "(default 0666)"),
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), ... | identifier_body | |
default.py | import sys, xbmcplugin, xbmcgui,xbmc
_id = "plugin.video.italian-news"
_resdir = "special://home/addons/" + _id + "/resources"
_thisPlugin = int(sys.argv[1])
_icons = _resdir + "/icons/"
sys.path.append( xbmc.translatePath(_resdir + "/lib/"))
import rai
_tg1Icon=xbmc.translatePath(_icons +"Tg1_logo.png")
_tg2Icon=xb... |
else:
for n in sorted(plugins.iterkeys()):
(engine, title, icon)=plugins[n]
print title
_addItem(title,sys.argv[0]+'?plugin='+n,icon,isFolder=True)
xbmcplugin.endOfDirectory(_thisPlugin)
#for (name,url,icon) in tg1:
# _addItem(name,url,icon)
#xbmcplugin.endOfDirectory(_thisPlugi... | (engine, title, eicon)=plugins[param['plugin']]
for (name,url,icon) in engine().get():
if icon == '':
icon = eicon
_addItem(name,url,icon)
xbmcplugin.endOfDirectory(_thisPlugin) | conditional_block |
default.py | import sys, xbmcplugin, xbmcgui,xbmc
_id = "plugin.video.italian-news"
_resdir = "special://home/addons/" + _id + "/resources"
_thisPlugin = int(sys.argv[1])
_icons = _resdir + "/icons/"
sys.path.append( xbmc.translatePath(_resdir + "/lib/"))
import rai
_tg1Icon=xbmc.translatePath(_icons +"Tg1_logo.png")
_tg2Icon=xb... | ():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}... | _get_params | identifier_name |
default.py | import sys, xbmcplugin, xbmcgui,xbmc
_id = "plugin.video.italian-news"
_resdir = "special://home/addons/" + _id + "/resources"
_thisPlugin = int(sys.argv[1])
_icons = _resdir + "/icons/"
sys.path.append( xbmc.translatePath(_resdir + "/lib/"))
import rai |
_tg1Icon=xbmc.translatePath(_icons +"Tg1_logo.png")
_tg2Icon=xbmc.translatePath(_icons +"Tg2_logo.png")
_tg3Icon=xbmc.translatePath(_icons +"Tg3_logo.png")
def _addItem(label,uri,icon,isFolder=False):
item = xbmcgui.ListItem(label, iconImage=icon)
xbmcplugin.addDirectoryItem(_thisPlugin,uri,item,isFolder)
de... | random_line_split | |
default.py | import sys, xbmcplugin, xbmcgui,xbmc
_id = "plugin.video.italian-news"
_resdir = "special://home/addons/" + _id + "/resources"
_thisPlugin = int(sys.argv[1])
_icons = _resdir + "/icons/"
sys.path.append( xbmc.translatePath(_resdir + "/lib/"))
import rai
_tg1Icon=xbmc.translatePath(_icons +"Tg1_logo.png")
_tg2Icon=xb... |
def _get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
... | item = xbmcgui.ListItem(label, iconImage=icon)
xbmcplugin.addDirectoryItem(_thisPlugin,uri,item,isFolder) | identifier_body |
visible-private-types-generics.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT | // <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.
trait Foo {
fn dummy(&self) { }
}
pub fn f<
T
: Foo //~ ERROR private trait in exported type parameter bound
>() {}
pub fn g<T>() where
... | // 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 | random_line_split |
visible-private-types-generics.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 ... | <
T
: Foo //~ ERROR private trait in exported type parameter bound
> {
x: T
}
pub struct S2<T> where
T
: Foo //~ ERROR private trait in exported type parameter bound
{
x: T
}
pub enum E1<
T
: Foo //~ ERROR private trait in exported type parameter bound
> {
V1(T)
}
pub enum E2<T> w... | S1 | identifier_name |
index.esm.js | /**
* @license
* Copyright 2017 Google 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 applica... | case LogLevel.WARN:
console.warn.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args));
break;
case LogLevel.ERROR:
console.error.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args));
break;
default:
... | random_line_split | |
index.esm.js | /**
* @license
* Copyright 2017 Google 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 applica... |
this._logHandler.apply(this, [this, LogLevel.DEBUG].concat(args));
};
Logger.prototype.log = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this._logHandler.apply(this, [this, LogLevel.VERBOSE]... | {
args[_i] = arguments[_i];
} | conditional_block |
index.esm.js | /**
* @license
* Copyright 2017 Google 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 applica... | (name) {
this.name = name;
/**
* The log level of the given Logger instance.
*/
this._logLevel = defaultLogLevel;
/**
* The log handler for the Logger instance.
*/
this._logHandler = defaultLogHandler;
/**
* Capture ... | Logger | identifier_name |
index.esm.js | /**
* @license
* Copyright 2017 Google 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 applica... |
export { setLogLevel, Logger, LogLevel };
| {
instances.forEach(function (inst) {
inst.logLevel = level;
});
} | identifier_body |
index.js | #!/usr/bin/env node
/**
* Created by Keith Morris on 11/10/14.
*/
const fs = require('fs'),
hyperquest = require('hyperquest'),
promptUser = require('./lib/prompt-user'),
qs = require('querystring'),
unzip = require('adm-zip'),
yargs = require('yargs');
const url = "https://underscores.me/";
con... | .example('$0', "you will be prompted for everything")
.example('$0 -n "My Great Theme"', 'You will be prompted for everything but the name of the theme.')
.alias('name', 'n')
.describe('name', 'The name of your theme.')
.alias('description', 'd')
.describe('description', 'The theme\'s descriptio... | .usage("Run underscores without command line arguments and you will be prompted for all options. " +
"Otherwise, run underscores with arguments to specify one or more options at the command prompt.") | random_line_split |
set-barcode-image-height-width-quality-settings.py | import asposebarcodecloud
from asposebarcodecloud.BarcodeApi import BarcodeApi
from asposebarcodecloud.BarcodeApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
import ConfigParser
config = Config... |
except ApiException as ex:
print "ApiException:"
print "Code:" + str(ex.code)
print "Message:" + ex.message
#ExEnd:1 | response = storageApi.GetDownload(Path=name)
outfilename = out_folder + name + "." + format
with open(outfilename, 'wb') as f:
for chunk in response.InputStream:
f.write(chunk) | conditional_block |
set-barcode-image-height-width-quality-settings.py | import asposebarcodecloud
from asposebarcodecloud.BarcodeApi import BarcodeApi
from asposebarcodecloud.BarcodeApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
import ConfigParser
config = Config... | storage_apiClient = asposestoragecloud.ApiClient.ApiClient(apiKey, appSid, True)
storageApi = StorageApi(storage_apiClient)
#Instantiate Aspose Barcode API SDK
api_client = asposebarcodecloud.ApiClient.ApiClient(apiKey, appSid, True)
barcodeApi = BarcodeApi(api_client);
#Set the barcode file name created on serv... | data_folder = "../../data/" #resouece data folder
#ExStart:1
#Instantiate Aspose Storage API SDK
| random_line_split |
baseConfig.js | var UIconfig = require('../vue/UIconfig');
var config = {};
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// GENERAL SETTINGS
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
config.silent = false;
config.debug = true;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | }
config.importer = {
daterange: {
// NOTE: these dates are in UTC
from: "2016-06-01 12:00:00"
}
}
module.exports = config; | config.backtest = {
daterange: 'scan',
batchSize: 50 | random_line_split |
ip_utils.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
#[test]
fn can_select_public_address() {
let pub_address = select_public_address(40477);
assert!(pub_address.port() == 40477);
}
#[ignore]
#[test]
fn can_map_external_address_or_fail() {
let pub_address = select_public_address(40478);
let _ = map_external_address(&NodeEndpoint { address: pub_address, udp_port: 4... | {
if let SocketAddr::V4(ref local_addr) = local.address {
match search_gateway_from_timeout(local_addr.ip().clone(), Duration::new(5, 0)) {
Err(ref err) => debug!("Gateway search error: {}", err),
Ok(gateway) => {
match gateway.get_external_ip() {
Err(ref err) => {
debug!("IP request error: {}",... | identifier_body |
ip_utils.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | for addr in &list { //TODO: use better criteria than just the first in the list
match *addr {
IpAddr::V4(a) if !a.is_unspecified_s() && !a.is_loopback() && !a.is_link_local() => {
return SocketAddr::V4(SocketAddrV4::new(a, port));
},
_ => {},
}
}
for addr in list {
match addr {... | pub fn select_public_address(port: u16) -> SocketAddr {
match get_if_addrs() {
Ok(list) => {
//prefer IPV4 bindings | random_line_split |
ip_utils.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | ,
}
}
None
}
#[test]
fn can_select_public_address() {
let pub_address = select_public_address(40477);
assert!(pub_address.port() == 40477);
}
#[ignore]
#[test]
fn can_map_external_address_or_fail() {
let pub_address = select_public_address(40478);
let _ = map_external_address(&NodeEndpoint { address: pub_addr... | {
match gateway.get_external_ip() {
Err(ref err) => {
debug!("IP request error: {}", err);
},
Ok(external_addr) => {
match gateway.add_any_port(PortMappingProtocol::TCP, SocketAddrV4::new(local_addr.ip().clone(), local_addr.port()), 0, "Parity Node/TCP") {
Err(ref err) => {
... | conditional_block |
ip_utils.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | () {
let pub_address = select_public_address(40477);
assert!(pub_address.port() == 40477);
}
#[ignore]
#[test]
fn can_map_external_address_or_fail() {
let pub_address = select_public_address(40478);
let _ = map_external_address(&NodeEndpoint { address: pub_address, udp_port: 40478 });
}
#[test]
fn ipv4_properties... | can_select_public_address | identifier_name |
migration.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # NOTE(danms): Migration was at 1.1 before we added this
'1.1': '1.1',
}
@base.remotable_classmethod
def get_unconfirmed_by_dest_compute(cls, context, confirm_window,
dest_compute, use_slave=False):
db_migrations = db.migration_get_unconfi... | 'objects': fields.ListOfObjectsField('Migration'),
}
child_versions = {
'1.0': '1.1', | random_line_split |
migration.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | (cls, context, filters):
db_migrations = db.migration_get_all_by_filters(context, filters)
return base.obj_make_list(context, cls(context), objects.Migration,
db_migrations)
| get_by_filters | identifier_name |
migration.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
@base.remotable_classmethod
def get_in_progress_by_host_and_node(cls, context, host, node):
db_migrations = db.migration_get_in_progress_by_host_and_node(
context, host, node)
return base.obj_make_list(context, cls(context), objects.Migration,
db_m... | db_migrations = db.migration_get_unconfirmed_by_dest_compute(
context, confirm_window, dest_compute, use_slave=use_slave)
return base.obj_make_list(context, cls(context), objects.Migration,
db_migrations) | identifier_body |
migration.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
updates = self.obj_get_changes()
db_migration = db.migration_create(self._context, updates)
self._from_db_object(self._context, self, db_migration)
@base.remotable
def save(self):
updates = self.obj_get_changes()
updates.pop('id', None)
db_migration = db.migrati... | raise exception.ObjectActionError(action='create',
reason='already created') | conditional_block |
genesis.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | /// Timestamp.
pub timestamp: u64,
/// Parent hash.
pub parent_hash: H256,
/// Gas limit.
pub gas_limit: U256,
/// Transactions root.
pub transactions_root: H256,
/// Receipts root.
pub receipts_root: H256,
/// State root.
pub state_root: Option<H256>,
/// Gas used.
pub gas_used: U256,
/// Extra data.
p... | /// Author.
pub author: Address, | random_line_split |
genesis.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | {
/// Seal.
pub seal: Seal,
/// Difficulty.
pub difficulty: U256,
/// Author.
pub author: Address,
/// Timestamp.
pub timestamp: u64,
/// Parent hash.
pub parent_hash: H256,
/// Gas limit.
pub gas_limit: U256,
/// Transactions root.
pub transactions_root: H256,
/// Receipts root.
pub receipts_root: H25... | Genesis | identifier_name |
accept_language.rs | use language_tags::LanguageTag;
use header::QualityItem;
header! {
/// `Accept-Language` header, defined in
/// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.5)
///
/// The `Accept-Language` header field can be used by user agents to
/// indicate the set of natural languages that are pre... | /// # fn main() {
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptLanguage(vec![
/// qitem(langtag!(da)),
/// QualityItem::new(langtag!(en;;;GB), Quality(800)),
/// QualityItem::new(langtag!(en), Quality(700)),
/// ])
/// );
/// # ... | /// # | random_line_split |
main.rs | // Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | (fname: String) -> MmapMut {
use std::fs::OpenOptions;
let file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.open(&fname)
.expect("failed to open file");
file.set_len((NSAMPLES * NN * 8) as u64)
.expect("failed to set length");
return uns... | ropen | identifier_name |
main.rs | // Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | }
}
let end = jumble(buffer);
for i in 0..NN {
for k in 0..8 {
endb[j * NN * 8 + i * 8 + k] = (end[i] >> k * 8) as u8;
}
}
}
startb.flush().expect("failed to flush");
endb.flush().expect("failed to flush");
} | for k in 0..8 {
startb[j * NN * 8 + i * 8 + k] = (buffer[i] >> k * 8) as u8; | random_line_split |
main.rs | // Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
}
return state;
}
use std::fs::File;
use std::io::prelude::*;
use memmap::MmapMut;
fn ropen(fname: String) -> MmapMut {
use std::fs::OpenOptions;
let file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.open(&fname)
.expect("failed to open file")... | {
state[0] ^= state[NN - 1];
i = 1;
} | conditional_block |
main.rs | // Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | {
let mut rng = thread_rng();
let mut startb = ropen("start".to_string());
let mut endb = ropen("end".to_string());
for j in 0..NSAMPLES {
if j % 100 == 0 {
println!("{:?}", j);
}
let mut buffer = [0u64; NN];
for i in 0..NN {
buffer[i] = rng.next_u... | identifier_body | |
Indexer.py | #! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... | def getDocumentOfQuery(self,query):
return self.invertedIndex.get(query,[])
def getDocumentOfId(self,id):
return self.forwardIndex.get(id,[])
def getUrl(self,id): # here we load all data from files thus the type is string !
return self.idToUrl[str(id)]
class Searcher():
def __init__(self,indexDir,imp... | self.invertedIndex=pickleLoadFromFile("inverted")
self.idToUrl=pickleLoadFromFile("idToUrl")
self.forwardIndex=pickleLoadFromFile("forward")
| random_line_split |
Indexer.py | #! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... |
except Exception as e:
logging.exception(e)
openFile.close()
indexer.finishIndexer()
def main():
logging.getLogger().setLevel(logging.INFO)
parser = argparse.ArgumentParser(description = "Index/r/learnprogramming")
parser.add_argument("--storedDocumentDir", dest = "storedDocumentDir", required= True)
pars... | logging.info(u"Indexed {} documents".format(indexCount)) | conditional_block |
Indexer.py | #! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... |
class MemoryIndexer():
def __init__(self):
self.invertedIndex = defaultdict(list)
self.forwardIndex = dict()
self.idToUrl = dict() #url is too long
self.docCount =0
# TOdo: remove this assumptions
# assumes that adddocument () is never called twice for a document
# assumes that a document has an un... | return self.idToUrl[str(id)] | identifier_body |
Indexer.py | #! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... | (self,id): # here we load all data from files thus the type is string !
return self.idToUrl[str(id)]
class Searcher():
def __init__(self,indexDir,implemention=ShelveIndexer):
self.index = implemention()
self.index.loadIndexer(indexDir)
def findDocument_AND(self,queryStr):
documentIdList = defaultdict(... | getUrl | identifier_name |
driver_listener.py | # Copyright 2018 Rackspace, US Inc.
# Copyright 2019 Red Hat, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
def stats_listener(exit_event):
_cleanup_socket_file(CONF.driver_agent.stats_socket_path)
server = ForkingUDSServer(CONF.driver_agent.stats_socket_path,
StatsRequestHandler)
server.timeout = CONF.driver_agent.stats_request_timeout
server.max_children = CONF.driver_agen... | _cleanup_socket_file(CONF.driver_agent.status_socket_path)
server = ForkingUDSServer(CONF.driver_agent.status_socket_path,
StatusRequestHandler)
server.timeout = CONF.driver_agent.status_request_timeout
server.max_children = CONF.driver_agent.status_max_processes
while n... | identifier_body |
driver_listener.py | # Copyright 2018 Rackspace, US Inc.
# Copyright 2019 Red Hat, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
payload_size = int(size_str)
mv_buffer = memoryview(bytearray(payload_size))
next_offset = 0
while payload_size - next_offset > 0:
recv_size = recv_socket.recv_into(mv_buffer[next_offset:],
payload_size - next_offset)
next_offset += recv_size
... | size_str += char
char = recv_socket.recv(1) | conditional_block |
driver_listener.py | # Copyright 2018 Rackspace, US Inc.
# Copyright 2019 Red Hat, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
def _recv(recv_socket):
size_str = b''
char = recv_socket.recv(1)
while char != b'\n':
size_str += char
char = recv_socket.recv(1)
payload_size = int(size_str)
mv_buffer = memoryview(bytearray(payload_size))
next_offset = 0
... | from oslo_serialization import jsonutils
from octavia.api.drivers.driver_agent import driver_get
from octavia.api.drivers.driver_agent import driver_updater
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.