text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Reset another ruby environment variable. | 'use strict';
var _ = require('lodash'),
path = require('path');
_.extend(exports, {
envOverrides: {},
supervisordConfigPath: function() {
var config = require('api-umbrella-config').global();
return path.join(config.get('etc_dir'), 'supervisord.conf');
},
env: function() {
return _.merge({
... | 'use strict';
var _ = require('lodash'),
path = require('path');
_.extend(exports, {
envOverrides: {},
supervisordConfigPath: function() {
var config = require('api-umbrella-config').global();
return path.join(config.get('etc_dir'), 'supervisord.conf');
},
env: function() {
return _.merge({
... |
Add stub methods for map handling | """This module provides views for application."""
from tof_server import app, versioning, mysql
from flask import jsonify, make_response
import string, random
@app.route('/')
def index():
"""Server information"""
return jsonify({
'server-version' : versioning.SERVER_VERSION,
'client-versions' :... | """This module provides views for application."""
from tof_server import app, versioning, mysql
from flask import jsonify, make_response
import string, random
@app.route('/')
def index():
"""Server information"""
return jsonify({
'server-version' : versioning.SERVER_VERSION,
'client-versions' :... |
Add accessor to unmodifiable copy of scoresMap | package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;
import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import java.util.Collections;
import java.util.Map;
/**
* Created by beng on 17/12/2015.
*/
public abstract class MapScorer<T> extends Scorer<T> {
Map<T, Integer> scoresMap;
... | package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;
import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import java.util.Map;
/**
* Created by beng on 17/12/2015.
*/
public abstract class MapScorer<T> extends Scorer<T> {
Map<T, Integer> scoresMap;
protected MapScorer(String s... |
Fix yet another stupid mistake | import re
from django.core.exceptions import ValidationError
default_validator = lambda x: x != '' # FIXME: Do we need this?
def validate_list(value, validator=default_validator, separator=',',
strip_whitespace=True, min_length=0, die=False):
"""Validate a "list" of things
separator: the ch... | import re
from django.core.exceptions import ValidationError
default_validator = lambda x: x != '' # FIXME: Do we need this?
def validate_list(value, validator=default_validator, separator=',',
strip_whitespace=True, min_length=0, die=False):
"""Validate a "list" of things
separator: the ch... |
Change __name__ for label (Django 1.9) | from django.db.models.signals import post_migrate
def mk_permissions(permissions, appname, verbosity):
"""
Make permission at app level - hack with empty ContentType.
Adapted code from http://djangosnippets.org/snippets/334/
"""
from django.contrib.auth.models import Permission
from django.co... | from django.db.models.signals import post_migrate
def mk_permissions(permissions, appname, verbosity):
"""
Make permission at app level - hack with empty ContentType.
Adapted code from http://djangosnippets.org/snippets/334/
"""
from django.contrib.auth.models import Permission
from django.co... |
Add facebook error handler in view.
This assumes that there is no other backend which
can authenticate user with facebook credentials. | import logging
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django import http
from django.views import generic
import facepy
from facebook_auth import urls
logger = logging.getLogger(__name__)
class Handler(generic.View):
def get(self, request):
try:
... | import logging
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django import http
from django.views import generic
from facebook_auth import urls
logger = logging.getLogger(__name__)
class Handler(generic.View):
def get(self, request):
try:
next_url =... |
Fix up the manual register URL in the worker and fix the initial log tail. | import os
import json
import socket
import requests
from flask import request, jsonify, Response, abort
from dadd.worker import app
from dadd.worker.proc import ChildProcess
@app.route('/run/', methods=['POST'])
def run_process():
proc = ChildProcess(request.json)
proc.run()
return jsonify(proc.info())... | import os
import json
import socket
import requests
from flask import request, jsonify, Response, abort
from dadd.worker import app
from dadd.worker.proc import ChildProcess
@app.route('/run/', methods=['POST'])
def run_process():
proc = ChildProcess(request.json)
proc.run()
return jsonify(proc.info())... |
Fix minor error with HKID verification | Meteor.methods({
checkHKID: function (hkid) {
var hkidPat = /^([A-Z]{1,2})([0-9]{6})([A0-9])$/; // HKID format = 1 or 2 letters followed by 6 numbers and 1 checksum digit.
var matchArray = hkid.match(hkidPat);
if(matchArray == null){idError()}
var checkSum = 0;
var charPart =... | Meteor.methods({
checkHKID: function (hkid) {
var hkidPat = /^([A-Z]{1,2})([0-9]{6})([A0-9])$/; // HKID format = 1 or 2 letters followed by 6 numbers and 1 checksum digit.
var matchArray = hkid.match(hkidPat);
if(matchArray == null){idError()}
var checkSum = 0;
var charPart =... |
Enable console logs in karma tests | var webpackConfig = require('./webpack.config.js');
webpackConfig.devtool = 'inline-source-map';
webpackConfig.module.rules.push({
test: /\.ts$/,
enforce: 'post',
loader: 'istanbul-instrumenter-loader',
exclude: [
'node_modules',
/\.test\.ts$/
]
});
module.exports = function(config)... | var webpackConfig = require('./webpack.config.js');
webpackConfig.devtool = 'inline-source-map';
webpackConfig.module.rules.push({
test: /\.ts$/,
enforce: 'post',
loader: 'istanbul-instrumenter-loader',
exclude: [
'node_modules',
/\.test\.ts$/
]
});
module.exports = function(config)... |
Fix - remove Year and Agenda view in General settings | import React from 'react';
import PropTypes from 'prop-types';
import { c } from 'ttag';
import { SETTINGS_VIEW } from '../../constants';
const { DAY, WEEK, MONTH, YEAR, PLANNING } = SETTINGS_VIEW;
const ViewPreferenceSelector = ({
className = 'pm-field w100',
loading = false,
disabled = false,
view,... | import React from 'react';
import PropTypes from 'prop-types';
import { c } from 'ttag';
import { SETTINGS_VIEW } from '../../constants';
const { DAY, WEEK, MONTH, YEAR, PLANNING } = SETTINGS_VIEW;
const ViewPreferenceSelector = ({ className = 'pm-field w100', loading = false, disabled = false, view, onChange, ...re... |
Fix spacing for linting purposes | 'use strict';
const express = require('express');
const router = express.Router();
const bodyParser = require('body-parser');
const request = require('request');
const models = require('../../db/models');
module.exports.getAll = (req, res) => {
models.User.where({ email: req.user.email }).fetch()
.then((result) ... | 'use strict';
const express = require('express');
const router = express.Router();
const bodyParser = require('body-parser');
const request = require('request');
const models = require('../../db/models');
module.exports.getAll = (req, res) => {
models.User.where({ email: req.user.email}).fetch()
.then((result) =... |
Remove schedule from admin too | from django.contrib import admin
from django.forms import model_to_dict
from django.utils.timezone import now
from main.models import Lan, Event
class EventInline(admin.TabularInline):
model = Event
show_change_link = True
fields = ('name', 'url', 'start', 'end')
@admin.register(Lan)
class LanAdmin(ad... | from django.contrib import admin
from django.forms import model_to_dict
from django.utils.timezone import now
from main.models import Lan, Event
class EventInline(admin.TabularInline):
model = Event
show_change_link = True
fields = ('name', 'url', 'start', 'end')
@admin.register(Lan)
class LanAdmin(ad... |
Remove last comma if no primary key is set | package me.mrten.mysqlapi.queries;
import java.util.ArrayList;
import java.util.List;
public class CreateTableQuery {
private String table;
private boolean ifNotExists = false;
private List<String> columns = new ArrayList<String>();
private String primaryKey;
public CreateTableQuery(... | package me.mrten.mysqlapi.queries;
import java.util.ArrayList;
import java.util.List;
public class CreateTableQuery {
private String table;
private boolean ifNotExists = false;
private List<String> columns = new ArrayList<String>();
private String primaryKey;
public CreateTableQuery(String table... |
Make test get correct url | """Functional tests for the xml api part of aniauth project.
This is a temporary app as EVE Online's xml api is deprecated and will be
disabled March 2018.
"""
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import tag
from django.shortcuts import reverse
from selenium import ... | """Functional tests for the xml api part of aniauth project.
This is a temporary app as EVE Online's xml api is deprecated and will be
disabled March 2018.
"""
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import tag
from django.shortcuts import reverse
from selenium import ... |
Add missing not-equal comparison for wbtypes
Bug: T158848
Change-Id: Ib6e992b7ed1c5b4b8feac205758bdbaebda2b09c | # -*- coding: utf-8 -*-
"""Wikibase data type classes."""
#
# (C) Pywikibot team, 2013-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import json
from pywikibot.tools import StringTypes
class WbRepresentation(object):
... | # -*- coding: utf-8 -*-
"""Wikibase data type classes."""
#
# (C) Pywikibot team, 2013-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import json
from pywikibot.tools import StringTypes
class WbRepresentation(object):
... |
Modify jwt token expiration time | import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define('User', {
fullName: {
type: DataTypes.STRING,
allowNull: false,
},
email: {
type: DataTypes.STRING,
allowNull: false,
validate: {
... | import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define('User', {
fullName: {
type: DataTypes.STRING,
allowNull: false,
},
email: {
type: DataTypes.STRING,
allowNull: false,
validate: {
... |
Make URLField compatible with Django 1.4 and remove verify_exists attribute | from django import forms
from django.utils.translation import ugettext_lazy as _
from tagging.forms import TagField
from bookmarks.models import Bookmark, BookmarkInstance
class BookmarkInstanceForm(forms.ModelForm):
url = forms.URLField(label = "URL", widget=forms.TextInput(attrs={"size": 40}))
descrip... | from django import forms
from django.utils.translation import ugettext_lazy as _
from tagging.forms import TagField
from bookmarks.models import Bookmark, BookmarkInstance
class BookmarkInstanceForm(forms.ModelForm):
url = forms.URLField(label = "URL", verify_exists=True, widget=forms.TextInput(attrs={"size... |
Add tests to ensure DataPackage uses base schema by default | import pytest
import datapackage
class TestDataPackage(object):
def test_init_uses_base_schema_by_default(self):
dp = datapackage.DataPackage()
assert dp.schema.title == 'DataPackage'
def test_schema(self):
descriptor = {}
schema = {'foo': 'bar'}
dp = datapackage.DataP... | import pytest
import datapackage
class TestDataPackage(object):
def test_schema(self):
descriptor = {}
schema = {'foo': 'bar'}
dp = datapackage.DataPackage(descriptor, schema=schema)
assert dp.schema.to_dict() == schema
def test_datapackage_attributes(self):
dp = datap... |
Fix non informative exception text
Error always throw `Stash\Driver\AbstractDriver is not available` insead of point what dirver not allowed. | <?php
/*
* This file is part of the Stash package.
*
* (c) Robert Hafner <tedivm@tedivm.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stash\Driver;
use Stash\Interfaces\DriverInterface;
use Stash\Exception\Runti... | <?php
/*
* This file is part of the Stash package.
*
* (c) Robert Hafner <tedivm@tedivm.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stash\Driver;
use Stash\Interfaces\DriverInterface;
use Stash\Exception\Runti... |
Fix redirect after password change | <?php
namespace Mschlueter\Backend\Controllers\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Mschlueter\Backend\Controllers\Controller;
class ChangePasswordController extends Controller
{
public function __construct() {
$this->middleware(... | <?php
namespace Mschlueter\Backend\Controllers\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Mschlueter\Backend\Controllers\Controller;
class ChangePasswordController extends Controller
{
public function __construct() {
$this->middleware(... |
Normalize type before switching on it | package tours.compiler;
import tours.grammar.ToursParser;
public class Type {
public static final Type BOOLEAN = new Type(ToursParser.BOOLEAN);
public static final Type CHARACTER = new Type(ToursParser.CHARACTER);
public static final Type INTEGER = new Type(ToursParser.INTEGER);
public static final Ty... | package tours.compiler;
import tours.grammar.ToursParser;
public class Type {
public static final Type BOOLEAN = new Type(ToursParser.BOOLEAN);
public static final Type CHARACTER = new Type(ToursParser.CHARACTER);
public static final Type INTEGER = new Type(ToursParser.INTEGER);
public static final Ty... |
Set a initial $scope.model.value for true/false | function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.mo... | function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.mo... |
Fix uncaught error when the click is on the HTML element | // This code is injected into every page
(function () {
'use strict';
/*jslint browser: true */
/*global chrome, console */
var parents;
// Get the position of a element in the list of its siblings
function getElementPosition(element, siblings) {
var position = 0,
i = 0;
... | // This code is injected into every page
(function () {
'use strict';
/*jslint browser: true */
/*global chrome, console */
var parents;
// Get the position of a element in the list of its siblings
function getElementPosition(element, siblings) {
var position = 0,
i = 0;
... |
Remove Meta-class change for AtmosphereUser
Fixed in solitary-snipe, so not needed anymore. | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-09-29 19:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0064_remove_ssh_keys_toggle'),
]
operations = [
migrations.AlterFiel... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-09-29 19:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0064_remove_ssh_keys_toggle'),
]
operations = [
migrations.AlterMode... |
Adjust log prefix in tests for Python 2.4 | import unittest
import logging
from yaml_server.YamlReader import YamlReader
from yaml_server.YamlServerException import YamlServerException
class Test(unittest.TestCase):
data1_data = {
'data1': 'test1',
'data2': [
{
... | import unittest
import logging
from yaml_server.YamlReader import YamlReader
from yaml_server.YamlServerException import YamlServerException
class Test(unittest.TestCase):
data1_data = {
'data1': 'test1',
'data2': [
{
... |
Put the colon next to the name, moron | /**
* Module Name: imgur
* Description: Various imgur functionality
*/
var _ = require('underscore')._,
request = require('request');
var imgur = function(dbot) {
this.api = {
'getRandomImage': function(callback) {
var random = function(len) {
var chars = "0123456789ABC... | /**
* Module Name: imgur
* Description: Various imgur functionality
*/
var _ = require('underscore')._,
request = require('request');
var imgur = function(dbot) {
this.api = {
'getRandomImage': function(callback) {
var random = function(len) {
var chars = "0123456789ABC... |
Set back Fresco logger to verbose | package chat.rocket.android.widget;
import android.content.Context;
import chat.rocket.android.widget.fresco.CustomImageFormatConfigurator;
import com.facebook.common.logging.FLog;
import com.facebook.drawee.backends.pipeline.DraweeConfig;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagep... | package chat.rocket.android.widget;
import android.content.Context;
import chat.rocket.android.widget.fresco.CustomImageFormatConfigurator;
import com.facebook.common.logging.FLog;
import com.facebook.drawee.backends.pipeline.DraweeConfig;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagep... |
Use Input instead of request | <?php
namespace App\Http\Middleware;
use App\User;
use Auth;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Input;
class Api
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
* ... | <?php
namespace App\Http\Middleware;
use App\User;
use Auth;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class Api
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return voi... |
Add additional error detail to cover other circumstances that intend to throw 401 |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array
"""
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
... |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array
"""
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
... |
Include registeredPlayerIds and confirmedPlayerIds fields when creating a new section object. | angular.module('chessRank')
.controller('sectionEditDetailsCtrl', function (_, $scope, $state, tournament, section, lookups,
sectionEditHelper, baseTypeConverter) {
$scope.action = 'Edit';
var converter = new baseTypeConverter();
$scope.s... | angular.module('chessRank')
.controller('sectionEditDetailsCtrl', function (_, $scope, $state, tournament, section, lookups,
sectionEditHelper, baseTypeConverter) {
$scope.action = 'Edit';
var converter = new baseTypeConverter();
$scope.s... |
Make sure not to set auth header to null | import { router } from '../../main';
import URLS from '../../urls';
export default {
user: {
authenticated: false
},
getProfile: localStorage.getItem('profile'),
login(context, creds, redirect) {
context.$http.post(URLS.LOGIN_URL, creds).then((data) => {
localStorage.setItem('token', data.body.to... | import { router } from '../../main';
import URLS from '../../urls';
export default {
user: {
authenticated: false
},
getProfile: localStorage.getItem('profile'),
login(context, creds, redirect) {
context.$http.post(URLS.LOGIN_URL, creds).then((data) => {
localStorage.setItem('token', data.body.to... |
Read mail settings from config. | import os
import sys
import web
import yaml
from . import default_settings
def load_default_config():
# take all vars defined in default_config
config = dict((k, v) for k, v in default_settings.__dict__.items()
if not k.startswith("_"))
web.config.update(config)
def load_config_from_en... | import os
import sys
import web
import yaml
from . import default_settings
def load_default_config():
# take all vars defined in default_config
config = dict((k, v) for k, v in default_settings.__dict__.items()
if not k.startswith("_"))
web.config.update(config)
def load_config_from_en... |
Update compiled JS for password block. | (function() {
'use strict';
var supported;
supported = void 0;
jQuery.prototype.tamiaPassword = function() {
if (supported === void 0) {
supported = (((jQuery('<b>')).html('<!--[if lte IE 8]><i></i><![endif]-->')).find('i')).length !== 1;
}
if (!supported) {
return this;
}
retu... | // Generated by CoffeeScript 1.6.2
(function() {
'use strict';
var supported;
supported = void 0;
jQuery.prototype.tamiaPassword = function() {
if (supported === void 0) {
supported = (((jQuery('<b>')).html('<!--[if lte IE 8]><i></i><![endif]-->')).find('i')).length !== 1;
}
if (!supported) ... |
Make context a defaultdict so unknown values yield empty string | from collections import defaultdict
from django.template import TemplateDoesNotExist, TemplateSyntaxError # NOQA
from django.template.backends.base import BaseEngine
from django.template.backends.utils import csrf_input_lazy, csrf_token_lazy
from . import compiler
from . import loader
class KnightsTemplater(BaseEn... | from django.template import TemplateDoesNotExist, TemplateSyntaxError # NOQA
from django.template.backends.base import BaseEngine
from django.template.backends.utils import csrf_input_lazy, csrf_token_lazy
from . import compiler
from . import loader
class KnightsTemplater(BaseEngine):
def __init__(self, params... |
Update user table seeder to assign roles | <?php
use Illuminate\Database\Seeder;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
... | <?php
use Illuminate\Database\Seeder;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
... |
Make unleash record user from gatekeeper header.
Signed-off-by: Elliot Murphy <014ce8fab4ab9f8a957bfe9f974379093994de97@users.noreply.github.com> | 'use strict';
const fs = require("fs");
const express = require("express");
const unleash = require('unleash-server');
let options = {};
options.adminAuthentication = 'custom';
function gatekeeperAuthentication(app) {
app.use('/api/admin/', (req, res, next) => {
const email = req.get('X-Auth-Email');
... | 'use strict';
const fs = require("fs");
const express = require("express");
const unleash = require('unleash-server');
let options = {};
options.adminAuthentication = 'custom';
function gatekeeperAuthentication(app) {
app.use('/api/admin/', (req, res, next) => {
const email = req.get('X-Auth-Email');
... |
Add minified and non-minified umd build | const path = require('path');
const webpack = require('webpack');
const BabiliPlugin = require('babili-webpack-plugin');
const isProd = process.env.NODE_ENV === 'PRODUCTION';
const outputFilename = isProd ? 'react-layout-transition.min.js' : 'react-layout-transition.js';
module.exports = {
devtool: !isProd ? 'so... | const path = require('path');
const webpack = require('webpack');
const BabiliPlugin = require('babili-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src/index.ts'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'react-layout-transition.js',
library: '... |
Tweak the code to avoid fabbot false positives | <?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\Component\Intl\Data\Bundle\Reader;
use Symfony\Component\Intl\E... | <?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\Component\Intl\Data\Bundle\Reader;
use Symfony\Component\Intl\E... |
Fix a bug when you try to add a geo tag to an object that does not have already one | from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from geotagging.models import Point
def add_edit_point(request, cont... | from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.contenttypes.models import ContentType
from geotagging.models import Point
def add_edit_point(request, content_type_id, object_id,
template=Non... |
Remove flex helper from fromt page callouts | <?php
$i = 0;
$callouts = get_field("callouts");
?>
<?php if ($callouts): ?>
<?php while (have_rows("callouts")): ?>
<?php the_row(); ?>
<?php
$title = get_sub_field("title");
$content = get_sub_field("content");
?>
<?php if ($title || $content): ?>
<?p... | <?php
$i = 0;
$callouts = get_field("callouts");
?>
<?php if ($callouts): ?>
<?php while (have_rows("callouts")): ?>
<?php the_row(); ?>
<?php
$title = get_sub_field("title");
$content = get_sub_field("content");
?>
<?php if ($title || $content): ?>
<?p... |
Add function for get all files. Deleted anonymous function. | <?php
//----------------------------------------------------------------------------------------------------------------------
/**
* Unit Tests for testing optimize_css Task.
*/
class OptimizeCssTest extends PHPUnit_Framework_TestCase
{
//-----------------------------------------------------------------------------... | <?php
//----------------------------------------------------------------------------------------------------------------------
/**
* Unit Tests for testing optimize_css Task.
*/
class OptimizeCssTest extends PHPUnit_Framework_TestCase
{
//-----------------------------------------------------------------------------... |
Add ability to publish rc versions | var vow = require('vow'),
vowNode = require('vow-node'),
childProcess = require('child_process'),
fs = require('fs'),
exec = vowNode.promisify(childProcess.exec),
readFile = vowNode.promisify(fs.readFile),
writeFile = vowNode.promisify(fs.writeFile);
version = process.argv.slice(2)[0] || 'pa... | var vow = require('vow'),
vowNode = require('vow-node'),
childProcess = require('child_process'),
fs = require('fs'),
exec = vowNode.promisify(childProcess.exec),
readFile = vowNode.promisify(fs.readFile),
writeFile = vowNode.promisify(fs.writeFile);
version = process.argv.slice(2)[0] || 'pa... |
Make function return false or true. | """
This file is part of Lisa.
Lisa 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 3 of the License, or
(at your option) any later version.
Lisa is distributed in the hope that it will be useful,... | """
This file is part of Lisa.
Lisa 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 3 of the License, or
(at your option) any later version.
Lisa is distributed in the hope that it will be useful,... |
Add failsafe mongo calls [ci skip] | from datetime import datetime
import logging
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import AutoReconnect
log = logging.getLogger(__name__)
class MongoBackend(object):
def __init__(self, name):
self.name = name
self.host = None
self._collection = None
... | from datetime import datetime
import logging
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import AutoReconnect
log = logging.getLogger(__name__)
class MongoBackend(object):
def __init__(self, name):
self.name = name
self.host = None
self._collection = None
... |
Refactor Random Color as Flag Method | import random
class Flag:
def __init__(self, **kwargs):
self.mode = kwargs.get('mode', self.random_mode())
self.bg = kwargs.get('bg', self.random_color())
if self.mode == 'plain':
pass
elif self.mode == 'quarters':
self.quarterpanels = kwargs.get('quarterpan... | import random
def random_color():
colors = ['white', 'black',
'#cc0033', #red
'#ffcc00', #yellow
'#009933', #green
'#003399', #blue
]
return random.choice(colors)
class Flag:
def __init__(self, **kwargs):
self.mode = kwargs.get(... |
Remove unused call for classes | <?php namespace Grav\Plugin;
use \Grav\Common\Plugin;
class PreCachePlugin extends Plugin
{
/** @var Config $config */
protected $config;
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized',... | <?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
use \Grav\Common\Grav;
use \Grav\Common\Cache;
use \Grav\Common\Config\Config;
use \Grav\Common\Page\Page;
use \Grav\Common\Page\Pages;
class PreCachePlugin extends Plugin
{
/** @var Config $config */
protected $config;
/**
* @return array
*... |
Add "all" to the queryset in DepartmentForm | from django import forms
from .models import Department, Province, District
class DepartmentForm(forms.Form):
department = forms.ModelChoiceField(
queryset=Department.objects.all()
)
class ProvinceForm(DepartmentForm):
province = forms.ModelChoiceField(
queryset=Province.objects.none()
... | from django import forms
from .models import Department, Province, District
class DepartmentForm(forms.Form):
department = forms.ModelChoiceField(
queryset=Department.objects
)
class ProvinceForm(DepartmentForm):
province = forms.ModelChoiceField(
queryset=Province.objects.none()
)
... |
Fix test_writable_stream failing in Python 3.3 and 3.4 | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import unittest
import tempfile
try:
from unittest import mock
except ImportError:
import mock
from fs.archive import _utils
class TestUtils(unittest.TestCase):
@unittest.skipUnless(os.na... | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import unittest
import tempfile
try:
from unittest import mock
except ImportError:
import mock
from fs.archive import _utils
class TestUtils(unittest.TestCase):
@unittest.skipUnless(os.na... |
Add option for a cc in email | <?php
namespace SynchWeb;
class Email
{
private $vars = array();
private $html = true;
function __construct($template, $subject) {
$this->template = $template.'.html';
$this->subject = $subject;
}
public function __get($name) {
ret... | <?php
namespace SynchWeb;
class Email
{
private $vars = array();
private $html = true;
function __construct($template, $subject) {
$this->template = $template.'.html';
$this->subject = $subject;
}
public function __get($name) {
ret... |
Add failing spec for package deserialization | /** @babel */
describe('About', () => {
let workspaceElement
beforeEach(() => {
workspaceElement = atom.views.getView(atom.workspace)
waitsForPromise(() => {
return atom.packages.activatePackage('about')
})
})
it('deserializes correctly', () => {
let deserializedAboutView = atom.deseri... | /** @babel */
describe('About', () => {
let workspaceElement
beforeEach(() => {
workspaceElement = atom.views.getView(atom.workspace)
waitsForPromise(() => {
return atom.packages.activatePackage('about')
})
})
describe('when the about:about-atom command is triggered', () => {
it('shows... |
Fix issue in anonymous filters in aggregations | <?php
namespace Elastica\Aggregation;
use Elastica\Filter\AbstractFilter;
/**
* Class Filters.
*
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
*/
class Filters extends AbstractAggregation
{
/**
* Add a filter.
*
* If a... | <?php
namespace Elastica\Aggregation;
use Elastica\Filter\AbstractFilter;
/**
* Class Filters.
*
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
*/
class Filters extends AbstractAggregation
{
/**
* Add a filter.
*
* If a... |
Replace undefined/null with something human-readable | function restore() {
var nurls = 0;
for (var k in localStorage) {
if (k.match(/^http:/)) {
nurls++;
var tr = document.createElement('tr');
var info = JSON.parse(localStorage[k]);
tr.innerHTML = '<td>' + k + '</td><td><a href="' +
info['long... | function restore() {
var nurls = 0;
for (var k in localStorage) {
if (k.match(/^http:/)) {
nurls++;
var tr = document.createElement('tr');
var info = JSON.parse(localStorage[k]);
tr.innerHTML = '<td>' + k + '</td><td><a href="' +
info['long... |
Set default LOG_LEVEL to logging.DEBUG | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Debug tools.
Can be configured by changing values of those variable.
DEBUG = False
Enable this variable to activate debug features (like defined_at parameters). It can slow down Rebulk
LOG_LEVEL = 0
Default log level of generated rebulk logs.
"""
import inspect
impo... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Debug tools.
Can be configured by changing values of those variable.
DEBUG = False
Enable this variable to activate debug features (like defined_at parameters). It can slow down Rebulk
LOG_LEVEL = 0
Default log level of generated rebulk logs.
"""
import inspect
impo... |
Remove the ending slash for handle ipn url | from django.conf.urls import patterns, url
from oscar.core.application import Application
from systempay import views
class SystemPayApplication(Application):
name = 'systempay'
place_order_view = views.PlaceOrderView
cancel_response_view = views.CancelResponseView
secure_redirect_view = views.Secu... | from django.conf.urls import patterns, url
from oscar.core.application import Application
from systempay import views
class SystemPayApplication(Application):
name = 'systempay'
place_order_view = views.PlaceOrderView
cancel_response_view = views.CancelResponseView
secure_redirect_view = views.Secu... |
Fix test to use /google instead of /google2 | import unittest
import http.client
import time
class TestStringMethods(unittest.TestCase):
def test_404NoConfig(self):
connRouter = http.client.HTTPConnection("localhost", 8666)
connConfig = http.client.HTTPConnection("localhost", 8888)
connRouter.request("GET", "/google")
response... | import unittest
import http.client
import time
class TestStringMethods(unittest.TestCase):
def test_404NoConfig(self):
connRouter = http.client.HTTPConnection("localhost", 8666)
connConfig = http.client.HTTPConnection("localhost", 8888)
connRouter.request("GET", "/google2")
respons... |
Add a huge hack to treat Decimals like floats
This commit provided to you by highly trained professional stuntmen,
do not try to reproduce any of this at home! | from decimal import Decimal
from django.http import HttpResponse
from django.utils import simplejson
def decimal_format(value, min_decimal_places=0):
decimal_tuple = value.as_tuple()
have_decimal_places = -decimal_tuple.exponent
digits = list(decimal_tuple.digits)
while have_decimal_places < min_decima... | from decimal import Decimal
from django.http import HttpResponse
from django.utils import simplejson
def decimal_format(value, min_decimal_places=0):
decimal_tuple = value.as_tuple()
have_decimal_places = -decimal_tuple.exponent
digits = list(decimal_tuple.digits)
while have_decimal_places < min_decima... |
Remove version number for snowballstemmer | from __future__ import with_statement
import os
from setuptools import setup
this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, 'src', 'pydocstyle', 'utils.py')) as f:
for line in f:
if line.startswith('__version__'):
version = eval(line.split('=')[-1])
setup(
name='p... | from __future__ import with_statement
import os
from setuptools import setup
this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, 'src', 'pydocstyle', 'utils.py')) as f:
for line in f:
if line.startswith('__version__'):
version = eval(line.split('=')[-1])
setup(
name='p... |
Fix bug to display all branches when there is only 1 repo | from __future__ import absolute_import
import os
import logging
from workspace.commands import AbstractCommand
from workspace.commands.helpers import ProductPager
from workspace.scm import stat_repo, repos, product_name, all_branches, is_repo
log = logging.getLogger(__name__)
class Status(AbstractCommand):
""" ... | from __future__ import absolute_import
import os
import logging
from workspace.commands import AbstractCommand
from workspace.commands.helpers import ProductPager
from workspace.scm import stat_repo, repos, product_name, all_branches, is_repo
log = logging.getLogger(__name__)
class Status(AbstractCommand):
""" ... |
Fix bug that caused HTML comments to halt all additional parsing | import Bit from '../components/Bit'
import { createElement } from 'react'
const COMMENT_TAG = '--'
const DEFAULT_TAG = Bit
// eslint-disable-next-line max-params
function parse (buffer, doc, options, key) {
switch (doc.type) {
case 'text':
return [...buffer, doc.content]
case 'tag': {
let childr... | import Bit from '../components/Bit'
import { createElement } from 'react'
const COMMENT_TAG = '--'
const DEFAULT_TAG = Bit
// eslint-disable-next-line max-params
function parse (buffer, doc, options, key) {
switch (doc.type) {
case 'text':
return [...buffer, doc.content]
case 'tag': {
if (doc.na... |
Set startConnect: false and tunnelIdentifier
Reference: https://github.com/karma-runner/karma-sauce-launcher/issues/73 | module.exports = function(config) {
require("./karma.conf")(config);
config.set({
customLaunchers: {
SL_Chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: '35'
},
SL_Firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '30'
... | module.exports = function(config) {
require("./karma.conf")(config);
config.set({
customLaunchers: {
SL_Chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: '35'
},
SL_Firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '30'
... |
Make sure `output` variable is in scope no matter what. | import requests
from collections import defaultdict
from requests.exceptions import RequestException
from django.conf import settings
from django.utils.dateparse import parse_datetime
import sal.plugin
import server.utils as utils
class CryptStatus(sal.plugin.DetailPlugin):
description = 'FileVault Escrow Stat... | import requests
from collections import defaultdict
from requests.exceptions import RequestException
from django.conf import settings
from django.utils.dateparse import parse_datetime
import sal.plugin
import server.utils as utils
class CryptStatus(sal.plugin.DetailPlugin):
description = 'FileVault Escrow Stat... |
Py3: Exit with non-0 status if there are failed tests or errors. | # -*- coding: utf-8 -*-
"""
Unit tests for pytils
"""
__all__ = ["test_numeral", "test_dt", "test_translit", "test_utils", "test_typo"]
import unittest
import sys
def get_django_suite():
try:
import django
except ImportError:
return unittest.TestSuite()
import pytils.test.templatetags... | # -*- coding: utf-8 -*-
"""
Unit tests for pytils
"""
__all__ = ["test_numeral", "test_dt", "test_translit", "test_utils", "test_typo"]
import unittest
def get_django_suite():
try:
import django
except ImportError:
return unittest.TestSuite()
import pytils.test.templatetags
return... |
Add temporary fix for problem where selected model on hover does not exist | define([
'extensions/views/single_stat'
],
function (SingleStatView) {
var NumberView = SingleStatView.extend({
changeOnSelected: true,
labelPrefix: '',
formatValue: function(value) {
return this.formatNumericLabel(value);
},
getValue: function () {
return this.formatValue(this.co... | define([
'extensions/views/single_stat'
],
function (SingleStatView) {
var NumberView = SingleStatView.extend({
changeOnSelected: true,
labelPrefix: '',
formatValue: function(value) {
return this.formatNumericLabel(value);
},
getValue: function () {
return this.formatValue(this.co... |
Implement empty metadata a little differently | import copy
import json
from py4j.java_gateway import java_import
from pymrgeo.instance import is_instance_of as iio
class RasterMapOp(object):
mapop = None
gateway = None
context = None
job = None
def __init__(self, gateway=None, context=None, mapop=None, job=None):
self.gateway = gatewa... | import copy
import json
from py4j.java_gateway import JavaClass, java_import
from pymrgeo.instance import is_instance_of as iio
class RasterMapOp(object):
mapop = None
gateway = None
context = None
job = None
def __init__(self, gateway=None, context=None, mapop=None, job=None):
self.gatew... |
Add yearless date as an acceptable format for moment parsing
Closes #2331 | /* global moment */
var parseDateFormats = ['DD MMM YY @ HH:mm', 'DD MMM YY HH:mm',
'DD MMM YYYY @ HH:mm', 'DD MMM YYYY HH:mm',
'DD/MM/YY @ HH:mm', 'DD/MM/YY HH:mm',
'DD/MM/YYYY @ HH:mm', 'DD/MM/YYYY HH:mm',
'DD-MM-YY @ HH:m... | /* global moment */
var parseDateFormats = ['DD MMM YY @ HH:mm', 'DD MMM YY HH:mm',
'DD MMM YYYY @ HH:mm', 'DD MMM YYYY HH:mm',
'DD/MM/YY @ HH:mm', 'DD/MM/YY HH:mm',
'DD/MM/YYYY @ HH:mm', 'DD/MM/YYYY HH:mm',
'DD-MM-YY @ HH:m... |
Fix demo. And *actually* test new Django versions | import os
from setuptools import setup, find_packages
def read_relative_file(filename):
"""Returns contents of the given file, which path is supposed relative
to this module."""
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()
NAME = 'django-genericfilters-demo'... | import os
from setuptools import setup
def read_relative_file(filename):
"""Returns contents of the given file, which path is supposed relative
to this module."""
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()
NAME = 'django-genericfilters-demo'
README = read_... |
Increment version in preperation for release of version 1.2.0 | try:
# Try using ez_setup to install setuptools if not already installed.
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
# Ignore import error and assume Python 3 which already has setuptools.
pass
from setuptools import setup
DESC = ('This Python library for Raspberry Pi... | try:
# Try using ez_setup to install setuptools if not already installed.
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
# Ignore import error and assume Python 3 which already has setuptools.
pass
from setuptools import setup
DESC = ('This Python library for Raspberry Pi... |
Fix ascii blink regex to match non blink command | 'use strict';
var figlet = require('figlet');
var util = require('../../utilities');
var random_font = function() {
var fonts = [
'Basic',
'Big',
'JS Stick Letters',
'Kban',
'Slant',
'Soft'
];
return fonts[Math.floor(Math.random() * fonts.length)];
};
if (process.env.IRC_ENV != 'produc... | 'use strict';
var figlet = require('figlet');
var util = require('../../utilities');
var random_font = function() {
var fonts = [
'Basic',
'Big',
'JS Stick Letters',
'Kban',
'Slant',
'Soft'
];
return fonts[Math.floor(Math.random() * fonts.length)];
};
if (process.env.IRC_ENV != 'produc... |
Fix test of ArrayAccessProvider to avoid using Pimple | <?php
namespace Knp\Menu\Tests\Renderer;
use Knp\Menu\Renderer\ArrayAccessProvider;
use PHPUnit\Framework\TestCase;
class ArrayAccessProviderTest extends TestCase
{
public function testHas()
{
$provider = new ArrayAccessProvider(new \ArrayObject(), 'first', array('first' => 'first', 'second' => 'dumm... | <?php
namespace Knp\Menu\Tests\Renderer;
use Knp\Menu\Renderer\ArrayAccessProvider;
use PHPUnit\Framework\TestCase;
class ArrayAccessProviderTest extends TestCase
{
public function testHas()
{
$provider = new ArrayAccessProvider(new \ArrayObject(), 'first', array('first' => 'first', 'second' => 'dumm... |
Use Stream::limit instead of List::subList | package uk.ac.ebi.atlas.solr.query;
import org.apache.solr.client.solrj.SolrQuery;
import uk.ac.ebi.atlas.search.SemanticQueryTerm;
import uk.ac.ebi.atlas.species.Species;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
import java.util.stream.Collectors;
@Named
public class SolrBioenti... | package uk.ac.ebi.atlas.solr.query;
import org.apache.solr.client.solrj.SolrQuery;
import uk.ac.ebi.atlas.search.SemanticQueryTerm;
import uk.ac.ebi.atlas.species.Species;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
import java.util.stream.Collectors;
@Named
public class SolrBioenti... |
Remove the extra dispatcher that snuck in | <?php
namespace LastCall\Crawler;
use LastCall\Crawler\Command\ClearCommand;
use LastCall\Crawler\Command\CrawlCommand;
use LastCall\Crawler\Command\SetupCommand;
use LastCall\Crawler\Command\SetupTeardownCommand;
use LastCall\Crawler\Command\TeardownCommand;
use LastCall\Crawler\Helper\CrawlerHelper;
use Symfony\Com... | <?php
namespace LastCall\Crawler;
use LastCall\Crawler\Command\ClearCommand;
use LastCall\Crawler\Command\CrawlCommand;
use LastCall\Crawler\Command\SetupCommand;
use LastCall\Crawler\Command\SetupTeardownCommand;
use LastCall\Crawler\Command\TeardownCommand;
use LastCall\Crawler\Helper\CrawlerHelper;
use Symfony\Com... |
Remove formatting issues with CI. | <?php
namespace League\HTMLToMarkdown\Converter;
use League\HTMLToMarkdown\Configuration;
use League\HTMLToMarkdown\ConfigurationAwareInterface;
use League\HTMLToMarkdown\ElementInterface;
class EmphasisConverter implements ConverterInterface, ConfigurationAwareInterface
{
/**
* @var Configuration
*/
... | <?php
namespace League\HTMLToMarkdown\Converter;
use League\HTMLToMarkdown\Configuration;
use League\HTMLToMarkdown\ConfigurationAwareInterface;
use League\HTMLToMarkdown\ElementInterface;
class EmphasisConverter implements ConverterInterface, ConfigurationAwareInterface
{
/**
* @var Configuration
*/
... |
Use beta version of Firefox (supports vertical writing-mode) in tests on Sauce Labs | module.exports = function(config) {
var commonConfig = (require("./karma-common.conf"))(config);
var customLaunchers = {
sl_chrome: {
base: "SauceLabs",
browserName: "chrome",
platform: "Windows 8.1"
},
sl_firefox: {
base: "SauceLabs",
... | module.exports = function(config) {
var commonConfig = (require("./karma-common.conf"))(config);
var customLaunchers = {
sl_chrome: {
base: "SauceLabs",
browserName: "chrome",
platform: "Windows 8.1"
},
sl_firefox: {
base: "SauceLabs",
... |
Fix bug in sentiment calculation
Signed-off-by: Itai Koren <7a3f8a9ea5df78694ad87e4c8117b31e1b103a24@gmail.com> | // Include The 'require.async' Module
require("require.async")(require);
/**
* Tokenizes an input string.
*
* @param {String} Input
*
* @return {Array}
*/
function tokenize (input) {
return input
.replace(/[^a-zA-Z ]+/g, "")
.replace("/ {2,}/", " ")
.toLowerCase()
... | // Include The 'require.async' Module
require("require.async")(require);
/**
* Tokenizes an input string.
*
* @param {String} Input
*
* @return {Array}
*/
function tokenize (input) {
return input
.replace(/[^a-zA-Z ]+/g, "")
.replace("/ {2,}/", " ")
.toLowerCase()
... |
Fix error in the apikey import task | from celery.decorators import task
from eve_api.api_puller.accounts import import_eve_account
from eve_api.app_defines import *
from sso.tasks import update_user_access
@task()
def import_apikey(api_userid, api_key, user=None, force_cache=False):
acc = import_eve_account(api_key, api_userid, force_cache=force_cach... | from celery.decorators import task
from eve_api.api_puller.accounts import import_eve_account
from eve_api.app_defines import *
from sso.tasks import update_user_access
@task()
def import_apikey(api_userid, api_key, user=None, force_cache=False):
log = import_apikey.get_logger()
l.info("Importing %s/%s" % (ap... |
Make library dependencies python-debian a bit more sane | try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='debexpo',
version="",
#description='',
#author='',
#author_email='',
#url='',
install_requires=[... | try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='debexpo',
version="",
#description='',
#author='',
#author_email='',
#url='',
install_requires=[... |
Use nifty filter widget for selecting questions for an assignment. | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from . import models
@admin.register(models.Question)
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['title']}),
(_('Mai... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from . import models
@admin.register(models.Question)
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['title']}),
(_('Mai... |
Add the package template data to the egg
This adds some extra files that are needed at run time to the packaged
egg. | from setuptools import setup, find_packages
import codecs
import os.path as path
# buildout build system
# http://www.buildout.org/en/latest/docs/tutorial.html
# setup() documentation:
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#setup-py
cwd = path.dirname(__file__)
longdesc = code... | from setuptools import setup, find_packages
import codecs
import os.path as path
# buildout build system
# http://www.buildout.org/en/latest/docs/tutorial.html
# setup() documentation:
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#setup-py
cwd = path.dirname(__file__)
longdesc = code... |
Remove side effect when booting middleware stack
See #64 | package com.vtence.molecule;
import com.vtence.molecule.middlewares.NotFound;
import com.vtence.molecule.middlewares.URLMap;
import java.util.function.Consumer;
public class MiddlewareStack {
private Middleware pipeline = Middleware.identity();
private URLMap map;
private Application runner;
private... | package com.vtence.molecule;
import com.vtence.molecule.middlewares.NotFound;
import com.vtence.molecule.middlewares.URLMap;
import java.util.function.Consumer;
public class MiddlewareStack {
private Middleware pipeline = Middleware.identity();
private URLMap map;
private Application runner;
private... |
Update to rawurlencode / rawurldecode
Due to [this](https://github.com/paypal/ipn-code-samples/issues/51), the listener will *always* return INVALID unless `raw` methods are used for encoding / decoding. | <?php
namespace Mdb\PayPal\Ipn;
class Message
{
/**
* @var array
*/
private $data;
/**
* @param array|string $data
*/
public function __construct($data)
{
if (!is_array($data)) {
$data = $this->extractDataFromRawPostDataString($data);
}
$th... | <?php
namespace Mdb\PayPal\Ipn;
class Message
{
/**
* @var array
*/
private $data;
/**
* @param array|string $data
*/
public function __construct($data)
{
if (!is_array($data)) {
$data = $this->extractDataFromRawPostDataString($data);
}
$th... |
Store --keep-publish value in options['publish'] (duh) | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Update to the latest CAL-ACCESS snapshot and bake static website pages.
"""
import logging
from django.core.management import call_command
from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand
logger = logging.getLogger(__name__)
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Update to the latest CAL-ACCESS snapshot and bake static website pages.
"""
import logging
from django.core.management import call_command
from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand
logger = logging.getLogger(__name__)
... |
Rename the WebBridge payload property: date -> time | package plugins.webbridge.api;
import logbook.api.APIListenerSpi;
import logbook.proxy.RequestMetaData;
import logbook.proxy.ResponseMetaData;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import plugins.webbridge.bean.WebBridgeConfig;
import javax.json.Jso... | package plugins.webbridge.api;
import logbook.api.APIListenerSpi;
import logbook.proxy.RequestMetaData;
import logbook.proxy.ResponseMetaData;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import plugins.webbridge.bean.WebBridgeConfig;
import javax.json.Jso... |
Remove hard coded socket provider class. | /*
* Copyright: 2012, V. Glenn Tarcea
* MIT License Applies
*/
angular.module('AngularStomp', []).
factory('ngstomp', function($rootScope) {
var stompClient = {};
function NGStomp(url) {
this.stompClient = Stomp.client(url);
}
NGStomp.prototype.subscribe = function(... | /*
* Copyright: 2012, V. Glenn Tarcea
* MIT License Applies
*/
angular.module('AngularStomp', []).
factory('ngstomp', function($rootScope) {
Stomp.WebSocketClass = SockJS;
var stompClient = {};
function NGStomp(url) {
this.stompClient = Stomp.client(url);
}
... |
Fix potential NPE with command context | package top.quantic.sentry.discord.core;
import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;
public class CommandContext {
private IMessage message;
private String prefix;
private Command command;
private String[] args;
private OptionSet optionSet;
public IMessage getMes... | package top.quantic.sentry.discord.core;
import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;
public class CommandContext {
private IMessage message;
private String prefix;
private Command command;
private String[] args;
private OptionSet optionSet;
public IMessage getMes... |
Handle situation if timer is already running. | #!/usr/bin/env python
from Axon.Component import component
from threading import Timer
class TimerMixIn(object):
def __init__(self, *argl, **argd):
super(TimerMixIn,self).__init__(*argl,**argd)
self.timer = None
self.timerSuccess = True
def startTimer(self, secs):
... | #!/usr/bin/env python
from Axon.Component import component
from threading import Timer
class TimerMixIn(object):
def __init__(self, *argl, **argd):
super(TimerMixIn,self).__init__(*argl,**argd)
self.timer = None
self.timerSuccess = True
def startTimer(self, secs):
... |
Add alias for the extension path | import path from 'path';
import webpack from 'webpack';
const srcPath = path.join(__dirname, '../src/browser/');
const baseConfig = ({input, output = {}, globals = {}, plugins, loaders, entry = []}) => ({
entry: input || {
background: [ `${srcPath}extension/background/index`, ...entry ],
window: [ `${srcPat... | import path from 'path';
import webpack from 'webpack';
const srcPath = path.join(__dirname, '../src/browser/');
const baseConfig = ({input, output = {}, globals = {}, plugins, loaders, entry = []}) => ({
entry: input || {
background: [ `${srcPath}extension/background/index`, ...entry ],
window: [ `${srcPat... |
Fix for case when something is deleted in the left side and it is also deleted in the right side without refresh | (function() {
"use strict";
angular
.module('awesome-app.search')
.controller('SearchCtrl', SearchCtrl);
SearchCtrl.$inject = ['$scope', 'SearchService'];
function SearchCtrl($scope, SearchService) {
$scope.$on('chosenTeamMember', function(event, worker) {
$scope.... | (function() {
"use strict";
angular
.module('awesome-app.search')
.controller('SearchCtrl', SearchCtrl);
SearchCtrl.$inject = ['$scope', 'SearchService'];
function SearchCtrl($scope, SearchService) {
$scope.$on('chosenTeamMember', function(event, worker) {
$scope.... |
Remove upper-bound on required Sphinx version | #!/usr/bin/env python
from setuptools import setup
# Version info -- read without importing
_locals = {}
with open('releases/_version.py') as fp:
exec(fp.read(), None, _locals)
version = _locals['__version__']
setup(
name='releases',
version=version,
description='A Sphinx extension for changelog mani... | #!/usr/bin/env python
from setuptools import setup
# Version info -- read without importing
_locals = {}
with open('releases/_version.py') as fp:
exec(fp.read(), None, _locals)
version = _locals['__version__']
setup(
name='releases',
version=version,
description='A Sphinx extension for changelog mani... |
Remove shell requirement to avoid escaping | import sublime_plugin
from ..libs.global_vars import *
from ..libs import cli
class TypescriptBuildCommand(sublime_plugin.WindowCommand):
def run(self):
if get_node_path() is None:
print("Cannot found node. Build cancelled.")
return
file_name = self.window.active_view().f... | import sublime_plugin
from ..libs.global_vars import *
from ..libs import cli
class TypescriptBuildCommand(sublime_plugin.WindowCommand):
def run(self):
if get_node_path() is None:
print("Cannot found node. Build cancelled.")
return
file_name = self.window.active_view().f... |
Throw an exception if no response in http tuple | <?php declare(strict_types=1);
namespace Behapi\HttpHistory;
use IteratorAggregate;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Http\Client\Common\Plugin\Journal;
use Http\Client\Exception;
use Http\Client\Exception\HttpException;
use function end;
use function reset;
use fun... | <?php declare(strict_types=1);
namespace Behapi\HttpHistory;
use IteratorAggregate;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Http\Client\Common\Plugin\Journal;
use Http\Client\Exception;
use Http\Client\Exception\HttpException;
use function end;
use function reset;
use fun... |
Increment version to trigger auto build | """Config for PyPI."""
from setuptools import find_packages
from setuptools import setup
setup(
author='Kyle P. Johnson',
author_email='kyle@kyle-p-johnson.com',
classifiers=[
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MI... | """Config for PyPI."""
from setuptools import find_packages
from setuptools import setup
setup(
author='Kyle P. Johnson',
author_email='kyle@kyle-p-johnson.com',
classifiers=[
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MI... |
Use StringBuilder to constructo the longcat body, as it can be very loooooooooong | package longcat;
public class Longcat {
// Source: http://encyclopediadramatica.com/Longcat
public static final String HEAD_ROW = "" +
" /\\___/\\ \n" +
" / \\ \n" +
" | # # | \n" +
" \\ @ | \n" +
... | package longcat;
public class Longcat {
// Source: http://encyclopediadramatica.com/Longcat
public static final String HEAD_ROW = "" +
" /\\___/\\ \n" +
" / \\ \n" +
" | # # | \n" +
" \\ @ | \n" +
... |
Add ability to iterate over all currently loaded ports.
This function provides a snapshot of ports and does not provide support to
query ports that are still loading. | """FreeBSD Ports."""
from __future__ import absolute_import
__all__ = ["get_port", "get_ports", "ports"]
class PortCache(object):
"""Caches created ports."""
def __init__(self):
"""Initialise port cache."""
self._ports = {}
self._waiters = {}
def __len__(self):
return l... | """FreeBSD Ports."""
from __future__ import absolute_import
__all__ = ["get_port"]
class PortCache(object):
"""Caches created ports."""
def __init__(self):
"""Initialise port cache."""
self._ports = {}
self._waiters = {}
def __len__(self):
return len(self._ports)
d... |
Remove the expectedFailure decorator. The test has been passing for some time now.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@138452 91177308-0d34-0410-b5e6-96231b3b80d8 | """
The evaluating printf(...) after break stop and then up a stack frame.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class Radar9531204TestCase(TestBase):
mydir = os.path.join("expression_command", "radar_9531204")
# rdar://problem/9531204
def test_expr_commands(self):
... | """
The evaluating printf(...) after break stop and then up a stack frame.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class Radar9531204TestCase(TestBase):
mydir = os.path.join("expression_command", "radar_9531204")
# rdar://problem/9531204
@unittest2.expectedFailure
def... |
Fix placeholder text in mithril example | var app = app || {};
(function () {
'use strict';
app.watchInput = function (ontype, onenter, onescape) {
return function (e) {
ontype(e)
if (e.keyCode == app.ENTER_KEY) onenter()
if (e.keyCode == app.ESC_KEY) onescape()
}
};
app.view = function (ctrl) {
return [
m('header... | var app = app || {};
(function () {
'use strict';
app.watchInput = function (ontype, onenter, onescape) {
return function (e) {
ontype(e)
if (e.keyCode == app.ENTER_KEY) onenter()
if (e.keyCode == app.ESC_KEY) onescape()
}
};
app.view = function (ctrl) {
return [
m('header... |
Use the correct UMD pattern | (function (root, factory) {
if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') module.exports = factory();
else root.Inverse = factory();
})(this, function () {
'use strict';
var Inverse = function() {
this._boundCallbacks = {};
... | (function (root, factory) {
if (typeof define === 'function' && define.amd) define(['exports'], factory);
else if (typeof exports === 'object') factory(exports);
else factory(root.Inverse = {});
})(this, function (exports) {
'use strict';
var Inverse = function() {
this._boundCallbacks ... |
Update the hour list if the day start, end or interval changes | 'use strict';
var angular = require('angular');
angular
.module('mwl.calendar')
.controller('MwlCalendarHourListCtrl', function($scope, moment, calendarConfig, calendarHelper) {
var vm = this;
var dayViewStart, dayViewEnd;
function updateDays() {
dayViewStart = moment($scope.dayViewStart || '00... | 'use strict';
var angular = require('angular');
angular
.module('mwl.calendar')
.controller('MwlCalendarHourListCtrl', function($scope, moment, calendarConfig, calendarHelper) {
var vm = this;
var dayViewStart, dayViewEnd;
function updateDays() {
dayViewStart = moment($scope.dayViewStart || '00... |
Replace hardcoded indicator key with keySize dependent | import CSVReader from 'readers/csv/csv';
import { isNumber } from 'base/utils';
const CSVTimeInColumnsReader = CSVReader.extend({
_name: 'csv-time_in_columns',
init(readerInfo) {
this._super(readerInfo);
},
load() {
return this._super()
.then((data) => {
const [firstRow] = data;
... | import CSVReader from 'readers/csv/csv';
import { isNumber } from 'base/utils';
const CSVTimeInColumnsReader = CSVReader.extend({
_name: 'csv-time_in_columns',
init(readerInfo) {
this._super(readerInfo);
},
load() {
return this._super()
.then((data) => {
const concepts = data.reduce(... |
Set Cython language_level to 3 when compiling for python3 | #!/usr/bin/env python
"""
Setup script.
Created on Oct 10, 2011
@author: tmetsch
"""
from distutils.core import setup
from distutils.extension import Extension
import sys
try:
from Cython.Build import build_ext, cythonize
BUILD_EXTENSION = {'build_ext': build_ext}
EXT_MODULES = cythonize([Extension("dt... | #!/usr/bin/env python
"""
Setup script.
Created on Oct 10, 2011
@author: tmetsch
"""
from distutils.core import setup
from distutils.extension import Extension
try:
from Cython.Build import build_ext, cythonize
BUILD_EXTENSION = {'build_ext': build_ext}
EXT_MODULES = cythonize([Extension("dtrace", ["dt... |
Remove last slash from file path | from Measurement import Measurement
class Recorder(object):
def __init__(self, recorderType):
self.recorderType = recorderType
def record(self, measure: Measurement):
None
class PrintRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.form... | from Measurement import Measurement
class Recorder(object):
def __init__(self, recorderType):
self.recorderType = recorderType
def record(self, measure: Measurement):
None
class PrintRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.form... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.