text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Enable list support in state persist helper | import Storage from 'store2';
/**
* @param {String} ns Local storage namespace
* @param {String[]} persistMutations
* @return {function(...[*]=)} Vuex plugin
*/
export default function persistFactory(ns, persistMutations) {
const storage = Storage.namespace(ns);
return function(store) {
const load = () =>... | import Storage from 'store2';
/**
* @param {String} ns Local storage namespace
* @param {String[]} persistMutations
* @return {function(...[*]=)} Vuex plugin
*/
export default function persistFactory(ns, persistMutations) {
const storage = Storage.namespace(ns);
return function(store) {
const load = () =>... |
Fix example Article.__str__ in Python 3 | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.six import python_2_unicode_compatible
from fluent_comments.moderation import moderate_model, comments_are_open, comments_are_moderated
from fluent_comments.models import get_comments_for_model, CommentsRelation
@python_2_uni... | from django.core.urlresolvers import reverse
from django.db import models
from fluent_comments.moderation import moderate_model, comments_are_open, comments_are_moderated
from fluent_comments.models import get_comments_for_model, CommentsRelation
class Article(models.Model):
title = models.CharField("Title", max_... |
Use thenShowInternal on action condition to avoid visibility colision | package fr.openwide.core.wicket.more.markup.html.template.js.jquery.plugins.bootstrap.confirm.component;
import org.apache.wicket.model.IModel;
import fr.openwide.core.wicket.more.markup.html.action.IAjaxAction;
public class AjaxConfirmLinkBuilder<O> extends AbstractConfirmLinkBuilder<AjaxConfirmLink<O>, O> {
priva... | package fr.openwide.core.wicket.more.markup.html.template.js.jquery.plugins.bootstrap.confirm.component;
import org.apache.wicket.model.IModel;
import fr.openwide.core.wicket.more.markup.html.action.IAjaxAction;
public class AjaxConfirmLinkBuilder<O> extends AbstractConfirmLinkBuilder<AjaxConfirmLink<O>, O> {
priva... |
Drop the ';' in the Python codegen as it's not necessary. | <% if (showSetup) { -%>
from KalturaClient import *
from KalturaClient.Plugins.Core import *
<% plugins.forEach(function(p) { -%>
from KalturaClient.Plugins.<%- p.charAt(0).toUpperCase() + p.substring(1) %> import *
<% }) -%>
config = KalturaConfiguration(<%- answers.partnerId %>)
config.serviceUrl = "https://www.kalt... | <% if (showSetup) { -%>
from KalturaClient import *
from KalturaClient.Plugins.Core import *
<% plugins.forEach(function(p) { -%>
from KalturaClient.Plugins.<%- p.charAt(0).toUpperCase() + p.substring(1) %> import *
<% }) -%>
config = KalturaConfiguration(<%- answers.partnerId %>)
config.serviceUrl = "https://www.kalt... |
Fix filter for disabled accounts | <?php
if ($GLOBALS['Session']->hasAccountLevel('User')) {
SearchRequestHandler::$searchClasses[Emergence\People\User::class] = [
'fields' => [
[
'field' => 'FirstName',
'method' => 'like'
],
[
'field' => 'LastName',
... | <?php
if ($GLOBALS['Session']->hasAccountLevel('User')) {
SearchRequestHandler::$searchClasses[Emergence\People\User::class] = [
'fields' => [
[
'field' => 'FirstName',
'method' => 'like'
],
[
'field' => 'LastName',
... |
Fix allow rules (admin check) | ActivityTypes = new Mongo.Collection('activityTypes');
var ActivityTypesSchema = new SimpleSchema({
name: {
type: String
}
});
ActivityTypes.allow({
insert () {
// Get current user ID
const currentUserId = Meteor.userId();
// Chack if user is administrator
const userIsAdmin = Roles.userIsIn... | ActivityTypes = new Mongo.Collection('activityTypes');
var ActivityTypesSchema = new SimpleSchema({
name: {
type: String
}
});
ActivityTypes.allow({
insert () {
// Get current user ID
const currentUserId = Meteor.userId();
// Chack if user is administrator
const userIsAdmin = Roles.userIsIn... |
Fix this context in ready callback. | define(['render',
'events',
'class'],
function(render, Emitter, clazz) {
function Application() {
Application.super_.call(this);
this.render = render;
this.controller = undefined;
}
clazz.inherits(Application, Emitter);
Application.prototype.run = function() {
this.willLaun... | define(['render',
'events',
'class'],
function(render, Emitter, clazz) {
function Application() {
Application.super_.call(this);
this.render = render;
this.controller = undefined;
}
clazz.inherits(Application, Emitter);
Application.prototype.run = function() {
this.willLaun... |
Fix Operations table (copy/pasted, blame me..) | package com.loyaltyplant.test.domain.operation;
import com.loyaltyplant.test.domain.BalanceOperation;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.Inhe... | package com.loyaltyplant.test.domain.operation;
import com.loyaltyplant.test.domain.BalanceOperation;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.Inhe... |
Fix chart scale on download stats page. | <?php
class DownloadStatsPage extends Page {
}
class DownloadStatsPage_Controller extends Page_Controller {
function DownloadStatsChartUrl() {
$downloads = DataObject::get("DownloadPage");
$values = array();
$labels = array();
foreach ($downloads as $download) {
$values[] = $download->DownloadCount;
$... | <?php
class DownloadStatsPage extends Page {
}
class DownloadStatsPage_Controller extends Page_Controller {
function DownloadStatsChartUrl() {
$downloads = DataObject::get("DownloadPage");
$values = array();
$labels = array();
foreach ($downloads as $download) {
$values[] = $download->DownloadCount;
$... |
Improve error handling of git process to commit installation of application. Mainly of use in tests | package io.liveoak.container.tenancy.service;
import java.io.File;
import java.util.function.Consumer;
import org.jboss.logging.Logger;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import o... | package io.liveoak.container.tenancy.service;
import java.io.File;
import java.util.function.Consumer;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;... |
Update sample to also fetch the object, and delete the object and bucket. | # Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
#
# 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 a... | # Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
#
# 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 a... |
Add comment explaining explicit setting of output | 'use strict';
var peg = require('pegjs');
class PegJsPlugin {
constructor(config) {
this.config = config.plugins.pegjs;
// The output of the below peg.generate() function must be a string, not an
// object
this.config.output = 'source';
}
compile(file) {
var parser;
try {
parser ... | 'use strict';
var peg = require('pegjs');
class PegJsPlugin {
constructor(config) {
this.config = config.plugins.pegjs;
this.config.output = 'source';
}
compile(file) {
var parser;
try {
parser = peg.generate(file.data, this.config);
} catch(error) {
if (error instanceof peg.pa... |
Make utils to be watched | /*global module:false*/
module.exports = function(grunt) {
grunt.initConfig({
watch: {
reload: {
files: ['src/*', 'src/js/*.js', 'src/js/utils/*.js', 'src/css/*.css', 'grunt.js'],
tasks: 'tinylr-reload'
}
}
});
grunt.registerTask('defa... | /*global module:false*/
module.exports = function(grunt) {
grunt.initConfig({
watch: {
reload: {
files: ['src/*', 'src/js/*.js', 'src/css/*.css', 'grunt.js'],
tasks: 'tinylr-reload'
}
}
});
grunt.registerTask('default', 'tinylr-start s... |
Initialize the machine assignments and assertions | import string
class Steckerbrett:
def __init__(self):
pass
class Umkehrwalze:
def __init__(self, wiring):
self.wiring = wiring
def encode(self, letter):
return self.wiring[string.ascii_uppercase.index(letter)]
class Walzen:
def __init__(self, notch, wiring):
assert... | import string
class Steckerbrett:
def __init__(self):
pass
class Umkehrwalze:
def __init__(self, wiring):
self.wiring = wiring
def encode(self, letter):
return self.wiring[string.ascii_uppercase.index(letter)]
class Walzen:
def __init__(self, notch, wiring):
assert... |
Convert $value to string to prevent strict_types errors | <?php
/**
* Wrapper for PHP's pgsql extension providing conversion of complex DB types
*
* LICENSE
*
* This source file is subject to BSD 2-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.githubusercontent.com/sad-spirit/pg-wrapper/master/LICENSE
*
... | <?php
/**
* Wrapper for PHP's pgsql extension providing conversion of complex DB types
*
* LICENSE
*
* This source file is subject to BSD 2-Clause License that is bundled
* with this package in the file LICENSE and available at the URL
* https://raw.githubusercontent.com/sad-spirit/pg-wrapper/master/LICENSE
*
... |
Throw exception if input date is not parsable | <?php
namespace Jaybizzle;
class Seasons
{
/**
* Seasons.
*
* @var array
*/
public $seasons = array(
'Winter',
'Spring',
'Summer',
'Autumn',
);
/**
* Parse input date and return numeric month.
*
* @param string
* @return int
... | <?php
namespace Jaybizzle;
class Seasons
{
/**
* Seasons.
*
* @var array
*/
public $seasons = array(
'Winter',
'Spring',
'Summer',
'Autumn',
);
/**
* Parse input date and return numeric month.
*
* @param string
*
* @retur... |
Add the decoratable behavior to the dispatcher and add the winddow controller as decorator | <?php
/**
* Kodekit Component - http://www.timble.net/kodekit
*
* @copyright Copyright (C) 2011 - 2013 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license MPL v2.0 <https://www.mozilla.org/en-US/MPL/2.0>
* @link https://github.com/timble/kodekit-pages for the canonical source repository
*/
retur... | <?php
/**
* Kodekit Component - http://www.timble.net/kodekit
*
* @copyright Copyright (C) 2011 - 2013 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license MPL v2.0 <https://www.mozilla.org/en-US/MPL/2.0>
* @link https://github.com/timble/kodekit-pages for the canonical source repository
*/
retur... |
FIX disable sale require contract | # -*- coding: utf-8 -*-
{
'name': 'Sale Order Require Contract on Confirmation',
'version': '1.0',
'category': 'Projects & Services',
'sequence': 14,
'summary': '',
'description': """
Sale Order Require Contract on Confirmation
===========================================
""",
'author': ... | # -*- coding: utf-8 -*-
{
'name': 'Sale Order Require Contract on Confirmation',
'version': '1.0',
'category': 'Projects & Services',
'sequence': 14,
'summary': '',
'description': """
Sale Order Require Contract on Confirmation
===========================================
""",
'author': ... |
Move import to top level to avoid import fail after fist time on sys.modules hack | from pyspark.sql.functions import udf
from pyspark.sql.types import *
from pyspark.sql import DataFrame
from sparknlp.annotation import Annotation
import sys
import sparknlp
def map_annotations(f, output_type: DataType):
sys.modules['sparknlp.annotation'] = sparknlp # Makes Annotation() pickle serializable in t... | from pyspark.sql.functions import udf
from pyspark.sql.types import *
from pyspark.sql import DataFrame
import sys
import sparknlp
def map_annotations(f, output_type: DataType):
sys.modules['sparknlp.annotation'] = sparknlp # Makes Annotation() pickle serializable in top-level
return udf(
lambda con... |
Use auto_register's filter_func to filter tests | from fontbakery.checkrunner import Section
from fontbakery.fonts_spec import spec_factory
def check_filter(item_type, item_id, item):
if item_type == "check" and item_id in (
"com.google.fonts/check/035", # ftxvalidator
"com.google.fonts/check/036", # ots-sanitize
"com.google.fonts/check/037", ... | from fontbakery.checkrunner import Section
from fontbakery.fonts_spec import spec_factory
def check_filter(checkid, font=None, **iterargs):
if checkid in (
"com.google.fonts/check/035", # ftxvalidator
"com.google.fonts/check/036", # ots-sanitize
"com.google.fonts/check/037", # Font Validator
... |
Fix coding standard [skip fix] | <?php
namespace Miaoxing\User\Controller\Admin;
class UserSettings extends \Miaoxing\Plugin\BaseController
{
protected $controllerName = '用户设置';
protected $actionPermissions = [
'index,update' => '设置',
];
public function indexAction()
{
$bgImage = &$this->setting('user.bgImage');... | <?php
namespace Miaoxing\User\Controller\Admin;
class UserSettings extends \Miaoxing\Plugin\BaseController
{
protected $controllerName = '用户设置';
protected $actionPermissions = [
'index,update' => '设置',
];
public function indexAction()
{
$bgImage = &$this->setting('user.bgImage');... |
Add user activated and logged in events to analytics subscriber | <?php
namespace OpenDominion\Listeners\Subscribers;
use Illuminate\Events\Dispatcher;
use OpenDominion\Contracts\Services\Analytics\AnalyticsService;
use OpenDominion\Events\HasAnalyticsEvent;
use OpenDominion\Events\UserActivatedEvent;
use OpenDominion\Events\UserLoggedInEvent;
use OpenDominion\Events\UserRegistered... | <?php
namespace OpenDominion\Listeners\Subscribers;
use Illuminate\Events\Dispatcher;
use OpenDominion\Contracts\Services\Analytics\AnalyticsService;
use OpenDominion\Events\HasAnalyticsEvent;
use OpenDominion\Events\UserRegisteredEvent;
class AnalyticsSubscriber implements SubscriberInterface
{
/** @var Analyti... |
Add column support for sql server | from django.db import connection
from django.db.models.fields import *
from south.db import generic
class DatabaseOperations(generic.DatabaseOperations):
"""
django-pyodbc (sql_server.pyodbc) implementation of database operations.
"""
add_column_string = 'ALTER TABLE %s ADD %s;'
def create_ta... | from django.db import connection
from django.db.models.fields import *
from south.db import generic
class DatabaseOperations(generic.DatabaseOperations):
"""
django-pyodbc (sql_server.pyodbc) implementation of database operations.
"""
def create_table(self, table_name, fields):
# Tweak stuff a... |
Expand content type detection to jpg and htm. | /*
* Copyright 2017, Sascha Häberling
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... | /*
* Copyright 2017, Sascha Häberling
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
Fix scope used for Cloud Search. | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2015 Google Inc. All rights reserved.
#
# 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 default value for package name.
If all else fails assume the name of the current folder is the packoge name. | <?php
namespace Respect\Foundation\InfoProviders;
use DirectoryIterator;
class PackageName extends AbstractProvider
{
public function providerPackageIni()
{
$iniPath = realpath($this->projectFolder.'/package.ini');
if (!file_exists($iniPath))
return '';
$ini = parse_ini_f... | <?php
namespace Respect\Foundation\InfoProviders;
use DirectoryIterator;
class PackageName extends AbstractProvider
{
public function providerPackageIni()
{
$iniPath = realpath($this->projectFolder.'/package.ini');
if (!file_exists($iniPath))
return '';
$ini = parse_ini_f... |
Increase JVM heap for logserver-container | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
imp... | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
imp... |
Change Manuscript JSON storage to same basedir | /*
*/
package org.datadryad.rest.storage.resolvers;
import org.datadryad.rest.storage.json.ManuscriptJSONStorageImpl;
import com.sun.jersey.spi.inject.SingletonTypeInjectableProvider;
import java.io.File;
import javax.ws.rs.core.Context;
import javax.ws.rs.ext.Provider;
import org.datadryad.rest.storage.AbstractManus... | /*
*/
package org.datadryad.rest.storage.resolvers;
import org.datadryad.rest.storage.json.ManuscriptJSONStorageImpl;
import com.sun.jersey.spi.inject.SingletonTypeInjectableProvider;
import java.io.File;
import javax.ws.rs.core.Context;
import javax.ws.rs.ext.Provider;
import org.datadryad.rest.storage.AbstractManus... |
Fix bad function name call | var AlexaAppServer = require('alexa-app-server');
var MpdInterface = require('./apps/alexa-mpd-control/mpd_interface');
var mpd = new MpdInterface();
AlexaAppServer.start({
// server_root:__dirname, // Path to root
// public_html:"public_html", // Static content
// app_dir:"apps", // Where ... | var AlexaAppServer = require('alexa-app-server');
var MpdInterface = require('./apps/alexa-mpd-control/mpd_interface');
var mpd = new MpdInterface();
AlexaAppServer.start({
// server_root:__dirname, // Path to root
// public_html:"public_html", // Static content
// app_dir:"apps", // Where ... |
Revise the way that searching for food is handled. | var CommandUtil = require('../../src/command_util')
.CommandUtil;
var l10n_file = __dirname + '/../../l10n/scripts/rooms/8.js.yml';
var l10n = require('../../src/l10n')(l10n_file);
exports.listeners = {
//TODO: Use cleverness stat for spot checks such as this.
examine: l10n => {
return (args, player, player... | var CommandUtil = require('../../src/command_util')
.CommandUtil;
var l10n_file = __dirname + '/../../l10n/scripts/rooms/8.js.yml';
var l10n = require('../../src/l10n')(l10n_file);
exports.listeners = {
//TODO: Use cleverness stat for spot checks such as this.
examine: l10n => {
return (args, player, player... |
Fix regression due to typo | package org.fxmisc.richtext;
import javafx.css.CssMetaData;
import javafx.css.StyleConverter;
import javafx.css.Styleable;
import javafx.css.StyleableObjectProperty;
import javafx.css.StyleableProperty;
import java.util.function.Function;
public class CustomCssMetaData<S extends Styleable, V> extends CssMetaData<S, ... | package org.fxmisc.richtext;
import javafx.css.CssMetaData;
import javafx.css.StyleConverter;
import javafx.css.Styleable;
import javafx.css.StyleableObjectProperty;
import javafx.css.StyleableProperty;
import java.util.function.Function;
public class CustomCssMetaData<S extends Styleable, V> extends CssMetaData<S, ... |
Add class_machine_name var to paramaters array | <?php
/**
* @file
* Containt Drupal\AppConsole\Generator\ControllerGenerator.
*/
namespace Drupal\AppConsole\Generator;
class ControllerGenerator extends Generator
{
public function generate($module, $class_name, $method_name, $route, $test, $services, $class_machine_name)
{
$parameters = array(
'c... | <?php
/**
* @file
* Containt Drupal\AppConsole\Generator\ControllerGenerator.
*/
namespace Drupal\AppConsole\Generator;
class ControllerGenerator extends Generator
{
public function generate($module, $class_name, $method_name, $route, $test, $services, $class_machine_name)
{
$parameters = array(
'c... |
Fix for ignoring passed in output directory and file extension | var fs, path, mkdirp
function toFileName(delimiter, name) {
if (delimiter === "") {
return name
}
return name
.replace(/[a-z][A-Z]/g, function(str) {
return str[0] + delimiter + str[1]
})
.toLowerCase()
}
if (typeof IN_BROWSER === "undefined") {
fs = require("fs")
path = require("path... | var fs, path, mkdirp
function toFileName(delimiter, name) {
if (delimiter === "") {
return name
}
return name
.replace(/[a-z][A-Z]/g, function(str) {
return str[0] + delimiter + str[1]
})
.toLowerCase()
}
if (typeof IN_BROWSER === "undefined") {
fs = require("fs")
path = require("path... |
cr: Fix the run command on Linux
TEST=cr run chrome
NOTRY=true
Review URL: https://codereview.chromium.org/105313004
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@240638 0039d316-1c4b-4281-b951-d872f2087c98 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module to hold linux specific action implementations."""
import cr
class LinuxRunner(cr.Runner):
"""An implementation of cr.Runner for the linux pl... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module to hold linux specific action implementations."""
import cr
class LinuxRunner(cr.Runner):
"""An implementation of cr.Runner for the linux pl... |
Fix log plugin breaking standalone | define(function(require, exports, module) {
main.consumes = [
"Plugin", "dialog.error"
];
main.provides = ["readonly"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var showError = imports["dialog.error"].show;
/*****... | define(function(require, exports, module) {
main.consumes = [
"Plugin", "dialog.error"
];
main.provides = ["readonly"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var showError = imports["dialog.error"].show;
/*****... |
Disable npm steps on DDC bot for now
This will only regression test compilation (no running of generated
code), but that appears to work.
R=leafp@google.com
Review-Url: https://codereview.chromium.org/2646493003 . | #!/usr/bin/env python
#
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import os.path
import shutil
import sys
import subprocess
import bot
im... | #!/usr/bin/env python
#
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import os.path
import shutil
import sys
import subprocess
import bot
im... |
Apply various and CS fixes as per review | <?php
namespace Doctrine\ORM\Utility;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal This class exists only to avoid code duplication, do not reuse it externally
*/
final class HierarchyDiscriminatorResolver
{
private function __construct()
{... | <?php
namespace Doctrine\ORM\Utility;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManagerInterface;
/**
* Class HierarchyDiscriminatorResolver
* @package Doctrine\ORM\Utility
* @internal This class exists only to avoid code duplication, do not reuse it externally
*/
class Hierar... |
Change how we get config settings
- Flask recommends using `app.config.from_object` to get config settings.
- Don't get config settings if we're using travis, since it won't have the
settings from the repo. | import flask
import sqlalchemy
import os
from Donut import constants
from Donut.modules import example
app = flask.Flask(__name__)
app.debug = False
# Get app config, if we're not testing on travis.
if 'TRAVIS' not in os.environ:
app.config.from_object('Donut.config')
# Maximum file upload size, in bytes.
app.con... | import flask
import sqlalchemy
from Donut import config, constants
from Donut.modules import example
app = flask.Flask(__name__)
app.debug = False
app.secret_key = config.SECRET_KEY
# Maximum file upload size, in bytes.
app.config['MAX_CONTENT_LENGTH'] = constants.MAX_CONTENT_LENGTH
# Load blueprint modules
app.reg... |
Fix the navigation generating js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative pat... | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative pat... |
Fix styling of body cells | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout: layout,
classNames: ['cell', 'eg-body-cell'],
attributeBindings: ['style', 'rowIndex:data-row-index'],
width: Ember.computed.alias('column.width'),
style: Ember.computed('column.offset', 'width', fu... | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout: layout,
classNames: ['eg-body-cell'],
attributeBindings: ['style', 'rowIndex:data-row-index'],
width: Ember.computed.alias('column.width'),
style: Ember.computed('column.offset', 'width', function()... |
Add markdown content type for README | #!/usr/bin/env python
import os
from setuptools import find_packages, setup
SCRIPT_DIR = os.path.dirname(__file__)
if not SCRIPT_DIR:
SCRIPT_DIR = os.getcwd()
SRC_PREFIX = 'src'
def readme():
with open('README.md') as f:
return f.read()
packages = find_packages(SRC_PREFIX)
setup(
name='cmd... | #!/usr/bin/env python
import os
from setuptools import find_packages, setup
SCRIPT_DIR = os.path.dirname(__file__)
if not SCRIPT_DIR:
SCRIPT_DIR = os.getcwd()
SRC_PREFIX = 'src'
packages = find_packages(SRC_PREFIX)
setup(
name='cmdline',
version='0.0.0',
description='Utilities for consistent... |
Document and inherit please :D | /**
* Get more info at : www.jrebirth.org .
* Copyright JRebirth.org © 2011-2013
* Contact : sebastien.bordes@jrebirth.org
*
* 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
*
... | /**
* Get more info at : www.jrebirth.org .
* Copyright JRebirth.org © 2011-2013
* Contact : sebastien.bordes@jrebirth.org
*
* 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
*
... |
Add type annotations for globus | import typeguard
from typing import Optional
from parsl.utils import RepresentationMixin
class GlobusScheme(RepresentationMixin):
"""Specification for accessing data on a remote executor via Globus.
Parameters
----------
endpoint_uuid : str
Universally unique identifier of the Globus endpoin... | from parsl.utils import RepresentationMixin
class GlobusScheme(RepresentationMixin):
"""Specification for accessing data on a remote executor via Globus.
Parameters
----------
endpoint_uuid : str
Universally unique identifier of the Globus endpoint at which the data can be accessed.
T... |
Correct redirect after search from submission | from flask import Flask, render_template, redirect, url_for
from flask_bootstrap import Bootstrap
from flask_nav import Nav
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired
class SimpleSearchForm(FlaskForm):
nct_id = StringField('nct_id', validators=[Dat... | from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_nav import Nav
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired
class SimpleSearchForm(FlaskForm):
nct_id = StringField('nct_id', validators=[DataRequired()])
impo... |
OAK-2833: Refactor TarMK
bump export package version as required
git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1682176 13f79535-47bb-0310-9956-ffa450edef68 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Add field to indicate admin permission | /*-
* Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de>
* All rights reserved
*
* Use of this source code is governed by a 2-clause BSD license
* that can be found in the LICENSE file.
*/
package msg
import (
)
type Supervisor struct {
Verdict uint16
VerictAdmin bool
RemoteAddr string
// Fiel... | /*-
* Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de>
* All rights reserved
*
* Use of this source code is governed by a 2-clause BSD license
* that can be found in the LICENSE file.
*/
package msg
import (
)
type Supervisor struct {
Verdict uint16
RemoteAddr string
// Fields for encrypted req... |
Add existence check for firestore before invoking. | import { merge } from 'lodash/fp';
import { firestoreActions } from './actions';
import { mapWithFirebaseAndDispatch } from './utils/actions';
import { defaultConfig } from './constants';
/**
* Create a firebase instance that has helpers attached for dispatching actions
* @param {Object} firebase - Firebase instanc... | import { merge } from 'lodash/fp';
import { firestoreActions } from './actions';
import { mapWithFirebaseAndDispatch } from './utils/actions';
import { defaultConfig } from './constants';
/**
* Create a firebase instance that has helpers attached for dispatching actions
* @param {Object} firebase - Firebase instanc... |
Add season to Convention filter | import rest_framework_filters as filters
from .models import (
Chart,
Convention,
Group,
Person,
Venue,
)
class ChartFilter(filters.FilterSet):
class Meta:
model = Chart
fields = {
'name': filters.ALL_LOOKUPS,
}
class ConventionFilter(filters.FilterSet):
... | import rest_framework_filters as filters
from .models import (
Chart,
Convention,
Group,
Person,
Venue,
)
class ChartFilter(filters.FilterSet):
class Meta:
model = Chart
fields = {
'name': filters.ALL_LOOKUPS,
}
class ConventionFilter(filters.FilterSet):
... |
Sort subscription list by date | define([
'backbone', 'handlebars', 'moment',
'connect/collections/Subscriptions',
'connect/views/SubscriptionListItemView',
'text!connect/templates/subscriptionList.handlebars'
], function(Backbone, Handlebars, moment, Subscriptions, SubscriptionListItemView, tpl) {
'use strict';
var SubscriptionListView ... | define([
'backbone', 'handlebars', 'moment',
'connect/collections/Subscriptions',
'connect/views/SubscriptionListItemView',
'text!connect/templates/subscriptionList.handlebars'
], function(Backbone, Handlebars, moment, Subscriptions, SubscriptionListItemView, tpl) {
'use strict';
var SubscriptionListView ... |
Update for plug-in : Weibo | var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push( {
name: 'Weibo',
version: '1.0',
prepareImgLinks: function(callback) {
var res = [];
hoverZoom.urlReplace(res,
'img[src]',
/\/thumb\d+\//,
'/large/'
);
hoverZoom.urlRe... | var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push( {
name: 'Weibo',
version: '0.1',
prepareImgLinks: function(callback) {
var res = [];
hoverZoom.urlReplace(res,
'img[src*="sinaimg.cn/thumbnail/"]',
/thumbnail\/([0-9a-z]+)\.jpg/,
'large... |
Use span tag for InPlaceFieldView | //
//https://github.com/mszoernyi/ember-inplace-edit
//
var InPlaceFieldView = Ember.View.extend({
tagName: 'span',
isEditing: false,
layoutName: "in_place_edit",
templateName: function(){
if(this.get("contentType") === 'currency'){
return 'in_place_currency_field';
} else {
return 'in_plac... | //
//https://github.com/mszoernyi/ember-inplace-edit
//
var InPlaceFieldView = Ember.View.extend({
tagName: 'div',
isEditing: false,
layoutName: "in_place_edit",
templateName: function(){
if(this.get("contentType") === 'currency'){
return 'in_place_currency_field';
} else {
return 'in_place... |
[Dns] Add rcode constants to message | <?php
namespace React\Dns;
class Message
{
const TYPE_A = 1;
const TYPE_NS = 2;
const TYPE_CNAME = 5;
const TYPE_SOA = 6;
const TYPE_PTR = 12;
const TYPE_MX = 15;
const TYPE_TXT = 16;
const CLASS_IN = 1;
const OPCODE_QUERY = 0;
const OPCODE_IQUERY = 1; // inverse query
co... | <?php
namespace React\Dns;
class Message
{
const TYPE_A = 1;
const TYPE_NS = 2;
const TYPE_CNAME = 5;
const TYPE_SOA = 6;
const TYPE_PTR = 12;
const TYPE_MX = 15;
const TYPE_TXT = 16;
const CLASS_IN = 1;
const OPCODE_QUERY = 0;
const OPCODE_IQUERY = 1; // inverse query
co... |
Include low and hidpi icon toggle support | // Global variables for isolated world
var iconActive = false;
function toggle(){
// Show "on" icon when showing the help
if(iconActive == false){
activate();
} else{
deactivate();
}
}
function deactivate(){
iconActive = false;
chrome.browserAction.setIcon({"path":"icon-" + "off" + ".png"});
chr... | // Global variables for isolated world
var iconActive = false;
function toggle(){
// Show "on" icon when showing the help
if(iconActive == false){
activate();
} else{
deactivate();
}
}
function deactivate(){
iconActive = false;
chrome.browserAction.setIcon({path:"icon-" + "off" + ".png"});
chrom... |
Fix string formatting in URL path
`go vet` message:
```
src/cf-metrics/events.go:29: arg url.QueryEscape(since.Format(time.RFC3339)) for printf verb %E of wrong type: string
```
I suspect that this wasn’t doing quite what I thought it was, due to
string formatting and URL encoding collisions. | package main
import (
"fmt"
"time"
"net/url"
"code.cloudfoundry.org/cli/cf/api/resources"
"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
"code.cloudfoundry.org/cli/cf/models"
"code.cloudfoundry.org/cli/cf/net"
)
type EventRepo struct {
config coreconfig.Reader
gateway net.Gateway
}
func NewEvent... | package main
import (
"fmt"
"time"
"net/url"
"code.cloudfoundry.org/cli/cf/api/resources"
"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
"code.cloudfoundry.org/cli/cf/models"
"code.cloudfoundry.org/cli/cf/net"
)
type EventRepo struct {
config coreconfig.Reader
gateway net.Gateway
}
func NewEvent... |
Fix broken comment field in CfP | // This file is part of Indico.
// Copyright (C) 2002 - 2019 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import 'jquery-ui';
import 'jquery-ui/ui/effect';
import 'jquery-ui/ui/effects/effect-pulsate';
impo... | // This file is part of Indico.
// Copyright (C) 2002 - 2019 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import 'jquery-ui';
import 'jquery-ui/ui/effect';
import 'jquery-ui/ui/effects/effect-pulsate';
impo... |
Allow users of the Machine Provider to specify the dev instance for API calls
BUG=489837
Review URL: https://codereview.chromium.org/1572793002 | # Copyright 2015 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Helper functions for working with the Machine Provider."""
import logging
from google.appengine.ext import ndb
from components import net
from comp... | # Copyright 2015 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Helper functions for working with the Machine Provider."""
import logging
from components import net
from components import utils
MACHINE_PROVIDER... |
Fix nosetests for config file loading | import json
import sys
def load_config_file(out=sys.stdout):
if sys.argv[0].endswith('nosetests'):
default_filepath = "./resources/config/default-config.json"
user_filepath = "./resources/config/user-config.json"
else:
default_filepath = "../resources/config/default-config.json"
... | import json
import sys
def load_config_file(out=sys.stdout):
default_filepath = "../resources/config/default-config.json"
user_filepath = "../resources/config/user-config.json"
try:
default_json = read_json(default_filepath)
user_json = read_json(user_filepath)
for property in use... |
Fix rq jobs registration check | from django.apps import AppConfig
from django.conf import settings
import session_csrf
class AtmoAppConfig(AppConfig):
name = 'atmo'
def ready(self):
# The app is now ready. Include any monkey patches here.
# Monkey patch CSRF to switch to session based CSRF. Session
# based CSRF wi... | from django.apps import AppConfig
from django.conf import settings
import session_csrf
class AtmoAppConfig(AppConfig):
name = 'atmo'
def ready(self):
# The app is now ready. Include any monkey patches here.
# Monkey patch CSRF to switch to session based CSRF. Session
# based CSRF wi... |
Test entity should not be allowed to change the created date after it's been created. | package ca.corefacility.bioinformatics.irida.web.controller.test.unit.support;
import java.util.Date;
import ca.corefacility.bioinformatics.irida.model.IridaThing;
/**
*
* @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
*/
public class IdentifiableTestEntity implements IridaThing, Comparable<Identifi... | package ca.corefacility.bioinformatics.irida.web.controller.test.unit.support;
import java.util.Date;
import ca.corefacility.bioinformatics.irida.model.IridaThing;
/**
*
* @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
*/
public class IdentifiableTestEntity implements IridaThing, Comparable<Identifi... |
Fix key and cert file params when using personal version | module.exports = ServerFactory => class HttpsServerFactory extends ServerFactory {
create (options) {
const fs = require('fs')
const https = require('https')
const t = require('typical')
const serverOptions = {}
if (options.pfx) {
serverOptions.pfx = fs.readFileSync(options.pfx)
} else {... | module.exports = ServerFactory => class HttpsServerFactory extends ServerFactory {
create (options) {
const fs = require('fs')
const https = require('https')
const t = require('typical')
const serverOptions = {}
if (options.pfx) {
serverOptions.pfx = fs.readFileSync(options.pfx)
} else {... |
Fix user, album factories; add setup for photo test case | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.DjangoModelFactory):
"""Create a fake user."""
... | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from imager_profile.models import ImagerProfile
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.Djang... |
Set version number to 0.7.0. | from setuptools import setup
setup(
name='slacker',
version='0.7.0',
packages=['slacker'],
description='Slack API client',
author='Oktay Sancak',
author_email='oktaysancak@gmail.com',
url='http://github.com/os/slacker/',
install_requires=['requests >= 2.2.1'],
license='http://www.a... | from setuptools import setup
setup(
name='slacker',
version='0.6.8',
packages=['slacker'],
description='Slack API client',
author='Oktay Sancak',
author_email='oktaysancak@gmail.com',
url='http://github.com/os/slacker/',
install_requires=['requests >= 2.2.1'],
license='http://www.a... |
Make sure everything is in lowercase. | var toNumber = require("underscore.string/toNumber"),
ltrim = require("underscore.string/ltrim");
// Generate a random justinfan username
function generateJustinfan() {
return "justinfan" + Math.floor((Math.random() * 80000) + 1000);
}
// Determine if value is a valid integer
function isInteger(value) {
//0 ... | var toNumber = require("underscore.string/toNumber"),
ltrim = require("underscore.string/ltrim");
// Generate a random justinfan username
function generateJustinfan() {
return "justinfan" + Math.floor((Math.random() * 80000) + 1000);
}
// Determine if value is a valid integer
function isInteger(value) {
//0 ... |
Add trademark symbol to control component | /*renders control panel with associated buttons and display*/
import React from 'react';
import CountDisplay from 'CountDisplay';
import StrictButton from 'StrictButton';
import OnOffButton from 'OnOffButton';
class Control extends React.Component{
render(){
return (
<div id="control-panel">
<div ... | /*renders control panel with associated buttons and display*/
import React from 'react';
import CountDisplay from 'CountDisplay';
import StrictButton from 'StrictButton';
import OnOffButton from 'OnOffButton';
class Control extends React.Component{
render(){
return (
<div id="control-panel">
<div ... |
Print a list of aliases, if any exist. | import java.util.*;
import org.xbill.DNS.*;
public class lookup {
public static void
printAnswer(String name, Lookup lookup) {
System.out.print(name + ":");
int result = lookup.getResult();
if (result != Lookup.SUCCESSFUL)
System.out.print(" " + lookup.getErrorString());
System.out.println();
Name [] aliases =... | import java.util.*;
import org.xbill.DNS.*;
public class lookup {
public static void
printAnswer(String name, Lookup lookup) {
System.out.print(name + ":");
int result = lookup.getResult();
if (result != Lookup.SUCCESSFUL)
System.out.print(" " + lookup.getErrorString());
System.out.println();
if (lookup.getRes... |
Make test module for Copy runnable | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
from chainer import testing
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.u... | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.uniform(-1, 1, (10, 5)).astyp... |
Fix timing issue in firefox where cycle wouldn't start before replay | import {run} from '@cycle/core';
import Rx from 'rx';
import restartable from './restartable';
function restart (main, drivers, {sources, sinks}, isolate = {}, timeToTravelTo = null) {
sources.dispose();
sinks && sinks.dispose();
if (typeof isolate === 'function' && 'reset' in isolate) {
isolate.reset();
... | import {run} from '@cycle/core';
import Rx from 'rx';
import restartable from './restartable';
function restart (main, drivers, {sources, sinks}, isolate = {}, timeToTravelTo = null) {
sources.dispose();
sinks && sinks.dispose();
if (typeof isolate === 'function' && 'reset' in isolate) {
isolate.reset();
... |
chore(bundle): Remove named define in AMD | const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
'browser-id3-writer': './src/browser-id3-writer.js',
'browser-id3-writer.min': './src/browser-id3-writer.js'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
... | const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
'browser-id3-writer': './src/browser-id3-writer.js',
'browser-id3-writer.min': './src/browser-id3-writer.js'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
... |
Add rangeCondition to algorithm binding | package org.yamcs.algorithms;
import java.util.Calendar;
import java.util.Date;
import org.yamcs.parameter.ParameterValue;
import org.yamcs.protobuf.Pvalue.AcquisitionStatus;
import org.yamcs.protobuf.Pvalue.MonitoringResult;
import org.yamcs.protobuf.Pvalue.RangeCondition;
import org.yamcs.utils.TimeEncoding;
/**
... | package org.yamcs.algorithms;
import java.util.Calendar;
import java.util.Date;
import org.yamcs.parameter.ParameterValue;
import org.yamcs.protobuf.Pvalue.AcquisitionStatus;
import org.yamcs.protobuf.Pvalue.MonitoringResult;
import org.yamcs.utils.TimeEncoding;
/**
* A ParameterValue as passed to an algorithm. Act... |
Remove defect for building a string in a loop | package nl.eernie.jmoribus.model;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
public class Step {
private StepType stepType;
private List<StepLine> stepLines = new ArrayList<>();
public Step(StepType stepType) {
this.stepType = stepType;
... | package nl.eernie.jmoribus.model;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
public class Step {
private StepType stepType;
private List<StepLine> stepLines = new ArrayList<>();
public Step(StepType stepType) {
this.stepType = stepType;
... |
Add support for JSX *within* .vue files | module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
},
"sourceType": "module"
},
"plugins": [
... | module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
... |
Add private constructor to prevent instantiation
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
msg systems ag (http://www.msg-systems.com) for supporting
the JUnit crowdfunding campaign!
------------------------------------------------... | /*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
packag... | /*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
packag... |
Change story index to use standard link for show action | @extends('layouts.admin')
@section('title') Stories @endsection
@section('content')
<table class="table table-striped">
<thead>
<tr>
<th style="width:10%">Action</th>
<th>Issue</th>
<th>Title</th>
<th>Author</th>
</tr>
</thead>
<tbody>
@foreach ($stories as $story)
<tr>
... | @extends('layouts.admin')
@section('title') Stories @endsection
@section('content')
<table class="table table-striped">
<thead>
<tr>
<th style="width:10%">Action</th>
<th>Issue</th>
<th>Title</th>
<th>Author</th>
</tr>
</thead>
<tbody>
@foreach ($stories as $story)
<tr>
... |
Remove temp directory just after the test (as well) | /* eslint no-console:0 */
var os = require('os');
var crypto = require('crypto');
var fse = require('fs-extra');
var originalCwd = process.cwd();
var createdDirectories = [];
process.on('exit', function () {
// In case something went wrong and some temp
// directories are still on the disk.
createdDirectories.... | /* eslint no-console:0 */
var os = require('os');
var crypto = require('crypto');
var fse = require('fs-extra');
var originalCwd = process.cwd();
var createdDirectories = [];
process.on('exit', function () {
createdDirectories.forEach(function (path) {
try {
fse.removeSync(path);
} catch (err) {
... |
Grunt/deploy: Use private ACL for S3 | module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
aws: grunt.file.readJSON('.aws-deploy.json'),
s3: {
options: {
accessKeyId: '<%= aws.accessKeyId %>',
secretAccess... | module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
aws: grunt.file.readJSON('.aws-deploy.json'),
s3: {
options: {
accessKeyId: '<%= aws.accessKeyId %>',
secretAccess... |
Use str and repr functions instead of magic methods | """
NOTE: There are no tests that check for data validation at this point since
the interpreter doesn't have any data validation as a feature.
"""
import pytest
from calc import INTEGER, Token
def test_no_defaults():
# There's no valid defaults at the moment.
with pytest.raises(TypeError):
Token()
... | """
NOTE: There are no tests that check for data validation at this point since
the interpreter doesn't have any data validation as a feature.
"""
import pytest
from calc import INTEGER, Token
def test_no_defaults():
# There's no valid defaults at the moment.
with pytest.raises(TypeError):
Token()
... |
Add support to run inside Meteor.
When running this babel-plugin inside Meteor, it gives us
weird errors.
But, we don't need this to use inside Meteor.
Meteor do this for us automatically.
So, we simply turn off this when using inside Meteor. | import BabelRootImportHelper from './helper';
export default function({ types: t }) {
class BabelRootImport {
constructor() {
const that = this;
return {
visitor: {
ImportDeclaration(path, state) {
const givenPath = path.node.source.value;
var rootPathSuffix... | import BabelRootImportHelper from './helper';
export default function({ types: t }) {
class BabelRootImport {
constructor() {
const that = this;
return {
visitor: {
ImportDeclaration(path, state) {
const givenPath = path.node.source.value;
var rootPathSuffix... |
Add LabeledImageDataset to datasets module | from chainer.datasets import cifar
from chainer.datasets import dict_dataset
from chainer.datasets import image_dataset
from chainer.datasets import mnist
from chainer.datasets import ptb
from chainer.datasets import sub_dataset
from chainer.datasets import tuple_dataset
DictDataset = dict_dataset.DictDataset
ImageDa... | from chainer.datasets import cifar
from chainer.datasets import dict_dataset
from chainer.datasets import image_dataset
from chainer.datasets import mnist
from chainer.datasets import ptb
from chainer.datasets import sub_dataset
from chainer.datasets import tuple_dataset
DictDataset = dict_dataset.DictDataset
ImageDa... |
Extend SimpleStreamableObject so that we get a useful default toString().
git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@2321 542714f4-19e9-0310-aa3c-eee0fc999fb1 | //
// $Id: Cluster.java,v 1.3 2003/03/25 03:16:11 mdb Exp $
package com.threerings.whirled.spot.data;
import com.threerings.io.SimpleStreamableObject;
import com.threerings.presents.dobj.DSet;
/**
* Contains information on clusters.
*/
public class Cluster extends SimpleStreamableObject
implements DSet.Entry
{... | //
// $Id: Cluster.java,v 1.2 2003/02/13 23:01:35 mdb Exp $
package com.threerings.whirled.spot.data;
import com.threerings.presents.dobj.DSet;
/**
* Contains information on clusters.
*/
public class Cluster
implements DSet.Entry
{
/** A unique identifier for this cluster (also the distributed object
... |
Fix issue in Python 2 | import venusian
class tween_config(object):
""" A decorator which allows developers to annotate tween factories. """
venusian = venusian
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def __call__(self, wrapped_tween_factory):
def do_the_thing(con... | import venusian
class tween_config(object):
""" A decorator which allows developers to annotate tween factories. """
venusian = venusian
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def __call__(self, wrapped_tween_factory):
def do_the_thing(con... |
Fix: Increase Height of 'About' window even more | const about = module.exports = {
init,
win: null
}
const config = require('../../config')
const electron = require('electron')
function init () {
if (about.win) {
return about.win.show()
}
const win = about.win = new electron.BrowserWindow({
backgroundColor: '#ECECEC',
center: true,
fullscr... | const about = module.exports = {
init,
win: null
}
const config = require('../../config')
const electron = require('electron')
function init () {
if (about.win) {
return about.win.show()
}
const win = about.win = new electron.BrowserWindow({
backgroundColor: '#ECECEC',
center: true,
fullscr... |
Fix ajax for user update modal | $(document).ready(function() {
$("#profile").on('submit', '.edit-user', function(event) {
const $form = $('.edit-user');
let url = $form.attr('action');
let method = $form.attr('method');
let data = $form.serialize();
$.ajax({
url: url,
method: method,
data: data,
dataTyp... | $(document).ready(function() {
const $form = $('.edit_user');
$form.on('submit', function(event) {
let url = $form.attr('action');
let method = $form.attr('method');
let data = $form.serialize();
$.ajax({
url: url,
method: method,
data: data,
dataType: "json"
})
.s... |
Fix multivar for nodes with variable lenght stacks |
from nodes import Node
class MultiVar(Node):
char = "'"
args = 0
results = None
contents = -1
def __init__(self, node_1: Node.NodeSingle, node_2: Node.NodeSingle):
self.node_1 = node_1
self.node_2 = node_2
def prepare(self, stack):
self.node_1.prepare(stac... |
from nodes import Node
class MultiVar(Node):
char = "'"
args = 0
results = None
contents = -1
def __init__(self, node_1: Node.NodeSingle, node_2: Node.NodeSingle):
self.node_1 = node_1
self.node_2 = node_2
self.args = max([node_1.args, node_2.args])
def pr... |
IMCMS-290: Add a "pin" icon to imCMS's panel:
- Refreshing elements length for displacing array. | /**
* Array with fixed max length and displacing first element on oversize.
*
* @author Serhii Maksymchuk from Ubrainians for imCode
* 10.05.18
*/
Imcms.define('imcms-displacing-array', [], function () {
var DisplacingArray = function (size) {
if (typeof size !== 'number') throw new Error("Size should... | /**
* Array with fixed max length and displacing first element on oversize.
*
* @author Serhii Maksymchuk from Ubrainians for imCode
* 10.05.18
*/
Imcms.define('imcms-displacing-array', [], function () {
var DisplacingArray = function (size) {
if (typeof size !== 'number') throw new Error("Size should... |
Repair option if params not exists. | var PermissionConstructor = require('./PermissionConstructor').PermissionConstructor;
function WebService(currentUser) {
this._currentUser = currentUser;
this._dependencies = {};
this.runRef = undefined;
}
WebService.prototype.runWrapper = function () {
var self = this;
return function (name, allowedTypeAccount... | var PermissionConstructor = require('./PermissionConstructor').PermissionConstructor;
function WebService(currentUser) {
this._currentUser = currentUser;
this._dependencies = {};
this.runRef = undefined;
}
WebService.prototype.runWrapper = function () {
var self = this;
return function (name, allowedTypeAccount... |
Remove date todo
Add DRY todo
git-svn-id: bdb5f82b9b83a1400e05d69d262344b821646179@1452 e217846f-e12e-0410-a4e5-89ccaea66ff7 | /*
* Copyright 2007-2008 University Of Southern California
*
* 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... | /*
* Copyright 2007-2008 University Of Southern California
*
* 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... |
Update on suggestion of jezdez. | import os
from setuptools import setup, find_packages
from taggit import VERSION
f = open(os.path.join(os.path.dirname(__file__), 'README.txt'))
readme = f.read()
f.close()
setup(
name='django-taggit',
version=".".join(VERSION),
description='django-taggit is a reusable Django application for simple tagg... | from setuptools import setup, find_packages
from taggit import VERSION
f = open('README.txt')
readme = f.read()
f.close()
setup(
name='django-taggit',
version=".".join(VERSION),
description='django-taggit is a reusable Django application for simple tagging.',
long_description=readme,
author='Alex... |
Add check for palindrome component of method | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if l is None or l.next is None:
return True
# find center of list
fast = l
slow = l
while ... | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if l.value is None:
return True
# find center of list
fast = l
slow = l
while fast.next an... |
Add option parser and main method | #!/usr/bin/env python
from Crypto.Cipher import AES
import json
import os
import optparse
KEY_LENGTH = 256
BLOCK_LENGTH = 16
KEY_FILE = 'key'
ENCRYPTED_FILE = 'data'
DECRYPTED_FILE = 'tmp'
EOT_CHAR = '\x04'
def main(options, arguments):
pass
def get_cipher(iv):
try:
key = open(KEY_FILE, 'rb').read(... | from Crypto.Cipher import AES
import json
import os
KEY_LENGTH = 256
BLOCK_LENGTH = 16
KEY_FILE = 'key'
ENCRYPTED_FILE = 'data'
DECRYPTED_FILE = 'tmp'
EOT_CHAR = '\x04'
def get_cipher(iv):
try:
key = open(KEY_FILE, 'rb').read()
except IOError:
key = input("Please enter the decryption key: ")... |
Use an https URL rather than http.
Found by sphinx's linkcheck. | """
RISC-V Target
-------------
`RISC-V <https://riscv.org/>`_ is an open instruction set architecture
originally developed at UC Berkeley. It is a RISC-style ISA with either a
32-bit (RV32I) or 64-bit (RV32I) base instruction set and a number of optional
extensions:
RV32M / RV64M
Integer multiplication and divis... | """
RISC-V Target
-------------
`RISC-V <http://riscv.org/>`_ is an open instruction set architecture
originally developed at UC Berkeley. It is a RISC-style ISA with either a
32-bit (RV32I) or 64-bit (RV32I) base instruction set and a number of optional
extensions:
RV32M / RV64M
Integer multiplication and divisi... |
Fix fatal error in collection episodes listing
Add null as scope parameter to _items call | <?php
namespace VHX;
class Collections extends ApiResource {
public static function all($params = array(), $headers = null) {
return self::_list($params, $headers);
}
public static function retrieve($id = null, $headers = null) {
return self::_retrieve($id, null, $headers);
}
public static function ... | <?php
namespace VHX;
class Collections extends ApiResource {
public static function all($params = array(), $headers = null) {
return self::_list($params, $headers);
}
public static function retrieve($id = null, $headers = null) {
return self::_retrieve($id, null, $headers);
}
public static function ... |
Add opacity to the drop shadow filter. | // Adapted from: http://bl.ocks.org/cpbotha/5200394
export function dropShadow (el, name, dx, dy, blur, opacity) {
let defs = el.select('defs');
if (defs.empty()) {
defs = el.append('defs');
}
// create filter with id #drop-shadow
// height = 130% so that the shadow is not clipped
const filter = defs.... | // Adapted from: http://bl.ocks.org/cpbotha/5200394
export function dropShadow (el, name, dx, dy, blur) {
let defs = el.select('defs');
if (defs.empty()) {
defs = el.append('defs');
}
// create filter with id #drop-shadow
// height = 130% so that the shadow is not clipped
const filter = defs.append('f... |
Add debug-menu manual triggers for Sentry
Signed-off-by: Kristofer Rye <1ed31cfd0b53bc3d1689a6fee6dbfc9507dffd22@gmail.com> | // @flow
import {Sentry, SentrySeverity} from 'react-native-sentry'
import * as React from 'react'
import {Section, PushButtonCell} from '@frogpond/tableview'
import {type NavigationScreenProp} from 'react-navigation'
type Props = {navigation: NavigationScreenProp<*>}
export class DeveloperSection extends React.Compo... | // @flow
import * as React from 'react'
import {Section, PushButtonCell} from '@frogpond/tableview'
import {type NavigationScreenProp} from 'react-navigation'
type Props = {navigation: NavigationScreenProp<*>}
export class DeveloperSection extends React.Component<Props> {
onAPIButton = () => this.props.navigation.na... |
Transform null values to empty string | package org.limeprotocol.util;
import java.util.LinkedHashMap;
import java.util.Map;
public class StringUtils {
public static boolean isNullOrEmpty(String string){
return string == null || string.equals("");
}
public static boolean isNullOrWhiteSpace(String string){
return isNullOrEmpty(... | package org.limeprotocol.util;
import java.util.LinkedHashMap;
import java.util.Map;
public class StringUtils {
public static boolean isNullOrEmpty(String string){
return string == null || string.equals("");
}
public static boolean isNullOrWhiteSpace(String string){
return isNullOrEmpty(... |
Handle exception and clean up during preview | /**
* (c) 2014 StreamSets, Inc. All rights reserved. May not
* be copied, modified, or distributed in whole or part without
* written consent of StreamSets, Inc.
*/
package com.streamsets.pipeline.runner.preview;
import com.streamsets.pipeline.api.StageException;
import com.streamsets.pipeline.runner.Pipeline;
imp... | /**
* (c) 2014 StreamSets, Inc. All rights reserved. May not
* be copied, modified, or distributed in whole or part without
* written consent of StreamSets, Inc.
*/
package com.streamsets.pipeline.runner.preview;
import com.streamsets.pipeline.api.StageException;
import com.streamsets.pipeline.runner.Pipeline;
imp... |
Update method should use KConfig instead of ArrayObject as parameter. | <?php
/**
* @version $Id$
* @category Koowa
* @package Koowa_Event
* @copyright Copyright (C) 2007 - 2010 Johan Janssens and Mathias Verraes. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.koowa.org
*/
/**
* Cl... | <?php
/**
* @version $Id$
* @category Koowa
* @package Koowa_Event
* @copyright Copyright (C) 2007 - 2010 Johan Janssens and Mathias Verraes. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.koowa.org
*/
/**
* Cl... |
Fix Landscape complaint "Method has no argument" | from django.test.runner import DiscoverRunner
from behave_django.environment import BehaveHooksMixin
from behave_django.testcase import (BehaviorDrivenTestCase,
ExistingDatabaseTestCase)
class BehaviorDrivenTestRunner(DiscoverRunner, BehaveHooksMixin):
"""
Test runner that... | from django.test.runner import DiscoverRunner
from behave_django.environment import BehaveHooksMixin
from behave_django.testcase import (BehaviorDrivenTestCase,
ExistingDatabaseTestCase)
class BehaviorDrivenTestRunner(DiscoverRunner, BehaveHooksMixin):
"""
Test runner that... |
Fix to bracket ordering in tree representation | package upparse.corpus;
/**
* Data structure representing a bracket, not including a category label
* @author eponvert@utexas.edu (Elias Ponvert)
*/
public class UnlabeledBracket implements Comparable<UnlabeledBracket> {
private final int first, last;
public UnlabeledBracket(final int _first, final int _las... | package upparse.corpus;
/**
* Data structure representing a bracket, not including a category label
* @author eponvert@utexas.edu (Elias Ponvert)
*/
public class UnlabeledBracket implements Comparable<UnlabeledBracket> {
private final int first, last;
public UnlabeledBracket(final int _first, final int _las... |
Add OPTIONS to CORS allowed methods | /**
* Adds CORS headers to the response
*
* ####Example:
*
* app.all('/api*', keystone.middleware.cors);
*
* @param {app.request} req
* @param {app.response} res
* @param {function} next
* @api public
*/
// The exported function returns a closure that retains
// a reference to the keystone instance, so ... | /**
* Adds CORS headers to the response
*
* ####Example:
*
* app.all('/api*', keystone.middleware.cors);
*
* @param {app.request} req
* @param {app.response} res
* @param {function} next
* @api public
*/
// The exported function returns a closure that retains
// a reference to the keystone instance, so ... |
Make sure to return python values, not lxml objects
Bump version to 0.4.0 | "Simple parser for Garmin TCX files."
from lxml import objectify
__version__ = '0.4.0'
class TcxParser:
def __init__(self, tcx_file):
tree = objectify.parse(tcx_file)
self.root = tree.getroot()
self.activity = self.root.Activities.Activity
@property
def latitude(self):
... | "Simple parser for Garmin TCX files."
from lxml import objectify
__version__ = '0.3.0'
class TcxParser:
def __init__(self, tcx_file):
tree = objectify.parse(tcx_file)
self.root = tree.getroot()
self.activity = self.root.Activities.Activity
@property
def latitude(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.