text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Remove not useful function creator | function formatFunctionName(type) {
let formattedName = '';
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
type.split('_').map((val, i) => {
if (i === 0) {
formattedName += val.toLowerCase();
} else {
... | function createDynamicFunction(customAction) {
return Function('action', 'return function (){ return action.apply(this, [...arguments]) };')(customAction);
}
function formatFunctionName(type) {
let formattedName = '';
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() +... |
Return just a boolean from find | /**
* @fileoverview Enforce emojis are wrapped in <span> and provide screenreader access.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
import emojiRegex fro... | /**
* @fileoverview Enforce emojis are wrapped in <span> and provide screenreader access.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
import emojiRegex fro... |
Add test for solc backward compatibility | package org.ethereum.solidity;
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertTrue;
import org.ethereum.solidity.Abi.Entry;
import org.ethereum.solidity.Abi.Entry.Type;
import org.junit.Test;
import java.io.IOException;
public class AbiTest {
@Test
public void sim... | package org.ethereum.solidity;
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertTrue;
import org.ethereum.solidity.Abi.Entry;
import org.ethereum.solidity.Abi.Entry.Type;
import org.junit.Test;
import java.io.IOException;
public class AbiTest {
@Test
public void sim... |
Fix an error when no samples were found. | # -*- coding: utf-8 -*-
#
# views.py
# wide-language-index-demo
#
"""
Public facing frontpage.
"""
import json
import random
from flask import (Blueprint, request, render_template, redirect)
from . import forms
from ..index import util
blueprint = Blueprint('public', __name__, static_folder="../static")
@bluep... | # -*- coding: utf-8 -*-
#
# views.py
# wide-language-index-demo
#
"""
Public facing frontpage.
"""
import json
import random
from flask import (Blueprint, request, render_template, redirect)
from . import forms
from ..index import util
blueprint = Blueprint('public', __name__, static_folder="../static")
@bluep... |
Use a varchar instead of an enum. Enums are not supported in sqlite and on postgresql it requires extra work to use | <?php
namespace atk4\data\tests\smbo;
class SMBOTestCase extends \atk4\data\tests\SQLTestCase
{
public function setUp()
{
parent::setUp();
$queryClass = $this->getProtected($this->db->connection, 'query_class');
$escapeChar = $this->getProtected(new $queryClass, 'escape_char');
... | <?php
namespace atk4\data\tests\smbo;
class SMBOTestCase extends \atk4\data\tests\SQLTestCase
{
public function setUp()
{
parent::setUp();
$s = new \atk4\data\tests\Structure(['connection' => $this->db->connection]);
$x = clone $s;
$x->table('account')->drop()
->i... |
Create destination path if it does no exist and copy file using shutil | import os
import shutil
class Generator:
def run(self, sourcedir, outputdir):
sourcedir = os.path.normpath(sourcedir)
outputdir = os.path.normpath(outputdir)
prefix = len(sourcedir)+len(os.path.sep)
for root, dirs, files in os.walk(sourcedir):
destpath = os.path.join(ou... | import os
class Generator:
def run(self, sourcedir, outputdir):
sourcedir = os.path.normpath(sourcedir)
outputdir = os.path.normpath(outputdir)
prefix = len(sourcedir)+len(os.path.sep)
for root, dirs, files in os.walk(sourcedir):
destpath = os.path.join(outputdir, root[... |
Add support for more than one subdomain. | var parseDomain = require("parse-domain");
function getLeadingLeafDomain(subdomain) {
var leafDomains = subdomain.split(".");
return leafDomains[0];
}
function getDomainDataFromHost(host) {
var defaultSubdomain = "www";
var subdomainAliases = {
"local": defaultSubdomain
};
var url = ... | var parseDomain = require("parse-domain");
function getDomainDataFromHost(host) {
var defaultSubdomain = "www";
var subdomainAliases = {
"local": defaultSubdomain
};
var url = parseDomain(host);
var subdomain = url.subdomain;
var resolvedSubdomain = subdomainAliases[subdomain] || subd... |
Add help text for Roles module. | import discord
import shlex
from modules.botModule import BotModule
class Roles(BotModule):
name = 'Roles'
description = 'Allow for the assignment and removal of roles.'
help_text = 'Usage: `!roles "role_name"`. This will add you to that role if allowed.'
' Executing it when you already ... | import discord
import shlex
from modules.botModule import BotModule
class Roles(BotModule):
name = 'Roles'
description = 'Allow for the assignment and removal of roles.'
help_text = ''
trigger_string = '!role' # String to listen for as trigger
async def parse_command(self, message, client):
... |
Use MockRedis instead of dict to mock redis in unit tests | """Unit tests configuration file."""
import pickle
import numpy as np
import pytest
from sklearn import linear_model, tree, svm
from mockredis import MockRedis
from cf_predict import create_app
def pytest_configure(config):
"""Disable verbose output when running tests."""
terminal = config.pluginmanager.get... | """Unit tests configuration file."""
import pickle
import numpy as np
import pytest
from sklearn import linear_model, tree, svm
from cf_predict import create_app
def pytest_configure(config):
"""Disable verbose output when running tests."""
terminal = config.pluginmanager.getplugin('terminal')
base = te... |
Fix session event variable import. | # -*- test-case-name: vumi.middleware.tests.test_session_length -*-
import time
from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.message import TransportUserMessage
from vumi.middleware.base import BaseMiddleware
from vumi.persist.txredis_manager import TxRedisManager
class SessionLengthMi... | # -*- test-case-name: vumi.middleware.tests.test_session_length -*-
import time
from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.message.TransportUserMessage import SESSION_NEW, SESSION_CLOSE
from vumi.middleware.base import BaseMiddleware
from vumi.persist.txredis_manager import TxRedisMana... |
Make swagger use symetric with recess | 'use strict';
module.exports = function(grunt) {
grunt.registerMultiTask('swagger', 'Generate Source from Swagger files', function(){
var fs = require('fs');
var request = require('request');
var done = this.async();
var options = this.options();
var dest = options.d... | 'use strict';
module.exports = function(grunt) {
grunt.registerMultiTask('swagger', 'Generate Source from Swagger files', function(){
var fs = require('fs');
var request = require('request');
var done = this.async();
var options = this.options();
var dest = options.d... |
Fix for HTTP method exception. | @extends('caravel::master')
@inject('form', 'adamwathan.form')
@inject('bootForm', 'bootform')
@section('container')
<div class="row">
<div class="col-md-12">
{!! $bootForm->open()->action($action)->addClass('caravel-form') !!}
@if (isset($model->id))
{!! ... | @extends('caravel::master')
@inject('form', 'adamwathan.form')
@inject('bootForm', 'bootform')
@section('container')
<div class="row">
<div class="col-md-12">
{!! $bootForm->open()->action($action)->addClass('caravel-form') !!}
@if (isset($model))
{!! $boo... |
Move away from using the with statement for 2.4 support | # coding=utf-8
import logging
import threading
import traceback
class Handler(object):
"""
Handlers process metrics that are collected by Collectors.
"""
def __init__(self, config=None):
"""
Create a new instance of the Handler class
"""
# Initialize Log
self.l... | # coding=utf-8
import logging
import threading
import traceback
class Handler(object):
"""
Handlers process metrics that are collected by Collectors.
"""
def __init__(self, config=None):
"""
Create a new instance of the Handler class
"""
# Initialize Log
self.l... |
Use "Custom" as default recipient label | Ext.define('SlateAdmin.model.person.progress.NoteRecipient', {
extend: 'Ext.data.Model',
groupField: 'RelationshipGroup',
fields: [
{
name: 'PersonID',
type: 'integer'
},
{
name: 'FullName',
type: 'string'
},
{
... | Ext.define('SlateAdmin.model.person.progress.NoteRecipient', {
extend: 'Ext.data.Model',
groupField: 'RelationshipGroup',
fields: [
{
name: 'PersonID',
type: 'integer'
},
{
name: 'FullName',
type: 'string'
},
{
... |
Update parser unit tests according to new comment block indent system | <?php
namespace Phug\Test\Parser\TokenHandler;
use Phug\Lexer;
use Phug\Lexer\Token\TagToken;
use Phug\Parser\State;
use Phug\Parser\TokenHandler\CommentTokenHandler;
use Phug\Test\AbstractParserTest;
/**
* @coversDefaultClass Phug\Parser\TokenHandler\CommentTokenHandler
*/
class CommentTokenHandlerTest extends Ab... | <?php
namespace Phug\Test\Parser\TokenHandler;
use Phug\Lexer;
use Phug\Lexer\Token\TagToken;
use Phug\Parser\State;
use Phug\Parser\TokenHandler\CommentTokenHandler;
use Phug\Test\AbstractParserTest;
/**
* @coversDefaultClass Phug\Parser\TokenHandler\CommentTokenHandler
*/
class CommentTokenHandlerTest extends Ab... |
Fix incorrect function config call | <?php
namespace Soy\Codeception;
trait ConfigTrait
{
/**
* @var Config
*/
protected $config;
/**
* @return string
*/
public function getBinary()
{
return $this->config->getBinary();
}
/**
* @param string $binary
* @return $this
*/
public fun... | <?php
namespace Soy\Codeception;
trait ConfigTrait
{
/**
* @var Config
*/
protected $config;
/**
* @return string
*/
public function getBinary()
{
return $this->config->getBinary();
}
/**
* @param string $binary
* @return $this
*/
public fun... |
Allow a type to have - in it's name which is not in spec but required for backward compatability. | /*
* Copyright 2016 higherfrequencytrading.com
*
* 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 la... | /*
* Copyright 2016 higherfrequencytrading.com
*
* 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 la... |
Use default arguments removed by mypy | from typing import Any
from flask import Flask
from relayer import Relayer
class FlaskRelayer(object):
def __init__(self, app: Flask = None, logging_topic: str = None, kafka_hosts: str = None, **kwargs: str) -> None:
if app:
self.init_app(
app,
logging_topic,
... | from typing import Any
from flask import Flask
from relayer import Relayer
class FlaskRelayer(object):
def __init__(self, app: Flask, logging_topic: str, kafka_hosts: str = None, **kwargs: str) -> None:
if app:
self.init_app(
app,
logging_topic,
... |
Use imported constants in middleware | import { _SUCCESS, _ERROR } from 'constants'
const pendingIds = {} // requestIDs to timeoutIDs
let nextRequestID = 0
export default function createSocketMiddleware(socket, prefix) {
return ({ dispatch }) => {
// Wire socket.io to dispatch actions sent by the server.
socket.on('action', dispatch)
return ... | const _SUCCESS = '_SUCCESS'
const _ERROR = '_ERROR'
const pendingIds = {} // requestIDs to timeoutIDs
let nextRequestID = 0
export default function createSocketMiddleware(socket, prefix) {
return ({ dispatch }) => {
// Wire socket.io to dispatch actions sent by the server.
socket.on('action', dispatch)
... |
Add skimage to install_requires list | #!/usr/bin/env python3
import os
import sys
import OpenPNM
sys.path.append(os.getcwd())
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name = 'OpenPNM',
description = 'A framework for conducting pore network modeling simulations of multiphase transport ... | #!/usr/bin/env python3
import os
import sys
import OpenPNM
sys.path.append(os.getcwd())
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name = 'OpenPNM',
description = 'A framework for conducting pore network modeling simulations of multiphase transport ... |
Fix bug with older man | import Entity, { printMessage, action, time, state } from "Entity";
import { isInInventory, removeItem } from "inventory";
export class OlderMan extends Entity {
name() {
return 'eldery man';
}
actions() {
return [
action(
"Give granola bar.", () => {
if (state.doom.started && st... | import Entity, { printMessage, action, time, state } from "Entity";
import { isInInventory, removeItem } from "inventory";
export class OlderMan extends Entity {
name() {
return 'eldery man';
}
actions() {
return [
action(
"Give granola bar.", () => {
if (state.doom.started && st... |
Use var = function syntax | import { select, local } from "d3-selection";
var myLocal = local(),
noop = function (){};
export default function (tagName, className){
var create = noop,
render = noop,
destroy = noop,
myCreate = function (){
var my = myLocal.set(this, {
selection: select(this),
st... | import { select, local } from "d3-selection";
var myLocal = local(),
noop = function (){};
export default function (tagName, className){
var create = noop,
render = noop,
destroy = noop,
selector = className ? "." + className : tagName;
function myCreate(){
var my = myLocal.set(this, {
... |
Use alt naming convention instead | from django.test import TestCase
from django.conf import settings
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# from selenium.webdriver.fir... | from django.test import TestCase
from django.conf import settings
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# from selenium.webdriver.fir... |
Create initial counts outside the test class | import unittest
from django.test import TestCase
from candidates.tests.test_create_person import mock_create_person
from .models import CachedCount
def create_initial_counts(extra=()):
initial_counts = (
{
'count_type': 'constituency',
'name': 'Dulwich and West Norwood',
... | import unittest
from django.test import TestCase
from candidates.tests.test_create_person import mock_create_person
from .models import CachedCount
class CachedCountTechCase(TestCase):
def setUp(self):
initial_counts = (
{
'count_type': 'constituency',
'name':... |
Remove per patch version classifiers | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import re
def find_version():
return re.search(r"^__version__ = '(.*)'$",
open('cantools/version.py', 'r').read(),
re.MULTILINE).group(1)
setup(name='cantools',
version=find_v... | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import re
def find_version():
return re.search(r"^__version__ = '(.*)'$",
open('cantools/version.py', 'r').read(),
re.MULTILINE).group(1)
setup(name='cantools',
version=find_v... |
Add `${args}` marker to cmd | from SublimeLinter.lint import Linter, util
class CSSLint(Linter):
cmd = 'csslint --format=compact ${args} ${temp_file}'
regex = r'''(?xi)
^.+:\s* # filename
# csslint emits errors that pertain to the code as a whole,
# in which case there is no line/col information, so that
... | from SublimeLinter.lint import Linter, util
class CSSLint(Linter):
cmd = 'csslint --format=compact ${temp_file}'
regex = r'''(?xi)
^.+:\s* # filename
# csslint emits errors that pertain to the code as a whole,
# in which case there is no line/col information, so that
# part ... |
Switch props to data, as they aren't passed in | Vue.component('spark-kiosk-notify', {
props: [
],
data: {
'notifications': []
'users': []
'createNotification': {
"user_id": null
}
}
ready(){
this.getNotifications();
this.getUsers();
},
methods: {
/**
* Get all of... | Vue.component('spark-kiosk-notify', {
props: [
'notifications',
'users',
'createNotification'
],
ready(){
this.getNotifications();
this.getUsers();
},
methods: {
/**
* Get all of the announcements.
*/
getNotifications: functio... |
Remove notification block on log out | app.directive('pbNotifications', ['Restangular', 'AuthService', 'config', function(Restangular, AuthService, config) {
return {
restrict: 'E',
templateUrl: config.partialsDir + '/broadcast_block.html',
link: function(scope) {
var notifications = Restangular.all('notifications');
... | app.directive('pbNotifications', ['Restangular', 'AuthService', 'config', function(Restangular, AuthService, config) {
return {
restrict: 'E',
templateUrl: config.partialsDir + '/broadcast_block.html',
link: function(scope, element, attrs) {
var notifications = Restangular.all('n... |
Refactor unit test to use `sinon.test` for automatic cleanup | 'use strict';
var auth = require('./auth.json');
var sinon = require('sinon');
var expect = require('chai').expect;
var should = require('chai').should();
var request = require('request');
describe('SAP module', function () {
var sap;
function initModule(auth) {
sap = require('../index')(auth);
}
before... | 'use strict';
var auth = require('./auth.json');
var sinon = require('sinon');
var expect = require('chai').expect;
var should = require('chai').should();
var request = require('request');
describe('SAP module', function () {
var sap;
function initModule(auth) {
sap = require('../index')(auth);
}
before... |
Allow method chaining after setUrl() | <?php
namespace RuiGomes\RssFeedFinder;
use Illuminate\Support\Collection;
use PHPHtmlParser\Dom;
class FeedFinder
{
/**
* @var \PHPHtmlParser\Dom
*/
protected $dom;
/**
* @var string
*/
protected $url;
protected $feedTypes = [
'application/rss+xml',
'applica... | <?php
namespace RuiGomes\RssFeedFinder;
use Illuminate\Support\Collection;
use PHPHtmlParser\Dom;
class FeedFinder
{
/**
* @var \PHPHtmlParser\Dom
*/
protected $dom;
/**
* @var string
*/
protected $url;
protected $feedTypes = [
'application/rss+xml',
'applica... |
Install the setActiveItem function to the view for convenience | Blend.defineClass('Blend.layout.container.Stacked', {
extend: 'Blend.layout.container.Fit',
alias: 'layout.stacked',
cssPrefix: 'stacked',
activeItem: null,
init: function () {
var me = this;
me.callParent.apply(me, arguments);
/**
* Install the setActiveItem to the ... | Blend.defineClass('Blend.layout.container.Stacked', {
extend: 'Blend.layout.container.Fit',
alias: 'layout.stacked',
cssPrefix: 'stacked',
activeItem: null,
init: function () {
var me = this;
me.callParent.apply(me, arguments);
me.view.setActiveItem = function () {
... |
Add root URL to Book model
Since model is used independently of collection in some cases | define([
'app',
'backbone'
], function(App, Backbone) {
var Entities = App.module('Entities');
//==============================
// Entities
//==============================
Entities.Book = Backbone.Model.extend({
urlRoot: '/api/book/'
});
Entities.Books = Backbone.Collection.extend({
model... | define([
'app',
'backbone'
], function(App, Backbone) {
var Entities = App.module('Entities');
//==============================
// Entities
//==============================
Entities.Book = Backbone.Model.extend({ });
Entities.Books = Backbone.Collection.extend({
model: Entities.Book,
url: '/... |
Fix exception handling in management command. Clean up. | """Creates an admin user if there aren't any existing superusers."""
from optparse import make_option
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Creates/Updates an Admin user'
def add_arguments(self, par... | '''
Creates an admin user if there aren't any existing superusers
'''
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from optparse import make_option
class Command(BaseCommand):
help = 'Creates/Updates an Admin user'
def add_arguments(self, pars... |
Use slightly better type hinting | <?php
namespace Dock\Doctor;
use Dock\IO\ProcessRunner;
use Dock\Installer\InstallerTask;
class DnsDock extends Task
{
/**
* @var InstallerTask $dnsDockInstaller
*/
private $dnsDockInstaller;
/**
* @var InstallerTask $dockerRouting
*/
private $dockerRouting;
/**
* @para... | <?php
namespace Dock\Doctor;
use Dock\IO\ProcessRunner;
class DnsDock extends Task
{
/**
* @var mixed
*/
private $dnsDockInstaller;
/**
* @var mixed
*/
private $dockerRouting;
/**
* @param ProcessRunner $processRunner
* @param mixed $dnsDockInstaller
* @param ... |
Add root path to configuration | /* eslint key-spacing:0 spaced-comment:0 */
const path = require('path');
const ip = require('ip');
const projectBase = path.resolve(__dirname, '..');
/************************************************
/* Default configuration
*************************************************/
var configuration = {
env : process.env... | /* eslint key-spacing:0 spaced-comment:0 */
const path = require('path');
const ip = require('ip');
const projectBase = path.resolve(__dirname, '..');
/************************************************
/* Default configuration
*************************************************/
module.exports = {
env : process.env.NO... |
Improve proxy web page example | // Web page retrieval using server-side proxy support to get around CORS restrictions
requirejs(["sanitizeHTML", "vendor/purify"], function(sanitizeHTML, DOMPurify) {
let content
// const url = "http://kurtz-fernhout.com/"
const url = "http://pdfernhout.net/"
const crossOriginService = "/api... | // Web page retrieval using server-side proxy support to get around CORS restrictions
requirejs(["sanitizeHTML", "vendor/purify"], function(sanitizeHTML, DOMPurify) {
let content
const url = "http://kurtz-fernhout.com/"
// const url = "http://pdfernhout.net/"
const crossOriginService = "/api... |
Include windows.cpp only on Windows | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
extra_compile_args = [] if os.name == 'nt' else ["-g", "-O2", "-march=nat... | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
extra_compile_args = [] if os.name == 'nt' else ["-g", "-O2", "-march=nat... |
Fix for ignoring BPMN validation - JBPM-4000 - corrected formatting | package org.jbpm.migration;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
/** Convenience class for making the error handling within the parsing and validation processes a little more verbose. */
abstract class ErrorCollector<T extends Exception> {
private final List... | package org.jbpm.migration;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
/** Convenience class for making the error handling within the parsing and validation processes a little more verbose. */
abstract class ErrorCollector<T extends Exception> {
private final List... |
Fix proxy urls for main uuid functions | (function(){
'use strict';
angular
.module('SAKapp')
.controller('UuidController', ['$scope', '$http', '$log', '$q', 'toaster', UuidController]);
function UuidController ($scope, $http, $log, $q, toaster) {
$scope.getUUIDs = function () {
$scope.uui... | (function(){
'use strict';
angular
.module('SAKapp')
.controller('UuidController', ['$scope', '$http', '$log', '$q', 'toaster', UuidController]);
function UuidController ($scope, $http, $log, $q, toaster) {
$scope.getUUIDs = function () {
$scope.uui... |
Change listener failure logging level to warn. | <?php
namespace FOQ\ElasticaBundle\Doctrine;
use FOQ\ElasticaBundle\Persister\ObjectPersister;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
abstract class AbstractListener
{
/**
* Object persister
*
* @var ObjectPersister
*/
protected $objectPersister;
/**
* Class of th... | <?php
namespace FOQ\ElasticaBundle\Doctrine;
use FOQ\ElasticaBundle\Persister\ObjectPersister;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
abstract class AbstractListener
{
/**
* Object persister
*
* @var ObjectPersister
*/
protected $objectPersister;
/**
* Class of th... |
Use L&F that is available on JDK 1.3
git-svn-id: fe6d842192ccfb78748eb71580d1ce65f168b559@1344 9830eeb5-ddf4-0310-9ef7-f4b9a3e3227e | package com.thoughtworks.acceptance;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.plaf.metal.MetalLookAndFeel;
public class SwingTest extends AbstractAcceptanceTest {
// JTable is one of the nastiest components to ser... | package com.thoughtworks.acceptance;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class SwingTest extends AbstractAcceptanceTest {
// JTable is one of the nastiest components to ser... |
Add missing comma after last element in an array | <?php
/**
* Updates the database layout during the update from 5.4 to 5.5.
*
* @author Matthias Schmidt
* @copyright 2001-2021 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core
*/
use wcf\system\database\table\column\Default... | <?php
/**
* Updates the database layout during the update from 5.4 to 5.5.
*
* @author Matthias Schmidt
* @copyright 2001-2021 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core
*/
use wcf\system\database\table\column\Default... |
Make $arguments public => protected | <?php
namespace CodeGen;
use Exception;
use CodeGen\Renderable;
use CodeGen\Raw;
use CodeGen\VariableDeflator;
use ArrayAccess;
use IteratorAggregate;
use ArrayIterator;
/**
* Argument list for function call
*/
class ArgumentList implements Renderable, ArrayAccess, IteratorAggregate
{
protected $arguments;
... | <?php
namespace CodeGen;
use Exception;
use CodeGen\Renderable;
use CodeGen\Raw;
use CodeGen\VariableDeflator;
use ArrayAccess;
use IteratorAggregate;
use ArrayIterator;
/**
* Argument list for function call
*/
class ArgumentList implements Renderable, ArrayAccess, IteratorAggregate
{
public $arguments;
pub... |
Use tuples of attnames instead of lists | VERSION = (0, 2)
__version__ = '.'.join(map(str, VERSION))
from django.db.models import Model
from django.db.models.base import ModelState
try:
from itertools import izip
except ImportError:
izip = zip
def attnames(cls, _cache={}):
try:
return _cache[cls]
except KeyError:
_cache[cls]... | VERSION = (0, 2)
__version__ = '.'.join(map(str, VERSION))
from django.db.models import Model
from django.db.models.base import ModelState
try:
from itertools import izip
except ImportError:
izip = zip
def attnames(cls, _cache={}):
try:
return _cache[cls]
except KeyError:
_cache[cls]... |
Fix to help garbage-collector work more rapidly | import EventManager from '../helpers/event-manager';
const createObjectUrl = (src) => {
const blob = new Blob([src], { type: 'text/javascript' });
const url = URL.createObjectURL(blob);
return url;
};
class Thread extends EventManager {
constructor() {
super(null);
this.currentWorker = null;
this.... | import EventManager from '../helpers/event-manager';
const createObjectUrl = (src) => {
const blob = new Blob([src], { type: 'text/javascript' });
const url = URL.createObjectURL(blob);
return url;
};
class Thread extends EventManager {
constructor() {
super(null);
this.currentWorker = null;
this.... |
Change HTTP method for validate endpoint | import flask
from flask import request, json
def Response(data, status = 200):
body = json.dumps(data)
return flask.Response(body, status = status, mimetype = 'application/json')
def SuccessResponse(dataset_id = None):
return Response({ 'success': True, 'id': dataset_id })
def ErrorResponse(status = 400)... | import flask
from flask import request, json
def Response(data, status = 200):
body = json.dumps(data)
return flask.Response(body, status = status, mimetype = 'application/json')
def SuccessResponse(dataset_id = None):
return Response({ 'success': True, 'id': dataset_id })
def ErrorResponse(status = 400)... |
Correct github URL for chessmoves module |
import chessmoves # Source: https://github.com/kervinck/chessmoves.git
import floyd as engine
import sys
def parseEpd(rawLine):
# 4-field FEN
line = rawLine.strip().split(' ', 4)
pos = ' '.join(line[0:4])
# EPD fields
operations = {'bm': '', 'am': ''}
fields = [op for... |
import chessmoves # Source: https://github.com/kervinck/floyd.git
import floyd as engine
import sys
def parseEpd(rawLine):
# 4-field FEN
line = rawLine.strip().split(' ', 4)
pos = ' '.join(line[0:4])
# EPD fields
operations = {'bm': '', 'am': ''}
fields = [op for op i... |
Change the way the configuration file is loaded | <?php
namespace ProjectLint\Console\Command;
use ProjectLint\Item\ItemManager;
use ProjectLint\Report\Renderer\TextRenderer;
use ProjectLint\Rule\RuleSet;
use ProjectLint\Rule\RuleSetChecker;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Consol... | <?php
namespace ProjectLint\Console\Command;
use ProjectLint\Item\ItemManager;
use ProjectLint\Report\Renderer\TextRenderer;
use ProjectLint\Rule\RuleSet;
use ProjectLint\Rule\RuleSetChecker;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Consol... |
Fix (profil): Text files should end with a newline character | <?php
namespace AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Compone... | <?php
namespace AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Compone... |
Return value instead of null | Kwf.Form.ShowField = Ext.extend(Ext.form.Field,
{
defaultAutoCreate : {tag: 'div', cls: 'kwf-form-show-field'},
/**
* {value} wenn kein objekt übergeben, sonst index aus objekt
*/
tpl: '{value}',
initValue : function(){
if(this.value !== undefined){
this.setValue(this.valu... | Kwf.Form.ShowField = Ext.extend(Ext.form.Field,
{
defaultAutoCreate : {tag: 'div', cls: 'kwf-form-show-field'},
/**
* {value} wenn kein objekt übergeben, sonst index aus objekt
*/
tpl: '{value}',
initValue : function(){
if(this.value !== undefined){
this.setValue(this.valu... |
Add move operation to user item | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._endpoint_base import EndpointBase
from ...._utils import send_session_re... | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._endpoint_base import EndpointBase
from ...._utils import send_session_re... |
Add id to translation of designer. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDesignerTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('designer', function (Blueprint $table) {
... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDesignerTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('designer', function (Blueprint $table) {
... |
Correct syntax while creating indexes
Change-Id: I90625647d8723531dbc7498d5d25e84ef1a3ed2b
Reviewed-on: http://review.couchbase.org/50007
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Michael Wiederhold <a17fed27eaa842282862ff7c1b9c8395a26ac320@couchbase.com> | INDEX_STATEMENTS = {
'basic': (
'CREATE INDEX by_city ON `{}` (city.f.f)',
'CREATE INDEX by_county ON `{}` (county.f.f)',
'CREATE INDEX by_realm ON `{}` (`realm.f`)',
),
'range': (
'CREATE INDEX by_coins ON `{}` (coins.f)',
'CREATE INDEX by_achievement ON `{}` (achiev... | INDEX_STATEMENTS = {
'basic': (
'CREATE INDEX by_city ON {}(city.f.f)',
'CREATE INDEX by_county ON {}(county.f.f)',
'CREATE INDEX by_realm ON {}(realm.f)',
),
'range': (
'CREATE INDEX by_coins ON {}(coins.f)',
'CREATE INDEX by_achievement ON {}(achievements)',
... |
Fix Django version in requirements
Current version of requirements in setup.py doesn't work well with (pip-compile)[https://github.com/nvie/pip-tools/] (concrete problem is discussed (here) [https://github.com/nvie/pip-tools/issues/323]). This commit changes `<=1.9` to `<1.10`. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
readme = open('README.md').read()
history = open('HISTORY.md').read().replace('.. :changelog:', '')
requirements = [
'Django<1.10',
]
test_requirements = [
'nose>=1.3,<2',
'factory_boy>=2.4,<3.0',
'fake-factory... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
readme = open('README.md').read()
history = open('HISTORY.md').read().replace('.. :changelog:', '')
requirements = [
'Django<=1.9',
]
test_requirements = [
'nose>=1.3,<2',
'factory_boy>=2.4,<3.0',
'fake-factory... |
Check if ga is a function | /* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CO... | /* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CO... |
Add eslint error if console is used | module.exports = {
env: {
node: true,
mocha: true,
es6: true
},
extends: 'react-app',
parserOptions: {
ecmaFeature: {
jsx: true
}
},
plugins: ['react', 'jsx-a11y', 'import'],
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
... | module.exports = {
env: {
node: true,
mocha: true,
es6: true
},
extends: 'react-app',
parserOptions: {
ecmaFeature: {
jsx: true
}
},
plugins: ['react', 'jsx-a11y', 'import'],
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
... |
Update the timeline endpoint for instagram | <?php
namespace duncan3dc\OAuth;
use duncan3dc\Helpers\Helper;
use duncan3dc\Serial\Json;
class Instagram extends OAuth2
{
public function __construct(array $options)
{
$options = Helper::getOptions($options, [
"client" => "",
"secret" => "",
"username" =... | <?php
namespace duncan3dc\OAuth;
use duncan3dc\Helpers\Helper;
use duncan3dc\Serial\Json;
class Instagram extends OAuth2
{
public function __construct(array $options)
{
$options = Helper::getOptions($options, [
"client" => "",
"secret" => "",
"username" =... |
Add fallback for empty dependencies and devDependencies | 'use strict';
var github = require('./github');
var npm = require('./npm');
var db = require('./db');
var email = require('./email');
var _ = require('underscore');
var cache = {};
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
npm.getLatestPackages(yesterday, function(error, packages) {
... | 'use strict';
var github = require('./github');
var npm = require('./npm');
var db = require('./db');
var email = require('./email');
var _ = require('underscore');
var cache = {};
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
npm.getLatestPackages(yesterday, function(error, packages) {
... |
BAP-11412: Implement enable/disable operations
- CS Fix | <?php
namespace Oro\Bundle\TranslationBundle\Helper;
use Oro\Bundle\ConfigBundle\Config\ConfigManager;
use Oro\Bundle\LocaleBundle\DependencyInjection\Configuration;
use Oro\Bundle\TranslationBundle\Entity\Language;
class LanguageHelper
{
/** @var ConfigManager */
protected $configManager;
/**
* @p... | <?php
namespace Oro\Bundle\TranslationBundle\Helper;
use Oro\Bundle\ConfigBundle\Config\ConfigManager;
use Oro\Bundle\LocaleBundle\DependencyInjection\Configuration;
use Oro\Bundle\TranslationBundle\Entity\Language;
class LanguageHelper
{
/** @var ConfigManager */
protected $configManager;
/**
* @p... |
Set debug level DEBUG in sample application | /*
* WireSpider
*
* Copyright (c) 2015 kazyx
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*/
package net.kazyx.wirespider.sampleapp;
import android.app.Application;
import android.util.Log;
public class SampleApplication extends Application {
@Overr... | /*
* WireSpider
*
* Copyright (c) 2015 kazyx
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*/
package net.kazyx.wirespider.sampleapp;
import android.app.Application;
import android.util.Log;
public class SampleApplication extends Application {
@Overr... |
Change long description to URL. | import os, sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def main():
setup(
name='stcrestclient',
version= '1.0.2',
author='Andrew Gillis',
author_email='andrew.gillis@spirent.com',
url='https://github.com/ajgillis/py-stc... | import os, sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def main():
setup(
name='stcrestclient',
version= '1.0.2',
author='Andrew Gillis',
author_email='andrew.gillis@spirent.com',
url='https://github.com/ajgillis/py-stc... |
Update thread query cache logic
- Move TTL to class constant
- Cast count to string instead of serializing | <?php
class SV_WordCountSearch_XenForo_Model_Thread extends XFCP_SV_WordCountSearch_XenForo_Model_Thread
{
/**
* The TTL for cached thread word count queries. Default is 4 hours.
*/
const WORD_COUNT_CACHE_TTL = 14400;
public function getThreadmarkWordCountByThread($threadId)
{
$cache... | <?php
class SV_WordCountSearch_XenForo_Model_Thread extends XFCP_SV_WordCountSearch_XenForo_Model_Thread
{
public function getThreadmarkWordCountByThread($threadId)
{
$cache = \XenForo_Application::getCache();
if ($cache)
{
$cacheKey = "SV_WordCountSearch_threadmarks_thread... |
Update Poll test to check members. | import unittest
from pollster.pollster import Pollster, Chart
class TestBasic(unittest.TestCase):
def test_basic_setup(self):
p = Pollster()
self.assertIsNotNone(p)
def test_charts(self):
c = Pollster().charts()
self.assertIsNotNone(c)
self.assertIsInstance(c, list)
... | import unittest
from pollster.pollster import Pollster, Chart
class TestBasic(unittest.TestCase):
def test_basic_setup(self):
p = Pollster()
self.assertIsNotNone(p)
def test_charts(self):
c = Pollster().charts()
self.assertIsNotNone(c)
self.assertIsInstance(c, list)
... |
Add moons admin link to global navigation. | <div class="user">
<img src="{{ $user->avatar }}" class="avatar" alt="{{ $user->name }}">
<div class="user-name">{{ $user->name }}</div>
<a href="/logout">Logout</a>
</div>
<ul>
<li>
<a href="/">
<i class="icon-home"></i>
Home
</a>
</li>
<li>
<a h... | <div class="user">
<img src="{{ $user->avatar }}" class="avatar" alt="{{ $user->name }}">
<div class="user-name">{{ $user->name }}</div>
<a href="/logout">Logout</a>
</div>
<ul>
<li>
<a href="/">
<i class="icon-home"></i>
Home
</a>
</li>
<li>
<a h... |
CRM-1322: Add mapping settings entity
- remove unused constant | <?php
namespace Oro\Bundle\IntegrationBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
class IntegrationConfiguration implements ConfigurationIn... | <?php
namespace Oro\Bundle\IntegrationBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
class IntegrationConfiguration implements ConfigurationIn... |
Fix non existing useragents shortcut | import os
import random
try:
import json
except ImportError:
import simplejson as json
from fake_useragent import settings
from fake_useragent.build import build_db
class UserAgent(object):
def __init__(self):
super(UserAgent, self).__init__()
# check db json file exists
if not os... | import os
import random
try:
import json
except ImportError:
import simplejson as json
from fake_useragent import settings
from fake_useragent.build import build_db
class UserAgent(object):
def __init__(self):
super(UserAgent, self).__init__()
# check db json file exists
if not os... |
Make the profile link inactive when needed. | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{ trans('messages.project-name') }}</title>
<style>
body {
padding-top: 80px;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.2/s... | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{ trans('messages.project-name') }}</title>
<style>
body {
padding-top: 80px;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.2/s... |
Check the number of items a little bit later
Due to MB-22749
Change-Id: Icffe46201223efa5645644ca40b99dffe4f0fb31
Reviewed-on: http://review.couchbase.org/76413
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.com> | from perfrunner.helpers.cbmonitor import with_stats
from perfrunner.helpers.local import clone_ycsb
from perfrunner.helpers.worker import ycsb_data_load_task, ycsb_task
from perfrunner.tests import PerfTest
from perfrunner.tests.n1ql import N1QLTest
class YCSBTest(PerfTest):
def download_ycsb(self):
clon... | from perfrunner.helpers.cbmonitor import with_stats
from perfrunner.helpers.local import clone_ycsb
from perfrunner.helpers.worker import ycsb_data_load_task, ycsb_task
from perfrunner.tests import PerfTest
from perfrunner.tests.n1ql import N1QLTest
class YCSBTest(PerfTest):
def download_ycsb(self):
clon... |
Use SG slug for event filtering | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter, BooleanFilter, ModelChoiceFilter
from falmer.events.models import Curator
from . import models
class EventFilterSet(FilterSet):
class Meta:
model = models.Event
fields = (
'title',
'venue',
't... | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter, BooleanFilter, ModelChoiceFilter
from falmer.events.models import Curator
from . import models
class EventFilterSet(FilterSet):
class Meta:
model = models.Event
fields = (
'title',
'venue',
't... |
Use react key list container | 'use strict'
import 'normalize.css'
import React, { Component } from 'react'
import ReactCSS from 'reactcss'
import '../fonts/work-sans/WorkSans.css!'
import '../styles/felony.css!'
import colors from '../styles/variables/colors'
import EncryptKeyListContainer from '../containers/EncryptKeyListContainer'
import F... | 'use strict';
import React, { Component } from 'react';
import ReactCSS from 'reactcss';
import colors from '../styles/variables/colors';
import 'normalize.css';
import '../fonts/work-sans/WorkSans.css!';
import '../styles/felony.css!';
import Header from './header/Header';
import EncryptKeyList from './encrypt/Encr... |
Use a more specific event selector in SelectDatasetView | import View from '../view';
import SelectDatasetPageTemplate from './selectDatasetPage.pug';
// View for a collection of datasets in a select tag. When user selects a
// dataset, a 'changed' event is triggered with the selected dataset as a
// parameter.
const SelectDatasetView = View.extend({
events: {
'... | import View from '../view';
import SelectDatasetPageTemplate from './selectDatasetPage.pug';
// View for a collection of datasets in a select tag. When user selects a
// dataset, a 'changed' event is triggered with the selected dataset as a
// parameter.
const SelectDatasetView = View.extend({
events: {
'... |
Update question about computer access | from django import forms
from studygroups.models import Application
from studygroups.models import Reminder
from localflavor.us.forms import USPhoneNumberField
class ApplicationForm(forms.ModelForm):
mobile = USPhoneNumberField(required=False)
def clean(self):
cleaned_data = super(ApplicationForm, se... | from django import forms
from studygroups.models import Application
from studygroups.models import Reminder
from localflavor.us.forms import USPhoneNumberField
class ApplicationForm(forms.ModelForm):
mobile = USPhoneNumberField(required=False)
def clean(self):
cleaned_data = super(ApplicationForm, se... |
Move @private to the end of the jsdoc | /*global define*/
define([], function() {
"use strict";
/**
* Parses the result of XMLHttpRequest's getAllResponseHeaders() method into
* a dictionary.
*
* @exports parseResponseHeaders
*
* @param {String} headerString The header string returned by getAllResponseHeaders(). The fo... | /*global define*/
define([], function() {
"use strict";
/**
* @private
*
* Parses the result of XMLHttpRequest's getAllResponseHeaders() method into
* a dictionary.
*
* @exports parseResponseHeaders
*
* @param {String} headerString The header string returned by getAllRes... |
Set the docs no matter if we run the test on this platform or not | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from users import Us... | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from users import Us... |
Change error message text for invite friends page. | /* global graphql */
import React from 'react'
import {QueryRenderer} from 'react-relay/compat'
import environment from '../../../../relay-env'
import ProfileInviteFriend from './ProfileInviteFriendContainer'
import FullScreenProgress from 'general/FullScreenProgress'
import AuthUserComponent from 'general/AuthUserC... | /* global graphql */
import React from 'react'
import {QueryRenderer} from 'react-relay/compat'
import environment from '../../../../relay-env'
import ProfileInviteFriend from './ProfileInviteFriendContainer'
import FullScreenProgress from 'general/FullScreenProgress'
import AuthUserComponent from 'general/AuthUserC... |
Add domain detect and show bold font of domain | define(function (require) {
'use strict';
var store = require('store');
var items = new Vue({
el: 'body',
data: {
items: [],
domains: store.fetch(),
domain: ''
},
ready: function () {
var timer,
that = this;
... | define(function (require) {
'use strict';
var store = require('store');
var items = new Vue({
el: 'body',
data: {
items: [],
domains: store.fetch(),
domain: ''
},
ready: function () {
var timer,
that = this;
... |
Sort test results according to version | 'use strict';
function TestResults(dataTable) {
var Cucumber = require('cucumber');
var TestResult = require('./testResult');
var maximums = [0, 0, 0, 0];
var testCollection = Cucumber.Type.Collection();
(function rowToTestResult() {
var rows = dataTable.getRows();
rows = rows.sor... | 'use strict';
function TestResults(dataTable) {
var Cucumber = require('cucumber');
var TestResult = require('./testResult');
var maximums = [0, 0, 0, 0];
var testCollection = Cucumber.Type.Collection();
(function rowToTestResult() {
dataTable.getRows().syncForEach(function(row) {
... |
Use cleaner method for checking if template ends with .gshkl | 'use strict';
const _ = require('lodash');
const fs = require('fs');
const path = require('path');
class Greshunkel {
constructor(options) {
this.options = {
directory: process.cwd()
};
_.extend(this.options, options);
}
compile(template) {
return new Promise... | 'use strict';
const _ = require('lodash');
const fs = require('fs');
const path = require('path');
class Greshunkel {
constructor(options) {
this.options = {
directory: process.cwd()
};
_.extend(this.options, options);
}
compile(template) {
return new Promise... |
Fix ajax URL check to run on page load | $(document).ready(function(){
$('#title_inc').tagsInput({'defaultText': '…'});
$('#title_exc').tagsInput({'defaultText': '…'});
$('#link_inc').tagsInput({'defaultText': '…'});
$('#link_exc').tagsInput({'defaultText': '…'});
set_submit(false)
$('#rss_url').blur(check_url)
check_url()
})
... | $(document).ready(function(){
$('#title_inc').tagsInput({'defaultText': '…'});
$('#title_exc').tagsInput({'defaultText': '…'});
$('#link_inc').tagsInput({'defaultText': '…'});
$('#link_exc').tagsInput({'defaultText': '…'});
set_submit(false)
$('#rss_url').blur(function(){
url = $(this... |
Store the correct payment method | (function() {
/***********************************************************/
/* Handle Proceed to Payment
/***********************************************************/
jQuery(function() {
jQuery(document).on('proceedToPayment', function(event, ShoppingCart) {
if (ShoppingCart.gateway... | (function() {
/***********************************************************/
/* Handle Proceed to Payment
/***********************************************************/
jQuery(function() {
jQuery(document).on('proceedToPayment', function(event, ShoppingCart) {
if (ShoppingCart.gateway... |
Use ResizeFactor parameter instead of hardcoded integer | package com.yahoo.sketches.tuple;
import com.yahoo.sketches.ResizeFactor;
import java.util.function.Predicate;
/**
* Class for filtering values from a {@link Sketch} given a {@link Summary}
*
* @param <T> Summary type against to which apply the {@link Predicate}
*/
public class Filter<T extends Summary> {
pr... | package com.yahoo.sketches.tuple;
import java.util.function.Predicate;
/**
* Class for filtering values from a {@link Sketch} given a {@link Summary}
*
* @param <T> Summary type against to which apply the {@link Predicate}
*/
public class Filter<T extends Summary> {
private Predicate<T> predicate;
/**
... |
Add all directories under lib to eslint config | #!/usr/bin/env node
require('shelljs/global');
require('colors');
var async = require('async'),
ESLintCLIEngine = require('eslint').CLIEngine,
LINT_SOURCE_DIRS = [
'./lib',
'./test/system',
'./test/unit',
'./test/integration',
'./npm/*.js',
'./index.js'
];
... | #!/usr/bin/env node
require('shelljs/global');
require('colors');
var async = require('async'),
ESLintCLIEngine = require('eslint').CLIEngine,
LINT_SOURCE_DIRS = [
'./lib/runner',
'./lib/authorizer',
'./lib/uvm/*.js',
'./lib/backpack',
'./test/system',
'./test/u... |
Fix the calls to loadMigrators() | package org.jboss.loom.migrators;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.jboss.loom.migrators._ext.MigratorDefinition;
import org.jboss.loom.spi.IMigrator;
/**
* Filters migrators - used to filter out migrators based on user input and config.
*
* @author Ondrej Zizka,... | package org.jboss.loom.migrators;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.jboss.loom.migrators._ext.MigratorDefinition;
import org.jboss.loom.spi.IMigrator;
/**
* Filters migrators - used to filter out migrators based on user input and config.
*
* @author Ondrej Zizka,... |
Add prepare-release task for consistency | var bower = require('bower'),
eventStream = require('event-stream'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip');
// Installs bower dependencies
gulp.task('bower', function(callback) {
bower.command... | var bower = require('bower'),
eventStream = require('event-stream'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip');
// Installs bower dependencies
gulp.task('bower', function(callback) {
bower.command... |
Update ldap3 1.0.3 => 1.0.4 | import sys
from setuptools import find_packages, setup
with open('VERSION') as version_fp:
VERSION = version_fp.read().strip()
install_requires = [
'django-local-settings>=1.0a13',
'stashward',
]
if sys.version_info[:2] < (3, 4):
install_requires.append('enum34')
setup(
name='django-arcutils... | import sys
from setuptools import find_packages, setup
with open('VERSION') as version_fp:
VERSION = version_fp.read().strip()
install_requires = [
'django-local-settings>=1.0a13',
'stashward',
]
if sys.version_info[:2] < (3, 4):
install_requires.append('enum34')
setup(
name='django-arcutils... |
Replace native w/ _.isObject function. | var klass = require('klass')
, _ = require('lodash')
, obligator = klass({
initialize: function() {
this._params = {};
this._collection = {};
}
})
.methods({
setCollection: function(collection) {
if ( !collection )
... | var klass = require('klass')
, _ = require('lodash')
, obligator = klass({
initialize: function() {
this._params = {};
this._collection = {};
}
})
.methods({
setCollection: function(collection) {
if ( !collection )
... |
Fix autofocus in user login dialog | /* Directives */
angular.module('myApp.directives')
.directive('ngVisible', function() {
return function(scope, elem, attr) {
scope.$watch(attr.ngVisible, function(value) {
elem.css('visibility', value ? 'visible' : 'hidden');
});
};
... | /* Directives */
angular.module('myApp.directives')
.directive('ngVisible', function() {
return function(scope, elem, attr) {
scope.$watch(attr.ngVisible, function(value) {
elem.css('visibility', value ? 'visible' : 'hidden');
});
};
... |
Add future import for Py2. | """Generate publication-quality data acquisition methods section from BIDS dataset.
"""
from __future__ import print_function
from collections import Counter
from bids.reports import utils
class BIDSReport(object):
"""
Generates publication-quality data acquisition methods section from BIDS
dataset.
... | """Generate publication-quality data acquisition methods section from BIDS dataset.
"""
from collections import Counter
from bids.reports import utils
class BIDSReport(object):
"""
Generates publication-quality data acquisition methods section from BIDS
dataset.
"""
def __init__(self, layout):
... |
Use bytes instead of strings | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gofasta
import (
"os"
"bufio"
"bytes"
)
type SeqRecord struct {
Id string
Seq string
}
func SimpleParser(file *os.File) chan *S... | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gofasta
import (
"strings"
"os"
"bufio"
"bytes"
)
type SeqRecord struct {
Id string
Seq string
}
func SimpleParser(file *os... |
Add a stub for fts_updates
Change-Id: Ieb48f98a0072dcd27de0b50027ff6c5f3ecc1513
Reviewed-on: http://review.couchbase.org/70413
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.com> | from urlparse import urlparse
from logger import logger
class WorkloadSettings(object):
def __init__(self, options):
self.creates = options.creates
self.reads = options.reads
self.updates = options.updates
self.deletes = options.deletes
self.cases = 0 # Stub for library ... | from urlparse import urlparse
from logger import logger
class WorkloadSettings(object):
def __init__(self, options):
self.creates = options.creates
self.reads = options.reads
self.updates = options.updates
self.deletes = options.deletes
self.cases = 0 # Stub for library ... |
[MySQL] Use the default number of queries | package sqlancer.dbms;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.junit.jupiter.api.Test;
import sqlancer.Main;
public class TestMySQL {
String mysqlAvailable = System.getenv("MYSQL_AVAILABLE");
boolean mysqlIsAvailabl... | package sqlancer.dbms;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.junit.jupiter.api.Test;
import sqlancer.Main;
public class TestMySQL {
String mysqlAvailable = System.getenv("MYSQL_AVAILABLE");
boolean mysqlIsAvailabl... |
Include qualifiers on reference generation | define(['rules/rules.module'
],
function() {
angular.module('rules').factory('references',
['ast',
function(ast) {
function generateReference(query) {
var bindings = {};
angular.forEach(query.bindings, function(binding) {
if (('id' in binding) && ('nam... | define(['rules/rules.module'
],
function() {
angular.module('rules').factory('references',
[
function() {
function generateReference(query) {
var bindings = {};
angular.forEach(query.bindings, function(binding) {
if (('id' in binding) && ('name' in bin... |
fix(kakao): Handle case where email is not present | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data['properties']
... | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data['properties']
... |
Fix: Use assertSame() instead of assertEquals() | <?php
/*
* This file is part of sebastian/phpunit-framework-constraint.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Constraint;
use PHPUnit\Framewo... | <?php
/*
* This file is part of sebastian/phpunit-framework-constraint.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Constraint;
use PHPUnit\Framewo... |
Use class name instead of object to reference constant (compile error fix on some versions of php) | <?
// callback controller
class Bitpay_Bitcoins_IndexController extends Mage_Core_Controller_Front_Action {
// bitpay's IPN lands here
public function indexAction() {
require 'lib/bitpay/bp_lib.php';
$apiKey = Mage::getStoreConfig('payment/Bitcoins/api_key');
$invoice = bpVerifyNotification($ap... | <?
// callback controller
class Bitpay_Bitcoins_IndexController extends Mage_Core_Controller_Front_Action {
// bitpay's IPN lands here
public function indexAction() {
require 'lib/bitpay/bp_lib.php';
$apiKey = Mage::getStoreConfig('payment/Bitcoins/api_key');
$invoice = bpVerifyNotification($ap... |
Fix selection not occurring on compact select+expand | (function(bitflux) {
'use strict';
angular.module('openfin.showcase')
.directive('showcase', ['quandlService', 'configService', (quandlService, configService) => {
return {
restrict: 'E',
templateUrl: 'showcase/showcase.html',
scope: {
... | (function(bitflux) {
'use strict';
angular.module('openfin.showcase')
.directive('showcase', ['quandlService', 'configService', (quandlService, configService) => {
return {
restrict: 'E',
templateUrl: 'showcase/showcase.html',
scope: {
... |
Fix for test failure introduced by basic auth changes | from e2e_framework.page_object import PageObject
from ..lms import BASE_URL
class InfoPage(PageObject):
"""
Info pages for the main site.
These are basically static pages, so we use one page
object to represent them all.
"""
# Dictionary mapping section names to URL paths
SECTION_PATH = {... | from e2e_framework.page_object import PageObject
from ..lms import BASE_URL
class InfoPage(PageObject):
"""
Info pages for the main site.
These are basically static pages, so we use one page
object to represent them all.
"""
# Dictionary mapping section names to URL paths
SECTION_PATH = {... |
Add message_type as CharField in form | import time
from django import forms
from .models import Message
from .utils import timestamp_to_datetime, datetime_to_timestamp
class MessageForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
typing = forms.BooleanField(required=False)
message_type = forms.CharField(widget=forms.Textarea)
... | import time
from django import forms
from .models import Message
from .utils import timestamp_to_datetime, datetime_to_timestamp
class MessageForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
typing = forms.BooleanField(required=False)
class MessageCreationForm(MessageForm):
username = f... |
Add unit test for masking key:value of YAML | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from salt.ext.six import text_type as text
# Import Salt Libs
from salt.utils.sanitizers import clean, mask_args_value
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from ... | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from salt.ext.six import text_type as text
# Import Salt Libs
from salt.utils.sanitizers import clean
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.moc... |
Fix reading the package version
This hack was broken by b4cad7631bd284df553bbc0fcd4c811bb4182509. | #!/usr/bin/env python
from setuptools import setup
long_description = open('README.rst').read()
# very convoluted way of reading version from the module without importing it
version = (
[l for l in open('flask_injector.py') if '__version__ = ' in l][0]
.split('=')[-1]
.strip().strip('\'')
)
if __name__ =... | #!/usr/bin/env python
from setuptools import setup
long_description = open('README.rst').read()
# very convoluted way of reading version from the module without importing it
version = (
[l for l in open('flask_injector.py') if '__version__' in l][0]
.split('=')[-1]
.strip().strip('\'')
)
if __name__ == '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.