hash
stringlengths
40
40
diff
stringlengths
131
26.7k
message
stringlengths
7
694
project
stringlengths
5
67
split
stringclasses
1 value
diff_languages
stringlengths
2
24
fea1cdcff4d50d302d8e8532432c3ab107ff816d
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb index <HASH>..<HASH> 100644 --- a/activemodel/lib/active_model/conversion.rb +++ b/activemodel/lib/active_model/conversion.rb @@ -84,7 +84,7 @@ module ActiveModel def _to_partial_path #:nodoc: @_to_partial_path ||= begin element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)) - collection = ActiveSupport::Inflector.tableize(self) + collection = ActiveSupport::Inflector.tableize(name) "#{collection}/#{element}".freeze end end
pass the class name to `tableize` We should not rely on to_s to return the name of the class
rails_rails
train
rb
e7460db016e8b1fa83b75e4a57403a681137a2ed
diff --git a/molgenis-data-migrate/src/main/java/org/molgenis/migrate/version/v1_19/Step28MigrateSorta.java b/molgenis-data-migrate/src/main/java/org/molgenis/migrate/version/v1_19/Step28MigrateSorta.java index <HASH>..<HASH> 100644 --- a/molgenis-data-migrate/src/main/java/org/molgenis/migrate/version/v1_19/Step28MigrateSorta.java +++ b/molgenis-data-migrate/src/main/java/org/molgenis/migrate/version/v1_19/Step28MigrateSorta.java @@ -45,6 +45,7 @@ public class Step28MigrateSorta extends MolgenisUpgrade updateDataType("Ontology_OntologyTermNodePath", "nodePath", "text"); updateDataType("Ontology_OntologyTermSynonym", "ontologyTermSynonym", "text"); removeRepository("MatchingTaskContent"); + removeRepository("MatchingTask"); LOG.info("Done."); }
Also remove the MatchingTask repository.
molgenis_molgenis
train
java
5ab2ff96e9ee9794c4b750723511de91f8ed8e37
diff --git a/tests/test_tracer.py b/tests/test_tracer.py index <HASH>..<HASH> 100644 --- a/tests/test_tracer.py +++ b/tests/test_tracer.py @@ -32,7 +32,7 @@ def test_recursion(): simgr.run() - print simgr.stashes, c.last_state, t._predecessors[0] + print simgr.stashes, c.last_state, t.predecessors[0] @attr(speed='slow') def test_cache_stall(): @@ -98,7 +98,7 @@ def test_manual_recursion(): simgr.use_technique(angr.exploration_techniques.Oppologist()) simgr.run() - print simgr.stashes, c.last_state, t._predecessors[0] + print simgr.stashes, c.last_state, t.predecessors[0] def test_cgc_se1_palindrome_raw(): b = os.path.join(bin_location, "tests/cgc/sc1_0b32aa01_01")
Fix CrashMonitor attribute visibility
angr_angr
train
py
13ccbc017d5fde8da3819daa3d713462b5be4f13
diff --git a/tempy/t.py b/tempy/t.py index <HASH>..<HASH> 100644 --- a/tempy/t.py +++ b/tempy/t.py @@ -60,6 +60,8 @@ class TempyParser(HTMLParser): def handle_data(self, data): if self.current_tag and data.strip(): self.current_tag(data) + else: + self.result.append(data) def handle_comment(self, data): pass
BUGFIX: parser now saves also content
Hrabal_TemPy
train
py
e54571f16d136f2c0aec9c8fdb0dd8111762f0de
diff --git a/lib/tanker.rb b/lib/tanker.rb index <HASH>..<HASH> 100644 --- a/lib/tanker.rb +++ b/lib/tanker.rb @@ -165,8 +165,10 @@ module Tanker self.tanker_config.indexes << [key, value] end - self.tanker_config.variables do - instance_exec &config.variables.first + unless config.variables.empty? + self.tanker_config.variables do + instance_exec &config.variables.first + end end else raise(NoBlockGiven, 'Please provide a block')
Tweak code so variables 'inheritance' isn't run if not defined in 'sub-class'.
kidpollo_tanker
train
rb
d9c0befe2422eb77c476a2c4b53a99c42ac13844
diff --git a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java +++ b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java @@ -264,21 +264,21 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel @Override public int hashCode() { - return getName().hashCode(); + return System.identityHashCode(this); } @Override public boolean equals(Object o) { - if (!(o instanceof ChannelGroup)) { - return false; - } - - ChannelGroup that = (ChannelGroup) o; - return getName().equals(that.getName()); + return this == o; } public int compareTo(ChannelGroup o) { - return getName().compareTo(o.getName()); + int v = getName().compareTo(o.getName()); + if (v != 0) { + return v; + } + + return System.identityHashCode(this) - System.identityHashCode(o); } @Override
Fixed equality comparison methods of DefaultChannelGroup
netty_netty
train
java
daf676f5b97799ecc43e791495f365f3b5f94f7e
diff --git a/lib/opal/simple_server.rb b/lib/opal/simple_server.rb index <HASH>..<HASH> 100644 --- a/lib/opal/simple_server.rb +++ b/lib/opal/simple_server.rb @@ -15,6 +15,8 @@ class Opal::SimpleServer require 'set' require 'erb' + NotFound = Class.new(StandardError) + def initialize(options = {}) @prefix = options.fetch(:prefix, 'assets') @main = options.fetch(:main, 'application') @@ -42,6 +44,8 @@ class Opal::SimpleServer call_asset(path) else call_index end + rescue NotFound => error + [404, {}, [error.to_s]] end def call_asset(path)
Return not-found when nothing matches in simple server
opal_opal
train
rb
42e9d6224a3e6806dc6eda0c69a5ef466547b470
diff --git a/arcgis_integration/RichDEM_ArcScript.py b/arcgis_integration/RichDEM_ArcScript.py index <HASH>..<HASH> 100644 --- a/arcgis_integration/RichDEM_ArcScript.py +++ b/arcgis_integration/RichDEM_ArcScript.py @@ -1,15 +1,11 @@ -# Script Name: Remove Pits +# Script Name: RichDEM_ArcScript # -# Created By: David Tarboton -# Date: 9/21/11 +# Created By: Richard Barnes +# Date: 5/10/2012 -# Import ArcPy site-package and os modules -# import arcpy import os import sys -import time -import string import subprocess PROGPATH="richdem"
Removed header comments carried over from TauDEM files I used as an example Eliminated unnecessary imports git-svn-id: file:///home/rick/.svn/richdem@<I> c4c8cafc-<I>d-<I>f-9f<I>-3f4f8cd<I>a<I>
r-barnes_richdem
train
py
731720d7be693bed2ba4747324d099b2a682e24e
diff --git a/security/BasicAuth.php b/security/BasicAuth.php index <HASH>..<HASH> 100755 --- a/security/BasicAuth.php +++ b/security/BasicAuth.php @@ -28,6 +28,7 @@ class BasicAuth extends Object { */ static function requireLogin($realm, $permissionCode) { if(!Security::database_is_ready() || Director::is_cli()) return true; + $authenticated = false; if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { $member = MemberAuthenticator::authenticate(array( @@ -35,13 +36,11 @@ class BasicAuth extends Object { 'Password' => $_SERVER['PHP_AUTH_PW'], ), null); - if($member) { - $authenticated = true; - } + if($member || Member::currentUser()) $authenticated = true; } // If we've failed the authentication mechanism, then show the login form - if(!isset($authenticated)) { + if(!$authenticated) { header("WWW-Authenticate: Basic realm=\"$realm\""); header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized');
BUGFIX #<I> BasicAuth should check if there's already a current member logged in before asking for a login/password (from r<I>) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@<I> <I>b<I>ca-7a2a-<I>-9d3b-<I>d<I>a<I>a9
silverstripe_silverstripe-framework
train
php
6a99c5aace5e56698d0402566840c8df06c8444a
diff --git a/spyplugins/ui/profiler/profiler.py b/spyplugins/ui/profiler/profiler.py index <HASH>..<HASH> 100644 --- a/spyplugins/ui/profiler/profiler.py +++ b/spyplugins/ui/profiler/profiler.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- # -# Copyright © 2011 Santiago Jaramillo +# Copyright © 2009- The Spyder Development Team # based on p_pylint.py by Pierre Raybaut # # Licensed under the terms of the MIT License @@ -98,9 +98,9 @@ class Profiler(ProfilerWidget, SpyderPluginMixin): self.edit_goto.connect(self.main.editor.load) self.redirect_stdio.connect(self.main.redirect_internalshell_stdio) self.main.add_dockwidget(self) - + profiler_act = create_action(self, _("Profile"), - icon=ima.icon('profiler'), + icon=self.get_plugin_icon(), triggered=self.run_profiler) profiler_act.setEnabled(is_profiler_installed()) self.register_shortcut(profiler_act, context="Profiler",
Profiler: Fix icon for its Run menu entry in the Spyder 2 theme
spyder-ide_spyder
train
py
fe430ff006174c4567b2132a34706a5635c91e2f
diff --git a/lib/vagrant/systems/linux.rb b/lib/vagrant/systems/linux.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant/systems/linux.rb +++ b/lib/vagrant/systems/linux.rb @@ -52,6 +52,17 @@ module Vagrant ssh.exec!("sudo chown #{config.ssh.username} #{guestpath}") end + def mount_nfs(ip, folders) + # TODO: Maybe check for nfs support on the guest, since its often + # not installed by default + folders.each do |name, opts| + vm.ssh.execute do |ssh| + ssh.exec!("sudo mkdir -p #{opts[:guestpath]}") + ssh.exec!("sudo mount #{ip}:#{opts[:hostpath]} #{opts[:guestpath]}") + end + end + end + def prepare_unison(ssh) ssh.exec!("which unison", :error_key => :unison_not_found)
Mount NFS folders on the linux system
hashicorp_vagrant
train
rb
62c751ff7fb4228c073eed464fce5cf9a60e2b48
diff --git a/reader_test.go b/reader_test.go index <HASH>..<HASH> 100644 --- a/reader_test.go +++ b/reader_test.go @@ -1,11 +1,11 @@ package torrent import ( - "context" "testing" "time" "github.com/stretchr/testify/require" + "golang.org/x/net/context" "github.com/anacrolix/torrent/internal/testutil" )
Also fix "context" in reader_test.go
anacrolix_torrent
train
go
f437035362e87a529426d237e9f6483c8829d171
diff --git a/prospector/autodetect.py b/prospector/autodetect.py index <HASH>..<HASH> 100644 --- a/prospector/autodetect.py +++ b/prospector/autodetect.py @@ -56,7 +56,7 @@ def find_from_requirements(path): def autodetect_libraries(path): try: - adaptor_names = find_requirements(path) + adaptor_names = find_from_requirements(path) except RequirementsNotFound: adaptor_names = find_from_path(path)
Fixing detection of requirements through normal means
PyCQA_prospector
train
py
f9778a14b5f2a936be7e1dc0fc7305910b3bbf08
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ tests_requirements = install_requirements + [ ] setup(name='everest', - version='1.0b1', + version='1.0b2', description='everest', long_description=README, classifiers=[
Bumping up the everest version to <I>b2
helixyte_everest
train
py
c14c5c906e9b2a0f722dee201eb41f2684315909
diff --git a/lib/utils.js b/lib/utils.js index <HASH>..<HASH> 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -225,36 +225,6 @@ exports.cleanOrientAttributes = function cleanOrientAttributes(model, schema) { /** - * Takes an edge or array of edges and returns the ID(s) of of the vertices pointed to - * - * @param {Object} side - * @param {Object} side - * @api public - */ -exports.getForeignKeys = function getForeignKeys(edge, side) { - if(!_.isArray(edge)){ - var foreignKey = edge[side]['@rid'] || edge[side]; - return [ foreignKey ]; - } - - var cleanEdge = _.filter(edge, function(ed){ - return ed && _.isObject(ed); // Edges are usually strings (IDs) or objects - }); - - var vertices = _.pluck(cleanEdge, side); - if(!_.isObject(vertices[0])) - return vertices; - - // Cleans some rogue edges - vertices = _.filter(vertices, function(vertex){ - return vertex && _.isObject(vertex); - }); - - return _.pluck(vertices, 'id'); -}; - - -/** * Reduce nested objects: goes through every object of collection, including nested and root, * and runs callback *
Removes utils.getForeignKeys() as it's not being used
appscot_sails-orientdb
train
js
a00ab0ba9d3d61e8a270458aa27206e4c2435eb9
diff --git a/orpsoc/simulator/__init__.py b/orpsoc/simulator/__init__.py index <HASH>..<HASH> 100644 --- a/orpsoc/simulator/__init__.py +++ b/orpsoc/simulator/__init__.py @@ -1,9 +1,12 @@ from orpsoc.simulator.icarus import SimulatorIcarus from orpsoc.simulator.modelsim import Modelsim +from orpsoc.simulator.verilator import Verilator def SimulatorFactory(sim,system): if sim == 'icarus': return SimulatorIcarus(system) elif sim == 'modelsim': return Modelsim(system) + elif sim == 'verilator': + return Verilator(system) else: raise Exception
simulator: Register verilator in SimulatorFactory
olofk_fusesoc
train
py
c2bce8e3a08be47483d8e32d1348cccdc6edcfcc
diff --git a/client/components/domains/domain-suggestion/test/index.js b/client/components/domains/domain-suggestion/test/index.js index <HASH>..<HASH> 100644 --- a/client/components/domains/domain-suggestion/test/index.js +++ b/client/components/domains/domain-suggestion/test/index.js @@ -24,6 +24,7 @@ describe( 'Domain Suggestion', function() { before( () => { DomainSuggestion = require( 'components/domains/domain-suggestion' ); + DomainSuggestion.prototype.translate = ( x ) => x; } ); describe( 'has attributes', () => { @@ -44,7 +45,7 @@ describe( 'Domain Suggestion', function() { } ); it( 'should show the button label when not in cart', function() { - const buttonLabel = 'Hello'; + const buttonLabel = 'Select'; const domainSuggestion = shallow( <DomainSuggestion isAdded={ false } buttonLabel={ buttonLabel } /> );
Fix the domain-suggestion unit test The AB test was causing this to this introduced in #<I> to randomly fail in CI.
Automattic_wp-calypso
train
js
8286b3589b0d772e7660d8cba0359656a4b5eaea
diff --git a/insights/parsers/tests/test_keystone_log.py b/insights/parsers/tests/test_keystone_log.py index <HASH>..<HASH> 100644 --- a/insights/parsers/tests/test_keystone_log.py +++ b/insights/parsers/tests/test_keystone_log.py @@ -1,6 +1,7 @@ from insights.parsers.keystone_log import KeystoneLog from insights.tests import context_wrap +from datetime import datetime KEYSTONE_LOG = """ 2016-11-09 14:31:48.681 1082 WARNING oslo_config.cfg [-] Option "rabbit_userid" from group "oslo_messaging_rabbit" is deprecated for removal. Its value may be silently ignored in the future. @@ -13,3 +14,4 @@ KEYSTONE_LOG = """ def test_keystone_log(): log = KeystoneLog(context_wrap(KEYSTONE_LOG)) assert len(log.get('INFO')) == 2 + assert len(list(log.get_after(datetime(2016, 11, 9, 14, 31, 0)))) == 4
Keystone_log parser add get_after for master branch (#<I>) * Testing new get_after() method * Correction: get_after yields, not returns * Updated to time_format property
RedHatInsights_insights-core
train
py
02269e8fea3d78b80fc22530b6481747f2167a29
diff --git a/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js b/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js +++ b/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js @@ -20,7 +20,7 @@ sap.ui.define(['jquery.sap.global', './Filter', 'sap/ui/model/Sorter', 'sap/ui/m /** * @alias sap.ui.model.odata.ODataUtils * @namespace - * @private + * @public */ var ODataUtils = function() {};
[INTERNAL] ODataUtils: Make public formatValue is public and meant to be used by the application, so ODataUtils must be marked as public as well to appear in JSDOC BCP: <I> Change-Id: I<I>d<I>c<I>a<I>d<I>baa<I>d5dc5fd<I>
SAP_openui5
train
js
f1d95ae1d5c819f6091488b99880a39da362f55b
diff --git a/ui/src/kapacitor/reducers/rules.js b/ui/src/kapacitor/reducers/rules.js index <HASH>..<HASH> 100644 --- a/ui/src/kapacitor/reducers/rules.js +++ b/ui/src/kapacitor/reducers/rules.js @@ -172,8 +172,10 @@ export default function rules(state = {}, action) { return { ...state, - [ruleID]: {...state[ruleID]}, - alertNodes: newAlertNodes, + [ruleID]: { + ...state[ruleID], + alertNodes: newAlertNodes, + }, } }
Fix alertNode redux schema bug by updating prop on rule correctly
influxdata_influxdb
train
js
4cbbddc970b2a9eba014aca7d569a5a54d0b3ec0
diff --git a/test.py b/test.py index <HASH>..<HASH> 100644 --- a/test.py +++ b/test.py @@ -86,7 +86,7 @@ class Tests(TestCase): self.all_inst = [self.u1, self.u2, self.u3, self.e1, self.e2, self.e3, self.e4] def tearDown(self): - shutil.rmtree(self.app.config['WHOOSHEE_DIR']) + shutil.rmtree(self.app.config['WHOOSHEE_DIR'], ignore_errors=True) Whooshee.whoosheers = [] self.db.drop_all()
Set ignore errors flag to True Tests were failing in Windows 7 <I> bit - see <URL>
bkabrda_flask-whooshee
train
py
8ccb3150c843dbd7cde9d191a1d7144e01cf1352
diff --git a/mrq/dashboard/static/js/views/jobs.js b/mrq/dashboard/static/js/views/jobs.js index <HASH>..<HASH> 100644 --- a/mrq/dashboard/static/js/views/jobs.js +++ b/mrq/dashboard/static/js/views/jobs.js @@ -73,8 +73,8 @@ define(["jquery", "underscore", "views/generic/datatablepage", "models"],functio var self = this; - var job_id = $(evt.target).closest(".js-actions").data("jobid"); - var action = $(evt.target).data("action"); + var job_id = $(evt.currentTarget).closest(".js-actions").data("jobid"); + var action = $(evt.currentTarget).data("action"); if (action == "viewresult") {
fixed buttons logs and results triggering job actions
pricingassistant_mrq
train
js
d2200884f8c8b7e1805a09521e78062d0f0d3efb
diff --git a/web/concrete/single_pages/dashboard/users/add.php b/web/concrete/single_pages/dashboard/users/add.php index <HASH>..<HASH> 100644 --- a/web/concrete/single_pages/dashboard/users/add.php +++ b/web/concrete/single_pages/dashboard/users/add.php @@ -90,10 +90,12 @@ $languages = Localization::getAvailableInterfaceLanguages(); <? foreach($attribs as $ak) { ?> <tr> <td class="clearfix"> - <p> - <?=$ak->getAttributeKeyName()?> <? if ($ak->isAttributeKeyRequiredOnRegister()) { ?><span class="required">*</span><? } ?> - </p> - <? $ak->render('form', $caValue, false)?> + <label> + <p> + <?=$ak->getAttributeKeyName()?> <? if ($ak->isAttributeKeyRequiredOnRegister()) { ?><span class="required">*</span><? } ?> + </p> + <? $ak->render('form', $caValue, false)?> + </label> </td> </tr> <? } // END Foreach ?>
Update Add User tweaks to wrap arrtibutes in 'label' tag Form UX improvement to increase click/hit area on list of attributes. Former-commit-id: <I>c<I>dac5b<I>e<I>ec2f7ff1bbc<I>a
concrete5_concrete5
train
php
538c9988706f4628cd8a71039ef71aa15ce249ff
diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -1,9 +1,5 @@ <?php /** - * SQLite layer for DBO - * - * PHP 5 - * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * @@ -12,13 +8,16 @@ * * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Model.Datasource.Database * @since CakePHP(tm) v 0.9.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database; + use Cake\Error; use Cake\Model\Datasource\DboSource; +use Cake\Model\Model; +use Cake\Model\Schema; +use Cake\Utility\String; use \PDO; /**
Fix strict errors and missing imports in Sqlite.
cakephp_cakephp
train
php
eeae0bb609a6db031b7d9efad01941c3c60f46f0
diff --git a/src/Illuminate/Routing/Middleware/ThrottleRequests.php b/src/Illuminate/Routing/Middleware/ThrottleRequests.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Routing/Middleware/ThrottleRequests.php +++ b/src/Illuminate/Routing/Middleware/ThrottleRequests.php @@ -102,6 +102,7 @@ class ThrottleRequests if (! is_null($retryAfter)) { $headers['Retry-After'] = $retryAfter; + $headers['X-RateLimit-Reset'] = time() + $retryAfter; } $response->headers->add($headers);
Adds X-RateLimit-Reset header to throttled response (#<I>)
laravel_framework
train
php
d5657574d993ce5a95b4ee0b3c4960e94571757f
diff --git a/lib/serf/util/with_options_extraction.rb b/lib/serf/util/with_options_extraction.rb index <HASH>..<HASH> 100644 --- a/lib/serf/util/with_options_extraction.rb +++ b/lib/serf/util/with_options_extraction.rb @@ -54,9 +54,10 @@ module Util # Options Hash returns a nil because of either a # non-existent key or a nil value in said hash for said key. # - def opts(key, default=nil) + def opts(key, default=nil, &block) value = options[key] value = default if value.nil? + value = block.call if value.nil? && block return value end @@ -84,8 +85,8 @@ module Util # # Raises error when `opts` returns a nil. # - def opts!(key, default=nil) - value = opts key, default + def opts!(key, default=nil, &block) + value = opts key, default, &block raise "Nil value found for option: #{key}, #{default}" if value.nil? return value end
`opts` now accepts blocks to generate default values. Details: * Sometimes we only want to do the work to instantiate a default value when the key doesn't exist in the options hash. Prior, all default values were processed and passed in. * This change first attempts to lookup the key; followed by trying the default value; else, calling the block for a value.
byu_serf
train
rb
0857b42af8a9be8e64837304f4e40b593434a03f
diff --git a/src/dependencies/_injector.py b/src/dependencies/_injector.py index <HASH>..<HASH> 100644 --- a/src/dependencies/_injector.py +++ b/src/dependencies/_injector.py @@ -59,20 +59,15 @@ class InjectorType(type): current_attr = attrs_stack.pop() have_default = False continue - if current_attr == "__parent__": - raise DependencyError( - "You tries to shift this more times that Injector has levels" + if len(attrs_stack) > 1: + message = "{0!r} can not resolve attribute {1!r} while building {2!r}".format( # noqa: E501 + cls.__name__, current_attr, attrs_stack.pop() ) else: - if len(attrs_stack) > 1: - message = "{0!r} can not resolve attribute {1!r} while building {2!r}".format( # noqa: E501 - cls.__name__, current_attr, attrs_stack.pop() - ) - else: - message = "{0!r} can not resolve attribute {1!r}".format( - cls.__name__, current_attr - ) - raise DependencyError(message) + message = "{0!r} can not resolve attribute {1!r}".format( + cls.__name__, current_attr + ) + raise DependencyError(message) attribute, argspec = attribute_spec
Do not raise the same exception twice.
dry-python_dependencies
train
py
045ee3c0171939ad8557d83b3518dfc4cffba5cb
diff --git a/lfs/ntlm.go b/lfs/ntlm.go index <HASH>..<HASH> 100644 --- a/lfs/ntlm.go +++ b/lfs/ntlm.go @@ -59,7 +59,7 @@ func DoNTLMRequest(request *http.Request, retry bool) (*http.Response, error) { return nil, err } - challengeMessage, err := negotiate(negotiateReq, getNegotiateMessage()) + challengeMessage, err := negotiate(negotiateReq, ntlmNegotiateMessage) if err != nil { return nil, err } @@ -180,7 +180,4 @@ func cloneRequest(request *http.Request) (*http.Request, error) { return clonedReq, nil } -func getNegotiateMessage() string { - return "NTLM TlRMTVNTUAABAAAAB7IIogwADAAzAAAACwALACgAAAAKAAAoAAAAD1dJTExISS1NQUlOTk9SVEhBTUVSSUNB" -} - +const ntlmNegotiateMessage = "NTLM TlRMTVNTUAABAAAAB7IIogwADAAzAAAACwALACgAAAAKAAAoAAAAD1dJTExISS1NQUlOTk9SVEhBTUVSSUNB"
a const works just fine here for now
git-lfs_git-lfs
train
go
afefbbf6b6fe09f07e19a51c12befebb89c7168f
diff --git a/app/main.py b/app/main.py index <HASH>..<HASH> 100644 --- a/app/main.py +++ b/app/main.py @@ -9,6 +9,7 @@ def main(args, bootstrap_args): sys.path.insert(0, os.path.join(os.path.dirname(__file__), "nionswift")) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "nionswift-instrumentation-kit")) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "nionswift-io")) + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "nion-instrumentation")) # these imports need to occur AFTER the args are parsed and the path # is updated accordingly. from nion.swift import Facade
Add nion-instrumentation to app-package path.
nion-software_nionswift
train
py
9a30f0dc8af3b7669cafb4576c4749af42b385c4
diff --git a/subscriptions/tasks.py b/subscriptions/tasks.py index <HASH>..<HASH> 100644 --- a/subscriptions/tasks.py +++ b/subscriptions/tasks.py @@ -408,8 +408,8 @@ class ScheduleDisable(Task): def scheduler_client(self): return SchedulerApiClient( - api_token=settings.SCHEDULER_API_TOKEN, - api_url=settings.SCHEDULER_URL) + settings.SCHEDULER_API_TOKEN, + settings.SCHEDULER_URL) def run(self, subscription_id, **kwargs): l = self.get_logger(**kwargs) @@ -450,8 +450,8 @@ class ScheduleCreate(Task): def scheduler_client(self): return SchedulerApiClient( - api_token=settings.SCHEDULER_API_TOKEN, - api_url=settings.SCHEDULER_URL) + settings.SCHEDULER_API_TOKEN, + settings.SCHEDULER_URL) def run(self, subscription_id, **kwargs): """ Returns remote scheduler_id UUID
Remove keyword arguments for SchedulerApiClient These keyword arguments are inconsistent with every other API client, so let's use positional arguments instead. It's normally called `auth_token` not `api_token`. We changed the keyword arguments in <I> of the API client.
praekeltfoundation_seed-stage-based-messaging
train
py
b80646d5fde68319f519d679231fcbdfb5920404
diff --git a/dialog-helper.js b/dialog-helper.js index <HASH>..<HASH> 100644 --- a/dialog-helper.js +++ b/dialog-helper.js @@ -162,7 +162,7 @@ class DialogHelper { /** * Setting up validation of the dialog - * @param {Array<{wrapper:HTMLElement, input: HTMLElement}>} elements The elements + * @param {Array<Object<{wrapper: HTMLElement, input: HTMLElement}>>} elements The elements * @param {HTMLButtonElement} okButton The ok button (gets disabled if form is invalid) * @param {onValidationCallback} validationFunction */
Chnaging some JSDoc stuff
pklaschka_xd-dialog-helper
train
js
677ca0fbeafe9df221195d0f15630ac60f67fc75
diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index <HASH>..<HASH> 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -442,6 +442,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { context.setMimeTypes(MIME_TYPES); SocketConnector connector = new SocketConnector(); + connector.setHeaderBufferSize(12*1024); // use a bigger buffer as Stapler traces can get pretty large on deeply nested URL server.setThreadPool(new ThreadPoolImpl(new ThreadPoolExecutor(10, 10, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),new ThreadFactory() { public Thread newThread(Runnable r) {
Use a bigger buffer as Stapler traces can get pretty large on deeply nested URL
jenkinsci_jenkins
train
java
5d135f848d0c3f084a7ffe3d67249a6d57f18ca2
diff --git a/ores/score_processors/celery.py b/ores/score_processors/celery.py index <HASH>..<HASH> 100644 --- a/ores/score_processors/celery.py +++ b/ores/score_processors/celery.py @@ -4,7 +4,6 @@ from urllib.parse import urlparse import celery import mwapi.errors -import redis import revscoring.errors from celery.signals import before_task_publish @@ -20,6 +19,7 @@ APPLICATIONS = [] DEFAULT_CELERY_QUEUE = "celery" + @before_task_publish.connect def update_sent_state(sender=None, body=None, **kwargs): @@ -228,6 +228,10 @@ def redis_from_url(url): """ Converts a redis URL used by celery into a `redis.Redis` object. """ + # Makes sure that we only try to import redis when we need + # to use it + import redis + url = url or "" parsed_url = urlparse(url) if parsed_url.scheme != "redis":
Makes redis import conditional on use for Celery score processor.
wikimedia_ores
train
py
977ffb382e456241d33e6a768ebca19c7c7b15fe
diff --git a/src/Products/ProductsList.php b/src/Products/ProductsList.php index <HASH>..<HASH> 100644 --- a/src/Products/ProductsList.php +++ b/src/Products/ProductsList.php @@ -25,4 +25,23 @@ class ProductsList return $result; } + public function listProducts($start, $limit, $search = null){ + // Sanity check + if(!isset($start) || !is_int($start) || $start < 0) throw new \Exception('Precizati o valoare de start numar natural'); + if(!isset($limit) || !is_int($limit) || $limit < 0) throw new \Exception('Precizati un numar natural pentru limita'); + + // Set method and action + $method = 'products'; + $action = 'readProducts'; + + // Set data + $data = array('start' => $start, 'limit' => $limit); + if(!is_null($search)) $data['search'] = $search; + + // Send request and retrieve response + $result = Dispatcher::send($method, $action, $data); + + return $result; + } + }
Added listProducts modified: src/Products/ProductsList.php
celdotro_marketplace
train
php
6a8c8b2cc617c051a78e147a0277588f919eb53c
diff --git a/visor-telnet/src/main/java/de/uniulm/omi/cloudiator/visor/telnet/TCPServer.java b/visor-telnet/src/main/java/de/uniulm/omi/cloudiator/visor/telnet/TCPServer.java index <HASH>..<HASH> 100644 --- a/visor-telnet/src/main/java/de/uniulm/omi/cloudiator/visor/telnet/TCPServer.java +++ b/visor-telnet/src/main/java/de/uniulm/omi/cloudiator/visor/telnet/TCPServer.java @@ -148,12 +148,8 @@ public class TCPServer implements Server { } catch (IOException e) { LOGGER.info("Exception occurred while accepting the socket.", e); } - try { - LOGGER.debug(String.format("%s got interrupted, closing server socket.", this)); - this.serverSocket.close(); - } catch (IOException ignored) { - LOGGER.warn(ignored); - } + LOGGER.debug(String.format("%s got interrupted, server socket remains open" + + "for new connections.", this)); } }
PS-<I> fixing closing of socket when connection is closed
cloudiator_visor
train
java
3cd9713e0d32033e4fde7b1c351708f53672d2c4
diff --git a/src/dataflow/load.js b/src/dataflow/load.js index <HASH>..<HASH> 100644 --- a/src/dataflow/load.js +++ b/src/dataflow/load.js @@ -5,8 +5,11 @@ export function ingest(target, data, format) { } function loadPending(df) { - var pending = new Promise(function(accept) { resolve = accept; }), - resolve; + var accept, reject, + pending = new Promise(function(a, r) { + accept = a; + reject = r; + }); pending.requests = 0; @@ -14,8 +17,12 @@ function loadPending(df) { if (--pending.requests === 0) { df.runAfter(function() { df._pending = null; - df.run(); - resolve(df); + try { + df.run(); + accept(df); + } catch (err) { + reject(err); + } }); } } @@ -40,7 +47,5 @@ export function request(target, url, format) { pending.done(); }) .then(pending.done) - .catch(function(error) { - df.error(error); - }); + .catch(function(error) { df.warn(error); }); }
Improve async request handling.
vega_vega-dataflow
train
js
078d25a674940393a825aa31ee7b9d3e15926ccd
diff --git a/src/styles/text/label.js b/src/styles/text/label.js index <HASH>..<HASH> 100644 --- a/src/styles/text/label.js +++ b/src/styles/text/label.js @@ -20,14 +20,21 @@ export default class Label { let aabbs = bboxes.aabb; let obbs = bboxes.obb; - // Broadphase + // Broad phase if (aabbs.length > 0) { boxIntersect([this.aabb], aabbs, (i, j) => { - log.trace(`${this.options.id} broad phase collide`, this, this.aabb, aabbs[j]); + log.trace('collision: broad phase collide', this.options.id, this, this.aabb, aabbs[j]); + + // Skip narrow phase collision if no rotation + if (this.obb.angle === 0 && obbs[j].angle === 0) { + log.trace('collision: skip narrow phase collide because neither is rotated', this.options.id, this, this.obb, obbs[j]); + intersect = true; + return true; + } // Narrow phase if (OBB.intersect(this.obb, obbs[j])) { - log.trace(`${this.options.id} narrow phase collide`, this, this.obb, obbs[j]); + log.trace('collision: narrow phase collide', this.options.id, this, this.obb, obbs[j]); intersect = true; return true; }
skip narrow phase collision if neither object is rotated
tangrams_tangram
train
js
728f83b7f766b56a88736d5111f6666d36cb957c
diff --git a/lib/Cache.js b/lib/Cache.js index <HASH>..<HASH> 100755 --- a/lib/Cache.js +++ b/lib/Cache.js @@ -75,7 +75,11 @@ function Cache(disabled) { } cacheEntry.loading = false; cacheEntry.handlers.forEach(function (handler) { - handler(err, data); + try { + return handler(err, data); + } catch (err) { + console.error("Error calling cache handler", err.stack); + } }); cacheEntry.handlers = []; }); @@ -85,7 +89,11 @@ function Cache(disabled) { cacheEntry.ready = true; cacheEntry.loading = false; cacheEntry.handlers.forEach(function (handler) { - handler(err, null); + try { + return handler(err, null); + } catch (err) { + return console.error("Error calling cache handler", err.stack); + } }); cacheEntry.handlers = []; }
Added extra exception handling around calling handlers
Crafity_crafity-webserver
train
js
1e1183a8bf0e8faf10229bfef7eef98500c6989f
diff --git a/pkg/search/query.go b/pkg/search/query.go index <HASH>..<HASH> 100644 --- a/pkg/search/query.go +++ b/pkg/search/query.go @@ -310,6 +310,7 @@ func (h *Handler) Query(rawq *SearchQuery) (*SearchResult, error) { Blob: meta.Ref, }) if q.Limit > 0 && len(res.Blobs) == q.Limit && q.candidatesAreSorted(s) { + sendCtx.Cancel() break } }
search: add a forgotten Cancel. Funny, because this one line is why I finally went and added the Context type and started plumbing it through lots of stuff. Change-Id: Ie<I>a<I>e<I>de<I>fe<I>d4a
perkeep_perkeep
train
go
6c8bd98edaa7e8e43f801286df808ea4f533691a
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -221,8 +221,6 @@ class YouTube extends React.Component { event.target.setPlaybackRate(this.props.playbackRate); } - this.playerInstance = event.target; - this.resolvePlayer(event.target); } @@ -315,6 +313,9 @@ class YouTube extends React.Component { this.resolvePlayer = resolve; const player = new YT.Player(this.container, this.getInitialOptions()); + // Store the instance directly so we can destroy it sync in + // `componentWilLUnmount`. + this.playerInstance = player; Object.keys(eventNames).forEach((dmName) => { const reactName = eventNames[dmName];
Fix unmounting the component before the player has fully loaded.
u-wave_react-youtube
train
js
a75c039685e6f3278da19f1025c38205563c8036
diff --git a/src/basis/data.js b/src/basis/data.js index <HASH>..<HASH> 100644 --- a/src/basis/data.js +++ b/src/basis/data.js @@ -1819,10 +1819,7 @@ // module.setWrapper(function(value){ - ;;;basis.dev.warn('using basis.data as function is deprecated now, use basis.data.wrapData instead'); - - module.setWrapper(wrapData); - + ;;;basis.dev.warn('using basis.data as function is deprecated now, use basis.data.wrapData instead'); return wrapData(value); }); diff --git a/src/basis/ui/table.js b/src/basis/ui/table.js index <HASH>..<HASH> 100644 --- a/src/basis/ui/table.js +++ b/src/basis/ui/table.js @@ -554,7 +554,7 @@ }, loadData: function(items){ - this.setChildNodes(nsData(items)); + this.setChildNodes(nsData.wrapData(items)); }, destroy: function(){
warn on any basis.data as function usage
basisjs_basisjs
train
js,js
890bc6cddb845dce02cb92749b429617e6581dbe
diff --git a/proto/query/query.go b/proto/query/query.go index <HASH>..<HASH> 100644 --- a/proto/query/query.go +++ b/proto/query/query.go @@ -52,4 +52,5 @@ type Example struct { Db string QueryTime float64 Query string + Size int // Original size of the Query, before any truncation. }
PMM-<I>: Add size to determine if query got truncated or not.
percona_pmm
train
go
93000886d69130c9f48c0e780ade2e11a2d66088
diff --git a/chef/lib/chef/mixin/language_include_attribute.rb b/chef/lib/chef/mixin/language_include_attribute.rb index <HASH>..<HASH> 100644 --- a/chef/lib/chef/mixin/language_include_attribute.rb +++ b/chef/lib/chef/mixin/language_include_attribute.rb @@ -22,6 +22,11 @@ class Chef module Mixin module LanguageIncludeAttribute + # Loads the attribute file specified by the short name of the + # file, e.g., loads specified cookbook's + # "attributes/mailservers.rb" + # if passed + # "mailservers" def include_attribute(*args) if self.kind_of?(Chef::Node) node = self @@ -39,11 +44,11 @@ class Chef node.run_state[:seen_attributes][attrib] = true if amatch = attrib.match(/(.+?)::(.+)/) - cookbook = @cookbook_loader[amatch[1].to_sym] - cookbook.load_attribute(amatch[2], node) + cookbook_name = amatch[1].to_sym + node.load_attribute_by_short_filename(amatch[2], cookbook_name) else - cookbook = @cookbook_loader[amatch[1].to_sym] - cookbook.load_attribute("default", node) + cookbook_name = attrib.to_sym + node.load_attribute_by_short_filename("default", cookbook_name) end end true
Loading attributes on the node directly, instead of passing the node to the cookbook
chef_chef
train
rb
775eb985f407bc84fcf10a16483b7240bff12eb2
diff --git a/gui/riab.py b/gui/riab.py index <HASH>..<HASH> 100644 --- a/gui/riab.py +++ b/gui/riab.py @@ -98,7 +98,7 @@ class Riab: QVariant('')).toString() # Also set the system locale to the user overridden local # so that the riab library functions gettext will work - #os.environ['LANG'] = myLocaleName + os.environ['LANG'] = str(myLocaleName) myRoot = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) myTranslationPath = os.path.join(myRoot, 'gui', 'i18n',
Set the LANG environment variable when starting the plugin
inasafe_inasafe
train
py
7999a1afd267f1ac9a433ab87b7e9fdff9439e4c
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -133,7 +133,7 @@ if not on_rtd: # only import and set the theme if we're building docs locally # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format.
docs/conf.py: Remove _static from html_static_path Avoid: WARNING: html_static_path entry '.../docs/_static' does not exist because we have no static source in doc/_static.
corydolphin_flask-cors
train
py
c9adf5c967e1ce8a406e6c3677c661d9e9da3cec
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php index <HASH>..<HASH> 100644 --- a/lib/Sabre/DAV/Server.php +++ b/lib/Sabre/DAV/Server.php @@ -320,7 +320,8 @@ class Sabre_DAV_Server { $newProps['href'] = $file['name']; if (!$properties || in_array('{DAV:}supportedlock',$properties)) $newProps['{DAV:}supportedlock'] = new Sabre_DAV_Property_SupportedLock($this->tree->supportsLocks()); - + //if (!$properties || in_array('{http://www.apple.com/webdav_fs/props/}appledoubleheader',$properties)) $newProps['{http://www.apple.com/webdav_fs/props/}appledoubleheader'] = base64_encode(str_repeat(' ',82)); + if ($this->tree->supportsLocks()) if (!$properties || in_array('{DAV:}lockdiscovery',$properties)) $newProps['{DAV:}lockdiscovery'] = new Sabre_DAV_Property_LockDiscovery($this->tree->getLocks($path));
Unused line for appledoubleheader support.. We'll need to dig into this further
sabre-io_dav
train
php
732ead5959aa9e53e17f67c73336559f7432d8f7
diff --git a/www/src/py_dom.js b/www/src/py_dom.js index <HASH>..<HASH> 100644 --- a/www/src/py_dom.js +++ b/www/src/py_dom.js @@ -1112,12 +1112,18 @@ DOMNode.bind = function(self, event){ var $ = $B.args("bind", 4, {self: null, event: null, func: null, options: null}, ["self", "event", "func", "options"], arguments, - {options: _b_.None}, null, null), + {func: _b_.None, options: _b_.None}, null, null), self = $.self, event = $.event, func = $.func, options = $.options + if(func === _b_.None){ + // Returns a function to decorate the callback + return function(f){ + return DOMNode.bind(self, event, f) + } + } var callback = (function(f){ return function(ev){ try{
Method DOMNode.bind can be called without specifying a callback function : in this case, DOMNode.bind(element, event) is a decorator for the callback function. Combined with PEP <I>, it allows code like "@document['btn'].bind('click')"
brython-dev_brython
train
js
febb25bdfd538973ec962760858bd2f2441a30f2
diff --git a/src/org/jmock/integration/junit4/JMock.java b/src/org/jmock/integration/junit4/JMock.java index <HASH>..<HASH> 100644 --- a/src/org/jmock/integration/junit4/JMock.java +++ b/src/org/jmock/integration/junit4/JMock.java @@ -15,10 +15,11 @@ import java.lang.reflect.Field; /** * A test {@link Runner} that asserts that all expectations have been met after * the test has finished and before the fixture is torn down. - * - * @author nat + * @Deprecated For JUnit 4 use {@link JUnitRuleMockery} + * @author nat steve.freeman * */ +@Deprecated public class JMock extends BlockJUnit4ClassRunner { private Field mockeryField;
deprecate JMock in favour of JUnitRuleMockery
jmock-developers_jmock-library
train
java
47596d1f90c7cbc6e331cba5fa040bba32fdab7b
diff --git a/lib/guard/rspec/formatter.rb b/lib/guard/rspec/formatter.rb index <HASH>..<HASH> 100644 --- a/lib/guard/rspec/formatter.rb +++ b/lib/guard/rspec/formatter.rb @@ -9,6 +9,7 @@ class Guard::RSpec::Formatter < RSpec::Core::Formatters::BaseFormatter # if this fails don't kill everything begin + FileUtils.mkdir_p('tmp') File.open("./tmp/rspec_guard_result","w") do |f| f.puts failed_specs.join("\n") end
ensure the tmp dir is created
guard_guard-rspec
train
rb
23f059cb7e427fcb9a658d5ef4faaed87f268a66
diff --git a/src/server/pkg/obj/amazon_client.go b/src/server/pkg/obj/amazon_client.go index <HASH>..<HASH> 100644 --- a/src/server/pkg/obj/amazon_client.go +++ b/src/server/pkg/obj/amazon_client.go @@ -30,6 +30,7 @@ import ( const oneDayInSeconds = 60 * 60 * 24 const twoDaysInSeconds = 60 * 60 * 48 +const MaxRetries = 10 var ( // By default, objects uploaded to a bucket are only accessible to the @@ -169,7 +170,8 @@ func newAmazonClient(region, bucket string, creds *AmazonCreds, cloudfrontDistri // set up aws config, including credentials (if neither creds.ID nor // creds.VaultAddress are set, then this will use the EC2 metadata service awsConfig := &aws.Config{ - Region: aws.String(region), + Region: aws.String(region), + MaxRetries: aws.Int(MaxRetries), } if creds.ID != "" { awsConfig.Credentials = credentials.NewStaticCredentials(creds.ID, creds.Secret, creds.Token)
Increase number of retries for amazon client
pachyderm_pachyderm
train
go
a64a2b7ed83e98546ac2c4e7b3218245ef84f852
diff --git a/graftm/run.py b/graftm/run.py index <HASH>..<HASH> 100644 --- a/graftm/run.py +++ b/graftm/run.py @@ -308,11 +308,12 @@ class Run: first_search_method = self.args.search_method if self.args.decoy_database: - decoy_filter = DecoyFilter(Diamond(diamond_db), - Diamond(self.args.decoy_database)) + decoy_filter = DecoyFilter(Diamond(diamond_db, threads=self.args.threads), + Diamond(self.args.decoy_database, + threads=self.args.threads)) doing_decoy_search = True elif self.args.search_method == Run.HMMSEARCH_AND_DIAMOND_SEARCH_METHOD: - decoy_filter = DecoyFilter(Diamond(diamond_db)) + decoy_filter = DecoyFilter(Diamond(diamond_db, threads=self.args.threads)) doing_decoy_search = True first_search_method = 'hmmsearch' else:
graft: Use expected number of threads when decoy searching.
geronimp_graftM
train
py
645dff1cf77d2c57eb6f8a5c9aa83fcbb9189550
diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index <HASH>..<HASH> 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -108,7 +108,7 @@ } /// Check availability - if (isguest()) { + if (isguestuser()) { print_heading(get_string('guestsno', 'quiz')); if (empty($popup)) { print_footer($course); diff --git a/mod/quiz/view.php b/mod/quiz/view.php index <HASH>..<HASH> 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -137,7 +137,7 @@ // // So for courses that allow guest access, it is good to offer people an easy // way to log in at this point if they have got this far before logging in. - if (isguest()) { + if (isguestuser()) { $loginurl = $CFG->wwwroot.'/login/index.php'; if (!empty($CFG->loginhttps)) { $loginurl = str_replace('http:','https:', $loginurl);
Correct logic for stopping people using guest access from doing quizzes. Merged from MOODLE_<I>_STABLE.
moodle_moodle
train
php,php
524d4a35d2893396ba0d57b5eea853b11d5a57b9
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -32,7 +32,11 @@ module ActiveRecord class PendingMigrationError < ActiveRecordError#:nodoc: def initialize - super("Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=#{::Rails.env}' to resolve this issue.") + if defined?(Rails) + super("Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=#{::Rails.env}' to resolve this issue.") + else + super("Migrations are pending; run 'bin/rake db:migrate' to resolve this issue.") + end end end
Refer to Rails.env only when Rails is defined
rails_rails
train
rb
f10e499317f05d510ee89a27998c4ed15a846a3e
diff --git a/lib/parse.js b/lib/parse.js index <HASH>..<HASH> 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -151,6 +151,7 @@ function beautify(neoRes, fn) { // console.log(beautify(neoRes, parseUser)) + /** * Beautify a matrix by JSON.stringify -> join('\n\n') -> join('\n\n---\n\n') to separate rows, and wrap with '```' * @param {Array} mat Matrix of data to beautify @@ -185,11 +186,11 @@ function beautify(neoRes, fn) { */ /* istanbul ignore next */ function beautifyMat(mat) { - return '```\n' + _.map(mat, function(row) { - return _.map(row, function(item) { - return _.isString(item) ? item : JSON.stringify(item, null, 2) - }).join('\n\n') - }).join('\n\n---\n\n') + '\n```' + return '```\n' + _.reduce(mat, function(sum, row) { + return sum + '\n\n' + _.reduce(row, function(sum, item) { + return (_.isString(sum) ? sum : JSON.stringify(sum, null, 2)) + '\n\n---\n\n' + (_.isString(item) ? item : JSON.stringify(item, null, 2)) + }) + }) + '\n```' } /**
use reduce for beautify, more reliable
kengz_neo4jKB
train
js
4843629f03bacbd29337579f57230220e2668320
diff --git a/porespy/filters/__funcs__.py b/porespy/filters/__funcs__.py index <HASH>..<HASH> 100644 --- a/porespy/filters/__funcs__.py +++ b/porespy/filters/__funcs__.py @@ -1530,7 +1530,7 @@ def chunked_func(func, overlap, im_arg=['input', 'image', 'im'], >>> f = spim.binary_dilation >>> im2 = ps.filters.chunked_func(func=f, overlap=7, im_arg='input', ... input=im, structure=ball(3), cores=1) - Applying function to 8 subsections... + [########################################] | 100% Completed... >>> im3 = spim.binary_dilation(input=im, structure=ball(3)) >>> sp.all(im2 == im3) True
Fixing tests and docstring calls signatures
PMEAL_porespy
train
py
749c688d43f3a7cda9a36e362cbab95be961b3ad
diff --git a/datacats/cli/pull.py b/datacats/cli/pull.py index <HASH>..<HASH> 100644 --- a/datacats/cli/pull.py +++ b/datacats/cli/pull.py @@ -10,7 +10,6 @@ import json from datacats.docker import pull_stream IMAGES = [ - 'scratch', 'datacats/web', 'datacats/web:preload_master', 'datacats/postgres', diff --git a/datacats/docker.py b/datacats/docker.py index <HASH>..<HASH> 100644 --- a/datacats/docker.py +++ b/datacats/docker.py @@ -205,7 +205,7 @@ def data_only_container(name, volumes): return c = _docker.create_container( name=name, - image='scratch', # minimal container + image='datacats/web', # FIXME: use an empty container instead command='true', volumes=volumes, detach=True)
stop using scratch image for data-only container
datacats_datacats
train
py,py
d52c9a9ad13c67555fc3f739761927effc212c34
diff --git a/oldlib/interpreter.js b/oldlib/interpreter.js index <HASH>..<HASH> 100644 --- a/oldlib/interpreter.js +++ b/oldlib/interpreter.js @@ -118,15 +118,12 @@ Interpreter.prototype = { getCommandModule: function (name) { var commands = this._commands; for (var i = 0; i < commands.length; i++) { - try { - var c = commands[i]; - if (c.name === name) { - return c; - } - } catch (ex) { - console.error('Error loading command ' + ex); + var c = commands[i]; + if (c.name === name) { + return c; } } + throw Error('no command called '+name); },
commands are pre-loaded so no need for try/catch
particle-iot_particle-cli
train
js
cd3bb944a0c4eefbd61f2e3d9963e09fb82f7540
diff --git a/nfc/dev/transport.py b/nfc/dev/transport.py index <HASH>..<HASH> 100644 --- a/nfc/dev/transport.py +++ b/nfc/dev/transport.py @@ -227,7 +227,8 @@ class USB(object): self.usb_dev.claimInterface(0) except self.usb.USBError: raise IOError("unusable device") - self.usb_dev.reset() + if (dev.idVendor, dev.idProduct) in [(0x54c, 0x193), (0x4cc, 0x531)]: + self.usb_dev.reset() # needed for PN531 only interface = dev.configurations[0].interfaces[0] endpoints = interface[0].endpoints bulk_inp = lambda ep: (\
fix: usb device reset when using pyusb 0.x is only needed for the PN<I> chip (makes trouble with PN<I>)
nfcpy_nfcpy
train
py
7b3d796d9fad27c886603f7d575f19f0f31614fb
diff --git a/lib/api_formats/siren/server.siren.js b/lib/api_formats/siren/server.siren.js index <HASH>..<HASH> 100644 --- a/lib/api_formats/siren/server.siren.js +++ b/lib/api_formats/siren/server.siren.js @@ -61,7 +61,7 @@ module.exports = function(context) { entity.properties.ql = context.query; entity.class = entity.class.concat(context.classes); var queryTopic = qs.stringify({topic: 'query/'+context.query, since: new Date().getTime()}); - entity.links.push({ rel: [rel.query], href: env.helpers.url.path(loader.path + '/events?' + queryTopic).replace(/^http/, 'ws') }); + entity.links.push({ rel: [rel.query], href: env.helpers.url.path(loader.path + '/events') + '?' + queryTopic.replace(/^http/, 'ws') }); //rerform matching of current devices. }
Fixing formatting of WS url in Server representation.
zettajs_zetta
train
js
c024b27681528601dfe804be818f3e24b7de0a57
diff --git a/tests/test_publisher.py b/tests/test_publisher.py index <HASH>..<HASH> 100644 --- a/tests/test_publisher.py +++ b/tests/test_publisher.py @@ -148,8 +148,14 @@ class TestMapServicePublisher(TestCase): mock_exists.return_value = {'exists': True} with patch('slap.api.Api.delete_service') as mock_delete: self.publisher.delete_service(service_name, folder_name) - mock_delete.assert_called_once_with(service_name, folder_name) - mock_exists.return_value = {'exists': False} + mock_delete.assert_called_once_with(service_name=service_name, folder=folder_name) + + def test_delete_service_only_if_exists(self): + service_name = 'myService' + folder_name = 'folder' + with patch('slap.api.Api.service_exists') as mock_exists: + mock_exists.return_value = {'exists': False} + with patch('slap.api.Api.delete_service') as mock_delete: self.publisher.delete_service(service_name, folder_name) mock_delete.assert_not_called()
Fixes tests for deleting service
lobsteropteryx_slap
train
py
ff8e363a8a244eab9bea2a844931cd88900da2a3
diff --git a/plugin/src/main/java/org/wildfly/plugin/cli/Commands.java b/plugin/src/main/java/org/wildfly/plugin/cli/Commands.java index <HASH>..<HASH> 100644 --- a/plugin/src/main/java/org/wildfly/plugin/cli/Commands.java +++ b/plugin/src/main/java/org/wildfly/plugin/cli/Commands.java @@ -72,7 +72,7 @@ public class Commands { * </p> */ @Parameter(alias = "fail-on-error", defaultValue = "true") - private boolean failOnError; + private boolean failOnError = true; /** * Indicates whether or not commands should be executed in a batch.
[WFMP-<I>] Explicitly set failOnError to true
wildfly_wildfly-maven-plugin
train
java
f67155fe88ae969999c6b9c7af37b1cf4f14d2f6
diff --git a/src/js/components/Columns.js b/src/js/components/Columns.js index <HASH>..<HASH> 100644 --- a/src/js/components/Columns.js +++ b/src/js/components/Columns.js @@ -33,6 +33,17 @@ export default class Columns extends Component { setTimeout(this._layout, 10); } + componentWillReceiveProps (nextProps) { + this.setState({ relayout: true }); + } + + componentDidUpdate () { + if (this.state.relayout) { + this.setState({ relayout: false }); + this._layout(); + } + } + componentWillUnmount () { window.removeEventListener('resize', this._onResize); clearTimeout(this._layoutTimer);
Changed Columns to relayout when props change.
grommet_grommet
train
js
c1b3dd04abb30fdff1327a3978ba6a3d43eaaf19
diff --git a/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php b/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php index <HASH>..<HASH> 100644 --- a/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php +++ b/Neos.Flow/Classes/ObjectManagement/Proxy/Compiler.php @@ -116,12 +116,13 @@ class Compiler * If no such proxy class has been created yet by this renderer, * this function will create one and register it for later use. * - * If the class is not proxable, false will be returned + * If the class is not proxyable, or is not a real class at all, + * false will be returned * * @param string $fullClassName Name of the original class * @return ProxyClass|boolean */ - public function getProxyClass($fullClassName) + public function getProxyClass(string $fullClassName) { if (interface_exists($fullClassName) || in_array(BaseTestCase::class, class_parents($fullClassName))) { return false; @@ -136,6 +137,10 @@ class Compiler return false; } + if (method_exists($classReflection, 'isEnum') && $classReflection->isEnum()) { + return false; + } + $proxyAnnotation = $this->reflectionService->getClassAnnotation($fullClassName, Flow\Proxy::class); if ($proxyAnnotation !== null && $proxyAnnotation->enabled === false) { return false;
BUGFIX: Don't create proxy classes for PHP enums This change introduces a check in the proxy class compiler which makes sure that PHP <I> enums are not considered as regular classes and are removed from the list of proxyable classes. Addresses #<I>
neos_flow-development-collection
train
php
f2c3bf51e6be8c0388b300ab1d3915775c4fd33f
diff --git a/mode/css/css.js b/mode/css/css.js index <HASH>..<HASH> 100644 --- a/mode/css/css.js +++ b/mode/css/css.js @@ -488,7 +488,7 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) { "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", - "italic", "justify", "kannada", "katakana", "katakana-iroha", "khmer", + "italic", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "line-through", "linear", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
[css mode] Added keep-all to valueKeywords. Valid value of e.g. word-break
codemirror_CodeMirror
train
js
ff74942afb5b1f0d2b840204325f709fa0896452
diff --git a/sos/plugins/libraries.py b/sos/plugins/libraries.py index <HASH>..<HASH> 100644 --- a/sos/plugins/libraries.py +++ b/sos/plugins/libraries.py @@ -24,6 +24,23 @@ class Libraries(Plugin, RedHatPlugin, UbuntuPlugin): self.add_copy_spec(["/etc/ld.so.conf", "/etc/ld.so.conf.d"]) if self.get_option("ldconfigv"): self.add_cmd_output("ldconfig -v -N -X") - self.add_cmd_output("ldconfig -p -N -X") + + ldconfig_file = self.get_cmd_output_now("ldconfig -p -N -X") + + if not ldconfig_file: + return + + # Collect library directories from ldconfig's cache + dirs = set() + with open(ldconfig_file) as f: + for l in f.read().splitlines(): + s = l.split(" => ", 2) + if len(s) != 2: + continue + dirs.add(s[1].rsplit('/', 1)[0]) + + if dirs: + self.add_cmd_output("ls -lanH %s" % " ".join(dirs), + suggest_filename="ld_so_cache") # vim: set et ts=4 sw=4 :
[libraries] collect standard library paths Collects the paths to the libraries cached by "ldconfig". This is useful when a customer replaced a standard library by its own or when he added his own libraries to the standard paths or through symbolic links. Resolves: #<I>
sosreport_sos
train
py
139803ed7e4228e285ee39f22ea7158f5e10b4c9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ TEST_REQUIRES = ANSIBLE_REQUIRES + ( ) DOCS_REQUIRES = ( - 'pyinfra-guzzle_sphinx_theme==0.6', + 'pyinfra-guzzle_sphinx_theme==0.7', 'recommonmark==0.5.0', 'sphinx==2.2.1 ; python_version >= "3"', )
Bump the sphinx theme to <I>.
Fizzadar_pyinfra
train
py
d742814686fc2c8dfbdcb582541155cb8df170ac
diff --git a/src/util/Util.js b/src/util/Util.js index <HASH>..<HASH> 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -8,7 +8,7 @@ const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); const isObject = d => typeof d === 'object' && d !== null; /** - * Contains various general-purpose utility methods. These functions are also available on the base `Discord` object. + * Contains various general-purpose utility methods. */ class Util { constructor() {
docs(Util): methods removed on the base object (#<I>)
discordjs_discord.js
train
js
94ebca0d044e4972c20e77933f9f5481b19f9e92
diff --git a/pandas/tests/test_expressions.py b/pandas/tests/test_expressions.py index <HASH>..<HASH> 100644 --- a/pandas/tests/test_expressions.py +++ b/pandas/tests/test_expressions.py @@ -73,17 +73,11 @@ class TestExpressions(object): def run_arithmetic(self, df, other, assert_func, check_dtype=False, test_flex=True): expr._MIN_ELEMENTS = 0 - operations = ['add', 'sub', 'mul', 'mod', 'truediv', 'floordiv', 'pow'] + operations = ['add', 'sub', 'mul', 'mod', 'truediv', 'floordiv'] if not compat.PY3: operations.append('div') for arith in operations: - # numpy >= 1.11 doesn't handle integers - # raised to integer powers - # https://github.com/pandas-dev/pandas/issues/15363 - if arith == 'pow' and not _np_version_under1p11: - continue - operator_name = arith if arith == 'div': operator_name = 'truediv'
TST: Remove pow test in expressions These are already skipped for NumPy>=<I>, and buggy for NumPy <I>
pandas-dev_pandas
train
py
101f962403216845f97786c3fd550013c6c9651c
diff --git a/pypot/vrep/__init__.py b/pypot/vrep/__init__.py index <HASH>..<HASH> 100644 --- a/pypot/vrep/__init__.py +++ b/pypot/vrep/__init__.py @@ -125,6 +125,9 @@ def from_vrep(config, vrep_host, vrep_port, vrep_scene, if tracked_collisions: vct.start() + while vrep_io.get_simulation_current_time() < 1.: + sys_time.sleep(0.1) + robot.reset_simulation = lambda: reset(robot) def current_simulation_time(robot):
Make sure that v-rep time is actually started before returning from the reset.
poppy-project_pypot
train
py
4553dc9feb352cc8c3224b4034fdecd39bd6199d
diff --git a/pkg/buildbot_pkg.py b/pkg/buildbot_pkg.py index <HASH>..<HASH> 100644 --- a/pkg/buildbot_pkg.py +++ b/pkg/buildbot_pkg.py @@ -214,8 +214,7 @@ class BuildJsCommand(distutils.cmd.Command): # if we find yarn, then we use it as it is much faster if yarn_version != "": - # --mutex allows to build in parallel - commands.append(['yarn', 'install', '--pure-lockfile', '--mutex', 'file:/tmp/.yarn-mutex']) + commands.append(['yarn', 'install', '--pure-lockfile']) else: commands.append(['npm', 'install'])
fix yarn mutex to work on multiplatform buildbot_pkg was reportedly broken on windows since the yarn mutex fix
buildbot_buildbot
train
py
5405354d884e1cb03253962aa3edc640e89572fe
diff --git a/lib/dml/sqlsrv_native_moodle_database.php b/lib/dml/sqlsrv_native_moodle_database.php index <HASH>..<HASH> 100644 --- a/lib/dml/sqlsrv_native_moodle_database.php +++ b/lib/dml/sqlsrv_native_moodle_database.php @@ -443,7 +443,7 @@ class sqlsrv_native_moodle_database extends moodle_database { * @return array of table names in lowercase and without prefix */ public function get_tables($usecache = true) { - if ($usecache and count($this->tables) > 0) { + if ($usecache and $this->tables !== null) { return $this->tables; } $this->tables = array ();
MDL-<I> dml: php<I> compatibility, avoid counting on non-countables This was not detected earlier because we have been unable to run sqlsrv + php<I> till now (not available).
moodle_moodle
train
php
8abeaa40ec2bfd9e81744c976fe60a0e14de62da
diff --git a/src/Serverfireteam/Panel/Commands/PanelCommand.php b/src/Serverfireteam/Panel/Commands/PanelCommand.php index <HASH>..<HASH> 100644 --- a/src/Serverfireteam/Panel/Commands/PanelCommand.php +++ b/src/Serverfireteam/Panel/Commands/PanelCommand.php @@ -36,7 +36,7 @@ class PanelCommand extends Command { public function fire() { - $this->info(' [ Wellcome to ServerFireTeam Panel Installations ] '); + $this->info(' [ Welcome to ServerFireTeam Panel Installations ] '); $this->call('vendor:publish');
Fix Typo Fixed spelling of "Welcome"
serverfireteam_panel
train
php
bab7f8e1d520c30abfb3dff42ec94fd07a727e9a
diff --git a/js/bithumb.js b/js/bithumb.js index <HASH>..<HASH> 100644 --- a/js/bithumb.js +++ b/js/bithumb.js @@ -299,7 +299,7 @@ module.exports = class bithumb extends Exchange { let signature = this.hmac (this.encode (auth), this.encode (this.secret), 'sha512'); let signature64 = this.decode (this.stringToBase64 (this.encode (signature))); headers = { - 'Accept': 'application/json,*/*;q=0.9', + 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Api-Key': this.apiKey, 'Api-Sign': signature64.toString (),
more edits for php #<I>
ccxt_ccxt
train
js
f2cd3fcb2a9b4b108f5ce34a9f121ec13ac1cc16
diff --git a/debug.go b/debug.go index <HASH>..<HASH> 100644 --- a/debug.go +++ b/debug.go @@ -16,6 +16,7 @@ func IsDebugging() bool { return ginMode == debugCode } +// DebugPrintRouteFunc indicates debug log output format. var DebugPrintRouteFunc func(httpMethod, absolutePath, handlerName string, nuHandlers int) func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) { diff --git a/routergroup.go b/routergroup.go index <HASH>..<HASH> 100644 --- a/routergroup.go +++ b/routergroup.go @@ -17,7 +17,7 @@ type IRouter interface { Group(string, ...HandlerFunc) *RouterGroup } -// Iroutes defins all router handle interface. +// IRoutes defines all router handle interface. type IRoutes interface { Use(...HandlerFunc) IRoutes
chore: fix typo and add a little anotation (#<I>)
gin-gonic_gin
train
go,go
5f60d457541aea64e26ca00cbbed0f93c0dc3aed
diff --git a/lib/gibier/version.rb b/lib/gibier/version.rb index <HASH>..<HASH> 100644 --- a/lib/gibier/version.rb +++ b/lib/gibier/version.rb @@ -1,3 +1,3 @@ module Gibier - VERSION = "0.8.14" + VERSION = "0.8.15" end
Bump gibier to <I>
youchan_gibier
train
rb
e5ae4e01b623b07e85007440939fdda4e7e4c39a
diff --git a/lib/mimi/config.rb b/lib/mimi/config.rb index <HASH>..<HASH> 100644 --- a/lib/mimi/config.rb +++ b/lib/mimi/config.rb @@ -15,10 +15,10 @@ module Mimi # Current set of values for configurable and const parameters attr_reader :params - DEFAULT_OPTS = { + default_options( raise_on_missing_params: true, use_dotenv: true - }.freeze + ) # Creates a Config object. # @@ -39,7 +39,7 @@ module Mimi # from ENV. # def load(manifest_filename, opts = {}) - opts = DEFAULT_OPTS.merge(opts) + opts = self.class.module_options.deep_merge(opts) manifest_filename = Pathname.new(manifest_filename).expand_path load_manifest(manifest_filename, opts) load_params(opts)
Updated to use mimi/core
kukushkin_mimi-config
train
rb
45736b7c2ba5f2d81163cae9884e31a7f46ab229
diff --git a/src/ocrmypdf/cli.py b/src/ocrmypdf/cli.py index <HASH>..<HASH> 100644 --- a/src/ocrmypdf/cli.py +++ b/src/ocrmypdf/cli.py @@ -340,8 +340,9 @@ Online documentation is located at: "Control how PDF is optimized after processing:" "0 - do not optimize; " "1 - do safe, lossless optimizations (default); " - "2 - do some lossy optimizations; " - "3 - do aggressive lossy optimizations (including lossy JBIG2)" + "2 - do lossy JPEG and JPEG2000 optimizations; " + "3 - do more aggressive lossy JPEG and JPEG2000 optimizations. " + "To enable lossy JBIG2, see --jbig2-lossy." ), ) optimizing.add_argument( @@ -379,7 +380,8 @@ Online documentation is located at: action='store_true', help=( "Enable JBIG2 lossy mode (better compression, not suitable for some " - "use cases - see documentation)." + "use cases - see documentation). Only takes effect if --optimize 1 or " + "higher is also enabled." ), ) optimizing.add_argument(
cli: clarify text to more accurately describe behavior of --jbig2-lossy
jbarlow83_OCRmyPDF
train
py
04140ab381ea3fd6154371202dd27c0b8aed7f6d
diff --git a/src/ikpy/chain.py b/src/ikpy/chain.py index <HASH>..<HASH> 100644 --- a/src/ikpy/chain.py +++ b/src/ikpy/chain.py @@ -159,6 +159,7 @@ class Chain(object): * URDF joints = IKPY links * URDF links are not used by IKPY. They are thrown away when parsing """ + # FIXME: Rename links to joints, to be coherent with URDF? if base_elements is None: base_elements = ["base_link"]
Add doc to describe relations between IKPY links and URDF joints
Phylliade_ikpy
train
py
caf24c70592c4d3027df5a6702b850819e0da819
diff --git a/sacred/initialize.py b/sacred/initialize.py index <HASH>..<HASH> 100755 --- a/sacred/initialize.py +++ b/sacred/initialize.py @@ -324,8 +324,9 @@ def create_run(experiment, command_name, config_updates=None, post_runs = [pr for ing in sorted_ingredients for pr in ing.post_run_hooks] run = Run(config, config_modifications, main_function, - experiment.observers, root_logger, run_logger, experiment_info, - host_info, pre_runs, post_runs, experiment.captured_out_filter) + copy(experiment.observers), root_logger, run_logger, + experiment_info, host_info, pre_runs, post_runs, + experiment.captured_out_filter) if hasattr(main_function, 'unobserved'): run.unobserved = main_function.unobserved
shallow-copy the list of observers when creating a run fixes #<I>
IDSIA_sacred
train
py
7e330e5b7ec2ebb3f8f0b9dc01f8e71d12a72faf
diff --git a/tacl/stripper.py b/tacl/stripper.py index <HASH>..<HASH> 100644 --- a/tacl/stripper.py +++ b/tacl/stripper.py @@ -82,7 +82,7 @@ class Stripper: work = os.path.splitext(os.path.basename(filename))[0] stripped_file_path = os.path.join(self._output_dir, work) self._logger.info('Stripping file {} into {}'.format( - file_path, stripped_file_path)) + file_path, stripped_file_path)) try: tei_doc = etree.parse(file_path) except etree.XMLSyntaxError:
Corrected continuation line indent.
ajenhl_tacl
train
py
8b3f2df3b3c069c185a7fa7816e4d1a71eb6837a
diff --git a/lib/fs.js b/lib/fs.js index <HASH>..<HASH> 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -838,10 +838,7 @@ MantaFs.prototype.readdir = function readdir(_path, cb) { res.on('entry', function onLsEntry(e) { names.push(e.name); - if (!out.write(JSON.stringify(e) + '\n')) { - out.once('drain', res.resume.bind(res)); - res.pause(); - } + out.write(JSON.stringify(e) + '\n'); }); res.once('end', function onLsDone() {
MANTA-<I>: readdir treating EventEmitter as stream (it's not one)
joyent_node-mantafs
train
js
9dead1b7f194ac94f86545099086d58422642c7f
diff --git a/src/translate.js b/src/translate.js index <HASH>..<HASH> 100644 --- a/src/translate.js +++ b/src/translate.js @@ -38,7 +38,7 @@ export default function translate(namespaces, options = {}) { if (this.mounted) this.setState({ ready: true }); }); this.i18n.on('languageChanged loaded', this.onI18nChanged); - this.i18n.store.on('added removed', this.onI18nChanged); + this.i18n.store && this.i18n.store.on('added removed', this.onI18nChanged); } componentWillUnmount() {
store not always ready when component loads;
i18next_react-i18next
train
js
a584a1e47f4721949a6b2c2f408dbc84382bc39f
diff --git a/src/lint.js b/src/lint.js index <HASH>..<HASH> 100644 --- a/src/lint.js +++ b/src/lint.js @@ -10,7 +10,12 @@ import CodeMirror from 'codemirror'; import {getDiagnostics} from 'graphql-language-service-interface'; -const SEVERITY = ['ERROR', 'WARNING', 'INFORMATION', 'HINT']; +const SEVERITY = ['error', 'warning', 'information', 'hint']; +const TYPE = { + 'GraphQL: Validation': 'validation', + 'GraphQL: Deprecation': 'deprecation', + 'GraphQL: Syntax': 'syntax', +}; /** * Registers a "lint" helper for CodeMirror. @@ -32,10 +37,10 @@ CodeMirror.registerHelper('lint', 'graphql', (text, options) => { const results = rawResults.map(error => ({ message: error.message, - severity: SEVERITY[error.severity], - type: error.source, - from: error.range.start, - to: error.range.end, + severity: SEVERITY[error.severity - 1], + type: TYPE[error.source], + from: CodeMirror.Pos(error.range.start.line, error.range.start.character), + to: CodeMirror.Pos(error.range.end.line, error.range.end.character), })); return results;
fix incorrect annotation formating in lint (#<I>)
graphql_graphiql
train
js
05af02c7d69ff94392bfd69747481f080cfdb9a9
diff --git a/parsl/monitoring/db_manager.py b/parsl/monitoring/db_manager.py index <HASH>..<HASH> 100644 --- a/parsl/monitoring/db_manager.py +++ b/parsl/monitoring/db_manager.py @@ -383,7 +383,8 @@ class DatabaseManager: columns=['task_time_invoked', 'task_time_returned', 'run_id', 'task_id', - 'task_fail_count'], + 'task_fail_count', + 'task_hashsum'], messages=task_info_update_messages) logger.debug("Inserting {} task_info_all_messages into status table".format(len(task_info_all_messages)))
update task_hashsum for task table in monitoring (#<I>)
Parsl_parsl
train
py
fdc59934b1fe37d74c9aaada6bbabd8e987598df
diff --git a/test-utils/src/main/java/com/github/olivergondza/dumpling/TestThread.java b/test-utils/src/main/java/com/github/olivergondza/dumpling/TestThread.java index <HASH>..<HASH> 100644 --- a/test-utils/src/main/java/com/github/olivergondza/dumpling/TestThread.java +++ b/test-utils/src/main/java/com/github/olivergondza/dumpling/TestThread.java @@ -126,8 +126,8 @@ public final class TestThread { /* Client is expected to dispose the thread */ public static Process runJmxObservableProcess(boolean auth) throws Exception { String //cp = "target/test-classes:target/classes"; // Current module - cp = TestThread.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); - + // Use file to convert URI to a path platform FS would understand, + cp = new File(TestThread.class.getProtectionDomain().getCodeSource().getLocation().toURI().getSchemeSpecificPart()).getAbsolutePath(); List<String> args = new ArrayList<String>(); args.add("java"); args.add("-cp");
Fix failing tests on windows unable to get current class-path
olivergondza_dumpling
train
java
6a55e41d36e347d0dc116affd95fd1e636dc3d3b
diff --git a/lib/restify/adapter/typhoeus.rb b/lib/restify/adapter/typhoeus.rb index <HASH>..<HASH> 100644 --- a/lib/restify/adapter/typhoeus.rb +++ b/lib/restify/adapter/typhoeus.rb @@ -77,7 +77,9 @@ module Restify end def convert_headers(headers) - headers.each_with_object({}) do |header, memo| + return {} unless headers.respond_to?(:each_pair) + + headers.each_pair.each_with_object({}) do |header, memo| memo[header[0].upcase.tr('-', '_')] = header[1] end end
Improve webmock compatibility Web requests mock may return nil as headers.
jgraichen_restify
train
rb
553d4a828a4f13fe4c8993db87c2e2ea61a87c33
diff --git a/plugins/kernel_v2/config/vm_provider.rb b/plugins/kernel_v2/config/vm_provider.rb index <HASH>..<HASH> 100644 --- a/plugins/kernel_v2/config/vm_provider.rb +++ b/plugins/kernel_v2/config/vm_provider.rb @@ -19,30 +19,17 @@ module VagrantPlugins @config = nil @logger = Log4r::Logger.new("vagrant::config::vm::provider") - # If we were given a block to configure with, then let's try - # to do that. - load_config(block) if block - end - - protected - - # This takes the config block given to define the provider and - # attempts to turn this into a real configuration object. If the - # provider plugin is not found then it is simply ignored. This allows - # people to share Vagrantfiles that have configuration for providers - # which may not be setup on every user's system. - # - # @param [Proc] config_proc - def load_config(config_proc) + # Attempt to find the configuration class for this provider and + # load the configuration. config_class = Vagrant.plugin("2").manager.provider_configs[@name] if !config_class - @logger.info("Provider config for #{@name} not found, ignoring that config.") + @logger.info("Provider config for #{@name} not found, ignoring config.") return end @logger.info("Configuring provider #{@name} with #{config_class}") @config = config_class.new - config_proc.call(@config) + block.call(@config) if block end end end
Make sure provider config is always available even if no block was given
hashicorp_vagrant
train
rb
7f1e2ba211a1bd8f2068aadddba5173440d28e36
diff --git a/searx/engines/dailymotion.py b/searx/engines/dailymotion.py index <HASH>..<HASH> 100644 --- a/searx/engines/dailymotion.py +++ b/searx/engines/dailymotion.py @@ -16,8 +16,8 @@ from lxml import html # engine dependent config categories = ['videos'] -locale = 'en_US' paging = True +language_support = True # search-url # see http://www.dailymotion.com/doc/api/obj-video.html @@ -26,6 +26,11 @@ search_url = 'https://api.dailymotion.com/videos?fields=title,description,durati # do search-request def request(query, params): + if params['language'] == 'all': + locale = 'en-US' + else: + locale = params['language'] + params['url'] = search_url.format( query=urlencode({'search': query, 'localization': locale}), pageno=params['pageno'])
[enh] dailymotion engine: add language support
asciimoo_searx
train
py
fb66e8f5451fd26cb9a5da97b9100b5b19b24cf8
diff --git a/lib/dsl.rb b/lib/dsl.rb index <HASH>..<HASH> 100644 --- a/lib/dsl.rb +++ b/lib/dsl.rb @@ -122,9 +122,6 @@ module CQL } elsif @from == 'scenarios' filter.each { |k, v| - what, op = k.split /_/ - comp = Comparison.new op, v - filter_obj = Filter.new what, comp if k =~ /tc/ what, op = k.split /_/ comp = Comparison.new op, v diff --git a/lib/map_reduce.rb b/lib/map_reduce.rb index <HASH>..<HASH> 100644 --- a/lib/map_reduce.rb +++ b/lib/map_reduce.rb @@ -60,7 +60,7 @@ module CQL end def self.filter_sso2 input, args - if args.class == CQL::Dsl::Filter + if args.class == CQL::Dsl::Filter and args.type == 'tc' input.each_with_index do |feature, index| filtered_elements= feature['elements'].find_all do |sso| sso['tags'].size.send(args.comparison.operator, args.comparison.amount)
Even further into nasty intermittent refactor
enkessler_cql
train
rb,rb
0e6ff415e43fa6e1353e63499a4d15b0e4d947ac
diff --git a/test/Async-test.js b/test/Async-test.js index <HASH>..<HASH> 100644 --- a/test/Async-test.js +++ b/test/Async-test.js @@ -132,6 +132,31 @@ describe('Async', () => { />); }); }); + + it('treats a rejected promise as empty options', () => { + + let promise1Resolve, promise2Reject; + + const promise1 = expect.promise((resolve, reject) => { + promise1Resolve = resolve; + }); + const promise2 = expect.promise((resolve, reject) => { + promise2Reject = reject; + }); + loadOptions.withArgs('te').returns(promise1); + + loadOptions.withArgs('tes').returns(promise2); + + const result1 = typeSearchText('te'); + const result2 = typeSearchText('tes'); + promise1Resolve({ options: [ { value: 1, label: 'from te input'}]}); + promise2Reject(); + + return expect.promise.all([ result1, result2]).then(() => { + // Previous results (from 'te') are thrown away, and we render with an empty options list + return expect(renderer, 'to have rendered', <Select options={ [] }/>); + }); + }); }); describe('with an isLoading prop', () => {
Test for rejected promise Treats as if the options list was empty
HubSpot_react-select-plus
train
js
d3178b8d848a9291d7095b2e999dc2ae8f645fa9
diff --git a/src/core/useTrackBindingPlugin.js b/src/core/useTrackBindingPlugin.js index <HASH>..<HASH> 100644 --- a/src/core/useTrackBindingPlugin.js +++ b/src/core/useTrackBindingPlugin.js @@ -62,7 +62,7 @@ export class TrackBindingPlugin { if (this._traverseParent) { const rootElement = this._rootElement; while (elem !== rootElement) { - elem = elem.parentElement; + elem = elem.parentElement || elem.parentNode; dataset = {...this._getData(elem), ...dataset}; } }
Fix for IE console log error. SVG elements in IE do not have a parentElement. Need to use elem.parentNode to get the parent DOM element of SVG elements
nfl_react-metrics
train
js
6c225686f841711b7112a594b46b0d0b5715b26a
diff --git a/mozdownload/scraper.py b/mozdownload/scraper.py index <HASH>..<HASH> 100755 --- a/mozdownload/scraper.py +++ b/mozdownload/scraper.py @@ -431,7 +431,9 @@ class DailyScraper(Scraper): auth=self.authentication, headers=headers) r.raise_for_status() - return datetime.strptime(r.text.split('\n')[0], '%Y%m%d%H%M%S') + retval = datetime.strptime(r.text.split('\n')[0], '%Y%m%d%H%M%S') + r.close() + return relval def is_build_dir(self, dir): """Return whether or not the given dir contains a build."""
Found another connection that should be closed. Not so essential as it won't be opened very often. Don't worry about closing main download connection; we exit soon after the download is complete. The only time we would leak is if we have to retry; that should be a limited number of tries.
mozilla_mozdownload
train
py
c16accc119e4ab80084549bb3f5860844c84db23
diff --git a/controller/client/client.go b/controller/client/client.go index <HASH>..<HASH> 100644 --- a/controller/client/client.go +++ b/controller/client/client.go @@ -315,8 +315,8 @@ outer: case "failed": return e.Err() } - case <-time.After(10 * time.Second): - return fmt.Errorf("Timed out waiting for deployment completion!") + case <-time.After(30 * time.Second): + return errors.New("timed out waiting for deployment completion") } }
controller: Bump the deploy timeout to <I>s
flynn_flynn
train
go
708ea506daa5042493087ed3145bef0539b194cf
diff --git a/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/commands/UserGroupCallbackTaskCommand.java b/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/commands/UserGroupCallbackTaskCommand.java index <HASH>..<HASH> 100644 --- a/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/commands/UserGroupCallbackTaskCommand.java +++ b/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/commands/UserGroupCallbackTaskCommand.java @@ -511,7 +511,7 @@ public class UserGroupCallbackTaskCommand<T> extends TaskCommand<T> { } protected boolean isBusinessAdmin(String userId, List<OrganizationalEntity> businessAdmins, TaskContext context) { - List<String> usersGroup = context.getUserGroupCallback().getGroupsForUser(userId, null, null); + List<String> usersGroup = context.getUserGroupCallback().getGroupsForUser(userId); usersGroup.add(userId); return businessAdmins.stream().anyMatch(oe -> usersGroup.contains(oe.getId()));
JBPM-<I> - Administration service for processes and tasks - services api and kie server - fixed usergroupcallback usage
kiegroup_jbpm
train
java
2a80581cf11b32e22a119abff663bafa441b3448
diff --git a/qtism/runtime/tests/AssessmentTestSession.php b/qtism/runtime/tests/AssessmentTestSession.php index <HASH>..<HASH> 100644 --- a/qtism/runtime/tests/AssessmentTestSession.php +++ b/qtism/runtime/tests/AssessmentTestSession.php @@ -1038,6 +1038,7 @@ class AssessmentTestSession extends State { $this->addPendingResponses($pendingResponses); } else { + $this->submitItemResults($session, $occurence); $this->outcomeProcessing(); } }
item results also submitted when skipping. git-svn-id: <URL>
oat-sa_qti-sdk
train
php
f17fc55b819d409419d8b0c0fc6c58ae0ab8ced7
diff --git a/signature/policy_config_test.go b/signature/policy_config_test.go index <HASH>..<HASH> 100644 --- a/signature/policy_config_test.go +++ b/signature/policy_config_test.go @@ -3,6 +3,7 @@ package signature import ( "bytes" "encoding/json" + "fmt" "os" "path/filepath" "testing" @@ -342,15 +343,17 @@ func (d policyJSONUmarshallerTests) run(t *testing.T) { assertJSONUnmarshalFromObjectFails(t, invalid, dest) } // Various ways to corrupt the JSON - for _, fn := range d.breakFns { - var tmp mSI - err := json.Unmarshal(validJSON, &tmp) - require.NoError(t, err) + for index, fn := range d.breakFns { + t.Run(fmt.Sprintf("breakFns[%d]", index), func(t *testing.T) { + var tmp mSI + err := json.Unmarshal(validJSON, &tmp) + require.NoError(t, err) - fn(tmp) + fn(tmp) - dest := d.newDest() - assertJSONUnmarshalFromObjectFails(t, tmp, dest) + dest := d.newDest() + assertJSONUnmarshalFromObjectFails(t, tmp, dest) + }) } // Duplicated fields
Add context to some test failures ... to make it easier to figure out which of breakFns failed.
containers_image
train
go
f77e2d15d7163107c972a36eeb3065d3239f0dd6
diff --git a/container_copy.go b/container_copy.go index <HASH>..<HASH> 100644 --- a/container_copy.go +++ b/container_copy.go @@ -38,6 +38,10 @@ func (cli *Client) CopyToContainer(ctx context.Context, container, path string, query.Set("noOverwriteDirNonDir", "true") } + if options.CopyUIDGID { + query.Set("copyUIDGID", "true") + } + apiPath := fmt.Sprintf("/containers/%s/archive", container) response, err := cli.putRaw(ctx, apiPath, query, content, nil)
daemon/archive.go: Fix copy routines to preserve UID. This changes the long-standing bug of copy operations not preserving the UID/GID information after the files arrive to the container.
docker_cli
train
go
93961fd233717c01e3c8073e9866ccdedd007d6d
diff --git a/ceph/cephfs/cephfs-provisioner.go b/ceph/cephfs/cephfs-provisioner.go index <HASH>..<HASH> 100644 --- a/ceph/cephfs/cephfs-provisioner.go +++ b/ceph/cephfs/cephfs-provisioner.go @@ -170,7 +170,9 @@ func (p *cephFSProvisioner) Delete(volume *v1.PersistentVolume) error { return errors.New("ceph share annotation not found on PV") } // delete CephFS - class, err := p.client.Storage().StorageClasses().Get(v1.GetPersistentVolumeClass(volume), metav1.GetOptions{}) + // TODO when beta is removed, have to check kube version and pick v1/beta + // accordingly: maybe the controller lib should offer a function for that + class, err := p.client.StorageV1beta1().StorageClasses().Get(v1.GetPersistentVolumeClass(volume), metav1.GetOptions{}) if err != nil { return err }
Use storage v1beta1 client interface for compatibility with kube >=<I>
kubernetes-incubator_external-storage
train
go
33dc9a4a05b7965e157263a45158c3ad7fbe4a3d
diff --git a/packages/data-mate/bench/src.js b/packages/data-mate/bench/src.js index <HASH>..<HASH> 100644 --- a/packages/data-mate/bench/src.js +++ b/packages/data-mate/bench/src.js @@ -1,4 +1,3 @@ 'use strict'; -// module.exports = require('../dist/src'); -module.exports = require('/Users/peter/tmp/data-mate/node_modules/@terascope/data-mate'); +module.exports = require('../dist/src');
Revert change to bench/src
terascope_teraslice
train
js
58f93bdf764753da6821c0b32c1803a2c7a78d0b
diff --git a/go/vt/sqlparser/parsed_query_test.go b/go/vt/sqlparser/parsed_query_test.go index <HASH>..<HASH> 100644 --- a/go/vt/sqlparser/parsed_query_test.go +++ b/go/vt/sqlparser/parsed_query_test.go @@ -5,6 +5,7 @@ package sqlparser import ( + "reflect" "testing" "github.com/youtube/vitess/go/sqltypes" @@ -194,3 +195,19 @@ func TestParsedQuery(t *testing.T) { } } } + +func TestGenerateParsedQuery(t *testing.T) { + stmt, err := Parse("select * from a where id =:id") + if err != nil { + t.Error(err) + return + } + pq := GenerateParsedQuery(stmt) + want := &ParsedQuery{ + Query: "select * from a where id = :id", + bindLocations: []bindLocation{{offset: 27, length: 3}}, + } + if !reflect.DeepEqual(pq, want) { + t.Errorf("GenerateParsedQuery: %+v, want %+v", pq, want) + } +}
sqlparser: add test for coverage
vitessio_vitess
train
go