text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Revert "Another attempt to fix the RTD build."
This reverts commit 43807c085493962ca0f79105b64b3be8ddc6fc39.
References #25 | from setuptools import setup, find_packages
from os.path import dirname, abspath
HERE = abspath(dirname(__file__))
VERSION = open(HERE + '/puresnmp/version.txt').read().strip()
setup(
name="puresnmp",
version=VERSION,
description="Pure Python SNMP implementation",
long_description=open(HERE + "/README... | from setuptools import setup, find_packages
VERSION = '1.1.4'
setup(
name="puresnmp",
version=VERSION,
description="Pure Python SNMP implementation",
long_description=open("README.rst").read(),
author="Michel Albert",
author_email="michel@albert.lu",
provides=['puresnmp'],
license="MIT... |
Use callback instead of sync | 'use strict'
const grunt = require('gruntfile-api')
const fs = require('fs')
const path = require('path')
const spawn = require('child_process').spawn
global.processes = {}
exports.getTasks = function () {
return new Promise(function (resolve, reject) {
fs.readFile(path.join(window.localStorage.getItem('current... | 'use strict'
const grunt = require('gruntfile-api')
const fs = require('fs')
const path = require('path')
const spawn = require('child_process').spawn
global.processes = {}
exports.getTasks = function () {
return new Promise(function (resolve, reject) {
const gruntfile = fs.readFileSync(path.join(window.localSt... |
Fix syntax of a migration | """add a flag for review active
Revision ID: 4d45dd3d8ce5
Revises: 49d09b3d2801
Create Date: 2014-02-26 16:29:54.507710
"""
# revision identifiers, used by Alembic.
revision = '4d45dd3d8ce5'
down_revision = '49d09b3d2801'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
'vi... | """add a flag for review active
Revision ID: 4d45dd3d8ce5
Revises: 49d09b3d2801
Create Date: 2014-02-26 16:29:54.507710
"""
# revision identifiers, used by Alembic.
revision = '4d45dd3d8ce5'
down_revision = '49d09b3d2801'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
'vi... |
Fix for scalable option bug, pointed out by Jason Smith.
git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@465 93a4e39c-3214-0410-bb16-828d8e3bcd0f | <?php
# $Id$
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#
if (! Gmetad($ganglia_ip, $ganglia_port) )
{
print "<H4>There was an error collecting ganglia data ".
"($... | <?php
# $Id$
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#
if (! Gmetad($ganglia_ip, $ganglia_port) )
{
print "<H4>There was an error collecting ganglia data ".
"($... |
Apply fix only when utils are broken | // Temporary fix for https://github.com/Gozala/test-commonjs/pull/8
'use strict';
var utils = require('test/utils')
, instanceOf;
try {
if (utils.instanceOf) utils.instanceOf(Object.create(null), Date);
} catch (e) {
instanceOf = utils.instanceOf = function (value, Type) {
var constructor, isConstructorNameSa... | // Temporary fix for https://github.com/Gozala/test-commonjs/pull/8
'use strict';
var utils = require('test/utils')
, instanceOf;
instanceOf = utils.instanceOf = function (value, Type) {
var constructor, isConstructorNameSame, isConstructorSourceSame
, isInstanceOf = value instanceof Type;
// If `instanceof... |
Allow to use custom model for Single Sender | <?php
namespace Fenos\Notifynder\Senders;
use Fenos\Notifynder\Contracts\SenderContract;
use Fenos\Notifynder\Contracts\SenderManagerContract;
use Fenos\Notifynder\Models\Notification;
/**
* Class SingleSender.
*/
class SingleSender implements SenderContract
{
/**
* @var \Fenos\Notifynder\Builder\Notifica... | <?php
namespace Fenos\Notifynder\Senders;
use Fenos\Notifynder\Contracts\SenderContract;
use Fenos\Notifynder\Contracts\SenderManagerContract;
use Fenos\Notifynder\Models\Notification;
/**
* Class SingleSender.
*/
class SingleSender implements SenderContract
{
/**
* @var \Fenos\Notifynder\Builder\Notifica... |
Fix mirage to only use default scenario when not testing | /* eslint global-require: off, import/no-mutable-exports: off */
import merge from 'lodash/merge';
import flow from 'lodash/flow';
const environment = process.env.NODE_ENV || 'test';
let start = () => {};
if (environment !== 'production') {
const { default: Mirage, camelize } = require('@bigtest/mirage');
const ... | /* eslint global-require: off, import/no-mutable-exports: off */
import merge from 'lodash/merge';
import flow from 'lodash/flow';
const environment = process.env.NODE_ENV || 'test';
let start = () => {};
if (environment !== 'production') {
const { default: Mirage, camelize } = require('@bigtest/mirage');
const ... |
Add torpedo failure rate as an environment variable | package hu.bme.mit.spaceship;
import java.util.Random;
/**
* Class storing and managing the torpedoes of a ship
*/
public class TorpedoStore {
private double FAILURE_RATE = 0.0;
private int torpedoCount = 0;
private Random generator = new Random();
public TorpedoStore(int numberOfTorpedos){
this.torped... | package hu.bme.mit.spaceship;
import java.util.Random;
/**
* Class storing and managing the torpedoes of a ship
*/
public class TorpedoStore {
private int torpedoCount = 0;
private Random generator = new Random();
public TorpedoStore(int numberOfTorpedos){
this.torpedoCount = numberOfTorpedos;
}
publ... |
Fix bug in focus measure | import cv2
import numpy
def LAPV(img):
"""Implements the LAPV focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.std(cv2.Laplacian(img, cv2.CV_64F)) ** 2
def TENG(img):
"""Implements the TENG focus measure algorithm.
:param img: the ... | import cv2
import numpy
def LAPV(img):
"""Implements the LAPV focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.std(cv2.Laplacian(img, cv2.CV_64F)) ** 2
def TENG(img):
"""Implements the TENG focus measure algorithm.
:param img: the ... |
Update comment for passport creation | package co.inventorsoft.oop.basic.demo;
import co.inventorsoft.oop.basic.model.Passport;
import co.inventorsoft.oop.basic.model.Person;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
public class Main {
public static void main(String[] args) {
... | package co.inventorsoft.oop.basic.demo;
import co.inventorsoft.oop.basic.model.Passport;
import co.inventorsoft.oop.basic.model.Person;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
public class Main {
public static void main(String[] args) {
... |
Stop shipping qy with python-moira
Moira now provides with its own native qy. | #!/usr/bin/python
from setuptools import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
setup(
name="PyMoira",
version="4.3.2",
description="PyMoira - Python bindings for the Athena Moira library",
author="Evan Broder",
author_email="broder@mit.edu",
lice... | #!/usr/bin/python
from setuptools import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
setup(
name="PyMoira",
version="4.3.1",
description="PyMoira - Python bindings for the Athena Moira library",
author="Evan Broder",
author_email="broder@mit.edu",
lice... |
Abort migrations check if a version is present more than once
list_migrations checks whether we have more than one branch in the
list of migration versions. Since we've switched to a new revision
naming convention, pull requests open at the same time are likely
to use the same revision number when adding new migration... | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import sys
import warnings
from alembic.script import ScriptDirectory
warnings.simplefilter('error')
def detect_heads(migrations):
heads = migrations.get_heads()
return heads
def version_history(migrations):
version_histor... | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import sys
from alembic.script import ScriptDirectory
def detect_heads(migrations):
heads = migrations.get_heads()
return heads
def version_history(migrations):
version_history = [
(m.revision, m.doc) for m in migra... |
general: Add package handler to class map | <?php
$Gcm__ = array(
'GatewayApiController'=>'controllers/GatewayApiController.php',
'ManagementApiController'=>'controllers/ManagementApiController.php',
'SpringApiController'=>'controllers/SpringApiController.php',
'CoreHandler'=>'handlers/CoreHandler.php',
'GatewayHandler'=>'handlers/GatewayHandler.php',
'Mod... | <?php
$Gcm__ = array(
'GatewayApiController'=>'controllers/GatewayApiController.php',
'ManagementApiController'=>'controllers/ManagementApiController.php',
'SpringApiController'=>'controllers/SpringApiController.php',
'CoreHandler'=>'handlers/CoreHandler.php',
'GatewayHandler'=>'handlers/GatewayHandler.php',
'Mod... |
Update blood death knight for soft mitigation check split damage schools. | import CoreMitigationCheck from 'parser/shared/modules/MitigationCheck';
import SPELLS from 'common/SPELLS';
class MitigationCheck extends CoreMitigationCheck {
constructor(...args) {
super(...args);
this.buffCheckPhysical = [
SPELLS.BONE_SHIELD.id,
SPELLS.DANCING_RUNE_WEAPON_BUFF.id,
];
... | import CoreMitigationCheck from 'parser/shared/modules/MitigationCheck';
import SPELLS from 'common/SPELLS';
class MitigationCheck extends CoreMitigationCheck {
constructor(...args){
super(...args);
this.buffCheck = [SPELLS.BLOOD_SHIELD.id,
SPELLS.BONE_SHIELD.id,
... |
Add new GetHatenaFeed func prototype | package main
import (
"github.com/timakin/ts/loader"
"github.com/codegangsta/cli"
)
var Commands = []cli.Command{
commandAll,
commandBiz,
commandHack,
}
var commandAll = cli.Command{
Name: "pop",
Usage: "",
Description: `
`,
Action: doAll,
}
var commandBiz = cli.Command{
Name: "biz",
Usage: "",
Descri... | package main
import (
"github.com/timakin/ts/loader"
"github.com/codegangsta/cli"
)
var Commands = []cli.Command{
commandAll,
commandBiz,
commandHack,
}
var commandAll = cli.Command{
Name: "pop",
Usage: "",
Description: `
`,
Action: doAll,
}
var commandBiz = cli.Command{
Name: "biz",
Usage: "",
Descri... |
Add rpm-build into environment setup message for CentOS
Change-Id: I44bd14f2f3c3e76c24f5efd26a5ff6a545dcaf72
Implements: blueprint plugin-major-version-for-releases | # -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... | # -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... |
Print console messages by default in the emulator | import DefaultConfig from 'anyware/lib/game-logic/config/default-config';
import GAMES from 'anyware/lib/game-logic/constants/games';
class Config extends DefaultConfig {
constructor() {
super();
this.DEBUG.console = true;
this.CLIENT_CONNECTION_OPTIONS = {
protocol: "wss",
username: "anywa... | import DefaultConfig from 'anyware/lib/game-logic/config/default-config';
import GAMES from 'anyware/lib/game-logic/constants/games';
class Config extends DefaultConfig {
constructor() {
super();
this.CLIENT_CONNECTION_OPTIONS = {
protocol: "wss",
username: "anyware",
password: "anyware",
... |
Use new extension setup() API | from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '0.2.2'
class GMusicExtension(ext.Extension):
dist_name = 'Mopidy-GMusic'
ext_name = 'gmusic'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file... | from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '0.2.2'
class GMusicExtension(ext.Extension):
dist_name = 'Mopidy-GMusic'
ext_name = 'gmusic'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file... |
Fix newline trimming in page renderer breaking GA tracking |
</div>
<footer><?=get_footer()?></footer>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>if(!window.jQuery)document.write('\x3Cscript src="/js/jquery-2.1.4.min.js">\x3C/script>');
var REWRITE_REGEX = <?=str_replace('~','/',str_replace('/','\/',REWRITE_REGEX))?>i,
SITE_TITLE = '<?=SITE... |
</div>
<footer><?=get_footer()?></footer>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>if(!window.jQuery)document.write('\x3Cscript src="/js/jquery-2.1.4.min.js">\x3C/script>');
var REWRITE_REGEX = <?=str_replace('~','/',str_replace('/','\/',REWRITE_REGEX))?>i,
SITE_TITLE = '<?=SITE... |
Use an ArrayDeque instead of LinkedList to store current rule execution context
Array-based collections perform better than linked lists in general, as
they don’t need to do memory allocation for each add/remove() call. | /*
* Copyright 2015 the original author or 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 applica... | /*
* Copyright 2015 the original author or 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 applica... |
Use a promise chain to be sure that everything's built | #!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const handlebars = require('handlebars')
const workingDir = process.cwd()
const output = workingDir + '/dist'
const tags = {
greeting: 'Hello!'
}
try {
const files = fs.readdirSync(workingDir + '/pages')
} catch (err) {
throw err
}
fun... | #!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const handlebars = require('handlebars')
const workingDir = process.cwd()
const output = workingDir + '/dist'
const tags = {
greeting: 'Hello!'
}
try {
const files = fs.readdirSync(workingDir + '/pages')
} catch (err) {
throw err
}
fil... |
Fix flake8 and missing sys module | import sys
from setuptools.command.test import test as TestCommand
from setuptools import setup
from hbite import VERSION as version
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):... | from setuptools import setup
from setuptools.command.test import test as TestCommand
from setuptools import setup
from hbite import VERSION as version
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
de... |
Remove my debugging statement... again | /* 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/. */
/**
* Gets the current guild and member counts.
*
* @param {CommandoClient} client - The Discord.JS-Commando Cl... | /* 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/. */
/**
* Gets the current guild and member counts.
*
* @param {CommandoClient} client - The Discord.JS-Commando Cl... |
Add loading state to signup | import { connect } from 'react-redux'
import { reduxForm } from 'redux-form'
import { push } from 'react-router-redux'
import { checkEmailAvailability, createUser } from '../../actions/users'
import { EMAIL_REGEX } from '../../utils/regexes'
import Signup from './Signup'
function mapStateToProps (state, ownProps) {... | import { connect } from 'react-redux'
import { reduxForm } from 'redux-form'
import { push } from 'react-router-redux'
import { checkEmailAvailability, createUser } from '../../actions/users'
import { EMAIL_REGEX } from '../../utils/regexes'
import Signup from './Signup'
function mapStateToProps (state, ownProps) {... |
Use npm style variable declarations. | /**
* Communicate back to the web app.
*/
var extensionRoot = (new File($.fileName)).parent + '/';
$.evalFile(extensionRoot + '/constants.js');
$.evalFile(extensionRoot + '/Json.js');
$.evalFile(extensionRoot + '/Saver.js');
function getSettingsPath()
{
return SP_SETTINGS_PATH;
}
function save(args)
{
var p... | /**
* Communicate back to the web app.
*/
var extensionRoot = (new File($.fileName)).parent + '/';
$.evalFile(extensionRoot + '/constants.js');
$.evalFile(extensionRoot + '/Json.js');
$.evalFile(extensionRoot + '/Saver.js');
function getSettingsPath()
{
return SP_SETTINGS_PATH;
}
function save(args)
{
var p... |
Fix Menu reload after re-login
This bug existed for ages. After re-login there always was this 'this.tr is undefined' error.
Problem was that two menu objects where created and the one actually rendered was not set to Kwf.menu. That caused the reload for the wrong object. |
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
... |
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
... |
Change system.rate-limit to prioritize disk | """
sentry.options.defaults
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from sentry.options import register, FLAG_NOSTORE, FLAG_REQUIRED, FLAG_PRIORITIZE_DIS... | """
sentry.options.defaults
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from sentry.options import register, FLAG_NOSTORE, FLAG_REQUIRED, FLAG_PRIORITIZE_DIS... |
Make sure the filename is alphanumeric | # encoding: utf-8
from django.db import models
import uuid
import os
def unique_file_name(instance, filename):
path = 'benchmarkLogs/'
name = str(uuid.uuid4().hex) + '.log'
return os.path.join(path, name)
class Picture(models.Model):
"""This is a small demo using just two fields. The slug field is re... | # encoding: utf-8
from django.db import models
import uuid
import os
def unique_file_name(instance, filename):
path = 'benchmarkLogs/'
name = str(uuid.uuid4()) + '.log'
return os.path.join(path, name)
class Picture(models.Model):
"""This is a small demo using just two fields. The slug field is really... |
[TASK] Rename repository method `add` to attach in order to not collide with extbase | <?php
namespace DreadLabs\VantomasWebsite\SecretSanta\Pair;
use DreadLabs\VantomasWebsite\SecretSanta\Donee\DoneeInterface;
use DreadLabs\VantomasWebsite\SecretSanta\Donor\DonorInterface;
interface RepositoryInterface
{
/**
* Finds a pair for the given donor
*
* @param DonorInterface $donor
*... | <?php
namespace DreadLabs\VantomasWebsite\SecretSanta\Pair;
use DreadLabs\VantomasWebsite\SecretSanta\Donee\DoneeInterface;
use DreadLabs\VantomasWebsite\SecretSanta\Donor\DonorInterface;
interface RepositoryInterface
{
/**
* Finds a pair for the given donor
*
* @param DonorInterface $donor
*... |
[FIX] Rollback 17710. Use of TR by default is necessary for now because default home page message uses it. A better solution is welcome.
git-svn-id: 08a866106b41c57cec985b5deddde5835bf030d4@17711 b456876b-0849-0410-b77d-98878d47e9d5 | <?php
// $Id: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_trackerlist.php,v 1.40.2.12 2008-03-22 12:13:54 sylvieg Exp $
function wikiplugin_tr_help() {
$help = tra("Translate a string");
$help .= "~np~{TR()}string{TR}~/np~";
return $help;
}
function wikiplugin_tr_info() {
return array(
'name' => tra('Tra... | <?php
// $Id: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_trackerlist.php,v 1.40.2.12 2008-03-22 12:13:54 sylvieg Exp $
function wikiplugin_tr_help() {
$help = tra("Translate a string");
$help .= "~np~{TR()}string{TR}~/np~";
return $help;
}
function wikiplugin_tr_info() {
return array(
'name' => tra('Tra... |
Make executable before develop/install, print what is made executable, and also run the actual develop/install. | from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
import os
dependencies = [
'requests~=2.7'
]
class PostDevelopCommand(develop):
def run(self):
make_director_executable()
develop.run(self)
class PostInstallCommand(install):
def r... | from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
import os
dependencies = [
'requests~=2.7'
]
class PostDevelopCommand(develop):
def run(self):
make_director_executable()
class PostInstallCommand(install):
def run(self):
make_dir... |
Fix two mistakes of method description
Fix two mistakes of method description in processor.py
Change-Id: I3434665b6d458937295b0563ea0cd0ee6aebaca1 | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... |
Switch to using InteractiveInterpreter object instead of eval | import sys
import code
from diesel import Application, Pipe, until
DEFAULT_PROMPT = '>>> '
def readcb():
from diesel.app import current_app
print 'Diesel Console'
cmd = ''
prompt = DEFAULT_PROMPT
interp = code.InteractiveInterpreter(locals={'app':current_app})
while 1:
sys.stdout.writ... | import sys
import code
from diesel import Application, Pipe, until
DEFAULT_PROMPT = '>>> '
def readcb():
print 'Diesel Console'
cmd = ''
prompt = DEFAULT_PROMPT
while 1:
sys.stdout.write(prompt)
sys.stdout.flush()
input = yield until("\n")
cmd += input
if input... |
fix: Make event emitter from blank object
- If a function is passed to jQuery, it calls it 🤷🏻♂️
- In hindsight, it is not needed to pass the object to jQuery
- This fixes a weird bug explained here
https://github.com/frappe/frappe/pull/6791 | frappe.provide('frappe.utils');
/**
* Simple EventEmitterMixin which uses jQuery's event system
*/
const EventEmitterMixin = {
init() {
this.jq = jQuery({});
},
trigger(evt, data) {
!this.jq && this.init();
this.jq.trigger(evt, data);
},
once(evt, handler) {
!this.jq && this.init();
this.jq.one(evt, ... | frappe.provide('frappe.utils');
/**
* Simple EventEmitterMixin which uses jQuery's event system
*/
const EventEmitterMixin = {
init() {
this.jq = jQuery(this);
},
trigger(evt, data) {
!this.jq && this.init();
this.jq.trigger(evt, data);
},
once(evt, handler) {
!this.jq && this.init();
this.jq.one(evt... |
Fix the initial search migration
There is no point in creating the model in this way, that's just not how
it's used: instead we want to use the FTS4 extension from SQLite. | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from ideascube.search.utils import create_index_table
class CreateSearchModel(migrations.CreateModel):
def database_forwards(self, *_):
# Don't run the parent method, we create the table our own way
c... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import ideascube.search.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Search',
fields=[
... |
Apply lint to easy client | var Http = require('http');
class EasyClient {
constructor(options) {
this.options = options;
this.postData = options.data;
}
call(success) {
var responseData = '';
var req = Http.request(this.options);
if (this.postData) {
req.write(this.postData);
}
req.on('response', func... | var Http = require('http');
class EasyClient {
constructor(options) {
this.options = options
this.postData = options.data;
}
static get(options) {
}
call(success) {
var responseData = '',
client = this;
var req = Http.request(this.options);
if (this.postData) {
req.write... |
Clean up $pre parameter description | <?php
/*
* Layout functions
*/
// `is_currentfile`
//
// Checks for current file. Returns boolean.
function is_currentfile($file) {
if (preg_match("/$file$/", $_SERVER['PHP_SELF'])) {
return true;
}
}
// `filecount`
//
// Counts number of files in a directory. `$dir` must be without a trailing
// slash.
fu... | <?php
/*
* Layout functions
*/
// `is_currentfile`
//
// Checks for current file. Returns boolean.
function is_currentfile($file) {
if (preg_match("/$file$/", $_SERVER['PHP_SELF'])) {
return true;
}
}
// `filecount`
//
// Counts number of files in a directory. `$dir` must be without a trailing
// slash.
fu... |
Add python versions to classifiers | import os
from setuptools import setup, find_packages
ROOT = os.path.abspath(os.path.dirname(__file__))
setup(
name='Flask-Mobility',
version='0.1',
url='http://github.com/rehandalal/flask-mobility/',
license='BSD',
author='Rehan Dalal',
author_email='rehan@meet-rehan.com',
description='A ... | import os
from setuptools import setup, find_packages
ROOT = os.path.abspath(os.path.dirname(__file__))
setup(
name='Flask-Mobility',
version='0.1',
url='http://github.com/rehandalal/flask-mobility/',
license='BSD',
author='Rehan Dalal',
author_email='rehan@meet-rehan.com',
description='A ... |
Refactor tests with `runTests()` helper
`runTests()` will create and run tests given parser and mock data.
Since the helper creates an `it()` block for each mock object key,
this allows the tests to be DRY and clear. Also, debugging will be
easier since the type of parser test being run is made explicit. | 'use strict';
/**
* Module dependencies.
*/
var assert = require('chai').assert;
var mocks = require('./mocks/');
var htmlparser = require('htmlparser2');
/**
* Helper that creates and runs tests based on mock data.
*
* @param {Function} parser - The parser.
* @param {Object} mockObj - The mock object.
*/
f... | 'use strict';
/**
* Module dependencies.
*/
var assert = require('chai').assert;
var mocks = require('./mocks/');
var htmlparser = require('htmlparser2');
/**
* Tests for parser.
*/
describe('html-dom-parser', function() {
describe('server parser', function() {
var parser = require('../');
i... |
Update REST API address in test | import requests
from nose.plugins.attrib import attr
@attr('webservice')
def test_rest_api_responsive():
stmt_str = '{"statements": [{"sbo": "http://identifiers.org/sbo/SBO:0000526", "type": "Complex", "id": "acc6d47c-f622-41a4-8ae9-d7b0f3d24a2f", "members": [{"db_refs": {"TEXT": "MEK", "FPLX": "MEK"}, "name": "ME... | import requests
from nose.plugins.attrib import attr
@attr('webservice')
def test_rest_api_responsive():
stmt_str = '{"statements": [{"sbo": "http://identifiers.org/sbo/SBO:0000526", "type": "Complex", "id": "acc6d47c-f622-41a4-8ae9-d7b0f3d24a2f", "members": [{"db_refs": {"TEXT": "MEK", "FPLX": "MEK"}, "name": "ME... |
Fix content height not being set on Safari | 'use strict';
module.exports = [
'$rootScope', '$window', '$timeout',
function FixContainerHeight($rootScope, $window, $timeout) {
return {
restrict: 'A',
link: function($scope, el) {
function setParentHeight() {
var pel = el[0].parentNode;
var h = el[0].offsetHeight;
... | 'use strict';
module.exports = [
'$rootScope', '$window', '$timeout',
function FixContainerHeight($rootScope, $window, $timeout) {
return {
restrict: 'A',
link: function($scope, el) {
function setParentHeight() {
var pel = el[0].parentNode;
var h = el[0].offsetHeight;
... |
Remove bug in autorunner management in PHAR. | <?php
namespace mageekguy\atoum;
use
mageekguy\atoum,
mageekguy\atoum\scripts\phar
;
if (extension_loaded('phar') === false)
{
throw new \runtimeException('Phar extension is mandatory to use this PHAR');
}
define(__NAMESPACE__ . '\phar\name', 'mageekguy.atoum.phar');
\phar::mapPhar(atoum\phar\name);
$versions ... | <?php
namespace mageekguy\atoum;
use
mageekguy\atoum,
mageekguy\atoum\scripts\phar
;
if (extension_loaded('phar') === false)
{
throw new \runtimeException('Phar extension is mandatory to use this PHAR');
}
define(__NAMESPACE__ . '\phar\name', 'mageekguy.atoum.phar');
\phar::mapPhar(atoum\phar\name);
$versions ... |
Add check to ensure truncate does not error
- check if input exists before acting on it
- silences thrown error
- spirit of template filter, do nothing rather than fail if input is incorrect | /**
* Return a truncated version of a string
* @param {string} input
* @param {integer} length
* @param {boolean} killwords
* @param {string} end
* @return {string}
*/
PolymerExpressions.prototype.truncate = function (input, length, killwords, end) {
var orig = input;
length = length || 255;
if(!... | /**
* Return a truncated version of a string
* @param {string} input
* @param {integer} length
* @param {boolean} killwords
* @param {string} end
* @return {string}
*/
PolymerExpressions.prototype.truncate = function (input, length, killwords, end) {
var orig = input;
lengt... |
Remove debuging add needed header | package marogo
import "sync"
import "encoding/json"
import "net/http"
import "bytes"
import "fmt"
func MakeRequest(address string, method string, data interface{}, needsHeader bool) (*http.Response, error) {
address = API_URL + address
jsob, err := json.Marshal(data)
fmt.Print("%v\n", string(jsob))
if err != nil ... | package marogo
import "sync"
import "encoding/json"
import "net/http"
import "bytes"
import "fmt"
func MakeRequest(address string, method string, data interface{}) (*http.Response, error) {
address = API_URL + address
jsob, err := json.Marshal(data)
fmt.Print("%v\n", string(jsob))
if err != nil {
return nil, er... |
Update to specify content-type header | import requests
from .resources.batches import Batches
from .resources.jobs import Jobs
DEFAULT_API_ROOT = 'http://app.spare5.com/partner/v2'
class Spare5Client(object):
def __init__(self, username, token, api_root=DEFAULT_API_ROOT):
super(Spare5Client, self).__init__()
self.api_root = api_root... | import requests
from .resources.batches import Batches
from .resources.jobs import Jobs
DEFAULT_API_ROOT = 'http://app.spare5.com/partner/v2'
class Spare5Client(object):
def __init__(self, username, token, api_root=DEFAULT_API_ROOT):
super(Spare5Client, self).__init__()
self.api_root = api_root... |
Update AsynchronousAction default values of min_workers to 0 and max_seconds_idle to 60 | from bot.action.core.action import IntermediateAction
from bot.multithreading.work import Work
class AsynchronousAction(IntermediateAction):
def __init__(self, name: str, min_workers: int = 0, max_workers: int = 4, max_seconds_idle: int = 60):
super().__init__()
self.name = name
self.min_w... | from bot.action.core.action import IntermediateAction
from bot.multithreading.work import Work
class AsynchronousAction(IntermediateAction):
def __init__(self, name: str, min_workers: int = 1, max_workers: int = 4, max_seconds_idle: int = 15):
super().__init__()
self.name = name
self.min_w... |
Apply markups from the outside in | 'use strict';
module.exports = convert
var serializeInline = require('./inline').serializeInline
/**
* convert(elem, s) performs the actual work of converting an element
* into its abstract representation.
*
* @param {Element} elem
* @param {Serialize} s
*/
function convert (elem, s) {
var allMarkups = [],
... | 'use strict';
module.exports = convert
var serializeInline = require('./inline').serializeInline
/**
* convert(elem, s) performs the actual work of converting an element
* into its abstract representation.
*
* @param {Element} elem
* @param {Serialize} s
*/
function convert (elem, s) {
var node = elem,
... |
Use POST for all methods requiring it in specs
Added all missing methods from https://dev.twitter.com/docs/api/1.1
Also included some of the streaming methods which work with both GET
and POST but accept arguments like "track" which can quickly require
POST.
(Closes #187 #145 #188) | '''
This module is automatically generated using `update.py`
.. data:: POST_ACTIONS
List of twitter method names that require the use of POST
'''
POST_ACTIONS = [
# Status Methods
'update', 'retweet',
# Direct Message Methods
'new',
# Account Methods
'update_profile_image', ... | '''
This module is automatically generated using `update.py`
.. data:: POST_ACTIONS
List of twitter method names that require the use of POST
'''
POST_ACTIONS = [
# Status Methods
'update', 'retweet',
# Direct Message Methods
'new',
# Account Methods
'update_profile_image', ... |
Support sources rather than source | <?php
/**
* mbp-logging-reports.php
*
* A producer to create reports based on logged data in mb-logging-api.
*/
use DoSomething\MBP_LoggingReports\MBP_LoggingReports_Users;
date_default_timezone_set('America/New_York');
define('CONFIG_PATH', __DIR__ . '/messagebroker-config');
// Load up the Composer autoload m... | <?php
/**
* mbp-logging-reports.php
*
* A producer to create reports based on logged data in mb-logging-api.
*/
use DoSomething\MBP_LoggingReports\MBP_LoggingReports_Users;
date_default_timezone_set('America/New_York');
define('CONFIG_PATH', __DIR__ . '/messagebroker-config');
// Load up the Composer autoload m... |
Fix indentation issues in javadoc code samples | /*
* Copyright 2015 Google Inc. 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 required by appli... | /*
* Copyright 2015 Google Inc. 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 required by appli... |
Fix the github xhr interface | const github = require('./lib/github')
const view = require('./lib/view')
var feeds
require('./lib/feeds')
.then(res => feeds = res)
module.exports = {
'/api/github/xhr/{command}': (request, reply) => {
github.xhr[request.params.command]
? github.xhr[request.params.command](reply)
: reply.continu... | const github = require('./lib/github')
const view = require('./lib/view')
var feeds
require('./lib/feeds')
.then(res => feeds = res)
module.exports = {
'/api/github/xhr/{command}': (request, reply) => {
github.xhr[request.params.command]
? github[request.params.command](reply)
: reply.continue()
... |
Fix check style issue exceeding no of chars in one line | package org.wso2.carbon.apimgt.core.configuration.models;
import org.wso2.carbon.apimgt.core.util.APIMgtConstants;
import org.wso2.carbon.config.annotation.Configuration;
import org.wso2.carbon.config.annotation.Element;
import java.util.Collections;
import java.util.List;
/**
* Class to hold Environment configurat... | package org.wso2.carbon.apimgt.core.configuration.models;
import org.wso2.carbon.apimgt.core.util.APIMgtConstants;
import org.wso2.carbon.config.annotation.Configuration;
import org.wso2.carbon.config.annotation.Element;
import java.util.Collections;
import java.util.List;
/**
* Class to hold Environment configurat... |
Make sure we have both images and not just one of them before building | """Handles all command line actions for Berth."""
import berth.build as build
import berth.config as config
import berth.utils as utils
import click
@click.command(help='Berth use Docker containers to build packages for you, based on a YAML configuration file.')
@click.pass_context
@click.version_option(prog_name='B... | """Handles all command line actions for Berth."""
import berth.build as build
import berth.config as config
import berth.utils as utils
import click
@click.command(help='Berth use Docker containers to build packages for you, based on a YAML configuration file.')
@click.pass_context
@click.version_option(prog_name='B... |
Fix render method for sfWidgetFormInputFileMulti | <?php
/**
* sfWidgetFormInputFileMulti represents an upload HTML input tag with multiple option.
*
* @package symfony
* @subpackage widget
* @author Vincent Chabot <vchabot@groupe-exp.com>
* @version SVN: $Id$
*/
class sfWidgetFormInputFileMulti extends sfWidgetFormInputFile
{
/**
* Configures th... | <?php
/**
* sfWidgetFormInputFileMulti represents an upload HTML input tag with multiple option.
*
* @package symfony
* @subpackage widget
* @author Vincent Chabot <vchabot@groupe-exp.com>
* @version SVN: $Id$
*/
class sfWidgetFormInputFileMulti extends sfWidgetFormInputFile
{
/**
* Configures th... |
Change fluent to eloquent to fix timestamps | <?php
/**
* Copyright (C) 2014 Ibrahim Yusuf <ibrahim7usuf@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the ... | <?php
/**
* Copyright (C) 2014 Ibrahim Yusuf <ibrahim7usuf@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the ... |
Return HTTP 403 when access is forbidden | <?php
namespace Kanboard\Controller;
use Kanboard\Core\Base;
/**
* Class AppController
*
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class AppController extends Base
{
/**
* Forbidden page
*
* @access public
* @param bool $withoutLayout
* @param string $message... | <?php
namespace Kanboard\Controller;
use Kanboard\Core\Base;
/**
* Class AppController
*
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class AppController extends Base
{
/**
* Forbidden page
*
* @access public
* @param bool $withoutLayout
* @param string $message... |
Load only js files by default | /* eslint-disable global-require, import/no-dynamic-require */
import React, { Component, PropTypes } from 'react'
export default class ComponentDoc extends Component {
static propTypes = {
path: PropTypes.string.isRequired,
}
state = {
component: null,
docs: null,
}
componentWillMount() {
... | /* eslint-disable global-require, import/no-dynamic-require */
import React, { Component, PropTypes } from 'react'
export default class ComponentDoc extends Component {
static propTypes = {
path: PropTypes.string.isRequired,
}
state = {
component: null,
docs: null,
}
componentWillMount() {
... |
Revert "GCW-1826 Disable scroll when menu is open"
This reverts commit 18e774eb4e8a0033727c0a16e494ed04c60c8abb. | import Ember from 'ember';
export default Ember.Component.extend({
foundation: null,
currentClassName: Ember.computed("className", function(){
return this.get("className") ? `.${this.get('className')}` : document;
}),
click() {
Ember.run.later(function() {
if($('.off-canvas-wrap.move-right')[0... | import Ember from 'ember';
import config from '../config/environment';
export default Ember.Component.extend({
foundation: null,
isMobileApp: config.cordova.enabled,
currentClassName: Ember.computed("className", function(){
return this.get("className") ? `.${this.get('className')}` : document;
}),
cli... |
[Extensions] Add support for persistent callback listener
This is going to be the base of the EventTarget implementation. It is
important to remove the listener at some point otherwise the object will
leak. | // Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var callback_listeners = {};
var callback_id = 0;
var extension_object;
function wrapCallback(args, callback) {
if (callback) {
var id = (callback... | // Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var callback_listeners = {};
var callback_id = 0;
var extension_object;
function wrapCallback(args, callback) {
if (callback) {
var id = (callback... |
Add missing email validation during initial setup | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms import BooleanField, StringField
from wtforms.fields... | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms import BooleanField, StringField
from wtforms.fields... |
Fix wrong default behaviour for analytics opt out | <?php
/**
* Plugin to remove component which uses cookie when user has chosen to opt-out from cookies
*
* Needs to used in conjunction with Kwc_Statistics_CookieBeforePlugin
*
* @see Kwc_Statistics_Analytics_Component
*/
class Kwc_Statistics_CookieAfterPlugin extends Kwf_Component_Plugin_Abstract
implements K... | <?php
/**
* Plugin to remove component which uses cookie when user has chosen to opt-out from cookies
*
* Needs to used in conjunction with Kwc_Statistics_CookieBeforePlugin
*
* @see Kwc_Statistics_Analytics_Component
*/
class Kwc_Statistics_CookieAfterPlugin extends Kwf_Component_Plugin_Abstract
implements K... |
Check for DVD device for ripping queue processing | (function() {
'use strict';
var ripper = require('./Rip'),
fs = require('fs'),
encoder = require('./Encode'),
ui = require('bull-ui/app')({
redis: {
host: 'localhost',
port: '6379'
}
}),
Queue = require('bull');
ui.listen(1337, function() {
console.log('bull-u... | (function() {
'use strict';
var ripper = require('./Rip'),
encoder = require('./Encode'),
ui = require('bull-ui/app')({
redis: {
host: 'localhost',
port: '6379'
}
}),
Queue = require('bull');
ui.listen(1337, function() {
console.log('bull-ui started listening on p... |
Add docstring, change tables searched | #! /usr/bin/env python
"""
Calculate statistics for each study area, and prints results to stdout.
All it prints is the number of blankspots, the number of v1 nodes,
and the number of total nodes. Since I am no longer storing the blankspot
information in the hist_point table itself, these stats are no longer very inf... | #! /usr/bin/env python
import MapGardening
import optparse
usage = "usage: %prog [options]"
p = optparse.OptionParser(usage)
p.add_option('--place', '-p',
default="all"
)
options, arguments = p.parse_args()
possible_tables = [
'hist_point',
'hist_poin... |
Remove old style system callback, add function names for render() and debug()
git-svn-id: fac99be8204c57f0935f741ea919b5bf0077cdf6@9403 688a9155-6ab5-4160-a077-9df41f55a9e9 | import('helma.system', 'system');
system.addHostObject(org.helma.web.Response);
/**
* Render a skin to the response's buffer
* @param skin
* @param context
* @param scope
*/
Response.prototype.render = function render(skin, context, scope) {
var render = require('helma.skin').render;
this.write(render(sk... | import('helma.system', 'system');
system.addHostObject(org.helma.web.Response);
system.addCallback("onResponse", "debugFlusher", function(res) {
if (res.status == 200 || res.status >= 400) {
res.flushDebug();
}
})
/**
* Render a skin to the response's buffer
* @param skin
* @param context
* @para... |
Simplify regex using non-greedy qualifier | import re
# <a> followed by another <a> without any intervening </a>s
# outer_link - partial outer element up to the inner link
# inner_content - content of the inner_link
link_inside_link_regex = re.compile(
ur"(?P<outer_link><a ((?!</a>).)*)<a .*?>(?P<inner_content>.*?)</a>",
re.IGNORECASE | re.DOTALL)
def... | import re
# <a> followed by another <a> without any intervening </a>s
link_inside_link_regex = re.compile(
ur"(?P<outer_link><a ((?!</a>).)*)(<a ((?!</a>).)*>"
ur"(?P<internal_content>((?!</a>).)*)</a>)",
re.IGNORECASE | re.DOTALL)
def flatten_links(text):
"""
Fix <a> elements that have embedded ... |
Add docstrings to rules unit tests | """ Tests for the rules module """
import unittest
from src import rules
class TestRules(unittest.TestCase):
""" Tests for the rules module """
def test_good_value_1(self):
""" Test a known good value"""
rules_obj = rules.Rules()
result = rules_obj.convertCharToInt('1')
self.a... | import unittest
from src import rules
class TestRules(unittest.TestCase):
def test_good_value_1(self):
rules_obj = rules.Rules()
result = rules_obj.convertCharToInt('1')
self.assertEqual(result, 1)
def test_good_value_3(self):
rules_obj = rules.Rules()
result = rules_obj.convertCharToInt('3')
self.asser... |
Add collision detection for Obstacle | package com.pqbyte.coherence;
import com.badlogic.gdx.physics.box2d.Contact;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.badlogic.gdx.physics.box2d.ContactListener;
import com.badlogic.gdx.physics.box2d.Manifold;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Array;
... | package com.pqbyte.coherence;
import com.badlogic.gdx.physics.box2d.Contact;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.badlogic.gdx.physics.box2d.ContactListener;
import com.badlogic.gdx.physics.box2d.Manifold;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Array;
... |
Rename Function Based on Feedback | import * as containers from "./container-view-builder";
import * as url from "url";
import { fetch } from "jsua";
export function linkViewBuilder(node) {
var view = document.createElement("a");
if (node.base) {
view.href = url.resolve(node.base, node.value.href);
} else {
view.href = node.value.href... | import * as containers from "./container-view-builder";
import * as url from "url";
import { fetch } from "jsua";
export function linkViewBuilder(node) {
var view = document.createElement("a");
if (node.base) {
view.href = url.resolve(node.base, node.value.href);
} else {
view.href = node.value.href... |
Add .amr extension to supported audio files | package com.todoist.mediaparser;
import com.todoist.mediaparser.util.StringUtils;
class AudioFileParser extends MediaParser {
// FIXME: .aac is only supported in Android 3.0+.
// FIXME: .flac is only supported in Android 3.1+.
private static final String[] EXTENSIONS = {".m4a", ".aac", ".amr", ".flac", ".... | package com.todoist.mediaparser;
import com.todoist.mediaparser.util.StringUtils;
class AudioFileParser extends MediaParser {
// FIXME: .aac is only supported in Android 3.0+.
// FIXME: .flac is only supported in Android 3.1+.
private static final String[] EXTENSIONS = {".m4a", ".aac", ".flac", ".mp3", ".... |
Check if we have tried, pause if we have | package com.nirima.jenkins.plugins.docker.utils;
import com.nirima.docker.client.DockerException;
import hudson.model.TaskListener;
import hudson.slaves.ComputerLauncher;
import hudson.slaves.DelegatingComputerLauncher;
import hudson.slaves.SlaveComputer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
impor... | package com.nirima.jenkins.plugins.docker.utils;
import com.nirima.docker.client.DockerException;
import hudson.model.TaskListener;
import hudson.slaves.ComputerLauncher;
import hudson.slaves.DelegatingComputerLauncher;
import hudson.slaves.SlaveComputer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
impor... |
Fix sample event listener should call next | /* global assert */
module.exports = function(runner, options) {
var called = {};
runner.on('setup', function (next) {
console.log('called "setup"');
called.setup = true;
next(null);
});
runner.on('new client', function (client, next) {
console.log('called "new client"')... | /* global assert */
module.exports = function(runner, options) {
var called = {};
runner.on('setup', function (next) {
console.log('called "setup"');
called.setup = true;
next(null);
});
runner.on('new client', function (client, next) {
console.log('called "new client"')... |
Add new types of peripherals | import copy
from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings
class Peripheral(Device):
type = {
'type': 'string',
'allowed': {
'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Termina... | import copy
from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings
class Peripheral(Device):
type = {
'type': 'string',
'allowed': {'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB', 'S... |
[bugfix] Reset redux value to defualt success. | import {
NO_EXPANDED_ROUTES,
REQUEST_ROUTES,
REQUEST_EXPANDED_ROUTES,
RECEIVE_EXPANDED_ROUTES,
RECEIVE_ROUTES_LYFT,
RECEIVE_ROUTES_UBER
} from '../actions/types';
// Setting state to this default feels ghetto... probably a better way
export default function(state={routes:{close:null,medium:null,far:null},m... | import {
NO_EXPANDED_ROUTES,
REQUEST_ROUTES,
REQUEST_EXPANDED_ROUTES,
RECEIVE_EXPANDED_ROUTES,
RECEIVE_ROUTES_LYFT,
RECEIVE_ROUTES_UBER
} from '../actions/types';
// Setting state to this default feels ghetto... probably a better way
export default function(state={routes:{close:null,medium:null,far:null},m... |
Make verification required field optional | <?php
namespace AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
class QualificationType extends AbstractType
{
/**
* @param FormB... | <?php
namespace AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
class QualificationType extends AbstractType
{
/**
* @param FormB... |
Revert change, App must be nullable | <?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim
* @copyright Copyright (c) 2011-2017 Josh Lockhart
* @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License)
*/
namespace Slim;
use Slim\Interfaces\RouteGroupInterface;
/**
* A collector f... | <?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim
* @copyright Copyright (c) 2011-2017 Josh Lockhart
* @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License)
*/
namespace Slim;
use Slim\Interfaces\RouteGroupInterface;
/**
* A collector f... |
Make sure to load the new mongo south adapter |
from test_project.settings import *
DATABASES['mongo'] = {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'mutant',
'OPTIONS': {
'OPERATIONS': {
'save' : {'safe' : True},
}
}
}
SOUTH_DATABASE_ADAPTERS = {'mongo': 'django_mongodb_engine.south_adapter'}
INSTALLED_APPS.extend(['django_mongodb_engin... |
from test_project.settings import *
DATABASES['mongo'] = {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'mutant',
'OPTIONS': {
'OPERATIONS': {
'save' : {'safe' : True},
}
}
}
SOUTH_DATABASE_ADAPTERS = {'mongo': 'django_mongodb_engine.south'}
INSTALLED_APPS.extend(['django_mongodb_engine', 'dja... |
Change Admin/Home controller parent to MY_Controller to get check_admin() method
Signed-off-by: JWhy <6a9f7c06e789f829524fd1a3a38b8c7d794c3a1f@jwhy.de> | <?php
class Home extends MY_Controller {
public function index() {
if($this->check_admin() === true){
$data['title'] = 'Admin Panel';
$this->load->view('general/header', $data);
$this->load->view('admin/index', $data);
$this->load->view('general/footer');
}
}
... | <?php
class Home extends CI_Controller {
public function index() {
if($this->check_admin() === true){
$data['title'] = 'Admin Panel';
$this->load->view('general/header', $data);
$this->load->view('admin/index', $data);
$this->load->view('general/footer');
}
}
... |
Fix a NPE plaguing tests that use the BlockingQueue transport. | /*
* Copyright 2012 the original author or 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 applica... | /*
* Copyright 2012 the original author or 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 applica... |
Repair check for correct status code on deploy. | var Request = require('./request')
, Browser = require('./browser');
var Theme = function (session, blog, html) {
this.session = session;
this.blog = blog;
this.html = html;
}
Theme.prototype = {
save: function () {
return this.session.create()
.with(this)
.then(this.get_customize_form)
... | var Request = require('./request')
, Browser = require('./browser');
var Theme = function (session, blog, html) {
this.session = session;
this.blog = blog;
this.html = html;
}
Theme.prototype = {
save: function () {
return this.session.create()
.with(this)
.then(this.get_customize_form)
... |
Clean up after science test | """
Scientific tests for SLCosmo package
"""
import matplotlib
matplotlib.use('Agg')
import os
import unittest
import desc.slcosmo
class SLCosmoScienceTestCase(unittest.TestCase):
def setUp(self):
self.message = 'Testing SLCosmo - For Science!'
self.Lets = desc.slcosmo.SLCosmo()
def tearDown(... | """
Scientific tests for SLCosmo package
"""
import matplotlib
matplotlib.use('Agg')
import unittest
import desc.slcosmo
class SLCosmoScienceTestCase(unittest.TestCase):
def setUp(self):
self.message = 'Testing SLCosmo - For Science!'
def tearDown(self):
pass
def test_round_trip(self):
... |
Clean up plugin task file | /*
* grunt-purifycss
* https://github.com/purifycss/grunt-purify-css
*
* Copyright (c) 2015 Phoebe Li, Matthew Rourke, Kenny Tran
* Licensed under the MIT license.
*/
'use strict';
var glob = require('glob');
var purify = require('purify-css');
module.exports = function(grunt) {
grunt.registerMultiTask('pur... | /*
* grunt-purifycss
* https://github.com/purifycss/grunt-purify-css
*
* Copyright (c) 2015 Phoebe Li, Matthew Rourke, Kenny Tran
* Licensed under the MIT license.
*/
'use strict';
var glob = require('glob');
var purify = require('purify-css');
module.exports = function(grunt) {
// Please see the Grunt docu... |
Use tagged template literal for chalk | #!/usr/bin/env node
"use strict";
const moment = require("moment");
const sugar = require("sugar");
const chalk = require("chalk");
const exec = require("child_process").exec;
let fatal = err => {
console.error(`fatal: ${err}`);
process.exit(1);
};
process.argv.splice(0, 2);
if (process.argv.length === 0) {... | #!/usr/bin/env node
"use strict";
const moment = require("moment");
const sugar = require("sugar");
const chalk = require("chalk");
const exec = require("child_process").exec;
let fatal = err => {
console.error(`fatal: ${err}`);
process.exit(1);
};
process.argv.splice(0, 2);
if (process.argv.length === 0) {... |
Make sure Django is required | 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="",
author_email="",
description="",
name="pinax-{{... | 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="",
author_email="",
description="",
name="pinax-{{... |
Use 2 octets to indicate padding length. | // Copyright 2016 Martijn Croonen. All rights reserved.
// Use of this source code is governed by the MIT license, a copy of which can
// be found in the LICENSE file.
package ece
import (
"crypto/aes"
"crypto/cipher"
"encoding/binary"
"errors"
)
// Encrypt encrypts |plaintext| using AEAD_AES_GCM_128 with the ke... | // Copyright 2016 Martijn Croonen. All rights reserved.
// Use of this source code is governed by the MIT license, a copy of which can
// be found in the LICENSE file.
package ece
import (
"crypto/aes"
"crypto/cipher"
"errors"
)
// Encrypt encrypts |plaintext| using AEAD_AES_GCM_128 with the keys in |keys|
// add... |
Allow passing config as lazy-evaluated function | import fs from 'fs'
import _ from 'lodash'
import postcss from 'postcss'
import cssnext from 'postcss-cssnext'
import stylefmt from 'stylefmt'
import defaultConfig from './defaultConfig'
import mergeConfig from './util/mergeConfig'
import addCustomMediaQueries from './lib/addCustomMediaQueries'
import generateUtiliti... | import fs from 'fs'
import _ from 'lodash'
import postcss from 'postcss'
import cssnext from 'postcss-cssnext'
import stylefmt from 'stylefmt'
import defaultConfig from './defaultConfig'
import mergeConfig from './util/mergeConfig'
import addCustomMediaQueries from './lib/addCustomMediaQueries'
import generateUtiliti... |
Fix off by one and string conversion | package fizzbuzz
import (
"fmt"
"log"
)
func Generate(count int) ([]string, error) {
if count <= 0 {
return nil, fmt.Errorf("fizzbuzz: Negative fizzbuzz count provided")
}
fizzbuzz := make([]string, count)
var output string
for i := 1; i <= count; i++ {
switch {
case i%15 == 0:
output = "FizzBuzz"
... | package fizzbuzz
import (
"fmt"
"log"
)
func Generate(count int) ([]string, error) {
if count <= 0 {
return nil, fmt.Errorf("fizzbuzz: Negative fizzbuzz count provided")
}
fizzbuzz := make([]string, count)
var output string
for i := 1; i <= count; i++ {
switch {
case i%15 == 0:
output = "FizzBuzz"
... |
Update Sparser script for phase3 | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import glob
from indra import sparser
base_folder = os.path.join(os.environ['HOME'],
'data/darpa/phase3_eval/sources/sparser-20170330')
def get_file_names(base_dir):
fnames ... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import glob
from indra import sparser
base_folder = os.path.join(os.environ['HOME'],
'data/darpa/phase3_eval/sources/sparser-20170210')
def get_file_names(base_dir):
fnames ... |
Fix wrong name for private field. | <?php
namespace Predis\Options;
class CustomOption extends Option {
private $_validate, $_default;
public function __construct(Array $options) {
$validate = isset($options['validate']) ? $options['validate'] : 'parent::validate';
$default = isset($options['default']) ? $options['default'] : ... | <?php
namespace Predis\Options;
class CustomOption extends Option {
private $__validate, $_default;
public function __construct(Array $options) {
$validate = isset($options['validate']) ? $options['validate'] : 'parent::validate';
$default = isset($options['default']) ? $options['default'] :... |
Add source to Article objects | 'use strict';
var app = app || {};
(function (module) {
let sourceArticles = {};
sourceArticles.all = [];
sourceArticles.requestArticles = function (callback) {
$.get('/news')
.then(data => {
sourceArticles.all = (JSON.parse(data).articles);
sourceArticles.all.forEach(obj => obj.sourc... | 'use strict';
var app = app || {};
(function (module) {
let sourceArticles = {};
sourceArticles.all = [];
sourceArticles.requestArticles = function (callback) {
console.log('requestArticles is listening');
$.get('/news')
.then(data => sourceArticles.all = (JSON.parse(data).articles), err =>... |
Use simple_tag instead of assignment_tag
The assignment_tag is depraceted and in django-2.0 removed.
Signed-off-by: Frantisek Lachman <bae095a6f6bdabf882218c81fdc3947ea1c10590@gmail.com> | from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from ..menu import generate_menu
register = template.Library()
@register.simple_tag(takes_context=True)
def get_menu(context, menu_name):
"""
Returns a consumable menu list for a given ... | from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from ..menu import generate_menu
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_menu(context, menu_name):
"""
Returns a consumable menu list for a gi... |
Update patch-level version number, upload to pypi | from setuptools import setup
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = open('README.md').read()
setup(
name="xonsh-apt-tabcomplete",
version="0.1.6",
license="BSD",
url="https://github.com/DangerOnTheRanger... | from setuptools import setup
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = open('README.md').read()
setup(
name="xonsh-apt-tabcomplete",
version="0.1.3",
license="BSD",
url="https://github.com/DangerOnTheRanger... |
Fix a dumb mistake that broke the all-posts page | import moment from 'moment';
import { addCallback } from 'meteor/vulcan:core';
// Add 'after' and 'before' properties to terms which can be used to limit posts in time.
function PostsAddBeforeAfterParameters (parameters, terms, apolloClient) {
if (!parameters.selector.postedAt) {
let postedAt = {};
if (term... | import moment from 'moment';
import { addCallback } from 'meteor/vulcan:core';
// Add 'after' and 'before' properties to terms which can be used to limit posts in time.
function PostsAddBeforeAfterParameters (parameters, terms, apolloClient) {
if (parameters.selector.postedAt) {
let postedAt = {};
if (terms... |
Fix opencage reverse issue where it was using self.lcoation instead of just location | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.opencage import OpenCageResult, OpenCageQuery
from geocoder.location import Location
class OpenCageReverseResult(OpenCageResult):
@property
def ok(self):
return bool(self.address)
class OpenCageR... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.opencage import OpenCageResult, OpenCageQuery
from geocoder.location import Location
class OpenCageReverseResult(OpenCageResult):
@property
def ok(self):
return bool(self.address)
class OpenCageR... |
Print process.env to debug Travis | import React from 'react';
import { mount } from 'enzyme';
import { createStore } from 'redux';
import Phone from '../dev-server/Phone';
import App from '../dev-server/containers/App';
import brandConfig from '../dev-server/brandConfig';
import version from '../dev-server/version';
import prefix from '../dev-server/pr... | import React from 'react';
import { mount } from 'enzyme';
import { createStore } from 'redux';
import Phone from '../dev-server/Phone';
import App from '../dev-server/containers/App';
import brandConfig from '../dev-server/brandConfig';
import version from '../dev-server/version';
import prefix from '../dev-server/pr... |
Add completion message to module:validate command | <?php
declare(strict_types=1);
namespace LotGD\Core\Console\Command;
use LotGD\Core\Bootstrap;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\C... | <?php
declare(strict_types=1);
namespace LotGD\Core\Console\Command;
use LotGD\Core\Bootstrap;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\C... |
Remove downloaded file before updating counter | #!/usr/bin/env python3
import ftplib
import gzip
import os
import sys
host = 'ftp.ncdc.noaa.gov'
base = '/pub/data/noaa'
retries = 3
ftp = ftplib.FTP(host)
ftp.login()
for line in sys.stdin:
(year, filename) = line.strip().split()
for i in range(retries):
sys.stderr.write('reporter:status:Processing ... | #!/usr/bin/env python3
import ftplib
import gzip
import os
import sys
host = 'ftp.ncdc.noaa.gov'
base = '/pub/data/noaa'
retries = 3
ftp = ftplib.FTP(host)
ftp.login()
for line in sys.stdin:
(year, filename) = line.strip().split()
for i in range(retries):
sys.stderr.write('reporter:status:Processing ... |
Fix girder_work script bug: PEP 263 is not compatible with exec | ###############################################################################
# Copyright Kitware 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/lic... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... |
Add save_config for brocade VDX | """Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enable mode on Brocade VDX."""
... | """Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enable mode on Brocade VDX."""
... |
Change the order of the update matchday menu | (function() {
'use strict';
angular
.module('app.matchday')
.controller('UpdateRankMatchday', UpdateRankMatchday);
function UpdateRankMatchday(initData, $scope, $rootScope, $modal) {
$rootScope.$broadcast('state-btn', 'updaterank');
$rootScope.$broadcast('show-phase-nav', false);
var vm = this;
vm.cu... | (function() {
'use strict';
angular
.module('app.matchday')
.controller('UpdateRankMatchday', UpdateRankMatchday);
function UpdateRankMatchday(initData, $scope, $rootScope, $modal) {
$rootScope.$broadcast('state-btn', 'updaterank');
$rootScope.$broadcast('show-phase-nav', false);
var vm = this;
vm.cu... |
Make $routePattern default value null | <?php
namespace Juy\ActiveMenu;
/**
* Class Active
*
* @package Juy\Providers
*/
class Active
{
/**
* Current matched route
*
* @var Route
*/
protected $currentRouteName;
/**
* Active constructor
*
* @param $currentRouteName
*/
public function __construct($... | <?php
namespace Juy\ActiveMenu;
/**
* Class Active
*
* @package Juy\Providers
*/
class Active
{
/**
* Current matched route
*
* @var Route
*/
protected $currentRouteName;
/**
* Active constructor
*
* @param $currentRouteName
*/
public function __construct($... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.