text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Add requirements to package definition. | import os
import setuptools
requirements = [
"fnmatch",
"future",
"six",
"numpy",
"scipy",
"lasagne",
"theano",
]
def readme():
base_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base_dir, 'README.md')) as f:
return f.read()
def setup():
s... | import os
import setuptools
requirements = [
"numpy",
"scipy",
"lasagne",
]
def readme():
base_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base_dir, 'README.md')) as f:
return f.read()
def setup():
setuptools.setup(
name="nn_patterns",
ve... |
Store `Y-m-d H:i:s` into a readable constant name | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2017-2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Core / Class
*/
namespac... | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2017-2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Core / Class
*/
namespac... |
Use new progressba interface, fixed console error, changed severity to notice, fixed error which caused empty urls to get fetched | <?php namespace Crawler\Flickr;
use Crawler\Crawler;
use Console\Console;
use Console\Progressbar;
class Flickr extends Crawler
{
public function getOriginalImageUrls($images)
{
$original_images = [];
Console::info("Getting original image urls for " . count($images) . " flickr links...");
... | <?php namespace Crawler\Flickr;
use Crawler\Crawler;
use Console\Console;
use Console\Progressbar;
class Flickr extends Crawler
{
public function getOriginalImageUrls($images)
{
$original_images = [];
Console::info("Getting original image urls for " . count($images) . " flickr links...");
... |
BAP-1194: Implement wrapper for Translator.get() call
- CR-changes | (function(Translator, _, Oro) {
var dict = {},
add = Translator.add,
get = Translator.get;
/**
* Adds a translation to Translator object and stores
* translation id in protected dictionary
* @param {string} id
*/
Translator.add = function(id) {
dict[id] = 1;
... | (function(Translator, _, Oro) {
var dict = {},
add = Translator.add;
/**
* Store all translation ids which were added to Translator
* @param id
*/
Translator.add = function(id) {
dict[id] = 1;
add.apply(Translator, arguments);
};
/**
* Checks if translat... |
Configure JS linter warnings for Ember deprecations | 'use strict';
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
... | 'use strict';
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
... |
Fix link un approbation alert email | 'use strict';
const util = require('util');
const Mail = require('../mail');
const getViewUrl = function(request) {
if (request.absence.distribution.length > 0) {
return '/admin/requests/absences/'+request._id;
}
if (request.workperiod_recover.length > 0) {
return '/admin/requests/workpe... | 'use strict';
const util = require('util');
const Mail = require('../mail');
/**
* Notification for admin about the approval list
*
* @param {Object} app Express
* @param {Request} request
* @param {User} user
*
* @return {Promise}
*/
exports = module.exports = function getMail(app, request, user) {
... |
Throw a 404 header on user w/o post crud role | <?php
$userInfo = get_userdata( get_query_var('author'));
$isAuthor = true;
if (
!in_array('contributor', $userInfo -> roles) &&
!in_array('administrator', $userInfo -> roles) &&
!in_array('author', $userInfo -> roles) &&
!in_array('editor', $userInfo -> roles)
) {
$isAuthor = false;
wp_redirect... | <?php
$userInfo = get_userdata( get_query_var('author'));
$isAuthor = true;
if (
!in_array('contributor', $userInfo -> roles) &&
!in_array('administrator', $userInfo -> roles) &&
!in_array('author', $userInfo -> roles) &&
!in_array('editor', $userInfo -> roles)
) {
$isAuthor = false;
}
?>
<?php get_... |
Add debug method to Retrofit process service | package util;
import com.google.gson.JsonObject;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.*;
/**
* Retrofit interfaces wrapping Filestack API.
*/
public class FilestackService {
public interface Api {
String URL = "https://www.filestackapi.co... | package util;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.*;
/**
* Retrofit interfaces wrapping Filestack API.
*/
public class FilestackService {
public interface Api {
String URL = "https://www.filestackapi.com/api/file/";
@POST("{hand... |
fix(kakao): Change field name from 'nickname' to 'username' | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data.get('propertie... | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data.get('propertie... |
Use the UK locale for parsing | package uk.co.alynn.games.suchrobot;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import java.util.Scanner;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
public abstract class NodeSetReader {
public static NodeSet readNodeSet(String file) throws IOExce... | package uk.co.alynn.games.suchrobot;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
public abstract class NodeSetReader {
public static NodeSet readNodeSet(String file) throws IOException {
FileHandl... |
Add condition to webMvcMetricsFilter bean
Co-authored-by: Marco Geweke <8bae85dbfa00ce59d1b81e4121747343f331087b@otto.de> | package de.otto.edison.metricsconfiguration;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
import org.springframework.boot.actuate.metrics.web.servlet.... | package de.otto.edison.metricsconfiguration;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
import org.springframework.boot.actuate.metrics.web.servlet.... |
Rename image_pub to image_publisher; change docstring. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Reduce /ardrone/image_raw framerate from 30 Hz to 2 Hz.
"""
import rospy
from sensor_msgs.msg import Image
class ImageFeature(object):
"""
A ROS image Publisher/Subscriber.
"""
def __init__(self)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Reduce /ardrone/image_raw framerate from 30 Hz to 2 Hz.
"""
import rospy
from sensor_msgs.msg import Image
class ImageFeature(object):
"""
A ROS image Publisher/Subscriber.
"""
def __init__(self)... |
Implement the interface specification in two easy lines (plus an import). | from functools import wraps
import inspect
class PreconditionError (TypeError):
pass
def preconditions(*precs):
precinfo = []
for p in precs:
spec = inspect.getargspec(p)
if spec.varargs or spec.keywords:
raise PreconditionError(
'Precondition {!r} must not a... | import inspect
class PreconditionError (TypeError):
pass
def preconditions(*precs):
precinfo = []
for p in precs:
spec = inspect.getargspec(p)
if spec.varargs or spec.keywords:
raise PreconditionError(
'Precondition {!r} must not accept * nor ** args.'.format... |
Add fallback for older PHPUnit versions | <?php /** @noinspection PhpUnhandledExceptionInspection */
namespace Amp\Redis;
use Amp\PHPUnit\AsyncTestCase;
class AuthTest extends AsyncTestCase
{
public static function setUpBeforeClass(): void
{
print \shell_exec('redis-server --daemonize yes --port 25325 --timeout 3 --pidfile /tmp/amp-redis.pid... | <?php /** @noinspection PhpUnhandledExceptionInspection */
namespace Amp\Redis;
use Amp\PHPUnit\AsyncTestCase;
class AuthTest extends AsyncTestCase
{
public static function setUpBeforeClass(): void
{
print \shell_exec('redis-server --daemonize yes --port 25325 --timeout 3 --pidfile /tmp/amp-redis.pid... |
Fix coding standard errors introduced in b18d30c | 'use strict'
const express = require('express')
const bodyParser = require('body-parser')
const deviceService = require('./src/devices')
const PORT = process.env.PORT || 8080
const app = express()
const error = (code, res) => (e) =>
res.status(code).end(e.message)
app.use(bodyParser.json())
app.get(
'/devices... | 'use strict'
const express = require('express')
const bodyParser = require('body-parser')
const deviceService = require('./src/devices')
const PORT = process.env.PORT || 8080
const app = express()
const error = (code, res) => (e) =>
res.status(code).end(e.message)
app.use(bodyParser.json())
app.get(
'/devices... |
Fix property name in twig extension | <?php
namespace Knplabs\MenuBundle\Twig;
use Knplabs\MenuBundle\Templating\Helper\MenuHelper;
class MenuExtension extends \Twig_Extension
{
/**
* @var MenuHelper
*/
protected $helper;
/**
* @param MenuHelper
*/
public function __construct(MenuHelper $helper)
{
$this->... | <?php
namespace Knplabs\MenuBundle\Twig;
use Knplabs\MenuBundle\Templating\Helper\MenuHelper;
class MenuExtension extends \Twig_Extension
{
/**
* @var MenuHelper
*/
protected $provider;
/**
* @param MenuHelper
*/
public function __construct(MenuHelper $helper)
{
$this... |
Adjust help request to conform to new spec format. | var http = require('http');
var r = require('request');
var config = require('./config.json');
var doneUrl;
var userUrl;
http.createServer(function(request, response) {
if (!isEvent(request)) return;
r.post({
url: doneUrl
}, function(error, response, body) {
if (error !== null) {
... | var http = require('http');
var r = require('request');
var config = require('./config.json');
var doneUrl;
var userUrl;
http.createServer(function(request, response) {
if (!isEvent(request)) return;
r.post({
url: doneUrl
}, function(error, response, body) {
if (error !== null) {
... |
Make LoadTestShape a proper abstract class. | from __future__ import annotations
import time
from typing import Optional, Tuple, List, Type
from abc import ABC, abstractmethod
from . import User
from .runners import Runner
class LoadTestShape(ABC):
"""
Base class for custom load shapes.
"""
runner: Optional[Runner] = None
"""Reference to th... | from __future__ import annotations
import time
from typing import Optional, Tuple, List, Type
from . import User
from .runners import Runner
class LoadTestShape:
"""
A simple load test shape class used to control the shape of load generated
during a load test.
"""
runner: Optional[Runner] = None... |
[DDW-160] Use role instead of selector in macOS menu | export const osxMenu = (app, window, openAbout) => (
[{
label: 'Daedalus',
submenu: [{
label: 'About',
click() {
openAbout();
},
}, {
label: 'Quit',
accelerator: 'Command+Q',
click: () => app.quit()
}]
}, {
label: 'Edit',
submenu: [{
label: '... | export const osxMenu = (app, window, openAbout) => (
[{
label: 'Daedalus',
submenu: [{
label: 'About',
click() {
openAbout();
},
}, {
label: 'Quit',
accelerator: 'Command+Q',
click: () => app.quit()
}]
}, {
label: 'Edit',
submenu: [{
label: '... |
Use PhantomJS instead of Chrome | const path = require('path');
const webpackConfig = {
devtool: 'inline-source-map',
module: {
rules: [{
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
enforce: 'pre'
}, {
test: /\.js$/,
exclude: /(node_mod... | const path = require('path');
const webpackConfig = {
devtool: 'inline-source-map',
module: {
rules: [{
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
enforce: 'pre'
}, {
test: /\.js$/,
exclude: /(node_mod... |
Fix the deletion of sector objects | const functions = require('firebase-functions');
const admin = require('firebase-admin');
const BATCH_SIZE = 500;
const deleteBatch = (query, resolve, reject) =>
query
.limit(BATCH_SIZE)
.get()
.then(snapshot => {
if (snapshot.size === 0) {
return 0;
}
const batch = admin.firest... | const functions = require('firebase-functions');
const admin = require('firebase-admin');
const BATCH_SIZE = 500;
const deleteBatch = (query, resolve, reject) =>
query
.limit(BATCH_SIZE)
.get()
.then(snapshot => {
if (snapshot.size === 0) {
return 0;
}
const batch = admin.firest... |
Fix controller name after merge | 'use strict';
// This file contains controllers of base pages attributes: header, footer, body, common menu and so on
(function() {
angular.module('ncsaas')
.controller('HeaderController', ['$scope', 'currentStateService', 'customersService', HeaderController]);
function HeaderController($scope, currentStateS... | 'use strict';
// This file contains controllers of base pages attributes: header, footer, body, common menu and so on
(function() {
angular.module('ncsaas')
.controller('HeaderContoller', ['$scope', 'currentStateService', 'customersService', HeaderContoller]);
function HeaderContoller($scope, currentStateServ... |
Update to work with new API | 'use strict';
var consolidate = require('consolidate');
var path = require('path');
var _ = require('lodash');
module.exports = function(source, config){
config = _defaultsDeep(config || {}, {
engine: 'handlebars'
});
const partials = {};
function loadViews(source) {
... | 'use strict';
var consolidate = require('consolidate');
var path = require('path');
var _ = require('lodash');
module.exports = {
partials: {},
defaults: {
ext: '.hbs',
name: 'handlebars'
},
config: null,
configure: function(config){
this.config = confi... |
Fix deprecation for symfony/config 4.2 | <?php
/*
* This file is part of the StampieBundle package.
*
* (c) Henrik Bjornskov <henrik@bjrnskov.dk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stampie\StampieBundle\DependencyInjection;
use Symfony\Component\... | <?php
/*
* This file is part of the StampieBundle package.
*
* (c) Henrik Bjornskov <henrik@bjrnskov.dk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stampie\StampieBundle\DependencyInjection;
use Symfony\Component\... |
Update factory voter ACTIVE_RELATION statement | <?php
namespace Furniture\FactoryBundle\Security\Voter;
use Furniture\UserBundle\Entity\User;
use Furniture\FactoryBundle\Entity\Factory;
use Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter;
class ViewFactoryVoter extends AbstractVoter
{
/**
* {@inheritDoc}
*/
protected function g... | <?php
namespace Furniture\FactoryBundle\Security\Voter;
use Furniture\UserBundle\Entity\User;
use Furniture\FactoryBundle\Entity\Factory;
use Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter;
class ViewFactoryVoter extends AbstractVoter
{
/**
* {@inheritDoc}
*/
protected function g... |
Add self to list of filtered users for editors
Closes #4412 | import AuthenticatedRoute from 'ghost/routes/authenticated';
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
import styleBody from 'ghost/mixins/style-body';
var paginationSettings,
UsersIndexRoute;
paginationSettings = {
page: 1,
limit: 20,
status: 'active'
};
UsersIndexRoute = Aut... | import AuthenticatedRoute from 'ghost/routes/authenticated';
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
import styleBody from 'ghost/mixins/style-body';
var paginationSettings,
UsersIndexRoute;
paginationSettings = {
page: 1,
limit: 20,
status: 'active'
};
UsersIndexRoute = Aut... |
Disable attempts for the cometd lib to try wss connections
wss connections are not yet valid in Lightning context | ({
doInit: function(component, event, helper) {
var action = component.get("c.getSessionId");
action.setCallback(this, function(response) {
// Configure CometD
var sessionId = response.getReturnValue();
var cometd = new window.org.cometd.CometD();
... | ({
doInit: function(component, event, helper) {
var action = component.get("c.getSessionId");
action.setCallback(this, function(response) {
// Configure CometD
var sessionId = response.getReturnValue();
var cometd = new window.org.cometd.CometD();
... |
Make "is_saveable" a staticmethod of SaveSession | import sublime
import sublime_plugin
from datetime import datetime
from .modules import messages
from .modules import serialize
from .modules import settings
from .modules.session import Session
def plugin_loaded():
settings.load()
def error_message(errno):
sublime.error_message(messages.e... | import sublime
import sublime_plugin
from datetime import datetime
from .modules import messages
from .modules import serialize
from .modules import settings
from .modules.session import Session
def plugin_loaded():
settings.load()
def error_message(errno):
sublime.error_message(messages.e... |
Add STATUS_UPDATE, remove header actions from status reducer | import initialState from './initialState';
import {
LOGO_SPIN_STARTED,
LOGO_SPIN_ENDED,
PAGE_SCROLL_STARTED,
SCROLL_ENDED,
APP_INIT,
STATUS_UPDATE,
PROVIDER_CHANGE,
BOARD_CHANGE,
THREAD_REQUESTED,
BOARD_REQUESTED,
} from '../constants';
export default function (state = init... | import initialState from './initialState';
import {
HEADER_SHRINKING,
HEADER_EXPANDING,
HEADER_ANIMATION_ENDED,
LOGO_SPIN_STARTED,
LOGO_SPIN_ENDED,
SCROLL_STARTED,
SCROLL_ENDED,
APP_INIT
} from '../constants';
export default function (state = initialState.status, action) {
sw... |
Fix reload page when scrolling upwards | import angular from 'angular';
export default function maDatagridInfinitePagination($window, $document) {
var windowElement = angular.element($window);
var offset = 100,
body = $document[0].body;
return {
restrict: 'E',
scope: {
perPage: '@',
totalItems: '@... | import angular from 'angular';
export default function maDatagridInfinitePagination($window, $document) {
var windowElement = angular.element($window);
var offset = 100,
body = $document[0].body;
return {
restrict: 'E',
scope: {
perPage: '@',
totalItems: '@... |
Use promises for looping through pathes to check authentication |
'use strict';
var test = require('selenium-webdriver/testing'),
application_host = 'http://localhost:3000/',
new_user_email,
webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
expect = require('chai').expect,
_ = require('underscore'),... |
'use strict';
var test = require('selenium-webdriver/testing'),
application_host = 'http://localhost:3000/',
new_user_email,
webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
expect = require('chai').expect;
describe('Try to access private pag... |
BUG-633: Rewrite test to how IReference actually works | import lxml.objectify
import zeit.cms.content.interfaces
import zeit.content.article.edit.volume
import zeit.content.volume.testing
import zope.component
class VolumeReferenceTest(zeit.content.volume.testing.FunctionalTestCase):
def setUp(self):
from zeit.content.volume.volume import Volume
super... | import zeit.cms.content.interfaces
import zeit.content.article.edit.volume
import zeit.content.volume.testing
import zope.component
class VolumeReferenceTest(zeit.content.volume.testing.FunctionalTestCase):
def setUp(self):
from zeit.content.volume.volume import Volume
super(VolumeReferenceTest, ... |
Add expiry fields on card model | # -*- coding: utf-8 -*-
"""Checkout Models"""
import functools
from flask import redirect, url_for
from fulfil_client.model import ModelType, StringType
from shop.fulfilio import Model
from shop.globals import current_cart, current_channel
def not_empty_cart(function):
@functools.wraps(function)
def wrapper(... | # -*- coding: utf-8 -*-
"""Checkout Models"""
import functools
from flask import redirect, url_for
from fulfil_client.model import ModelType, StringType
from shop.fulfilio import Model
from shop.globals import current_cart, current_channel
def not_empty_cart(function):
@functools.wraps(function)
def wrapper(... |
[tests] Enable also the Script panel to get proper stack traces | function runTest()
{
FBTest.sysout("issue2914.START");
FBTest.openNewTab(basePath + "console/2914/issue2914.html", function(win)
{
FBTest.openFirebug();
FBTest.enableScriptPanel();
FBTest.enableConsolePanel(function(win)
{
var panelNode = FBTest.selectPanel("cons... | function runTest()
{
FBTest.sysout("issue2914.START");
FBTest.openNewTab(basePath + "console/2914/issue2914.html", function(win)
{
FBTest.openFirebug();
FBTest.enableConsolePanel(function(win)
{
var panelNode = FW.Firebug.chrome.selectPanel("console").panelNode;
... |
Upgrade if the user's file matches the previous | import fs from "fs-extra";
import path from "path";
import inquirer from "inquirer";
import sha1 from "sha1";
import readFileSyncStrip from "../lib/readFileSyncStrip";
import logger from "../lib/logger";
import { warn } from "../lib/logsColorScheme";
function doUpdate(from, to) {
logger.info("Updating .babelrc file... | import fs from "fs-extra";
import path from "path";
import inquirer from "inquirer";
import sha1 from "sha1";
import readFileSyncStrip from "../lib/readFileSyncStrip";
import logger from "../lib/logger";
import { warn } from "../lib/logsColorScheme";
function doUpdate(from, to) {
logger.info("Updating .babelrc file... |
Add viewport meta data and use small button | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sligen Online Demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<style>
body {
font-size: 1.5em;
}
</style>
<link rel="stylesheet"... | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sligen Online Demo</title>
<style>
body {
font-size: 1.5em;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<... |
Change __exit__arg names to not be built ins | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... |
Introduce a library of the xtend. | import Promise from 'bluebird'
import extend from 'xtend'
import * as gitlabClient from './gitlabClient'
// MRのユーザを表示します。
module.exports = function(objectKind, body) {
if (objectKind === 'merge_request' || objectKind === 'issue') {
var objectAttributes = body.object_attributes;
var projectId = objectKind ===... | import Promise from 'bluebird'
import extend from 'xtend'
import * as gitlabClient from './gitlabClient'
// MRのユーザを表示します。
module.exports = function(objectKind, body) {
if (objectKind === 'merge_request' || objectKind === 'issue') {
var objectAttributes = body.object_attributes;
var projectId = objectKind ===... |
Update UserSuForm to enhance compatibility with custom user models.
In custom user models, we cannot rely on there being a 'username'
field. Instead, we should use whichever field has been specified as
the username field. | # -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from . import get_user_model
class UserSuForm(forms.Form):
username_field = get_user_model().USERNAME_FIELD
user = forms.ModelChoiceField(
label=_('Users'), que... | # -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from . import get_user_model
class UserSuForm(forms.Form):
user = forms.ModelChoiceField(
label=_('Users'), queryset=get_user_model()._default_manager.order_by(
... |
Fix injectable service due to rc.7 changes. | "use strict";
(function () {
angular
.module("dummy", []);
var fooS = ng.core
.Class({
constructor: [ng.http.Http, function FooService(http) {
this.http = http;
}],
getFoo: function () {
ret... | "use strict";
(function () {
angular
.module("dummy", []);
var fooS = ng.core
.Injectable()
.Class({
constructor: [ng.http.Http, function FooService(http) {
this.http = http;
}],
getFoo: function ()... |
Add --all to push option | #!/usr/bin/env python3
import git
class PullPush:
def __init__(self, repo_dir):
"""
:param repo_dir: Directory in which to pull into
"""
self.repo_dir = repo_dir
self.repo = None
def pull(self, origin):
"""
Pulls from a remote repository and store... | #!/usr/bin/env python3
import git
class PullPush:
def __init__(self, repo_dir):
"""
:param repo_dir: Directory in which to pull into
"""
self.repo_dir = repo_dir
self.repo = None
def pull(self, origin):
"""
Pulls from a remote repository and store... |
Fix following testing, add instructions for uploading | package com.google.cloud.pubsub.sql.providers;
import com.google.auto.service.AutoService;
import com.google.cloud.pubsub.sql.Rows;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.Schema.FieldType;
@AutoService({StandardSourceProvider.class, StandardSinkProvider.class})
public class Pubs... | package com.google.cloud.pubsub.sql.providers;
import com.google.auto.service.AutoService;
import com.google.cloud.pubsub.sql.Rows;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.Schema.FieldType;
@AutoService({StandardSourceProvider.class, StandardSinkProvider.class})
public class Pubs... |
Fix removing the order of inventory | 'use strict';
angular.module('inventory.controllers')
.controller('OrderTableCtrl', ['$scope', 'orderService', 'formService',
function ($scope, orderService, formService) {
$scope.inventoryOrders = $scope.parts.inventoryOrders;
$scope.deliveredOrders = function (orders) {
return orderService... | 'use strict';
angular.module('inventory.controllers')
.controller('OrderTableCtrl', ['$scope', 'orderService', 'formService',
function ($scope, orderService, formService) {
$scope.inventoryOrders = $scope.parts.inventoryOrders;
$scope.deliveredOrders = function (orders) {
return orderService... |
Add a corrected spectral regridding function that smooths before interpolating to a new spectral axis | # Licensed under an MIT open source license - see LICENSE
import numpy as np
from astropy import units as u
from spectral_cube import SpectralCube
from astropy.convolution import Gaussian1DKernel
def spectral_regrid_cube(cube, channel_width):
fwhm_factor = np.sqrt(8 * np.log(2))
current_resolution = np.dif... | # Licensed under an MIT open source license - see LICENSE
import numpy as np
def change_slice_thickness(cube, slice_thickness=1.0):
'''
Degrades the velocity resolution of a data cube. This is to avoid
shot noise by removing velocity fluctuations at small thicknesses.
Parameters
----------
... |
Fix typo: route has been renamed, rename in config | <?php
/**
* ZfcAdmin Configuration
*
* If you have a ./config/autoload/ directory set up for your project, you can
* drop this config file in it and change the values as you wish.
*/
$settings = array(
/**
* Flag to use layout/admin as the admin layout
*
* The layout when ZfcAdmin is accessed wi... | <?php
/**
* ZfcAdmin Configuration
*
* If you have a ./config/autoload/ directory set up for your project, you can
* drop this config file in it and change the values as you wish.
*/
$settings = array(
/**
* Flag to use layout/admin as the admin layout
*
* The layout when ZfcAdmin is accessed wi... |
[CoreBundle] Update getEm function in the core controller to use the getDoctrine function instead | <?php
/*
* This file is part of the CSBillCoreBundle package.
*
* (c) Pierre du Plessis <info@customscripts.co.za>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CSBill\CoreBundle\Controller;
use Symfony\Bundle\Framew... | <?php
/*
* This file is part of the CSBillCoreBundle package.
*
* (c) Pierre du Plessis <info@customscripts.co.za>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CSBill\CoreBundle\Controller;
use Symfony\Bundle\Framew... |
Tidy up layout and remove redundant code | from typing import Sequence
import pulp
def variables(events: Sequence, rooms: Sequence, slots: Sequence):
"""Defines the required instances of pulp.LpVariable
Parameters
----------
events : List or Tuple
of resources.Event
rooms : List or Tuple
of resources.Room
slots : List ... | from typing import NamedTuple, Callable, List, Dict, Sequence
import pulp
from .resources import ScheduledItem
def variables(events: Sequence, rooms: Sequence, slots: Sequence):
"""Defines the required instances of pulp.LpVariable
Parameters
----------
events : List or Tuple
of resources.Even... |
Fix XHR login on Firebase hosting | import { ValidationError } from '../lib/validation';
export const LOGIN_ERROR = 'LOGIN_ERROR';
export const LOGIN_START = 'LOGIN_START';
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
export const LOGOUT = 'LOGOUT';
export function login(fields) {
return ({ fetch, validate }) => {
const getPromise = async () => ... | import { ValidationError } from '../lib/validation';
export const LOGIN_ERROR = 'LOGIN_ERROR';
export const LOGIN_START = 'LOGIN_START';
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
export const LOGOUT = 'LOGOUT';
export function login(fields) {
return ({ fetch, validate }) => {
const getPromise = async () => ... |
OEE-1073: Create field in Multicurrency for fixed rate
- add field to entity
- add migration | <?php
namespace Oro\Bundle\CurrencyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Oro\Bundle\DataAuditBundle\Metadata\Annotation as Oro;
class MultiCurrency
{
use CurrencyAwareTrait;
protected $value;
protected $rate;
protected $baseCurrencyValue;
/**
* @param string $value
* @pa... | <?php
namespace Oro\Bundle\CurrencyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Oro\Bundle\DataAuditBundle\Metadata\Annotation as Oro;
class MultiCurrency
{
use CurrencyAwareTrait;
protected $value;
protected $rate;
/**
* @param string $value
* @param string $currency
* @param... |
Fix a bug that we didn't properly close our physical connections. | package net.nanopool;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
import net.nanopool.cas.CasArray;
public class Connector {
private final ConnectionPoolDataSource source;
private final CasArray<Connector> connectors... | package net.nanopool;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
import net.nanopool.cas.CasArray;
public class Connector {
private final ConnectionPoolDataSource source;
private final CasArray<Connector> connectors... |
Fix LAG Admin extension test | <?php
namespace LAG\AdminBundle\Tests\DependencyInjection;
use LAG\AdminBundle\DependencyInjection\LAGAdminExtension;
use LAG\AdminBundle\Tests\AdminTestBase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class LAGAdminExtensionTest extends AdminTestBase
{
/**
* The load should allow the conta... | <?php
namespace LAG\AdminBundle\Tests\DependencyInjection;
use LAG\AdminBundle\DependencyInjection\LAGAdminExtension;
use LAG\AdminBundle\Tests\AdminTestBase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class LAGAdminExtensionTest extends AdminTestBase
{
/**
* The load should allow the conta... |
Switch to using a button group for the context selector. | import React from "react"
import { Button, ButtonGroup, NavItem, Collapse } from "react-bootstrap"
export default React.createClass({
getInitialState: function() {
return {}
},
render: function() {
var { title, ...other } = this.props;
return (
<NavItem {...other}>
... | import React from "react"
import { Nav, NavItem, Collapse } from "react-bootstrap"
var threadNavStyle = {
backgroundColor: 'rgb(220, 220, 220)',
color: 'black'
};
export default React.createClass({
getInitialState: function() {
return {}
},
render: function() {
var { title, ...oth... |
Set local worker as default for SyftTensor owner | import random
from syft.frameworks.torch.tensors import PointerTensor
import syft
class TorchTensor:
"""
This tensor is simply a more convenient way to add custom functions to
all Torch tensor types.
"""
def __init__(self):
self.id = None
self.owner = syft.local_worker
def ... | import random
from syft.frameworks.torch.tensors import PointerTensor
class TorchTensor:
"""
This tensor is simply a more convenient way to add custom functions to
all Torch tensor types.
"""
def __init__(self):
self.id = None
self.owner = None
def create_pointer(
se... |
Disable `console` warnings for test harness | 'use strict';
/* eslint-disable no-console */
const { EventEmitter } = require('events');
const { Server } = require('http');
const handler = require('serve-handler');
const childProcess = require('child_process');
const sauceConnect = require('sauce-connect-launcher');
EventEmitter.defaultMaxListeners = 0;
const po... | 'use strict';
const { EventEmitter } = require('events');
const { Server } = require('http');
const handler = require('serve-handler');
const childProcess = require('child_process');
const sauceConnect = require('sauce-connect-launcher');
EventEmitter.defaultMaxListeners = 0;
const port = Number(process.env.npm_pack... |
Make sure HH:MM values are allowed | import datetime
import time
from graphite_api.render.attime import parseATTime
from . import TestCase
class AtTestCase(TestCase):
def test_parse(self):
for value in [
str(int(time.time())),
'20140319',
'20130319+1y',
'20130319+1mon',
'20130319+... | import datetime
import time
from graphite_api.render.attime import parseATTime
from . import TestCase
class AtTestCase(TestCase):
def test_parse(self):
for value in [
str(int(time.time())),
'20140319',
'20130319+1y',
'20130319+1mon',
'20130319+... |
Fix parse refactor - this passed to the plugin manager must be less | var PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
module.exports = function(environment, ParseTree, ImportManager) {
var render = function (input, options, callback) {
if (typeof(options) === 'function') {
callback = options;
options = {};
... | var PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
module.exports = function(environment, ParseTree, ImportManager) {
var render = function (input, options, callback) {
var parse = require('./parse')(environment, ParseTree, ImportManager);
if (typeof(options) =... |
Refactor to change the comparator of dict | from flask import Flask
from flask import request
from flask import jsonify
from y_text_recommender_system.recommender import recommend
app = Flask(__name__)
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, payload=None):
Exception.__init__(self)
self.message = m... | from flask import Flask
from flask import request
from flask import jsonify
from y_text_recommender_system.recommender import recommend
app = Flask(__name__)
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, payload=None):
Exception.__init__(self)
self.message = m... |
Add automatic upgrade portal url from http to https where appropriate
Adding an upgrade of portal urls from http to https in the url
validation check whenever the hosting ArcGIS Online Assistant is hosted
on https. | define(["jquery"], function(jquery) {
return {
// Convert an array to a comma separated string.
arrayToString: function(array) {
var arrayString;
jquery.each(array, function(index, arrayValue) {
if (index === 0) {
arrayString = arrayValue;
... | define(["jquery"], function(jquery) {
return {
// Convert an array to a comma separated string.
arrayToString: function(array) {
var arrayString;
jquery.each(array, function(index, arrayValue) {
if (index === 0) {
arrayString = arrayValue;
... |
[Android] Destroy containes when they are not visible
Whatever I've tried so far ends up failing in really weird ways, so let's admit
defeat, for now. Destroy containers only on Android.
This shall be revisited when we update RN to version >= 0.43 and we have
"display: 'none'" available. | /* @flow */
import React from 'react';
import {
TouchableHighlight,
TouchableWithoutFeedback,
View
} from 'react-native';
import { Platform } from '../../';
import AbstractContainer from '../AbstractContainer';
/**
* Represents a container of React Native/mobile {@link Component} children.
*
* @extend... | /* @flow */
import React from 'react';
import {
TouchableHighlight,
TouchableWithoutFeedback,
View
} from 'react-native';
import AbstractContainer from '../AbstractContainer';
/**
* Represents a container of React Native/mobile {@link Component} children.
*
* @extends AbstractContainer
*/
export defa... |
Change global in btoa segment to refer to exports instead of this for consistency (and so it works on Titanium android) | (function (global) {
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/**
* Base64 encode a string
* @param string {string} the string to be base64 encoded
*/
global.btoa = global.btoa || function (string) {
var i = 0, length = string.length, ascii, inde... | (function (global) {
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/**
* Base64 encode a string
* @param string {string} the string to be base64 encoded
*/
global.btoa = global.btoa || function (string) {
var i = 0, length = string.length, ascii, inde... |
Use the latest version of openstax-accounts | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
install_requires = (
'cnx-epub',
'cnx-query-grammar',
'colander',
'openstax-accounts>=0.6',
'PasteDeploy',
'pyramid',
'psycopg2>=2.5',
'requests',
'tzlocal',
'waitress',
... | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
install_requires = (
'cnx-epub',
'cnx-query-grammar',
'colander',
'openstax-accounts>=0.5',
'PasteDeploy',
'pyramid',
'psycopg2>=2.5',
'requests',
'tzlocal',
'waitress',
... |
Fix bug with Markdown Previewer where it wouldn't load up correct data initially | (function( $ ) {
$.fn.markdownPreview = function( options ) {
var settings = {
'insert-preview-div': true,
'location': 'below',
'preview-class-name': 'preview',
'preview-element': null
};
if( options ) {
$.extend(... | (function( $ ) {
$.fn.markdownPreview = function( options ) {
var settings = {
'insert-preview-div': true,
'location': 'below',
'preview-class-name': 'preview',
'preview-element': null
};
if( options ) {
$.extend(... |
Use regular send() instead of our writev()
Buffering is apparently more rewarding performance-wise than using
zero-copy vectorised I/O ala writev(), hence there's no point to keep
using our homemade write() extension. | # -*- coding: utf-8 -*-
import errno
import collections
from savate import writev
# FIXME: should this be a method of BufferEvent below ?
# FIXME: handle Python2.x/Python3k compat here
def buffer_slice(buff, offset, size):
return buffer(buff, offset, size)
class BufferOutputHandler(object):
def __init__(sel... | # -*- coding: utf-8 -*-
import errno
import collections
from savate import writev
# FIXME: should this be a method of BufferEvent below ?
# FIXME: handle Python2.x/Python3k compat here
def buffer_slice(buff, offset, size):
return buffer(buff, offset, size)
class BufferOutputHandler(object):
def __init__(sel... |
Add colour map by type | 'use strict';
angular.module('interfaceApp')
.constant('configuration', {
'development': 'https://service.esrc.info',
'production': 'https://cnex.esrc.unimelb.edu.au',
'service': 'development',
'solr': 'https://solr.esrc.unimelb.edu.au/ESRC/select',
'colours': {
'person': '#d... | 'use strict';
angular.module('interfaceApp')
.constant('configuration', {
'development': 'https://service.esrc.info',
'production': 'https://cnex.esrc.unimelb.edu.au',
'service': 'development',
'solr': 'https://solr.esrc.unimelb.edu.au/ESRC/select',
'fill': {
'contextNode': '... |
Enable to call gc() in performance tests of BlinkGC.
In case of GCController cannot be used.
BUG=465997,457982,438074
TEST=./tools/perf/run_benchmark run oilpan_gc_times.blink_perf_stress --browser=content-shell-release
Review URL: https://codereview.chromium.org/971683002
git-svn-id: bf5cd6ccde378db821296732a091cfb... | if (!window.PerfTestRunner)
console.log("measure-gc.js requires PerformanceTests/resources/runner.js to be loaded.");
if (!window.internals)
console.log("measure-gc.js requires window.internals.");
if (!window.GCController && !window.gc)
console.log("measure-gc.js requires GCController or exposed gc().");
... | if (!window.PerfTestRunner)
console.log("measure-gc.js requires PerformanceTests/resources/runner.js to be loaded.");
if (!window.internals)
console.log("measure-gc.js requires window.internals.");
if (!window.GCController)
console.log("measure-gc.js requires GCController.");
(function (PerfTestRunner) {
... |
Increase Nightwatch.js check_process_delay to 5 seconds | var seleniumServer = require('selenium-server');
var chromedriver = require('chromedriver');
var geckodriver = require('geckodriver');
module.exports = {
src_folders: ['tests'],
selenium: {
start_process: true,
server_path: seleniumServer.path,
port: 4444,
cli_args: {
'webdriver.chrome.driver... | var seleniumServer = require('selenium-server');
var chromedriver = require('chromedriver');
var geckodriver = require('geckodriver');
module.exports = {
src_folders: ['tests'],
selenium: {
start_process: true,
server_path: seleniumServer.path,
port: 4444,
cli_args: {
'webdriver.chrome.driver... |
Support for static pages added | # View for semi-static templatized content.
#
# List of valid templates is explicitly managed for (short-term)
# security reasons.
from mitxmako.shortcuts import render_to_response, render_to_string
from django.shortcuts import redirect
from django.core.context_processors import csrf
from django.conf import settings
... | # View for semi-static templatized content.
#
# List of valid templates is explicitly managed for (short-term)
# security reasons.
from mitxmako.shortcuts import render_to_response, render_to_string
from django.shortcuts import redirect
from django.core.context_processors import csrf
from django.conf import settings
... |
Test case two for comment contents | var cmm = require("__buttercup/classes/commands/command.cmm.js");
module.exports = {
setUp: function(cb) {
this.command = new cmm();
(cb)();
},
callbackInjected: {
callsToCallback: function(test) {
var callbackCalled = false;
var callback = function(comment)... | var cmm = require("__buttercup/classes/commands/command.cmm.js");
module.exports = {
setUp: function(cb) {
this.command = new cmm();
(cb)();
},
callbackInjected: {
callsToCallback: function(test) {
var callbackCalled = false;
var callback = function(comment)... |
Update django to use latest security release | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-oscar-fancypages',
version=":versiontools:fancypages:",
url='https://github.com/tangentlabs/django-oscar-fancypages',
author="Sebastian Vetter",
author_email="sebastian.vetter@tangentsnowball.com.au",
descript... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-oscar-fancypages',
version=":versiontools:fancypages:",
url='https://github.com/tangentlabs/django-oscar-fancypages',
author="Sebastian Vetter",
author_email="sebastian.vetter@tangentsnowball.com.au",
descript... |
Update Bincrafters config url for tests
Signed-off-by: Uilian Ries <d4bad57018205bdda203549c36d3feb0bfe416a7@gmail.com> | import unittest
from conans.errors import ConanException
from cpt.config import ConfigManager
from cpt.printer import Printer
from cpt.test.integration.base import BaseTest
from cpt.test.unit.packager_test import MockConanAPI
class RemotesTest(unittest.TestCase):
def setUp(self):
self.conan_api = MockC... | import unittest
from conans.errors import ConanException
from cpt.config import ConfigManager
from cpt.printer import Printer
from cpt.test.integration.base import BaseTest
from cpt.test.unit.packager_test import MockConanAPI
class RemotesTest(unittest.TestCase):
def setUp(self):
self.conan_api = MockC... |
Set Django requirement to the last LTS | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-bitfield',
version='1.9.0',
author='DISQUS',
author_email='opensource@disqus.com',
url='https://github.com/disqus/django-bitfield',
description='BitField in Django',
packages=find_packages(),
zip_safe... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-bitfield',
version='1.9.0',
author='DISQUS',
author_email='opensource@disqus.com',
url='https://github.com/disqus/django-bitfield',
description='BitField in Django',
packages=find_packages(),
zip_safe... |
Change BaseWorker to new style class. | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module define base class of mass worker.
"""
# built-in modules
from functools import wraps
import sys
import traceback
# local modules
from mass.exception import TaskError
class BaseWorker(object):
"""Base class of mass worker.
"""
role_functions... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module define base class of mass worker.
"""
# built-in modules
from functools import wraps
import sys
import traceback
# local modules
from mass.exception import TaskError
class BaseWorker:
"""Base class of mass worker.
"""
role_functions = {}
... |
Fix NPE in applying wolf entity data from config | package com.elmakers.mine.bukkit.entity;
import org.bukkit.DyeColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Wolf;
import com.elmakers.mine.bukkit.api.magic.MageController;
public class EntityWolfData extends EntityAnimalData {
private boole... | package com.elmakers.mine.bukkit.entity;
import org.bukkit.DyeColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Wolf;
import com.elmakers.mine.bukkit.api.magic.MageController;
public class EntityWolfData extends EntityAnimalData {
private boole... |
[FIX] stock_planning: Fix condition cond.append(('date', '>=', from_date)) | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models
class StockMove(models.Model):... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models
class StockMove(models.Model):... |
Add additional trove classifiers for supported Pythons | #!/usr/bin/env python
"""Setup script for the pyparsing module distribution."""
# Setuptools depends on pyparsing (via packaging) as of version 34, so allow
# installing without it to avoid bootstrap problems.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
i... | #!/usr/bin/env python
"""Setup script for the pyparsing module distribution."""
# Setuptools depends on pyparsing (via packaging) as of version 34, so allow
# installing without it to avoid bootstrap problems.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
i... |
Switch to use Schedule for identifying campus. | from myuw_mobile.dao.gws import Member
from myuw_mobile.dao.sws import Schedule
from myuw_mobile.logger.logback import log_time
def log_response_time(logger, message, timer):
log_time(logger, message, timer)
def log_success_response(logger, timer):
log_time(logger,
get_identity() + 'fulfilled',... | from myuw_mobile.dao.gws import Member
from myuw_mobile.logger.logback import log_time
def log_response_time(logger, message, timer):
log_time(logger, message, timer)
def log_success_response(logger, timer):
log_time(logger,
get_identity() + 'fulfilled',
timer)
def log_data_not_... |
Check before attempting to init image cropping | if ($('#uploadPreview').length) {
let $uploadCrop;
let $preview = $('#uploadPreview');
function readFile(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (evt) {
$uploadCrop.croppie('bind', {
... | $( document ).ready(function() {
let $uploadCrop;
let $preview = $('#uploadPreview');
function readFile(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (evt) {
$uploadCrop.croppie('bind', {
... |
Fix if no profiles are found | @extends('partials.content-area')
@section('content')
<h1 class="page-title">{{ $page['title'] }}</h1>
{!! $page['content']['main'] !!}
@forelse($profiles as $key => $profiles)
<h1>{{ $key }}</h1>
<div class="row small-up-2 medium-up-3">
@foreach((array)$profiles as $profile)... | @extends('partials.content-area')
@section('content')
<h1 class="page-title">{{ $page['title'] }}</h1>
{!! $page['content']['main'] !!}
@foreach($profiles as $key => $profiles)
<h1>{{ $key }}</h1>
<div class="row small-up-2 medium-up-3">
@forelse((array)$profiles as $profile)... |
Refactor AddGradeController to work with two factor authentification | package at.ac.tuwien.inso.controller.lecturer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
... | package at.ac.tuwien.inso.controller.lecturer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
... |
Update path fonts gulp task | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... |
Add python 3.6 to support array | import sys
from setuptools import setup
setup_requires = ['setuptools_scm']
if sys.argv[-1] in ('sdist', 'bdist_wheel'):
setup_requires.append('setuptools-markdown')
setup(
name='tldr',
author='Felix Yan',
author_email='felixonmars@gmail.com',
url='https://github.com/tldr-pages/tldr-python-client'... | import sys
from setuptools import setup
setup_requires = ['setuptools_scm']
if sys.argv[-1] in ('sdist', 'bdist_wheel'):
setup_requires.append('setuptools-markdown')
setup(
name='tldr',
author='Felix Yan',
author_email='felixonmars@gmail.com',
url='https://github.com/tldr-pages/tldr-python-client'... |
Fix [IQSLDSH-107] - the MongoDB server date was used as default, now user date is used. | /*jslint nomen: true, vars: true*/
/*global _, angular, ApplicationConfiguration*/
(function () {
'use strict';
angular.module('blueprints').controller('SlideBlueprintsController', ['$scope', 'Tags', 'SlideBlueprints',
function ($scope, Tags, SlideBlueprints) {
$scope.bluePrintInstance = Sli... | /*jslint nomen: true, vars: true*/
/*global _, angular, ApplicationConfiguration*/
(function () {
'use strict';
angular.module('blueprints').controller('SlideBlueprintsController', ['$scope', 'Tags', 'SlideBlueprints',
function ($scope, Tags, SlideBlueprints) {
$scope.bluePrintInstance = Sli... |
Make the failing test pass | <?php
namespace fennecweb;
class ProjectsTest extends \PHPUnit_Framework_TestCase
{
const NICKNAME = 'listingProjectsTestUser';
const USERID = 'listingProjectsTestUser';
const PROVIDER = 'listingProjectsTestUser';
public function testExecute()
{
//Test for error returned by user is not lo... | <?php
namespace fennecweb;
class ProjectsTest extends \PHPUnit_Framework_TestCase
{
const NICKNAME = 'listingProjectsTestUser';
const USERID = 'listingProjectsTestUser';
const PROVIDER = 'listingProjectsTestUser';
public function testExecute()
{
//Test for error returned by user is not lo... |
Add restriction to allowed types in base type extension | <?php
/**
* This file is part of the BootstrapBundle project.
*
* (c) 2013 Philipp Boes <mostgreedy@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace P2\Bundle\BootstrapBundle\Form\Extension;
use Symfony\Compon... | <?php
/**
* This file is part of the BootstrapBundle project.
*
* (c) 2013 Philipp Boes <mostgreedy@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace P2\Bundle\BootstrapBundle\Form\Extension;
use Symfony\Compon... |
Include templates in assets pipeline for plugins. | var path = require('path');
var cwd = process.cwd();
var filter = require('../../api/hooks/pluginloader/pluginhelper').filter;
module.exports = function(grunt) {
grunt.registerTask('pluginassets', 'Links assets from plugins into the assets folder', function() {
var options = this.options({
modl... | var path = require('path');
var cwd = process.cwd();
var filter = require('../../api/hooks/pluginloader/pluginhelper').filter;
module.exports = function(grunt) {
grunt.registerTask('pluginassets', 'Links assets from plugins into the assets folder', function() {
var options = this.options({
modl... |
Fix some more unittest assert methods for Python 2.6 | import unittest
import cybox.bindings.cybox_common_types_1_0 as common_types_binding
import cybox.bindings.mutex_object_1_3 as mutex_binding
from cybox.objects.mutex_object import Mutex
class MutexTest(unittest.TestCase):
def setUp(self):
self.test_dict = {'named': True, 'name': {'value': 'test_name'}}
... | import unittest
import cybox.bindings.cybox_common_types_1_0 as common_types_binding
import cybox.bindings.mutex_object_1_3 as mutex_binding
from cybox.objects.mutex_object import Mutex
class MutexTest(unittest.TestCase):
def setUp(self):
self.test_dict = {'named': True, 'name': {'value': 'test_name'}}
... |
Check for element before tryign to retrive an attibiute of that element | module.exports = {
sortChildren (data) {
data.forEach((el) => {
if (el.parent) {
if (this.findNestedObject(data, el.parent[0].admin.uid)) {
this.findNestedObject(data, el.parent[0].admin.uid).children.push(el);
}
}
});
return this.arrangeChildren(data[0]);
},
fin... | module.exports = {
sortChildren (data) {
data.forEach((el) => {
if (el.parent) {
this.findNestedObject(data, el.parent[0].admin.uid).children.push(el);
}
});
return this.arrangeChildren(data[0]);
},
findNestedObject (objects, id) {
var found;
for (var i = 0; i < objects.le... |
Remove the obsolte comment, library is licensed under BSD. | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import re
from distutils.core import setup
version_re = re.compile(
r'__version__ = (\(.*?\))')
cwd = os.path.dirname(os.path.abspath(__file__))
fp = open(os.path.join(cwd, 'face_client', '__init__.py'))
version = None
for line in fp:
match = version_re... | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import re
from distutils.core import setup
version_re = re.compile(
r'__version__ = (\(.*?\))')
cwd = os.path.dirname(os.path.abspath(__file__))
fp = open(os.path.join(cwd, 'face_client', '__init__.py'))
version = None
for line in fp:
match = version_re... |
Use url rather than file-loader to base64 encode images | const path = require('path');
module.exports = {
mode: 'development', // TODO: production mode
entry: path.resolve('src', 'index.js'),
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
library: 'stockflux-components',
libraryTarget: 'umd'
},
modu... | const path = require('path');
module.exports = {
mode: 'development', // TODO: production mode
entry: path.resolve('src', 'index.js'),
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
library: 'stockflux-components',
libraryTarget: 'umd'
},
modu... |
Fix issue where parent slug was not being included on NEW entries | <?php namespace Anomaly\PagesModule\Page\Form;
use Anomaly\PagesModule\Page\Command\GetRealPath;
use Anomaly\PagesModule\Page\Contract\PageInterface;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Foundation\Bus\DispatchesJobs;
/**
* Class PageFormFields
*
* @link http://pyrocms.com/
* @author... | <?php namespace Anomaly\PagesModule\Page\Form;
use Anomaly\PagesModule\Page\Command\GetRealPath;
use Anomaly\PagesModule\Page\Contract\PageInterface;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Foundation\Bus\DispatchesJobs;
/**
* Class PageFormFields
*
* @link http://pyrocms.com/
* @author... |
Fix detection of Nuxeo SDK folder | package org.nuxeo.intellij.ui;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
/**
* Utility class to show a
* {@link com.intellij.openapi.fileChooser.FileCho... | package org.nuxeo.intellij.ui;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
/**
* Utility class to show a
* {@link com.intellij.openapi.fileChooser.FileCho... |
Remove phantom header on splash screen on android | import React, { Component } from 'react';
import { View, Text, Image, ActivityIndicator, AppRegistry, StyleSheet } from 'react-native';
export default class SpalshScreen extends Component {
constructor(props) {
super(props)
}
componentWillUpdate() {
const { navigate } = this.props.navigati... | import React, { Component } from 'react';
import { View, Text, Image, ActivityIndicator, AppRegistry, StyleSheet } from 'react-native';
export default class SpalshScreen extends Component {
constructor(props) {
super(props)
}
componentWillUpdate() {
const { navigate } = this.props.navigati... |
Use console.groupCollapsed() in the logger plugin, where available. | /* istanbul ignore next */
/*eslint no-console: 0*/
const noop = () => {};
function loggerPlugin() {
let startGroup, endGroup;
if (console.groupCollapsed) {
startGroup = label => console.groupCollapsed(label);
endGroup = () => console.groupEnd();
} else if (console.group) {
startGr... | /* istanbul ignore next */
/*eslint no-console: 0*/
const noop = () => {};
function loggerPlugin() {
const supportsGroups = console.group && console.groupEnd;
const startGroup = supportsGroups
? () => console.group('Router transition')
: noop;
const endGroup = supportsGroups
? () =>... |
Set webpack to fallback to history on mismatched route | const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src',
module: {
rules: [
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
'style-load... | const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src',
module: {
rules: [
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
'style-load... |
Allow plugins to specify permissible update frequencies.
Fixed #2. | import pkg_resources
import logging
log = logging.getLogger("fedmsg")
def find_stats_consumer(hub):
for cons in hub.consumers:
if 'StatsConsumer' in str(type(cons)):
return cons
raise ValueError('StatsConsumer not found.')
class memoized(object):
def __init__(self, func):
s... | import pkg_resources
import logging
log = logging.getLogger("fedmsg")
def find_stats_consumer(hub):
for cons in hub.consumers:
if 'StatsConsumer' in str(type(cons)):
return cons
raise ValueError('StatsConsumer not found.')
class memoized(object):
def __init__(self, func):
s... |
Allow files to be exlcuded | /*jslint node:true */
var RequireAll = (function () {
'use strict';
var fs = require('fs'),
exclude = function (excludeRegexp, name) {
return excludeRegexp && name.match(excludeRegexp);
},
loadAllModules = function (options) {
var files = fs.readdirSync(o... | /*jslint node:true */
var RequireAll = (function () {
'use strict';
var fs = require('fs'),
excludeDirectory = function (excludeDirs, dirname) {
return excludeDirs && dirname.match(excludeDirs);
},
loadAllModules = function (options) {
var files = fs.read... |
Replace accent with apostrophe for consistency. | define ({
title: 'Titre',
format: 'Format',
layout: 'Disposition',
settings: 'Paramètres',
mapScaleExtent: 'Échelle/étendue de la carte',
preserve: 'Préserver',
mapScale: 'échelle de la carte',
mapExtent: 'étendue de la carte',
fullLayoutOptions: 'Options complètes de mise en page',
... | define ({
title: 'Titre',
format: 'Format',
layout: 'Disposition',
settings: 'Paramètres',
mapScaleExtent: 'Échelle/étendue de la carte',
preserve: 'Préserver',
mapScale: 'échelle de la carte',
mapExtent: 'étendue de la carte',
fullLayoutOptions: 'Options complètes de mise en page',
... |
Use get_config instead of CONFIG_DICT | import logging
import requests
from indra.config import get_config
logger = logging.getLogger(__name__)
dart_uname = get_config('DART_WM_USERNAME')
dart_pwd = get_config('DART_WM_PASSWORD')
dart_url = 'https://indra-ingest-pipeline-rest-1.prod.dart.worldmodelers.com' \
'/dart/api/v1/readers/query'
de... | import logging
import requests
from indra.config import CONFIG_DICT
logger = logging.getLogger(__name__)
dart_uname = CONFIG_DICT['DART_WM_USERNAME']
dart_pwd = CONFIG_DICT['DART_WM_PASSWORD']
dart_url = 'https://indra-ingest-pipeline-rest-1.prod.dart.worldmodelers.com' \
'/dart/api/v1/readers/query'
... |
Enable pretty printing in the git_log_json task | /*
* grunt-git-log-json
* https://github.com/nlaplante/grunt-git-log-json
*
* Copyright (c) 2014 Nicolas Laplante
* Licensed under the MIT license.
*/
'use strict';
module.exports = function (grunt) {
// load all npm grunt tasks
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initCo... | /*
* grunt-git-log-json
* https://github.com/nlaplante/grunt-git-log-json
*
* Copyright (c) 2014 Nicolas Laplante
* Licensed under the MIT license.
*/
'use strict';
module.exports = function (grunt) {
// load all npm grunt tasks
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initCo... |
Fix a typo in how aux name is printed. | // Copyright 2013 Judson D Neer
package com.singledsoftware.mixmaestro;
import java.io.Serializable;
/**
* Stores data for an individual channel.
*
* @see Serializable
* @author Judson D Neer
*/
public class Channel implements Serializable, Comparable<Channel> {
// Unique serializable version ID
privat... | // Copyright 2013 Judson D Neer
package com.singledsoftware.mixmaestro;
import java.io.Serializable;
/**
* Stores data for an individual channel.
*
* @see Serializable
* @author Judson D Neer
*/
public class Channel implements Serializable, Comparable<Channel> {
// Unique serializable version ID
privat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.