text
stringlengths
17
1.47k
positive
stringlengths
673
4.43k
negative
stringlengths
677
2.81k
Fix councourse script for gpdb
#!/usr/bin/python2 import optparse import subprocess import sys from gporca import GporcaCommon def make(): ciCommon = GporcaCommon() return subprocess.call(["make", "-j" + str(ciCommon.num_cpus())], cwd="gpdb_src") def install(output_dir): subprocess.call(["make", "install"],...
#!/usr/bin/python2 import optparse import subprocess import sys from gporca import GporcaCommon def make(): return subprocess.call(["make", "-j" + str(num_cpus())], cwd="gpdb_src") def install(output_dir): subprocess.call(["make", "install"], cwd="gpdb_src") subprocess.call("m...
Add onMarkClick event to SimpleTextGraph, set pointer cursor
import React from "react"; import CircularProgress from "material-ui/CircularProgress"; import "./style.css"; /* This is a very basic graph that displays a text message */ export default class SimpleTextGraph extends React.Component { render() { const { response, queryConfigur...
import React from "react"; import CircularProgress from "material-ui/CircularProgress"; import "./style.css"; /* This is a very basic graph that displays a text message */ export default class SimpleTextGraph extends React.Component { render() { const { response, queryConfigur...
Fix path cannot be set when creating new library
import os from pathlib import Path from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand from django.db.utils import IntegrityError from photonix.photos.models import Library, LibraryPath, LibraryUser from photonix.photos.utils.db import record_photo from photonix.photos.u...
import os from pathlib import Path from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand from django.db.utils import IntegrityError from photonix.photos.models import Library, LibraryPath, LibraryUser from photonix.photos.utils.db import record_photo from photonix.photos.u...
Improve jQuery object iteration; remove unused deconstructed property
import Component from 'ember-forge-ui/components/ef-list'; import Ember from 'ember'; const { get } = Ember; /** * @module * @augments ember-forge-ui/components/ef-list */ export default Component.extend({ // ------------------------------------------------------------------------- // Dependencies // ---...
import Component from 'ember-forge-ui/components/ef-list'; import Ember from 'ember'; const { computed, get } = Ember; /** * @module * @augments ember-forge-ui/components/ef-list */ export default Component.extend({ // ------------------------------------------------------------------------- // Dependenci...
Resolve includeDir relative to the project context
var Async = require('async'), Fs = require('fs'), Glob = require('glob'), Path = require('path'), RawSource = require('webpack-core/lib/RawSource'); module.exports = function(options) { this.options = options; }; module.exports.prototype.apply = function(compiler) { var options = this.options; c...
var Async = require('async'), Fs = require('fs'), Glob = require('glob'), Path = require('path'), RawSource = require('webpack-core/lib/RawSource'); module.exports = function(options) { this.options = options; }; module.exports.prototype.apply = function(compiler) { var options = this.options; c...
Fix a bug on business model
<?php /* * This file is part of the Antvel Shop package. * * (c) Gustavo Ocanto <gustavoocanto@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Antvel\User\Models; use Antvel\Antvel; use Illuminate\Database\E...
<?php /* * This file is part of the Antvel Shop package. * * (c) Gustavo Ocanto <gustavoocanto@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Antvel\User\Models; use Antvel\Antvel; use Illuminate\Database\E...
Fix closing tag in genericWidget directive
(function() { 'use strict'; angular.module('app.widgets', [ 'app.services', 'rzModule', 'web.colorpicker' ]) .value('WidgetTypes', []) .factory('Widgets', WidgetsService) .directive('genericWidget', GenericWidgetDirective); WidgetsService.$inject = ['WidgetTypes']; ...
(function() { 'use strict'; angular.module('app.widgets', [ 'app.services', 'rzModule', 'web.colorpicker' ]) .value('WidgetTypes', []) .factory('Widgets', WidgetsService) .directive('genericWidget', GenericWidgetDirective); WidgetsService.$inject = ['WidgetTypes']; ...
Fix blocks and use ViewData
<?php namespace Enhavo\Bundle\ShopBundle\Block; use Enhavo\Bundle\AppBundle\View\ViewData; use Enhavo\Bundle\BlockBundle\Model\BlockInterface; use Enhavo\Bundle\ShopBundle\Entity\ProductListBlock; use Enhavo\Bundle\ShopBundle\Factory\ProductListBlockFactory; use Enhavo\Bundle\ShopBundle\Form\Type\ProductListBlockType...
<?php namespace Enhavo\Bundle\ShopBundle\Block; use Enhavo\Bundle\BlockBundle\Model\BlockInterface; use Enhavo\Bundle\ShopBundle\Entity\ProductListBlock; use Enhavo\Bundle\ShopBundle\Factory\ProductListBlockFactory; use Enhavo\Bundle\ShopBundle\Form\Type\ProductListBlockType as ProductListBlockFormType; use Enhavo\Bu...
Add keywords and update package name
#!/usr/bin/env python # -*- coding: utf-8 -*- # # License: MIT # vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: """ django twitter bootstrap form setup script """ __author__ = "Guillaume Luchet <guillaume@geelweb.org>" __version__ = "0.1" import sys from setuptools import setup, find_packages author_data ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # License: MIT # vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: """ django twitter bootstrap form setup script """ __author__ = "Guillaume Luchet <guillaume@geelweb.org>" __version__ = "0.1" import sys from setuptools import setup, find_packages author_data ...
Add a line between outputs.
#! /usr/bin/env python from __future__ import print_function import os import sys import json def pretty_print(equation): print(equation["description"]["terse"]) eqn_dict = equation["unicode-pretty-print"] equation_text = eqn_dict["multiline"] for line in equation_text: print(line) if "para...
#! /usr/bin/env python from __future__ import print_function import os import sys import json def pretty_print(equation): print(equation["description"]["terse"]) eqn_dict = equation["unicode-pretty-print"] equation_text = eqn_dict["multiline"] for line in equation_text: print(line) if "para...
Add correct margin to x-axis
(function(d3, fc, sc) { 'use strict'; sc.chart.xAxis = function() { var xAxisHeight = 23; var yAxisWidth = 60; var xScale = fc.scale.dateTime(); var xAxis = d3.svg.axis() .scale(xScale) .orient('bottom'); var dataJoin = fc.util.dataJoin() ...
(function(d3, fc, sc) { 'use strict'; sc.chart.xAxis = function() { var xAxisHeight = 23; var xScale = fc.scale.dateTime(); var xAxis = d3.svg.axis() .scale(xScale) .orient('bottom'); var dataJoin = fc.util.dataJoin() .selector('g.x-axis') ...
Add error message if there is one
<?php namespace fennecweb\ajax\upload; use \PDO as PDO; /** * Web Service. * Uploads Project biom files and save them in the database */ class Project extends \fennecweb\WebService { /** * @param $querydata[] * @returns result of file upload */ public function execute($querydata) { ...
<?php namespace fennecweb\ajax\upload; use \PDO as PDO; /** * Web Service. * Uploads Project biom files and save them in the database */ class Project extends \fennecweb\WebService { /** * @param $querydata[] * @returns result of file upload */ public function execute($querydata) { ...
Remove unneeded console logs, improve messaging to player.
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { r...
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { r...
Fix for the failing notfns on Oracle
package edu.duke.cabig.c3pr.dao; import java.util.List; import org.springframework.transaction.annotation.Transactional; import edu.duke.cabig.c3pr.domain.PlannedNotification; import edu.duke.cabig.c3pr.domain.RecipientScheduledNotification; /** * Hibernate implementation of ArmDao * * @see edu.duke.cabig.c3pr....
package edu.duke.cabig.c3pr.dao; import java.util.List; import org.springframework.transaction.annotation.Transactional; import edu.duke.cabig.c3pr.domain.PlannedNotification; import edu.duke.cabig.c3pr.domain.RecipientScheduledNotification; /** * Hibernate implementation of ArmDao * * @see edu.duke.cabig.c3pr....
Remove some more ST2 specific code
from __future__ import absolute_import import sublime import traceback from markdown import Markdown, util from markdown.extensions import Extension import importlib class StMarkdown(Markdown): def __init__(self, *args, **kwargs): Markdown.__init__(self, *args, **kwargs) self.Meta = {} def r...
from __future__ import absolute_import import sublime import traceback ST3 = int(sublime.version()) >= 3000 if ST3: from markdown import Markdown, util from markdown.extensions import Extension import importlib else: from markdown import Markdown, util from markdown.extensions import Extension c...
Update to use token instead of email+pass
import discord import asyncio from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Discord channel scraper') requiredNamed = parser.add_argument_group('Required arguments:') requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',...
import discord import asyncio from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Discord channel scraper') requiredNamed = parser.add_argument_group('Required arguments:') requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',...
Disable weave tests that cause compilation failure, since this causes distutils to do a SystemExit, which break the test suite. git-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@5402 d6536bca-fef9-0310-8506-e4c0a848fbcf
from numpy import * from numpy.testing import * from scipy.weave import inline_tools class TestInline(TestCase): """ These are long running tests... I'd like to benchmark these things somehow. """ @dec.slow def test_exceptions(self): a = 3 code = """ if (a < 2)...
from numpy import * from numpy.testing import * from scipy.weave import inline_tools class TestInline(TestCase): """ These are long running tests... I'd like to benchmark these things somehow. """ @dec.slow def test_exceptions(self): a = 3 code = """ if (a < 2)...
Remove a debugging flush() after every trace
# Copyright (C) 2010 Peter Teichman import datetime import math import os import time def singleton(cls): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return getinstance @singleton class Instatrace: def __init__(se...
# Copyright (C) 2010 Peter Teichman import datetime import math import os import time def singleton(cls): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return getinstance @singleton class Instatrace: def __init__(se...
Add "file_exists" check for the CI.
<?php declare(strict_types=1); namespace App\Sync\Task; use App\Doctrine\ReloadableEntityManagerInterface; use App\Entity\Repository\SettingsRepository; use App\Radio\Adapters; use App\Radio\CertificateLocator; use Psr\Log\LoggerInterface; class ReloadFrontendAfterSslChangeTask extends AbstractTask { public fun...
<?php declare(strict_types=1); namespace App\Sync\Task; use App\Doctrine\ReloadableEntityManagerInterface; use App\Entity\Repository\SettingsRepository; use App\Radio\Adapters; use App\Radio\CertificateLocator; use Psr\Log\LoggerInterface; class ReloadFrontendAfterSslChangeTask extends AbstractTask { public fun...
Make agents able to see each other.
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import agent import structure class PerceptionHandler(object): """ Abstract perception handler class. """ @abc.abstractmethod def perceive(self, agent, world): """ Generates a p...
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import structure class PerceptionHandler(object): """ Abstract perception handler class. """ @abc.abstractmethod def perceive(self, agent, world): """ Generates a percept given ...
Change is checked when either condition or watch changes
var Gaffa = require('gaffa'); function change(behaviour){ var gaffa = behaviour.gaffa; if(!behaviour.condition.value){ return; } var throttleTime = behaviour.throttle; if(!isNaN(throttleTime)){ var now = new Date(); if(!behaviour...
var Gaffa = require('gaffa'); function executeBehaviour(behaviour, value){ behaviour.gaffa.actions.trigger(behaviour.actions.change, behaviour); } function ModelChangeBehaviour(){} ModelChangeBehaviour = Gaffa.createSpec(ModelChangeBehaviour, Gaffa.Behaviour); ModelChangeBehaviour.prototype._type = 'mod...
Sort to get determinist ordering
var request = require('supertest'); var assert = require('assert'); var storageFactory = require('../lib/storage/storage-factory'); var storage = storageFactory.getStorageInstance('test'); var app = require('../webserver/app')(storage); describe('ping plugins route', function () { var server; var PORT = 3355; ...
var request = require('supertest'); var assert = require('assert'); var storageFactory = require('../lib/storage/storage-factory'); var storage = storageFactory.getStorageInstance('test'); var app = require('../webserver/app')(storage); describe('ping plugins route', function () { var server; var PORT = 3355; ...
Fix login permissions for ticketing
from django.conf.urls.defaults import patterns, url from django.contrib.auth.decorators import login_required from oscar.core.application import Application from ticketing import views class TicketingApplication(Application): name = 'ticketing' ticket_list_view = views.TicketListView ticket_create_view...
from django.conf.urls.defaults import patterns, url from oscar.core.application import Application from ticketing import views class TicketingApplication(Application): name = 'ticketing' ticket_list_view = views.TicketListView ticket_create_view = views.TicketCreateView ticket_update_view = views.T...
Set a maximum to the number of elements that may be requested
from collections import OrderedDict from django.utils.translation import ugettext_lazy as _ from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response class LegacyPaginator(PageNumberPagination): """ A legacy paginator that mocks the one from Eve Python """ ...
from collections import OrderedDict from django.utils.translation import ugettext_lazy as _ from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response class LegacyPaginator(PageNumberPagination): """ A legacy paginator that mocks the one from Eve Python """ ...
Configure mission form type option
<?php namespace ModuleGenerator\PhpGenerator\Constant; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\NotBlank; final ...
<?php namespace ModuleGenerator\PhpGenerator\Constant; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\NotBlank; final ...
Refactor to better define data helper
const request = require('request'); /** * Function checks that a string given is string with some number of * characters * * @params {string} str string value to check for validity * @return true if the string is valid; otherwise, return false */ function isValidString(str) { if ((str === undefined) || (typeo...
const request = require('request'); /** * Function checks that a string given is string with some number of * characters * * @params {string} str string value to check for validity * @return true if the string is valid; otherwise, return false */ function isValidString(str) { if ((str === undefined) || (typeo...
Add protection against multiple Fancybox init.
$(document).ready(function () { $.fancybox.defaults.locales = $.extend({}, $.fancybox.defaults.locales, { ru: { CLOSE: Translator.trans('fancybox.close'), NEXT: Translator.trans('fancybox.next'), PREV: Translator.trans('fancybox.prev'), ERROR:...
$(document).ready(function () { $.fancybox.defaults.locales = $.extend({}, $.fancybox.defaults.locales, { ru: { CLOSE: Translator.trans('fancybox.close'), NEXT: Translator.trans('fancybox.next'), PREV: Translator.trans('fancybox.prev'), ERROR:...
Make cite definition more robust
"use strict"; // Provides several classes frequently used in Arethusa angular.module('arethusa.util').service('commons', [ function ArethusaClasses() { // Used to define plugin settings function Setting(label, model, change) { this.label = label; this.model = model; this.change = change; ...
"use strict"; // Provides several classes frequently used in Arethusa angular.module('arethusa.util').service('commons', [ function ArethusaClasses() { // Used to define plugin settings function Setting(label, model, change) { this.label = label; this.model = model; this.change = change; ...
Make the skip apply to any system missing crypt
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, print_function, unicode_literals import logging import re # Import Salt Libs import salt.utils.pycrypto import salt.utils.platform # Import Salt Testing Libs from tests.support.unit import TestCase, skipIf log = logging.getLogger(_...
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, print_function, unicode_literals import logging import re # Import Salt Libs import salt.utils.pycrypto import salt.utils.platform # Import Salt Testing Libs from tests.support.unit import TestCase, skipIf log = logging.getLogger(_...
Check OutputConfiguration for avoiding NPE
package com.cookpad.puree.outputs; import com.cookpad.puree.PureeFilter; import com.cookpad.puree.storage.PureeStorage; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public abstract class PureeOutput { protected OutputConfiguration conf; protec...
package com.cookpad.puree.outputs; import com.cookpad.puree.PureeFilter; import com.cookpad.puree.storage.PureeStorage; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public abstract class PureeOutput { protected OutputConfiguration conf; protec...
Fix QuickFind: stop relying on keys being integers
class UnionFind: def __init__(self, it=None): self.uf = {} if it is None else {i : i for i in it} self.count = len(self.uf) def __iter__(self): return iter(self.uf.keys()) def __getitem__(self, key): return self.uf[key] def __setitem__(self, key, val): if key ...
class UnionFind: def __init__(self, it=None): self.uf = {} if it is None else {i : i for i in it} self.count = len(self.uf) def __iter__(self): return iter(self.uf.keys()) def __getitem__(self, key): return self.uf[key] def __setitem__(self, key, val): if key ...
Add code to silence requests logger in the handler
import logging import socket import traceback from threading import Thread import requests class SplunkHandler(logging.Handler): """ A logging handler to send events to a Splunk Enterprise instance """ def __init__(self, host, port, username, password, index): logging.Handler.__init__(self...
import logging import socket import traceback from threading import Thread import requests class SplunkHandler(logging.Handler): """ A logging handler to send events to a Splunk Enterprise instance """ def __init__(self, host, port, username, password, index): logging.Handler.__init__(self...
Add explicit render layer binding instead of assuming all render passes can be used for compositing
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Application import Application from UM.Resources import Resources from UM.Math.Matrix import Matrix from UM.View.RenderPass import RenderPass from UM.View.GL.OpenGL import OpenGL class CompositePass(RenderPass): ...
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Application import Application from UM.Resources import Resources from UM.Math.Matrix import Matrix from UM.View.RenderPass import RenderPass from UM.View.GL.OpenGL import OpenGL class CompositePass(RenderPass): ...
Fix tooltips not hiding after clicking button
isic.views.LayoutHeaderView = isic.View.extend({ events: { 'click .isic-link-home': function () { isic.router.navigate('index', {trigger: true}); }, 'click .isic-link-dataset-upload': function () { isic.router.navigate('uploadDataset', {trigger: true}); }, ...
isic.views.LayoutHeaderView = isic.View.extend({ events: { 'click .isic-link-home': function () { isic.router.navigate('index', {trigger: true}); }, 'click .isic-link-dataset-upload': function () { isic.router.navigate('uploadDataset', {trigger: true}); }, ...
Revert year range end back to 2015 (2016 is not over)
#!/usr/bin/env python import sys import os import collections import data import figs class Counter(collections.Counter): year_range = range(2004, 2015) def restrict_to_year_range(self, multiplier=1): output = [] for year in self.year_range: output.append(multiplier * self[year]) ...
#!/usr/bin/env python import sys import os import collections import data import figs class Counter(collections.Counter): year_range = range(2004, 2016) def restrict_to_year_range(self, multiplier=1): output = [] for year in self.year_range: output.append(multiplier * self[year]) ...
Use null as the defaultValue for Image URLs (denoting an image placeholder)
// Register ContentNode types (including meta information). ContentNode.types = { "document": { name: "Document", allowedChildren: ["section"], properties: [ { "key": "title", "name": "Title", "defaultValue": "A document title" } ] }, "section": { name: "Se...
// Register ContentNode types (including meta information). ContentNode.types = { "document": { name: "Document", allowedChildren: ["section"], properties: [ { "key": "title", "name": "Title", "defaultValue": "A document title" } ] }, "section": { name: "Se...
Set "contentType" on AJAX call.
$(document).ready(function() { var editor = ace.edit("json"); editor.setTheme("ace/theme/github"); editor.session.setMode("ace/mode/json"); editor.setFontSize(14); editor.$blockScrolling = "Infinity"; $("#submit_json").click(function() { try { $.ajax({ ...
$(document).ready(function() { var editor = ace.edit("json"); editor.setTheme("ace/theme/github"); editor.session.setMode("ace/mode/json"); editor.setFontSize(14); editor.$blockScrolling = "Infinity"; $("#submit_json").click(function() { try { var json = $.parseJSON(e...
Fix generating icon name for files without extension
import Ember from 'ember'; export default Ember.Component.extend({ classNames: ['popover-confirm'], iconClass: function () { var filename = this.get('filename'), regex, match, extension; if (filename) { regex = /\.([0-9a-z]+)$/i; match = filename.match(/\.(...
import Ember from 'ember'; export default Ember.Component.extend({ classNames: ['popover-confirm'], iconClass: function () { var filename = this.get('filename'), regex, extension; if (filename) { regex = /\.([0-9a-z]+)$/i; extension = filename.match(/\.([0-...
Allow Property Models to be undefined
const Config = use('config'); const Errors = use('core/errors'); const DefaultProperty = require('./default'); const PrimaryKeyPattern = new RegExp('^'+Config.router.primaryKeyPattern + '$'); class ModelProperty extends DefaultProperty { constructor(modelNa...
const Config = use('config'); const Errors = use('core/errors'); const DefaultProperty = require('./default'); const PrimaryKeyPattern = new RegExp('^'+Config.router.primaryKeyPattern + '$'); class ModelProperty extends DefaultProperty { constructor(modelNa...
Fix a bad function name
"use strict"; var createParser = require("postcss-selector-parser"), keyframes = /keyframes$/i; exports.keyframes = keyframes; // TODO: this is probably inefficient, but oh well for now exports.parse = function parse(selector) { var values = []; createParser(function(selectors) { // Wal...
"use strict"; var createParser = require("postcss-selector-parser"), keyframes = /keyframes$/i; exports.keyframes = keyframes; // TODO: this is probably inefficient, but oh well for now exports.parse = function identifiers(selector) { var values = []; createParser(function(selectors) { ...
[BUG] Fix for scroll janky on virtual scroll after apply change
import { requestAnimFrame } from '../../utils/utils'; import { StyleTranslator } from './StyleTranslator'; import { TranslateXY } from '../../utils/translate'; export function ScrollerDirective($timeout){ return { restrict: 'E', require:'^dtBody', transclude: true, replace: true, template: `<div ...
import { requestAnimFrame } from '../../utils/utils'; import { StyleTranslator } from './StyleTranslator'; import { TranslateXY } from '../../utils/translate'; export function ScrollerDirective($timeout){ return { restrict: 'E', require:'^dtBody', transclude: true, replace: true, template: `<div ...
Improve the url parsing - we need only the path to be able to decide
package hellowicket; import org.apache.wicket.core.request.handler.PageProvider; import org.apache.wicket.core.request.handler.RenderPageRequestHandler; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.request.Request; import org.apache.wicket....
package hellowicket; import org.apache.wicket.core.request.handler.PageProvider; import org.apache.wicket.core.request.handler.RenderPageRequestHandler; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.request.Request; import org.apache.wicket....
Add option to print astor reconstructed source of template
import ast from .context import ContextScope from .parser import Parser from .utils import Helpers def kompile(src, raw=False, filename='<compiler>', **kwargs): ''' Creates a new class based on the supplied template, and returnsit. class Template(object): def __call__(self, context): ...
import ast from .context import ContextScope from .parser import Parser from .utils import Helpers def kompile(src, raw=False, filename='<compiler>'): ''' Creates a new class based on the supplied template, and returnsit. class Template(object): def __call__(self, context): return ''...
Add expectation on Error output
var request = require('supertest'); var JSONAPIValidator = require('jsonapi-validator').Validator; validateJSONapi = function(res) { var validator = new JSONAPIValidator(); validator.validate(res.body); } describe('Error handling', function() { describe('GET /fake', function() { it('Should return 404', fun...
var request = require('supertest'); var JSONAPIValidator = require('jsonapi-validator').Validator; validateJSONapi = function(res) { var validator = new JSONAPIValidator(); validator.validate(res.body); } describe('Error handling', function() { describe('GET /fake', function() { it('Should return 404', fun...
Change remaining console.log calls to angular's logger.
'use strict'; angular.module('seaWebApp') .controller('JobCtrl', function($scope, $log, $http, $location, $routeParams) { $scope.jobId = $routeParams.jobId; $scope.jobDone = false; $scope.refreshJob = function() { $http({method: 'GET', url: 'http://localhost:8001/jobs/' + $scop...
'use strict'; angular.module('seaWebApp') .controller('JobCtrl', function($scope, $http, $location, $routeParams) { $scope.jobId = $routeParams.jobId; $scope.jobDone = false; $scope.refreshJob = function() { $http({method: 'GET', url: 'http://localhost:8001/jobs/' + $scope.jobI...
Allow to get key for serializer. Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
<?php namespace Orchestra\Support; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Support\Collection as BaseCollection; abstract class Serializer { /** * Data serializer key name. * * @var string */ protected $key = 'data'; /** * Invoke the serializer. * ...
<?php namespace Orchestra\Support; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Support\Collection as BaseCollection; abstract class Serializer { /** * Data serializer key name. * * @var string */ protected $key = 'data'; /** * Invoke the serializer. * ...
Fix users count for unit test
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from users import Us...
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from users import Us...
Add name fields to generated templates
"""Generator functions for thesaurus files""" import json from web.MetaInfo import MetaInfo def generate_language_template(language_id, structure_id, version=None): """Generate a template for the given language and structure""" meta_info = MetaInfo() if structure_id not in meta_info.data_structures: ...
import json from web.MetaInfo import MetaInfo def generate_language_template(language_id, structure_id, version=None): meta_info = MetaInfo() if structure_id not in meta_info.data_structures: raise ValueError language_name = meta_info.languages.get( language_id, {'name': 'Human-Rea...
Return promise when loading sidebar
class Sidebar { constructor() { const self = this; const doc = $(document); doc.on('click', 'a[href][data-open-sidebar]', function (e) { e.preventDefault(); var sidebar = $('#' + $(this).data('open-sidebar')), href = $(this).attr('href'); ...
class Sidebar { constructor() { const self = this; const doc = $(document); doc.on('click', 'a[href][data-open-sidebar]', function (e) { e.preventDefault(); var sidebar = $('#' + $(this).data('open-sidebar')), href = $(this).attr('href'); ...
Read commandline args as isbns
#!/usr/bin/env python import yaml import sys import os from amazon.api import AmazonAPI # Change to script directory os.chdir(os.path.dirname(sys.argv[0])) class Books: def __init__(self, config_file): self.config = yaml.load(open(config_file, 'r')) self.amazon = AmazonAPI( self.config['aws_access_ke...
#!/usr/bin/env python import yaml from amazon.api import AmazonAPI class Books: def __init__(self, config_file): self.config = yaml.load(open(config_file, 'r')) self.amazon = AmazonAPI( self.config['aws_access_key_id'], self.config['aws_secret_key'], self.config['amazon_associate_tag'] ...
Use query builder to delete versions
<?php declare(strict_types=1); /* * This file is part of SolidInvoice project. * * (c) Pierre du Plessis <open-source@solidworx.co> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace SolidInvoice\CoreBundle\Repository; use Doctrine\Bun...
<?php declare(strict_types=1); /* * This file is part of SolidInvoice project. * * (c) Pierre du Plessis <open-source@solidworx.co> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace SolidInvoice\CoreBundle\Repository; use Doctrine\Bun...
Fix % overflow on 32 bit systems See http://php.net/manual/en/function.fmod.php Partially fixes #1
<?php /** * This file is part of the Random.php package. * * Copyright (C) 2013 Shota Nozaki <emonkak@gmail.com> * * Licensed under the MIT License */ namespace Random\Engine; class LinearCongruentialEngine extends AbstractEngine { const DEFAULT_SEED = 1; /** * @var integer */ private $a;...
<?php /** * This file is part of the Random.php package. * * Copyright (C) 2013 Shota Nozaki <emonkak@gmail.com> * * Licensed under the MIT License */ namespace Random\Engine; class LinearCongruentialEngine extends AbstractEngine { const DEFAULT_SEED = 1; /** * @var integer */ private $a;...
Add Twig Extensions on boot
<?php namespace Pipe\Silex; use Silex\Application; use Silex\ServiceProviderInterface; use Symfony\Component\HttpFoundation\Response; class PipeServiceProvider implements ServiceProviderInterface { function register(Application $app) { $app->register(new \Silex\Provider\UrlGeneratorServiceProvider()...
<?php namespace Pipe\Silex; use Silex\Application; use Silex\ServiceProviderInterface; use Symfony\Component\HttpFoundation\Response; class PipeServiceProvider implements ServiceProviderInterface { function register(Application $app) { $app->register(new \Silex\Provider\UrlGeneratorServiceProvider()...
Add unit tests for update with a parameter.
/** * Copyright (C) 2011 Akiban Technologies Inc. * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * ...
/** * Copyright (C) 2011 Akiban Technologies Inc. * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * ...
Revert "Remove dependency that was fixed upstream" This reverts commit 9ee219d85849629eac53a28e72fa374a6c805ea4.
#!/usr/bin/env python import os import re from setuptools import setup, find_packages def get_ini_variable(name): with open(os.path.join(os.path.dirname(__file__), 'src', 'ros_get', '__init__.py')) as f: return re.compile(r".*%s = '(.*?)'" % name, re.S).match(f.read()).group(1) with open(os.path.join(os...
#!/usr/bin/env python import os import re from setuptools import setup, find_packages def get_ini_variable(name): with open(os.path.join(os.path.dirname(__file__), 'src', 'ros_get', '__init__.py')) as f: return re.compile(r".*%s = '(.*?)'" % name, re.S).match(f.read()).group(1) with open(os.path.join(os...
Save in the same place inside 'state', 'selected' & 'dragging' element
export const updateElementInWorkspace = (workspace, payload) => { const { selectionState } = workspace if(!selectionState.dragStarted) { return workspace } const { currentMousePosition } = payload const { element } = selectionState const originalElement = workspace.entities[element.id] return Objec...
export const updateElementInWorkspace = (workspace, payload) => { const { selectionState } = workspace if(!selectionState.dragStarted) { return workspace } const { currentMousePosition } = payload const { elementId, startElementPosition, startMousePosition } = selectionState const elemen...
Work on classical_risk test_case_1 and test_case_2
import unittest from nose.plugins.attrib import attr from openquake.qa_tests_data.classical_risk import ( case_1, case_2, case_3, case_4) from openquake.calculators.tests import CalculatorTestCase class ClassicalRiskTestCase(CalculatorTestCase): @attr('qa', 'risk', 'classical_risk') def test_case_1(self...
import unittest from nose.plugins.attrib import attr from openquake.qa_tests_data.classical_risk import ( case_1, case_2, case_3, case_4) from openquake.calculators.tests import CalculatorTestCase class ClassicalRiskTestCase(CalculatorTestCase): @attr('qa', 'risk', 'classical_risk') def test_case_1(self...
Improve by using breadth search instead of depth search
<?php class AlgorithmConnectedComponents extends Algorithm{ /** * * @var Graph */ private $graph; /** * * @param Graph $graph */ public function __construct(Graph $graph){ $this->graph = $graph; } /** * check whether this graph consist...
<?php class AlgorithmConnectedComponents extends Algorithm{ /** * * @var Graph */ private $graph; /** * * @param Graph $graph */ public function __construct(Graph $graph){ $this->graph = $graph; } /** * check whether this graph consist...
Complete refactoring, including addition of kind to all core objects
/* * See LICENSE file in distribution for copyright and licensing information. */ package ioke.lang; import java.util.IdentityHashMap; /** * * @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a> */ public class Context extends IokeObject { IokeObject ground; public IokeObject message; public Io...
/* * See LICENSE file in distribution for copyright and licensing information. */ package ioke.lang; import java.util.IdentityHashMap; /** * * @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a> */ public class Context extends IokeObject { IokeObject ground; public IokeObject message; public Io...
Add timezone settings to the test project.
import os local_path = lambda path: os.path.join(os.path.dirname(__file__), path) APP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) DEBUG = True SECRET_KEY = 'not-so-secret-for-tests' INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contr...
import os local_path = lambda path: os.path.join(os.path.dirname(__file__), path) APP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) DEBUG = True SECRET_KEY = 'not-so-secret-for-tests' INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contr...
Fix logging of errors, Karma expects a string. Reset errors after every cycle.
(function() { var global = this; var karma = global.__karma__; karma.start = function(runner) { var suites = global.__karma_benchmark_suites__; var hasTests = !!suites.length; var errors = []; if (!hasTests) { return complete(); } runNextSuite(); function logResult(event) { ...
(function() { var global = this; var karma = global.__karma__; karma.start = function(runner) { var suites = global.__karma_benchmark_suites__; var hasTests = !!suites.length; var errors = []; if (!hasTests) { return complete(); } runNextSuite(); function logResult(event) { ...
Correct bug to initialize mogodbUri
var mongo = require('mongodb'); var mongoUri = process.env.MONGOLAB_URI ||process.env.MONGOHQ_URL ||'mongodb://localhost/mydb'; if (process.env.VCAP_SERVICES) { var env = JSON.parse(process.env.VCAP_SERVICES); console.log('Env: ', env); mongoUri = env['mongodb-1.8'][0].credentials.url; } console.log('mongoUri...
var mongo = require('mongodb'); var mongoUri = process.env.MONGOLAB_URI ||process.env.MONGOHQ_URL ||'mongodb://localhost/mydb'; if (process.env.VCAP_SERVICES) { var env = JSON.parse(process.env.VCAP_SERVICES); console.log('Env: ', env); mongoUri = env['mongo-1.8'][0].credentials.url; } console.log('mongoUri: ...
Change name from MatrixData to DenseData
import numpy as np from sympy import IndexedBase class DenseData(IndexedBase): def __init__(self, name, shape, dtype): self.name = name self.shape = shape self.dtype = dtype self.pointer = None self.initializer = None def set_initializer(self, lambda_initializer): ...
import numpy as np from sympy import IndexedBase class MatrixData(IndexedBase): def __init__(self, name, shape, dtype): self.name = name self.shape = shape self.dtype = dtype self.pointer = None self.initializer = None def set_initializer(self, lambda_initializer): ...
Add ability to delete spending on spendings' index view
@extends('layout') @section('title', __('general.spendings')) @section('body') <div class="wrapper my-3"> <h2>{{ __('general.spendings') }}</h2> <div class="box mt-3"> @if (count($spendings)) @foreach ($spendings as $spending) <div class="box__sectio...
@extends('layout') @section('title', __('general.spendings')) @section('body') <div class="wrapper my-3"> <h2>{{ __('general.spendings') }}</h2> <div class="box mt-3"> @if (count($spendings)) @foreach ($spendings as $spending) <div class="box__sectio...
Update some function syntax and add options to the downloadBox call
var utils = require("./lib/utils"); var tmp = require("tmp"); var path = require("path"); var Config = require("truffle-config"); var Box = { unbox: function(url, destination, options) { options = options || {}; options.logger = options.logger || { log: () => {} }; const downloadBoxOptions = { fo...
var utils = require("./lib/utils"); var tmp = require("tmp"); var path = require("path"); var Config = require("truffle-config"); var Box = { unbox: function(url, destination, options) { options = options || {}; options.logger = options.logger || {log: function() {}} return Promise.resolve() .the...
Call _set in next loop
import EventEmitter from 'events'; export default class Observer extends EventEmitter { constructor() { super(); this._name = null; this._model = null; this._value = null; this._format = (v) => v; this._handleSet = (e) => this._set(e); } destroy() { this._unbindModel(); } name...
import EventEmitter from 'events'; export default class Observer extends EventEmitter { constructor() { super(); this._name = null; this._model = null; this._value = null; this._format = (v) => v; this._handleSet = (e) => this._set(e); } destroy() { this._unbindModel(); } name...
Add reducer cases for thread/board destroyed
import initialState from './initialState'; import { LOGO_SPIN_STARTED, LOGO_SPIN_ENDED, PAGE_SCROLL_STARTED, PAGE_SCROLL_ENDED, APP_INIT, STATUS_UPDATE, PROVIDER_CHANGE, BOARD_CHANGE, SCROLL_HEADER, THREAD_REQUESTED, THREAD_DESTROYED, BOARD_REQUESTED, BOARD_DES...
import initialState from './initialState'; import { LOGO_SPIN_STARTED, LOGO_SPIN_ENDED, PAGE_SCROLL_STARTED, PAGE_SCROLL_ENDED, APP_INIT, STATUS_UPDATE, PROVIDER_CHANGE, BOARD_CHANGE, SCROLL_HEADER, THREAD_REQUESTED, BOARD_REQUESTED, } from '../constants'; export defau...
Stop fetching items for each killmail since they are not necessary.
module.exports = (function() { var m = require('mithril') function zeroPad(num) { return num < 10 ? `0${num}` : num; } var zKillboard = {} zKillboard.fetchKillmails = function(solarSystems, from, to, page) { var solarSystemID = solarSystems.map(solarSystem => solarSystem.id).join(','); var star...
module.exports = (function() { var m = require('mithril') function zeroPad(num) { return num < 10 ? `0${num}` : num; } var zKillboard = {} zKillboard.fetchKillmails = function(solarSystems, from, to, page) { var solarSystemID = solarSystems.map(solarSystem => solarSystem.id).join(','); var star...
Change a title of the option
module.exports = function() { return this .title('Benchmarks') .helpful() .arg() .name('treeish-list') .title('List of revisions to compare (git treeish)') .arr() .end() .opt() .name('ben...
module.exports = function() { return this .title('Benchmarks') .helpful() .arg() .name('treeish-list') .title('List of revisions to compare (git treeish)') .arr() .end() .opt() .name('ben...
Add flag indicating method comes from chain execution
'use strict' export default class LodashWrapper { constructor (_) { this.steps = [] let step = 1 const record = (name, isChained, args, result) => { if (name === 'chain' || typeof (name) === 'undefined') { return } this.steps.push({ step: step++, funcName: name...
'use strict' export default class LodashWrapper { constructor (_) { this.steps = [] let step = 1 const record = (name, args, result) => { if (name === 'chain' || typeof (name) === 'undefined') { return } this.steps.push({ step: step++, funcName: name, a...
Fix typo at RSS bit
'use strict'; var moment = require('moment'); var _ = require('lodash'); var config = require('../config'); var paths = require('../elements/PathsMixin'); module.exports = function() { return t('feed', {xmlns: 'http://www.w3.org/2005/Atom'}, [ t('title', {}, config.title), t('link', {href: 'config.baseUrl'...
'use strict'; var moment = require('moment'); var _ = require('lodash'); var config = require('../config'); var paths = require('../elements/PathsMixin'); module.exports = function(page) { return t('feed', {xmlns: 'http://www.w3.org/2005/Atom'}, [ t('title', {}, config.title), t('link', {href: "#{config.ba...
Make trigger name in .py match .yaml
from flask import request, Flask from st2reactor.sensor.base import Sensor class EchoFlaskSensor(Sensor): def __init__(self, sensor_service, config): super(EchoFlaskSensor, self).__init__( sensor_service=sensor_service, config=config ) self._host = '127.0.0.1' ...
from flask import request, Flask from st2reactor.sensor.base import Sensor class EchoFlaskSensor(Sensor): def __init__(self, sensor_service, config): super(EchoFlaskSensor, self).__init__( sensor_service=sensor_service, config=config ) self._host = '127.0.0.1' ...
Fix not using right debugging method
/* eslint-disable no-console */ const debug = (...args) => console.log('[Service Worker]', ...args); const isCacheableRequest = request => request.method === 'GET' && !new URL(request.url).search.match(/[?&]nocache[&$]/); self.addEventListener('install', () => debug('Installed')); self.addEventListener('act...
/* eslint-disable no-console */ const debug = (...args) => console.log('[Service Worker]', ...args); const isCacheableRequest = request => request.method === 'GET' && !new URL(request.url).search.match(/[?&]nocache[&$]/); self.addEventListener('install', () => debug('Installed')); self.addEventListener('act...
Convert temperatures to degrees Celsius.
/* global angular, console */ (function () { 'use strict'; angular .module('plotWidget') .controller('PlotWidgetController', PlotWidgetController); PlotWidgetController.$inject = ['$scope', 'weatherRestService']; function PlotWidgetController($scope, weatherRestService) { var...
/* global angular, console */ (function () { 'use strict'; angular .module('plotWidget') .controller('PlotWidgetController', PlotWidgetController); PlotWidgetController.$inject = ['$scope', 'weatherRestService']; function PlotWidgetController($scope, weatherRestService) { var...
Read More module: removed MainController check We don’t actually care if the controller is Main or not, since Admin also has a feed attribute that we can test.
<?php class ReadMore extends Modules { public function __init() { # Replace comment codes before markup modules filters them. $this->setPriority("markup_post_text", 4); } public function markup_post_text($text, $post = null) { if (!is_string($text) or !pr...
<?php class ReadMore extends Modules { public function __init() { # Replace comment codes before markup modules filters them. $this->setPriority("markup_post_text", 4); } public function markup_post_text($text, $post = null) { if (!is_string($text) or !pr...
Remove ambiguity of desc ordering
// Author: tngan const request = require('superagent'); const path = require('path'); const url = require('url'); const DOMAIN = 'https://api.stackexchange.com'; const API_VERSION = '2.2'; function query(category) { // Internal functions const append = key => value => { this.queryParams = Object....
// Author: tngan const request = require('superagent'); const path = require('path'); const url = require('url'); const DOMAIN = 'https://api.stackexchange.com'; const API_VERSION = '2.2'; function query(category) { // Internal functions const append = key => value => { this.queryParams = Object....
Fix Pagerfanta adapter result caching
<?php namespace Brouzie\Sphinxy\Pagerfanta\Adapter; use Brouzie\Sphinxy\Query\ResultSet; use Brouzie\Sphinxy\QueryBuilder; use Pagerfanta\Adapter\AdapterInterface; /** * Sphinxy Pagerfanta Adapter * * @author Konstantin.Myakshin <koc-dp@yandex.ru> */ class SphinxyQbAdapter implements AdapterInterface { /** ...
<?php namespace Brouzie\Sphinxy\Pagerfanta\Adapter; use Brouzie\Sphinxy\Query\ResultSet; use Brouzie\Sphinxy\QueryBuilder; use Pagerfanta\Adapter\AdapterInterface; /** * Sphinxy Pagerfanta Adapter * * @author Konstantin.Myakshin <koc-dp@yandex.ru> */ class SphinxyQbAdapter implements AdapterInterface { /** ...
Remove a debugging print that should never have been left there anyway.
from django.conf import settings import importlib # Merge two lots of mesobox-compatible context additions def merge_context_additions(additions): context = {} boxes = {} for c in additions: try: context.update(c.get("context")) except TypeError: pass try: ...
from django.conf import settings import importlib # Merge two lots of mesobox-compatible context additions def merge_context_additions(additions): context = {} boxes = {} for c in additions: try: context.update(c.get("context")) except TypeError: pass try: ...
Refactor build and print method
from ListNode import * class Solution(): def addTwoNumbers(self, l1, l2): head_node = current_node = ListNode(None) carry = 0 p = l1 q = l2 while p or q or carry: x = y = 0 if p is not None: x = p.val p = p.next ...
from ListNode import * class Solution(): def addTwoNumbers(self, l1, l2): current_node = ListNode(None) head_node = current_node carry = 0 p = l1 q = l2 while p or q or carry: x = y = 0 if p is not None: x = p.val ...
Fix what seems to be a mistake in fromColorResAndDrawable Based off the name of the function, it seems that `fromColorResAndDrawable` should take in a `Drawable` object, not a `String` imageUrl.
package com.github.florent37.materialviewpager.header; import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; /** * Created by florentchampigny on 10/06/15. */ public class HeaderDesign { protected int color; protected int colorRes;...
package com.github.florent37.materialviewpager.header; import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; /** * Created by florentchampigny on 10/06/15. */ public class HeaderDesign { protected int color; protected int colorRes;...
tests: Test IAM Policy with no "services" See also: PSOBAT-1482
"""Test IAM Policies for correctness.""" import json from foremast.iam.construct_policy import construct_policy ANSWER1 = { 'Version': '2012-10-17', 'Statement': [ { 'Effect': 'Allow', 'Action': [ 's3:GetObject', 's3:ListObject' ], ...
"""Test IAM Policies for correctness.""" import json from foremast.iam.construct_policy import construct_policy ANSWER1 = { 'Version': '2012-10-17', 'Statement': [ { 'Effect': 'Allow', 'Action': [ 's3:GetObject', 's3:ListObject' ], ...
Add constant for the poll timeout value and fix quotes https://bugzilla.redhat.com/show_bug.cgi?id=1393982
/* global miqSparkleOn miqSparkleOff showErrorMessage clearMessages */ var GitImport = { TASK_POLL_TIMEOUT: 1500, retrieveDatastoreClickHandler: function() { $('.git-retrieve-datastore').click(function(event) { event.preventDefault(); miqSparkleOn(); clearMessages(); $.post('retrieve_...
/* global miqSparkleOn miqSparkleOff showErrorMessage clearMessages */ var GitImport = { retrieveDatastoreClickHandler: function() { $('.git-retrieve-datastore').click(function(event) { event.preventDefault(); miqSparkleOn(); clearMessages(); $.post('retrieve_git_datastore', $('#retrieve...
Fix dev status trove classifier.
import os import relman import setuptools BASEPATH = os.path.abspath(os.path.dirname(__file__)) def load_requirements(filename): """load requirements from a pip requirements file.""" lineiter = (line.strip() for line in open(os.path.join(BASEPATH, filename))) return [line for line in li...
import os import relman import setuptools BASEPATH = os.path.abspath(os.path.dirname(__file__)) def load_requirements(filename): """load requirements from a pip requirements file.""" lineiter = (line.strip() for line in open(os.path.join(BASEPATH, filename))) return [line for line in li...
Add a test for CmdRunner.
from nose.tools import * from libeeyore.cpp.cppcompiler import CppCompiler from libeeyore.cpp.cmdrunner import CmdRunner class FakeProcess( object ): def __init__( self, sys_op, retcode ): self.sys_op = sys_op self.returncode = retcode def communicate( self, inp = None ): if inp is ...
from nose.tools import * from libeeyore.cpp.cppcompiler import CppCompiler class FakeProcess( object ): def __init__( self, sys_op, retcode ): self.sys_op = sys_op self.returncode = retcode def communicate( self, inp = None ): if inp is None: istr = "" else: ...
Set max connection pool limit
var path = require('path'), config; config = { production: { url: process.env.BASE_URL || 'http://blog.ertrzyiks.pl/', mail: {}, database: { client: 'postgres', connection: process.env.DATABASE_URL, pool: { min: 0, max: 2 } }, serve...
var path = require('path'), config; config = { production: { url: process.env.BASE_URL || 'http://blog.ertrzyiks.pl/', mail: {}, database: { client: 'postgres', connection: process.env.DATABASE_URL }, server: { host: '0.0.0.0', ...
Terminate viz process at end of experiment.
'''Main file for running experiments. ''' import logging from cortex._lib import (config, data, exp, optimizer, setup_cortex, setup_experiment, train) from cortex._lib.utils import print_section import torch __author__ = 'R Devon Hjelm' __author_email__ = 'erroneus@gmail.com' logger = l...
'''Main file for running experiments. ''' import logging from cortex._lib import (config, data, exp, optimizer, setup_cortex, setup_experiment, train) from cortex._lib.utils import print_section import torch __author__ = 'R Devon Hjelm' __author_email__ = 'erroneus@gmail.com' logger = l...
Change name of date to datetime
RESOURCE_METHODS = ['GET', 'POST', 'DELETE'] ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE'] schema = { 'name': { 'type': 'string', 'minlength': 3, 'maxlength': 50, 'required': True, }, 'datetime': { 'type': 'datetime', }, 'reference': { 'type': 'str...
RESOURCE_METHODS = ['GET', 'POST', 'DELETE'] ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE'] schema = { 'name': { 'type': 'string', 'minlength': 3, 'maxlength': 50, 'required': True, }, 'date': { 'type': 'datetime', }, 'reference': { 'type': 'string'...
Add a new function to get value by key in a file content
<?php namespace Botonomous; use Botonomous\utility\FileUtility; /** * Class Dictionary. */ class Dictionary { const DICTIONARY_DIR = 'dictionary'; const DICTIONARY_FILE_SUFFIX = 'json'; private $data; /** * @param $key * * @throws \Exception * * @return array|mixed *...
<?php namespace Botonomous; use Botonomous\utility\FileUtility; /** * Class Dictionary. */ class Dictionary { const DICTIONARY_DIR = 'dictionary'; const DICTIONARY_FILE_SUFFIX = 'json'; private $data; /** * @param $key * * @throws \Exception * * @return array|mixed *...
Fix the focus jump in post.
import React, { Component, PropTypes } from 'react'; import ReactDisqusComments from 'react-disqus-comments'; import Page from '../Page'; import styles from './index.scss'; const setOverflow = (overflow) => { const html = document.querySelector('html'); const body = document.body; html.style.overflow = overfl...
import React, { Component, PropTypes } from 'react'; import ReactDisqusComments from 'react-disqus-comments'; import Page from '../Page'; import styles from './index.scss'; const setOverflow = (overflow) => { const html = document.querySelector('html'); const body = document.body; html.style.overflow = overfl...
Fix bugs -- token is added into response json only when authentication succeeded and invalid username and password always show up even though username and password are correct
<?php /** * This file is Copyright (c). * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Component\Authentication; use Doctrine\ORM\EntityManager; use Component\Entity\User; use Component\Response\JsonResponse; class Aut...
<?php /** * This file is Copyright (c). * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Component\Authentication; use Doctrine\ORM\EntityManager; use Component\Entity\User; use Component\Response\JsonResponse; class Aut...
Switch the main post detail view to a CBV
from datetime import datetime from django.http import Http404 from django.shortcuts import get_object_or_404 from django.views.generic import ( ArchiveIndexView, YearArchiveView, MonthArchiveView, DetailView, ) from tinyblog.models import Post class TinyBlogPostView(DetailView): template_name = 't...
from datetime import datetime from django.http import Http404 from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.views.generic import ( ArchiveIndexView, YearArchiveView, MonthArchiveView, ) from tinyblog.models import Post def post(re...
Set cookie if image uploaded
<?php require_once '../repository/ImageRepository.php'; /** * Siehe Dokumentation im DefaultController. */ class ImageController { public function index() { $imageRepository = new ImageRepository(); $view = new View('image_index'); $view->title = 'Upload'; $view->heading = 'Upl...
<?php require_once '../repository/ImageRepository.php'; /** * Siehe Dokumentation im DefaultController. */ class ImageController { public function index() { $imageRepository = new ImageRepository(); $view = new View('image_index'); $view->title = 'Upload'; $view->heading = 'Upl...
Fix ability to build prod static files
var path = require('path'); var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { devtool: 'source-map', entry: { app: './lib/index.js' }, output: { filename: '[name].min.js', path...
var path = require('path'); var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { devtool: 'source-map', entry: { app: './lib/index.js' }, output: { filename: '[name].min.js', path...
Enable SLURM allocation synchronization action.
// @ngInject export default function actionConfig(ActionConfigurationProvider, DEFAULT_EDIT_ACTION) { ActionConfigurationProvider.register('SLURM.Allocation', { order: [ 'details', 'pull', 'edit', 'cancel', 'destroy' ], options: { pull: { title: gettext('Synchro...
// @ngInject export default function actionConfig(ActionConfigurationProvider, DEFAULT_EDIT_ACTION) { ActionConfigurationProvider.register('SLURM.Allocation', { order: [ 'details', 'edit', 'cancel', 'destroy' ], options: { details: { title: gettext('Details'), ...
Replace log4j reference with Logback.
package com.yammer.dropwizard.json; import ch.qos.logback.classic.Level; import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.*; import org.codehaus.jackson.map.annotate.JsonCachable; import org.codehaus.jackson.type.JavaType; import java.io.IOException; class ...
package com.yammer.dropwizard.json; import ch.qos.logback.classic.Level; import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.*; import org.codehaus.jackson.map.annotate.JsonCachable; import org.codehaus.jackson.type.JavaType; import java.io.IOException; class ...
Add .min name to minified .js
'use strict'; var gulp = require('gulp'), nib = require('nib'), $ = require('gulp-load-plugins')({ lazy: false }); var paths = require('./paths.js'); module.exports = { copyAssets: function () { return function () { var assets = gulp.src(paths.src.assets) .pipe(gulp.dest(paths.dest.root)...
'use strict'; // TODO: // - Rename to .min for minified js - get paths right for components. var gulp = require('gulp'), nib = require('nib'), $ = require('gulp-load-plugins')({ lazy: false }); var paths = require('./paths.js'); module.exports = { copyAssets: function () { return function () { ...
Fix up grammar errors in the comments
(function(Backbone) { var superDelegateEvents = Backbone.View.prototype.delegateEvents; _.extend(Backbone.View.prototype, { // Hook up `listen` processing in `delegateEvents`. delegateEvents: function(events) { superDelegateEvents.call(this, events); this._setupListening(); }, // Tak...
(function(Backbone) { var superDelegateEvents = Backbone.View.prototype.delegateEvents; _.extend(Backbone.View.prototype, { // Hook up `listen` processing in `delegateEvents`. delegateEvents: function(events) { superDelegateEvents.call(this, events); this._setupListening(); }, // Tak...
Change name of the default task
/** * @author Frank David Corona Prendes <frankdavid.corona@gmail.com> * @copyright MIT 2016 Frank David Corona Prendes * @description Tarea Gulp para la compresion de ficheros JS * @version 1.0.1 */ (function () { 'use strict'; var gulp = require('gulp'); var uglify = require('gulp-uglify'); var ...
/** * @author Frank David Corona Prendes <frankdavid.corona@gmail.com> * @copyright MIT 2016 Frank David Corona Prendes * @description Tarea Gulp para la compresion de ficheros JS * @version 1.0.1 */ (function () { 'use strict'; var gulp = require('gulp'); var uglify = require('gulp-uglify'); var ...
Test against string version of ID.
'use strict'; const assert = require('assert'); const mongoose = require('mongoose'); mongoose.Promise = global.Promise; const dataSchema = new mongoose.Schema({ 'contents': String }); dataSchema.plugin(require('../../index')); const dataModel = mongoose.model('data', dataSchema); describe('createOrUpdate', ...
'use strict'; const assert = require('assert'); const mongoose = require('mongoose'); mongoose.Promise = global.Promise; const dataSchema = new mongoose.Schema({ 'contents': String }); dataSchema.plugin(require('../../index')); const dataModel = mongoose.model('data', dataSchema); describe('createOrUpdate', ...
Handle case where deconstruct receives string
""" Select widget for MonthField. Copied and modified from https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#base-widget-classes """ from datetime import date from django.forms import widgets class MonthSelectorWidget(widgets.MultiWidget): def __init__(self, attrs=None): # create choices for days, m...
""" Select widget for MonthField. Copied and modified from https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#base-widget-classes """ from datetime import date from django.forms import widgets class MonthSelectorWidget(widgets.MultiWidget): def __init__(self, attrs=None): # create choices for days, m...