text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
[AC-9452] Fix image field import and migration
# Generated by Django 2.2.28 on 2022-04-20 13:05 import sorl.thumbnail.fields from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ ('accelerator', '0098_update_startup_update_20220408_0441'), ] operations = [ migrations.AddField( ...
# Generated by Django 2.2.28 on 2022-04-20 13:05 from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ ('accelerator', '0098_update_startup_update_20220408_0441'), ] operations = [ migrations.AddField( model_name='progr...
Switch from optparase to argparse
# -*- coding: utf-8 -*- import argparse import logging import os import signal import time from watchdog.observers import Observer from pyautotest.observers import Notifier, ChangeHandler # Configure logging logging.basicConfig(format='%(asctime)s (%(name)s) [%(levelname)s]: %(message)s', datefmt='%m-%d-%Y %H:%M:%S...
# -*- coding: utf-8 -*- import logging import os import signal import time from optparse import OptionParser from watchdog.observers import Observer from pyautotest.observers import Notifier, ChangeHandler # Configure logging logging.basicConfig(format='%(asctime)s (%(name)s) [%(levelname)s]: %(message)s', datefmt=...
Fix absolute reference to logfile location
import pathlib _basedir = pathlib.Path(__file__).parents[1] SQLALCHEMY_DATABASE_URI = ( 'sqlite:///' + str(_basedir.joinpath(pathlib.PurePath('app.db')).resolve()) ) SQLALCHEMY_TRACK_MODIFICATIONS = True SECRET_KEY = 'INSECURE' MAIL_SERVER = 'localhost' MAIL_PORT = '25' MAIL_DEFAULT_SENDER = 'no-reply@localhos...
import pathlib _basedir = pathlib.Path(__file__).parents[1] SQLALCHEMY_DATABASE_URI = ( 'sqlite:///' + str(_basedir.joinpath(pathlib.PurePath('app.db')).resolve()) ) SQLALCHEMY_TRACK_MODIFICATIONS = True SECRET_KEY = 'INSECURE' MAIL_SERVER = 'localhost' MAIL_PORT = '25' MAIL_DEFAULT_SENDER = 'no-reply@localhos...
Fix issue where StyleSheet.create() is called when it doesn't have to be
import { StyleSheet } from 'react-native'; import { flatten } from 'lodash'; export const cachedStyles = {}; export const styleHasher = JSON.stringify; // todo: how bad is this? // Uses cached or generates a new StyleSheet for a given style prop const createStyleSheet = (stylesToGenerate) => { let styles = flatten(...
import { StyleSheet } from 'react-native'; import { flatten } from 'lodash'; export const cachedStyles = {}; export const styleHasher = JSON.stringify; // todo: how bad is this? // Uses cached or generates a new StyleSheet for a given style prop const createStyleSheet = (stylesToGenerate) => { let styles = flatten(...
Fix in test for pathologic grammars.
# -*- coding: utf-8 -*- ####################################################################### # Name: test_pathologic_models # Purpose: Test for grammar models that could lead to infinite loops are # handled properly. # Author: Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com> # Copyright: (c) 2014 Igor R. De...
# -*- coding: utf-8 -*- ####################################################################### # Name: test_pathologic_models # Purpose: Test for grammar models that could lead to infinite loops are # handled properly. # Author: Igor R. Dejanović <igor DOT dejanovic AT gmail DOT com> # Copyright: (c) 2014 Igor R. De...
Effects: Refactor transfer back compat to avoid bad nested return Download builder replaces return statements while concatenating a bundle, but fails to deal with this nested return. Since this module is already deprecated, pulling the return to the top level makes more sense.
/*! * jQuery UI Effects Transfer @VERSION * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ //>>label: Transfer Effect //>>group: Effects //>>description: Displays a transfer effect from one element to another. //>>docs:...
/*! * jQuery UI Effects Transfer @VERSION * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ //>>label: Transfer Effect //>>group: Effects //>>description: Displays a transfer effect from one element to another. //>>docs:...
Annotate jsdoc for FilterBuilder class as private
import { cloneDeep } from 'lodash' import filters from './index' import { boolMerge } from '../utils' export default class FilterBuilder { constructor () { this._filters = {} } /** * Apply a filter of a given type providing all the necessary arguments, * passing these arguments directly to the specifie...
import { cloneDeep } from 'lodash' import filters from './index' import { boolMerge } from '../utils' export default class FilterBuilder { constructor () { this._filters = {} } /** * Apply a filter of a given type providing all the necessary arguments, * passing these arguments directly to the specifie...
Make onContentsChanged public in the uitemstackhandler
package info.u_team.u_team_core.inventory; import info.u_team.u_team_core.api.item.IExtendedItemHandler; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.ItemStackHandler; public class UItemStackHandler extends ItemStackHandler implements IExtendedI...
package info.u_team.u_team_core.inventory; import info.u_team.u_team_core.api.item.IExtendedItemHandler; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.ItemStackHandler; public class UItemStackHandler extends ItemStackHandler implements IExtendedI...
Fix test broken by previous commit.
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> """Tests for creating a simple tight-binding model.""" import pytest from parameters import T_VALUES, KPT @pytest.mark.parametrize('t1', T_VALUES) @pytest.mark.para...
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> """Tests for creating a simple tight-binding model.""" import pytest from parameters import T_VALUES, KPT @pytest.mark.parametrize('t1', T_VALUES) @pytest.mark.para...
Make the order of LINKS output consistent
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from zope.interface import implements class LinksCommand(ModuleData, Command): implements(IPlugin, IModuleData, ICommand) name = "LinksCommand" core = True d...
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from zope.interface import implements class LinksCommand(ModuleData, Command): implements(IPlugin, IModuleData, ICommand) name = "LinksCommand" core = True d...
Fix broken test in maybeSendVerificationEmail
import Users from "meteor/vulcan:users"; import { addCallback } from 'meteor/vulcan:core'; const TRUSTLEVEL1_THRESHOLD = 2000 function updateTrustedStatus ({newDocument, vote}) { const user = Users.findOne(newDocument.userId) if (user.karma >= TRUSTLEVEL1_THRESHOLD && (!Users.getGroups(user).includes('trustLevel...
import Users from "meteor/vulcan:users"; import { addCallback } from 'meteor/vulcan:core'; const TRUSTLEVEL1_THRESHOLD = 2000 function updateTrustedStatus ({newDocument, vote}) { const user = Users.findOne(newDocument.userId) if (user.karma >= TRUSTLEVEL1_THRESHOLD && (!Users.getGroups(user).includes('trustLevel...
Quit Blender after writing FBX
# !/usr/bin/env python # Blender has moved to Python 3! import sys import os import bpy for sysarg in sys.argv: print(sysarg) py_args = sys.argv[sys.argv.index('--') + 1] py_args = py_args.split(' ') for arg in py_args: if (arg.startswith('basedir:')): basedir = arg.split('basedir:')[1] else: ...
# !/usr/bin/env python # Blender has moved to Python 3! import sys import os import bpy for sysarg in sys.argv: print(sysarg) py_args = sys.argv[sys.argv.index('--') + 1] py_args = py_args.split(' ') for arg in py_args: if (arg.startswith('basedir:')): basedir = arg.split('basedir:')[1] else: ...
Add MIDDLEWARE_CLASSES to test settings Squelches a warning when using Django 1.7.
#!/usr/bin/env python import django from django.conf import settings from django.core.management import call_command settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', } }, ALLOWED_HOSTS=[ 'testserver', ], INSTALLED_APPS=[ ...
#!/usr/bin/env python import django from django.conf import settings from django.core.management import call_command settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', } }, ALLOWED_HOSTS=[ 'testserver', ], INSTALLED_APPS=[ ...
Update djsonb, and add pytz
#!/usr/bin/env python from setuptools import setup, find_packages tests_require = [] setup( name='ashlar', version='0.0.2', description='Define and validate schemas for metadata for geotemporal event records', author='Azavea, Inc.', author_email='info@azavea.com', keywords='gis jsonschema', ...
#!/usr/bin/env python from setuptools import setup, find_packages tests_require = [] setup( name='ashlar', version='0.0.2', description='Define and validate schemas for metadata for geotemporal event records', author='Azavea, Inc.', author_email='info@azavea.com', keywords='gis jsonschema', ...
Fix the usage for `service rm` command Signed-off-by: Yi EungJun <d8a05a153c80bfd80b76dd9b85a05eebcec2ca4e@navercorp.com>
package service import ( "fmt" "strings" "github.com/docker/docker/api/client" "github.com/docker/docker/cli" "github.com/spf13/cobra" "golang.org/x/net/context" ) func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "rm [OPTIONS] SERVICE [SERVICE...]", Alia...
package service import ( "fmt" "strings" "github.com/docker/docker/api/client" "github.com/docker/docker/cli" "github.com/spf13/cobra" "golang.org/x/net/context" ) func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "rm [OPTIONS] SERVICE", Aliases: []string...
Fix issue where modX was not yet available
<?php namespace MODX\Shell\Command\User; use MODX\Shell\Command\ListProcessor; /** * List all users for the current modX instance */ class GetList extends ListProcessor { protected $processor = 'security/user/getlist'; protected $headers = array( 'id', 'username', 'active', 'sudo' ); protec...
<?php namespace MODX\Shell\Command\User; use MODX\Shell\Command\ListProcessor; /** * List all users for the current modX instance */ class GetList extends ListProcessor { protected $processor = 'security/user/getlist'; protected $headers = array( 'id', 'username', 'active', 'sudo' ); protec...
Disable SSL mode in DB connection for now
package db import ( "database/sql" "fmt" "github.com/rafaeljusto/cctldstats/config" ) // Connection database connection. var Connection *sql.DB // Connect performs the database connection. Today the following databases are supported: mysql and postgres func Connect() (err error) { var connParams string switch ...
package db import ( "database/sql" "fmt" "github.com/rafaeljusto/cctldstats/config" ) // Connection database connection. var Connection *sql.DB // Connect performs the database connection. Today the following databases are supported: mysql and postgres func Connect() (err error) { var connParams string switch ...
Add back logging for production debug
package com.psidox.saddlewoof.web.rest; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.ext.Provider; import java.io.IOException; @Provider @PreMatching public class Interceptor implements Container...
package com.psidox.saddlewoof.web.rest; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.ext.Provider; import java.io.IOException; @Provider @PreMatching public class Interceptor implements Container...
Add Polyfill to standalone build, bring exports on par with lib build
import 'babel/polyfill'; import 'isomorphic-fetch'; // Configuration export {default as render} from './render'; export {default as configure} from './configure'; export {default as configureRoutes} from './configureRoutes'; export {configureJSXRoutes} from './configureRoutes'; // Components export {default as Card} ...
import 'isomorphic-fetch'; // Configuration export {default as render} from './render'; export {default as configure} from './configure'; export {default as configureRoutes} from './configureRoutes'; export {configureJSXRoutes} from './configureRoutes'; // Components export {default as Card} from './components/Page/P...
Add tests for correct class name which ignores non-php files. Is this code necessary since we should be ignoring non-php files already?
<?php namespace li3_quality\tests\cases\test\rules; class HasCorrectClassNameTest extends \li3_quality\test\Unit { public $rule = 'li3_quality\test\rules\HasCorrectClassName'; public function testWithClosingTag() { $code = <<<EOD namespace bar/baz; class FooBar {} EOD; $this->assertRulePass(array( 'source'...
<?php namespace li3_quality\tests\cases\test\rules; class HasCorrectClassNameTest extends \li3_quality\test\Unit { public $rule = 'li3_quality\test\rules\HasCorrectClassName'; public function testWithClosingTag() { $code = <<<EOD namespace bar/baz; class FooBar {} EOD; $this->assertRulePass(array( 'source'...
Add tests to make sure each rule has a recommended setting and a description
import fs from 'fs'; import test from 'ava'; import pify from 'pify'; import index from '../'; test('every rule should defined in the index file and recommended settings', async t => { const files = await pify(fs.readdir, Promise)('../rules/'); const rules = files.filter(file => file.indexOf('.js') === file.length...
import fs from 'fs'; import test from 'ava'; import pify from 'pify'; import index from '../'; test('every rule should defined in the index file and recommended settings', async t => { const files = await pify(fs.readdir, Promise)('../rules/'); const rules = files.filter(file => file.indexOf('.js') === file.length...
Make output even more minimal.
from collections import OrderedDict from server import prepare_data, query_server from parser import parse_response from bottle import route, request, run, view, JSONPlugin, json_dumps as dumps from functools import partial import bottle bottle.TEMPLATE_PATH = ["api/views/"] bottle.debug(True) bottle.TEMPLATES.clear()...
from collections import OrderedDict from server import prepare_data, query_server from parser import parse_response from bottle import route, request, run, view import bottle bottle.TEMPLATE_PATH = ["api/views/"] bottle.debug(True) bottle.TEMPLATES.clear() @route('/api/') @view('index') def index(): site = "%s://...
Remove dirties context of testcontainerbase
package org.synyx.urlaubsverwaltung; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; import org.testcontainers.containers.MariaDBContainer; import static org.testcontainers.contai...
package org.synyx.urlaubsverwaltung; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; import org.testcontainers.containers.MariaDBContainer; import static org.testcontainers.contai...
Add support for new ValueRestriction QueryTagValues parameter in HavenSearchComponents (FIND-975) Add new parameters for GetQueryTagValues [rev. matthew.gordon]
/* * Copyright 2015-2016 Hewlett-Packard Development Company, L.P. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. */ package com.hp.autonomy.types.requests.idol.actions.tags.params; public enum GetQueryTagValuesParams { AllowNonParametricField...
/* * Copyright 2015-2016 Hewlett-Packard Development Company, L.P. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. */ package com.hp.autonomy.types.requests.idol.actions.tags.params; public enum GetQueryTagValuesParams { AllowNonParametricField...
Set text to help menu.
package com.github.aureliano.edocs.app.gui.menu.help; import javax.swing.JMenu; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import com.github.aureliano.edocs.app.model.IDatabaseConnectionDependent; import com.github.aureliano.edocs.common.locale.EdocsLocale; public class HelpMenu exten...
package com.github.aureliano.edocs.app.gui.menu.help; import javax.swing.JMenu; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import com.github.aureliano.edocs.app.model.IDatabaseConnectionDependent; import com.github.aureliano.edocs.common.locale.EdocsLocale; public class HelpMenu exten...
Fix legacy use of action result
#!/usr/bin/env python # # Print the list of sysdig captures. # import os import sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..')) from sdcclient import SdcClient # # Parse arguments # if len(sys.argv) != 2: print('usage: %s <sysdig-token>' % sys.argv[0]) print('You can...
#!/usr/bin/env python # # Print the list of sysdig captures. # import os import sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..')) from sdcclient import SdcClient # # Parse arguments # if len(sys.argv) != 2: print('usage: %s <sysdig-token>' % sys.argv[0]) print('You can...
Remove dots when small screen
const settings = { autoplay: true, infinite: true, dots: true, speed: 500, pauseOnHover: true, responsive: [ { breakpoint: 100000, settings: { slidesToShow: 5, slidesToScroll: 5, infinite: true, dots: true } }, { breakpoint: 1500, set...
const settings = { autoplay: true, infinite: true, dots: true, speed: 500, pauseOnHover: true, responsive: [ { breakpoint: 100000, settings: { slidesToShow: 5, slidesToScroll: 5, infinite: true, dots: true } }, { breakpoint: 1500, set...
Add new logging style logs
package main import ( "encoding/json" "fmt" "net/http" ) var taskIndex = 0 func startHTTP() { http.HandleFunc("/api/addtask", addTaskHandler) log.Info.Printf("API listening on port %d", *port) if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil { log.Error.Fatalf("Failed to start listen...
package main import ( "encoding/json" "fmt" "log" "net/http" ) var taskIndex = 0 func startHTTP() { http.HandleFunc("/api/addtask", addTaskHandler) log.Printf("api listening on port %d", *port) if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil { log.Fatalf("failed to start listening ...
Add option to define amount of gas sent in post request
const contractHelper = require('../contracts/contractHelpers.js'); const web3Connection = require('../web3.js'); const loggers = require('../loggers/events.js'); const web3 = web3Connection.web3; const buySvc = { buyTicket: (req, res) => { const contractAddress = req.body.contractAddress; // address of deployed...
const contractHelper = require('../contracts/contractHelpers.js'); const web3Connection = require('../web3.js'); const loggers = require('../loggers/events.js'); const web3 = web3Connection.web3; const buySvc = { buyTicket: (req, res) => { const contractAddress = req.body.contractAddress; // address of deployed...
Change lifetime to 1 week
'use strict'; var Memcached = require('memcached'), replify = require('replify'), Promise = require('rsvp').Promise; module.exports = function(connection) { var memcachedstore = new Memcached(connection); var API = { get: function(id){ return new Promise(function(resolve, reject) { me...
'use strict'; var Memcached = require('memcached'), replify = require('replify'), Promise = require('rsvp').Promise; module.exports = function(connection) { var memcachedstore = new Memcached(connection); var API = { get: function(id){ return new Promise(function(resolve, reject) { me...
Prepare development of new version.
# -*- coding: utf-8 -*- # Copyright © 2009 Ben Finney <ben+python@benfinney.id.au> # Copyright © 2006 Robert Niederreiter # # This is free software: you may copy, modify, and/or distribute this work # under the terms of the Python Software Foundation License, version 2 or # later as published by the Python Software Fo...
# -*- coding: utf-8 -*- # Copyright © 2009 Ben Finney <ben+python@benfinney.id.au> # Copyright © 2006 Robert Niederreiter # # This is free software: you may copy, modify, and/or distribute this work # under the terms of the Python Software Foundation License, version 2 or # later as published by the Python Software Fo...
Add spinner when remote markdown is loading
import React from 'react'; import {fetchMarkdown} from './client.js'; import marked from './marked'; import externalLinkSetup from './externalLinkSetup.js'; export default class About extends React.Component { constructor() { super(); this.state = { markdownText: '' }; } get pageTitle() { r...
import React from 'react'; import {fetchMarkdown} from './client.js'; import marked from './marked'; import externalLinkSetup from './externalLinkSetup.js'; export default class About extends React.Component { constructor() { super(); this.state = { markdownText: '' }; } get pageTitle() { r...
Fix for duplicat field in Json serialisation.
package com.github.onsdigital.json.release; import com.github.onsdigital.json.ContentType; import com.github.onsdigital.json.Reference; import com.github.onsdigital.json.dataset.Dataset; import com.github.onsdigital.json.markdown.Article; import com.github.onsdigital.json.markdown.Bulletin; /** * Represents a sectio...
package com.github.onsdigital.json.release; import com.github.onsdigital.json.ContentType; import com.github.onsdigital.json.Reference; import com.github.onsdigital.json.dataset.Dataset; import com.github.onsdigital.json.markdown.Article; import com.github.onsdigital.json.markdown.Bulletin; /** * Represents a sectio...
Use System.import until jest supports it
import Definition, { asyncComponent } from 'hippo/screens/definition'; import Group from 'hippo/screens/group'; <% Hippo::Screen.each_group do | group | %> Group.register( <%= group.to_json %> ); <% end -%> const Screens = {}; <% Hippo::Screen.each do | screen | -%> Screens['<%= screen.identifier %>'] = <%= screen.t...
import Definition, { asyncComponent } from 'hippo/screens/definition'; import Group from 'hippo/screens/group'; <% Hippo::Screen.each_group do | group | %> Group.register( <%= group.to_json %> ); <% end -%> const Screens = {}; <% Hippo::Screen.each do | screen | -%> Screens['<%= screen.identifier %>'] = <%= screen.t...
Prepend library/ to the include_path to help prevent testing other copies of the framework. git-svn-id: b6e219894c353fb1d215c78b2075057d8daadfba@604 44c647ce-9c0f-0410-b52a-842ac1e357ba
<?php if (!defined('PHPUnit2_MAIN_METHOD')) { define('PHPUnit2_MAIN_METHOD', 'AllTests::main'); } require_once 'PHPUnit2/Framework/TestSuite.php'; require_once 'PHPUnit2/TextUI/TestRunner.php'; /** * Read in user-defined test configuration if available; otherwise, read default test configuration */ if (is_reada...
<?php if (!defined('PHPUnit2_MAIN_METHOD')) { define('PHPUnit2_MAIN_METHOD', 'AllTests::main'); } require_once 'PHPUnit2/Framework/TestSuite.php'; require_once 'PHPUnit2/TextUI/TestRunner.php'; /** * Read in user-defined test configuration if available; otherwise, read default test configuration */ if (is_reada...
Add log message when running Gulp in development mode
var gulp = require('gulp'); var less = require('gulp-less'); var browserify = require('browserify'); var LessPluginCleanCSS = require('less-plugin-clean-css'); var cleancss = new LessPluginCleanCSS({advanced: true}); var source = require('vinyl-source-stream'); var uglify = require('gulp-uglify'); var streamify = requi...
var gulp = require('gulp'); var less = require('gulp-less'); var browserify = require('browserify'); var LessPluginCleanCSS = require('less-plugin-clean-css'); var cleancss = new LessPluginCleanCSS({advanced: true}); var source = require('vinyl-source-stream'); var uglify = require('gulp-uglify'); var streamify = requi...
Clean up Ember.Application ext tests
/** These tests ensure that Ember Data works with Ember.js' application initialization and dependency injection APIs. */ var app; module("Ember.Application Extensions", { setup: function() { var Router = Ember.Router.extend({ root: Ember.Route.extend() }); Ember.run(function() { app = E...
/** These tests ensure that Ember Data works with Ember.js' application initialization and dependency injection APIs. */ var app; module("Ember.Application extensions", { setup: function() { var Router = Ember.Router.extend({ root: Ember.Route.extend() }); Ember.run(function() { app = E...
Put the script loading in test in a try/catch because it was causing an error in certain cases with Opera.
var loadScripts = function(js_files, onComplete){ var len = js_files.length; var head = document.getElementsByTagName('head')[0]; function loadScript(index){ if (index >= len){ onComplete(); return; } try { testOk = js_files[index].test(); ...
var loadScripts = function(js_files, onComplete){ var len = js_files.length; var head = document.getElementsByTagName('head')[0]; function loadScript(index){ if (index >= len){ onComplete(); return; } if (js_files[index].test()){ // console.log('...
Update migration to overwrite existing destination table. I think migrations were failing because a "lookup" would end up creating the destination table in the QA/Thor database, and then trying to use the `renameCollection` method would silently fail because the table already existed. See: https://docs.mongodb.org/ma...
<?php use Illuminate\Database\Migrations\Migration; class RenameClientTable extends Migration { /** * The raw MongoDB interface. * @var MongoDB */ protected $mongodb; public function __construct() { $this->mongodb = app('db')->getMongoDB(); } /** * Run the migrati...
<?php use Illuminate\Database\Migrations\Migration; class RenameClientTable extends Migration { /** * The raw MongoDB interface. * @var MongoDB */ protected $mongodb; public function __construct() { $this->mongodb = app('db')->getMongoDB(); } /** * Run the migrati...
Set mapping to standard for gamepad object.
export default class { constructor (win, keys) { this.keys = keys this.win = win this.id = 'keypad' this.mapping = 'standard' this.buttons = [] for (var key in this.keys) { this.buttons[this.keys[key]] = {pressed: false} } this.onkey = function (event) { if (event.which i...
export default class { constructor (win, keys) { this.keys = keys this.win = win this.id = 'keypad' this.buttons = [] for (var key in this.keys) { this.buttons[this.keys[key]] = {pressed: false} } this.onkey = function (event) { if (event.which in this.keys) { let pre...
Use python 2.7+ standard importlib instead of deprecated django importlib
from django.conf import settings import importlib def import_from_string(val, setting_name): """ Attempt to import a class from a string representation. Based on the method of the same name in Django Rest Framework. """ try: parts = val.split('.') module_path, class_name = '.'.join...
from django.conf import settings from django.utils import importlib def import_from_string(val, setting_name): """ Attempt to import a class from a string representation. Based on the method of the same name in Django Rest Framework. """ try: parts = val.split('.') module_path, cla...
[lib] Reduce AutoReload ping to 3s.
<script type="text/javascript"> // // Reload the app if server detects local change // (function() { function checkForReload() { var xhr = new XMLHttpRequest; xhr.open('get', 'http://' + document.location.host + '/autoreload', true); xhr.setRequestHeader('X-Requested-With','XMLHttpRequest')...
<script type="text/javascript"> // // Reload the app if server detects local change // (function() { function checkForReload() { var xhr = new XMLHttpRequest; xhr.open('get', 'http://' + document.location.host + '/autoreload', true); xhr.setRequestHeader('X-Requested-With','XMLHttpRequest')...
Use old style string formatting to appease readthedocs aging 3.5 interpreter.
# pyinfra # File: docs/conf.py # Desc: minimal Sphinx config from datetime import date, datetime from better import better_theme_path from pyinfra import __version__ _today = date.today() copyright = '{0}, Nick Barrett'.format(datetime.strftime(_today, '%Y')) extensions = [ # Official 'sphinx.ext.autodoc'...
# pyinfra # File: docs/conf.py # Desc: minimal Sphinx config from datetime import date, datetime from better import better_theme_path from pyinfra import __version__ _today = date.today() copyright = f'{datetime.strftime(_today, "%Y")}, Nick Barrett' extensions = [ # Official 'sphinx.ext.autodoc', 'sp...
Add autoFocus prop to popup main <input> - fixes it now in Chrome - FF currently breaks this, but apparently will be fixed in FF60: https://bugzilla.mozilla.org/show_bug.cgi?id=1324255
import React from 'react' import PropTypes from 'prop-types' import styles from './Popup.css' const Search = ({ onSearchEnter, onSearchChange, searchValue }) => ( <form className={styles.searchContainer}> <input autoFocus className={styles.search} name="query" ...
import React from 'react' import PropTypes from 'prop-types' import styles from './Popup.css' const Search = ({ onSearchEnter, onSearchChange, searchValue }) => ( <form className={styles.searchContainer}> <input className={styles.search} name="query" placeholder="Search...
Add one bigger size to arithmetic benchmark
import numpy as np from dynd import nd, ndt from benchrun import Benchmark, clock class ArithmeticBenchmark(Benchmark): parameters = ('size',) size = [100000, 10000000, 100000000] def run(self, size): a = nd.uniform(dst_tp = ndt.type('{} * float64'.format(size))) b = nd.uniform(dst_tp = ndt.type('{} *...
import numpy as np from dynd import nd, ndt from benchrun import Benchmark, clock class ArithemticBenchmark(Benchmark): parameters = ('size',) size = [100000, 10000000] def run(self, size): a = nd.uniform(dst_tp = ndt.type('{} * float64'.format(size))) b = nd.uniform(dst_tp = ndt.type('{} * float64'.f...
Prepare for next dev cycle
#!/usr/bin/env python # coding: utf-8 from setuptools import setup, find_packages setup( name="bentoo", description="Benchmarking tools", version="0.13.dev", packages=find_packages(), scripts=["scripts/bentoo-generator.py", "scripts/bentoo-runner.py", "scripts/bentoo-collector.py", "sc...
#!/usr/bin/env python # coding: utf-8 from setuptools import setup, find_packages setup( name="bentoo", description="Benchmarking tools", version="0.12", packages=find_packages(), scripts=["scripts/bentoo-generator.py", "scripts/bentoo-runner.py", "scripts/bentoo-collector.py", "script...
Add Semantic UI into the app layout.
<!DOCTYPE html> <html lang="en" prefix="dcterms: http://purl.org/dc/terms/ og: http://ogp.me/ns#"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <meta name="description" content="@yield('description')"> <meta name="author" content="@yield('author...
<!DOCTYPE html> <html lang="en" prefix="dcterms: http://purl.org/dc/terms/ og: http://ogp.me/ns#"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <meta name="description" content="@yield('description')"> <meta name="author" content="@yield('author...
[BPK-989] Fix spinner theme attributes export
/* * Backpack - Skyscanner's Design System * * Copyright 2017 Skyscanner Ltd * * 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 * * Un...
/* * Backpack - Skyscanner's Design System * * Copyright 2017 Skyscanner Ltd * * 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 * * Un...
Allow detail to be falsy
const CustomEvent = ((Event) => { if (Event) { try { new Event(); // eslint-disable-line no-new } catch (e) { return undefined; } } return Event; })(window.CustomEvent); function createCustomEvent(name, opts = {}) { let e; if (Event) { e = new Event(name, opts); if ('detail' i...
const CustomEvent = ((Event) => { if (Event) { try { new Event(); // eslint-disable-line no-new } catch (e) { return undefined; } } return Event; })(window.CustomEvent); function createCustomEvent(name, opts = {}) { let e; if (Event) { e = new Event(name, opts); if (opts.detai...
Add limitation of this defence in the comment
import torchaudio import librosa # There exist a limitation of this defense that it may lead to the problem of aliasing, and we can use the narrowband sample rate # rather than downsampling followed by upsampling. # resampling reference https://core.ac.uk/download/pdf/228298313.pdf # resampling input transformation de...
import torchaudio import librosa # resampling reference https://core.ac.uk/download/pdf/228298313.pdf # resampling input transformation defense for audio T = torchaudio.transforms # Read audio file audio_data = librosa.load(files, sr=16000)[0][-19456:] audio_data = torch.tensor(audio_data).float().to(device) # Di...
Support for web url widget creator
package uk.ac.edukapp.util; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import org.apache.commons.validator.routines.UrlValidator; public class ServletUtils { public static String getCookieValue(Cookie[] cookies, String cookieName, String defaultValue) { for (int...
package uk.ac.edukapp.util; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; public class ServletUtils { public static String getCookieValue(Cookie[] cookies, String cookieName, String defaultValue) { for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies...
Add some more output examples
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """Exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an interface to sty...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """Exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an interface to sty...
Fix product patterm form type
<?php namespace Furniture\ProductBundle\Form\Type\ProductPattern; use Furniture\ProductBundle\Entity\ProductPartPatternVariantSelection; use Furniture\ProductBundle\Entity\ProductVariantsPattern; use Furniture\ProductBundle\Form\Type\Pattern\PatternType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Co...
<?php namespace Furniture\ProductBundle\Form\Type\ProductPattern; use Furniture\ProductBundle\Entity\ProductPartPatternVariantSelection; use Furniture\ProductBundle\Entity\ProductVariantsPattern; use Furniture\ProductBundle\Form\Type\Pattern\PatternType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Co...
[Form] Replace methods in ChoiceView by public properties (PHP +100ms, Twig +400ms)
<?php foreach ($options as $index => $choice): ?> <?php if ($view['form']->isChoiceGroup($choice)): ?> <optgroup label="<?php echo $view->escape($view['translator']->trans($index, array(), $translation_domain)) ?>"> <?php foreach ($choice as $nested_choice): ?> <option value="<?p...
<?php foreach ($options as $index => $choice): ?> <?php if ($view['form']->isChoiceGroup($choice)): ?> <optgroup label="<?php echo $view->escape($view['translator']->trans($index, array(), $translation_domain)) ?>"> <?php foreach ($choice as $nested_choice): ?> <option value="<?p...
logout: Clean up logout method call. This was a silent type error -- we were passing an argument to a function that doesn't expect any. Make the code less confused. [greg: revised commit message]
/* @flow */ import React, { PureComponent } from 'react'; import { StyleSheet } from 'react-native'; import type { Actions, Auth } from '../types'; import connectWithActions from '../connectWithActions'; import { ZulipButton } from '../common'; import { unregisterPush } from '../api'; import { getAuth, getPushToken } ...
/* @flow */ import React, { PureComponent } from 'react'; import { StyleSheet } from 'react-native'; import type { Actions, Auth } from '../types'; import connectWithActions from '../connectWithActions'; import { ZulipButton } from '../common'; import { unregisterPush } from '../api'; import { getAuth, getAccounts, ge...
Use a more sensible output file name
#!/usr/bin/env node var fs = require("fs"); var glob = require("glob"); var ts = require("typescript"); var tsa = require("../lib/Analyzer"); var o = require("../lib/JsonOutput"); var arg = process.argv.slice(2)[0]; const fileNames = glob(arg, {}, function(err, files) { if (err) { console.log(err); ...
#!/usr/bin/env node var fs = require("fs"); var glob = require("glob"); var ts = require("typescript"); var tsa = require("../lib/Analyzer"); var o = require("../lib/JsonOutput"); var arg = process.argv.slice(2)[0]; const fileNames = glob(arg, {}, function(err, files) { if (err) { console.log(err); ...
Use AssertJ instead of JUnit expected to assert thrown exception.
package de.mvitz.jprops.core.api; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; import static org.mockito.BDDMockito.given; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.moc...
package de.mvitz.jprops.core.api; import static org.mockito.BDDMockito.given; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PropertiesInjectorTest { @...
Add optional parameters for starting location
#!/usr/bin/env python import sys, time import math class Ball: gravity = -3 # Dots per second squared def __init__(self, x=0, y=0): self.r = 255 self.g = 0 self.b = 0 self.x = 0 self.y = 0 self.vx = 0 self.vy = 0 def updateValues(self, timeElapsed=1): # timeElapsed in seconds self.x += self.vx * ...
#!/usr/bin/env python import sys, time import math class Ball: gravity = -3 # Dots per second squared def __init__(self): self.r = 255 self.g = 0 self.b = 0 self.x = 0 self.y = 0 self.vx = 0 self.vy = 0 def updateValues(self, timeElapsed=1): # timeElapsed in seconds self.x += self.vx * timeElapse...
Enhancement: Use {{!}} instead of ! for help.
var BLTPlugin = { init: function (client, imports) { return { handlers: { '!givemeblt': function (command) { client.act(command.channel, 'gives a juicy BLT to ' + command.nickname); } }, help: { 'givemeb...
var BLTPlugin = { init: function (client, imports) { return { handlers: { '!givemeblt': function (command) { client.act(command.channel, 'gives a juicy BLT to ' + command.nickname); } }, help: { 'givemeb...
Add run command to application
<?php /* * This file is part of the PHP To 7 Aid project. * * (c) Giso Stallenberg <gisostallenberg@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace GisoStallenberg\phpTo7aid\Console; use GisoStallenberg\phpTo7aid\Console\Com...
<?php /* * This file is part of the PHP To 7 Aid project. * * (c) Giso Stallenberg <gisostallenberg@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace GisoStallenberg\phpTo7aid\Console; use Symfony\Component\Console\Application...
Use better name and fix undefined references
import cli from 'cli'; import {Gpio} from 'chip-gpio'; import sensor from 'ds18x20'; var options = cli.parse(); var interval = 2000; var threshold = 25; var heater = new Gpio(0, 'out'); function setHeater(on) { console.log('Heater:', on ? 'on' : 'off'); heater.write(on ? 0 : 1); } function setHeaterOn() { set...
import cli from 'cli'; import {Gpio} from 'chip-gpio'; import temp from 'ds18x20'; var options = cli.parse(); var interval = 2000; var threshold = 25; var heater = new Gpio(0, 'out'); function setHeater(on) { console.log('Heater:', on ? 'on' : 'off'); heater.write(on ? 0 : 1); } function setHeaterOn() { setHe...
Add test to make sure public facing app raises exception when it hits an error.
import mock from auslib.test.web.test_client import ClientTestBase class TestDockerflowEndpoints(ClientTestBase): def testVersion(self): ret = self.client.get("/__version__") self.assertEquals(ret.data, """ { "source":"https://github.com/mozilla/balrog", "version":"1.0", "commit":"abcdef12...
import mock from auslib.test.web.test_client import ClientTestBase class TestDockerflowEndpoints(ClientTestBase): def testVersion(self): ret = self.client.get("/__version__") self.assertEquals(ret.data, """ { "source":"https://github.com/mozilla/balrog", "version":"1.0", "commit":"abcdef12...
Make it work in Python < 2.6
import os import sys def importRelativeOrAbsolute(f): # maybe there's a way to do this more sanely with the |imp| module... if f.endswith(".py"): f = f[:-3] if f.endswith(".pyc"): f = f[:-4] p, f = os.path.split(f) if p: # Add the path part of the given filename to the impor...
import os import sys def importRelativeOrAbsolute(f): # maybe there's a way to do this more sanely with the |imp| module... if f.endswith(".py"): f = f[:-3] if f.endswith(".pyc"): f = f[:-4] p, f = os.path.split(f) if p: # Add the path part of the given filename to the impor...
Fix small bug in Scaler class
# Author: Mainak Jas <mainak@neuro.hut.fi> # # License: BSD (3-clause) from sklearn.base import TransformerMixin from mne.fiff import pick_types class RtClassifier: """ TODO: complete docstring ... Parameters ---------- Attributes ---------- """ def __init__(self, estimator): ...
# Author: Mainak Jas <mainak@neuro.hut.fi> # # License: BSD (3-clause) from sklearn.base import TransformerMixin from mne.fiff import pick_types class RtClassifier: """ TODO: complete docstring ... Parameters ---------- Attributes ---------- """ def __init__(self, estimator): ...
Remove reference to ForceCapitalizeMixin from migration file and update with SlugifyMixin
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-30 19:59 from __future__ import unicode_literals import common.mixins from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0003_mealoption'), ] operations = [ migra...
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-30 19:59 from __future__ import unicode_literals import common.mixins from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0003_mealoption'), ] operations = [ migra...
Fix redis error => If redis client subscribed a key, it cannot run another commands.
import SocketIO from 'socket.io'; import { createClient } from 'redis'; import { redisUrl } from './config'; const io = SocketIO(); io.use((socket, next) => { return next(); }); io.of('/live-chatroom') .use((socket, next) => { return next(); }) .on('connection', (socket) => { const redisSubscriber =...
import SocketIO from 'socket.io'; import { createClient } from 'redis'; import { redisUrl } from './config'; const io = SocketIO(); io.use((socket, next) => { return next(); }); io.of('/live-chatroom') .use((socket, next) => { return next(); }) .on('connection', (socket) => { const redis = createCli...
Fix redeclaration of name in use of Map.computeIfAbsent.
package org.babblelang.engine.impl.natives.java; import org.babblelang.engine.impl.Callable; import org.babblelang.engine.impl.Interpreter; import org.babblelang.engine.impl.Namespace; import org.babblelang.engine.impl.Scope; import org.babblelang.parser.BabbleParser; import java.util.HashMap; import java.util.Map; ...
package org.babblelang.engine.impl.natives.java; import org.babblelang.engine.impl.Callable; import org.babblelang.engine.impl.Interpreter; import org.babblelang.engine.impl.Namespace; import org.babblelang.engine.impl.Scope; import org.babblelang.parser.BabbleParser; import java.util.HashMap; import java.util.Map; ...
Store event column in text field
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateNewEventsTableSchema extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('events', function (Blueprint $table) { ...
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateNewEventsTableSchema extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('events', function (Blueprint $table) { ...
Check if title should be updated
'use strict'; var React = require('react'), withSideEffect = require('react-side-effect'); function reducePropsToState(propsList) { var innermostProps = propsList[propsList.length - 1]; if (innermostProps) { return innermostProps.title; } } function handleStateChangeOnClient(title) { var nextTitle = ...
'use strict'; var React = require('react'), withSideEffect = require('react-side-effect'); function reducePropsToState(propsList) { var innermostProps = propsList[propsList.length - 1]; if (innermostProps) { return innermostProps.title; } } function handleStateChangeOnClient(title) { if (title !== do...
Remove version check now that TFX 0.25 is released. PiperOrigin-RevId: 343533114
# Lint as: python3 # Copyright 2020 Google LLC. 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 ...
# Lint as: python3 # Copyright 2020 Google LLC. 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 ...
Add test re: hide kwarg
from spec import eq_, skip, Spec, raises, ok_, trap from invoke.run import run from invoke.exceptions import Failure class Run(Spec): """run()""" def return_code_in_result(self): r = run("echo 'foo'") eq_(r.stdout, "foo\n") eq_(r.return_code, 0) eq_(r.exited, 0) def nonze...
from spec import eq_, skip, Spec, raises, ok_ from invoke.run import run from invoke.exceptions import Failure class Run(Spec): """run()""" def return_code_in_result(self): r = run("echo 'foo'") eq_(r.stdout, "foo\n") eq_(r.return_code, 0) eq_(r.exited, 0) def nonzero_ret...
Remove variable declaration for service and just return the object.
Application.Services.factory('tags', ["mcapi", function tags(mcapi) { return { tags: [], createTag: function (tag, item_id) { mcapi('/tags/item/%', item_id) .success(function (tag) { return tag; }).post(...
Application.Services.factory('tags', ["mcapi", function tags(mcapi) { var service = { tags: [], createTag: function (tag, item_id) { mcapi('/tags/item/%', item_id) .success(function (tag) { return tag; }...
Update filter args and fix name The newer version of django-filter uses `field_name` rather than `name`
from rest_framework import viewsets from django_filters import filters, filterset from api.v09.views import ResultsSetPagination from ..models import CandidateResult, ResultSet from ..serializers import CandidateResultSerializer, ResultSetSerializer class CandidateResultViewSet(viewsets.ModelViewSet): queryset ...
from rest_framework import viewsets from django_filters import filters, filterset from api.v09.views import ResultsSetPagination from ..models import CandidateResult, ResultSet from ..serializers import CandidateResultSerializer, ResultSetSerializer class CandidateResultViewSet(viewsets.ModelViewSet): queryset ...
Remove the hardcode from the settings.
from django.conf import settings as django_settings from django.utils.translation import ugettext_lazy as _ def settings(request): if not getattr(django_settings, "SOCIAL", None): return {} return { "SOCIAL_FACEBOOK": django_settings.SOCIAL.get("FACEBOOK", ""), "SOCIAL_TWITTER": django_...
from django.conf import settings as django_settings from django.utils.translation import ugettext_lazy as _ def settings(request): if not getattr(django_settings, "SOCIAL", None): return {} return { "SOCIAL_FACEBOOK": django_settings.SOCIAL.get("FACEBOOK", ""), "SOCIAL_TWITTER": django_...
Add renderer setting for electron
'use strict'; const webpack = require('webpack'); const env = process.env.NODE_ENV || 'development'; const isDev = env === 'development'; const devtool = isDev ? '#inline-source-map' : null; const uglify = isDev ? null : new webpack.optimize.UglifyJsPlugin({ output: { comments: false }, compress: { dead_code: ...
'use strict'; const webpack = require('webpack'); const env = process.env.NODE_ENV || 'development'; const isDev = env === 'development'; const devtool = isDev ? '#inline-source-map' : null; const uglify = isDev ? null : new webpack.optimize.UglifyJsPlugin({ output: { comments: false }, compress: { dead_code: ...
Use Setext strategy in GitHub built in Writer
""" File that initializes a Writer object designed for GitHub style markdown files. """ from anchorhub.writer import Writer from anchorhub.builtin.github.wstrategies import MarkdownATXWriterStrategy, \ MarkdownSetextWriterStrategy, MarkdownInlineLinkWriterStrategy import anchorhub.builtin.github.switches as ghswit...
""" File that initializes a Writer object designed for GitHub style markdown files. """ from anchorhub.writer import Writer from anchorhub.builtin.github.wstrategies import MarkdownATXWriterStrategy, \ MarkdownSetextWriterStrategy, MarkdownInlineLinkWriterStrategy import anchorhub.builtin.github.switches as ghswit...
Allow arg to specify spawning type
import os import multiprocessing import threading class Sponsor(object): def __init__(self): print('Sponsor pid: {}'.format(os.getpid())) def create(self, behavior): return Actor(behavior, self) class Actor(object): def __init__(self, behavior, sponsor): self.behavior = behavior...
import os import multiprocessing import threading class Sponsor(object): def __init__(self): print('Sponsor pid: {}'.format(os.getpid())) def create(self, behavior): return Actor(behavior, self) class Actor(object): def __init__(self, behavior, sponsor): self.behavior = behavior...
AccessController: Fix spi.ac.AttmeptTarget to change types of session_id and attempt_id
package io.digdag.spi.ac; import org.immutables.value.Value; @Value.Immutable public interface AttemptTarget { int getSiteId(); String getProjectName(); String getWorkflowName(); long getSessionId(); long getId(); static AttemptTarget of(int siteId, String projectName, String workflowName...
package io.digdag.spi.ac; import org.immutables.value.Value; @Value.Immutable public interface AttemptTarget { int getSiteId(); String getProjectName(); String getWorkflowName(); int getSessionId(); int getId(); static AttemptTarget of(int siteId, String projectName, String workflowName, ...
Remove exception from method signature
package de.codecentric.centerdevice.glass; import com.sun.glass.ui.Application; import de.codecentric.centerdevice.util.ReflectionUtils; import javafx.application.Platform; public class MacApplicationAdapter { private Application app; private boolean forceQuitOnCmdQ = true; public MacApplicationAdapter() {...
package de.codecentric.centerdevice.glass; import com.sun.glass.ui.Application; import de.codecentric.centerdevice.util.ReflectionUtils; import javafx.application.Platform; public class MacApplicationAdapter { private Application app; private boolean forceQuitOnCmdQ = true; public MacApplicationAdapter() t...
Fix regexp logic when installed into subfolder
<?php /* * This file is part of Slim HTTP Basic Authentication middleware * * Copyright (c) 2013-2015 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * https://github.com/tuupola/slim-basic-auth * */ namespace Slim\Middleware\HttpB...
<?php /* * This file is part of Slim HTTP Basic Authentication middleware * * Copyright (c) 2013-2015 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * https://github.com/tuupola/slim-basic-auth * */ namespace Slim\Middleware\HttpB...
Use mapDispatchToProps to bind actions efficiently
import React, { Component, PropTypes } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Header from '../components/Header'; import MainSection from '../components/MainSection'; import * as TodoActions from '../actions/todos'; class App extends Component { render...
import React, { Component, PropTypes } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Header from '../components/Header'; import MainSection from '../components/MainSection'; import * as TodoActions from '../actions/todos'; class App extends Component { render...
Add endpoint for flask app.
# -*- coding: utf-8 -*- from electro.errors import ResourceDuplicatedDefinedError class API(object): def __init__(self, app=None, decorators=None, catch_all_404s=None): self.app = app self.endpoints = set() self.decorators = decorators or [] self.catch_all_404s = catch...
# -*- coding: utf-8 -*- from electro.errors import ResourceDuplicatedDefinedError class API(object): def __init__(self, app=None, decorators=None, catch_all_404s=None): self.app = app self.endpoints = set() self.decorators = decorators or [] self.catch_all_404s = catch...
Add missing function expression name
/* eslint no-console: 0 */ 'use strict'; const irc = require('irc'); const server = process.env.IRC_SERVER; const user = process.env.IRC_USER; const channel = process.env.IRC_CHANNEL; const client = module.exports.client = new irc.Client(server, user, { autoConnect: false, autoRejoin: true, channels: [channel]...
/* eslint no-console: 0 */ 'use strict'; const irc = require('irc'); const server = process.env.IRC_SERVER; const user = process.env.IRC_USER; const channel = process.env.IRC_CHANNEL; const client = module.exports.client = new irc.Client(server, user, { autoConnect: false, autoRejoin: true, channels: [channel]...
Fix code that gets post-processed command-line args
// Command aws-gen-gocli parses a JSON description of an AWS API and generates a // Go file containing a client for the API. // // aws-gen-gocli EC2 apis/ec2/2014-10-01.api.json service/ec2/ec2.go package main import ( "flag" "fmt" "os" "github.com/awslabs/aws-sdk-go/model" ) func main() { var svcPath strin...
// Command aws-gen-gocli parses a JSON description of an AWS API and generates a // Go file containing a client for the API. // // aws-gen-gocli EC2 apis/ec2/2014-10-01.api.json service/ec2/ec2.go package main import ( "flag" "fmt" "os" "github.com/awslabs/aws-sdk-go/model" ) func main() { var svcPath strin...
:bug: Fix a bug in the template tag.
from django.template.loader_tags import register from django.template import loader, Context, defaultfilters, TemplateDoesNotExist import markdown presenters = { 'Speaker': 'presenters/speaker_presenter.html' } generic_template = 'presenters/object_presenter.html' @register.simple_tag(takes_context=True) def p...
from django.template.loader_tags import register from django.template import loader, Context, defaultfilters, TemplateDoesNotExist import markdown presenters = { 'Speaker': 'presenters/speaker_presenter.html' } generic_template = 'presenters/object_presenter.html' @register.simple_tag(takes_context=True) def p...
Set __version__ to 6.1.4 in preparation for the v6.1.4 release That is all. Change-Id: I79edd9574995e50c17c346075bf158e6f1d64a0c Reviewed-on: https://gerrit.franz.com:9080/6845 Reviewed-by: Tadeusz Sznuk <4402abb98f9559cbfb6d73029f928227b498069b@franz.com> Reviewed-by: Ahmon Dancy <8f7d8ce2c6797410ae95fecd4c30801ee9f...
# The version number must follow these rules: # - When the server is released, a client with exactly the same version number # should be released. # - Bugfixes should be released as consecutive post-releases, # that is versions of the form X.Y.Z.postN, where X.Y.Z is # the AG version number and N increa...
# The version number must follow these rules: # - When the server is released, a client with exactly the same version number # should be released. # - Bugfixes should be released as consecutive post-releases, # that is versions of the form X.Y.Z.postN, where X.Y.Z is # the AG version number and N increa...
Add function to change string to upper camel case
define(function (require, exports, module) { 'use strict'; function CodeWriter(indentString) { this.lines = []; this.indentString = (indentString ? indentString : ' '); this.indentations = []; } CodeWriter.prototype.indent = function () { this.indentations.push(this.indentString); }; Cod...
define(function (require, exports, module) { 'use strict'; function CodeWriter(indentString) { this.lines = []; this.indentString = (indentString ? indentString : ' '); this.indentations = []; } CodeWriter.prototype.indent = function () { this.indentations.push(this.indentString); }; Cod...
Fix validation of Client objects
import uuid from django.db import transaction, IntegrityError from mygpo.users.settings import STORE_UA from mygpo.users.models import Client import logging logger = logging.getLogger(__name__) def get_device(user, uid, user_agent, undelete=True): """ Loads or creates the device indicated by user, uid. ...
import uuid from django.db import transaction, IntegrityError from mygpo.users.settings import STORE_UA from mygpo.users.models import Client import logging logger = logging.getLogger(__name__) def get_device(user, uid, user_agent, undelete=True): """ Loads or creates the device indicated by user, uid. ...
Allow to give already initialized redis client instead of the port/host
const duration = require('@maxdome/duration'); const Throttle = require('redis-throttle'); module.exports = config => { if (config.redis) { Throttle.rdb = config.redis; } else { Throttle.configure(config); } return (key, limit, callback, fallback) => { let span = '1 second'; if (typeof li...
const duration = require('@maxdome/duration'); const Throttle = require('redis-throttle'); module.exports = config => { Throttle.configure(config); return (key, limit, callback, fallback) => { let span = '1 second'; if (typeof limit === 'string') { [limit, span] = limit.split(' per '); } span...
Make sure we use the absolute path in generating cron lines
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This tool iterates through all of the scrapers in the datasets module and creates a cron-task for each one. ''' import os import pkgutil import random import sys from publish.lib.manifest import get_scraper_names def get_launch_binary(): this_location = sys.argv[...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This tool iterates through all of the scrapers in the datasets module and creates a cron-task for each one. ''' import os import pkgutil import random import sys from publish.lib.manifest import get_scraper_names def get_launch_binary(): this_location = sys.argv[...
Rename commentthreadwriter to commentthreadworker since it does not write anything...
from setuptools import setup, find_packages setup( name='zeit.care', version='0.2dev', author='Christian Zagrodnick, Ron Drongowski, Dominik Hoppe', author_email='cz@gocept.com', url='http://trac.gocept.com/zeit', description="""\ """, packages=find_packages('src'), package_dir = {'': '...
from setuptools import setup, find_packages setup( name='zeit.care', version='0.2dev', author='Christian Zagrodnick, Ron Drongowski, Dominik Hoppe', author_email='cz@gocept.com', url='http://trac.gocept.com/zeit', description="""\ """, packages=find_packages('src'), package_dir = {'': '...
Remove depreciated createJSModules @overide marker
package io.rado.backgroundcolor; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.ArrayList; import java....
package io.rado.backgroundcolor; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.ArrayList; import java....
Update outdated link to repository, per @cknv
import os import sys from distutils.core import setup if sys.version_info < (3,): print('\nSorry, but Adventure can only be installed under Python 3.\n') sys.exit(1) README_PATH = os.path.join(os.path.dirname(__file__), 'adventure', 'README.txt') with open(README_PATH, encoding="utf-8") as f: README_TEXT ...
import os import sys from distutils.core import setup if sys.version_info < (3,): print('\nSorry, but Adventure can only be installed under Python 3.\n') sys.exit(1) README_PATH = os.path.join(os.path.dirname(__file__), 'adventure', 'README.txt') with open(README_PATH, encoding="utf-8") as f: README_TEXT ...
Fix wrong type mapping for game player stats
package com.faforever.api.dto; import com.faforever.api.elide.ElideEntity; import com.github.jasminb.jsonapi.annotations.Id; import com.github.jasminb.jsonapi.annotations.Relationship; import com.github.jasminb.jsonapi.annotations.Type; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import...
package com.faforever.api.dto; import com.faforever.api.elide.ElideEntity; import com.github.jasminb.jsonapi.annotations.Id; import com.github.jasminb.jsonapi.annotations.Relationship; import com.github.jasminb.jsonapi.annotations.Type; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import...
Fix for default date format issue. SVN-Revision: 402
package edu.wustl.bulkoperator.processor; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.beanutils.Converter; import edu.wustl.bulkoperator.metadata.DateValue; import edu.wustl.common.util.global.ApplicationProperties; import edu.wustl.common.util.l...
package edu.wustl.bulkoperator.processor; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.beanutils.Converter; import edu.wustl.bulkoperator.metadata.DateValue; import edu.wustl.common.util.global.ApplicationProperties; import edu.wustl.common.util.l...
Fix typo and execute JS script found in local folder.
import RPi.GPIO as GPIO import time import os from optparse import OptionParser # Parse input arguments parser = OptionParser() parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.") # The option --pin sets the Input Pin for your Button # It default to G...
import RPi.GPIO as GPIO import time import os from optparse import OptionParser # Parse input arguments parser = OptionParser() parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.") # The option --pin sets the Input Pin for your Button # It default to G...
Create special folder for tests Former-commit-id: ae51c6c248baaf996f899e77e760aba1f0c161cf [formerly 7bf4f38602dd6b24f7888d88f18ca6e9cac9b9a3] [formerly 0ef00a42149f4e7724fde45c2a252e9ec7c550f5 [formerly d20e40ca85e6a06d0aba698624e3433e7c5c612a]] Former-commit-id: 69b97c02f08943de02a1ae58c8291dcae6c56db8 [formerly d2...
package main import ( // "fmt" "os" "strings" "testing" ) func TestGeneral(t *testing.T) { pathToData = "testdata" os.MkdirAll(pathToData, 0755) defer os.RemoveAll(pathToData) p := Open("testpage") err := p.Update("**bold**") if err != nil { t.Error(err) } if strings.TrimSpace(p.Render...
package main import ( // "fmt" "os" "strings" "testing" ) func TestGeneral(t *testing.T) { defer os.RemoveAll("data") p := Open("testpage") err := p.Update("**bold**") if err != nil { t.Error(err) } if strings.TrimSpace(p.RenderedPage) != "<p><strong>bold</strong></p>" { t.Errorf("Did n...
Set clear flag on render pass to false The clear flag needs to be false to allow transparent render passes on top of eachother. It was originally set to false in nin, but updating three.js resets it to true, since that's the default in the official three.js version. This commit is a copy of 7ec1acca3327e4de25a68541d7...
/** * @author alteredq / http://alteredqualia.com/ */ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { THREE.Pass.call( this ); this.scene = scene; this.camera = camera; this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; this.clearAlpha = ( clea...
/** * @author alteredq / http://alteredqualia.com/ */ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { THREE.Pass.call( this ); this.scene = scene; this.camera = camera; this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; this.clearAlpha = ( clea...
Change a test name to CamelCase instead of snake, to conform with TFX convention. PiperOrigin-RevId: 246340014
# Copyright 2019 Google LLC. 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 2019 Google LLC. 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...
Migrate profile tests to pytest
from unittest.mock import MagicMock, patch from buffpy.models.profile import Profile, PATHS mocked_response = { "name": "me", "service": "twiter", "id": 1 } def test_profile_schedules_getter(): """ Should retrieve profiles from buffer's API. """ mocked_api = MagicMock() mocked_api.get.retu...
from nose.tools import eq_ from mock import MagicMock, patch from buffpy.models.profile import Profile, PATHS mocked_response = { 'name': 'me', 'service': 'twiter', 'id': 1 } def test_profile_schedules_getter(): ''' Test schedules gettering from buffer api ''' mocked_api = MagicMock() mocked_api.g...