text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Set language choices based on user locale. | 'use strict';
/**
* @ngdoc directive
* @name translapediaApp.directive:translateInput
* @description
* # translateInput
*/
angular.module('translapediaApp')
.directive('translateInput', function () {
return {
restrict: 'E',
templateUrl: 'views/directives/translate-input.html',
controller: functi... | 'use strict';
/**
* @ngdoc directive
* @name translapediaApp.directive:translateInput
* @description
* # translateInput
*/
angular.module('translapediaApp')
.directive('translateInput', function () {
return {
restrict: 'E',
templateUrl: 'views/directives/translate-input.html',
controller: functi... |
Add further constrains to create_dataset
To clarify that it capped_size must be zero or a positive integer. | from __future__ import unicode_literals
import json
import requests
from django.conf import settings
class BackdropError(Exception):
pass
def create_dataset(name, capped_size):
"""
Connect to Backdrop and create a new collection called ``name``.
Specify ``capped_size`` in bytes to create a capped ... | from __future__ import unicode_literals
import json
import requests
from django.conf import settings
class BackdropError(Exception):
pass
def create_dataset(name, capped_size):
"""
Connect to Backdrop and create a new collection called ``name``.
Specify ``capped_size`` in bytes to create a capped ... |
Build in support for writing mha files. | """
DataWriter.py
"""
from DataController import DataController
from DataReader import DataReader
from vtk import vtkMetaImageWriter
from vtk import vtkXMLImageDataWriter
class DataWriter(DataController):
"""
DataWriter writes an image data object to
disk using the provided format.
"""
def __init__(self):
sup... | """
DataWriter.py
"""
from DataController import DataController
from DataReader import DataReader
from vtk import vtkMetaImageWriter
from vtk import vtkXMLImageDataWriter
class DataWriter(DataController):
"""
DataWriter writes an image data object to
disk using the provided format.
"""
def __init__(self):
sup... |
Add a property that allows the web server to start automatically during initialization | package com.aspectran.with.jetty;
import com.aspectran.core.component.bean.ablility.DisposableBean;
import com.aspectran.core.component.bean.ablility.InitializableBean;
import com.aspectran.core.util.logging.Log;
import com.aspectran.core.util.logging.LogFactory;
import org.eclipse.jetty.server.Server;
import org.ecli... | package com.aspectran.with.jetty;
import com.aspectran.core.component.bean.ablility.DisposableBean;
import com.aspectran.core.component.bean.ablility.InitializableBean;
import com.aspectran.core.util.logging.Log;
import com.aspectran.core.util.logging.LogFactory;
import org.eclipse.jetty.server.Server;
import org.ecli... |
Use README.md instead of README.rst | #-*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='zerows',
version='1.0.0',
description='We... | #-*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='zerows',
version='1.0.0',
description='W... |
Refactor carousel image references for better readability | app.controller('HomeController', ['$http', 'AuthFactory', function($http, AuthFactory) {
console.log('HomeController running');
var self = this;
self.userStatus = AuthFactory.userStatus;
self.dataArray = [
{ src: '../assets/images/carousel/genome-sm.jpg' },
{ src: '../assets/images/carousel/falkirk-whe... | app.controller('HomeController', ['$http', 'AuthFactory', function($http, AuthFactory) {
console.log('HomeController running');
var self = this;
self.userStatus = AuthFactory.userStatus;
self.dataArray = [{
src: '../assets/images/carousel/genome-sm.jpg'
},
{
src: '../assets/images/carousel/... |
Tweak layer list overflow settings to auto | // gerber file output component
'use strict'
const {h} = require('deku')
const GerberSettings = require('./gerber-settings')
const {LayerDefs} = require('../../layer/component')
module.exports = function renderGerberOutput({props}) {
const {layers, layerDisplayStates, renders, units} = props
const {
toggleVi... | // gerber file output component
'use strict'
const {h} = require('deku')
const GerberSettings = require('./gerber-settings')
const {LayerDefs} = require('../../layer/component')
module.exports = function renderGerberOutput({props}) {
const {layers, layerDisplayStates, renders, units} = props
const {
toggleVi... |
Use for...of loops where appropriate | 'use strict';
//
// --- Aggregator
//
function Aggregator(defaultTags) {
this.buffer = {};
this.defaultTags = defaultTags || [];
}
Aggregator.prototype.makeBufferKey = function(key, tags) {
tags = tags || [''];
return key + '#' + tags.concat().sort().join('.');
};
Aggregator.prototype.addPoint = fun... | 'use strict';
//
// --- Aggregator
//
function Aggregator(defaultTags) {
this.buffer = {};
this.defaultTags = defaultTags || [];
}
Aggregator.prototype.makeBufferKey = function(key, tags) {
tags = tags || [''];
return key + '#' + tags.concat().sort().join('.');
};
Aggregator.prototype.addPoint = fun... |
Add missing redirect after POST in product details | from __future__ import unicode_literals
from django.http import HttpResponsePermanentRedirect
from django.contrib import messages
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _
from .forms import Product... | from __future__ import unicode_literals
from django.http import HttpResponsePermanentRedirect
from django.contrib import messages
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _
from .forms import ProductForm
from ... |
Add Python 3 to supported platforms | # -*- coding: utf-8 -*-
"""
nose-notify
~~~~~~~~~~~
A nose plugin to display testsuite progress in the notify osd.
:copyright: 2010, Pascal Hartig <phartig@rdrei.net>
:license: BSD, see LICENSE for more details
"""
from setuptools import setup
from nosenotify import __version__
setup(
name="nose-notify",
... | # -*- coding: utf-8 -*-
"""
nose-notify
~~~~~~~~~~~
A nose plugin to display testsuite progress in the notify osd.
:copyright: 2010, Pascal Hartig <phartig@rdrei.net>
:license: BSD, see LICENSE for more details
"""
from setuptools import setup
from nosenotify import __version__
setup(
name="nose-notify",
... |
Remove ranking from denormalization command | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **options):
vs = Convention.objects.all()
for v... | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **options):
vs = Convention.objects.all()
for v... |
Determine GPU presence on workers based on instance metadata | """
Grab worker configuration from GCloud instance attributes.
"""
import json
import requests
MANAGER_URL_METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/halite-manager-url"
SECRET_FOLDER_METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/hal... | """
Grab worker configuration from GCloud instance attributes.
"""
import json
import requests
MANAGER_URL_METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/halite-manager-url"
SECRET_FOLDER_METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/hal... |
stdlib: Make api directly available in stdlib | """
:py:mod:`leapp.libraries.stdlib`
represents a location for functions that otherwise would be defined multiple times across leapp actors
and at the same time, they are really useful for other actors.
"""
import six
import subprocess
import os
from leapp.libraries.stdlib import api
def call(args, split=True):
... | """
:py:mod:`leapp.libraries.stdlib`
represents a location for functions that otherwise would be defined multiple times across leapp actors
and at the same time, they are really useful for other actors.
"""
import six
import subprocess
import os
def call(args, split=True):
"""
Call an external program, captur... |
Test fail not to deploy | from django.test import TestCase
from django.urls import reverse
from .models import Post
# Create your tests here.
class PostModelTest(TestCase):
def test_render_markdown(self):
p = Post(content='aa')
self.assertEqual(p.html_content, '<p>aa</p>\n')
class PostViewTest(TestCase):
def test_p... | from django.test import TestCase
from django.urls import reverse
from .models import Post
# Create your tests here.
class PostModelTest(TestCase):
def test_render_markdown(self):
p = Post(content='aa')
self.assertEqual(p.html_content, '<p>aa</p>\n')
class PostViewTest(TestCase):
def test_p... |
Fix the memory leak issue on idle timeout | /**
* Emulates stream.setTimeout() behaviour, but respects outgoing data
* too.
*
* @param {Number} timeout Milliseconds
*/
exports.attach = function(stream, timeout) {
var timer;
var emitTimeout = function() {
timer = undefined;
stream.emit('timeout');
};
var updateTimer = function... | /**
* Emulates stream.setTimeout() behaviour, but respects outgoing data
* too.
*
* @param {Number} timeout Milliseconds
*/
exports.attach = function(stream, timeout) {
var timer;
var emitTimeout = function() {
timer = undefined;
stream.emit('timeout');
};
var updateTimer = function... |
Revert "fix transfer form unlock wallet issue"
This reverts commit 9510fcaea98c9f569c0176500efebcbc0d648a8a. | import alt from "alt-instance"
import WalletUnlockActions from "actions/WalletUnlockActions"
import WalletDb from "stores/WalletDb"
class WalletUnlockStore {
constructor() {
this.bindActions(WalletUnlockActions)
this.state = {locked: true}
}
onUnlock({resolve, reject}) {
/... | import alt from "alt-instance"
import WalletUnlockActions from "actions/WalletUnlockActions"
import WalletDb from "stores/WalletDb"
class WalletUnlockStore {
constructor() {
this.bindActions(WalletUnlockActions)
this.state = {locked: true}
}
onUnlock({resolve, reject}) {
l... |
Add directory for state files | #!/usr/bin/env python
# Copyright 2015 University of Chicago
# Available under Apache 2.0 License
from distutils.core import setup
setup(name='htcondor-es-probes',
version='0.6.3',
description='HTCondor probes for Elasticsearch analytics',
author='Suchandra Thapa',
author_email='sthapa@ci.uch... | #!/usr/bin/env python
# Copyright 2015 University of Chicago
# Available under Apache 2.0 License
from distutils.core import setup
setup(name='htcondor-es-probes',
version='0.6.3',
description='HTCondor probes for Elasticsearch analytics',
author='Suchandra Thapa',
author_email='sthapa@ci.uch... |
Rename method and remove debugging code | var App = angular.module('Ohtu-Hatut', []);
App.controller('ReferenceController', function ($scope, $http) {
getReferences();
$scope.confirmDeletion = function (referenceId) {
console.log("got into deleteion");
if (confirm("Confirm deletion of reference") === true) {
... | var App = angular.module('Ohtu-Hatut', []);
App.controller('ReferenceController', function ($scope, $http) {
getReferences();
$scope.confirmDeletion = function (referenceId) {
console.log("got into deleteion");
if (confirm("Confirm deletion of reference") === true) {
... |
Fix Error: The method addTestSuite(Class<? extends TestCase>) in the type TestSuite is not applicable for the arguments (Class<TaskTemplateVariableResolver>)
TaskTemplateVariableResolver is now TaskTemplateResolverTest | /*******************************************************************************
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distributio... | /*******************************************************************************
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distributio... |
Introduce option to set text formField's value without triggering `change` | /**
* @class CM_FormField_Text
* @extends CM_FormField_Abstract
*/
var CM_FormField_Text = CM_FormField_Abstract.extend({
_class: 'CM_FormField_Text',
/** @type Boolean */
_skipTriggerChange: false,
events: {
'blur input': function() {
this.trigger('blur');
},
'focus input': function() {
this.trigg... | /**
* @class CM_FormField_Text
* @extends CM_FormField_Abstract
*/
var CM_FormField_Text = CM_FormField_Abstract.extend({
_class: 'CM_FormField_Text',
events: {
'blur input': function() {
this.trigger('blur');
},
'focus input': function() {
this.trigger('focus');
}
},
/**
* @param {String} valu... |
Allow cron jobs to be long lasting | <?php
/**
* This class provides some common cron controller functionality
*
* @package Nails
* @subpackage module-cron
* @category Controller
* @author Nails Dev Team
* @link
*/
namespace Nails\Cron\Controller;
class Base extends \MX_Controller
{
protected $oCronRouter;
// -------------... | <?php
/**
* This class provides some common cron controller functionality
*
* @package Nails
* @subpackage module-cron
* @category Controller
* @author Nails Dev Team
* @link
*/
namespace Nails\Cron\Controller;
class Base extends \MX_Controller
{
protected $oCronRouter;
// -------------... |
Fix session driver in cached config. | <?php namespace Illuminate\Foundation\Console;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ConfigCacheCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'config:cache';
/**
* The console command description.
*
* @var string... | <?php namespace Illuminate\Foundation\Console;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ConfigCacheCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'config:cache';
/**
* The console command description.
*
* @var string... |
Fix tests for the new config format used in the init command | <?php
namespace Liip\RMT\Tests\Functional;
use Symfony\Component\Yaml\Yaml;
class InitCommandTest extends RMTFunctionalTestBase
{
public function testInitConfig()
{
$configFile = '.rmt.yml';
unlink($configFile);
$this->assertFileNotExists($configFile);
exec('./RMT init --vcs=... | <?php
namespace Liip\RMT\Tests\Functional;
use Symfony\Component\Yaml\Yaml;
class InitCommandTest extends RMTFunctionalTestBase
{
public function testInitConfig()
{
$configFile = '.rmt.yml';
unlink($configFile);
$this->assertFileNotExists($configFile);
// $this->manualDebug();... |
Disable lint for line with unused var | /*eslint-disable react/no-danger*/
import React from "react";
import serialize from "serialize-javascript";
import path from "path";
import process from "process";
// Make sure path ends in forward slash
let assetPath = require(path.resolve(path.join(process.cwd(), "src", "config", "application"))).default.assetPath;
... | /*eslint-disable react/no-danger*/
import React from "react";
import serialize from "serialize-javascript";
import path from "path";
import process from "process";
// Make sure path ends in forward slash
let assetPath = require(path.resolve(path.join(process.cwd(), "src", "config", "application"))).default.assetPath;
... |
Fix missing table name in alter_table | """id(pirmary key) for torsion_init_mol
Revision ID: 1604623c481a
Revises: fb5bd88ae2f3
Create Date: 2020-07-02 18:42:17.267792
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1604623c481a"
down_revision = "fb5bd88ae2f3"
branch_labels = None
depends_on = None
... | """id(pirmary key) for torsion_init_mol
Revision ID: 1604623c481a
Revises: fb5bd88ae2f3
Create Date: 2020-07-02 18:42:17.267792
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1604623c481a"
down_revision = "fb5bd88ae2f3"
branch_labels = None
depends_on = None
... |
Use official OSI name in the license metadata
This makes it easier for automatic license checkers to verify the license of this package.
The license file is included in MANIFEST.in as is standard practice. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except:
from distutils.core import setup
long_description = ""
with open('README.rst') as f:
long_description = f.read()
setup(
name='ImageHash',
version='4.2.1',
author='Johannes Buchner',
author_email='buchn... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except:
from distutils.core import setup
long_description = ""
with open('README.rst') as f:
long_description = f.read()
setup(
name='ImageHash',
version='4.2.1',
author='Johannes Buchner',
author_email='buchn... |
Change code to be PEP-8 compliant | #
# Copyright 2014-2015 Boundary, Inc.
#
# 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 in... | ###
### Copyright 2014-2015 Boundary, Inc.
###
### 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... |
Make \r in topics optional | package de.tuberlin.dima.schubotz.fse.mappers;
import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Cleans main task queries. TODO find way to do this using stratosphere built in da... | package de.tuberlin.dima.schubotz.fse.mappers;
import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Cleans main task queries. TODO find way to do this using stratosphere built in da... |
Fix typo in fxml name | package com.annimon.jmr;
import com.annimon.jmr.controllers.MainController;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
... | package com.annimon.jmr;
import com.annimon.jmr.controllers.MainController;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
... |
Bump to next dev 0.1.2.dev1 | #!/usr/bin/env python3
# encoding: utf-8
from setuptools import setup, find_packages
setup(
name='pyatv',
version='0.1.2.dev1',
license='MIT',
url='https://github.com/postlund/pyatv',
author='Pierre Ståhl',
author_email='pierre.staahl@gmail.com',
description='Library for controlling an App... | #!/usr/bin/env python3
# encoding: utf-8
from setuptools import setup, find_packages
setup(
name='pyatv',
version='0.1.1',
license='MIT',
url='https://github.com/postlund/pyatv',
author='Pierre Ståhl',
author_email='pierre.staahl@gmail.com',
description='Library for controlling an Apple TV... |
Rename method 'testExample' to 'testRegister' | <?php
use App\UserRegistrationRequest;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class RegisterTest extends TestCase
{
use DatabaseMigrations;
/**
* A basic test example.
*/
public function testRegister()
{
$code = new UserRegistrationRequest();
$code->id = 1234567;
$cod... | <?php
use App\UserRegistrationRequest;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class RegisterTest extends TestCase
{
use DatabaseMigrations;
/**
* A basic test example.
*/
public function testExample()
{
$code = new UserRegistrationRequest();
$code->id = 1234567;
$code... |
Add date range filter to short url repository interface | <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Repository;
use Doctrine\Common\Persistence\ObjectRepository;
use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
interface ShortUrlRepositoryInterface extends ObjectRepository
{
/**
* Gets a list of elements usi... | <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Repository;
use Doctrine\Common\Persistence\ObjectRepository;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
interface ShortUrlRepositoryInterface extends ObjectRepository
{
/**
* Gets a list of elements using provided filtering data
*
* @p... |
Fix parsing when style specified, add 'auto' score | """Docstring parsing."""
from . import rest
from .common import ParseError, Docstring
_styles = {"rest": rest.parse}
def _parse_score(docstring: Docstring) -> int:
"""
Produce a score for the parsing.
:param Docstring docstring: parsed docstring representation
:returns int: parse score, higher is ... | """Docstring parsing."""
from . import rest
from .common import ParseError
_styles = {"rest": rest.parse}
def parse(text: str, style: str = "auto"):
"""
Parse the docstring into its components.
:param str text: docstring text to parse
:param text style: docstring style, choose from: 'rest', 'auto'... |
Fix (Observation test): change methode name | <?php
namespace AppBundle\TestsService;
use AppBundle\Service\ObservationService;
use AppBundle\Entity\Observation;
use PHPUnit\Framework\TestCase;
use OC\BookingBundle\Service\Utils;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
... | <?php
namespace AppBundle\TestsService;
use AppBundle\Service\ObservationService;
use AppBundle\Entity\Observation;
use PHPUnit\Framework\TestCase;
use OC\BookingBundle\Service\Utils;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
... |
Fix typo in compat mode attrs test. | import View from "ember-views/views/view";
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
import compile from "ember-template-compiler/system/compile";
import Registry from "container/registry";
var view, registry, container;
QUnit.module("ember-views: attrs-proxy", {
setup() {
registry = ne... | import View from "ember-views/views/view";
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
import compile from "ember-template-compiler/system/compile";
import Registry from "container/registry";
var view, registry, container;
QUnit.module("ember-views: attrs-proxy", {
setup() {
registry = ne... |
Update HTMLManager in the documentation
Signed-off-by: martinRenou <a8278cece597ec79cc59974d3d55dbb79bb38416@gmail.com> | # -*- coding: utf-8 -*-
import sphinx_rtd_theme
extensions = [
# 'sphinx.ext.autodoc',
# 'sphinx.ext.intersphinx',
# 'sphinx.ext.autosummary',
# 'sphinx.ext.viewcode',
# 'sphinx.ext.napoleon',
# 'jupyter_sphinx.embed_widgets',
]
templates_path = ['_templates']
def setup(app):
app.add_jav... | # -*- coding: utf-8 -*-
import sphinx_rtd_theme
extensions = [
# 'sphinx.ext.autodoc',
# 'sphinx.ext.intersphinx',
# 'sphinx.ext.autosummary',
# 'sphinx.ext.viewcode',
# 'sphinx.ext.napoleon',
# 'jupyter_sphinx.embed_widgets',
]
templates_path = ['_templates']
def setup(app):
app.add_jav... |
Allow new blocks to be reloaded. | const { clone, pull } = require('./lib/git')
const path = require('path')
const jetpack = require('fs-jetpack')
const freshRequire = require('./lib/freshRequire')
const configuration = require('./configuration')
class Package {
constructor (url) {
this.path = path.join(configuration.pluginDir, url)
this.url... | const { clone, pull } = require('./lib/git')
const path = require('path')
const jetpack = require('fs-jetpack')
const configuration = require('./configuration')
class Package {
constructor (url) {
this.path = path.join(configuration.pluginDir, url)
this.url = url
this.clone = clone
this.pull = pull
... |
Use context manager in example | from __future__ import print_function
import unittest
import modfoo
import saliweb.test
import os
class JobTests(saliweb.test.TestCase):
"""Check custom ModFoo Job class"""
def test_archive(self):
"""Test the archive method"""
# Make a ModFoo Job test job in ARCHIVED state
j = self.ma... | from __future__ import print_function
import unittest
import modfoo
import saliweb.test
import os
class JobTests(saliweb.test.TestCase):
"""Check custom ModFoo Job class"""
def test_archive(self):
"""Test the archive method"""
# Make a ModFoo Job test job in ARCHIVED state
j = self.mak... |
Add a context processor that adds the UserProfile to each context. | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['current_site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
... | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['current_site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
... |
rcos: Add / to rcos tests | import pytest
from django.core.urlresolvers import reverse
@pytest.mark.django_db
def test_homepage(client):
for url in (
"/",
"/donor",
"/students",
"/courses",
"/talks",
"/programming-competition",
"/achievements",
"... | import pytest
from django.core.urlresolvers import reverse
@pytest.mark.django_db
def test_homepage(client):
for url in (
"/donor",
"/students",
"/courses",
"/talks",
"/programming-competition",
"/achievements",
"/urp-application"... |
Change test to use something that looks like a real region code | package digitalocean
import (
"testing"
"github.com/mitchellh/packer/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}
func TestArtifactId(t *testing.T) {
a := &Artifact{"packer-foobar"... | package digitalocean
import (
"testing"
"github.com/mitchellh/packer/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}
func TestArtifactId(t *testing.T) {
a := &Artifact{"packer-foobar"... |
Add default value for date
with @NerdyProjects | from django.db.models import ForeignKey, DateTimeField, ManyToManyField
from yunity.models.entities import User, Location, Mappable, Message
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Chat(BaseModel):
participants = ManyToManyField(User)
... | from django.db.models import ForeignKey, DateTimeField, ManyToManyField
from yunity.models.entities import User, Location, Mappable, Message
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Chat(BaseModel):
participants = ManyToManyField(User)
... |
Use a space for scope separator to prevent issues with multiple scopes. | <?php
namespace Rgbvader\OAuth;
use League\OAuth2\Client\Provider\GenericProvider;
class XenForoProvider extends GenericProvider
{
const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'user_id';
/**
* @param string $url
* @param string $query
* @return string
*/
protected function appendQuery($url,... | <?php
namespace Rgbvader\OAuth;
use League\OAuth2\Client\Provider\GenericProvider;
class XenForoProvider extends GenericProvider
{
const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'user_id';
/**
* @param string $url
* @param string $query
* @return string
*/
protected function appendQuery($url,... |
SimonStewart: Convert the https test that we never run to use junit.
git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@17194 07704840-8298-11de-bf8c-fd130f914ac9 | /*
Copyright 2012 Selenium committers
Copyright 2012 Software Freedom Conservancy
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... | /*
Copyright 2012 Selenium committers
Copyright 2012 Software Freedom Conservancy
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... |
Allow workspaces outside of the workspace root
Summary:
As part of the workspace separation, and because our repo does not have an ideal layout (for example `react-native-github` consists of both product and tooling code, and is hard to move right now), I am in need of making workspaces outside of a workspace root wor... | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
import {dirname, join, resolve} from 'path';
const FLOW_ROOT = resolve(__dirname, '../../../');
export con... | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {resolve} from 'path';
const TOOL_ROOT = resolve(__dirname, "../");
const FLOW_ROOT = resolve(__dirname, "../.... |
Allow character to appear more than once
Using str_shuffle means that each character can only occur once in the generated string. This reduces the number of permutations possible. For example, using base 36, and 4 characters, there are 36^4 = 1.68M, but the current function can only generate 36*35*34*33 = 1.41M of the... | <?php
/*
Plugin Name: Random Keywords
Plugin URI: http://yourls.org/
Description: Assign random keywords to shorturls, like bitly (sho.rt/hJudjK)
Version: 1.1
Author: Ozh
Author URI: http://ozh.org/
*/
/* Release History:
*
* 1.0 Initial release
* 1.1 Added: don't increment sequential keyword counter & save one SQL qu... | <?php
/*
Plugin Name: Random Keywords
Plugin URI: http://yourls.org/
Description: Assign random keywords to shorturls, like bitly (sho.rt/hJudjK)
Version: 1.1
Author: Ozh
Author URI: http://ozh.org/
*/
/* Release History:
*
* 1.0 Initial release
* 1.1 Added: don't increment sequential keyword counter & save one SQL qu... |
Make the test really work. (Learning how to do promises right with hamcrest) | import assert from 'assert';
import {
assertThat,
everyItem,
hasProperty,
endsWith,
hasSize,
promiseThat, is, fulfilled, fulfilledWith,
allOf, truthy
} from 'hamjest';
import fs from 'fs';
import path from 'path';
function convertOneFile(fileName, destFileName) {
const fileReadPromise = new Promise(re... | import assert from 'assert';
import {
assertThat,
everyItem,
hasProperty,
endsWith,
hasSize,
promiseThat, is, fulfilled, fulfilledWith,
allOf, truthy
} from 'hamjest';
import fs from 'fs';
import path from 'path';
function convertOneFile(fileName, destFileName) {
const fileReadPromise = new Promise(re... |
Create random auth token on user signup | from .models import School, User
import re
import string
import random
def get_school_list():
schools = School.objects.all()
school_list = []
for s in schools:
school = {}
school['id'] = s.id
school['name'] = s.name
school['site'] = s.site
school['university'] = s.u... | from .models import School, User
import re
def get_school_list():
schools = School.objects.all()
school_list = []
for s in schools:
school = {}
school['id'] = s.id
school['name'] = s.name
school['site'] = s.site
school['university'] = s.university.name
schoo... |
Truncate rather than replace to prevent erroneous substitutions. | from django.urls import reverse
from six.moves.urllib.parse import urljoin
from kolibri.utils.conf import OPTIONS
def reverse_remote(
baseurl, viewname, urlconf=None, args=None, kwargs=None, current_app=None
):
# Get the reversed URL
reversed_url = reverse(
viewname, urlconf=urlconf, args=args, k... | from django.urls import reverse
from six.moves.urllib.parse import urljoin
from kolibri.utils.conf import OPTIONS
def reverse_remote(
baseurl, viewname, urlconf=None, args=None, kwargs=None, current_app=None
):
# Get the reversed URL
reversed_url = reverse(
viewname, urlconf=urlconf, args=args, k... |
Use "private" for fields in struct-like classes | package jauter;
public class Pattern<T> {
private final String path;
private final String[] tokens;
private final T target;
public static String removeSlashAtBothEnds(String path) {
if (path.isEmpty()) return path;
int beginIndex = 0;
while (beginIndex < path.length() && path.charAt(begi... | package jauter;
public class Pattern<T> {
protected final String path;
protected final String[] tokens;
protected final T target;
public static String removeSlashAtBothEnds(String path) {
if (path.isEmpty()) return path;
int beginIndex = 0;
while (beginIndex < path.length() && path.charA... |
Allow the reporter to be a member of the required module | #!/usr/bin/env node
require("ts-node/register");
var path = require("path");
var fs = require("fs");
var Jasmine = require("jasmine");
var Command = require("jasmine/lib/command.js");
var jasmine = new Jasmine({ projectBaseDir: path.resolve() });
var examplesDir = path.join("node_modules", "jasmine-core", "lib", "jasm... | #!/usr/bin/env node
require("ts-node/register");
var path = require("path");
var fs = require("fs");
var Jasmine = require("jasmine");
var Command = require("jasmine/lib/command.js");
var jasmine = new Jasmine({ projectBaseDir: path.resolve() });
var examplesDir = path.join("node_modules", "jasmine-core", "lib", "jasm... |
Fix return values in doc | <?php
/**
* Fiber: String
* Copyright (c) 2013 Eirik Refsdal <eirikref@gmail.com>
*/
namespace Fiber;
/**
* Fiber: String
*
* Class for generating string test data
*
* Things: - strings of various length (min, max, exact)
* - different charsets
* - empty strings (just length 0)
* - ... | <?php
/**
* Fiber: String
* Copyright (c) 2013 Eirik Refsdal <eirikref@gmail.com>
*/
namespace Fiber;
/**
* Fiber: String
*
* Class for generating string test data
*
* Things: - strings of various length (min, max, exact)
* - different charsets
* - empty strings (just length 0)
* - ... |
Replace field injection by constructor injection | package org.synyx.urlaubsverwaltung;
import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.... | package org.synyx.urlaubsverwaltung;
import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
imp... |
Add collections to JSON arrays | package com.aemreunal.helper.json;
/*
* *********************** *
* Copyright (c) 2015 *
* *
* This code belongs to: *
* *
* @author Ahmet Emre Ünal *
* S001974 *
* *
* aemreunal@gmail.com *
* emre.unal@ozu.edu... | package com.aemreunal.helper.json;
/*
* *********************** *
* Copyright (c) 2015 *
* *
* This code belongs to: *
* *
* @author Ahmet Emre Ünal *
* S001974 *
* *
* aemreunal@gmail.com *
* emre.unal@ozu.edu... |
Drop the TLS tests for a moment to see if we can get a success for timing. | from kat.harness import Runner
from abstract_tests import AmbassadorTest
# Import all the real tests from other files, to make it easier to pick and choose during development.
import t_basics
import t_extauth
import t_grpc
import t_grpc_bridge
import t_grpc_web
import t_gzip
import t_headerrouting
import t_loadbalan... | from kat.harness import Runner
from abstract_tests import AmbassadorTest
# Import all the real tests from other files, to make it easier to pick and choose during development.
import t_basics
import t_extauth
import t_grpc
import t_grpc_bridge
import t_grpc_web
import t_gzip
import t_headerrouting
import t_loadbalan... |
Add loot table for basic block | package info.u_team.u_team_test.data.provider;
import java.util.function.BiConsumer;
import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
public class TestLootTablesProvider extends CommonLootTable... | package info.u_team.u_team_test.data.provider;
import java.util.function.BiConsumer;
import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.TestBlocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
public class TestLootTablesProvider extends Common... |
Add a global scope for the reply count | <?php namespace App\Data;
use Eloquent;
use DiscussionPresenter;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
class Discussion extends Eloquent
{
use SoftDeletes, PresentableTrait;
protected $fillable = ['title', 'body', 'user_id', 'topic_id'];
protected $dates = ['creat... | <?php namespace App\Data;
use Eloquent;
use DiscussionPresenter;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
class Discussion extends Eloquent
{
use SoftDeletes, PresentableTrait;
protected $fillable = ['title', 'body', 'user_id', 'topic_id'];
protected $dates = ['creat... |
Remove save method for auto_now_add=True | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... |
Include legend label text in update block. | import {Index, Label, Offset, Size, Total, Value} from './constants';
import guideMark from './guide-mark';
import {TextMark} from '../marks/marktypes';
import {LegendLabelRole} from '../marks/roles';
import {addEncode} from '../encode/encode-util';
export default function(spec, config, userEncode, dataRef) {
var ze... | import {Index, Label, Offset, Size, Total, Value} from './constants';
import guideMark from './guide-mark';
import {TextMark} from '../marks/marktypes';
import {LegendLabelRole} from '../marks/roles';
import {addEncode} from '../encode/encode-util';
export default function(spec, config, userEncode, dataRef) {
var ze... |
Allow date without time with date injector | <?php
namespace Maphper\Lib;
//Replaces dates in an object graph with \DateTime instances
class DateInjector {
private $processCache;
public function replaceDates($obj, $reset = true) {
//prevent infinite recursion, only process each object once
if ($reset) $this->processCache = new \SplObjectStorage();
if (is... | <?php
namespace Maphper\Lib;
//Replaces dates in an object graph with \DateTime instances
class DateInjector {
private $processCache;
public function replaceDates($obj, $reset = true) {
//prevent infinite recursion, only process each object once
if ($reset) $this->processCache = new \SplObjectStorage();
if (is... |
Fix tests refering to wrong IAM resource | # Copyright 2022 Google LLC
#
# 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 in writing, ... | # Copyright 2022 Google LLC
#
# 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 in writing, ... |
Set replace to false in pushState method | import { _win } from 'core/variables';
import { genTimeKey } from './key';
let _key = genTimeKey();
export const supportsPushState = _win.history && _win.history.pushState;
/**
* Either replace existing History entry or add new entry
*
* @param {string} url
* @param {boolean} replace=false
*/
export function pu... | import { _win } from 'core/variables';
import { genTimeKey } from './key';
let _key = genTimeKey();
export const supportsPushState = _win.history && _win.history.pushState;
/**
* Either replace existing History entry or add new entry
*
* @param {string} url
* @param {boolean} [replace]
*/
export function pushSt... |
Load fresh data for each request | import {Server} from 'hapi'
import inert from 'inert'
import getProjects from './app/get-projects'
/**
* @param {string} configFilename The config filename
* @param {number} port The port number
*/
export function serve(configFilename, port) {
const server = new Server()
let projects
server.connection({port... | import {Server} from 'hapi'
import inert from 'inert'
import getProjects from './app/get-projects'
/**
* @param {string} configFilename The config filename
* @param {number} port The port number
*/
export function serve(configFilename, port) {
const server = new Server()
let projects
server.connection({port... |
Allow object literals to be IDisposable
RELNOTES[INC]: goog.disposable.IDisposable is now @record
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129902477 | // Copyright 2011 The Closure Library Authors. All Rights Reserved.
//
// 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 requ... | // Copyright 2011 The Closure Library Authors. All Rights Reserved.
//
// 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 requ... |
Change visibility of storage interruption manager | package com.orientechnologies.orient.core.storage.impl.local;
import com.orientechnologies.common.concur.lock.OInterruptedException;
import com.orientechnologies.common.log.OLogManager;
public class OStorageInterruptionManager {
private int depth = 0;
private boolean interrupted = false;
protected void interr... | package com.orientechnologies.orient.core.storage.impl.local;
import com.orientechnologies.common.concur.lock.OInterruptedException;
import com.orientechnologies.common.log.OLogManager;
public class OStorageInterruptionManager {
private int depth = 0;
private boolean interrupted = false;
protected void interr... |
Fix error update widget action | import { createAction } from './create-action'
import * as t from '../action-types'
import AuthSelectors from '~authenticate/redux/selectors'
import Selectors from '../selectors'
export default widget => (dispatch, getState, { api }) => {
dispatch(createAction(t.UPDATE_WIDGET_REQUEST))
const credentials = AuthSel... | import { createAction } from './create-action'
import * as t from '../action-types'
import AuthSelectors from '~authenticate/redux/selectors'
import Selectors from '../selectors'
export default widget => (dispatch, getState, { api }) => {
dispatch(createAction(t.UPDATE_WIDGET_REQUEST))
const credentials = AuthSel... |
Tag is not required, of course | """Forms for dealing with jobs/posts."""
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from taggit.models import Tag
class PostFilterForm(forms.Form):
"""Form for filtering the PostListView."""
title = forms.CharField(required=False)
is_job_p... | """Forms for dealing with jobs/posts."""
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from taggit.models import Tag
class PostFilterForm(forms.Form):
"""Form for filtering the PostListView."""
title = forms.CharField(required=False)
is_job_p... |
Add filter by language for list by tag. | from dragoman_blog.models import EntryTranslation
from django.views.generic.list import ListView
from django.utils.translation import get_language
class ListByTagView(ListView):
""" View for listing posts by tags"""
template_name = "dragoman_blog/entrytranslation_list_by_tag.html"
model = EntryTranslatio... | from dragoman_blog.models import EntryTranslation
from django.views.generic.list import ListView
class ListByTagView(ListView):
""" View for listing posts by tags"""
template_name = "dragoman_blog/entrytranslation_list_by_tag.html"
model = EntryTranslation
def get_queryset(self):
try:
... |
Tidy up array handling hiccup | import { VACCINE_ACTIONS } from '../actions/VaccineActions';
const initialState = () => ({
scannedSensors: [],
isScanning: false,
});
export const VaccineReducer = (state = initialState(), action) => {
const { type } = action;
switch (type) {
case VACCINE_ACTIONS.SCAN_START: {
return {
...s... | import { VACCINE_ACTIONS } from '../actions/VaccineActions';
const initialState = () => ({
scannedSensors: [],
isScanning: false,
});
export const VaccineReducer = (state = initialState(), action) => {
const { type } = action;
switch (type) {
case VACCINE_ACTIONS.SCAN_START: {
return {
...s... |
Improve comment on Batch interface | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// For ease of implementation, our database's interface matches Ethereum's
// database implementation. This was to allow use to use Geth code as is for the
// EVM chain.
package database
// Batch is a write-only databa... | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// For ease of implementation, our database's interface matches Ethereum's
// database implementation. This was to allow use to use Geth code as is for the
// EVM chain.
package database
// Batch is a write-only databa... |
Use better start values for arm | #!/usr/bin/env python3
import socket
import time
import math
import random
HOST, PORT = 'localhost', 7777
LIMIT = 0.5
posx = random.uniform(-50.00, 50.00)
posy = random.uniform(-50.00, 50.00)
posz = random.uniform(-50.00, 50.00)
def change_pos(*values):
range_delta = 0.1
output = []
for pos in values:
... | #!/usr/bin/env python3
import socket
import time
import math
import random
HOST, PORT = 'localhost', 7777
LIMIT = 0.5
posx, posy, posz = 0.0, 0.0, 0.0
def change_pos(*values):
range_delta = 0.1
output = []
for pos in values:
pos_min = pos - range_delta
pos_min = -0.5 if pos_min < -0.5 e... |
Add DM support, and first start at self-update | import discord
import asyncio
import os
import signal
import sys
import subprocess
#Set up Client State
CLIENT_TOKEN=os.environ['TOKEN']
#Create Discord client
client = discord.Client()
#Handle shutdown gracefully
def sigterm_handler(signum, frame):
print('Logging out...', flush=True)
raise KeyboardInterrup... | import discord
import asyncio
import os
import signal
import sys
#Set up Client State
CLIENT_TOKEN=os.environ['TOKEN']
#Create Discord client
client = discord.Client()
#Handle shutdown gracefully
def sigterm_handler(signum, frame):
print('Logging out...', flush=True)
raise KeyboardInterrupt
sys.exit('Sh... |
Use strings for IDs in Committee Popolo | from django.http import JsonResponse
from django.views.generic import ListView
from pombola.core.models import Organisation
# Output Popolo JSON suitable for WriteInPublic for any committees that have an
# email address.
class CommitteesPopoloJson(ListView):
queryset = Organisation.objects.filter(
kind__... | from django.http import JsonResponse
from django.views.generic import ListView
from pombola.core.models import Organisation
# Output Popolo JSON suitable for WriteInPublic for any committees that have an
# email address.
class CommitteesPopoloJson(ListView):
queryset = Organisation.objects.filter(
kind__... |
Fix bug in flag parsing | package main
import (
"errors"
"flag"
"io/ioutil"
"os"
"strings"
)
// Token Getter is a function that can retrieve a token
type tokenGetter func() (string, error)
// goes through the provided TokenGetter chain and stops once one reports
// a non-"" value. If any produce errors it'll wrap those up and return 'em... | package main
import (
"errors"
"flag"
"io/ioutil"
"os"
"strings"
)
// a function that provides a means to retrieve a token
type TokenGetter func() (string, error)
// goes through the provided TokenGetter chain and stops once one reports
// a non-"" value. If any produce errors it'll wrap those up and return 'em... |
Add pod name to payload | package enmasse.config.service.podsense;
import enmasse.config.service.openshift.MessageEncoder;
import io.fabric8.kubernetes.api.model.Pod;
import org.apache.qpid.proton.amqp.messaging.AmqpSequence;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.message.Message;
import java.io.... | package enmasse.config.service.podsense;
import enmasse.config.service.openshift.MessageEncoder;
import io.fabric8.kubernetes.api.model.Pod;
import org.apache.qpid.proton.amqp.messaging.AmqpSequence;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.message.Message;
import java.io.... |
Make sami/sami config PSR1/2 compliant | <?php
use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;
$dir = __DIR__ . '/src';
$iterator = Finder::create()
->files()
->name('*.php')
->in($dir);
$versions = GitVersionCollection::create($dir)
->addFromTags(function ($version) {
return preg_match('/^... | <?php
use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;
$dir = __DIR__ . '/src';
$iterator = Finder::create()
->files()
->name('*.php')
->in($dir)
;
$versions = GitVersionCollection::create($dir)
->addFromTags(function ($version) { return preg_match('/^v?\d+\.... |
Switch to a geo IP API that isn't down | package net.maxbraun.mirror;
import android.location.Location;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
/**
* A helper class to look up location by IP.
*/
public abstract class GeoLocation {
private static final String TAG = GeoLocation.class.getSimpleName();
/**
... | package net.maxbraun.mirror;
import android.location.Location;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
/**
* A helper class to look up location by IP.
*/
public abstract class GeoLocation {
private static final String TAG = GeoLocation.class.getSimpleName();
/**
... |
Fix bug on deepExtend helper | /**
* Orion Helpers
*/
orion.helpers = {}
/**
* Searchs a object with a givin string
* you can specify if you want the searcher to
* take the first values of array if they are
*/
orion.helpers.searchObjectWithDots = function(object, key, selectFirstIfIsArray) {
key = key.split('.');
try {
for (... | /**
* Orion Helpers
*/
orion.helpers = {}
/**
* Searchs a object with a givin string
* you can specify if you want the searcher to
* take the first values of array if they are
*/
orion.helpers.searchObjectWithDots = function(object, key, selectFirstIfIsArray) {
key = key.split('.');
try {
for (... |
Refactor to use method references | package helloworld;
import static org.requirementsascode.UseCaseModelBuilder.newBuilder;
import org.requirementsascode.UseCaseModel;
import org.requirementsascode.UseCaseModelBuilder;
import org.requirementsascode.UseCaseModelRunner;
public class HelloWorld01_PrintHelloUserExample {
public UseCaseModel buildWith... | package helloworld;
import static org.requirementsascode.UseCaseModelBuilder.newBuilder;
import java.util.function.Consumer;
import org.requirementsascode.UseCaseModel;
import org.requirementsascode.UseCaseModelBuilder;
import org.requirementsascode.UseCaseModelRunner;
public class HelloWorld01_PrintHelloUserExampl... |
Update metadata defaults to Rootstrikers-specific info | angular
.module('app')
.factory('MetaMachine', function($rootScope) {
var metaDefaults = {
metaTitle: "Home | Rootstrikers",
metaDescription: "We fight the corrupting influence of money in politics",
metaImage: "/app/images/favicon/apple-touch-icon-144x144-precomposed.png",
metaUrl: "ht... | angular
.module('app')
.factory('MetaMachine', function($rootScope) {
var metaDefaults = {
metaTitle: "Home | Rootstrikers",
metaDescription: "We fight the corrupting influence of money in politics",
metaImage: "http://facultycreative.com/img/icons/facultyicon114.png",
metaUrl: "http://... |
Remove some hidden magic + adjust output to be compatible with view block | <?php
declare(strict_types=1);
namespace block\dbblock;
use app;
use arr;
use attr;
function render(array $block): string
{
$data = $block['cfg']['data'];
if (!$data || !($attrs = arr\extract($data['_entity']['attr'], $block['cfg']['attr_id']))) {
return '';
}
$html = '';
foreach ($att... | <?php
declare(strict_types=1);
namespace block\dbblock;
use app;
use arr;
use attr;
function render(array $block): string
{
$data = $block['cfg']['data'];
if (!$data || !($attrs = arr\extract($data['_entity']['attr'], $block['cfg']['attr_id']))) {
return '';
}
$html = '';
foreach ($att... |
Fix duplicate prefix sending with party chat & logging. | package com.gmail.nossr50.chat;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
public class PartyChatManager extends ChatManager {
private Party par... | package com.gmail.nossr50.chat;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;... |
Install bash completion script only when running the installation script
as root. This is also a workaround for a bug that prevents tox from install the
above script while creating the virtual environment. | import os
from setuptools import find_packages
from distutils.core import setup
data_files = []
# Add bash completion script in case we are running as root
if os.getuid() == 0:
data_files=[
('/etc/bash_completion.d', ['data/skipper-complete.sh'])
]
setup(
name='skipper',
version='0.0.1',
... | from setuptools import find_packages
from distutils.core import setup
setup(
name='skipper',
version='0.0.1',
url='http://github.com/Stratoscale/skipper',
author='Adir Gabai',
author_mail='adir@stratoscale.com',
packages=find_packages(include=['skipper*']),
data_files=[
('/etc/bash_... |
Fix Validate Site popup when open on mobile phones | /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2016, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $validationBox = (function() {
$.get(pH7Url.base + 'validate-si... | /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2016, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $validationBox = (function() {
$.get(pH7Url.base + 'validate-si... |
Add a body to posts | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... |
Rename PyPi dist. to wallace-platform | """Install Wallace as a command line utility."""
from setuptools import setup
setup_args = dict(
name='wallace-platform',
packages=['wallace'],
version="0.11.1",
description='Wallace, a platform for experimental cultural evolution',
url='http://github.com/berkeley-cocosci/Wallace',
author='Ber... | """Install Wallace as a command line utility."""
from setuptools import setup
setup_args = dict(
name='w',
packages=['wallace'],
version="0.11.1",
description='Wallace, a platform for experimental cultural evolution',
url='http://github.com/berkeley-cocosci/Wallace',
author='Berkeley CoCoSci',... |
docs(TrackerDash): Remove mention of private GitHub project | import $ from 'jquery';
import topInfoBar from './templates/topInfoBar.jade';
import VisComponent from '../../VisComponent';
class TopInfoBar extends VisComponent {
constructor (el, settings) {
super(el);
this.$el = $(this.el);
this.name = settings.name || 'Ground Truth';
this.branch = settings.bra... | import $ from 'jquery';
import topInfoBar from './templates/topInfoBar.jade';
import VisComponent from '../../VisComponent';
class TopInfoBar extends VisComponent {
constructor (el, settings) {
super(el);
this.$el = $(this.el);
this.name = settings.name || 'Ground Truth';
this.branch = settings.bra... |
Add more comments in capturist dashboard view | from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio
@login_required
@user_passes_test(is_capturista)
def capturista_dashboard(request):
"""View to render... | from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio
@login_required
#@user_passes_test(is_capturista)
def capturista_dashboard(request):
"""View to rende... |
Use resource_string for error messages
Signed-off-by: Michael Barton <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@michaelbarton.me.uk> | import sys, yaml, os.path
def select_module(module, name):
"""
Select and return a biobox module
"""
mod_name = ".".join(["biobox_cli", module, name])
try:
__import__(mod_name)
except ImportError:
err_exit('unknown_command',
{'command_type': str.replace(module, '... | import sys, yaml, os.path
def select_module(module, name):
"""
Select and return a biobox module
"""
mod_name = ".".join(["biobox_cli", module, name])
try:
__import__(mod_name)
except ImportError:
err_exit('unknown_command',
{'command_type': str.replace(module, '... |
Allow action message customization by service | <?php
namespace PragmaRX\Health\Notifications\Channels;
use Request;
abstract class BaseChannel implements Contract
{
/**
* @return mixed
*/
protected function getActionTitle()
{
return config('health.notifications.action-title');
}
/**
* @param $item
* @return string... | <?php
namespace PragmaRX\Health\Notifications\Channels;
use Request;
abstract class BaseChannel implements Contract
{
/**
* @return mixed
*/
protected function getActionTitle()
{
return config('health.notifications.action-title');
}
/**
* @param $item
* @return string... |
Update footer not to use grid layout. | /**
* Footer component of the ModulePopularPagesWidget widget.
*
* Site Kit by Google, Copyright 2021 Google LLC
*
* 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
*
* https://www.a... | /**
* Footer component of the ModulePopularPagesWidget widget.
*
* Site Kit by Google, Copyright 2021 Google LLC
*
* 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
*
* https://www.a... |
Replace deprecated imp with importlib | import pytest # noqa
import os
import sys
import glob
import importlib
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... | import pytest # noqa
import os
import sys
import glob
import imp
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... |
Fix Theme To Make Sure Its An Object | import Form from "./components/form.js"
import Input from "./components/input.js"
import Submit from "./components/submit.js"
import FormErrorList from "./components/form_error_list.js"
import Fieldset from "./components/fieldset.js"
import FieldsetText from "./components/fieldset_text.js"
import ValueLinkedSelect from... | import Form from "./components/form.js"
import Input from "./components/input.js"
import Submit from "./components/submit.js"
import FormErrorList from "./components/form_error_list.js"
import Fieldset from "./components/fieldset.js"
import FieldsetText from "./components/fieldset_text.js"
import ValueLinkedSelect from... |
Fix wrong test naming for docs | import { expect } from 'chai'
import AtomicString from '../../src/atomic/string'
/** @test {AtomicString} */
describe('AtomicString', () => {
const bitArrayHello = [104, 97, 108, 108, 111, 0, 0, 0]
let atomic
before(() => {
atomic = new AtomicString('hallo')
})
/** @test {AtomicString#unpack} */
des... | import { expect } from 'chai'
import AtomicString from '../../src/atomic/string'
/** @test {AtomicString} */
describe('AtomicString', () => {
const bitArrayHello = [104, 97, 108, 108, 111, 0, 0, 0]
let atomic
before(() => {
atomic = new AtomicString('hallo')
})
/** @test {AtomicString#pack} */
descr... |
Handle path separator differences in AntLoader
DAT-4036 | package liquibase.integration.ant;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.util.StringUtil;
import org.apache.tools.ant.AntClassLoader;
import java.io.File;
public class AntResourceAccessor extends FileSystemResourceAccessor {
public AntResourceAccessor(AntClassLoader classLoader,... | package liquibase.integration.ant;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.util.StringUtil;
import org.apache.tools.ant.AntClassLoader;
import java.io.File;
public class AntResourceAccessor extends FileSystemResourceAccessor {
public AntResourceAccessor(AntClassLoader classLoader,... |
Revert accidental gums test change from previous commit.
git-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@17355 4e558342-562e-0410-864c-e07659590f8c | import os
import pwd
import unittest
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.tomcat as tomcat
import osgtest.library.osgunittest as osgunittest
class TestGUMS(osgunittest.OSGTestCase):
def test_01_map_user(self):
core.skip_ok_unless_installed('gums... | import os
import pwd
import unittest
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.tomcat as tomcat
import osgtest.library.osgunittest as osgunittest
class TestGUMS(osgunittest.OSGTestCase):
def test_01_map_user(self):
core.skip_ok_unless_installed('gums... |
Fix AMD / UMD problems. | (function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore', 'backbone.paginator'], function(Backbone, Underscore, PageableCollection) {
Backbone.PageableCollection = PageableCollection;
return (root.Hal = ... | (function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore', 'backbone.paginator'], function(Backbone, Underscore, PageableCollection) {
return (root.Hal = factory(root, Backbone, _, PageableCollection));
});
}
... |
Add CBO column to cnes professional | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesProfessional(db.Model):
__tablename__ = 'cnes_professional'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
mic... | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesProfessional(db.Model):
__tablename__ = 'cnes_professional'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
mic... |
Use new resolver in LexicalID resolution | from thinglang.utils.type_descriptors import ValueType
from thinglang.lexer.symbols import LexicalSymbol
class LexicalQuote(LexicalSymbol): # "
EMITTABLE = False
@classmethod
def next_operator_set(cls, current, original):
if current is original:
return {'"': LexicalQuote}
ret... | from thinglang.utils.type_descriptors import ValueType
from thinglang.lexer.symbols import LexicalSymbol
class LexicalQuote(LexicalSymbol): # "
EMITTABLE = False
@classmethod
def next_operator_set(cls, current, original):
if current is original:
return {'"': LexicalQuote}
ret... |
[terraform-conversions] Add json tags to CAI asset.
Signed-off-by: Modular Magician <86ce7da8ad74b1c583667a2bebd347455fa06219@google.com> | package google
// Asset is the CAI representation of a resource.
type Asset struct {
// The name, in a peculiar format: `\\<api>.googleapis.com/<self_link>`
Name string `json:"name"`
// The type name in `google.<api>.<resourcename>` format.
Type string `json:"asset_type"`
Resource *AssetResource `js... | package google
// Asset is the CAI representation of a resource.
type Asset struct {
// The name, in a peculiar format: `\\<api>.googleapis.com/<self_link>`
Name string
// The type name in `google.<api>.<resourcename>` format.
Type string
Resource *AssetResource
IAMPolicy *IAMPolicy
}
// AssetResource is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.