text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Remove a console log statement, so tests run without extraneous logging | define (["lib/lodash", "lib/Handlebars", "src/skinner/core/keypath"], function (_, Handlebars, keyPath) {
"use strict";
function resolveData(data, subject, additionalDimensionData, context) {
var allContext = keyPath(subject, "condition", {});
if (!_.isUndefined(additionalDimensionData)) {
... | define (["lib/lodash", "lib/Handlebars", "src/skinner/core/keypath"], function (_, Handlebars, keyPath) {
"use strict";
function resolveData(data, subject, additionalDimensionData, context) {
var allContext = keyPath(subject, "condition", {});
if (!_.isUndefined(additionalDimensionData)) {
... |
Add keyup to event list to fix IE so it updates height properly when deleting text. | (function($){
$.fn.textareaAutoExpand = function(){
return this.each(function(){
var textarea = $(this);
var height = textarea.height();
var diff = parseInt(textarea.css('borderBottomWidth')) + parseInt(textarea.css('borderTopWidth')) +
parseInt(textarea.css('paddingBottom')) +... | (function($){
$.fn.textareaAutoExpand = function(){
return this.each(function(){
var textarea = $(this);
var height = textarea.height();
var diff = parseInt(textarea.css('borderBottomWidth')) + parseInt(textarea.css('borderTopWidth')) +
parseInt(textarea.css('paddingBottom')) +... |
Add pytz as a test requirement | from distutils.core import setup
import skyfield # safe, because __init__.py contains no import statements
setup(
name='skyfield',
version=skyfield.__version__,
description=skyfield.__doc__.split('\n', 1)[0],
long_description=open('README.rst', 'rb').read().decode('utf-8'),
license='MIT',
auth... | from distutils.core import setup
import skyfield # safe, because __init__.py contains no import statements
setup(
name='skyfield',
version=skyfield.__version__,
description=skyfield.__doc__.split('\n', 1)[0],
long_description=open('README.rst', 'rb').read().decode('utf-8'),
license='MIT',
auth... |
Fix typo documention -> documentation | # -*- coding: utf-8 -*-
'''
The acl module handles client_acl operations
Additional information on client_acl can be
found by reading the salt documentation:
http://docs.saltstack.com/en/latest/ref/clientacl.html
'''
# Import python libraries
from __future__ import absolute_import
import re
class ClientACL(obj... | # -*- coding: utf-8 -*-
'''
The acl module handles client_acl operations
Additional information on client_acl can be
found by reading the salt documention:
http://docs.saltstack.com/en/latest/ref/clientacl.html
'''
# Import python libraries
from __future__ import absolute_import
import re
class ClientACL(objec... |
Support for new sf api | <?php
namespace Dami\Cli\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface;
class StatusCommand extends ContainerAwareComm... | <?php
namespace Dami\Cli\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface;
use Dami\Migration\MigrationFiles;
class Stat... |
Add event on selected element | ( function( window, define, require, requirejs, undefined ) {
'use strict';
define( [
'jquery',
'lodash',
'utils/event'
], function( $, _, Event ) {
/**
* Global Breakpoint system
*/
var EVENT_BREAKPOINT_CHANGE = 'Breakpoint/change';
retu... | ( function( window, define, require, requirejs, undefined ) {
'use strict';
define( [
'jquery',
'lodash',
'utils/event'
], function( $, _, Event ) {
/**
* Global Breakpoint system
*/
return {
isGlobal: true,
currentBreakpoi... |
Clean up how we enable the extension after loading options | (function() {
var Handler = function() {
var options = {
urlPatterns: [],
shortcutKey: null,
linkSelector: null
};
var window;
var enabled = false;
this.init = function(obj) {
window = obj;
var keys = Object.keys(... | (function() {
var Handler = function() {
var options = {
urlPatterns: [],
shortcutKey: null,
linkSelector: null
};
this.init = function() {
var keys = Object.keys(options);
chrome.storage.sync.get(keys, function(saved) {
... |
Connect to the "elasticsearch" host by default | #!/usr/bin/env python
# encoding: utf-8
import socket
from os import environ as env
from tornado.netutil import Resolver
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
class UnixResolver(Resolver):
def initialize(self, resolver):
self.resolver = resolver
def close(self):
... | #!/usr/bin/env python
# encoding: utf-8
import socket
from os import environ as env
from tornado.netutil import Resolver
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
class UnixResolver(Resolver):
def initialize(self, resolver):
self.resolver = resolver
def close(self):
... |
Remove deleted & child reservation types | define(['app', 'text!./schedule.html', 'lodash'], function(app, template, _) {
app.directive("cctvFrameSchedule", ['$http', function($http) {
return {
restrict: 'E',
template: template,
replace: true,
scope: {
content: '='
},
... | define(['app', 'text!./schedule.html', 'lodash'], function(app, template, _) {
app.directive("cctvFrameSchedule", ['$http', function($http) {
return {
restrict: 'E',
template: template,
replace: true,
scope: {
content: '='
},
... |
Add default value for owner_details. | /*@ngInject*/
function ProjectModelService(projectsAPI) {
class Project {
constructor(id, name, owner) {
this.id = id;
this.name = name;
this.owner = owner;
this.samples_count = 0;
this.processes_count = 0;
this.experiments_count = 0;
... | /*@ngInject*/
function ProjectModelService(projectsAPI) {
class Project {
constructor(id, name, owner) {
this.id = id;
this.name = name;
this.owner = owner;
this.samples_count = 0;
this.processes_count = 0;
this.experiments_count = 0;
... |
Convert JSON blob to relational db structure. | #!/usr/bin/env python3
# chameleon-crawler
#
# Copyright 2015 ghostwords.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from time import sleep
from .utils import ... | #!/usr/bin/env python3
# chameleon-crawler
#
# Copyright 2015 ghostwords.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from time import sleep
from .utils import ... |
Add Pykka as a dependency | from __future__ import unicode_literals
import re
from setuptools import setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-Scrobbler',
version=get_version('mopidy_scrob... | from __future__ import unicode_literals
import re
from setuptools import setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-Scrobbler',
version=get_version('mopidy_scrob... |
Allow pieces to take one another | import React from "react";
import classNames from "classnames";
import { movePiece, selectPiece } from "store/actions";
class ChessBoardSquare extends React.Component {
constructor(props) {
super(props);
this.selectSquare = this.selectSquare.bind(this);
}
squareCoords() {
return { rank: this.props... | import React from "react";
import classNames from "classnames";
import { movePiece, selectPiece } from "store/actions";
class ChessBoardSquare extends React.Component {
constructor(props) {
super(props);
this.selectSquare = this.selectSquare.bind(this);
}
squareCoords() {
return { rank: this.props... |
Make mocks added in test-check timeout tests PHPUnit 4.5-compatible | <?php
namespace Liip\RMT\Tests\Functional;
use Exception;
use Liip\RMT\Context;
use Liip\RMT\Prerequisite\TestsCheck;
class TestsCheckTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$informationCollector = $this->getMock('Liip\RMT\Information\InformationCollector');
$i... | <?php
namespace Liip\RMT\Tests\Functional;
use Exception;
use Liip\RMT\Context;
use Liip\RMT\Prerequisite\TestsCheck;
class TestsCheckTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$informationCollector = $this->createMock('Liip\RMT\Information\InformationCollector');
... |
Remove dead error check from user agent.
Remove an error test from an earlier verion of the user agent that used
a different library. Axios will raise an exception on error.
Closes #485. | const stream = require('stream')
const url = require('url')
const logger = require('prolific.logger').create('compassion.colleague')
const axios = require('axios')
const httpAdapter = require('axios/lib/adapters/http')
module.exports = {
json: async (location, path, body) => {
const resolved = url.resolv... | const stream = require('stream')
const url = require('url')
const logger = require('prolific.logger').create('compassion.colleague')
const axios = require('axios')
const httpAdapter = require('axios/lib/adapters/http')
module.exports = {
json: async (location, path, body) => {
const resolved = url.resolv... |
Fix passing GCC compiler options on Windows | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
extra_compile_args = [] if os.name == 'nt' else ["-g", "-O2", "-march=nat... | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
mod_cv_algorithms = Extension('cv_algorithms._cv_algorithms',
... |
Use laravel application instance when running suitey | <?php
namespace TheCrypticAce\Suitey;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Foundation\Application;
class Suitey
{
/**
* The laravel application instance
* A container used to resolve dependencies
*
* @var \Illuminate\Contracts\Foundatio... | <?php
namespace TheCrypticAce\Suitey;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Container\Container;
class Suitey
{
/**
* A list of all executable steps
*
* @var \Illuminate\Support\Collection
*/
private $steps;
/**
* A contain... |
Remove annoying logging in Router | from threading import Thread
import zmq
from logbook import Logger
class Router(Thread):
"""Thread waiting for a request by another Driver and responding to
it with the chunked asked.
"""
def __init__(self, name, redis, get_chunk):
super(Router, self).__init__()
self.name = name
... | from threading import Thread
import zmq
from logbook import Logger
class Router(Thread):
"""Thread waiting for a request by another Driver and responding to
it with the chunked asked.
"""
def __init__(self, name, redis, get_chunk):
super(Router, self).__init__()
self.name = name
... |
Switch to list equality check | from tests.base_case import ChatBotTestCase
from chatterbot.trainers import ChatterBotCorpusTrainer
class ChatterBotCorpusTrainingTestCase(ChatBotTestCase):
"""
Test case for training with data from the ChatterBot Corpus.
"""
def setUp(self):
super(ChatterBotCorpusTrainingTestCase, self).setU... | from tests.base_case import ChatBotTestCase
from chatterbot.trainers import ChatterBotCorpusTrainer
class ChatterBotCorpusTrainingTestCase(ChatBotTestCase):
"""
Test case for training with data from the ChatterBot Corpus.
"""
def setUp(self):
super(ChatterBotCorpusTrainingTestCase, self).setU... |
Update SampleDateUtil to include isCompleted during Task creation | package utask.model.util;
import utask.commons.exceptions.IllegalValueException;
import utask.model.ReadOnlyUTask;
import utask.model.UTask;
import utask.model.tag.UniqueTagList;
import utask.model.task.Deadline;
import utask.model.task.EventTask;
import utask.model.task.Frequency;
import utask.model.task.IsCompleted;... | package utask.model.util;
import utask.commons.exceptions.IllegalValueException;
import utask.model.ReadOnlyUTask;
import utask.model.UTask;
import utask.model.tag.UniqueTagList;
import utask.model.task.Deadline;
import utask.model.task.EventTask;
import utask.model.task.Frequency;
import utask.model.task.Name;
import... |
Revert "Always use registrationCount when calculating numbers"
This reverts commit 726f87eae7b5609e75ee4d94d376f230317c9b32. | // @flow
import React from 'react';
import styles from './AttendanceStatus.css';
import withModal from './withModal';
import type { EventPool } from 'app/models';
type AttendanceElementProps = {
pool: EventPool,
index: number,
toggleModal: number => void
};
const AttendanceElement = ({
pool: { name, registra... | // @flow
import React from 'react';
import styles from './AttendanceStatus.css';
import withModal from './withModal';
import type { EventPool } from 'app/models';
type AttendanceElementProps = {
pool: EventPool,
index: number,
toggleModal: number => void
};
const AttendanceElement = ({
pool: { name, registra... |
Add numpy array as a possibility for setting external magnetic field. | import numpy as np
class FixedZeeman(object):
def __init__(self, H, multiplier=1, name='fixedzeeman'):
if not isinstance(H, (list, tuple, np.ndarray)) or len(H) != 3:
raise ValueError('H must be a 3-element tuple or list.')
else:
self.H = H
if not isinstance(multipl... | class FixedZeeman(object):
def __init__(self, H, multiplier=1, name='fixedzeeman'):
if not isinstance(H, (list, tuple)) or len(H) != 3:
raise ValueError('H must be a 3-element tuple or list.')
else:
self.H = H
if not isinstance(multiplier, (float, int)):
... |
Use the site that has scheme also input. | try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
import datetime
import multiprocessing
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandEr... | try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
import datetime
import multiprocessing
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandEr... |
Bump version: 0.0.12 -> 0.0.13
[ci skip] | # /setup.py
#
# Installation and setup script for parse-shebang
#
# See /LICENCE.md for Copyright information
"""Installation and setup script for parse-shebang."""
from setuptools import find_packages, setup
setup(name="parse-shebang",
version="0.0.13",
description="""Parse shebangs and return their comp... | # /setup.py
#
# Installation and setup script for parse-shebang
#
# See /LICENCE.md for Copyright information
"""Installation and setup script for parse-shebang."""
from setuptools import find_packages, setup
setup(name="parse-shebang",
version="0.0.12",
description="""Parse shebangs and return their comp... |
Fix print for python 3
Fix print statement in copy_from_theme management command. | import errno
import glob
import os
import shutil
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
def copy(src, dest):
if not os.path.exists(os.path.dirname(dest)):
os.makedirs(os.path.dirname(dest))
try:
shutil.copytree(sr... | import errno
import glob
import os
import shutil
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
def copy(src, dest):
if not os.path.exists(os.path.dirname(dest)):
os.makedirs(os.path.dirname(dest))
try:
shutil.copytree(sr... |
Remove reliance on function prototype extension. | import Ember from "ember";
import Snippets from "../snippets";
/* global require */
var Highlight = require('highlight.js');
export default Ember.Component.extend({
tagName: 'pre',
classNameBindings: ['language'],
unindent: true,
_unindent: function(src) {
if (!this.get('unindent')) {
return src;
... | import Ember from "ember";
import Snippets from "../snippets";
/* global require */
var Highlight = require('highlight.js');
export default Ember.Component.extend({
tagName: 'pre',
classNameBindings: ['language'],
unindent: true,
_unindent: function(src) {
if (!this.get('unindent')) {
return src;
... |
Fix duplicate simultaneous build initiation. | const fs = require('fs-extra')
const { exec } = require('child_process')
const path = require('path')
module.exports = function getCurrentCommit (directory, callback) {
// If not a git repository, return null.
if (!fs.existsSync(path.join(directory, '.git'))) {
callback(null)
retur... | const fs = require('fs-extra')
const { exec } = require('child_process')
const path = require('path')
module.exports = function getCurrentCommit (directory, callback) {
// If not a git repository, return null.
if (!fs.existsSync(path.join(directory, '.git'))) {
callback(null)
}
// ... |
Fix data erasure API test to use POST method
(was previously done via GET request) | const frisby = require('frisby')
const jsonHeader = { 'content-type': 'application/json' }
const REST_URL = 'http://localhost:3000/rest'
describe('/rest/user/erasure-request', () => {
it('Erasure request does not actually delete the user', () => {
return frisby.post(REST_URL + '/user/login', {
headers: js... | const frisby = require('frisby')
const jsonHeader = { 'content-type': 'application/json' }
const REST_URL = 'http://localhost:3000/rest'
describe('/rest/user/erasure-request', () => {
it('Erasure request does not actually delete the user', () => {
return frisby.post(REST_URL + '/user/login', {
headers: js... |
Replace phpdoc blocks by language type hints | <?php
namespace PhpGitHooks\Module\Configuration\Infrastructure\Hook;
use Symfony\Component\Process\Process;
class HookCopier
{
private $hookDir = '.git/hooks/';
public function copyPreCommitHook(): void
{
$this->copyHookFile('pre-commit');
}
public function copyCommitMsgHook(): void
... | <?php
namespace PhpGitHooks\Module\Configuration\Infrastructure\Hook;
use Symfony\Component\Process\Process;
class HookCopier
{
private $hookDir = '.git/hooks/';
public function copyPreCommitHook()
{
$this->copyHookFile('pre-commit');
}
public function copyCommitMsgHook()
{
... |
Add new-line at EOF, when dumping userdb | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... |
Use most_fields as search type | var module = angular.module('JGivenApp',['ngSanitize']);
var elasticSearchHost = 'localhost'
module.controller(
'ApplicationController',
['$scope', '$http',
function( $scope, $http ) {
$scope.getScenarios = function() {
console.log("Searching for "+$scope.search);
data ... | var module = angular.module('JGivenApp',['ngSanitize']);
var elasticSearchHost = 'localhost'
module.controller(
'ApplicationController',
['$scope', '$http',
function( $scope, $http ) {
$scope.getScenarios = function() {
console.log("Searching for "+$scope.search);
data ... |
Check email before user email validator | <?php
namespace Gitonomy\Bundle\FrontendBundle\Validation\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Bundle\DoctrineBundle\Registry;
class UserEmailValidator extends ConstraintValidator
{
/**
* @var Symfony\Bundle\DoctrineBundle\... | <?php
namespace Gitonomy\Bundle\FrontendBundle\Validation\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Bundle\DoctrineBundle\Registry;
class UserEmailValidator extends ConstraintValidator
{
/**
* @var Symfony\Bundle\DoctrineBundle\... |
Add new scope for every film element, to avoid rewriting genre massive. | app.directive('film', function() {
return{
restrict: 'E',
scope: {},
controller: function($scope){
$scope.genres = [];
this.addGenres = function(genres){
$scope.genres = $scope.genres.concat(genres);
};
},
link:... | app.directive('film', function() {
return{
restrict: 'E',
controller: function($scope){
$scope.genres = [];
this.addGenres = function(genres){
$scope.genres = $scope.genres.concat(genres);
};
},
link: function(scope, el... |
Add some error handling around releasing wake locks | package com.markupartist.sthlmtraveling.service;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.util.Log;
abstract public class WakefulIntentService extends IntentService {
private static String TAG = "WakefulIntentSe... | package com.markupartist.sthlmtraveling.service;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.util.Log;
abstract public class WakefulIntentService extends IntentService {
private static String TAG = "WakefulIntentSe... |
Add fix to ace worker loading error | hqDefine('app_manager/js/download_index_main',[
'jquery',
'underscore',
'ace-builds/src-min-noconflict/ace',
'app_manager/js/download_async_modal',
'app_manager/js/source_files',
],function ($, _, ace) {
// work around with ace issue https://github.com/ajaxorg/ace/issues/732 also see the linked ... | hqDefine('app_manager/js/download_index_main',[
'jquery',
'underscore',
'ace-builds/src-min-noconflict/ace',
'app_manager/js/download_async_modal',
'app_manager/js/source_files',
],function ($, _, ace) {
ace.require("ace/config").set("packaged", false);
$(function () {
var elements ... |
Add optional event_cmd bash file into the docs | from i3pystatus import IntervalModule
class Pianobar(IntervalModule):
"""
Shows the title and artist name of the current music
In pianobar config file must be setted the fifo and event_command options
(see man pianobar for more information)
For the event_cmd use:
https://github.com/jlucchese... | from i3pystatus import IntervalModule
class Pianobar(IntervalModule):
"""
Shows the title and artist name of the current music
In pianobar config file must be setted the fifo and event_command options
(see man pianobar for more information)
Mouse events:
- Left click play/pauses
- Right ... |
Fix buffering issue in udp bridge | #!/usr/bin/env python
import select
import serial
import socket
def run_lux_udp(host, port, dev):
with serial.Serial(dev, baudrate=3000000, xonxoff=False) as ser:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((host, port))
last_addr = None
serial_buffer = ""
... | #!/usr/bin/env python
import select
import serial
import socket
def run_lux_udp(host, port, dev):
with serial.Serial(dev, baudrate=3000000, xonxoff=False) as ser:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((host, port))
last_addr = None
serial_buffer = ""
... |
Fix model config to alter on every change | /**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/******************************... | /**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/******************************... |
Enable mirage on production for now | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
i18n: {
defaultLocale: 'en',
},
emblemOptions: {
blueprints: false
},
modulePrefix: 'irene',
environment: environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
i18n: {
defaultLocale: 'en',
},
emblemOptions: {
blueprints: false
},
modulePrefix: 'irene',
environment: environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
... |
Rename directory for Toki Pona recordings
See parent commit. | <?php
use Cake\Core\Configure;
use Migrations\AbstractMigration;
class TokiPonaCodeRename extends AbstractMigration
{
private $langColumns = [
'contributions' => ['sentence_lang', 'translation_lang'],
'contributions_stats' => ['lang'],
'languages' => ['code'],
'last_contributions' ... | <?php
use Migrations\AbstractMigration;
class TokiPonaCodeRename extends AbstractMigration
{
private $langColumns = [
'contributions' => ['sentence_lang', 'translation_lang'],
'contributions_stats' => ['lang'],
'languages' => ['code'],
'last_contributions' => ['sentence_lang', 'tra... |
Add a css loader to import global style from external components | var rucksack = require('rucksack-css')
var webpack = require('webpack')
var path = require('path')
module.exports = {
context: path.join(__dirname, './client'),
entry: {
jsx: './index.js',
html: './index.html',
vendor: ['react']
},
output: {
path: path.join(__dirname, './static'),
filename:... | var rucksack = require('rucksack-css')
var webpack = require('webpack')
var path = require('path')
module.exports = {
context: path.join(__dirname, './client'),
entry: {
jsx: './index.js',
html: './index.html',
vendor: ['react']
},
output: {
path: path.join(__dirname, './static'),
filename:... |
Remove a for loop in favour of a dict comprehension |
from contextlib import contextmanager
from functools import wraps
from fastats.core.ast_transforms.convert_to_jit import convert_to_jit
from fastats.core.ast_transforms.processor import AstProcessor
@contextmanager
def code_transform(func, replaced):
try:
yield func
finally:
for k, v in repl... |
from contextlib import contextmanager
from functools import wraps
from fastats.core.ast_transforms.convert_to_jit import convert_to_jit
from fastats.core.ast_transforms.processor import AstProcessor
@contextmanager
def code_transform(func, replaced):
try:
yield func
finally:
for k, v in repl... |
Add fast-math back to compiler options, now that anaconda can handle it
Closes #13
See https://github.com/ContinuumIO/anaconda-issues/issues/182 | #!/usr/bin/env python
# Copyright (c) 2014, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE>
from auto_version import calculate_version, build_py_copy_version
def configuration(parent_package='', top_path=None):
import numpy
from distutils.errors import... | #!/usr/bin/env python
# Copyright (c) 2014, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE>
from auto_version import calculate_version, build_py_copy_version
def configuration(parent_package='', top_path=None):
import numpy
from distutils.errors import... |
Implement input API as spec'd in oonib.md | import glob
import json
import os
import yaml
from oonib.handlers import OONIBHandler
from oonib import config, log
class InputDescHandler(OONIBHandler):
def get(self, inputID):
bn = os.path.basename(inputID) + ".desc"
try:
f = open(os.path.join(config.main.input_dir, bn))
... | import glob
import json
import os
import yaml
from oonib.handlers import OONIBHandler
from oonib import config
class InputDescHandler(OONIBHandler):
def get(self, inputID):
#XXX return the input descriptor
# see oonib.md in ooni-spec
bn = os.path.basename(inputID) + ".desc"
try:
... |
Use - instead of _ when converting filename in file upload | Ext2.ns('Kwc.Basic.DownloadTag');
Kwc.Basic.DownloadTag.Panel = Ext2.extend(Ext2.Panel, {
initComponent: function() {
Kwc.Basic.DownloadTag.Panel.superclass.initComponent.call(this);
this.findByType('kwf.file')[0].on('uploaded', function(field, value) {
if (value) {
this.... | Ext2.ns('Kwc.Basic.DownloadTag');
Kwc.Basic.DownloadTag.Panel = Ext2.extend(Ext2.Panel, {
initComponent: function() {
Kwc.Basic.DownloadTag.Panel.superclass.initComponent.call(this);
this.findByType('kwf.file')[0].on('uploaded', function(field, value) {
if (value) {
this.... |
Fix getting registrations error if no project id | <?php
namespace MapasCulturais\Repositories;
use MapasCulturais\Traits;
class Registration extends \MapasCulturais\Repository{
/**
*
* @param \MapasCulturais\Entities\Project $project
* @param \MapasCulturais\Entities\User $user
* @return \MapasCulturais\Entities\Registration[]
*/
func... | <?php
namespace MapasCulturais\Repositories;
use MapasCulturais\Traits;
class Registration extends \MapasCulturais\Repository{
/**
*
* @param \MapasCulturais\Entities\Project $project
* @param \MapasCulturais\Entities\User $user
* @return \MapasCulturais\Entities\Registration[]
*/
func... |
Return from exit condition sooner
Since an array doesn't need to be converted to itself, there's
no reason to go any further in this method. | <?php
namespace Haystack\Functional;
use Haystack\Container\ContainerInterface;
use Haystack\HArray;
use Haystack\Helpers\Helper;
use Haystack\HString;
class HaystackMap
{
/** @var array */
private $arr;
/**
* @param HArray $array
*/
public function __construct(HArray $array)
{
... | <?php
namespace Haystack\Functional;
use Haystack\Container\ContainerInterface;
use Haystack\HArray;
use Haystack\Helpers\Helper;
use Haystack\HString;
class HaystackMap
{
/** @var array */
private $arr;
/**
* @param HArray $array
*/
public function __construct(HArray $array)
{
... |
Remove Time component's dependency on utils | /*
* Semantic time element
*/
define(['react', 'moment'], function(React, Moment) {
var Time = React.createClass({
propTypes: {
date: React.PropTypes.instanceOf(Date),
showAbsolute: React.PropTypes.bool,
showRelative: React.PropTypes.bool
},
getDefault... | /*
* Semantic time element
*/
define(['react', 'utils', 'moment'], function(React, Utils, Moment) {
var Time = React.createClass({
propTypes: {
date: React.PropTypes.instanceOf(Date),
showAbsolute: React.PropTypes.bool,
showRelative: React.PropTypes.bool
},
... |
Adjust for renamed CSV class |
from django.http import StreamingHttpResponse
from django.utils.encoding import force_text
from .models import modelserialiser_factory
from .simplecsv import Writer
class ExportCsv(object):
def __init__(self, serialiser=None, label=None, **opts):
self.serialiser = serialiser
self.opts = opts
... |
from django.http import StreamingHttpResponse
from django.utils.encoding import force_text
from .models import modelserialiser_factory
from .simplecsv import CSV
class ExportCsv(object):
def __init__(self, serialiser=None, label=None, **opts):
self.serialiser = serialiser
self.opts = opts
... |
Use fat arrows instead of that=this. Some foratting fixes | "use strict";
const medium = require('medium-sdk');
class CamayakMedium {
constructor(api_key) {
this.api_key = api_key;
// Since we use an Integration Token instead
// of oAuth login, we just enter dummy values
// for the oAuth client options.
this.client = new mediu... | "use strict";
const medium = require('medium-sdk');
class CamayakMedium {
constructor(api_key) {
this.api_key = api_key;
// Since we use an Integration Token instead
// of oAuth login, we just enter dummy values
// for the oAuth client options.
this.client = new mediu... |
Revert "Force boolean as not all set to true/false some are 1/0"
This reverts commit b80e83192363f6f77f70bc7a663cae9ff6ef40cd. | <?php
namespace DBAL\Tests\Caching;
use PHPUnit\Framework\TestCase;
abstract class CacheTest extends TestCase{
protected $host = '127.0.0.1';
protected $port = false;
protected $cache;
public function setUp() {
$this->cache->connect($this->host, $this->port);
if(!$th... | <?php
namespace DBAL\Tests\Caching;
use PHPUnit\Framework\TestCase;
abstract class CacheTest extends TestCase{
protected $host = '127.0.0.1';
protected $port = false;
protected $cache;
public function setUp() {
$this->cache->connect($this->host, $this->port);
if(!$th... |
Fix unsupported `headers` and `status` of undefined |
/**
* OAuth interceptor.
*/
function oauthInterceptor($q, $rootScope, OAuthToken) {
return {
request: function(config) {
config.headers = config.headers || {};
// Inject `Authorization` header.
if (!config.headers.hasOwnProperty('Authorization') && OAuthToken.getAuthorizationHeader()) {
... |
/**
* OAuth interceptor.
*/
function oauthInterceptor($q, $rootScope, OAuthToken) {
return {
request: function(config) {
config.headers = config.headers || {};
// Inject `Authorization` header.
if (!config.headers.hasOwnProperty('Authorization') && OAuthToken.getAuthorizationHeader()) {
... |
Remove debug and use warngins | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import warnings
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
self.debug = False
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
self.debug = False
def set_deb... |
Add method to return book in component | import React from 'react';
import { Link } from 'react-router-dom';
const BorrowedBooks = (props) => {
const {
books, returnBook, user, isSendingRequest, returnRequests,
} = props;
console.log(props);
if (!books.length) {
return (
<div className="row center">
<p className="grey-tex... | import React from 'react';
import { Link } from 'react-router-dom';
const BorrowedBooks = (props) => {
const { books } = props;
if (!books.length) {
return (
<div className="row center">
<p className="grey-text">You have no borrowed books </p>
</div>
);
}
return (
<... |
Prepare for making it a kata. | // 1: assertThat
// To do: make all tests pass, leave the assert lines unchanged!
import {
assertThat, equalTo,
containsString, throws, returns,
} from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(type... | // 1: assertThat
// To do: make all tests pass, leave the assert lines unchanged!
import {
assertThat, equalTo,
containsString, throws, returns,
} from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(type... |
Fix broken build due to missing config file | const fs = require('fs');
const restify = require('restify');
const builder = require('botbuilder');
const config = fs.existsSync('./config/index.js') ? require('./config') : {};
//=========================================================
// Bot Setup
//=========================================================
... | const restify = require('restify');
const builder = require('botbuilder');
const config = require('./config');
//=========================================================
// Bot Setup
//=========================================================
// Setup Restify server
const server = restify.createServer();
server.lis... |
Add id to json content types
Tests will probably fail! | from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.richtext.models import RichTextContent
from feincms.content.section.models import SectionContent
class JsonRichTextContent(RichTextContent):
class Meta(RichTextContent.Meta):
abstract = True
def json(self, **kwargs)... | from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.richtext.models import RichTextContent
from feincms.content.section.models import SectionContent
class JsonRichTextContent(RichTextContent):
class Meta(RichTextContent.Meta):
abstract = True
def json(self, **kwargs)... |
Hide password reset instruction alert after 3 seconds | import Ember from 'ember';
import ajax from 'ic-ajax';
export default Ember.Controller.extend({
needs: 'application',
auth_token: Ember.computed.alias('controllers.application.auth_token'),
currentUser: Ember.computed.alias('controllers.application.currentUser'),
email: null,
password: null,
response: null... | import Ember from 'ember';
import ajax from 'ic-ajax';
export default Ember.Controller.extend({
needs: 'application',
auth_token: Ember.computed.alias('controllers.application.auth_token'),
currentUser: Ember.computed.alias('controllers.application.currentUser'),
email: null,
password: null,
response: null... |
Remove all moderator made comments before 2021/01/01 | import random
import string
from datetime import datetime
from django.core.management import BaseCommand
from django.utils import timezone
from heltour.tournament.models import *
from django_comments.models import Comment
from django.contrib.contenttypes.models import ContentType
class Command(BaseCommand):
help ... | import random
import string
from django.core.management import BaseCommand
from django.utils import timezone
from heltour.tournament.models import *
from django_comments.models import Comment
from django.contrib.contenttypes.models import ContentType
class Command(BaseCommand):
help = "Removes ALL emails from the... |
Refactor BasicAuth to extend the abstract client | <?php
namespace Intercom;
use Guzzle\Common\Collection;
use Guzzle\Service\Client;
class IntercomBasicAuthClient extends IntercomAbstractClient
{
/** @var array The required config variables for this type of client */
private static $required = ['app_id', 'api_key', 'headers', 'service_description'];
/**... | <?php
namespace Intercom;
use InvalidArgumentException;
use Guzzle\Common\Collection;
use Guzzle\Service\Client;
use Guzzle\Service\Description\ServiceDescription;
class IntercomBasicAuthClient extends Client
{
/**
* Creates a Basic Auth Client with the supplied configuration options
*
* @param arr... |
MAINT: Use the new version of traitlets. | from setuptools import setup
from sys import version_info
def install_requires():
requires = [
'traitlets>=4.1',
'six>=1.9.0',
'pyyaml>=3.11',
]
if (version_info.major, version_info.minor) < (3, 4):
requires.append('singledispatch>=3.4.0')
return requires
def extras_r... | from setuptools import setup
from sys import version_info
def install_requires():
requires = [
'traitlets>=4.0',
'six>=1.9.0',
'pyyaml>=3.11',
]
if (version_info.major, version_info.minor) < (3, 4):
requires.append('singledispatch>=3.4.0')
return requires
def extras_r... |
Fix token to place request parsing: allow hierarchy depths > 2 | package org.jboss.as.console.client.util;
import com.allen_sauer.gwt.log.client.Log;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import java.util.ArrayList;
import java.util.List;
/**
* @author Heiko Braun
* @date 2/17/11
*/
public class Places {
public static List<PlaceRequest> fromString(String u... | package org.jboss.as.console.client.util;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import java.util.ArrayList;
import java.util.List;
/**
* @author Heiko Braun
* @date 2/17/11
*/
public class Places {
public static List<PlaceRequest> fromString(String urlString)
{
List<PlaceRequest> ... |
Test against ember 2.0.x and 2.1.x in CI | module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-1.10',
dependencies: {
ember: '~1.10.0'
}
},
{
name: 'ember-1.11',
dependencies: {
ember: '~1.11.0'
}
},
{
name: 'ember-1.12',
... | module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-1.10',
dependencies: {
ember: '~1.10.0'
}
},
{
name: 'ember-1.11',
dependencies: {
ember: '~1.11.0'
}
},
{
name: 'ember-1.12',
... |
Implement a method to convert udesrscore case to camelCase | <?php
namespace Air\BookishBundle\Lib;
class NytApiHandler
{
private $nytApiKey;
private $guzzleClient;
public function __construct($nytApiKey, $guzzleClient)
{
$this->nytApiKey = $nytApiKey;
$this->guzzleClient = $guzzleClient;
}
public function getNytApiKey()
{
r... | <?php
namespace Air\BookishBundle\Lib;
class NytApiHandler
{
private $nytApiKey;
private $guzzleClient;
public function __construct($nytApiKey, $guzzleClient)
{
$this->nytApiKey = $nytApiKey;
$this->guzzleClient = $guzzleClient;
}
public function getNytApiKey()
{
r... |
Remove skip in type juggling. | <?php
class TypeJugglingTest extends PHPUnit_Framework_TestCase
{
public function testFromFalseOrNullToArray()
{
foreach (array(false, null) as $testValue) {
$var = $testValue;
$var['foo'] = 10;
$this->assertEquals('array', gettype($var));
}
}
... | <?php
class TypeJugglingTest extends PHPUnit_Framework_TestCase
{
public function testFromFalseOrNullToArray()
{
foreach (array(false, null) as $testValue) {
$var = $testValue;
$var['foo'] = 10;
$this->assertEquals('array', gettype($var));
}
}
... |
Use assertEqual instead of assertEquals | import unittest
from anser import Anser, Client
class BasicAnserTest(unittest.TestCase):
def test_creation(self):
server = Anser(__file__)
self.assertEqual(server.name, __file__)
def test_creation_explicit_no_debug(self):
server = Anser(__file__, debug=False)
self.assertFalse... | import unittest
from anser import Anser, Client
class BasicAnserTest(unittest.TestCase):
def test_creation(self):
server = Anser(__file__)
self.assertEquals(server.name, __file__)
def test_creation_explicit_no_debug(self):
server = Anser(__file__, debug=False)
self.assertFals... |
Mark locale negotiation acceptance in progress | package examples.locale;
import com.vtence.molecule.WebServer;
import com.vtence.molecule.testing.http.HttpRequest;
import com.vtence.molecule.testing.http.HttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.util.Locale... | package examples.locale;
import com.vtence.molecule.WebServer;
import com.vtence.molecule.testing.http.HttpRequest;
import com.vtence.molecule.testing.http.HttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.Locale;
import static com.vten... |
Add check to ensure launcher components begin with 'stockflux-' | import React, { useEffect, useState } from "react";
import { OpenfinApiHelpers } from "stockflux-core";
import Components from "stockflux-components";
import "./AppShortcuts.css";
export default () => {
const [apps, setApps] = useState([]);
useEffect(() => {
const options = {
method: "GET"
};
O... | import React, { useEffect, useState } from 'react';
import { OpenfinApiHelpers } from 'stockflux-core';
import Components from 'stockflux-components';
import './AppShortcuts.css';
export default () => {
const [apps, setApps] = useState([]);
useEffect(() => {
const options = {
method: 'GET'
};
O... |
Throw exception if action method does not exist | <?php
namespace watoki\cqurator;
use watoki\factory\Factory;
use watoki\smokey\Dispatcher;
use watoki\smokey\EventDispatcher;
class ActionDispatcher implements Dispatcher {
/** @var Dispatcher */
private $dispatcher;
/** @var \watoki\factory\Factory */
private $factory;
public function __constr... | <?php
namespace watoki\cqurator;
use watoki\factory\Factory;
use watoki\smokey\Dispatcher;
use watoki\smokey\EventDispatcher;
class ActionDispatcher implements Dispatcher {
/** @var Dispatcher */
private $dispatcher;
/** @var \watoki\factory\Factory */
private $factory;
public function __constr... |
Set default locale in test to avoid test failures when different default is used than expected. | # -*- coding: utf-8 -*-
"""
Unit Test: orchard.extensions.babel
"""
import unittest
import orchard
import orchard.extensions.flask_babel
class BabelUnitTest(unittest.TestCase):
def setUp(self):
self.app = orchard.create_app('Testing')
self.app.config['BABEL_DEFAULT_LOCALE'] = 'en'
... | # -*- coding: utf-8 -*-
"""
Unit Test: orchard.extensions.babel
"""
import unittest
import orchard
import orchard.extensions.flask_babel
class BabelUnitTest(unittest.TestCase):
def setUp(self):
self.app = orchard.create_app('Testing')
self.app.config['LANGUAGES'] = {
'de': 'Deu... |
Swap query/refresh button spots on list screen | import React from "react";
import {Box} from "adminlte";
import LinkedListGroup from "app/components/LinkedListGroup";
import Pagination from "app/components/Pagination";
import RefreshButton from "app/components/RefreshButton";
import SearchBox from "app/components/SearchBox";
class MasterBox extends React.Componen... | import React from "react";
import {Box} from "adminlte";
import LinkedListGroup from "app/components/LinkedListGroup";
import Pagination from "app/components/Pagination";
import RefreshButton from "app/components/RefreshButton";
import SearchBox from "app/components/SearchBox";
class MasterBox extends React.Componen... |
Fix the gift certificate module so that an invalid code won't throw an exception. | """
GiftCertificate processor
"""
from django.utils.translation import ugettext as _
from l10n.utils import moneyfmt
from models import GiftCertificate
from payment.modules.base import BasePaymentProcessor, ProcessorResult, NOTSET
class PaymentProcessor(BasePaymentProcessor):
def __init__(self, settings):
... | """
GiftCertificate processor
"""
from django.utils.translation import ugettext as _
from l10n.utils import moneyfmt
from models import GiftCertificate
from payment.modules.base import BasePaymentProcessor, ProcessorResult, NOTSET
class PaymentProcessor(BasePaymentProcessor):
def __init__(self, settings):
... |
Fix typo: it is $this->storage, not just any local $storage | <?php
namespace Ob_Ivan\Cache\Driver;
use DateTime;
use Ob_Ivan\Cache\StorageInterface;
class MemoryDriver implements StorageInterface
{
const KEY_EXPIRE = __LINE__;
const KEY_VALUE = __LINE__;
/**
* @var [
* <string key> => [
* KEY_EXPIRE => <DateTime Expiration date>,
... | <?php
namespace Ob_Ivan\Cache\Driver;
use DateTime;
use Ob_Ivan\Cache\StorageInterface;
class MemoryDriver implements StorageInterface
{
const KEY_EXPIRE = __LINE__;
const KEY_VALUE = __LINE__;
/**
* @var [
* <string key> => [
* KEY_EXPIRE => <DateTime Expiration date>,
... |
Add integration test via docker | 'use strict';
/*jslint nomen: true, stupid: true*/
module.exports = function (grunt) {
grunt.registerTask('integration-test', 'Run integration tests', [
'docker-integration-test'
]);
grunt.registerMultiTask('docker-integration-test', function runTask() {
/*eslint-disable no-invalid-this*/... | 'use strict';
/*jslint nomen: true, stupid: true*/
module.exports = function (grunt) {
grunt.registerTask('integration-test', 'Run integration tests', [
'docker-integration-test'
]);
grunt.registerMultiTask('docker-integration-test', function runTask() {
/*eslint-disable no-invalid-this*/... |
Add a 5 second pause | """
The django clearsessions commend internally calls:
cls.get_model_class().objects.filter(
expire_date__lt=timezone.now()).delete()
which could lock the DB table for a long time when
having a large number of records to delete.
To prevent the job running forever, we only delete a limit number of
expired dja... | """
The django clearsessions commend internally calls:
cls.get_model_class().objects.filter(
expire_date__lt=timezone.now()).delete()
which could lock the DB table for a long time when
having a large number of records to delete.
To prevent the job running forever, we only delete a limit number of
expired dja... |
Disable PXF in ORCA CI | import os
import subprocess
import sys
from GpdbBuildBase import GpdbBuildBase
class GpBuild(GpdbBuildBase):
def __init__(self, mode):
self.mode = 'on' if mode == 'orca' else 'off'
def configure(self):
return subprocess.call(["./configure",
"--enable-mapreduce",... | import os
import subprocess
import sys
from GpdbBuildBase import GpdbBuildBase
class GpBuild(GpdbBuildBase):
def __init__(self, mode):
self.mode = 'on' if mode == 'orca' else 'off'
def configure(self):
return subprocess.call(["./configure",
"--enable-mapreduce",... |
Improve efficiency by merging two loops accessing the same data into one loop | package com.google.sps.data;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import org.apache.commons.collections4.keyvalue.MultiKey;
/*
* Class representing one row/entry in the aggregation response. A NULL field value
* means the field was not being ... | package com.google.sps.data;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.keyvalue.MultiKey;
/*
* Class representing one row/entry in the aggregation response. A NULL field value
* means the field was no... |
Rollback to supporting older versions of cffi | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
extra_compile_args = [] if os.name == 'nt' else ["-g", "-O2", "-march=nat... | #!/usr/bin/env python
import os
import sys
import io
try:
import setuptools
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Extension
from setuptools import find_packages
extra_compile_args = [] if os.name == 'nt' else ["-g", "-O2", "-march=nat... |
Fix the test to disassemble as if at address zero, not at an invalid address. The default SBAddress constructor sets the offset to 0xffffffffffffffff and the section to NULL.
This was causing problems on clang 602 branches that use MemoryObjects to as the container for opcode bytes instead of a plain array of bytes. S... | """
Use lldb Python API to disassemble raw machine code bytes
"""
import os, time
import re
import unittest2
import lldb, lldbutil
from lldbtest import *
class DisassembleRawDataTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@python_api_test
def test_disassemble_raw_data(self):
"""... | """
Use lldb Python API to disassemble raw machine code bytes
"""
import os, time
import re
import unittest2
import lldb, lldbutil
from lldbtest import *
class DisassembleRawDataTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@python_api_test
def test_disassemble_raw_data(self):
"""... |
Add Email Address for Contact | import React, { PropTypes, Component } from "react";
import { LOGO_BACKGROUND_PATH } from "../constants/image_paths";
const BetterSelfAddress = () => (
<p className="address small">
BetterHealth, Inc.
<br />
99 St Marks, 3D
<br />
New York, NY, 10009
<br />
jeffshek@gmail.com
</p>
);
... | import React, { PropTypes, Component } from "react";
import { LOGO_BACKGROUND_PATH } from "../constants/image_paths";
const BetterSelfAddress = () => (
<p className="address small">
BetterHealth, Inc.<br />99 St Marks, 3D<br />New York, NY, 10009
</p>
);
export default class Footer extends Component {
rende... |
Fix mistake in last commit | import sys
from datetime import datetime
from courtutils.databases.postgres import PostgresDatabase
from courtreader import readers
from courtutils.logger import get_logger
log = get_logger()
reader = readers.DistrictCourtReader()
reader.connect()
db = PostgresDatabase('district')
def update_case(fips):
cases_to_... | import sys
from datetime import datetime
from courtutils.databases.postgres import PostgresDatabase
from courtreader import readers
from courtutils.logger import get_logger
log = get_logger()
reader = readers.DistrictCourtReader()
reader.connect()
db = PostgresDatabase('district')
def update_case(fips):
cases_to_... |
Add missing mechanism-too-weak SASL Error | /**
*
* Copyright 2014 Florian Schmaus
*
* 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 ag... | /**
*
* Copyright 2014 Florian Schmaus
*
* 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 ag... |
Change type comparisions with isinstance | from django import forms
def parsleyfy(klass):
class ParsleyClass(klass):
def __init__(self, *args, **kwargs):
super(ParsleyClass, self).__init__(*args, **kwargs)
for key, val in self.fields.items():
if val.required:
val.widget.attrs.update({"dat... | from django import forms
def parsleyfy(klass):
class ParsleyClass(klass):
def __init__(self, *args, **kwargs):
super(ParsleyClass, self).__init__(*args, **kwargs)
for key, val in self.fields.items():
if val.required:
val.widget.attrs.update({"data... |
Replace assertGreaterEqual with assertTrue(a >= b) | from unittest import TestCase
from itertools import repeat, imap, izip, cycle
from spicedham.bayes import Bayes
from spicedham import Spicedham
class TestBayes(TestCase):
def test_classify(self):
sh = Spicedham()
b = Bayes(sh.config, sh.backend)
b.backend.reset()
self._traini... | from unittest import TestCase
from itertools import repeat, imap, izip, cycle
from spicedham.bayes import Bayes
from spicedham import Spicedham
class TestBayes(TestCase):
def test_classify(self):
sh = Spicedham()
b = Bayes(sh.config, sh.backend)
b.backend.reset()
self._traini... |
Raise AttributeError instead of None | import imp
import json
import os
import sys
class Dot(dict):
def __init__(self, d):
super(dict, self).__init__()
for k, v in d.iteritems():
if isinstance(v, dict):
self[k] = Dot(v)
else:
self[k] = v
def __getattr__(self, attr):
... | import imp
import json
import os
import sys
class Dot(dict):
def __init__(self, d):
super(dict, self).__init__()
for k, v in d.iteritems():
if isinstance(v, dict):
self[k] = Dot(v)
else:
self[k] = v
def __getattr__(self, attr):
... |
Update grunt to use bower_components | module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'public/css/calendar.css': 'public/sass/calendar.scss'
... | module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'public/css/calendar.css': 'public/sass/calendar.scss'
... |
Add cast so code compiles properly under source 1.4 | package org.bouncycastle.cms;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
import java.security.spec.InvalidParameterSpecException;
import javax.crypto.interfaces.PBEKey;
import javax.crypto.spec.PBEParameterSpec;
public abstract class CMSPBEKey
implements PB... | package org.bouncycastle.cms;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
import java.security.spec.InvalidParameterSpecException;
import javax.crypto.interfaces.PBEKey;
import javax.crypto.spec.PBEParameterSpec;
public abstract class CMSPBEKey
implements PB... |
Add support for django 1.8 by using test runner | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
if not settings.configured:
settings_dict = dict(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django_pandas',
'django_pandas.tests',
),
DATABASES={
... | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
if not settings.configured:
settings_dict = dict(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django_pandas',
'django_pandas.tests',
),
DATABASES={
... |
Fix PEP8 E713 - test for membership should be "not in" | # -*- coding: utf-8 -*-
# Import python libs
import os
# Import third party libs
import yaml
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
return {'shell': os.en... | # -*- coding: utf-8 -*-
# Import python libs
import os
# Import third party libs
import yaml
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
return {'shell': os.en... |
Fix added for faster animation. Conflict with modals not showing up resolved. | var apiFactoryApp = angular.module("APIFactoryWeb", ["ngRoute", "Shared", "Main", "Entities"]);
apiFactoryApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/entities', {
templateUrl: 'partials/entities.partial.html',
controller: 'Enti... | var apiFactoryApp = angular.module("APIFactoryWeb", ["ngRoute", "Shared", "Main", "Entities"]);
apiFactoryApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/entities', {
templateUrl: 'partials/entities.partial.html',
controller: 'Enti... |
Fix command message if the account wasn't found on deleting. | package com.github.games647.flexiblelogin.tasks;
import com.github.games647.flexiblelogin.FlexibleLogin;
import java.util.UUID;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.util.command.CommandSource;
public class UnregisterTask implement... | package com.github.games647.flexiblelogin.tasks;
import com.github.games647.flexiblelogin.FlexibleLogin;
import java.util.UUID;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.util.command.CommandSource;
public class UnregisterTask implement... |
Fix typing conflict on Python 3.7
When using bazel on Python3.7, I got error message below
```
Traceback (most recent call last):
File "/private/var/tmp/_bazel_yujo/abf0a3d83a4b1d722a32424a453d5c05/sandbox/darwin-sandbox/39/execroot/__main__/bazel-out/darwin-fastbuild/bin/tests/unit/unit_tests.runfiles/__main__/t... | from setuptools import setup, find_packages
try:
import md5 # fix for "No module named _md5" error
except ImportError:
# python 3 moved md5
from hashlib import md5
tests_require = [
"dill",
"coverage",
"coveralls",
"mock",
"nose",
]
setup(name="expiringdict",
version="1.2.0",
... | from setuptools import setup, find_packages
try:
import md5 # fix for "No module named _md5" error
except ImportError:
# python 3 moved md5
from hashlib import md5
tests_require = [
"dill",
"coverage",
"coveralls",
"mock",
"nose",
]
setup(name="expiringdict",
version="1.2.0",
... |
Include poll info field in JSON response | <?php
namespace app\modules\rest\versions\v1\controllers;
use Yii;
use app\models\Poll;
use app\models\Code;
use app\modules\rest\controllers\VotingRestController;
use yii\helpers\ArrayHelper;
use app\components\filters\TokenFilter;
use yii\base\UserException;
class PollController extends VotingRestController
{
... | <?php
namespace app\modules\rest\versions\v1\controllers;
use Yii;
use app\models\Poll;
use app\models\Code;
use app\modules\rest\controllers\VotingRestController;
use yii\helpers\ArrayHelper;
use app\components\filters\TokenFilter;
use yii\base\UserException;
class PollController extends VotingRestController
{
... |
BAP-6772: Remove organization calendar type from community edition | <?php
namespace Oro\Bundle\PlatformBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfon... | <?php
namespace Oro\Bundle\PlatformBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfon... |
Handle failed geocoder requests correct | anol.geocoder.Base = function(_options) {
if(_options === undefined) {
return;
}
this.url = _options.url;
this.options = _options;
};
anol.geocoder.Base.prototype = {
CLASS_NAME: 'anol.geocoder.Base',
handleResponse: function(response) {
var self = this;
var results = []... | anol.geocoder.Base = function(_options) {
if(_options === undefined) {
return;
}
this.url = _options.url;
this.options = _options;
};
anol.geocoder.Base.prototype = {
CLASS_NAME: 'anol.geocoder.Base',
handleResponse: function(response) {
var self = this;
var results = []... |
Use Objects::requireNonNull instead of if-throw | /*
* Copyright (c) 2013-2015 Falko Schumann <www.muspellheim.de>
* Released under the terms of the MIT License.
*/
package de.muspellheim.signalslot;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* A signal act as source of data and can connect to any comp... | /*
* Copyright (c) 2013-2015 Falko Schumann <www.muspellheim.de>
* Released under the terms of the MIT License.
*/
package de.muspellheim.signalslot;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* A signal act as source of data and can connect to any compatible slot.
*
* @param ... |
Add source map to uglifyjs | const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: './src/index.js',
devtool: 'source-map',
output: {
path: path.join(__dirname, 'dist'),
filename: 'sync-client.min.js',
libraryTarget: 'commonjs2',
library: 'sync-client.min.js',
},
module: {
rules:... | const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: './src/index.js',
devtool: 'source-map',
output: {
path: path.join(__dirname, 'dist'),
filename: 'sync-client.min.js',
libraryTarget: 'commonjs2',
library: 'sync-client.min.js',
},
module: {
rules:... |
Remove route ignore adding if not enabled | <?php
namespace Gregoriohc\Preview;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
class PreviewServiceProvider extends LaravelServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $def... | <?php
namespace Gregoriohc\Preview;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
class PreviewServiceProvider extends LaravelServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $def... |
Correct default handling of collection key | import stableStringify from 'json-stable-stringify';
function defaultGetId(item) {
return item.id;
}
function defaultCollectionKey(options = {}) {
return stableStringify(options);
}
function defaultItemKey(id) {
return id;
}
export default function generateStore({
getId = defaultGetId,
collectionKey = def... | import stableStringify from 'json-stable-stringify';
function defaultGetId(item) {
return item.id;
}
function defaultCollectionKey(options) {
if (!options) {
return '';
}
return stableStringify(options);
}
function defaultItemKey(id) {
return id;
}
export default function generateStore({
getId = de... |
Improve handling of non standard errors returned | (function () {
"use strict";
var Fiber = require('fibers'),
extend = require('util')._extend;
module.exports = Future;
function Future () {
this.fiber = Fiber.current;
this.resolved = false;
this.yielded = false;
}
Future.prototype.resolve = function (err, res) {
var self = this;
... | (function () {
"use strict";
var Fiber = require('fibers');
module.exports = Future;
function Future () {
this.fiber = Fiber.current;
this.resolved = false;
this.yielded = false;
}
Future.prototype.resolve = function (err, res) {
var self = this;
if (this.resolved) return;
this.re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.