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 |
|---|---|---|---|---|
placement-in-syntax.rs | // Copyright 2015 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 x: Box<isize> = in HEAP { 2 };
let b: Box<isize> = in HEAP { 1 + 2 };
let c = in HEAP { 3 + 4 };
let s: Box<Structure> = in HEAP {
Structure {
x: 3,
y: 4,
}
};
}
| main | identifier_name |
placement-in-syntax.rs | // Copyright 2015 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 x: Box<isize> = in HEAP { 2 };
let b: Box<isize> = in HEAP { 1 + 2 };
let c = in HEAP { 3 + 4 };
let s: Box<Structure> = in HEAP {
Structure {
x: 3,
y: 4,
}
};
} | identifier_body | |
lib.rs | /*!
# Kiss3d
Keep It Simple, Stupid 3d graphics engine.
This library is born from the frustration in front of the fact that today’s 3D
graphics library are:
* either too low level: you have to write your own shaders and opening a
window steals you 8 hours, 300 lines of code and 10L of coffee.
* or high level but t... | ```text
[dependencies.kiss3d]
git = "https://github.com/sebcrozet/kiss3d"
```
## Contributions
I’d love to see people improving this library for their own needs. However, keep in mind that
**Kiss3d** is KISS. One-liner features (from the user point of view) are preferred.
*/
#![deny(non_camel_case_types)]
#![deny(unu... | random_line_split | |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... |
return available_interfaces
class InputInterface(InputReaderInterface):
def __init__(self, dev_name, dev_id, dev_reader):
super(InputInterface, self).__init__(dev_name, dev_id, dev_reader)
# These devices cannot be mapped and configured
self.supports_mapping = False
# Ask th... | for reader in initialized_interfaces:
devs = reader.devices()
for dev in devs:
available_interfaces.append(InputInterface(
dev["name"], dev["id"], reader)) | conditional_block |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | (self, include_raw=False):
mydata = self._reader.read(self.id)
# Merge interface returned data into InputReader Data Item
for key in list(mydata.keys()):
self.data.set(key, mydata[key])
return self.data
| read | identifier_name |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... |
class InputInterface(InputReaderInterface):
def __init__(self, dev_name, dev_id, dev_reader):
super(InputInterface, self).__init__(dev_name, dev_id, dev_reader)
# These devices cannot be mapped and configured
self.supports_mapping = False
# Ask the reader if it wants to limit
... | if len(available_interfaces) == 0:
for reader in initialized_interfaces:
devs = reader.devices()
for dev in devs:
available_interfaces.append(InputInterface(
dev["name"], dev["id"], reader))
return available_interfaces | identifier_body |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | # Todo: Support rescanning and adding/removing devices
if len(available_interfaces) == 0:
for reader in initialized_interfaces:
devs = reader.devices()
for dev in devs:
available_interfaces.append(InputInterface(
dev["name"], dev["id"], reader)... | def devices(): | random_line_split |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | (&self, msg: Message) -> Result<(), SendError<Message>> {
Ok(try!(self.tx.send(msg)))
}
}
impl<Message: Send + 'static> Debug for ActorCell<Message> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(f, "ActorCell")
}
}
impl<Message: Send + 'static> Clone for ActorCell<Message> {
fn clone(&... | send | identifier_name |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... |
}
impl<Message: Send + 'static> ActorRefImpl<Message> for ActorCell<Message> {
fn send(&self, msg: Message) -> Result<(), SendError<Message>> {
Ok(try!(self.tx.send(msg)))
}
}
impl<Message: Send + 'static> Debug for ActorCell<Message> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(f, "A... | {
let (tx, rx) = channel();
let actor_box: Box<Actor<Message>> = Box::new(actor);
let actor = Arc::new(Mutex::new(actor_box));
let actor_for_thread = actor.clone();
thread::spawn( move|| {
let mut actor = actor_for_thread.lock().unwrap();
loop {
match rx.recv() {
Ok(msg) => {
debug!("Pr... | identifier_body |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | ,
Err(error) => {
debug!("Quitting: {:?}", error);
break;
},
}
}
});
ActorRef(
ActorRefEnum::DedicatedThread(
ActorCell {
tx: tx,
actor: actor
}
)
)
}
}
impl<Message: Send + 'static> ActorRefImpl<Message> for ActorCell<Message> {
fn send(&self, msg: Message... | {
debug!("Processing");
actor.process(msg);
} | conditional_block |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | }
impl<Message: Send + 'static> Debug for ActorCell<Message> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(f, "ActorCell")
}
}
impl<Message: Send + 'static> Clone for ActorCell<Message> {
fn clone(&self) -> ActorCell<Message> {
ActorCell {
tx: self.tx.clone(),
actor: self.actor.cl... | } | random_line_split |
PermalinkProvider.js | /*
* Copyright (c) 2008-2015 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See https://github.com/geoext/geoext2/blob/master/license.txt for the full
* text of the license.
*/
/*
* @include OpenLayers/Util.js
* @requires GeoExt/Version.js
*/
/**
* The permalink provider.
*
*... | * renderTo: "map",
* layers: [
* new OpenLayers.Layer.WMS(
* "Global Imagery",
* "http://maps.opengeo.org/geowebcache/service/wms",
* {layers: "bluemarble"}
* )
* ],
* stateId: "map",
* prettyStateK... | random_line_split | |
PermalinkProvider.js | /*
* Copyright (c) 2008-2015 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See https://github.com/geoext/geoext2/blob/master/license.txt for the full
* text of the license.
*/
/*
* @include OpenLayers/Util.js
* @requires GeoExt/Version.js
*/
/**
* The permalink provider.
*
*... |
}
// merge params in the URL into the state params
OpenLayers.Util.applyDefaults(
params, OpenLayers.Util.getParameters(base));
var paramsStr = OpenLayers.Util.getParameterString(params);
var qMark = base.indexOf("?");
if(qMark > 0) {
base = ba... | {
for(k in state[id]) {
params[id + "_" + k] = this.encodeType ?
unescape(this.encodeValue(state[id][k])) : state[id][k];
}
} | conditional_block |
download_content_as_file.ts | /*
* 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... | * @param mimeType: An optional MIME type; defaults to plaintext.
*/
export function downloadAsFile(contents: BlobPart[], name: string, mimeType = "text/plain") {
const data = new Blob(contents, { type: mimeType });
const a = el("a", { href: URL.createObjectURL(data), download: name, style: "display:none" }, []);
... | * probably be a single string wrapped in an array.
* @param name: The desired filename for the download. | random_line_split |
download_content_as_file.ts | /*
* 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... | (contents: BlobPart[], name: string, mimeType = "text/plain") {
const data = new Blob(contents, { type: mimeType });
const a = el("a", { href: URL.createObjectURL(data), download: name, style: "display:none" }, []);
document.body.appendChild(a); // Firefox requires this to be added to the DOM before click()
a.c... | downloadAsFile | identifier_name |
download_content_as_file.ts | /*
* 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... | {
const data = new Blob(contents, { type: mimeType });
const a = el("a", { href: URL.createObjectURL(data), download: name, style: "display:none" }, []);
document.body.appendChild(a); // Firefox requires this to be added to the DOM before click()
a.click();
document.body.removeChild(a);
} | identifier_body | |
mqtt_receiver.js | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var debug = require('debug')('mqtt-common');
var Message = require('azure-... |
});
}
util.inherits(MqttReceiver, EventEmitter);
MqttReceiver.prototype._setupListeners = function () {
debug('subscribing to ' + this._topic_subscribe);
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_003: [When a listener is added for the message event, the topic should be subscribed to.]*/
this._client.subscribe... | {
debug('Now listening for messages');
self._setupListeners();
} | conditional_block |
mqtt_receiver.js | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var debug = require('debug')('mqtt-common');
var Message = require('azure-... | (mqttClient, topic_subscribe) {
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_001: [If the topic_subscribe parameter is falsy, a ReferenceError shall be thrown.]*/
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_002: [If the mqttClient parameter is falsy, a ReferenceError shall be thrown.]*/
if (!mqttClient) { throw new Refe... | MqttReceiver | identifier_name |
mqtt_receiver.js | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var debug = require('debug')('mqtt-common');
var Message = require('azure-... |
util.inherits(MqttReceiver, EventEmitter);
MqttReceiver.prototype._setupListeners = function () {
debug('subscribing to ' + this._topic_subscribe);
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_003: [When a listener is added for the message event, the topic should be subscribed to.]*/
this._client.subscribe(this._t... | {
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_001: [If the topic_subscribe parameter is falsy, a ReferenceError shall be thrown.]*/
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_002: [If the mqttClient parameter is falsy, a ReferenceError shall be thrown.]*/
if (!mqttClient) { throw new ReferenceError('mqttClient cannot ... | identifier_body |
mqtt_receiver.js | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var debug = require('debug')('mqtt-common');
var Message = require('azure-... | this._topic_subscribe = topic_subscribe;
this._listenersInitialized = false;
var self = this;
this.on('removeListener', function () {
// stop listening for AMQP events if our consumers stop listening for our events
if (self._listenersInitialized && self.listeners('message').length === 0) {
debug... | EventEmitter.call(this);
this._client = mqttClient; | random_line_split |
TangoServices.py | #!/usr/bin/env python
import boto3
import sys
import json
import logging
from botocore.exceptions import ClientError
from CoinCollection import ValueRecord
logger = logging.getLogger("tango")
logger.setLevel(logging.DEBUG)
class Cache():
def stash(self, key, record):
logger.debug("Stash request for: " + ... | return self.table
def getDB(self):
try:
self.dynamodb
except AttributeError:
self.dynamodb = boto3.resource('dynamodb', region_name='us-east-1') #, endpoint_url="http://localhost:8000")
return self.dynamodb
def createTangoCache(self):
table = sel... | random_line_split | |
TangoServices.py | #!/usr/bin/env python
import boto3
import sys
import json
import logging
from botocore.exceptions import ClientError
from CoinCollection import ValueRecord
logger = logging.getLogger("tango")
logger.setLevel(logging.DEBUG)
class Cache():
def stash(self, key, record):
logger.debug("Stash request for: " + ... |
def expired(self, key):
expired = True
try:
logger.debug("Expiration check for: " + key)
expired = self.retrieve(key).expired()
except (ValueError, AttributeError) as verr:
logger.error("Error occured checking expiration: " + str(verr))
expir... | try:
logger.debug("Retrieving record for: " + key)
response = self.getTable().get_item(
Key={
'coin_type': key,
}
)
except ClientError as e:
errorMsg = e.response['Error']['Message']
logger.error(erro... | identifier_body |
TangoServices.py | #!/usr/bin/env python
import boto3
import sys
import json
import logging
from botocore.exceptions import ClientError
from CoinCollection import ValueRecord
logger = logging.getLogger("tango")
logger.setLevel(logging.DEBUG)
class Cache():
def stash(self, key, record):
logger.debug("Stash request for: " + ... | if sys.argv[1] == 'createcache':
Cache().createTangoCache() | conditional_block | |
TangoServices.py | #!/usr/bin/env python
import boto3
import sys
import json
import logging
from botocore.exceptions import ClientError
from CoinCollection import ValueRecord
logger = logging.getLogger("tango")
logger.setLevel(logging.DEBUG)
class | ():
def stash(self, key, record):
logger.debug("Stash request for: " + key)
self.getTable().delete_item(
Key={
'coin_type': key
}
)
self.getTable().put_item(
Item={
'coin_type': key,
'value_record': ... | Cache | identifier_name |
testService5.ts | module app {
'use strict';
export interface ItestService5Options {
greeting: string;
}
export interface ItestService5 {
greet(name: string): string;
}
export interface ItestService5Provider extends ng.IServiceProvider {
configure(options: ItestService5Options): void;
... |
configure(options: ItestService5Options): void {
angular.extend(this.options, options);
}
$get(testService4: app.ItestService4): ItestService5 {
var service: ItestService5 = {
greet: (name: string) => {
return this.options.greeting +... | {
this.$get.$inject = ['testService4'];
} | identifier_body |
testService5.ts | module app {
'use strict';
export interface ItestService5Options {
greeting: string;
}
export interface ItestService5 {
greet(name: string): string;
}
export interface ItestService5Provider extends ng.IServiceProvider {
configure(options: ItestService5Options): void;
... | implements ItestService5Provider {
options: ItestService5Options = {
greeting: 'hello'
}
constructor() {
this.$get.$inject = ['testService4'];
}
configure(options: ItestService5Options): void {
angular.extend(this.options, options);
... | testService5Provider | identifier_name |
testService5.ts | module app {
'use strict';
export interface ItestService5Options {
greeting: string;
}
export interface ItestService5 {
greet(name: string): string;
}
export interface ItestService5Provider extends ng.IServiceProvider {
configure(options: ItestService5Options): void;
... | return service;
}
}
angular
.module('app')
.provider('testService5', testService5Provider);
} | random_line_split | |
setup.py | from cx_Freeze import setup, Executable
import sys
base = None
if sys.platform == "win32":
#base = "Win32GUI"
base = "Console"
executables = [
Executable("G_outgauge.py",
base=base,
icon="icon.ico"
)
]
include_files=[]
include_files.append(("LogitechLcdEnginesWrapper.dll... | description = "OutGauge python application for Logitech periperal with lcd color screen (G19)",
options=dict(build_exe=buildOptions),
executables = executables
) | version = "0.1", | random_line_split |
setup.py | from cx_Freeze import setup, Executable
import sys
base = None
if sys.platform == "win32":
#base = "Win32GUI"
|
executables = [
Executable("G_outgauge.py",
base=base,
icon="icon.ico"
)
]
include_files=[]
include_files.append(("LogitechLcdEnginesWrapper.dll","LogitechLcdEnginesWrapper.dll"))
buildOptions = dict(
compressed=False,
includes=[],
packages=[],
include_files=inc... | base = "Console" | conditional_block |
automationactions.py | # coding=utf-8
"""
The Automations API endpoint actions
Note: This is a paid feature
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class AutomationActions(BaseApi):
"""
Actions ... | """
self.workflow_id = workflow_id
return self._mc_client._post(url=self._build_path(workflow_id, 'actions/pause-all-emails'))
# Paid feature
def start(self, workflow_id):
"""
Start all emails in an Automation workflow.
:param workflow_id: The unique id for the... | random_line_split | |
automationactions.py | # coding=utf-8
"""
The Automations API endpoint actions
Note: This is a paid feature
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class | (BaseApi):
"""
Actions for the Automations endpoint.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(AutomationActions, self).__init__(*args, **kwargs)
self.endpoint = 'automations'
self.workflow_id = None
# Paid featur... | AutomationActions | identifier_name |
automationactions.py | # coding=utf-8
"""
The Automations API endpoint actions
Note: This is a paid feature
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class AutomationActions(BaseApi):
"""
Actions ... | """
Start all emails in an Automation workflow.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
"""
self.workflow_id = workflow_id
return self._mc_client._post(url=self._build_path(workflow_id, 'actions/start-all-emails')... | identifier_body | |
shell.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Frederic Guillot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... |
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
| return KanboardShell().run(argv) | identifier_body |
shell.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Frederic Guillot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | (self, argv):
client_manager = client.ClientManager(self.options)
self.client = client_manager.get_client()
self.is_super_user = client_manager.is_super_user()
self.command_manager.add_command('app version', application.ShowVersion)
self.command_manager.add_command('app timezone... | initialize_app | identifier_name |
shell.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Frederic Guillot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WH... | # furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software. | random_line_split |
shell.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Frederic Guillot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | sys.exit(main(sys.argv[1:])) | conditional_block | |
change_request.py | # -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
| """
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fields.many2one(
"crm.lead", "Lead", domain=[("type", "=", "lead")]
),
# "project_id": fields.man... | identifier_body | |
change_request.py | # -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fiel... | def action_lead_to_change_request(self, cr, uid, ids, context=None):
# get the wizards and models
wizards = self.browse(cr, uid, ids, context=context)
lead_obj = self.pool["crm.lead"]
cr_obj = self.pool["change.management.change"]
attachment_obj = self.pool['ir.attachment']
... | "lead_id": lambda self, cr, uid, context=None: context.get('active_id')
}
| random_line_split |
change_request.py | # -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fiel... | (self, cr, uid, ids, context=None):
# get the wizards and models
wizards = self.browse(cr, uid, ids, context=context)
lead_obj = self.pool["crm.lead"]
cr_obj = self.pool["change.management.change"]
attachment_obj = self.pool['ir.attachment']
for wizard in wizards:
... | action_lead_to_change_request | identifier_name |
change_request.py | # -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fiel... |
# return the action to go to the form view of the new CR
view_id = self.pool.get('ir.ui.view').search(
cr, uid,
[
('model', '=', 'change.management.change'),
('name', '=', 'change_form_view')
]
)
return {
'n... | lead = wizard.lead_id
partner = self._find_matching_partner(cr, uid, context=context)
if not partner and (lead.partner_name or lead.contact_name):
partner_ids = lead_obj.handle_partner_assignation(
cr, uid, [lead.id], context=context
)
... | conditional_block |
semverCompare.test.js | import { expect } from 'chai';
import semverCompare from './semverCompare';
describe('semverCompare', () => {
const chaos = [
'2.5.10.4159',
'0.5', | '0.4.1',
'1',
'1.1',
'2.5.0',
'2',
'2.5.10',
'10.5',
'1.25.4',
'1.2.15',
];
const order = [
'0.4.1',
'0.5',
'1',
'1.1',
'1.2.15',
'1.25.4',
'2',
'2.5.0',
'2.5.10',
'2.5.10.4159',
'10.5',
];
it('sorts arrays correctly', () => {
... | random_line_split | |
exponential-backoff.js | /**
* Attempts to try a function repeatedly until either success or max number of tries has been reached.
*
* @param {Function} toTry The function to try repeatedly. Thrown errors cause a retry. This function returns a Promise.
* @param {number} max The maximum number of function retries.
* @param {number} delay T... |
module.exports = exponentialBackoff;
| {
return toTry().catch((err) => {
if (max <= 0) {
return Promise.reject(err);
}
if (predicate == null || predicate(err)) {
// This delays the Promise by delay.
return new Promise((resolve) => setTimeout(resolve, delay))
.then(() => {
return exponentialBackoff(toTry, --... | identifier_body |
exponential-backoff.js | /**
* Attempts to try a function repeatedly until either success or max number of tries has been reached.
*
* @param {Function} toTry The function to try repeatedly. Thrown errors cause a retry. This function returns a Promise.
* @param {number} max The maximum number of function retries.
* @param {number} delay T... | (toTry, max, delay, predicate) {
return toTry().catch((err) => {
if (max <= 0) {
return Promise.reject(err);
}
if (predicate == null || predicate(err)) {
// This delays the Promise by delay.
return new Promise((resolve) => setTimeout(resolve, delay))
.then(() => {
retu... | exponentialBackoff | identifier_name |
exponential-backoff.js | /**
* Attempts to try a function repeatedly until either success or max number of tries has been reached.
*
* @param {Function} toTry The function to try repeatedly. Thrown errors cause a retry. This function returns a Promise.
* @param {number} max The maximum number of function retries.
* @param {number} delay T... | // This delays the Promise by delay.
return new Promise((resolve) => setTimeout(resolve, delay))
.then(() => {
return exponentialBackoff(toTry, --max, delay * 2);
});
}
else {
return Promise.reject(err);
}
});
}
module.exports = exponentialBackoff; | random_line_split | |
exponential-backoff.js | /**
* Attempts to try a function repeatedly until either success or max number of tries has been reached.
*
* @param {Function} toTry The function to try repeatedly. Thrown errors cause a retry. This function returns a Promise.
* @param {number} max The maximum number of function retries.
* @param {number} delay T... |
});
}
module.exports = exponentialBackoff;
| {
return Promise.reject(err);
} | conditional_block |
base_transform.py | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
API Issues to work out:
- MatrixTransform and STTransform both have 'scale' and 'translate'
attributes, but they are used in very different ways. It ... |
def shader_map(self):
"""
Return a shader Function that accepts only a single vec4 argument
and defines new attributes / uniforms supplying the Function with
any static input.
"""
return self._shader_map
def shader_imap(self):
"""
see shader_map... | self._dynamic = d | identifier_body |
base_transform.py | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
API Issues to work out:
- MatrixTransform and STTransform both have 'scale' and 'translate'
attributes, but they are used in very different ways. It ... | (self, *args):
"""
Called to inform any listeners that this transform has changed.
"""
self.changed(*args)
def __mul__(self, tr):
"""
Transform multiplication returns a new transform that is equivalent to
the two operands performed in series.
By defa... | update | identifier_name |
base_transform.py | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
API Issues to work out:
- MatrixTransform and STTransform both have 'scale' and 'translate'
attributes, but they are used in very different ways. It ... |
if self.glsl_imap is not None:
self._shader_imap = Function(self.glsl_imap)
def map(self, obj):
"""
Return *obj* mapped through the forward transformation.
Parameters
----------
obj : tuple (x,y) or (x,y,z)
array with shape (..., 2... | self._shader_map = Function(self.glsl_map) | conditional_block |
base_transform.py | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
API Issues to work out:
- MatrixTransform and STTransform both have 'scale' and 'translate'
attributes, but they are used in very different ways. It ... | Linear = None
# The transformation's effect on one axis is independent
# of the input position along any other axis.
Orthogonal = None
# If True, then the distance between two points is the
# same as the distance between the transformed points.
NonScaling = None
# Scale factors are ap... | # If True, then for any 3 colinear points, the
# transformed points will also be colinear. | random_line_split |
test_config.py | """Test PbenchConfig class and objects
"""
import pytest
from pathlib import Path
from pbench import PbenchConfig
from pbench.common.exceptions import BadConfig
_config_path_prefix = Path("lib/pbench/test/unit/common/config")
class TestPbenchConfig:
def test_empty_config(self):
config = PbenchConfig(... |
def test_logger_type_provided(self):
config = PbenchConfig(_config_path_prefix / "hostport.cfg")
assert (
config.logger_type == "hostport"
), f"Unexpected logger type, {config.logger_type!r}"
assert (
config.logger_host == "logger.example.com"
), f"Un... | config.log_dir == "/srv/log/directory"
), f"Unexpected log directory, {config.log_dir!r}" | random_line_split |
test_config.py | """Test PbenchConfig class and objects
"""
import pytest
from pathlib import Path
from pbench import PbenchConfig
from pbench.common.exceptions import BadConfig
_config_path_prefix = Path("lib/pbench/test/unit/common/config")
class TestPbenchConfig:
def test_empty_config(self):
config = PbenchConfig(... | (self):
config = PbenchConfig(_config_path_prefix / "hostport.cfg")
assert (
config.logger_type == "hostport"
), f"Unexpected logger type, {config.logger_type!r}"
assert (
config.logger_host == "logger.example.com"
), f"Unexpected logger host value, {confi... | test_logger_type_provided | identifier_name |
test_config.py | """Test PbenchConfig class and objects
"""
import pytest
from pathlib import Path
from pbench import PbenchConfig
from pbench.common.exceptions import BadConfig
_config_path_prefix = Path("lib/pbench/test/unit/common/config")
class TestPbenchConfig:
| def test_empty_config(self):
config = PbenchConfig(_config_path_prefix / "pbench.cfg")
assert config.TZ == "UTC", f"Unexpected TZ value, {config.TZ!r}"
assert (
config.log_fmt is None
), f"Unexpected log format value, {config.log_fmt!r}"
assert (
config.de... | identifier_body | |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... | (&self) -> &Model { self.model }
}
| deref | identifier_name |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... |
}
impl<'a> Callback<'a> {
/// Retrieve the location where the callback called.
pub fn get_where(&self) -> Where { self.where_.clone() }
/// Retrive node relaxation solution values at the current node.
pub fn get_node_rel(&self, vars: &[Var]) -> Result<Vec<f64>> {
// memo: only MIPNode && status == Optim... | {
let mut callback = Callback {
cbdata: cbdata,
where_: Where::Polling,
model: model
};
let where_ = match where_ {
POLLING => Where::Polling,
PRESOLVE => {
Where::PreSolve {
coldel: try!(callback.get_int(PRESOLVE, PRE_COLDEL)),
rowdel: try!(callbac... | identifier_body |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... |
MIP => {
Where::MIP {
objbst: try!(callback.get_double(MIP, MIP_OBJBST)),
objbnd: try!(callback.get_double(MIP, MIP_OBJBND)),
nodcnt: try!(callback.get_double(MIP, MIP_NODCNT)),
solcnt: try!(callback.get_double(MIP, MIP_SOLCNT)),
cutcnt: try!(callback.get... | {
Where::Simplex {
itrcnt: try!(callback.get_double(SIMPLEX, SPX_ITRCNT)),
objval: try!(callback.get_double(SIMPLEX, SPX_OBJVAL)),
priminf: try!(callback.get_double(SIMPLEX, SPX_PRIMINF)),
dualinf: try!(callback.get_double(SIMPLEX, SPX_DUALINF)),
ispert: try!(ca... | conditional_block |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... | /// Current count of feasible solutions found.
solcnt: i32
},
/// Printing a log message
Message(String),
/// Currently in barrier.
Barrier {
/// Current barrier iteration count.
itrcnt: i32,
/// Primal objective value for current barrier iterate.
primobj: f64,
/// Dual objective... | /// Current best objective bound.
objbnd: f64,
/// Current explored node count.
nodcnt: f64, | random_line_split |
graphcool-ids.js | exports.strength = {
"1": "cjersov3s14fu01832cku6ivc",
"2": "cjertinv814oj0183jx107b9u",
"3": "cjertith714om0183tr2huxiw",
"4": "cjertj05014or0183we74xnsb",
"5": "cjertj34914ov0183sl7kmqm1",
"6": "cjertj5ol14p10183cmzat5y9",
"7": "cjertj8a814p60183av1hlcty",
"8": "cjertjbqr14pc0183uo7656p7",
"9": "cje... | "Military Police Regiment": "cjes4ushb170o0183gqvjd1pr",
"Titan": "cjes4v11x170t0183yn2ripoe",
"Cadet Corps": "cjes4vgkg170x0183kj04xyew",
"Human": "cjf8iuklm49ie0183uw7s0iq4"
}; | "Garrison Regiment": "cjes4ulp5170k0183wz5ewix6", | random_line_split |
page-change-time.js | /*!
* jQuery Mobile v@VERSION
* http://jquerymobile.com/
*
* Copyright 2011, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
// This is code that can be used as a simple bookmarklet for timing
// the load, enhancment, and transition of a changePage() reques... |
var startChange, stopChange, startLoad, stopLoad, startEnhance, stopEnhance, startTransition, stopTransition, lock = 0;
$( document )
.bind( "pagebeforechange", function( e, data) {
if ( typeof data.toPage === "string" ) {
startChange = stopChange = startLoad = stopLoad = startEnhance = stopEnhance = s... | {
return ( new Date() ).getTime();
} | identifier_body |
page-change-time.js | /*!
* jQuery Mobile v@VERSION
* http://jquerymobile.com/
*
* Copyright 2011, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
// This is code that can be used as a simple bookmarklet for timing
// the load, enhancment, and transition of a changePage() reques... |
})
.bind( "pagebeforeload", function() {
startLoad = stopLoad = getTime();
})
.bind( "pagebeforecreate", function() {
if ( ++lock === 1 ) {
stopLoad = startEnhance = stopEnhance = getTime();
}
})
.bind( "pageinit", function() {
if ( --lock === 0 ) {
stopEnhance = getTime();
... | {
startChange = stopChange = startLoad = stopLoad = startEnhance = stopEnhance = startTransition = stopTransition = getTime();
} | conditional_block |
page-change-time.js | /*!
* jQuery Mobile v@VERSION
* http://jquerymobile.com/
*
* Copyright 2011, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
// This is code that can be used as a simple bookmarklet for timing
// the load, enhancment, and transition of a changePage() reques... |
startChange = stopChange = startLoad = stopLoad = startEnhance = stopEnhance = startTransition = stopTransition = 0;
}
});
})( jQuery, window ); | + "\nenhance: " + ( stopEnhance - startEnhance )
+ "\ntransition: " + ( stopTransition - startTransition )
+ "\ntotalTime: " + ( stopChange - startChange ) ); | random_line_split |
page-change-time.js | /*!
* jQuery Mobile v@VERSION
* http://jquerymobile.com/
*
* Copyright 2011, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
// This is code that can be used as a simple bookmarklet for timing
// the load, enhancment, and transition of a changePage() reques... | () {
return ( new Date() ).getTime();
}
var startChange, stopChange, startLoad, stopLoad, startEnhance, stopEnhance, startTransition, stopTransition, lock = 0;
$( document )
.bind( "pagebeforechange", function( e, data) {
if ( typeof data.toPage === "string" ) {
startChange = stopChange = startLoad =... | getTime | identifier_name |
DEPProfilesTable.tsx | import * as React from "react";
import ReactTable, {TableProps, Column} from "react-table";
import selectTableHoc from "react-table/lib/hoc/selectTable";
import {DEPAccount, DEPProfile} from "../../store/dep/types";
import {DEPProfileName} from "../react-table/DEPProfileName";
import {JSONAPIDataObject} from "../../sto... | const ReactSelectTable = selectTableHoc(ReactTable);
export const DEPProfilesTable = ({ data, ...props }: IDEPProfilesTableProps & Partial<TableProps>) => (
<ReactSelectTable
keyField="id"
selectType="checkbox"
data={data}
columns={columns}
{...props}
/>
); | id: "uuid",
},
];
| random_line_split |
paginator.py | class Paginator(object):
def __init__(self, collection, page_number=0, limit=20, total=-1):
self.collection = collection
self.page_number = int(page_number)
self.limit = int(limit)
self.total = int(total)
@property
def page(self):
start = self.page_number * ... | (self, page_num, url):
import re
#check if there is a query string
if url.find('?') != -1:
if re.search(r'page=\d',url) != None:
page_str = "&page=%d" % page_num
return re.sub(r'&page=\d+', page_str, url)
else:
retu... | __build_url | identifier_name |
paginator.py | class Paginator(object):
def __init__(self, collection, page_number=0, limit=20, total=-1):
self.collection = collection | self.page_number = int(page_number)
self.limit = int(limit)
self.total = int(total)
@property
def page(self):
start = self.page_number * self.limit
end = start + self.limit
try:
return self.collection[start:end]
except Exception as det... | random_line_split | |
paginator.py | class Paginator(object):
def __init__(self, collection, page_number=0, limit=20, total=-1):
self.collection = collection
self.page_number = int(page_number)
self.limit = int(limit)
self.total = int(total)
@property
def page(self):
start = self.page_number * ... |
@property
def page_count(self):
if self.total != -1:
pages = abs(self.total / self.limit)+1
return pages
else:
return None
@property
def has_previous(self):
return True if (self.page_number > 0) else False
@property
def ... | return self.page_number + 1 | identifier_body |
paginator.py | class Paginator(object):
def __init__(self, collection, page_number=0, limit=20, total=-1):
self.collection = collection
self.page_number = int(page_number)
self.limit = int(limit)
self.total = int(total)
@property
def page(self):
start = self.page_number * ... |
else:
return None
@property
def has_previous(self):
return True if (self.page_number > 0) else False
@property
def has_next(self):
return True if (len(self.page) == self.limit) else False
@property
def previous_page(self):
if self.has_p... | pages = abs(self.total / self.limit)+1
return pages | conditional_block |
qsdateutil.py | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for backteste... | '''
@summary: Generate dates on which we need to trade
@param c_strat: Strategy config class
@param dt_start: Start date
@param dt_end: End date
'''
ldt_timestamps = getNYSEdays(dt_start,
dt_end, dt.timedelta(hours=16) )
# Use pandas reindex method instead
# Note, date... | identifier_body | |
qsdateutil.py | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for backteste... |
ret = GTS_DATES[i + offset]
ret = ret.replace(hour=16)
return ret
def getNYSEdays(startday = dt.datetime(1964,7,5), endday = dt.datetime(2020,12,31),
timeofday = dt.timedelta(0)):
"""
@summary: Create a list of timestamps between startday and endday (inclusive)
that correspond ... | i -= 1 | conditional_block |
qsdateutil.py | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for backteste... |
ret = ret.replace(hour=16)
return ret
def getNYSEdays(startday = dt.datetime(1964,7,5), endday = dt.datetime(2020,12,31),
timeofday = dt.timedelta(0)):
"""
@summary: Create a list of timestamps between startday and endday (inclusive)
that correspond to the days there was trading at the NYSE.... | ret = GTS_DATES[i + offset] | random_line_split |
qsdateutil.py | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for backteste... | (startday, days, timeofday):
"""
@summary: Create a list of timestamps from startday that is days days long
that correspond to the days there was trading at NYSE. This function
depends on the file used in getNYSEdays and assumes the dates within are
in order.
@param startday: First timestamp to... | getNextNNYSEdays | identifier_name |
ResponsiveLayout.tsx | import * as React from "react"
import {
PropertyControls,
Frame,
addPropertyControls,
ControlType,
} from "framer"
// Responsive Layout Component
// @steveruizok
type Child = React.ReactElement<any>
const defaultStyle: React.CSSProperties = {
height: "100%",
display: "flex",
flexDirection... | propertyControl: {
type: ControlType.ComponentInstance,
},
},
}) | addPropertyControls(ResponsiveLayout, {
layouts: {
type: ControlType.Array,
title: "Layouts", | random_line_split |
ResponsiveLayout.tsx | import * as React from "react"
import {
PropertyControls,
Frame,
addPropertyControls,
ControlType,
} from "framer"
// Responsive Layout Component
// @steveruizok
type Child = React.ReactElement<any>
const defaultStyle: React.CSSProperties = {
height: "100%",
display: "flex",
flexDirection... |
// otherwise, return the largest layout among those that fit
return filtered[filtered.length - 1]
}
const updateLayout = () => {
if (!container.current) {
return
}
const width = container.current.offsetWidth
setState({
...state,
... | {
return sorted[0]
} | conditional_block |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... | code: Vec::new(),
p: Vec::new(),
lineinfo: Vec::new(),
locvars: Vec::new(),
upvalues: Vec::new(),
source: source,
linedefined: linedefined,
lastlinedefined: lastlinedefined,
nups: nups,
numparams: numparams,
is_vararg: is_vararg,
maxstac... | k: Vec::new(),
| random_line_split |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... |
}
impl Proto {
pub fn new(source: InString,
linedefined: u32,
lastlinedefined: u32,
nups: u8,
numparams: u8,
is_vararg: u8,
maxstacksize: u8)
-> Proto {
Proto {
k: Vec::new(),
code: Vec::new(),
p: ... | {
LocVar {
varname: varname,
startpc: startpc,
endpc: endpc
}
} | identifier_body |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... | (source: InString,
linedefined: u32,
lastlinedefined: u32,
nups: u8,
numparams: u8,
is_vararg: u8,
maxstacksize: u8)
-> Proto {
Proto {
k: Vec::new(),
code: Vec::new(),
p: Vec::new(),
lineinfo: Vec::n... | new | identifier_name |
app.py | from flask import Flask, request
import sendgrid
import json
import requests
import os
app = Flask(__name__)
SENDGRID_USER = os.getenv('SENDGRID_USER')
SENDGRID_PASS = os.getenv('SENDGRID_PASS')
ONENOTE_TOKEN = os.getenv('ONENOTE_TOKEN')
# Make the WSGI interface available at the top level so wfastcgi can get it.
wsg... |
@app.route('/tos', methods = ['GET'])
def tos():
return "Terms of Service Placeholder."
@app.route('/privacy', methods = ['GET'])
def privacy():
return "Privacy Policy Placeholder."
if __name__ == '__main__':
import os
HOST = os.environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(os.... | """Renders a sample page."""
return "Hello Universe!" | identifier_body |
app.py | from flask import Flask, request
import sendgrid
import json
import requests
import os
app = Flask(__name__)
SENDGRID_USER = os.getenv('SENDGRID_USER')
SENDGRID_PASS = os.getenv('SENDGRID_PASS')
ONENOTE_TOKEN = os.getenv('ONENOTE_TOKEN')
# Make the WSGI interface available at the top level so wfastcgi can get it.
wsg... | ():
return "Privacy Policy Placeholder."
if __name__ == '__main__':
import os
HOST = os.environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(os.environ.get('SERVER_PORT', '5555'))
except ValueError:
PORT = 5555
app.run(HOST, PORT)
| privacy | identifier_name |
app.py | from flask import Flask, request
import sendgrid
import json
import requests
import os
app = Flask(__name__)
SENDGRID_USER = os.getenv('SENDGRID_USER')
SENDGRID_PASS = os.getenv('SENDGRID_PASS')
ONENOTE_TOKEN = os.getenv('ONENOTE_TOKEN')
# Make the WSGI interface available at the top level so wfastcgi can get it.
wsg... | import os
HOST = os.environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(os.environ.get('SERVER_PORT', '5555'))
except ValueError:
PORT = 5555
app.run(HOST, PORT) | conditional_block | |
app.py | from flask import Flask, request
import sendgrid
import json
import requests
import os
app = Flask(__name__)
SENDGRID_USER = os.getenv('SENDGRID_USER')
SENDGRID_PASS = os.getenv('SENDGRID_PASS')
ONENOTE_TOKEN = os.getenv('ONENOTE_TOKEN')
# Make the WSGI interface available at the top level so wfastcgi can get it.
wsg... | auth = 'Bearer ' + ONENOTE_TOKEN
body = "An email from " + data[i]['email'] + " bounced. You might want to do something about that :)"
payload = "<!DOCTYPE HTML><html><head><title>Bounced Email Alert</title></head>"
payload += "<body>" + body + "</body></html>"
... | url = "https://www.onenote.com/api/v1.0/pages" | random_line_split |
first.py | #!/usr/bin/python
# usage: A debugging class
import pdb
version=2.0
def my_add(a,b):
''' This is the function for addition of numbers and strings '''
print "value of a is {}".format(a)
print "value of b is {}".format(b)
return a+b
def my_div(a,b):
''' This is the function for division '''
return a/b
... | print "Congo, i learned to write a calculator"
pdb.set_trace()
print "summation of two numbers- {}".format(my_add(1,2))
print "multiplication of two numbers- {}".format(my_mul(1,2))
print "substartion of two numbers - {}".format(my_sub(1,2))
print "division of two numbers - {}".format(my_div(4,2)) | print "This is a example on understading debugging" | random_line_split |
first.py | #!/usr/bin/python
# usage: A debugging class
import pdb
version=2.0
def my_add(a,b):
''' This is the function for addition of numbers and strings '''
print "value of a is {}".format(a)
print "value of b is {}".format(b)
return a+b
def | (a,b):
''' This is the function for division '''
return a/b
def my_sub(a,b):
''' This is the function for substraction '''
if a > b:
return a - b
elif b > a:
return b - a
def my_mul(a,b):
''' This is the function for multiplication '''
return a * b
# Application code
if __name__ == '__... | my_div | identifier_name |
first.py | #!/usr/bin/python
# usage: A debugging class
import pdb
version=2.0
def my_add(a,b):
''' This is the function for addition of numbers and strings '''
print "value of a is {}".format(a)
print "value of b is {}".format(b)
return a+b
def my_div(a,b):
''' This is the function for division '''
return a/b
... |
# Application code
if __name__ == '__main__':
print "This is a example on understading debugging"
print "Congo, i learned to write a calculator"
pdb.set_trace()
print "summation of two numbers- {}".format(my_add(1,2))
print "multiplication of two numbers- {}".format(my_mul(1,2))
print "substartion of t... | ''' This is the function for multiplication '''
return a * b | identifier_body |
first.py | #!/usr/bin/python
# usage: A debugging class
import pdb
version=2.0
def my_add(a,b):
''' This is the function for addition of numbers and strings '''
print "value of a is {}".format(a)
print "value of b is {}".format(b)
return a+b
def my_div(a,b):
''' This is the function for division '''
return a/b
... |
def my_mul(a,b):
''' This is the function for multiplication '''
return a * b
# Application code
if __name__ == '__main__':
print "This is a example on understading debugging"
print "Congo, i learned to write a calculator"
pdb.set_trace()
print "summation of two numbers- {}".format(my_add(1,2))
... | return b - a | conditional_block |
custom.js | var baseUrlServer = 'http://luzparatodos.o3midia.com.br/';
$('#btn_cadastrar_usuario').click(function(){
dadosForm = $('#form_login').serialize();
console.log(dadosForm);
});
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device API... | navigator.geolocation.getCurrentPosition(onSuccess, onError);
});
$('#btn_salvar_endereco_tela_estou_aqui').click(function(){
alert(endereco);
});
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '... | random_line_split | |
custom.js |
var baseUrlServer = 'http://luzparatodos.o3midia.com.br/';
$('#btn_cadastrar_usuario').click(function(){
dadosForm = $('#form_login').serialize();
console.log(dadosForm);
});
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device ... | (error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
} | onError | identifier_name |
custom.js |
var baseUrlServer = 'http://luzparatodos.o3midia.com.br/';
$('#btn_cadastrar_usuario').click(function(){
dadosForm = $('#form_login').serialize();
console.log(dadosForm);
});
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device ... |
$('#tela-estou-aqui').on('pagehide',function(){
$('#paragrafo_tela_estou_aqui').html('');
$('#btn_salvar_endereco_tela_estou_aqui,#observacao_tela_estou_aqui').hide();
});
$('#tela-estou-aqui').on('pageshow',function(){
$.mobile.loading('show');
navigator.geolocation.getCurrentPosition(onSuccess, onError)... | {
// var element = document.getElementById('geolocation');
// element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
// var msg = 'Latitude: ' + position.coords.latitude + '<br />' +
// 'Longitude: ' + position.coords.longitude ... | identifier_body |
loading.tsx | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
import React from "react";
import { Icon } from "./icon";
import { TypedMap } from "../app-framework";
export type Estimate = TypedMap<{
time: number; // Time in seconds
t... | }
render() {
let style: React.CSSProperties | undefined = undefined;
if (this.props.style != undefined) {
style = this.props.style;
} else if (this.props.theme != undefined) {
style = LOADING_THEMES[this.props.theme];
}
return (
<div style={style}>
<span>
<Ico... | return (
<div>
Loading '{this.props.estimate.get("type")}' file.
<br />
Estimated time: {this.props.estimate.get("time")}s
</div>
);
}
| conditional_block |
loading.tsx | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
import React from "react";
import { Icon } from "./icon";
import { TypedMap } from "../app-framework";
export type Estimate = TypedMap<{
time: number; // Time in seconds
t... | {
if (this.props.estimate != undefined) {
return (
<div>
Loading '{this.props.estimate.get("type")}' file.
<br />
Estimated time: {this.props.estimate.get("time")}s
</div>
);
}
}
render() {
let style: React.CSSProperties | undefined = undefined;... | der_estimate() | identifier_name |
loading.tsx | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
import React from "react";
import { Icon } from "./icon";
import { TypedMap } from "../app-framework";
export type Estimate = TypedMap<{
time: number; // Time in seconds
t... | Loading '{this.props.estimate.get("type")}' file.
<br />
Estimated time: {this.props.estimate.get("time")}s
</div>
);
}
}
render() {
let style: React.CSSProperties | undefined = undefined;
if (this.props.style != undefined) {
style = this.props.style;
... | random_line_split | |
loading.tsx | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
import React from "react";
import { Icon } from "./icon";
import { TypedMap } from "../app-framework";
export type Estimate = TypedMap<{
time: number; // Time in seconds
t... | render() {
let style: React.CSSProperties | undefined = undefined;
if (this.props.style != undefined) {
style = this.props.style;
} else if (this.props.theme != undefined) {
style = LOADING_THEMES[this.props.theme];
}
return (
<div style={style}>
<span>
<Icon na... | if (this.props.estimate != undefined) {
return (
<div>
Loading '{this.props.estimate.get("type")}' file.
<br />
Estimated time: {this.props.estimate.get("time")}s
</div>
);
}
}
| identifier_body |
index.ts | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | */
export * from './datasource-view/datasource-view';
export * from './home-view/home-view';
export * from './ingestion-view/ingestion-view';
export * from './load-data-view/load-data-view';
export * from './lookups-view/lookups-view';
export * from './query-view/query-view';
export * from './segments-view/segments-v... | * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. | random_line_split |
gallery.component.spec.ts | /* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { RouterTestingModule } from '@angular/router/testing';
impor... | beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminGalleryComponent, TimerComponent, NextComponent ],
imports: [
RouterTestingModule,
StoreModule.provideStore(rootReducer),
SharedModule
],
providers: [ScoreService, StoreService]
})
... | random_line_split | |
test.py | # Copyright 2015, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Azrael (https://github.com/olitheolix/azrael)
#
# Azrael is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of... |
return Template(name, rbs, fragments, boosters, factories)
| rbs = getRigidBody(cshapes={'cssphere': getCSSphere()}) | conditional_block |
test.py | # Copyright 2015, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Azrael (https://github.com/olitheolix/azrael)
#
# Azrael is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of... |
def getCSSphere(pos=[0, 0, 0], rot=[0, 0, 0, 1], radius=1):
"""
Convenience function to construct a Sphere shape.
"""
return CollShapeMeta('sphere', pos, rot, CollShapeSphere(radius))
def getCSPlane(pos=[0, 0, 0], rot=[0, 0, 0, 1], normal=[0, 0, 1], ofs=0):
"""
Convenience function to const... | """
Convenience function to construct a Box shape.
"""
return CollShapeMeta('box', pos, rot, CollShapeBox(*dim)) | identifier_body |
test.py | # Copyright 2015, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Azrael (https://github.com/olitheolix/azrael)
#
# Azrael is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of... | # Azrael is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
#... | # License, or (at your option) any later version.
# | random_line_split |
test.py | # Copyright 2015, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Azrael (https://github.com/olitheolix/azrael)
#
# Azrael is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of... | (scale: (int, float)=1,
imass: (int, float)=1,
restitution: (int, float)=0.9,
rotation: (tuple, list)=(0, 0, 0, 1),
position: (tuple, list, np.ndarray)=(0, 0, 0),
velocityLin: (tuple, list, np.ndarray)=(0, 0, 0),
veloc... | getRigidBody | identifier_name |
classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.js | var classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest =
[
[ "setUp", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.html#a2dce61fc6869e60bcb0f5be7616b985d", null ],
[ "testDeviceAnnotation", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1Suppres... | [ "testDeviceTypes", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.html#add66c76a6bf03715757f058c32cf5e34", null ]
]; | random_line_split | |
test_pdb_chain.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... | rom config import test_dir
mpath = os.path.abspath(os.path.join(test_dir, '..'))
sys.path.insert(0, mpath) # so we load dev files before any installation
unittest.main()
| conditional_block | |
test_pdb_chain.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... | self.exec_module()
self.assertEqual(self.retcode, 1) # ensure the program exited gracefully.
self.assertEqual(len(self.stdout), 0) # no output
self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
def test_invalid_option(self):
"""$ pdb_chain -AH data/dummy.... | random_line_split | |
test_pdb_chain.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... |
if __name__ == '__main__':
from config import test_dir
mpath = os.path.abspath(os.path.join(test_dir, '..'))
sys.path.insert(0, mpath) # so we load dev files before any installation
unittest.main()
| ""
Generic class for testing tools.
"""
def setUp(self):
# Dynamically import the module
name = 'pdbtools.pdb_chain'
self.module = __import__(name, fromlist=[''])
def exec_module(self):
"""
Execs module.
"""
with OutputCapture() as output:
... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.