text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Split Protocol class in Protocol and ProtocolElement | '''
Created on 11 jan. 2013
@author: sander
'''
from abc import abstractmethod, ABCMeta
class ProtocolElement(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
'''
Constructor
'''
def __repr__(self):
# This works as long as we accept all properties... | '''
Created on 11 jan. 2013
@author: sander
'''
from abc import abstractmethod, ABCMeta
class Protocol(object):
__metaclass__ = ABCMeta
header_type = None
@abstractmethod
def __init__(self, next_header=None, payload=''):
'''
Constructor
'''
self.next_header = next_he... |
Add data fixtures bundle config | <?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\Sec... | <?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\Sec... |
Add Component to StyleManager tests | var path = 'StyleManager/view/';
define([path + 'PropertyView', 'StyleManager/model/Property', 'DomComponents/model/Component'],
function(PropertyView, Property, Component) {
return {
run : function(){
describe('PropertyView', function() {
var $fixtures;
var $fixture;
... | var path = 'StyleManager/view/';
define([path + 'PropertyView', 'StyleManager/model/Property'],
function(PropertyView, Property) {
return {
run : function(){
describe('PropertyView', function() {
var $fixtures;
var $fixture;
var model;
var view;
... |
Handle command-line parsing errors separately from command execution errors. | package org.musetest.commandline;
import io.airlift.airline.*;
import org.musetest.core.commandline.*;
import org.reflections.*;
import javax.imageio.spi.*;
import java.util.*;
/**
* @author Christopher L Merrill (see LICENSE.txt for license details)
*/
public class Launcher
{
@SuppressWarnings("unchecked"... | package org.musetest.commandline;
import io.airlift.airline.*;
import org.musetest.core.commandline.*;
import org.reflections.*;
import javax.imageio.spi.*;
import java.util.*;
/**
* @author Christopher L Merrill (see LICENSE.txt for license details)
*/
public class Launcher
{
@SuppressWarnings("unchecked"... |
Remove unnecessary if true/else false | """utils.py"""
import random
from pyechonest import config as echonest_config
from pyechonest import song as echonest_song
import rfc3987
from gweetr import app
from gweetr.exceptions import GweetrError
echonest_config.ECHO_NEST_API_KEY = app.config['ECHO_NEST_API_KEY']
def fetch_track(track_params):
"""
... | """utils.py"""
import random
from pyechonest import config as echonest_config
from pyechonest import song as echonest_song
import rfc3987
from gweetr import app
from gweetr.exceptions import GweetrError
echonest_config.ECHO_NEST_API_KEY = app.config['ECHO_NEST_API_KEY']
def fetch_track(track_params):
"""
... |
Make floats something small due to imprecision on large values | <?php
/**
* Humbug
*
* @category Humbug
* @package Humbug
* @copyright Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
* @license https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
*/
namespace Humbug\Mutator\Number;
use Humbug\Mutator\MutatorAbstract;
class Float e... | <?php
/**
* Humbug
*
* @category Humbug
* @package Humbug
* @copyright Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
* @license https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
*/
namespace Humbug\Mutator\Number;
use Humbug\Mutator\MutatorAbstract;
class Float e... |
Drop __toString to allow exceptions | <?php
namespace Kameli\Quickpay;
use InvalidArgumentException;
class Form
{
const FORM_ACTION = 'https://payment.quickpay.net';
/**
* @var array
*/
protected $parameters = [
'version' => 'v10',
];
/**
* @var array
*/
protected static $requiredParameters = [
... | <?php
namespace Kameli\Quickpay;
use InvalidArgumentException;
class Form
{
const FORM_ACTION = 'https://payment.quickpay.net';
/**
* @var array
*/
protected $parameters = [
'version' => 'v10',
];
/**
* @var array
*/
protected static $requiredParameters = [
... |
Mod: Remove leading comments and allow control characters directly. | # -*- coding: utf-8 -*-
"""
JSON-LD extractor
"""
import json
import re
import lxml.etree
import lxml.html
HTML_OR_JS_COMMENTLINE = re.compile('^\s*(//.*|<!--.*-->)')
class JsonLdExtractor(object):
_xp_jsonld = lxml.etree.XPath('descendant-or-self::script[@type="application/ld+json"]')
def extract(self, ... | # -*- coding: utf-8 -*-
"""
JSON-LD extractor
"""
import json
import re
import lxml.etree
import lxml.html
HTML_OR_JS_COMMENTLINE = re.compile('^\s*(//.*|<!--.*-->)')
class JsonLdExtractor(object):
_xp_jsonld = lxml.etree.XPath('descendant-or-self::script[@type="application/ld+json"]')
def extract(self, ... |
Fix padding on cliploader icon | import React from "react";
import { ClipLoader } from "halogenium";
import { Icon } from "../../base";
import { getTaskDisplayName } from "../../utils";
const JobStep = ({ step, isDone }) => {
let hasBar;
let stateIcon;
let entryStyle;
switch (step.state) {
case "running":
hasBar... | import React from "react";
import { ClipLoader } from "halogenium";
import { Icon } from "../../base";
import { getTaskDisplayName } from "../../utils";
const JobStep = ({ step, isDone }) => {
let hasBar;
let stateIcon;
let entryStyle;
switch (step.state) {
case "running":
hasBar... |
Fix gid not found bug | # -*- coding: utf-8 -*-
'''
Set grains describing the minion process.
'''
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import salt libs
import salt.utils.platform
try:
import pwd
except ImportError:
import getpass
pwd = None
try:
import grp
except ImportError... | # -*- coding: utf-8 -*-
'''
Set grains describing the minion process.
'''
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import salt libs
import salt.utils.platform
try:
import pwd
except ImportError:
import getpass
pwd = None
try:
import grp
except ImportError... |
Fix BC with setCode -> setStatusCode | <?php
/**
* @author Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace RestApp\Api\Controller;
use Exception;
use ReflectionExtension;
/**
* Class IndexController
* @Path("/api")
*/
class IndexController extends \Owl\Mvc\Controller
{
/**
* @Get
* @Url("/", name="default")
*/
... | <?php
/**
* @author Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace RestApp\Api\Controller;
use Exception;
use ReflectionExtension;
/**
* Class IndexController
* @Path("/api")
*/
class IndexController extends \Owl\Mvc\Controller
{
/**
* @Get
* @Url("/", name="default")
*/
... |
Use target instead of srcElement
Fixes bug in Firefox that prevents panels from being opened. | define([
'dojo/_base/declare',
'dojo/on'
], function (
declare,
on
) {
return declare([], {
// preventToggleElements: Node[]
// these elements do not trigger a panel toggle when clicked
preventToggleElements: null,
constructor: function () {
// summ... | define([
'dojo/_base/declare',
'dojo/on'
], function (
declare,
on
) {
return declare([], {
// preventToggleElements: Node[]
// these elements do not trigger a panel toggle when clicked
preventToggleElements: null,
constructor: function () {
// summ... |
Hide Webpack terminal spam on test errors | const webpackConfig = require('../webpack/webpack.test.babel');
const path = require('path');
module.exports = (config) => {
config.set({
frameworks: ['mocha'],
reporters: ['coverage', 'mocha'],
browsers: process.env.TRAVIS // eslint-disable-line no-nested-ternary
? ['ChromeTravis']
: process... | const webpackConfig = require('../webpack/webpack.test.babel');
const path = require('path');
module.exports = (config) => {
config.set({
frameworks: ['mocha'],
reporters: ['coverage', 'mocha'],
browsers: process.env.TRAVIS // eslint-disable-line no-nested-ternary
? ['ChromeTravis']
: process... |
Allow sessionTokenAction to POST redirect | <?php
namespace Payum\Bundle\PayumBundle\Controller;
use Payum\Core\Reply\HttpPostRedirect;
use Payum\Core\Request\Capture;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
class CaptureController extends PayumController
{
public function doSessionTokenAction... | <?php
namespace Payum\Bundle\PayumBundle\Controller;
use Payum\Core\Request\Capture;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
class CaptureController extends PayumController
{
public function doSessionTokenAction(Request $request)
{
if (fa... |
Change google maps api text to include destination | require('dotenv').config();
const request = require('request-promise');
const googlemaps = {
getResponse: (loc, placeStr, originalStr) => {
// originalString is the text query!
// var locRegex = /directions(.*)/gi;
var locRegex = /directions(?:\s{1}to)*(.*)/gi;
var location = locRegex.exec(originalS... | require('dotenv').config();
const request = require('request-promise');
const googlemaps = {
getResponse: (loc, placeStr, originalStr) => {
// originalString is the text query!
// var locRegex = /directions(.*)/gi;
var locRegex = /directions(?:\s{1}to)*(.*)/gi;
var location = locRegex.exec(originalS... |
Enable the all list payment | <?php
namespace Morfeu\Bundle\PaymentBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Morfeu\Bundle\BusinessBundle\Enum\StatusPayment;
class PaymentFilterType extends AbstractType
{
/**
*... | <?php
namespace Morfeu\Bundle\PaymentBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Morfeu\Bundle\BusinessBundle\Enum\StatusPayment;
class PaymentFilterType extends AbstractType
{
/**
*... |
Add some logging at install time
Otherwise, it's tough to know if this code executed. | /*global chrome, hwRules */
chrome.runtime.onInstalled.addListener(function(details) {
// Install declarative content rules
if (details.reason == 'update') {
console.info('Upgrade detected, checking data format...');
// Upgrade stored data to a new format when a new version is installed.
... | /*global chrome, hwRules */
chrome.runtime.onInstalled.addListener(function(details) {
// Install declarative content rules
if (details.reason == 'update') {
// Upgrade stored data to a new format when a new version is installed.
// Delay installing the rules until the data is upgraded in case ... |
Change order of assert arguments | package com.jedrzejewski.slisp.lexer;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class LexerTest {
@Test
public void testNextToken() {
Lexer lexer =... | package com.jedrzejewski.slisp.lexer;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class LexerTest {
@Test
public void testNextToken() {
Lexer lexer =... |
Check margin keyword to Row/Column is not None | from __future__ import absolute_import, division, print_function, unicode_literals
from PySide import QtGui
def _Box(box, *a):
for arg in a:
if isinstance(arg, tuple):
item = arg[0]
else:
item = arg
arg = (item,)
if isinstance(item, QtGui.QLayout):
... | from __future__ import absolute_import, division, print_function, unicode_literals
from PySide import QtGui
def _Box(box, *a):
for arg in a:
if isinstance(arg, tuple):
item = arg[0]
else:
item = arg
arg = (item,)
if isinstance(item, QtGui.QLayout):
... |
Update sum error text to be more descriptive | package org.javarosa.xpath.expr;
import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.xpath.XPathNodeset;
import org.javarosa.xpath.XPathTypeMismatchException;
import org.javarosa.xpath.parser.XPathSyntaxException;
public class XPathSumF... | package org.javarosa.xpath.expr;
import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.xpath.XPathNodeset;
import org.javarosa.xpath.XPathTypeMismatchException;
import org.javarosa.xpath.parser.XPathSyntaxException;
public class XPathSumF... |
Make the project actually compile under Java 7 | package com.proxerme.library;
import com.proxerme.library.api.ProxerApi;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Response;
import okhttp3.mockwebserver.MockWebServer;
import okio.Okio;
import org.jetbrains.annotations.NotNull;
import org.junit.After;
import org.j... | package com.proxerme.library;
import com.proxerme.library.api.ProxerApi;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.mockwebserver.MockWebServer;
import okio.Okio;
import org.jetbrains.annotations.NotNull;
import org.junit.After;
import org.junit.Before;
import java.io.IOException;
/**
* TOD... |
Remove NavLink: unexistent in v2;
Create two auxiliary components to apply the correct CSS class(es) to the links. | import React from 'react'
import { Link } from 'gatsby'
import styles from './navigation.module.styl'
// this is only active when the location pathname is exactly
// the same as the href.
const isActive = ({ location, href }) => {
const decodedURI = decodeURI(location.pathname)
const isCurrent = decodedURI === hr... | import React from 'react'
import { NavLink } from 'gatsby'
import styles from './navigation.module.styl'
export default ({ sports }) => (
<nav>
<ol className={`${styles.sportsList}`}>
{sports.map(({ node }, idx) => (
<li key={idx} className={`${styles.sportItem}`}>
<h3 className={styles.... |
Fix default editor not working for dynamic content | (function () {
var updateUrl = window.IVOAZ_CONTENT_EDITABLE_UPDATE_URL;
var current, timeout;
var htmlTags = document.getElementsByTagName('html');
if (0 === htmlTags.length) {
return;
}
document.addEventListener('mouseup', onMouseUp);
document.addEventListener('mousedow... | (function () {
var updateUrl = window.IVOAZ_CONTENT_EDITABLE_UPDATE_URL;
var current, timeout;
var htmlTags = document.getElementsByTagName('html');
if (0 === htmlTags.length) {
return;
}
var html = htmlTags[0];
html.addEventListener('mousedown', onMouseDown);
html... |
Fix console is undefined on IE 8 | jQuery(function ($) {
function d(event) {
event.keyCode === 13 && button.click();
}
function click() {
image.attr('src', src + (src.indexOf('?') < 0 ? '?' : '&') + '_=' + +new Date());
imgv.val('');
(user.val() ? imgv : user).focus();
}
function enable() {
b... | jQuery(function ($) {
function d(event) {
event.keyCode === 13 && button.click();
}
function click() {
image.attr('src', src + (src.indexOf('?') < 0 ? '?' : '&') + '_=' + +new Date());
imgv.val('');
(user.val() ? imgv : user).focus();
}
function enable() {
b... |
Change version to 1.2.1 (dev) | # -*- coding: utf-8 -*-
##############################################################################
#
##############################################################################
{
'name': u"Asset Streamline",
'version': u"1.2.1",
'author': u"XCG Consulting",
'category': u"Custom Module",
'desc... | # -*- coding: utf-8 -*-
##############################################################################
#
##############################################################################
{
'name': u"Asset Streamline",
'version': u"1.0",
'author': u"XCG Consulting",
'category': u"Custom Module",
'descri... |
Test wrapt.document for Read the Docs | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from codecs import open
import os.path as osp
from setuptools import setup, find_packages
import strumenti
here = osp.abspath(osp.dirname(__file__))
with open(osp.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='stru... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from codecs import open
import os.path as osp
from setuptools import setup, find_packages
import strumenti
here = osp.abspath(osp.dirname(__file__))
with open(osp.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='stru... |
Throw an exception when try to mutate data on ImmutableDataObjectInterface instance. Access data from DataObjectInterface instance and ImmutableDataObjectInterface instance. | <?php
/**
*
* (c) Marco Bunge <marco_bunge@web.de>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*
* Date: 12.02.2016
* Time: 10:02
*
*/
namespace Blast\Db\Data;
class Helper
{
/**
* receive data from object
... | <?php
/**
*
* (c) Marco Bunge <marco_bunge@web.de>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*
* Date: 12.02.2016
* Time: 10:02
*
*/
namespace Blast\Db\Data;
class Helper
{
/**
* receive data from object
... |
Add documentation to SenderBase plugin | import logging
from promgen.models import Project, Service
logger = logging.getLogger(__name__)
class SenderBase(object):
MAPPING = [
('project', Project),
('service', Service),
]
def _send(self, target, alert, data):
'''
Sender specific implmentation
This funct... | import logging
from promgen.models import Project, Service
logger = logging.getLogger(__name__)
class SenderBase(object):
MAPPING = [
('project', Project),
('service', Service),
]
def send(self, data):
sent = 0
for alert in data['alerts']:
for label, klass in... |
Allow middleware to also be non-function callables | <?php
namespace Lstr\Sprintf;
class ParsedExpression
{
/**
* @var string
*/
private $parsed_format;
/**
* @var array
*/
private $parameter_map;
/**
* @param string $parsed_format
* @param array $parameter_map
*/
public function __construct($parsed_format, a... | <?php
namespace Lstr\Sprintf;
class ParsedExpression
{
/**
* @var string
*/
private $parsed_format;
/**
* @var array
*/
private $parameter_map;
/**
* @param string $parsed_format
* @param array $parameter_map
*/
public function __construct($parsed_format, a... |
Prepare "Main Summary" job for backfill
Set the max number of active runs so we don't overwhelm the system,
and rewind the start date by a couple of days to test that the
scheduler does the right thing. | from airflow import DAG
from datetime import datetime, timedelta
from operators.emr_spark_operator import EMRSparkOperator
from airflow.operators import BashOperator
default_args = {
'owner': 'mreid@mozilla.com',
'depends_on_past': False,
'start_date': datetime(2016, 6, 25),
'email': ['telemetry-alerts... | from airflow import DAG
from datetime import datetime, timedelta
from operators.emr_spark_operator import EMRSparkOperator
from airflow.operators import BashOperator
default_args = {
'owner': 'mreid@mozilla.com',
'depends_on_past': False,
'start_date': datetime(2016, 6, 27),
'email': ['telemetry-alerts... |
Rewrite Account tests to ES2015 | 'use strict';
const assert = require('assert');
const sinon = require('sinon');
const Account = require('../../lib/endpoints/account');
const Request = require('../../lib/request');
describe('endpoints/account', () => {
describe('changePassword', () => {
it('should set the request URL', () => {
... | 'use strict';
var assert = require('assert');
var sinon = require('sinon');
var Account = require('../../lib/endpoints/account');
var Request = require('../../lib/request');
describe('endpoints/account', function () {
describe('changePassword', function () {
it('should set the request URL', function () {... |
Allow to override test client | 'use strict';
require('../helper');
var assert = require('assert');
var appServer = require('../../app/server');
function response(code) {
return {
status: code
};
}
var RESPONSE = {
OK: response(200),
CREATED: response(201)
};
function TestClient(config) {
this.config = config || {};
... | 'use strict';
require('../helper');
var assert = require('assert');
var appServer = require('../../app/server');
function response(code) {
return {
status: code
};
}
var RESPONSE = {
OK: response(200),
CREATED: response(201)
};
function TestClient(config) {
this.config = config || {};
... |
Use name() instead of toString() for enum value.
The javadoc for Enum notes that name() should be used when
correctness depends on getting the exact name of the enum
constant which will not vary from release to release. The
javadoc further encourages overriding the toString() method
when appropriate to provide a more ... | package org.sql2o.converters;
/**
* Default implementation of {@link EnumConverterFactory},
* used by sql2o to convert a value from the database into an {@link Enum}.
*/
public class DefaultEnumConverterFactory implements EnumConverterFactory {
public <E extends Enum> Converter<E> newConverter(final Class<E> en... | package org.sql2o.converters;
/**
* Default implementation of {@link EnumConverterFactory},
* used by sql2o to convert a value from the database into an {@link Enum}.
*/
public class DefaultEnumConverterFactory implements EnumConverterFactory {
public <E extends Enum> Converter<E> newConverter(final Class<E> en... |
Update format for group members view | import _ from 'lodash'
import React from 'react'
import {connect} from 'react-redux'
import {compose, withHandlers, withProps, withState} from 'recompose'
import GroupMembersList from './GroupMembersList'
import {addMemberToGroup} from '../actions/groups'
const mapStateToProps = ({groups}) => ({
groups
})
const en... | import _ from 'lodash'
import React from 'react'
import {connect} from 'react-redux'
import {compose, withHandlers, withProps, withState} from 'recompose'
import GroupMembersList from './GroupMembersList'
import {addMemberToGroup} from '../actions/groups'
const mapStateToProps = ({groups}) => ({
groups
})
const en... |
Fix code style in optional parent interface implementation | <?php
/*
* This file is part of the Active Collab DatabaseStructure project.
*
* (c) A51 doo <info@activecollab.com>. All rights reserved.
*/
declare(strict_types=1);
namespace ActiveCollab\DatabaseStructure\Behaviour\ParentInterface;
use ActiveCollab\DatabaseObject\Entity\EntityInterface;
use ActiveCollab\Data... | <?php
/*
* This file is part of the Active Collab DatabaseStructure project.
*
* (c) A51 doo <info@activecollab.com>. All rights reserved.
*/
declare(strict_types=1);
namespace ActiveCollab\DatabaseStructure\Behaviour\ParentInterface;
use ActiveCollab\DatabaseObject\Entity\EntityInterface;
use ActiveCollab\Data... |
Allow theme to be changed | import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on... | import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on... |
Fix to remove Activity as necessary arg | package com.peak.salut;
import android.util.Log;
import com.arasthel.asyncjob.AsyncJob;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.net.Socket;
public class BackgroundDataJob implements AsyncJob.OnBackgroundJob{
private Salut salutInstance;
private Socket clientSocket;
... | package com.peak.salut;
import android.util.Log;
import com.arasthel.asyncjob.AsyncJob;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.net.Socket;
public class BackgroundDataJob implements AsyncJob.OnBackgroundJob{
private Salut salutInstance;
private Socket clientSocket;
... |
Fix typo on Master Alchemist dishonor action chat message | const DrawCard = require('../../drawcard.js');
const { CardTypes } = require('../../Constants');
class MasterAlchemist extends DrawCard {
setupCardAbilities(ability) {
this.action({
title: 'Honor or dishonor a character',
cost: ability.costs.payFateToRing(1, ring => ring.element ===... | const DrawCard = require('../../drawcard.js');
const { CardTypes } = require('../../Constants');
class MasterAlchemist extends DrawCard {
setupCardAbilities(ability) {
this.action({
title: 'Honor or dishonor a character',
cost: ability.costs.payFateToRing(1, ring => ring.element ===... |
Remove let keyword in order to support <=0.12 | 'use strict'
var Hoek = require("hoek");
var requireDir = require('require-dir');
var internals = {};
var defaultOptions = {};
internals.settings = {};
internals.runThroughPlugins = function (pluginsPaths, options, server) {
if (pluginsPaths) {
if (pluginsPaths.register) {
var name = plugin... | 'use strict'
var Hoek = require("hoek");
var requireDir = require('require-dir');
var internals = {};
var defaultOptions = {};
internals.settings = {};
internals.runThroughPlugins = function (pluginsPaths, options, server) {
if (pluginsPaths) {
if (pluginsPaths.register) {
let name = plugin... |
Handle case where screensEnabled isn't available (in Snack) | /* @flow */
import * as React from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import { Screen, screensEnabled } from 'react-native-screens';
type Props = {
isVisible: boolean,
children: React.Node,
style?: any,
};
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whol... | /* @flow */
import * as React from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import { Screen, screensEnabled } from 'react-native-screens';
type Props = {
isVisible: boolean,
children: React.Node,
style?: any,
};
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whol... |
Check config and show what required options not exists | /*
* grunt-browser-extension
* https://github.com/addmitriev/grunt-browser-extension
*
* Copyright (c) 2015 Aleksey Dmitriev
* Licensed under the MIT license.
*/
'use strict';
var util = require('util');
var path = require('path');
var fs = require('fs-extra');
module.exports = function (grunt) {
var Brows... | /*
* grunt-browser-extension
* https://github.com/addmitriev/grunt-browser-extension
*
* Copyright (c) 2015 Aleksey Dmitriev
* Licensed under the MIT license.
*/
'use strict';
var util = require('util');
var path = require('path');
var fs = require('fs-extra');
module.exports = function (grunt) {
var Brows... |
Allow broadcaster's labels to be localized | import { Localization } from './base';
import { overlayElement } from './overlay';
export { contexts } from './base';
const ns = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
const allowed = {
attributes: {
global: ['aria-label', 'aria-valuetext', 'aria-moz-hint'],
broadcaster: ['label']... | import { Localization } from './base';
import { overlayElement } from './overlay';
export { contexts } from './base';
const ns = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
const allowed = {
attributes: {
global: ['aria-label', 'aria-valuetext', 'aria-moz-hint'],
button: ['accesskey'],... |
Use two digit numbers to ensure PHP isn't converting the array to a string | <?php
class ArrTest extends PHPUnit_Framework_TestCase {
function testFlatten() {
$this->assertEquals(
array('a', 'b', 'c', 'd'),
Missing\Arr::flatten(array(
array('a','b'),
'c',
array(array(array('d'))),
))
);
}
function testSortByInt() {
$this->assertEqual... | <?php
class ArrTest extends PHPUnit_Framework_TestCase {
function testFlatten() {
$this->assertEquals(
array('a', 'b', 'c', 'd'),
Missing\Arr::flatten(array(
array('a','b'),
'c',
array(array(array('d'))),
))
);
}
function testSortByInt() {
$this->assertEqual... |
Fix param sent to the API
Signed-off-by: soupette <0a59f0508aa203bc732745954131d022d9f538a9@gmail.com> | import { isEmpty, pickBy, transform } from 'lodash';
import request from './request';
const findMatchingPermissions = (userPermissions, permissions) => {
return transform(
userPermissions,
(result, value) => {
const associatedPermission = permissions.find(
perm => perm.action === value.action &... | import { isEmpty, pickBy, transform } from 'lodash';
import request from './request';
const findMatchingPermissions = (userPermissions, permissions) => {
return transform(
userPermissions,
(result, value) => {
const associatedPermission = permissions.find(
perm => perm.action === value.action &... |
Split send_message out in to _send_message to reuse functionality later | import requests
from .error import PushoverCompleteError
class PushoverAPI(object):
def __init__(self, token):
self.token = token
def send_message(self, user, message, device=None, title=None, url=None, url_title=None,
priority=None, retry=None, expire=None, timestamp=None, sound... | import requests
from .error import PushoverCompleteError
class PushoverAPI(object):
def __init__(self, token):
self.token = token
def send_message(self, user, message, device=None, title=None, url=None, url_title=None,
priority=None, retry=None, expire=None, timestamp=None, sound... |
Optimize pending order screen load | function openerp_pos_ncf_widgets(instance, module) { //module is instance.point_of_sale
var QWeb = instance.web.qweb;
var _t = instance.web._t;
module.PosWidget = module.PosWidget.extend({
// This method instantiates all the screens, widgets, etc. If you want to add new screens change the
/... | function openerp_pos_ncf_widgets(instance, module) { //module is instance.point_of_sale
var QWeb = instance.web.qweb;
var _t = instance.web._t;
module.PosWidget = module.PosWidget.extend({
start: function() {
var self = this;
this._super();
},
// This met... |
Remove unused conditon which cant hold anyway | package name.abuchen.portfolio.util;
public class Isin
{
private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
public static final String PATTERN = "[A-Z]{2}[A-Z0-9]{9}\\d"; //$NON-NLS-1$
private Isin()
{
}
public static final boolean isValid(String is... | package name.abuchen.portfolio.util;
public class Isin
{
private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
public static final String PATTERN = "[A-Z]{2}[A-Z0-9]{9}\\d"; //$NON-NLS-1$
private Isin()
{
}
public static final boolean isValid(String is... |
Add a paint-event test to the main page | <?php
/**
* @author Manuel Thalmann <m@nuth.ch>
* @license Apache-2.0
*/
namespace ManuTh\TemPHPlate\Pages;
use System\Web;
use System\Web\Forms\Rendering\PaintEventArgs;
use System\Web\Forms\MenuItem;
use ManuTh\TemPHPlate\Templates\BootstrapTemplate;
{
/**
*... | <?php
/**
* @author Manuel Thalmann <m@nuth.ch>
* @license Apache-2.0
*/
namespace ManuTh\TemPHPlate\Pages;
use System\Web;
use ManuTh\TemPHPlate\Templates\BootstrapTemplate;
{
/**
* A page
*/
class Page extends Web\Page
{
/**
... |
Disable CGC simprocedures, it's unhelpful at the moment | import angr
import simuvex
class DrillerTransmit(simuvex.SimProcedure):
'''
CGC's transmit simprocedure which supports errors
'''
def run(self, fd, buf, count, tx_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG generation
self.state.store_mem(tx_bytes,... | import angr
import simuvex
class DrillerTransmit(simuvex.SimProcedure):
'''
CGC's transmit simprocedure which supports errors
'''
def run(self, fd, buf, count, tx_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG generation
self.state.store_mem(tx_bytes,... |
Update the retries count of a queued message when it is changed back from deferred | from django.db import models
from django_mailer import constants
class QueueManager(models.Manager):
use_for_related_fields = True
def high_priority(self):
"""
Return a QuerySet of high priority queued messages.
"""
return self.filter(priority=constants.PRIORITY_HIGH)... | from django.db import models
from django_mailer import constants
class QueueManager(models.Manager):
use_for_related_fields = True
def high_priority(self):
"""
Return a QuerySet of high priority queued messages.
"""
return self.filter(priority=constants.PRIORITY_HIGH)... |
Use native system dialog instead of input type=file | // @flow
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import Dropzone from 'react-dropzone';
import styles from './Server.css';
const { dialog } = require('electron').remote;
class Server extends Component {
static propTypes = {
start: PropTypes.func.isRequired,
... | // @flow
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import Dropzone from 'react-dropzone';
import styles from './Server.css';
class Server extends Component {
static propTypes = {
start: PropTypes.func.isRequired,
shutdown: PropTypes.func.isRequired,
servers... |
Fix doctrine issues after first request is made. | <?php
namespace Codeception\Lib\Connector;
class Symfony2 extends \Symfony\Component\HttpKernel\Client
{
private static $hasPerformedRequest;
public $persistentServices = [];
protected function doRequest($request)
{
$services = [];
if (self::$hasPerformedRequest) {
$servic... | <?php
namespace Codeception\Lib\Connector;
class Symfony2 extends \Symfony\Component\HttpKernel\Client
{
private static $hasPerformedRequest;
public $persistentServices = [];
protected function doRequest($request)
{
$services = [];
if (self::$hasPerformedRequest) {
$servic... |
Fix users access zone comment description
git-svn-id: 4cd2d1688610a87757c9f4de95975a674329c79f@1148 b8ca103b-dd03-488c-9448-c80b36131af2 | <?
$access_zone = $sub0;
if($access_zone)
$zone = sql::row("ks_access_zones", compact('access_zone'));
if($action == "zone_manage") try {
$data = array(
'access_zone' => $_POST['access_zone'],
'access_zone_parent' => $_POST['access_zone_parent'],
'zone_descr' => $_PO... | <?
$access_zone = $sub0;
if($access_zone)
$zone = sql::row("ks_access_zones", compact('access_zone'));
if($action == "zone_manage") try {
$data = array(
'access_zone' => $_POST['access_zone'],
'access_zone_parent' => $_POST['access_zone_parent'],
'zone_descr' => rte_... |
Change test due to change in default sort order. | package com.bbn.bue.common.diff;
import com.bbn.bue.common.evaluation.FMeasureCounts;
import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class FMeasureTableRendererTest {
@Test
public void testFMeasureTableRenderer(... | package com.bbn.bue.common.diff;
import com.bbn.bue.common.evaluation.FMeasureCounts;
import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class FMeasureTableRendererTest {
@Test
public void testFMeasureTableRenderer(... |
Make an anonymous JS func now named for re-usability. |
'use strict';
// We assume this JS is sourced at the end of any HTML, avoiding the
// need for a $(document).ready(…) call. But it really needs the
// document fully loaded to operated properly.
// TODO: put this in our own namespace, not in the window…
common_init();
start_checking_for_needed_updates();
function... |
'use strict';
// We assume this JS is sourced at the end of any HTML, avoiding the
// need for a $(document).ready(…) call. But it really needs the
// document fully loaded to operated properly.
// TODO: put this in our own namespace, not in the window…
common_init();
start_checking_for_needed_updates();
function... |
Add a wrapping div around control as a placeholder. | var Controls = Datagrid.Controls = Backbone.View.extend({
initialize: function() {
this.pager = this.options.pager;
this.left = this._resolveView(this.options.left);
this.middle = this._resolveView(this.options.middle);
this.right = this._resolveView(this.options.right);
},
render: function()... | var Controls = Datagrid.Controls = Backbone.View.extend({
initialize: function() {
this.pager = this.options.pager;
this.left = this._resolveView(this.options.left);
this.middle = this._resolveView(this.options.middle);
this.right = this._resolveView(this.options.right);
},
render: function()... |
Make failIfDiff work with dict keys and values. | """
Code originally from: http://www.aminus.org/blogs/index.php/2009/01/09/assertnodiff
"""
import difflib
from pprint import pformat
class DiffTestCaseMixin(object):
def get_diff_msg(self, first, second,
fromfile='First', tofile='Second'):
"""Return a unified diff between first and... | """
Code originally from: http://www.aminus.org/blogs/index.php/2009/01/09/assertnodiff
"""
import difflib
from pprint import pformat
class DiffTestCaseMixin(object):
def get_diff_msg(self, first, second,
fromfile='First', tofile='Second'):
"""Return a unified diff between first and... |
Add more info log output
Partial reimplementation of #39 | "use strict";
const path = require("path");
const rollup = require("rollup");
function createPreprocessor(options, preconfig, basePath, logger) {
const cache = new Map();
const log = logger.create("preprocessor.rollup");
return async function preprocess(original, file, done) {
const location = path.relativ... | "use strict";
const path = require("path");
const rollup = require("rollup");
function createPreprocessor(options, preconfig, basePath, logger) {
const cache = new Map();
const log = logger.create("preprocessor.rollup");
return async function preprocess(original, file, done) {
try {
const config = Ob... |
Use class cache in factory | <?php
namespace Jackalope;
use InvalidArgumentException;
use ReflectionClass;
/**
* Jackalope implementation factory.
*
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
* @license http://opensource.org/licenses/MIT MIT License
*/
class Factory implements FactoryInterface
{
... | <?php
namespace Jackalope;
use InvalidArgumentException;
use ReflectionClass;
/**
* Jackalope implementation factory.
*
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
* @license http://opensource.org/licenses/MIT MIT License
*/
class Factory implements FactoryInterface
{
... |
Set the correct prefix for searching places | define(["backbone", "underscore", "places/models/CategoryModel", "moxie.conf"], function(Backbone, _, Category, conf) {
var CategoryCollection = Backbone.Collection.extend({
model: Category,
url: conf.endpoint + conf.pathFor('places_categories'),
parse: function(data) {
var flat... | define(["backbone", "underscore", "places/models/CategoryModel", "moxie.conf"], function(Backbone, _, Category, conf) {
var CategoryCollection = Backbone.Collection.extend({
model: Category,
url: conf.endpoint + conf.pathFor('places_categories'),
parse: function(data) {
console.... |
Rename default extension to `tpl`, shorter | var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var cache = {};
// Set the default template extension. Override as necessary.
_.templateExtension = 'tpl';
// Set the special express property for templating to work.
_.__express = function (abs, options, cb) {
var sync = !cb;
try... | var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var cache = {};
// Set the default template extension. Override as necessary.
_.templateExtension = 'underscore';
// Set the special express property for templating to work.
_.__express = function (abs, options, cb) {
var sync = !cb... |
Return code for about command | <?php
namespace Distill\Cli\Command;
use Distill\Distill;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AboutCommand extends Command
{
/**
* App version.
* @var string
*/
protected... | <?php
namespace Distill\Cli\Command;
use Distill\Distill;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AboutCommand extends Command
{
/**
* App version.
* @var string
*/
protected... |
:green_heart: Fix broken input email test | 'use strict';
const InputEmail = require('../../lib/install/input-email');
const InputEmailElement = require('../../lib/elements/atom/input-email-element');
describe('InputEmail', () => {
let step, view, promise;
beforeEach(() => {
view = new InputEmailElement();
step = new InputEmail(view);
});
des... | 'use strict';
const InputEmail = require('../../lib/install/input-email');
const InputEmailElement = require('../../lib/elements/atom/input-email-element');
describe('InputEmail', () => {
let step, view, promise;
beforeEach(() => {
view = new InputEmailElement();
step = new InputEmail(view);
});
des... |
[2.7][DX] Use constant message contextualisation for deprecations | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess;
/**
* Entry point of the PropertyAcc... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess;
/**
* Entry point of the PropertyAcc... |
Use statement + output added | <?php
namespace KevinVR\FootbelProcessorBundle\Command;
use KevinVR\FootbelProcessorBundle\Processor\ResourceFileProcessor;
use PhpAmqpLib\Message\AMQPMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\Input... | <?php
namespace KevinVR\FootbelProcessorBundle\Command;
use PhpAmqpLib\Message\AMQPMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
cl... |
Fix file-loader exclusion in react-app-rewire-less | const path = require('path');
const { getLoader } = require('react-app-rewired');
function createRewireLess(lessLoaderOptions = {}) {
return function(config, env) {
const lessExtension = /\.less$/;
const fileLoader = getLoader(
config.module.rules,
rule =>
rule.loader &&
typeof r... | const path = require('path');
const { getLoader } = require('react-app-rewired');
function createRewireLess(lessLoaderOptions = {}) {
return function(config, env) {
const lessExtension = /\.less$/;
const fileLoader = getLoader(
config.module.rules,
rule =>
rule.loader &&
typeof r... |
Delete method added in FileObject | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... |
Refactor introduction to make it the same as the other tests | """"
Introduction Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"Introduction Adventure test"
de... | """"
Introduction Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"Introduction Adventure test"
de... |
Allow for requirements without a hash | import click
import requirements
import os
import re
@click.command()
@click.option('--file', default='requirements.txt', help='File to upgrade')
@click.option('--branch', default='master', help='Branch to upgrade from')
def upgrade(file, branch):
lines = []
with open(file, 'r') as f:
for req in requi... | import click
import requirements
import os
import re
@click.command()
@click.option('--file', default='requirements.txt', help='File to upgrade')
@click.option('--branch', default='master', help='Branch to upgrade from')
def upgrade(file, branch):
lines = []
with open(file, 'r') as f:
for req in requi... |
Set up environment specific connection to rabbitmq | # -*- coding: utf-8 -*-
import time
import json
import sys
import pika
import os
from tweepy.streaming import StreamListener
class Listener(StreamListener):
def __init__(self):
#setup rabbitMQ Connection
host = os.environ['CLOUDAMQP_URL']
connection = pika.BlockingConnection(pika.Connectio... | # -*- coding: utf-8 -*-
import time
import json
import sys
import pika
from tweepy.streaming import StreamListener
class Listener(StreamListener):
def __init__(self):
#setup rabbitMQ Connection
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
self.channel = conn... |
Set initial EVL applications query to month | define([
'vehicle-licensing/collections/services',
'extensions/views/timeseries-graph/timeseries-graph',
'extensions/views/tabs',
'extensions/views/graph/headline',
],
function (ServicesCollection, TimeseriesGraph, Tabs, Headline) {
return function (selector, id, type) {
if ($('.lte-ie8').length) {
... | define([
'vehicle-licensing/collections/services',
'extensions/views/timeseries-graph/timeseries-graph',
'extensions/views/tabs',
'extensions/views/graph/headline',
],
function (ServicesCollection, TimeseriesGraph, Tabs, Headline) {
return function (selector, id, type) {
if ($('.lte-ie8').length) {
... |
Split input text on init | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class Table:
class InputStrContainsCarriageReturn (RuntimeError):
pass
def __init__ (self, tab_separated_text = None):
... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class Table:
class InputStrContainsCarriageReturn (RuntimeError):
pass
def __init__ (self, tab_separated_text = None):
... |
Change test because yes/no fits better for checkbox
FormDynamic-code changed because checkbox in german added "Am" instead of "Yes". This updates the test to fit the new text. | <?php
/**
* @group Kwc_FormDynamic
*/
class Kwc_FormDynamic_Basic_Test extends Kwc_TestAbstract
{
public function setUp()
{
parent::setUp('Kwc_FormDynamic_Basic_Root');
}
public function testIt()
{
$c = $this->_root->getComponentById('root_form-form')->getComponent();
$pos... | <?php
/**
* @group Kwc_FormDynamic
*/
class Kwc_FormDynamic_Basic_Test extends Kwc_TestAbstract
{
public function setUp()
{
parent::setUp('Kwc_FormDynamic_Basic_Root');
}
public function testIt()
{
$c = $this->_root->getComponentById('root_form-form')->getComponent();
$pos... |
Fix double space in doc string.
Refs #9995 | <?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, In... | <?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, In... |
Exclude some no longer relevant categories | <?php
get_header();
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class="blogPost">
<?php the_content(); ?>
<?php
if (is_page("tags")) {
?>
<ul class="tagList">
<?php
wp_list_categories(
array(
"hierarchical" => 1,
... | <?php
get_header();
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class="blogPost">
<?php the_content(); ?>
<?php
if (is_page("tags")) {
?>
<ul class="tagList">
<?php
wp_list_categories(
array(
"hierarchical" => 1,
... |
Use relative import for default settings | # -*- coding: utf8 -*-
"""
LibCrowdsData
-------------
Global data repository page for LibCrowds.
"""
import os
import json
from . import default_settings
from flask import current_app as app
from flask.ext.plugins import Plugin
__plugin__ = "LibCrowdsData"
__version__ = json.load(open(os.path.join(os.path.dirname(_... | # -*- coding: utf8 -*-
"""
LibCrowdsData
-------------
Global data repository page for LibCrowds.
"""
import os
import json
import default_settings
from flask import current_app as app
from flask.ext.plugins import Plugin
__plugin__ = "LibCrowdsData"
__version__ = json.load(open(os.path.join(os.path.dirname(__file__... |
Fix where uri path is empty | <?php
namespace Web\Route\Rules;
use Web\Route\Abstraction\AbstractRule;
class UriRule extends AbstractRule
{
/**
* Count the number of pattern segments for this rule.
*/
public function complexity()
{
return substr_count($this->pattern, '/');
}
/**
* @return string
*... | <?php
namespace Web\Route\Rules;
use Web\Route\Abstraction\AbstractRule;
class UriRule extends AbstractRule
{
/**
* Count the number of pattern segments for this rule.
*/
public function complexity()
{
return substr_count($this->pattern, '/');
}
/**
* @return string
*... |
Allow either a string (a (relative) url) or <link href> object passed to the exhibit json importer. | /*==================================================
* Exhibit.ExhibitJSONImporter
*==================================================
*/
Exhibit.ExhibitJSONImporter = {
};
Exhibit.importers["application/json"] = Exhibit.ExhibitJSONImporter;
Exhibit.ExhibitJSONImporter.load = function(link, database, cont) {
... | /*==================================================
* Exhibit.ExhibitJSONImporter
*==================================================
*/
Exhibit.ExhibitJSONImporter = {
};
Exhibit.importers["application/json"] = Exhibit.ExhibitJSONImporter;
Exhibit.ExhibitJSONImporter.load = function(link, database, cont) {
... |
Update results on situation change in IE
Partial fix of #106
Still need to update the UI | 'use strict';
angular.module('ddsApp').service('ResultatService', function($http, droitsDescription) {
// Si la valeur renvoyée par l'API vaut null, cela signifie par convention que l'aide a été injectée et non recaculée par le simulateur
function sortDroits(droitsCalcules) {
var droitsEligibles = {},... | 'use strict';
angular.module('ddsApp').service('ResultatService', function($http, droitsDescription) {
// Si la valeur renvoyée par l'API vaut null, cela signifie par convention que l'aide a été injectée et non recaculée par le simulateur
function sortDroits(droitsCalcules) {
var droitsEligibles = {},... |
Set default page size to 10 events. | import React from 'react'
import EventBets from '../templates/event-bets'
import EventHeading from '../templates/event-heading'
import styles from './index.module.styl'
export default ({ data }) => (
<ol className={styles['events-list']}>
{
data.allMongodbPlacardDevEvents.edges.map(({ node }, idx) => (
... | import React from 'react'
import EventBets from '../templates/event-bets'
import EventHeading from '../templates/event-heading'
import styles from './index.module.styl'
export default ({ data }) => (
<ol className={styles['events-list']}>
{
data.allMongodbPlacardDevEvents.edges.map(({ node }, idx) => (
... |
Reset image, even after error | $('#tiny_inner_image').bind('change', function (event) {
formElement = document.getElementById("tinymce_file_uploader");
data = new FormData(formElement);
ed = tinymce.get('news_type_text');
var tmpMsg = flashes.info('', 'Bild wird hochgeladen');
ed.getBody().setAttribute('contenteditable', 'false'... | $('#tiny_inner_image').bind('change', function (event) {
formElement = document.getElementById("tinymce_file_uploader");
data = new FormData(formElement);
ed = tinymce.get('news_type_text');
var tmpMsg = flashes.info('', 'Bild wird hochgeladen');
ed.getBody().setAttribute('contenteditable', 'false'... |
Add actual image rather than link to travis | // https://github.com/json-schema/JSON-Schema-Test-Suite/blob/develop/tests/draft4/required.json
var scenerios = [
{
"description": "required validation",
"schema": {
"properties": {
"foo": {},
"bar": {}
},
"required": ["foo"]
... | // https://github.com/json-schema/JSON-Schema-Test-Suite/blob/develop/tests/draft4/required.json
var scenerios = [
{
"description": "required validation",
"schema": {
"properties": {
"foo": {},
"bar": {}
},
"required": ["foo"]
... |
Add more unit test cases | package org.pdxfinder.services.constants;
import org.junit.Test;
import org.pdxfinder.BaseTest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class DataUrlTest extends BaseTest {
private final static String ASSERTION_ERROR = "Unknown Data Url Found: ";
@Te... | package org.pdxfinder.services.constants;
import org.junit.Test;
import org.pdxfinder.BaseTest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class DataUrlTest extends BaseTest {
private final static String ASSERTION_ERROR = "Unknown Data Url Found: ";
@Te... |
Enable hover table styling only if row click handler is defined | import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
{
'table-hover': !!click
... | import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
'table-hover',
'DataTable',... |
Remove config access from buildCommand | <?php
namespace Lawstands\Hermes;
class Channel
{
/**
* Channel command.
*
* @var $command
*/
private $command;
/**
* Channel constructor.
* @param array $config
* @param $data
* @param bool $async
*/
public function __construct(array $c... | <?php
namespace Lawstands\Hermes;
class Channel
{
/**
* Channel command.
*
* @var $command
*/
private $command;
/**
* Channel constructor.
* @param array $config
* @param $data
* @param bool $async
*/
public function __construct(array $c... |
Remove redundant and incorrect test | <?php
namespace Mockery\Generator\StringManipulation\Pass;
use Mockery as m;
use Mockery\Generator\StringManipulation\Pass\ClassNamePass;
use Mockery\Generator\MockConfiguration;
class ClassNamePassTest extends \PHPUnit_Framework_TestCase
{
const CODE = "namespace Mockery; class Mock {}";
public functio... | <?php
namespace Mockery\Generator\StringManipulation\Pass;
use Mockery as m;
use Mockery\Generator\StringManipulation\Pass\ClassNamePass;
use Mockery\Generator\MockConfiguration;
class ClassNamePassTest extends \PHPUnit_Framework_TestCase
{
const CODE = "namespace Mockery; class Mock {}";
public functio... |
Make sure javascript gets minified every time the build runs. | /**
* grunt
* CoffeeScript example
*/
module.exports = function(grunt){
grunt.initConfig({
lint: {
files: ['grunt.js', 'src/*.js']
},
coffee: {
compile: {
options: {
bare: true
},
files: {
'src/sidetap_loader.js': 'src/coffee/sidetap_loader.coffe... | /**
* grunt
* CoffeeScript example
*/
module.exports = function(grunt){
grunt.initConfig({
lint: {
files: ['grunt.js', 'src/*.js']
},
coffee: {
compile: {
options: {
bare: true
},
files: {
'src/sidetap_loader.js': 'src/coffee/sidetap_loader.coffe... |
CA-40618: Change path to the supplemental pack
Signed-off-by: Javier Alvarez-Valle <cf4c8668a0b4c5e013f594a6940d05b3d4d9ddcf@citrix.com> | import subprocess, sys, os.path
class DRAC_NO_SUPP_PACK(Exception):
"""Base Exception class for all transfer plugin errors."""
def __init__(self, *args):
Exception.__init__(self, *args)
class DRAC_POWERON_FAILED(Exception):
"""Base Exception class for all transfer plugin errors."""
def... | import subprocess, sys, os.path
class DRAC_NO_SUPP_PACK(Exception):
"""Base Exception class for all transfer plugin errors."""
def __init__(self, *args):
Exception.__init__(self, *args)
class DRAC_POWERON_FAILED(Exception):
"""Base Exception class for all transfer plugin errors."""
def... |
Add extra spaces to improve readability | (function () {
'use strict';
var path = require('path'),
loadConfig = require(path.join(__dirname, 'grunt/load')),
config = {};
module.exports = function (grunt) {
config = {
pkg: grunt.file.readJSON('package.json'),
scaffold: {
dev: {
... | (function () {
'use strict';
var path = require('path'),
loadConfig = require(path.join(__dirname, 'grunt/load')),
config = {};
module.exports = function (grunt) {
config = {
pkg: grunt.file.readJSON('package.json'),
scaffold: {
dev: {
... |
Remove Node interfaces (use origin id for objects) | import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from graphene_django_extras import (
DjangoFilterPaginateListField, LimitOffsetGraphqlPagination
)
from apps.employees import models
class EmployeeType(DjangoObjectType):
class Meta:
model = models.Employee
filte... | import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from graphene_django_extras import (
DjangoFilterPaginateListField, LimitOffsetGraphqlPagination
)
from apps.employees import models
class EmployeeType(DjangoObjectType):
class Meta:
model = models.Employee
filte... |
Load the gapi client drive library and change when promise is resolved | /** @jsx React.DOM */
var GoogleApiAuthForm = React.createClass({
render: function () {
return (
<form role="form" onSubmit={this.handleSubmit}>
<div className="form-group">
<label for="client_id">Client Id</label>
<input
... | /** @jsx React.DOM */
var GoogleApiAuthForm = React.createClass({
getInitialState: function() {
return {apiKey: null, clientId: null};
},
render: function () {
return (
<form role="form" onSubmit={this.handleSubmit}>
<div className="form-group">
... |
Change input from previous processing not from a file | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended for
non-graph based clust... | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended for
non-graph based clust... |
Revert "Stricter error message in place of "Name or service not known""
This reverts commit f0258bdd739450104cc196cbea750450f391e763. | <?php
namespace Illuminate\Database;
use Throwable;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Throwable $e
* @return bool
*/
protected function causedByLostConnection(Throwable $e)
... | <?php
namespace Illuminate\Database;
use Throwable;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Throwable $e
* @return bool
*/
protected function causedByLostConnection(Throwable $e)
... |
Make Selector.scope test more rigorous | from contextlib import contextmanager
from scell import Selector
from pytest import raises, fixture
def test_select(selector):
res = list(selector.select())
assert res
for event in res:
assert event.ready
def test_select_empty():
sel = Selector()
assert list(sel.select()) == []
def tes... | from contextlib import contextmanager
from scell import Selector
from pytest import raises, fixture
def test_select(selector):
res = list(selector.select())
assert res
for event in res:
assert event.ready
def test_select_empty():
sel = Selector()
assert list(sel.select()) == []
def tes... |
Fix param type in doc block | <?php
/**
* AmChartsPHP
*
* @link http://github.com/neeckeloo/AmChartsPHP
* @copyright Copyright (c) 2012 Nicolas Eeckeloo
*/
namespace AmCharts\Chart\Axis;
use AmCharts\Chart\Exception;
class Category extends AbstractAxis
{
const POSITION_START = 'start';
const POSITION_MIDDLE = 'middle';
/**... | <?php
/**
* AmChartsPHP
*
* @link http://github.com/neeckeloo/AmChartsPHP
* @copyright Copyright (c) 2012 Nicolas Eeckeloo
*/
namespace AmCharts\Chart\Axis;
use AmCharts\Chart\Exception;
class Category extends AbstractAxis
{
const POSITION_START = 'start';
const POSITION_MIDDLE = 'middle';
/**... |
Add a missing test description | from django.core.exceptions import ValidationError
from django.test import TestCase
import djohno
from djohno.utils import (
is_pretty_from_address,
get_app_versions
)
class DjohnoUtilTests(TestCase):
def test_is_pretty_from_address_fails_on_bare_address(self):
"""
Ensure normal email addr... | from django.core.exceptions import ValidationError
from django.test import TestCase
import djohno
from djohno.utils import (
is_pretty_from_address,
get_app_versions
)
class DjohnoUtilTests(TestCase):
def test_is_pretty_from_address_fails_on_bare_address(self):
"""
Ensure normal email addr... |
Fix problem loading daily chart on node page | jQuery(function ($) {
function generateChart(el) {
var url = window.location.origin + "/daily_reports_chart.json";
var certname = $(el).attr('data-certname');
if (typeof certname !== typeof undefined && certname !== false) {
url = url + "?certname=" + certname;
}
d3.json(url, function(data) ... | jQuery(function ($) {
function generateChart(el) {
var url = "daily_reports_chart.json";
var certname = $(el).attr('data-certname');
if (typeof certname !== typeof undefined && certname !== false) {
url = url + "?certname=" + certname;
}
d3.json(url, function(data) {
var chart = c3.gen... |
Fix variable in state change | angular.module('billett.admin').controller('AdminPaymentgroupNewController', function ($state, $stateParams, $location, AdminEventgroup, AdminPaymentgroup, Page) {
var ctrl = this;
console.log("state", $stateParams);
var loader = Page.setLoading();
AdminEventgroup.get({id: $stateParams['eventgroup_id'... | angular.module('billett.admin').controller('AdminPaymentgroupNewController', function ($state, $stateParams, $location, AdminEventgroup, AdminPaymentgroup, Page) {
var ctrl = this;
console.log("state", $stateParams);
var loader = Page.setLoading();
AdminEventgroup.get({id: $stateParams['eventgroup_id'... |
Remove unused imports & Skip if no mock available | # -*- coding: utf-8 -*-
'''
:codauthor: :email:`Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting.unit import skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import MagicMock, patch, NO_MOCK, NO_MOCK_REASON
ensure_in_syspath('../')
# Import salt libs
imp... | # -*- coding: utf-8 -*-
'''
:codauthor: :email:`Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting.helpers import (ensure_in_syspath, destructiveTest)
from salttesting.mock import MagicMock, patch
ensure_in_syspath('../')
# Import salt libs
import integration
from salt import fileclien... |
Fix package service provider registration | <?php namespace Spekkionu\Assetcachebuster;
use Illuminate\Support\ServiceProvider;
class AssetcachebusterServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application ... | <?php namespace Spekkionu\Assetcachebuster;
use Illuminate\Support\ServiceProvider;
class AssetcachebusterServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.