text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Change confusing variable name in e2e test | describe('the Basic example page', function () {
var basicExamplePage = require('./page.js');
beforeEach(function () {
basicExamplePage.get();
});
describe('rendering of the tree data', function () {
it('should render a tree with 3 root nodes', function () {
basicExamplePage.rootNodes.count().th... | describe('the Basic example page', function () {
var basicExamplePage = require('./page.js');
beforeEach(function () {
basicExamplePage.get();
});
describe('rendering of the tree data', function () {
it('should render a tree with 3 root nodes', function () {
basicExamplePage.rootNodes.count().th... |
Throw an error if includeLanguages option is used. | /* eslint-env node */
'use strict';
let path = require('path');
let Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cli-numeral',
included: function(app) {
this.app = app;
if (typeof app.import !== 'function' && app.app) {
this.app = app = app.app;
}
this._super.inclu... | /* eslint-env node */
'use strict';
let path = require('path');
let Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cli-numeral',
included: function(app) {
this.app = app;
if (typeof app.import !== 'function' && app.app) {
this.app = app = app.app;
}
this._super.inclu... |
Make mystery man the default Gravatar image | # place inside a 'templatetags' directory inside the top level of a Django app (not project, must be inside an app)
# at the top of your page template include this:
# {% load gravatar %}
# and to use the url do this:
# <img src="{% gravatar_url 'someone@somewhere.com' %}">
# or
# <img src="{% gravatar_url sometemplatev... | # place inside a 'templatetags' directory inside the top level of a Django app (not project, must be inside an app)
# at the top of your page template include this:
# {% load gravatar %}
# and to use the url do this:
# <img src="{% gravatar_url 'someone@somewhere.com' %}">
# or
# <img src="{% gravatar_url sometemplatev... |
Add name to User model. | from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _
class Organization(models.Model):
name = models.CharField(_('Name'), max_length=80)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Team(... | from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _
class Organization(models.Model):
name = models.CharField(_('Name'), max_length=80)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Team(... |
Rename svg output based on sort attribute | import pygal
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
users = [user for user, _ in sorted_streaks][::-1]
streaks = [getattr(streak, sort) for _, streak in sorted_streaks][::-1]
chart = pygal.Horiz... | import pygal
def horizontal_bar(sorted_streaks, sort_attrib):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort_attrib.
"""
users = [user for user, _ in sorted_streaks][::-1]
streaks = [getattr(streak, sort_attrib) for _, streak in sorted_streaks][::-1]
... |
Add bridge.user to the config. | package org.sagebionetworks.bridge.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class BridgeConfigTest {
@Before
public void before() {... | package org.sagebionetworks.bridge.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class BridgeConfigTest {
@Before
public void before() {... |
Use abstract classes in the runlistener | package de.pitkley.jenkins.plugins.dockerswarmslave;
import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildableItemWithBuildWrappers;
import hudson.model.Run;
import hudson.model.listeners.RunListener;
@Extension
public class DockerSwarmSlaveRunListe... | package de.pitkley.jenkins.plugins.dockerswarmslave;
import hudson.Extension;
import hudson.model.Build;
import hudson.model.Project;
import hudson.model.Run;
import hudson.model.listeners.RunListener;
@Extension
public class DockerSwarmSlaveRunListener extends RunListener<Run<?, ?>> {
@Override
public void o... |
Fix install ways triggering re-indexing recommendation | <?php
class SV_WordCountSearch_Installer
{
public static function install($installedAddon, array $addonData, SimpleXMLElement $xml)
{
$version = isset($installedAddon['version_id']) ? $installedAddon['version_id'] : 0;
if (!(XenForo_Application::get('options')->enableElasticsearch) || !($XenEs... | <?php
class SV_WordCountSearch_Installer
{
public static function install($installedAddon, array $addonData, SimpleXMLElement $xml)
{
$version = isset($installedAddon['version_id']) ? $installedAddon['version_id'] : 0;
if (!(XenForo_Application::get('options')->enableElasticsearch) || !($XenEs... |
Fix test for checking resource PDF generation | """Tests for resource generation."""
import os
import re
import copy
from django.core import management
from config.settings.base import DEFAULT_LANGUAGES as LANGUAGES
from tests.BaseTestWithDB import BaseTestWithDB
from resources.models import Resource
class ResourceGenerationTest(BaseTestWithDB):
"""Tests for ... | """Tests for resource generation."""
import os
import re
from django.core import management
from tests.BaseTestWithDB import BaseTestWithDB
from resources.models import Resource
class ResourceGenerationTest(BaseTestWithDB):
"""Tests for resource generation."""
def test_all_resources_are_generated(self):
... |
Use multiprocessing to get quicker updates from PyPI. | from functools import partial
import subprocess
import multiprocessing
import requests
def get_pkg_info(pkg_name, session):
r = session.get('http://pypi.python.org/pypi/%s/json' % (pkg_name,))
if r.status_code == requests.codes.ok:
return r.json
else:
raise ValueError('Package %r not found... | from functools import partial
import subprocess
import requests
def get_pkg_info(pkg_name, session):
r = session.get('http://pypi.python.org/pypi/%s/json' % (pkg_name,))
if r.status_code == requests.codes.ok:
return r.json
else:
raise ValueError('Package %r not found on PyPI.' % (pkg_name,... |
Support for reading deployment types from beans.xml
git-svn-id: 811cd8a17a8c3c0c263af499002feedd54a892d0@1531 1c488680-804c-0410-94cd-c6b725194a0e | package org.jboss.webbeans.tck;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.List;
import org.jboss.jsr299.tck.api.DeploymentException;
import org.jboss.jsr299.tck.spi.StandaloneContainers;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.mock.MockBootstrap;
import org... | package org.jboss.webbeans.tck;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import javax.inject.manager.Manager;
import org.jboss.jsr299.tck.api.DeploymentException;
import org.jboss.jsr299.tck.spi.StandaloneContainers;
import org.jboss.webbeans.ManagerImpl;
import org.jbo... |
Add path when calling object | <?php
namespace Politix\PolitikportalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
// use Politix\PolitikportalBundle\Model;
class SourcesController extends Controller {
public function indexAction($name) {
$out['items'] = $this->getSource('tagesschau');
$out['name'] =... | <?php
namespace Politix\PolitikportalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
// use Politix\PolitikportalBundle\Model;
class SourcesController extends Controller {
public function indexAction($name) {
$out['items'] = $this->getSource('tagesschau');
$out['name'] =... |
Throw error to console if app fails to boot | <!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ $title }}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<meta name="theme-c... | <!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ $title }}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<meta name="theme-c... |
Drop duplicates when listing transform types
Signed-off-by: Robert D Anderson <4907d442684b61876fae0471c4d2d08024a9ca72@us.ibm.com> | /*
* This file is part of the DITA Open Toolkit project.
*
* Copyright 2011 Jarno Elovirta
*
* See the accompanying LICENSE file for applicable license.
*/
package org.dita.dost.platform;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.... | /*
* This file is part of the DITA Open Toolkit project.
*
* Copyright 2011 Jarno Elovirta
*
* See the accompanying LICENSE file for applicable license.
*/
package org.dita.dost.platform;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.... |
Use old array notation because gnomo is not updated
srsly 2.0. | <?php
class StatisticsHandler
{
function get()
{
/*if (isset($_GET['startDate']) && isset($_GET['endDate'])) {
$start = $_GET['startDate'];
$end = $_GET['endDate'];
global $conn;
$stmt = $conn->prepare("SELECT * FROM get_counts_per_month_year(:startDate,... | <?php
class StatisticsHandler
{
function get()
{
/*if (isset($_GET['startDate']) && isset($_GET['endDate'])) {
$start = $_GET['startDate'];
$end = $_GET['endDate'];
global $conn;
$stmt = $conn->prepare("SELECT * FROM get_counts_per_month_year(:startDate,... |
Test complex polygons and nonsensical nested boxes | // Copyright 2012 - 2015 The ASCIIToSVG Contributors
// All rights reserved.
package asciitosvg
import "testing"
func TestNewCanvas(t *testing.T) {
data := `
+------+
|Editor|-------------+--------+
+------+ | |
| | v
v | ... | // Copyright 2012 - 2015 The ASCIIToSVG Contributors
// All rights reserved.
package asciitosvg
import "testing"
func TestNewCanvas(t *testing.T) {
data := `
+------+
|Editor|-------------+--------+
+------+ | |
| | v
v | ... |
Revert "Revert "Added support for multiple files (excluding minified scripts)""
This reverts commit fde48e384ec241fef5d6c4c80a62e3f32f9cc7ab. | 'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configurable paths
config: {
lintFiles: [
'**/*.js',
'!*.min.js'
]
},
jshint: {
... | 'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configurable paths
config: {
lintFiles: [
'angular-bind-html-compile.js'
]
},
jshint: {
... |
Return dict with selected utxo list and total |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
try:
from peercoin_rpc import Client
except:
raise EnvironmentError("peercoin_rpc library is required for this to work,\
use pip to install it.")
def select_inputs(cls, total_amoun... |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
try:
from peercoin_rpc import Client
except:
raise EnvironmentError("peercoin_rpc library is required for this to work,\
use pip to install it.")
def select_inputs(cls, total_amoun... |
Add property to delay repeat | var React = require('react');
var { Repeat } = require('Immutable');
class ReactTypeInAndOut extends React.Component {
constructor (props) {
super(props);
var words = props.words;
words = words.reduce((acc, word) => {
// include empty string as start/end
word = [... | var React = require('react');
var { Repeat } = require('Immutable');
class ReactTypeInAndOut extends React.Component {
constructor (props) {
super(props);
var words = props.words;
words = words.reduce((acc, word) => {
// include empty string as start/end
word = [... |
Remove an invalid trove classifier.
* setup.py(setuptools.setup): Remove "Intended Audience :: BigDate"
since it's not in pypi's list of valid trove classifiers and
prevents successful upload of the package when present.
Change-Id: Iee487d1737a12158bb181d21ae841d07e0820e10 | import setuptools
from savanna.openstack.common import setup as common_setup
requires = common_setup.parse_requirements()
depend_links = common_setup.parse_dependency_links()
project = 'savanna'
setuptools.setup(
name=project,
version=common_setup.get_version(project, '0.1'),
description='Savanna project... | import setuptools
from savanna.openstack.common import setup as common_setup
requires = common_setup.parse_requirements()
depend_links = common_setup.parse_dependency_links()
project = 'savanna'
setuptools.setup(
name=project,
version=common_setup.get_version(project, '0.1'),
description='Savanna project... |
Hide Python 2.6 Exception.message deprecation warnings | """
Module containing package exception classes.
"""
class Invalid(Exception):
def __init__(self, message, exceptions=None, validator=None):
Exception.__init__(self, message, exceptions)
self.message = message
self.exceptions = exceptions
self.validator = validator
def __str_... | """
Module containing package exception classes.
"""
class Invalid(Exception):
def __init__(self, message, exceptions=None, validator=None):
Exception.__init__(self, message, exceptions)
self.message = message
self.exceptions = exceptions
self.validator = validator
def __str_... |
Use session.store instead of session for Guard instance.
On September 30, commit 3816e425ae3fdaa69474763737d5e906e073c9a9 to
the Laravel framework changed the arguments of the Guard constructor,
so it now takes a Store object instead of a Session object. This one
line patch fixes the issue. | <?php namespace Ccovey\LdapAuth;
use Exception;
use adLDAP\adLDAP;
use Illuminate\Auth\Guard;
use Illuminate\Auth\AuthManager;
/**
*
*/
class LdapAuthManager extends AuthManager
{
/**
*
* @return \Config\Packages\Guard
*/
protected function createLdapDriver()
{
$provider = $this->... | <?php namespace Ccovey\LdapAuth;
use Exception;
use adLDAP\adLDAP;
use Illuminate\Auth\Guard;
use Illuminate\Auth\AuthManager;
/**
*
*/
class LdapAuthManager extends AuthManager
{
/**
*
* @return \Config\Packages\Guard
*/
protected function createLdapDriver()
{
$provider = $this->... |
Add test for too short isin | package name.abuchen.portfolio.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class IsinTest
{
@Test
public void testValidIsin()
{
String ubsIsin = "CH0244767585";
assertTrue(Isin.isValid(ubsIsin));
Strin... | package name.abuchen.portfolio.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class IsinTest
{
@Test
public void testValidIsin()
{
String ubsIsin = "CH0244767585";
assertTrue(Isin.isValid(ubsIsin));
Strin... |
Fix JUnit errors - 11E, 2F
Down from 13E, 2F
Fixed an error related to deleting tasks and unintentionally fixed
another error too. | package seedu.gtd.ui;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.gtd.model.task.ReadOnlyTask;
public class TaskCard extends UiPart{
private static final String FXML = "TaskListCard.fxml";
@FXML
private HBox cardPane... | package seedu.gtd.ui;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.gtd.model.task.ReadOnlyTask;
public class TaskCard extends UiPart{
private static final String FXML = "TaskListCard.fxml";
@FXML
private HBox cardPane... |
Remove entry from coverage reporter | package fixtures.report;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public final class CoverageReporter {
private static AutoRestReportService client = new AutoRestReportServiceImpl("http://localhost:3000");
private CoverageReporter() { }
public static void main(String[] ar... | package fixtures.report;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public final class CoverageReporter {
private static AutoRestReportService client = new AutoRestReportServiceImpl("http://localhost:3000");
private CoverageReporter() { }
public static void main(String[] ar... |
Fix builder to return a literal React component, and supply correct context/args | const babel = require('babel');
const ast = require('./ast');
const extraction = require('./extraction');
const freeVariables = require('./free-variables');
module.exports = function({Plugin, types: t}) {
return new Plugin('transformation', {
visitor: {
JSXElement: function(node, parent) {
... | const babel = require('babel');
const ast = require('./ast');
const extraction = require('./extraction');
const freeVariables = require('./free-variables');
module.exports = function({Plugin, types: t}) {
return new Plugin('transformation', {
visitor: {
JSXElement: function(node, parent) {
... |
Fix a bug that caused improper initialization with overrides | (function( $ ){
$.fn.placeholder = function(restoreOverride, removeOverride){
return $(this).each(function(){
var $this = $(this)
original_color = $this.css('color')
function remove(){
$this.css('color', original_color)
... | (function( $ ){
$.fn.placeholder = function(restoreOverride, removeOverride){
return $(this).each(function(){
var $this = $(this)
original_color = $this.css('color')
function remove(){
$this.css('color', original_color)
... |
Make Dotenv to search for .env file in the document root always | <?php
/**
* This helper package makes a database connection for package Kola\PotatoOrm\Model.
*
* @package Kola\PotatoOrm\Helper\DbConn
* @author Kolawole ERINOSO <kola.erinoso@gmail.com>
* @license MIT <https://opensource.org/licenses/MIT>
*/
namespace Kola\PotatoOrm\Helper;
use Kola\PotatoOrm\Exception\Unsuc... | <?php
/**
* This helper package makes a database connection for package Kola\PotatoOrm\Model.
*
* @package Kola\PotatoOrm\Helper\DbConn
* @author Kolawole ERINOSO <kola.erinoso@gmail.com>
* @license MIT <https://opensource.org/licenses/MIT>
*/
namespace Kola\PotatoOrm\Helper;
use Kola\PotatoOrm\Exception\Unsuc... |
Return all don't executed commands | <?php
namespace Command;
use Database\Connect;
use Config\Config;
class getData
{
/**
* setData constructor.
*
* @param \Aura\Web\Request $request
* @param \Aura\Web\Response $response
* @param \Aura\View\View $view
*/
public function __construct($request, $response, $view)
... | <?php
namespace Command;
use Database\Connect;
use Config\Config;
class getData
{
/**
* setData constructor.
*
* @param \Aura\Web\Request $request
* @param \Aura\Web\Response $response
* @param \Aura\View\View $view
*/
public function __construct($request, $response, $view)
... |
Replace bankid with fid to avoid duplicate config options. | """OFX downloader."""
from ofxtools.Client import OFXClient, BankAcct
from ofxtools.Types import DateTime
from yapsy.IPlugin import IPlugin
def make_date_kwargs(config):
return {k:DateTime().convert(v) for k,v in config.items() if k.startswith('dt')}
class OFXDownload(IPlugin):
"""OFX plugin class."""
... | """OFX downloader."""
from ofxtools.Client import OFXClient, BankAcct
from ofxtools.Types import DateTime
from yapsy.IPlugin import IPlugin
def make_date_kwargs(config):
return {k:DateTime().convert(v) for k,v in config.items() if k.startswith('dt')}
class OFXDownload(IPlugin):
"""OFX plugin class."""
... |
Call 'getSystemInfo' only on success | (function(globalSettings, $, _, window, undefined) {
var Application = window.Application,
settings = globalSettings.SysMonitor;
var SystemMonitorView = Backbone.View.extend({
initialize: function(options) {
this.templateSelectorPrefix = '#js-tmpl-sysmonitor-';
this.syst... | (function(globalSettings, $, _, window, undefined) {
var Application = window.Application,
settings = globalSettings.SysMonitor;
var SystemMonitorView = Backbone.View.extend({
initialize: function(options) {
this.templateSelectorPrefix = '#js-tmpl-sysmonitor-';
this.syst... |
Correct argument type for event collection creation | <?php
/**
* Copyright 2017 SURFnet B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | <?php
/**
* Copyright 2017 SURFnet B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Add --dev command line arg | import coloredlogs
import logging.handlers
from argparse import ArgumentParser
def get_args():
parser = ArgumentParser()
parser.add_argument(
"-H", "--host",
dest="host",
help="hostname to listen on"
)
parser.add_argument(
"-p", "--port",
dest="port",
... | import coloredlogs
import logging.handlers
from argparse import ArgumentParser
def get_args():
parser = ArgumentParser()
parser.add_argument(
"-H", "--host",
dest="host",
help="hostname to listen on"
)
parser.add_argument(
"-p", "--port",
dest="port",
... |
Add doc string to Snippet.get_files | import os
from os import path
import glob
import json
import subprocess
class Snippet(object):
def __init__(self, config, username, snippet_id):
self.config = config
self.username = username
self.snippet_id = snippet_id
repo_parent = path.join(self.config.get('snippet_home'), use... | import os
from os import path
import glob
import json
import subprocess
class Snippet(object):
def __init__(self, config, username, snippet_id):
self.config = config
self.username = username
self.snippet_id = snippet_id
repo_parent = path.join(self.config.get('snippet_home'), use... |
Add Wikidata as shared data repository for Commons.
Change-Id: Ie79e3157d016fc74e400ddc618c04f2d1d39f17d | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... |
Fix server config in client | module.exports = function(RED) {
var artemisNet = require('./artemisNet'),
artemisModel = require('./public/javascripts/worldmodel');
function ArtemisClient(config) {
RED.nodes.createNode(this, config);
var node = this;
this.status({fill:"red", shape:"ring",text:"disconnected"}... | module.exports = function(RED) {
var artemisNet = require('./artemisNet'),
artemisModel = require('./public/javascripts/worldmodel');
function ArtemisClient(config) {
RED.nodes.createNode(this,config);
var node = this;
this.status({fill:"red", shape:"ring",text:"disconnected"}... |
Work around deprecation warning with new cssutils versions. | import logging
import logging.handlers
from django.conf import settings
from django_assets.filter import BaseFilter
__all__ = ('CSSUtilsFilter',)
class CSSUtilsFilter(BaseFilter):
"""Minifies CSS by removing whitespace, comments etc., using the Python
`cssutils <http://cthedot.de/cssutils/>`_ l... | import logging
import logging.handlers
from django.conf import settings
from django_assets.filter import BaseFilter
__all__ = ('CSSUtilsFilter',)
class CSSUtilsFilter(BaseFilter):
"""Minifies CSS by removing whitespace, comments etc., using the Python
`cssutils <http://cthedot.de/cssutils/>`_ l... |
Raise an error if no file is specified | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Command line utility for proselint."""
import click
import os
import imp
def log_error(line, column, error_code, msg):
"""Print a message to the command line."""
click.echo(str(line) + ":" +
str(column) + " \t" +
error_code + ": " +
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Command line utility for proselint."""
import click
import os
import imp
def log_error(line, column, error_code, msg):
"""Print a message to the command line."""
click.echo(str(line) + ":" +
str(column) + " \t" +
error_code + ": " +
... |
Update form to handle notes about funding | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
exclude = [
"home_lon",
"home_lat",
"inauguration_year",
"funding_notes",
... | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
exclude = [
"home_lon",
"home_lat",
"inauguration_year",
"mentor",
]
... |
Allow proxy minions to load static grains
Add the `__proxyenabled__` global var so the extra grains are loaded.
Inside the `config` function of the extra grains check if the minion
is a proxy, then try loading from <conf_file>/proxy.d/<proxy id>/grains. | # -*- coding: utf-8 -*-
from __future__ import absolute_import
# Import python libs
import os
# Import third party libs
import yaml
import logging
# Import salt libs
import salt.utils
__proxyenabled__ = ['*']
log = logging.getLogger(__name__)
def shell():
'''
Return the default shell to use on this syste... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
# Import python libs
import os
# Import third party libs
import yaml
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def shell():
'''
Return the default shell to use on this system
'''
# Provides:... |
Update JavaDoc references in EvalCommand | package org.metaborg.spoofax.shell.commands;
import java.util.function.Consumer;
import com.google.inject.Inject;
import com.google.inject.name.Named;
/**
* Command for evaluating the String as an expression in some language.
*/
public class SpoofaxEvaluationCommand implements IReplCommand {
private static fin... | package org.metaborg.spoofax.shell.commands;
import java.util.function.Consumer;
import com.google.inject.Inject;
import com.google.inject.name.Named;
/**
* Command for evaluating the String as an expression in some language.
*/
public class SpoofaxEvaluationCommand implements IReplCommand {
private static fin... |
Fix home virtool version display | import React from "react";
import { get } from "lodash-es";
import { connect } from "react-redux";
import { Panel } from "react-bootstrap";
import { getSoftwareUpdates } from "../../updates/actions";
import { Icon } from "../../base";
class Welcome extends React.Component {
componentDidMount () {
this.pr... | import React from "react";
import { get } from "lodash-es";
import { connect } from "react-redux";
import { Panel } from "react-bootstrap";
import { getSoftwareUpdates } from "../../updates/actions";
import { Icon } from "../../base";
class Welcome extends React.Component {
componentDidMount () {
this.pr... |
Return null for an empty patch for now | import React from 'react';
import PropTypes from 'prop-types';
import yubikiri from 'yubikiri';
import {autobind} from '../helpers';
import ObserveModel from '../views/observe-model';
import FilePatchController from '../controllers/file-patch-controller';
export default class FilePatchContainer extends React.Componen... | import React from 'react';
import PropTypes from 'prop-types';
import yubikiri from 'yubikiri';
import {autobind} from '../helpers';
import ObserveModel from '../views/observe-model';
import FilePatchController from '../controllers/file-patch-controller';
export default class FilePatchContainer extends React.Componen... |
Use two LSTM LM’s instead of single huge one | from keras.layers import LSTM, Input, Reshape
from keras.models import Model
from ..layers import LMMask, Projection
class LanguageModel(Model):
def __init__(self, n_batch, d_W, d_L, trainable=True):
"""
n_batch :: batch size for model application
d_L :: language model state dimension (and ou... | from keras.layers import LSTM, Input, Reshape
from keras.models import Model
from ..layers import LMMask, Projection
class LanguageModel(Model):
def __init__(self, n_batch, d_W, d_L, trainable=True):
"""
n_batch :: batch size for model application
d_L :: language model state dimension (and ou... |
Check before casting a null. | package com.kolinkrewinkel.BitLimitBlockRegression;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
/**
* Created with IntelliJ IDEA.
* User: kolin
* Date: 7/14/13
* Time: 4:26 PM
* To change this template use File | Settings ... | package com.kolinkrewinkel.BitLimitBlockRegression;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
/**
* Created with IntelliJ IDEA.
* User: kolin
* Date: 7/14/13
* Time: 4:26 PM
* To change this template use File | Settings ... |
Add contrib package to deployment | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'pyj... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'pyj... |
Fix missing space between base icon classes and extra icon classes. | <?php
/**
* FontAwesome Helper
*
* PHP 5
*
* @copyright Copyright (c) Sylvain Lévesque (http://www.gezere.com)
* @link http://www.gezere.com
* @package app.View.Helper
*/
class FontawesomeHelper extends AppHelper {
/**
* Create a Fontawesome Icon
*
* Inspired by @webandcow Thanks !
*
... | <?php
/**
* FontAwesome Helper
*
* PHP 5
*
* @copyright Copyright (c) Sylvain Lévesque (http://www.gezere.com)
* @link http://www.gezere.com
* @package app.View.Helper
*/
class FontawesomeHelper extends AppHelper {
/**
* Create a Fontawesome Icon
*
* Inspired by @webandcow Thanks !
*
... |
Set attachment color based on log level | import json
import traceback
from logging import Handler, CRITICAL, ERROR, WARNING
from slacker import Slacker
ERROR_COLOR = 'danger' # color name is built in to Slack API
WARNING_COLOR = 'warning' # color name is built in to Slack API
INFO_COLOR = '#439FE0'
COLORS = {
CRITICAL: ERROR_COLOR,
ERROR: ERROR_C... | import json
import traceback
from logging import Handler
from slacker import Slacker
class SlackLogHandler(Handler):
def __init__(self, api_key, channel, stack_trace=False, username='Python logger', icon_url=None, icon_emoji=None):
Handler.__init__(self)
self.slack_chat = Slacker(api_key)
... |
Fix meetup date in builder | <?php
namespace Techlancaster\Bundle\WebBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$men... | <?php
namespace Techlancaster\Bundle\WebBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$men... |
Make tests work with php 5.4 | <?php
use PHPUnit\Framework\TestCase;
use Ratchet\Client\Connector;
use React\EventLoop\Factory;
use React\Promise\RejectedPromise;
class ConnectorTest extends TestCase
{
public function uriDataProvider() {
return [
['ws://127.0.0.1', 'tcp://127.0.0.1:80'],
['wss://127.0.0.1', 'tls... | <?php
use PHPUnit\Framework\TestCase;
use Ratchet\Client\Connector;
use React\EventLoop\Factory;
use React\Promise\RejectedPromise;
use React\Socket\ConnectorInterface as ReactConnector;
class ConnectorTest extends TestCase
{
public function uriDataProvider() {
return [
['ws://127.0.0.1', 'tcp... |
Document the application name parameter. | <?php
namespace Nubs\PwMan;
use Exception;
/**
* Manage the collection of passwords.
*/
class PasswordManager
{
/** @type array<array> The passwords. */
private $_passwords;
/**
* Initialize the password manager.
*
* @param array<array> The passwords.
*/
public function __constr... | <?php
namespace Nubs\PwMan;
use Exception;
/**
* Manage the collection of passwords.
*/
class PasswordManager
{
/** @type array<array> The passwords. */
private $_passwords;
/**
* Initialize the password manager.
*
* @param array<array> The passwords.
*/
public function __constr... |
Clean up autocomplete API load code
Move the logic to a separate function, call it from componentDidMount(). | 'use strict';
import React, { Component, PropTypes } from 'react';
import Button from './Button';
import TextInput from './TextInput';
import { destTextInputStyle, errorMessageStyle } from '../stylesheets/styles';
class CreateTripPage extends Component {
componentDidMount() {
this.loadGoogleAutocompleteAPI();
... | 'use strict';
import React, { Component, PropTypes } from 'react';
import Button from './Button';
import TextInput from './TextInput';
import { destTextInputStyle, errorMessageStyle } from '../stylesheets/styles';
class CreateTripPage extends Component {
componentDidMount() {
const { onEnterDestination } = this... |
Add Ordering and PaginationMixin on Listview | from django.views.generic import DetailView
from django.views.generic import ListView
from django.shortcuts import redirect, render
from pure_pagination import PaginationMixin
from .forms import PresentationCreateForm
from .models import Presentation, Slide
class PresentationList(PaginationMixin, ListView):
mod... | from django.views.generic import DetailView
from django.views.generic import ListView
from django.shortcuts import redirect, render
from .forms import PresentationCreateForm
from .models import Presentation, Slide
class PresentationList(ListView):
model = Presentation
paginate_by = 9
context_object_name ... |
Create metaproject with user-provided description. | # -*- coding: utf-8 -*-
# Ingestion service: create a metaproject (tag) with user-defined name in given space
def process(transaction, parameters, tableBuilder):
"""Create a project with user-defined name in given space.
"""
# Prepare the return table
tableBuilder.addHeader("success")
tableBuilde... | # -*- coding: utf-8 -*-
# Ingestion service: create a metaproject (tag) with user-defined name in given space
def process(transaction, parameters, tableBuilder):
"""Create a project with user-defined name in given space.
"""
# Prepare the return table
tableBuilder.addHeader("success")
tableBuilde... |
Disable tests that aren't network-stable. | #!/usr/bin/env python3
"""
test for the Psas module.
"""
import unittest
from base_test import PschedTestBase
from pscheduler.psas import as_bulk_resolve
class TestPsas(PschedTestBase):
"""
Psas tests.
"""
def test_bulk_resolve(self):
"""Bulk resolve test"""
ips = [
'8.... | #!/usr/bin/env python3
"""
test for the Psas module.
"""
import unittest
from base_test import PschedTestBase
from pscheduler.psas import as_bulk_resolve
class TestPsas(PschedTestBase):
"""
Psas tests.
"""
def test_bulk_resolve(self):
"""Bulk resolve test"""
ips = [
'8.... |
fix(select-feed): Make sure the feed exists before checking its routes | /** Select a (group of) patterns from the GTFS feed */
import React, {Component, PropTypes} from 'react'
import SelectPatterns from './select-patterns'
import SelectFeedAndRoutes from './select-feed-and-routes'
export default class SelectFeedRouteAndPatterns extends Component {
static propTypes = {
feed: PropT... | /** Select a (group of) patterns from the GTFS feed */
import React, {Component, PropTypes} from 'react'
import SelectPatterns from './select-patterns'
import SelectFeedAndRoutes from './select-feed-and-routes'
export default class SelectFeedRouteAndPatterns extends Component {
static propTypes = {
feed: PropT... |
Update dashboard nav sign out. | import React from 'react';
import Anchor from 'grommet/components/Anchor';
import Box from 'grommet/components/Box';
import Header from 'grommet/components/Header';
import Heading from 'grommet/components/Heading';
import Menu from 'grommet/components/Menu';
import Image from 'grommet/components/Image';
const CLASS_RO... | import React from 'react';
import Anchor from 'grommet/components/Anchor';
import Box from 'grommet/components/Box';
import Header from 'grommet/components/Header';
import Heading from 'grommet/components/Heading';
import Menu from 'grommet/components/Menu';
import Image from 'grommet/components/Image';
const CLASS_RO... |
BAP-2013: Create locale kernel listener
- added listener | <?php
namespace Oro\Bundle\LocaleBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Translation\TranslatorInte... | <?php
namespace Oro\Bundle\LocaleBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Translation\TranslatorInte... |
Dimension: Add dtype of iteration variable | import cgen
import numpy as np
from sympy import Symbol
__all__ = ['Dimension', 'x', 'y', 'z', 't', 'p']
class Dimension(Symbol):
"""Index object that represents a problem dimension and thus
defines a potential iteration space.
:param size: Optional, size of the array dimension.
:param buffered: O... | import cgen
from sympy import Symbol
__all__ = ['Dimension', 'x', 'y', 'z', 't', 'p']
class Dimension(Symbol):
"""Index object that represents a problem dimension and thus
defines a potential iteration space.
:param size: Optional, size of the array dimension.
:param buffered: Optional, boolean flag... |
Use `modules: false` for client-side code | module.exports = {
presets: [
['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', modules: false }],
'@babel/preset-react',
'@babel/preset-flow',
],
plugins: [
'babel-plugin-emotion',
'babel-plugin-macros',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-pro... | module.exports = {
presets: [
['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage' }],
'@babel/preset-react',
'@babel/preset-flow',
],
plugins: [
'babel-plugin-emotion',
'babel-plugin-macros',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-res... |
Fix errors with new thumbnail helper. | @extends('app')
@section('title', $candidate->name)
@section('meta_title', $candidate->name)
@section('meta_description', 'Vote for ' . $candidate->name . ' in ' . setting('site_title') . '.')
@section('meta_image', URL::to($candidate->thumbnail))
@section('content')
<div class="candidate">
<div class="ca... | @extends('app')
@section('title', $candidate->name)
@section('meta_title', $candidate->name)
@section('meta_description', 'Vote for ' . $candidate->name . ' in ' . setting('site_title') . '.')
@section('meta_image', URL::to($candidate->thumbnail()))
@section('content')
<div class="candidate">
<div class="... |
Move the render_index() function out of the constructor and use add_url_rule() instead of the route() decorator to connect it to Flask. | """Analysis module for Databench."""
from flask import Blueprint, render_template
import databench.signals
LIST_ALL = []
class Analysis(object):
"""Databench's analysis class.
An optional :class:`databench.Signals` instance and :class:`flask.Blueprint`
can be dependency-injected, however that should n... | """Analysis module for Databench."""
from flask import Blueprint, render_template
import databench.signals
LIST_ALL = []
class Analysis(object):
"""Databench's analysis class.
An optional :class:`databench.Signals` instance and :class:`flask.Blueprint`
can be dependency-injected, however that should n... |
Use node id (not project id) to create component Subscriptions | from framework.auth.decorators import must_be_logged_in
from model import Subscription
from flask import request
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from modularodm.storage.mongostorage import KeyExistsException
@must_be_logged_in
def subscribe(auth, **kwargs):
user = auth.us... | from framework.auth.decorators import must_be_logged_in
from model import Subscription
from flask import request
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from modularodm.storage.mongostorage import KeyExistsException
@must_be_logged_in
def subscribe(auth, **kwargs):
user = auth.us... |
Fix regression in displaying a thumbnail for newly selected images on FileBrowseField. | function FileSubmit(FilePath, FileURL, ThumbURL, FileType) {
// var input_id=window.name.split("___").join(".");
var input_id=window.name.replace(/____/g,'-').split("___").join(".");
var preview_id = 'image_' + input_id;
var link_id = 'link_' + input_id;
var help_id = 'help_' + input_id;
var cl... | function FileSubmit(FilePath, FileURL, ThumbURL, FileType) {
// var input_id=window.name.split("___").join(".");
var input_id=window.name.replace(/____/g,'-').split("___").join(".");
var preview_id = 'image_' + input_id;
var link_id = 'link_' + input_id;
var help_id = 'help_' + input_id;
var cl... |
Use official Flask-Script distribution (>= 0.3.2) | """
Flask-Celery
------------
Celery integration for Flask
"""
from setuptools import setup
setup(
name='Flask-Celery',
version='2.4.1',
url='http://github.com/ask/flask-celery/',
license='BSD',
author='Ask Solem',
author_email='ask@celeryproject.org',
description='Celery integration for ... | """
Flask-Celery
------------
Celery integration for Flask
"""
from setuptools import setup
setup(
name='Flask-Celery',
version='2.4.1',
url='http://github.com/ask/flask-celery/',
license='BSD',
author='Ask Solem',
author_email='ask@celeryproject.org',
description='Celery integration for ... |
Remove hot loader from webpack config | var webpack = require('webpack');
var path = require('path');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: [
'./index.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0... | var webpack = require('webpack');
var path = require('path');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: [
'./index.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0... |
Add test for states() method shortcut | <?php
use Galahad\LaravelAddressing\AdministrativeAreaCollection;
use Galahad\LaravelAddressing\Country;
/**
* Class AdministrativeAreaCollectionTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class AdministrativeAreaCollectionTest extends PHPUnit_Framework_TestCase
{
public function testCollectionCla... | <?php
use Galahad\LaravelAddressing\AdministrativeAreaCollection;
use Galahad\LaravelAddressing\Country;
/**
* Class AdministrativeAreaCollectionTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class AdministrativeAreaCollectionTest extends PHPUnit_Framework_TestCase
{
public function testCollectionCla... |
Update name of Eidos reading class | import json
from indra.java_vm import autoclass, JavaException
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings are done with the same
in... | import json
from indra.java_vm import autoclass, JavaException
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings are done with the same
in... |
Add google map component under city heading | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Chart from '../components/chart';
import GoogleMap from '../components/google_map';
class WeatherList extends Component {
renderWeather(cityData) {
const name = cityData.city.name;
const temps = cityData.list.map(weather ... | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Chart from '../components/chart';
class WeatherList extends Component {
renderWeather(cityData) {
const name = cityData.city.name;
const temps = cityData.list.map(weather => weather.main.temp);
const pressures = cityD... |
Use logger for hades-generate-config error messages | import logging
import os
import sys
from hades import constants
from hades.common.cli import ArgumentParser, parser as common_parser
from hades.config.generate import ConfigGenerator
from hades.config.loader import load_config
logger = logging.getLogger()
def main():
parser = ArgumentParser(parents=[common_pars... | import os
import sys
from hades import constants
from hades.common.cli import ArgumentParser, parser as common_parser
from hades.config.generate import ConfigGenerator
from hades.config.loader import load_config
def main():
parser = ArgumentParser(parents=[common_parser])
parser.add_argument(dest='source', m... |
Change `npm run dev` to `npm run local` | <?php
namespace TightenCo\Jigsaw\Scaffold;
class DefaultInstaller
{
const ALWAYS_IGNORE = [
'build_*',
'init.php',
'node_modules',
'vendor',
];
const DEFAULT_COMMANDS = [
'composer install',
'npm install',
'npm run local',
];
protected $comma... | <?php
namespace TightenCo\Jigsaw\Scaffold;
class DefaultInstaller
{
const ALWAYS_IGNORE = [
'build_*',
'init.php',
'node_modules',
'vendor',
];
const DEFAULT_COMMANDS = [
'composer install',
'npm install',
'npm run dev',
];
protected $command... |
Fix bug when Opera Mini (and possibly others) present no X-OperaMini-Phone header. | from django.conf import settings
import geolocation
from mobile_portal.wurfl.wurfl_data import devices
from mobile_portal.wurfl import device_parents
from pywurfl.algorithms import DeviceNotFound
from mobile_portal.wurfl.vsm import VectorSpaceAlgorithm
class LocationMiddleware(object):
vsa = VectorSpaceAlgorithm(... | from django.conf import settings
import geolocation
from mobile_portal.wurfl.wurfl_data import devices
from mobile_portal.wurfl import device_parents
from pywurfl.algorithms import DeviceNotFound
from mobile_portal.wurfl.vsm import VectorSpaceAlgorithm
class LocationMiddleware(object):
vsa = VectorSpaceAlgorithm(... |
Test against all javascript compressors, and the return compressor for reference | <?php
/*
* This file is part of HtmlCompress.
*
** (c) 2014 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\HtmlCompress\Tests\SpecialFormats;
use WyriHaximus\HtmlCompress\Compressor;
class... | <?php
/*
* This file is part of HtmlCompress.
*
** (c) 2014 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\HtmlCompress\Tests\SpecialFormats;
use WyriHaximus\HtmlCompress\Compressor;
class... |
Update install requires, add opps >= 0.2 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='opps-admin',
version='0.1',
description='Opps Admin, drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.',
long_description=open('README... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='opps-admin',
version='0.1',
description='Opps Admin, drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.',
long_description=open('README... |
Fix bug for release status | package fr.synchrotron.soleil.ica.ci.lib.workflow;
import java.util.Arrays;
/**
* @author Gregory Boissinot
*/
public class DefaultWorkflow extends Workflow {
private static final String DEFAULT_STATUS_BUILD = "BUILD";
private static final String DEFAULT_STATUS_INTEGRATION = "INTEGRATION";
private stat... | package fr.synchrotron.soleil.ica.ci.lib.workflow;
import java.util.Arrays;
/**
* @author Gregory Boissinot
*/
public class DefaultWorkflow extends Workflow {
private static final String DEFAULT_STATUS_BUILD = "BUILD";
private static final String DEFAULT_STATUS_INTEGRATION = "INTEGRATION";
private stat... |
Use real path for views instead of alias | <?php
/**
* README plugin for HiDev
*
* @link https://github.com/hiqdev/hidev-readme
* @package hidev-readme
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/
return [
'controllerMap' => [
'README' => [
'class' => \hidev\readme\console\... | <?php
/**
* README plugin for HiDev
*
* @link https://github.com/hiqdev/hidev-readme
* @package hidev-readme
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/
return [
'controllerMap' => [
'README' => [
'class' => \hidev\readme\console\... |
Implement scalar/vector multiply and divide | export default class Vector2 {
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
add(vec2) {
this.x = vec2.x;
this.y = vec2.y;
return this;
}
subtract(vec2) {
th... | export default class Vector2 {
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
add(vec2) {
this.x = vec2.x;
this.y = vec2.y;
return this;
}
subtract(vec2) {
th... |
Make Selenium shut down after it's done | #!/usr/bin/python
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as ui
import re
import atexit
disp = Display(visible=0, size=(800,600))
atexit.regist... | #!/usr/bin/python
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as ui
import re
import atexit
disp = Display(visible=0, size=(800,600))
atexit.regist... |
Fix app crash from our pagination when editing invalid things
Addresses the most important part of #1742 , next patch will be to make
it so we just navigate away from the detail page if we delete the item
we're on. | /*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default ['$http', '$q', function($http, $q) {
return {
getInitialPageForList: function(id, url, pageSize) {
// get the name... | /*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default ['$http', '$q', function($http, $q) {
return {
getInitialPageForList: function(id, url, pageSize) {
// get the name... |
Make functions static to prevent deprecated warnings | <?php
namespace Recras;
class Editor
{
/**
* Add the shortcode generator buttons to TinyMCE
*/
public static function addButtons()
{
add_filter('mce_buttons', ['Recras\Editor', 'registerButtons']);
add_filter('mce_external_plugins', ['Recras\Editor', 'addScripts']);
add_th... | <?php
namespace Recras;
class Editor
{
/**
* Add the shortcode generator buttons to TinyMCE
*/
public static function addButtons()
{
add_filter('mce_buttons', ['Recras\Editor', 'registerButtons']);
add_filter('mce_external_plugins', ['Recras\Editor', 'addScripts']);
add_th... |
Use META.SERVER_NAME in template view. … | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.generic.base import TemplateView
from django.views.decorators.csrf import csrf_exempt
import redis
from ws4redis import settings as redis_settings
class BaseTemplateView(TemplateView):
def __... | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.generic.base import TemplateView
from django.views.decorators.csrf import csrf_exempt
import redis
from ws4redis import settings as redis_settings
class BaseTemplateView(TemplateView):
def __... |
Change interval from 4 to 7 seconds | <?php
class CodesController extends \BaseController {
public function process($code)
{
$code = Code::where('code', '=', $code)->first();
if(is_null($code) || $code->used == 1){
return Redirect::to('/')->with('error', 'Nie znaleziono!');
} else {
//Snapchatty functio... | <?php
class CodesController extends \BaseController {
public function process($code)
{
$code = Code::where('code', '=', $code)->first();
if(is_null($code) || $code->used == 1){
return Redirect::to('/')->with('error', 'Nie znaleziono!');
} else {
//Snapchatty functio... |
Remove user_mail from request data | from ckan.lib import base
from ckan.common import c, _
from ckan import logic
from ckanext.requestdata import emailer
from ckan.plugins import toolkit
import ckan.model as model
import ckan.plugins as p
import json
get_action = logic.get_action
NotFound = logic.NotFound
NotAuthorized = logic.NotAuthorized
ValidationEr... | from ckan.lib import base
from ckan.common import c, _
from ckan import logic
from ckanext.requestdata import emailer
from ckan.plugins import toolkit
import ckan.model as model
import ckan.plugins as p
import json
get_action = logic.get_action
NotFound = logic.NotFound
NotAuthorized = logic.NotAuthorized
ValidationEr... |
Fix error message in the scikitlearn extension. |
# coding: utf-8
# A jinja extension for the harness
# In[9]:
try:
from .base import HarnessExtension
except:
from base import HarnessExtension
import pandas, sklearn.model_selection as model_selection
from toolz.curried import first
# In[10]:
class SciKitExtension(HarnessExtension):
alias = 'sklearn... |
# coding: utf-8
# A jinja extension for the harness
# In[9]:
try:
from .base import HarnessExtension
except:
from base import HarnessExtension
import pandas, sklearn.model_selection as model_selection
from toolz.curried import first
# In[11]:
get_ipython().magic('pinfo2 model_selection.ShuffleSplit')
... |
Refactor of one assignment test | # -*- coding: utf-8 -*-
import unittest
dbconfig = None
try:
import dbconfig
import erppeek
except ImportError:
pass
@unittest.skipIf(not dbconfig, "depends on ERP")
class Assignment_Test(unittest.TestCase):
def setUp(self):
self.erp = erppeek.Client(**dbconfig.erppeek)
self.Assignments... | # -*- coding: utf-8 -*-
import unittest
dbconfig = None
try:
import dbconfig
import erppeek
except ImportError:
pass
@unittest.skipIf(not dbconfig, "depends on ERP")
class Assignment_Test(unittest.TestCase):
def setUp(self):
self.erp = erppeek.Client(**dbconfig.erppeek)
self.Assignments ... |
Update redux dev tool configuration | // Redux
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
// import createLogger from 'redux-logger';
// import Immutable from 'immutable';
import rootReducer from '../reducers';
// const __DEV__ = process.env.NODE_ENV === 'production' ? false : true;
const finalCreateSto... | // Redux
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
// import createLogger from 'redux-logger';
// import Immutable from 'immutable';
import rootReducer from '../reducers';
// const __DEV__ = process.env.NODE_ENV === 'production' ? false : true;
const finalCreateSto... |
Change print statement to logger.debug | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Rollback a migration."""
from .. import logger, utils
__all__ = ('cli_loader',)
@utils.with_cursor
... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Rollback a migration."""
from .. import utils
__all__ = ('cli_loader',)
@utils.with_cursor
def cli_... |
Delete several commented out lines. | package com.biotronisis.pettplant.communication.transfer;
import java.io.Serializable;
public abstract class AbstractResponse implements Serializable {
private static final long serialVersionUID = 1L;
public abstract void fromResponseBytes(byte[] responseBytes);
public abstract Byte getResponseId();
... | package com.biotronisis.pettplant.communication.transfer;
import java.io.Serializable;
public abstract class AbstractResponse implements Serializable {
private static final long serialVersionUID = 1L;
public abstract void fromResponseBytes(byte[] responseBytes);
public abstract Byte getResponseId();
... |
Remove code which blanks patch files | #! /usr/bin/python2.3
# vim:sw=8:ts=8:et:nowrap
import os
import shutil
def ApplyPatches(filein, fileout):
# Generate short name such as wrans/answers2003-03-31.html
(rest, name) = os.path.split(filein)
(rest, dir) = os.path.split(rest)
fileshort = os.path.join(dir, name)
# Lo... | #! /usr/bin/python2.3
# vim:sw=8:ts=8:et:nowrap
import os
import shutil
def ApplyPatches(filein, fileout):
# Generate short name such as wrans/answers2003-03-31.html
(rest, name) = os.path.split(filein)
(rest, dir) = os.path.split(rest)
fileshort = os.path.join(dir, name)
# Lo... |
Add test for passing paths with variables to create_urlspec_regex. | from unittest import TestCase
from go_store_service.api_handler import (
ApiApplication, create_urlspec_regex, CollectionHandler,
ElementHandler)
class TestCreateUrlspecRegex(TestCase):
def test_no_variables(self):
self.assertEqual(create_urlspec_regex("/foo/bar"), "/foo/bar")
def test_one_v... | from unittest import TestCase
from go_store_service.api_handler import (
ApiApplication, create_urlspec_regex, CollectionHandler,
ElementHandler)
class TestCreateUrlspecRegex(TestCase):
def test_no_variables(self):
self.assertEqual(create_urlspec_regex("/foo/bar"), "/foo/bar")
class TestApiAppl... |
Correct error in URL mappings | from django.conf.urls import patterns, include, url
from django.contrib import admin
from sysrev.views import *
urlpatterns = patterns(
'',
url(r'^$', ReviewListView.as_view(), name='index'),
url(r'^review/(?P<pk>\d+)(-([\w\-]+))?/$', Revi... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from sysrev.views import *
urlpatterns = patterns(
'',
url(r'^$', ReviewListView.as_view(), name='index'),
url(r'^review/(?P<pk>\d+)(-([\w\-]+))?/$', Revi... |
Change about read "token" & "domain" | import requests
import json
import time
import sys
file = open('token.txt', 'r')
_token = file.readline()
file.close()
file = open('domain.txt', 'r')
_domain = file.readline()
def del_time(Day):
Set_time = str(int(time.time())-Day*86400)
return Set_time
def files_list(Day):
Del_time = del_time(Day)
f... | import requests
import json
import time
import sys
_token = "xxxxxxx"
_domain = "xxxxxxx"
def del_time(Day):
Set_time = str(int(time.time())-Day*86400)
return Set_time
def files_list(Day):
Del_time = del_time(Day)
files_list_url = "https://slack.com/api/files.list"
data = {
"token": _toke... |
Put a timer on reload to wait for autosave to finish | (function (ng, app) {
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('it-system.usage.contracts', {
url: '/contracts',
templateUrl: 'partials/it-system/tab-contracts.html',
controller: 'system.EditContracts',
resolve: {
... | (function (ng, app) {
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('it-system.usage.contracts', {
url: '/contracts',
templateUrl: 'partials/it-system/tab-contracts.html',
controller: 'system.EditContracts',
resolve: {
... |
Make the user in the profile update a copy | {
angular
.module('meganote.users')
.directive('userProfile', [
'CurrentUser',
'UsersService',
(CurrentUser, UsersService) => {
class UserProfileController {
constructor() {
this.user = angular.copy(CurrentUser.get());
}
submit() {
... | {
angular
.module('meganote.users')
.directive('userProfile', [
'CurrentUser',
'UsersService',
(CurrentUser, UsersService) => {
class UserProfileController {
constructor() {
this.user = CurrentUser.get();
}
submit() {
UsersServ... |
Fix typo in content type | <?php
namespace OParl\Website\Api\Controllers;
use function Swagger\scan;
/**
* @SWG\Swagger(
* schemes={"https"},
* host="dev.oparl.org",
* basePath="/api/",
* @SWG\Info(
* title="OParl Developer Platform API",
* description="Meta information concerning the OParl ecosystem",
... | <?php
namespace OParl\Website\Api\Controllers;
use function Swagger\scan;
/**
* @SWG\Swagger(
* schemes={"https"},
* host="dev.oparl.org",
* basePath="/api/",
* @SWG\Info(
* title="OParl Developer Platform API",
* description="Meta information concerning the OParl ecosystem",
... |
Add button appears but not aligned | <h1><?php echo $recipe->name; ?></h1>
<div class="row recipe-quick-facts">
<div class="col-md-4">
<h4>Servings</h4>
<?php echo $recipe->servings; ?>
</div>
<div class="col-md-4">
<h4>Prep Time</h4>
<?php echo display_time($recipe->time_prep); ?>
</div>
<div class="co... | <h1><?php echo $recipe->name; ?></h1>
<div class="row recipe-quick-facts">
<div class="col-md-4">
<h4>Servings</h4>
<?php echo $recipe->servings; ?>
</div>
<div class="col-md-4">
<h4>Prep Time</h4>
<?php echo display_time($recipe->time_prep); ?>
</div>
<div class="co... |
Add field for test result return | __author__ = 'sharvey'
from classifiers import Classifier
from corpus.mysql.reddit import RedditMySQLCorpus
from ppm import Trie
class RedditPPM(Classifier):
corpus = None
trie = None
user = None
reddit = None
order = 5
def __init__(self, corpus):
self.corpus = corpus
def train(... | __author__ = 'sharvey'
from classifiers import Classifier
from corpus.mysql.reddit import RedditMySQLCorpus
from ppm import Trie
class RedditPPM(Classifier):
corpus = None
trie = None
user = None
reddit = None
order = 5
def __init__(self, corpus):
self.corpus = corpus
def train(... |
Update symfony and composer packages | <?php
namespace Enhavo\Bundle\ShopBundle\Form\Extension;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
use Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\C... | <?php
namespace Enhavo\Bundle\ShopBundle\Form\Extension;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
use Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\C... |
Add 0.33 to the vertices to prevent misalignment | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from vispy.visuals.line.arrow import ARROW_TYPES
from vispy.scene import visuals, transforms
from vispy.testing import (requires_application, TestingCanvas... | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from vispy.visuals.line.arrow import ARROW_TYPES
from vispy.scene import visuals, transforms
from vispy.testing import (requires_application, TestingCanvas... |
Add pytest-cov and fix change requirements to >= | from codecs import open as codecs_open
from setuptools import setup, find_packages
with codecs_open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(name='gypsy',
version='0.0.1',
description=u"Controlling Gypsy modules, and outputs",
long_description=long_description,
... | from codecs import open as codecs_open
from setuptools import setup, find_packages
with codecs_open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(name='gypsy',
version='0.0.1',
description=u"Controlling Gypsy modules, and outputs",
long_description=long_description,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.