text
stringlengths
17
1.47k
positive
stringlengths
673
4.43k
negative
stringlengths
677
2.81k
NXP-11577: Fix Sonar Major violations: Final Class
package org.nuxeo.drive.service.impl; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.nuxeo.ecm.core.api.IdRef; /** * Helper to handle synchronization root definitions. * * @author Antoine Taillefer */ pu...
package org.nuxeo.drive.service.impl; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.nuxeo.ecm.core.api.IdRef; /** * Helper to handle synchronization root definitions. * * @author Antoine Taillefer */ pu...
Check webUrl of groups for null to prevent NullPointerException
package com.commit451.gitlab.model.api; import com.google.gson.annotations.SerializedName; import org.parceler.Parcel; import android.net.Uri; @Parcel public class Group { @SerializedName("id") long mId; @SerializedName("name") String mName; @SerializedName("path") String mPath; @Seriali...
package com.commit451.gitlab.model.api; import com.google.gson.annotations.SerializedName; import org.parceler.Parcel; import android.net.Uri; @Parcel public class Group { @SerializedName("id") long mId; @SerializedName("name") String mName; @SerializedName("path") String mPath; @Seriali...
Remove test that fails because of qualified function call
<?php namespace Ramsey\Uuid\Test\Generator; use phpmock\phpunit\PHPMock; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Generator\SodiumRandomGenerator; class SodiumRandomGeneratorTest extends TestCase { use PHPMock; protected function skipIfLibsodiumExtensionNotLoaded() { if (!extension_loaded(...
<?php namespace Ramsey\Uuid\Test\Generator; use phpmock\phpunit\PHPMock; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Generator\SodiumRandomGenerator; class SodiumRandomGeneratorTest extends TestCase { use PHPMock; protected function skipIfLibsodiumExtensionNotLoaded() { if (!extension_loaded(...
Revert "Added cookies deletion step to @BeforeMethod." This reverts commit bc44573ae5011b2155badbc77c530189e0b356ce.
package tests; import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.*; import pages.HomePage; import selenium.WebDriverFactory; import utils.Log4Test; import utils.PropertyLoader; public class BaseTest { public static WebDriver driver; @BeforeSuite public void int...
package tests; import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.*; import pages.HomePage; import selenium.WebDriverFactory; import utils.Log4Test; import utils.PropertyLoader; public class BaseTest { public static WebDriver driver; @BeforeSuite public void int...
Remove get user by id nonsense, now exponent.auth.name
from twisted.cred import checkers, portal from twisted.protocols import amp from zope import interface class AuthenticationLocator(amp.CommandLocator): """ A base class for responder locators that allow users to authenticate. """ credentialInterfaces = [] def __init__(self, store): """ ...
from exponent.auth import common from twisted.cred import checkers, portal from twisted.internet import defer from twisted.protocols import amp from zope import interface def _getUserByIdentifier(rootStore, userIdentifier): """ Gets a user by uid. """ user = common.User.findUnique(rootStore, userIdent...
Add support for -debug=true when testing clouds. --debug is still unsafe. We need to redirect sdtout to a log.
#!/usr/bin/env python from __future__ import print_function __metaclass__ = type from argparse import ArgumentParser import os import subprocess import sys from jujupy import ( CannotConnectEnv, Environment, ) def deploy_stack(environment, debug): """"Deploy a test stack in the specified environment. ...
#!/usr/bin/env python __metaclass__ = type from argparse import ArgumentParser import subprocess import sys from jujupy import ( CannotConnectEnv, Environment, until_timeout, ) def deploy_stack(environment): """"Deploy a test stack in the specified environment. :param environment: The name of ...
Remove force_load which was added in later versions.
from __future__ import unicode_literals from django.core.management.base import NoArgsCommand, CommandError from allaccess.models import Provider class Command(NoArgsCommand): "Convert existing providers from django-social-auth to django-all-access." def handle_noargs(self, **options): verbosity =...
from __future__ import unicode_literals from django.core.management.base import NoArgsCommand, CommandError from allaccess.models import Provider class Command(NoArgsCommand): "Convert existing providers from django-social-auth to django-all-access." def handle_noargs(self, **options): verbosity =...
Fix a few issues with the POST tests.
var request = require('request'), should = require('chai').should(), muxamp = require('../lib/server').getApplication(), testutils = require('../lib/testutils'), playlist = require('../lib/playlist'); describe('POST', function() { var baseUrl = 'http://localhost:' + 3000 + '/playlists/save...
var request = require('request'), should = require('chai').should(), muxamp = require('../lib/server').getApplication(), testutils = require('../lib/testutils'), playlist = require('../lib/playlist'); describe('POST', function() { var baseUrl = 'http://localhost:' + 3000 + '/playlists/save...
Connect before using the database
<?php namespace Aureka\VBBundle; use Aureka\VBBundle\Exception\VBUserException, Aureka\VBBundle\Exception\VBSessionException; class VBUsers { private $db; public function __construct(VBDatabase $db) { $this->db = $db; } public function create(VBSession $session, $username, $pass...
<?php namespace Aureka\VBBundle; use Aureka\VBBundle\Exception\VBUserException, Aureka\VBBundle\Exception\VBSessionException; class VBUsers { private $db; public function __construct(VBDatabase $db) { $this->db = $db; } public function create(VBSession $session, $username, $pass...
Add list:server command enable option
<?php /** * SiteCLI - Help you manage Nginx local development configuration * * @author panlatent@gmail.com * @link https://github.com/panlatent/site-cli * @license https://opensource.org/licenses/MIT */ namespace Panlatent\SiteCli\Commands; use Symfony\Component\Console\Input\InputInterface; use Symfony\Co...
<?php /** * SiteCLI - Help you manage Nginx local development configuration * * @author panlatent@gmail.com * @link https://github.com/panlatent/site-cli * @license https://opensource.org/licenses/MIT */ namespace Panlatent\SiteCli\Commands; use Symfony\Component\Console\Input\InputInterface; use Symfony\Co...
Add COUNTRY_APP to settings exposed to the templates
from django.conf import settings import logging def add_settings( request ): """Add some selected settings values to the context""" return { 'settings': { 'STAGING': settings.STAGING, 'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER, ...
from django.conf import settings import logging def add_settings( request ): """Add some selected settings values to the context""" return { 'settings': { 'STAGING': settings.STAGING, 'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER, ...
Make sure ALLOWED_HOSTS is correctly set
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengin...
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengin...
Add classifier for Python 3.5
import sys from shutil import rmtree from setuptools import setup, find_packages if sys.argv[:2] == ['setup.py', 'bdist_wheel']: # Remove previous build dir when creating a wheel build, since if files # have been removed from the project, they'll still be cached in the build # dir and end up as part of th...
import sys from shutil import rmtree from setuptools import setup, find_packages if sys.argv[:2] == ['setup.py', 'bdist_wheel']: # Remove previous build dir when creating a wheel build, since if files # have been removed from the project, they'll still be cached in the build # dir and end up as part of th...
Comment out test that fails locally because issue not resolved yet because preventing mvn deploy git-svn-id: 545e707062091c2f19509f4812c0e7d129870002@853 922cec90-98bc-ecba-b0a9-867c771b4a74
package org.jaudiotagger.issues; import org.jaudiotagger.AbstractTestCase; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.tag.FieldKey; import java.io.File; /** *File corrupt after write */ public class Issue290Test extends AbstractTestCase { public ...
package org.jaudiotagger.issues; import org.jaudiotagger.AbstractTestCase; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.tag.FieldKey; import java.io.File; /** *File corrupt after write */ public class Issue290Test extends AbstractTestCase { public ...
Fix error when already renamed
#!/usr/bin/env python import os import sys from string import Template import argparse import hashlib if __name__ == "__main__": parser = argparse.ArgumentParser(description='Rename files based on content.') parser.add_argument('files', metavar='FILE', type=str, nargs='+', help='Files ...
#!/usr/bin/env python import os import sys from string import Template import argparse import hashlib if __name__ == "__main__": parser = argparse.ArgumentParser(description='Rename files based on content.') parser.add_argument('files', metavar='FILE', type=str, nargs='+', help='Files ...
Rename package to use dashes.
from setuptools import setup REQUIRES = [ 'markdown', 'mdx_outline', ] SOURCES = [] with open('README.rst', 'r') as f: long_description = f.read() setup( name="mdx-attr-cols", version="0.1.1", url='http://github.com/CTPUG/mdx_attr_cols', license='MIT', description="A bootstrap 3 row ...
from setuptools import setup REQUIRES = [ 'markdown', 'mdx_outline', ] SOURCES = [] with open('README.rst', 'r') as f: long_description = f.read() setup( name="mdx_attr_cols", version="0.1.1", url='http://github.com/CTPUG/mdx_attr_cols', license='MIT', description="A bootstrap 3 row ...
Put reference handling correct way around
VIE.prototype.Collection = Backbone.Collection.extend({ model: VIE.prototype.Entity, get: function(id) { if (!this.models.length) { return null; } if (!this.models[0].isReference(id)) { id = this.models[0].toReference(id); } if (id == null) return...
VIE.prototype.Collection = Backbone.Collection.extend({ model: VIE.prototype.Entity, get: function(id) { if (!this.models.length) { return null; } if (this.models[0].isReference(id)) { id = this.models[0].fromReference(id); } if (id == null) retur...
Fix custom template tag to work with django 1.8
from django import template register = template.Library() class InContextNode(template.Node): def __init__(self, nodelist, subcontext_names): self.nodelist = nodelist self.subcontext_names = subcontext_names def render(self, context): new_context = {} for field in self.subcon...
from django import template register = template.Library() class InContextNode(template.Node): def __init__(self, nodelist, subcontext_names): self.nodelist = nodelist self.subcontext_names = subcontext_names def render(self, context): new_context = {} for field in self.subcon...
Send event author in webhook notification
<?php namespace Kanboard\Notification; use Kanboard\Core\Base; use Kanboard\Core\Notification\NotificationInterface; /** * Webhook Notification * * @package Kanboard\Notification * @author Frederic Guillot */ class WebhookNotification extends Base implements NotificationInterface { /** * Send notifi...
<?php namespace Kanboard\Notification; use Kanboard\Core\Base; use Kanboard\Core\Notification\NotificationInterface; /** * Webhook Notification * * @package Kanboard\Notification * @author Frederic Guillot */ class WebhookNotification extends Base implements NotificationInterface { /** * Send notifi...
Remove overlay JS function since we now use Magnific popup.
;(function($){ $(function() { var selections = $('#add-cart select'); var showImage = function(id) { var image = $(id); if (image.length == 1) { $('#product-images-large li').hide(); image.show(); } }; ...
;(function($){ $(function() { var selections = $('#add-cart select'); var showImage = function(id) { var image = $(id); if (image.length == 1) { $('#product-images-large li').hide(); image.show(); } }; ...
Build regular and minified CSS.
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ compass: { dist: { options: { sourcemap: true, sassDir: 'sass', cssDir: 'static/css', outputStyle: 'expanded', ...
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ compass: { dist: { options: { sourcemap: true, sassDir: 'sass', cssDir: 'static/css', outputStyle: 'expanded', ...
Update the CVS unit tests to use build_client(). This updates the CVS unit tests to build a `CVSClient` in each test where it's needed, rather than in `setUp()`. This is in prepration for new tests that will need to handle client construction differently. Testing Done: CVS unit tests pass. Reviewed at https://review...
"""Unit tests for CVSClient.""" from __future__ import unicode_literals import kgb from rbtools.clients import RepositoryInfo from rbtools.clients.cvs import CVSClient from rbtools.clients.tests import SCMClientTestCase class CVSClientTests(kgb.SpyAgency, SCMClientTestCase): """Unit tests for CVSClient.""" ...
"""Unit tests for CVSClient.""" from __future__ import unicode_literals import kgb from rbtools.clients import RepositoryInfo from rbtools.clients.cvs import CVSClient from rbtools.clients.tests import SCMClientTestCase class CVSClientTests(kgb.SpyAgency, SCMClientTestCase): """Unit tests for CVSClient.""" ...
Set manual timeout for count test
var mongoose = require('mongoose'), async = require('async'), config = require('./config'), Schema = mongoose.Schema, mongoosastic = require('../lib/mongoosastic'); var CommentSchema = new Schema({ user: String, post_date: {type:Date, es_type:'date'}, message: {type:String}, title: {type:String, es_boo...
var mongoose = require('mongoose'), async = require('async'), config = require('./config'), Schema = mongoose.Schema, mongoosastic = require('../lib/mongoosastic'); var CommentSchema = new Schema({ user: String, post_date: {type:Date, es_type:'date'}, message: {type:String}, title: {type:String, es_boo...
Support for finalize and unfinalize
(function(window) { var Gitana = window.Gitana; Gitana.Release = Gitana.AbstractRepositoryObject.extend( /** @lends Gitana.Release.prototype */ { /** * @constructs * @augments Gitana.AbstractRepositoryObject * * @class Release * * @param {Gi...
(function(window) { var Gitana = window.Gitana; Gitana.Release = Gitana.AbstractRepositoryObject.extend( /** @lends Gitana.Release.prototype */ { /** * @constructs * @augments Gitana.AbstractRepositoryObject * * @class Release * * @param {Gi...
Use a variadic call instead of call_user_func_array().
<?php namespace Knp\Bundle\MenuBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Refer...
<?php namespace Knp\Bundle\MenuBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Refer...
[Customer][Core] Rename DashboardStatistic customers count() method to countCustomers()
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Sylius\Component\Core\Dashboard; use Sylius\Component\Core\Model\...
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Sylius\Component\Core\Dashboard; use Sylius\Component\Core\Model\...
Allow blank source_id in event, tweak formatting of the code
from django.contrib.gis.db import models from django.contrib.gis import geos from datetime import datetime class Venue(models.Model): name = models.CharField(max_length=255) street_address = models.TextField() country = models.CharField(max_length=255) location = models.PointField(blank=True) obj...
from django.contrib.gis.db import models from django.contrib.gis import geos from datetime import datetime class Venue(models.Model): name = models.CharField(max_length=255) street_address = models.TextField() country = models.CharField(max_length=255) location = models.PointField(blank=True) obj...
Allow Mongo connections to Mongo Replicaset Cluster
import pymongo DEFAULT_MONGODB_HOST = 'localhost' DEFAULT_MONGODB_PORT = 27017 DEFAULT_MONGODB_NAME = 'eduid' DEFAULT_MONGODB_URI = 'mongodb://%s:%d/%s' % (DEFAULT_MONGODB_HOST, DEFAULT_MONGODB_PORT, DEFAULT_MONGODB_NAME) cla...
import pymongo from eduid_signup.compat import urlparse DEFAULT_MONGODB_HOST = 'localhost' DEFAULT_MONGODB_PORT = 27017 DEFAULT_MONGODB_NAME = 'eduid' DEFAULT_MONGODB_URI = 'mongodb://%s:%d/%s' % (DEFAULT_MONGODB_HOST, DEFAULT_MONGODB_PORT, ...
Reset device list on scan
(function(){ 'use strict'; angular .module('steamWorks') .controller('btCtrl', btCtrl); btCtrl.$inject = ['$scope', '$state', 'deviceSvc']; function btCtrl($scope, $state, deviceSvc){ var vm = this; vm.devices = []; // the devices listed in the page vm.scan = scan; vm.connect = connect;...
(function(){ 'use strict'; angular .module('steamWorks') .controller('btCtrl', btCtrl); btCtrl.$inject = ['$scope', '$state', 'deviceSvc']; function btCtrl($scope, $state, deviceSvc){ var vm = this; vm.devices = []; // the devices listed in the page vm.scan = scan; vm.connect = connect;...
Update to new webapp and skin rendering (I like it better than before!) git-svn-id: fac99be8204c57f0935f741ea919b5bf0077cdf6@9248 688a9155-6ab5-4160-a077-9df41f55a9e9
var webapp = loadModule('helma.webapp'); var handleRequest = loadModule('helma.webapp.handler').handleRequest; // db model var model = loadModule('model'); // the main action is invoked for http://localhost:8080/ // this also shows simple skin rendering function main_action(req, res) { if (req.data.save) { ...
var handleRequest = loadModule('helma.simpleweb').handleRequest; var render = loadModule('helma.skin').render; var webapp = loadModule('helma.webapp'); // db model var model = loadModule('model'); // the main action is invoked for http://localhost:8080/ // this also shows simple skin rendering function main_action() ...
Add interface method as abstract to trait Code quality: while trait is supposed to go together with the interface, it makes sense to add interface method used by trait as an abstract method. This way implementors will not be caught by surprise if method definition is ever changed or removed altogether
<?php declare(strict_types=1); namespace Xerkus\Neovim\Plugin\RpcHandler; /** * Rpc handler that announces itself to neovim. * */ trait RpcSpecTrait { private $name; private $sync; private $pluginPath; /** * @inheritDoc */ abstract public function getType() : string; /** * ...
<?php declare(strict_types=1); namespace Xerkus\Neovim\Plugin\RpcHandler; /** * Rpc handler that announces itself to neovim. * */ trait RpcSpecTrait { private $name; private $sync; private $pluginPath; /** * @inheritDoc */ public function getName() : string { return $this...
Add empty space to logging output
package com.microsoft.applicationinsights.logging; import android.util.Log; import com.microsoft.applicationinsights.library.ApplicationInsights; public class InternalLogging { private static final String PREFIX = InternalLogging.class.getPackage().getName(); private InternalLogging() { //...
package com.microsoft.applicationinsights.logging; import android.util.Log; import com.microsoft.applicationinsights.library.ApplicationInsights; public class InternalLogging { private static final String PREFIX = InternalLogging.class.getPackage().getName(); private InternalLogging() { //...
Fix another doc string type.
<?php /** * MiniAsset * Copyright (c) Mark Story (http://mark-story.com) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Mark Story (http://mark-story.c...
<?php /** * MiniAsset * Copyright (c) Mark Story (http://mark-story.com) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Mark Story (http://mark-story.c...
Add support for higher order collection messages from 5.4
<?php namespace TightenCo\Jigsaw; use ArrayAccess; use Exception; use Illuminate\Support\Collection as BaseCollection; use Illuminate\Support\HigherOrderCollectionProxy; class IterableObject extends BaseCollection implements ArrayAccess { public function __get($key) { if (! $this->offsetExists($key) &...
<?php namespace TightenCo\Jigsaw; use ArrayAccess; use Exception; use Illuminate\Support\Collection as BaseCollection; class IterableObject extends BaseCollection implements ArrayAccess { public function __get($key) { return $this->get($key); } public function get($key, $default = null) {...
Add dependency to vcstools>=0.1.34 (to be released)
from setuptools import setup import imp def get_version(): ver_file = None try: ver_file, pathname, description = imp.find_module('__version__', ['src/wstool']) vermod = imp.load_module('__version__', ver_file, pathname, description) version = vermod.version return version ...
from setuptools import setup import imp def get_version(): ver_file = None try: ver_file, pathname, description = imp.find_module('__version__', ['src/wstool']) vermod = imp.load_module('__version__', ver_file, pathname, description) version = vermod.version return version ...
Add colorlog to reqs and fix dev req versions
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"Forestry Growth and Yield Projection System", long_description=LONG_DESCRIPTIO...
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"Forestry Growth and Yield Projection System", long_description=LONG_DESCRIPTIO...
[f] Add failure message test for not_to.be.true()
from robber import expect from robber.matchers.boolean import TrueMatcher, FalseMatcher class TestTrueMatcher: def test_matches(self): expect(TrueMatcher(True).matches()).to.eq(True) expect(TrueMatcher(False).matches()).to.eq(False) def test_failure_message(self): true = TrueMatcher(F...
from robber import expect from robber.matchers.boolean import TrueMatcher, FalseMatcher class TestTrueMatcher: def test_matches(self): expect(TrueMatcher(True).matches()).to.eq(True) expect(TrueMatcher(False).matches()).to.eq(False) def test_failure_message(self): true = TrueMatcher(F...
Fix issue where double clicking in char select causes game breakage.
var CharSelect = { showing: false, bound: false, $ov: null, $ui: null, $chars: null, bind: function () { if (this.bound) { return; } this.bound = true; this.$ov = $('#overlay'); this.$ui = $('#charselect'); this.$chars = this.$ui.fi...
var CharSelect = { showing: false, bound: false, $ov: null, $ui: null, $chars: null, bind: function () { if (this.bound) { return; } this.bound = true; this.$ov = $('#overlay'); this.$ui = $('#charselect'); this.$chars = this.$ui.fi...
Add TinyDbReader to observers init
#!/usr/bin/env python # coding=utf-8 from __future__ import division, print_function, unicode_literals from sacred.commandline_options import CommandLineOption from sacred.observers.base import RunObserver from sacred.observers.file_storage import FileStorageObserver import sacred.optional as opt from sacred.observer...
#!/usr/bin/env python # coding=utf-8 from __future__ import division, print_function, unicode_literals from sacred.commandline_options import CommandLineOption from sacred.observers.base import RunObserver from sacred.observers.file_storage import FileStorageObserver import sacred.optional as opt from sacred.observer...
Allow for directories argument to be optional
"""A set of functions to standardize some options for python scripts.""" def setup_parser_help(parser, additional_docs=None): """ Set formatting for parser to raw and add docstring to help output Parameters ---------- parser : `ArgumentParser` The parser to be modified. additional_d...
"""A set of functions to standardize some options for python scripts.""" def setup_parser_help(parser, additional_docs=None): """ Set formatting for parser to raw and add docstring to help output Parameters ---------- parser : `ArgumentParser` The parser to be modified. additional_d...
Add undo/redo buttons and remove sub-/superscript buttons
'use strict'; (function (document, CKEDITOR) { document.addEventListener('DOMContentLoaded', function () { // RTE Array.prototype.forEach.call(document.querySelectorAll('textarea[data-type=rte]'), function (item) { const cfg = { customConfig: '', disableN...
'use strict'; (function (document, CKEDITOR) { document.addEventListener('DOMContentLoaded', function () { // RTE Array.prototype.forEach.call(document.querySelectorAll('textarea[data-type=rte]'), function (item) { const cfg = { customConfig: '', disableN...
Update perf scripts to use browserify rather than gulp-browserify.
var gulp = require('gulp'); var build = require('./../gulp-build'); var rename = require('gulp-rename'); var concat = require('gulp-concat'); var browserify = require('browserify'); var Transform = require('stream').Transform; var Rx = require('rx'); var Observable = Rx.Observable; var fs = require('fs'); var path = re...
var gulp = require('gulp'); var build = require('./../gulp-build'); var rename = require('gulp-rename'); var concat = require('gulp-concat'); var browserify = require('gulp-browserify'); var Transform = require("stream").Transform; var Rx = require('rx'); var Observable = Rx.Observable; var fs = require('fs'); var path...
Set test width/height via attributes
package com.snowble.android.verticalstepper; import android.app.Activity; import org.robolectric.Robolectric; public class RobolectricTestUtils { public static VerticalStepper.LayoutParams createTestLayoutParams(Activity activity, int leftMar...
package com.snowble.android.verticalstepper; import android.app.Activity; import org.robolectric.Robolectric; public class RobolectricTestUtils { public static VerticalStepper.LayoutParams createTestLayoutParams(Activity activity, int leftM...
Ch03: Declare Meta class in NewsLink model. [skip ci]
from django.db import models # Model Field Reference # https://docs.djangoproject.com/en/1.8/ref/models/fields/ class Tag(models.Model): name = models.CharField( max_length=31, unique=True) slug = models.SlugField( max_length=31, unique=True, help_text='A label for URL config...
from django.db import models # Model Field Reference # https://docs.djangoproject.com/en/1.8/ref/models/fields/ class Tag(models.Model): name = models.CharField( max_length=31, unique=True) slug = models.SlugField( max_length=31, unique=True, help_text='A label for URL config...
Update expected number of metrics
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.jdisc.metric; import com.yahoo.jdisc.Metric; import com.yahoo.jdisc.statistics.ContainerWatchdogMetrics; import org.junit.Test; import java.lang.management.ManagementFactory; import jav...
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.jdisc.metric; import com.yahoo.jdisc.Metric; import com.yahoo.jdisc.statistics.ContainerWatchdogMetrics; import org.junit.Test; import java.lang.management.ManagementFactory; import jav...
Fix an issue where binding the command would fail
<?php namespace Spatie\MediaLibrary; use Illuminate\Support\ServiceProvider; use Spatie\MediaLibrary\Commands\RegenerateCommand; class MediaLibraryServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; ...
<?php namespace Spatie\MediaLibrary; use Illuminate\Support\ServiceProvider; use Spatie\MediaLibrary\Commands\RegenerateCommand; class MediaLibraryServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; ...
Add shadow changing support according to our new passwd.
#!/usr/bin/env python3 import sys _args = sys.argv if __name__ == "__main__": if len(_args) == 8: keys_file = _args[1] passwd_orig = _args[2] passwd_new = _args[3] passwd_log = _args[4] shadow_orig = _args[5] shadow_new = _args[6] shadow_log = _args[7] ...
#!/usr/bin/env python3 import sys _args = sys.argv if __name__ == "__main__": if len(_args) == 5: keys_file = _args[1] target_file = _args[2] result_file = _args[3] log_file = _args[4] try: with open(keys_file, 'r') as k: keys = k.readlines() ...
Make "No Attribute Aggregation for $SP" log message level info. This is a common case so not really deserving of notice status.
<?php class EngineBlock_Corto_Filter_Command_AttributeAggregator extends EngineBlock_Corto_Filter_Command_Abstract { /** * This command may modify the response attributes * * @return array */ public function getResponseAttributes() { return $this->_responseAttributes; } ...
<?php class EngineBlock_Corto_Filter_Command_AttributeAggregator extends EngineBlock_Corto_Filter_Command_Abstract { /** * This command may modify the response attributes * * @return array */ public function getResponseAttributes() { return $this->_responseAttributes; } ...
Revert reduced failure level for try.
package mb.statix.constraints.messages; import java.util.Map; import javax.annotation.Nullable; import com.google.common.collect.ImmutableMap; import mb.statix.constraints.CAstId; import mb.statix.constraints.CAstProperty; import mb.statix.constraints.CTry; import mb.statix.solver.IConstraint; public class Message...
package mb.statix.constraints.messages; import java.util.Map; import javax.annotation.Nullable; import com.google.common.collect.ImmutableMap; import mb.statix.constraints.CAstId; import mb.statix.constraints.CAstProperty; import mb.statix.constraints.CTry; import mb.statix.solver.IConstraint; public class Message...
Remove a legacy Markdown extension when generating e-mails. The recent updates for using Python-Markdown 3.x removed the `smart_strong` extension from the main Markdown procssing, but failed to remove it for the list of extensions used in e-mails. This is a trivial change that simply removes that entry.
from __future__ import unicode_literals import markdown from django import template from django.utils.safestring import mark_safe from djblets.markdown import markdown_unescape register = template.Library() @register.filter def markdown_email_html(text, is_rich_text): if not is_rich_text: return text ...
from __future__ import unicode_literals import markdown from django import template from django.utils.safestring import mark_safe from djblets.markdown import markdown_unescape register = template.Library() @register.filter def markdown_email_html(text, is_rich_text): if not is_rich_text: return text ...
Fix bug that make go back in browserhistory to fail
var React = require('react'); var Link = require('react-router').Link; var Login = require('./sidebar/login'); var Highscore = require('./sidebar/highscore'); module.exports = React.createClass({ getInitialState: function () { return { message: '' }; }, componentWillMount: function () { if (this.props.m...
var React = require('react'); var Link = require('react-router').Link; var Login = require('./sidebar/login'); var Highscore = require('./sidebar/highscore'); module.exports = React.createClass({ getInitialState: function () { return { message: '' }; }, componentWillMount: function () { if (typeof this....
Fix Translate HOC imbrication for tests
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import RaisedButton from 'material-ui/RaisedButton'; import ContentSave from 'material-ui/svg-icons/content/save'; import CircularProgress from 'material-ui/CircularProgress'; import Translate from '../../i18n/Translate'; class...
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import RaisedButton from 'material-ui/RaisedButton'; import ContentSave from 'material-ui/svg-icons/content/save'; import CircularProgress from 'material-ui/CircularProgress'; import Translate from '../../i18n/Translate'; class...
Add a test for the character fetching
<?php namespace Destiny; class ClientTest extends TestCase { /** * Constructor */ public function __construct() { parent::__construct(); } /** * Test fetching an Xbox player. * * @throws \Exception */ public function testFetchXboxPlayer() { $p...
<?php namespace Destiny; class ClientTest extends TestCase { /** * Constructor */ public function __construct() { parent::__construct(); } /** * Test fetching an Xbox player. * * @throws \Exception */ public function testFetchXboxPlayer() { $p...
Make rethrow chain a Function
package throwing.bridge; import java.util.Optional; import java.util.function.Function; @FunctionalInterface interface RethrowChain<X extends Throwable, Y extends Throwable> extends Function<X, Optional<Y>> { public static final RethrowChain<Throwable, Throwable> START = t -> Optional.empty(); public static f...
package throwing.bridge; import java.util.Optional; import java.util.function.Function; @FunctionalInterface interface RethrowChain<X extends Throwable, Y extends Throwable> { public static final RethrowChain<Throwable, Throwable> START = t -> Optional.empty(); public static final RethrowChain<Throwable, Thro...
Change to protected instead private It's should be like this. No need to make function private.
<?php namespace Eduardokum\LaravelMailAutoEmbed\Embedder; use Swift_Image; use Swift_Message; use Swift_EmbeddedFile; use Eduardokum\LaravelMailAutoEmbed\Models\EmbeddableEntity; class AttachmentEmbedder extends Embedder { /** * @var Swift_Message */ protected $message; /** * AttachmentE...
<?php namespace Eduardokum\LaravelMailAutoEmbed\Embedder; use Eduardokum\LaravelMailAutoEmbed\Models\EmbeddableEntity; use Swift_EmbeddedFile; use Swift_Image; use Swift_Message; class AttachmentEmbedder extends Embedder { /** * @var Swift_Message */ private $message; /** * AttachmentEmb...
Make function name more descriptive
/* * ready * Watch for when an element becomes available in the DOM * @param {String} selector * @param {Function} fn */ (function(win){ 'use strict'; var listeners = [], doc = win.document, MutationObserver = win.MutationObserver || win.WebKitMutationObserver, observer; function ready...
/* * ready * Watch for when an element becomes available in the DOM * @param {String} selector * @param {Function} fn */ (function(win){ 'use strict'; var listeners = [], doc = win.document, MutationObserver = win.MutationObserver || win.WebKitMutationObserver, observer; function ready...
Fix publishing im.php file to config folder
<?php namespace CTL\XMPPMessageBase; use BirknerAlex\XMPPHP\XMPP; use Illuminate\Support\ServiceProvider; class IMServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { $this->publishFiles(); } ...
<?php namespace CTL\XMPPMessageBase; use BirknerAlex\XMPPHP\XMPP; use Illuminate\Support\ServiceProvider; class IMServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { $this->publishes([ __D...
Fix generator path for service provider
<?php namespace Pingpong\Modules\Commands; use Illuminate\Support\Str; use Pingpong\Generators\Stub; use Pingpong\Modules\Traits\ModuleCommandTrait; use Symfony\Component\Console\Input\InputArgument; class GenerateProviderCommand extends GeneratorCommand { use ModuleCommandTrait; /** * The console comm...
<?php namespace Pingpong\Modules\Commands; use Illuminate\Support\Str; use Pingpong\Generators\Stub; use Pingpong\Modules\Traits\ModuleCommandTrait; use Symfony\Component\Console\Input\InputArgument; class GenerateProviderCommand extends GeneratorCommand { use ModuleCommandTrait; /** * The console comm...
Change default debug behavior back to false
/** * In-Memory configuration storage */ let Config = { isInitialized: false, debug: false, overridePublishFunction: true, mutationDefaults: { pushToRedis: true, optimistic: true, }, passConfigDown: false, redis: { port: 6379, host: '127.0.0.1', }, g...
/** * In-Memory configuration storage */ let Config = { isInitialized: false, debug: true, overridePublishFunction: true, mutationDefaults: { pushToRedis: true, optimistic: true, }, passConfigDown: false, redis: { port: 6379, host: '127.0.0.1', }, gl...
Add a system to update service worker sw.js
this.addEventListener('install', function(event) { event.waitUntil( caches.open('learn-memory-1500879945180').then(function(cache) { return cache.addAll([ '/', '/stylesheets/styles.css', '/views/lessons-list.html', '/views/lessons-id.html', '/javascripts/scripts.js', ...
this.addEventListener('install', function(event) { event.waitUntil( caches.open('learn-memory').then(function(cache) { return cache.addAll([ '/', '/stylesheets/styles.css', '/views/lessons-list.html', '/views/lessons-id.html', '/javascripts/scripts.js', '/lang...
Add test coverage for expected nutrient retrieval behaviour
import unittest from recipe_scrapers._exceptions import SchemaOrgException from recipe_scrapers._schemaorg import SchemaOrg class TestSchemaOrg(unittest.TestCase): def setUp(self): with open("tests/test_data/schemaorg.testhtml", encoding="utf-8") as pagedata: self.schema = SchemaOrg(pagedata....
import unittest from recipe_scrapers._exceptions import SchemaOrgException from recipe_scrapers._schemaorg import SchemaOrg class TestSchemaOrg(unittest.TestCase): def setUp(self): with open("tests/test_data/schemaorg.testhtml", encoding="utf-8") as pagedata: self.schema = SchemaOrg(pagedata....
Support group_by, em and query_builder options in entity filter Add support for group_by, em and query_builder options in DatagridFilterTypeEntity. Allows custom sorting and grouping of data into the DatagridFilterTypeEntity filter type.
<?php namespace Wanjee\Shuwee\AdminBundle\Datagrid\Filter\Type; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\OptionsResolver\OptionsResolver; use Doctrine\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager; /** * Class DatagridFilterTypeEntity ...
<?php namespace Wanjee\Shuwee\AdminBundle\Datagrid\Filter\Type; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\OptionsResolver\OptionsResolver; /** * Class DatagridFilterTypeEntity * @package Wanjee\Shuwee\AdminBundle\Datagrid\Filter\Type */ class DatagridFilterTypeEntity extends Datagrid...
TEST for correct an with errors S06 report
from expects import expect, equal from primestg.report import Report from ast import literal_eval with description('Report S06 example'): with before.all: self.data_filenames = [ 'spec/data/S06.xml', 'spec/data/S06_with_error.xml', # 'spec/data/S06_empty.xml' ]...
from expects import expect, equal from primestg.report import Report from ast import literal_eval with description('Report S06 example'): with before.all: self.data_filenames = [ 'spec/data/S06.xml', # 'spec/data/S06_empty.xml' ] self.report = [] for data_...
Use the same headline as the API
#!/usr/bin/env python """Setup script for The Coverage Space CLI.""" import setuptools from coveragespace import __project__, __version__, CLI try: README = open("README.rst").read() CHANGES = open("CHANGES.rst").read() except IOError: DESCRIPTION = "<placeholder>" else: DESCRIPTION = README + '\n' ...
#!/usr/bin/env python """Setup script for The Coverage Space CLI.""" import setuptools from coveragespace import __project__, __version__, CLI try: README = open("README.rst").read() CHANGES = open("CHANGES.rst").read() except IOError: DESCRIPTION = "<placeholder>" else: DESCRIPTION = README + '\n' ...
Add logAndSendNotifications() to deploy script by default.
<?php namespace DeltaCli\Extension; use DeltaCli\Console\Output\Banner; use DeltaCli\Project; use DeltaCli\Script\InstallFsevents; use DeltaCli\Script\SshFixKeyPermissions as SshFixKeyPermissionsScript; use DeltaCli\Script\SshInstallKey as SshInstallKeyScript; use Symfony\Component\Console\Output\OutputInterface; cl...
<?php namespace DeltaCli\Extension; use DeltaCli\Console\Output\Banner; use DeltaCli\Project; use DeltaCli\Script\InstallFsevents; use DeltaCli\Script\SshFixKeyPermissions as SshFixKeyPermissionsScript; use DeltaCli\Script\SshInstallKey as SshInstallKeyScript; use Symfony\Component\Console\Output\OutputInterface; cl...
Fix import error for program page test
from lib.constants.test import create_new_program from lib.page import dashboard from lib import base class TestProgramPage(base.Test): def create_private_program_test(self): dashboard_page = dashboard.DashboardPage(self.driver) dashboard_page.navigate_to() lhn_menu = dashboard_page.open_l...
from lib.constants.test import create_new_program from lib import base, page class TestProgramPage(base.Test): def create_private_program_test(self): dashboard = page.dashboard.DashboardPage(self.driver) dashboard.navigate_to() lhn_menu = dashboard.open_lhn_menu() lhn_menu.select_a...
Fix since_id when calling Tweets.more()
YUI.add("model-list-tweets", function(Y) { "use strict"; var tristis = Y.namespace("Tristis"), models = Y.namespace("Tristis.Models"), Tweets; Tweets = Y.Base.create("tweets", Y.LazyModelList, [ Y.namespace("Extensions").ModelListMore ], { sync : funct...
YUI.add("model-list-tweets", function(Y) { "use strict"; var tristis = Y.namespace("Tristis"), models = Y.namespace("Tristis.Models"), Tweets; Tweets = Y.Base.create("tweets", Y.LazyModelList, [ Y.namespace("Extensions").ModelListMore ], { sync : funct...
Make the service worker get the payload from the server if the push message didn't contain any
importScripts('localforage.min.js'); self.addEventListener('push', function(event) { function getPayload() { if (event.data) { return Promise.resolve(event.data.json()); } else { return fetch('./getPayload') .then(function(response) { return response.json(); }); } } e...
importScripts('localforage.min.js'); self.addEventListener('push', function(event) { var data = event.data ? event.data.json() : null; var title = data ? data.title : 'Mercurius'; var body = data ? data.body : 'Notification'; event.waitUntil(self.registration.showNotification(title, { body: body, })); ...
Use new translated string placeholder style
# coding: utf-8 from django.conf import settings from django.utils.translation import gettext as _ from rest_framework import exceptions from onadata.apps.main.models.user_profile import UserProfile class MFABlockerMixin: def validate_mfa_not_active(self, user: 'auth.User'): """ Raise an excepti...
# coding: utf-8 from django.conf import settings from django.utils.translation import gettext as _ from rest_framework import exceptions from onadata.apps.main.models.user_profile import UserProfile class MFABlockerMixin: def validate_mfa_not_active(self, user: 'auth.User'): """ Raise an excepti...
Revert change to make user data private I'll need to just move any private data to another table because we need to be able to search usernames in order to add people to a chronicle.
// Includes file dependencies define([ "jquery", "backbone", "parse" ], function( $, Backbone, Parse ) { // Extends Backbone.View var SignupView = Backbone.View.extend( { events: { "submit form.signup-form": "signUp" }, el: "#signup", initialize: functi...
// Includes file dependencies define([ "jquery", "backbone", "parse" ], function( $, Backbone, Parse ) { // Extends Backbone.View var SignupView = Backbone.View.extend( { events: { "submit form.signup-form": "signUp" }, el: "#signup", initialize: functi...
Add comment about Provider not being used in userland code
<?php namespace Neos\Flow\Http; use Neos\Flow\Annotations as Flow; use Neos\Flow\Core\Bootstrap; use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\ServerRequestInterface; /** * Central authority to get hold of the active HTTP request. * When no active HTTP request can be determined (for examp...
<?php namespace Neos\Flow\Http; use Neos\Flow\Annotations as Flow; use Neos\Flow\Core\Bootstrap; use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\ServerRequestInterface; /** * Central authority to get hold of the active HTTP request. * When no active HTTP request can be determined (for examp...
Remove getInstance thanks to DI
<?php namespace Core; class Router { private $routes = array(); public function __construct() { $this->routes = require dirname(__DIR__) . '/config/routes.php'; } public function get($key) { if(array_key_exists($key, $this->routes)) { return $this->route...
<?php namespace Core; class Router { private $routes = array(); private static $_instance; public static function getInstance() { if(is_null(self::$_instance)) { self::$_instance = new Router(); } return self::$_instance; } public function __con...
Add method isDirectory to File model
define([ "hr/hr", "hr/utils", "core/rpc" ], function(hr, _, rpc) { var File = hr.Model.extend({ defaults: { path: null, name: null, directory: false, size: 0, mtime: 0, atime: 0 }, idAttribute: "name", ...
define([ "hr/hr", "hr/utils", "core/rpc" ], function(hr, _, rpc) { var File = hr.Model.extend({ defaults: { path: null, name: null, directory: false, size: 0, mtime: 0, atime: 0 }, idAttribute: "name", ...
Add stop waiter to call buffer
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiter = None self.queue = collections.deque(maxlen=CALL_QUEUE_MAX) self.call_waiters = {} def wait_for_calls(self, callback): self.stop_waiter() calls = [] while...
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiter = None self.queue = collections.deque(maxlen=CALL_QUEUE_MAX) self.call_waiters = {} def wait_for_calls(self, callback): if self.waiter: self.waiter([]) ...
Allow to filter expert bids by a customer [WAL-1169]
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
Add immediate checkbox to admin form
<?php namespace Mapbender\CoreBundle\Element\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; /** * */ class RulerAdminType extends AbstractType { /** * @inheritdoc */ public function g...
<?php namespace Mapbender\CoreBundle\Element\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; /** * */ class RulerAdminType extends AbstractType { /** * @inheritdoc */ public function g...
Rework condition on cutom filter example
<?php /** * PlumSearch plugin for CakePHP Rapid Development Framework * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @author Evgeny Tomenko * @since PlumSearch 0.1 * @license http://www.opensource.org/licenses/mit-license.php MIT Li...
<?php /** * PlumSearch plugin for CakePHP Rapid Development Framework * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @author Evgeny Tomenko * @since PlumSearch 0.1 * @license http://www.opensource.org/licenses/mit-license.php MIT Li...
Repair validate single shape validator
import pyblish.api class ValidateMindbenderSingleShape(pyblish.api.InstancePlugin): """Transforms with a mesh must ever only contain a single mesh This ensures models only contain a single shape node. """ label = "Validate Single Shape" order = pyblish.api.ValidatorOrder hosts = ["maya"] ...
import pyblish.api class ValidateMindbenderSingleShape(pyblish.api.InstancePlugin): """One mesh per transform""" label = "Validate Single Shape" order = pyblish.api.ValidatorOrder hosts = ["maya"] active = False optional = True families = [ "mindbender.model", "mindbender....
Add ability to generate a Job easily. Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
import sys import time from django.utils import simplejson from .utils import get_path, get_middleware class Job(object): def __init__(self, path, args, kwargs): self.path = path self.args = args self.kwargs = kwargs @classmethod def from_json(cls, json): return cls(**sim...
import sys import time from django.utils import simplejson from .utils import get_path, get_middleware class Job(object): def __init__(self, path, args, kwargs): self.path = path self.args = args self.kwargs = kwargs def run(self): start = time.time() middleware = ge...
Include superusers in web user domaing access record
from __future__ import absolute_import from __future__ import unicode_literals from datetime import datetime, timedelta from django.utils.deprecation import MiddlewareMixin from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY from corehq.util.quickcache import quickc...
from __future__ import absolute_import from __future__ import unicode_literals from datetime import datetime, timedelta from django.utils.deprecation import MiddlewareMixin from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY from corehq.util.quickcache import quickc...
Add support for query relatives in simple example
from aiohttp_json_api.schema import BaseSchema, fields, relationships from .models import Article, Comment, People class SchemaWithStorage(BaseSchema): @property def storage(self): return self.app['storage'][self.resource_class.__name__] async def fetch_resource(self, resource_id, context, **kwa...
from aiohttp_json_api.schema import BaseSchema, fields, relationships from .models import Article, Comment, People class SchemaWithStorage(BaseSchema): @property def storage(self): return self.app['storage'][self.resource_class.__name__] async def query_collection(self, context, **kwargs): ...
Fix exit code handling in Promise.
var spawn = require("cross-spawn"); export default function (cmd, subcmd = [], options = {}) { return new Promise((resolve, reject) => { options.maxBuffer = 1024 * 1024; let cp = spawn(cmd, subcmd, options); let stdout = [], stderr = []; let error = ""; let setup = (stream, ...
var spawn = require("cross-spawn"); export default function (cmd, subcmd = [], options = {}) { return new Promise((resolve, reject) => { options.maxBuffer = 1024 * 1024; let cp = spawn(cmd, subcmd, options); let stdout = [], stderr = []; let error = ""; let setup = (stream, ...
Add get operation to JSON wrapper
""" Hamcrest matching support for JSON responses. """ from json import dumps, loads from hamcrest.core.base_matcher import BaseMatcher def prettify(value): return dumps( value, sort_keys=True, indent=4, separators=(',', ': '), ) class JSON(object): """ Dictionary wra...
""" Hamcrest matching support for JSON responses. """ from json import dumps, loads from hamcrest.core.base_matcher import BaseMatcher def prettify(value): return dumps( value, sort_keys=True, indent=4, separators=(',', ': '), ) class JSON(object): """ Dictionary wra...
Add value alias to script routine...
<?php /** config.init.php * @author Team22mars <pierre@owni.fr> * @version 1.0 * @desc Set up the application */ // MySQL Database settings // ----------------------- if (strstr($_SERVER['SERVER_NAME'], 'influencenetworks.org') ): /* *** PROD ENVIRONMENT *** */ ...
<?php /** config.init.php * @author Team22mars <pierre@owni.fr> * @version 1.0 * @desc Set up the application */ // MySQL Database settings // ----------------------- if (strstr($_SERVER['SERVER_NAME'], 'influencenetworks.org') ): /* *** PROD ENVIRONMENT *** */ ...
Add PHP-CS-Fixer with a simple baseline
<?php namespace SimpleBus\Asynchronous\Tests\Properties; use PHPUnit\Framework\TestCase; use SimpleBus\Asynchronous\Properties\AdditionalPropertiesResolver; use SimpleBus\Asynchronous\Properties\DelegatingAdditionalPropertiesResolver; class DelegatingAdditionalPropertiesResolverTest extends TestCase { /** *...
<?php namespace SimpleBus\Asynchronous\Tests\Properties; use PHPUnit\Framework\TestCase; use SimpleBus\Asynchronous\Properties\AdditionalPropertiesResolver; use SimpleBus\Asynchronous\Properties\DelegatingAdditionalPropertiesResolver; class DelegatingAdditionalPropertiesResolverTest extends TestCase { /** *...
Increase perfs when loading a product's page
'use strict'; var set_taxon_select = function(selector){ if ($(selector).length > 0) { $(selector).select2({ placeholder: Spree.translations.taxon_placeholder, multiple: true, initSelection: function (element, callback) { var url = Spree.url(Spree.routes.taxons_search, { ids: ...
'use strict'; var set_taxon_select = function(selector){ if ($(selector).length > 0) { $(selector).select2({ placeholder: Spree.translations.taxon_placeholder, multiple: true, initSelection: function (element, callback) { var url = Spree.url(Spree.routes.taxons_search, { ids: ...
Fix tests by passing default settings object rather than empty dict.
from contextlib import contextmanager from os import path from unittest import TestCase from dictdiffer import diff from jsontest import JsonTest from mock import patch from canaryd_packages import six from canaryd.plugin import get_plugin_by_name from canaryd.settings import CanarydSettings class TestPluginRealSt...
from contextlib import contextmanager from os import path from unittest import TestCase from dictdiffer import diff from jsontest import JsonTest from mock import patch from canaryd_packages import six from canaryd.plugin import get_plugin_by_name class TestPluginRealStates(TestCase): def test_meta_plugin(self...
Remove un-needed field in epoch serializer. git-svn-id: 4b387fe5ada7764508e2ca96c335714e4c1692c6@2115 0d517254-b314-0410-acde-c619094fa49f
package edu.northwestern.bioinformatics.studycalendar.xml.writers; import edu.northwestern.bioinformatics.studycalendar.dao.EpochDao; import edu.northwestern.bioinformatics.studycalendar.domain.Epoch; import edu.northwestern.bioinformatics.studycalendar.xml.AbstractStudyCalendarXmlSerializer; import org.dom4j.Document...
package edu.northwestern.bioinformatics.studycalendar.xml.writers; import edu.northwestern.bioinformatics.studycalendar.dao.EpochDao; import edu.northwestern.bioinformatics.studycalendar.domain.Epoch; import edu.northwestern.bioinformatics.studycalendar.xml.AbstractStudyCalendarXmlSerializer; import org.dom4j.Document...
Set base path for ace
hqDefine('app_manager/js/download_index_main',[ 'jquery', 'underscore', 'ace-builds/src-min-noconflict/ace', 'app_manager/js/download_async_modal', 'app_manager/js/source_files', ],function ($, _, ace) { ace.config.set('basePath', '/ace-builds/src-noconflict'); $(function () { var e...
hqDefine('app_manager/js/download_index_main',[ 'jquery', 'underscore', 'ace-builds/src-min-noconflict/ace', 'app_manager/js/download_async_modal', 'app_manager/js/source_files', ],function ($, _, ace) { $(function () { var elements = $('.prettyprint'); _.each(elements, functi...
Add name to the snapshot extension
from chainer.serializers import npz from chainer.trainer import extension def snapshot(savefun=npz.save_npz, filename='snapshot_iter_{.updater.iteration}'): """Return a trainer extension to take snapshots of the trainer. This extension serializes the trainer object and saves it to the output ...
from chainer.serializers import npz from chainer.trainer import extension def snapshot(savefun=npz.save_npz, filename='snapshot_iter_{.updater.iteration}'): """Return a trainer extension to take snapshots of the trainer. This extension serializes the trainer object and saves it to the output ...
Make empty notifications message localisable
<style> .notificationsCounter { animation-duration: .5s; } .notificationIcon { font-size: 30px; } </style> <li class="dropdown messages-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true"> <i class="fa fa-bell-o"></i> <span class="la...
<style> .notificationsCounter { animation-duration: .5s; } .notificationIcon { font-size: 30px; } </style> <li class="dropdown messages-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true"> <i class="fa fa-bell-o"></i> <span class="la...
Fix console script to mirror git repos even if it has never been done before
<?php namespace REBELinBLUE\Deployer\Console\Commands; use Carbon\Carbon; use Illuminate\Console\Command; use Illuminate\Foundation\Bus\DispatchesJobs; use REBELinBLUE\Deployer\Jobs\UpdateGitMirror; use REBELinBLUE\Deployer\Project; /** * Updates the mirrors for all git repositories. */ class UpdateGitMirrors exte...
<?php namespace REBELinBLUE\Deployer\Console\Commands; use Carbon\Carbon; use Illuminate\Console\Command; use Illuminate\Foundation\Bus\DispatchesJobs; use REBELinBLUE\Deployer\Jobs\UpdateGitMirror; use REBELinBLUE\Deployer\Project; /** * Updates the mirrors for all git repositories. */ class UpdateGitMirrors exte...
Join callback lists returned from backends
from django.utils.module_loading import import_string def _get_backends(): backends = [] for backend_path in ['mama_cas.services.backends.SettingsBackend']: backend = import_string(backend_path)() backends.append(backend) return backends def _is_allowed(attr, *args): for backend in _...
from django.utils.module_loading import import_string def _get_backends(): backends = [] for backend_path in ['mama_cas.services.backends.SettingsBackend']: backend = import_string(backend_path)() backends.append(backend) return backends def _is_allowed(attr, *args): for backend in _...
Use HashSet instead of List
package com.aware.plugin.term_collector; import android.content.Context; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; /** * Created by wmb on 08.01.14. */ public class StopWords { private HashSet<String> stopwords;...
package com.aware.plugin.term_collector; import android.content.Context; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; /** * Created by wmb on 08.01.14. */ public class StopWords { private List<String> stopwords; ...
Remove !$temp check to fix loading an empty array
<?php namespace Noodlehaus\FileParser; use Exception; use Noodlehaus\Exception\ParseException; use Noodlehaus\Exception\UnsupportedFormatException; /** * PHP file parser * * @package Config * @author Jesus A. Domingo <jesus.domingo@gmail.com> * @author Hassan Khan <contact@hassankhan.me> * @link ...
<?php namespace Noodlehaus\FileParser; use Exception; use Noodlehaus\Exception\ParseException; use Noodlehaus\Exception\UnsupportedFormatException; /** * PHP file parser * * @package Config * @author Jesus A. Domingo <jesus.domingo@gmail.com> * @author Hassan Khan <contact@hassankhan.me> * @link ...
Remove random numbers at bottom
$(function() { $('.atml-description--title').click(function(e) { e.preventDefault(); var $this = $(this); var $contentId = $this.data('content'); var $content = $this.parent().next('div'); var $descriptions = $('.atml-description--content'); var $lis...
$(function() { $('.atml-description--title').click(function(e) { e.preventDefault(); var $this = $(this); var $contentId = $this.data('content'); var $content = $this.parent().next('div'); var $descriptions = $('.atml-description--content'); var $lis...
Clean PostgreSQL - commit after each change not to keep state in memory
from selinon import StoragePool from cucoslib.models import WorkerResult, Analysis from .base import BaseHandler class CleanPostgres(BaseHandler): """ Clean JSONB columns in Postgres """ def execute(self): s3 = StoragePool.get_connected_storage('S3Data') results = self.postgres.session.query...
from selinon import StoragePool from cucoslib.models import WorkerResult, Analysis from .base import BaseHandler class CleanPostgres(BaseHandler): """ Clean JSONB columns in Postgres """ def execute(self): s3 = StoragePool.get_connected_storage('S3Data') results = self.postgres.session.query...
chore: Use different port for server task
module.exports = function(grunt) { // Project configuration grunt.initConfig({ clean: { all: { src: ['.tmp', 'dist'] } }, concat: { all: { src: [ 'less/mixins.less', 'less/variables.less', 'less/*.less', ], ...
module.exports = function(grunt) { // Project configuration grunt.initConfig({ clean: { all: { src: ['.tmp', 'dist'] } }, concat: { all: { src: [ 'less/mixins.less', 'less/variables.less', 'less/*.less', ], ...
Fix local opts from CLI
# -*- coding: utf-8 -*- ''' React by calling async runners ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # import salt libs import salt.runner def cmd( name, func=None, arg=(), **kwargs): ''' Execute a runner asynchronous: ...
# -*- coding: utf-8 -*- ''' React by calling async runners ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # import salt libs import salt.runner def cmd( name, func=None, arg=(), **kwargs): ''' Execute a runner asynchronous: ...
Fix metadata addition when the results are empty
<?php /* * This file is part of Packagist. * * (c) Jordi Boggiano <j.boggiano@seld.be> * Nils Adermann <naderman@naderman.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Packagist\WebBundle\Controller; use Sym...
<?php /* * This file is part of Packagist. * * (c) Jordi Boggiano <j.boggiano@seld.be> * Nils Adermann <naderman@naderman.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Packagist\WebBundle\Controller; use Sym...