text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
Fix rendering of alfred.is data to json file
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy def single_item_serializer(value): # values are sometimes nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) # so need to return just the fi...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy def single_item_serializer(value): # values are nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) # so need to return just the fist value w...
Fix import bardarash conf import path
"""Bardarash in Kurdistan, Iraq""" from .idb_jor_azraq import * # noqa from django.utils.translation import ugettext_lazy as _ USER_FORM_FIELDS = ( ('Ideasbox', ['serial', 'box_awareness']), (_('Personal informations'), ['short_name', 'full_name', 'latin_name', 'birth_year', 'gender', 'country_of_origin_occu...
"""Bardarash in Kurdistan, Iraq""" from .azraq import * # noqa from django.utils.translation import ugettext_lazy as _ USER_FORM_FIELDS = ( ('Ideasbox', ['serial', 'box_awareness']), (_('Personal informations'), ['short_name', 'full_name', 'latin_name', 'birth_year', 'gender', 'country_of_origin_occupation',...
Simplify logic, add type hint
<?php /* * This file is part of the Zephir. * * (c) Zephir Team <team@zephir-lang.com> * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; /** * A ret...
<?php /* * This file is part of the Zephir. * * (c) Zephir Team <team@zephir-lang.com> * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; /** * A ret...
Remove LMOD_CMD global from module scope Declaring the variable at the module level could cause problem when installing and enabling the extension when Lmod was not activated.
from os import environ from subprocess import Popen, PIPE LMOD_SYSTEM_NAME = environ.get('LMOD_SYSTEM_NAME', '') def module(command, arguments=()): cmd = [environ['LMOD_CMD'], 'python', '--terse', command] cmd.extend(arguments) result = Popen(cmd, stdout=PIPE, stderr=PIPE) if command in ('load', 'unl...
import os from subprocess import Popen, PIPE LMOD_CMD = os.environ['LMOD_CMD'] LMOD_SYSTEM_NAME = os.environ.get('LMOD_SYSTEM_NAME', '') def module(command, arguments=()): cmd = [LMOD_CMD, 'python', '--terse', command] cmd.extend(arguments) result = Popen(cmd, stdout=PIPE, stderr=PIPE) if command in ...
Check if form is submitted first
<?php namespace ForkCMS\Bundle\InstallerBundle\Form\Handler; use ForkCMS\Bundle\InstallerBundle\Entity\InstallationData; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; /** * Base class to validate and save data from the installer form */ abstract class InstallerHandler { /** ...
<?php namespace ForkCMS\Bundle\InstallerBundle\Form\Handler; use ForkCMS\Bundle\InstallerBundle\Entity\InstallationData; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; /** * Base class to validate and save data from the installer form */ abstract class InstallerHandler { /** ...
Update Orchestra\Mail to follow latest update on Messages bundle Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
<?php namespace Orchestra; use \Closure, \IoC; class Mail { /** * Make a new Orchestra\Mail instance. * * <code> * Orchestra\Mail::send('view.file', array(), function ($mail) * { * $mail->to('example@test.com', "Username") * ->subject("An awesome title") * ->send(); * }); * </co...
<?php namespace Orchestra; use \Closure, \IoC; class Mail { /** * Make a new Orchestra\Mail instance. * * <code> * Orchestra\Mail::send('view.file', array(), function ($mail) * { * $mail->to('example@test.com', "Username") * ->subject("An awesome title") * ->send(); * }); * </co...
Fix example to use the right module name
var zmqbus = require('zmqbus'); /* simple quote sender/reader. Run multiple processes to send/receive cluster-wide. */ var node = zmqbus.createNode(); node.on('ready', function() { // subscribe to equity channel node.subscribe("equity"); setInterval(fakeEquityQuote, 1000); // uncomment the followi...
var zmqbus = require('../lib/index.js'); /* simple quote sender/reader. Run multiple processes to send/receive cluster-wide. */ var node = zmqbus.createNode(); node.on('ready', function() { // subscribe to equity channel node.subscribe("equity"); setInterval(fakeEquityQuote, 1000); // uncomment th...
Add --limit and filtering options to task event-list
import click from globus_cli.parsing import common_options, task_id_arg from globus_cli.helpers import outformat_is_json, print_table from globus_cli.services.transfer import print_json_from_iterator, get_client @click.command('event-list', help='List Events for a given Task') @common_options @task_id_arg @click.op...
import click from globus_cli.parsing import common_options, task_id_arg from globus_cli.helpers import outformat_is_json, print_table from globus_cli.services.transfer import print_json_from_iterator, get_client @click.command('event-list', help='List Events for a given Task') @common_options @task_id_arg def task_...
Change stage -> status column
<?php RequestHandler::$responseMode = 'csv'; RequestHandler::respond('projects', array( 'data' => array_map(function($Project) { preg_match('/^\s*[^*#]\s*\w.*/m', $Project->README, $matches); return array( 'name' => $Project->Title ,'description' => trim($matches[0]) ...
<?php RequestHandler::$responseMode = 'csv'; RequestHandler::respond('projects', array( 'data' => array_map(function($Project) { preg_match('/^\s*[^*#]\s*\w.*/m', $Project->README, $matches); return array( 'name' => $Project->Title ,'description' => trim($matches[0]) ...
Fix chopped off data for twelve hours
const React = require('react'); const Styled = require('styled-components'); const fns = require('../../shared/functions'); const constants = require('../../shared/constants'); const CloseIcon = require( '!babel-loader!svg-react-loader!./close.svg?name=CloseIcon' ); const { default: styled } = Styled; const...
const React = require('react'); const Styled = require('styled-components'); const fns = require('../../shared/functions'); const constants = require('../../shared/constants'); const CloseIcon = require( '!babel!svg-react!./close.svg?name=CloseIcon' ); const { default: styled } = Styled; const { remcalc }...
Fix bug removing FILE: from ccache name.
// vim:shiftwidth=4:tabstop=4:expandtab import sun.security.krb5.PrincipalName; import sun.security.krb5.internal.ccache.FileCredentialsCache; public class kwho { public static void main(String[] args) { String cache = System.getenv("KRB5CCNAME"); if (cache == null) { return; ...
// vim:shiftwidth=4:tabstop=4:expandtab import sun.security.krb5.PrincipalName; import sun.security.krb5.internal.ccache.FileCredentialsCache; public class kwho { public static void main(String[] args) { String cache = System.getenv("KRB5CCNAME"); if (cache == null) { return; ...
Add official support for Python 3.10
#! /usr/bin/env python3 from setuptools import setup from hsluv import __version__ setup( name='hsluv', version=__version__, description='Human-friendly HSL', long_description=open('README.md').read(), long_description_content_type='text/markdown', license="MIT", author_email="alexei@boron...
#! /usr/bin/env python3 from setuptools import setup from hsluv import __version__ setup( name='hsluv', version=__version__, description='Human-friendly HSL', long_description=open('README.md').read(), long_description_content_type='text/markdown', license="MIT", author_email="alexei@boron...
Add method to broadcast to all players
/* * Trident - A Multithreaded Server Alternative * Copyright 2014 The TridentSDK Team * * 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....
/* * Trident - A Multithreaded Server Alternative * Copyright 2014 The TridentSDK Team * * 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....
Make sure our ReadableStream can be written to
module.exports = function(runtime) { var STREAM_MODULE = 'stream'; function Readable() { Readable.$super.call(this); this._args = arguments; this._rendered = false; } Readable.prototype = { write: function(data) { this.push(data); }, end: fu...
module.exports = function(runtime) { var STREAM_MODULE = 'stream'; function Readable() { Readable.$super.call(this); this._args = arguments; this._rendered = false; } Readable.prototype = { _read: function() { if (this._rendered) { return; ...
Add some unit test on utils.io
import difflib import numpy as np import pytest from mbuild.tests.base_test import BaseTest from mbuild.utils.io import get_fn, import_ from mbuild.utils.validation import assert_port_exists class TestUtils(BaseTest): def test_assert_port_exists(self, ch2): assert_port_exists('up', ch2) with py...
import difflib import pytest from mbuild.tests.base_test import BaseTest from mbuild.utils.io import get_fn from mbuild.utils.validation import assert_port_exists class TestUtils(BaseTest): def test_assert_port_exists(self, ch2): assert_port_exists('up', ch2) with pytest.raises(ValueError): ...
Use deterministic name to make test always fail Problem: The test passes if the directory already exists, which makes it intermittent and hard to debug. Solution: Use a unique directory name for each instance of the test, which makes the test fail consistently.
'use strict' var tape = require('tape') var pull = require('pull-stream') var createSSB = require('./create-ssb') var keys = require('ssb-keys').generate() var content = { type: 'whatever' } const name = `test-ssb-close-${Date.now()}` tape('load', function (t) { t.plan(1) var ssb = createSSB(name, { keys, temp: ...
'use strict' var tape = require('tape') var pull = require('pull-stream') var createSSB = require('./create-ssb') var keys = require('ssb-keys').generate() var content = { type: 'whatever' } tape('load', function (t) { t.plan(1) var ssb = createSSB('test-ssb-feed', { keys, temp: false }) ssb.createFeed().add(c...
Add Drivers/PostgreSQL to the list of autoloaded paths
<?php /* * Autoload controllers and modules */ function autoload($className) { foreach (array( 'include/resto/', 'include/resto/Drivers/', 'include/resto/Drivers/PostgreSQL/', 'include/resto/Collections/', 'include/resto/Models/', 'include/resto/Dictionaries/', ...
<?php /* * Autoload controllers and modules */ function autoload($className) { foreach (array( 'include/resto/', 'include/resto/Drivers/', 'include/resto/Collections/', 'include/resto/Models/', 'include/resto/Dictionaries/', 'include/resto/Modules/', 'inclu...
Add png mime type to the download blob
import React, { Component } from 'react'; import downloadIcon from '../icons/downloadIcon.svg'; class DownloadButton extends Component { constructor(props) { super(props); this.downloadImage = this.downloadImage.bind(this); this.downloadCanvasBlob = this.downloadCanvasBlob.bind(this); this.revokeURL = t...
import React, { Component } from 'react'; import downloadIcon from '../icons/downloadIcon.svg'; class DownloadButton extends Component { constructor(props) { super(props); this.downloadImage = this.downloadImage.bind(this); this.downloadCanvasBlob = this.downloadCanvasBlob.bind(this); this.revokeURL = t...
Change en_US code from "en" to "en-us" for consistency
function randomFrom(array) { return array[Math.floor(Math.random()*array.length)] } function filter_available(item) { return !item.unreleased } var language_map = { "en_US": "en-us", "fr_FR": "fr", "ja_JP": "ja", "fr_CA": "fr-ca", "es_ES": "es", "es_MX": "es-mx" } String.prototype.format = function(s...
function randomFrom(array) { return array[Math.floor(Math.random()*array.length)] } function filter_available(item) { return !item.unreleased } var language_map = { "en_US": "en", "fr_FR": "fr", "ja_JP": "ja", "fr_CA": "fr-ca", "es_ES": "es", "es_MX": "es-mx" } String.prototype.format = function(scop...
Store objects in memory map
package storage import ( "bytes" "errors" "io" ) type Storage struct { data map[string][]byte } func (storage *Storage) CopyObjectToWriter(w io.Writer, bucket string, object string) error { // TODO synchronize access // get object key := bucket + ":" + object if val, ok := storage.data[key]; ok { objectBuf...
package storage import ( "bytes" "errors" "io" ) type Storage struct { data map[string][]byte } func (storage *Storage) CopyObjectToWriter(w io.Writer, bucket string, object string) error { // TODO synchronize access // get object key := bucket + ":" + object if val, ok := storage.data[key]; ok { objectBuf...
FIX language of privacy statement
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2019 Compassion CH (http://www.compassion.ch) # @author: Emanuel Cino <ecino@compassion.ch> # @author: Théo Nikles <theo.nikles@gmail.com> # # The licence is in the file __manifest__.py #...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2019 Compassion CH (http://www.compassion.ch) # @author: Emanuel Cino <ecino@compassion.ch> # @author: Théo Nikles <theo.nikles@gmail.com> # # The licence is in the file __manifest__.py #...
Fix language when the device has been rotated (Language)
package net.somethingdreadful.MAL; import android.content.res.Configuration; import org.holoeverywhere.ThemeManager; import org.holoeverywhere.app.Application; import java.util.Locale; public class Theme extends Application { Locale locale; @Override public void onCreate() { super.onCreate(); ...
package net.somethingdreadful.MAL; import android.content.res.Configuration; import org.holoeverywhere.ThemeManager; import org.holoeverywhere.app.Application; import java.util.Locale; public class Theme extends Application { @Override public void onCreate() { super.onCreate(); PrefManager P...
Add spec to test the return type of toLower()
describe('hasVowels()', function() { it('should always return a boolean', function() { expect('example string'.hasVowels()).toEqual(jasmine.any(Boolean)); }); it('should return true if string has vowels', function() { expect('oreofe'.hasVowels()).toBe(true); expect(('AnDeLa').hasVow...
describe('hasVowels()', function() { it('should always return a boolean', function() { expect('example string'.hasVowels()).toEqual(jasmine.any(Boolean)); }); it('should return true if string has vowels', function() { expect('oreofe'.hasVowels()).toBe(true); expect(('AnDeLa').hasVow...
Add method to determine if a computer is "mostly on" This means it is in the process of turning on, is on or is shutting down: basically anything which hasn't been fully stopped.
package org.squiddev.cctweaks.lua.patch; import dan200.computercraft.core.computer.Computer; import dan200.computercraft.core.computer.IComputerEnvironment; import dan200.computercraft.core.lua.ILuaMachine; import dan200.computercraft.core.terminal.Terminal; import org.squiddev.patcher.visitors.MergeVisitor; public c...
package org.squiddev.cctweaks.lua.patch; import dan200.computercraft.core.computer.Computer; import dan200.computercraft.core.computer.IComputerEnvironment; import dan200.computercraft.core.lua.ILuaMachine; import dan200.computercraft.core.terminal.Terminal; import org.squiddev.patcher.visitors.MergeVisitor; public c...
Use the system default LAF.
package gui; import gui.window.listener.GraphyWindowListener; import java.awt.BorderLayout; import javax.swing.*; public class MainWindow extends JFrame { private static MainWindow instance = null; public static MainWindow get_instance() { if (instance == null) { instance = new MainWindow(); } return...
package gui; import gui.window.listener.GraphyWindowListener; import java.awt.BorderLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; public class MainWindow extends JFrame { private static MainWindow instance = null; public static MainWindow get_instance() { if (instance == null) { instan...
Allow event handlers to be passed in
var $soloModal = null // Used when allowMultiple = false. // The public API. Modal = { allowMultiple: false, show: function(templateName, data, options){ if($soloModal == null || this.allowMultiple){ var parentNode = document.body var view = Blaze.renderWithData(Template[templateName], data, parentNode)...
var $soloModal = null // Used when allowMultiple = false. // The public API. Modal = { allowMultiple: false, show: function(templateName, data, options){ if($soloModal == null || this.allowMultiple){ var parentNode = document.body var view = Blaze.renderWithData(Template[templateName], data, p...
GS-8654: Add machine isolation API shorter key svn path=/trunk/openspaces/; revision=83620 Former-commit-id: 2bab1678ffd82133a8e8506c17b9d505eb44706b
package org.openspaces.admin.internal.pu.elastic; import java.util.Map; /** * @author Moran Avigdor * @since 8.0.1 */ public class ElasticMachineIsolationConfig { private static final String ELASTIC_MACHINE_ISOLATION_SHARING_ID_KEY = "elastic-machine-isolation-sharing-id"; private final Map...
package org.openspaces.admin.internal.pu.elastic; import java.util.Map; /** * @author Moran Avigdor * @since 8.0.1 */ public class ElasticMachineIsolationConfig { private static final String ELASTIC_MACHINE_ISOLATION_SHARING_ID_KEY = "elastic-machine-provisioning-isolation-sharing-id"; priv...
Add missing unit test for auth_hdr.
var auth_hdr = require('../lib/auth_header') describe('Parsing Auth Header field-value', function() { it('Should handle single space separated values', function() { var res = auth_hdr.parse("SCHEME VALUE"); expect(res).to.deep.equal({scheme: "SCHEME", value: "VALUE"}); }); it('Should ha...
var auth_hdr = require('../lib/auth_header') describe('Parsing Auth Header field-value', function() { it('Should handle single space separated values', function() { var res = auth_hdr.parse("SCHEME VALUE"); expect(res).to.deep.equal({scheme: "SCHEME", value: "VALUE"}); }); it('Should ha...
Call init to add blocks.
package com.pseudo_sudo.openstorage; import com.pseudo_sudo.openstorage.configuration.ConfigurationController; import com.pseudo_sudo.openstorage.init.ModBlocks; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid=OpenStorage.ID, name=OpenStorage.NAME, version=OpenSt...
package com.pseudo_sudo.openstorage; import com.pseudo_sudo.openstorage.configuration.ConfigurationController; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid=OpenStorage.ID, name=OpenStorage.NAME, version=OpenStorage.VERSION) public class OpenStorage { publi...
Fix crash when post's user has been deleted
<?php $discussion = $document->data; $postsCount = count($discussion->relationships->posts->data); ?> <div class="container"> <h2>{{ $discussion->attributes->title }}</h2> <div> @foreach ($posts as $post) <div> <?php $user = ! empty($post->relationships->user->data) ? $getRe...
<?php $discussion = $document->data; $postsCount = count($discussion->relationships->posts->data); ?> <div class="container"> <h2>{{ $discussion->attributes->title }}</h2> <div> @foreach ($posts as $post) <div> <?php $user = $getResource($post->relationships->user->data); ?>...
Move MR and Pipelines to 1.9.15.0 - Slight tweaks to requirements.txt for pipeline to add GCS Client as a dep. Revision created by MOE tool push_codebase. MOE_MIGRATION=7173
#!/usr/bin/env python """Setup specs for packaging, distributing, and installing MR lib.""" import distribute_setup # User may not have setuptools installed on their machines. # This script will automatically install the right version from PyPI. distribute_setup.use_setuptools() # pylint: disable=g-import-not-at-top...
#!/usr/bin/env python """Setup specs for packaging, distributing, and installing MR lib.""" import distribute_setup # User may not have setuptools installed on their machines. # This script will automatically install the right version from PyPI. distribute_setup.use_setuptools() # pylint: disable=g-import-not-at-top...
Raise exceptions rather than catching
import pandas import traceback import typing def process_files(file_iterator: typing.Iterator[typing.IO], processor: typing.Callable) -> pandas.DataFrame: def get_frames(): for file in file_iterator: df = processor(file) yield (df .assign(Source=getattr(file, 'n...
import pandas import traceback import typing def process_files(file_iterator: typing.Iterator[typing.IO], processor: typing.Callable) -> pandas.DataFrame: def get_frames(): for file in file_iterator: try: df = processor(file) except Exception: df = ...
Change the order of component info tabs to be shown - Nunjucks - Ruby - HTML - Context
'use strict' const path = require('path') /* Fractal theme ----------------------------------------------------------------------------- */ // Require the mandelbrot theme module const mandelbrot = require('@frctl/mandelbrot') // Configure a custom theme const customTheme = mandelbrot({ // Mandelbrot offers a pre-...
'use strict' const path = require('path') /* Fractal theme ----------------------------------------------------------------------------- */ // Require the mandelbrot theme module const mandelbrot = require('@frctl/mandelbrot') // Configure a custom theme const customTheme = mandelbrot({ // Mandelbrot offers a pre-...
Fix bug with comment POST (created_date was required)
from .models import Comment from .models import Motel from .models import Town from rest_framework import serializers class CommentSerializer(serializers.ModelSerializer): created_date = serializers.DateTimeField(format='%d/%m/%Y %H:%M', required=False) class Meta: model = Comment fields = ('i...
from .models import Comment from .models import Motel from .models import Town from rest_framework import serializers class CommentSerializer(serializers.ModelSerializer): created_date = serializers.DateTimeField(format='%d/%m/%Y %H:%M') class Meta: model = Comment fields = ('id', 'motel', 'bo...
Remove import of fixed-data-table javascript library
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ...
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ...
Add gulp-connect to serve project
var gulp = require('gulp'); var gutil = require('gulp-util'); var notify = require('gulp-notify'); var less = require('gulp-less'); var autoprefix = require('gulp-autoprefixer'); var minifyCSS = require('gulp-minify-css'); var connect = require('gulp-connect'); //Pre-compiled directory var lessDir = 'src/less'; //Com...
var gulp = require('gulp'); var gutil = require('gulp-util'); var notify = require('gulp-notify'); var less = require('gulp-less'); var autoprefix = require('gulp-autoprefixer'); var minifyCSS = require('gulp-minify-css') //Pre-compiled directory var lessDir = 'src/less'; //Compiled directory var targetCSSDir = 'css/...
Enhancement: Handle module reload exceptions gracefully In some rare cases if the internal module structure has changed the 'reload' module can't recover all modules and will fail with ImportError. This is the situation we need to advice a restart of Sublime Text.
# -*- coding: utf-8 -*- """Load and Unload all GitGutter modules. This module exports __all__ modules, which Sublime Text needs to know about. The list of __all__ exported symbols is defined in modules/__init__.py. """ try: from .modules import * except ValueError: from modules import * except ImportError: ...
# -*- coding: utf-8 -*- """Load and Unload all GitGutter modules. This module exports __all__ modules, which Sublime Text needs to know about. The list of __all__ exported symbols is defined in modules/__init__.py. """ try: from .modules import * except ValueError: from modules import * def plugin_loaded():...
Fix for querying for player by username
import isString from 'lodash/isString'; const ENDPOINT_PREFIX = 'players'; export default (http, options, parser) => { async function getByName(playerName) { if (!playerName) { return new Error('Expected required playerName. Usage: .getByName(playerName)'); } if (!isString(playerName)) { re...
import isString from 'lodash/isString'; const ENDPOINT_PREFIX = 'players'; export default (http, options, parser) => { async function getByName(playerName) { console.log('Heads up! This endpoint currently does not work, it is here because it is listed in the API docs.'); if (!playerName) { return new ...
Add script file name to stack traces
'use strict'; var extend = require('extend'); var repl = require('repl') , vm = require('vm') , fs = require('fs'); /** * Start the REPL and expose variables in `context`. * * @arg {Object} context * @return {Repl} */ var replWith = function (context) { var r = repl.start({ prompt: '> ', useGloba...
'use strict'; var extend = require('extend'); var repl = require('repl') , vm = require('vm') , fs = require('fs'); /** * Start the REPL and expose variables in `context`. * * @arg {Object} context * @return {Repl} */ var replWith = function (context) { var r = repl.start({ prompt: '> ', useGloba...
Support string value for color.
import {makeInner, normalizeToArray} from '../../util/model'; var inner = makeInner(); export default { clearColorPalette: function () { inner(this).colorIdx = 0; inner(this).colorNameMap = {}; }, getColorFromPalette: function (name, scope) { scope = scope || this; var sco...
import {makeInner} from '../../util/model'; var inner = makeInner(); export default { clearColorPalette: function () { inner(this).colorIdx = 0; inner(this).colorNameMap = {}; }, getColorFromPalette: function (name, scope) { scope = scope || this; var scopeFields = inner(s...
Remove default values from channels columns
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateMusicSettings extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('music_settings', function (Blueprint $table) { ...
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateMusicSettings extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('music_settings', function (Blueprint $table) { ...
Fix scaling issue when a retina-capable device resizes. Will now correctly scale.
module.exports = function($, window, errorHandler) { var Multigraph = require('../../core/multigraph.js')($), Point = require('../../math/point.js'); if (typeof(Multigraph.registerResizeEvents)==="function") { return Multigraph; } Multigraph.respondsTo("registerResizeEvents", function (target) { ...
module.exports = function($, window, errorHandler) { var Multigraph = require('../../core/multigraph.js')($), Point = require('../../math/point.js'); if (typeof(Multigraph.registerResizeEvents)==="function") { return Multigraph; } Multigraph.respondsTo("registerResizeEvents", function (target) { ...
Add back 3.5, 3.6 classifiers
#!/usr/bin/env python from setuptools import setup, find_packages try: with open('VERSION.txt', 'r') as v: version = v.read().strip() except FileNotFoundError: version = '0.0.0.dev0' with open('DESCRIPTION', 'r') as d: long_description = d.read() setup( name='tukio', description='An even...
#!/usr/bin/env python from setuptools import setup, find_packages try: with open('VERSION.txt', 'r') as v: version = v.read().strip() except FileNotFoundError: version = '0.0.0.dev0' with open('DESCRIPTION', 'r') as d: long_description = d.read() setup( name='tukio', description='An even...
Use dict not if/else, add exceptions
from __future__ import absolute_import import random from .jokes_en import jokes as jokes_en from .jokes_de import jokes as jokes_de from .jokes_es import jokes as jokes_es all_jokes = { 'en': jokes_en, 'de': jokes_de, 'es': jokes_es, } class LanguageNotFoundError(Exception): pass class CategoryN...
from __future__ import absolute_import import random import importlib def get_joke(category='neutral', language='en'): """ Parameters ---------- category: str Choices: 'neutral', 'explicit', 'chuck', 'all' lang: str Choices: 'en', 'de', 'es' Returns ------- joke: str ...
Fix docstrings for JsonLdApi to avoid confusion See #4 for more details
// Copyright 2015 Stanislav Nazarenko // // 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 agree...
// Copyright 2015 Stanislav Nazarenko // // 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 agree...
Make the embed widgets command return the full widget state schema (with version number), instead of just the widget state.
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. "use strict"; var save_state = function() { return new Promise(function(resolve) { requirejs(["base/js/namespace"], function(Jupyter) { return Jupyter.WidgetManager._managers[0].get_state({ ...
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. "use strict"; var save_state = function() { return new Promise(function(resolve) { requirejs(["base/js/namespace"], function(Jupyter) { return Jupyter.WidgetManager._managers[0].get_state({ ...
Use invoke method like in all other places. Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
package som.interpreter.nodes.dispatch; import som.vm.Universe; import som.vmobjects.SAbstractObject; import som.vmobjects.SInvokable; import som.vmobjects.SSymbol; import com.oracle.truffle.api.frame.VirtualFrame; public final class GenericDispatchNode extends AbstractDispatchWithLookupNode { public GenericDispa...
package som.interpreter.nodes.dispatch; import som.vm.Universe; import som.vmobjects.SAbstractObject; import som.vmobjects.SInvokable; import som.vmobjects.SSymbol; import com.oracle.truffle.api.frame.VirtualFrame; public final class GenericDispatchNode extends AbstractDispatchWithLookupNode { public GenericDispa...
Use moment at the last minute
var path = require("path"); var _ = require("lodash"); // ----------------------------------------------------------------------------- // Make tags snake case // ----------------------------------------------------------------------------- function cleanTag(tag){ return _.snakeCase(tag); } // Regex used to ...
var path = require("path"); var _ = require("lodash"); // ----------------------------------------------------------------------------- // Make tags snake case // ----------------------------------------------------------------------------- function cleanTag(tag){ return _.snakeCase(tag); } // Regex used to ...
Fix MorphingField: polymorphic_identy is already the string we want
from marshmallow.fields import Field class MorphingField(Field): # registry = { # } def __init__(self, many=False, fallback=None, overwrite=None, **metadata): self.many = False self.fallback = fallback or self.FALLBACK self.overwrite = overwrite # Common alternative: # d...
from marshmallow.fields import Field class MorphingField(Field): # registry = { # } def __init__(self, many=False, fallback=None, overwrite=None, **metadata): self.many = False self.fallback = fallback or self.FALLBACK self.overwrite = overwrite # Common alternative: # d...
Rename print_struct to generate_template and use multi_map
#!/usr/bin/env python import json import os from lib.functional import multi_map from engine import types, consts template_dir = os.path.join(os.environ['PORTER'], 'templates') structs = ( (types.new_unit, "Tank", (consts.RED,)), (types.new_attack, "RegularCannon", ()), (types.new_armor, "WeakMetal", ()...
#!/usr/bin/env python import json import os from engine import types, consts template_dir = os.path.join(os.environ['PORTER'], 'templates') structs = ( (types.new_unit, "Tank", (consts.RED,)), (types.new_attack, "RegularCannon", ()), (types.new_armor, "WeakMetal", ()), (types.new_movement, "Treads",...
Use UnprovidedSet when converting ember to Box.lots
package org.marsik.elshelves.backend.entities.converters; import org.marsik.elshelves.api.entities.BoxApiModel; import org.marsik.elshelves.backend.entities.Box; import org.marsik.elshelves.backend.entities.IdentifiedEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ster...
package org.marsik.elshelves.backend.entities.converters; import org.marsik.elshelves.api.entities.BoxApiModel; import org.marsik.elshelves.backend.entities.Box; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Map; import java.util.UUID; ...
Add integer compatibility with integer
<?php /** * This file is part of Railt package. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Railt\Reflection\Standard\Scalars; use Railt\Reflection\Standard\StandardType; /** * The ID standa...
<?php /** * This file is part of Railt package. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Railt\Reflection\Standard\Scalars; use Railt\Reflection\Standard\StandardType; /** * The ID standa...
Fix getattr() takes no keyword arguments
from django.conf import settings from django.contrib import admin from django.contrib.flatpages.admin import FlatpageForm, FlatPageAdmin from django.contrib.flatpages.models import FlatPage from django.utils.module_loading import import_string FLATPAGE_WIDGET = getattr(settings, 'FLATPAGE_WIDGET', 'tinymce.widgets.Tin...
from django.conf import settings from django.contrib import admin from django.contrib.flatpages.admin import FlatpageForm, FlatPageAdmin from django.contrib.flatpages.models import FlatPage from django.utils.module_loading import import_string FLATPAGE_WIDGET = getattr(settings, 'FLATPAGE_WIDGET', 'tinymce.widgets.Tin...
Correct the 'reference' format transform method Currently, the 'reference' format transform method will traversal the metrics list and reconstruct every item of the list to add tenant_id and region info, but new transformed metrics list will use the reference of the local dict variable "transformed_metric", that will ...
# Copyright 2014 Hewlett-Packard # # 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 agreed to in writ...
# Copyright 2014 Hewlett-Packard # # 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 agreed to in writ...
Fix json.loads when context is None Co-authored-by: Pierre Verkest <94ea506e1738fc492d3f7a19e812079abcde2af1@gmail.com>
# Copyright 2019 Creu Blanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import json from odoo.http import request, route from odoo.addons.web.controllers import main as report class ReportController(report.ReportController): @route() def report_routes(self, reportname, docids=None...
# Copyright 2019 Creu Blanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import json from odoo.http import request, route from odoo.addons.web.controllers import main as report class ReportController(report.ReportController): @route() def report_routes(self, reportname, docids=None...
Enable preventChanges hook to delete fields containing dots.
const existsByDot = require('../common/exists-by-dot'); const deleteByDot = require('../common/delete-by-dot'); const checkContext = require('./check-context'); const errors = require('@feathersjs/errors'); module.exports = function (...fieldNames) { const ifThrow = fieldNames[0]; if (typeof ifThrow === 'string'...
const existsByDot = require('../common/exists-by-dot'); const deleteByDot = require('../common/delete-by-dot'); const checkContext = require('./check-context'); const errors = require('@feathersjs/errors'); module.exports = function (...fieldNames) { const ifThrow = fieldNames[0]; if (typeof ifThrow === 'string'...
Exit unless we're explicitly in a Python3 environment
from setuptools import setup, find_packages from codecs import open from os import path import sys # Exit unless we're in pip3/Python 3 if not sys.version_info[0] == 3: print("\noctohatrack requires a Python 3 environment.\n\nTry `pip3 install` instead") sys.exit(1) here = path.abspath(path.dirname(__file__))...
from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='octohatrack', version='0.5.1', description='Show _all_ the co...
Extend the optionset to include ref The ref parameter expects a function which will be given the instance to the rendered component.
(function (root, factory) { if (typeof define === 'function' && define.amd) { define(['knockout', 'react', 'react-dom'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('knockout'), require('react'), require('react-dom')); } else { factory(root.ko, root.React, root...
(function (root, factory) { if (typeof define === 'function' && define.amd) { define(['knockout', 'react', 'react-dom'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('knockout'), require('react'), require('react-dom')); } else { factory(root.ko, root.React, root...
Load latestDistData in main build
import history from '!json!../assets/data/history.json' import metadata from '!json!../assets/data/metadata.json' // Loading latest season in the main bundle itself import latestSeasonData from '!json!../assets/data/season-latest.json' import latestDistData from '!json!../assets/data/distributions/season-latest-nat.jso...
import history from '!json!../assets/data/history.json' import metadata from '!json!../assets/data/metadata.json' // Loading latest season in the main bundle itself import latestSeasonData from '!json!../assets/data/season-latest.json' const seasonDataCtx = require.context( 'file-loader!../assets/data/', false, ...
Fix an issue for hostname to be connected
/* global io */ 'use strict'; angular.module('memoApp') .service('memoService', function memoService() { this.socket = io.connect(window.location.protocol + '//' + window.location.hostname); this.watch = function (file) { this.socket.emit('watch', file); }; this.load = function (file, callba...
/* global io */ 'use strict'; angular.module('memoApp') .service('memoService', function memoService() { this.socket = io.connect('http://localhost'); this.watch = function (file) { this.socket.emit('watch', file); }; this.load = function (file, callback) { this.socket.on('memo', funct...
Add wrapper for render_to_resposne to include tmpl context processors easily Autoconverted from SVN (revision:2231)
from django.shortcuts import render_to_response from django.template.context import RequestContext def render(request, template, context={}): return render_to_response(template, context, context_instance=RequestContext(request)) def get_directory_name(job): """ Expected format: %sharedPath%watched...
def get_directory_name(job): """ Expected format: %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/ """ import re directory = job.directory uuid = job.sipuuid try: return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w...
Reset gzip encoder on put to pool
package main import ( "compress/gzip" "io" "io/ioutil" "sync" ) type gzipPool struct { mutex sync.Mutex top *gzipPoolEntry } type gzipPoolEntry struct { gz *gzip.Writer next *gzipPoolEntry } func newGzipPool(n int) *gzipPool { pool := new(gzipPool) for i := 0; i < n; i++ { pool.grow() } return p...
package main import ( "compress/gzip" "io" "io/ioutil" "sync" ) type gzipPool struct { mutex sync.Mutex top *gzipPoolEntry } type gzipPoolEntry struct { gz *gzip.Writer next *gzipPoolEntry } func newGzipPool(n int) *gzipPool { pool := new(gzipPool) for i := 0; i < n; i++ { pool.grow() } return p...
Change spec test back to true/false, rewrite loop for better clarity of changes
var pingPong = function(i) { if ((i % 5 === 0) || (i % 3 === 0)) { return true; } else { return false; } }; $(function() { $("#game").submit(function(event) { $('#outputList').empty(); var number = parseInt($("#userNumber").val()); for (var i = 1; i <= number; i += 1) { if (i % 15 =...
var pingPong = function(i) { if ((i % 3 === 0) && (i % 5 != 0)) { return "ping"; } else if ((i % 5 === 0) && (i % 6 != 0)) { return "pong"; } else if ((i % 3 === 0) && (i % 5 === 0)) { return "ping pong"; } else { return false; } }; $(function() { $("#game").submit(function(event) { $('...
Call e.respondWith() in fetch event handler.
this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return cache.addAll([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.j...
this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return cache.addAll([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.j...
Solve errata naming the class
<?php /* Copyright 2009-2011 Rafael Gutierrez Martinez * Copyright 2012-2013 Welma WEB MKT LABS, S.L. * Copyright 2014-2016 Where Ideas Simply Come True, S.L. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obt...
<?php /* Copyright 2009-2011 Rafael Gutierrez Martinez * Copyright 2012-2013 Welma WEB MKT LABS, S.L. * Copyright 2014-2016 Where Ideas Simply Come True, S.L. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obt...
Use TAB instead of ;
#!/usr/bin/env python3 import sys import serial import datetime if __name__=='__main__': try: ser = serial.Serial('COM1', 115200, timeout=1) print("opened " + ser.portstr) except serial.SerialException: print('could not open port') sys.exit(1) pass f = open(datetime.datetime.now().strftime("%y-%m-%d_%H-%M...
#!/usr/bin/env python3 import sys import serial import datetime if __name__=='__main__': try: ser = serial.Serial('COM1', 115200, timeout=1) print("opened " + ser.portstr) except serial.SerialException: print('could not open port') sys.exit(1) pass f = open(datetime.datetime.now().strftime("%y-%m-%d_%H-%M...
Normalize the variance to 1.0 (from 0.5)
package am.app.mappingEngine.qualityEvaluation.metrics.ufl; import java.util.List; import am.app.mappingEngine.AbstractMatcher.alignType; import am.app.mappingEngine.qualityEvaluation.AbstractQualityMetric; import am.app.mappingEngine.similarityMatrix.SimilarityMatrix; import static am.evaluation.disagreement.varianc...
package am.app.mappingEngine.qualityEvaluation.metrics.ufl; import java.util.List; import am.app.mappingEngine.AbstractMatcher.alignType; import am.app.mappingEngine.qualityEvaluation.AbstractQualityMetric; import am.app.mappingEngine.similarityMatrix.SimilarityMatrix; import static am.evaluation.disagreement.varianc...
Migrate the tests for the alert service to vlui
'use strict'; describe('Directive: alertMessages', function() { var element, scope; // load the directive's module beforeEach(module('vlui', function($provide) { // Mock the alerts service $provide.value('Alerts', { alerts: [ {msg: 'foo'}, {msg: 'bar'} ] }); })); ...
'use strict'; describe('Directive: alertMessages', function() { // load the directive's module beforeEach(module('polestar')); var element, scope; beforeEach(module('polestar', function($provide) { var mock = { alerts: [ {name: 'foo'}, {name: 'bar'} ] }; $provide....
Write out grammar JSON to a file when compiling
var api = require("../api"), fs = require("fs-extra"), path = require("path"), mkdirp = require("mkdirp"), templates = require("./templates"), cwd = process.cwd(); module.exports = function compile(options) { for (var key in api.dsl) { global[key] = api.dsl[key]; } require("coffee-script...
var api = require("../api"), fs = require("fs-extra"), path = require("path"), mkdirp = require("mkdirp"), templates = require("./templates"), cwd = process.cwd(); module.exports = function compile(options) { for (var key in api.dsl) { global[key] = api.dsl[key]; } require("coffee-script...
Use the Chrome formatter when running in Electron
module.exports = require('./common/minilog.js'); var consoleLogger = require('./node/console.js'); // if we are running inside Electron then use the web version of console.js isChrome = (typeof navigator != 'undefined' && /chrome/i.test(navigator.userAgent)); if (isChrome) { consoleLogger = require('./web/console...
module.exports = require('./common/minilog.js'); var consoleLogger = require('./node/console.js'); // intercept the pipe method and transparently wrap the stringifier, if the // destination is a Node core stream module.exports.Stringifier = require('./node/stringify.js'); var oldPipe = module.exports.pipe; module.e...
Connect actions to props and add onSubmit function
import React, {Component} from 'react' import {connect} from 'react-redux'; import {bindActionCreators} from 'redux' import * as sessionsActions from '../actions/sessionsActions'; class Login extends Component { constructor(props) { super(); this.state = { email: '', password: '' } this....
import React, {Component} from 'react' class Login extends Component { constructor(props) { super(); this.state = { email: '', password: '' } this.handleChange = this.handleChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) } handleSubmit(e) { e.preventDefaul...
Add project_id to invoice detail
<?php namespace Picqer\Financials\Moneybird\Entities\Generic; use Picqer\Financials\Moneybird\Model; /** * Class InvoiceDetail. */ abstract class InvoiceDetail extends Model { /** * @var array */ protected $fillable = [ 'id', 'tax_rate_id', 'ledger_account_id', 'am...
<?php namespace Picqer\Financials\Moneybird\Entities\Generic; use Picqer\Financials\Moneybird\Model; /** * Class InvoiceDetail. */ abstract class InvoiceDetail extends Model { /** * @var array */ protected $fillable = [ 'id', 'tax_rate_id', 'ledger_account_id', 'am...
Add purecloud hosts as trusted
import Ember from 'ember'; import AjaxService from 'ember-ajax/services/ajax'; const { inject, computed } = Ember; export default AjaxService.extend({ auth: inject.service(), contentType: 'application/json; charset=utf-8', trustedHosts: [ /outlook.office.com/, /graph.microsoft.co...
import Ember from 'ember'; import AjaxService from 'ember-ajax/services/ajax'; const { inject, computed } = Ember; export default AjaxService.extend({ auth: inject.service(), contentType: 'application/json; charset=utf-8', trustedHosts: [ /outlook.office.com/, /graph.microsoft.co...
Update regex for diesel fuel
<?php use Illuminate\Database\Seeder; class VehiclesFuelsTableSeeder extends Seeder { public function run() { DB::table('vehicles_fuels')->delete(); $fuels = [ ['name' => 'Gasolina', 'regex' => '/\bgasolina\b/i'], ['name' => 'Diesel', 'regex' => '/\bdiesel|gas[oó]leo\b...
<?php use Illuminate\Database\Seeder; class VehiclesFuelsTableSeeder extends Seeder { public function run() { DB::table('vehicles_fuels')->delete(); $fuels = [ ['name' => 'Gasolina', 'regex' => '/\bgasolina\b/i'], ['name' => 'Diesel', 'regex' => '/\bgas[oó]leo\b/iu'], ...
Update Python/Django: Restore admin.autodiscover() for Django 1.6 compatibility
from django.conf.urls import include, url from django.contrib import admin admin.autodiscover() # For Django 1.6 urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^selectable/', include('selectable.urls')), url(r'', include('timepiece.urls')), # authentication views url(r'^accou...
from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^selectable/', include('selectable.urls')), url(r'', include('timepiece.urls')), # authentication views url(r'^accounts/login/$', 'django.contrib.auth.views....
Tag an image based on detected visual content which mean running a CNN on top of it.
<?php /* * PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github * https://github.com/symisc/pixlab-php */ require_once "pixlab.php"; # Tag an image based on detected visual content which mean running a CNN on top of it. # https://pixlab.io/#/cmd?id=tagimg for ...
<?php /* * PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github * https://github.com/symisc/pixlab-php */ require_once "pixlab.php"; # Tag an image based on detected visual content which mean running a CNN on top of it. # https://pixlab.io/#/cmd?id=tagimg for ...
Rename passwd to password for form field validation
<?php namespace OpenCFP\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; class ResetForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add...
<?php namespace OpenCFP\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; class ResetForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add...
Bump version for new pypi dist
#!/usr/bin/env python from distutils.core import setup setup(name='optfunc-ysimonson', version='0.1.2', description='Generate commandline flags from function arguments.', author='Simon Willison', author_email='simon@lanyrd.com', url='https://github.com/ysimonson/optfunc', license='...
#!/usr/bin/env python from distutils.core import setup setup(name='optfunc-ysimonson', version='0.1.1', description='Generate commandline flags from function arguments.', author='Simon Willison', author_email='simon@lanyrd.com', url='https://github.com/ysimonson/optfunc', license='...
Rewrite structure_check tests with hypothesis `OrderedDict` chosen instead of `SimpleNamespace` as the former supports the dictionary-like item access, unlike the latter.
from collections import OrderedDict import pytest from hypothesis import given from hypothesis.strategies import lists, tuples, integers, dictionaries, \ fixed_dictionaries from datatyping.datatyping import validate @given(lst=lists(integers()), tpl=tuples(integers())) def test_different_sequences(lst, tpl): ...
import pytest from datatyping.datatyping import validate def test_empty(): with pytest.raises(TypeError): assert validate([], ()) is None def test_empty_reversed(): with pytest.raises(TypeError): assert validate((), []) is None def test_plain(): with pytest.raises(TypeError): a...
Improve cprint to use __str__ method if available
from __future__ import print_function import sys import string from colors import * def is_posix_filename(name, extra_chars=""): CHARS = string.letters + string.digits + "._-" + extra_chars return all(c in CHARS for c in name) def cprint(color, msg, file=sys.stdout, end='\n'): data = msg.__str__() if ...
from __future__ import print_function import sys import string from colors import * def is_posix_filename(name, extra_chars=""): CHARS = string.letters + string.digits + "._-" + extra_chars return all(c in CHARS for c in name) def cprint(color, msg, file=sys.stdout, end='\n'): print(color + msg + RESE...
Define a global for the autoloader location
<?php /* * Test bootstrapper. This leaves out all stuff registering services and * related to request dispatching. */ global $CLASSLOADER; if (!defined('TEST_ROOT')) { define('TEST_ROOT', realpath(__DIR__ . '/../../')); } if (!defined('BOLT_AUTOLOAD')) { if (is_dir(TEST_ROOT . '/../../../vendor/')) { ...
<?php /* * Test bootstrapper. This leaves out all stuff registering services and * related to request dispatching. */ global $CLASSLOADER; if (!defined('TEST_ROOT')) { define('TEST_ROOT', realpath(__DIR__ . '/../../')); } if (is_dir(TEST_ROOT . '/../../../vendor/')) { // Composer install $CLASSLOADER ...
Make sure we have actually looked up a model in get_model_from_string.
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl> # # This file is part of django-webshop. # # django-webshop is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 2, or (at...
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl> # # This file is part of django-webshop. # # django-webshop is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 2, or (at...
Rename the package so that it does not contain -
from setuptools import setup, find_packages import sys, os version = '0.1' setup(name='ckanserviceprovider', version=version, description="A server that can server jobs at services.", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_class...
from setuptools import setup, find_packages import sys, os version = '0.1' setup(name='ckan-service-provider', version=version, description="A server that can server jobs at services.", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_cla...
TDB-4594: Return a copy of Nomad object mappper for protection
/* * Copyright (c) 2011-2019 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Sof...
/* * Copyright (c) 2011-2019 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Sof...
Fix test coverage being horribly useless
var path = require('path'); var coffeeCoverage = require('coffee-coverage'); var projectRoot = path.normalize(path.join(__dirname, '..')); var coverageVar = coffeeCoverage.findIstanbulVariable(); // Only write a coverage report if we're not running inside of Istanbul. var writeOnExit = (coverageVar == null) ? (projectR...
var path = require('path'); var coffeeCoverage = require('coffee-coverage'); var projectRoot = path.normalize(__dirname); var coverageVar = coffeeCoverage.findIstanbulVariable(); // Only write a coverage report if we're not running inside of Istanbul. var writeOnExit = (coverageVar == null) ? (projectRoot + '/coverage/...
Add onclick handler to toggle soft wrap
'use babel' /** @jsx etch.dom */ import etch from 'etch' import stateless from 'etch-stateless' const IndicatorAnchor = stateless(etch, ({onclick, wrapped}) => { let light = '' if (wrapped) { light = 'lit' } else { light = 'unlit' } return <a className={`status-${light}`} onclick={onclick} href="#"...
'use babel' /** @jsx etch.dom */ import etch from 'etch' import stateless from 'etch-stateless' const IndicatorAnchor = stateless(etch, ({wrapped}) => { let light = '' if (wrapped) { light = 'lit' } else { light = 'unlit' } return <a className={`status-${light}`} href="#">Wrap</a> }) export defaul...
Fix autoload path in example
<!DOCTYPE html> <html lang="cs-CZ"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Ical Parser example</title> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" r...
<!DOCTYPE html> <html lang="cs-CZ"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Ical Parser example</title> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" r...
Prepare for players and maps update of core.
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ con...
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ con...
Simplify the icon finder function. We statically know our bundle identifier, so we don’t have too find the bundle by runtime class.
#!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage haskellBundleIdentifier = 'org.purl.net.mkhl.haskell' def iconForName(name): """Return the NSImage instance representing a `name` item.""" bundle = NSBundle.bundleWithIdentifier_(has...
#!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage def iconForName(klass, name): """Return the NSImage instance representing a `name` item.""" imgpath = NSBundle.bundleForClass_(klass).pathForResource_ofType_(name, 'png') img = NSIma...
Add proptypes & signedIn check to navbar
import React, { PureComponent, PropTypes } from 'react' import { connect } from 'react-redux' import { Link } from 'react-router' import signOut from '../../actions/users/sign-out' class Navbar extends PureComponent { static propTypes = { currentUser: PropTypes.object, signedIn: PropTypes.bool.isRequired ...
import React, { PureComponent } from 'react' import { connect } from 'react-redux' import { Link } from 'react-router' import signOut from '../../actions/users/sign-out' class Navbar extends PureComponent { checkLoginStatus() { return !!this.props.currentUser ? this.renderSignOut() : this.renderSignIn() } ...
Fix development environment broken after Babel 6 update
import reactTransform from 'babel-plugin-react-transform' import es2015 from 'babel-preset-es2015' import stage0 from 'babel-preset-stage-0' import react from 'babel-preset-react' export default { name: 'webpack-babel', configure ({ buildTarget }) { const hmrEnv = { development: { plugins: [ ...
import reactTransform from 'babel-plugin-react-transform' import es2015 from 'babel-preset-es2015' import stage0 from 'babel-preset-stage-0' import react from 'babel-preset-react' export default { name: 'webpack-babel', configure ({ buildTarget }) { const hmrEnv = { development: { plugins: [react...
Update test Solr download script to work with default Python 3
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import sys import requests # Try to import urljoin from the Python 3 reorganized stdlib first: try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin if len(sys....
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import sys import requests # Try to import urljoin from the Python 3 reorganized stdlib first: try: from urlparse.parse import urljoin except ImportError: from urlparse import urljoin if len(sy...
Fix ui bug in switch
# -*- coding: utf-8 -*- # Gitless - a version control system built on top of Git. # Licensed under GNU GPL v2. """gl switch - Switch branches.""" from __future__ import unicode_literals from clint.textui import colored from . import pprint def parser(subparsers, _): """Adds the switch parser to the given subpa...
# -*- coding: utf-8 -*- # Gitless - a version control system built on top of Git. # Licensed under GNU GPL v2. """gl switch - Switch branches.""" from __future__ import unicode_literals from clint.textui import colored from . import pprint def parser(subparsers, _): """Adds the switch parser to the given subpa...
Set `output_routes` to True by default
import logging import json from tornado.options import define, options _CONFIG_FILENAME = "cutthroat.conf" def define_options(): """Define defaults for most custom options""" # Log file and config file paths options.log_file_prefix = "/var/log/cutthroat/cutthroat.log" define( "conf_file_path...
import logging import json from tornado.options import define, options _CONFIG_FILENAME = "cutthroat.conf" def define_options(): """Define defaults for most custom options""" # Log file and config file paths options.log_file_prefix = "/var/log/cutthroat/cutthroat.log" define( "conf_file_path...
Fix missing refactorization in unit test send_to_users unit test was not modified after parameter change.
from django.test import TestCase from yunity.utils.session import RealtimeClientData class TestSharedSession(TestCase): def test_session_key(self): self.assertEqual(RealtimeClientData.session_key('123'), 'session-store-123') def test_set_get_django_redis(self): RealtimeClientData.set_user_s...
from django.test import TestCase from yunity.utils.session import RealtimeClientData class TestSharedSession(TestCase): def test_session_key(self): self.assertEqual(RealtimeClientData.session_key('123'), 'session-store-123') def test_set_get_django_redis(self): RealtimeClientData.set_user_s...
Add preamble with settings for some famous web servers Makes it simple to configure the headers for the Apache and Nginx without reading it up on the net. Output the headers with level 'ERROR' so that it's written out when using the `--silent` option.
'use strict'; var buildPolicyString = require('./utils')['buildPolicyString']; var chalk = require('chalk'); module.exports = { 'csp-headers': { name: 'csp-headers', description: 'Generate Content-Security-Policy headers', works: 'insideProject', availableOptions: [ { name: 'environmen...
'use strict'; var buildPolicyString = require('./utils')['buildPolicyString']; module.exports = { 'csp-headers': { name: 'csp-headers', description: 'Generate Content-Security-Policy headers', works: 'insideProject', availableOptions: [ { name: 'environment', type: String, ...
Make inaccessable private key exception more informative Perviously setting $config['rsa_private_key'] = 'file://full/path/to/key.pem' (note two slashes instead of three) or other variations that are incompatitible with openssl_pkey_private(), would just give the user "Cannot access private key for signing", for a fil...
<?php namespace XeroPHP\Remote\OAuth\SignatureMethod; use XeroPHP\Remote\OAuth\Exception; class RSASHA1 implements SignatureMethodInterface { public static function generateSignature(array $config, $sbs, $secret) { // Fetch the private key if(false === $private_key_id = openssl_pkey_get_private...
<?php namespace XeroPHP\Remote\OAuth\SignatureMethod; use XeroPHP\Remote\OAuth\Exception; class RSASHA1 implements SignatureMethodInterface { public static function generateSignature(array $config, $sbs, $secret) { // Fetch the private key if(false === $private_key_id = openssl_pkey_get_private...
Fix me being an idiot
@foreach (session('flash_notification', collect())->toArray() as $message) @if ($message['overlay']) @include('flash::modal', [ 'modalClass' => 'flash-modal', 'title' => $message['title'], 'body' => $message['message'] ]) @else <div class="a...
@foreach (session('flash_notification', collect())->toArray() as $message) @if (isset($message['overlay'] && $message['overlay']) @include('flash::modal', [ 'modalClass' => 'flash-modal', 'title' => $message['title'], 'body' => $message['message'] ]) ...
Integrate jshint in CI process.
module.exports = function(grunt) { var pkg = grunt.file.readJSON('package.json'); (function () { var taskName; for(taskName in pkg.devDependencies) { if(taskName.substring(0, 6) === 'grunt-') { grunt.loadNpmTasks(taskName); } } })(); grun...
module.exports = function(grunt) { var pkg = grunt.file.readJSON('package.json'); (function () { var taskName; for(taskName in pkg.devDependencies) { if(taskName.substring(0, 6) === 'grunt-') { grunt.loadNpmTasks(taskName); } } })(); grun...
Make Croogo fixture insert compatible with CakePHP 3 one
<?php namespace Croogo\Croogo\TestSuite; use Cake\Database\Connection; use Cake\Database\Driver\Postgres; use Cake\TestSuite\Fixture\TestFixture; /** * CroogoTestFixture class * * @category TestSuite * @package Croogo * @version 1.4 * @author Fahad Ibnay Heylaal <contact@fahad19.com> * @author Rachman C...
<?php namespace Croogo\Croogo\TestSuite; use Cake\TestSuite\Fixture\TestFixture; /** * CroogoTestFixture class * * @category TestSuite * @package Croogo * @version 1.4 * @author Fahad Ibnay Heylaal <contact@fahad19.com> * @author Rachman Chavik <rchavik@gmail.com> * @license http://www.opensource.org/...