text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Include `roundrobin` in the dependencies | # -*- coding: utf-8 -*-
import ast
import os
import re
import sys
from setuptools import find_packages, setup
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
# parse version from locust/__init__.py
_version_re = re.compile(r"__version__\s+=\s+(.*)")
_init_file = os.path.join(ROOT_PATH, "locust", "__init__.py"... | # -*- coding: utf-8 -*-
import ast
import os
import re
import sys
from setuptools import find_packages, setup
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
# parse version from locust/__init__.py
_version_re = re.compile(r"__version__\s+=\s+(.*)")
_init_file = os.path.join(ROOT_PATH, "locust", "__init__.py"... |
Use a data provider so we can show multiple failures | <?php
/*
* This file is part of Alt Three TestBench.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AltThree\TestBench;
use CallbackFilterIterator;
use RecursiveDirectoryIterator;
us... | <?php
/*
* This file is part of Alt Three TestBench.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AltThree\TestBench;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;... |
Handle error message case on product create front end | app.controller('indexController', ['$scope', '$http', function($scope, $http){
$scope.currency = 'USD';
$scope.codes = currencyCodes;
$scope.handleCodeChange = function ($index) {
$scope.currency = $scope.codes[$index];
console.log($scope.currency);
};
$scope.toggleAdd = function ... | app.controller('indexController', ['$scope', '$http', function($scope, $http){
$scope.currency = 'USD';
$scope.codes = currencyCodes;
$scope.handleCodeChange = function ($index) {
$scope.currency = $scope.codes[$index];
console.log($scope.currency);
};
$scope.toggleAdd = function ... |
Hide contact form when sending succeeded. | angular.module('codebrag.common.directives').directive('contactFormPopup', function() {
function ContactFormPopup($scope, $http) {
$scope.isVisible = false;
$scope.submit = function() {
clearStatus();
sendFeedbackViaUservoice().then(success, failure);
function ... | angular.module('codebrag.common.directives').directive('contactFormPopup', function() {
function ContactFormPopup($scope, $http) {
$scope.isVisible = false;
$scope.submit = function() {
sendFeedbackViaUservoice().then(success, failure);
function success() {
... |
Use requests' reponse.text per documentation | import requests
class TestCase(object):
"""
Add assetion methods for HTTP Requests to TestCase
"""
def assertRequest(self, method="GET", url="", status_code=200,
contains=None, **kwargs):
"""
Asserts requests on a given endpoint
"""
if contains is None:
... | import requests
class TestCase(object):
"""
Add assetion methods for HTTP Requests to TestCase
"""
def assertRequest(self, method="GET", url="", status_code=200,
contains=None, **kwargs):
"""
Asserts requests on a given endpoint
"""
if contains is None:
... |
Set textarea value using 'value' prop | import ClearButton from '../buttons/ClearButton'
import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import equals from 'shallow-equals'
import styles from './styles/Text.css'
export default class Str extends React.Component {
static displayName = 'Text';
static prop... | import ClearButton from '../buttons/ClearButton'
import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import equals from 'shallow-equals'
import styles from './styles/Text.css'
export default class Str extends React.Component {
static displayName = 'Text';
static prop... |
Update selectors in Capsule CRM integration
Update the class selectors used in the Capsule integration to reflect
changes in Capsule. | /*jslint indent: 2 */
/*global $: false, document: false, togglbutton: false*/
'use strict';
// List items
togglbutton.render('.list li:not(.toggl)', {observe: true}, function (elem) {
var link,
taskElement = $('.task-title', elem),
description = $('a', taskElement).textContent.trim(),
projectName = fun... | /*jslint indent: 2 */
/*global $: false, document: false, togglbutton: false*/
'use strict';
// List items
togglbutton.render('.list li:not(.toggl)', {observe: true}, function (elem) {
var link,
taskElement = $('.task-title', elem),
description = $('a', taskElement).textContent.trim(),
projectName = fun... |
Fix load config from local db config file | import click
from .history import clone
from . import config
def validate_remote(ctx, param, value):
if value:
try:
remote, branch = value.split('/')
return (remote, branch)
except ValueError:
raise click.BadParameter('remote need to be in format <remote>/<bran... | import click
from .history import clone
from . import config
def validate_remote(ctx, param, value):
if value:
try:
remote, branch = value.split('/')
return (remote, branch)
except ValueError:
raise click.BadParameter('remote need to be in format <remote>/<bran... |
Add information about date confirmed | var Promise = require('bluebird');
var moment = require('moment');
module.exports = {
createOrSave: function(app, tournament) {
if (!app.googleCalendar) {
return Promise.reject(new Error('Calendar service not exist'));
}
var insert = Promise.promisify(app.googleCalendar.events.insert, {context: app... | var Promise = require('bluebird');
var moment = require('moment');
module.exports = {
createOrSave: function(app, tournament) {
if (!app.googleCalendar) {
return Promise.reject(new Error('Calendar service not exist'));
}
var insert = Promise.promisify(app.googleCalendar.events.insert, {context: app... |
Fix a bunch of PEP8 warnings. | #! /usr/bin/env python
import argparse
import csv
import itertools
import logging
import math
import os
import miseq_logging
BAD_ERROR_RATE = 7.5
def parseArgs():
parser = argparse.ArgumentParser(
description='Post-processing of short-read alignments.')
parser.add_argument('quality_csv',
... | #! /usr/bin/env python
import argparse
import csv
import itertools
import logging
import math
import os
import miseq_logging
BAD_ERROR_RATE = 7.5
def parseArgs():
parser = argparse.ArgumentParser(
description='Post-processing of short-read alignments.')
parser.add_argument('quality_csv',
... |
Use "having" instead of "where". We don't want to break the query and want to filter by all possible fields. | <?
class QuickSearch extends Filter {
/*
* Quicksearch represents one-field filter which goes perfectly with a grid
*/
var $region=null;
var $region_url=null;
function defaultTemplate(){
return array('compact_form','form');
}
function init(){
parent::init();
$... | <?
class QuickSearch extends Filter {
/*
* Quicksearch represents one-field filter which goes perfectly with a grid
*/
var $region=null;
var $region_url=null;
function defaultTemplate(){
return array('compact_form','form');
}
function init(){
parent::init();
$... |
Include templates in package distribution | import sys
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
from setup... | import sys
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
from setup... |
Apply label in TextField Object. | /**
* Main application class of "QxMaterialDemo".
*/
qx.Class.define("qxmaterialdemo.Application", {
extend: qxm.Application,
// extend: qxm.application.Standalone,
members: {
/**
* This method contains the initial application code and gets called
* during startup of the applicat... | /**
* Main application class of "QxMaterialDemo".
*/
qx.Class.define("qxmaterialdemo.Application", {
extend: qxm.Application,
// extend: qxm.application.Standalone,
members: {
/**
* This method contains the initial application code and gets called
* during startup of the applicat... |
Add __repr__ and __str__ methods to dummy object. | #!/usr/bin/env python
"""Simple library for parsing deeply nested structure (dict, json)
into regular object. You can specify fields to extract, and argument
names in created object.
Example
content = {
'name': 'Bob',
'details': {
'email': 'bob@email.com',
}
}
fields = ... | #!/usr/bin/env python
"""Simple library for parsing deeply nested structure (dict, json)
into regular object. You can specify fields to extract, and argument
names in created object.
Example
content = {
'name': 'Bob',
'details': {
'email': 'bob@email.com',
}
}
fields = ... |
Add time complexity for zigzagArray problem | /*
Input array: 8 7 9 2 1 10
< > < > <
7 9 2 8 1 10
*/
import java.util.*;
import java.lang.*;
class Solution{
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
int n = sc.nextInt();
int[] arr = new int[n];
... | /*
Input array: 8 7 9 2 1 10
< > < > <
7 9 2 8 1 10
*/
import java.util.*;
import java.lang.*;
class Solution{
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
int n = sc.nextInt();
int[] arr = new int[n];
... |
Fix a regression in accessing the username for the session.
My previous optimization to fetching the user resource along with the
session broke the `get_username()` function, which attempted to follow a
now non-existent link. It's been updated to get the expanded user
resource instead and access the username from that... | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... |
[Notifier][Slack] Remove :void from test methods | <?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\Notifier\Bridge\Slack\Tests;
use PHPUnit\Framework\Te... | <?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\Notifier\Bridge\Slack\Tests;
use PHPUnit\Framework\Te... |
Improve user edit modal, now it saves the last name and bio | /*****************************************************************************/
/* UserProfileEdit: Event Handlers */
/*****************************************************************************/
Template.UserProfileEdit.events({
'click #confirm': function(event) {
event.preventDefault();
var newU... | /*****************************************************************************/
/* UserProfileEdit: Event Handlers */
/*****************************************************************************/
Template.UserProfileEdit.events({
'click #confirm': function(event) {
event.preventDefault();
var newU... |
Change base path for dummy | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/ember-cli-toggle',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// ... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... |
Allow minimatch match slashes too | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... |
Add collection and db id injection | 'use strict';
module.exports = {
mongodb: {
class: 'vendor.mongodb'
},
db: {
collections: ['db'],
class: 'db',
declinations: '$connections$',
properties: {
id: '@_@',
connectionUrl: '@url@',
connectionOptions: '@options@',
... | 'use strict';
module.exports = {
mongodb: {
class: 'vendor.mongodb'
},
db: {
collections: ['db'],
class: 'db',
declinations: '$connections$',
properties: {
name: '@_@',
connectionUrl: '@url@',
connectionOptions: '@options@',
... |
Add width heigt column to face migration file | <?php
use yii\db\Migration;
/**
* Handles the creation of table `faces`.
* Has foreign keys to the tables:
*
* - `image`
*/
class m170124_153250_create_faces_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('faces', [
'id' => $this... | <?php
use yii\db\Migration;
/**
* Handles the creation of table `faces`.
* Has foreign keys to the tables:
*
* - `image`
*/
class m170124_153250_create_faces_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('faces', [
'id' => $this... |
Fix bash completion for HelpCommand and fully typed subcommands | package ee.shy.cli.command;
import ee.shy.cli.Command;
import ee.shy.cli.SuperCommand;
import java.io.IOException;
import java.util.Map;
public class CompletionCommand implements Command {
private final Command rootCommand;
public CompletionCommand(Command rootCommand) {
this.rootCommand = rootComma... | package ee.shy.cli.command;
import ee.shy.cli.Command;
import ee.shy.cli.SuperCommand;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class CompletionCommand implements Command {
private final Command rootCommand;
public C... |
Use self.stdout.write() instead of print().
This is the recommended way in the Django documentation:
https://docs.djangoproject.com/en/1.7/howto/custom-management-commands/ | import requests
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django.utils.six.moves import input
class Command(NoArgsCommand):
"""
Download and load dev fixtures from www.python.org
"""
help = "Download and... | import requests
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django.utils.six.moves import input
class Command(NoArgsCommand):
"""
Download and load dev fixtures from www.python.org
"""
help = "Download and... |
Use more natural constructor call | // volontary written in ES5, so that it works with Node 4.x
var path = require('path');
var webpack = require('webpack');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
var HasteMapWebPackResolver = require('haste-map-webpack-resolver');
var currentDir = path.resolve(__dirname, '.');
module.exports =... | // volontary written in ES5, so that it works with Node 4.x
var path = require('path');
var webpack = require('webpack');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
var buildResolver = require('haste-map-webpack-resolver');
var currentDir = path.resolve(__dirname, '.');
module.exports = {
con... |
Adjust macro tests to new template location | #!/usr/bin/env python
import unittest
import os.path
from macropolo import MacroTestCase, JSONTestCaseLoader
from macropolo.environments import SheerEnvironment
class CFGovTestCase(SheerEnvironment, MacroTestCase):
"""
A MacroTestCase subclass for cfgov-refresh.
"""
def search_root(self):
""... | #!/usr/bin/env python
import unittest
import os.path
from macropolo import MacroTestCase, JSONTestCaseLoader
from macropolo.environments import SheerEnvironment
class CFGovTestCase(SheerEnvironment, MacroTestCase):
"""
A MacroTestCase subclass for cfgov-refresh.
"""
def search_root(self):
""... |
Enhance compatibility with Symfony 5. | <?php declare(strict_types=1);
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2015-2019, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
name... | <?php declare(strict_types=1);
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2015-2019, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
name... |
Fix logging the JSON result | from sublime_plugin import WindowCommand
from ...common import util
from ...core.git_command import GitCommand
from .. import github, git_mixins
from GitSavvy.core.runtime import enqueue_on_worker
START_CREATE_MESSAGE = "Forking {repo} ..."
END_CREATE_MESSAGE = "Fork created successfully."
__all__ = ['gs_github_cr... | from sublime_plugin import WindowCommand
from ...common import util
from ...core.git_command import GitCommand
from .. import github, git_mixins
from GitSavvy.core.runtime import enqueue_on_worker
START_CREATE_MESSAGE = "Forking {repo} ..."
END_CREATE_MESSAGE = "Fork created successfully."
__all__ = ['gs_github_cr... |
Work around Chrome's over-eager validation of integration config form.
Chrome loves to test the validation of forms, even going so far as to
run validation on inputs which are not visible to the user. It then
errors out on the console that it can't focus the input. This change
goes through and adds the `disabled` prop... | $(function() {
const $tool = $('#id_tool');
const $toolOptions = $('#row-tool_options');
if ($tool.length === 1 && $toolOptions.length === 1) {
const $itemAboveOptions = $toolOptions.prev();
function changeToolVisibility() {
const selectedTool = parseInt($tool.val(), 10);
... | $(function() {
const $tool = $('#id_tool');
const $toolOptions = $('#row-tool_options');
if ($tool.length === 1 && $toolOptions.length === 1) {
const $itemAboveOptions = $toolOptions.prev();
function changeToolVisibility() {
const selectedTool = parseInt($tool.val(), 10);
... |
Make Graph an attribute rather than an inheritance | from rdflib import Graph
from ktbs_bench.bnsparqlstore import SPARQLStore
class BenchableStore:
"""Allows to use a store/graph for benchmarks.
Contains a rdflib.Graph with setup and teardown.
"""
def __init__(self, store, graph_id, store_config, store_create=False):
self.graph = Graph(store=... | from rdflib import Graph
from ktbs_bench.bnsparqlstore import SPARQLStore
class BenchableStore(Graph):
def __init__(self, connect_args, create_func=None, create_args=[], *args, **kwargs):
super(BenchableStore, self).__init__(*args, **kwargs)
self.connect_args = connect_args
self.create_fun... |
Use max number of attempts to scan user queues | 'use strict';
var QUEUE = require('../job_queue').QUEUE;
var MAX_SCAN_ATTEMPTS = 50;
function QueueSeeker(pool) {
this.pool = pool;
}
module.exports = QueueSeeker;
QueueSeeker.prototype.seek = function (callback) {
var initialCursor = ['0'];
var attemps = 0;
var users = {};
var self = this;
... | 'use strict';
var QUEUE = require('../job_queue').QUEUE;
function QueueSeeker(pool) {
this.pool = pool;
}
module.exports = QueueSeeker;
QueueSeeker.prototype.seek = function (callback) {
var initialCursor = ['0'];
var users = {};
var self = this;
this.pool.acquire(QUEUE.DB, function(err, client... |
Add link to details for now | import React from 'react'
import { Link } from 'gatsby'
import './footer.css'
const Footer = () => (
<div
style={{
// position: 'absolute',
// bottom: '0',
// left: '0',
// right: '0',
background: '#0C192E',
marginBottom: '0rem',
height: '80px',
}}
>
<div
... | import React from 'react'
import { Link } from 'gatsby'
import './footer.css'
const Footer = () => (
<div
style={{
// position: 'absolute',
// bottom: '0',
// left: '0',
// right: '0',
background: '#0C192E',
marginBottom: '0rem',
height: '80px',
}}
>
<div
... |
Handle 404s due to index not existing when doing versioning | import json
import logging
from elasticsearch import Elasticsearch
from scrapi import settings
from scrapi.processing.base import BaseProcessor
es = Elasticsearch(
settings.ELASTIC_URI,
request_timeout=settings.ELASTIC_TIMEOUT
)
logging.getLogger('elasticsearch').setLevel(logging.WARN)
logging.getLogger('el... | import json
import logging
from elasticsearch import Elasticsearch
from scrapi import settings
from scrapi.processing.base import BaseProcessor
es = Elasticsearch(
settings.ELASTIC_URI,
request_timeout=settings.ELASTIC_TIMEOUT
)
logging.getLogger('elasticsearch').setLevel(logging.WARN)
logging.getLogger('el... |
Add conditional import of the enum34 library
This lib is used to bing enumerations to Python <= 3.3. | """
This module gives the "listener" classes for the PyEcore notification layer.
The main class to create a new listener is "EObserver" which is triggered
each time a modification is perfomed on an observed element.
"""
try:
from enum34 import unique, Enum
except ImportError:
from enum import unique, Enum
cla... | """
This module gives the "listener" classes for the PyEcore notification layer.
The main class to create a new listener is "EObserver" which is triggered
each time a modification is perfomed on an observed element.
"""
class ENotifer(object):
def notify(self, notification):
notification.notifier = notifi... |
Make generic (can now be applied to pages and dataobjects) | <?php
class FaqSegment extends DataObject
{
private static $db = [
'Title' => 'Varchar(255)',
'Answer' => 'HTMLText',
'SortOrder' => 'Int'
];
private static $has_one = [
'OwnerObject' => 'DataObject'
];
private static $default_sort = 'SortOrder';
priva... | <?php
class FaqSegment extends DataObject
{
private static $db = [
'Title' => 'Varchar(255)',
'Answer' => 'HTMLText',
'SortOrder' => 'Int'
];
private static $has_one = [
'Page' => 'Page'
];
private static $default_sort = 'SortOrder';
private static $fi... |
Remove unnecesary logs from order function | /* global console, Calendar, vis */
(function() {
"use strict";
var calendar = new Calendar();
calendar.init(document.getElementById('visualization'),
{
height: "100vh",
orientation: "top",
zoomKey: 'shiftKey',
zoomMax: 315360000000,
zoomMin: 600000,
editable: {
... | /* global console, Calendar, vis */
(function() {
"use strict";
var calendar = new Calendar();
calendar.init(document.getElementById('visualization'),
{
height: "100vh",
orientation: "top",
zoomKey: 'shiftKey',
zoomMax: 315360000000,
zoomMin: 600000,
editable: {
... |
Update the javadoc to show that the basic ontology information can come from go terms OR eco terms | package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model;
import uk.ac.ebi.quickgo.rest.comm.ResponseType;
import java.util.List;
/**
* Represents part of the model corresponding to the response available from the resource:
*
* <ul>
* <li>/go/terms/{term}</li>
* </ul>
*
* or
*
* <ul>
* ... | package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model;
import uk.ac.ebi.quickgo.rest.comm.ResponseType;
import java.util.List;
/**
* Represents part of the model corresponding to the response available from the resource:
*
* <ul>
* <li>/go/terms/{term}</li>
* </ul>
*
* This model captures ... |
Fix counts for search timeline updates | YUI.add("model-timeline-base", function(Y) {
"use strict";
var models = Y.namespace("Falco.Models"),
TimelineBase;
TimelineBase = Y.Base.create("timeline", Y.Model, [], {
initializer : function(config) {
var tweets;
config || (confi... | YUI.add("model-timeline-base", function(Y) {
"use strict";
var models = Y.namespace("Falco.Models"),
TimelineBase;
TimelineBase = Y.Base.create("timeline", Y.Model, [], {
initializer : function(config) {
var tweets;
config || (confi... |
Change once to on for m:job.created listener | minerva.views.JobsPanel = minerva.View.extend({
initialize: function () {
var columnEnum = girder.views.jobs_JobListWidget.prototype.columnEnum;
var columns = columnEnum.COLUMN_STATUS_ICON |
columnEnum.COLUMN_TITLE;
this.jobListWidget = new girder.views.jobs_JobListWid... | minerva.views.JobsPanel = minerva.View.extend({
initialize: function () {
var columnEnum = girder.views.jobs_JobListWidget.prototype.columnEnum;
var columns = columnEnum.COLUMN_STATUS_ICON |
columnEnum.COLUMN_TITLE;
this.jobListWidget = new girder.views.jobs_JobListWid... |
Remove not necessary code in Setting class | """
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_path = "MODEL_PATH"
string_submission_path ... | """
This class is used in kaggle competitions
"""
import json
class Settings():
train_path = None
test_path = None
model_path = None
submission_path = None
string_train_path = "TRAIN_DATA_PATH"
string_test_path = "TEST_DATA_PATH"
string_model_path = "MODEL_PATH"
string_submission_path ... |
Use Image component as image source instead of raw object | import React, { Component, StyleSheet, PropTypes, Image, View } from 'react-native';
export default class Media extends Component {
static propTypes = {
image: PropTypes.shape({type: PropTypes.oneOf([Image])}).isRequired,
height: PropTypes.number,
overlay: PropTypes.bool,
children... | import React, { Component, StyleSheet, PropTypes, Image, View } from 'react-native';
export default class Media extends Component {
static propTypes = {
src: PropTypes.object.isRequired,
height: PropTypes.number,
overlay: PropTypes.bool,
children: PropTypes.node
};
static... |
Make all search form fields optional. | from django import forms
import settings
OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES
EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES
class EventSearchForm(forms.Form):
outcome = forms.ChoiceField(
widget=forms.Select(
attrs={
'id': 'prependedInput',
'cla... | from django import forms
import settings
OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES
EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES
class EventSearchForm(forms.Form):
outcome = forms.ChoiceField(
widget=forms.Select(
attrs={
'id': 'prependedInput',
'cla... |
Add Ionicons to icon font list | <?php
namespace Kibo\Phast\Filters\CSS\FontSwap;
use Kibo\Phast\Services\ServiceFilter;
use Kibo\Phast\ValueObjects\Resource;
class Filter implements ServiceFilter {
const FONT_FACE_REGEXP = '/(@font-face\s*\{)([^}]*)/i';
const ICON_FONT_FAMILIES = [
'Font Awesome',
'GeneratePress',
... | <?php
namespace Kibo\Phast\Filters\CSS\FontSwap;
use Kibo\Phast\Services\ServiceFilter;
use Kibo\Phast\ValueObjects\Resource;
class Filter implements ServiceFilter {
const FONT_FACE_REGEXP = '/(@font-face\s*\{)([^}]*)/i';
const ICON_FONT_FAMILIES = [
'Font Awesome',
'GeneratePress',
... |
Update the alert template a bit. Allow closing by ESC | angular.module('com.likalo.ui')
.factory('uiDialog', ['ngDialog',
function (ngDialog) {
return {
alert: function (title, message) {
var infoClass;
title = title || 'Alert';
message = message || '';
return ngDialog.open({
plain: true,
cl... | angular.module('com.likalo.ui')
.factory('uiDialog', ['ngDialog',
function (ngDialog) {
return {
alert: function (title, message) {
var infoClass;
title = title || 'Alert';
message = message || '';
return ngDialog.open({
plain: true,
cl... |
Build before every test as a way to keep builds up to date (thanks @hodgestar) | module.exports = function (grunt) {
var paths = require('./paths');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
paths: paths,
watch: {
src: {
files: ['... | module.exports = function (grunt) {
var paths = require('./paths');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
paths: paths,
watch: {
src: {
files: ['... |
Set short open tags to on by default | <?php
class PhpTemplate
{
protected $_dir = Null;
protected $_data = Array();
protected $_headers = Array();
public $app = Null;
public $router = Null;
public function __construct()
{
ini_set('output_buffering', 'On');
ini_set('short_open_tag', 'On');
$th... | <?php
class PhpTemplate
{
protected $_dir = Null;
protected $_data = Array();
protected $_headers = Array();
public $app = Null;
public $router = Null;
public function __construct()
{
ini_set('output_buffering', 'On');
$this->_dir = '../views/';
$this->... |
Fix bug with port change | var express = require('express');
var bodyParser = require('body-parser');
var ipcMain = require('electron').ipcMain;
var notificationListener = express();
const path = require('path');
// Load all endpoint modules.
function loadAllModuleEndpoints() {
notificationListener.use(bodyParser.json());
var pjson = re... | var express = require('express');
var bodyParser = require('body-parser');
var ipcMain = require('electron').ipcMain;
var notificationListener = express();
const path = require('path');
// Load all endpoint modules.
function loadAllModuleEndpoints() {
notificationListener.use(bodyParser.json());
var pjson = re... |
Fix unitialized variable compiler error | /**
* @license
* Copyright 2019 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
package foam.util.concurrent;
import foam.core.Agency;
import foam.core.ContextAgent;
import foam.core.X;
/**
* An Aynchronous implementation of the AssemblyLine interface.
* Uses the threadpool... | /**
* @license
* Copyright 2019 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
package foam.util.concurrent;
import foam.core.Agency;
import foam.core.ContextAgent;
import foam.core.X;
/**
* An Aynchronous implementation of the AssemblyLine interface.
* Uses the threadpool... |
Remove option for non-thunk SQS initialization | from .base import BackendFactory, Backend
from ..queue.sqs import SQSQueue
class SQSBackendFactory(BackendFactory):
def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10, create_if_missing=False):
"""To allow backends to be initialized lazily, this factory requires a thunk
(p... | from .base import BackendFactory, Backend
from ..queue.sqs import SQSQueue
class SQSBackendFactory(BackendFactory):
def __init__(self, sqs_connection_or_thunk, visibility_timeout=30, wait_time=10, create_if_missing=False):
if callable(sqs_connection_or_thunk):
self.sqs_connection_thunk = sqs_co... |
Update to latest i18n API |
import Vue from 'vue';
import vuexI18n from 'vuex-i18n';
import store from '../store';
import locales from './locales';
import fallback from '../assets/i18n/en.json';
Vue.use(vuexI18n.plugin, store);
Vue.i18n.add('en', fallback);
Vue.i18n.set('en');
Vue.i18n.fallback('en');
export default {
init() {
l... |
import Vue from 'vue';
import vuexI18n from 'vuex-i18n';
import store from '../store';
import locales from './locales';
import fallback from '../assets/i18n/en.json';
Vue.use(vuexI18n.plugin, store);
Vue.i18n.add('en', fallback);
Vue.i18n.set('en');
Vue.i18n.fallback('en');
export default {
init() {
l... |
Add string and json representations of all Job instances | <?php
namespace josegonzalez\Queuesadilla\Job;
use JsonSerializable;
class Base implements JsonSerializable
{
const LOW = 4;
const NORMAL = 3;
const MEDIUM = 2;
const HIGH = 1;
const CRITICAL = 0;
protected $engine;
protected $item;
public function __construct($item, $engine)
{... | <?php
namespace josegonzalez\Queuesadilla\Job;
class Base
{
const LOW = 4;
const NORMAL = 3;
const MEDIUM = 2;
const HIGH = 1;
const CRITICAL = 0;
protected $engine;
protected $item;
public function __construct($item, $engine)
{
$this->engine = $engine;
$this->it... |
Support Symfony Process 2.3 "process timed-out" exception message | <?php
namespace Liip\RMT\Tests\Functional;
use Exception;
use Liip\RMT\Context;
use Liip\RMT\Prerequisite\TestsCheck;
class TestsCheckTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$informationCollector = $this->getMock('Liip\RMT\Information\InformationCollector');
$i... | <?php
namespace Liip\RMT\Tests\Functional;
use Exception;
use Liip\RMT\Context;
use Liip\RMT\Prerequisite\TestsCheck;
class TestsCheckTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$informationCollector = $this->getMock('Liip\RMT\Information\InformationCollector');
$i... |
Set user's name as anonymous if no name is specified | /**
* 24.05.2017
* TCP Chat using NodeJS
* https://github.com/PatrikValkovic/TCPChat
* Created by patri
*/
'use strict'
const net = require('net')
const log = require('./logger')
const config = require('../config.json')
const GroupManager = require('./groupManager')
const Parser = require('./Parser')
const Client... | /**
* 24.05.2017
* TCP Chat using NodeJS
* https://github.com/PatrikValkovic/TCPChat
* Created by patri
*/
'use strict'
const net = require('net')
const log = require('./logger')
const config = require('../config.json')
const GroupManager = require('./groupManager')
const Parser = require('./Parser')
const Client... |
Fix issue where logout redirects to non-locale URI | <?php namespace Anomaly\UsersModule\Http\Controller;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\Streams\Platform\Routing\UrlGenerator;
use Anomaly\UsersModule\User\UserAuthenticator;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Translation\Translator;
/**
* Class LoginControlle... | <?php namespace Anomaly\UsersModule\Http\Controller;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\UsersModule\User\UserAuthenticator;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Translation\Translator;
/**
* Class LoginController
*
* @link http://pyrocms.com/
* @auth... |
Fix in getLimitQuery not valid result | <?php
namespace Helper;
use APIJet\Config;
use \PDO;
class Db
{
private static $instance = null;
private static $options = [
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
];
... | <?php
namespace Helper;
use APIJet\Config;
use \PDO;
class Db
{
private static $instance = null;
private static $options = [
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
];
... |
[REF] openacademy: Add sql constraint identation fixed | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... |
Update class name validator implementation. | <?php
namespace PhpSpec\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DescribeCommand e... | <?php
namespace PhpSpec\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DescribeCommand e... |
Fix test runner importing wrong module. | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='publisher.urls',
INSTALLED_APPS=[
... | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='publisher.urls',
INSTALLED_APPS=[
... |
Use render function instead of template
This is needed for runtime only environment in Vue | import noop from 'lodash/noop';
import omitBy from 'lodash/omitBy';
import isArray from 'lodash/isArray';
import normalizeProps from './normalizeProps';
export default function connect(mapStateAsProps = noop, mapActionsAsProps = noop) {
return (children) => {
const props = children.props || {};
con... | import noop from 'lodash/noop';
import omitBy from 'lodash/omitBy';
import isArray from 'lodash/isArray';
import normalizeProps from './normalizeProps';
export default function connect(mapStateAsProps = noop, mapActionsAsProps = noop) {
return (children) => {
const props = children.props || {};
con... |
Set referer header to prevent CSRF | // Copyright (C) 2007-2014, GoodData(R) Corporation.
var httpProxy = require('http-proxy');
module.exports = function(host) {
var currentHost, currentPort;
var proxy = new httpProxy.RoutingProxy({
target: {
https: true
}
});
var requestProxy = function(req, res, next) {
... | // Copyright (C) 2007-2014, GoodData(R) Corporation.
var httpProxy = require('http-proxy');
module.exports = function(host) {
var currentHost, currentPort;
var proxy = new httpProxy.RoutingProxy({
target: {
https: true
}
});
var requestProxy = function(req, res, next) {
... |
Add katex as an angular constant | /*!
* angular-katex v0.2.1
* https://github.com/tfoxy/angular-katex
*
* Copyright 2015 Tomás Fox
* Released under the MIT license
*/
(function() {
'use strict';
angular.module('katex', [])
.constant('katex', katex)
.provider('katexConfig', ['katex', function(katex) {
var self = this;
... | /*!
* angular-katex v0.2.1
* https://github.com/tfoxy/angular-katex
*
* Copyright 2015 Tomás Fox
* Released under the MIT license
*/
(function() {
'use strict';
angular.module('katex', [])
.provider('katexConfig', function() {
var self = this;
self.errorTemplate = function(err) {
... |
Update DI extension to recognize new parameter
Make sure we fetch avalange_imagine.not_found_images parameter collection
into imagine.not_found_images parameter. | <?php
namespace Avalanche\Bundle\ImagineBundle\DependencyInjection;
use InvalidArgumentException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use S... | <?php
namespace Avalanche\Bundle\ImagineBundle\DependencyInjection;
use InvalidArgumentException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use S... |
Fix @variable directive without arguments | <?php
namespace Milax\Mconsole\Providers;
use Illuminate\Support\ServiceProvider;
use Milax\Mconsole\Models\MconsoleUploadPreset;
use Milax\Mconsole\Models\Variable;
use Blade;
use View;
class MconsoleBladeExtensions extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return v... | <?php
namespace Milax\Mconsole\Providers;
use Illuminate\Support\ServiceProvider;
use Milax\Mconsole\Models\MconsoleUploadPreset;
use Milax\Mconsole\Models\Variable;
use Blade;
use View;
class MconsoleBladeExtensions extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return v... |
Normalize string before passing it to detectors | <?php namespace Linko\Spam;
class SpamFilter
{
/**
* Holds registed spam detectors
*
* @var SpamDetectorInterface[]
*/
private $_spamDetectors = array();
/**
* Checks if a string is spam or not
*
* @param $string
*
* @return SpamResult
*/
public functi... | <?php namespace Linko\Spam;
class SpamFilter
{
/**
* Holds registed spam detectors
*
* @var SpamDetectorInterface[]
*/
private $_spamDetectors = array();
/**
* Checks if a string is spam or not
*
* @param $string
*
* @return SpamResult
*/
public functi... |
Add incomplete category into showcommand | package seedu.tasklist.logic.commands;
/**
* Shows all tasks that fulfill the category keyword.
* Keyword matching is case insensitive.
*/
public class ShowCommand extends Command {
public static final String COMMAND_WORD = "show";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows all tas... | package seedu.tasklist.logic.commands;
/**
* Shows all tasks that fulfill the category keyword.
* Keyword matching is case insensitive.
*/
public class ShowCommand extends Command {
public static final String COMMAND_WORD = "show";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows all tas... |
Correct table names in migration | <?php
namespace Surfnet\StepupMiddleware\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160622160146 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public funct... | <?php
namespace Surfnet\StepupMiddleware\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160622160146 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public funct... |
Revise download_url string for consistency with main script | import os
from setuptools import setup
from pyspeedtest import __program__, __version__
# allow setup.py to be run from any path
os.chdir(os.path.dirname(os.path.abspath(__file__)))
setup(
name=__program__,
version=__version__,
py_modules=['pyspeedtest'],
scripts=['bin/pyspeedtest'],
license='MIT'... | import os
from setuptools import setup
from pyspeedtest import __program__, __version__
# allow setup.py to be run from any path
os.chdir(os.path.dirname(os.path.abspath(__file__)))
setup(
name=__program__,
version=__version__,
py_modules=['pyspeedtest'],
scripts=['bin/pyspeedtest'],
license='MIT'... |
Make "register" return False when username is already taken | # -*- coding: utf-8 -*-
# from twisted.words.xish import domish
from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep
from base import *
import random
import time
import bnw.core.bnw_objects as objs
def _(s, user):
return s
from uuid import uuid4
import re
@check_arg(name=USER_RE)
@defer.inlineC... | # -*- coding: utf-8 -*-
# from twisted.words.xish import domish
from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep
from base import *
import random
import time
import bnw.core.bnw_objects as objs
def _(s, user):
return s
from uuid import uuid4
import re
@check_arg(name=USER_RE)
@defer.inlineC... |
Fix my silly mistake combining the arrays of objects | var request = require('request');
var _und = require('underscore');
/* Get orders listing. */
exports.list = function(req, res){
var results = {
orders: [],
bitStampOrders: [],
btceOrders: []
};
request('https://www.bitstamp.net/api/transactions/', function(error, response, body){
... | var request = require('request');
var _und = require('underscore');
/* Get orders listing. */
exports.list = function(req, res){
var results = {
orders: [],
bitStampOrders: [],
btceOrders: []
};
request('https://www.bitstamp.net/api/transactions/', function(error, response, body){
... |
Update to support FIT 1.4.3-SNAPSHOT | package org.pitest.cucumber;
import cucumber.api.junit.Cucumber;
import cucumber.runtime.Runtime;
import cucumber.runtime.model.CucumberScenario;
import gherkin.formatter.Formatter;
import gherkin.formatter.Reporter;
import gherkin.formatter.model.TagStatement;
import org.junit.Before;
import org.junit.Test;
import or... | package org.pitest.cucumber;
import cucumber.api.junit.Cucumber;
import cucumber.runtime.Runtime;
import cucumber.runtime.model.CucumberScenario;
import gherkin.formatter.Formatter;
import gherkin.formatter.Reporter;
import gherkin.formatter.model.TagStatement;
import org.junit.Before;
import org.junit.Test;
import or... |
Make sure we can rebuild the menu | 'use strict'
void (function () {
const remote = require('remote')
const Tray = remote.require('tray')
const Menu = remote.require('menu')
const MenuItem = remote.require('menu-item')
const dialog = remote.require('dialog')
const ipc = require('ipc')
const grunt = require('./lib/Grunt')
// Set up tray ... | 'use strict'
void (function () {
const remote = require('remote')
const Tray = remote.require('tray')
const Menu = remote.require('menu')
const MenuItem = remote.require('menu-item')
const dialog = remote.require('dialog')
const ipc = require('ipc')
const grunt = require('./lib/Grunt')
// Set up tray ... |
Make sure the trigger view is locked down | from django.contrib import admin
from django.http import HttpResponseRedirect, Http404
from django.conf.urls import url
from django.utils.decorators import method_decorator
from django.contrib.admin.views.decorators import staff_member_required
from .models import TestResult
from .prod_tests.entity_counting_test impo... | from django.contrib import admin
from django.http import HttpResponseRedirect, Http404
from django.conf.urls import patterns
from django.conf.urls import url
from django.shortcuts import redirect
from .models import TestResult
from .prod_tests.entity_counting_test import test_entity_count_vs_length
class TestResult... |
Add CR2 to allowed files | import os
from addict import Dict
from gallery.models import File
def get_dir_file_contents(dir_id):
print(File.query.filter(File.parent == dir_id).all())
return File.query.filter(File.parent == dir_id).all()
def get_dir_tree_dict():
path = os.path.normpath("/gallery-data/root")
file_tree = Dict()
... | import os
from addict import Dict
from gallery.models import File
def get_dir_file_contents(dir_id):
print(File.query.filter(File.parent == dir_id).all())
return File.query.filter(File.parent == dir_id).all()
def get_dir_tree_dict():
path = os.path.normpath("/gallery-data/root")
file_tree = Dict()
... |
Correct linting error with order of requires | const merge = require("webpack-merge");
const PostCompile = require("post-compile-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const Version = require("node-version-assets");
const postCSSPlugins = [
require("postcss-easy-import")({ prefix: "_" }),
require("postcss-mixins"),
... | const merge = require("webpack-merge");
const PostCompile = require("post-compile-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const Version = require("node-version-assets");
const common = require("./webpack.common.js");
const postCSSPlugins = [
require("postcss-easy-import")({... |
Return more than 10 domains | from .es_query import HQESQuery
from . import filters
class FormES(HQESQuery):
index = 'forms'
default_filters = {
'is_xform_instance': {"term": {"doc_type": "xforminstance"}},
'has_xmlns': {"not": {"missing": {"field": "xmlns"}}},
'has_user': {"not": {"missing": {"field": "form.meta.u... | from .es_query import HQESQuery
from . import filters
class FormES(HQESQuery):
index = 'forms'
default_filters = {
'is_xform_instance': {"term": {"doc_type": "xforminstance"}},
'has_xmlns': {"not": {"missing": {"field": "xmlns"}}},
'has_user': {"not": {"missing": {"field": "form.meta.u... |
Make hashmaploader use Map instead of hashmap | package org.twig.loader;
import org.twig.exception.LoaderException;
import java.util.HashMap;
import java.util.Map;
/**
* Used for unit tests only
*/
public class HashMapLoader implements Loader {
Map<String, String> hashMap;
/**
* Default constructor
*/
public HashMapLoader() {
hash... | package org.twig.loader;
import org.twig.exception.LoaderException;
import java.util.HashMap;
/**
* Used for unit tests only
*/
public class HashMapLoader implements Loader {
HashMap<String, String> hashMap;
/**
* Default constructor
*/
public HashMapLoader() {
hashMap = new HashMap<... |
Make command invisible by default | import random
from discord.ext import commands
from lxml import etree
class NSFW:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['gel'], hidden=True)
async def gelbooru(self, ctx, *, tags):
async with ctx.typing():
entries = []
url = 'http://ge... | import random
from discord.ext import commands
from lxml import etree
class NSFW:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['gel'])
async def gelbooru(self, ctx, *, tags):
async with ctx.typing():
entries = []
url = 'http://gelbooru.com/in... |
Add 'My Image Requests' to secondary image navigation | define(function (require) {
var React = require('react/addons'),
Router = require('react-router'),
Glyphicon = require('components/common/Glyphicon.react'),
context = require('context');
return React.createClass({
renderRoute: function (name, linksTo, icon, requiresLogin) {
if (requiresLogi... | define(function (require) {
var React = require('react/addons'),
Router = require('react-router'),
Glyphicon = require('components/common/Glyphicon.react'),
context = require('context');
return React.createClass({
renderRoute: function (name, linksTo, icon, requiresLogin) {
if (requiresLogi... |
Allow turning off coverage reporting for performance tests | /*eslint-env node */
/*eslint no-var: 0 */
var coverage = String(process.env.COVERAGE)!=='false';
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha'].concat(coverage ? 'coverage' : []),
coverageReporter: {
reporters: [
{
type: 'text-summary'
... | /*eslint-env node */
/*eslint no-var: 0 */
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha', 'coverage'],
coverageReporter: {
reporters: [
{
type: 'text-summary'
},
{
type: 'html',
dir: 'coverage'
}
]
},
browsers... |
Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... |
Change to package.json to enable source map | var path = require('path');
var webpack = require('webpack');
var configFile = require('./settings/config.json');
module.exports = {
entry: [
path.resolve(__dirname, 'app/main.js')
],
devtool: "#cheap-eval-source-map",
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '... | var path = require('path');
var webpack = require('webpack');
var configFile = require('./settings/config.json');
module.exports = {
entry: [
path.resolve(__dirname, 'app/main.js')
],
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'bundle.js',
... |
Handle null case for client id | "use strict";
var restify = require('restify');
var async = require('async');
var Anyfetch = require('anyfetch');
module.exports.get = function get(req, res, next) {
if(!req.query.context) {
return next(new restify.ConflictError("Missing query parameter"));
}
async.waterfall([
function getDocuments(cb)... | "use strict";
var restify = require('restify');
var async = require('async');
var Anyfetch = require('anyfetch');
module.exports.get = function get(req, res, next) {
if(!req.query.context) {
return next(new restify.ConflictError("Missing query parameter"));
}
async.waterfall([
function getDocuments(cb)... |
Rename state variable to baseState | import React from 'react';
const mapValuesToDefaultState = (defaultState, item) => {
if (typeof item === 'string') {
defaultState[item] = '';
}
if (typeof item === 'object') {
const { key, value } = item;
defaultState[key] = value;
}
}
const withLinkState = (baseState = []) =>... | import React from 'react';
const mapValuesToDefaultState = (defaultState, item) => {
if (typeof item === 'string') {
defaultState[item] = '';
}
if (typeof item === 'object') {
const { key, value } = item;
defaultState[key] = value;
}
}
const withLinkState = (state = []) => Com... |
Fix select element global listener | $(function() {
$('.dropdown').each(function() {
var me = $(this);
var dropdownList = me.find(".dropdownList");
if(dropdownList.children().length === 0) {
me.find("option").each(function(i, e) {
$(e).addClass("opt-" + i);
dropdownList.append($('<li ... | $(function() {
$('.dropdown').each(function() {
var element = $(this);
var dropdownList = element.find(".dropdownList");
if(dropdownList.children().length === 0) {
element.find("option").each(function(i, e) {
$(e).addClass("opt-" + i);
dropdownLis... |
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
--HG--
extra : convert_revision : e026073455a73c9fe9a9f026b76ac783b2a12d23 | # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInli... | from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInline
from django.contrib.admin.sites import AdminSite, site
def autodiscover():
"""
Auto-discover INSTALLED_APPS admin.py modules and fail silently when
not present. T... |
Change in warning message when user attempts to change task storage directory | package seedu.task.alerts;
import java.util.Optional;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
//@@author A0142360U
public class TransferTaskAlert extends Alert {
public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change of Task Storage Directory";
public static f... | package seedu.task.alerts;
import java.util.Optional;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
//@@author A0142360U
public class TransferTaskAlert extends Alert {
public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change of Task Storage Directory";
public static f... |
Use ParticleData class in file reader
File reader now creates lists of ParticleData objects.
Signed-off-by: Jussi Auvinen <16b8c81f9479dec4f5eedf7ae5a2413c6a10bc13@phy.duke.edu> | #!/usr/bin/python
# Functions for reading hybrid model output(s)
import os
import copy
from .. import dataobjects.particledata
def read_afterburner_output(filename, read_initial=False):
id_event = 0
if os.path.isfile(filename):
read_data = False
initial_list = False
eventlist = []
... | #!/usr/bin/python
# Functions for reading hybrid model output(s)
import os
def read_afterburner_output(filename, read_initial=False):
id_event = 0
particlelist = []
if os.path.isfile(filename):
read_data = False
initial_list = False
for line in open(filename, "r"):
inp... |
Use github URL instead of documentation. | """
Powerful and Lightweight Python Tree Data Structure with various plugins.
"""
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
config = {
'name': "anytree",
'version': "1.0.1",
'author': 'c0fec0de',
'a... | """
Powerful and Lightweight Python Tree Data Structure with various plugins.
"""
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
config = {
'name': "anytree",
'version': "1.0.1",
'author': 'c0fec0de',
'a... |
Fix exception when task result is null | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
start = 0
while True:
... | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
start = 0
while True:
... |
Set each bookmark's identifier on its DOM element 'id' attribute. |
( function( global, chrome, d )
{
// I know, UGLY, but it's just a prototype.
// FIXME: Refactor, improve, rewrite from scrath, whatever but make it pretty and efficient !
function View( $element, manager )
{
this.manager = manager;
this.$left = $element.find( '.left' );
th... |
( function( global, chrome, d )
{
// I know, UGLY, but it's just a prototype.
function View( $element, manager )
{
this.manager = manager;
this.$left = $element.find( '.left' );
this.$right = $element.find( '.right' );
}
View.prototype.display = function()
{
... |
Update logging to log async functions properly | import sys
import inspect
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(function)
def wrapped_function... | import sys
from functools import wraps, _make_key
import redis
def logging(*triggers, out=sys.stdout):
"""Will log function if all triggers are True"""
log = min(triggers) # will be False if any trigger is false
def wrapper(function):
@wraps(function)
def wrapped_function(*args, **kwarg... |
Update to Apache Airflow 1.8.1 | from setuptools import setup
from os import path
import codecs
here = path.abspath(path.dirname(__file__))
with codecs.open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='data-tracking',
version='1.5.11',
zip_safe=False,
url='https://github.com/LRE... | from setuptools import setup
from os import path
import codecs
here = path.abspath(path.dirname(__file__))
with codecs.open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='data-tracking',
version='1.5.11',
zip_safe=False,
url='https://github.com/LRE... |
Add page_* prefix to values set in the PageInfo js | <?php
/**
* @package Mautic
* @copyright 2016 Mautic Contributors. All rights reserved.
* @author Mautic
* @link http://mautic.org
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Mautic\PageBundle\EventListener;
use Mautic\CoreBundle\EventListener\CommonSubscriber;... | <?php
/**
* @package Mautic
* @copyright 2016 Mautic Contributors. All rights reserved.
* @author Mautic
* @link http://mautic.org
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Mautic\PageBundle\EventListener;
use Mautic\CoreBundle\EventListener\CommonSubscriber;... |
Fix bug when using a custom class (defined via string in config) | <?php
namespace Spatie\MediaLibrary\UrlGenerator;
use Spatie\MediaLibrary\Media;
use Spatie\MediaLibrary\PathGenerator\PathGeneratorFactory;
class UrlGeneratorFactory
{
public static function createForMedia(Media $media)
{
$urlGeneratorClass = 'Spatie\MediaLibrary\UrlGenerator\\'.ucfirst($media->getD... | <?php
namespace Spatie\MediaLibrary\UrlGenerator;
use Spatie\MediaLibrary\Media;
use Spatie\MediaLibrary\PathGenerator\PathGeneratorFactory;
class UrlGeneratorFactory
{
public static function createForMedia(Media $media)
{
$urlGeneratorClass = 'Spatie\MediaLibrary\UrlGenerator\\'.ucfirst($media->getD... |
Fix indentation + remove underscore to private member | <?php
/**
* @title User API Ajax Class
*
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2013-2017, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package ... | <?php
/**
* @title User API Ajax Class
*
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2013-2017, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package ... |
Add timer and remove confirm buttonk, overall cleanup for better ux | var deleteOpenSession = function(timeslot_id){
event.preventDefault();
$("#modal_remote").modal('hide');
swal({
title: "Are you sure you wish to cancel?",
text: "This will delete your mentoring timeslot.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#EF5350",
... | var deleteOpenSession = function(timeslot_id){
event.preventDefault();
$("#modal_remote").modal('hide');
swal({
title: "Are you sure you wish to cancel?",
text: "This will delete your mentoring timeslot.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#EF5350",
... |
Move extra log params under 'janus' namespace | var _ = require('underscore');
var layouts = require('log4js').layouts;
var sprintf = require("sprintf-js").sprintf;
var stringify = require('json-stringify-safe');
var NestedError = require('nested-error-stacks');
var isPlainObject = require('is-plain-object');
var Log4jsJsonLayout = {
process: function(logEvent) {... | var _ = require('underscore');
var layouts = require('log4js').layouts;
var sprintf = require("sprintf-js").sprintf;
var stringify = require('json-stringify-safe');
var NestedError = require('nested-error-stacks');
var isPlainObject = require('is-plain-object');
var Log4jsJsonLayout = {
process: function(logEvent) {... |
Break infinite loop with Gradle 5.6 when adding configuration for core bom support | package netflix.nebula.dependency.recommender;
import netflix.nebula.dependency.recommender.provider.RecommendationProviderContainer;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
... | package netflix.nebula.dependency.recommender;
import netflix.nebula.dependency.recommender.provider.RecommendationProviderContainer;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
... |
Support when actionhero is installed on read-only filesystem
- Delay creation of log directory until after all config has been loaded | var fs = require('fs');
var cluster = require('cluster');
exports['default'] = {
logger: function(api){
var logger = {transports: []};
// console logger
if(cluster.isMaster){
logger.transports.push(function(api, winston){
return new (winston.transports.Console)({
colorize: true,
... | var fs = require('fs');
var cluster = require('cluster');
exports['default'] = {
logger: function(api){
var logger = {transports: []};
// console logger
if(cluster.isMaster){
logger.transports.push(function(api, winston){
return new (winston.transports.Console)({
colorize: true,
... |
Allow config override for the sm | <?php
namespace mxdiModuleTest;
use mxdiModule\Factory\DiAbstractFactory;
use mxdiModuleTest\TestObjects;
use Zend\ServiceManager as SM;
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
/** @var SM\ServiceManager */
private $sm;
/** @var array */
private $config = [
... | <?php
namespace mxdiModuleTest;
use mxdiModule\Factory\DiAbstractFactory;
use mxdiModuleTest\TestObjects;
use Zend\ServiceManager as SM;
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
/** @var SM\ServiceManager */
private $sm;
/** @var array */
private $config = [
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.