text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Order method parameters more consistent | package com.basgeekball.screenshotsnanny.core;
import android.os.Handler;
import com.basgeekball.screenshotsnanny.activityassistant.ActivityHelper;
import com.basgeekball.screenshotsnanny.helper.Callback;
import com.basgeekball.screenshotsnanny.helper.KeyboardHelper;
public class ScreenshotsTask {
private static... | package com.basgeekball.screenshotsnanny.core;
import android.os.Handler;
import com.basgeekball.screenshotsnanny.activityassistant.ActivityHelper;
import com.basgeekball.screenshotsnanny.helper.Callback;
import com.basgeekball.screenshotsnanny.helper.KeyboardHelper;
public class ScreenshotsTask {
private static... |
Add inheritance from object for BaseWrapper to force new style classes in python 2.7. | """This module contains the main wrapper class."""
class BaseWrapper(object):
"""Define base template for function wrapper classes. """
def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__
def __call__(self, *args, **kwargs):
raise NotImplementedError
class Nu... | """This module contains the main wrapper class."""
class BaseWrapper:
"""Define base template for function wrapper classes. """
def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__
def __call__(self, *args, **kwargs):
raise NotImplementedError
class NumpyWrapp... |
Add support for configurable function to extract code from item for sorting | Ext.define('Slate.sorter.Code', {
extend: 'Ext.util.Sorter',
config: {
numberRe: /^\d+$/,
numberDelim: '.',
codeFn: function(item) {
return item.get('Code');
},
sorterFn: function(a, b) {
var me = this,
codeFn = me._codeFn, // e... | Ext.define('Slate.sorter.Code', {
extend: 'Ext.util.Sorter',
config: {
numberRe: /^\d+$/,
numberDelim: '.',
sorterFn: function(a, b) {
var codeA = a.get('Code').toLowerCase(),
codeB = b.get('Code').toLowerCase(),
numberRe = this._numberRe, /... |
Update vector layer name to wikidata | mapboxgl.accessToken = 'pk.eyJ1IjoicGxhbmVtYWQiLCJhIjoiY2l2dzVxbzA3MDAwNDJzbDUzMzVzbXc5dSJ9.WZ4_UtVvuVmOw4ofNMkiJw';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
zoom: 1.4,
center: [21.6,7.6],
hash: true
});
map.addControl(new MapboxGeocoder({
accessT... | mapboxgl.accessToken = 'pk.eyJ1IjoicGxhbmVtYWQiLCJhIjoiY2l2dzVxbzA3MDAwNDJzbDUzMzVzbXc5dSJ9.WZ4_UtVvuVmOw4ofNMkiJw';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
zoom: 1.4,
center: [21.6,7.6],
hash: true
});
map.addControl(new MapboxGeocoder({
accessT... |
Exclude spec from coverage reporting. | 'use strict';
module.exports = function(config) {
config.set({
autoWatch: true,
browsers: [
'PhantomJS'
],
colors: true,
coverageReporter: {
dir: 'coverage',
instrumenterOptions: {
istanbul: {
noCom... | 'use strict';
module.exports = function(config) {
config.set({
autoWatch: true,
browsers: [
'PhantomJS'
],
colors: true,
coverageReporter: {
dir: 'coverage',
instrumenterOptions: {
istanbul: {
noCom... |
Load custom preprocessor from ".thought/hb-preprocessor.js" change name of custom helper file to ".thought/hb-helpers.js" | /*!
* thought <https://github.com/nknapp/thought>
*
* Copyright (c) 2015 Nils Knappmeier.
* Released under the MIT license.
*/
'use strict'
var path = require('path')
/**
*
* Create a spec that can be loaded with `customize` using the `load()` function.
*
* @param {String} workingDir the working directory o... | /*!
* thought <https://github.com/nknapp/thought>
*
* Copyright (c) 2015 Nils Knappmeier.
* Released under the MIT license.
*/
'use strict'
var path = require('path')
/**
*
* Create a spec that can be loaded with `customize` using the `load()` function.
*
* @param {String} workingDir the working directory o... |
Fix Python3s lack of .next(). | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .. import KeyValueStore
from .._compat import BytesIO
from .._compat import pickle
from bson.binary import Binary
class MongoStore(KeyValueStore):
"""Uses a MongoDB collection as the backend, using pickle as a serializer.
:param db: A (already authenticate... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .. import KeyValueStore
from .._compat import BytesIO
from .._compat import pickle
from bson.binary import Binary
class MongoStore(KeyValueStore):
"""Uses a MongoDB collection as the backend, using pickle as a serializer.
:param db: A (already authenticate... |
Add comment to special pendingcomments bit after its sent | // HubBub client code
// From: https://github.com/almost/hubbub/
(function () {
// Just a very rough demo, needs a lot more work
var form = document.querySelector('form[data-hubbub]');
form.addEventListener('submit', function (evt) {
evt.preventDefault();
var comment = form.querySelector('[name=comment]... | // HubBub client code
// From: https://github.com/almost/hubbub/
(function () {
// Just a very rough demo, needs a lot more work
var form = document.querySelector('form[data-hubbub]');
form.addEventListener('submit', function (evt) {
evt.preventDefault();
var comment = form.querySelector('[name=comment]... |
Change default for env execOption to null |
'use strict';
var glob = require('glob'),
_ = require('underscore'),
ParallelExec = require('./lib/ParallelExec'),
BehatTask = require('./lib/BehatTask'),
defaults = {
src: './**/*.feature',
bin: './bin/behat',
cwd: './',
config: './behat.yml',
flags: '',
... |
'use strict';
var glob = require('glob'),
_ = require('underscore'),
ParallelExec = require('./lib/ParallelExec'),
BehatTask = require('./lib/BehatTask'),
defaults = {
src: './**/*.feature',
bin: './bin/behat',
cwd: './',
config: './behat.yml',
flags: '',
... |
Upgrade deadline implementation to optional | package seedu.address.logic.parser;
import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import java.util.NoSuchElementException;
import seedu.address.common... | package seedu.address.logic.parser;
import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import java.util.NoSuchElementException;
import seedu.address.common... |
Remove extra variable by simplifying config | (function () {
'use strict';
var path = require('path'),
loadConfig = require(path.join(__dirname, 'grunt/load')),
config = {};
module.exports = function (grunt) {
config = {
pkg: grunt.file.readJSON('package.json'),
scaffold: {
dev: {
... | (function () {
'use strict';
var path = require('path'),
loadConfig = require(path.join(__dirname, 'grunt/load')),
config = {},
scaffold = {};
module.exports = function (grunt) {
scaffold = {
dev: {
path: 'dev',
assets: 'dev/asse... |
Add forward to list of bridges | from setuptools import setup
setup(
name='regrowl',
description='Regrowl server',
author='Paul Traylor',
url='https://github.com/kfdm/gntp-regrowl',
version='0.0.1',
packages=[
'regrowl',
'regrowl.bridge',
'regrowl.extras',
],
# http://pypi.python.org/pypi?%3Aact... | from setuptools import setup
setup(
name='regrowl',
description='Regrowl server',
author='Paul Traylor',
url='https://github.com/kfdm/gntp-regrowl',
version='0.0.1',
packages=[
'regrowl',
'regrowl.bridge',
'regrowl.extras',
],
# http://pypi.python.org/pypi?%3Aact... |
Sort parent objectives by testTitle to avoid them jumping around | import Ember from 'ember';
export default Ember.Route.extend({
session: null,
course: null,
proxiedObjectives: [],
afterModel: function(sessionObjective){
var self = this;
var deferred = Ember.RSVP.defer();
var objectiveProxy = Ember.ObjectProxy.extend({
sessionObjective: null,
selected... | import Ember from 'ember';
export default Ember.Route.extend({
session: null,
course: null,
proxiedObjectives: [],
afterModel: function(sessionObjective){
var self = this;
var deferred = Ember.RSVP.defer();
var objectiveProxy = Ember.ObjectProxy.extend({
sessionObjective: null,
selected... |
Adjust field name of GoTask | package com.github.blindpirate.gogradle.task.go;
import groovy.lang.Closure;
import org.gradle.api.Task;
import org.gradle.api.internal.tasks.ContextAwareTaskAction;
import org.gradle.api.internal.tasks.TaskExecutionContext;
import java.util.Map;
public class GoExecutionAction implements ContextAwareTaskAction {
... | package com.github.blindpirate.gogradle.task.go;
import groovy.lang.Closure;
import org.gradle.api.Task;
import org.gradle.api.internal.tasks.ContextAwareTaskAction;
import org.gradle.api.internal.tasks.TaskExecutionContext;
import java.util.Map;
public class GoExecutionAction implements ContextAwareTaskAction {
... |
Use DjangoJSONEncoder for JSON serialization | # coding: utf-8
import logging
from socket import gethostname
from django.core.serializers.json import DjangoJSONEncoder
from .compat import json, text_type
class JSONFormatter(logging.Formatter):
"""
Formatter to convert LogRecord into JSON.
Thanks to: https://github.com/lobziik/rlog
"""
def __i... | # coding: utf-8
import logging
from socket import gethostname
from .compat import json, text_type
class JSONFormatter(logging.Formatter):
"""
Formatter to convert LogRecord into JSON.
Thanks to: https://github.com/lobziik/rlog
"""
def __init__(self, *args, **kwargs):
include = kwargs.pop(... |
Fix search problem (but how??) | module.exports = function($scope, $state, $location, $http, GlobalService,
DocumentService, DocumentApiService, MathJaxService, QueryParser) {
$scope.doSearch = function(){
var apiServer = GlobalService.apiServer()
var query = QueryParser.parse($sc... | module.exports = function($scope, $state, $location, $http, GlobalService,
DocumentService, DocumentApiService, MathJaxService, QueryParser) {
$scope.doSearch = function(){
var apiServer = GlobalService.apiServer()
var query = QueryParser.parse($sc... |
Add check for src field
Src field can be absent in copy task,
and content field can be used instead,
so we should check if src is present to
avoid Keyerror exception. | from ansiblelint import AnsibleLintRule
format = "{}"
class RoleRelativePath(AnsibleLintRule):
id = 'E201'
shortdesc = "Doesn't need a relative path in role"
description = ''
tags = ['role']
def matchplay(self, file, play):
# assume if 'roles' in path, inside a role.
if 'roles' n... | from ansiblelint import AnsibleLintRule
format = "{}"
class RoleRelativePath(AnsibleLintRule):
id = 'E201'
shortdesc = "Doesn't need a relative path in role"
description = ''
tags = ['role']
def matchplay(self, file, play):
# assume if 'roles' in path, inside a role.
if 'roles' n... |
Fix slave labor required by | module.exports = {
name: "slave_labor",
title: "Slave Labor",
description: "During Upkeep, you can increase one City AV by 1. \
The maximum AV of a City is 2, unless otherwise noted.",
points: 1,
cost: { },
resources: [ 'food' ],
requires: [ ],
required_by: [ ],
events: {
'an... | module.exports = {
name: "slave_labor",
title: "Slave Labor",
description: "During Upkeep, you can increase one City AV by 1. \
The maximum AV of a City is 2, unless otherwise noted.",
points: 1,
cost: { },
resources: [ 'food' ],
requires: [ ],
required_by: [ 'government' ],
events: ... |
Fix Spotify api object creation | from flask_login import UserMixin
import spotify
import spotipy
import db_utils
import application as app
class User(UserMixin):
''' User class for Flask-Login '''
def __init__(self, user_id, username=None):
self.id = int(user_id)
self.username = username
self._spotify = None
@pro... | from flask_login import UserMixin
import spotify
import spotipy
import db_utils
import application as app
class User(UserMixin):
''' User class for Flask-Login '''
def __init__(self, user_id, username=None):
self.id = int(user_id)
self.username = username
self._spotify = None
@pro... |
Add a better transform example | /**
The `DS.Transform` class is used to serialize and deserialize model
attributes when they are saved or loaded from an
adapter. Subclassing `DS.Transform` is useful for creating custom
attributes. All subclasses of `DS.Transform` must implement a
`serialize` and a `deserialize` method.
Example
```java... | /**
The `DS.Transform` class is used to serialize and deserialize model
attributes when they are saved or loaded from an
adapter. Subclassing `DS.Transform` is useful for creating custom
attributes. All subclasses of `DS.Transform` must implement a
`serialize` and a `deserialize` method.
Example
```java... |
Add homepage to LongT5 dataset collection
PiperOrigin-RevId: 479013251 | # coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | # coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
Fix compile error of recipe "android" for non-sdl bootstrap build | from distutils.core import setup, Extension
import os
library_dirs = ['libs/' + os.environ['ARCH']]
lib_dict = {
'pygame': ['sdl'],
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
}
sdl_libs = lib_dict.get(os.environ['BOOTSTRAP'], [])
renpy_sound = Extension('android._android_sound',
... | from distutils.core import setup, Extension
import os
library_dirs = ['libs/' + os.environ['ARCH']]
lib_dict = {
'pygame': ['sdl'],
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
}
sdl_libs = lib_dict[os.environ['BOOTSTRAP']]
renpy_sound = Extension('android._android_sound',
... |
[Tests] Implement simple tests for findBy([]) method | <?php
/**
* @author: Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace Lynx\Tests;
use DateTime;
use Model\User;
class RepositoryTest extends TestCase
{
public function testGetOneMethodSuccessForUserEntity()
{
/** @var \Lynx\Repository $repository */
$repository = $this->em-... | <?php
/**
* @author: Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace Lynx\Tests;
use DateTime;
use Model\User;
class RepositoryTest extends TestCase
{
public function testGetOneMethodSuccessForUserEntity()
{
/** @var \Lynx\Repository $repository */
$repository = $this->em-... |
Update menu to Bootstrap 4 | <nav class="navbar navbar-toggleable-sm navbar-static-top navbar-inverse bg-inverse">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label... | <nav class="navbar navbar-static-top navbar-dark bg-inverse">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">Bang</a>
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{{ route('cartridges.index') }}">Cartridges</a>
... |
Make this easier to test, which we'll get to a bit later | import os
import atexit
import logging
import socket
from .preflight import preflight_check
from .log import configure_logging
from .notifier import notify
from .constants import SOCKET_PATH, SOCKET_TERMINATOR
def _clean_up_existing_socket(socket_path):
try:
os.unlink(socket_path)
except OSError:
... | import os
import atexit
import logging
import socket
from .preflight import preflight_check
from .log import configure_logging
from .notifier import notify
from .constants import SOCKET_PATH, SOCKET_TERMINATOR
def _clean_up_existing_socket():
try:
os.unlink(SOCKET_PATH)
except OSError:
if os.p... |
Enable AutoConfiguration and removed default controller to CustomerAdaptor | package com.tesco.bootcamp.orderreview.adaptor;
import com.tesco.bootcamp.orderreview.representations.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org... | package com.tesco.bootcamp.orderreview.adaptor;
import com.tesco.bootcamp.orderreview.representations.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.ParameterizedTypeReference;
import org.springfram... |
Fix issue with manager (error w cut and paste) | from django.db import models
from logicaldelete import managers
try:
from django.utils import timezone
except ImportError:
from datetime import datetime as timezone
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in der... | from django.db import models
try:
from django.utils import timezone
except ImportError:
from datetime import datetime as timezonefrom logicaldelete import managers
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in deriv... |
Fix interface in historian service interface | import logging
from flow_workflow.historian.messages import UpdateMessage
LOG = logging.getLogger(__name__)
class WorkflowHistorianServiceInterface(object):
def __init__(self,
broker=None,
exchange=None,
routing_key=None):
self.broker = broker
self.exchange = ex... | import logging
from flow_workflow.historian.messages import UpdateMessage
LOG = logging.getLogger(__name__)
class WorkflowHistorianServiceInterface(object):
def __init__(self,
broker=None,
exchange=None,
routing_key=None):
self.broker = broker
self.exchange = ex... |
Fix misspelled UglifyJS filter class name | """Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_.
UglifyJS is an external tool written for NodeJS; this filter assumes that
the ``uglifyjs`` executable is in the path. Otherwise, you may define
a ``UGLIFYJS_BIN`` setting. Additional options may be passed to ``uglifyjs``
by setting ``UGLIFYJ... | """Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_.
UglifyJS is an external tool written for NodeJS; this filter assumes that
the ``uglifyjs`` executable is in the path. Otherwise, you may define
a ``UGLIFYJS_BIN`` setting. Additional options may be passed to ``uglifyjs``
by setting ``UGLIFYJ... |
Add commented includePaths parameters for grunt-sass in case of Foundation usage | module.exports = function(grunt) {
//grunt-sass
grunt.config('sass', {
options: {
outputStyle: 'expanded',
//includePaths: ['<%= config.scss.includePaths %>'],
imagePath: '../<%= config.image.dir %>'
},
dist: {
files: {
'... | module.exports = function(grunt) {
//grunt-sass
grunt.config('sass', {
options: {
outputStyle: 'expanded',
imagePath: '../<%= config.image.dir %>'
},
dist: {
files: {
'<%= config.css.dir %>/<%= config.css.file %>': '<%= config.scss.... |
Fix to avoid asynchronous Ebean fetchAhead (automatically fetches the next page)
When a page is accessed, Ebean LimitOffsetPagingQuery.java automatically
starts a new background thread to fetch the next page. This thread uses
a database connection that can be still alive after the HTTP request was
processed. On heavy ... | package models;
import java.util.*;
import javax.persistence.*;
import play.db.ebean.*;
import play.data.format.*;
import play.data.validation.*;
import com.avaje.ebean.*;
/**
* Computer entity managed by Ebean
*/
@Entity
public class Computer extends Model {
@Id
public Long id;
@Constraints.Re... | package models;
import java.util.*;
import javax.persistence.*;
import play.db.ebean.*;
import play.data.format.*;
import play.data.validation.*;
import com.avaje.ebean.*;
/**
* Computer entity managed by Ebean
*/
@Entity
public class Computer extends Model {
@Id
public Long id;
@Constraints.Re... |
Update dependencies, migrate webpack dev conf + babel + adapt to new react v16 | /* eslint-disable */
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: __dirname + '/src/main/resources/static/js/main.js',
devtool: 'eval-source-map',
output: {
filename: 'main.js',
... | /* eslint-disable */
//noinspection Eslint
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
//noinspection Eslint
const ExtractTextPlugin = require("extract-text-webpack-plugin");
//noinspection Eslint
module.exports = {
// eslint-disable-line
entry: __dirname + '/src/main/resources/static/j... |
Fix typo in command name | from setuptools import setup, find_packages
setup(
name='sgfs',
version='0.1.0b',
description='Translation layer between Shotgun entities and a file structure.',
url='http://github.com/westernx/sgfs',
packages=find_packages(exclude=['build*', 'tests*']),
include_package_data=True,
... | from setuptools import setup, find_packages
setup(
name='sgfs',
version='0.1.0b',
description='Translation layer between Shotgun entities and a file structure.',
url='http://github.com/westernx/sgfs',
packages=find_packages(exclude=['build*', 'tests*']),
include_package_data=True,
... |
Set heartbeat attrib in init | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import random
import hashlib
import requests
from heartbeat import Challenge, Heartbeat
from .utils import urlify
from .exc import DownstreamError
class DownstreamClient(object):
def __init__(self, server_url):
self.server = server_url.... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import random
import hashlib
import requests
from heartbeat import Challenge, Heartbeat
from .utils import urlify
from .exc import DownstreamError
class DownstreamClient(object):
def __init__(self, server_url):
self.server = server_url.... |
Update required version of wptrunner | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup
PACKAGE_VERSION = '0.1'
deps = ['fxos-appgen>=0.2.7',
'marionette_client>=0.7.1.1'... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup
PACKAGE_VERSION = '0.1'
deps = ['fxos-appgen>=0.2.7',
'marionette_client>=0.7.1.1'... |
Change template and improve query to NotificationHistory | window.c.AdminNotificationHistory = ((m, h, _, models) => {
return {
controller: (args) => {
const notifications = m.prop([]),
getNotifications = (user) => {
let notification = models.notification;
notification.getPageWithToken(m.postgrest.... | window.c.AdminNotificationHistory = ((m, h, _, models) => {
return {
controller: (args) => {
const notifications = m.prop([]),
getNotifications = (user) => {
let notification = models.notification;
notification.getPageWithToken(m.postgrest.... |
Add balance checking test samplesets | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... |
Make table basic and no longer striped | import React, { Component } from 'react';
import { Table, Icon } from 'semantic-ui-react';
import data from './data/food.json';
class List extends Component {
render() {
let list = [];
let categories = data.categories;
let status = data.status;
data.foods.forEach((item, index) => {
if (item.n... | import React, { Component } from 'react';
import { Table, Icon } from 'semantic-ui-react';
import data from './data/food.json';
class List extends Component {
render() {
let list = [];
let categories = data.categories;
let status = data.status;
data.foods.forEach((item, index) => {
if (item.n... |
Make sure we set the EMAIL_BACKEND by default |
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage'
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024
FILE_UPLOAD_HANDLERS = (
'djangae.storage.BlobstoreFileUploadHandler',
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)
DATABASES = {
'default': {
'ENGINE': 'djangae.db.backends.appengin... |
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage'
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024
FILE_UPLOAD_HANDLERS = (
'djangae.storage.BlobstoreFileUploadHandler',
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)
DATABASES = {
'default': {
'ENGINE': 'djangae.db.backends.appengin... |
Add docblock to correct return type provided by 2dotstwice collection | <?php
namespace CultuurNet\UDB3\Media;
use ArrayIterator;
use TwoDotsTwice\Collection\AbstractCollection;
use TwoDotsTwice\Collection\CollectionInterface;
use ValueObjects\Identity\UUID;
class ImageCollection extends AbstractCollection implements CollectionInterface
{
/**
* @var Image|null
*/
prote... | <?php
namespace CultuurNet\UDB3\Media;
use TwoDotsTwice\Collection\AbstractCollection;
use TwoDotsTwice\Collection\CollectionInterface;
use ValueObjects\Identity\UUID;
class ImageCollection extends AbstractCollection implements CollectionInterface
{
/**
* @var Image|null
*/
protected $mainImage;
... |
Fix bug in daenerys module:register command | <?php
declare(strict_types=1);
namespace LotGD\Core\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use LotGD\Core\Exceptions\ClassNotFoundException;
use LotGD\Core\Exceptions\ModuleAlreadyExistsException;
use LotGD\Core\LibraryConfiguration;... | <?php
declare(strict_types=1);
namespace LotGD\Core\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use LotGD\Core\Exceptions\ClassNotFoundException;
use LotGD\Core\Exceptions\ModuleAlreadyExistsException;
/**
* Danerys command to register ... |
Fix url of entries made by listdir on Windows.
git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1586 3942dd89-8c5d-46d7-aeed-044bccf3e60c | import logging
from flexget.plugin import register_plugin
log = logging.getLogger('listdir')
class InputListdir:
"""
Uses local path content as an input.
Example:
listdir: /storage/movies/
"""
def validator(self):
from flexget import validator
root = validator.f... | import logging
from flexget.plugin import *
log = logging.getLogger('listdir')
class InputListdir:
"""
Uses local path content as an input.
Example:
listdir: /storage/movies/
"""
def validator(self):
from flexget import validator
root = valid... |
Use more recent packages as minimum requirements | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
NAME = "pinax-blog"
DESCRIPTION = "a Django blog app"
AUTHOR = "Pinax Team"
AUTHO... | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
NAME = "pinax-blog"
DESCRIPTION = "a Django blog app"
AUTHOR = "Pinax Team"
AUTHO... |
Use AbstractEntry instead of EntryAbstractClass | """Placeholder model for Zinnia"""
import inspect
from cms.models.fields import PlaceholderField
from cms.plugin_rendering import render_placeholder
from zinnia.models_bases.entry import AbstractEntry
class EntryPlaceholder(AbstractEntry):
"""Entry with a Placeholder to edit content"""
content_placeholder ... | """Placeholder model for Zinnia"""
import inspect
from cms.models.fields import PlaceholderField
from cms.plugin_rendering import render_placeholder
from zinnia.models.entry import EntryAbstractClass
class EntryPlaceholder(EntryAbstractClass):
"""Entry with a Placeholder to edit content"""
content_placehol... |
Change dateutil to python-dateutil because some loser decided to rename it. (Thanks Leigh)
git-svn-id: 7187af8a85e68091b56e148623cc345c4eafc588@188 d723f978-dc38-0410-87ed-da353333cdcc | from setuptools import setup, find_packages
import sys, os
version = '0.4.4'
setup(name='twitter',
version=version,
description="An API and command-line toolset for Twitter (twitter.com)",
long_description=open("./README", "r").read(),
# Get strings from http://pypi.python.org/pypi?%3Aaction=l... | from setuptools import setup, find_packages
import sys, os
version = '0.4.3'
setup(name='twitter',
version=version,
description="An API and command-line toolset for Twitter (twitter.com)",
long_description=open("./README", "r").read(),
# Get strings from http://pypi.python.org/pypi?%3Aaction=l... |
Make django-sortable install, pypi package is broken. | import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = 'RecordExpress',
version = '0.0',
packages = ['collectio... | import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = 'RecordExpress',
version = '0.0',
packages = ['collectio... |
Add SSL option to work with modified Gaufrette that use SSL/TSL FTP | <?php
namespace Knp\Bundle\GaufretteBundle\DependencyInjection\Factory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
/**
... | <?php
namespace Knp\Bundle\GaufretteBundle\DependencyInjection\Factory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
/**
... |
III-709: Use String instead of fully namespaced equivalent | <?php
namespace CultuurNet\UDB3\EventExport\Command;
use CultuurNet\Deserializer\JSONDeserializer;
use CultuurNet\Deserializer\MissingValueException;
use CultuurNet\UDB3\EventExport\EventExportQuery;
use ValueObjects\String\String;
use ValueObjects\Web\EmailAddress;
abstract class ExportEventsJSONDeserializer extend... | <?php
namespace CultuurNet\UDB3\EventExport\Command;
use CultuurNet\Deserializer\JSONDeserializer;
use CultuurNet\Deserializer\MissingValueException;
use CultuurNet\UDB3\EventExport\EventExportQuery;
use ValueObjects\String\String;
use ValueObjects\Web\EmailAddress;
abstract class ExportEventsJSONDeserializer extend... |
Remove extra margin around SVG images | import React, { PropTypes, PureComponent } from 'react';
import { View, Platform, WebView, ActivityIndicator } from 'react-native';
export default class SVGImage extends PureComponent {
static propTypes = {
style: PropTypes.any,
source: PropTypes.shape({
uri: PropTypes.string,
}).isRequired,
sh... | import React, { PropTypes, PureComponent } from 'react';
import { View, Platform, WebView, ActivityIndicator } from 'react-native';
export default class SVGImage extends PureComponent {
static propTypes = {
style: PropTypes.any,
source: PropTypes.shape({
uri: PropTypes.string,
}).isRequired,
sh... |
fix(shop): Insert link type and category in home page
Insert link type and category in home page
see #386 | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
@foreach ($types as $type)
<a href="{{ route('showProductByType', ['id' => $type->id] ) }}"><h3>{{ $type->name }}</h3></a>
<div class="panel-group">
... | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
@foreach ($types as $type)
<h3>{{ $type->name }}</h3>
<div class="panel-group">
@foreach ($type->categories(['limit' => 2]) as $categ... |
Align with ASM Comics layout (which is the old ASM Hentai Layout...) | package me.devsaki.hentoid.parsers.images;
import androidx.annotation.NonNull;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import me.devsaki.hentoid.database.domains.Content;
import static me.devsaki.hentoid.util.... | package me.devsaki.hentoid.parsers.images;
import androidx.annotation.NonNull;
import org.jsoup.nodes.Document;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import me.devsaki.hentoid.database.domains.Content;
import static me.devsaki.hentoid.util.network.HttpHelper.getOnlineDocume... |
Use OPPS_MULTISITE_ADMIN on queryset AdminViewPermission | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.conf import settings
from django.utils import timezone
from .models import SitePermission
class AdminViewPermission(admin.ModelAdmin):
def queryset(self, request):
queryset = super(AdminViewPermission, self).query... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.conf import settings
from django.utils import timezone
from .models import SitePermission
class AdminViewPermission(admin.ModelAdmin):
def queryset(self, request):
queryset = super(AdminViewPermission, self).query... |
Support ipv6 for status endpoint security | package org.apereo.cas.configuration.model.core.web.security;
import org.springframework.core.io.Resource;
/**
* This is {@link AdminPagesSecurityProperties}.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
public class AdminPagesSecurityProperties {
private String ip = "127\\.0\\.0\\.1|0:0:0:0:0:0:0:1";
... | package org.apereo.cas.configuration.model.core.web.security;
import org.springframework.core.io.Resource;
/**
* This is {@link AdminPagesSecurityProperties}.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
public class AdminPagesSecurityProperties {
private String ip = "127\\.0\\.0\\.1";
private String a... |
Check on type rather than method exist | <?php
namespace PhpSpec\Formatter\Html;
use PhpSpec\Formatter\Presenter\StringPresenter;
use Exception;
use PhpSpec\Exception\Exception as PhpSpecException;
class HtmlPresenter extends StringPresenter
{
public function presentException(Exception $exception, $verbose = false)
{
if ($exception instance... | <?php
namespace PhpSpec\Formatter\Html;
use PhpSpec\Formatter\Presenter\StringPresenter;
use Exception;
class HtmlPresenter extends StringPresenter
{
public function presentException(Exception $exception, $verbose = false)
{
if (method_exists($exception, 'getCause')) {
list($file, $line) ... |
Use non default args for proc_open | <?php
namespace Aztech\Process;
class ProcessBuilder
{
private $command;
private $args = [];
private $env = null;
private $workingDirectory = null;
public function setCommand($executablePath)
{
$this->command = $executablePath;
return $this;
}
public function get... | <?php
namespace Aztech\Process;
class ProcessBuilder
{
private $command;
private $args = [];
private $env = null;
public function setCommand($executablePath)
{
$this->command = $executablePath;
return $this;
}
public function getCommand()
{
return $this->c... |
Resolve in over array values | package org.hcjf.layers.query;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
/**
* @author javaito
* @mail javaito@gmail.com
*/
public class In extends FieldEvaluator {
public In(String fieldName, Object value) {
super(fieldName, value);
}
@Override
public bo... | package org.hcjf.layers.query;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
/**
* @author javaito
* @mail javaito@gmail.com
*/
public class In extends FieldEvaluator {
public In(String fieldName, Object value) {
super(fieldName, value);
}
@Override
public bo... |
Update module loader for Python 3.4+ | import sys
import types
import unittest
if sys.version_info >= (3, 4):
from importlib.machinery import SourceFileLoader
loader = SourceFileLoader('rollbar-agent', './rollbar-agent')
rollbar_agent = types.ModuleType(loader.name)
loader.exec_module(rollbar_agent)
else:
import imp
rollbar_agent = ... | import unittest
import imp
rollbar_agent = imp.load_source('rollbar-agent', './rollbar-agent')
class FakeScanner:
def __init__(self, config):
self.config = config
class TestDefaultMessageStartParserUsage(unittest.TestCase):
app = {'name': 'pyramid',
'config': {
'log_format... |
Fix propel config for now | <?php
namespace FOS\ElasticaBundle\Propel;
use FOS\ElasticaBundle\Provider\AbstractProvider;
/**
* Propel provider.
*
* @author William Durand <william.durand1@gmail.com>
*/
class Provider extends AbstractProvider
{
/**
* {@inheritDoc}
*/
public function doPopulate($options, \Closure $loggerClo... | <?php
namespace FOS\ElasticaBundle\Propel;
use FOS\ElasticaBundle\Provider\AbstractProvider;
/**
* Propel provider.
*
* @author William Durand <william.durand1@gmail.com>
*/
class Provider extends AbstractProvider
{
/**
* {@inheritDoc}
*/
public function doPopulate($options, \Closure $loggerClo... |
Make the test robust against usage for comparisons between minor Python versions.
Typically, for Wine, I have an older version installed, than my Debian has, and
this then fails the test without strict need. | # Copyright 2012, Kay Hayen, mailto:kayhayen@gmx.de
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | # Copyright 2012, Kay Hayen, mailto:kayhayen@gmx.de
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
Add tasks/build_from_config to the public API. | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by Ecpy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------------... | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by Ecpy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------------... |
Update rest of functions with new data structure; Passes Test 8 | #!/usr/bin/env python
import sys
class Grid(object):
def __init__(self):
self.board = [[None] * 10 for i in range(22)]
self.score = 0
self.lines_clear = 0
def draw_board(self):
current_board = self.board
for row in current_board:
row = map(lambda... | #!/usr/bin/env python
import sys
class Grid(object):
def __init__(self):
self.board = [[None] * 10 for i in range(22)]
self.score = 0
self.lines_clear = 0
def draw_board(self):
current_board = self.board
for row in current_board:
row = map(lambda... |
Sort repository regex paths by longest first | <?php
namespace Gitlist\Util;
use Silex\Application;
class Routing
{
protected $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function getRepositoryRegex()
{
static $regex = null;
if ($regex === null) {
$app = $this->ap... | <?php
namespace Gitlist\Util;
use Silex\Application;
class Routing
{
protected $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function getRepositoryRegex()
{
static $regex = null;
if ($regex === null) {
$app = $this->ap... |
Trim the S3 prefix on both sides just to be on the safe side | <?php
namespace Jalle19\VagrantRegistryGenerator\Configuration;
use Symfony\Component\Console\Input\InputInterface;
/**
* Class Parser
* @package Jalle19\VagrantRegistryGenerator\Configuration
*/
class Parser
{
/**
* @param InputInterface $input
*
* @return Configuration
*/
public sta... | <?php
namespace Jalle19\VagrantRegistryGenerator\Configuration;
use Symfony\Component\Console\Input\InputInterface;
/**
* Class Parser
* @package Jalle19\VagrantRegistryGenerator\Configuration
*/
class Parser
{
/**
* @param InputInterface $input
*
* @return Configuration
*/
public sta... |
Update test that it runs | import unittest
from performance.web import Request, RequestTypeError, RequestTimeError
class RequestTestCase(unittest.TestCase):
def setUp(self):
self.url = 'http://www.google.com'
def test_constants(self):
self.assertEqual('get', Request.GET)
self.assertEqual('post', Request.POST)
... | import unittest
from performance.web import Request, RequestTypeError, RequestTimeError
class RequestTestCase(unittest.TestCase):
def setUp(self):
self.url = 'http://www.google.com'
def test_constants(self):
self.assertEqual('get', Request.GET)
self.assertEqual('post', Request.POST)
... |
Clarify that the MathJax comment is Notebook specific. | """Simple magics for display formats"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----... | """Simple magics for display formats"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----... |
Fix Ghost icon is not clickable
closes #3623
- Initialization of the link was done on login page where the ‚burger‘
did not exist.
- initialization in application needs to be done to make it work on
refresh | import {mobileQuery, responsiveAction} from 'ghost/utils/mobile';
var PostsView = Ember.View.extend({
target: Ember.computed.alias('controller'),
classNames: ['content-view-container'],
tagName: 'section',
mobileInteractions: function () {
Ember.run.scheduleOnce('afterRender', this, function (... | import {mobileQuery, responsiveAction} from 'ghost/utils/mobile';
var PostsView = Ember.View.extend({
target: Ember.computed.alias('controller'),
classNames: ['content-view-container'],
tagName: 'section',
mobileInteractions: function () {
Ember.run.scheduleOnce('afterRender', this, function (... |
Use an indexation method that works even for Magento <= 1.7 | <?php
class SPM_ShopyMind_Test_Observer
{
public function beforeTestStart()
{
if (Mage::app()->getStore()->isAdmin()) {
$store = Mage::getModel('core/store')->load(1);
if (!$store->isEmpty()) {
$this->_setStore($store->getCode());
}
... | <?php
class SPM_ShopyMind_Test_Observer
{
public function beforeTestStart()
{
if (Mage::app()->getStore()->isAdmin()) {
$store = Mage::getModel('core/store')->load(1);
if (!$store->isEmpty()) {
$this->_setStore($store->getCode());
}
... |
Support for anonymous saved versions
This fixes a case when de API sends a version without user. There was a
bug allowing to create anonymous versions in the application and we
have to support the old data.
The problem here is that SnapshotInfo classes are inflated from json
via Gson. This method does not call any co... | package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;
import uk.ac.ic.wlgitbridge.util.Util;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotInfo implements Comparable<SnapshotInfo> {
private int versionId;
private String comment;
private WLUser user;
private String createdAt;
publ... | package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;
import uk.ac.ic.wlgitbridge.util.Util;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotInfo implements Comparable<SnapshotInfo> {
private int versionId;
private String comment;
private WLUser user;
private String createdAt;
publ... |
Remove Telescope service provider registration | <?php
namespace RadDB\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\DuskServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
... | <?php
namespace RadDB\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\DuskServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
... |
Add function to calculate distance between points | <?php
namespace GeoTools\Model;
final class Point2D
{
/**
* @var double
*/
public $x;
/**
* @var double
*/
public $y;
/**
* @param double $x
* @param double $y
*/
public function __construct($x, $y)
{
$this->x = $x;
$this->y = $y;
}
... | <?php
namespace GeoTools\Model;
final class Point2D
{
/**
* @var double
*/
public $x;
/**
* @var double
*/
public $y;
/**
* @param double $x
* @param double $y
*/
public function __construct($x, $y)
{
$this->x = $x;
$this->y = $y;
}
... |
Throw errors if either arg is wrong | var async = require('async');
var DoWhen = function(obj, ev) {
var objCallback,
triggerCallbacks,
args = null,
callbacks = [];
if (typeof(obj) != 'undefined') {
throw TypeError('obj argument must be an EventEmitter-like object');
}
if (typeof(ev) == 'undefined') {
... | var async = require('async');
var DoWhen = function(obj, ev) {
var objCallback,
triggerCallbacks,
args = null,
callbacks = [];
if (typeof(obj) == 'undefined') {
// error
}
if (typeof(ev) == 'undefined') {
//error
}
triggerCallbacks = function() {
... |
Include the entire existing environment for integration tests subprocesses | import copy
import multiprocessing
import os
from pathlib import PurePath
import subprocess
import sys
import tempfile
from textwrap import dedent
import unittest
try:
from unittest.mock import MagicMock
except:
from mock import MagicMock
from green import cmdline
class TestFinalizer(unittest.TestCase):
... | import multiprocessing
import os
from pathlib import PurePath
import subprocess
import sys
import tempfile
from textwrap import dedent
import unittest
try:
from unittest.mock import MagicMock
except:
from mock import MagicMock
from green import cmdline
class TestFinalizer(unittest.TestCase):
def setUp(s... |
Make GA user id persistent across database resets and app_key resets | <?php
namespace OpenDominion\Http\Middleware;
use Analytics;
use Closure;
use Illuminate\Support\Facades\Auth;
class Authenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixe... | <?php
namespace OpenDominion\Http\Middleware;
use Analytics;
use Closure;
use Illuminate\Support\Facades\Auth;
class Authenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixe... |
Use repr() instead of str() for printing | import traceback
import sys
import logging
# always print stuff on the screen:
logging.basicConfig(level=logging.INFO)
def log_exception(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
logging.info("Exception raised")
etype, value,... | import traceback
import sys
import logging
# always print stuff on the screen:
logging.basicConfig(level=logging.INFO)
def log_exception(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
logging.info("Exception raised")
etype, value,... |
Rename lock to _lock to imply that it's private.
tilequeue/queue/file.py
-The `lock` instance variable shouldn't be used outside of the
`OutputFileQueue`'s methods. | from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage
import threading
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
self._lock = threading.RLock()
def enqueue(self, coord):
with self._lock:
payload = serialize_coord(coord)
... | from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage
import threading
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
self.lock = threading.RLock()
def enqueue(self, coord):
with self.lock:
payload = serialize_coord(coord)
... |
Correct directory names in test sample of javascript validator | /*
tests validator.js implementation.
steps to run this test:
1. install mocha
$ npm install -g mocha
2. run RedPen in server mode
$ cd $REDPEN_HOME/bin
$ ./redpen-server
3. rename validator.js.example to enable the validator implementation
$ cd $REDPEN_HOME/js
$ mv validator.js.example validator.js
4. run... | /*
tests validator.js implementation.
steps to run this test:
1. install mocha
$ npm install -g mocha
2. run RedPen in server mode
$ cd $REDPEN_HOME/bin
$ ./redpen-server
3. rename validator.js.example to enable the validator implementation
$ cd $REDPEN_HOME/sample
$ mv validator.js.example validator.js
4.... |
Add sl-bootstrap to blueprint bower includes | /* globals module */
module.exports = {
afterInstall: function() {
var self = this;
return this.addBowerPackageToProject( 'bootstrap-datepicker' )
.then( function() {
return self.addBowerPackageToProject( 'momentjs' );
})
.then( function() {
... | /* globals module */
module.exports = {
afterInstall: function() {
var self = this;
return this.addBowerPackageToProject( 'bootstrap-datepicker' )
.then( function() {
return self.addBowerPackageToProject( 'momentjs' );
})
.then( function() {
... |
Fix python 2 unicode issue. | from django.utils import six
from debug_toolbar_multilang.pseudo import STR_FORMAT_PATTERN, \
STR_FORMAT_NAMED_PATTERN
from debug_toolbar_multilang.pseudo.pseudo_language import PseudoLanguage
class ExpanderPseudoLanguage(PseudoLanguage):
"""
Pseudo Language for expanding the strings. This is useful
f... | from django.utils import six
from debug_toolbar_multilang.pseudo import STR_FORMAT_PATTERN, \
STR_FORMAT_NAMED_PATTERN
from debug_toolbar_multilang.pseudo.pseudo_language import PseudoLanguage
class ExpanderPseudoLanguage(PseudoLanguage):
"""
Pseudo Language for expanding the strings. This is useful
f... |
Correct bug in var declarations | (function($) {
return $.fn.noiseGen = function(options) {
var defaultOptions = {
width: 32,
height: 32,
opacity: 0.2,
fallbackImage: false,
depth: 60
},
canvas = document.createElement("canvas");
options = $.extend(defaultOptions, options);
if (!canvas.getContext || !... | (function($) {
return $.fn.noiseGen = function(options) {
var defaultOptions = {
width: 32,
height: 32,
opacity: 0.2,
fallbackImage: false,
depth: 60
},
canvas = document.createElement("canvas"),
options = $.extend(defaultOptions, options);
if (!canvas.getContext || !... |
Fix pre/post plugins for generateSVGOConfig helper not being overwritten properly | const svgo = require('svgo');
const { omit, concat, uniqBy } = require('lodash');
const { merge } = require('webpack-merge');
module.exports = (options, pre = [], post = []) => {
try {
// The preset-default plugin is only available since SVGO 2.4.0
svgo.optimize('', {
plugins: [{
... | const svgo = require('svgo');
const { omit, concat, uniqBy } = require('lodash');
const { merge } = require('webpack-merge');
module.exports = (options, pre = [], post = []) => {
try {
// The preset-default plugin is only available since SVGO 2.4.0
svgo.optimize('', {
plugins: [{
... |
Use raw parsing mode for asset_compress.ini
This will avoid parsing issues due to special characters like "^" in URLs. | <?php
declare(strict_types=1);
use Cake\Core\Plugin;
// The function `parse_ini_file` may be disabled
$assets = parse_ini_string(
file_get_contents(dirname(__FILE__) . '/asset_compress.ini'),
true,
INI_SCANNER_RAW
);
// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.css'][... | <?php
declare(strict_types=1);
use Cake\Core\Plugin;
// The function `parse_ini_file` may be disabled
$assets = parse_ini_string(file_get_contents(dirname(__FILE__) . '/asset_compress.ini'), true);
// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.css']['files'] as $i => $file) {
... |
Add proper region name for the Overwatch rank command | 'use strict';
const DiscordCommand = require('../../../../bot/modules/DiscordCommand');
const models = require('../../../models');
class CommandRank extends DiscordCommand {
constructor(bot) {
super(bot, 'rank', ['rank']);
}
async onCommand(message) {
const bot = this.getBot();
... | 'use strict';
const DiscordCommand = require('../../../../bot/modules/DiscordCommand');
const models = require('../../../models');
class CommandRank extends DiscordCommand {
constructor(bot) {
super(bot, 'rank', ['rank']);
}
async onCommand(message) {
const bot = this.getBot();
... |
Make assertions more resilient to text wrapping
Running tests in isolation vs not in isolation may cause text to wrap at a different line width. | <?php
namespace Tests\Concerns;
use PHPUnit\Framework\Assert;
use Illuminate\Support\Collection;
class ArtisanResult
{
private $output;
private $status;
private $parameters;
public function __construct($parameters, $output, $status)
{
$this->output = $output;
$this->status = $sta... | <?php
namespace Tests\Concerns;
use PHPUnit\Framework\Assert;
use Illuminate\Support\Collection;
class ArtisanResult
{
private $output;
private $status;
private $parameters;
public function __construct($parameters, $output, $status)
{
$this->output = $output;
$this->status = $sta... |
Replace locale parameter by default_locale | <?php
namespace Alpixel\Bundle\CMSBundle\Twig\Extension;
use Alpixel\Bundle\CMSBundle\Entity\NodeInterface;
use Alpixel\Bundle\CMSBundle\Helper\CMSHelper;
class CMSExtension extends \Twig_Extension
{
protected $contentTypes;
protected $container;
protected $cmsHelper;
public function __construct(CMS... | <?php
namespace Alpixel\Bundle\CMSBundle\Twig\Extension;
use Alpixel\Bundle\CMSBundle\Entity\NodeInterface;
use Alpixel\Bundle\CMSBundle\Helper\CMSHelper;
class CMSExtension extends \Twig_Extension
{
protected $contentTypes;
protected $container;
protected $cmsHelper;
public function __construct(CMS... |
Use the async version of buildMatcher for the middleware loading | var metaRouter = require('../');
var DataHolder = require('raptor-async/DataHolder');
var nodePath = require('path');
module.exports = function matchFactory(routes) {
var matcher;
var matcherDataHolder;
if (typeof routes === 'string') {
routes = nodePath.resolve(process.cwd(), routes);
mat... | var metaRouter = require('../');
var routesLoader = require('../lib/routes-loader');
var DataHolder = require('raptor-async/DataHolder');
var nodePath = require('path');
module.exports = function matchFactory(routes) {
var matcher;
var matcherDataHolder;
if (typeof routes === 'string') {
routes = ... |
Stop cassandra from deleting documents, delete documents from old index as well | import logging
from scripts.util import documents
from scrapi import settings
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
from scrapi.tasks import normalize, process_normalized, process_raw
logger = logging.getLogger(__name__)
def rename(source, target, dry=True):
asser... | import logging
from scripts.util import documents
from scrapi import settings
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
from scrapi.tasks import normalize, process_normalized, process_raw
logger = logging.getLogger(__name__)
def rename(source, target, dry=True):
asser... |
Fix bug on country joint | <?php
namespace WBB\BarBundle\Repository;
use WBB\BarBundle\Entity\Ad;
use WBB\CoreBundle\Repository\EntityRepository;
/**
* AdRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class AdRepository extends EntityRepository
{
public function findOne... | <?php
namespace WBB\BarBundle\Repository;
use WBB\BarBundle\Entity\Ad;
use WBB\CoreBundle\Repository\EntityRepository;
/**
* AdRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class AdRepository extends EntityRepository
{
public function findOne... |
Update map state to props to destructure meals | import React, { Component } from 'react'
import { connect } from 'react-redux'
import Meal from '../views/Meal'
import NewMeal from '../components/NewMeal'
import { Container } from 'semantic-ui-react'
import { Link, Route, Switch } from 'react-router-dom'
import { css } from 'glamor'
class MealsContainer extends Comp... | import React, { Component } from 'react'
import { connect } from 'react-redux'
import Meal from '../views/Meal'
import NewMeal from '../components/NewMeal'
import { Container } from 'semantic-ui-react'
import { Link, Route, Switch } from 'react-router-dom'
import { css } from 'glamor'
class MealsContainer extends Comp... |
[THEIA] Replace Bing maps by OpenStreetMap to avoid licensing issue | (function(c) {
/*
* !!! CHANGE THIS !!!
*/
c["general"].rootUrl = '//localhost/resto2/';
/*
* !! DO NOT EDIT UNDER THIS LINE !!
*/
c["general"].serverRootUrl = null;
c["general"].proxyUrl = null;
c["general"].confirmDeletion = false;
c["general"].themePath = "/js/li... | (function(c) {
/*
* !!! CHANGE THIS !!!
*/
c["general"].rootUrl = '//localhost/resto2/';
/*
* !! DO NOT EDIT UNDER THIS LINE !!
*/
c["general"].serverRootUrl = null;
c["general"].proxyUrl = null;
c["general"].confirmDeletion = false;
c["general"].themePath = "/js/li... |
Add argparse as a requirement if not built in | """ Setup file """
import os
from setuptools import setup, find_packages
from version_helper import git_version
HERE = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(HERE, 'README.rst')).read()
CHANGES = open(os.path.join(HERE, 'CHANGES.txt')).read()
REQUIREMENTS = [
'mock',
]
# Python 2... | """ Setup file """
import os
from setuptools import setup, find_packages
from version_helper import git_version
HERE = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(HERE, 'README.rst')).read()
CHANGES = open(os.path.join(HERE, 'CHANGES.txt')).read()
REQUIREMENTS = [
'mock',
]
if __name_... |
Add watch task to default | var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sh = require('shelljs');
var del = require('del');
var copyHTML = require('ionic-gulp-html-copy');
var requireDir = require('require-dir');
var gulpTask = requireDir('./gulp');
gulp.task... | var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sh = require('shelljs');
var del = require('del');
var copyHTML = require('ionic-gulp-html-copy');
var requireDir = require('require-dir');
var gulpTask = requireDir('./gulp');
gulp.task... |
Fix Mocked Datsetws missing the CrisId field | package org.datavaultplatform.common.metadata.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.datavaultplatform.common.model.Dataset;
import org.datavaultplatform.common.metadata.Provider;
// This mock metadata provider is for testing purposes only
... | package org.datavaultplatform.common.metadata.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.datavaultplatform.common.model.Dataset;
import org.datavaultplatform.common.metadata.Provider;
// This mock metadata provider is for testing purposes only
... |
Improve test of csvstack --filenames. | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... |
Make modulePrefix default a little more generic. |
module.exports = {
options: {
'v': {
type: 'boolean',
description: 'Verbose logging',
alias: 'verbose'
},
'd': {
type: 'string',
description: 'Output base directory',
alias: 'outputDir'
},
'f': {
... |
module.exports = {
options: {
'v': {
type: 'boolean',
description: 'Verbose logging',
alias: 'verbose'
},
'd': {
type: 'string',
description: 'Output base directory',
alias: 'outputDir'
},
'f': {
... |
Add check whether layout option is set | <?php
abstract class Layoutable {
/**
* associative array of layout settings
*
* @var array
*/
private $layout = array();
/**
* get array of layout settings
*
* @return array
*/
public function getLayout(){
return $this->layout;
}
/**
... | <?php
abstract class Layoutable {
/**
* associative array of layout settings
*
* @var array
*/
private $layout = array();
/**
* get array of layout settings
*
* @return array
*/
public function getLayout(){
return $this->layout;
}
/**
... |
Update test requirement for PTB | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Developers",
author_email="developers@pinaxproject.c... | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Developers",
author_email="developers@pinaxproject.c... |
Add nice database close for RSS | var _ = require('lodash'),
async = require('async'),
checkForFiling = require('./check'),
request = require('request'),
models = require('../../models'),
parser = require('rss-parser');
// var interval = 60000;
function queueFilingsToCheck() {
console.log('checking RSS');
parser.parseURL... | var _ = require('lodash'),
async = require('async'),
checkForFiling = require('./check'),
request = require('request'),
models = require('../../models'),
parser = require('rss-parser');
// var interval = 60000;
function queueFilingsToCheck() {
console.log('checking RSS');
parser.parseURL... |
Fix pay command always sending 0.
Closes #197
Closes #193 | package org.gestern.gringotts.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import static org.gestern.gringotts.Language.LANG;
/**
* Player commands.
*/
public class MoneyExecutor extends GringottsAbstractExecutor {
@Override
public ... | package org.gestern.gringotts.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import static org.gestern.gringotts.Language.LANG;
/**
* Player commands.
*/
public class MoneyExecutor extends GringottsAbstractExecutor {
@Override
public ... |
Replace deprecated "empty_value" form option with "placeholder". | <?php
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2016, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\Form\... | <?php
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2016, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\Form\... |
Fix stupid possible compiler error. | package cpw.mods.fml.common.network.handshake;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.AttributeKey;
public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
... | package cpw.mods.fml.common.network.handshake;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.AttributeKey;
public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.