text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Fix error type for Python 2 | import argparse
import os
from six.moves.urllib import request
import zipfile
"""Download the MSCOCO dataset (images and captions)."""
urls = [
'http://images.cocodataset.org/zips/train2014.zip',
'http://images.cocodataset.org/zips/val2014.zip',
'http://images.cocodataset.org/annotations/annotations_tra... | import argparse
import os
from six.moves.urllib import request
import zipfile
"""Download the MSCOCO dataset (images and captions)."""
urls = [
'http://images.cocodataset.org/zips/train2014.zip',
'http://images.cocodataset.org/zips/val2014.zip',
'http://images.cocodataset.org/annotations/annotations_tra... |
Use the autocomplete lookup instead of traversing DOM elements | //= require jquery.autocomplete
(function ($) {
$.fn.ministerSelect = function (options) {
var settings = $.extend({
inputClass: 'minister-select-input'
}, options);
return this.each(function () {
var $select = $(this),
$input = $('<input type="text... | //= require jquery.autocomplete
(function ($) {
$.fn.ministerSelect = function (options) {
var settings = $.extend({
inputClass: 'minister-select-input'
}, options);
return this.each(function () {
var $select = $(this),
$input = $('<input type="text... |
Remove some required arguments in post function context | from openerp import pooler
def call_post_function(cr, uid, context):
"""This functionality allows users of module account.move.reversal
to call a function of the desired openerp model, after the
reversal of the move.
The call automatically sends at least the database cursor (cr) and
the use... | from openerp import pooler
def call_post_function(cr, uid, context):
"""This functionality allows users of module account.move.reversal
to call a function of the desired openerp model, after the
reversal of the move.
The call automatically sends at least the database cursor (cr) and
the use... |
Remove check for matching base domain and update host string concatenation to *append* the port rather than reconstructing the whole string | class UrlBuilder {
constructor(name, absolute, ziggyObject) {
this.name = name;
this.ziggy = ziggyObject;
this.route = this.ziggy.namedRoutes[this.name];
if (typeof this.name === 'undefined') {
throw new Error('Ziggy Error: You must provide a route name');
} els... | class UrlBuilder {
constructor(name, absolute, ziggyObject) {
this.name = name;
this.ziggy = ziggyObject;
this.route = this.ziggy.namedRoutes[this.name];
if (typeof this.name === 'undefined') {
throw new Error('Ziggy Error: You must provide a route name');
} els... |
Update path fonts gulp task | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... |
Fix CSS state when a vote is cancelled. | /**
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
(function($) {
$('.upvote').on('click', function(e) {
var url = '/links/upvote/{id}'.replace('{id}', $(this).data('id'));
var $link = $(this);
var hasBeenVoted = $link.hasClass('link-... | /**
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
(function($) {
$('.upvote').on('click', function(e) {
var url = '/links/upvote/{id}'.replace('{id}', $(this).data('id'));
var $link = $(this);
var $vote = $link.parent();
var ... |
Add support for IE11 (msCrypto) | var almost = (function() {
function lookupWord(id)
{
// TODO: Return the specified entry from our words list.
return 'word' + id;
}
return {
getWords : function(howMany) {
var c = window.crypto || window.msCrypto;
if (c && c.getRandomValues) {
... | var almost = (function() {
function lookupWord(id)
{
// TODO: Return the specified entry from our words list.
return 'word' + id;
}
return {
getWords : function(howMany) {
if (window.crypto && window.crypto.getRandomValues) {
// Get random values usin... |
Refactor populate_db pyinvoke task to use it in tests | import json
from pathlib import Path
import sys
import sqlalchemy as sa
from invoke import task
FANTASY_DATA_FOLDER = Path(__file__).parent / 'fantasy-database'
@task
def populate_db(ctx, data_folder=FANTASY_DATA_FOLDER, dsn=None):
from examples.fantasy import tables
data_file = data_folder / 'data.json'
... | import json
from pathlib import Path
import sys
import sqlalchemy as sa
from invoke import task
FANTASY_DB_SQL = Path.cwd() / 'fantasy-database' / 'schema.sql'
FANTASY_DB_DATA = Path.cwd() / 'fantasy-database' / 'data.json'
@task
def populate_db(ctx, data_file=FANTASY_DB_DATA):
from examples.fantasy import tabl... |
Use exception renderable instead of uses of instanceof | <?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Routing\Exceptions\InvalidSignatureException;
use Illuminate\Validation\ValidationException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are n... | <?php
namespace App\Exceptions;
use App\Exceptions\SolverException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Routing\Exceptions\InvalidSignatureException;
use Illuminate\Validation\ValidationException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A li... |
Add default headers, fix output | #!/usr/bin/env python3
import lxml.html
from lxml.cssselect import CSSSelector
import requests
import json
class EndpointIdentifier:
_page = 'https://www.reddit.com/dev/api/oauth'
_no_scope = '(any scope)'
_headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like... | #!/usr/bin/env python3
import lxml.html
from lxml.cssselect import CSSSelector
import requests
import json
class EndpointIdentifier:
_page = 'https://www.reddit.com/dev/api/oauth'
_no_scope = '(any scope)'
def __init__(self):
pass
def find(self):
page = requests.get(self._page)
... |
feat(form): Add class id to form dropdown container | import React, {PropTypes, Component} from 'react'
import { Form, FormGroup, FormControl, Row, Col } from 'react-bootstrap'
import { connect } from 'react-redux'
import { setQueryParam } from '../../actions/form'
class DropdownSelector extends Component {
static propTypes = {
name: PropTypes.string,
value: P... | import React, {PropTypes, Component} from 'react'
import { Form, FormGroup, FormControl, Row, Col } from 'react-bootstrap'
import { connect } from 'react-redux'
import { setQueryParam } from '../../actions/form'
class DropdownSelector extends Component {
static propTypes = {
name: PropTypes.string,
value: P... |
Fix numberOfPages when nItems is null | /**
* Created by FG0003 on 09/02/2017.
*/
import Template from './pagination.tpl.html';
import previous from './../../../icons/previous.svg';
import next from './../../../icons/next.svg';
import first from './../../../icons/first.svg';
import last from './../../../icons/last.svg';
class PaginationController{
c... | /**
* Created by FG0003 on 09/02/2017.
*/
import Template from './pagination.tpl.html';
import previous from './../../../icons/previous.svg';
import next from './../../../icons/next.svg';
import first from './../../../icons/first.svg';
import last from './../../../icons/last.svg';
class PaginationController{
c... |
Fix integer formatter to accept zero value | <?php
declare(strict_types = 1);
namespace DASPRiD\Formidable\Mapping\Formatter;
use Assert\Assertion;
use DASPRiD\Formidable\Data;
use DASPRiD\Formidable\FormError\FormError;
use DASPRiD\Formidable\Mapping\BindResult;
final class IntegerFormatter implements FormatterInterface
{
/**
* {@inheritdoc}
*/
... | <?php
declare(strict_types = 1);
namespace DASPRiD\Formidable\Mapping\Formatter;
use Assert\Assertion;
use DASPRiD\Formidable\Data;
use DASPRiD\Formidable\FormError\FormError;
use DASPRiD\Formidable\Mapping\BindResult;
final class IntegerFormatter implements FormatterInterface
{
/**
* {@inheritdoc}
*/
... |
Fix installation on Python < 2.7
When the install_requires array was moved, a erroneous trailing comma
was left, turning it into a tuple which cannot be appended to. Removing
the comma allows installation on Python 2.6 which is what CloudFormation
uses. | """ Setup script for PyPI """
import os
import sys
from setuptools import setup
from ConfigParser import SafeConfigParser
settings = SafeConfigParser()
settings.read(os.path.realpath('dynamic_dynamodb/dynamic-dynamodb.conf'))
def return_requires():
install_requires = [
'boto >= 2.29.1',
'requests... | """ Setup script for PyPI """
import os
import sys
from setuptools import setup
from ConfigParser import SafeConfigParser
settings = SafeConfigParser()
settings.read(os.path.realpath('dynamic_dynamodb/dynamic-dynamodb.conf'))
def return_requires():
install_requires = [
'boto >= 2.29.1',
'requests... |
Fix decoding of empty responses.
When an empty response was given by the web server, we were
decoding to '{}', which is problematic when you are expecting
an empty response for things like empty text/plain files. This
fixes the problematic assumption we were making.
Reviewed at http://reviews.reviewboard.org/r/3680/ | import json
from rbtools.api.utils import parse_mimetype
DECODER_MAP = {}
def DefaultDecoder(payload):
"""Default decoder for API payloads.
The default decoder is used when a decoder is not found in the
DECODER_MAP. This is a last resort which should only be used when
something has gone wrong.
... | import json
from rbtools.api.utils import parse_mimetype
DECODER_MAP = {}
def DefaultDecoder(payload):
"""Default decoder for API payloads.
The default decoder is used when a decoder is not found in the
DECODER_MAP. This is a last resort which should only be used when
something has gone wrong.
... |
Prepare to send 'ready' message when all setup is done
Signed-off-by: Tomas Neme <6bc1d25c0f0098e02c3c0ae175e2ae803c7b6bbc@gmail.com> | /*******************
* This is the pubsub driver that should tell caspa about the melted status
*
*******************/
events = require('events');
utils = require('utils');
_ = require('underscore');
mbc = require('mbc-common');
defaults = { // copied from caspa/models.App.Status
_id: 1,
piece: {
pr... | /*******************
* This is the pubsub driver that should tell caspa about the melted status
*
*******************/
events = require('events');
utils = require('utils');
_ = require('underscore');
mbc = require('mbc-common');
defaults = { // copied from caspa/models.App.Status
_id: 1,
piece: {
pr... |
[JUnit] Use explicit encoding when getting bytes from String | package cucumber.runtime.junit;
import cucumber.runtime.io.Resource;
import cucumber.runtime.model.CucumberFeature;
import cucumber.runtime.model.FeatureParser;
import gherkin.events.PickleEvent;
import gherkin.pickles.Compiler;
import gherkin.pickles.Pickle;
import java.io.ByteArrayInputStream;
import java.io.InputS... | package cucumber.runtime.junit;
import cucumber.runtime.io.Resource;
import cucumber.runtime.model.CucumberFeature;
import cucumber.runtime.model.FeatureParser;
import gherkin.events.PickleEvent;
import gherkin.pickles.Compiler;
import gherkin.pickles.Pickle;
import java.io.ByteArrayInputStream;
import java.io.InputS... |
Revert optimization: it didn't help | <?php
declare(strict_types=1);
namespace WoohooLabs\Zen;
use Closure;
use Psr\Container\ContainerInterface;
use WoohooLabs\Zen\Exception\NotFoundException;
use function array_key_exists;
abstract class AbstractCompiledContainer implements ContainerInterface
{
/**
* @var array
*/
protected $singleto... | <?php
declare(strict_types=1);
namespace WoohooLabs\Zen;
use Closure;
use Psr\Container\ContainerInterface;
use WoohooLabs\Zen\Exception\NotFoundException;
use function array_key_exists;
abstract class AbstractCompiledContainer implements ContainerInterface
{
/**
* @var array
*/
protected $singleto... |
Update minifier to write to build file more smartly
This handles cases where the main stylesheet is referenced from a
subdir or different directory from the root of index.html, but
still allow the minifier to write to the file using a different path
(for example outside of the webroot). | <?php
/**
* Minify CSS Preprocessor class file
*
* @package Holograph
*/
namespace Holograph\Preprocessor\Css;
use Holograph\Preprocessor\PreprocessorAbstract;
use Holograph\FileOps;
/**
* Class to minify and combine Css files
*
* @package Holograph
* @author Jansen Price <jansen.price@gmail.com>
* @version... | <?php
/**
* Minify CSS Preprocessor class file
*
* @package Holograph
*/
namespace Holograph\Preprocessor\Css;
use Holograph\Preprocessor\PreprocessorAbstract;
use Holograph\FileOps;
/**
* Class to minify and combine Css files
*
* @package Holograph
* @author Jansen Price <jansen.price@gmail.com>
* @version... |
Rename to better method names | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2017-2018, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / Test / Unit / Framework / Mvc/ Re... | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2017-2018, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / Test / Unit / Framework / Mvc/ Re... |
Apply a couple refinements to object name strategy.
Zero length names are invalid.
So are names beginning or ending with -. | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
Hypothesis strategies useful for testing ``pykube``.
"""
from string import ascii_lowercase, digits
from pyrsistent import pmap
from hypothesis.strategies import builds, fixed_dictionaries, text, lists, sampled_from
from .. import NamespacedOb... | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
Hypothesis strategies useful for testing ``pykube``.
"""
from string import ascii_lowercase, digits
from pyrsistent import pmap
from hypothesis.strategies import builds, fixed_dictionaries, text, lists, sampled_from
from .. import NamespacedOb... |
Add watcher for jsx files. | var gulp = require('gulp'),
react = require('gulp-react'),
gulpIf = require('gulp-if'),
uglify = require('gulp-uglify'),
_ = require('underscore'),
elixir = require('laravel-elixir'),
utilities = require('laravel-elixir/ingredients/commands/Utilities'),
notification = require('laravel-elixir... | var gulp = require('gulp'),
react = require('gulp-react'),
gulpIf = require('gulp-if'),
uglify = require('gulp-uglify'),
_ = require('underscore'),
elixir = require('laravel-elixir'),
utilities = require('laravel-elixir/ingredients/commands/Utilities'),
notification = require('laravel-elixir... |
Use one query with group_by for service status | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... |
Correct test setter for email | <?php
/*
* (c) Nimbles b.v. <wessel@nimbles.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nimbles\OnlineBetaalPlatform\Model;
use PHPUnit\Framework\TestCase;
/**
* Class PaymentTest
*/
class PaymentTest extends TestC... | <?php
/*
* (c) Nimbles b.v. <wessel@nimbles.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nimbles\OnlineBetaalPlatform\Model;
use PHPUnit\Framework\TestCase;
/**
* Class PaymentTest
*/
class PaymentTest extends TestC... |
Create a instance for AudioContext | (function (exports) {
'use strict';
/**
* @constructor
*/
function BrowserMusicPlayer () {
this.ctx = new (window.AudioContext || window.webkitAudioContext)();
}
/**
* ファイルをFileReader.readAsDataURL()を使って読み込み、FileReaderオブジェクトを返します
* @param {File} file
* @returns {Fi... | (function (exports) {
'use strict';
/**
* @constructor
*/
function BrowserMusicPlayer () {}
/**
* ファイルをFileReader.readAsDataURL()を使って読み込み、FileReaderオブジェクトを返します
* @param {File} file
* @returns {FileReader}
*/
BrowserMusicPlayer.prototype.loadMusic = function (file) {
... |
Fix select values for stars | (function () {
'use strict';
var React = require('react');
var $ = require('jquery');
var RatingForm = React.createClass({
handleSubmit: function (event) {
event.preventDefault();
var $form = $(event.target);
var rating = {
text: $form.find('#text').val(),
stars: $form.... | (function () {
'use strict';
var React = require('react');
var $ = require('jquery');
var RatingForm = React.createClass({
handleSubmit: function (event) {
event.preventDefault();
var $form = $(event.target);
var rating = {
text: $form.find('#text').val(),
stars: $form.... |
Client: Remove global variable used for debugging | var Backbone = require("lib").Backbone;
var utils = require("utils");
var View = Backbone.View.extend({
el: "#top-progress-bar",
initialize: function() {
this.progress = this.$el.find(".determinate");
this._timer = null;
},
setProgress: function(fraction) {
if(this._timer) {
... | var Backbone = require("lib").Backbone;
var utils = require("utils");
var View = Backbone.View.extend({
el: "#top-progress-bar",
initialize: function() {
this.progress = this.$el.find(".determinate");
this._timer = null;
},
setProgress: function(fraction) {
if(this._timer) {
... |
Add character replacements for RT search | import requests
from bs4 import BeautifulSoup
from source.models.rt_rating import RTRating
class RottenTomatoesService:
__URL = 'http://www.rottentomatoes.com/m/'
__SEPERATOR = '_'
def __init__(self, title):
self.title = title
def get_rt_rating(self):
search_url = self.__URL + self... | import requests
from bs4 import BeautifulSoup
from source.models.rt_rating import RTRating
class RottenTomatoesService:
__URL = 'http://www.rottentomatoes.com/m/'
__SEPERATOR = '_'
def __init__(self, title):
self.title = title
def get_rt_rating(self):
search_url = self.__URL + self... |
philadelphia-client: Simplify command name length calculation | package com.paritytrading.philadelphia.client.command;
import com.paritytrading.philadelphia.client.TerminalClient;
import java.util.Scanner;
class HelpCommand implements Command {
@Override
public void execute(TerminalClient client, Scanner arguments) throws CommandException {
if (arguments.hasNext(... | package com.paritytrading.philadelphia.client.command;
import com.paritytrading.philadelphia.client.TerminalClient;
import java.util.Scanner;
class HelpCommand implements Command {
@Override
public void execute(TerminalClient client, Scanner arguments) throws CommandException {
if (arguments.hasNext(... |
Fix to Modal displaying off the page. | /**
* Copyright 2015 Ian Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /**
* Copyright 2015 Ian Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Add a slot for legislator role | """ these are helper classes for object creation during the scrape """
from pupa.models.person import Person
from pupa.models.organization import Organization
from pupa.models.membership import Membership
class Legislator(Person):
_is_legislator = True
__slots__ = ('post_id', 'party', 'chamber', '_contact_det... | """ these are helper classes for object creation during the scrape """
from pupa.models.person import Person
from pupa.models.organization import Organization
from pupa.models.membership import Membership
class Legislator(Person):
_is_legislator = True
__slots__ = ('post_id', 'party', 'chamber', '_contact_det... |
Reset learners password when user is unGDPRed/unretired via django admin. | """
Django forms for accounts
"""
from django import forms
from django.core.exceptions import ValidationError
from openedx.core.djangoapps.user_api.accounts.utils import generate_password
class RetirementQueueDeletionForm(forms.Form):
"""
Admin form to facilitate learner retirement cancellation
"""
c... | """
Django forms for accounts
"""
from django import forms
from django.core.exceptions import ValidationError
class RetirementQueueDeletionForm(forms.Form):
"""
Admin form to facilitate learner retirement cancellation
"""
cancel_retirement = forms.BooleanField(required=True)
def save(self, retir... |
BAP-10654: Prepare existing code for new Localization Entity
- reverted back parentLocalization and childLocalization names | <?php
namespace Oro\Bundle\LocaleBundle\Tests\Functional\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Oro\Bundle\LocaleBundle\Entity\Localization;
class LoadLocalizationData extends AbstractFixture
{
/**
* @var array
*/
protecte... | <?php
namespace Oro\Bundle\LocaleBundle\Tests\Functional\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Oro\Bundle\LocaleBundle\Entity\Localization;
class LoadLocalizationData extends AbstractFixture
{
/**
* @var array
*/
protecte... |
Replace jQuery `each` method with for loop | window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (global, GOVUK) {
'use strict'
GOVUK.Modules.TrackBrexitQaChoices = function () {
this.start = function (element) {
track(element)
}
function track (element) {
element.on('submit', function (eve... | window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (global, GOVUK) {
'use strict'
GOVUK.Modules.TrackBrexitQaChoices = function () {
this.start = function (element) {
track(element)
}
function track (element) {
element.on('submit', function (eve... |
Fix "Axis Tick Styling" example. | var options = {
container: document.getElementById('myChart'),
data: generateSpiralData(),
series: [{
type: 'line',
xKey: 'x',
yKey: 'y',
marker: {
enabled: false
}
}],
axes: [
{
type: 'number',
position: 'bottom',
... | var options = {
container: document.getElementById('myChart'),
data: generateSpiralData(),
series: [{
type: 'line',
xKey: 'x',
yKey: 'y',
marker: {
enabled: false
}
}],
axes: [
{
type: 'number',
position: 'bottom',
... |
Return None if key is not found | import json
import re
import requests
class KeyValue(object):
def __init__(self, url):
self._url = "%s/kv" % url
def _get(self, key, recurse=None, keys=None):
url = self._url + '/' + key
params = dict()
if recurse is not None:
params['recurse'] = True
if k... | import json
import re
import requests
class KeyValue(object):
def __init__(self, url):
self._url = "%s/kv" % url
def _get(self, key, recurse=None, keys=None):
url = self._url + '/' + key
params = dict()
if recurse is not None:
params['recurse'] = True
if k... |
Fix accidental global variable assignment | 'use strict';
var Kefir = require('kefir');
module.exports = Stream;
function Stream(value) {
if (typeof value === 'function') {
var subscribe = value;
this._observable = Kefir.fromBinder(function (sink) {
return subscribe({
push: sink,
close: function ... | 'use strict';
var Kefir = require('kefir');
module.exports = Stream;
function Stream(value) {
if (typeof value === 'function') {
var subscribe = value;
this._observable = Kefir.fromBinder(function (sink) {
return subscribe({
push: sink,
close: function ... |
Remove empty values when fetching credentials from session | <?php
namespace App\Services;
use Illuminate\Http\Request;
abstract class Authentication
{
/**
* Retrieves array of currently configured clients.
*
* @return array
*/
abstract public function getSupportedClientKeys();
/**
* Engage in login flow.
*
* @param string $p... | <?php
namespace App\Services;
use Illuminate\Http\Request;
abstract class Authentication
{
/**
* Retrieves array of currently configured clients.
*
* @return array
*/
abstract public function getSupportedClientKeys();
/**
* Engage in login flow.
*
* @param string $p... |
Allow blanking array properties on users | <?php
namespace Auth;
trait LDAPSettableObject
{
protected function setCachedOnlyProp($propName, $value)
{
if(in_array($propName, $this->cachedOnlyProps))
{
if(!is_object($this->ldapObj))
{
$this->setFieldLocal($propName, $value);
return t... | <?php
namespace Auth;
trait LDAPSettableObject
{
protected function setCachedOnlyProp($propName, $value)
{
if(in_array($propName, $this->cachedOnlyProps))
{
if(!is_object($this->ldapObj))
{
$this->setFieldLocal($propName, $value);
return t... |
Fix ServiceProvider registerCommands method compatibility | <?php
declare(strict_types=1);
namespace Rinvex\Auth\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Rinvex\Support\Traits\ConsoleTools;
use Rinvex\Auth\Console\Commands\PublishCommand;
use Rinvex\Auth\Services\PasswordResetBrokerManager;
use Rinvex\Auth\Services\EmailVerificati... | <?php
declare(strict_types=1);
namespace Rinvex\Auth\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Rinvex\Support\Traits\ConsoleTools;
use Rinvex\Auth\Console\Commands\PublishCommand;
use Rinvex\Auth\Services\PasswordResetBrokerManager;
use Rinvex\Auth\Services\EmailVerificati... |
Fix this code so it works | from django.db import models
class DenormalizeManagerMixin(object):
def update_cohort(self, cohort, **kwargs):
stats, created = self.get_or_create(**kwargs)
stats.highest_paid = cohort.order_by('-compensation')[0]
stats.lowest_paid = cohort.order_by('compensation')[0]
stats.save()
... | from django.db import models
class DenormalizeManagerMixin(object):
def update_cohort(self, cohort, **kwargs):
stats, created = self.get_or_create(**kwargs)
stats.highest_paid = cohort.order_by('-compensation')[0]
stats.lowest_paid = cohort.order_by('compensation')[0]
stats.save()
... |
refactor: Remove materializecss select field render function
Using it now in controller when required | import Ember from 'ember';
import $ from 'jquery';
export default Ember.Controller.extend({
indexedDbPromised: Ember.inject.service('indexed-db'),
init () {
window.addEventListener('offline', () => {
/* global Materialize */
Materialize.toast('Conection lost. Trying to reconect...');
});
wi... | import Ember from 'ember';
import $ from 'jquery';
export default Ember.Controller.extend({
indexedDbPromised: Ember.inject.service('indexed-db'),
init () {
window.addEventListener('offline', () => {
/* global Materialize */
Materialize.toast('Conection lost. Trying to reconect...');
});
wi... |
Remove slug from view. Useless by now. | @extends('app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">{{ trans('manager.services.index.title') }}</div>
<div class="panel-body">
... | @extends('app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">{{ trans('manager.services.index.title') }}</div>
<div class="panel-body">
... |
Improve the spec descriptions in ContextSpecification. | describe('jasmine.grammar.ContextSpecification', function() {
var ContextSpecification = jasmine.grammar.ContextSpecification;
var env;
beforeEach(function() {
env = new jasmine.Env();
jasmine.grammar._currentEnv = env;
});
describe('concern', function() {
it('c... | describe('jasmine.grammar.ContextSpecification', function() {
var ContextSpecification = jasmine.grammar.ContextSpecification;
var env;
beforeEach(function() {
env = new jasmine.Env();
jasmine.grammar._currentEnv = env;
});
describe('concern', function() {
it('s... |
fix(webpack): Use external `react` and `react-dom`
Prevent bundling React and ReactDOM to use a single version of React if one is already included.
Refs https://github.com/scup/atellier/issues/33 | var path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'react-atellier.js',
library: 'ReactAtellier',
libraryTarget: 'umd',
},
externals: {
// Use external version of React
'react': 'react',
'react-dom'... | var path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'react-atellier.js',
library: 'ReactAtellier',
libraryTarget: 'umd',
},
externals: {
// Use external version of React
"react": "React"
},
module: {
... |
Add debug flag to nodemon to allow debugging via node-inspect et. al. | module.exports = function(grunt) {
// Load tasks
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.initConfig({
less: {
development: {
opti... | module.exports = function(grunt) {
// Load tasks
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.initConfig({
less: {
development: {
opti... |
fix(PropertyPanel): Add support of show function on prop group | import React from 'react';
import PropTypes from 'prop-types';
import style from 'PVWStyle/ReactProperties/PropertyPanel.mcss';
import factory from '../PropertyFactory';
function alwaysShow() {
return true;
}
export default class PropertyPanel extends React.Component {
constructor(props) {
super(props);
... | import React from 'react';
import PropTypes from 'prop-types';
import style from 'PVWStyle/ReactProperties/PropertyPanel.mcss';
import factory from '../PropertyFactory';
export default class PropertyPanel extends React.Component {
constructor(props) {
super(props);
// Bind callback
this.valueChange = t... |
Maintain scroll position in data source/sink list in Enabler.
Instead of blowing away the adapter each time we update, keep the same adapter
and just update the list.
Thanks to
http://vikinghammer.com/2011/06/17/android-listview-maintain-your-scroll-position-when-you-refresh/ | package com.openxc.enabler;
import java.util.TimerTask;
import android.app.Activity;
import com.openxc.VehicleManager;
import android.widget.ListView;
import android.widget.ArrayAdapter;
public class PipelineStatusUpdateTask extends TimerTask {
private VehicleManager mVehicleManager;
private Activity mActiv... | package com.openxc.enabler;
import java.util.TimerTask;
import android.app.Activity;
import com.openxc.VehicleManager;
import android.widget.ListView;
import android.widget.ArrayAdapter;
public class PipelineStatusUpdateTask extends TimerTask {
private VehicleManager mVehicleManager;
private Activity mActiv... |
Update reverse a linked list code | public class Program {
public static void main(String[] args) {
LinkedList head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Singly);
head = reverseSingly(head);
head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Singly);
head = new LinkedList(new int[] {1, 2, 3, ... | public class Program {
public static void main(String[] args) {
LinkedList head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Singly);
head = reverseSingly(head);
head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Singly);
head = new LinkedList(new int[] {1, 2, 3, ... |
Define type of `props.tag` as a string | import React from "react";
export default class ResponsiveComponent extends React.Component {
constructor(props) {
super(props);
this.state = { canRender: false };
this._mediaQueryList = null;
this._updateState = this._updateState.bind(this);
}
componentWillMount() {
... | import React from "react";
export default class ResponsiveComponent extends React.Component {
constructor(props) {
super(props);
this.state = { canRender: false };
this._mediaQueryList = null;
this._updateState = this._updateState.bind(this);
}
componentWillMount() {
... |
Add FF, Safari and Chrome to tests | module.exports = function(grunt) {
var browsers = [
{
browserName: 'internet explorer',
platform: 'Windows 10',
version: '11.285'
},
{
browserName: 'chrome',
platform: 'Linux'
},
{
browserName: 'firefox',... | module.exports = function(grunt) {
var browsers = [
{
browserName: 'internet explorer',
platform: 'Windows 10',
version: '11.285'
}
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
... |
Fix bug with csrf token | /**
* @copyright Copyright (c) 2012-2015 2amigOS! Consulting Group LLC
* @link http://2amigos.us
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
if (typeof dosamigos == "undefined" || !dosamigos) {
var dosamigos = {};
}
dosamigos.ckEditorWidget = (function ($) {
var pub = ... | /**
* @copyright Copyright (c) 2012-2015 2amigOS! Consulting Group LLC
* @link http://2amigos.us
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
if (typeof dosamigos == "undefined" || !dosamigos) {
var dosamigos = {};
}
dosamigos.ckEditorWidget = (function ($) {
var pub = ... |
Replace the test data set with this one. | import os.path as op
import numpy as np
import numpy.testing as npt
import nibabel as nib
import nibabel.tmpdirs as nbtmp
import dipy.data as dpd
from dipy.reconst.shm import calculate_max_order
from AFQ import csd
def test_fit_csd():
fdata, fbval, fbvec = dpd.get_data('small_64D')
with nbtmp.InTemporaryD... | import os.path as op
import numpy as np
import numpy.testing as npt
import nibabel as nib
import nibabel.tmpdirs as nbtmp
import dipy.data as dpd
from dipy.reconst.shm import calculate_max_order
from AFQ import csd
def test_fit_csd():
fdata, fbval, fbvec = dpd.get_data()
with nbtmp.InTemporaryDirectory() ... |
Set produced Logger as DefaultBean | package io.quarkus.arc.runtime;
import java.lang.annotation.Annotation;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.I... | package io.quarkus.arc.runtime;
import java.lang.annotation.Annotation;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.I... |
tests: Fix error in test_preprocessor_cur (xrange -> range) | import unittest
from Orange.data import Table
from Orange.preprocess import ProjectCUR
class TestCURProjector(unittest.TestCase):
def test_project_cur_default(self):
data = Table("ionosphere")
projector = ProjectCUR()
data_cur = projector(data)
for i in range(data_cur.X.shape[1]):... | import unittest
from Orange.data import Table
from Orange.preprocess import ProjectCUR
class TestCURProjector(unittest.TestCase):
def test_project_cur_default(self):
data = Table("ionosphere")
projector = ProjectCUR()
data_cur = projector(data)
for i in xrange(data_cur.X.shape[1])... |
conan: Copy find modules to root of module path | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.2"
class ClangTidyTargetCMakeConan(ConanFile):
name = "clang-tidy-target-cmake"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
generators = "cmake"
requires = ("cmake-include-guard/master@smspi... | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.2"
class ClangTidyTargetCMakeConan(ConanFile):
name = "clang-tidy-target-cmake"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
generators = "cmake"
requires = ("cmake-include-guard/master@smspi... |
Use the generic names for these as well. | #!python3
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
setup (
name = 'PyDoom rendering module',
ext_modules = cythonize (
[
Extension (
"pydoom.extensions.video",
["pydoom/extensions/video.pyx... | #!python3
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
setup (
name = 'PyDoom rendering module',
ext_modules = cythonize (
[
Extension (
"pydoom.extensions.video",
["pydoom/extensions/video.pyx... |
Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods since
5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:
"The access_policy argument is changing its default value to <class
'oslo_messaging.rpc.dispatc... | # Copyright 2015 - Alcatel-Lucent
# Copyright 2016 - Nokia
#
# 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 applicabl... | # Copyright 2015 - Alcatel-Lucent
# Copyright 2016 - Nokia
#
# 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 applicabl... |
Use $document instead of document for on fn
Signed-off-by: gconsidine <79e2475f81a6317276bf7cbb3958b20d289b78df@gregconsidine.com> | const templateUrl = require('~components/layout/side-nav.partial.html');
let $document;
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
$document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav'... | const templateUrl = require('~components/layout/side-nav.partial.html');
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav');
}
... |
Add Type attribute to password (security header) | <?php
/**
* Created by PhpStorm.
* User: Giansalex
* Date: 15/07/2017
* Time: 22:54.
*/
namespace Greenter\Ws\Header;
use SoapHeader;
use SoapVar;
/**
* Class WSSESecurityHeader.
*/
class WSSESecurityHeader extends SoapHeader
{
const WSS_NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss... | <?php
/**
* Created by PhpStorm.
* User: Giansalex
* Date: 15/07/2017
* Time: 22:54.
*/
namespace Greenter\Ws\Header;
use SoapHeader;
use SoapVar;
/**
* Class WSSESecurityHeader.
*/
class WSSESecurityHeader extends SoapHeader
{
const WSS_NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss... |
fix(command): Fix NPE when caching commands | package valandur.webapi.cache.command;
import org.spongepowered.api.command.CommandMapping;
import org.spongepowered.api.text.Text;
import valandur.webapi.api.cache.command.ICachedCommand;
import valandur.webapi.cache.CachedObject;
import static valandur.webapi.command.CommandSource.instance;
public class CachedComm... | package valandur.webapi.cache.command;
import org.spongepowered.api.command.CommandMapping;
import org.spongepowered.api.text.Text;
import valandur.webapi.api.cache.command.ICachedCommand;
import valandur.webapi.cache.CachedObject;
import static valandur.webapi.command.CommandSource.instance;
public class CachedComm... |
Add geocode delay to prevent DDOS | class GeocodeAPI {
constructor(geocodeCache) {
this.cache = geocodeCache;
}
async getGeocode(cityName, postCode) {
const location = this.makeLocation(cityName, postCode);
const cachedGeocode = this.cache.geocodeWithLocation(location);
if (cachedGeocode) {
log(`G... | class GeocodeAPI {
constructor(geocodeCache) {
this.cache = geocodeCache;
}
async getGeocode(cityName, postCode) {
const location = this.makeLocation(cityName, postCode);
const cachedGeocode = this.cache.geocodeWithLocation(location);
if (cachedGeocode) {
log(`G... |
Fix event behaviour when typing | import {
Component,
h
} from 'skatejs';
import styles from './styles';
const deleteCode = 8;
customElements.define('sk-tags', class extends Component {
static get props() {
return {
delimiter: {
attribute: true,
default: ' '
},
tags: {
default: []
}
};
}... | import {
Component,
h
} from 'skatejs';
import styles from './styles';
const deleteCode = 8;
customElements.define('sk-tags', class extends Component {
static get props() {
return {
delimiter: {
attribute: true,
default: ' '
},
tags: {
default: []
}
};
}... |
Fix bug when loading projects | package org.deidentifier.arx.gui.view.impl.analyze;
import java.awt.Panel;
import org.deidentifier.arx.DataHandle;
import org.deidentifier.arx.gui.model.Model;
import org.deidentifier.arx.gui.model.ModelEvent.ModelPart;
public abstract class ViewStatistics extends Panel{
private static final long serialVers... | package org.deidentifier.arx.gui.view.impl.analyze;
import java.awt.Panel;
import org.deidentifier.arx.DataHandle;
import org.deidentifier.arx.gui.model.Model;
import org.deidentifier.arx.gui.model.ModelEvent.ModelPart;
public abstract class ViewStatistics extends Panel{
private static final long serialVers... |
Increase version number for Python 3.9 support | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
with open("README.md") as readme_file:
readme = readme_file.read()
requirements = ["Pillow>=5.3.0", "numpy>=1.15.4", "Click>=7.0"]
setup(
author="Ryan Gibson",
author_email="ryanalexandergibson@gmail.com",
name... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
with open("README.md") as readme_file:
readme = readme_file.read()
requirements = ["Pillow>=5.3.0", "numpy>=1.15.4", "Click>=7.0"]
setup(
author="Ryan Gibson",
author_email="ryanalexandergibson@gmail.com",
name... |
Change path tot adminlte less file
Copy the fonts to build folder because we will be using elixir | var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.copy(
'node_modules/bootstrap/dist/fonts',
'public/build/fonts'
);
mix.copy(
'node_modules/font-awesome/fonts',
'public/build/fonts'
);
mix.copy(
'node_modules/ionicons/dist/fonts',
... | var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.copy(
'node_modules/bootstrap/dist/fonts',
'public/fonts'
);
mix.copy(
'node_modules/font-awesome/fonts',
'public/fonts'
);
mix.copy(
'node_modules/ionicons/dist/fonts',
'public/fon... |
Make table prop columns an array of column objects | import React, { Component } from 'react'
import PropTypes from 'prop-types'
import TableRow from './TableRow/index.js'
import Button from '../../Components/Button/index.js'
export default class Table extends Component {
static propTypes = {
tableName: PropTypes.string,
columns: PropTypes.arrayOf(PropTypes.s... | import React, { Component } from 'react'
import PropTypes from 'prop-types'
import TableRow from './TableRow/index.js'
import Button from '../../Components/Button/index.js'
export default class Table extends Component {
static propTypes = {
tableName: PropTypes.string,
columnTypes: PropTypes.object.isRequir... |
Set default ordering for blog post tags | from django.db import models
class BlogPostTag(models.Model):
name = models.CharField(max_length=255)
class Meta:
ordering = ['name']
def __str__(self):
return self.name
class BlogPost(models.Model):
datetime = models.DateTimeField()
title = models.CharField(max_length=255)
... | from django.db import models
class BlogPostTag(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class BlogPost(models.Model):
datetime = models.DateTimeField()
title = models.CharField(max_length=255)
content = models.TextField()
live = model... |
Switch <TouchableHighlight> for simpler <TouchableOpacity> | /**
* Created by BK on 21/06/16.
*
* @flow
*/
'use strict';
import React, { Component } from 'react';
import {
Text,
View,
TouchableOpacity,
StyleSheet
} from 'react-native';
type Props = {
row: {
title: string,
desc: string,
reward: string,
compl... | /**
* Created by BK on 21/06/16.
*
* @flow
*/
'use strict';
import React, { Component } from 'react';
import {
Text,
View,
TouchableHighlight,
StyleSheet
} from 'react-native';
type Props = {
row: {
title: string,
desc: string,
reward: string,
com... |
Use correct m2m join table name in LatestCommentsFeed
git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@9089 bcc190cf-cafb-0310-a4f2-bffc1f526a37 | from django.conf import settings
from django.contrib.syndication.feeds import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def title(self):
if not hasattr(self, '_site'):
... | from django.conf import settings
from django.contrib.syndication.feeds import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def title(self):
if not hasattr(self, '_site'):
... |
Refactor for better logical flow. | import logging
import os
VERSION = (1, 2, 9)
def get_version():
return '%s.%s.%s' % VERSION
try:
# check for existing logging configuration
# valid for Django>=1.3
from django.conf import settings
if settings.LOGGING:
pass
except ImportError:
# if we have any problems, we most likely... | import logging
import os
from django.conf import settings
VERSION = (1, 2, 9)
def get_version():
return '%s.%s.%s' % VERSION
try:
LOGFILE = os.path.join(settings.DIRNAME, 'axes.log')
except (ImportError, AttributeError):
# if we have any problems, we most likely don't have a settings module
# loaded... |
Fix eslint config file checks. | 'use strict';
// Load modules
const Fs = require('fs');
const Path = require('path');
const Eslint = require('eslint');
const Hoek = require('hoek');
// Declare internals
const internals = {};
exports.lint = function () {
const configuration = {
ignore: true,
useEslintrc: true
};
con... | 'use strict';
// Load modules
const Fs = require('fs');
const Path = require('path');
const Eslint = require('eslint');
const Hoek = require('hoek');
// Declare internals
const internals = {};
exports.lint = function () {
const configuration = {
ignore: true,
useEslintrc: true
};
con... |
Add manifest and bump version | #!/usr/bin/env python
import os
from setuptools import setup
def _read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
REQUIREMENTS = [l for l in _read('requirements.txt').split('\n') if l and not l.startswith('#')]
VERSION = '1.0.1'
s... | #!/usr/bin/env python
import os
from setuptools import setup
def _read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
REQUIREMENTS = [l for l in _read('requirements.txt').split('\n') if l and not l.startswith('#')]
VERSION = '1.0.0'
s... |
Improve the error handling and error response message. | import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from vehicles.models import Vehicle
import control.tasks
#@api_view(['POST'])
@csrf_exempt
def handle_control(request, vehicle_vin='-1'):
print 'vehicle: ', vehicle_vin
try:
vehicle = Vehicle.obje... | import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from vehicles.models import Vehicle
import control.tasks
#@api_view(['POST'])
@csrf_exempt
def handle_control(request, vehicle_vin='-1'):
print 'vehicle: ', vehicle_vin
try:
vehicle = Vehicle.obje... |
Update classifier tags, email and url. | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('pgspecial/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'Meta-commands handler for Postgres Dat... | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('pgspecial/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'Meta-commands handler for Postgres Dat... |
Fix for Python 2.6 and Python 3. | """Like the input built-in, but with bells and whistles."""
import getpass
# Use raw_input for Python 2.x
try:
input = raw_input
except NameError:
pass
def user_input(field, default='', choices=None, password=False, empty_ok=False, accept=False):
"""Prompt user for input until a value is retrieved or def... | """Like the raw_input built-in, but with bells and whistles."""
import getpass
def user_input(field, default='', choices=None, password=False, empty_ok=False, accept=False):
"""Prompt user for input until a value is retrieved or default
is accepted. Return the input.
Arguments:
field Descript... |
Remove cannotBeEmpty call on integernode | <?php
namespace Blablacar\RedisBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
*
* @return TreeBu... | <?php
namespace Blablacar\RedisBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
*
* @return TreeBu... |
Fix JS error preventing newly created dictionary items from opening automatically | /**
* @ngdoc controller
* @name Umbraco.Editors.Dictionary.CreateController
* @function
*
* @description
* The controller for creating dictionary items
*/
function DictionaryCreateController($scope, $location, dictionaryResource, navigationService, notificationsService, formHelper, appState) {
var vm = th... | /**
* @ngdoc controller
* @name Umbraco.Editors.Dictionary.CreateController
* @function
*
* @description
* The controller for creating dictionary items
*/
function DictionaryCreateController($scope, $location, dictionaryResource, navigationService, notificationsService, formHelper, appState) {
var vm = th... |
Add line separator in logs from JSON event log to another to facilitate json log parsers | package io.dropwizard.logging.layout;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.contrib.json.JsonLayoutBase;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import io.dropwizard.l... | package io.dropwizard.logging.layout;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.contrib.json.JsonLayoutBase;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import io.dropwizard.l... |
Use Line::EOL for line detection | <?php
namespace WyriHaximus\React\ChildProcess\Messenger;
use WyriHaximus\React\ChildProcess\Messenger\Messages\Line;
/**
* @todo code smell with $source
*/
trait OnDataTrait
{
/**
* @var string[]
*/
protected $buffers = [
'stdin' => '',
'stdout' => '',
'stderr' => '',
... | <?php
namespace WyriHaximus\React\ChildProcess\Messenger;
/**
* @todo code smell with $source
*/
trait OnDataTrait
{
/**
* @var string[]
*/
protected $buffers = [
'stdin' => '',
'stdout' => '',
'stderr' => '',
];
/**
* @param string $data
* @param string $... |
Drop content type in migration as well | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def forwards_remove_content_types(apps, schema_editor):
db = schema_editor.connection.alias
ContentType = apps.get_model('contenttypes', 'ContentType')
ContentType.objects.using(db).filter(
ap... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('oauth', '0003_move_github'),
]
operations = [
migrations.RemoveField(
model_name='bitbucketproject',
... |
Add a simple type for null | import Context from "../context"
import ContextTypes from "../context-types"
import Expression from "./expression"
import Doc from "./doc"
import {PHPSimpleType, PHPTypeUnion} from "../phptype"
import Identifier from "./identifier"
export default class ConstRef extends Expression {
/** @type {string|Identifier} */
... | import Context from "../context"
import ContextTypes from "../context-types"
import Expression from "./expression"
import Doc from "./doc"
import {PHPSimpleType, PHPTypeUnion} from "../phptype"
import Identifier from "./identifier"
export default class ConstRef extends Expression {
/** @type {string|Identifier} */
... |
Fix sourcemaps so they write to separate .map file | var gulp = require("gulp"),
plugins = require("gulp-load-plugins")(),
pkg = require("./package.json"),
paths = {
src: {
css: "./src/main/resources/static/sass"
},
dist: {
css: "./src/main/resources/static/css"
}
},
config = {
... | var gulp = require("gulp"),
plugins = require("gulp-load-plugins")(),
pkg = require("./package.json"),
paths = {
src: {
css: "./src/main/resources/static/sass"
},
dist: {
css: "./src/main/resources/static/css"
}
},
config = {
... |
Use let instead of var | import { isString, isArray, isFunction } from './util';
let resolved = {};
function loadScript(url, callback, errorCallback) {
let invokeCallback = function() {
resolved[url] = true;
if (isFunction(callback)) {
callback();
}
};
if (resolved[url]) {
invokeCallb... | import { isString, isArray, isFunction } from './util';
let resolved = {};
function loadScript(url, callback, errorCallback) {
var invokeCallback = function() {
resolved[url] = true;
if (isFunction(callback)) {
callback();
}
};
if (resolved[url]) {
invokeCallb... |
Create a parent with the same dataset type | import ckan.logic as logic
from ckan.logic.action.get import package_show as ckan_package_show
from ckan.plugins import toolkit
from ckanext.datasetversions.helpers import get_context
def dataset_version_create(context, data_dict):
id = data_dict.get('id')
parent_name = data_dict.get('base_name')
owner_... | import ckan.logic as logic
from ckan.logic.action.get import package_show as ckan_package_show
from ckan.plugins import toolkit
from ckanext.datasetversions.helpers import get_context
def dataset_version_create(context, data_dict):
id = data_dict.get('id')
parent_name = data_dict.get('base_name')
owner_... |
Use grid_on icon for QnA | export default class {
constructor($scope, auth, toast) {
'ngInject';
$scope.buttons = [
{
name: 'View Code',
icon: 'code',
show: true,
href: 'https://github.com/mjhasbach/material-qna'
},
{
... | export default class {
constructor($scope, auth, toast) {
'ngInject';
$scope.buttons = [
{
name: 'View Code',
icon: 'code',
show: true,
href: 'https://github.com/mjhasbach/material-qna'
},
{
... |
Add get registration count to service | <?php
namespace Shaygan\AffiliateBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* ReferralRegistrationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ReferralRegistrationRepository extends EntityRepository
{
public function getReg... | <?php
namespace Shaygan\AffiliateBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* ReferralRegistrationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ReferralRegistrationRepository extends EntityRepository
{
public function getReg... |
Add logic for multiremote object when setting tunnelIdentifier | import SauceConnectLauncher from 'sauce-connect-launcher'
class SauceLaunchService {
/**
* modify config and launch sauce connect
*/
onPrepare (config, capabilities) {
if (!config.sauceConnect) {
return
}
this.sauceConnectOpts = Object.assign({
usernam... | import SauceConnectLauncher from 'sauce-connect-launcher'
class SauceLaunchService {
/**
* modify config and launch sauce connect
*/
onPrepare (config, capabilities) {
if (!config.sauceConnect) {
return
}
this.sauceConnectOpts = Object.assign({
usernam... |
Put the bundle set value in a new while loop. | package com.brg.dao;
import com.brg.ServiceProvider;
import com.brg.domain.RuleValueBundle;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
public class RuleValueBundleDAO implements DAO{
@Override
public ArrayList<RuleValueBundle> executeRead(String sql) {
ArrayLi... | package com.brg.dao;
import com.brg.ServiceProvider;
import com.brg.domain.RuleValueBundle;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
public class RuleValueBundleDAO implements DAO{
@Override
public ArrayList<RuleValueBundle> executeRead(String sql) {
ArrayLi... |
Fix bug in onBootsrap function | <?php
namespace TreeLayoutStack;
class Module implements \Zend\ModuleManager\Feature\AutoloaderProviderInterface{
/**
* @param \Zend\EventManager\EventInterface $oEvent
*/
public function onBootstrap(\Zend\EventManager\EventInterface $oEvent){
$oServiceManager = $oEvent->getApplication()->getServiceManager();
... | <?php
namespace TreeLayoutStack;
class Module implements \Zend\ModuleManager\Feature\AutoloaderProviderInterface{
/**
* @param \Zend\EventManager\EventInterface $oEvent
*/
public function onBootstrap(\Zend\EventManager\EventInterface $oEvent){
$oServiceManager = $oEvent->getApplication()->getServiceManager();
... |
Add missing class property declarations | <?php
namespace RIPS\APIConnector;
use GuzzleHttp\Client;
use RIPS\APIConnector\Requests\UserRequests;
use RIPS\APIConnector\Requests\OrgRequests;
use RIPS\APIConnector\Requests\QuotaRequests;
class API
{
// @var UserRequests
public $users;
// @var OrgRequests
public $orgs;
// @var QuotaRequest... | <?php
namespace RIPS\APIConnector;
use GuzzleHttp\Client;
use RIPS\APIConnector\Requests\UserRequests;
use RIPS\APIConnector\Requests\OrgRequests;
use RIPS\APIConnector\Requests\QuotaRequests;
class API
{
// @var UserRequests
public $users;
// @var GuzzleHttp/Client
protected $client;
// @var a... |
Split arg parsing into function | import argparse
import os
import string
def generate_rpm_spec(template, patch_file):
spec_template = string.Template(template)
base_name, _ = os.path.splitext(patch_file)
values = {
'name': 'kpatch-module-{}'.format(base_name),
'patch_file': patch_file,
'kmod_filename': 'kpatch-{... | import argparse
import os
import string
def generate_rpm_spec(template, patch_file):
spec_template = string.Template(template)
base_name, _ = os.path.splitext(patch_file)
values = {
'name': 'kpatch-module-{}'.format(base_name),
'patch_file': patch_file,
'kmod_filename': 'kpatch-{... |
Add a waterfalled event on active tab change
This allows us to do extra bullshit since Enyo doesn't tend to like
being shown/hidden. | enyo.kind({
name: "bootstrap.TabHolder",
handlers: {
onNavItemClicked: "showTabContent"
},
showTabContent: function(inSender, inEvent){
this.waterfall("showTabContent", inEvent);
}
});
enyo.kind({
name: "bootstrap.TabContent",
classes: "tab-content",
published: {
active: false
},
handle... | enyo.kind({
name: "bootstrap.TabHolder",
handlers: {
onNavItemClicked: "showTabContent"
},
showTabContent: function(inSender, inEvent){
this.waterfall("showTabContent", inEvent);
}
});
enyo.kind({
name: "bootstrap.TabContent",
classes: "tab-content",
published: {
active: false
},
handle... |
Remove binding as got moved to concierge package | <?php
namespace App\Providers;
use Timegridio\Concierge\Models\Appointment;
use Timegridio\Concierge\Models\Business;
use Timegridio\Concierge\Models\Contact;
use Timegridio\Concierge\Models\Service;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
c... | <?php
namespace App\Providers;
use Timegridio\Concierge\Models\Appointment;
use Timegridio\Concierge\Models\Business;
use Timegridio\Concierge\Models\Contact;
use Timegridio\Concierge\Models\Service;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
c... |
Use source keyword argument (instead of overriding get_attribute)
This allows the ImageRenditionField to be used on models that contain an
image field. | from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from rest_framework.fields import Field
from ...models import SourceImageIOError
from ..v2.serializers import ImageSerializer
class ImageRenditionField(Field):
"""
A field that generates a rendition with the specif... | from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from rest_framework.fields import Field
from ...models import SourceImageIOError
from ..v2.serializers import ImageSerializer
class ImageRenditionField(Field):
"""
A field that generates a rendition with the specif... |
Add data-automation tag to text field error message | import styles from './TextField.less';
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import ErrorIcon from '../../icons/ErrorIcon/ErrorIcon';
export default class TextField extends Component {
static propTypes = {
className: PropTypes.string,
inputProps: PropTyp... | import styles from './TextField.less';
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import ErrorIcon from '../../icons/ErrorIcon/ErrorIcon';
export default class TextField extends Component {
static propTypes = {
className: PropTypes.string,
inputProps: PropTyp... |
Tweak partner form to use textarea for description | from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from casepro.msgs.models import Label
from .models import Partner
class BasePartnerForm(forms.ModelForm):
description = forms.CharField(label=_("Description"), max_length=255, required=False,... | from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from casepro.msgs.models import Label
from .models import Partner
class PartnerUpdateForm(forms.ModelForm):
labels = forms.ModelMultipleChoiceField(label=_("Can Access"),
... |
Fix a platform detection bug | """
Simple test runner to separate out the functional tests and the unit tests.
"""
import os
import subprocess
PLATFORMS = ['bsd', 'linux', 'nt']
# Detect what platform we are on
try:
platform = os.uname()[0].lower()
except AttributeError:
platform = os.name.lower()
if platform == 'darwin':
platform = '... | """
Simple test runner to separate out the functional tests and the unit tests.
"""
import os
import subprocess
PLATFORMS = ['bsd', 'linux', 'nt']
# Detect what platform we are on
try:
platform = os.uname()[0].lower()
except AttributeError:
platform = os.name.lower()
if platform == 'darwin':
platform = '... |
Add comment to traverseDOM function | const Bulma = {
/**
* Current BulmaJS version.
* @type {String}
*/
VERSION: '0.3.0',
/**
* Helper method to create a new plugin.
* @param {String} key
* @param {Object} options
* @return {Object}
*/
create(key, options) {
if(!key || !Bulma.hasOwnPropert... | const Bulma = {
/**
* Current BulmaJS version.
* @type {String}
*/
VERSION: '0.3.0',
/**
* Helper method to create a new plugin.
* @param {String} key
* @param {Object} options
* @return {Object}
*/
create(key, options) {
if(!key || !Bulma.hasOwnPropert... |
Make zero-element bubbles a bit smaller | import { hierarchy } from 'd3-hierarchy';
export default class Clusters {
constructor () {
this.data = {
children: [
{
cluster: 'non-anomalous',
value: 0
},
{
cluster: 'anomalous',
value: 0,
children: []
}
]
};
}
... | import { hierarchy } from 'd3-hierarchy';
export default class Clusters {
constructor () {
this.data = {
children: [
{
cluster: 'non-anomalous',
value: 0
},
{
cluster: 'anomalous',
value: 0,
children: []
}
]
};
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.