text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Fix the condition to return string | export default class EasyInput {
constructor() {
this.keys = []
}
handleKeyDown(event) {
if (event.ctrlKey) {
this.keys.push(this.ignoreDupKey('Ctrl+'))
}
if (event.shiftKey) {
this.keys.push(this.ignoreDupKey('Shift+'))
}
if (event.altKey) {
this.keys.push(this.ignoreD... | export default class EasyInput {
constructor() {
this.keys = []
}
handleKeyDown(event) {
if (event.ctrlKey) {
this.keys.push(this.ignoreDupKey('Ctrl+'))
}
if (event.shiftKey) {
this.keys.push(this.ignoreDupKey('Shift+'))
}
if (event.altKey) {
this.keys.push(this.ignoreD... |
Add log message about starting in the emulator | /* global Pebble navigator */
function pebbleSuccess(e) {
// do nothing
}
function pebbleFailure(e) {
console.error(e);
}
var reportPhoneBatt;
Pebble.addEventListener('ready', function(e) {
if (navigator.getBattery) {
navigator.getBattery().then(function (battery) {
reportPhoneBatt = function () {
... | /* global Pebble navigator */
function pebbleSuccess(e) {
// do nothing
}
function pebbleFailure(e) {
console.error(e);
}
var reportPhoneBatt;
Pebble.addEventListener('ready', function(e) {
if (navigator.getBattery) {
navigator.getBattery().then(function (battery) {
reportPhoneBatt = function () {
... |
Revert "Removed the limit on re-running tests in the same client."
This reverts commit ab108ee5f966718833d96260538b13033eda9296. | <?php
include "inc/init.php";
$result = mysql_queryf("SELECT run_id FROM run_useragent WHERE useragent_id=%u AND runs < max ORDER BY run_id DESC LIMIT 1;", $useragent_id);
# A run was found
if ( $row = mysql_fetch_array($result) ) {
$run_id = $row[0];
$result = mysql_queryf("SELECT url FROM runs WHERE id=%u... | <?php
include "inc/init.php";
$result = mysql_queryf("SELECT run_id FROM run_useragent WHERE useragent_id=%u AND runs < max ORDER BY run_id DESC LIMIT 1;", $useragent_id);
# A run was found
if ( $row = mysql_fetch_array($result) ) {
$run_id = $row[0];
$result = mysql_queryf("SELECT url FROM runs WHERE id=%u... |
Deal with commands in any case. | var Chat = function(socket) {
this.socket = socket;
};
Chat.prototype.sendMessage = function(room, text) {
var message = {
room: room,
text: text
};
this.socket.emit('message', message);
};
Chat.prototype.changeRoom = function(currentRoom, newRoom) {
this.socket.emit('join', {
newRoom: newRoom,
... | var Chat = function(socket) {
this.socket = socket;
};
Chat.prototype.sendMessage = function(room, text) {
var message = {
room: room,
text: text
};
this.socket.emit('message', message);
};
Chat.prototype.changeRoom = function(currentRoom, newRoom) {
this.socket.emit('join', {
newRoom: newRoom,
... |
Fix request scheme: REQUEST_SCHEME doesn't exist for PHP 7 built-in server | <?php
session_start();
require __DIR__.'/../vendor/autoload.php';
use \BW\Vkontakte as Vk;
$vk = new Vk([
'client_id' => '5759854',
'client_secret' => 'a556FovqtUBHArlXlAAO',
'redirect_uri' => 'http://localhost:8000',
]);
if (isset($_GET['code'])) {
$vk->authenticate($_GET['code']);
$_SESSION['... | <?php
session_start();
require __DIR__.'/../vendor/autoload.php';
use \BW\Vkontakte as Vk;
$vk = new Vk([
'client_id' => '5759854',
'client_secret' => 'a556FovqtUBHArlXlAAO',
'redirect_uri' => 'http://localhost:8000',
]);
if (isset($_GET['code'])) {
$vk->authenticate($_GET['code']);
$_SESSION['... |
BUGFIX: Allow the fetch API to be used since we polyfill it globally | module.exports = {
parser: 'babel-eslint',
extends: [
'xo',
'xo-react',
'plugin:jsx-a11y/recommended',
'plugin:promise/recommended',
'plugin:react/recommended'
],
plugins: [
'compat',
'promise',
'babel',
'react',
'jsx-a11y'
],
env: {
node: true,
browser: true,
jest: true
},
globals: {
... | module.exports = {
parser: 'babel-eslint',
extends: [
'xo',
'xo-react',
'plugin:jsx-a11y/recommended',
'plugin:promise/recommended',
'plugin:react/recommended'
],
plugins: [
'compat',
'promise',
'babel',
'react',
'jsx-a11y'
],
env: {
node: true,
browser: true,
jest: true
},
globals: {
... |
Add the class name note | <?php
/*
* Core functions.
*
* Don't forget to add own ones.
*/
// `encrypt`
//
// Encrypts `$str` in rot13.
function encrypt($str) {
echo str_rot13($str);
}
// `decrypt`
//
// Decrypts `$str` from rot13.
function decrypt($str) {
echo str_rot13(str_rot13($str));
}
// `cfile`
//
// Checks for current file. ... | <?php
/*
* Core functions.
*
* Don't forget to add own ones.
*/
// `encrypt`
//
// Encrypts `$str` in rot13.
function encrypt($str) {
echo str_rot13($str);
}
// `decrypt`
//
// Decrypts `$str` from rot13.
function decrypt($str) {
echo str_rot13(str_rot13($str));
}
// `cfile`
//
// Checks for current file.
... |
Change active to a boolean | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInstallationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('installat... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInstallationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('installat... |
Use correct IO pins and serial port | import signal
import sys
import serial
import sms
from xbee import XBee
SERIAL_PORT = '/dev/usbserial-143'
MOBILE_NUM = '0400000000'
NOTIFICATION_MSG = 'Cock-a-doodle-doo! An egg is waiting for you!'
egg_was_present = False
def signal_handler(signal, frame):
xbee.halt()
serial_port.close()
sys.exit(0)
d... | import signal
import sys
import serial
import sms
from xbee import XBee
MOBILE_NUM = '0400000000'
NOTIFICATION_MSG = 'Cock-a-doodle-doo! An egg is waiting for you!'
egg_was_present = False
def signal_handler(signal, frame):
xbee.halt()
serial_port.close()
sys.exit(0)
def packet_received(packet):
sam... |
Make String polyfills configurable and writable
This prevents breakage when used with other shims, and more closely follows the ECMAScript specification. Fixes #487. | // String.startsWith polyfill
if (! String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: true,
writable: true,
value: function(str) {
var that = this;
for(var i = 0, ceil = str.length; i < ceil... | // String.startsWith polyfill
if (! String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function(str) {
var that = this;
for(var i = 0, ceil = str.length; i < ce... |
Allow ember-orbit to be used in addons | 'use strict';
const path = require('path');
const assert = require('assert');
const fs = require('fs');
module.exports = {
name: require('./package').name,
included() {
const app = this._findHost();
const addonConfig = app.project.config(app.env)['orbit'] || {};
const collections = addonConfig.collecti... | 'use strict';
const path = require('path');
const assert = require('assert');
const fs = require('fs');
module.exports = {
name: require('./package').name,
included() {
const app = this._findHost();
const addonConfig = this.app.project.config(app.env)['orbit'] || {};
const collections = addonConfig.col... |
Fix initializer deprecation for 2.x
Resolves #4 | import Ember from 'ember';
var proxyGenerator = function(name){
return function(msg = '', title = '') {
window.toastr[name](msg.toString(), title.toString());
};
};
export function initialize() {
// support 1.x and 2.x
var application = arguments[1] || arguments[0];
var injectAs = options.injectAs;
w... | import Ember from 'ember';
var proxyGenerator = function(name){
return function(msg = '', title = '') {
window.toastr[name](msg.toString(), title.toString());
};
};
export function initialize(container, application, options) {
var injectAs = options.injectAs;
window.toastr.options = options.toastrOptions;... |
FIX broken markdown and entities | const MySql = require("./MySql.js");
const entities = require("entities");
class Meet{
constructor(obj){
Object.keys(obj).forEach(k=>this[k]=entities.decodeHTML(obj[k]));
}
asMarkdown(){
return `*${this.post_title}* ${this.meet_start_time}\n${this.guid}`;
}
}
Meet.fromObjArray = function(objArray){
... | const MySql = require("./MySql.js");
class Meet{
constructor(obj){
Object.keys(obj).forEach(k=>this[k]=obj[k]);
}
asMarkdown(){
return `*${this.post_title}* ${this.meet_start_time}\n_${this.guid}_`;
}
}
Meet.fromObjArray = function(objArray){
return objArray.map(o=>new Meet(o));
};
function getAll... |
Remove custom security manager after test finishes | package org.gbif.checklistbank.ws.resources;
import java.security.Permission;
import org.gbif.ws.app.Application;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.fail;
public class WsAppTest {
private SecurityManager sm;
@Before
public void init(){
... | package org.gbif.checklistbank.ws.resources;
import java.security.Permission;
import org.gbif.ws.app.Application;
import org.junit.Test;
import static org.junit.Assert.fail;
public class WsAppTest {
/**
* Test the startup of the webapp.
* We expect a SecurityException raised as the Application stops becau... |
Remove unecessary initialization from Route model | from app import db
class Base(db.Model):
__abstract__ = True
id = db.Column(db.Integer, primary_key=True)
created_at = db.Column(db.DateTime, default=db.func.current_timestamp())
updated_at = db.Column(db.DateTime, default=db.func.current_timestamp())
class Route(Base):
__tablename__ = 'route... | from app import db
class Base(db.Model):
__abstract__ = True
id = db.Column(db.Integer, primary_key=True)
created_at = db.Column(db.DateTime, default=db.func.current_timestamp())
updated_at = db.Column(db.DateTime, default=db.func.current_timestamp())
class Route(Base):
__tablename__ = 'route... |
Fix packaging to resolve the PEP420 namespace
Setuptools is still lacking support for PEP480 namespace packages
when using the find_packages function. Until it does all packages,
including the namespace, must be registered in the packages list. | """Setuptools configuration for interfaces."""
from setuptools import setup
from setuptools import find_packages
with open('README.rst', 'r') as readmefile:
README = readmefile.read()
setup(
name='asyncdef.interfaces',
version='0.1.3',
url='https://github.com/asyncdef/interfaces',
description='... | """Setuptools configuration for interfaces."""
from setuptools import setup
from setuptools import find_packages
with open('README.rst', 'r') as readmefile:
README = readmefile.read()
setup(
name='asyncdef.interfaces',
version='0.1.0',
url='https://github.com/asyncdef/interfaces',
description='... |
Set Global Variable action created | package structures.data.actions.library;
import structures.data.DataAction;
import structures.data.actions.params.CheckboxParam;
import structures.data.actions.params.GroovyParam;
import structures.data.actions.params.StringParam;
public class SetGlobalVariable extends DataAction {
public SetGlobalVariable(){
ini... | package structures.data.actions.library;
import structures.data.DataAction;
import structures.data.actions.params.CheckboxParam;
import structures.data.actions.params.DoubleParam;
import structures.data.actions.params.StringParam;
public class SetGlobalVariable extends DataAction {
public SetGlobalVariable(){
ini... |
Make logs dir if missing | <?php
function debug_collectionInfoStart($debug, $log) {
if ($debug == TRUE) {
debug("[DEBUG] Collecting data\n", $log);
}
}
function debug_collectionInfoEnd($debug, $log) {
if ($debug == TRUE) {
debug("[DEBUG] Finished collecting data\n\n", $log);
}
}
function debug_collectionInterva... | <?php
function debug_collectionInfoStart($debug, $log) {
if ($debug == TRUE) {
debug("[DEBUG] Collecting data\n", $log);
}
}
function debug_collectionInfoEnd($debug, $log) {
if ($debug == TRUE) {
debug("[DEBUG] Finished collecting data\n\n", $log);
}
}
function debug_collectionInterva... |
Bump version number and tag release | # The MIT License
#
# Copyright (c) 2008 Bob Farrell
#
# 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, modify, mer... | # The MIT License
#
# Copyright (c) 2008 Bob Farrell
#
# 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, modify, mer... |
Adjust serialization artifacts to match RI.
svn path=/incubator/harmony/enhanced/classlib/trunk/; revision=414445 | /*
* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
*
* 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... | /*
* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
*
* 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... |
Fix for backwards trigger check on Art of Peace | const ProvinceCard = require('../../provincecard.js');
class TheArtOfPeace extends ProvinceCard {
setupCardAbilities() {
this.interrupt({
title: 'Honor all defenders and dishonor all attackers',
when: {
onBreakProvince: (event, context) => event.card === context.sour... | const ProvinceCard = require('../../provincecard.js');
class TheArtOfPeace extends ProvinceCard {
setupCardAbilities() {
this.interrupt({
title: 'Honor all defenders and dishonor all attackers',
when: {
onBreakProvince: (event, context) => event.card === context.sour... |
Add line to save an entity in test | package servers;
import com.onyx.application.WebDatabaseServer;
import entities.SimpleEntity;
/**
* Created by timothy.osborn on 4/1/15.
*/
public class SampleDatabaseServer extends WebDatabaseServer
{
public SampleDatabaseServer()
{
}
/**
* Run Database Server
*
* ex: executable /... | package servers;
import com.onyx.application.WebDatabaseServer;
import entities.SimpleEntity;
/**
* Created by timothy.osborn on 4/1/15.
*/
public class SampleDatabaseServer extends WebDatabaseServer
{
public SampleDatabaseServer()
{
}
/**
* Run Database Server
*
* ex: executable /... |
Handle unauthorized exceptions (do not pollute error log) | <?php
if (defined('PHAST_SERVICE')) {
$service = PHAST_SERVICE;
} else if (!isset ($_GET['service'])) {
http_response_code(404);
exit;
} else {
$service = $_GET['service'];
}
if (isset ($_GET['src']) && !headers_sent()) {
header('Location: ' . $_GET['src']);
} else {
http_response_code(404);
... | <?php
if (defined('PHAST_SERVICE')) {
$service = PHAST_SERVICE;
} else if (!isset ($_GET['service'])) {
http_response_code(404);
exit;
} else {
$service = $_GET['service'];
}
if (isset ($_GET['src']) && !headers_sent()) {
header('Location: ' . $_GET['src']);
} else {
http_response_code(404);
... |
Add id to Geek schema (we need it on client side!). | require.paths.unshift(__dirname + "/vendor/rest-mongo/src")
var rest_mongo = require("rest-mongo")
var schema = {
Geek: {
schema: {
id: "Geek",
description: "A geek / person / dev ...",
type: "object",
properties: {
id: {type: "string"},
name: {type: "string"},
... | require.paths.unshift(__dirname + "/vendor/rest-mongo/src")
var rest_mongo = require("rest-mongo")
var schema = {
Geek: {
schema: {
id: "Geek",
description: "A geek / person / dev ...",
type: "object",
properties: {
name: {type: "string"},
pole: {type: "string"},
... |
Apply class comments and refactor spacing | /*
* Copyright 2015 Ryan Gilera.
*
* 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 ... | /*
* Copyright 2015 Ryan Gilera.
*
* 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 ... |
Change api route for consistency | #!/usr/bin/env node
var path = require('path');
var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var apiRouter = require('./lib/apiRouter.js');
var status = require('./lib/statusMiddleware.js');
var uploads = require('./lib/uploadMiddlewares.js');
var... | #!/usr/bin/env node
var path = require('path');
var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var apiRouter = require('./lib/apiRouter.js');
var status = require('./lib/statusMiddleware.js');
var uploads = require('./lib/uploadMiddlewares.js');
var... |
NEW: Add link to the pull request that fix the issue. | var scrapinode = require('./../main.js')();
// Issue with this page similar to https://github.com/tmpvar/jsdom/issues/290
// Fix https://github.com/tmpvar/jsdom/pull/387
// Works great with cheerio
var url = 'http://www.dell.com/uk/p/xps-15z/pd?oc=n0015z01epp&model_id=xps-15z&';
scrapinode.createScraper(url,'jsdom',f... | var scrapinode = require('./../main.js')();
// Issue with this page similar to https://github.com/tmpvar/jsdom/issues/290
// Works great with cheerio
var url = 'http://www.dell.com/uk/p/xps-15z/pd?oc=n0015z01epp&model_id=xps-15z&';
scrapinode.createScraper(url,'jsdom',function(err,scraper){
if(err){
console.lo... |
Fix ESLint error causing Travis build to fail
'jsx-max-props-per-line' rule | import React from 'react';
import commonUrl from 'shared/constants/commonLinks';
import LinkButton from 'shared/components/linkButton/linkButton';
import styles from './opCodeCon.css';
const OpCodeCon = () => (
<div className={styles.hero}>
<div className={styles.heading}>
<h1>OpCodeCon</h1>
<h3>Join... | import React from 'react';
import commonUrl from 'shared/constants/commonLinks';
import LinkButton from 'shared/components/linkButton/linkButton';
import styles from './opCodeCon.css';
const OpCodeCon = () => (
<div className={styles.hero}>
<div className={styles.heading}>
<h1>OpCodeCon</h1>
<h3>Join... |
Remove deployState parameter, forgotten during rebase to master.
- Was used for spooler only. | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.builder.xml.dom;
import com.yahoo.config.model.ConfigModelContext;
import com.yahoo.config.model.builder.xml.ConfigModelId;
import com.yahoo.vespa.model.clients.Clients;
... | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.builder.xml.dom;
import com.yahoo.config.model.ConfigModelContext;
import com.yahoo.config.model.builder.xml.ConfigModelId;
import com.yahoo.vespa.model.clients.Clients;
... |
Make test_get_application_access_token_raises_error compatible with Python < 2.7 | """Tests for the ``utils`` module."""
from mock import patch, Mock as mock
from nose.tools import *
from facepy import *
patch = patch('requests.session')
def mock():
global mock_request
mock_request = patch.start()().request
def unmock():
patch.stop()
@with_setup(mock, unmock)
def test_get_applicati... | """Tests for the ``utils`` module."""
from mock import patch, Mock as mock
from nose.tools import *
from facepy import *
patch = patch('requests.session')
def mock():
global mock_request
mock_request = patch.start()().request
def unmock():
patch.stop()
@with_setup(mock, unmock)
def test_get_applicati... |
Fix indent and trailing whitespace. | var settings = require('ep_etherpad-lite/node/utils/Settings');
var githubAuth = require('github-auth');
var config = {
organization: settings.users.github.org,
autologin: true // This automatically redirects you to github to login.
};
var gh = githubAuth(settings.users.github.appId,settings.users.github.appSec... | var settings = require('ep_etherpad-lite/node/utils/Settings');
var githubAuth = require('github-auth');
var config = {
organization: settings.users.github.org,
autologin: true // This automatically redirects you to github to login.
};
var gh = githubAuth(settings.users.github.appId,settings.users.github.appSe... |
Add Response class for unsupported media | from django.http import HttpResponse
class HttpResponseCreated(HttpResponse):
status_code = 201
class HttpResponseNoContent(HttpResponse):
status_code = 204
class HttpResponseNotAllowed(HttpResponse):
status_code = 405
def __init__(self, allow_headers):
"""
RFC2616: The response MUST... | from django.http import HttpResponse
class HttpResponseCreated(HttpResponse):
status_code = 201
class HttpResponseNoContent(HttpResponse):
status_code = 204
class HttpResponseNotAllowed(HttpResponse):
status_code = 405
def __init__(self, allow_headers):
"""
RFC2616: The response MUST... |
Exclude filter expression from selector | 'use strict'
/**
* @license
* node-scrapy <https://github.com/eeshi/node-scrapy>
* Copyright Stefan Maric, Adrian Obelmejias, and other contributors <https://github.com/eeshi/node-scrapy/graphs/contributors>
* Released under MIT license <https://github.com/eeshi/node-scrapy/blob/master/LICENSE>
*/
module.exports... | 'use strict'
/**
* @license
* node-scrapy <https://github.com/eeshi/node-scrapy>
* Copyright Stefan Maric, Adrian Obelmejias, and other contributors <https://github.com/eeshi/node-scrapy/graphs/contributors>
* Released under MIT license <https://github.com/eeshi/node-scrapy/blob/master/LICENSE>
*/
module.exports... |
Rename the library sessions instead of Sessions | # Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
Change custom markup to asynchronous testing | 'use strict';
var _ = require('lodash');
var fs = require('fs');
var utility = require('../utility');
var handleFile = utility.handleExpectedFile;
describe('custom markup', function() {
before(function() {
var testHTML = document.querySelectorAll('#custom-markup .hljs');
this.blocks = _.map(tes... | 'use strict';
var _ = require('lodash');
var fs = require('fs');
var utility = require('../utility');
describe('custom markup', function() {
before(function() {
var testHTML = document.querySelectorAll('#custom-markup .hljs');
this.blocks = _.map(testHTML, 'innerHTML');
});
it('should repla... |
Fix amd part of umd to return r function correctly. | function r() {
var strings = arguments[0]; // template strings
var values = Array.prototype.slice.call(arguments, 1); // interpolation values
// concentrate strings and interpolations
var str = strings.raw.reduce(function(prev, cur, idx) {
return prev + values[idx-1] + cur;
})
.replace(/\r\n/g, '\n')... | function r() {
var strings = arguments[0]; // template strings
var values = Array.prototype.slice.call(arguments, 1); // interpolation values
// concentrate strings and interpolations
var str = strings.raw.reduce(function(prev, cur, idx) {
return prev + values[idx-1] + cur;
})
.replace(/\r\n/g, '\n')... |
Add missing use for \Doctrine\DBAL\Cache\QueryCacheProfile | <?php
namespace Bolt\Storage\Database;
use Bolt\Events\FailedConnectionEvent;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\DBALException;
/**
* Extension of DBAL's Connection class to allow catching of database connection
* exceptions.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
* @author ... | <?php
namespace Bolt\Storage\Database;
use Bolt\Events\FailedConnectionEvent;
use Doctrine\DBAL\DBALException;
/**
* Extension of DBAL's Connection class to allow catching of database connection
* exceptions.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
* @author Carson Full <carsonfull@gmail.com>
*/
clas... |
Add a test so that other regions are fine with DynamoDB using the STS service | var fmt = require('fmt');
var awssum = require('awssum');
var amazon = awssum.load('amazon/amazon');
var DynamoDB = awssum.load('amazon/dynamodb').DynamoDB;
var env = process.env;
var accessKeyId = env.ACCESS_KEY_ID;
var secretAccessKey = env.SECRET_ACCESS_KEY;
var awsAccountId = env.AWS_ACCOUNT_ID;... | var fmt = require('fmt');
var awssum = require('awssum');
var amazon = awssum.load('amazon/amazon');
var DynamoDB = awssum.load('amazon/dynamodb').DynamoDB;
var env = process.env;
var accessKeyId = env.ACCESS_KEY_ID;
var secretAccessKey = env.SECRET_ACCESS_KEY;
var awsAccountId = env.AWS_ACCOUNT_ID;... |
Switch to external source map | var path = require('path');
var webpack = require('webpack');
var webpackSettings = require('./webpack-helper');
module.exports = webpackSettings({
entry: {
'backbone': path.join(__dirname, './adaptors/backbone'),
'ampersand': path.join(__dirname, './adaptors/ampersand'),
'core': path.join(__dirname, './... | var path = require('path');
var webpack = require('webpack');
var webpackSettings = require('./webpack-helper');
module.exports = webpackSettings({
entry: {
'backbone': path.join(__dirname, './adaptors/backbone'),
'ampersand': path.join(__dirname, './adaptors/ampersand'),
'core': path.join(__dirname, './... |
Add overridden behaviour to testapp. | from django.db import models
from binder.models import BinderModel
from binder.exceptions import BinderValidationError
# From the api docs: an animal with a name. We don't use the
# CaseInsensitiveCharField because it's so much simpler to use
# memory-backed sqlite than Postgres in the tests. Eventually we
# might s... | from django.db import models
from binder.models import BinderModel
# From the api docs: an animal with a name. We don't use the
# CaseInsensitiveCharField because it's so much simpler to use
# memory-backed sqlite than Postgres in the tests. Eventually we
# might switch and require Postgres for tests, if we need man... |
Hide secret channels from /NAMES users | from twisted.words.protocols import irc
from txircd.modbase import Mode
class SecretMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "NAMES":
return data
remove = []
for chan in data["targetchan"]:
if "p" in chan.mode and chan.name not in user.channels:
user.sendMessage(irc.ERR_NOSUCH... | from txircd.modbase import Mode
class SecretMode(Mode):
def listOutput(self, command, data):
if command != "LIST":
return data
cdata = data["cdata"]
if "s" in cdata["channel"].mode and cdata["channel"].name not in data["user"].channels:
data["cdata"].clear()
# other +s stuff is hiding in other modules.
... |
Clean up content and header output | #!/usr/bin/env python
import BaseHTTPServer
ServerClass = BaseHTTPServer.HTTPServer
RequestHandlerClass = BaseHTTPServer.BaseHTTPRequestHandler
SERVER_NAME = ''
SERVER_PORT = 9000
class JsonPostResponder(RequestHandlerClass):
def _get_content_from_stream(self, length, stream):
return stream.read(length)... | #!/usr/bin/env python
import BaseHTTPServer
ServerClass = BaseHTTPServer.HTTPServer
RequestHandlerClass = BaseHTTPServer.BaseHTTPRequestHandler
SERVER_NAME = ''
SERVER_PORT = 9000
class JsonPostResponder(RequestHandlerClass):
def _get_content_from_stream(self, length, stream):
return stream.read(length)... |
Make test dependencies installable as an extra
Signed-off-by: Daniel Bluhm <6df8625bb799b640110458f819853f591a9910cb@sovrin.org> | from distutils.core import setup
import os
PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.9.0'
TEST_DEPS = [
'pytest<3.7', 'pytest-asyncio', 'base58'
]
setup(
name='python3-indy',
version=PKG_VERSION,
packages=['indy'],
url='https://github.com/hyperledger/indy-sdk',
license='MIT/Apache... | from distutils.core import setup
import os
PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '1.9.0'
setup(
name='python3-indy',
version=PKG_VERSION,
packages=['indy'],
url='https://github.com/hyperledger/indy-sdk',
license='MIT/Apache-2.0',
author='Vyacheslav Gudkov',
author_email='vyach... |
Replace hard coded timestamp with time.time() | # -*- coding: utf-8 -*-
import time
from chai import Chai
from arrow import util
class UtilTests(Chai):
def test_is_timestamp(self):
timestamp_float = time.time()
timestamp_int = int(timestamp_float)
self.assertTrue(util.is_timestamp(timestamp_int))
self.assertTrue(util.is_times... | # -*- coding: utf-8 -*-
from chai import Chai
from arrow import util
class UtilTests(Chai):
def test_is_timestamp(self):
timestamp_float = 1563047716.958061
timestamp_int = int(timestamp_float)
self.assertTrue(util.is_timestamp(timestamp_int))
self.assertTrue(util.is_timestamp(ti... |
Add storage role to inspector | package cmd
import (
"fmt"
"io"
"strings"
"github.com/apprenda/kismatic/pkg/inspector/rule"
)
func getNodeRoles(commaSepRoles string) ([]string, error) {
roles := strings.Split(commaSepRoles, ",")
for _, r := range roles {
if r != "etcd" && r != "master" && r != "worker" && r != "ingress" && r != "storage" {... | package cmd
import (
"fmt"
"io"
"strings"
"github.com/apprenda/kismatic/pkg/inspector/rule"
)
func getNodeRoles(commaSepRoles string) ([]string, error) {
roles := strings.Split(commaSepRoles, ",")
for _, r := range roles {
if r != "etcd" && r != "master" && r != "worker" && r != "ingress" {
return nil, fm... |
Upgrade missing element log to error | (function() {
var element = null;
var nav_elements = document.querySelectorAll('.nav-item-container');
for (var i = 0; i < nav_elements.length; i++) {
var current = nav_elements[i];
if (current.innerHTML == 'My Library') {
element = current;
break;
}
}
... | (function() {
var element = null;
var nav_elements = document.querySelectorAll('.nav-item-container');
for (var i = 0; i < nav_elements.length; i++) {
var current = nav_elements[i];
if (current.innerHTML == 'My Library') {
element = current;
break;
}
}
... |
Remove output_dir fixture from test | # -*- coding: utf-8 -*-
"""
test_create_template
--------------------
"""
import os
import pytest
import subprocess
def run_tox(plugin):
"""Run the tox suite of the newly created plugin."""
try:
subprocess.check_call([
'tox',
plugin,
'-c', os.path.join(plugin, 't... | # -*- coding: utf-8 -*-
"""
test_create_template
--------------------
"""
import os
import pytest
import subprocess
@pytest.fixture
def output_dir(tmpdir):
return str(tmpdir.mkdir('output'))
def run_tox(plugin):
"""Run the tox suite of the newly created plugin."""
try:
subprocess.check_call([... |
Add overlay option for debugging | const Environment = require('../environment')
const { dev_server } = require('../config')
const assetHost = require('../asset_host')
const webpack = require('webpack')
module.exports = class extends Environment {
constructor() {
super()
if (dev_server.hmr) {
this.plugins.set('HotModuleReplacement', ne... | const Environment = require('../environment')
const { dev_server } = require('../config')
const assetHost = require('../asset_host')
const webpack = require('webpack')
module.exports = class extends Environment {
constructor() {
super()
if (dev_server.hmr) {
this.plugins.set('HotModuleReplacement', ne... |
Change the call of httpGet, now it will work with button | /**
* Print the current url
*/
chrome.tabs.query({ active: true, lastFocusedWindow: true},
function(array_of_Tabs) { // Since there can only be one active tab in one active window,
// the array has only one element
var tab = array_of_Tabs[0];
var url = tab.url;
c... | /**
* Print the current url
*/
chrome.tabs.query({ active: true, lastFocusedWindow: true},
function(array_of_Tabs) { // Since there can only be one active tab in one active window,
// the array has only one element
var tab = array_of_Tabs[0];
var url = tab.url;
c... |
Document that this part of the unit test code must remain in src/
git-svn-id: 7c053b8fbd1fb5868f764c6f9536fc6a9bbe7da9@602096 13f79535-47bb-0310-9956-ffa450edef68 | /*
* 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 may ... | /*
* 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 may ... |
Fix incorrect call to database and sloppy callback | // FIXME: don't use hardcoded params
var nano = require('nano')('http://localhost:5984');
var db = nano.db.use('todo');
var todo = {};
todo.getAll = function(callback) {
var results = [];
db.view('todos', 'all_todos', function(err, body) {
for (var row of body.rows) {
results.push(row.value);
}
... | // FIXME: don't use hardcoded params
var nano = require('nano')('http://localhost:5984');
var db = nano.db.use('todo');
var todo = {};
todo.getAll = function(callback) {
var results = [];
db.view('todos', 'all_todos', function(err, body) {
for (var row of body.rows) {
results.push(row.value);
}
... |
Add test for link redirect | from django.test import Client, TestCase
from .models import Category, Link
class CategoryModelTests(TestCase):
def test_category_sort(self):
Category(title='Test 2', slug='test2').save()
Category(title='Test 1', slug='test1').save()
self.assertEqual(['Test 1', 'Test 2'], map(str, Catego... | from django.test import TestCase
from .models import Category, Link
class CategoryModelTests(TestCase):
def test_category_sort(self):
Category(title='Test 2', slug='test2').save()
Category(title='Test 1', slug='test1').save()
self.assertEqual(['Test 1', 'Test 2'], map(str, Category.objec... |
Remove not needed callback arguments 💀 | var buildFile = require('./build-file')
var runGitCommand = require('./helpers/run-git-command')
var COMMITHASH_COMMAND = 'rev-parse HEAD'
var VERSION_COMMAND = 'describe --always'
function GitRevisionPlugin (options) {
this.gitWorkTree = options && options.gitWorkTree
this.lightweightTags = options && options.li... | var buildFile = require('./build-file')
var runGitCommand = require('./helpers/run-git-command')
var COMMITHASH_COMMAND = 'rev-parse HEAD'
var VERSION_COMMAND = 'describe --always'
function GitRevisionPlugin (options) {
this.gitWorkTree = options && options.gitWorkTree
this.lightweightTags = options && options.li... |
API: Clear embargo fields once embargo processed | <?php
/**
* A queued job that publishes a target after a delay.
*
* @package advancedworkflow
*/
class WorkflowPublishTargetJob extends AbstractQueuedJob {
public function __construct($obj = null, $type = null) {
if ($obj) {
$this->setObject($obj);
$this->publishType = $type ? strtolower($type) : 'publish... | <?php
/**
* A queued job that publishes a target after a delay.
*
* @package advancedworkflow
*/
class WorkflowPublishTargetJob extends AbstractQueuedJob {
public function __construct($obj = null, $type = null) {
if ($obj) {
$this->setObject($obj);
$this->publishType = $type ? strtolower($type) : 'publish... |
Change test to reflect changes to coords | const chai = require('chai')
const assert = chai.assert;
const sinon = require('sinon');
const Bumper = require("../lib/bumper")
describe("Bumper", function(){
context("with assigned attributes", function(){
var bumper = new Bumper({minX: 0, minY:0, maxX:10, maxY:10})
it("should have an x min position", fun... | const chai = require('chai')
const assert = chai.assert;
const sinon = require('sinon');
const Bumper = require("../lib/bumper")
describe("Bumper", function(){
context("with assigned attributes", function(){
var bumper = new Bumper(0,0,10,10)
it("should have an x min position", function(){
assert.equa... |
Increase timeout for trakt.tv API calls | 'use strict';
var Settings = require('./settings.js');
var ChromeStorage = require('./chrome-storage.js');
function Request() {};
Request._send = function _send(options, accessToken) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
xhr.setRequestHeader('Content-type', 'applicatio... | 'use strict';
var Settings = require('./settings.js');
var ChromeStorage = require('./chrome-storage.js');
function Request() {};
Request._send = function _send(options, accessToken) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
xhr.setRequestHeader('Content-type', 'applicatio... |
Load default.js if it exists. | var pageMod = require('page-mod'),
data = require('self').data,
file = require('file'),
url = require('url');
pageMod.PageMod({
include: "*",
contentScriptWhen: 'ready',
contentScriptFile: data.url('jquery-1.5.min.js'),
contentScript:
'(function($) {' +
'onMessage = func... | var pageMod = require('page-mod'),
data = require('self').data,
file = require('file'),
url = require('url');
pageMod.PageMod({
include: "*",
contentScriptWhen: 'ready',
contentScriptFile: data.url('jquery-1.5.min.js'),
contentScript:
'(function($) {' +
'onMessage = func... |
Add a border until we can theme this sucker | <?php
function pubsites_content(&$a) {
$dirmode = intval(get_config('system','directory_mode'));
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
$url = z_root() . '/dirsearch';
}
if(! $url) {
$directory = find_upstream_directory($dirmode);
if($directory) {
$url = $... | <?php
function pubsites_content(&$a) {
$dirmode = intval(get_config('system','directory_mode'));
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
$url = z_root() . '/dirsearch';
}
if(! $url) {
$directory = find_upstream_directory($dirmode);
if($directory) {
$url = $... |
Remove support for Webpack 3.x and prior from `WatchTimestampsPlugin`. | const fs = require('fs');
/** A Webpack plugin to refresh file mtime values from disk before compiling.
* This is used in order to account for SCSS-generated .d.ts files written
* as part of compilation so they trigger only a single recompile per write.
*
* All credit for the technique and implementation goes t... | const fs = require('fs');
/** A Webpack plugin to refresh file mtime values from disk before compiling.
* This is used in order to account for SCSS-generated .d.ts files written
* as part of compilation so they trigger only a single recompile per write.
*
* All credit for the technique and implementation goes t... |
Change path following import of build folder | import os,sys
#General vars
CURDIR=os.path.dirname(os.path.abspath(__file__))
TOPDIR=os.path.dirname(os.path.dirname(CURDIR))
DOWNLOAD_DIR=os.path.join(TOPDIR,'downloads')
#Default vars
PY_VER='Python27'
BIN_DIR=os.path.join(TOPDIR,'bin')
PY_DIR=os.path.join(BIN_DIR,PY_VER) #Don't mess with PYTHONHOME
##... | import os,sys
#General vars
CURDIR=os.path.dirname(os.path.abspath(__file__))
TOPDIR=os.path.dirname(CURDIR)
DOWNLOAD_DIR=TOPDIR+'\\downloads'
#Default vars
PY_VER='Python27'
BIN_DIR=TOPDIR+'\\bin'
PY_DIR=BIN_DIR+'\\'+PY_VER #Don't mess with PYTHONHOME
####################################################... |
Update the sample proxy list | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... |
Send QR Code when riddle created | <?php
/**
* CodeMOOC QuizzleBot
* ===================
* UWiClab, University of Urbino
* ===================
* Command message processing functionality.
*/
/**
* Processes commands.
* @return bool True if the message was handled.
*/
function process_command($context, $text) {
$command = extract_command($te... | <?php
/**
* CodeMOOC QuizzleBot
* ===================
* UWiClab, University of Urbino
* ===================
* Command message processing functionality.
*/
/**
* Processes commands.
* @return bool True if the message was handled.
*/
function process_command($context, $text) {
$command = extract_command($te... |
Update repository addresses and emails | #!/usr/bin/env python
import os.path
from distutils.core import setup
README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read()
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Py... | #!/usr/bin/env python
import os.path
from distutils.core import setup
README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read()
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Py... |
Remove extra space at EOL | <?php
namespace Test\View;
use Slim\Slim;
use Twig\Test\IntegrationTestCase;
use View\FiltersExtension;
use View\FunctionsExtension;
class TwigExtensionIntegrationTest extends IntegrationTestCase
{
private $slim;
public function setUp(): void
{
$this->slim = $this->getMockBuilder(Slim::class)
... | <?php
namespace Test\View;
use Slim\Slim;
use Twig\Test\IntegrationTestCase;
use View\FiltersExtension;
use View\FunctionsExtension;
class TwigExtensionIntegrationTest extends IntegrationTestCase
{
private $slim;
public function setUp(): void
{
$this->slim = $this->getMockBuilder(Slim::class)
... |
Fix a typo in the contents constraints creation. | #------------------------------------------------------------------------------
# Copyright (c) 2013, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
STRENGTHS = set(['required', 'strong', 'medium', 'weak'])
def add_symbolic_constraints(namesp... | #------------------------------------------------------------------------------
# Copyright (c) 2013, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
STRENGTHS = set(['required', 'strong', 'medium', 'weak'])
def add_symbolic_constraints(namesp... |
Set fallback to true on get text to avoid crash on missing language file | # -*- coding: utf-8 -*-
import os
import config
import gettext
# Change this variable to your app name!
# The translation files will be under
# @LOCALE_DIR@/@LANGUAGE@/LC_MESSAGES/@APP_NAME@.mo
APP_NAME = "simpleValidator"
LOCALE_DIR = os.path.abspath('lang') # .mo files will then be located in APP_Dir/i18n/LAN... | # -*- coding: utf-8 -*-
import os
import config
import gettext
# Change this variable to your app name!
# The translation files will be under
# @LOCALE_DIR@/@LANGUAGE@/LC_MESSAGES/@APP_NAME@.mo
APP_NAME = "simpleValidator"
LOCALE_DIR = os.path.abspath('lang') # .mo files will then be located in APP_Dir/i18n/LAN... |
Add URL for django admin access to screenshots | from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from . import views
from projects.views import screenshot
urlpatterns = patterns('',
# Examples:
# url(r'^blog/', inclu... | from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from . import views
from projects.views import screenshot
urlpatterns = patterns('',
# Examples:
# url(r'^blog/', inclu... |
Fix console output bug in history | (function()
{
angular
.module('history')
.controller('HistoryController', HistoryController);
HistoryController.$inject = ['$scope', '$state', 'localStorage', 'HistoryService', 'SettingsService'];
function HistoryController($scope, $state, localStorage, HistoryService, SettingsService)
{
$scope.hi... | (function()
{
angular
.module('history')
.controller('HistoryController', HistoryController);
HistoryController.$inject = ['$scope', '$state', 'localStorage', 'HistoryService', 'SettingsService'];
function HistoryController($scope, $state, localStorage, HistoryService, SettingsService)
{
$scope.hi... |
Use formatted log values instead of raw values when emitting to Socket.io, to avoid errors when exceptions are thrown and Socket.io tries to pack them | <?php
/**
* @file
*/
namespace CultuurNet\UDB3\Monolog;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
use SocketIO\Emitter;
class SocketIOEmitterHandler extends AbstractProcessingHandler
{
/**
* @var ... | <?php
/**
* @file
*/
namespace CultuurNet\UDB3\Monolog;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
use SocketIO\Emitter;
class SocketIOEmitterHandler extends AbstractProcessingHandler
{
/**
* @var Emitter
*/
protected $emitter;
/**
* @param Emitter $emitter
... |
Add reverse relationship serializer to Category | from .models import Category, Keyword, Subcategory
from rest_framework import serializers
class KeywordSerializer(serializers.ModelSerializer):
class Meta:
model = Keyword
fields = ('pk', 'name')
class KeywordListSerializer(serializers.ModelSerializer):
class Meta:
model ... | from .models import Category, Keyword, Subcategory
from rest_framework import serializers
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('pk', 'name', 'weight', 'comment_required')
class KeywordSerializer(serializers.ModelSerializer):
... |
chore: Fix lint problem in cleanup-plugin |
function cleanupPlugins(resolve, reject) {
'use strict';
if (!axe._audit) {
throw new Error('No audit configured');
}
var q = axe.utils.queue();
// If a plugin fails it's cleanup, we still want the others to run
var cleanupErrors = [];
Object.keys(axe.plugins).forEach(function (key) {
... |
function cleanupPlugins(resolve, reject) {
'use strict';
if (!axe._audit) {
throw new Error('No audit configured');
}
var q = axe.utils.queue();
// If a plugin fails it's cleanup, we still want the others to run
var cleanupErrors = [];
Object.keys(axe.plugins).forEach(function (key) {
... |
Add "hurt" flag to Bleed effect
So you can use the effect without the hurt part. | package de.slikey.effectlib.effect;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import de.slikey.effectlib.EffectManager;
import de.slikey.effectlib.EffectType;
import de.slikey.effectlib.util.RandomUtils;
public class BleedEntityEffect extends EntityEffect {
public bo... | package de.slikey.effectlib.effect;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import de.slikey.effectlib.EffectManager;
import de.slikey.effectlib.EffectType;
import de.slikey.effectlib.util.RandomUtils;
public class BleedEntityEffect extends EntityEffect {
/**
* Dura... |
Rework imports and ignore known mypy issues | # Copyright 2018 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | # Copyright 2018 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
Put numpy namespace in scipy for backward compatibility...
git-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@1530 d6536bca-fef9-0310-8506-e4c0a848fbcf | """\
SciPy --- A scientific computing package for Python
===================================================
You can support the development of SciPy by purchasing documentation
at
http://www.trelgol.com
It is being distributed for a fee for a limited time to try and raise
money for development.
Documentation is ... | """\
SciPy --- A scientific computing package for Python
===================================================
You can support the development of SciPy by purchasing documentation
at
http://www.trelgol.com
It is being distributed for a fee for a limited time to try and raise
money for development.
Documentation is ... |
Allow method PATCH in cors | require('babel-register')
import Koa from 'koa'
import cors from 'koa2-cors'
import Router from 'koa-router'
import bodyParser from 'koa-bodyparser'
import serve from 'koa-static'
import mongoose from 'mongoose'
import error from './middlewares/error'
import logger from './middlewares/logger'
import route from './rou... | require('babel-register')
import Koa from 'koa'
import cors from 'koa2-cors'
import Router from 'koa-router'
import bodyParser from 'koa-bodyparser'
import serve from 'koa-static'
import mongoose from 'mongoose'
import error from './middlewares/error'
import logger from './middlewares/logger'
import route from './rou... |
Add depots into Import and increase mime version to 2.2 | package fi.cosky.sdk;
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
import java.util.List;
public class ImportData extends BaseData {
public static final String MimeType = "application/vnd.jyu.nfleet.import";
public static fina... | package fi.cosky.sdk;
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
import java.util.List;
public class ImportData extends BaseData {
public static final String MimeType = "application/vnd.jyu.nfleet.import";
public static fina... |
Fix Travis errors on recent Go | package main
import (
"flag"
"image"
"log"
"os"
"github.com/pixiv/go-libjpeg/jpeg"
)
func main() {
flag.Parse()
file := flag.Arg(0)
io, err := os.Open(file)
if err != nil {
log.Fatalln("Can't open file: ", file)
}
img, err := jpeg.Decode(io, &jpeg.DecoderOptions{})
if img == nil {
log.Fatalln("Got ... | package main
import (
"flag"
"image"
"log"
"os"
"github.com/pixiv/go-libjpeg/jpeg"
)
func main() {
flag.Parse()
file := flag.Arg(0)
io, err := os.Open(file)
if err != nil {
log.Fatalln("Can't open file: ", file)
}
img, err := jpeg.Decode(io, &jpeg.DecoderOptions{})
if img == nil {
log.Fatalln("Got ... |
Add GraphQL type for ContentType | import graphene
from django.contrib.contenttypes.models import ContentType
from graphene.types.generic import GenericScalar
from graphene_django import DjangoObjectType
__all__ = (
'BaseObjectType',
'ObjectType',
'TaggedObjectType',
)
#
# Base types
#
class BaseObjectType(DjangoObjectType):
"""
... | import graphene
from graphene.types.generic import GenericScalar
from graphene_django import DjangoObjectType
__all__ = (
'BaseObjectType',
'ObjectType',
'TaggedObjectType',
)
class BaseObjectType(DjangoObjectType):
"""
Base GraphQL object type for all NetBox objects
"""
class Meta:
... |
Add etc/* files to wheel | from setuptools import setup, find_packages
import sys
install_requires_list = [
'falcon>=0.1.8',
'requests',
'six>=1.4.1',
'oslo.config>=1.2.0',
'softlayer',
'pycrypto',
'iso8601',
]
if sys.version_info[0] < 3:
install_requires_list.append('py2-ipaddress')
... | from setuptools import setup, find_packages
import sys
install_requires_list = [
'falcon>=0.1.8',
'requests',
'six>=1.4.1',
'oslo.config>=1.2.0',
'softlayer',
'pycrypto',
'iso8601',
]
if sys.version_info[0] < 3:
install_requires_list.append('py2-ipaddress')
... |
Use query parameters to limit results | from flask import Flask
from flask import render_template
from flask import request
import argparse
import games
import json
GAMES_COUNT = 100
app = Flask(__name__)
@app.route("/")
def index():
return render_template('games_list.html')
@app.route("/api/")
def games_api():
limit = request.args.get('limi... | from flask import Flask
from flask import render_template
import argparse
import games
import json
GAMES_COUNT = 100
app = Flask(__name__)
@app.route("/")
def index():
return render_template('games_list.html')
@app.route("/api/")
def games_api():
return json.dumps(game_list)
if __name__ == "__main__"... |
Add call controller in method start app | <?php
namespace Uphp\web;
use \UPhp\ActionDispach\Routes as Route;
use \UPhp\ActionController\ActionController;
class Application
{
public function __construct()
{
set_exception_handler("src\uphpExceptionHandler");
set_error_handler("src\uphpErrorHandler");
}
public function start($co... | <?php
namespace Uphp\web;
use \UPhp\ActionDispach\Routes as Route;
use \UPhp\ActionController\ActionController;
class Application
{
public function __construct()
{
set_exception_handler("src\uphpExceptionHandler");
set_error_handler("src\uphpErrorHandler");
}
public function start($co... |
Add new line on the end of every message | 'use strict';
const dateformat = require('dateformat');
const directory = require('./directory');
const fs = require('fs');
const path = require('path');
module.exports = {
'_get_message': function (data) {
const hour = dateformat('HH:MM:ss');
return '[' + hour + ']: ' + data + '\n';
},
'... | 'use strict';
const dateformat = require('dateformat');
const directory = require('./directory');
const fs = require('fs');
const path = require('path');
module.exports = {
'_get_message': function (data) {
const hour = dateformat('HH:MM:ss');
return '[' + hour + ']: ' + data;
},
'log': f... |
Fix typos in Swedish weekdays translation | // Swedish
$.extend( $.fn.pickadate.defaults, {
monthsFull: [ 'januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december' ],
monthsShort: [ 'jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec' ],
weekdaysFull: [ 'sön... | // Swedish
$.extend( $.fn.pickadate.defaults, {
monthsFull: [ 'januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december' ],
monthsShort: [ 'jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec' ],
weekdaysFull: [ 'sö... |
Disable troublesome imports for now | import { Controller } from 'stimulus'
// import '@ap-spectrum-web-components/slider'
// import '@spectrum-web-components/theme/lib/theme-lightest'
// import '@spectrum-web-components/theme/lib/scale-large'
// import '@spectrum-web-components/theme/lib/theme'
export default class extends Controller {
static targets =... | import { Controller } from 'stimulus'
import '@ap-spectrum-web-components/slider'
import '@spectrum-web-components/theme/lib/theme-lightest'
import '@spectrum-web-components/theme/lib/scale-large'
import '@spectrum-web-components/theme/lib/theme'
export default class extends Controller {
static targets = ['image']
... |
Fix Travis build by using require("../main") instead of require("recast"). | var assert = require("assert"),
fs = require("fs"),
path = require("path");
function identity(ast, callback) {
assert.deepEqual(ast.original, ast);
callback(ast);
}
function testFile(t, path) {
fs.readFile(path, "utf-8", function(err, source) {
assert.equal(err, null);
assert.stric... | var assert = require("assert"),
fs = require("fs"),
path = require("path");
function identity(ast, callback) {
assert.deepEqual(ast.original, ast);
callback(ast);
}
function testFile(t, path) {
fs.readFile(path, "utf-8", function(err, source) {
assert.equal(err, null);
assert.stric... |
Remove buttons added in the wrong step. | define(function (require, exports, module) {
var definition = ['todoList'];
var getTemplate = function () {
var template = '';
template += '<ul>';
template += ' <li ng-repeat="task in tasks track by task.id">';
template += ' <span ng-bind="task.title"></span>';
... | define(function (require, exports, module) {
var definition = ['todoList'];
var getTemplate = function () {
var template = '';
template += '<ul>';
template += ' <li ng-repeat="task in tasks track by task.id">';
template += ' <span ng-bind="task.title"></span>';
... |
Fix MappingInstantiationException for no default constructor | /*
* Copyright 2015 the original author or authors.
*
* 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... | /*
* Copyright 2015 the original author or authors.
*
* 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... |
Update work around for disabling store caching | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout,
store: Ember.inject.service(),
internalState: Ember.inject.service(),
leftTitle: null,
leftView: null,
leftPanelColor: null,
leftModel: null,
rightTitle: null,
rightView: ... | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout,
store: Ember.inject.service(),
internalState: Ember.inject.service(),
leftTitle: null,
leftView: null,
leftPanelColor: null,
leftModel: null,
rightTitle: null,
rightView: ... |
Change environment attribute name to datetime_format | # -*- coding: utf-8 -*-
import arrow
from jinja2 import nodes
from jinja2.ext import Extension
class TimeExtension(Extension):
tags = set(['now'])
def __init__(self, environment):
super(TimeExtension, self).__init__(environment)
# add the defaults to the environment
environment.ext... | # -*- coding: utf-8 -*-
import arrow
from jinja2 import nodes
from jinja2.ext import Extension
class TimeExtension(Extension):
tags = set(['now'])
def __init__(self, environment):
super(TimeExtension, self).__init__(environment)
# add the defaults to the environment
environment.ext... |
Allow cross-origin headers on dev builds | import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_mail import Mail
from flask_login import LoginManager
from rauth import OAuth2Service
app = Flask(__name__)
BASE_FOLDER = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
app.static_f... | import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_mail import Mail
from flask_login import LoginManager
from rauth import OAuth2Service
app = Flask(__name__)
BASE_FOLDER = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
app.static_f... |
Change version 0.1.4 to 0.1.5 | from setuptools import setup
from sys import version
if version < '2.6.0':
raise Exception("This module doesn't support any version less than 2.6")
import sys
sys.path.append("./test")
with open('README.rst', 'r') as f:
long_description = f.read()
classifiers = [
'Development Status :: 4 - Beta',
'I... | from setuptools import setup
from sys import version
if version < '2.6.0':
raise Exception("This module doesn't support any version less than 2.6")
import sys
sys.path.append("./test")
with open('README.rst', 'r') as f:
long_description = f.read()
classifiers = [
'Development Status :: 4 - Beta',
'I... |
Support to check the ast node is valid or not | /**
* Using esprima JS parser to parse AST
* @lastmodifiedBy ChengFuLin(chengfulin0806@gmail.com)
* @lastmodifiedDate 2015-07-27
*/
/** Import esprima module */
var esprima = require('esprima');
/**
* JS parser
* @constructor
*/
function JSParser() {
}
/* start-public-methods */
/**
* Check if the node is an... | /**
* Using esprima JS parser to parse AST
* @lastmodifiedBy ChengFuLin(chengfulin0806@gmail.com)
* @lastmodifiedDate 2015-07-27
*/
/** Import esprima module */
var esprima = require('esprima');
/**
* JS parser
* @constructor
*/
function JSParser() {
}
/**
* Parse the code to AST with specified options for e... |
Store magic test. On MacOSX the temp dir in /var is symlinked into /private/var thus making this comparison fail. This is solved by using os.path.realpath to expand the tempdir into is's real directory. | import tempfile, os
import nose.tools as nt
ip = get_ipython()
ip.magic('load_ext storemagic')
def test_store_restore():
ip.user_ns['foo'] = 78
ip.magic('alias bar echo "hello"')
tmpd = tempfile.mkdtemp()
ip.magic('cd ' + tmpd)
ip.magic('store foo')
ip.magic('store bar')
# Check stor... | import tempfile, os
import nose.tools as nt
ip = get_ipython()
ip.magic('load_ext storemagic')
def test_store_restore():
ip.user_ns['foo'] = 78
ip.magic('alias bar echo "hello"')
tmpd = tempfile.mkdtemp()
ip.magic('cd ' + tmpd)
ip.magic('store foo')
ip.magic('store bar')
# Check stor... |
Fix syntax bug on stream emptying | import time
import numpy as np
import pyaudio
import config
def start_stream(callback):
p = pyaudio.PyAudio()
frames_per_buffer = int(config.MIC_RATE / config.FPS)
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=config.MIC_RATE,
input=Tr... | import time
import numpy as np
import pyaudio
import config
def start_stream(callback):
p = pyaudio.PyAudio()
frames_per_buffer = int(config.MIC_RATE / config.FPS)
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=config.MIC_RATE,
input=Tr... |
Fix mac - OS buttons overlap with back/forward buttons
requies https://github.com/brave/electron/commit/92c9e25 | /* 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/. */
'use strict'
/**
* Get list of styles which should be applied to root window div
* return array of strings (eac... | /* 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/. */
'use strict'
const os = require('os')
/**
* Get list of styles which should be applied to root window div
* re... |
Make linter know when JSX is using React variable | module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"installedESLint": true,
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"s... | module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"installedESLint": true,
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"s... |
Fix for adjust parent method definition | <?php
/*
* This file is part of the Eulogix\Cool package.
*
* (c) Eulogix <http://www.eulogix.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Eulogix\Cool\Lib\Database\Propel\generator\platform;
/**
* @author Pie... | <?php
/*
* This file is part of the Eulogix\Cool package.
*
* (c) Eulogix <http://www.eulogix.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Eulogix\Cool\Lib\Database\Propel\generator\platform;
/**
* @author Pie... |
1.0.0: Change URL to point to trac-hacks.org | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Sebastian Krysmanski
# Copyright (C) 2012 Greg Lavallee
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from setuptools import setup
PACKAGE = 'TicketGuidelinesPl... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Sebastian Krysmanski
# Copyright (C) 2012 Greg Lavallee
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from setuptools import setup
PACKAGE = 'TicketGuidelinesPl... |
Include assertFileExists and assertFileNotExists as public. | <?php
namespace Codeception\Module;
use Codeception\Module as CodeceptionModule;
use \Codeception\Util\Shared\Asserts as SharedAsserts;
/**
* Special module for using asserts in your tests.
*
*/
class Asserts extends CodeceptionModule
{
use SharedAsserts {
assertEquals as public;
assertNotEqual... | <?php
namespace Codeception\Module;
use Codeception\Module as CodeceptionModule;
use \Codeception\Util\Shared\Asserts as SharedAsserts;
/**
* Special module for using asserts in your tests.
*
*/
class Asserts extends CodeceptionModule
{
use SharedAsserts {
assertEquals as public;
assertNotEqual... |
Fix broken path on CSV converter form | <?php include 'header_meta_inc_view.php';?>
<?php include 'header_inc_view.php';?>
<div class="container">
<!-- Example row of columns -->
<div class="row">
<div class="col-lg-12">
<h2>CSV Converter</h2>
<form action="<?php echo site_url(); ?>/datagov/csv_to_json" metho... | <?php include 'header_meta_inc_view.php';?>
<?php include 'header_inc_view.php';?>
<div class="container">
<!-- Example row of columns -->
<div class="row">
<div class="col-lg-12">
<h2>CSV Converter</h2>
<form action="<?php echo site_url(); ?>/csv_to_json" method="post"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.