text
stringlengths
17
1.47k
positive
stringlengths
673
4.43k
negative
stringlengths
677
2.81k
Remove confusing and useless "\n"
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Main server script for a pyqode.python backend. You can directly use this script in your application if it fits your needs or use it as a starting point for writing your own server. :: usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port positional argumen...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Main server script for a pyqode.python backend. You can directly use this script in your application if it fits your needs or use it as a starting point for writing your own server. :: usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port positional argumen...
Trim resolutions so they are a factor of 2. Currently ol3 appears to be assuming that resolutions are always a factor of 2, need to look into it more.
// Extent of the map in units of the projection var extent = [-3276800, -3276800, 3276800, 3276800]; // Fixed resolutions to display the map at var resolutions = [1600, 800, 400, 200, 100, 50, 25]; // Basic ol3 Projection definition, include the extent here and specify the // resolutions as a property of the View2D o...
// Extent of the map in units of the projection var extent = [-3276800, -3276800, 3276800, 3276800]; // Fixed resolutions to display the map at var resolutions = [1600, 800, 400, 200, 100, 50, 25, 10, 5, 2.5, 1, 0.5]; // Basic ol3 Projection definition, include the extent here and specify the // resolutions as a prop...
ZON-3409: Update to version with celery.
from setuptools import setup, find_packages setup( name='zeit.wysiwyg', version='2.0.8.dev0', author='gocept, Zeit Online', author_email='zon-backend@zeit.de', url='http://www.zeit.de/', description="vivi legacy WYSIWYG editor", packages=find_packages('src'), package_dir={'': 'src'}, ...
from setuptools import setup, find_packages setup( name='zeit.wysiwyg', version='2.0.8.dev0', author='gocept, Zeit Online', author_email='zon-backend@zeit.de', url='http://www.zeit.de/', description="vivi legacy WYSIWYG editor", packages=find_packages('src'), package_dir={'': 'src'}, ...
Remove reference to dashboard services.
define( [ "angular", "./dataset-list-controllers", "./dataset-list-services" ], function (angular, controllers) { "use strict"; var datasetListRoutes = angular.module("datasetList.routes", ["narthex.common"]); datasetListRoutes.config( [ ...
define( [ "angular", "./dataset-list-controllers", "./dataset-list-services" ], function (angular, controllers) { "use strict"; var datasetListRoutes = angular.module("datasetList.routes", ["narthex.common", "dashboard.services"]); datasetListRoutes.config( ...
Work around for watchdog problem on OS X.
import sys # FSEvents observer in watchdog cannot have multiple watchers of the same path # use kqueue instead if sys.platform == 'darwin': from watchdog.observers.kqueue import KqueueObserver as Observer else: from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os...
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os import time class MyEventHandler(FileSystemEventHandler): def __init__(self, filePath, callback): super(MyEventHandler, self).__init__() self.filePath = filePath self.callback = callback ...
Implement web assets in the twig function
<?php declare(strict_types=1); /** * Copyright (c) 2013-2017 OpenCFP * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. * * @see https://github.com/opencfp/opencfp */ namespace OpenCFP\Infrastructure\Templating; use OpenCFP\PathInter...
<?php declare(strict_types=1); /** * Copyright (c) 2013-2017 OpenCFP * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. * * @see https://github.com/opencfp/opencfp */ namespace OpenCFP\Infrastructure\Templating; use OpenCFP\PathInter...
Fix invalid typehint for subject in is_granted Twig function
<?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\Bridge\Twig\Extension; use Symfony\Component\Security\Acl\Voter...
<?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\Bridge\Twig\Extension; use Symfony\Component\Security\Acl\Voter...
Adjust Account.databases() to new return format
from .base import BaseWrapper from .database import Database from ..constants import URL_BASE class Account(BaseWrapper): """An object encapsulating a billing account on Luminoso's servers""" def __init__(self, acct_name, session): """Construct a wrapper around a particular account name NOT...
from .base import BaseWrapper from .database import Database from ..constants import URL_BASE class Account(BaseWrapper): """An object encapsulating a billing account on Luminoso's servers""" def __init__(self, acct_name, session): """Construct a wrapper around a particular account name NOT...
Use the proper entry point name.
import os from setuptools import setup, find_packages import uuid from jirafs_list_table import __version__ as version_string requirements_path = os.path.join( os.path.dirname(__file__), 'requirements.txt', ) try: from pip.req import parse_requirements requirements = [ str(req.req) for req in...
import os from setuptools import setup, find_packages import uuid from jirafs_list_table import __version__ as version_string requirements_path = os.path.join( os.path.dirname(__file__), 'requirements.txt', ) try: from pip.req import parse_requirements requirements = [ str(req.req) for req in...
Use the babel-runtime to fix the build
/* global process */ module.exports = function (config) { config.set({ browsers: [ process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome' ], singleRun: true, frameworks: [ 'mocha' ], files: [ 'https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-with-addons.js', ...
/* global process */ module.exports = function (config) { config.set({ browsers: [ process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome' ], singleRun: true, frameworks: [ 'mocha' ], files: [ 'https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-with-addons.js', ...
Prepare first 2.0 alpha release
import sys from setuptools import find_packages, setup VERSION = '2.0a1' install_requires = [ 'django-local-settings>=1.0a13', 'stashward', ] if sys.version_info[:2] < (3, 4): install_requires.append('enum34') setup( name='django-arcutils', version=VERSION, url='https://github.com/PSU-OI...
import sys from setuptools import find_packages, setup VERSION = '2.0.dev0' install_requires = [ 'django-local-settings>=1.0a13', 'stashward', ] if sys.version_info[:2] < (3, 4): install_requires.append('enum34') setup( name='django-arcutils', version=VERSION, url='https://github.com/PSU...
Decrease mapLimit and pool maximums
#!/usr/bin/env node 'use strict'; var stdin = process.openStdin(); var async = require('async'); var cheerio = require('cheerio'); var ent = require('ent'); var request = require('request'); main(); function main() { stdin.setEncoding('utf8'); stdin.on('data', function(data) { fetchTitles(JSON.par...
#!/usr/bin/env node 'use strict'; var stdin = process.openStdin(); var async = require('async'); var cheerio = require('cheerio'); var ent = require('ent'); var request = require('request'); main(); function main() { stdin.setEncoding('utf8'); stdin.on('data', function(data) { fetchTitles(JSON.par...
Add test cases for optional enums Added test cases where required is set as true and false, with the attribute omitted.
<?php /* * This file is part of the JsonSchema package. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace JsonSchema\Tests\Constraints; class EnumTest extends BaseTestCase { public function getInvalidTests() { ...
<?php /* * This file is part of the JsonSchema package. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace JsonSchema\Tests\Constraints; class EnumTest extends BaseTestCase { public function getInvalidTests() { ...
Order radar view more sensibly 1. Sort with by date_seen DESC so new stuff is at the top and old stuff is at the bottom 2. Sort by id as secondary criteria so order is consistent otherwise the order changes a bit every time we make an edit
from django.views.generic import TemplateView from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from election_snooper.models import SnoopedElection from election_snooper.forms import ReviewElectionForm class SnoopedElectionView(TemplateView): template_name = "election_snoo...
from django.views.generic import TemplateView from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from election_snooper.models import SnoopedElection from election_snooper.forms import ReviewElectionForm class SnoopedElectionView(TemplateView): template_name = "election_snoo...
Set the api token from a successful authorization
import Ember from 'ember'; export default Ember.Route.extend({ beforeModel: function(transition) { var win = window.open('/github_login', 'Authorization', 'width=1000,height=450,' + 'toolbar=0,scrollbars=1,status=1,resizable=1,' + ...
import Ember from 'ember'; export default Ember.Route.extend({ beforeModel: function(transition) { var win = window.open('/github_login', 'Authorization', 'width=1000,height=450,' + 'toolbar=0,scrollbars=1,status=1,resizable=1,' + ...
Add more shards to test speed
<?php return [ 'index' => 'sites', 'body' => [ 'settings' => [ 'number_of_shards' => 20, 'number_of_replicas' => 0, ], 'mapping' => [ 'default' => [ 'properties' => [ 'title' => [ 'ty...
<?php return [ 'index' => 'sites', 'body' => [ 'settings' => [ 'number_of_shards' => 10, 'number_of_replicas' => 0, ], 'mapping' => [ 'default' => [ 'properties' => [ 'title' => [ 'ty...
Revert "small fix in perplexity runner" This reverts commit b195416761f12df496baa389df4686b2cf60c675.
from typing import Dict, List from typeguard import check_argument_types import tensorflow as tf import numpy as np from neuralmonkey.decoders.autoregressive import AutoregressiveDecoder from neuralmonkey.decorators import tensor from neuralmonkey.runners.base_runner import BaseRunner class PerplexityRunner(BaseRun...
from typing import Dict, List from typeguard import check_argument_types import tensorflow as tf import numpy as np from neuralmonkey.decoders.autoregressive import AutoregressiveDecoder from neuralmonkey.decorators import tensor from neuralmonkey.runners.base_runner import BaseRunner class PerplexityRunner(BaseRun...
CC-5781: Upgrade script for new storage quota implementation
<?php // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( get_include_path(), realpath(...
<?php // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( get_include_path(), realpath(...
Use page.content if modified or fallback to page.sections in plugins hooks
var _ = require('lodash'); var error = require('../utils/error'); /* Return the context for a plugin. It tries to keep compatibilities with GitBook v2 */ function pluginCtx(plugin) { var book = plugin.book; var ctx = book; return ctx; } /* Call a function "fn" with a context of page similar t...
var _ = require('lodash'); var error = require('../utils/error'); /* Return the context for a plugin. It tries to keep compatibilities with GitBook v2 */ function pluginCtx(plugin) { var book = plugin.book; var ctx = book; return ctx; } /* Call a function "fn" with a context of page similar t...
Allow TextWire to write binary headers as well as plain text.
package net.openhft.chronicle.wire; import net.openhft.chronicle.bytes.Bytes; import net.openhft.chronicle.bytes.BytesUtil; import org.junit.Test; import java.io.IOException; import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; i...
package net.openhft.chronicle.wire; import net.openhft.chronicle.bytes.Bytes; import net.openhft.chronicle.bytes.BytesUtil; import org.junit.Test; import java.io.IOException; import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; i...
Remove extraneous colon from url(...) regex
<?php namespace Kibo\Phast\Filters\HTML; use Kibo\Phast\ValueObjects\URL; class CSSImagesOptimizationServiceHTMLFilter extends ImagesOptimizationServiceHTMLFilter { public function transformHTMLDOM(\DOMDocument $document) { $styleTags = $document->getElementsByTagName('style'); /** @var \DOMElem...
<?php namespace Kibo\Phast\Filters\HTML; use Kibo\Phast\ValueObjects\URL; class CSSImagesOptimizationServiceHTMLFilter extends ImagesOptimizationServiceHTMLFilter { public function transformHTMLDOM(\DOMDocument $document) { $styleTags = $document->getElementsByTagName('style'); /** @var \DOMElem...
Add ES6 string interpolation in template
import React from 'react'; const Item = ({ onDeleteClick, name, year, rated, runtime, genre, director, actors, description, country, awards, poster, scoreMetacritic, scoreImdb, scoreTomato, scoreTomatoUser, tomatoConsensus }) => <li className="item"> <img className="item__p...
import React from 'react'; const Item = ({ onDeleteClick, name, year, rated, runtime, genre, director, actors, description, country, awards, poster, scoreMetacritic, scoreImdb, scoreTomato, scoreTomatoUser, tomatoConsensus }) => <li className="item"> <img className="item__p...
Add newly created packages to config.
<?php namespace Studio\Console; use Studio\Config\Config; use Studio\Creator; use Studio\Package; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class CreateCom...
<?php namespace Studio\Console; use Studio\Creator; use Studio\Package; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class CreateCommand extends Command { ...
Change credential text to use the same identifiers as the commandline tools This allows a single simple cut/paste into a config file.
<h4>Details for your app: <em><?php $this->utility->safe($name); ?></em></h4> <div class="row"> <div class="span12"> <table class="table left-header"> <tr> <td class="span2">Name</td> <td><?php $this->utility->safe($name); ?></td> </tr> <tr> <td>consumerKey =</td> ...
<h4>Details for your app: <em><?php $this->utility->safe($name); ?></em></h4> <div class="row"> <div class="span12"> <table class="table left-header"> <tr> <td class="span2">Name</td> <td><?php $this->utility->safe($name); ?></td> </tr> <tr> <td>Consumer Key</td> ...
Check the end of notification fade-out animation
var NotificationComponent = Ember.Component.extend({ classNames: ['js-bb-notification'], typeClass: function () { var classes = '', message = this.get('message'), type, dismissible; // Check to see if we're working with a DS.Model or a plain JS object ...
var NotificationComponent = Ember.Component.extend({ classNames: ['js-bb-notification'], typeClass: function () { var classes = '', message = this.get('message'), type, dismissible; // Check to see if we're working with a DS.Model or a plain JS object ...
Add a space into the material filter search string Without this space the end of the session title is forced onto the start of the instructor names. This leads to a search for 'dean' returning results of suicideAngela which is incorrect.
import Ember from 'ember'; import SortableTable from 'ilios/mixins/sortable-table'; import escapeRegExp from '../utils/escape-reg-exp'; const { Component, computed, isPresent } = Ember; export default Component.extend(SortableTable, { classNames: ['my-materials'], filter: null, courseIdFilter: null, filteredM...
import Ember from 'ember'; import SortableTable from 'ilios/mixins/sortable-table'; import escapeRegExp from '../utils/escape-reg-exp'; const { Component, computed, isPresent } = Ember; export default Component.extend(SortableTable, { classNames: ['my-materials'], filter: null, courseIdFilter: null, filteredM...
Include JSX in browserified bundle for Karma
'use strict'; module.exports = function (config) { config.set({ basePath: '', frameworks: ['browserify', 'mocha', 'sinon'], files: [ // Source // 'src/js/**/*.js', // // Application // 'build/css/main.css', // 'build/js/modernizr.js', // 'index.html', // Test sui...
'use strict'; module.exports = function (config) { config.set({ basePath: '', frameworks: ['browserify', 'mocha', 'sinon'], files: [ // Source // 'src/js/**/*.js', // // Application // 'build/css/main.css', // 'build/js/modernizr.js', // 'index.html', // Test sui...
Remove unneeded return + add comment about require.resolve()
var sass = require('node-sass'), path = require('path'), fs = require('fs'); var handledBaseFolderNames = { 'bower_components': 'bower_components', 'node_modules': 'node_modules' }; function customImporter (url, prev, done) { var baseFolderName = url.split(path.sep)[0]; if (handledBaseFolderN...
var sass = require('node-sass'), path = require('path'), fs = require('fs'); var handledBaseFolderNames = { 'bower_components': 'bower_components', 'node_modules': 'node_modules' }; function customImporter (url, prev, done) { var baseFolderName = url.split(path.sep)[0]; if (handledBaseFolderN...
Remove HTML table (our mail cannot send HTML)
# -*- encoding: utf-8 -*- import logging from celery import shared_task from django.utils import timezone from invoice.models import InvoiceUser from mail.service import queue_mail_message from mail.tasks import process_mail from .report import time_summary logger = logging.getLogger(__name__) @shared_task def ma...
# -*- encoding: utf-8 -*- import logging from celery import shared_task from django.utils import timezone from invoice.models import InvoiceUser from mail.service import queue_mail_message from mail.tasks import process_mail from .report import time_summary logger = logging.getLogger(__name__) @shared_task def ma...
Allow Edit and Set of Slug Field
<div class="form-group"> <input type="text" id="name" class="form-control input-lg" name="name" placeholder="Enter Page Title" value="{{ old('name', $page->name) }}"> </div> <div class="form-group no-margin"> <div class="input-group"> <span...
<div class="form-group"> <input type="text" id="name" class="form-control input-lg" name="name" placeholder="Enter Page Title" value="{{ old('name', $page->name) }}"> </div> <div class="form-group no-margin"> <div class="input-group"> <span...
Use SplFileInfo::isFile() method for checking if path is a file
<?php namespace App\Controllers; use PHLAK\Config\Config; use Slim\Psr7\Response; use SplFileInfo; class FileInfoController { /** @var Config App configuration component */ protected $config; /** * Create a new FileInfoController object. * * @param \PHLAK\Config\Config $config */ ...
<?php namespace App\Controllers; use PHLAK\Config\Config; use Slim\Psr7\Response; use SplFileInfo; class FileInfoController { /** @var Config App configuration component */ protected $config; /** * Create a new FileInfoController object. * * @param \PHLAK\Config\Config $config */ ...
Set dashboard as next state after logging in
(function () { "use strict"; angular.module("mfl.auth.controllers", [ "mfl.auth.services", "ui.router" ]) .controller("mfl.auth.controllers.login", ["$scope", "$sce", "$state", "mfl.auth.services.login", function ($scope, $sce, $state, loginService) { $scope...
(function () { "use strict"; angular.module("mfl.auth.controllers", [ "mfl.auth.services", "ui.router" ]) .controller("mfl.auth.controllers.login", ["$scope", "$sce", "$state", "mfl.auth.services.login", function ($scope, $sce, $state, loginService) { $scope...
Generalize method names to be compatible with Python 2.7 and 3.4
import unittest from utils import TextLoader import numpy as np from collections import Counter class TestUtilsMethods(unittest.TestCase): def setUp(self): self.data_loader = TextLoader("tests/test_data", batch_size=2, seq_length=5) def test_init(self): print (self.data_loader.vocab) print...
import unittest from utils import TextLoader import numpy as np class TestUtilsMethods(unittest.TestCase): def setUp(self): self.data_loader = TextLoader("tests/test_data", batch_size=2, seq_length=5) def test_init(self): print (self.data_loader.vocab) print (self.data_loader.tensor) ...
Use find_packages to find migrations and management commands
#!/usr/bin/env python from setuptools import setup, find_packages install_requires = ['Django>=1.5'] try: from collections import OrderedDict except ImportError: install_requires.append('ordereddict>=1.1') setup( name='django-auth-policy', version='0.9.5', zip_safe=False, description='Enforc...
#!/usr/bin/env python from setuptools import setup install_requires = ['Django>=1.5'] try: from collections import OrderedDict except ImportError: install_requires.append('ordereddict>=1.1') setup( name='django-auth-policy', version='0.9.4', zip_safe=False, description='Enforces a couple of...
Update sorl-thumbnail to latest version
#!/usr/bin/env python from fancypages import __version__ from setuptools import setup, find_packages setup( name='django-fancypages', version=__version__, url='https://github.com/tangentlabs/django-fancypages', author="Sebastian Vetter", author_email="sebastian.vetter@tangentsnowball.com.au", ...
#!/usr/bin/env python from fancypages import __version__ from setuptools import setup, find_packages setup( name='django-fancypages', version=__version__, url='https://github.com/tangentlabs/django-fancypages', author="Sebastian Vetter", author_email="sebastian.vetter@tangentsnowball.com.au", ...
[Address] Clean all inputs before filling in the address
/* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ (function ( $ ) { $.fn.extend({ addressBook: function () { var element = $(this); ...
/* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ (function ( $ ) { $.fn.extend({ addressBook: function () { var element = $(this); ...
Use Bukkit.getPlayerExact(String) rather than Bukkit.getPlayer(String)
package fr.aumgn.bukkitutils.playerid; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; public final class PlayerId { private static final Map<String, PlayerId> accounts = new Has...
package fr.aumgn.bukkitutils.playerid; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; public final class PlayerId { private static final Map<String, PlayerId> accounts = new Has...
Fix amdDefine patch to check for backboneCandidate
// @private // Calls the callback passing to it the Backbone object every time it's detected. // The function uses multiple methods of detection. var patchDefine = function(callback) { // AMD patchFunctionLater(window, "define", function(originalFunction) { return function() { // function arguments: (i...
// @private // Calls the callback passing to it the Backbone object every time it's detected. // The function uses multiple methods of detection. var patchDefine = function(callback) { // AMD patchFunctionLater(window, "define", function(originalFunction) { return function() { // function arguments: (i...
Add Access Rules in AudioConference controller
<?php /** * oskr-portal * Created: 11.05.17 12:44 * @copyright Copyright (c) 2017 OSKR NIAEP */ namespace frontend\controllers; use frontend\models\audioconference\AudioConferenceService; use yii\filters\AccessControl; use yii\web\Controller; use yii\filters\VerbFilter; /** * Class AudioConferenceController * ...
<?php /** * oskr-portal * Created: 11.05.17 12:44 * @copyright Copyright (c) 2017 OSKR NIAEP */ namespace frontend\controllers; use frontend\models\audioconference\AudioConferenceService; use yii\web\Controller; use yii\filters\VerbFilter; /** * Class AudioConferenceController * * @author Shubnikov Alexey <a....
Return `parent::newQuery();` is not using `withTrashed` or `onlyTrashed`
<?php /** * Laravel 4 Repository classes * * @author Andreas Lutro <anlutro@gmail.com> * @license http://opensource.org/licenses/MIT * @package l4-repository */ namespace anlutro\LaravelRepository; use Illuminate\Database\Eloquent\Model; class SoftDeletingEloquentRepository extends EloquentRepository { ...
<?php /** * Laravel 4 Repository classes * * @author Andreas Lutro <anlutro@gmail.com> * @license http://opensource.org/licenses/MIT * @package l4-repository */ namespace anlutro\LaravelRepository; use Illuminate\Database\Eloquent\Model; class SoftDeletingEloquentRepository extends EloquentRepository { ...
Use compat for unicode import
"""Coordination chatroom game.""" import dallinger as dlgr from dallinger.compat import unicode from dallinger.config import get_config config = get_config() def extra_settings(): config.register('network', unicode) config.register('n', int) class CoordinationChatroom(dlgr.experiments.Experiment): """...
"""Coordination chatroom game.""" import dallinger as dlgr from dallinger.config import get_config try: unicode = unicode except NameError: # Python 3 unicode = str config = get_config() def extra_settings(): config.register('network', unicode) config.register('n', int) class CoordinationChatroom...
Fix filename creation in csv export action
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 ...
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 ...
Revert "Return utf-8, not ascii." This reverts commit 86cbefc74471e4c991c96e0385b931a2a20f5d50. Former-commit-id: 3246e0bfefb806bd2b4d3dda0cb77e91f3481971
from falcon.util.uri import parse_query_string import json from api.actions import pos_tagging class ApiResource(object): def parse_request_data(self, raw_post_data): encoded_raw_post_data = "" try: encoded_raw_post_data = str(raw_post_data, 'utf-8') except UnicodeDecodeError: ...
from falcon.util.uri import parse_query_string import json from api.actions import pos_tagging class ApiResource(object): def parse_request_data(self, raw_post_data): encoded_raw_post_data = "" try: encoded_raw_post_data = str(raw_post_data, 'utf-8') except UnicodeDecodeError: ...
Add source maps to get better debugging in the browser
const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { entry: { app: './app.js' }, output: { filename: '[name].bundle.js', path: path.resolve(__dirname, 'dist'), ...
const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { entry: { app: './app.js' }, output: { filename: '[name].bundle.js', path: path.resolve(__dirname, 'dist'), ...
Add divider to the list
import React, { PureComponent } from "react"; import PropTypes from "prop-types"; import styled from "styled-components"; import { Divider } from "@blueprintjs/core"; import { EntriesShape } from "../prop-types/entry.js"; import Entry from "./Entry.js"; import { List, AutoSizer } from "react-virtualized"; class Entrie...
import React, { PureComponent } from "react"; import PropTypes from "prop-types"; import styled from "styled-components"; import { EntriesShape } from "../prop-types/entry.js"; import Entry from "./Entry.js"; import { List, AutoSizer } from "react-virtualized"; class Entries extends PureComponent { rowRenderer = (...
Allow empty input to terminate testing
package ch.poole.openinghoursparser; import java.io.ByteArrayInputStream; import java.util.List; import java.util.Scanner; /** * Individual testing for the OpeningHoursParser, receiving inputs from System.in * * * @author Vuong Ho * */ public class IndividualTest { public static void main(String[] args) {...
package ch.poole.openinghoursparser; import java.io.ByteArrayInputStream; import java.util.List; import java.util.Scanner; /** * Individual testing for the OpeningHoursParser, receiving * inputs from System.in * * * @author Vuong Ho * */ public class IndividualTest { public static void main(String[] arg...
Change locale support for Laravel 5.4
<?php namespace Someline\Support\Controllers; /** * Created for someline-starter. * User: Libern */ use Carbon\Carbon; use Illuminate\Http\Request; use Someline\Base\Http\Controllers\Controller; class LocaleController extends Controller { /** * @param Request $request * @param $locale * @retur...
<?php namespace Someline\Support\Controllers; /** * Created for someline-starter. * User: Libern */ use Carbon\Carbon; use Illuminate\Http\Request; use Someline\Base\Http\Controllers\Controller; class LocaleController extends Controller { /** * @param Request $request * @param $locale * @retur...
Fix course id separator at export all courses command
""" Script for exporting all courseware from Mongo to a directory """ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.xml_exporter import export_to_xml from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore class Command(BaseC...
""" Script for exporting all courseware from Mongo to a directory """ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.xml_exporter import export_to_xml from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore class Command(BaseC...
Fix bug which caused shots to be fired at the wrong board Postgres (SQL) makes no promises regarding what order rows are stored / returned, so we need to sort them if we are to make the assumption that the 'first board' belongs to player 1.
function coordinatesToString(x, y) { return x + ',' + y; } module.exports = function(sequelize, DataTypes) { var Game = sequelize.define('Game', { player1: {type: DataTypes.STRING}, player2: {type: DataTypes.STRING}, next: {type: DataTypes.STRING}, lastMove: {type: DataTypes.STRING, allowNull: fals...
function coordinatesToString(x, y) { return x + ',' + y; } module.exports = function(sequelize, DataTypes) { var Game = sequelize.define('Game', { player1: {type: DataTypes.STRING}, player2: {type: DataTypes.STRING}, next: {type: DataTypes.STRING}, lastMove: {type: DataTypes.STRING, allowNull: fals...
Move _hal_regex to class scope.
#!/usr/bin/env python # encoding: utf-8 import json import re from .resource import Resource class Response(Resource): """Represents an HTTP response that is hopefully a HAL document.""" _hal_regex = re.compile(r"application/hal\+json") def __init__(self, response): """Pass it a Requests respo...
#!/usr/bin/env python # encoding: utf-8 import json import re from .resource import Resource class Response(Resource): """Represents an HTTP response that is hopefully a HAL document.""" def __init__(self, response): """Pass it a Requests response object. :response: A response object from ...
Add mcmod.info fix for SlopesAndCorners SlimevoidLib dependency
#!/usr/bin/python # Fixes and mod-specific data for various mods' mcmod.info files DEP_BLACKLIST = set(( "mod_MinecraftForge", # we always have Forge "Forge", # typo for mod_MinecraftForge "Industrialcraft", # typo for IC2 "GUI_Api", # typo for GuiAPI and not needed on server "EurysCore", # rep...
#!/usr/bin/python # Fixes and mod-specific data for various mods' mcmod.info files DEP_BLACKLIST = set(( "mod_MinecraftForge", # we always have Forge "Forge", # typo for mod_MinecraftForge "Industrialcraft", # typo for IC2 "GUI_Api", # typo for GuiAPI and not needed on server )) DEP_ADDITIONS...
Remove argument defaulting from Version() It was moved to the ABC and subsequently the check was left behind.
from piper.abc import DynamicItem from piper.utils import oneshot class Version(DynamicItem): """ Base for versioning classes """ def __str__(self): # pragma: nocover return self.get_version() def get_version(self): raise NotImplementedError() class StaticVersion(Version): ...
from piper.abc import DynamicItem from piper.utils import oneshot class Version(DynamicItem): """ Base for versioning classes """ def __str__(self): # pragma: nocover return self.get_version() def get_version(self): raise NotImplementedError() class StaticVersion(Version): ...
Add statsd data for (in)secure requests
from django.conf import settings from django_statsd.clients import statsd from django_statsd.middleware import GraphiteRequestTimingMiddleware class GraphiteViewHitCountMiddleware(GraphiteRequestTimingMiddleware): """add hit counting to statsd's request timer.""" def process_view(self, request, view_func, v...
from django.conf import settings from django_statsd.clients import statsd from django_statsd.middleware import GraphiteRequestTimingMiddleware class GraphiteViewHitCountMiddleware(GraphiteRequestTimingMiddleware): """add hit counting to statsd's request timer.""" def process_view(self, request, view_func, v...
BB-4189: Create listener for all entities in website search - used correct mapping provider - removed website restriction - fixed functional test
<?php namespace Oro\Bundle\SearchBundle\EventListener; use Doctrine\Common\Util\ClassUtils; use Doctrine\ORM\UnitOfWork; use Oro\Bundle\SearchBundle\Provider\AbstractSearchMappingProvider; /** * This trait contains common code that repeats in * the listeners used for creating indexes. */ trait IndexationListener...
<?php namespace Oro\Bundle\SearchBundle\EventListener; use Doctrine\Common\Util\ClassUtils; use Doctrine\ORM\UnitOfWork; use Oro\Bundle\SearchBundle\Provider\SearchMappingProvider; /** * This trait contains common code that repeats in * the listeners used for creating indexes. */ trait IndexationListenerTrait { ...
Add camera selection based on desired feed and camera number
#!/usr/bin/env python import rospy import Adafruit_BBIO.GPIO as GPIO from vortex_msgs.msg import CameraFeedSelection PIN_MAP_FEED0 = rospy.get_param('/camera/pin_map_feed0') PIN_MAP_FEED1 = rospy.get_param('/camera/pin_map_feed1') PIN_MAP_FEED2 = rospy.get_param('/camera/pin_map_feed2') PIN_MAP_LIST = [PIN_MAP_FEED0,P...
#!/usr/bin/env python import rospy import Adafruit_BBIO.GPIO as GPIO from vortex_msgs.msg import CameraFeedSelection PIN_MAP_FEED0 = rospy.get_param('/camera/pin_map_feed0') PIN_MAP_FEED1 = rospy.get_param('/camera/pin_map_feed1') PIN_MAP_FEED2 = rospy.get_param('/camera/pin_map_feed2') PIN_MAP_LIST = [PIN_MAP_FEED0,P...
Make start_message_params optional in start_workflow()
from django.db import transaction from yawf.config import DEFAULT_START_MESSAGE, WORKFLOW_TYPE_ATTR from yawf import get_workflow, get_workflow_by_instance from yawf import dispatch from yawf.exceptions import WorkflowNotLoadedError, CreateValidationError @transaction.commit_on_success def create(workflow_type, sende...
from django.db import transaction from yawf.config import DEFAULT_START_MESSAGE, WORKFLOW_TYPE_ATTR from yawf import get_workflow, get_workflow_by_instance from yawf import dispatch from yawf.exceptions import WorkflowNotLoadedError, CreateValidationError @transaction.commit_on_success def create(workflow_type, sende...
Prepend simplejson import with 'module' name
import sublime import sublime_plugin import PrettyJSON.simplejson as json from PrettyJSON.simplejson import OrderedDict import decimal s = sublime.load_settings("Pretty JSON.sublime-settings") class PrettyjsonCommand(sublime_plugin.TextCommand): """ Pretty Print JSON """ def run(self, edit): for ...
import sublime import sublime_plugin import simplejson as json from simplejson import OrderedDict import decimal s = sublime.load_settings("Pretty JSON.sublime-settings") class PrettyjsonCommand(sublime_plugin.TextCommand): """ Pretty Print JSON """ def run(self, edit): for region in self.view.se...
Add unit to the test directories
""" Simple test runner to separate out the functional tests and the unit tests. """ import os import subprocess PLATFORMS = ['bsd', 'linux', 'nt'] # Detect what platform we are on try: platform = os.uname()[0].lower() except AttributeError: platform = os.name.lower() if platform == 'darwin': platform = '...
""" Simple test runner to separate out the functional tests and the unit tests. """ import os import subprocess PLATFORMS = ['bsd', 'linux', 'nt'] # Detect what platform we are on try: platform = os.uname()[0].lower() except AttributeError: platform = os.name.lower() if platform == 'darwin': platform = '...
Add support for incuna_mail 3.0.0
from setuptools import find_packages, setup version = '6.0.0' install_requires = ( 'djangorestframework>=2.4.4,<3', 'incuna_mail>=2.0.0,<=3.0.0', ) extras_require = { 'avatar': [ 'django-imagekit>=3.2', ], 'utils': [ 'raven>=5.1.1', ], } setup( name='django-user-managem...
from setuptools import find_packages, setup version = '6.0.0' install_requires = ( 'djangorestframework>=2.4.4,<3', 'incuna_mail>=2.0.0,<3', ) extras_require = { 'avatar': [ 'django-imagekit>=3.2', ], 'utils': [ 'raven>=5.1.1', ], } setup( name='django-user-management',...
Revert "parando de lançar exceção" This reverts commit 6153703a5c2a3d4dda559c2b8bc285760b4f9bf1.
package br.com.caelum.brutal.infra; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5 { /** * Encodes a string * * @param str * String to encode * @return Encoded String */ public static String crypt(String str) { ...
package br.com.caelum.brutal.infra; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5 { /** * Encodes a string * * @param str * String to encode * @return Encoded String */ public static String crypt(String str) { ...
Fix $var name in hydrator
<?php /* * This file is part of vaibhavpandeyvpz/pimple-config package. * * (c) Vaibhav Pandey <contact@vaibhavpandey.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE.md. */ namespace Pimple\Config; use InvalidArgumentException; use RuntimeExc...
<?php /* * This file is part of vaibhavpandeyvpz/pimple-config package. * * (c) Vaibhav Pandey <contact@vaibhavpandey.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE.md. */ namespace Pimple\Config; use InvalidArgumentException; use RuntimeExc...
Remove .json suffix from run names
import BenchmarkRun from 'models/BenchmarkRun.js'; import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx'; //A non-ui class which cares about upload file, converting them to json and passing them on to the AppState export default class FileUploader { constructor(uploadBenchmarksFunction) { this.u...
import BenchmarkRun from 'models/BenchmarkRun.js'; import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx'; //A non-ui class which cares about upload file, converting them to json and passing them on to the AppState export default class FileUploader { constructor(uploadBenchmarksFunction) { this.u...
FIX toolbar not activating on topbar menu click
import React, { Component } from 'react'; import filtersIcon from '../icons/filtersIcon.svg'; import effectsIcon from '../icons/effectsIcon.svg'; import MenuItemIconAbove from './MenuItemIconAbove'; import Toolbar from './Toolbar'; class MainNavbar extends Component { constructor(props) { super(props); this....
import React, { Component } from 'react'; import filtersIcon from '../icons/filtersIcon.svg'; import effectsIcon from '../icons/effectsIcon.svg'; import MenuItemIconAbove from './MenuItemIconAbove'; import Toolbar from './Toolbar'; class MainNavbar extends Component { constructor(props) { super(props); this....
Fix chatroom url pattern to include '-'
from django.conf.urls import patterns, url from . import views urlpatterns = patterns('', url( regex=r'^step([1234])/$', view=views.edit_initial_config, name='initialconfig' ), url(r'^debug/start-again/$', views.start_again, name="start-again"), ...
from django.conf.urls import patterns, url from . import views urlpatterns = patterns('', url( regex=r'^step([1234])/$', view=views.edit_initial_config, name='initialconfig' ), url(r'^debug/start-again/$', views.start_again, name="start-again"), ...
Refactor TodosController to use Space.messaging.Controller
Space.messaging.Controller.extend('Todos.TodosController', { dependencies: { configuration: 'configuration' }, eventSubscriptions() { return [{ 'Todos.TodoCreated': this._onTodoCreated, 'Todos.TodoReopened': this._onTodoReopened, 'Todos.TodoCompleted': this._onTodoCompleted, 'Tod...
Space.Object.extend('Todos.TodosController', { mixin: [ Space.messaging.EventSubscribing, Space.messaging.CommandSending ], dependencies: { configuration: 'configuration' }, eventSubscriptions() { return [{ 'Todos.TodoCreated': this._onTodoCreated, 'Todos.TodoReopened': this._on...
Add test with usleep() function
<?php namespace Isswp101\Timer\Test; use Isswp101\Timer\Timer; class TimerTest extends \PHPUnit_Framework_TestCase { public function testDefaultTimerFormat() { $timer = new Timer; $this->assertRegExp('/\d{2}:\d{2}:\d{2}\.\d{3}/', $timer->end()); } public function testTimerFormatWitho...
<?php namespace Isswp101\Timer\Test; use Isswp101\Timer\Timer; class TimerTest extends \PHPUnit_Framework_TestCase { public function testDefaultTimerFormat() { $timer = new Timer; $this->assertRegExp('/\d{2}:\d{2}:\d{2}\.\d{3}/', $timer->end()); } public function testTimerFormatWitho...
Clean up some code mess
import { expect, getRenderedComponent, sinon } from '../../spec_helper' import { routeActions } from 'react-router-redux' import { Discover as Component } from '../../../src/containers/discover/Discover' function createPropsForComponent(props = {}) { const defaultProps = { dispatch: sinon.spy(), isLoggedIn:...
import { expect, getRenderedComponent, sinon } from '../../spec_helper' import { routeActions } from 'react-router-redux' // import * as MAPPING_TYPES from '../../../src/constants/mapping_types' import Container, { Discover as Component } from '../../../src/containers/discover/Discover' function createPropsForComponen...
Fix service provider class reference
<?php namespace GeneaLabs\LaravelCasts\Console\Commands; use Illuminate\Console\Command; use Illuminate\Contracts\Console\Kernel; use GeneaLabs\LaravelCasts\Providers\Service; use File; class Publish extends Command { protected $signature = 'casts:publish {--assets} {--config}'; protected $description = 'Publ...
<?php namespace GeneaLabs\LaravelCasts\Console\Commands; use Illuminate\Console\Command; use Illuminate\Contracts\Console\Kernel; use GeneaLabs\LaravelCasts\Providers\LaravelCastsService; use File; class Publish extends Command { protected $signature = 'casts:publish {--assets} {--config}'; protected $descrip...
Remove route resolves from login/logout routes Was previously using wrong route names.
export default function($stateProvider) { this.$get = function() { return { getResolves: function(state){ var resolve = state.resolve || {}, routes = ["signIn", "signOut"]; if(_.indexOf(routes, state.name)>-1){ return; ...
export default function($stateProvider) { this.$get = function() { return { getResolves: function(state){ var resolve = state.resolve || {}, routes = ["login", "logout", "socket"]; if(_.indexOf(routes, state.name)>-1){ return; ...
Set BG to transparent instead of matching page background color
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['exports', 'echarts'], factory); } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(exports, require('...
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['exports', 'echarts'], factory); } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(exports, require('...
Use 'pass', not 'return', for empty Python methods
""" Test that Gabble times out the connection process after a while if the server stops responding at various points. Real Gabbles time out after a minute; the test suite's Gabble times out after a couple of seconds. """ from servicetest import assertEquals from gabbletest import exec_test, XmppAuthenticator import c...
""" Test that Gabble times out the connection process after a while if the server stops responding at various points. Real Gabbles time out after a minute; the test suite's Gabble times out after a couple of seconds. """ from servicetest import assertEquals from gabbletest import exec_test, XmppAuthenticator import c...
Fix an issue that on IE the QRCode cannot be displayed due to this.baseURI is undefined in IE
$(function() { var links = $("#gamelist h1 a").map(function() { var gameName = this.text; var baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf("/")); this.href = baseUrl + "/" + gameName + ".html"; var qrCodeDiv = document.createElement("div"); ...
$(function() { var links = $("#gamelist h1 a").map(function() { var gameName = this.text; var baseUrl = this.baseURI.substring(0, this.baseURI.lastIndexOf("/")); this.href = baseUrl + "/" + gameName + ".html"; var qrCodeDiv = document.createElement("div"); qrCodeDiv....
Test modified according to refactorings
package org.jlib.core.collection; import java.util.HashMap; import java.util.Map; import com.google.common.collect.ForwardingMap; import org.junit.Test; public class CachingMapTest { @Test public void performance() { final Map<String, String> hashMap = new HashMap<>(); hashMap.put("ja", "nei...
package org.jlib.core.collection; import java.util.HashMap; import java.util.Map; import org.junit.Test; public class CachingMapTest { @Test public void performance() { final Map<String, String> hashMap = new HashMap<>(); hashMap.put("ja", "nein"); hashMap.put("gut", "schlecht"); ...
Refactor create action into function
from createCollection import createCollectionFile from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime, json, os.path, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(descripti...
from createCollection import createCollectionFile from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime, json, os.path, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(descripti...
BAP-10985: Update the rules displaying autocomplete result for business unit owner field
<?php namespace Oro\Bundle\OrganizationBundle\Form\Transformer; use Doctrine\Common\Collections\Collection; use Oro\Bundle\OrganizationBundle\Entity\BusinessUnit; use Oro\Bundle\OrganizationBundle\Entity\Manager\BusinessUnitManager; use Symfony\Component\Form\DataTransformerInterface; class BusinessUnitTreeTransform...
<?php namespace Oro\Bundle\OrganizationBundle\Form\Transformer; use Doctrine\Common\Collections\Collection; use Oro\Bundle\OrganizationBundle\Entity\BusinessUnit; use Oro\Bundle\OrganizationBundle\Entity\Manager\BusinessUnitManager; use Symfony\Component\Form\DataTransformerInterface; class BusinessUnitTreeTransform...
Implement dialog injection of buttons
/** * Created by bjanish on 3/6/15. */ RcmAdminService.rcmAdminPageNotFound = { onEditChange: function(page){ var pageData = page.model.getData(); if(page.editMode) { if (pageData.name != pageData.requestedPageData.rcmPageName) { var actions = { ...
/** * Created by bjanish on 3/6/15. */ RcmAdminService.rcmAdminPageNotFound = { onEditChange: function(page){ var pageData = page.model.getData(); if(page.editMode) { if (pageData.name != pageData.requestedPageData.rcmPageName) { var actions = { ...
Fix bug where some files could get lost when uploading multiple files
import BenchmarkRun from 'models/BenchmarkRun.js'; import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx'; //A non-ui class which cares about upload file, converting them to json and passing them on to the AppState export default class FileUploader { constructor(uploadBenchmarksFunction) { this.u...
import BenchmarkRun from 'models/BenchmarkRun.js'; import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx'; //A non-ui class which cares about upload file, converting them to json and passing them on to the AppState export default class FileUploader { constructor(uploadBenchmarksFunction) { this.u...
Introduce new "toAxisMessage()" to create a Axis message from a DOM document. Use this new function instead of "toSOAPMessage()". This resolves a problem in Java 6 which has a built-in xml.SOAPMessage implementation. This implementation is in conflict with the previous used Axis implementation. Previously the MessageFa...
package wssec; import org.apache.xml.security.c14n.Canonicalizer; import org.w3c.dom.Document; import org.apache.axis.Message; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPMessage; import javax.xml.transform.dom.DOMSource; import java.io.ByteArrayInputStream; public class SOAPUtil { /** ...
package wssec; import org.apache.xml.security.c14n.Canonicalizer; import org.w3c.dom.Document; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPMessage; import javax.xml.transform.dom.DOMSource; import java.io.ByteArrayInputStream; public class SOAPUtil { /** * Convert a DOM Document into a ...
Make cluster extend Rectangle so that we get all of its lovely methods. git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@2337 542714f4-19e9-0310-aa3c-eee0fc999fb1
// // $Id: Cluster.java,v 1.6 2003/03/27 15:57:47 mdb Exp $ package com.threerings.whirled.spot.data; import java.awt.Rectangle; import com.samskivert.util.StringUtil; import com.threerings.io.SimpleStreamableObject; import com.threerings.io.Streamable; import com.threerings.presents.dobj.DSet; /** * Contains in...
// // $Id: Cluster.java,v 1.5 2003/03/26 23:42:41 mdb Exp $ package com.threerings.whirled.spot.data; import java.awt.Rectangle; import com.threerings.io.SimpleStreamableObject; import com.threerings.presents.dobj.DSet; /** * Contains information on clusters. */ public class Cluster extends SimpleStreamableObject...
Add comments on use of 'initializer' key.
<?php /** * ZnZend * * @author Zion Ng <zion@intzone.com> * @link [Source] http://github.com/zionsg/ZnZend */ namespace ZnZend; class Module { public function getAutoloaderConfig() { return array( 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( ...
<?php /** * ZnZend * * @author Zion Ng <zion@intzone.com> * @link [Source] http://github.com/zionsg/ZnZend */ namespace ZnZend; class Module { public function getAutoloaderConfig() { return array( 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( ...
Rewrite httputil test module via pytest
"""Tests for ``cherrypy.lib.httputil``.""" import pytest from cherrypy.lib import httputil class TestUtility(object): @pytest.mark.parametrize( 'script_name,path_info,expected_url', [ ('/sn/', '/pi/', '/sn/pi/'), ('/sn/', '/pi', '/sn/pi'), ('/sn/', '/', '/sn/')...
"""Tests for cherrypy/lib/httputil.py.""" import unittest from cherrypy.lib import httputil class UtilityTests(unittest.TestCase): def test_urljoin(self): # Test all slash+atom combinations for SCRIPT_NAME and PATH_INFO self.assertEqual(httputil.urljoin('/sn/', '/pi/'), '/sn/pi/') self.a...
Fix depreciation notices with Symfony >= 4.2
<?php /* * This file is part of the SensioLabsConnectBundle package. * * (c) SensioLabs <contact@sensiolabs.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SensioLabs\Bundle\ConnectBundle\DependencyInjection; use ...
<?php /* * This file is part of the SensioLabsConnectBundle package. * * (c) SensioLabs <contact@sensiolabs.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SensioLabs\Bundle\ConnectBundle\DependencyInjection; use ...
Update text index to include url
var client = require('mongodb').MongoClient var instance = false module.exports = { connect: function(config, callback) { client.connect(config.database.host+config.database.name, function(err, db){ //Make db instance available to the rest of the module instance = db //...
var client = require('mongodb').MongoClient var instance = false module.exports = { connect: function(config, callback) { client.connect(config.database.host+config.database.name, function(err, db){ //Make db instance available to the rest of the module instance = db //...
Add extra tests to query string query model
from positive_test_suite import PositiveTestSuite from negative_test_suite import NegativeTestSuite import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) from query_models import QueryStringMatch hostname_test_regex = 'hostname: /(.*\.)*(sub|bus)+(\..*)*\.abc(\..*)*\.company\.com...
from positive_test_suite import PositiveTestSuite from negative_test_suite import NegativeTestSuite import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) from query_models import QueryStringMatch class TestQueryStringMatchPositiveTestSuite(PositiveTestSuite): def query_tests(...
Increase package version to 0.4 and update meta
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup version = "0.4" setup( name="dj-cmd", version=version, description="`dj cmd` is a Django shortcut command.", license="BSD", author="Filip Wasilewski", author_email="en@ig.ma", url="https://github.com/nigma/dj-cmd...
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup version = "0.3" setup( name="dj-cmd", version=version, description="`dj cmd` is a Django shortcut command.", license="BSD", author="Filip Wasilewski", author_email="en@ig.ma", url="https://github.com/nigma/dj-cm...
Allow `PBar` to accept any kwargs (e.g. those used by `tqdm`)
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module provides utilities to chunk large sequences and display progress bars during processing. """ import math def get_chunks(sequence, size=1): """ Args: sequence (): size ...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module provides utilities to chunk large sequences and display progress bars during processing. """ import math def get_chunks(sequence, size=1): """ Args: sequence (): size ...
Clean up job stats when jobs are removed in build restart
from sqlalchemy.orm import joinedload from datetime import datetime from changes.api.base import APIView from changes.api.build_index import execute_build from changes.config import db from changes.constants import Result, Status from changes.models import Build, Job, ItemStat class BuildRestartAPIView(APIView): ...
from sqlalchemy.orm import joinedload from datetime import datetime from changes.api.base import APIView from changes.api.build_index import execute_build from changes.config import db from changes.constants import Result, Status from changes.models import Build, Job, ItemStat class BuildRestartAPIView(APIView): ...
Update charset of email config
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Emailing { private $ci; private $config; public function __construct() { $this->ci =& get_instance(); // initialize email configuration $this->config = array( 'protocol' => 'smtp', ...
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Emailing { private $ci; private $config; public function __construct() { $this->ci =& get_instance(); // initialize email configuration $this->config = array( 'protocol' => 'smtp', ...
Add location path to console
myApp.controller('InventoryController', function($scope, $window, $location, $routeParams, inventoryService) { $scope.inventories = inventoryService.loadInventories(); $scope.inventory = inventoryService.getInventory($routeParams.id); $scope.headerIcon = $scope.inventory ? "arrow_back" : ""; console.log...
myApp.controller('InventoryController', function($scope, $window, $location, $routeParams, inventoryService) { $scope.inventories = inventoryService.loadInventories(); $scope.inventory = inventoryService.getInventory($routeParams.id); $scope.headerIcon = $scope.inventory ? "arrow_back" : ""; $scope.goB...
Rewrite test with utility methods
var expect = require('expect.js') var utils = require('./utils') describe("User registration", () => { var user = { username: "KtorZ", password: "password" } beforeEach(done => { utils.mongo(db => { return db.collection('users') .deleteOne({ username: user.username }) ...
var expect = require('expect.js') var mongo = require('mongodb') var http = require('http') describe("User registration", function () { var user = { username: "KtorZ", password: "password" } beforeEach(function (done) { mongo.MongoClient .connect("mongodb://localhost:27017/hexode") ...
Add display for running states
import os import time from TextFileReader import * def main(): # get the base directory base_directory = os.getcwd() # counter for percentage print stage_counter = 0 total_stage = len(os.listdir(base_directory + "/Annotation")) start_time = time.time() for filename in os.listdir(base_dir...
import os from TextFileReader import * def main(): # get the base directory base_directory = os.getcwd() # counter for percentage print stage_counter = 0 total_stage = len(os.listdir(base_directory + "/Annotation")) for filename in os.listdir(base_directory + "/Annotation"): # print t...
Include url attribute in created Collection
define(['streamhub-sdk/collection'], function (Collection) { 'use strict'; var HotCollectionToCollection = function () {}; /** * Transform an Object from StreamHub's Hot Collection endpoint into a * streamhub-sdk/collection model * @param hotCollection {object} */ HotCollectionTo...
define(['streamhub-sdk/collection'], function (Collection) { 'use strict'; var HotCollectionToCollection = function () {}; /** * Transform an Object from StreamHub's Hot Collection endpoint into a * streamhub-sdk/collection model * @param hotCollection {object} */ HotCollectionTo...
Fix DropPrivileges component to be compatible with python3
from pwd import getpwnam from grp import getgrnam from traceback import format_exc from os import getuid, setgroups, setgid, setuid, umask from circuits.core import handler, BaseComponent class DropPrivileges(BaseComponent): def init(self, user="nobody", group="nobody", **kwargs): self.user = user ...
from pwd import getpwnam from grp import getgrnam from traceback import format_exc from os import getuid, setgroups, setgid, setuid, umask from circuits.core import handler, BaseComponent class DropPrivileges(BaseComponent): def init(self, user="nobody", group="nobody", **kwargs): self.user = user ...
Update StringBuilder formatting to use "by" for dateTime and double quotes for description
package seedu.address.testutil; import seedu.emeraldo.model.tag.UniqueTagList; import seedu.emeraldo.model.task.*; /** * A mutable person object. For testing only. */ public class TestPerson implements ReadOnlyTask { private Description name; private DateTime dateTime; private Phone phone; private ...
package seedu.address.testutil; import seedu.emeraldo.model.tag.UniqueTagList; import seedu.emeraldo.model.task.*; /** * A mutable person object. For testing only. */ public class TestPerson implements ReadOnlyTask { private Description name; private DateTime dateTime; private Phone phone; private ...
Return False early if mailgun API key isn't set locally
# -*- coding: utf-8 -*- import hmac import hashlib from rest_framework import permissions from rest_framework import exceptions from framework import sentry from website import settings class RequestComesFromMailgun(permissions.BasePermission): """Verify that request comes from Mailgun. Adapted here from co...
# -*- coding: utf-8 -*- import hmac import hashlib from rest_framework import permissions from rest_framework import exceptions from framework import sentry from website import settings class RequestComesFromMailgun(permissions.BasePermission): """Verify that request comes from Mailgun. Adapted here from co...
DatabaseBackend: Make it possible to override the models used to store task/taskset state
from celery.backends.base import BaseDictBackend from djcelery.models import TaskMeta, TaskSetMeta class DatabaseBackend(BaseDictBackend): """The database backends. Using Django models to store task metadata.""" TaskModel = TaskMeta TaskSetModel = TaskSetMeta def _store_result(self, task_id, result,...
from celery.backends.base import BaseDictBackend from djcelery.models import TaskMeta, TaskSetMeta class DatabaseBackend(BaseDictBackend): """The database backends. Using Django models to store task metadata.""" def _store_result(self, task_id, result, status, traceback=None): """Store return value ...
Make the template and static folders be inside bitHopper
import logging, json import bitHopper.Tracking import bitHopper.util import bitHopper.Network import flask app = flask.Flask(__name__, template_folder='bitHopper/templates', static_folder = 'bitHopper/static') app.Debug = False @app.teardown_request def teardown_request_wrap(exception): """ Prin...
import logging, json import bitHopper.Tracking import bitHopper.util import bitHopper.Network import flask app = flask.Flask(__name__, template_folder='./templates', static_folder = './static') app.Debug = False @app.teardown_request def teardown_request_wrap(exception): """ Prints tracebacks an...
Fix prototype template loading error
import yaml import os.path from django.http import Http404 from django.conf.urls import url from django.conf import settings def get_page(path): url = ('/%s/' % path) if path else '/' with (settings.PROJECT_DIR / 'prototype.yml').open(encoding='utf-8') as f: data = yaml.load(f) try: page ...
import yaml import os.path from django.http import Http404 from django.conf.urls import url from django.conf import settings def get_page(path): url = ('/%s/' % path) if path else '/' with (settings.PROJECT_DIR / 'prototype.yml').open() as f: data = yaml.load(f) try: page = data['urls'][u...
Fix double error message when "tour" is missing
'use strict'; angular.module('alienUiApp').factory('restTechnicalErrorInterceptor', ['$rootScope', '$q', '$window', 'toaster', '$translate', function($rootScope, $q, $window, toaster, $translate) { var extractErrorMessage = function(rejection) { if (UTILS.isDefinedAndNotNull(rejection.data)) { if ...
'use strict'; angular.module('alienUiApp').factory('restTechnicalErrorInterceptor', ['$rootScope', '$q', '$window', 'toaster', '$translate', function($rootScope, $q, $window, toaster, $translate) { var extractErrorMessage = function(rejection) { if (UTILS.isDefinedAndNotNull(rejection.data)) { if ...
Use new GitBook 3 API to get plugin configuration
import { uuid } from './util'; import * as chartFns from './chart'; const FORMAT_YAML = 'yaml'; let chartScriptFn = () => {}; module.exports = { book: { assets: './assets' }, hooks: { init: function () { let pluginConfig = this.config.get('pluginsConfig.chart'); l...
import { uuid } from './util'; import * as chartFns from './chart'; const FORMAT_YAML = 'yaml'; let chartScriptFn = () => {}; module.exports = { book: { assets: './assets' }, hooks: { init: function () { let pluginConfig = (this.options.pluginsConfig || {}).chart || {}; ...