text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Transform args into proper arrays | 'use strict';
var Bluebird = require('bluebird');
var _path = require('path');
var redefine = require('redefine');
module.exports = redefine.Class({
constructor: function(path, options) {
this.path = _path.resolve(path);
this.file = _path.basename(this.path);
this.options = options;
},
mi... | 'use strict';
var Bluebird = require('bluebird');
var _path = require('path');
var redefine = require('redefine');
module.exports = redefine.Class({
constructor: function(path, options) {
this.path = _path.resolve(path);
this.file = _path.basename(this.path);
this.options = options;
},
mi... |
Use django.get_version in prerequisite checker | #!/usr/bin/env python
import sys
# Check that we are in an activated virtual environment
try:
import os
virtual_env = os.environ['VIRTUAL_ENV']
except KeyError:
print("It doesn't look like you are in an activated virtual environment.")
print("Did you make one?")
print("Did you activate it?")
... | #!/usr/bin/env python
import sys
# Check that we are in an activated virtual environment
try:
import os
virtual_env = os.environ['VIRTUAL_ENV']
except KeyError:
print("It doesn't look like you are in an activated virtual environment.")
print("Did you make one?")
print("Did you activate it?")
... |
Change on the regex variable such that it distinguish warnings from errors. | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Cppcheck plugin class."""
from SublimeLinter.lint import Linter, util
class Cppcheck(Linter):
"""Provides an interface to cpp... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Cppcheck plugin class."""
from SublimeLinter.lint import Linter, util
class Cppcheck(Linter):
"""Provides an interface to cpp... |
Use $log instead of console and use angulars isObject method for typechecking | angular
.module('ngSharepoint')
.provider('$spLog', function($log) {
var prefix = '[ngSharepoint] ';
var enabled = true;
return {
setPrefix: function(prefix) {
this.prefix = '[' + prefix + '] ';
},
setEnabled: function(enabled) {
this.enabled = enabled;
},
$get: function() {
return ({... | angular
.module('ngSharepoint')
.provider('$spLog', function() {
var prefix = '[ngSharepoint] ';
var enabled = true;
return {
setPrefix: function(prefix) {
this.prefix = '[' + prefix + '] ';
},
setEnabled: function(enabled) {
this.enabled = enabled;
},
$get: function() {
return ({
... |
Allow configuration of reviewers on project info screen
Change-Id: Ib529ce8b2593daba58a2c8f737a932323b2f9220 | // Copyright (C) 2013 The Android Open Source Project
//
// 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 ... | // Copyright (C) 2013 The Android Open Source Project
//
// 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 ... |
Add long description / url | #!/usr/bin/env python
import os
import setuptools
setuptools.setup(
name='remoteconfig',
version='0.2.4',
author='Max Zheng',
author_email='maxzheng.os @t gmail.com',
description='A simple wrapper for localconfig that allows for reading config from a remote server',
long_description=open('README.rst').... | #!/usr/bin/env python
import os
import setuptools
setuptools.setup(
name='remoteconfig',
version='0.2.4',
author='Max Zheng',
author_email='maxzheng.os @t gmail.com',
description=open('README.rst').read(),
install_requires=[
'localconfig>=0.4',
'requests',
],
license='MIT',
package_dir... |
Add configuration properties for legend title specifications. | import {GuideTitleStyle} from './constants';
import guideMark from './guide-mark';
import {lookup} from './guide-util';
import {TextMark} from '../marks/marktypes';
import {LegendTitleRole} from '../marks/roles';
import {addEncode, encoder} from '../encode/encode-util';
export default function(spec, config, userEncode... | import {GuideTitleStyle} from './constants';
import guideMark from './guide-mark';
import {TextMark} from '../marks/marktypes';
import {LegendTitleRole} from '../marks/roles';
import {addEncode} from '../encode/encode-util';
export default function(spec, config, userEncode, dataRef) {
var zero = {value: 0},
ti... |
Allow dates in Datetime scalar | from __future__ import absolute_import
import datetime
try:
import iso8601
except:
raise ImportError("iso8601 package is required for DateTime Scalar.\nYou can install it using: pip install iso8601.")
from graphql.language import ast
from .scalars import Scalar
class DateTime(Scalar):
@staticmethod
... | from __future__ import absolute_import
import datetime
try:
import iso8601
except:
raise ImportError("iso8601 package is required for DateTime Scalar.\nYou can install it using: pip install iso8601.")
from graphql.language import ast
from .scalars import Scalar
class DateTime(Scalar):
@staticmethod
... |
Rename to internal / external | /* jshint -W078 */
'use strict';
let stream = require('stream');
function BidiTransform(options) {
this._externalToInternal = new stream.Transform();
this._internalToExternal = new stream.Transform();
if (options.external) {
this.externalState = options.external;
}
if (options.internal) {
this.int... | /* jshint -W078 */
'use strict';
let stream = require('stream');
function BidiTransform(options) {
this._clientToServer = new stream.Transform();
this._serverToClient = new stream.Transform();
if (options.client) {
this.clientEndState = options.client;
}
if (options.server) {
this.serverEndState =... |
Remove onModule method that is no longer needed. | /**
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this f... | /**
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this f... |
Add gradient clipping value and norm | from keras.models import Model
from keras.layers import Input, Convolution2D, Activation, Flatten, Dense
from keras.layers.advanced_activations import PReLU
from keras.optimizers import Nadam
from eva.layers.residual_block import ResidualBlockList
from eva.layers.masked_convolution2d import MaskedConvolution2D
def Pi... | from keras.models import Model
from keras.layers import Input, Convolution2D, Activation, Flatten, Dense
from keras.layers.advanced_activations import PReLU
from keras.optimizers import Nadam
from eva.layers.residual_block import ResidualBlockList
from eva.layers.masked_convolution2d import MaskedConvolution2D
def Pi... |
Fix logic error in inlineKeyboard | 'use strict'
var tgTypes = {};
tgTypes.InlineKeyboardMarkup = function (rowWidth) {
this['inline_keyboard'] = [[]];
var rowWidth = (rowWidth > 8 ? 8 : rowWidth) || 8; //Currently maximum supported in one row
//Closure to make this property private
this._rowWidth = function () {
return rowWidt... | 'use strict'
var tgTypes = {};
tgTypes.InlineKeyboardMarkup = function (rowWidth) {
this['inline_keyboard'] = [[]];
var rowWidth = (rowWidth > 8 ? 8 : rowWidth) || 8; //Currently maximum supported in one row
//Closure to make this property private
this._rowWidth = function () {
return rowWidt... |
Rename function to match module. | /*global define*/
define(function() {
"use strict";
function createObservableProperty(name, privateName) {
return {
get : function() {
return this[privateName];
},
set : function(value) {
var oldValue = this[privateName];
... | /*global define*/
define(function() {
"use strict";
function createProperty(name, privateName) {
return {
get : function() {
return this[privateName];
},
set : function(value) {
var oldValue = this[privateName];
if (old... |
i18n: Annotate Python UML diagrams support
GitOrigin-RevId: 492135bbc194d71e7a869ef591be574b1225b66b | /*
* Copyright 2000-2014 JetBrains s.r.o.
*
* 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 agre... | /*
* Copyright 2000-2014 JetBrains s.r.o.
*
* 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 agre... |
Simplify class by removing unnecessary stuff | package coatapp.coat;
import android.os.AsyncTask;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ForecastRequestTask extends AsyncTask<String, Void, String> {
private static String getForecastRequest(String urlToRead) throws... | package coatapp.coat;
import android.os.AsyncTask;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ForecastRequestTask extends AsyncTask<String, Void, String> {
public String result;
public static String getForecastReques... |
Move deferred command additions to be processed after `'after_wp_load'` hook.
For the command additions within (mu-)plugins to work, they need to be processed after all plugins have actually been loaded.
Fixes #4122 | <?php
namespace WP_CLI\Bootstrap;
/**
* Class RegisterDeferredCommands.
*
* Registers the deferred commands that for which no parent was registered yet.
* This is necessary, because we can have sub-commands that have no direct
* parent, like `wp network meta`.
*
* @package WP_CLI\Bootstrap
*/
final class Regi... | <?php
namespace WP_CLI\Bootstrap;
/**
* Class RegisterDeferredCommands.
*
* Registers the deferred commands that for which no parent was registered yet.
* This is necessary, because we can have sub-commands that have no direct
* parent, like `wp network meta`.
*
* @package WP_CLI\Bootstrap
*/
final class Regi... |
Fix syntax error in layouts.base view. | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title')</title>
<link href="css/main.css" rel="stylesheet">
@yie... | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title')</title>
<link href="css/main.css" rel="stylesheet">
@yei... |
Add comment about when auto layout doesn't work | /**
* Convert monitors from VM format to what the GUI needs to render.
* - Convert opcode to a label and a category
* - Add missing XY position data if needed
*/
const OpcodeLabels = require('../lib/opcode-labels.js');
const PADDING = 5;
const MONITOR_HEIGHT = 23;
const isUndefined = a => typeof a === 'undefined'... | /**
* Convert monitors from VM format to what the GUI needs to render.
* - Convert opcode to a label and a category
* - Add missing XY position data if needed
*/
const OpcodeLabels = require('../lib/opcode-labels.js');
const PADDING = 5;
const MONITOR_HEIGHT = 23;
const isUndefined = a => typeof a === 'undefined'... |
Remove unused arguments from test | <?php
namespace Emarref\Namer\Detector;
class ArrayDetectorTest extends \PHPUnit_Framework_TestCase
{
/**
* @array
*/
private static $pool = [
'Apple',
];
/**
* @var ArrayDetector
*/
private $detector;
public function setup()
{
$this->detector = new Ar... | <?php
namespace Emarref\Namer\Detector;
class ArrayDetectorTest extends \PHPUnit_Framework_TestCase
{
/**
* @array
*/
private static $pool = [
'Apple',
];
/**
* @var ArrayDetector
*/
private $detector;
public function setup()
{
$this->detector = new Ar... |
Test the app list generation a bit | from django.contrib import admin
from django.contrib.auth.models import User
from django.test import Client, RequestFactory, TestCase
from fhadmin.templatetags.fhadmin_module_groups import generate_group_list
class AdminTest(TestCase):
def login(self):
client = Client()
u = User.objects.create(
... | from django.contrib.auth.models import User
from django.test import Client, TestCase
class AdminTest(TestCase):
def login(self):
client = Client()
u = User.objects.create(
username="test", is_active=True, is_staff=True, is_superuser=True
)
client.force_login(u)
... |
Set delete expense action as HTTP Put | package agoodfriendalwayspayshisdebts.web.actions.expense;
import agoodfriendalwayspayshisdebts.command.expense.DeleteExpenseCommand;
import com.vter.command.CommandBus;
import com.vter.infrastructure.bus.ExecutionResult;
import com.vter.web.actions.BaseAction;
import net.codestory.http.annotations.Put;
import net.cod... | package agoodfriendalwayspayshisdebts.web.actions.expense;
import agoodfriendalwayspayshisdebts.command.expense.DeleteExpenseCommand;
import com.vter.command.CommandBus;
import com.vter.infrastructure.bus.ExecutionResult;
import com.vter.web.actions.BaseAction;
import net.codestory.http.annotations.Delete;
import net.... |
Fix bug in unit test | #!/usr/bin/env python
#------------------------------------------------------------------------
# Copyright (c) 2015 SGW
#
# Distributed under the terms of the New BSD License.
#
# The full License is in the file LICENSE
#------------------------------------------------------------------------
import unittest
import ... | #!/usr/bin/env python
#------------------------------------------------------------------------
# Copyright (c) 2015 SGW
#
# Distributed under the terms of the New BSD License.
#
# The full License is in the file LICENSE
#------------------------------------------------------------------------
import unittest
import ... |
feat(login): Set monitoring as the default page after login (SDNTB-180) | /**
* This file is part of Superdesk.
*
* Copyright 2013, 2014 Sourcefabric z.u. and contributors.
*
* For the full copyright and license information, please see the
* AUTHORS and LICENSE files distributed with this source code, or
* at https://www.sourcefabric.org/superdesk/license
*/
(function() {
'use s... | /**
* This file is part of Superdesk.
*
* Copyright 2013, 2014 Sourcefabric z.u. and contributors.
*
* For the full copyright and license information, please see the
* AUTHORS and LICENSE files distributed with this source code, or
* at https://www.sourcefabric.org/superdesk/license
*/
(function() {
'use s... |
Make Display for the window numbers linear because of chrome. | var body = document.getElementById("body");
var currentWindow = null;
var ul = null;
function clickHandler(){
chrome.tabs.update(this.tabId, {active:true});
chrome.windows.update(this.windowId, {focused: true});
}
//loop through the tabs and group them by windows for display
chrome.tabs.query({}, function(tabs){... | var body = document.getElementById("body");
var currentWindow = null;
var ul = null;
function clickHandler(){
chrome.tabs.update(this.tabId, {active:true});
chrome.windows.update(this.windowId, {focused: true});
}
//loop through the tabs and group them by windows for display
chrome.tabs.query({}, function(tabs){... |
Test config does not require an entry setting | var webpack = require("webpack");
var nodeExternals = require("webpack-node-externals");
module.exports = {
target: "node",
externals: [nodeExternals()],
module: {
preLoaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "eslint" }
],
loaders: [
{
test: /.js$/,
load... | var webpack = require("webpack");
var nodeExternals = require("webpack-node-externals");
module.exports = {
target: "node",
externals: [nodeExternals()],
entry: './test/start.js',
module: {
preLoaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "eslint" }
],
loaders: [
{
... |
Use state for random number. | import React, { Component } from 'react'
import RandomNumber from '../RandomNumber'
import RoundImage from '../RoundImage'
import WelcomeNote from '../WelcomeNote'
import style from './style.css'
import classnames from 'classnames'
const classes = classnames.bind(style)
export default class App extends Component {
... | import React, { Component } from 'react'
import RandomNumber from '../RandomNumber'
import RoundImage from '../RoundImage'
import WelcomeNote from '../WelcomeNote'
import style from './style.css'
import classnames from 'classnames'
const classes = classnames.bind(style)
// import src from '../../assets/images/crosswor... |
Add service name for replacement pattern type registry | <?php
/*
* This file is part of the PcdxParameterEncryptionBundle package.
*
* (c) picodexter <https://picodexter.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Picodexter\ParameterEncryptionBundle\DependencyInjec... | <?php
/*
* This file is part of the PcdxParameterEncryptionBundle package.
*
* (c) picodexter <https://picodexter.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Picodexter\ParameterEncryptionBundle\DependencyInjec... |
Allow consumers to specify custom theme for react-autosuggest in autosuggest component | import React from 'react'
import Autosuggest from 'react-autosuggest'
import style from './bpk-autosuggest.scss'
const defaultTheme = {
container: 'bpk-autosuggest__container',
containerOpen: 'bpk-autosuggest__container--open',
input: 'bpk-autosuggest__input',
suggestionsConta... | import React from 'react'
import Autosuggest from 'react-autosuggest'
import style from './bpk-autosuggest.scss'
const defaultTheme = {
container: 'bpk-autosuggest__container',
containerOpen: 'bpk-autosuggest__container--open',
input: 'bpk-autosuggest__input',
suggestionsConta... |
Add /r and /m to muted commands | package net.simpvp.NoSpam;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandListener implements Listener {
public CommandListener(NoSpam plu... | package net.simpvp.NoSpam;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandListener implements Listener {
public CommandListener(NoSpam plu... |
Stop interlude removes non-player characters. | #!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# This file is part of Addison Arches.
#
# Addison Arches 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 3 of the License, or
# (at you... | #!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# This file is part of Addison Arches.
#
# Addison Arches 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 3 of the License, or
# (at you... |
Set creation date via field, not via constructor | # -*- coding: utf-8 -*-
"""
testfixtures.snippet
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.blueprints.snippet.models.snippet import \
CurrentVersionAssociation, Snippet, SnippetVersion
def create_snippet(party, name):
re... | # -*- coding: utf-8 -*-
"""
testfixtures.snippet
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.blueprints.snippet.models.snippet import \
CurrentVersionAssociation, Snippet, SnippetVersion
def create_snippet(party, name):
re... |
chore(tests): Remove console logging during test run. | /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
require('ass')
var dbServer = require('fxa-auth-db-server')
var backendTests = require('fxa-auth-db-server/test/backend')
var config = require('../../config')
var noop = function () {}
var log = { trace: noop, e... | /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
require('ass')
var dbServer = require('fxa-auth-db-server')
var backendTests = require('fxa-auth-db-server/test/backend')
var config = require('../../config')
var log = { trace: console.log, error: console.log, ... |
Make infinibow lowest priority to give other mod behaviors priority | package com.enderio.core.common.tweaks;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.mi... | package com.enderio.core.common.tweaks;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.mi... |
Add cache in sitemap section | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDisct
sitemaps = {
'containers': GenericSitemap(InfoDisct(), priority=... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDisct
sitemaps = {
'articles': GenericSitemap(InfoDisct(), priority=0.... |
Include env.system_install PATH as part of version checking to work with installed software not on the global PATH. Thanks to James Cuff | """Tool specific version checking to identify out of date dependencies.
This provides infrastructure to check version strings against installed
tools, enabling re-installation if a version doesn't match. This is a
lightweight way to avoid out of date dependencies.
"""
from distutils.version import LooseVersion
from f... | """Tool specific version checking to identify out of date dependencies.
This provides infrastructure to check version strings against installed
tools, enabling re-installation if a version doesn't match. This is a
lightweight way to avoid out of date dependencies.
"""
from distutils.version import LooseVersion
from f... |
Set an API load every hour as a scheduled job | 'use strict';
// Dependencies
var config = require('./config');
var express = require('express');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var compress = require('compression');
var multipart = require('connect-multiparty');
var sched... | 'use strict';
// Dependencies
var config = require('./config');
var express = require('express');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var compress = require('compression');
var multipart = require('connect-multiparty');
var app ... |
Add trigger as an alias for schedule
"Have you triggered that pipeline" is a fairly common thing to say. | from gocd.api.endpoint import Endpoint
class Pipeline(Endpoint):
base_path = 'go/api/pipelines/{id}'
id = 'name'
def __init__(self, server, name):
self.server = server
self.name = name
def history(self, offset=0):
return self._get('/history/{offset:d}'.format(offset=offset or... | from gocd.api.endpoint import Endpoint
class Pipeline(Endpoint):
base_path = 'go/api/pipelines/{id}'
id = 'name'
def __init__(self, server, name):
self.server = server
self.name = name
def history(self, offset=0):
return self._get('/history/{offset:d}'.format(offset=offset or... |
Allow version to have subrevision. | from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
if type(version_tuple[2]) == int:
version = "%d.%d.%s" % version_tuple
else:
version = "%d.%d_%s" % version_tuple
else:
v... | from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
version = "%d.%d_%s" % version_tuple
else:
version = "%d.%d" % version_tuple[:2]
setup(
name='django-dbsettings',
version=version,
... |
Add copyright header to CommitteeDetailGetTestCase. | # Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from huxley.utils.test import TestCommitt... | import json
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from huxley.utils.test import TestCommittees
class CommitteeDetailGetTestCase(TestCase):
def setUp(self):
self.client = Client()
def get_url(self, committee_id):
r... |
Fix model connection for sqlite tests | <?php namespace GeneaLabs\LaravelModelCaching\Traits;
use Illuminate\Container\Container;
trait CachePrefixing
{
protected function getCachePrefix() : string
{
$cachePrefix = Container::getInstance()
->make("config")
->get("laravel-model-caching.cache-prefix", "");
if ... | <?php namespace GeneaLabs\LaravelModelCaching\Traits;
use Illuminate\Container\Container;
trait CachePrefixing
{
protected function getCachePrefix() : string
{
$cachePrefix = Container::getInstance()
->make("config")
->get("laravel-model-caching.cache-prefix", "");
if ... |
Delete testonly namespaces from the duplicate namespaces exemption list
GITHUB_BREAKING_CHANGES=none
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=360768962 | /*
* Copyright 2021 Google Inc.
*
* 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 ... | /*
* Copyright 2021 Google Inc.
*
* 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 ... |
Change meal name to charfield | from __future__ import unicode_literals
from django.db import models
class Weekday(models.Model):
"""Model representing the day of the week."""
name = models.CharField(max_length=60, unique=True)
def clean(self):
"""
Capitalize the first letter of the first word to avoid case
in... | from __future__ import unicode_literals
from django.db import models
class Weekday(models.Model):
"""Model representing the day of the week."""
name = models.CharField(max_length=60, unique=True)
def clean(self):
"""
Capitalize the first letter of the first word to avoid case
in... |
Convert task output to UTF8 | import bosh_client
import os
import yaml
def do_step(context):
settings = context.meta['settings']
username = settings["username"]
home_dir = os.path.join("/home", username)
f = open('manifests/index.yml')
manifests = yaml.safe_load(f)
f.close()
client = bosh_client.BoshClient("https://1... | import bosh_client
import os
import yaml
def do_step(context):
settings = context.meta['settings']
username = settings["username"]
home_dir = os.path.join("/home", username)
f = open('manifests/index.yml')
manifests = yaml.safe_load(f)
f.close()
client = bosh_client.BoshClient("https://1... |
Add Force flag to CW events rule deletion
Use aws.Bool
Adding ec2-launch-templates resource file
Add --quiet flag to remove filtered resources from output
Without this change, output showing what is (or will be) removed can
easily be lost on the output showing filtered resources. It's useful
to be able to just see... | package resources
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
func init() {
register("CloudWatchEventsRule", ListCloudWatchEventsRules)
}
func ListCloudWatchEventsRules(sess *session.Session) ([]Resource, error) {... | package resources
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
func init() {
register("CloudWatchEventsRule", ListCloudWatchEventsRules)
}
func ListCloudWatchEventsRules(sess *session.Session) ([]Resource, error) {
svc := cloudwatchevents.New(ses... |
Add a little bit of documentation. | // Copyright 2015, Mike Houston, see LICENSE for details.
// A bitset Bloom filter for a reduced memory password representation.
//
// See https://github.com/AndreasBriese/bbloom
package bloompw
import (
"github.com/AndreasBriese/bbloom"
)
type BloomPW struct {
Filter *bbloom.Bloom
}
// New will return a new Data... | // Copyright 2015, Mike Houston, see LICENSE for details.
package bloompw
import (
"github.com/AndreasBriese/bbloom"
)
type BloomPW struct {
Filter *bbloom.Bloom
}
// New will return a new Database interface that stores entries in
// a bloom filter
func New(filter *bbloom.Bloom) (*BloomPW, error) {
b := &BloomPW{... |
Fix Hover Out when Clicking Minimize Button | function updateImageUrl(image_id, new_image_url) {
var image = document.getElementById(image_id);
if (image)
image.src = new_image_url;
}
function addButtonHandlers(button_id, normal_image_url, hover_image_url, click_func) {
var button = $("#"+button_id)[0];
button.onmouseover = function() {
updateImag... | function updateImageUrl(image_id, new_image_url) {
var image = document.getElementById(image_id);
if (image)
image.src = new_image_url;
}
function addButtonHandlers(button_id, normal_image_url, hover_image_url, click_func) {
var button = $("#"+button_id)[0];
button.onmouseover = function() {
updateImag... |
Update CLI with new property names | #!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var klParkingSpots = require('./');
var argv = process.argv.slice(2);
var columnify = require('columnify')
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Example',
' kl-parking',
'',
' => PL... | #!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var klParkingSpots = require('./');
var argv = process.argv.slice(2);
var columnify = require('columnify')
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Example',
' kl-parking',
'',
' => PL... |
Change tooltip delay to 3secs | (function () {
// event triggers
$('a.person-link').live('click.linkPerson', function (e) {
var $this = $(this);
// Preserve hashtag if the current page is of a person
if (window.currentPage == 'person' && location.hash) {
location.href = $this.attr('href') + location.hash;
return false;
... | (function () {
// event triggers
$('a.person-link').live('click.linkPerson', function (e) {
var $this = $(this);
// Preserve hashtag if the current page is of a person
if (window.currentPage == 'person' && location.hash) {
location.href = $this.attr('href') + location.hash;
return false;
... |
Put back the trailing / and fix it in the JS model | from django.conf.urls import patterns, url
from openbudget.apps.projects.views import api
urlpatterns = patterns('',
url(r'^$',
api.ProjectList.as_view(),
name='project-list'
),
url(r'^states/$',
api.StateList.as_view(),
name='state-list'
),
url(
r'^(?P<uui... | from django.conf.urls import patterns, url
from openbudget.apps.projects.views import api
urlpatterns = patterns('',
url(r'^$',
api.ProjectList.as_view(),
name='project-list'
),
url(r'^states/$',
api.StateList.as_view(),
name='state-list'
),
url(
r'^(?P<uui... |
Add test for localized spoken language name | const test = require('tap').test;
const TextToSpeech = require('../../src/extensions/scratch3_text2speech/index.js');
const fakeStage = {
textToSpeechLanguage: null
};
const fakeRuntime = {
getTargetForStage: () => fakeStage,
on: () => {} // Stub out listener methods used in constructor.
};
const ext = n... | const test = require('tap').test;
const TextToSpeech = require('../../src/extensions/scratch3_text2speech/index.js');
const fakeStage = {
textToSpeechLanguage: null
};
const fakeRuntime = {
getTargetForStage: () => fakeStage,
on: () => {} // Stub out listener methods used in constructor.
};
const ext = n... |
Make build separate src and test directories | var gulp = require('gulp');
var path = require('path');
var runSequence = require('run-sequence');
var tslint = require('gulp-tslint');
var typescript = require('gulp-typescript');
var dirs = {
build: path.join(__dirname, 'build'),
src: path.join(__dirname, 'src'),
test: path.join(__dirname, 'test'),
typings: ... | var gulp = require('gulp');
var path = require('path');
var runSequence = require('run-sequence');
var tslint = require('gulp-tslint');
var typescript = require('gulp-typescript');
var dirs = {
build: path.join(__dirname, 'build'),
src: path.join(__dirname, 'src'),
test: path.join(__dirname, 'test'),
typings: ... |
Add equlaity comparisons to LineChange class. | #!/usr/bin/env python3
from enum import Enum
class LineChange:
class ChangeType(Enum):
added = 1
deleted = 2
modified = 3
def __init__(self, line_number=None, change_type=None, file_path=None, commit_sha=None):
self.line_number = line_number
self.change_type = change_... | #!/usr/bin/env python3
from enum import Enum
class LineChange:
class ChangeType(Enum):
added = 1
deleted = 2
modified = 3
def __init__(self, number=None, change_type=None, filename=None, commit=None):
self.number = number
self.change_type = change_type
... |
Remove some debug logging from the frontend | import { put, call, fork } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { getBranches, register } from './resources';
import {
BRANCH_LIST_REQUESTED, branchListUpdated,
registerStart,
REGISTER_REQUESTED, registerSuccess,
clearPageError, pageError,
} from './actions';
export funct... | import { put, call, fork } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { getBranches, register } from './resources';
import {
BRANCH_LIST_REQUESTED, branchListUpdated,
registerStart,
REGISTER_REQUESTED, registerSuccess,
clearPageError, pageError,
} from './actions';
export funct... |
Define baseURL variable to get base_url func from codeigniter | <?php
echo doctype('html5');
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<?php
$meta = array(
array(
'name' => 'Content-Type',
'content' => 'text/html; charset=UTF-8',
'type' => 'equiv'
),
array(
'name' => 'X-UA-Compatible',
'content' => 'IE=edge',
'type' => 'equiv'
),
... | <?php
echo doctype('html5');
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<?php
$meta = array(
array(
'name' => 'Content-Type',
'content' => 'text/html; charset=UTF-8',
'type' => 'equiv'
),
array(
'name' => 'X-UA-Compatible',
'content' => 'IE=edge',
'type' => 'equiv'
),
... |
Update huge wave zombie spawn delay. | package avs.models;
public class ZombieSummoner implements Runnable{
private Thread thread;
private boolean isHugeWave;
public ZombieSummoner(){
this.thread = new Thread(this);
}
public void run(){
try {
Thread.sleep(30000);
while (true) {
if(!isHugeWave){
... | package avs.models;
public class ZombieSummoner implements Runnable{
private Thread thread;
private boolean isHugeWave;
public ZombieSummoner(){
this.thread = new Thread(this);
}
public void run(){
try {
Thread.sleep(30000);
while (true) {
if(!isHugeWave){
... |
Add possibility to override MultiBaseLocalDiskRepositoryManager
Add possibility to override MultiBaseLocalDiskRepositoryManager in lib
module by making GitRepositoryManagerModule as replaceable with module
that is annotated with 'git-manager' name.
Bug: Issue 15407
Change-Id: Ie470a035167225494d2b6f1977a0f7988f164aa4 | // Copyright (C) 2015 The Android Open Source Project
//
// 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 ... | // Copyright (C) 2015 The Android Open Source Project
//
// 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 ... |
Remove callback url and bring uploads together | """
Predict app's urls
"""
#
# pylint: disable=bad-whitespace
#
from django.conf.urls import patterns, include, url
from .views import *
def url_tree(regex, *urls):
"""Quick access to stitching url patterns"""
return url(regex, include(patterns('', *urls)))
urlpatterns = patterns('',
url(r'^$', Datasets.as... | """
Predict app's urls
"""
#
# pylint: disable=bad-whitespace
#
from django.conf.urls import patterns, include, url
from .views import *
def url_tree(regex, *urls):
"""Quick access to stitching url patterns"""
return url(regex, include(patterns('', *urls)))
urlpatterns = patterns('',
url(r'^$', Datasets.as... |
Update grunt file after switch to grunt-contrib-sass | module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
autoprefixer: {
options: {
browsers: ['last 3 iOS versions', 'Android 2.3', 'Android 4', 'last 2 Chrome versions']
},
... | module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
autoprefixer: {
options: {
browsers: ['last 3 iOS versions', 'Android 2.3', 'Android 4', 'last 2 Chrome versions']
},
... |
Fix method visibility after refactoring. | /*
* Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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://w... | /*
* Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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://w... |
Make South optional since we now support Django migrations. | import io
from setuptools import setup, find_packages
def read(*filenames, **kwargs):
"""
From http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/
"""
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filena... | import io
from setuptools import setup, find_packages
def read(*filenames, **kwargs):
"""
From http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/
"""
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filena... |
Remove the test for / via the API.
Makes no sense; the root of the API is /api. | package hello;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.... | package hello;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.... |
Modify the test for the new function name on RisFieldsMapping | <?php
namespace Funstaff\RefLibRis\Tests;
use Funstaff\RefLibRis\RisFieldsMapping;
/**
* RisFieldsMappingTest
*
* @author Bertrand Zuchuat <bertrand.zuchuat@gmail.com>
*/
class RisFieldsMappingTest extends \PHPUnit_Framework_TestCase
{
/**
* testFindField
*/
public function testFindField()
... | <?php
namespace Funstaff\RefLibRis\Tests;
use Funstaff\RefLibRis\RisFieldsMapping;
/**
* RisFieldsMappingTest
*
* @author Bertrand Zuchuat <bertrand.zuchuat@gmail.com>
*/
class RisFieldsMappingTest extends \PHPUnit_Framework_TestCase
{
/**
* testFindField
*/
public function testFindField()
... |
Load the missing image synchronously, improve assert error messages.
We need to load sync so that the error is logged while our log collector is in
place. Yay testing. | //
// $Id$
package playn.java;
import org.junit.Test;
import static org.junit.Assert.*;
import playn.core.PlayN;
import playn.core.Log;
import playn.core.Image;
import playn.tests.AbstractPlayNTest;
/**
* Tests various JavaImage behavior.
*/
public class JavaImageTest extends AbstractPlayNTest {
@Test
public... | //
// $Id$
package playn.java;
import org.junit.Test;
import static org.junit.Assert.*;
import playn.core.PlayN;
import playn.core.Log;
import playn.core.Image;
import playn.tests.AbstractPlayNTest;
/**
* Tests various JavaImage behavior.
*/
public class JavaImageTest extends AbstractPlayNTest {
@Test
public... |
Fix a typo in an error | function normalizeName(name) {
if (name.charAt(0) === '-') {
name = name.substr(1)
}
if (name.charAt(0) === '-') {
name = name.substr(1)
}
return name
}
class Option {
constructor(name, parent) {
if (!parent) {
throw new Error('An option must have a parent command')
}
if (!name... | function normalizeName(name) {
if (name.charAt(0) === '-') {
name = name.substr(1)
}
if (name.charAt(0) === '-') {
name = name.substr(1)
}
return name
}
class Option {
constructor(name, parent) {
if (!parent) {
throw new Error('An option must have a parent command')
}
if (!name... |
Add the score to Engine.chat return values | # -*- coding: utf-8 -*-
class Engine:
def __init__(self,
response_pairs,
knowledge={}):
self.response_pairs = response_pairs
self.knowledge = knowledge
def chat(self, user_utterance, context):
best_score = 0
best_response_pair = None
... | # -*- coding: utf-8 -*-
class Engine:
def __init__(self,
response_pairs,
knowledge={}):
self.response_pairs = response_pairs
self.knowledge = knowledge
def chat(self, user_utterance, context):
best_score = 0
best_response_pair = None
... |
Add API to reset CxxModuleWrapper's module pointer
Reviewed By: mhorowitz
Differential Revision: D4914335
fbshipit-source-id: f28f57c2e74d590dacfb85d8027747837f768fdc | // Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react.cxxbridge;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.NativeModule;
import com.facebook.soloader.SoLoader;
/**
* A Java Object which represents a cross-... | // Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react.cxxbridge;
import java.util.Map;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.NativeModule;
import com.facebook.soloader.SoLoader;
/**
* A Java Object whi... |
Implement more props for Header
Makes it more flexible to reuse in footer | import React from 'react';
import cn from 'classnames';
export default class Header extends React.Component {
render() {
const h1Style = {
margin: 0,
float: 'left'
};
const aStyle = {
float: 'right',
fontSize: '15px',
fontFamily: 'belwe'
};
const isLargeClass = thi... | import React from 'react';
export default class Header extends React.Component {
render() {
const h1Style = {
margin: 0,
padding: '47px 0 0 47px',
float: 'left'
};
const aStyle = {
float: 'right',
// marginTop: '54px',
marginTop: '60px',
marginRight: '45px',
... |
Change how default options were set
It previously ignored the case when ngModuleName was not set and
options was defined. It should now set the default ngModuleName when
needed if options was defined for any reason. | 'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var generator = require('loopback-sdk-angular');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
cb();
return;
}
var app;
try... | 'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var generator = require('loopback-sdk-angular');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.emit('error', new gutil.PluginError('gulp-loopback-sdk-angular', ... |
Configure logging handlers before submodule imports
- Fix #474
- Fix #475 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""
Utilities for streaming to/from several file-like data storages: S3 / HDFS / local
filesystem / compressed files, and many more, using a sim... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""
Utilities for streaming to/from several file-like data storages: S3 / HDFS / local
filesystem / compressed files, and many more, using a sim... |
Check Sender.track assigning for nil
It does not make sense to have Sender.track == nil | package webrtc
import (
"fmt"
"github.com/pkg/errors"
)
// RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid.
type RTPTransceiver struct {
Mid string
Sender *RTPSender
Receiver *RTPReceiver
Direction RTPTransceiverDirection
// currentDirection RTPTran... | package webrtc
import (
"github.com/pkg/errors"
)
// RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid.
type RTPTransceiver struct {
Mid string
Sender *RTPSender
Receiver *RTPReceiver
Direction RTPTransceiverDirection
// currentDirection RTPTransceiverD... |
Rename postcss plugin name string | 'use-strict';
const path = require('path');
const postcss = require('postcss');
const cssImport = require('postcss-import');
const atRulesVars = require('postcss-at-rules-variables');
const each = require('postcss-each');
const mixins = require('postcss-mixins');
const nested = require('postcss-nested');
const customP... | 'use-strict';
const path = require('path');
const postcss = require('postcss');
const cssImport = require('postcss-import');
const atRulesVars = require('postcss-at-rules-variables');
const each = require('postcss-each');
const mixins = require('postcss-mixins');
const nested = require('postcss-nested');
const customP... |
Set cookie protection mode to strong | import logging
from logging import config
from flask import Flask
import dateutil
import dateutil.parser
import json
from flask_login import LoginManager
from config import CONFIG_DICT
app = Flask(__name__)
app.config.update(CONFIG_DICT)
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login... | import logging
from logging import config
from flask import Flask
import dateutil
import dateutil.parser
import json
from flask_login import LoginManager
from config import CONFIG_DICT
app = Flask(__name__)
app.config.update(CONFIG_DICT)
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login... |
Return 404 if no message so we can poll from cucumber tests | from kombu import Connection, Exchange, Queue
from flask import Flask
import os
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
@app.route("/getnextqueuemessage")
#Gets the next message from target queue. Returns the signed JSON.
def get_last_queue_message():
#: By default messages sent ... | from kombu import Connection, Exchange, Queue
from flask import Flask
import os
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
@app.route("/getnextqueuemessage")
#Gets the next message from target queue. Returns the signed JSON.
def get_last_queue_message():
#: By default messages sent ... |
Check that the password parameter when unsetting mode k matches the password that is set | from twisted.words.protocols import irc
from txircd.modbase import Mode
class PasswordMode(Mode):
def checkUnset(self, user, target, param):
if param == target.mode["k"]:
return True
return False
def commandPermission(self, user, cmd, data):
if cmd != "JOIN":
return data
channels = data["targetchan"]... | from twisted.words.protocols import irc
from txircd.modbase import Mode
class PasswordMode(Mode):
def commandPermission(self, user, cmd, data):
if cmd != "JOIN":
return data
channels = data["targetchan"]
keys = data["keys"]
removeChannels = []
for index, chan in channels.enumerate():
if "k" in chan.mo... |
Switch from distutils to distribute | #!/usr/bin/env python2.7
from setuptools import setup, find_packages
setup(
name='spreads',
version='0.1',
author='Johannes Baiter',
author_email='johannes.baiter@gmail.com',
#packages=['spreads', 'spreadsplug'],
packages=find_packages(),
scripts=['spread', ],
url='http://github.com/jba... | #!/usr/bin/env python2.7
from distutils.core import setup
setup(
name='spreads',
version='0.1.0',
author='Johannes Baiter',
author_email='johannes.baiter@gmail.com',
packages=['spreads', 'spreadsplug'],
scripts=['spread', ],
url='http://github.com/jbaiter/spreads',
license='LICENSE.txt'... |
Update CLI based on @sindresorhus feedback
* don't use flagged args for file and selector
* exit properly if error opening file | #!/usr/bin/env node
var oust = require('../index');
var pkg = require('../package.json');
var fs = require('fs');
var argv = require('minimist')((process.argv.slice(2)))
var printHelp = function() {
console.log('oust');
console.log(pkg.description);
console.log('');
console.log('Usage:');
console.log(' $ oust ... | #!/usr/bin/env node
var oust = require('../index');
var pkg = require('../package.json');
var fs = require('fs');
var argv = require('minimist')((process.argv.slice(2)))
var printHelp = function() {
console.log('oust');
console.log(pkg.description);
console.log('');
console.log('Usage:');
console.log(' $ oust... |
Update doc blocks at class level | <?php
namespace SilverStripe\FullTextSearch\Search\Extensions;
use SilverStripe\Core\Extension;
use TractorCow\ClassProxy\Generators\ProxyGenerator;
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
/**
* This database connector proxy will allow {@link SearchUpdater::handle_manipulation} to monitor dat... | <?php
namespace SilverStripe\FullTextSearch\Search\Extensions;
use SilverStripe\Core\Extension;
use TractorCow\ClassProxy\Generators\ProxyGenerator;
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
/**
* Class ProxyDBExtension
* @package SilverStripe\FullTextSearch\Search\Extensions
*
* This databa... |
Fix HasColumn matcher for dataframe with duplicated columns | # -*- coding: utf-8 -*-
import re
from hamcrest.core.base_matcher import BaseMatcher
class HasColumn(BaseMatcher):
def __init__(self, column):
self._column = column
def _matches(self, df):
return self._column in df.columns
def describe_to(self, description):
description.append_... | # -*- coding: utf-8 -*-
import re
from hamcrest.core.base_matcher import BaseMatcher
class HasColumn(BaseMatcher):
def __init__(self, column):
self._column = column
def _matches(self, df):
return self._column in df.columns
def describe_to(self, description):
description.append_... |
Update bundles example after configuration provider refactoring | """Run 'Bundles' example application."""
import sqlite3
import boto3
from dependency_injector import containers
from dependency_injector import providers
from bundles.users import Users
from bundles.photos import Photos
class Core(containers.DeclarativeContainer):
"""Core container."""
config = providers.... | """Run 'Bundles' example application."""
import sqlite3
import boto3
from dependency_injector import containers
from dependency_injector import providers
from bundles.users import Users
from bundles.photos import Photos
class Core(containers.DeclarativeContainer):
"""Core container."""
config = providers.... |
Allow meals with unknown payer | from django.db import models
class Wbw_list(models.Model):
list_id = models.IntegerField(unique=True)
name = models.CharField(max_length=200, blank=True)
def __str__(self):
return self.name
class Participant(models.Model):
wbw_list = models.ManyToManyField(Wbw_list, through='Participation')... | from django.db import models
class Wbw_list(models.Model):
list_id = models.IntegerField(unique=True)
name = models.CharField(max_length=200, blank=True)
def __str__(self):
return self.name
class Participant(models.Model):
wbw_list = models.ManyToManyField(Wbw_list, through='Participation')... |
Add an optional second parameter to cache, used to conditionaly enable/disable caching | <?php
if ( ! function_exists('cache') )
{
function cache($key, $condition = true, Closure $closure)
{
$content = $condition ? Cache::get($key) : false;
if ( ! $content ) {
ob_start();
$closure();
$content = ob_get_contents();
ob_end_c... | <?php
if ( ! function_exists('cache') )
{
function cache($key, Closure $closure)
{
$content = Cache::get($key);
if ( ! $content ) {
ob_start();
$closure();
$content = ob_get_contents();
ob_end_clean();
Cache::forever($key,... |
Update parameterized test with custom display name | /*
* (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
*
* 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 require... | /*
* (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
*
* 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 require... |
Update GitHub repos from blancltd to developersociety | #!/usr/bin/env python
from codecs import open
from setuptools import find_packages, setup
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='django-paginationlinks',
version='0.1.1',
description='Django Pagination Links',
long_description=readme,
url='https://github.... | #!/usr/bin/env python
from codecs import open
from setuptools import find_packages, setup
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='django-paginationlinks',
version='0.1.1',
description='Django Pagination Links',
long_description=readme,
url='https://github.... |
Add note about broken theme config loading
Something weird going on here. Now that config loading is fixed it gives
errors. Probably need to understand better how loaders work to solve
this. | 'use strict';
var path = require('path');
require('es6-promise').polyfill();
require('promise.prototype.finally');
var build = require('./build');
exports.develop = function(config) {
config.themeConfig = parseThemeWebpackConfig(config);
return build.devIndex(config).then(build.devServer.bind(null, config));
}... | 'use strict';
var path = require('path');
require('es6-promise').polyfill();
require('promise.prototype.finally');
var build = require('./build');
exports.develop = function(config) {
config.themeConfig = parseThemeWebpackConfig(config);
return build.devIndex(config).then(build.devServer.bind(null, config));
}... |
Update form elements to more accurately reflect actual Stripe form
These attributes more closely reflect the actual form injected by Stripe. The additional attributes are also useful for selecting elements in tests | class Element {
mount(el) {
if (typeof el === "string") {
el = document.querySelector(el);
}
el.innerHTML = `
<input id="stripe-cardnumber" name="cardnumber" placeholder="Card number" size="16" type="text">
<input name="exp-date" placeholder="MM / YY" size="6" type="text">
<input ... | class Element {
mount(el) {
if (typeof el === "string") {
el = document.querySelector(el);
}
el.innerHTML = `
<input id="stripe-cardnumber" placeholder="cardnumber" size="16" type="text">
<input placeholder="exp-date" size="6" type="text">
<input placeholder="cvc" size="3" type="t... |
Increase splash screen delay and finish splash screen activity. | package de.fu_berlin.cdv.chasingpictures.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import de.fu_berlin.cdv.chasingpictures.MainActivity;
import de.fu_berlin.cdv.chasingpictures.R;
public class SplashScreen extends Activity {
privat... | package de.fu_berlin.cdv.chasingpictures.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import de.fu_berlin.cdv.chasingpictures.MainActivity;
import de.fu_berlin.cdv.chasingpictures.R;
public class SplashScreen extends Activity {
privat... |
Clean up dask client in indexing test | import pytest
import os
import shutil
import xarray as xr
from cosima_cookbook import database
from dask.distributed import Client
from sqlalchemy import select, func
@pytest.fixture(scope='module')
def client():
client = Client()
yield client
client.close()
def test_broken(client, tmp_path):
db = tm... | import pytest
import os
import shutil
import xarray as xr
from cosima_cookbook import database
from dask.distributed import Client
from sqlalchemy import select, func
@pytest.fixture(scope='module')
def client():
return Client()
def test_broken(client, tmp_path):
db = tmp_path / 'test.db'
database.build_... |
Modify the logic to get slot transfer entities to return all the entities per org.
The logic is now changed from having only one slot transfer entity per org to multiple
slot transfer entities per org.
--HG--
extra : rebase_source : d5526723d69356f4d076143f4dc537c7eeed74c0 | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 applic... | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 applic... |
Check if function type as well | import { applyMiddleware } from 'redux';
import { useRoutes } from 'react-router';
import historyMiddleware from './historyMiddleware';
import { ROUTER_STATE_SELECTOR } from './constants';
export default function reduxReactRouter({
routes,
createHistory,
parseQueryString,
stringifyQuery,
routerStateSelector
... | import { applyMiddleware } from 'redux';
import { useRoutes } from 'react-router';
import historyMiddleware from './historyMiddleware';
import { ROUTER_STATE_SELECTOR } from './constants';
export default function reduxReactRouter({
routes,
createHistory,
parseQueryString,
stringifyQuery,
routerStateSelector
... |
Add customization for conseil departemental nord | 'use strict';
angular.module('ddsCommon').factory('CustomizationService', function(lyonMetropoleInseeCodes) {
function determineCustomizationId(testCase, currentPeriod) {
if (testCase.menages &&
testCase.menages._) {
if (testCase.menages._.depcom[currentPeriod].match(/^93/))
... | 'use strict';
angular.module('ddsCommon').factory('CustomizationService', function(lyonMetropoleInseeCodes) {
function determineCustomizationId(testCase, currentPeriod) {
if (testCase.menages &&
testCase.menages._) {
if (testCase.menages._.depcom[currentPeriod].match(/^93/))
... |
Fix problem with freezing flow under debug plus many workers | "use strict";
let fetch = require('node-fetch');
let Converter = require("csvtojson");
let Promise = require('bluebird');
/**
* Helps fetch Google Docs data
* @param link URI of CSV file
* @return {Promise<Token>} A promise to the token.
*/
module.exports = function remoteCSVtoJSON (link) {
return fetch(link)
... | "use strict";
let fetch = require('node-fetch');
let Converter = require("csvtojson");
let Promise = require('bluebird');
/**
* Helps fetch Google Docs data
* @param link URI of CSV file
* @return {Promise<Token>} A promise to the token.
*/
module.exports = function remoteCSVtoJSON (link) {
return fetch(link)
... |
Allow handle to be passed in to avoid embedded global reference. | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import copy
import bark
from .log import Log
class Logger(Log):
'''Helper for emitting logs.
A logger can be used to preset common information (such as a name) and then
emit :py:class:`~bark.log.Log`... | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import copy
import bark
from .log import Log
class Logger(Log):
'''Helper for emitting logs.
A logger can be used to preset common information (such as a name) and then
emit :py:class:`~bark.log.Log`... |
Add a simple JUL test. | package dk.bitcraft.lc;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
public class JavaUtil... | package dk.bitcraft.lc;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.logging.Logger;
import static org.assertj.core.api.Assertions.assertThat;
public class JavaUtilLoggingTest {
@Rule
public LogCollector collector = new LogCollector(Logger.getLogger("test.logger"));
... |
Fix issue with date format causing order creation to fail | 'use strict';
app.controller('CheckoutCtrl', function($scope, Basket, Order, AuthenticationService) {
$scope.basket = Basket;
$scope.currentUser = AuthenticationService.currentUser();
$scope.createOrder = function() {
console.log('Building the order...');
var orderItems = [];
angular.forEach($scope.... | 'use strict';
app.controller('CheckoutCtrl', function($scope, Basket, Order, AuthenticationService) {
$scope.basket = Basket;
$scope.currentUser = AuthenticationService.currentUser();
var hour = 60 * 60 * 1000; // 1 Hour in ms
$scope.pickupTime = new Date() + (2 * hour);
$scope.createOrder = function() {
... |
Add test configuration vars: STOMP_HOST + STOMP_PORT | import os
from carrot.connection import BrokerConnection
AMQP_HOST = os.environ.get('AMQP_HOST', "localhost")
AMQP_PORT = os.environ.get('AMQP_PORT', 5672)
AMQP_VHOST = os.environ.get('AMQP_VHOST', "/")
AMQP_USER = os.environ.get('AMQP_USER', "guest")
AMQP_PASSWORD = os.environ.get('AMQP_PASSWORD', "guest")
STOMP_H... | import os
from carrot.connection import BrokerConnection
AMQP_HOST = os.environ.get('AMQP_HOST', "localhost")
AMQP_PORT = os.environ.get('AMQP_PORT', 5672)
AMQP_VHOST = os.environ.get('AMQP_VHOST', "/")
AMQP_USER = os.environ.get('AMQP_USER', "guest")
AMQP_PASSWORD = os.environ.get('AMQP_PASSWORD', "guest")
STOMP_H... |
Update up to changes in es5-ext | 'use strict';
var slice = Array.prototype.slice
, isFunction = require('es5-ext/lib/Function/is-function')
, curry = require('es5-ext/lib/Function/prototype/curry')
, silent = require('es5-ext/lib/Function/prototype/silent')
, nextTick = require('clock/lib/next-tick')
, deferred = require... | 'use strict';
var slice = Array.prototype.slice
, isFunction = require('es5-ext/lib/Function/is-function')
, curry = require('es5-ext/lib/Function/curry').call
, silent = require('es5-ext/lib/Function/silent').apply
, nextTick = require('clock/lib/next-tick')
, deferred = require('../defe... |
Make sure that 0 doesnt count as empty | <?php
namespace Smartive\HandlebarsBundle\Helper;
use Handlebars\Context;
use Handlebars\Helper;
/**
* Base class for Handlebars helpers
*/
abstract class AbstractHelper implements Helper
{
/**
* Evaluates a value in the template and if not found, returns the value itself
*
* @param Context $con... | <?php
namespace Smartive\HandlebarsBundle\Helper;
use Handlebars\Context;
use Handlebars\Helper;
/**
* Base class for Handlebars helpers
*/
abstract class AbstractHelper implements Helper
{
/**
* Evaluates a value in the template and if not found, returns the value itself
*
* @param Context $con... |
Fix react path for commonjs build | 'use strict';
var path = require('path');
var parse = require('./parse');
var reactRuntimePath;
try {
reactRuntimePath = require.resolve('react');
} catch (ex) {
reactRuntimePath = false;
}
module.exports = compileClient;
function compileClient(str, options){
options = options || { filename: '' };
var react... | 'use strict';
var path = require('path');
var parse = require('./parse');
var reactRuntimePath;
try {
reactRuntimePath = require.resolve('react');
} catch (ex) {
reactRuntimePath = false;
}
module.exports = compileClient;
function compileClient(str, options){
options = options || { filename: '' };
var react... |
Fix xml tags for ingredients | // SPDX-License-Identifier: MIT
package mealplaner.io.xml.model.v3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
imp... | // SPDX-License-Identifier: MIT
package mealplaner.io.xml.model.v3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
imp... |
Fix compilation error in mutability | package org.genericsystem.mutability;
import java.io.Serializable;
import java.util.List;
import org.genericsystem.defaults.DefaultVertex;
public interface Generic extends DefaultVertex<Generic> {
@Override
default Engine getRoot() {
throw new IllegalStateException();
}
@Override
default Cache getCurrentCac... | package org.genericsystem.mutability;
import java.io.Serializable;
import java.util.List;
import org.genericsystem.defaults.DefaultVertex;
public interface Generic extends DefaultVertex<Generic> {
@Override
default Engine getRoot() {
throw new IllegalStateException();
}
@Override
default Cache getCurrentCac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.