text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use pympler only if available | import guv
guv.monkey_patch()
import guv.server
import logging
import time
from util import create_example
import logger
try:
from pympler import tracker
tr = tracker.SummaryTracker()
except ImportError:
tr = None
if not hasattr(time, 'perf_counter'):
time.perf_counter = time.clock
logger.configure... | import guv
guv.monkey_patch()
import guv.server
import logging
import time
from util import create_example
import logger
from pympler import tracker
tr = tracker.SummaryTracker()
if not hasattr(time, 'perf_counter'):
time.perf_counter = time.clock
logger.configure()
log = logging.getLogger()
response_times = ... |
Use a saner requirements for python-dateutil
The requirement >=1.0, <2.0, >=2.1 doesn't make a lot of logical sense and it
will break in the future. There is no version that is >= 1.0, and < 2.0, and
>= 2.1 becasue these versions are mutually exclusive. Even if you interpret
the , as OR it still doesn't make sense ... | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
requires = ['six']
if sys.version_info[0] == 2:
requires += ['python-dateutil>=1.0, != 2.0']
else:
# Py3k
requires += ['python-dateutil>=2.0']
setup(
name='freezegun',
version='0.2.2',
description='Let your Python t... | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
requires = ['six']
if sys.version_info[0] == 2:
requires += ['python-dateutil>=1.0, <2.0, >=2.1']
else:
# Py3k
requires += ['python-dateutil>=2.0']
setup(
name='freezegun',
version='0.2.2',
description='Let your Pyt... |
Fix origin-checking logic in postMessage
This allows us to post messages where the origin is something other than `*`. Closes #1789. | "use strict";
const isValidTargetOrigin = require("../utils").isValidTargetOrigin;
const DOMException = require("../web-idl/DOMException");
module.exports = function (message, targetOrigin) {
if (arguments.length < 2) {
throw new TypeError("'postMessage' requires 2 arguments: 'message' and 'targetOrigin'");
}
... | "use strict";
const isValidTargetOrigin = require("../utils").isValidTargetOrigin;
const DOMException = require("../web-idl/DOMException");
module.exports = function (message, targetOrigin) {
if (arguments.length < 2) {
throw new TypeError("'postMessage' requires 2 arguments: 'message' and 'targetOrigin'");
}
... |
Check ember-source version from NPM, if not found use ember from bower | /* jshint node: true */
'use strict';
var path = require('path');
var filterInitializers = require('fastboot-filter-initializers');
var VersionChecker = require('ember-cli-version-checker');
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-head',
treeForApp: function(defaultT... | /* jshint node: true */
'use strict';
var path = require('path');
var filterInitializers = require('fastboot-filter-initializers');
var VersionChecker = require('ember-cli-version-checker');
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-head',
treeForApp: function(defaultT... |
Remove noise from default COBRA configs.
PiperOrigin-RevId: 265733849
Change-Id: Ie0e7c0385497852fd85c769ee85c951542c14463 | # Copyright 2019 DeepMind Technologies Limited.
#
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | # Copyright 2019 DeepMind Technologies Limited.
#
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
Make open assets command trackable | module.exports = {
run(editor, sender, opts = {}) {
const modal = editor.Modal;
const am = editor.AssetManager;
const config = am.getConfig();
const amContainer = am.getContainer();
const title = opts.modalTitle || config.modalTitle || '';
const types = opts.types;
const accept = opts.acce... | module.exports = {
run(editor, sender, opts = {}) {
const modal = editor.Modal;
const am = editor.AssetManager;
const config = am.getConfig();
const amContainer = am.getContainer();
const title = opts.modalTitle || config.modalTitle || '';
const types = opts.types;
const accept = opts.acce... |
Remove scroll listener when it is really not necessary | (function(root, factory) {
if (typeof define === 'function' && define.amd) {
define('scrollindo', factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory;
} else {
root.scrollindo = factory;
}
}(this, function scrollindo(element, newClass) {
if (typeof element... | (function(root, factory) {
if (typeof define === 'function' && define.amd) {
define('scrollindo', factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory;
} else {
root.scrollindo = factory;
}
}(this, function scrollindo(element, newClass) {
if (typeof element... |
Fix cache clearer doc block. | <?php declare(strict_types=1);
/**
* @author Alexander Volodin <mr-stanlik@yandex.ru>
* @copyright Copyright (c) 2020, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
name... | <?php declare(strict_types=1);
/**
* @author Alexander Volodin <mr-stanlik@yandex.ru>
* @copyright Copyright (c) 2020, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
name... |
Call super constructor for BitforgeError |
class BitforgeError(Exception):
def __init__(self, *args, **kwargs):
self.cause = kwargs.pop('cause', None)
self.prepare(*args, **kwargs)
message = self.__doc__.format(**self.__dict__)
super(BitforgeError, self).__init__(message)
def prepare(self):
pass
def __str__... |
class BitforgeError(Exception):
def __init__(self, *args, **kwargs):
self.cause = kwargs.pop('cause', None)
self.prepare(*args, **kwargs)
self.message = self.__doc__.format(**self.__dict__)
def prepare(self):
pass
def __str__(self):
return self.message
class Obje... |
Fix bug: Action name should be split into 2 elements (not 1) | import { createActions, handleActions } from 'redux-actions'
import { takeEvery } from 'redux-saga/effects'
export const createModule = (moduleName, definitions, defaultState) => {
const identityActions = []
const actionMap = {}
const reducerMap = {}
const sagas = []
for (const [type, definition] of Object... | import { createActions, handleActions } from 'redux-actions'
import { takeEvery } from 'redux-saga/effects'
export const createModule = (moduleName, definitions, defaultState) => {
const identityActions = []
const actionMap = {}
const reducerMap = {}
const sagas = []
for (const [type, definition] of Object... |
Append binary file mode to write RSA exported key needed by Python 3 | from Crypto.PublicKey import RSA
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Randomly generate a new RSA key for the OpenID server'
def handle(self, *args, **options):
try:
key = RSA.generate(1024)
f... | from Crypto.PublicKey import RSA
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Randomly generate a new RSA key for the OpenID server'
def handle(self, *args, **options):
try:
key = RSA.generate(1024)
f... |
Fix the --verbose argument to properly take an int
Without this, the `i % args.verbose` check would fail since `args.verbose` was
a string | import json
import bson.json_util as bju
import emission.core.get_database as edb
import argparse
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representa... | import json
import bson.json_util as bju
import emission.core.get_database as edb
import argparse
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representa... |
Fix include for group inbox class | <?php
/**
* Table Definition for group_inbox
*/
require_once 'classes/Memcached_DataObject.php';
class Group_inbox extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public $__table = 'group_inbox'; // table name
pu... | <?php
/**
* Table Definition for group_inbox
*/
require_once 'classes/Memcached_DataObject';
class Group_inbox extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public $__table = 'group_inbox'; // table name
public... |
Update gdbase client main script | //GDBase client tool
//Usage: node gdbase-client.js command --specie <SPECIE> --assembly <ASSEMBLY> --dataset <DATASET>
//Import dependencies
var getArgs = require('get-args');
//Get the command line args
var args = getArgs();
//Check the command
if(args.command === ''){ return console.error('No command provided...'... | //GDBase client tool
//Usage: node gdbase-client.js command --specie <SPECIE> --assembly <ASSEMBLY> --dataset <DATASET>
//Import dependencies
var getArgs = require('get-args');
//Source datasets
var source = require('./source.json');
//Get the command line args
var args = getArgs();
//Check the command
if(args.comm... |
:new: Add specs for rejecting promise on stream error | 'use strict'
describe('StreamPromise', function() {
const StreamPromise = require('../')
const FS = require('fs')
it('works', function() {
waitsForPromise(function() {
return StreamPromise.create(FS.createReadStream(`${__dirname}/fixtures/something.txt`))
.then(function(contents) {
exp... | 'use strict'
describe('StreamPromise', function() {
const StreamPromise = require('../')
const FS = require('fs')
it('works', function() {
waitsForPromise(function() {
return StreamPromise.create(FS.createReadStream(`${__dirname}/fixtures/something.txt`))
.then(function(contents) {
exp... |
Test: Expand globbing pattern to match tests in directories | #!/usr/bin/env node
'use strict';
var Mocha = require('mocha');
require('mocha-as-promised')(Mocha);
var chai = require('chai');
chai.use(require('chai-as-promised'));
require('sinon').assert.expose(chai.assert, { prefix: '' });
var mocha = new Mocha({
reporter: 'spec',
timeout: 200,
slow: Infinity
});
var pa... | #!/usr/bin/env node
'use strict';
var Mocha = require('mocha');
require('mocha-as-promised')(Mocha);
var chai = require('chai');
chai.use(require('chai-as-promised'));
require('sinon').assert.expose(chai.assert, { prefix: '' });
var mocha = new Mocha({
reporter: 'spec',
timeout: 200,
slow: Infinity
});
var pa... |
Fix a name collision for two types of types. | #
## PyMoira client library
##
## This file contains the more abstract methods which allow user to work with
## lists and list members.
#
import protocol
import utils
import datetime
from errors import *
class Filesys(object):
info_query_description = (
('label', str),
('type', str),
('mac... | #
## PyMoira client library
##
## This file contains the more abstract methods which allow user to work with
## lists and list members.
#
import protocol
import utils
import datetime
from errors import *
class Filesys(object):
info_query_description = (
('label', str),
('type', str),
('mac... |
Add rudimentary testing for thread-mapped pools
Refs #174 | try:
import queue
except ImportError:
import Queue as queue
import pylibmc
from nose.tools import eq_, ok_
from tests import PylibmcTestCase
class PoolTestCase(PylibmcTestCase):
pass
class ClientPoolTests(PoolTestCase):
def test_simple(self):
a_str = "a"
p = pylibmc.ClientPool(self.mc... | try:
import queue
except ImportError:
import Queue as queue
import pylibmc
from nose.tools import eq_, ok_
from tests import PylibmcTestCase
class PoolTestCase(PylibmcTestCase):
pass
class ClientPoolTests(PoolTestCase):
def test_simple(self):
a_str = "a"
p = pylibmc.ClientPool(self.mc... |
Fix PyPI README.MD showing problem.
There is a problem in the project's pypi page. To fix this I added the following line in the setup.py file:
```python
long_description_content_type='text/markdown'
``` | from os.path import abspath, dirname, join, normpath
from setuptools import setup
setup(
# Basic package information:
name='django-heroku-memcacheify',
version='1.0.0',
py_modules=('memcacheify',),
# Packaging options:
zip_safe=False,
include_package_data=True,
# Package dependenci... | from os.path import abspath, dirname, join, normpath
from setuptools import setup
setup(
# Basic package information:
name='django-heroku-memcacheify',
version='1.0.0',
py_modules=('memcacheify',),
# Packaging options:
zip_safe=False,
include_package_data=True,
# Package dependenci... |
Fix MonitorClient not working to detect failed jobs | package org.rundeck.api;
import org.rundeck.api.RundeckApiException;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.RundeckClient;
import org.rundeck.api.domain.RundeckHistory;
import org.rundeck.api.parse... | package org.rundeck.api;
import org.rundeck.api.RundeckApiException;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.RundeckClient;
import org.rundeck.api.domain.RundeckHistory;
import org.rundeck.api.parse... |
Update register if user exists | <?php
if($_SERVER['SERVER_NAME'] == 'builder.osmand.net') {
include '../reports/db_conn.php';
$dbconn = db_conn();
$visiblename = pg_escape_string($dbconn, $_GET["visibleName"]);
$useremail = pg_escape_string($dbconn, $_GET["email"]);
$email = pg_escape_string($dbconn, $_GET["cemail"]);
$country... | <?php
if($_SERVER['SERVER_NAME'] == 'builder.osmand.net') {
include '../reports/db_conn.php';
$dbconn = db_conn();
$visiblename = pg_escape_string($dbconn, $_GET["visibleName"]);
$useremail = pg_escape_string($dbconn, $_GET["email"]);
$email = pg_escape_string($dbconn, $_GET["cemail"]);
$country... |
Fix icon for time component | export default (iconset, name, spinning) => {
if (iconset === 'fa') {
switch (name) {
case 'save':
name = 'download';
break;
case 'zoom-in':
name = 'search-plus';
break;
case 'zoom-out':
name = 'search-minus';
break;
case 'question-sign':
... | export default (iconset, name, spinning) => {
if (iconset === 'fa') {
switch (name) {
case 'save':
name = 'download';
break;
case 'zoom-in':
name = 'search-plus';
break;
case 'zoom-out':
name = 'search-minus';
break;
case 'question-sign':
... |
Make logic benchmarks runner more portable | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.path.dirname(__file__)
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
if __name__ == '__main__':
for... | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.getcwd() + '/' + '/'.join(sys.argv[0].split('/')[:-1])
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
fo... |
Remove token from session once back on the index page | package controllers;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.confighelper;
import views.html.index;
/**
* This controller contains an action to handle HTTP requests
* to the application's home page.
*/
public class HomeController extends Controller {
/**
* Renders the main h... | package controllers;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.confighelper;
import views.html.index;
/**
* This controller contains an action to handle HTTP requests
* to the application's home page.
*/
public class HomeController extends Controller {
/**
* Renders the main h... |
Fix environment.validate() being called without branch name. | #!/usr/bin/python
# The MIT License (MIT)
#
# Copyright (c) 2013 CFEngine AS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... | #!/usr/bin/python
# The MIT License (MIT)
#
# Copyright (c) 2013 CFEngine AS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
joystick: Add missing '* ' in example
Signed-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr> | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... |
Remove rogue Cloneable interface implementation | package semantics.model;
import com.google.gson.JsonElement;
import java.util.Arrays;
import semantics.KnowBase;
import semantics.Util;
public abstract class Binary extends Conceptual {
private final Conceptual[] cs;
public Binary(Conceptual[] cs) {
this.cs = cs;
}
protected abstract Binary construct(C... | package semantics.model;
import com.google.gson.JsonElement;
import java.util.Arrays;
import semantics.KnowBase;
import semantics.Util;
public abstract class Binary extends Conceptual implements Cloneable {
private final Conceptual[] cs;
public Binary(Conceptual[] cs) {
this.cs = cs;
}
protected abstra... |
Remove checks for sliced arraybuffer since blob handles that now | var WritableStream = require('stream').Writable;
var util = require('util');
var Blob = require('blob');
var URL = global.URL || global.webkitURL || global.mozURL;
function BlobStream() {
if (!(this instanceof BlobStream))
return new BlobStream;
WritableStream.call(this);
this._chunks = [];
this.lengt... | var WritableStream = require('stream').Writable;
var util = require('util');
var Blob = require('blob');
var URL = global.URL || global.webkitURL || global.mozURL;
function BlobStream() {
if (!(this instanceof BlobStream))
return new BlobStream;
WritableStream.call(this);
this._chunks = [];
this.lengt... |
Add eager loading of reviews for single product. | 'use strict'
const db = require('APP/db');
const Product = db.model('products');
const Review = db.model('review');
const router = require('express').Router();
router.get('/', (req, res, next) => {
Product.findAll({})
.then(products => res.json(products))
.catch(next)
})
router.get('/:id', (req, res, next... | 'use strict'
const db = require('APP/db');
const Product = db.model('products');
const Review = db.model('review');
const router = require('express').Router();
router.get('/', (req, res, next) => {
Product.findAll({})
.then(products => res.json(products))
.catch(next)
})
router.get('/:id', (req, res, next... |
[fix] Prepend a refernce to the spark for `data` events | 'use strict';
/**
* The server-side plugin for Primus which adds EventEmitter functionality.
*
* @param {Primus} primus The initialised Primus server.
* @api public
*/
exports.server = function server(primus) {
var Spark = primus.Spark
, emit = Spark.prototype.emit;
primus.transform('incoming', function ... | 'use strict';
/**
* The server-side plugin for Primus which adds EventEmitter functionality.
*
* @param {Primus} primus The initialised Primus server.
* @api public
*/
exports.server = function server(primus) {
var Spark = primus.Spark
, emit = Spark.prototype.emit;
primus.transform('incoming', function ... |
Fix for historylinks connecting to missing objects | """Middleware used by the history links service."""
from django.shortcuts import redirect
from cms.apps.historylinks.models import HistoryLink
class HistoryLinkFallbackMiddleware(object):
"""Middleware that attempts to rescue 404 responses with a redirect to it's new location."""
def process_respon... | """Middleware used by the history links service."""
from django.shortcuts import redirect
from cms.apps.historylinks.models import HistoryLink
class HistoryLinkFallbackMiddleware(object):
"""Middleware that attempts to rescue 404 responses with a redirect to it's new location."""
def process_respon... |
[FIX] Increment timeout when getting images
Signed-off-by: Ludovic Ferrandis <22de32f469b6975001fde4e8fec94685fb50d109@intel.com> | # media-service-demo
#
# Copyright (C) 2012 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is dist... | # media-service-demo
#
# Copyright (C) 2012 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is dist... |
Order CMD according to alphabet, to make /cmds easier | var { createActions } = require('./helpers');
module.exports = {
CHATIDLEN: 18,
STEAMIDLEN: 17,
CMD: createActions(
'accept',
'add',
'autojoin',
'block',
'cmds',
'connect',
'debug',
'disconnect',
'dump',
'games',
'get'... | var { createActions } = require('./helpers');
module.exports = {
CHATIDLEN: 18,
STEAMIDLEN: 17,
CMD: createActions(
'connect',
'disconnect',
'add',
'accept',
'autojoin',
'block',
'join',
'nick',
'part',
'pm',
'remove',... |
Split multiline tests to actual multiple lines
For better readability. | import createTestHelpers from '../createTestHelpers';
const {expectTransform, expectNoChange} = createTestHelpers(['no-strict']);
describe('Removal of "use strict"', () => {
it('should remove statement with "use strict" string', () => {
expectTransform('"use strict";').toReturn('');
expectTransform('\'use st... | import createTestHelpers from '../createTestHelpers';
const {expectTransform, expectNoChange} = createTestHelpers(['no-strict']);
describe('Removal of "use strict"', () => {
it('should remove statement with "use strict" string', () => {
expectTransform('"use strict";').toReturn('');
expectTransform('\'use st... |
[FEATURE] Put commonly used constants on main export | "use strict";
var TypeDecorator = require( "./lib/type/decorator" );
var TypeHelper = require( "./lib/type/helper" );
var TypeInfo = require( "./lib/type/info" );
module.exports = {
DecoratorError : require( "./lib/error/decorator" ),
HelperError : require( "./lib/error/helper" ),
ChangeSet : require( ... | "use strict";
var TypeDecorator = require( "./lib/type/decorator" );
var TypeHelper = require( "./lib/type/helper" );
var TypeInfo = require( "./lib/type/info" );
module.exports = {
DecoratorError : require( "./lib/error/decorator" ),
HelperError : require( "./lib/error/helper" ),
ChangeSet : require( ... |
Include python interpreter implementation name in rule keys
Reviewed By: andrewjcg
fbshipit-source-id: 16e4503cb9 | /*
* Copyright 2014-present Facebook, 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... | /*
* Copyright 2014-present Facebook, 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... |
Update branch for git updater | <?php
/**
* Plugin Name: Culture Object
* Plugin URI: http://cultureobject.co.uk
* Description: A framework as a plugin to enable sync of culture objects into WordPress.
* Version: 3.0.0-alpha.2
* Author: Liam Gladdy / Thirty8 Digital
* Text Domain: culture-object
* Author URI: https://github.com/lgladdy
* GitH... | <?php
/**
* Plugin Name: Culture Object
* Plugin URI: http://cultureobject.co.uk
* Description: A framework as a plugin to enable sync of culture objects into WordPress.
* Version: 3.0.0-alpha.2
* Author: Liam Gladdy / Thirty8 Digital
* Text Domain: culture-object
* Author URI: https://github.com/lgladdy
* GitH... |
Fix addGhost not properly checking for existing id | package com.pm.server.player;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.springframework.stereotype.Repository;
import com.pm.server.utils.JsonUtils;
@Repository
public class GhostRepositoryImpl implements GhostRe... | package com.pm.server.player;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.springframework.stereotype.Repository;
import com.pm.server.utils.JsonUtils;
@Repository
public class GhostRepositoryImpl implements GhostRe... |
Fix unexpected error when there is no context in an error | var JSLINT = require("../lib/nodelint");
function addDefaults(options) {
'use strict';
['node', 'es5'].forEach(function (opt) {
if (!options.hasOwnProperty(opt)) {
options[opt] = true;
}
});
return options;
}
exports.lint = function (script, options) {
'use strict';
... | var JSLINT = require("../lib/nodelint");
function addDefaults(options) {
'use strict';
['node', 'es5'].forEach(function (opt) {
if (!options.hasOwnProperty(opt)) {
options[opt] = true;
}
});
return options;
}
exports.lint = function (script, options) {
'use strict';
... |
Add close to DataSource interface. | package db
import "gopkg.in/mgo.v2"
// Interface for generic data source (e.g. database).
type DataSource interface {
// Returns collection by name
C(name string) Collection
// Returns copy of data source (may be copy of session as well)
Copy() DataSource
// Closes data source (it will be runtime error to use ... | package db
import "gopkg.in/mgo.v2"
// Interface for generic data source (e.g. database).
type DataSource interface {
// Returns collection by name
C(name string) Collection
// Returns copy of data source (may be copy of session as well)
Copy() DataSource
}
// Override Source method of mgo.Session to return wra... |
Clear the screen between frames in asteroids | function StaticAsteroids(num, ctx) {
var x;
var y;
var nextPt = function(pt) {
var sign = Math.random() < 0.5 ? -1 : 1;
return pt + (sign * Math.random() * 15);
};
ctx.clearRect(0,0,window.innerWidth,window.innerHeight);
for(i = 0; i < num; i++){
x = Math.random() * windo... | function StaticAsteroids(num, ctx) {
var x;
var y;
var nextPt = function(pt) {
var sign = Math.random() < 0.5 ? -1 : 1;
return pt + (sign * Math.random() * 15);
};
for(i = 0; i < num; i++){
x = Math.random() * window.innerWidth;
y = Math.random() * window.innerHeight;... |
Remove unnecessary arguments to composer install.
We don't set these elsewhere and don't need to set them here. | #!/usr/bin/env php
<?php
chdir(__DIR__);
$returnStatus = null;
passthru('composer install --dev', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS *.php', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
passt... | #!/usr/bin/env php
<?php
chdir(__DIR__);
$returnStatus = null;
passthru('composer install --dev --no-interaction --prefer-source', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS *.php', $returnStatus);
if ($returnStat... |
Add println so user gets feedback that input accepted | // +build freebsd openbsd netbsd darwin linux
package gopass
/*
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
int getch() {
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(... | // +build freebsd openbsd netbsd darwin linux
package gopass
/*
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
int getch() {
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(... |
Fix where the seat number appears | from utils import CanadianJurisdiction
from opencivicdata.divisions import Division
from pupa.scrape import Organization
class OntarioEnglishPublicSchoolBoards(CanadianJurisdiction):
classification = 'legislature' # just to avoid clash
division_id = 'ocd-division/country:ca/province:on'
division_name = '... | from utils import CanadianJurisdiction
from opencivicdata.divisions import Division
from pupa.scrape import Organization
class OntarioEnglishPublicSchoolBoards(CanadianJurisdiction):
classification = 'legislature' # just to avoid clash
division_id = 'ocd-division/country:ca/province:on'
division_name = '... |
Enable source-map for minimized build | var path = require('path');
var webpack = require('webpack');
var package = require('./package.json');
minimize = process.argv.indexOf('--minimize') !== -1;
var conf = {
entry: ['babel-polyfill', './src/index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: package.name + '.js'... | var path = require('path');
var webpack = require('webpack');
var package = require('./package.json');
minimize = process.argv.indexOf('--minimize') !== -1;
var conf = {
entry: ['babel-polyfill', './src/index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: package.name + '.js'... |
Add tests for Word class. | package com.tyleryates.util;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@SuppressWarnings("JavaDoc")
public class W... | package com.tyleryates.util;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@SuppressWarnings("JavaDoc")
public class WordTest {
private Word word;
@Before
public void setUp() throws Exception {
word = new Wo... |
Add emailSupport back to the preprint provider model | import DS from 'ember-data';
import OsfModel from 'ember-osf/models/osf-model';
export default OsfModel.extend({
name: DS.attr('fixstring'),
description: DS.attr('fixstring'),
domain: DS.attr('string'),
domainRedirectEnabled: DS.attr('boolean'),
example: DS.attr('fixstring'),
advisoryBoard: DS.... | import DS from 'ember-data';
import OsfModel from 'ember-osf/models/osf-model';
export default OsfModel.extend({
name: DS.attr('fixstring'),
description: DS.attr('fixstring'),
domain: DS.attr('string'),
domainRedirectEnabled: DS.attr('boolean'),
example: DS.attr('fixstring'),
advisoryBoard: DS.... |
Change component name to 'ILAMB'
This currently conflicts with the component name for the NCL
version of ILAMB; however, I'll change its name to 'ILAMBv1'.
The current version of ILAMB should take the correct name. | #! /usr/bin/env python
import sys
import subprocess
class BmiIlamb(object):
_command = 'ilamb-run'
_args = None
_env = None
def __init__(self):
self._time = self.get_start_time()
@property
def args(self):
return [self._command] + (self._args or [])
def get_component_name... | #! /usr/bin/env python
import sys
import subprocess
class BmiIlamb(object):
_command = 'ilamb-run'
_args = None
_env = None
def __init__(self):
self._time = self.get_start_time()
@property
def args(self):
return [self._command] + (self._args or [])
def get_component_name... |
[AllBundles] Mark classes extending twig final | <?php
namespace Kunstmaan\UtilitiesBundle\Twig;
use Kunstmaan\UtilitiesBundle\Helper\SlugifierInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* @final since 5.4
*/
class UtilitiesTwigExtension extends AbstractExtension
{
/**
* @var SlugifierInterface
*/
private $slugifie... | <?php
namespace Kunstmaan\UtilitiesBundle\Twig;
use Kunstmaan\UtilitiesBundle\Helper\SlugifierInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class UtilitiesTwigExtension extends AbstractExtension
{
/**
* @var SlugifierInterface
*/
private $slugifier;
/**
* @param $s... |
Fix object access on None | from haystack.fields import NgramField
try:
from .elasticsearch import SuggestField
except ImportError:
class SuggestField(NgramField):
pass
class SearchQuerySetWrapper(object):
"""
Decorates a SearchQuerySet object using a generator for efficient iteration
"""
def __init__(self, sqs... | from haystack.fields import NgramField
try:
from .elasticsearch import SuggestField
except ImportError:
class SuggestField(NgramField):
pass
class SearchQuerySetWrapper(object):
"""
Decorates a SearchQuerySet object using a generator for efficient iteration
"""
def __init__(self, sqs... |
Add some exception handling for dict | #!/usr/bin/env python
from nodes import Node
import json
class Dictionary(Node):
char = ".d"
args = 0
results = 1
def __init__(self, word_ids:Node.IntList):
if not hasattr(Dictionary, "word_list"):
Dictionary.word_list = init_words()
self.words = " ".join(Dictionary.wo... | #!/usr/bin/env python
from nodes import Node
import json
class Dictionary(Node):
char = ".d"
args = 0
results = 1
def __init__(self, word_ids:Node.IntList):
if not hasattr(Dictionary, "word_list"):
Dictionary.word_list = init_words()
self.words = " ".join(Dictionary.wo... |
Add PART to tag map
16 of the 17 PoS tags in the UD tag set is added; PART is missing. | # encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
"ADV": {POS: ADV},
"NOUN": {POS: NOUN},
"ADP": {POS: ADP},
"PRON": {POS: PRON},
"SCONJ": {POS: SCONJ},
"PROPN": {POS: PROPN},
"DET": {POS: DET},
"SYM": {POS: ... | # encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
"ADV": {POS: ADV},
"NOUN": {POS: NOUN},
"ADP": {POS: ADP},
"PRON": {POS: PRON},
"SCONJ": {POS: SCONJ},
"PROPN": {POS: PROPN},
"DET": {POS: DET},
"SYM": {POS: ... |
Add isLoggedIn knob to story for pollButtons | import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { withKnobs, text, boolean, number, object } from '@kadira/storybook-addon-knobs';
import { setComposerStub } from 'react-komposer';
import PollButtons from '../poll_buttons.jsx';
import palette from '../../libs/palette';
storiesO... | import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { withKnobs, text, boolean, number, object } from '@kadira/storybook-addon-knobs';
import { setComposerStub } from 'react-komposer';
import PollButtons from '../poll_buttons.jsx';
import palette from '../../libs/palette';
storiesO... |
Fix one more bug with asset picker | import React, { PropTypes, Component } from 'react';
import MarketPickerContainer from '../_common/MarketPickerContainer';
import InputGroup from '../_common/InputGroup';
export default class AssetPickerFilter extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
filter: PropTypes.object... | import React, { PropTypes, Component } from 'react';
import MarketPickerContainer from '../_common/MarketPickerContainer';
import InputGroup from '../_common/InputGroup';
export default class AssetPickerFilter extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
filter: PropTypes.object... |
Remove mongoose debug mode from test
Signed-off-by: Ian Macalinao <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@ian.pw> | var async = require("async");
var bay6 = require("../lib/");
var expect = require("chai").expect;
var mongoose = require("mongoose");
var request = require("supertest");
describe("Model", function() {
var app;
var model;
beforeEach(function() {
app = bay6();
app.options.prefix = "";
model = app.mode... | var async = require("async");
var bay6 = require("../lib/");
var expect = require("chai").expect;
var mongoose = require("mongoose");
var request = require("supertest");
describe("Model", function() {
var app;
var model;
beforeEach(function() {
app = bay6();
app.options.prefix = "";
model = app.mode... |
Fix to allow “_” (underline) in file path name | package seedu.taskmanager.logic.parser;
import java.util.regex.Pattern;
import seedu.taskmanager.logic.parser.ArgumentTokenizer.Prefix;
/**
* Contains Command Line Interface (CLI) syntax definitions common to multiple commands
*/
public class CliSyntax {
/* Prefix definitions */
public static final Prefix... | package seedu.taskmanager.logic.parser;
import java.util.regex.Pattern;
import seedu.taskmanager.logic.parser.ArgumentTokenizer.Prefix;
/**
* Contains Command Line Interface (CLI) syntax definitions common to multiple commands
*/
public class CliSyntax {
/* Prefix definitions */
public static final Prefix... |
Add site footer to each documentation generator | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-clears/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-clears/tachyons-clears.min.css', 'utf8')
var moduleObj = css... | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-clears/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-clears/tachyons-clears.min.css', 'utf8')
var moduleObj = css... |
Add contact information and readme in long description. | import os
import re
from setuptools import setup, find_packages
_here = os.path.dirname(__file__)
_init = os.path.join(_here, 'van', 'contactology', '__init__.py')
_init = open(_init, 'r').read()
VERSION = re.search(r'^__version__ = "(.*)"', _init, re.MULTILINE).group(1)
README = open(os.path.join(_here, 'README.txt... | import os
import re
from setuptools import setup, find_packages
_here = os.path.dirname(__file__)
_init = os.path.join(_here, 'van', 'contactology', '__init__.py')
_init = open(_init, 'r').read()
VERSION = re.search(r'^__version__ = "(.*)"', _init, re.MULTILINE).group(1)
setup(name="van.contactology",
version=... |
Change default addr for http server | package main
import (
"fmt"
"log"
"net/http"
"os"
"os/signal"
"showrss/handlers"
"flag"
"syscall"
"github.com/braintree/manners"
)
const version = "1.0.0"
func main() {
var httpAddr = flag.String("http", "0.0.0.0:8000", "HTTP service address")
flag.Parse()
log.Println("Starting server ...")
log.Prin... | package main
import (
"fmt"
"log"
"net/http"
"os"
"os/signal"
"showrss/handlers"
"flag"
"syscall"
"github.com/braintree/manners"
)
const version = "1.0.0"
func main() {
var httpAddr = flag.String("http", "localhost:7000", "HTTP service address")
flag.Parse()
log.Println("Starting server ...")
log.Pr... |
Write correct device id into value | /**
* This static UI function fills the given HTML <select> element with HTML
* <option> elements that represent each found device.
* A device type to filter is optional, the default is the video input type.
*/
VideoStream.UI.deviceSelector = function(selectElement, deviceType = VideoStream.DeviceType.VIDEO_IN... | /**
* This static UI function fills the given HTML <select> element with HTML
* <option> elements that represent each found device.
* A device type to filter is optional, the default is the video input type.
*/
VideoStream.UI.deviceSelector = function(selectElement, deviceType = VideoStream.DeviceType.VIDEO_IN... |
Add req.Map["admin"], clear req.Map security fields |
package common
import (
"encoding/base64"
"strings"
"github.com/ricallinson/forgery"
"github.com/spacedock-io/index/models"
)
func UnpackAuth(raw string) (creds []string, err error) {
auth := strings.Split(raw, " ")
decoded, err := base64.StdEncoding.DecodeString(auth[1])
if err != nil { return nil, e... |
package common
import (
"encoding/base64"
"strings"
"github.com/ricallinson/forgery"
"github.com/spacedock-io/index/models"
)
func UnpackAuth(raw string) (creds []string, err error) {
auth := strings.Split(raw, " ")
decoded, err := base64.StdEncoding.DecodeString(auth[1])
if err != nil { return nil, e... |
Refresh the page between a test and another | describe('Prerequisites', () => {
describe('Call the same resource with both http client and iframe', () => {
it('http headers should be less or equal than iframe ones', () => {
browser.url('/');
browser.leftClick('.httpCall');
browser.waitForExist('.detail_headers');
browser.wai... | describe('Prerequisites', () => {
describe('Call the same resource with both http client and iframe', () => {
it('http headers should be less or equal than iframe ones', () => {
browser.url('/');
browser.leftClick('.httpCall');
browser.waitForExist('.detail_headers');
browser.wai... |
Add connect menu item to file menu. | package com.github.aureliano.edocs.app.gui.menu.file;
import javax.swing.JMenu;
import javax.swing.JSeparator;
import com.github.aureliano.edocs.common.locale.EdocsLocale;
public class FileMenu extends JMenu {
private static final long serialVersionUID = -662548298147505185L;
private ConnectMenuItem connectMenuI... | package com.github.aureliano.edocs.app.gui.menu.file;
import javax.swing.JMenu;
import javax.swing.JSeparator;
import com.github.aureliano.edocs.common.locale.EdocsLocale;
public class FileMenu extends JMenu {
private static final long serialVersionUID = -662548298147505185L;
private CloseTabMenuItem closeTabMen... |
Use var instead of const | 'use strict';
/* global env, exec */
var path = require('path');
require('shelljs/global');
var PROJECT_DIR = path.join(__dirname, '..');
var iron = {
'token': env.IRON_TOKEN,
'project_id': env.IRON_PROJECT_ID
};
JSON.stringify(iron).to(PROJECT_DIR + '/iron.json');
var worker = [
'runtime "node"',
'stack ... | 'use strict';
/* global env, exec */
var path = require('path');
require('shelljs/global');
const PROJECT_DIR = path.join(__dirname, '..');
var iron = {
'token': env.IRON_TOKEN,
'project_id': env.IRON_PROJECT_ID
};
JSON.stringify(iron).to(PROJECT_DIR + '/iron.json');
var worker = [
'runtime "node"',
'stac... |
Replace base_name with basename
base_name is deprecated | import copy
from rest_framework.routers import DefaultRouter, SimpleRouter
from events.api import all_views as events_views
from helevents.api import all_views as users_views
class LinkedEventsAPIRouter(DefaultRouter):
# these are from Django REST Framework bulk BulkRouter with 'delete' excluded
routes = copy... | import copy
from rest_framework.routers import DefaultRouter, SimpleRouter
from events.api import all_views as events_views
from helevents.api import all_views as users_views
class LinkedEventsAPIRouter(DefaultRouter):
# these are from Django REST Framework bulk BulkRouter with 'delete' excluded
routes = copy... |
feat: Add base test for containing any value | describe("About Maps", function () {
describe("Basic Usage", function () {
it("should understand they are key, value stores", function () {
var trooper = new Map();
trooper.set('name', 'Stormtrooper');
trooper.set('Droid you are looking for?', false);
trooper.set('hits target', function... | describe("About Maps", function () {
describe("Basic Usage", function () {
it("should understand they are key, value stores", function () {
var trooper = new Map();
trooper.set('name', 'Stormtrooper');
trooper.set('Droid you are looking for?', false);
trooper.set('hits target', function... |
Reset OCCI_CORE_SCHEME to its previous value. | /*******************************************************************************
* Copyright (c) 2016-17 Inria
* 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 distribution, and is available at
* http... | /*******************************************************************************
* Copyright (c) 2017 Inria
* 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 distribution, and is available at
* http://... |
Use os.join for testing on multiple platforms. | #!/usr/bin/env python
import subprocess
import os.path
NOTEBOOKS_DIR = 'notebooks'
SKIP_NOTEBOOKS = [os.path.join('Bonus','What to do when things go wrong.ipynb')]
def run_notebook(notebook):
args = ['jupyter', 'nbconvert', '--execute',
'--ExecutePreprocessor.timeout=900',
'--ExecutePrep... | #!/usr/bin/env python
import subprocess
NOTEBOOKS_DIR = 'notebooks'
SKIP_NOTEBOOKS = ['Bonus/What to do when things go wrong.ipynb']
def run_notebook(notebook):
args = ['jupyter', 'nbconvert', '--execute',
'--ExecutePreprocessor.timeout=900',
'--ExecutePreprocessor.kernel_name=workshop',... |
Fix publicPath for development server | import path from "path";
import { ENTRY_PATH, OUTPUT_PATH } from "../constants";
import {
isDevelopment,
isProduction,
isReact,
resolveExternal,
resolveInternal
} from "../utils";
export default (options, partials) => {
const ENTRY = options.server ? [
isReact(options.framework) && "react-hot-loader/... | import path from "path";
import { ENTRY_PATH, OUTPUT_PATH } from "../constants";
import {
isDevelopment,
isProduction,
isReact,
resolveExternal,
resolveInternal
} from "../utils";
export default (options, partials) => {
const ENTRY = options.server ? [
isReact(options.framework) && "react-hot-loader/... |
Remove integer ID in Telemetry model | from tsserver import db
from tsserver.dtutils import datetime_to_str
class Telemetry(db.Model):
"""
All the data that is going to be obtained in regular time intervals
(every second or so).
"""
timestamp = db.Column(db.DateTime, primary_key=True)
temperature = db.Column(db.Float)
pressure... | from tsserver import db
from tsserver.dtutils import datetime_to_str
class Telemetry(db.Model):
"""
All the data that is going to be obtained in regular time intervals
(every second or so).
"""
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime)
temperature = d... |
Check Debug folder for colony, otherwise skip | var fs = require('fs')
, falafel = require('falafel')
, colors = require('colors')
, path = require('path')
, spawn = require('child_process').spawn;
var colonize = require('./colonize');
/**
* Bytecode
*/
var compile_lua = process.platform != 'win32'
? fs.existsSync(__dirname + '/../bin/build/Release')
... | var fs = require('fs')
, falafel = require('falafel')
, colors = require('colors')
, path = require('path')
, spawn = require('child_process').spawn;
var colonize = require('./colonize');
/**
* Bytecode
*/
var compile_lua = process.platform != 'win32'
? __dirname + '/../bin/build/Release/compile_lua'
:... |
Allow list to be sorted by a key in the node's data | import os
import json
from kitchen.settings import KITCHEN_LOCATION
def load_data(data_type):
retval = []
nodes_dir = os.path.join(KITCHEN_LOCATION, data_type)
if not os.path.isdir(nodes_dir):
raise IOError('Invalid data type or kitchen location. Check your settings.')
for filename in os.listd... | import os
import json
from kitchen.settings import KITCHEN_LOCATION
def load_data(data_type):
retval = []
nodes_dir = os.path.join(KITCHEN_LOCATION, data_type)
if not os.path.isdir(nodes_dir):
raise IOError('Invalid data type or kitchen location. Check your settings.')
for filename in os.listd... |
Fix lint report error; Simplify Query function | package ipfs
import (
"context"
routing "gx/ipfs/QmPpYHPRGVpSJTkQDQDwTYZ1cYUR2NM4HS6M3iAXi8aoUa/go-libp2p-kad-dht"
peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer"
)
// Query returns the closest peers known for peerID
func Query(dht *routing.IpfsDHT, peerID string) ([]peer.ID, error) {... | package ipfs
import (
"context"
routing "gx/ipfs/QmPpYHPRGVpSJTkQDQDwTYZ1cYUR2NM4HS6M3iAXi8aoUa/go-libp2p-kad-dht"
"gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer"
)
func Query(dht *routing.IpfsDHT, peerID string) ([]peer.ID, error) {
id, err := peer.IDB58Decode(peerID)
if err != nil {
r... |
Tweak to make the new NativeStore indexes property *optional*. | package net.fortytwo.twitlogic.persistence.sail;
import net.fortytwo.twitlogic.TwitLogic;
import net.fortytwo.twitlogic.persistence.SailFactory;
import net.fortytwo.twitlogic.util.properties.PropertyException;
import net.fortytwo.twitlogic.util.properties.TypedProperties;
import org.openrdf.sail.Sail;
import org.openr... | package net.fortytwo.twitlogic.persistence.sail;
import net.fortytwo.twitlogic.TwitLogic;
import net.fortytwo.twitlogic.persistence.SailFactory;
import net.fortytwo.twitlogic.util.properties.PropertyException;
import net.fortytwo.twitlogic.util.properties.TypedProperties;
import org.openrdf.sail.Sail;
import org.openr... |
Fix submodule attribute check for Django 1.4 compatibility | import imp
from os import listdir
from os.path import dirname, splitext
from django.template import loaders
MODULE_EXTENSIONS = tuple([suffix[0] for suffix in imp.get_suffixes()])
def get_django_template_loaders():
return [(loader.__name__.rsplit('.',1)[1], loader)
for loader in get_submodules(l... | import imp
from os import listdir
from os.path import dirname, splitext
from django.template import loaders
MODULE_EXTENSIONS = tuple([suffix[0] for suffix in imp.get_suffixes()])
def get_django_template_loaders():
return [(loader.__name__.rsplit('.',1)[1], loader)
for loader in get_submodules(l... |
Update link to institute in footer to say "Institute for Software Technology" | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'DLR'
SITENAME = u'RCE'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
DEFAULT_DATE_FORMAT = '%a %d %B %Y'
THEME = 'themes/polar'
# Feed generation is usually not desired when developi... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'DLR'
SITENAME = u'RCE'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
DEFAULT_DATE_FORMAT = '%a %d %B %Y'
THEME = 'themes/polar'
# Feed generation is usually not desired when developi... |
Add .git as default ignored file/dir | package dotignore
import (
"bufio"
"os"
"path/filepath"
"strings"
"sync"
"github.com/drpotato/dotdot/filesystem"
)
var ignoredFiles map[string]bool
var once sync.Once
func ShouldIgnore(uri string) bool {
GetIgnoredFiles()
dotDirURI := filesystem.GetDotDirURI()
_, fileName := filepath.Split(uri)
return... | package dotignore
import (
"bufio"
"os"
"path/filepath"
"strings"
"sync"
"github.com/drpotato/dotdot/filesystem"
)
var ignoredFiles map[string]bool
var once sync.Once
func ShouldIgnore(uri string) bool {
GetIgnoredFiles()
dotDirURI := filesystem.GetDotDirURI()
_, fileName := filepath.Split(uri)
return... |
fix(labels): Fix the demo to remove excess parens | import { div, label } from 'hexagon-js'
export default () => {
return [
label().text('Default Label'),
label({ context: 'action' }).text('Action Label'),
label({ context: 'positive' }).text('Positive Label'),
label({ context: 'warning' }).text('Warning Label'),
label({ context: 'negative' }).text... | import { div, label } from 'hexagon-js'
export default () => {
return [
label().text('Default Label')),
label({ context: 'action' }).text('Action Label')),
label({ context: 'positive' }).text('Positive Label')),
label({ context: 'warning' }).text('Warning Label')),
label({ context: 'negative' }).... |
Set token to false by default | angular
.module('ngSharepoint')
.provider('$sp', function() {
var siteUrl = '';
var connMode = 'JSOM'; //possible values: JSOM, REST
var token = false;
var autoload = true;
return {
setSiteUrl: function (newUrl) {
siteUrl = newUrl;
},
setConnectionMode: function(connMode) { //Only JSOM Support... | angular
.module('ngSharepoint')
.provider('$sp', function() {
var siteUrl = '';
var connMode = 'JSOM'; //possible values: JSOM, REST
var token = '';
var autoload = true;
return {
setSiteUrl: function (newUrl) {
siteUrl = newUrl;
},
setConnectionMode: function(connMode) { //Only JSOM Supported ... |
Add edge label and rotation. | """
Nodes can contain words
=======================
We here at **Daft** headquarters tend to put symbols (variable
names) in our graph nodes. But you don't have to if you don't
want to.
"""
from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)
import daft
pgm = daft.PGM()
pgm.add_n... | """
Nodes can contain words
=======================
We here at **Daft** headquarters tend to put symbols (variable
names) in our graph nodes. But you don't have to if you don't
want to.
"""
from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)
import daft
pgm = daft.PGM()
pgm.add_n... |
Update teacher survey count script | // Print out teacher survey counts by day
// Usage:
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
var surveyDayMap = {};
var cursor = db['trial.requests'].find();
while (cursor.hasNext()) {
var doc = cursor.next();
var date = doc._id.getTimestamp();
if (doc.created) {
date ... | // Print out teacher survey counts by day
// Usage:
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
var surveyDayMap = {};
var cursor = db['trial.requests'].find({type: 'subscription'});
while (cursor.hasNext()) {
var doc = cursor.next();
var date = doc._id.getTimestamp();
var da... |
Fix REST interface of the Behaviour Timeout | package net.floodlightcontroller.prediction;
import org.json.JSONObject;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
public class BehaviourManagerResource extends ServerResource {
@Get("json")
public String retrieve() {
INetTopologyS... | package net.floodlightcontroller.prediction;
import org.json.JSONObject;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
public class BehaviourManagerResource extends ServerResource {
@Get("json")
public String retrieve() {
INetTopologyS... |
Fix httplib monkey patching problem with Gevent >= 1.0
From v1.0 on, Gevent doesn't support monkey patching of httplib anymore.
CATMAID's example script to run a Gevent WSGI server, however, was still
expecting this to be possible. This commit fixes this.
Thanks to Mikhail Kandel for reporting. | #!/usr/bin/env python
# Import gevent monkey and patch everything
from gevent import monkey
monkey.patch_all()
# Import the rest
from django.core.handlers.wsgi import WSGIHandler as DjangoWSGIApp
from django.core.management import setup_environ
from gevent.wsgi import WSGIServer
import sys
import settings
setup_envi... | #!/usr/bin/env python
# Import gevent monkey and patch everything
from gevent import monkey
monkey.patch_all(httplib=True)
# Import the rest
from django.core.handlers.wsgi import WSGIHandler as DjangoWSGIApp
from django.core.management import setup_environ
from gevent.wsgi import WSGIServer
import sys
import settings... |
Check that datestamp and status fields exist before setting them, since incoming messages don't have a status view. | /*
* Copyright (c) 2015, Apptentive, Inc. All Rights Reserved.
* Please refer to the LICENSE file for the terms and conditions
* under which redistribution and use of this file is permitted.
*/
package com.apptentive.android.sdk.module.messagecenter.view.holder;
import android.view.View;
import android.widget.Tex... | /*
* Copyright (c) 2015, Apptentive, Inc. All Rights Reserved.
* Please refer to the LICENSE file for the terms and conditions
* under which redistribution and use of this file is permitted.
*/
package com.apptentive.android.sdk.module.messagecenter.view.holder;
import android.view.View;
import android.widget.Tex... |
Check for errors for operations in BeforeEach and AfterEach/Suite.
Signed-off-by: Phan Le <f2c5995718b197bbd6f63c99e8aab6ee2af1c495@pivotallabs.com> | package integration_test
import (
"io/ioutil"
"os"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils"
)
var testCpiFilePath string
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
err := bmtestu... | package integration_test
import (
"io/ioutil"
"os"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils"
)
var testCpiFilePath string
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
err := bmtestu... |
release(marvin): Update pins for marvin release | from setuptools import setup, find_packages
setup(
name='gdcdatamodel',
packages=find_packages(),
install_requires=[
'pytz==2016.4',
'graphviz==0.4.2',
'jsonschema==2.5.1',
'python-dateutil==2.4.2',
'psqlgraph',
'gdcdictionary',
'dictionaryutils>=2.0.... | from setuptools import setup, find_packages
setup(
name='gdcdatamodel',
packages=find_packages(),
install_requires=[
'pytz==2016.4',
'graphviz==0.4.2',
'jsonschema==2.5.1',
'python-dateutil==2.4.2',
'psqlgraph',
'gdcdictionary',
'dictionaryutils>=2.0.... |
Fix webamp.onTrackDidChange, by actually passing the action to the event emitter | import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import reducer from "./reducers";
import mediaMiddleware from "./mediaMiddleware";
import { merge } from "./utils";
import { UPDATE_TIME_ELAPSED, STEP_MARQUEE } from "./... | import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import reducer from "./reducers";
import mediaMiddleware from "./mediaMiddleware";
import { merge } from "./utils";
import { UPDATE_TIME_ELAPSED, STEP_MARQUEE } from "./... |
Fix Integration Test after changing response for index | import org.junit.*;
import play.mvc.*;
import play.test.*;
import play.libs.F.*;
import static play.test.Helpers.*;
import static org.junit.Assert.*;
import static org.fluentlenium.core.filter.FilterConstructor.*;
public class IntegrationTest {
/**
* add your integration test here
* in this example w... | import org.junit.*;
import play.mvc.*;
import play.test.*;
import play.libs.F.*;
import static play.test.Helpers.*;
import static org.junit.Assert.*;
import static org.fluentlenium.core.filter.FilterConstructor.*;
public class IntegrationTest {
/**
* add your integration test here
* in this example w... |
Add concurrent library to it . | package mklib.hosseini.com.vinci.Main;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayInputStream;
import java.util.Arrays;
import java.util.concu... | package mklib.hosseini.com.vinci.Main;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayInputStream;
public class Vinci {
private static Conte... |
Fix bug with Date fields and SOQL.
Fixes https://github.com/freelancersunion/django-salesforce/issues/10 | # django-salesforce
#
# by Phil Christensen
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
import re
from django.db.backends import BaseDatabaseOperations
"""
Default database operations, with unquoted names.
"""
class DatabaseOperations(BaseDatabaseOperations):
... | # django-salesforce
#
# by Phil Christensen
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
import re
from django.db.backends import BaseDatabaseOperations
"""
Default database operations, with unquoted names.
"""
class DatabaseOperations(BaseDatabaseOperations):
... |
Add line break code at end of marked custom parser result | import marked from 'marked';
import htmlclean from 'htmlclean';
import he from 'he';
const renderer = new marked.Renderer();
renderer.listitem = (text) => {
if (/<input[^>]+type="checkbox"/.test(text)) {
return `<li class="task-list-item">${text}</li>\n`;
}
return `<li>${text}</li>\n`;
};
renderer.code = (... | import marked from 'marked';
import htmlclean from 'htmlclean';
import he from 'he';
const renderer = new marked.Renderer();
renderer.listitem = (text) => {
if (/<input[^>]+type="checkbox"/.test(text)) {
return `<li class="task-list-item">${text}</li>\n`;
}
return `<li>${text}</li>\n`;
};
renderer.code = (... |
CRM-6171: Prepare correct DQL query for fetching contacts
- Change order of email and phone titles for Contact | <?php
namespace Oro\Component\MessageQueue\Consumption;
use Oro\Component\MessageQueue\Transport\MessageInterface;
use Oro\Component\MessageQueue\Transport\SessionInterface;
interface MessageProcessorInterface
{
/**
* Use this constant when the message is processed successfully and the message could be remov... | <?php
namespace Oro\Component\MessageQueue\Consumption;
use Oro\Component\MessageQueue\Transport\MessageInterface;
use Oro\Component\MessageQueue\Transport\SessionInterface;
interface MessageProcessorInterface
{
/**
* Use this constant when the message is processed successfully and the message could be remov... |
Remove recently published test for pending events | package au.gov.ga.geodesy.domain.model.event;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
public class EventRepositoryImpl implements EventRepositoryCustom {
@PersistenceContext(unitName = "geodesy")
private... | package au.gov.ga.geodesy.domain.model.event;
import java.time.Instant;
import java.util.Calendar;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
public class EventRepositoryImpl implements EventRepositoryCustom {
... |
Return moment object after parsing | import moment from 'moment-timezone';
import AbstractFormat from './abstract';
export default class DateFormat extends AbstractFormat {
format(dateValue, dateFormat, locale, timezone) {
locale = locale || this._locale();
timezone = timezone || this._timezone();
return this
.moment(dateValue, local... | import moment from 'moment-timezone';
import AbstractFormat from './abstract';
export default class DateFormat extends AbstractFormat {
format(dateValue, dateFormat, locale, timezone) {
locale = locale || this._locale();
timezone = timezone || this._timezone();
return this
.moment(dateValue, local... |
Change env('APP_ENV') to $app->environment() to prevent .env reading again | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if ($this->app->environment("local")) {
\DB::connec... | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (env('APP_ENV') === 'local') {
\DB::conn... |
Check and fast return if object can't move | function isArrived(object, target) {
return object.x === target.x && object.y === target.y;
}
function getC(a, b) {
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
}
function getBeta(b, c) {
return Math.asin(b / c);
}
function getB(c, beta) {
return c * Math.sin(beta);
}
function getAlpha(a, c) {
retur... | function isArrived(object, target) {
return object.x === target.x && object.y === target.y;
}
function getC(a, b) {
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
}
function getBeta(b, c) {
return Math.asin(b / c);
}
function getB(c, beta) {
return c * Math.sin(beta);
}
function getAlpha(a, c) {
retur... |
Use Node's `inspect` for error message formation | 'use strict';
var nodeUtils = require('util');
var REASONS = {
'values' : 'Given objects are not equal',
'types' : 'Given objects are of different types',
'prototypes' : 'Given objects has different prototypes',
'object_property_amounts' : 'Given objects has d... | 'use strict';
var nodeUtils = require('util');
var REASONS = {
'values' : 'Given objects are not equal',
'types' : 'Given objects are of different types',
'prototypes' : 'Given objects has different prototypes',
'object_property_amounts' : 'Given objects has d... |
Change getGenerator method protected to public | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Drupal\AppConsole\Command;
use Drupal\AppConsole\Generator\Generator;
... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Drupal\AppConsole\Command;
use Drupal\AppConsole\Generator\Generator;
... |
Add generic types to traversable implementations | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Psr\Cache\CacheItemPoolInterface;
... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Psr\Cache\CacheItemPoolInterface;
... |
Use subprocess instead of os.system to git clone. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.vcs
----------------
Helper functions for working with version control systems.
"""
import logging
import os
import shutil
import subprocess
import sys
from .prompt import query_yes_no
def git_clone(repo, checkout=None):
"""
Clone a git repo t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.vcs
----------------
Helper functions for working with version control systems.
"""
import logging
import os
import shutil
import subprocess
import sys
from .prompt import query_yes_no
def git_clone(repo, checkout=None):
"""
Clone a git repo t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.