text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use `reducer` to replace `prepare` | __all__ = []
from lib.exp.featx.base import Feats
from lib.exp.tools.slider import Slider
from lib.exp.tools.video import Video
from lib.exp.pre import Reducer
class Featx(Feats):
def __init__(self, root, name):
Feats.__init__(self, root, name)
def get_slide_feats(self):
ss = Slider(self.roo... | __all__ = []
from lib.exp.featx.base import Feats
from lib.exp.tools.slider import Slider
from lib.exp.tools.video import Video
from lib.exp.prepare import Prepare
class Featx(Feats):
def __init__(self, root, name):
Feats.__init__(self, root, name)
def get_slide_feats(self):
ss = Slider(self... |
Add old method for setting val to pin named set_val_old | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | # Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... |
Check for config via NOT
Until yesterday, this was `if (config == null)`, which checks for a certain
falseyness of `config`. This was changed yesterday to `if (config === null)` which
checks if `config` is, in fact, `null`. The problem is that when calling a function
without a parameter, then the paramter is `undefine... | /**
* Run a new test with the given +title+ and function body, which will
* be executed within the proper test declarations for the UIAutomation
* framework. The given function will be handed a +UIATarget+ and
* a +UIApplication+ object which it can use to exercise and validate your
* application.
*
* The +optio... | /**
* Run a new test with the given +title+ and function body, which will
* be executed within the proper test declarations for the UIAutomation
* framework. The given function will be handed a +UIATarget+ and
* a +UIApplication+ object which it can use to exercise and validate your
* application.
*
* The +optio... |
feat(redux-module-activities): Update to use Records for initialState | import {Record} from 'immutable';
import {
STORE_ACTIVITIES,
UPDATE_ACTIVITY
} from './actions';
const Activity = Record({
id: null,
actor: null,
type: '',
object: {},
status: {}
});
const InitialState = Record({
byId: {}
});
export const initialState = new InitialState();
export default function r... | import {fromJS, Record} from 'immutable';
import {
STORE_ACTIVITIES,
UPDATE_ACTIVITY
} from './actions';
const Activity = Record({
id: null,
actor: null,
type: '',
object: {},
status: {}
});
export const initialState = fromJS({
byId: {}
});
export default function reducer(state = initialState, acti... |
Add named 'login' route for auth middleware. | <?php
/**
* Here is where you can register web routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* contains the "web" middleware group. Now create something great!
*
* @var \Illuminate\Routing\Router $router
* @see \Aurora\Providers\RouteServiceProvider
*/
... | <?php
/**
* Here is where you can register web routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* contains the "web" middleware group. Now create something great!
*
* @var \Illuminate\Routing\Router $router
* @see \Aurora\Providers\RouteServiceProvider
*/
... |
Fix issue where book names weren't being lowercased
The book name must be lowercased in order to be compared with the query
string. | import m from 'mithril';
// The core back-end model consisting of shared functions and data
class Core {
// Fetch any arbitrary JSON data via the given data file path
static getJSON(dataFilePath) {
return m.request({url: dataFilePath});
}
// Retrieve the Bible data for the current language (English for... | import m from 'mithril';
// The core back-end model consisting of shared functions and data
class Core {
// Fetch any arbitrary JSON data via the given data file path
static getJSON(dataFilePath) {
return m.request({url: dataFilePath});
}
// Retrieve the Bible data for the current language (English for... |
Set the allowed methods to all required ones.
The Spring boot default ones do not allow for `PUT` and `DELETE`. | package org.zalando.pazuzu.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.co... | package org.zalando.pazuzu.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.co... |
Update overrides iterator to use Array.forEach | var log = require('../lib/logger');
var config = {
coinbaseApiKey: process.env.COINBASE_API_KEY,
coinbaseApiSec: process.env.COINBASE_API_SECRET,
coinbaseApiUri: process.env.COINBASE_API_URI,
coinbaseApiWallet: process.env.COINBASE_API_WALLET,
dbUrl: process.env.DATABASE_URL,
redisUrl: process.env.REDIS_UR... | var log = require('../lib/logger');
var allTheSettings = {
coinbaseApiKey: process.env.COINBASE_API_KEY,
coinbaseApiSec: process.env.COINBASE_API_SECRET,
coinbaseApiUri: process.env.COINBASE_API_URI,
coinbaseApiWallet: process.env.COINBASE_API_WALLET,
dbUrl: process.env.DATABASE_URL,
redisUrl: process.env.... |
Remove name, url and email from comment form | from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from django.views.generic.list import ListView
from core.models import Account as User
from django_c... | from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from django.views.generic.list import ListView
from core.models import Account as User
from django_c... |
Make only left-button, unmasked clicks operate conflict buttons | /*
* Copyright (C) 2013 Aaron Madlon-Kay <aaron@madlon-kay.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
... | /*
* Copyright (C) 2013 Aaron Madlon-Kay <aaron@madlon-kay.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
... |
Test for .wfbundle filename, not .scufl2
git-svn-id: d93a27e49e8366f092fe01955016b9f01f5c8622@14416 bf327186-88b3-11dd-a302-d386e5130c1c | package uk.org.taverna.scufl2.usecases;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.zip.ZipFile;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
public class T... | package uk.org.taverna.scufl2.usecases;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.zip.ZipFile;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
public class T... |
Check for composer wherever it is signaled to be, even after override | <?php
namespace Probuild\Shell;
use Probuild\Shell;
class Composer extends Shell
{
protected $composer = 'composer';
/**
* @param string $targetDir
* @return Composer
* @author Cristian Quiroz <cris@qcas.co>
*/
public function run($targetDir)
{
if (!`which {$this->compos... | <?php
namespace Probuild\Shell;
use Probuild\Shell;
class Composer extends Shell
{
protected $composer = 'composer';
/**
* @param string $targetDir
* @return Composer
* @author Cristian Quiroz <cris@qcas.co>
*/
public function run($targetDir)
{
if (!`which composer`) {
... |
Fix merge (phpdoc => typehint) | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\... |
Update class names for more consistency | import Remarkable from 'remarkable';
const markdown = (text) => {
var md = new Remarkable();
return {
__html: md.render(text)
};
};
const Event = ({ title, start_time, end_time, content, eventClickHandler, index, active }) => {
const classes = (index === active) ? 'cal-event-content-active' : '';
retur... | import Remarkable from 'remarkable';
const markdown = (text) => {
var md = new Remarkable();
return {
__html: md.render(text)
};
};
const Event = ({ title, start_time, end_time, content, eventClickHandler, index, active }) => {
const classes = (index === active) ? 'cal-event-content-active' : '';
retur... |
Return null when a response is not succesful. | <?php
namespace Sdmx\api\client\http;
use Requests;
class RequestHttpClient implements HttpClient
{
/**
* @var array $predefinedHeaders
*/
private $predefinedHeaders = [];
/**
* @param string $url
* @param array $headers
* @param array $options
* @return string
*/
... | <?php
namespace Sdmx\api\client\http;
use Requests;
class RequestHttpClient implements HttpClient
{
/**
* @var array $predefinedHeaders
*/
private $predefinedHeaders = [];
/**
* @param string $url
* @param array $headers
* @param array $options
* @return string
*/
... |
Fix teacher ids not being mapped | package li.l1t.tingo.service;
import li.l1t.tingo.exception.TeacherNotFoundException;
import li.l1t.tingo.model.Teacher;
import li.l1t.tingo.model.dto.TeacherDto;
import li.l1t.tingo.model.repo.TeacherRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Servi... | package li.l1t.tingo.service;
import li.l1t.tingo.exception.TeacherNotFoundException;
import li.l1t.tingo.model.Teacher;
import li.l1t.tingo.model.dto.TeacherDto;
import li.l1t.tingo.model.repo.TeacherRepository;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import or... |
Add support for Redux Devtools extension | import moment from 'moment';
import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer as HotAppContainer } from 'react-hot-loader';
import { applyMiddleware, createStore, compose } from 'redux';
import IO from 'socket.io-client';
import createSocketIoMiddleware from 'redux-socket.io';
import l... | import moment from 'moment';
import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer as HotAppContainer } from 'react-hot-loader';
import { applyMiddleware, createStore } from 'redux';
import IO from 'socket.io-client';
import createSocketIoMiddleware from 'redux-socket.io';
import logger fro... |
internal-test-helpers: Convert `ContainersAssert` to ES6 class | import { Container } from '@ember/-internals/container';
const { _leakTracking: containerLeakTracking } = Container;
export default class ContainersAssert {
constructor(env) {
this.env = env;
}
reset() {}
inject() {}
assert() {
if (containerLeakTracking === undefined) return;
let { config } =... | import { Container } from '@ember/-internals/container';
function ContainersAssert(env) {
this.env = env;
}
const { _leakTracking: containerLeakTracking } = Container;
ContainersAssert.prototype = {
reset: function() {},
inject: function() {},
assert: function() {
if (containerLeakTracking === undefined)... |
Comment long_description read, because it cause exception
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 424 | import os
from setuptools import setup, find_packages
VERSION = (0, 1, 7)
__version__ = '.'.join(map(str, VERSION))
# readme_rst = os.path.join(os.path.dirname(__file__), 'README.rst')
# if os.path.exists(readme_rst):
# long_description = open(readme_rst).read()
# else:
long_description = "This module provides a... | import os
from setuptools import setup, find_packages
VERSION = (0, 1, 7)
__version__ = '.'.join(map(str, VERSION))
readme_rst = os.path.join(os.path.dirname(__file__), 'README.rst')
if os.path.exists(readme_rst):
long_description = open(readme_rst).read()
else:
long_description = "This module provides a few... |
Remove `setState`, For hide modal, it is enough to call `onHidePromoteModal`. | import React, { Component } from 'react';
import Dialog from 'material-ui/lib/dialog';
import FlatButton from 'material-ui/lib/flat-button';
import RaisedButton from 'material-ui/lib/raised-button';
// NOTE: For emit `onTouchTap` event.
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();... | import React, { Component } from 'react';
import Dialog from 'material-ui/lib/dialog';
import FlatButton from 'material-ui/lib/flat-button';
import RaisedButton from 'material-ui/lib/raised-button';
// NOTE: For emit `onTouchTap` event.
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();... |
core: Add missing serial version id
Change-Id: I1467bfda3a1f349087266bedb0fafac7170baeb2
Signed-off-by: Moti Asayag <da1debb83a8e12b6e8822edf2c275f55cc51b720@redhat.com> | package org.ovirt.engine.core.common.queries;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.compat.Version;
public class GetFilteredAttachableDisksParameters extends GetAllAttachableDisksForVmQueryParameters {
private static final long serialVersionUID = 4092810692277463140L;
privat... | package org.ovirt.engine.core.common.queries;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.compat.Version;
public class GetFilteredAttachableDisksParameters extends GetAllAttachableDisksForVmQueryParameters {
private int os;
private Version vdsGroupCompatibilityVersion;
public... |
Implement getTitle and getDescription for search | Meteor.startup(function () {
PostsSearchController = PostsListController.extend({
view: 'search',
getTitle: function() {
return i18n.t("Search") + ' - ' + getSetting('title', "Telescope");
},
getDescription: function() {
return getSetting('description');
},
onBeforeAction: functio... | Meteor.startup(function () {
PostsSearchController = PostsListController.extend({
view: 'search',
onBeforeAction: function() {
var query = this.params.query;
if ('q' in query) {
Session.set('searchQuery', query.q);
if (query.q) {
Meteor.call('logSearch', query.q)
... |
Use the config for token
And yes, I did regenerate that token, don't bother. | const Discord = require('discord.js');
const client = new Discord.Client();
const _ = require('lodash');
const winston = require('winston');
require('dotenv').config();
const channel_handler = require('./channel_handler');
const presence_handler = require('./presence_handler');
winston.configure({
transports: [
... | const Discord = require('discord.js');
const client = new Discord.Client();
const _ = require('lodash');
const winston = require('winston');
require('dotenv').config();
const channel_handler = require('./channel_handler');
const presence_handler = require('./presence_handler');
winston.configure({
transports: [
... |
Add spec for endpoints function | /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
/* eslint-env node, mocha */
import test from 'ava';
import endpoint from '../src/endpoint';
test('endpoint returns correctly partially applied function', (t) => {
const endpointConfig = {
uri: 'http://example.com',
};
const... | /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
/* eslint-env node, mocha */
import test from 'ava';
import endpoint from '../src/endpoint';
test('happy ponies', () => {
const fetch = () => null;
api(null, null, {
baseUri: 'http://api.example.com/v1',
endpoints: [
... |
Switch to API version 009 for generation. | <?php
// Map 'src' and 'lib' folders to the Wsdl2PhpGenerator namespace in your
// favorite PSR-0 compatible classloader or require the files manually.
require __DIR__ . '/../vendor/autoload.php';
use Wsdl2PhpGenerator\Config;
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(new Config(array(
... | <?php
// Map 'src' and 'lib' folders to the Wsdl2PhpGenerator namespace in your
// favorite PSR-0 compatible classloader or require the files manually.
require __DIR__ . '/../vendor/autoload.php';
use Wsdl2PhpGenerator\Config;
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(new Config(array(
... |
fix: Use watch instead of watchFile | #!/usr/bin/env node
const express = require('express');
const fileExists = require('file-exists');
const bodyParser = require('body-parser');
const fs = require('fs');
const { port = 8123 } = require('minimist')(process.argv.slice(2));
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.us... | #!/usr/bin/env node
const express = require('express');
const fileExists = require('file-exists');
const bodyParser = require('body-parser');
const fs = require('fs');
const { port = 8123 } = require('minimist')(process.argv.slice(2));
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.us... |
Add post date on search results | <header class="entry-header">
<?php
if ( is_sticky() && ! is_single() ) :
printf( '<p class="sticky-title-sm">%s</p>', __( 'Must read', 'keitaro' ) );
endif;
if ( is_singular() ) :
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
elseif ( is... | <header class="entry-header">
<?php
if ( is_sticky() && ! is_single() ) :
printf( '<p class="sticky-title-sm">%s</p>', __( 'Must read', 'keitaro' ) );
endif;
if ( is_singular() ) :
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
elseif ( is... |
Switch back to using innerText
I thought innerHTML might preserve spaces better, but the encoding is
actually working fine without innerText | document.addEventListener('DOMContentLoaded', function() {
getSource();
});
function getSource() {
document.getElementById('source').innerText = "Loading";
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {greeting: "GetEmailSource"}, function(response) {... | document.addEventListener('DOMContentLoaded', function() {
getSource();
});
function getSource() {
document.getElementById('source').innerText = "Loading";
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {greeting: "GetEmailSource"}, function(response) {... |
Make abstract method final to avoid unwanted overloading | <?php
namespace Trappar\AliceGenerator\Metadata\Resolver\Faker;
use Trappar\AliceGenerator\DataStorage\ValueContext;
use Trappar\AliceGenerator\Faker\FakerGenerator;
use Trappar\AliceGenerator\Metadata\Resolver\AbstractMetadataResolver;
abstract class AbstractFakerResolver extends AbstractMetadataResolver implements... | <?php
namespace Trappar\AliceGenerator\Metadata\Resolver\Faker;
use Trappar\AliceGenerator\DataStorage\ValueContext;
use Trappar\AliceGenerator\Faker\FakerGenerator;
use Trappar\AliceGenerator\Metadata\Resolver\AbstractMetadataResolver;
abstract class AbstractFakerResolver extends AbstractMetadataResolver implements... |
Add both domains to hostsfile. | """
Dynamic host file management.
"""
import docker
from subprocess import call
import re
def refresh():
"""
Ensure that all running containers have a valid entry in /etc/hosts.
"""
containers = docker.containers()
hosts = '\n'.join(['%s %s.%s.dork %s' % (c.address, c.project, c.instance, c.domain... | """
Dynamic host file management.
"""
import docker
from subprocess import call
import re
def refresh():
"""
Ensure that all running containers have a valid entry in /etc/hosts.
"""
containers = docker.containers()
hosts = '\n'.join(['%s %s' % (c.address, c.domain) for c in [d for d in containers ... |
Hide PyLint warning with undefined WindowsError exception | # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
from os import remove
from tempfile import mkstemp
MAX_SOURCES_LENGTH = 8000 # Windows CLI has limit with command length to 8192
def _remove_tmpfile(path):
try:
remove(path)
except WindowsError: # pylint: disab... | # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
from os import remove
from tempfile import mkstemp
MAX_SOURCES_LENGTH = 8000 # Windows CLI has limit with command length to 8192
def _remove_tmpfile(path):
try:
remove(path)
except WindowsError:
pass
d... |
Add in `value` count, leaving non-interactive as the final parameter | // Extension to track errors using google analytics as a data store.
(function() {
"use strict";
var trackJavaScriptError = function (e) {
var errorSource = e.filename + ': ' + e.lineno;
_gaq.push([
'_trackEvent',
'JavaScript Error',
e.message,
errorSource,
1... | // Extension to track errors using google analytics as a data store.
(function() {
"use strict";
var trackJavaScriptError = function (e) {
var errorSource = e.filename + ': ' + e.lineno;
_gaq.push([
'_trackEvent',
'JavaScript Error',
e.message,
errorSource,
t... |
Upgrade the version to force reinstall by wheels | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(
name='django-remote-forms',
version='0.0.2',
description='A platform independent form serializer for D... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(
name='django-remote-forms',
version='0.0.1',
description='A platform independent form serializer for D... |
build(rollup): Fix path to compiled file | import nodeResolve from 'rollup-plugin-node-resolve';
import { globalsRegex, GLOBAL } from 'rollup-globals-regex';
export default {
input: 'dist/ng-dynamic-component.js',
output: {
file: 'dist/bundles/ng-dynamic-component.es2015.js',
format: 'es',
},
name: 'dynamicComponent',
plugins: [
nodeResol... | import nodeResolve from 'rollup-plugin-node-resolve';
import { globalsRegex, GLOBAL } from 'rollup-globals-regex';
export default {
input: 'dist/src/ng-dynamic-component.js',
output: {
file: 'dist/bundles/ng-dynamic-component.es2015.js',
format: 'es',
},
name: 'dynamicComponent',
plugins: [
nodeR... |
Make file listing more robust | from slacksocket import SlackSocket
import subprocess
import config
import os
def handle_cmd(cmd):
if cmd in ('ls','list'):
s.send_msg(list_files(), channel_name=config.slack_channel)
else:
playsound(cmd)
def playsound(sound):
subprocess.call([config.play_cmd,"{0}.mp3".format(sound)])
def... | from slacksocket import SlackSocket
import subprocess
import config
import os
def handle_cmd(cmd):
if cmd in ('ls','list'):
s.send_msg(list_files(), channel_name=config.slack_channel)
else:
playsound(cmd)
def playsound(sound):
subprocess.call([config.play_cmd,"{0}.mp3".format(sound)])
def... |
Change flow stat reply to include multiple stats | package nom
import (
"encoding/gob"
"time"
)
// NodeQuery queries the information of a node.
type NodeQuery struct {
Node UID
}
// NodeQueryResult is the result for NodeQuery.
type NodeQueryResult struct {
Err error
Node Node
}
// PortQuery queries the information of a port.
type PortQuery struct {
Port UID
... | package nom
import (
"encoding/gob"
"time"
)
// NodeQuery queries the information of a node.
type NodeQuery struct {
Node UID
}
// NodeQueryResult is the result for NodeQuery.
type NodeQueryResult struct {
Err error
Node Node
}
// PortQuery queries the information of a port.
type PortQuery struct {
Port UID
... |
Disable Darcula special welcome screen | /*
* Copyright 2000-2012 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-2012 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... |
Use the right UiThreadTest annotation. | package com.jakewharton.rxbinding.view;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest;
import android.support.test.rule.UiThreadTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android... | package com.jakewharton.rxbinding.view;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.UiThreadTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
import android.view.View;
import android.widget.LinearLayou... |
Correct javadoc to point to proper annotation. | package retrofit;
/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
/** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
void intercept(RequestFacade request);
interface RequestFacade {
/** Ad... | package retrofit;
/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
/** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
void intercept(RequestFacade request);
interface RequestFacade {
/** Ad... |
Disable distribution of rank-expression files. | package com.yahoo.searchdefinition;
import com.yahoo.vespa.model.AbstractService;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class RankExpressionFiles {
private final Map<String, RankExpressionFile> expressions = new HashMap<>();
public ... | package com.yahoo.searchdefinition;
import com.yahoo.vespa.model.AbstractService;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class RankExpressionFiles {
private final Map<String, RankExpressionFile> expressions = new HashMap<>();
public ... |
Remove pause from e2e tests | var db = require( '../../db' )
var chai = require( 'chai' )
chai.use( require( 'chai-as-promised' ) )
var expect = chai.expect
describe( 'making a post', function() {
it( 'creates an account and creates a new post', function() {
browser.get( 'http://localhost:3001' )
element( by.css( 'nav .register... | var db = require( '../../db' )
var chai = require( 'chai' )
chai.use( require( 'chai-as-promised' ) )
var expect = chai.expect
describe( 'making a post', function() {
it( 'creates an account and creates a new post', function() {
browser.get( 'http://localhost:3001' )
element( by.css( 'nav .register... |
Fix Notification is already in use error | <?php
namespace LaravelDoctrine\ORM\Notifications;
use Doctrine\Common\Persistence\ManagerRegistry;
use Illuminate\Notifications\Notification as LaravelNotification;
use LaravelDoctrine\ORM\Exceptions\NoEntityManagerFound;
class DoctrineChannel
{
/**
* @var ManagerRegistry
*/
private $registry;
... | <?php
namespace LaravelDoctrine\ORM\Notifications;
use Doctrine\Common\Persistence\ManagerRegistry;
use Illuminate\Notifications\Notification;
use LaravelDoctrine\ORM\Exceptions\NoEntityManagerFound;
class DoctrineChannel
{
/**
* @var ManagerRegistry
*/
private $registry;
/**
* @param Man... |
Fix the deprecated "base_path" in Grunt | module.exports = function (grunt) {
grunt.initConfig({
typescript: {
base: {
src: ['src/**/*.ts'],
dest: 'bin',
options: {
module: 'commonjs', //or commonjs
target: 'es5', //or es3
basePath: 'src',
sourcemap: false,
fullSourceMapPath: false,
declaration: false
}
}... | module.exports = function (grunt) {
grunt.initConfig({
typescript: {
base: {
src: ['src/**/*.ts'],
dest: 'bin',
options: {
module: 'commonjs', //or commonjs
target: 'es5', //or es3
base_path: 'src',
sourcemap: false,
fullSourceMapPath: false,
declaration: false
}
... |
Add String Constant for Recipe key in Bundle | package com.example.profbola.bakingtime.ui;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.example.profbo... | package com.example.profbola.bakingtime.ui;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.example.profbo... |
Update taxonomyUrl to machine readable XML endpoint | package no.geonorge.nedlasting.data;
import org.apache.cayenne.Cayenne;
import org.apache.cayenne.ObjectContext;
import no.geonorge.nedlasting.data.auto._Projection;
public class Projection extends _Projection {
public no.geonorge.nedlasting.data.client.Projection forClient() {
no.geonorge.nedlastin... | package no.geonorge.nedlasting.data;
import org.apache.cayenne.Cayenne;
import org.apache.cayenne.ObjectContext;
import no.geonorge.nedlasting.data.auto._Projection;
public class Projection extends _Projection {
public no.geonorge.nedlasting.data.client.Projection forClient() {
no.geonorge.nedlastin... |
Fix reverse since we deprecated post_object_list | from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from post.models import Post
from jmbo.generic.views import GenericObjectDetail, GenericObjectList
from jmbo.view_modifiers import DefaultViewModifier
class ObjectList(GenericObjectList):
def get_extra_context(self, *... | from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from post.models import Post
from jmbo.generic.views import GenericObjectDetail, GenericObjectList
from jmbo.view_modifiers import DefaultViewModifier
class ObjectList(GenericObjectList):
def get_extra_context(self, *... |
Update asset paths in production | var webpack = require("webpack");
/**
* This is the Webpack configuration file for production.
*/
module.exports = {
entry: "./src/main",
output: {
path: __dirname + "/build/",
filename: "app.js"
},
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader" },... | var webpack = require("webpack");
/**
* This is the Webpack configuration file for production.
*/
module.exports = {
entry: "./src/main",
output: {
path: __dirname + "/build/",
publicPath: __dirname + "/build/",
filename: "app.js"
},
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /n... |
Change the tagline for PyPI | from distutils.core import setup
setup(
name='jute',
packages=['jute'],
package_dir={'jute': 'python3/jute'},
version='0.1.0',
description='An interface module that verifies both providers and callers',
author='Jonathan Patrick Giddy',
author_email='jongiddy@gmail.com',
url='https://gith... | from distutils.core import setup
setup(
name='jute',
packages=['jute'],
package_dir={'jute': 'python3/jute'},
version='0.1',
description='Yet another interface module for Python',
author='Jonathan Patrick Giddy',
author_email='jongiddy@gmail.com',
url='https://github.com/jongiddy/jute',
... |
Add more tests to the in() utility | package adeptus
import (
"testing"
)
func Test_in(t *testing.T) {
cases := []struct {
in string
slice []string
out bool
}{
{
in: "a",
slice: []string{},
out: false,
},
{
in: "a",
slice: []string{"b", "c"},
out: false,
},
{
in: "a",
slice: []string{"a", "b",... | package adeptus
import (
"testing"
)
func Test_in(t *testing.T) {
cases := []struct {
in string
slice []string
out bool
}{
{
in: "",
slice: []string{},
out: false,
},
{
in: "a",
slice: []string{"b", "c"},
out: false,
},
{
in: "a",
slice: []string{"a", "b", ... |
Add timestamp and client IP | <?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
class ApiControl... | <?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
class ApiControl... |
Fix bug: use type to construct log string | var Logger = function (config) {
this.config = config;
this.backend = this.config.backend || 'stdout'
this.level = this.config.level || "LOG_INFO"
if (this.backend == 'stdout') {
this.util = require('util');
} else {
if (this.backend == 'syslog') {
this.util = require('node-syslog');
th... | var Logger = function (config) {
this.config = config;
this.backend = this.config.backend || 'stdout'
this.level = this.config.level || "LOG_INFO"
if (this.backend == 'stdout') {
this.util = require('util');
} else {
if (this.backend == 'syslog') {
this.util = require('node-syslog');
th... |
Fix require MySQL server on Ubuntu 12.04 LTS | """
Idempotent API for managing MySQL users and databases
"""
from __future__ import with_statement
from fabtools.mysql import *
from fabtools.deb import is_installed, preseed_package
from fabtools.require.deb import package
from fabtools.require.service import started
def server(version=None, password=None):
""... | """
Idempotent API for managing MySQL users and databases
"""
from __future__ import with_statement
from fabtools.mysql import *
from fabtools.deb import is_installed, preseed_package
from fabtools.require.deb import package
from fabtools.require.service import started
def server(version='5.1', password=None):
"... |
Remove props param to get current mobilization selector | import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
// Global module dependencies
import { SettingsPageLayout } from '../../../components/Layout'
// Parent module dependencies
import * as MobilizationSelectors from '../../mobilizations/selectors'
// Current module dependencies
import * as ... | import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
// Global module dependencies
import { SettingsPageLayout } from '../../../components/Layout'
// Parent module dependencies
import * as MobilizationSelectors from '../../mobilizations/selectors'
// Current module dependencies
import * as ... |
Set instances variables in auth before init | """Base formgrade authenticator."""
from traitlets.config.configurable import LoggingConfigurable
class BaseAuth(LoggingConfigurable):
"""Base formgrade authenticator."""
def __init__(self, ip, port, base_directory, **kwargs):
self._ip = ip
self._port = port
self._base_url = ''
... | """Base formgrade authenticator."""
from traitlets.config.configurable import LoggingConfigurable
class BaseAuth(LoggingConfigurable):
"""Base formgrade authenticator."""
def __init__(self, ip, port, base_directory, **kwargs):
super(BaseAuth, self).__init__(**kwargs)
self._ip = ip
sel... |
Remove python decorators from list | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def extract_function_names(module):
'''
extract function names from attributes of 'module'.
'''
from importlib import import_module
mod = import_module(module.__name__)
attr_list = dir(mod)
scope = locals()
def iscallable(name):
i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def extract_function_names(module):
'''
extract function names from attributes of 'module'.
'''
from importlib import import_module
mod = import_module(module.__name__)
attr_list = dir(mod)
scope = locals()
def iscallable(name):
r... |
Use filterEvent for filtering events | define([
'jquery',
'DoughBaseComponent',
'InsertManager',
'eventsWithPromises',
'filter-event'
], function (
$,
DoughBaseComponent,
InsertManager,
eventsWithPromises,
filterEvent
) {
'use strict';
var LinkManagerProto,
defaultConfig = {
selectors: {
}
};
function ... | define([
'jquery',
'DoughBaseComponent',
'InsertManager',
'eventsWithPromises'
], function (
$,
DoughBaseComponent,
InsertManager,
eventsWithPromises
) {
'use strict';
var LinkManagerProto,
defaultConfig = {
selectors: {
}
};
function LinkManager($el, config, customCo... |
Resolve commit about local time | /**
* Parse task and return task info if
* the task is valid, otherwise throw
* error.
* @param {string} query Enetered task
* @return {object} Task info containing
* task text, start time
* and dealine
*/
function parse(query) {
/**
* Day, week or m... | /**
* Parse task and return task info if
* the task is valid, otherwise throw
* error.
* @param {string} query Enetered task
* @return {object} Task info containing
* task text, start time
* and dealine
*/
function parse(query) {
/**
* Day, week or m... |
Check Foo.class.isInstance instead of Object.class.isInstance.
See
https://github.com/jspecify/jspecify/issues/164#issuecomment-775868055
I'm going to remove this sample entirely, but I'm first improving it in
this commit: If someone wants to keep a local copy, we might as well
make it as useful as we can. | /*
* Copyright 2020 The JSpecify 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 applicable law or ... | /*
* Copyright 2020 The JSpecify 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 applicable law or ... |
Make that public so it is actually useable. | /*
* LapisCommons
* Copyright (c) 2014, LapisDev <https://github.com/LapisDev>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the ri... | /*
* LapisCommons
* Copyright (c) 2014, LapisDev <https://github.com/LapisDev>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the ri... |
:lipstick: Set proper config for inherited repo | <?php
namespace Harp\Core\Test\Repo;
use Harp\Core\Test\Model;
use Harp\Core\Test\Rel;
/**
* @author Ivan Kerin
* @copyright (c) 2014 Clippings Ltd.
* @license http://www.opensource.org/licenses/isc-license.txt
*/
class BlogPost extends Post {
public static function newInstance()
{
retur... | <?php
namespace Harp\Core\Test\Repo;
use Harp\Core\Test\Model;
use Harp\Core\Test\Rel;
/**
* @author Ivan Kerin
* @copyright (c) 2014 Clippings Ltd.
* @license http://www.opensource.org/licenses/isc-license.txt
*/
class BlogPost extends Post {
public static function newInstance()
{
retur... |
Remove list of project names from slack announcement for cycle launch. | import Promise from 'bluebird'
import {Cycle, Phase, Project} from 'src/server/services/dataService'
export default async function sendCycleLaunchAnnouncements(cycleId) {
const [cycle, phases] = await Promise.all([
await Cycle.get(cycleId),
await Phase.filter({hasVoting: true}),
])
await Promise.each(pha... | import Promise from 'bluebird'
import {Cycle, Phase, Project} from 'src/server/services/dataService'
export default async function sendCycleLaunchAnnouncements(cycleId) {
const [cycle, phases] = await Promise.all([
await Cycle.get(cycleId),
await Phase.filter({hasVoting: true}),
])
await Promise.each(pha... |
Add comma to the last element of the array | <?php
namespace Moxio\Sniffs\Tests\PHP;
use Moxio\Sniffs\PHP\DisallowImplicitLooseComparisonSniff;
use Moxio\Sniffs\Tests\AbstractSniffTest;
class DisallowImplicitLooseComparisonSniffTest extends AbstractSniffTest
{
protected function getSniffClass()
{
return DisallowImplicitLooseComparisonSniff::clas... | <?php
namespace Moxio\Sniffs\Tests\PHP;
use Moxio\Sniffs\PHP\DisallowImplicitLooseComparisonSniff;
use Moxio\Sniffs\Tests\AbstractSniffTest;
class DisallowImplicitLooseComparisonSniffTest extends AbstractSniffTest
{
protected function getSniffClass()
{
return DisallowImplicitLooseComparisonSniff::clas... |
Configure headers through a constructor | <?php
namespace hiapi\Core\Http\Psr15\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
class CorsMiddleware implements MiddlewareInterface
{
protected $headers = [
'Access... | <?php
namespace hiapi\Core\Http\Psr15\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
class CorsMiddleware implements MiddlewareInterface
{
protected $headers = [
'Access... |
Add a comment explaining why the filter cache doesn't need exipiring | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Print stacktrace when Biwa crashes in node.js. | var sys = require('sys'),
fs = require('fs'),
path = require('path'),
optparse = require('optparse');
function Options(argv){
var switches = [
[ '--encoding', 'Specify encoding (default: utf8)'],
['-h', '--help', 'Shows help sections']
];
var parser = new optparse.OptionParser(swit... | var sys = require('sys'),
fs = require('fs'),
path = require('path'),
optparse = require('optparse');
function Options(argv){
var switches = [
[ '--encoding', 'Specify encoding (default: utf8)'],
['-h', '--help', 'Shows help sections']
];
var parser = new optparse.OptionParser(swit... |
Drop use of spread operator (not supported in Safari/Edge yet). | export default function ClickSelectionMixin(Base) {
return class ClickSelection extends Base {
constructor(props) {
super(props);
this.click = this.click.bind(this);
}
click(event) {
// REVIEW: is this the best way to reliably map the event target to a
// child?
const paren... | export default function ClickSelectionMixin(Base) {
return class ClickSelection extends Base {
constructor(props) {
super(props);
this.click = this.click.bind(this);
}
click(event) {
// REVIEW: is this the best way to reliably map the event target to a
// child?
const paren... |
Fix bug in media player keys ubuntu | import DBus from 'dbus';
try {
const dbus = new DBus();
const session = dbus.getBus('session');
session.getInterface('org.gnome.SettingsDaemon', '/org/gnome/SettingsDaemon/MediaKeys',
'org.gnome.SettingsDaemon.MediaKeys', (err, iface) => {
if (!err) {
iface.on('MediaPlayerKeyPressed', (n, keyName) =... | import DBus from 'dbus';
try {
const dbus = new DBus();
const session = dbus.getBus('session');
session.getInterface('org.gnome.SettingsDaemon', '/org/gnome/SettingsDaemon/MediaKeys',
'org.gnome.SettingsDaemon.MediaKeys', (err, iface) => {
if (!err) {
iface.on('MediaPlayerKeyPressed', (n, keyName) =... |
Remove obsolete list resources functions | package com.woorea.openstack.heat;
import com.woorea.openstack.base.client.HttpMethod;
import com.woorea.openstack.base.client.OpenStackClient;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.heat.model.Resources;
/**
* v1/{tenant_id}/stacks/{stack_name}/resources
*/
publi... | package com.woorea.openstack.heat;
import com.woorea.openstack.base.client.HttpMethod;
import com.woorea.openstack.base.client.OpenStackClient;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.heat.model.Resources;
/**
* v1/{tenant_id}/stacks/{stack_name}/resources
*/
publi... |
Use GLOBAL_TOOLs rather than Export/Import for project wide configuration. | # SpatialDB scons tool
#
# It builds the library for the SpatialDB C++ class library,
# and provides CPP and linker specifications for the header
# and libraries.
#
# SpatialDB depends on SqliteDB, which provides the interface to
# sqlite3. It also depends on SpatiaLite. Since SpatiaLite is
# is also needed by SQLit... | # SpatialDB scons tool
#
# It builds the library for the SpatialDB C++ class library,
# and provides CPP and linker specifications for the header
# and libraries.
#
# SpatialDB depends on SqliteDB, which provides the interface to
# sqlite3. It also depends on SpatiaLite. Since SpatiaLite is
# is also needed by SQLit... |
Allow str type comparison in py2/3 | """ Test utilities for ensuring the correctness of products
"""
import arrow
import six
from tilezilla.core import BoundingBox, Band
MAPPING = {
'timeseries_id': six.string_types,
'acquired': arrow.Arrow,
'processed': arrow.Arrow,
'platform': six.string_types,
'instrument': six.string_types,
... | """ Test utilities for ensuring the correctness of products
"""
import arrow
import six
from tilezilla.core import BoundingBox, Band
MAPPING = {
'timeseries_id': str,
'acquired': arrow.Arrow,
'processed': arrow.Arrow,
'platform': str,
'instrument': str,
'bounds': BoundingBox,
'bands': [Ba... |
Revert changes to client masking | import superagent from 'superagent';
import config from '../config';
const methods = ['get', 'post', 'put', 'patch', 'del'];
function formatUrl(path) {
const adjustedPath = path[0] !== '/' ? '/' + path : path;
if (__SERVER__) {
// Prepend host and port of the API server to the path.
return 'http://localho... | import superagent from 'superagent';
import config from '../config';
const methods = ['get', 'post', 'put', 'patch', 'del'];
function formatUrl(path) {
const adjustedPath = path[0] !== '/' ? '/' + path : path;
if (__SERVER__) {
// Prepend host and port of the API server to the path.
return 'http://localho... |
Fix line lenght in manifest | # coding: utf-8
# @ 2016 florian DA COSTA @ Akretion
# © 2016 @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'External File Location',
'version': '10.0.1.0.0',
'author': 'Akretion,Odoo Community Association ... | # coding: utf-8
# @ 2016 florian DA COSTA @ Akretion
# © 2016 @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'External File Location',
'version': '10.0.1.0.0',
'author': 'Akretion,Odoo Community Association ... |
Set empty array on object transformer | <?php
namespace Opifer\EavBundle\Form\Transformer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Form\DataTransformerInterface;
class CollectionToObjectTransformer implements DataTransformerInterface
{
/**
* Transforms an ArrayCollection O... | <?php
namespace Opifer\EavBundle\Form\Transformer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Form\DataTransformerInterface;
class CollectionToObjectTransformer implements DataTransformerInterface
{
/**
* Transforms an ArrayCollection O... |
Remove export of nonexisting class | // !!
// This module defines ProseMirror's document model, the data
// structure used to define and inspect content documents. It
// includes:
//
// * The [node](#Node) type that represents document elements
//
// * The [schema](#Schema) types used to tag and constrain the
// document structure
//
// This module does... | // !!
// This module defines ProseMirror's document model, the data
// structure used to define and inspect content documents. It
// includes:
//
// * The [node](#Node) type that represents document elements
//
// * The [schema](#Schema) types used to tag and constrain the
// document structure
//
// This module does... |
Add long description and bump version number | # -*- coding: utf-8 -*-
from setuptools import setup
VERSION = '0.1.3'
with open('README.rst', 'r') as f:
long_description = f.read()
setup(
name='tree_extractor',
version=VERSION,
description="Lib to extract html elements by preserving ancestors and cleaning CSS",
long_description=long_descripti... | # -*- coding: utf-8 -*-
from setuptools import setup
VERSION = '0.1.2'
setup(
name='tree_extractor',
version=VERSION,
description="Lib to extract html elements by preserving ancestors and cleaning CSS",
author=u'Jurismarchés',
author_email='contact@jurismarches.com',
url='https://github.com/j... |
Switch the format ES6 back to ES5 to make it compatible with IE11 | 'use strict';
var PinyinHelper = require('./lib/PinyinHelper');
var ChineseHelper = require('./lib/ChineseHelper');
var PinyinFormat = require('./lib/PinyinHelper');
var pinyin4js = {
WITH_TONE_MARK :"WITH_TONE_MARK", //带声调
WITHOUT_TONE :"WITHOUT_TONE", //不带声调
WITH_TONE_NUMBER :"WITH_T... | 'use strict';
var PinyinHelper = require('./lib/PinyinHelper');
var ChineseHelper = require('./lib/ChineseHelper');
var PinyinFormat = require('./lib/PinyinHelper');
var pinyin4js = {
WITH_TONE_MARK :"WITH_TONE_MARK", //带声调
WITHOUT_TONE :"WITHOUT_TONE", //不带声调
WITH_TONE_NUMBER :"WITH_T... |
[AdminBundle] Test console exception subscriber without instantiating a specific command | <?php
namespace Kunstmaan\AdminBundle\Tests\EventListener;
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Consol... | <?php
namespace Kunstmaan\AdminBundle\Tests\EventListener;
use Kunstmaan\AdminBundle\Command\ApplyAclCommand;
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Co... |
Fix eslint checking lib directory | module.exports = {
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended'],
env: {
node: true,
},
rules: {
'arrow-parens': 'error',
'func-names': 'off',
'id-length': ['error', { exceptions: ['i', 'j', 'e', 'a', 'b', 't'] }],
'import/prefer-default-export': 'off',
'prefer-a... | module.exports = {
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended'],
env: {
node: true,
},
rules: {
'arrow-parens': 'error',
'func-names': 'off',
'id-length': ['error', { exceptions: ['i', 'j', 'e', 'a', 'b', 't'] }],
'import/prefer-default-export': 'off',
'prefer-a... |
Fix after upgrade node v7 | 'use strict';
var restify = require('restify');
var js2xmlparser = require('js2xmlparser');
var server = restify.createServer({
formatters: {
'application/json; q=5': function format(req, res, body) {
res.setHeader('Content-type', 'application/hal+json');
res.send(JSON.stringify(bod... | 'use strict';
var restify = require('restify');
var js2xmlparser = require('js2xmlparser');
var server = restify.createServer({
formatters: {
'application/json; q=5': function format(req, res, body) {
res.setHeader('Content-type', 'application/hal+json');
return JSON.stringify(body)... |
Optimize SQL queries used for fetching clouds | from rest_framework import permissions as rf_permissions
from rest_framework import exceptions
from nodeconductor.core import viewsets
from nodeconductor.cloud import models
from nodeconductor.cloud import serializers
from nodeconductor.structure import filters as structure_filters
from nodeconductor.structure import ... | from rest_framework import permissions as rf_permissions
from rest_framework import exceptions
from nodeconductor.core import viewsets
from nodeconductor.cloud import models
from nodeconductor.cloud import serializers
from nodeconductor.structure import filters as structure_filters
from nodeconductor.structure import ... |
Fix header not being validated if 'auth.header' option is not given.
In authenticate middleware. | import handleAdapter from '../handleAdapter'
export default (config) => {
if ( ! config.enabled) return (req, res, next) => { next() }
var header = (config.header || 'Authorization').toLowerCase()
var tokenLength = 32
var tokenRegExp = new RegExp(`^Token ([a-zA-Z0-9]{${tokenLength}})$`)
return (req, res, next) ... | import handleAdapter from '../handleAdapter'
export default (config) => {
if ( ! config.enabled) return (req, res, next) => { next() }
var verifyHeader = ( !! config.header)
var header = (config.header || 'Authorization').toLowerCase()
var tokenLength = 32
var tokenRegExp = new RegExp(`^Token ([a-zA-Z0-9]{${toke... |
Fix legacy kernel config usage | import * as path from 'path'
import { Loader } from './loader'
var loader
const system = () => {
if (typeof loader === 'undefined') {
let scope = new URL(self.registration.scope)
let base = scope
if (KERNEL_CONFIG_BASE) {
let base = new URL(path.join(scope.pathname, path.resolve(KERNEL_CONFIG_BA... | import * as path from 'path'
import { Loader } from './loader'
var loader
const system = () => {
if (typeof loader === 'undefined') {
let scope = new URL(self.registration.scope)
let base = new URL(path.join(scope.pathname, path.resolve(kernel_conf.base)), scope)
loader = new Loader({
base: base... |
Fix fatal error when setting API key
No such property $url, updated to use constant | <?php namespace TeamWorkPm;
class Auth
{
const URL = 'https://authenticate.teamworkpm.net/';
private static $config = [
'url' => null,
'key' => null
];
public static function set()
{
$num_args = func_num_args();
if ($num_args === 1) {
self::$config['url... | <?php namespace TeamWorkPm;
class Auth
{
const URL = 'https://authenticate.teamworkpm.net/';
private static $config = [
'url' => null,
'key' => null
];
public static function set()
{
$num_args = func_num_args();
if ($num_args === 1) {
self::$config['url... |
Make sure files and FS are properly closed in open_archive | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
@contextlib.contextmanager
def open_archive(fs_url, archive):
from pkg_resources import iter_entry_points
from ..opener import open_fs
from ..opener._errors import Unsupported
it = iter_en... | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
@contextlib.contextmanager
def open_archive(fs_url, archive):
from pkg_resources import iter_entry_points
from ..opener import open_fs
from ..opener._errors import Unsupported
it = iter_en... |
Replace $ with jQuery for noConflict mode
When jQuery is in noConflict mode, the $ operator can be claimed by other frameworks (ProtoType, MooTools). To avoid JS errors, jQuery plugins should not use $ but jQuery instead. | jQuery(document).ready(function () {
var rotationMultiplier = 3.6;
// For each div that its id ends with "circle", do the following.
jQuery( "div[id$='circle']" ).each(function() {
// Save all of its classes in an array.
var classList = jQuery( this ).attr('class').split(/\s+/);
// Iterate over the array
for... | $(document).ready(function () {
var rotationMultiplier = 3.6;
// For each div that its id ends with "circle", do the following.
$( "div[id$='circle']" ).each(function() {
// Save all of its classes in an array.
var classList = $( this ).attr('class').split(/\s+/);
// Iterate over the array
for (var i = 0; i ... |
Set alias id on message, if it exists. | const DataComposer = require('./BaseComposer');
const dataHandler = require('./DataHandler');
const eventCentral = require('../EventCentral');
const storageManager = require('../StorageManager');
class MessageComposer extends DataComposer {
constructor() {
super({
handler: dataHandler.messages,
comp... | const DataComposer = require('./BaseComposer');
const dataHandler = require('./DataHandler');
const eventCentral = require('../EventCentral');
class MessageComposer extends DataComposer {
constructor() {
super({
handler: dataHandler.messages,
completionEvent: eventCentral.Events.COMPLETE_MESSAGE,
... |
PUBDEV-6170: Add a technote explaining what to do when Jetty is missing | package water.webserver.iface;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* Finds implementation of {@link HttpServerFacade} found on the classpath.
* There must be exactly one present.
*/
public class HttpServerLoader {
public static final HttpServerFacade INSTANCE;
static {
final Serv... | package water.webserver.iface;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* Finds implementation of {@link HttpServerFacade} found on the classpath.
* There must be exactly one present.
*/
public class HttpServerLoader {
public static final HttpServerFacade INSTANCE;
static {
final Serv... |
Fix uia_controls registration only when UIA is supported | # GUI Application automation and testing library
# Copyright (C) 2015 Intel Corporation
# Copyright (C) 2009 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either v... | # GUI Application automation and testing library
# Copyright (C) 2015 Intel Corporation
# Copyright (C) 2009 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either v... |
Revert to the original import path. | // Copyright © 2015-2017 Hilko Bengen <bengen@hilluzination.de>
// All rights reserved.
//
// Use of this source code is governed by the license that can be
// found in the LICENSE file.
package yara
import (
"github.com/hillu/go-yara/internal/callbackdata"
)
var callbackData = callbackdata.MakePool(256)
func toin... | // Copyright © 2015-2017 Hilko Bengen <bengen@hilluzination.de>
// All rights reserved.
//
// Use of this source code is governed by the license that can be
// found in the LICENSE file.
package yara
import (
"github.com/VirusTotal/go-yara/internal/callbackdata"
)
var callbackData = callbackdata.MakePool(256)
func... |
Support evernote:// and other URIs | package com.todoist.markup;
import java.util.regex.Pattern;
class Patterns {
public static final Pattern HEADER = Pattern.compile("^\\*\\s*");
public static final Pattern BOLD = Pattern.compile("!!\\s*((?!!!).+?)\\s*!!");
public static final Pattern ITALIC = Pattern.compile("__\\s*((?!__).+?)\\s*__");
... | package com.todoist.markup;
import java.util.regex.Pattern;
class Patterns {
public static final Pattern HEADER = Pattern.compile("^\\*\\s*");
public static final Pattern BOLD = Pattern.compile("!!\\s*((?!!!).+?)\\s*!!");
public static final Pattern ITALIC = Pattern.compile("__\\s*((?!__).+?)\\s*__");
... |
Fix warnings from phpunit about deprecated assertType | <?php
namespace VXML;
class EventTest extends \PHPUnit_Framework_TestCase {
/**
* @var VXML\Event
*/
private $event;
/**
* @var VXML\Rule\RuleAbstract
*/
private $rule;
/**
* @var VXML\Context
*/
private $context;
/**
* @var VXML\Response
*/
private $response;
protected function setU... | <?php
namespace VXML;
class EventTest extends \PHPUnit_Framework_TestCase {
/**
* @var VXML\Event
*/
private $event;
/**
* @var VXML\Rule\RuleAbstract
*/
private $rule;
/**
* @var VXML\Context
*/
private $context;
/**
* @var VXML\Response
*/
private $response;
protected function setU... |
Include tick in expiry types | import moment from 'moment';
import ContractType from './helpers/contract_type';
export const onChangeExpiry = (store) => {
const { contract_type, duration_unit, expiry_date, expiry_type, server_time } = store;
const duration_is_day = expiry_type === 'duration' && duration_unit === 'd';
const ... | import moment from 'moment';
import ContractType from './helpers/contract_type';
export const onChangeExpiry = (store) => {
const { contract_type, duration_unit, expiry_date, expiry_type, server_time } = store;
const duration_is_day = expiry_type === 'duration' && duration_unit === 'd';
const e... |
Revert "Increase payload limit to 1.5MB"
This reverts commit eb59950038a363baca64593379739fcb4eeea22f. | import express from 'express';
import path from 'path';
import bodyParser from 'body-parser';
import api from './api';
let server = null;
function start(port) {
return new Promise((resolve, reject) => {
if (server !== null) {
reject(new Error('The server is already running.'));
}
... | import express from 'express';
import path from 'path';
import bodyParser from 'body-parser';
import api from './api';
let server = null;
function start(port) {
return new Promise((resolve, reject) => {
if (server !== null) {
reject(new Error('The server is already running.'));
}
... |
Fix: Reduce visibility of protected class members to private | <?php
namespace Application\Controller;
use Application\Service\RepositoryRetriever;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class ContributorsController extends AbstractActionController
{
const LIST_LIMIT = 36;
/**
* @var RepositoryRetriever
*/
private... | <?php
namespace Application\Controller;
use Application\Service\RepositoryRetriever;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class ContributorsController extends AbstractActionController
{
const LIST_LIMIT = 36;
/**
* @var RepositoryRetriever
*/
protect... |
Fix declaring extra constants when `intl` is loaded | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php55 as p;
if (PHP_VERSION_ID >= 50500) {
return;
}
if... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php55 as p;
if (PHP_VERSION_ID < 50500) {
if (!function_... |
conan: Make cmake-module-common a dev-only requirement | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.1.2"
class CMakeIncludeGuardConan(ConanFile):
name = "cmake-include-guard"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
generators = "cmake"
url = "http://github.com/polysquare/cmake-include-gu... | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.1.2"
class CMakeIncludeGuardConan(ConanFile):
name = "cmake-include-guard"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
requires = ("cmake-module-common/master@smspillaz/cmake-module-common", )
... |
Fix package data so that VERSION file actually gets installed | from setuptools import setup, find_packages
import sys, os
PACKAGE = 'mtdna'
VERSION = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),'oldowan', PACKAGE, 'VERSION')).read().strip()
desc_lines = open('README', 'r').readlines()
setup(name='oldowan.%s' % PACKAGE,
version=VERSION,
description... | from setuptools import setup, find_packages
import sys, os
PACKAGE = 'mtdna'
VERSION = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),'oldowan', PACKAGE, 'VERSION')).read().strip()
desc_lines = open('README', 'r').readlines()
setup(name='oldowan.%s' % PACKAGE,
version=VERSION,
description... |
Use the gallery_image method for required information | from pyramid.view import view_config
from pyramid.httpexceptions import (
HTTPNotFound,
)
@view_config(route_name='page', renderer='templates/page.mako')
@view_config(route_name='page_view', renderer='templates/page.mako')
def page_view(request):
if 'page_id' in request.matchdict:
data = request.kimoc... | from pyramid.view import view_config
from pyramid.httpexceptions import (
HTTPNotFound,
)
@view_config(route_name='page', renderer='templates/page.mako')
@view_config(route_name='page_view', renderer='templates/page.mako')
def page_view(request):
if 'page_id' in request.matchdict:
data = request.kimoc... |
Change Jenkins settings.py to use env vars | import os
from .testing import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('CLA', 'cla-alerts@digital.justice.gov.uk'),
)
MANAGERS = ADMINS
INSTALLED_APPS += ('django_jenkins',)
JENKINS_TASKS = (
'django_jenkins.tasks.with_coverage',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.bac... | import os
from .testing import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('CLA', 'cla-alerts@digital.justice.gov.uk'),
)
MANAGERS = ADMINS
INSTALLED_APPS += ('django_jenkins',)
JENKINS_TASKS = (
'django_jenkins.tasks.with_coverage',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.bac... |
Remove ShufflePeers() to avoid partion in setup. | package main
import (
"bufio"
"fmt"
"os"
"github.com/go-distributed/gog/agent"
"github.com/go-distributed/gog/config"
)
func main() {
config, err := config.ParseConfig()
if err != nil {
fmt.Println("Failed to parse configuration", err)
return
}
ag := agent.NewAgent(config)
ag.RegisterMessageHandler(msg... | package main
import (
"bufio"
"fmt"
"os"
"github.com/go-distributed/gog/agent"
"github.com/go-distributed/gog/config"
)
func main() {
config, err := config.ParseConfig()
if err != nil {
fmt.Println("Failed to parse configuration", err)
return
}
ag := agent.NewAgent(config)
ag.RegisterMessageHandler(msg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.