text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Remove map and filter use | from operator import itemgetter
from itertools import chain
from ...utils.py3_hook import with_hook
with with_hook():
from arcrest import Catalog
import numpy as np
def get_layers(service):
layers = service.layers
return {
layer.name: layer
for layer in layers
}
def mend_extent(ext... | from operator import attrgetter, itemgetter
from itertools import chain
from ...utils.py3_hook import with_hook
with with_hook():
from arcrest import Catalog
import numpy as np
def get_layers(service):
layers = service.layers
return {
layer.name: layer
for layer in layers
}
def men... |
Update dates passed in python3 | """
Coda Replication Model factories for test fixtures.
"""
from datetime import datetime
import factory
from factory import fuzzy
from . import models
class QueueEntryFactory(factory.django.DjangoModelFactory):
ark = factory.Sequence(lambda n: 'ark:/00001/id{0}'.format(n))
bytes = fuzzy.FuzzyInteger(100000... | """
Coda Replication Model factories for test fixtures.
"""
from datetime import datetime
import factory
from factory import fuzzy
from . import models
class QueueEntryFactory(factory.django.DjangoModelFactory):
ark = factory.Sequence(lambda n: 'ark:/00001/id{0}'.format(n))
bytes = fuzzy.FuzzyInteger(100000... |
Change dimensions of output in python wrapper | import pycuda.autoinit
import pycuda.driver as drv
import numpy
from scipy import misc
from color_histogram_cuda_module import histogram_atomics, histogram_accum
def histogram(image_path, num_bins):
image = misc.imread(image_path)
bin_size = 256 / num_bins
# calculate image dimensions
(w, h, c) = ima... | import pycuda.autoinit
import pycuda.driver as drv
import numpy
from scipy import misc
from color_histogram_cuda_module import histogram_atomics, histogram_accum
def histogram(image_path, num_bins):
image = misc.imread(image_path)
bin_size = 256 / num_bins
# calculate image dimensions
(w, h, c) = ima... |
Add Transaction Requires New to Action Log service | package edu.harvard.iq.dataverse.actionlogging;
import java.util.Date;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* A service bean that persists {@link ActionLog... | package edu.harvard.iq.dataverse.actionlogging;
import java.util.Date;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* A service bean that persists {@link ActionLogRecord}s to the DB.
* @author michael
*/
@Stateless
public class ActionLogServic... |
Include babel polyfill for github pages demo | /* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
includePolyfill: true,
optional: ['es7.decorators']
},
codemirror: {
modes: ['javascript', 'handlebars', 'mar... | /* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
codemirror: {
modes: ['javascript', 'handlebars', 'markdown'],
themes: ['mdn-... |
Split out main into process(), and add shortened version in process2(). | package com.ticketmanor.rest.client;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
//import org.glassfish.jersey.jackson.JacksonFeature;
import com.ticketmanor.model.Event;
/** This will become an example of the JAX... | package com.ticketmanor.rest.client;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
//import org.glassfish.jersey.jackson.JacksonFeature;
import com.ticketmanor.model.Event;
/** This will become an example of the JAX... |
Change paths for twitter API | package fr.oni.gaagaa.api;
import java.util.List;
import fr.oni.gaagaa.model.twitter.Authenticated;
import fr.oni.gaagaa.model.twitter.Tweet;
import fr.oni.gaagaa.model.twitter.TwitterUser;
import retrofit.http.Body;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import ret... | package fr.oni.gaagaa.api;
import java.util.List;
import fr.oni.gaagaa.model.twitter.Authenticated;
import fr.oni.gaagaa.model.twitter.Tweet;
import fr.oni.gaagaa.model.twitter.TwitterUser;
import retrofit.http.Body;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import ret... |
Use newer package import syntax for Flask | # Application models
#
# Copyright (c) 2016, Alexandre Hamelin <alexandre.hamelin gmail.com>
import os, os.path
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from {{PROJECTNAME}} import app
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///{}'.format(
o... | # Application models
#
# Copyright (c) 2016, Alexandre Hamelin <alexandre.hamelin gmail.com>
import os, os.path
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from {{PROJECTNAME}} import app
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///{}'.format(
os.path.join(app.root_path, app... |
Use feed as the foreign key of image | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free ... | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free ... |
Fix versioning and add scripts directory | import os
from setuptools import setup, find_packages
import glob
src_dir = os.path.dirname(__file__)
def read(filename):
full_path = os.path.join(src_dir, filename)
with open(full_path) as fd:
return fd.read()
setup(
name='nymms',
version='0.2.1',
author='Michael Barrett',
author_em... | import os
from setuptools import setup, find_packages
def read(filename):
full_path = os.path.join(os.path.dirname(__file__), filename)
with open(full_path) as fd:
return fd.read()
setup(
name='nymms',
version='0.4.2',
author='Michael Barrett',
author_email='loki77@gmail.com',
lic... |
Fix module name: test.mysql -> test.mysqld | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming ... | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming ... |
Rename public function to match task name | import patch from '../node/patch';
import Transaction from '../transaction';
import { CreateNodeHookCache, VTree } from '../util/types';
import globalThis from '../util/global';
/**
* Processes a set of patches onto a tracked DOM Node.
*
* @param {Transaction} transaction
* @return {void}
*/
export default functi... | import patchNode from '../node/patch';
import Transaction from '../transaction';
import { CreateNodeHookCache, VTree } from '../util/types';
import globalThis from '../util/global';
/**
* Processes a set of patches onto a tracked DOM Node.
*
* @param {Transaction} transaction
* @return {void}
*/
export default fu... |
Set EOL style to Native.
Remove tab characters.
git-svn-id: 306be505b4acf4ccace778b4b2465237cc9581ba@581081 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 ... |
Remove CRC from data returned by DecodePacket | package medtronic
import (
"fmt"
)
func (pump *Pump) DecodePacket(packet []byte) []byte {
data, err := Decode6b4b(packet)
if err != nil {
pump.err = err
pump.DecodingErrors++
return data
}
last := len(data) - 1
pktCrc := data[last]
data = data[:last] // without CRC
calcCrc := Crc8(data)
if pktCrc != ca... | package medtronic
import (
"fmt"
)
func (pump *Pump) DecodePacket(packet []byte) []byte {
data, err := Decode6b4b(packet)
if err != nil {
pump.err = err
pump.DecodingErrors++
return data
}
crc := Crc8(data[:len(data)-1])
if data[len(data)-1] != crc {
pump.err = fmt.Errorf("CRC should be %X, not %X", crc... |
Fix function name and add missing else block in HMAC. | /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* HMAC - keyed-Hash Message Authentication Code
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**/
(function HMAC(self) {
self.fn.hmac = function hmac(hash, data, hkey, block) {
var i, akey, ipad, op... | /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* HMAC - keyed-Hash Message Authentication Code
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**/
(function HMAC(self) {
self.fn.hmac = function hmac(hash, data, hkey, block) {
var i, akey, ipad, op... |
Update unit tests to match correct behaviour | import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from smartbot import events
class TestEvents(unittest.TestCase):
def test_empty(self):
event = events.Event()
self.assertEqual(len(event.trigger()), 0)
def test_with_handlers(... | import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from smartbot import events
class TestEvents(unittest.TestCase):
def test_empty(self):
event = events.Event()
self.assertEqual(len(event.trigger()), 0)
def test_with_handlers(... |
Handle namespacing properly so pylons imports without errors.
--HG--
branch : trunk | """Base objects to be exported for use in Controllers"""
# Import pkg_resources first so namespace handling is properly done so the
# paste imports work
import pkg_resources
from paste.registry import StackedObjectProxy
from pylons.configuration import config
__all__ = ['app_globals', 'cache', 'config', 'request', '... | """Base objects to be exported for use in Controllers"""
from paste.registry import StackedObjectProxy
from pylons.configuration import config
__all__ = ['app_globals', 'cache', 'config', 'request', 'response',
'session', 'tmpl_context', 'url']
def __figure_version():
try:
from pkg_resources i... |
Fix the circle to rectangle code
Was totally incorrect previously | from menpo.shape import PointDirectedGraph
import numpy as np
def pointgraph_from_circle(fitting):
diameter = fitting.diameter
radius = diameter / 2.0
y, x = fitting.center
y -= radius
x -= radius
return PointDirectedGraph(np.array(((y, x),
(y + diameter... | from menpo.shape import PointDirectedGraph
import numpy as np
def pointgraph_from_circle(fitting):
y, x = fitting.center
radius = fitting.diameter / 2.0
return PointDirectedGraph(np.array(((y, x),
(y + radius, x),
(y + radius,... |
Set figshare's MAX_FILE_SIZE to 50mb | import os
from . import routes, views, model # noqa
MODELS = [
model.AddonFigShareUserSettings,
model.AddonFigShareNodeSettings,
model.FigShareGuidFile
]
USER_SETTINGS_MODEL = model.AddonFigShareUserSettings
NODE_SETTINGS_MODEL = model.AddonFigShareNodeSettings
ROUTES = [routes.settings_routes, routes.a... | import os
from . import routes, views, model # noqa
MODELS = [
model.AddonFigShareUserSettings,
model.AddonFigShareNodeSettings,
model.FigShareGuidFile
]
USER_SETTINGS_MODEL = model.AddonFigShareUserSettings
NODE_SETTINGS_MODEL = model.AddonFigShareNodeSettings
ROUTES = [routes.settings_routes, routes.a... |
fix(shop): Update admin order show page
Update admin order show page
see #401 | <?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Order;
class OrderController extends Controller
{
public function index()
{
$orders = Order::all();
return view('admin.orders.index')->with('orders', $orders);
}
publ... | <?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Order;
class OrderController extends Controller
{
public function index()
{
$orders = Order::all();
return view('admin.orders.index')->with('orders', $orders);
}
publ... |
PUT and DELETE return altered config | module.exports = function(Config, XIBLE, EXPRESS_APP) {
EXPRESS_APP.get('/api/config', (req, res) => {
res.json(Config.getAll());
});
EXPRESS_APP.put('/api/config/value', (req, res) => {
let path = req.body.path;
let value = req.body.value;
if (typeof path !== 'string' || typeof value === 'undefined') {
... | module.exports = function(Config, XIBLE, EXPRESS_APP) {
EXPRESS_APP.get('/api/config', (req, res) => {
res.json(Config.getAll());
});
EXPRESS_APP.put('/api/config/value', (req, res) => {
let path = req.body.path;
let value = req.body.value;
if (typeof path !== 'string' || typeof value === 'undefined') {
... |
Include create-react-class in Rollup configuration :newspaper:. | // Rollup plugins.
import babel from 'rollup-plugin-babel'
import cjs from 'rollup-plugin-commonjs'
import globals from 'rollup-plugin-node-globals'
import replace from 'rollup-plugin-replace'
import resolve from 'rollup-plugin-node-resolve'
export default {
dest: 'build/app.js',
entry: 'src/index.js',
format: '... | // Rollup plugins.
import babel from 'rollup-plugin-babel'
import cjs from 'rollup-plugin-commonjs'
import globals from 'rollup-plugin-node-globals'
import replace from 'rollup-plugin-replace'
import resolve from 'rollup-plugin-node-resolve'
export default {
dest: 'build/app.js',
entry: 'src/index.js',
format: '... |
Support any options mapbox source supports. Maintain backwards compatibility. | import Ember from 'ember';
import layout from '../templates/components/mapbox-gl-source';
const {
Component,
computed,
get,
getProperties,
guidFor
} = Ember;
export default Component.extend({
layout,
tagName: '',
map: null,
dataType: 'geojson',
data: null,
options: null,
sourceId: computed(... | import Ember from 'ember';
import layout from '../templates/components/mapbox-gl-source';
const {
Component,
computed,
get,
getProperties,
guidFor
} = Ember;
export default Component.extend({
layout,
tagName: '',
map: null,
dataType: 'geojson',
data: null,
sourceId: computed({
get() {
... |
Switch from share to singleton
The share method has been deprecated. | <?php
namespace Badawy\Embedly;
use Illuminate\Support\ServiceProvider;
class EmbedlyServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
... | <?php
namespace Badawy\Embedly;
use Illuminate\Support\ServiceProvider;
class EmbedlyServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
... |
Initialize controllers to empty array | var registerSystem = require('../core/system').registerSystem;
/**
* Tracked controls system.
* Maintain list with available tracked controllers.
*/
module.exports.System = registerSystem('tracked-controls-webxr', {
init: function () {
this.controllers = [];
this.addSessionEventListeners = this.addSession... | var registerSystem = require('../core/system').registerSystem;
/**
* Tracked controls system.
* Maintain list with available tracked controllers.
*/
module.exports.System = registerSystem('tracked-controls-webxr', {
init: function () {
this.addSessionEventListeners = this.addSessionEventListeners.bind(this);
... |
Fix flake8 line length issue
Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com> | from setuptools import setup, find_packages
jsonpatch_uri \
= 'jsonpatch@https://github.com/cjh1/python-json-patch/archive/tomviz.zip'
setup(
name='tomviz-pipeline',
version='0.0.1',
description='Tomviz python external pipeline execution infrastructure.',
author='Kitware, Inc.',
author_email='... | from setuptools import setup, find_packages
setup(
name='tomviz-pipeline',
version='0.0.1',
description='Tomviz python external pipeline execution infrastructure.',
author='Kitware, Inc.',
author_email='kitware@kitware.com',
url='https://www.tomviz.org/',
license='BSD 3-Clause',
classif... |
Move most expensive type check to last | 'use strict';
// MODULES //
var debug = require( 'debug' )( 'time-series:set:x' );
var isTypedArray = require( '@stdlib/utils/is-typed-array' );
var isNumberArray = require( '@stdlib/utils/is-number' ).isPrimitiveNumberArray;
var isEmptyArray = require( '@stdlib/utils/is-empty-array' );
var events = require( './../..... | 'use strict';
// MODULES //
var debug = require( 'debug' )( 'time-series:set:x' );
var isTypedArray = require( '@stdlib/utils/is-typed-array' );
var isNumberArray = require( '@stdlib/utils/is-number' ).isPrimitiveNumberArray;
var isEmptyArray = require( '@stdlib/utils/is-empty-array' );
var events = require( './../..... |
Use strict mode in karma E2E test congig file | // Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
'use strict';
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['... | // Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['ng-scenario'],
... |
Make get_readable_list process tuples, too | def get_readable_list(passed_list, sep=', ', end=''):
output = ""
if isinstance(passed_list, list) or isinstance(passed_list, tuple):
for i, item in enumerate(passed_list):
if len(passed_list) is 1:
output += str(item)
else:
if i is not (len(passed_list) - 1):
output += str(item) + sep
else:... | def get_readable_list(passed_list, sep=', ', end=''):
output = ""
if isinstance(passed_list, list):
for i, item in enumerate(passed_list):
if len(passed_list) is 1:
output += str(item)
else:
if i is not (len(passed_list) - 1):
output += str(item) + sep
else:
output += str(item)
elif i... |
Make the name of an organization required | from rest_framework import serializers
from bluebottle.organizations.models import Organization
from bluebottle.utils.serializers import URLField
class OrganizationSerializer(serializers.ModelSerializer):
class Meta:
model = Organization
fields = ('id', 'name', 'slug', 'address_line1', 'address_l... | from rest_framework import serializers
from bluebottle.organizations.models import Organization
from bluebottle.utils.serializers import URLField
class OrganizationSerializer(serializers.ModelSerializer):
class Meta:
model = Organization
fields = ('id', 'name', 'slug', 'address_line1', 'address_l... |
Print a stacktrace when a failure is caused by an exception
When a spec fails due to an exception, the exception's stacktrace is printed when running the spec in Rhino. This helps to locate the code that caused the exception. | (function($) {
$(Screw).bind("before", function(){
function example_name(element){
// TODO: handle nested describes!
var context_name = $(element).parents(".describe").children("h1").text();
var example_name = $(element).children("h2").text();
return context_name + " - " + example_name;
... | (function($) {
$(Screw).bind("before", function(){
function example_name(element){
// TODO: handle nested describes!
var context_name = $(element).parents(".describe").children("h1").text();
var example_name = $(element).children("h2").text();
return context_name + " - " + example_name;
... |
Increase timeouts for e2e tests on Sauce Labs. | // Protractor configuration
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
var TIMEOUT = 120000;
exports.config = {
specs: ['e2e/**/*.js'],
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
multiCapabilities: [{
name: 'End-to-End Tests: Chrome 36'... | // Protractor configuration
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
exports.config = {
specs: ['e2e/**/*.js'],
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
multiCapabilities: [{
name: 'End-to-End Tests: Chrome 36',
browserName: 'chr... |
Fix table names in flask-admin | from flask import Flask
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_admin import Admin
from flask_admin.contrib.peewee import ModelView
from playhouse.flask_utils import FlaskDB
app = Flask(__name__)
app.config.from_object('config')
@app.before_request
def _db_connect():
db.co... | from flask import Flask
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_admin import Admin
from flask_admin.contrib.peewee import ModelView
from playhouse.flask_utils import FlaskDB
app = Flask(__name__)
app.config.from_object('config')
@app.before_request
def _db_connect():
db.co... |
Use slideToggle for brief animated show / hide | $(document).ready(function() {
$(".additional-options-toggle").on("click", function(e) {
e.preventDefault();
$("#" + $(this).data("export-section") + "_options").slideToggle(200);
});
jQuery.validator.addMethod("wanikaniLevelRange", function(value, element) {
return this.optional(element) || /^[0-9]+... | $(document).ready(function() {
$(".additional-options-toggle").on("click", function(e) {
e.preventDefault();
$("#" + $(this).data("export-section") + "_options").toggle();
});
jQuery.validator.addMethod("wanikaniLevelRange", function(value, element) {
return this.optional(element) || /^[0-9]+(,[0-9]+... |
Make sure all package files are committed correctly when bumping a version | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! Version: <%= pkg.version %>\nDate: <%= grunt.template.today("yyyy-mm-dd") %> */\n',
preserveComments: 'some'
},
build:... | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! Version: <%= pkg.version %>\nDate: <%= grunt.template.today("yyyy-mm-dd") %> */\n',
preserveComments: 'some'
},
build:... |
Return all properties (including nulls) | $.fn.filterByData = function(prop, val) {
return this.filter(
function() { return $(this).data(prop)==val; }
);
};
$(document).ready(function() {
var radios = $('.table-view.radio');
var saveBtn = $('#save');
var options = $.url().param();
radios.each(function (index) {
var radio = $(this);
... | $.fn.filterByData = function(prop, val) {
return this.filter(
function() { return $(this).data(prop)==val; }
);
};
$(document).ready(function() {
var radios = $('.table-view.radio');
var saveBtn = $('#save');
var options = $.url().param();
radios.each(function (index) {
var radio = $(this);
... |
Allow picking people from NHA. | <?php
$db->query('SELECT alliance_id,alliance_name,leader_id FROM alliance WHERE game_id=' . SmrSession::$game_id . ' AND alliance_id=' . $player->getAllianceID() . ' LIMIT 1');
$db->nextRecord();
$template->assign('PageTopic',stripslashes($db->getField('alliance_name')) . ' (' . $db->getField('alliance_id') . ')');
i... | <?php
$db->query('SELECT alliance_id,alliance_name,leader_id FROM alliance WHERE game_id=' . SmrSession::$game_id . ' AND alliance_id=' . $player->getAllianceID() . ' LIMIT 1');
$db->nextRecord();
$template->assign('PageTopic',stripslashes($db->getField('alliance_name')) . ' (' . $db->getField('alliance_id') . ')');
i... |
[Misc] Add missing newline (new checkstyle rule) | /*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | /*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... |
Add a test for functions with keyword only arguments
This adds a test to ensure that no error is raised if a trailing comma
is missing from a function definition that has keyword only arguments.
Reviewed-by: Jakub Stasiak <1d3764b91b902f6b45836e2498da81fe35caf6d6@stasiak.at> | def f1(a, # S100
b): # S101
pass
def f2(
a,
b # S101
):
pass
def f3(
a,
b,
):
pass
# trailing comma after *args or **kwargs is a syntax error therefore
# we don't want to enforce it such situations
def f4(
a,
*args
):
pass
def f5(
b,
**kwargs
):
pa... | def f1(a, # S100
b): # S101
pass
def f2(
a,
b # S101
):
pass
def f3(
a,
b,
):
pass
# trailing comma after *args or **kwargs is a syntax error therefore
# we don't want to enforce it such situations
def f4(
a,
*args
):
pass
def f5(
b,
**kwargs
):
pa... |
Enable turning on SSL for apiHost with ?apiSSL=yes | /*jslint browser: true ,undef: true *//*global Ext*/
Ext.define('Slate.API', {
extend: 'Emergence.util.AbstractAPI',
singleton: true,
// example function
getMySections: function(callback, scope) {
this.request({
url: '/sections',
method: 'GET',
params: {
... | /*jslint browser: true ,undef: true *//*global Ext*/
Ext.define('Slate.API', {
extend: 'Emergence.util.AbstractAPI',
singleton: true,
// example function
getMySections: function(callback, scope) {
this.request({
url: '/sections',
method: 'GET',
params: {
... |
Remove dependency on ExecutionTool to break a build cycle.
PiperOrigin-RevId: 304627771 | // Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... | // Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
Implement lookupItemController() function in controller array | import Em from 'ember';
import Column from './column';
var ArrayProxy = Em.ArrayProxy;
var Sortable = Em.SortableMixin;
var ControllerArray = ArrayProxy.extend({
itemController: Em.ObjectController,
lookupItemController: function (object) {
return this.get('itemController');
},
mapController: function (obj) {
... | import Em from 'ember';
import Column from './column';
var ArrayProxy = Em.ArrayProxy;
var Sortable = Em.SortableMixin;
var ControllerArray = ArrayProxy.extend({
itemController: Em.ObjectController,
mapController: function (obj) {
return this.itemController.create({
content: obj
});
},
arrangedContent: func... |
Select correct for vote detection | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.views.generic import ListView, TemplateView, RedirectView
from django.contrib import auth
from bakery.cookies.models import Cookie
from bakery.socialize.models import Vote
class HomeView(ListView):
model = Cookie
template_name ... | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.views.generic import ListView, TemplateView, RedirectView
from django.contrib import auth
from bakery.cookies.models import Cookie
from bakery.socialize.models import Vote
class HomeView(ListView):
model = Cookie
template_name ... |
Split up the external url validation in a valid and an invalid test | <?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testValidExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
... | <?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'... |
Add new decorator for suvery_data | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
#url(r'^profile/intake/$', views.survey_intake, name='survey_profile_i... | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^profile/surveys/$', views.survey_management, name='survey_manag... |
Move splash screen farther afield on click. | #pragma strict
private var _gameManager : GameManager;
private var _isTriggered = false;
function Start() {
_gameManager = GameManager.Instance();
}
function Update() {
}
function OnMouseDown() {
if (!_isTriggered) {
rollAway();
_isTriggered = true;
}
}
private function rollAway() {
iTween.RotateB... | #pragma strict
private var _gameManager : GameManager;
private var _isTriggered = false;
function Start() {
_gameManager = GameManager.Instance();
}
function Update() {
}
function OnMouseDown() {
if (!_isTriggered) {
rollAway();
_isTriggered = true;
}
}
private function rollAway() {
iTween.RotateB... |
Remove unnecessary functions in SockJSConnection | 'use strict';
const debug = require('debug')('sockjs:connection');
const stream = require('stream');
const uuid = require('uuid');
class SockJSConnection extends stream.Duplex {
constructor(session) {
super({ decodeStrings: false, encoding: 'utf8' });
this._session = session;
this.id = uuid.v4();
th... | 'use strict';
const debug = require('debug')('sockjs:connection');
const stream = require('stream');
const uuid = require('uuid');
class SockJSConnection extends stream.Duplex {
constructor(_session) {
super({ decodeStrings: false, encoding: 'utf8' });
this._session = _session;
this.id = uuid.v4();
... |
Remove phone number from email body | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['messa... | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone']... |
Fix build break with Fixtures 1.3
Our explicit call to cleanUp messes things up in latest
fixture, so we need to call _clear_cleanups to stop
the test from breaking
Change-Id: I8ce2309a94736b47fb347f37ab4027857e19c8a8 | # Copyright 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | # Copyright 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
Update ZeroClipboard to the newest version available at CDN
@XhmikosR, No 1.3.4 yet. I guess next time we'll update to 2.x. | 'use strict';
angular.module('osscdnApp', ['ngAnimate', 'ui.router', 'ngDropdowns', 'semverSort',
'ngClipboard', 'angular-flash.service', 'angular-flash.flash-alert-directive'])
.config(function($stateProvider, $urlRouterProvider, flashProvider, ngClipProvider) {
$urlRouterProvider.otherwise('/');
... | 'use strict';
angular.module('osscdnApp', ['ngAnimate', 'ui.router', 'ngDropdowns', 'semverSort',
'ngClipboard', 'angular-flash.service', 'angular-flash.flash-alert-directive'])
.config(function($stateProvider, $urlRouterProvider, flashProvider, ngClipProvider) {
$urlRouterProvider.otherwise('/');
... |
Include DemoModule in module list for simple Android example. | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Fix association model with user and email | 'use strict';
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(module.filename);
var env = process.env.NODE_ENV || 'development';
if(env !== 'production') {
var config = require(__dirname + '/../config/development.json')[env];
... | 'use strict';
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(module.filename);
var env = process.env.NODE_ENV || 'development';
if(env !== 'production') {
var config = require(__dirname + '/../config/development.json')[env];
... |
Use SHAs for commit_range rather than refs
Refs are local and might not always be present in the checkout. | #!/usr/bin/env python3
import os
import argparse
from github import Github
def from_pr(project, repo, pr_number):
gh = Github()
pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number)
base = pr.base.sha
head = pr.base.sha
return f'{base}...{head}'
def main():
argparser = argparse.ArgumentP... | #!/usr/bin/env python3
import os
import argparse
from github import Github
def from_pr(project, repo, pr_number):
gh = Github()
pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number)
base = pr.base.ref
head = pr.head.ref
return f'origin/{base}...{head}'
def main():
argparser = argparse.Ar... |
Add old method for setting val to pin named set_val_old | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... |
Update component class to take foundation contract | <?php
namespace Xu\Components;
use Xu\Contracts\Foundation\Foundation as FoundationContract;
/**
* Component class.
*/
abstract class Component {
/**
* xu instance.
*
* @var \Xu\Contracts\Foundation\Foundation
*/
protected $xu;
/**
* Create a new component instance.
*
... | <?php
namespace Xu\Components;
use Xu\Foundation\Foundation;
/**
* Component class.
*/
abstract class Component {
/**
* xu instance.
*
* @var \Xu\Foundation\Xu
*/
protected $xu;
/**
* Create a new component instance.
*
* @param \Xu\Foundation\Foundation $xu
*/
... |
SWITCHYARD-329: Add BPM annotations to mark methods as process action triggers | /*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made a... | /*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made a... |
Fix socket closed on connection reset bug | var net = require("net");
var express = require("express");
var bodyParser = require("body-parser");
var config = require('./config');
var app;
// Create a simple server
var server = net.createServer(function (conn) {
app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyPars... | var net = require("net");
var express = require("express");
var bodyParser = require("body-parser");
var config = require('./config');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// Create a simple server
var server = net.createServer(function (conn) {
co... |
Move to static file serving from ./public.
Add possibility to remove rules. | var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rul... | var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rul... |
Update to js-jupyter-services 0.5 for some reconnect fixes that are nice to have | /*
* Copyright 2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | /*
* Copyright 2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... |
Make sure numpy exists on the cpython side | import pytest
from pymetabiosis.module import import_module
from pymetabiosis.numpy_convert import \
register_cpy_numpy_to_pypy_builtin_converters
register_cpy_numpy_to_pypy_builtin_converters()
def test_scalar_converter():
try:
numpy = import_module("numpy")
except ImportError:
pytest... | from pymetabiosis.module import import_module
from pymetabiosis.numpy_convert import \
register_cpy_numpy_to_pypy_builtin_converters
register_cpy_numpy_to_pypy_builtin_converters()
def test_scalar_converter():
numpy = import_module("numpy")
assert numpy.bool_(True) is True
assert numpy.bool_(Fals... |
Stop sending undefined version to TrackJS | /* eslint-disable import/no-extraneous-dependencies */
import 'babel-polyfill';
import 'jquery-ui/ui/widgets/dialog';
import 'notifyjs-browser';
import '../../common/binary-ui/dropdown';
import Elevio from '../../common/elevio';
import View from './View';
$.ajaxSetup({
cache: false,
});
// eslint-disable-next-lin... | /* eslint-disable import/no-extraneous-dependencies */
import 'babel-polyfill';
import 'jquery-ui/ui/widgets/dialog';
import 'notifyjs-browser';
import '../../common/binary-ui/dropdown';
import Elevio from '../../common/elevio';
import View from './View';
import { version } from '../../../package.json';
$.ajaxSetup({
... |
Fix issue with "readonly" table
- Using getSelect() was leading to an issue against current ZF2 master whereby
the table was being marked as readonly; this meant that later calling from()
led to an exception. This patch fixes that issue by pulling the select() from
a Sql object and then calling setTable(). | <?php
namespace ScnSocialAuth\Mapper;
use ZfcBase\Mapper\AbstractDbMapper;
use Zend\Stdlib\Hydrator\HydratorInterface;
class UserProvider extends AbstractDbMapper implements UserProviderInterface
{
protected $tableName = 'user_provider';
public function findUserByProviderId($providerId, $provider)
{
... | <?php
namespace ScnSocialAuth\Mapper;
use ZfcBase\Mapper\AbstractDbMapper;
use Zend\Stdlib\Hydrator\HydratorInterface;
class UserProvider extends AbstractDbMapper implements UserProviderInterface
{
protected $tableName = 'user_provider';
public function findUserByProviderId($providerId, $provider)
{
... |
Fix bug in gather-metadata-plot script | """Plot metadata info
{{header}}
"""
from subprocess import run
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from msmbuilder.io import load_meta, render_meta
sns.set_style('ticks')
colors = sns.color_palette()
## Load
meta = load_meta()
## Plot logic
def plot_lengths(ax):
len... | """Plot metadata info
{{header}}
"""
from subprocess import run
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from msmbuilder.io import load_meta, render_meta
sns.set_style('ticks')
colors = sns.color_palette()
## Load
meta = load_meta()
## Plot logic
def plot_lengths(ax):
len... |
Add Server header to identify Lapitar | package server
import (
"flag"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
"github.com/zenazn/goji/web/middleware"
"net/http"
)
var (
defaults *config
//decoder = schema.NewDecoder()
)
func start(conf *config) {
defaults = conf
flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange
i... | package server
import (
"flag"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web/middleware"
"net/http"
)
var (
defaults *config
//decoder = schema.NewDecoder()
)
func start(conf *config) {
defaults = conf
flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange
if conf.Proxy {
goji.Insert(m... |
Add method definition generator and some sample for test | import os
import json
import sys
from pprint import pprint
def loadJSON(fInput):
with open(fInput) as f:
return json.load(f)
return None
if __name__ == '__main__':
filePath = 'data/example.json'
data = loadJSON(filePath)
# check if the data is loaded correctly
if data is None:
... | import os
import json
import sys
from pprint import pprint
def loadJSON(fInput):
with open(fInput) as f:
return json.load(f)
return None
if __name__ == '__main__':
filePath = 'data/example.json'
data = loadJSON(filePath)
# check if the data is loaded correctly
if data is None:
... |
Fix for Python 3.4 html module not containing _escape_map_full | # -*- coding: utf-8 -*-
import re
from html.entities import codepoint2name
try:
from html import _escape_map_full
except:
# taken from the 3.3 standard lib, as it's removed in 3.4
_escape_map_full = {ord('&'): '&', ord('<'): '<', ord('>'): '>',
ord('"'): '"', ord('\''... | # -*- coding: utf-8 -*-
import re
from html import _escape_map_full
from html.entities import codepoint2name
html_entities = {_ord: '&{0};'.format(value)
for _ord, value in codepoint2name.items()}
html_entities.update(_escape_map_full)
entities_html = {value: _ord for _ord, value in html_entities.item... |
Fix Doctrine Migrations commands to work with new bundles. | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineMigrationsBundle\Command;
use ... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineMigrationsBundle\Command;
use ... |
Add new field to factory | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
import swapper
from factory import (
DjangoModelFactory,
Sequence,
)
from accelerator.apps import AcceleratorConfig
ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily')
class ProgramFamily... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
import swapper
from factory import (
DjangoModelFactory,
Sequence,
)
from accelerator.apps import AcceleratorConfig
ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily')
class ProgramFamily... |
Correct ValidateInput's use of BadRequestHttpException | <?php
namespace Fuzz\ApiServer\Validation;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
trait ValidatesInput
{
/**
* Validate the given request with the given rules.
*
* @param array $input
* @param array $rules
* @param array $messages
* @throws \Symfony\Component\HttpKernel\E... | <?php
namespace Fuzz\ApiServer\Validation;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
trait ValidatesInput
{
/**
* Validate the given request with the given rules.
*
* @param array $input
* @param array $rules
* @param array $messages
* @throws \Symfony\Component\HttpKernel\E... |
Fix default get_user_home with dynamic dashboards
The existing get_user_home implementation expects both the 'admin'
and 'project' dashboards to exist and throws an exception if they
are missing. With the inclusion of configurable dashboard loading,
we can no longer count on certain dashboards being loaded.
Closes-B... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... |
Reset Neon version to 0.1.0 | '''
Copyright 2015 University of Auckland
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 agre... | '''
Copyright 2015 University of Auckland
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 agre... |
Add check for valid type of tracks | import time
from mycroft.messagebus.message import Message
class AudioService():
def __init__(self, emitter):
self.emitter = emitter
self.emitter.on('MycroftAudioServiceTrackInfoReply', self._track_info)
self.info = None
def _track_info(self, message=None):
self.info = messag... | import time
from mycroft.messagebus.message import Message
class AudioService():
def __init__(self, emitter):
self.emitter = emitter
self.emitter.on('MycroftAudioServiceTrackInfoReply', self._track_info)
self.info = None
def _track_info(self, message=None):
self.info = messag... |
Add no-defined users to the 'default' group | package markehme.FactionsPerms.listeners;
import java.io.IOException;
import java.util.Arrays;
import java.util.logging.Level;
import markehme.FactionsPerms.FactionsPerms;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.Pla... | package markehme.FactionsPerms.listeners;
import markehme.FactionsPerms.FactionsPerms;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
public class R... |
Change the vertical position to work correctly in standards mode. | "use strict";
function createDialog(pageMantle, dialogHtml, dialogCss) {
var dialog = {};
// write dialog HTML to document
var dialogDiv = jQuery('<div title="Create a feed"></div>');
dialogDiv.appendTo(document.body);
// create iframe
var iframe = jQuery('<iframe frameborder="0" style="width:100%; height:100%... | "use strict";
function createDialog(pageMantle, dialogHtml, dialogCss) {
var dialog = {};
// write dialog HTML to document
var dialogDiv = jQuery('<div title="Create a feed"></div>');
dialogDiv.appendTo(document.body);
// create iframe
var iframe = jQuery('<iframe frameborder="0" style="width:100%; height:100%... |
Add getSRID() method to geometry | <?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* 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, me... | <?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* 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, me... |
Fix warning error about missing $title | <?php
/*
* Hackwork
*
* Simple, layout-based PHP microframework for making HTML5 sites.
* http://git.io/hackwork
*/
define('ROOT', $_SERVER['DOCUMENT_ROOT']);
define('PATH', ROOT);
define('ASSETS', '/assets');
define('DATA', PATH . '/data');
define('LAYOUTS', PATH . '/layouts');
// Generate layout
//
// `$layou... | <?php
/*
* Hackwork
*
* Simple, layout-based PHP microframework for making HTML5 sites.
* http://git.io/hackwork
*/
define('ROOT', $_SERVER['DOCUMENT_ROOT']);
define('PATH', ROOT);
define('ASSETS', '/assets');
define('DATA', PATH . '/data');
define('LAYOUTS', PATH . '/layouts');
// Generate layout
//
// `$layou... |
Update template away from legacy variation setting
Former-commit-id: 79522c8565f4c21c0536f106532295321a0f7b07
Former-commit-id: 8be9e6f171ae33ab163b02dee0d4b5b4449ece03 | $(function () {
// We move the background image and class from data-stripe-wrapper up to the closest
// div containing the special custom template class. Because it's this DIV that should
// have the parallax image close to it.
var $parallax = $('div[data-stripe-wrapper=parallax]');
$parallax.each... | $(function () {
// We move the background image and class from data-stripe-wrapper up to the closest
// div containing the special custom template class. Because it's this DIV that should
// have the parallax image close to it.
var $parallax = $('div[data-stripe-wrapper=parallax]');
$parallax.each... |
Remove test that sporadically gives false negatives
Nothing worse than an unreliable test; remove this test as there can be
errors in the logs that do not necessarily correspond to a broken
image.
Relates #119 | from .fixtures import elasticsearch
import pytest
image_flavor = pytest.config.getoption('--image-flavor')
def test_elasticsearch_logs_are_in_docker_logs(elasticsearch):
elasticsearch.assert_in_docker_log('o.e.n.Node')
# eg. elasticsearch1 | [2017-07-04T00:54:22,604][INFO ][o.e.n.Node ] [docker-test-node-1]... | from .fixtures import elasticsearch
import pytest
image_flavor = pytest.config.getoption('--image-flavor')
def test_elasticsearch_logs_are_in_docker_logs(elasticsearch):
elasticsearch.assert_in_docker_log('o.e.n.Node')
# eg. elasticsearch1 | [2017-07-04T00:54:22,604][INFO ][o.e.n.Node ] [docker-test-node-1]... |
Implement dynamic username and collection type | from createCollection import createCollection
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime, json, os.path, argparse
CONST_COLLECTIONS_NAME = 'collections'
def generateArgumentsFromParser():
parser = parser = argparse.ArgumentParser(description="... | from createCollection import createCollection
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime, json, os.path, argparse
CONST_COLLECTIONS_NAME = 'collections'
def generateArgumentsFromParser():
parser = parser = argparse.ArgumentParser(description="... |
Fix permission check on /getrp command | package com.elmakers.mine.bukkit.magic.command;
import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
public class RPCommand... | package com.elmakers.mine.bukkit.magic.command;
import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
public class RPCommand... |
Fix to default cron time |
import 'babel-polyfill';
import { existsSync } from 'fs';
import { resolve } from 'path';
import merge from 'lodash.merge';
import TipsBot from './Tipsbot';
const tokenPath = resolve(__dirname, '..', '..', 'token.js');
const defaultToken = existsSync(tokenPath) ? require(tokenPath) : '';
const defaultName = 'Tipsbot... |
import 'babel-polyfill';
import { existsSync } from 'fs';
import { resolve } from 'path';
import merge from 'lodash.merge';
import TipsBot from './Tipsbot';
const tokenPath = resolve(__dirname, '..', '..', 'token.js');
const defaultToken = existsSync(tokenPath) ? require(tokenPath) : '';
const defaultName = 'Tipsbot... |
Add changes for test 4 | #!/usr/bin/env node
const inquirer = require('inquirer')
const Listr = require('listr')
const steps = [{
type: 'input',
name: 'userName',
message: 'Whats your name?'
}]
const tasks = [{
title: 'Preparing',
task: (context, task) => new Promise((resolve, reject) => {
setTimeout(() => resolve(), 1000)
}... | #!/usr/bin/env node
const inquirer = require('inquirer')
const Listr = require('listr')
const steps = [{
type: 'input',
name: 'userName',
message: 'Whats your name?'
}]
const tasks = [{
title: 'Preparing',
task: (context, task) => new Promise((resolve, reject) => {
setTimeout(() => resolve(), 1000)
}... |
Replace double quotes with single quotes as requested | from django.db import models
from django_countries.fields import CountryField
from model_utils.models import TimeStampedModel
from .constants import JOB_COMPENSATION_CHOICES, JOB_HOURS_CHOICES, JOB_TYPE_CHOICES
class Job(TimeStampedModel):
"""
This model contains all the fields related to a job being
po... | from django.db import models
from django_countries.fields import CountryField
from model_utils.models import TimeStampedModel
from .constants import JOB_COMPENSATION_CHOICES, JOB_HOURS_CHOICES, JOB_TYPE_CHOICES
class Job(TimeStampedModel):
"""
This model contains all the fields related to a job being
po... |
Update min width and display for button. | import styled from 'styled-components';
import { darken, lighten } from 'polished';
import { pickColorFromProps } from '../utils';
import {
buttonBackground,
buttonColor,
} from './Style';
const borderColor = (colorSet) => {
return pickColorFromProps(colorSet, (color) => darken(.2, color));
};
const hoverBackgr... | import styled from 'styled-components';
import { darken, lighten } from 'polished';
import { pickColorFromProps } from '../utils';
import {
buttonBackground,
buttonColor,
} from './Style';
const borderColor = (colorSet) => {
return pickColorFromProps(colorSet, (color) => darken(.2, color));
};
const hoverBackgr... |
Add specifications for Bitcoin mainnet and testnet | from collections import namedtuple
Network = namedtuple('Network', [
'network_name',
'network_shortname',
'pubkeyhash',
'wif_prefix',
'scripthash',
'magicbytes'
])
networks = (
# Peercoin mainnet
Network("Peercoin", "ppc", b'37', b'b7', b'75', b'e6e8e9e5'),
# Peercoin testnet
N... | from collections import namedtuple
Network = namedtuple('Network', [
'network_name',
'network_shortname',
'pubkeyhash',
'wif_prefix',
'scripthash',
'magicbytes'
])
networks = (
# Peercoin mainnet
Network("Peercoin", "ppc", b'37', b'b7', b'75', b'e6e8e9e5'),
# Peercoin testnet
N... |
Use sort_keys=True for the ConsoleWritter pretty printing | import json
from exporters.writers.base_writer import BaseWriter, ItemsLimitReached
class ConsoleWriter(BaseWriter):
"""
It is just a writer with testing purposes. It prints every item in console.
"""
def __init__(self, options):
super(ConsoleWriter, self).__init__(options)
self.logg... | import json
from exporters.writers.base_writer import BaseWriter, ItemsLimitReached
class ConsoleWriter(BaseWriter):
"""
It is just a writer with testing purposes. It prints every item in console.
"""
def __init__(self, options):
super(ConsoleWriter, self).__init__(options)
self.logg... |
Fix another doc string mistake. | <?php
/**
* MiniAsset
* Copyright (c) Mark Story (http://mark-story.com)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Mark Story (http://mark-story.c... | <?php
/**
* MiniAsset
* Copyright (c) Mark Story (http://mark-story.com)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Mark Story (http://mark-story.c... |
Make the syntax checker happy | 'use strict';
var Tracer = require('tracer');
function Logger (options) {
this.options = options;
this.tracer = this._setupTracer(options.enabled);
}
Logger.prototype.info = function () {
this.tracer.info.apply(this.tracer, arguments);
};
Logger.prototype.error = function (message) {
this.tracer.error(messa... | var Tracer = require('tracer');
function Logger (options) {
this.options = options;
this.tracer = this._setupTracer(options.enabled);
}
Logger.prototype.info = function () {
this.tracer.info.apply(this.tracer, arguments);
};
Logger.prototype.error = function (message) {
this.tracer.error(message);
}
Logger.... |
Remove reporter from gulp mocha options | const gulp = require('gulp');
const util = require('gulp-util');
const babel = require('gulp-babel');
const mocha = require('gulp-mocha');
const eslint = require('gulp-eslint');
const compiler = require('babel-core/register');
const src = 'src/index.js';
gulp.task('lint', () =>
gulp.src(src)
.pipe(eslint())
.pi... | const gulp = require('gulp');
const util = require('gulp-util');
const babel = require('gulp-babel');
const mocha = require('gulp-mocha');
const eslint = require('gulp-eslint');
const compiler = require('babel-core/register');
const src = 'src/index.js';
gulp.task('lint', () =>
gulp.src(src)
.pipe(eslint())
.pi... |
Use 'Animated.View.propTypes' to avoid warnings.
The propTypes Validation must be based on `Animated.View.propTypes` instead of just `View.propTypes`
otherwise a Warning is displayed when passing Animated values to TabBar. | 'use strict';
import React, {
Animated,
Platform,
StyleSheet,
View,
} from 'react-native';
import Layout from './Layout';
export default class TabBar extends React.Component {
static propTypes = {
...Animated.View.propTypes,
shadowStyle: View.propTypes.style,
};
render() {
return (
<... | 'use strict';
import React, {
Animated,
Platform,
StyleSheet,
View,
} from 'react-native';
import Layout from './Layout';
export default class TabBar extends React.Component {
static propTypes = {
...View.propTypes,
shadowStyle: View.propTypes.style,
};
render() {
return (
<Animated.... |
TASK: Add newline at the end of the file | <?php
namespace TYPO3\Flow\Tests\Unit\Cryptography\Fixture;
/*
* This file is part of the TYPO3.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with ... | <?php
namespace TYPO3\Flow\Tests\Unit\Cryptography\Fixture;
/*
* This file is part of the TYPO3.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with ... |
Disable fetching profile for now | import React from 'react';
import { connect } from 'react-redux';
import { clearNotices } from 'lib/actions/general';
import { doAuthWithPassword, parseAuthToken, getProfile } from 'lib/actions/auth';
import Layout from 'components/layout';
import LogInBox from 'components/log-in-box';
class App extends React.Compone... | import React from 'react';
import { connect } from 'react-redux';
import { clearNotices } from 'lib/actions/general';
import { doAuthWithPassword, parseAuthToken, getProfile } from 'lib/actions/auth';
import Layout from 'components/layout';
import LogInBox from 'components/log-in-box';
class App extends React.Compone... |
Build: Remove CRLF line endings to fix builds on Windows
Close gh-3929 | var fs = require( "fs" );
module.exports = function( grunt ) {
grunt.registerTask( "qunit_fixture", function() {
var dest = "./test/data/qunit-fixture.js";
fs.writeFileSync(
dest,
"// Generated by build/tasks/qunit_fixture.js\n" +
"QUnit.config.fixture = " +
JSON.stringify(
fs.readFileSync(
"... | var fs = require( "fs" );
module.exports = function( grunt ) {
grunt.registerTask( "qunit_fixture", function() {
var dest = "./test/data/qunit-fixture.js";
fs.writeFileSync(
dest,
"// Generated by build/tasks/qunit_fixture.js\n" +
"QUnit.config.fixture = " +
JSON.stringify(
fs.readFileSync(
"... |
Add environment to newly-generated task IDs. | package com.twitter.aurora.scheduler;
import java.util.UUID;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.twitter.aurora.gen.TaskConfig;
import com.twitter.common.util.Clock;
/**
* A function that generates universally-unique (not ... | package com.twitter.aurora.scheduler;
import java.util.UUID;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.twitter.aurora.gen.TaskConfig;
import com.twitter.common.util.Clock;
/**
* A function that generates universally-unique (not ... |
Fix return dest stream from pipe | var PassThrough = require('stream').PassThrough
var inherits = require('util').inherits
function SeriesStream () {
PassThrough.apply(this, arguments)
this._current = null
this._queue = []
}
inherits(SeriesStream, PassThrough)
SeriesStream.prototype.on = function (ev, fn) {
var res = PassThrough.prototype.on.c... | var PassThrough = require('stream').PassThrough
var inherits = require('util').inherits
function SeriesStream () {
PassThrough.apply(this, arguments)
this._current = null
this._queue = []
}
inherits(SeriesStream, PassThrough)
SeriesStream.prototype.on = function (ev, fn) {
var res = PassThrough.prototype.on.c... |
Read breakpoint file from classpath | package com.thanglequoc.aqicalculator;
import java.io.IOException;
import java.io.InputStream;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class PollutantsBreakpointGenerator {
private Pollutant... | package com.thanglequoc.aqicalculator;
import java.io.File;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class PollutantsBreakpointGenerator {
private PollutantsBreakp... |
Change Cookie expiration to 30 days | import { serialize } from 'cookie';
export default async function cookieHandler(req, res) {
const { method } = req;
if (method === 'POST') {
const body = JSON.parse(req.body);
if (body.token) {
res.setHeader(
'Set-Cookie',
serialize('gfw-token', body.token, {
path: '/',
... | import { serialize } from 'cookie';
export default async function cookieHandler(req, res) {
const { method } = req;
if (method === 'POST') {
const body = JSON.parse(req.body);
if (body.token) {
res.setHeader(
'Set-Cookie',
serialize('gfw-token', body.token, {
path: '/',
... |
Add self-rating flag for movies. Removed LikedOrNot table | from django.db import models
# Create your models here.
class Movie(models.Model):
movie_id = models.IntegerField(primary_key=True)
title = models.CharField(max_length=200)
poster = models.ImageField(null=True, blank=True)
year = models.IntegerField(null=True)
genres = models.CharField(max_length=2... | from django.db import models
# Create your models here.
class Movie(models.Model):
movie_id = models.IntegerField(primary_key=True)
title = models.CharField(max_length=200)
poster = models.ImageField(null=True, blank=True)
year = models.IntegerField(null=True)
genres = models.CharField(max_length=2... |
Fix zero-length field error when building docs in Python 2.6 | import os
import taxii_services
project = u'django-taxii-services'
copyright = u'2014, The MITRE Corporation'
version = taxii_services.__version__
release = version
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
rst_prolog = ""... | import os
import taxii_services
project = u'django-taxii-services'
copyright = u'2014, The MITRE Corporation'
version = taxii_services.__version__
release = version
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
rst_prolog = ""... |
Update KYD to KYDC listing to be conform ISO_4217 | /*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the ... | /*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.