text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Fix alert change type controller test | <?php
namespace Ilios\CoreBundle\Tests\DataLoader;
class AlertChangeTypeData extends AbstractDataLoader
{
protected function getData()
{
$arr = array();
$arr[] = array(
'id' => 1,
'title' => $this->faker->text(25),
'alerts' => ['1', '2']
);
... | <?php
namespace Ilios\CoreBundle\Tests\DataLoader;
class AlertChangeTypeData extends AbstractDataLoader
{
protected function getData()
{
$arr = array();
$arr[] = array(
'id' => 1,
'title' => $this->faker->text(25),
'alerts' => ['1']
);
$arr... |
Fix typo in the HelpPage module | (function (h) {
'use strict';
function HelpPage(chromeTabs, extensionURL) {
this.showHelpForError = function (tab, error) {
if (error instanceof h.LocalFileError) {
return this.showLocalFileHelpPage(tab);
}
else if (error instanceof h.NoFileAccessError) {
return this.showNoFil... | (function (h) {
'use strict';
function HelpPage(chromeTabs, extensionURL) {
this.showHelpForError = function (tab, error) {
if (error instanceof h.LocalFileError) {
return this.showLocalFileHelpPage(tab);
}
else if (error instanceof h.NoFileAccessError) {
return this.showNoFil... |
Make use of MarkdownLanguageConfig constants | package flow.netbeans.markdown;
import flow.netbeans.markdown.csl.MarkdownLanguageConfig;
import flow.netbeans.markdown.highlighter.MarkdownLanguageHierarchy;
import flow.netbeans.markdown.highlighter.MarkdownTokenId;
import org.netbeans.api.lexer.InputAttributes;
import org.netbeans.api.lexer.Language;
import ... | package flow.netbeans.markdown;
import org.netbeans.api.lexer.InputAttributes;
import org.netbeans.api.lexer.Language;
import org.netbeans.api.lexer.LanguagePath;
import org.netbeans.api.lexer.Token;
import org.netbeans.spi.lexer.LanguageEmbedding;
import org.netbeans.spi.lexer.LanguageProvider;
import flow.ne... |
Fix logos on 'Browse' page ('/directory') | 'use strict';
import React from 'react';
import { browserHistory } from 'react-router';
import EnterpriseSummary from './EnterpriseSummaryComponent.js';
class DirectoryComponent extends React.Component {
render() {
var directory = this.props.directory,
jsx = [],
app = this;
// Directory hasn't... | 'use strict';
import React from 'react';
import { browserHistory } from 'react-router';
import EnterpriseSummary from './EnterpriseSummaryComponent.js';
class DirectoryComponent extends React.Component {
render() {
var directory = this.props.directory,
jsx = [];
// Directory hasn't loaded yet, displ... |
Add pyscopg2 to list of dependencies | #!/usr/bin/evn python2
from setuptools import setup, find_packages
setup(name='pprof',
version='0.9.6',
packages=find_packages(),
install_requires=["SQLAlchemy==1.0.4", "cloud==2.8.5", "plumbum==1.4.2",
"regex==2015.5.28", "wheel==0.24.0", "parse==1.6.6",
... | #!/usr/bin/evn python2
from setuptools import setup, find_packages
setup(name='pprof',
version='0.9.6',
packages=find_packages(),
install_requires=["SQLAlchemy==1.0.4", "cloud==2.8.5", "plumbum==1.4.2",
"regex==2015.5.28", "wheel==0.24.0", "parse==1.6.6",
... |
Use jshint option for mozilla addons | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
development: {
files: {
"data/css/sidebar.css": "data/css/sidebar.less"
},
options: {}
}
},
jshint: {
... | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
development: {
files: {
"data/css/sidebar.css": "data/css/sidebar.less"
},
options: {}
}
},
jshint: {
... |
Trim code a little more | import _ from './utils';
function getTransitions(value) {
if (_.isArray(value)) return value;
if (_.isObject(value)) return value.transitions;
}
export default {
has: (value = {}, conditions = {}) => {
return !!_.find(getTransitions(value), conditions);
},
find: (value = {}, conditions = {}) => {
r... | import _ from './utils';
export default {
has: (value = {}, conditions = {}) => {
if (!_.isObject(conditions)) return false;
if (_.isArray(value)) return !!_.find(value, conditions);
if (_.isObject(value)) return !!_.find(value.transitions, conditions);
return false;
},
find: (value = {}, condit... |
Fix issue when root is being ignored if passed as an empty string. | // TODO: Make options linear.
// Would make configuration more user friendly.
'use strict'
var path = require('path')
var packageName = 'chewingum'
module.exports = function (options) {
function n (pathString) {
return path.normalize(pathString)
}
var opts = options || {}
opts.location = (opts.location)... | // TODO: Make options linear.
// Would make configuration more user friendly.
'use strict'
var path = require('path')
var packageName = 'chewingum'
module.exports = function (options) {
function n (pathString) {
return path.normalize(pathString)
}
var opts = options || {}
opts.location = (opts.location)... |
Add note createAction with sample data | <?php
namespace AppBundle\Controller;
use AppBundle\Entity\Note;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class NoteControlle... | <?php
namespace AppBundle\Controller;
use AppBundle\Entity\Note;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class NoteControlle... |
Fix url resolution with regards to querysting parameters. | <?php
namespace Markup\OEmbedBundle\Client;
use Markup\OEmbedBundle\Provider\ProviderInterface;
/**
* A superclass for client implementations.
*/
abstract class AbstractClient implements ClientInterface
{
/**
* Resolves the media ID and an oEmbed provider to a URL.
*
* @param ProviderInterface $p... | <?php
namespace Markup\OEmbedBundle\Client;
use Markup\OEmbedBundle\Provider\ProviderInterface;
/**
* A superclass for client implementations.
*/
abstract class AbstractClient implements ClientInterface
{
/**
* Resolves the media ID and an oEmbed provider to a URL.
*
* @param ProviderInterface $p... |
Correct IIFE global variable name | (function(global, f){
'use strict';
/*istanbul ignore next*/
if(module && typeof module.exports !== 'undefined'){
module.exports = f(
require('fluture'),
require('sanctuary-def'),
require('sanctuary-type-identifiers')
);
}else{
global.flutureSanctuaryTypes = f(
global.Flutu... | (function(global, f){
'use strict';
/*istanbul ignore next*/
if(module && typeof module.exports !== 'undefined'){
module.exports = f(
require('fluture'),
require('sanctuary-def'),
require('sanctuary-type-identifiers')
);
}else{
global.concurrify = f(
global.Fluture,
g... |
Add section session varialbes to facilitate redirects | from collections import namedtuple
CONTENT_TYPES = [
("core.ArticlePage", "Article"),
("core.SectionPage", "Section"),
]
ENDPOINTS = [
("page", "api/v1/pages")
]
SESSION_VARS = namedtuple(
"SESSION_VARS",
["first", "second", ]
)
ARTICLE_SESSION_VARS = SESSION_VARS(
first=("url", "article_con... | from collections import namedtuple
CONTENT_TYPES = [
("core.ArticlePage", "Article"),
("core.SectionPage", "Section"),
]
ENDPOINTS = [
("page", "api/v1/pages")
]
SESSION_VARS = namedtuple(
"SESSION_VARS",
["first", "second", ]
)
ARTICLE_SESSION_VARS = SESSION_VARS(
first=("url", "article_con... |
Make abstract or it run | /**
*
*/
package org.javacc;
import junit.framework.TestCase;
/**
* An ancestor class to enable transition to a different directory structure.
*
* @author timp
* @since 2 Nov 2007
*
*/
public abstract class JavaCCTestCase extends TestCase {
/**
*
*/
public JavaCCTestCase() {
super();
}
... | /**
*
*/
package org.javacc;
import junit.framework.TestCase;
/**
* An ancestor class to enable transition to a different directory structure.
*
* @author timp
* @since 2 Nov 2007
*
*/
public class JavaCCTestCase extends TestCase {
/**
*
*/
public JavaCCTestCase() {
super();
}
/**
* ... |
Use full paths due to dependency injection | <?php
namespace Dealer4dealer\Xcore\Model;
class RestManagement implements \Dealer4dealer\Xcore\Api\RestManagementInterface
{
const MODULE_NAME = 'Dealer4dealer_Xcore';
protected $productMetadata;
protected $moduleList;
public function __construct(\Magento\Framework\App\ProductMetadataInterface $prod... | <?php
namespace Dealer4dealer\Xcore\Model;
class RestManagement implements \Dealer4dealer\Xcore\Api\RestManagementInterface
{
const MODULE_NAME = 'Dealer4dealer_Xcore';
protected $productMetadata;
protected $moduleList;
public function __construct(\Magento\Framework\App\ProductMetadataInterface $prod... |
Put jQuery back. Removed in error. | <meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="/css/bootstrap.css" />
<link rel="stylesheet" media="screen" href="/css/superfish.css" />
<link rel="stylesheet" media="screen" href="/css/slides.css" />
<lin... | <meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="/css/bootstrap.css" />
<link rel="stylesheet" media="screen" href="/css/superfish.css" />
<link rel="stylesheet" media="screen" href="/css/slides.css" />
<lin... |
Change null namespaces to empty string on upgrade
Former-commit-id: d7c529c257869772bce5cf4b06520a241904a808 | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
class Version5704 extends AbstractMigration
{
public function getName()
{
return '20140930000000';
}
public funct... | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
class Version5704 extends AbstractMigration
{
public function getName()
{
return '20140930000000';
}
public funct... |
Fix bug in action serializer
Don't try to get URL of items that have been deleted | from rest_framework import serializers
from editorsnotes.main.models.auth import (LogActivity, ADDITION, CHANGE,
DELETION)
VERSION_ACTIONS = {
ADDITION: 'added',
CHANGE: 'changed',
DELETION: 'deleted'
}
# TODO: make these fields nested, maybe
class ActivitySeria... | from rest_framework import serializers
from editorsnotes.main.models.auth import (LogActivity, ADDITION, CHANGE,
DELETION)
VERSION_ACTIONS = {
ADDITION: 'added',
CHANGE: 'changed',
DELETION: 'deleted'
}
# TODO: make these fields nested, maybe
class ActivitySeria... |
Read contents of files in archive as well | import {useCallback} from 'react';
import {useDropzone} from 'react-dropzone';
import JSZip from 'jszip';
export default function Dropzone() {
const onDrop = useCallback(async acceptedFiles => {
const zip = await JSZip.loadAsync(acceptedFiles[0]);
for (let name in zip.files) {
console.log(name);
... | import {useCallback} from 'react';
import {useDropzone} from 'react-dropzone';
import JSZip from 'jszip';
export default function Dropzone() {
const onDrop = useCallback(async acceptedFiles => {
const zip = await JSZip.loadAsync(acceptedFiles[0]);
zip.forEach((name, file) => {
console.log(name);
... |
Fix usage of some helper in form loss preventer service | import Ember from 'ember';
import {some} from 'ember-form-object/utils/core';
const {Service, computed, $, A: emberArray} = Ember;
export default Service.extend({
registeredFormObjects: computed(() => emberArray()),
init() {
this._super(...arguments);
this.setupBeforeUnloadListener();
},
setupBefore... | import Ember from 'ember';
import {some} from 'ember-form-object/utils/core';
const {Service, computed, $, A: emberArray} = Ember;
export default Service.extend({
registeredFormObjects: computed(() => emberArray()),
init() {
this._super(...arguments);
this.setupBeforeUnloadListener();
},
setupBefore... |
Add exception to to return extended height of the show | from django import template
from datetime import datetime, time, timedelta
register = template.Library()
@register.simple_tag
def height(start, end):
if start.year == 2020 and int(start.strftime('%V')) >= 5 and start.hour == 12 and start.minute == 0:
if end.minute == 5:
return '30'
r... | from django import template
from datetime import datetime, time, timedelta
register = template.Library()
@register.simple_tag
def height(start, end):
if start.year == 2020 and int(start.strftime('%V')) >= 5 and start.hour == 12 and start.minute == 0:
return '30'
else:
return '%d' % ((end - s... |
Autoloader: Support PSR-4 style namespace/directory mapping
Signed-off-by: Florian Pritz <753f544d2d01592750fb4bd29251b78abcfc8ecd@xinu.at> | <?php
/*
* Copyright 2014 Florian "Bluewind" Pritz <bluewind@server-speed.net>
*
* Licensed under AGPLv3
* (see COPYING for full license text)
*
*/
// Original source: http://stackoverflow.com/a/9526005/953022
class CustomAutoloader{
public function __construct()
{
spl_autoload_register(array($this, 'loader'... | <?php
/*
* Copyright 2014 Florian "Bluewind" Pritz <bluewind@server-speed.net>
*
* Licensed under AGPLv3
* (see COPYING for full license text)
*
*/
// Original source: http://stackoverflow.com/a/9526005/953022
class CustomAutoloader{
public function __construct()
{
spl_autoload_register(array($this, 'loader'... |
Add support for single files
There may be a time where a user would like to pass just a single file to the formatter instead of an entire directory. | <?php
/*
* This file is part of MITRE's ACE project
*
* Copyright (c) 2015 MITRE Corporation
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* @author MITRE's ACE Team <ace-team@mitre.org>
*/
namespace Mmoreram\PHPFormatter\F... | <?php
/*
* This file is part of the php-formatter package
*
* Copyright (c) 2014 Marc Morera
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Feel free to edit as you please, and have fun.
*
* @author Marc Morera <yuhu@mmoreram... |
Use SiteFeed to get a category listing | # encoding: utf-8
"""
List categories and their IDs in a Discourse forum.
"""
import os
from argparse import ArgumentParser
from community_mailbot.discourse import SiteFeed
def main():
args = parse_args()
site_feed = SiteFeed(args.url, user=args.user, key=args.key)
for c_id, name in site_feed.category_n... | # encoding: utf-8
"""
List categories and their IDs in a Discourse forum.
"""
import os
from argparse import ArgumentParser
from urllib.parse import urljoin
import requests
def main():
args = parse_args()
params = {}
if args.key is not None:
params['api_key'] = args.key
if args.user is not N... |
Update tests for `res.url` and `err.url` | 'use strict';
var assert = require('assert');
var Response = require('../');
var res = new Response(200, {
'Foo-Bar': 'baz-Bosh',
'bar-foo': 'bish-Bosh'
}, 'foo bar baz', 'http://example.com');
assert(res.statusCode = 200);
assert(res.headers['foo-bar'] === 'baz-Bosh');
assert(res.headers['bar-foo'] === 'bish-Bos... | 'use strict';
var assert = require('assert');
var Response = require('../');
var res = new Response(200, {
'Foo-Bar': 'baz-Bosh',
'bar-foo': 'bish-Bosh'
}, 'foo bar baz');
assert(res.statusCode = 200);
assert(res.headers['foo-bar'] === 'baz-Bosh');
assert(res.headers['bar-foo'] === 'bish-Bosh');
assert(res.body =... |
Add more tests back in | <?php
class Purity5Test extends PHPUnit_Framework_TestCase
{
// Tests
public function test_SimpleParse() {
$html = '<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Heading</h1>
<p>Welcome to Purity5!</p>
</body>
</html>';
$func = SkylarK\Purity5\Purity5::parse($html);
$thi... | <?php
class Purity5Test extends PHPUnit_Framework_TestCase
{
// Tests
public function test_SimpleParse() {
$html = '<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Heading</h1>
<p>Welcome to Purity5!</p>
</body>
</html>';
$func = SkylarK\Purity5\Purity5::parse($html);
//$t... |
Insert example directories in path before all others in the example test. | # -*- coding: utf-8 -*-
#######################################################################
# Name: test_examples
# Purpose: Test that examples run without errors.
# Author: Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com>
# Copyright: (c) 2014-2015 Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com>
# L... | # -*- coding: utf-8 -*-
#######################################################################
# Name: test_examples
# Purpose: Test that examples run without errors.
# Author: Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com>
# Copyright: (c) 2014-2015 Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com>
# L... |
Simplify object in ChatServer constructor. | import connect from 'connect';
import faker from 'faker';
import path from 'path';
import serveStatic from 'serve-static';
import uuid from 'node-uuid';
import {Server as WebSocketServer} from 'ws';
connect().use(serveStatic(path.join(__dirname, '../'))).listen(8080);
class ChatServer {
constructor(port) {
this... | import connect from 'connect';
import faker from 'faker';
import path from 'path';
import serveStatic from 'serve-static';
import uuid from 'node-uuid';
import {Server as WebSocketServer} from 'ws';
connect().use(serveStatic(path.join(__dirname, '../'))).listen(8080);
class ChatServer {
constructor(port) {
this... |
[TASK] Fix small error in model naming
-InvoiceNumber should have been InvoiceId | package org.killbill.billing.plugin.notification.womplyClient;
public class EmailRequestModel {
private String emailType;
private String invoiceId;
private String subscriptionId;
private String businessLocationId;
public EmailRequestModel(String emailType,
String invo... | package org.killbill.billing.plugin.notification.womplyClient;
public class EmailRequestModel {
private String emailType;
private String invoiceNumber;
private String subscriptionId;
private String businessLocationId;
public EmailRequestModel(String emailType,
String ... |
Test + travis = error | package main
import (
"fmt"
"testing"
"github.com/spf13/viper"
)
func TestSomething(t *testing.T) {
viper.SetConfigName("config")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
fmt.Printf("%v", err)
}
}
/*
func TestMain(m *testing.M) {
i18n.MustLoadTranslationFile("lang/en-US.all.js... | package main
import (
"fmt"
"os"
"testing"
"github.com/nicksnyder/go-i18n/i18n"
mylog "github.com/patrickalin/GoMyLog"
"github.com/spf13/viper"
)
func TestSomething(t *testing.T) {
viper.SetConfigName("config")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
fmt.Printf("%v", err)
}
... |
Remove GS from internal header | var fetch = require('node-fetch');
var FormData = require('form-data');
module.exports = () => {
const scriptURL = 'https://script.google.com/macros/s/---/exec';
// Add submit handler to 'internal header' form
const wikiform = document.forms['wikidata-form'];
if (wikiform) {
wikiform.addEventListener('sub... | var fetch = require('node-fetch');
var FormData = require('form-data');
module.exports = () => {
const scriptURL = 'https://script.google.com/macros/s/AKfycbxavhMbZpTlCuRHdUauf2hkGcx4uHTZ2TpSx5jr4B8p4Luy3u4/exec';
// Add submit handler to 'internal header' form
const wikiform = document.forms['wikidata-form'];
... |
Add deselectCountry method to WorldComponent. | /** @jsx React.DOM */
var CountriesComponent = require('./countries_component');
var PathsComponent = require('./paths_component');
var PolygonsComponent = require('./polygons_component');
var React = require('react');
module.exports = React.createClass({
// Selects a given country.
selectCountr... | /** @jsx React.DOM */
var CountriesComponent = require('./countries_component');
var PathsComponent = require('./paths_component');
var PolygonsComponent = require('./polygons_component');
var React = require('react');
module.exports = React.createClass({
selectCountry: function(country) {
thi... |
Throw errors to stop the promise chain | 'use strict';
// External modules
var Bluebird = require('bluebird');
// Local modules
var Support = require('./support');
module.exports = {
bump: function (args) {
return Bluebird
.resolve(args)
.tap(logWrap('Updating the changelog', Support.changelog.update))
.tap(logWrap('Updating the pac... | 'use strict';
// External modules
var Bluebird = require('bluebird');
// Local modules
var Support = require('./support');
module.exports = {
bump: function (args) {
return Bluebird
.resolve(args)
.tap(logWrap('Updating the changelog', Support.changelog.update))
.tap(logWrap('Updating the pac... |
Remove second type element if empty | const DocumentedItem = require('./item');
class DocumentedVarType extends DocumentedItem {
registerMetaInfo(data) {
this.directData = data;
}
serialize() {
const names = [];
for(const name of this.directData.names) names.push(this.constructor.splitVarName(name));
return { types: names };
}
static splitV... | const DocumentedItem = require('./item');
class DocumentedVarType extends DocumentedItem {
registerMetaInfo(data) {
this.directData = data;
}
serialize() {
const names = [];
for(const name of this.directData.names) names.push(this.constructor.splitVarName(name));
return { types: names };
}
static splitV... |
Make sure the OEmbed type can never be used to control filenames.
Minor risk, as it's still a template path, but better be safe then sorry. | """
Definition of the plugin.
"""
from django.utils.translation import ugettext_lazy as _
from fluent_contents.extensions import ContentPlugin, plugin_pool
from fluent_contents.plugins.oembeditem.forms import OEmbedItemForm
from fluent_contents.plugins.oembeditem.models import OEmbedItem
import re
re_safe = re.compile... | """
Definition of the plugin.
"""
from django.utils.translation import ugettext_lazy as _
from fluent_contents.extensions import ContentPlugin, plugin_pool
from fluent_contents.plugins.oembeditem.forms import OEmbedItemForm
from fluent_contents.plugins.oembeditem.models import OEmbedItem
@plugin_pool.register
class O... |
Delete useless username at link
Now that the image upload is at the edit page username isn't needed as a
method. | <?php
class ImageController {
public static function create( $image ) {
include_once 'models/image.php';
include_once 'models/extentions.php';
if ( !isset( $_SESSION[ 'user' ][ 'username' ] ) ) {
throw new HTTPUnauthorizedException();
}
... | <?php
class ImageController {
public static function create( $image ) {
include_once 'models/image.php';
include_once 'models/extentions.php';
if ( !isset( $_SESSION[ 'user' ][ 'username' ] ) ) {
throw new HTTPUnauthorizedException();
}
... |
Use open instead of file. | # -*- encoding: utf8 -*-
from setuptools import setup, find_packages
import os
setup(
name = "django-prefetch",
version = "0.1.1",
url = 'https://github.com/ionelmc/django-prefetch',
download_url = '',
license = 'BSD',
description = "Generic model related data prefetch framework for Django",
... | # -*- encoding: utf8 -*-
from setuptools import setup, find_packages
import os
setup(
name = "django-prefetch",
version = "0.1.1",
url = 'https://github.com/ionelmc/django-prefetch',
download_url = '',
license = 'BSD',
description = "Generic model related data prefetch framework for Django",
... |
Drop trailing arg list comma to support Python 3.5 | """Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date'
):
"""Retrieve the version from SCM tag in Git or Hg."""
try:
return get_version(
root=root,... | """Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date',
):
"""Retrieve the version from SCM tag in Git or Hg."""
try:
return get_version(
root=root... |
Refactor simple select path logic | function q(path) {
var fn = selectPath(path);
if (arguments.length > 1) {
return fn(arguments[1]);
} else {
return fn;
}
}
function selectPath(path) {
function nonEmpty(part) {
return part.length > 0;
}
var defaultValue = undefined;
path = path.split("/").filt... | function q(path) {
var fn = selectPath(path);
if (arguments.length > 1) {
return fn(arguments[1]);
} else {
return fn;
}
}
function selectPath(path) {
function nonEmpty(part) {
return part.length > 0;
}
var parts = path.split("/").filter(nonEmpty);
var p... |
core: Modify constructor to be compatible with caller method
ConnectDomainToStorageCommand is being called without context
although its constructor is only supported with context parameter,
so we will always get runtime exception when the command is being
called.
The proposed fix is to add a constructor which also su... | package org.ovirt.engine.core.bll.storage;
import org.ovirt.engine.core.bll.context.CommandContext;
import java.util.Date;
import org.ovirt.engine.core.bll.InternalCommandAttribute;
import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
import org.ovirt.engine.core.common.action.StorageDomainPoolParameters... | package org.ovirt.engine.core.bll.storage;
import org.ovirt.engine.core.bll.context.CommandContext;
import java.util.Date;
import org.ovirt.engine.core.bll.InternalCommandAttribute;
import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
import org.ovirt.engine.core.common.action.StorageDomainPoolParameters... |
Revert "Fix for blank page on Safari reload" |
/**
* Expose `fresh()`.
*/
module.exports = fresh;
/**
* Check freshness of `req` and `res` headers.
*
* When the cache is "fresh" __true__ is returned,
* otherwise __false__ is returned to indicate that
* the cache is now stale.
*
* @param {Object} req
* @param {Object} res
* @return {Boolean}
* @api pu... |
/**
* Expose `fresh()`.
*/
module.exports = fresh;
/**
* Check freshness of `req` and `res` headers.
*
* When the cache is "fresh" __true__ is returned,
* otherwise __false__ is returned to indicate that
* the cache is now stale.
*
* @param {Object} req
* @param {Object} res
* @return {Boolean}
* @api pu... |
Drop database before every test run, too, to remove data from failed tests. | # -*- coding: utf-8 -*-
from unittest import TestCase
from byceps.application import create_app
from byceps.blueprints.brand.models import Brand
from byceps.blueprints.party.models import Party
from byceps.database import db
class AbstractAppTestCase(TestCase):
def setUp(self):
self.app = create_app('t... | # -*- coding: utf-8 -*-
from unittest import TestCase
from byceps.application import create_app
from byceps.blueprints.brand.models import Brand
from byceps.blueprints.party.models import Party
from byceps.database import db
class AbstractAppTestCase(TestCase):
def setUp(self):
self.app = create_app('t... |
Fix JSHint issues with template node test file | 'use strict';
var <%= slugname %> = require('../lib/<%= slugname %>.js');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [mes... | 'use strict';
var <%= slugname %> = require('../lib/<%= slugname %>.js');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [mes... |
Set default for STATS to true to get byte counts for messages
git-svn-id: f22e84ca493ccad7df8d2727bca69d1c9fc2e5c5@2714 aaf88347-d911-0410-b711-e54d386773bb | package ibis.impl.tcp;
import ibis.util.TypedProperties;
interface Config {
static final String PROPERTY_PREFIX = "ibis.tcp.";
static final String s_debug = PROPERTY_PREFIX + "debug";
static final String s_stats = PROPERTY_PREFIX + "stats";
static final String s_asserts = PROPERTY_PREFIX + "asserts";
... | package ibis.impl.tcp;
import ibis.util.TypedProperties;
interface Config {
static final String PROPERTY_PREFIX = "ibis.tcp.";
static final String s_debug = PROPERTY_PREFIX + "debug";
static final String s_stats = PROPERTY_PREFIX + "stats";
static final String s_asserts = PROPERTY_PREFIX + "asserts";
... |
Use commit suggestion to use types
Co-authored-by: Pedro Algarvio <4410d99cefe57ec2c2cdbd3f1d5cf862bb4fb6f8@algarvio.me> | import subprocess
import types
import pytest
import salt.client.ssh.shell as shell
@pytest.fixture
def keys(tmp_path):
pub_key = tmp_path / "ssh" / "testkey.pub"
priv_key = tmp_path / "ssh" / "testkey"
return types.SimpleNamespace(pub_key=pub_key, priv_key=priv_key)
@pytest.mark.skip_on_windows(reason=... | import os
import subprocess
import pytest
import salt.client.ssh.shell as shell
@pytest.fixture
def keys(tmp_path):
pub_key = tmp_path / "ssh" / "testkey.pub"
priv_key = tmp_path / "ssh" / "testkey"
yield {"pub_key": str(pub_key), "priv_key": str(priv_key)}
@pytest.mark.skip_on_windows(reason="Windows ... |
Fix tests now that we have added Redux | import React from 'react'
import { Provider } from 'react-redux'
import { shallow, render } from 'enzyme'
import { shallowToJson } from 'enzyme-to-json'
import store from './store'
import { setSearchTerm } from './actionCreators'
import Search, { Unwrapped as UnwrappedSearch } from './Search'
import ShowCard from './Sh... | import React from 'react'
import { shallow } from 'enzyme'
import { shallowToJson } from 'enzyme-to-json'
import Search from './Search'
import ShowCard from './ShowCard'
import preload from '../public/data.json'
test('Search snapshot test', () => {
const component = shallow(<Search />)
const tree = shallowToJson(... |
Fix tests: add module function docstring | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import time
# Import Salt libs
import salt.utils.decorators
def _fallbackfunc():
return False, 'fallback'
def working_function():
'''
CLI Example:
.. code-block:: bash
'''
return True
@salt.utils.decorat... | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import time
# Import Salt libs
import salt.utils.decorators
def _fallbackfunc():
return False, 'fallback'
def working_function():
'''
CLI Example:
.. code-block:: bash
'''
return True
@salt.utils.decorato... |
Add 1 more checklist item about publish | const readline = require('readline')
console.log(`Preparing to publish version: ${process.env.npm_package_version}`)
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
function pleaseFix() {
console.warn('Please fix the checklist first then come back again ;)')
process.exit(1)
... | const readline = require('readline')
console.log(`Preparing to publish version: ${process.env.npm_package_version}`)
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
function pleaseFix() {
console.warn('Please fix the checklist first then come back again ;)')
process.exit(1)
... |
Fix test 4.2 to test for stream error
The test sends an oversized data frame, so the server is required
to reset the stream with FRAME_SIZE_ERROR.
The server may treat this error as fatal for the connection and send
GOAWAY( FRAME_SIZE_ERROR ), or drop the connection instead.
These upgraded errors are already handled ... | package h2spec
import (
"github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack"
)
func FrameSizeTestGroup() *TestGroup {
tg := NewTestGroup("4.2", "Frame Size")
tg.AddTestCase(NewTestCase(
"Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
"The endpoint MUST send a FRAME_SIZE_ERROR erro... | package h2spec
import (
"github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack"
)
func FrameSizeTestGroup() *TestGroup {
tg := NewTestGroup("4.2", "Frame Size")
tg.AddTestCase(NewTestCase(
"Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
"The endpoint MUST send a FRAME_SIZE_ERROR erro... |
Change unicode rep to use Subject text | # -*- coding: utf-8 -*-
from django.db import models
from website.util import api_v2_url
from osf.models.base import BaseModel, ObjectIDMixin
class Subject(ObjectIDMixin, BaseModel):
"""A subject discipline that may be attached to a preprint."""
modm_model_path = 'website.project.taxonomies.Subject'
mod... | # -*- coding: utf-8 -*-
from django.db import models
from website.util import api_v2_url
from osf.models.base import BaseModel, ObjectIDMixin
class Subject(ObjectIDMixin, BaseModel):
"""A subject discipline that may be attached to a preprint."""
modm_model_path = 'website.project.taxonomies.Subject'
mod... |
Add rtd import to master | import shutil
import os
from readthedocs.projects.models import Project
slugs = [p.slug for p in Project.objects.all()]
build_projects = os.listdir('/home/docs/checkouts/readthedocs.org/user_builds/')
final = []
for slug in build_projects:
if slug not in slugs and slug.replace('_', '-') not in slugs:
fin... | import shutil
import os
from projects.models import Project
slugs = [p.slug for p in Project.objects.all()]
build_projects = os.listdir('/home/docs/checkouts/readthedocs.org/user_builds/')
final = []
for slug in build_projects:
if slug not in slugs and slug.replace('_', '-') not in slugs:
final.append(sl... |
Refactor Zendesk client code for smoketest | # -*- coding: utf-8 -*-
"Zendesk"
import json
import requests
from flask import current_app
TICKETS_URL = 'https://ministryofjustice.zendesk.com/api/v2/tickets.json'
def zendesk_auth():
return (
'{username}/token'.format(
username=current_app.config['ZENDESK_API_USERNAME']),
current... | # -*- coding: utf-8 -*-
"Zendesk"
import json
import requests
from flask import current_app
TICKETS_URL = 'https://ministryofjustice.zendesk.com/api/v2/tickets.json'
def create_ticket(payload):
"Create a new Zendesk ticket"
return requests.post(
TICKETS_URL,
data=json.dumps(payload),
... |
Update compilerOutputFormatting value in the unit test | <?php
class SassHandlerTest extends PHPUnit_Framework_TestCase
{
/**
* @var SassHandler
*/
private $sassHandler;
/**
* Path to the directory with fixture files
* @var string
*/
private $fixturesDirectory;
protected function setUp()
{
$this->sassHandler = new ... | <?php
class SassHandlerTest extends PHPUnit_Framework_TestCase
{
/**
* @var SassHandler
*/
private $sassHandler;
/**
* Path to the directory with fixture files
* @var string
*/
private $fixturesDirectory;
protected function setUp()
{
$this->sassHandler = new ... |
Remove FLOWER_ prefix for non flower based vars | import os
AMPQ_ADMIN_USERNAME = os.getenv('AMQP_ADMIN_USERNAME', 'guest')
AMPQ_ADMIN_PASSWORD = os.getenv('AMQP_ADMIN_PASSWORD', 'guest')
AMQP_ADMIN_HOST = os.getenv('AMQP_ADMIN_HOST', '172.17.42.1')
AMQP_ADMIN_PORT = int(os.getenv('AMQP_ADMIN_PORT', '15672'))
DEFAULT_BROKER_API = 'http://%s:%s@%s:%d/api/' \
... | import os
AMPQ_ADMIN_USERNAME = os.getenv('AMQP_ADMIN_USERNAME', 'guest')
AMPQ_ADMIN_PASSWORD = os.getenv('AMQP_ADMIN_PASSWORD', 'guest')
AMQP_ADMIN_HOST = os.getenv('AMQP_ADMIN_HOST', '172.17.42.1')
AMQP_ADMIN_PORT = int(os.getenv('AMQP_ADMIN_PORT', '15672'))
DEFAULT_BROKER_API = 'http://%s:%s@%s:%d/api/' \
... |
Select next item with j key | // ==UserScript==
// @name Rightmove Enhancement Suite
// @namespace https://github.com/chigley/
// @description Keyboard shortcuts
// @include http://www.rightmove.co.uk/*
// @version 1
// @grant GM_addStyle
// @grant GM_getResourceText
// @resource style style.css
// ==/UserScript==
v... | // ==UserScript==
// @name Rightmove Enhancement Suite
// @namespace https://github.com/chigley/
// @description Keyboard shortcuts
// @include http://www.rightmove.co.uk/*
// @version 1
// @grant GM_addStyle
// @grant GM_getResourceText
// @resource style style.css
// ==/UserScript==
v... |
Check weather data validity on refresh
Related to #76 | var RefreshWeather = function (options) {
options = options || {};
options.elem = options.elem || "#weather-general";
options.update_interval = options.update_interval || 15 * 60 * 1000;
var elem = $(options.elem),
update_interval;
function setWeatherInfo (icon, temperature) {
elem.html("<img src='/... | var RefreshWeather = function (options) {
options = options || {};
options.elem = options.elem || "#weather-general";
options.update_interval = options.update_interval || 15 * 60 * 1000;
var elem = $(options.elem),
update_interval;
function setWeatherInfo (icon, temperature) {
elem.html("<img src='/... |
Improve LocaleToggle messages definition syntax | /*
*
* LanguageToggle
*
*/
import React from 'react';
import { connect } from 'react-redux';
import { selectLocale } from '../LanguageProvider/selectors';
import { changeLocale } from '../LanguageProvider/actions';
import { languages } from '../../i18n';
import { createSelector } from 'reselect';
import styles fro... | /*
*
* LanguageToggle
*
*/
import React from 'react';
import { connect } from 'react-redux';
import { selectLocale } from '../LanguageProvider/selectors';
import { changeLocale } from '../LanguageProvider/actions';
import { languages } from '../../i18n';
import { createSelector } from 'reselect';
import styles fro... |
Send msg from bot to channel | const TeleBot = require('telebot');
const config = require('./config');
const bot = new TeleBot({
token: config.token, // Add telegram token bot here.
sleep: 1000, // Optional. How often check updates (in ms).
timeout: 0, // Optional. Update pulling timeout (0 - short polling).
limit: 100, // Optional. Limits ... | const TeleBot = require('telebot');
const config = require('./config');
const bot = new TeleBot({
token: config.token, // Add telegram token bot here.
sleep: 1000, // Optional. How often check updates (in ms).
timeout: 0, // Optional. Update pulling timeout (0 - short polling).
limit: 100, // Optional. Limits ... |
Fix desktop notifications when changing wallpaper is invoked | #!/usr/bin/env node
/* jshint node: true */
'use strict';
var timer, pattern, interval;
var rotate = require('./rotate-wallpaper');
var notify = false;
process.on('message', function(params) {
pattern = params.pattern;
interval = params.interval;
timer = setInterval(rotate, interval, pattern);
notify ... | #!/usr/bin/env node
/* jshint node: true */
'use strict';
var timer, pattern, interval;
var rotate = require('./rotate-wallpaper');
process.on('message', function(params) {
pattern = params.pattern;
interval = params.interval;
timer = setInterval(rotate, interval, pattern);
rotate(pattern, params.notif... |
Add JSDoc comments to explain what's going on | /**
* Checks if the page title contains the given value.
*
* ```
* this.demoTest = function (client) {
* browser.assert.titleContains("Nightwatch");
* };
* ```
*
* @method title
* @param {string} expected The expected page title substring.
* @param {string} [message] Optional log message to displa... | /**
* Checks if the page title contains the given value.
*
* ```
* this.demoTest = function (client) {
* browser.assert.titleContains("Nightwatch");
* };
* ```
*
* @method title
* @param {string} expected The expected page title substring.
* @param {string} [message] Optional log message to displa... |
Remove async that's not required for now. | import fs from 'fs'
import http from 'http';
import path from 'path';
import React from 'react';
import Baobab from 'baobab';
import {root} from 'baobab-react/higher-order';
import defaultData from './data';
import Html from './components/Html';
import Layout from './components/Layout';
function renderHtml(res, data... | import fs from 'fs'
import http from 'http';
import path from 'path';
import React from 'react';
import Baobab from 'baobab';
import {root} from 'baobab-react/higher-order';
import defaultData from './data';
import Html from './components/Html';
import Layout from './components/Layout';
function renderHtml(res, data... |
Move framework downloads to github release | #!/usr/bin/env python
import sys
import os
from lib.util import safe_mkdir, extract_zip, tempdir, download
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell/releases/download/v0.11.10'
def main():
os.chdir(SOURCE_ROOT)
safe_mkdir('fra... | #!/usr/bin/env python
import sys
import os
from lib.util import safe_mkdir, extract_zip, tempdir, download
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'http://atom-alpha.s3.amazonaws.com'
def main():
os.chdir(SOURCE_ROOT)
safe_mkdir('frameworks')
download_and_u... |
Bump client library version to 0.1.0.dev3 | from setuptools import setup
requirements = [
'pyserial',
]
with open('README') as f:
long_description = f.read()
setup(
name='removinator',
version='0.1.0.dev3',
description='A library for controlling the Smart Card Removinator',
long_description=long_description,
url='https://github.com... | from setuptools import setup
requirements = [
'pyserial',
]
with open('README') as f:
long_description = f.read()
setup(
name='removinator',
version='0.1.0.dev2',
description='A library for controlling the Smart Card Removinator',
long_description=long_description,
url='https://github.com... |
Upgrade libchromiumcontent to remove dom storage quota
Closes #897. | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'e375124044f9044ac88076eba0cd17361ee0997c'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... |
Check if request is a built-in module | var Module = require('module')
var path = require('path')
var fs = require('fs')
function exists (target, extensions) {
if (fs.existsSync(target)) {
return target
}
if (path.extname(target) === '') {
for (var i = 0; i < extensions.length; i++) {
var resolvedPath = target + extensions[i]
if (... | var Module = require('module')
var path = require('path')
var fs = require('fs')
function exists (target, extensions) {
if (fs.existsSync(target)) {
return target
}
if (path.extname(target) === '') {
for (var i = 0; i < extensions.length; i++) {
var resolvedPath = target + extensions[i]
if (... |
Fix to deal with invalid commands. | # coding: utf-8
"""
Mission simulation.
"""
from rover import Plateau, Rover, Heading, Command
if __name__ == '__main__':
instructions = open('instructions.txt', 'r')
# Prepare the plateau to landings.
data = instructions.readline().split()
x, y = map(int, data)
plateau = Plateau(x, y)
# D... | # coding: utf-8
"""
Mission simulation.
"""
from rover import Plateau, Rover, Heading, Command
if __name__ == '__main__':
instructions = open('instructions.txt', 'r')
# Prepare the plateau to landings.
data = instructions.readline().split()
x, y = map(int, data)
plateau = Plateau(x, y)
# D... |
Add tumblr->yahoo info for server | 'use strict';
var hosts = {
'bbc.co.uk': 'bbc',
'm.bbc.co.uk': 'bbc',
'reddit.com': 'reddit',
'www.reddit.com': 'reddit',
'condenast.co.uk': 'condenast'
'tumblr.com' : 'tumblr'
};
var organisations = {
'bbc': {
'owner': null,
'info': 'British Broadcasting Corporation'
},
'reddit': {
'own... | 'use strict';
var hosts = {
'bbc.co.uk': 'bbc',
'm.bbc.co.uk': 'bbc',
'reddit.com': 'reddit',
'www.reddit.com': 'reddit',
'condenast.co.uk': 'condenast'
};
var organisations = {
'bbc': {
'owner': null,
'info': 'British Broadcasting Corporation'
},
'reddit': {
'owner': 'condenast',
'inf... |
patron-client: Fix for reducer hot loading | import { browserHistory } from 'react-router'
import thunkMiddleware from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'
import { routerMiddleware } from 'react-router-redux'
import createLogger from 'redux-logger'
import persistState from 'redux-localstorage'
import adapter from 'redux-loc... | import { browserHistory } from 'react-router'
import thunkMiddleware from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'
import { routerMiddleware } from 'react-router-redux'
import createLogger from 'redux-logger'
import persistState from 'redux-localstorage'
import adapter from 'redux-loc... |
Fix spaces in previous commit | const webpack = require('webpack');
const ora = require('ora');
const rm = require('rimraf');
const chalk = require('chalk');
const config = require('./webpack.config.js');
const env = process.env.NODE_ENV || 'development';
const target = process.env.TARGET || 'web';
const spinner = ora(env === 'production' ? 'buildi... | const webpack = require('webpack');
const ora = require('ora');
const rm = require('rimraf');
const chalk = require('chalk');
const config = require('./webpack.config.js');
const env = process.env.NODE_ENV || 'development';
const target = process.env.TARGET || 'web';
const spinner = ora(env === 'production' ? 'buildi... |
Add global for default template name. | """
ydf/templating
~~~~~~~~~~~~~~
Contains functions to be exported into the Jinja2 environment and accessible from templates.
"""
import jinja2
import os
from ydf import instructions, __version__
DEFAULT_TEMPLATE_NAME = 'default.tpl'
DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.dirname... | """
ydf/templating
~~~~~~~~~~~~~~
Contains functions to be exported into the Jinja2 environment and accessible from templates.
"""
import jinja2
import os
from ydf import instructions, __version__
DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'templates')
def render... |
Implement PEP 246 compliant environment markers | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from setuptools import setup
try:
from unittest import mock # noqa
except ImportError:
tests_require = ['mock']
else:
tests_require = []
with open('README.rst') as f:
readme = f.read()
setup(
name='syringe',
version='0.3.0',
author='Remc... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from setuptools import setup
try:
from unittest import mock # noqa
except:
kwargs = {
'tests_require': 'mock',
'extras_require': {
'mock': 'mock'
}
}
else:
kwargs = {}
with open('README.rst') as f:
readme = f.re... |
Fix for usage of PagingAndSortingRepository | /**
* Copyright 2015 Smart Community Lab
*
* 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 a... | /**
* Copyright 2015 Smart Community Lab
*
* 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 a... |
Change type to shipment in dispatching. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class EcontDispatching extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::setConnection(DB::connection(Config::get('econt.connection')))->... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class EcontDispatching extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::setConnection(DB::connection(Config::get('econt.connection')))->... |
Change 1 based range so it counts up to n | #!/usr/bin/env python
from nodes import Node
class Sort(Node):
char = "S"
args = 1
results = 1
@Node.test_func([[2,3,4,1]], [[1,2,3,4]])
@Node.test_func(["test"], ["estt"])
def func(self, a: Node.indexable):
"""sorted(a) - returns the same type as given"""
if isinstance(a,... | #!/usr/bin/env python
from nodes import Node
class Sort(Node):
char = "S"
args = 1
results = 1
@Node.test_func([[2,3,4,1]], [[1,2,3,4]])
@Node.test_func(["test"], ["estt"])
def func(self, a: Node.indexable):
"""sorted(a) - returns the same type as given"""
if isinstance(a,... |
Add link to contributors graph | <?php
/**
* The template for displaying the footer.
*
* Contains the closing of the #content div and all content after
*
* @package socket.io-website
*/
?>
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
<span class="footer-left">SOCKET.IO IS ... | <?php
/**
* The template for displaying the footer.
*
* Contains the closing of the #content div and all content after
*
* @package socket.io-website
*/
?>
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
<span class="footer-left">SOCKET.IO IS ... |
Update parseLxcInfo to comply with new lxc1.0 format
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack) | package lxc
import (
"bufio"
"errors"
"strconv"
"strings"
)
var (
ErrCannotParse = errors.New("cannot parse raw input")
)
type lxcInfo struct {
Running bool
Pid int
}
func parseLxcInfo(raw string) (*lxcInfo, error) {
if raw == "" {
return nil, ErrCannotParse
}
var (
err error
s = bufio.NewSc... | package lxc
import (
"bufio"
"errors"
"strconv"
"strings"
)
var (
ErrCannotParse = errors.New("cannot parse raw input")
)
type lxcInfo struct {
Running bool
Pid int
}
func parseLxcInfo(raw string) (*lxcInfo, error) {
if raw == "" {
return nil, ErrCannotParse
}
var (
err error
s = bufio.NewSc... |
Replace .map with .some, get rid of intermediate array | import { enqueueRender } from './component';
export let i = 0;
/**
*
* @param {any} defaultValue
*/
export function createContext(defaultValue) {
let context = {
_id: '__cC' + i++,
_defaultValue: defaultValue
};
function Consumer(props, context) {
return props.children(context);
}
Consumer.contextType ... | import { enqueueRender } from './component';
export let i = 0;
/**
*
* @param {any} defaultValue
*/
export function createContext(defaultValue) {
let context = {
_id: '__cC' + i++,
_defaultValue: defaultValue
};
function Consumer(props, context) {
return props.children(context);
}
Consumer.contextType ... |
Set UTC time zone for DB time conversion | const Errors = use('core/errors');
const DefaultProperty = require('./default');
class DateProperty extends DefaultProperty {
constructor() {
super();
this._addValidator((value, propertyName) => {
const originalValue = value;
if (typeof value... | const Errors = use('core/errors');
const DefaultProperty = require('./default');
class DateProperty extends DefaultProperty {
constructor() {
super();
this._addValidator((value, propertyName) => {
const originalValue = value;
if (typeof value... |
Add more assertions find key near | package dht
import (
"testing"
assert "github.com/stretchr/testify/assert"
)
func TestFindKeysNearestTo(t *testing.T) {
s, err := newStore()
assert.Nil(t, err)
s.Put(KeyPrefixPeer+"a1", "0.0.0.0", true)
s.Put(KeyPrefixPeer+"a2", "0.0.0.1", true)
s.Put(KeyPrefixPeer+"a3", "0.0.0.3", true)
s.Pu... | package dht
import (
"testing"
assert "github.com/stretchr/testify/assert"
)
func TestFindKeysNearestToNotEqual(t *testing.T) {
s, err := newStore()
assert.Nil(t, err)
s.Put(KeyPrefixPeer+"a1", "0.0.0.0", true)
s.Put(KeyPrefixPeer+"a2", "0.0.0.1", true)
s.Put(KeyPrefixPeer+"a3", "0.0.0.3", true... |
Update the test for character count | import { expect } from './spec_helper'
import * as api from '../src/api'
describe('api.js', () => {
it('.communitiesPath', () => {
expect(api.communitiesPath).to.equal('https://ello-staging.herokuapp.com/api/v2/interest_categories/members?name=onboarding&per_page=25')
})
it('.awesomePeoplePath', () => {
... | import { expect } from './spec_helper'
import * as api from '../src/api'
describe('api.js', () => {
it('.communitiesPath', () => {
expect(api.communitiesPath).to.equal('https://ello-staging.herokuapp.com/api/v2/interest_categories/members?name=onboarding&per_page=25')
})
it('.awesomePeoplePath', () => {
... |
Change minimimum required PHP version to 5.3.23
- Remove [] array notation | <?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace ZF\ContentValidation;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class ContentValidationList... | <?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace ZF\ContentValidation;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class ContentValidationList... |
Add tests and configuration for editing | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Core\Formatter;
final class StringInflector
{
... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Core\Formatter;
final class StringInflector
{
... |
Fix end to end testing by increasing mocha timeout
Signed-off-by: Joe Walker <7a17872fbb32c7d760c9a16ee3076daead11efcf@mozilla.com> | /* eslint prefer-arrow-callback: 0 */
import expect from 'expect';
import { Application } from 'spectron';
import { quickTest } from '../../build-config';
import { getBuiltExecutable } from '../../build/utils';
describe('application launch', function() {
if (quickTest) {
it.skip('all tests');
return;
}
... | /* eslint prefer-arrow-callback: 0 */
import expect from 'expect';
import { Application } from 'spectron';
import { quickTest } from '../../build-config';
import { getBuiltExecutable } from '../../build/utils';
describe('application launch', function() {
if (quickTest) {
it.skip('all tests');
return;
}
... |
Update to appease the inquirer | 'use strict';
var taskOpts = require('./tasks');
var _ = require('lodash');
module.exports = function(kbox, drupal, appName) {
var drushVersions = _.pluck(drupal, 'drush');
// Add an option
kbox.create.add(appName, {
option: {
name: 'drush-version',
task: taskOpts.drushVersion,
inquire: ... | 'use strict';
var taskOpts = require('./tasks');
module.exports = function(kbox, appName) {
var deps = kbox.core.deps;
// Add an option
kbox.create.add(appName, {
option: {
name: 'drush-version',
task: taskOpts.drushVersion,
properties: {
message: 'Drush version'.green,
r... |
Make sure the UUIDs are unique too :) | <?php
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('STATUSNET', true);
require_once INSTALLDIR . '/lib/common.php';
class UUIDTest extends PHPUnit_Fr... | <?php
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('STATUSNET', true);
require_once INSTALLDIR . '/lib/common.php';
class UUIDTest extends PHPUnit_Fr... |
Allow user styles to override default styles
Just moved the `...styles` spread to the end of the style object. |
import React from 'react';
import PropTypes from 'prop-types';
import SvgIcon from './SvgIcon';
export const Icon = (props) => {
const { style, className, icon, ...others} = props; //eslint-disable-line
return (
<div {...others} style={{display: 'inline-flex', justifyContent: 'center', alignItems:'c... |
import React from 'react';
import PropTypes from 'prop-types';
import SvgIcon from './SvgIcon';
export const Icon = (props) => {
const { style, className, icon, ...others} = props; //eslint-disable-line
return (
<div {...others} style={{...style, display: 'inline-flex', justifyContent: 'center', ali... |
Remove default label from AttachmentValue | <?php
namespace Opifer\CmsBundle\ValueProvider;
use Opifer\EavBundle\ValueProvider\AbstractValueProvider;
use Opifer\EavBundle\ValueProvider\ValueProviderInterface;
use Symfony\Component\Form\FormBuilderInterface;
class AttachmentValueProvider extends AbstractValueProvider implements ValueProviderInterface
{
/**... | <?php
namespace Opifer\CmsBundle\ValueProvider;
use Opifer\EavBundle\ValueProvider\AbstractValueProvider;
use Opifer\EavBundle\ValueProvider\ValueProviderInterface;
use Symfony\Component\Form\FormBuilderInterface;
class AttachmentValueProvider extends AbstractValueProvider implements ValueProviderInterface
{
/**... |
Move crawl options to crawl command | #! /usr/bin/env node
'use strict';
(function () {
var yargs = require('yargs');
var packageJson = require('../package.json');
var version = packageJson.version;
var argv = yargs
.usage('Usage: $0 <command> [options]')
.command('crawl', 'Crawl a domain')
.example('$0 crawl domain.com --depth 100', '(Cra... | #! /usr/bin/env node
'use strict';
(function () {
var yargs = require('yargs');
var packageJson = require('../package.json');
var version = packageJson.version;
var argv = yargs
.usage('Usage: $0 <command> [options]')
.command('crawl', 'Crawl a domain')
.example('$0 crawl domain.com --depth 100', '(Cra... |
Allow to pass array to scraper-genres | <?php
class Denkmal_Scraper_Genres {
/** @var string[] */
private $_genreList = array();
/**
* @param string|string[] $genres
*/
function __construct($genres) {
if (!is_array($genres)) {
$genres = Functional\map(preg_split('#[,|/]#', $genres), function ($genre) {
... | <?php
class Denkmal_Scraper_Genres {
/** @var string[] */
private $_genreList = array();
/**
* @param string $genres Genres list as string
*/
function __construct($genres) {
foreach (preg_split('#[,|/]#', $genres) as $genre) {
if ($genre = strtolower(trim($genre))) {
... |
Fix file opening and make tests pass. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_starting_chunk(filename):
with open(filename, 'r') as f:
chunk = f.read(1024)
return chunk
def is_binary_string(bytes_to_check):
"""
:param bytes: A chunk of bytes to check.
:returns: True if appears to be a binary, otherwise False... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_starting_chunk(filename):
with(filename, 'r') as f:
chunk = open(filename).read(1024)
return chunk
def is_binary_string(bytes_to_check):
"""
:param bytes: A chunk of bytes to check.
:returns: True if appears to be a binary, otherwi... |
Set python2 explicitly as interpreter | #!/usr/bin/env python2
from setuptools import setup, find_packages
import os
version = __import__('cms_themes').__version__
install_requires = [
'setuptools',
'django',
'django-cms',
]
setup(
name = "django-cms-themes",
version = version,
url = 'http://github.com/megamark16/django-cms-themes'... | from setuptools import setup, find_packages
import os
version = __import__('cms_themes').__version__
install_requires = [
'setuptools',
'django',
'django-cms',
]
setup(
name = "django-cms-themes",
version = version,
url = 'http://github.com/megamark16/django-cms-themes',
license = 'BSD',
... |
Remove null type in docblock before assigning to array variable | <?php
declare(strict_types=1);
namespace Roave\BetterReflection\TypesFinder;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;
class ResolveTypes
{
/** @var TypeResolver */
private $typeResolver;
public function __construct()
{... | <?php
declare(strict_types=1);
namespace Roave\BetterReflection\TypesFinder;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;
class ResolveTypes
{
/** @var TypeResolver */
private $typeResolver;
public function __construct()
{... |
Add support for converting arrays | 'use strict';
/**
* Attempts to convert object properties recursively to numbers.
* @param {Object} obj - Object to iterate over.
* @param {Object} options - Options.
* @param {Function} options.parser - Parser to process string with. Should return NaN if not a valid number. Defaults... | 'use strict';
/**
* Attempts to convert object properties recursively to numbers.
* @param {Object} obj - Object to iterate over.
* @param {Object} options - Options.
* @param {Function} options.parser - Parser to process string with. Should return NaN if not a valid number. Defaults... |
Read URL and Token from environment | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = True
WTF_CSRF_ENABLED = True
SESSION_COOKIE_NAME = 'notify_admin_session'
SESSION_COOKIE_PATH = '/admin'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = True
SECRET_KEY = os.getenv('NOTIFY_... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = True
WTF_CSRF_ENABLED = False
SESSION_COOKIE_NAME = 'notify_admin_session'
SESSION_COOKIE_PATH = '/admin'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = True
SECRET_KEY = os.getenv('NOTIFY... |
fix(server): Add field data to team controller | 'use strict';
let mongoose = require('mongoose');
let Schema = mongoose.Schema;
let teamSchema = new Schema({
name : {
type: String,
required: true,
unique: true
},
email : {
type: String,
required: true,
unique: true
},
description : {
type:... | 'use strict';
let mongoose = require('mongoose');
let Schema = mongoose.Schema;
let teamSchema = new Schema({
name : {
type: String,
required: true,
unique: true
},
email : {
type: String,
required: true,
unique: true
},
description : {
type:... |
Use the `css` property of `Result` | #!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const concise = require('../src/index')
const command = {
name: process.argv[2],
input: process.argv[3],
output: process.argv[4]
}
const build = (input, output) => {
concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then... | #!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const concise = require('../src/index')
const command = {
name: process.argv[2],
input: process.argv[3],
output: process.argv[4]
}
const build = (input, output) => {
concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then... |
Update whitespace removal to convert underscores to spaces | var removeExcessSpaces = function(htmlString) {
var processedString = htmlString.replace(/\s+</g, '<');
processedString = processedString.replace(/>\s+/g, '>');
processedString = processedString.replace(/_/g, ' ');
return processedString;
}
var ready = function(fn) {
if(document.readyState != 'loading') {
f... | var removeExcessSpaces = function(htmlString) {
var processedString = htmlString.replace(/\s+</g, '<');
processedString = processedString.replace(/>\s+/g, '>');
processedString = processedString.replace(/\:</g, ': <');
return processedString;
}
var ready = function(fn) {
if(document.readyState != 'loading') {
... |
Fix issues with findUser refactor | const Q = require('q');
// Regex to test if the string is likely a facebook user ID
const USER_ID_REGEX = /^\d+$/;
async function getFBUserInfoByID(api, id) {
return await Q.nfcall(api.getUserInfo, id);
}
async function findFBUser(api, search_str, allowNonFriends) {
let userID = search_str;
// If the se... | const Q = require('q');
// Regex to test if the string is likely a facebook user ID
const USER_ID_REGEX = /^\d+$/;
async function getFBUserInfoByID(api, id) {
return await Q.nfcall(api.getUserInfo, id);
}
async function findFBUser(api, search_str, allowNonFriends) {
let userID = search_str;
// If the se... |
Remove karma-commonjs settings for avoiding error.
- If you require commonjs modules, Add settings below:
- Add `commonjs` to `frameworks`.
```
frameworks: ["jasmine", 'commonjs'],
```
- Add `preprocessors` and `commonjsPreprocessor` setting.
```
preprocessors: {
"node_modules/dummy/*.j... | /*eslint-env node */
var sourceList = require("../../src/source-list");
var sourceFiles = sourceList.list.map(function(src) {
return "src/" + src;
});
var commonJsSourceFiles = sourceList.commonJsModuleList;
var testFiles = [
"test/util/dom.js",
"test/util/matchers.js",
"test/util/mock/vivliostyle/logg... | /*eslint-env node */
var sourceList = require("../../src/source-list");
var sourceFiles = sourceList.list.map(function(src) {
return "src/" + src;
});
var commonJsSourceFiles = sourceList.commonJsModuleList;
var testFiles = [
"test/util/dom.js",
"test/util/matchers.js",
"test/util/mock/vivliostyle/logg... |
refactor: Make test variables more descriptive | import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'any-stack': {'template-url': 'foo.json', 'tags': {'any-tag': 'any-ta... | import unittest2
from cfn_sphere.stack_configuration import Config, StackConfig, NoConfigException
class ConfigTests(unittest2.TestCase):
def test_properties_parsing(self):
config = Config(config_dict={'region': 'eu-west-1', 'stacks': {'foo': {'template-url': 'foo.json'}}})
self.assertEqual('eu-w... |
refactor: Change parameter name for Rate limit | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* 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 requ... | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* 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 requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.