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
4d1d74ba2bac21cfdc5f54c031ef36839f109fc2
diff --git a/salt/cli/__init__.py b/salt/cli/__init__.py index <HASH>..<HASH> 100644 --- a/salt/cli/__init__.py +++ b/salt/cli/__init__.py @@ -523,7 +523,6 @@ class SaltCall(object): opts['grains_run'] = options.grains opts['module_dirs'] = options.module_dirs.split(',') opts['doc'] = options.doc - opts['log_level'] = options.log_level opts['raw_out'] = options.raw_out opts['txt_out'] = options.txt_out opts['yaml_out'] = options.yaml_out @@ -533,6 +532,7 @@ class SaltCall(object): else: opts['json_out'] = False opts.update(salt.config.minion_config(options.config)) + opts['log_level'] = options.log_level if len(args) >= 1: opts['fun'] = args[0] opts['arg'] = args[1:]
Doh! Move config file overwite to after config loading
saltstack_salt
train
py
315460a374eeb3d5f5ee329d22a63251661753cb
diff --git a/src/feat/agents/base/agent.py b/src/feat/agents/base/agent.py index <HASH>..<HASH> 100644 --- a/src/feat/agents/base/agent.py +++ b/src/feat/agents/base/agent.py @@ -21,6 +21,8 @@ # Headers in this file shall remain intact. # -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 +import os +import sys import types from zope.interface import implements @@ -519,3 +521,25 @@ class BaseAgent(mro.FiberMroMixin, log.Logger, log.LogProxy, replay.Replayable, state.medium.register_interest, replier.ProposalReceiver) return f.succeed() + + +class StandalonePartners(Partners): + + default_role = u'standalone' + + +class Standalone(BaseAgent): + + partners_class = StandalonePartners + + standalone = True + + @staticmethod + def get_cmd_line(desc): + python_path = ":".join(sys.path) + path = os.environ.get("PATH", "") + + command = 'feat' + args = ['-X', '--agent-id', str(desc.doc_id)] + env = dict(PYTHONPATH=python_path, FEAT_DEBUG='5', PATH=path) + return command, args, env
Define a base class for simple standalone agents.
f3at_feat
train
py
1ee3276aac3e51a84ffb68c1b1705595fb7b8721
diff --git a/pyiso.py b/pyiso.py index <HASH>..<HASH> 100644 --- a/pyiso.py +++ b/pyiso.py @@ -1592,7 +1592,14 @@ class PyIso(object): # Next we write out the Volume Descriptor Terminators. for vdst in self.vdsts: outfp.write(vdst.record()) - outfp.write(pad(2048, 4096)) + + # Next we write out the version block. + # FIXME: In genisoimage, write.c:vers_write(), this "version descriptor" + # is written out with the exact command line used to create the ISO + # (if in debug mode, otherwise it is all zero). However, there is no + # mention of this in any of the specifications I've read so far. Where + # does it come from? + outfp.write("\x00" * 2048) # Next we write out the Path Table Records, both in Little Endian and # Big-Endian formats. We do this within the same loop, seeking back
Add in another FIXME comment.
clalancette_pycdlib
train
py
158dba9ecb749ee38a939b1159ef29146cc003d9
diff --git a/test/vanity_test.rb b/test/vanity_test.rb index <HASH>..<HASH> 100644 --- a/test/vanity_test.rb +++ b/test/vanity_test.rb @@ -108,12 +108,16 @@ describe Vanity do f.write(connection_config) end - Vanity.reset! - Vanity.disconnect! - Vanity::Connection.stubs(:new) - Vanity.connect! + out, _err = capture_io do + Vanity.reset! + Vanity.configuration.logger = Logger.new($stdout) + Vanity.disconnect! + Vanity::Connection.stubs(:new) + Vanity.connect! + end assert_equal false, Vanity.configuration.collecting + assert_match(/Deprecated/, out) end end end @@ -178,4 +182,4 @@ describe Vanity do refute_same original_configuration, Vanity.reload! end end -end \ No newline at end of file +end
Silence deprecation warnings from legacy connecting test This test involves resetting Vanity, which sets a new logger at the default level. This means that the legacy configuration method it supports prints a deprecation to the test output. We can capture the IO and assert the presence of a deprecation message instead using minitest's #capture_io, setting a new logger within the captured block.
assaf_vanity
train
rb
bf6b9ba4022516bcd4839a6ccbb9b7d2772aee14
diff --git a/src/js/plugins/tooltipster/SVG/tooltipster-SVG.js b/src/js/plugins/tooltipster/SVG/tooltipster-SVG.js index <HASH>..<HASH> 100644 --- a/src/js/plugins/tooltipster/SVG/tooltipster-SVG.js +++ b/src/js/plugins/tooltipster/SVG/tooltipster-SVG.js @@ -32,10 +32,13 @@ $.tooltipster.plugin({ if (event.instance.content() === null) { // TODO: when there are several <title> tags (not supported in - // today's browsers yet though, still an RFC drat), pick the right - // one based on the "lang" attribute - var content = $origin.find('title').text(); - event.instance.content(content); + // today's browsers yet though, still an RFC draft), pick the right + // one based on its "lang" attribute + var $title = $origin.find('title'); + + if ($title[0]) { + event.instance.content($title.text()); + } } // rectify the geometry if SVG.js and its screenBBox plugin have been included
if there is no svg title either
iamceege_tooltipster
train
js
375aca8cf6d2f3bdf243d98ac82b73cd89ffd278
diff --git a/hazelcast/src/main/java/com/hazelcast/core/LifecycleService.java b/hazelcast/src/main/java/com/hazelcast/core/LifecycleService.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/core/LifecycleService.java +++ b/hazelcast/src/main/java/com/hazelcast/core/LifecycleService.java @@ -29,7 +29,8 @@ public interface LifecycleService { boolean isRunning(); /** - * gracefully shutdowns HazelcastInstance. Different from {@link #terminate()}, it waits for partition operations to be completed. + * gracefully shutdowns HazelcastInstance. Different from {@link #terminate()}, + * it waits for partition operations to be completed. */ void shutdown();
Fixed checkstyle issue: com/hazelcast/core/LifecycleService.java:<I>: Line is longer than <I> characters (found <I>).
hazelcast_hazelcast
train
java
6b9d3abd9cfde1ef7040f61600f95a6b03ce9da7
diff --git a/hazelcast/src/main/java/com/hazelcast/core/PartitionAwareKey.java b/hazelcast/src/main/java/com/hazelcast/core/PartitionAwareKey.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/core/PartitionAwareKey.java +++ b/hazelcast/src/main/java/com/hazelcast/core/PartitionAwareKey.java @@ -31,6 +31,10 @@ public final class PartitionAwareKey<K,P> implements PartitionAware<Object>, Dat this.partitionKey = ValidationUtil.isNotNull(partitionKey,"partitionKey"); } + //constructor needed for deserialization. + private PartitionAwareKey(){ + } + public K getKey() { return key; }
Added no arg constructor to PartitionAwareKey for deserialization
hazelcast_hazelcast
train
java
4af4955abb5ef4d9f6ebba632aa17070bbc247de
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup setup(name='dtw', - version='1.1', + version='1.2', description='Python DTW Module', author='Pierre Rouanet', author_email='pierre.rouanet@gmail.com',
Bump to version <I>
pierre-rouanet_dtw
train
py
3b87091492a5b883fa2b5d62f8bac1a98719b4de
diff --git a/openstack-api/src/main/java/org/openstack/client/common/JerseyClient.java b/openstack-api/src/main/java/org/openstack/client/common/JerseyClient.java index <HASH>..<HASH> 100644 --- a/openstack-api/src/main/java/org/openstack/client/common/JerseyClient.java +++ b/openstack-api/src/main/java/org/openstack/client/common/JerseyClient.java @@ -14,13 +14,12 @@ import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.LoggingFilter; import com.sun.jersey.api.json.JSONConfiguration; import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.DeserializationConfig; -enum JerseyClient { +public final class JerseyClient { - INSTANCE; + public static final JerseyClient INSTANCE = new JerseyClient(); - private Client client; + final Client client; private JerseyClient() { ClientConfig config = new DefaultClientConfig();
Avoid FindBugs warning about serializability
woorea_openstack-java-sdk
train
java
d936b9e125660d2983190732c815a75773cbe37c
diff --git a/test/www/jxcore/bv_tests/testThaliNotificationLocal.js b/test/www/jxcore/bv_tests/testThaliNotificationLocal.js index <HASH>..<HASH> 100644 --- a/test/www/jxcore/bv_tests/testThaliNotificationLocal.js +++ b/test/www/jxcore/bv_tests/testThaliNotificationLocal.js @@ -1,5 +1,5 @@ 'use strict'; -var tape = require('../lib/thali-tape'); +var tape = require('../lib/thaliTape'); var express = require('express'); var crypto = require('crypto'); var sinon = require('sinon');
Fixed thali-tape require to thaliTape
thaliproject_Thali_CordovaPlugin
train
js
cc3ea46058aafe6bdcf47a3f1bf1215432d86698
diff --git a/salt/state.py b/salt/state.py index <HASH>..<HASH> 100644 --- a/salt/state.py +++ b/salt/state.py @@ -717,7 +717,7 @@ class HighState(object): return opts mopts = self.client.master_opts() opts['renderer'] = mopts['renderer'] - opts['failhard'] = mopts['failhard'] + opts['failhard'] = mopts.get('failhard', False) if mopts['state_top'].startswith('salt://'): opts['state_top'] = mopts['state_top'] elif mopts['state_top'].startswith('/'):
fix issue is master is old and does not have failhard
saltstack_salt
train
py
4a9cb288df91cf338f3bf9266b8de4fc8e3bb9c6
diff --git a/spec/adhearsion/call_spec.rb b/spec/adhearsion/call_spec.rb index <HASH>..<HASH> 100644 --- a/spec/adhearsion/call_spec.rb +++ b/spec/adhearsion/call_spec.rb @@ -534,6 +534,15 @@ module Adhearsion (Time.now - starting_time).should >= 0.5 end + it "does not block the whole actor while waiting for a response" do + slow_command = Punchblock::Command::Dial.new + slow_command.request! + fut = subject.future.write_and_await_response slow_command + subject.id.should == call_id + slow_command.response = response + fut.value + end + describe "with a successful response" do it "returns the executed command" do subject.write_and_await_response(message).should be message
[BUGFIX] Add test coverage for command responses not blocking call actors #<I>
adhearsion_adhearsion
train
rb
0ad7c24aa394249a5213a8e11a826821d4b56266
diff --git a/src/structures/User.js b/src/structures/User.js index <HASH>..<HASH> 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -141,7 +141,7 @@ class User extends Base { } /** - * The Discord "tag" (e.g. `hydrabolt#0086`) for this user + * The Discord "tag" (e.g. `hydrabolt#0001`) for this user * @type {string} * @readonly */
docs(User): fix hydrabolt's tag (#<I>)
discordjs_discord.js
train
js
d977a187946b8aa32f6fdf28180990d1f7b6057e
diff --git a/lib/peace_love/document.rb b/lib/peace_love/document.rb index <HASH>..<HASH> 100644 --- a/lib/peace_love/document.rb +++ b/lib/peace_love/document.rb @@ -78,13 +78,14 @@ module PeaceLove when :array # XXX - this is ok for now... we really need to typecheck, perhaps wrap in a smart-array obj ||= [] - obj = obj.map {|elt| extend_doc(elt, mod, parent_obj)} + puts "mixing in array" + obj.map! {|elt| extend_doc(elt, mod, parent_obj)} when :hash obj ||= {} - obj = obj.inject(AngryHash.new) do |h,(k,elt)| + obj.replace( obj.inject(AngryHash.new) do |h,(k,elt)| h[k] = extend_doc(elt,mod,parent_obj) h - end + end ) end end
mixing in to arrays & hashes replaces contents
lachie_peace_love
train
rb
17d2f27271818b15de4670a149b50f1f9860823e
diff --git a/src/js/mixin/slider-drag.js b/src/js/mixin/slider-drag.js index <HASH>..<HASH> 100644 --- a/src/js/mixin/slider-drag.js +++ b/src/js/mixin/slider-drag.js @@ -5,6 +5,7 @@ import { includes, isRtl, isTouch, + noop, off, on, selInput, @@ -14,7 +15,7 @@ import { const pointerOptions = { passive: false, capture: true }; const pointerDown = 'touchstart mousedown'; const pointerMove = 'touchmove mousemove'; -const pointerUp = 'touchend touchcancel mouseup click input scroll'; +const pointerUp = 'touchend touchcancel mouseup click input'; export default { props: { @@ -70,6 +71,16 @@ export default { e.preventDefault(); }, }, + + { + // iOS workaround for slider stopping if swiping fast + name: `${pointerMove} ${pointerUp}`, + el() { + return this.list; + }, + handler: noop, + ...pointerOptions, + }, ], methods: { @@ -172,7 +183,7 @@ export default { } }, - end(e) { + end() { off(document, pointerMove, this.move, pointerOptions); off(document, pointerUp, this.end, pointerOptions);
fix: dragging in Slider component on iOS
uikit_uikit
train
js
51c868e693dedfef7de32cc8992c819124531893
diff --git a/modules/system/assets/js/framework.js b/modules/system/assets/js/framework.js index <HASH>..<HASH> 100644 --- a/modules/system/assets/js/framework.js +++ b/modules/system/assets/js/framework.js @@ -390,7 +390,7 @@ if (window.jQuery === undefined) } }) - $(document).on('keyup', 'input[type=text][data-request][data-track-input], input[type=password][data-request][data-track-input]', function(e){ + $(document).on('keyup', 'input[type=text][data-request][data-track-input], input[type=password][data-request][data-track-input], input[type=number][data-request][data-track-input]', function(e){ var $el = $(this), lastValue = $el.data('oc.lastvalue')
Adds input types to data-track-input options I need this input type, and it would be handy if I could use it with data-track-input. I promise this will be the last time I ask you to touch your priceless faberge egg ;)
octobercms_october
train
js
6bb8eb2266aeb3d4088ae7af4488bd52bc454d65
diff --git a/src/Validator.php b/src/Validator.php index <HASH>..<HASH> 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -83,13 +83,20 @@ class Validator implements IValidator */ public function schemaValidation($data, ISchema $schema, int $max_errors = 1, ISchemaLoader $loader = null): ValidationResult { - $default_loader = $this->loader; + $bag = new ValidationResult($max_errors); + if ($loader !== null) { + $default_loader = $this->loader; $this->loader = $loader; + try { + $this->validateSchema($data, $data, [], [], $schema, $schema->resolve(), $bag); + } finally { + $this->loader = $default_loader; + } + } else { + $this->validateSchema($data, $data, [], [], $schema, $schema->resolve(), $bag); } - $bag = new ValidationResult($max_errors); - $this->validateSchema($data, $data, [], [], $schema, $schema->resolve(), $bag); - $this->loader = $default_loader; + return $bag; }
Fix opis/json-schema#<I> Added a try-finally block into Validator::schemaValidation() so that the exception-thrower validateSchema() doesn't prevent the temporarily replaced loader from restoring. Also, reshaped the code slightly, as suggested by @sorinsarca.
opis_json-schema
train
php
78e254dd3d8143ec0fce25b231b05dad04d5b502
diff --git a/api/src/main/java/org/syphr/mythtv/api/backend/Recording.java b/api/src/main/java/org/syphr/mythtv/api/backend/Recording.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/org/syphr/mythtv/api/backend/Recording.java +++ b/api/src/main/java/org/syphr/mythtv/api/backend/Recording.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; import org.syphr.mythtv.data.PixMap; import org.syphr.mythtv.data.Program; @@ -44,6 +45,15 @@ public class Recording return program; } + public RecordingByteChannel getByteChannel(boolean readAhead, long timeout, TimeUnit unit) throws IOException, + CommandException + { + return new RecordingByteChannel(protocol, + program, + readAhead, + TimeUnit.MILLISECONDS.convert(timeout, unit)); + } + public boolean isCurrentlyRecording() throws IOException { return protocol.checkRecording(program) > 0;
added a method to get the byte channel of a recording
syphr42_libmythtv-java
train
java
79e22ed37fc668fa1f80a270dd5cb089ddad4d2a
diff --git a/lib/notify_on/notify_on.rb b/lib/notify_on/notify_on.rb index <HASH>..<HASH> 100644 --- a/lib/notify_on/notify_on.rb +++ b/lib/notify_on/notify_on.rb @@ -10,8 +10,7 @@ class << ActiveRecord::Base attr_accessor :skip_notifications - case action.to_sym - when :create + if action.to_sym == :create method_name = "notify_#{options[:to]}_on_create" after_create(method_name.to_sym) define_method(method_name) { create_notify_on_notifications(options) } @@ -21,7 +20,8 @@ class << ActiveRecord::Base method_name = "notify_#{options[:to]}_on_#{action_to_s}_when_#{when_to_s}" after_save(method_name.to_sym) define_method(method_name) do - return unless send(action) && send(options[:when]) + return unless action.to_sym == :save || send(action) + return unless options[:when].present? && send(options[:when]) create_notify_on_notifications(options) end end
allow "save" as an action
BrilliantChemistry_NotifyOn
train
rb
63ec60980039059b0b1cc72d3a3578a7c81bc6f9
diff --git a/zk_shell/shell.py b/zk_shell/shell.py index <HASH>..<HASH> 100644 --- a/zk_shell/shell.py +++ b/zk_shell/shell.py @@ -735,6 +735,7 @@ class Shell(XCmd): start = len(results) + params.top if abs(params.top) < len(results) else 0 end = len(results) + offs = 1 if params.path == "/" else len(params.path) + 1 for i in range(start, end): path, stat = results[i] @@ -743,7 +744,7 @@ class Shell(XCmd): time.ctime(stat.created).ljust(32), time.ctime(stat.last_modified).ljust(32), ("0x%x" % stat.ephemeralOwner).ljust(23), - path[len(params.path) + 1:] + path[offs:] ) def complete_summary(self, cmd_param_text, full_cmd, *rest):
Fix off-by-one for summary of /
rgs1_zk_shell
train
py
41469f699f2b007f8f0f640c1f4f2195df9aab43
diff --git a/lib/nio.rb b/lib/nio.rb index <HASH>..<HASH> 100644 --- a/lib/nio.rb +++ b/lib/nio.rb @@ -12,9 +12,28 @@ module NIO def self.engine ENGINE end + + def self.pure?(env = ENV) + # The user has explicitly opted in to non-native implementation: + if env["NIO4R_PURE"] == "true" + return true + end + + # Native Ruby on Windows is not supported: + if (Gem.win_platform? && !defined?(JRUBY_VERSION)) + return true + end + + # M1 native extension is crashing on M1 (arm64): + if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/ + return true + end + + return false + end end -if ENV["NIO4R_PURE"] == "true" || (Gem.win_platform? && !defined?(JRUBY_VERSION)) || (RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/) +if NIO.pure? require "nio/monitor" require "nio/selector" require "nio/bytebuffer"
Be more explicit with why `pure?` is being used.
socketry_nio4r
train
rb
f4627d7a806307d1f6de84a90b0357028dd30357
diff --git a/salt/modules/win_pkg.py b/salt/modules/win_pkg.py index <HASH>..<HASH> 100644 --- a/salt/modules/win_pkg.py +++ b/salt/modules/win_pkg.py @@ -868,7 +868,7 @@ def _repo_process_pkg_sls(filename, short_path_name, ret, successful_verbose): renderers = salt.loader.render(__opts__, __salt__) def _failed_compile(prefix_msg, error_msg): - log.error('{} \`{}\`: {} '.format(prefix_msg, short_path_name, error_msg)) + log.error('{} \'{}\': {} '.format(prefix_msg, short_path_name, error_msg)) ret.setdefault('errors', {})[short_path_name] = ['{}, {} '.format(prefix_msg, error_msg)] return False
fix quote i.e. change \` to \'
saltstack_salt
train
py
9785f44b07ae0e7f783eb46466dbd6dd135b61a8
diff --git a/test/full_test.py b/test/full_test.py index <HASH>..<HASH> 100755 --- a/test/full_test.py +++ b/test/full_test.py @@ -95,8 +95,8 @@ def run_canonical_tests(mode, checker, protocol, cores, slices): "cores" : cores, "slices" : slices, "duration" : dur, - "verify-timeout": dur * 4 * ec2 + 200 }, - repeat=2, timeout=dur * 4 * ec2 + 200) + "verify-timeout": dur * 5 * ec2 + 290 }, + repeat=2, timeout=dur * 5 * ec2 + 290) # Running all tests def run_all_tests(mode, checker, protocol, cores, slices):
Allow more time for corruption test, as pylibmc apparently is somewhat slower than memcache.
rethinkdb_rethinkdb
train
py
f2d6f609bab41fcdb0f1487c52b94a3e56a8274f
diff --git a/embark-ui/src/components/Preview.js b/embark-ui/src/components/Preview.js index <HASH>..<HASH> 100644 --- a/embark-ui/src/components/Preview.js +++ b/embark-ui/src/components/Preview.js @@ -1,5 +1,6 @@ import React from 'react'; import {Button, InputGroup, Input, InputGroupAddon} from 'reactstrap'; +import FontAwesome from 'react-fontawesome'; class Preview extends React.Component { constructor(props) { @@ -31,9 +32,11 @@ class Preview extends React.Component { <InputGroup> <Input placeholder="URL" value={this.state.previewUrl} - onChange={(e) => this.handlePreviewUrlChange(e)} /> + onChange={(e) => this.handlePreviewUrlChange(e)}/> <InputGroupAddon addonType="append"> - <Button className="ml-auto" color="primary" onClick={(e) => this.handlePreviewGo(e)}>Go</Button> + <Button className="ml-auto" color="primary" onClick={(e) => this.handlePreviewGo(e)}> + <FontAwesome name="refresh"/> + </Button> </InputGroupAddon> </InputGroup> <iframe width="100%"
chore(browser): change Go to refresh since that's what they do
embark-framework_embark
train
js
e50235b08333f988c392158f8341533c252605e5
diff --git a/app/observers/AddRewriteRules.php b/app/observers/AddRewriteRules.php index <HASH>..<HASH> 100644 --- a/app/observers/AddRewriteRules.php +++ b/app/observers/AddRewriteRules.php @@ -26,6 +26,8 @@ class AddRewriteRules } $update = function() use ( $app ) { + global $wp_rewrite; + foreach ( $app->rewrite_rules as $regexp => $matches ) { $i = (int) ArrayHelper::remove( $matches, 'matches_position', 1 ); $query_string = ArrayHelper::remove( $matches, 'query_string', 'index.php?' ); @@ -51,11 +53,10 @@ class AddRewriteRules add_rewrite_rule( $regexp, $query, $priority ); } + + $wp_rewrite->flush_rules(); }; add_action('init', $update ); - - global $wp_rewrite; - $wp_rewrite->flush_rules(); } -} \ No newline at end of file +}
Fix bug in AddRewriteRules.php $wp_rewrite->flush_rules() need to be called with init hook.
nikonorovsv_wpf
train
php
f2490de3c89bdf8b9a1bff6807d241f15653f85a
diff --git a/packages/sproutcore-metal/tests/observer_test.js b/packages/sproutcore-metal/tests/observer_test.js index <HASH>..<HASH> 100644 --- a/packages/sproutcore-metal/tests/observer_test.js +++ b/packages/sproutcore-metal/tests/observer_test.js @@ -151,6 +151,7 @@ testBoth('addObserver should preserve additional context passed when firing the didChange: function(obj, keyName, value, ctx1, ctx2) { equals(ctx1, "biff", "first context is passed"); equals(ctx2, "bang", "second context is passed"); + equals(5, arguments.length); this.count++; } }; @@ -159,6 +160,9 @@ testBoth('addObserver should preserve additional context passed when firing the set(observed, 'foo', 'BAZ'); equals(target1.count, 1, 'target1 observer should have fired'); + + set(observed, 'foo', 'BAZ2'); + equals(target1.count, 2, 'target1 observer should have fired'); });
Update unit test to demonstrate bug. The length of the arguments array grows longer every time the observer fires.
emberjs_ember.js
train
js
3cc321e877fc53d580be0fd5c3b4130502fca580
diff --git a/examples/iyyer_dan.py b/examples/iyyer_dan.py index <HASH>..<HASH> 100644 --- a/examples/iyyer_dan.py +++ b/examples/iyyer_dan.py @@ -71,8 +71,9 @@ class Extractor(object): all_words[id_] += 1 if sum(bow.values()) < 1: bow = all_words - # Normalize for frequency + # Normalize for frequency and adjust for dropout total = sum(bow.values()) + total *= 1-dropout for word, freq in bow.items(): bow[word] = float(freq) / total return bow
* Add dropout-adjustment to DAN
explosion_thinc
train
py
97ebeaaa531786258cc5ea2501f040db1fa1b5e5
diff --git a/avatar/views.py b/avatar/views.py index <HASH>..<HASH> 100644 --- a/avatar/views.py +++ b/avatar/views.py @@ -29,6 +29,7 @@ except ImportError: MAX_MEGABYTES = getattr(settings, 'AVATAR_MAX_FILESIZE', 10) MAX_WIDTH = getattr(settings, 'AVATAR_MAX_WIDTH', 512) DEFAULT_WIDTH = getattr(settings, 'AVATAR_DEFAULT_WIDTH', 80) +#AVATAR_CACHE def _get_next(request): """ @@ -66,6 +67,8 @@ def img(request, email_hash, resize_method=Image.ANTIALIAS): avatar = Avatar.objects.get(email_hash=email_hash) except Avatar.DoesNotExist: avatar = None + except Avatar.MultipleObjectsReturned: + avatar = None try: if avatar is not None: data = open(avatar.get_avatar_filename(), 'r').read()
Handle the MultipleObjectsReturned edge case (shouldn't happen, but it might) git-svn-id: <URL>
GeoNode_geonode-avatar
train
py
7071e3425cca31048a7a45b945d8ddcb8e76a562
diff --git a/salt/utils/pkg/rpm.py b/salt/utils/pkg/rpm.py index <HASH>..<HASH> 100644 --- a/salt/utils/pkg/rpm.py +++ b/salt/utils/pkg/rpm.py @@ -104,8 +104,12 @@ def parse_pkginfo(line, osarch=None): if epoch not in ('(none)', '0'): version = ':'.join((epoch, version)) - install_date = datetime.datetime.utcfromtimestamp(int(install_time)).isoformat() + "Z" - install_date_time_t = int(install_time) + if install_time: + install_date = datetime.datetime.utcfromtimestamp(int(install_time)).isoformat() + "Z" + install_date_time_t = int(install_time) + else: + install_date = None + install_date_time_t = None return pkginfo(name, version, arch, repoid, install_date, install_date_time_t)
Checking install_time for None value RedHat systems might in some cases return None as install_time, which would cause a ValueError. We are checking for None now. install_date and install_date_time are being set to None in that case.
saltstack_salt
train
py
63a107381291f8fc0442a098a35bb3cb28882bb1
diff --git a/gwpy/io/cache.py b/gwpy/io/cache.py index <HASH>..<HASH> 100644 --- a/gwpy/io/cache.py +++ b/gwpy/io/cache.py @@ -275,8 +275,12 @@ def is_cache(cache): if isinstance(cache, (str,) + FILE_LIKE): try: return bool(len(read_cache(cache))) - except (TypeError, ValueError, UnicodeDecodeError, ImportError): - # failed to parse cache + except ( + OSError, # failed to read file + TypeError, # failed to parse a line as a cache entry + UnicodeDecodeError, # failed to decode file + ValueError, # failed to parse a line as a cache entry + ): return False if HAS_CACHE and isinstance(cache, Cache): return True
gwpy.io: handle more errors in is_cache() return `False` if reading the file fails for any reason (something downstream will give a better error)
gwpy_gwpy
train
py
240a36f329b450ef4e99d488094ec107dd1264b3
diff --git a/src/kba/pipeline/_clean_html.py b/src/kba/pipeline/_clean_html.py index <HASH>..<HASH> 100644 --- a/src/kba/pipeline/_clean_html.py +++ b/src/kba/pipeline/_clean_html.py @@ -300,13 +300,21 @@ def clean_html(config): ## make a closure around config def _make_clean_html(stream_item): code = config.get('require_language_code', None) - if code: + allow_null = config.get('allow_null_language_code', False) + + if code and not allow_null: ## need to check stream_item for language if not stream_item.body.language or \ code != stream_item.body.language.code: ## either missing or different return stream_item + elif code and allow_null: + if stream_item.body.language and \ + code != stream_item.body.language.code: + ## has code and not the right one + return stream_item + if stream_item.body and stream_item.body.raw \ and stream_item.body.media_type == 'text/html':
adding allow_null_language_code as config param that will cause all the documents that CLD cannot recognize to get tagged and processed by the pipeline. This is important, because it turns out that about a third of the vital results for our entities are in language='' documents! Yes... this means that after we finish processing, we are going to have to do a second pass to catch all the language='' docs that we ignored previously. :-/
trec-kba_streamcorpus-pipeline
train
py
7b9f13c8ec62d8d541ade866affce9ffa83aefce
diff --git a/instaLooter.py b/instaLooter.py index <HASH>..<HASH> 100644 --- a/instaLooter.py +++ b/instaLooter.py @@ -208,8 +208,9 @@ class InstaLooter(object): self.session.close() except ReferenceError: pass - for worker in self._workers: - worker.kill() + if hasattr(self, "_workers"): + for worker in self._workers: + worker.kill() if hasattr(self, '_pbar'): self._pbar.finish() diff --git a/tests/test_instaLooter.py b/tests/test_instaLooter.py index <HASH>..<HASH> 100644 --- a/tests/test_instaLooter.py +++ b/tests/test_instaLooter.py @@ -52,8 +52,8 @@ class TestInstaLooterHashtagDownload(unittest.TestCase): shutil.rmtree(self.tmpdir) def test_hashtag_download(self): - looter = instaLooter.InstaLooter(self.tmpdir, hashtag="python", get_videos=True, num_to_dl=200) - looter.download() + looter = instaLooter.InstaLooter(self.tmpdir, hashtag="python", get_videos=True) + looter.download(media_count=200) self.assertEqual(len(os.listdir(self.tmpdir)), 200)
Fix InstaLooter.__del__ method failing when no workers were created
althonos_InstaLooter
train
py,py
d5bef71d41412f129883496f0e0b8ecf0ace4f88
diff --git a/viewport-units-buggyfill.js b/viewport-units-buggyfill.js index <HASH>..<HASH> 100755 --- a/viewport-units-buggyfill.js +++ b/viewport-units-buggyfill.js @@ -131,6 +131,14 @@ options.isMobileSafari = isMobileSafari; options.isBadStockAndroid = isBadStockAndroid; + if (options.ignoreVmax && !options.force && !isOldIE) { + // modern IE (10 and up) do not support vmin/vmax, + // but chances are this unit is not even used, so + // allow overwriting the "hacktivation" + // https://github.com/rodneyrehm/viewport-units-buggyfill/issues/56 + isBuggyIE = false; + } + if (isOldIE || (!options.force && !isMobileSafari && !isBuggyIE && !isBadStockAndroid && !isOperaMini && (!options.hacks || !options.hacks.required(options)))) { // this buggyfill only applies to mobile safari, IE9-10 and the Stock Android Browser. if (window.console && isOldIE) {
fix(polyfill): adding option ignoreVmax to deliberately not engage the hacks on IE9+ - closes #<I>
rodneyrehm_viewport-units-buggyfill
train
js
9049931ce86f9eaa5e37d27e7ca1a48270c03db8
diff --git a/core/Controller/CookieController.php b/core/Controller/CookieController.php index <HASH>..<HASH> 100644 --- a/core/Controller/CookieController.php +++ b/core/Controller/CookieController.php @@ -44,25 +44,31 @@ class CookieController setcookie($name, $value, $expire, '/'); } + + public function destroyCookie(string $name) + { + if ($this->cookie[$name] !== null) { + + $this->createCookie($name, '', time() - 3600); + } + } + /** - * @param string $name * @return mixed */ - public function readCookie(string $name) + public function getCookieArray() { - return $this->cookie[$name]; + return $this->cookie; } + /** - * @param string $name - * @return bool + * @param string $var + * @return mixed */ - public function deleteCookie(string $name) + public function getCookieVar(string $var) { - if ($this->cookie[$name] !== null) { - - $this->createCookie($name, '', time() - 3600); - } + return $this->cookie[$var]; } /** @@ -90,7 +96,7 @@ class CookieController echo filter_var($this->alert); - $this->deleteCookie('alert'); + $this->destroyCookie('alert'); } } }
Refactoring CookieController to implement array getter
philippebeck_pam
train
php
4604af3e16e000217b854c4bc363b90964e74587
diff --git a/lib/simple_bootstrap_form/horizontal_form/form_builder.rb b/lib/simple_bootstrap_form/horizontal_form/form_builder.rb index <HASH>..<HASH> 100644 --- a/lib/simple_bootstrap_form/horizontal_form/form_builder.rb +++ b/lib/simple_bootstrap_form/horizontal_form/form_builder.rb @@ -2,10 +2,10 @@ module SimpleBootstrapForm module HorizontalForm class FormBuilder < ActionView::Helpers::FormBuilder - def initialize(object_name, object, template, options={}, block=nil) + def initialize(object_name, object, template, options={}) @field_factory = FieldFactory.new self, template process_options options - super object_name, object, template, options_for_rails_form_builder, block + super object_name, object, template, options_for_rails_form_builder end def input(name, supplied_options = {})
Remove block argument from form_builder.new which has recently disappeared from Rails, it seems
sampierson_simple_bootstrap_form
train
rb
238a568287d78258e775da7360b81fc0886af10b
diff --git a/auth/basicauth.go b/auth/basicauth.go index <HASH>..<HASH> 100644 --- a/auth/basicauth.go +++ b/auth/basicauth.go @@ -19,7 +19,7 @@ var ( func parseAuthHeader(header string) (*BasicAuth, error) { parts := strings.SplitN(header, " ", 2) - if len(parts) > 2 { + if len(parts) < 2 { return nil, fmt.Errorf("Invalid authorization header, not enought parts") }
Fix issue with basicauth's parseAuthHeader
AaronO_go-git-http
train
go
0f45a70fd9b7b1173834d5c83858bf3f50af852c
diff --git a/resources/js/base.js b/resources/js/base.js index <HASH>..<HASH> 100644 --- a/resources/js/base.js +++ b/resources/js/base.js @@ -44,6 +44,6 @@ export default { */ readableTimestamp(timestamp) { return this.formatDate(timestamp).format('YYYY-MM-DD HH:mm:ss'); - } + }, }, };
Apply fixes from StyleCI (#<I>)
laravel_horizon
train
js
9c67104809b9ad9a7fa758d518c2dd5c25be8e56
diff --git a/src/Client/OAuth2Client.php b/src/Client/OAuth2Client.php index <HASH>..<HASH> 100644 --- a/src/Client/OAuth2Client.php +++ b/src/Client/OAuth2Client.php @@ -92,7 +92,7 @@ class OAuth2Client implements OAuth2ClientInterface { if (!$this->isStateless()) { $expectedState = $this->getSession()->get(self::OAUTH2_SESSION_STATE_KEY); - $actualState = $this->getCurrentRequest()->query->get('state'); + $actualState = $this->getCurrentRequest()->get('state'); if (!$actualState || ($actualState !== $expectedState)) { throw new InvalidStateException('Invalid state'); }
Look for both POST and GET params when getting state
knpuniversity_oauth2-client-bundle
train
php
ce70016ed52b844782dcb4eeb50696ba089ec5a3
diff --git a/py/pyahocorasick.py b/py/pyahocorasick.py index <HASH>..<HASH> 100644 --- a/py/pyahocorasick.py +++ b/py/pyahocorasick.py @@ -7,6 +7,8 @@ License : public domain """ +from collections import deque + nil = object() # used to distinguish from None class TrieNode(object): @@ -132,7 +134,8 @@ class Trie(object): Calculates number of words in a trie. """ - stack = [self.root] + stack = deque() + stack.append(self.root) n = 0 while stack: node = stack.pop() @@ -199,7 +202,7 @@ class Trie(object): Converts trie to Aho-Corasick automaton. """ - queue = [] + queue = deque() # 1. for i in range(256): @@ -213,7 +216,7 @@ class Trie(object): # 2. while queue: - r = queue.pop(0); + r = queue.popleft() for node in r.children.values(): queue.append(node) state = r.fail
use dequeue instead of python list Solution provided by Bruce Harold (bharold at esri.com)
WojciechMula_pyahocorasick
train
py
42d7f17a86848408bba6d9345994cc5754b8ae8a
diff --git a/plugins/context2d.js b/plugins/context2d.js index <HASH>..<HASH> 100644 --- a/plugins/context2d.js +++ b/plugins/context2d.js @@ -300,7 +300,6 @@ } var scale; - var scale; if (this.pdf.hotfix && this.pdf.hotfix.scale_text) { // We only use X axis as scale hint scale = this._matrix_decompose(this._getTransform()).scale[0]; @@ -356,7 +355,6 @@ } var scale; - var scale; if (this.pdf.hotfix && this.pdf.hotfix.scale_text) { // We only use the X axis as scale hint scale = this._matrix_decompose(this._getTransform()).scale[0]; @@ -475,7 +473,7 @@ this.pdf.setFont(jsPdfFontName, style); } else { - var rx = /(\d+)(pt|px|em)\s+(\w+)\s*(\w+)?/; + var rx = /\s*(\d+)(pt|px|em)\s+([\w "]+)\s*([\w "]+)?/; var m = rx.exec(font); if (m != null) { var size = m[1];
Update font regular expression to handle more combinations
MrRio_jsPDF
train
js
04ebc7eeb14956660b6428aeaafcd5ac50c9c2ea
diff --git a/components/query-assist/query-assist.js b/components/query-assist/query-assist.js index <HASH>..<HASH> 100644 --- a/components/query-assist/query-assist.js +++ b/components/query-assist/query-assist.js @@ -30,7 +30,7 @@ const ngModelStateField = 'query'; function noop() {} function cleanText(text) { - return text.trim().replace(/([\n\r])+/g, ' '); + return text.replace(/([\n\r])+/g, ' '); } /**
RG-<I> don't trim pasted string to avoid unwanted spaces removal and let user control their actions better
JetBrains_ring-ui
train
js
6bdbe8957d8c8d293e3fea3fa4baf45eb7c3a3a4
diff --git a/setuptools/version.py b/setuptools/version.py index <HASH>..<HASH> 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '19.2' +__version__ = '19.3'
Bumped to <I> in preparation for next release.
pypa_setuptools
train
py
509c086dc526fdc18391996b1a3477baa57ae5f3
diff --git a/src/parser/getToken/getMustacheOrTriple/getExpression/getExpression.js b/src/parser/getToken/getMustacheOrTriple/getExpression/getExpression.js index <HASH>..<HASH> 100644 --- a/src/parser/getToken/getMustacheOrTriple/getExpression/getExpression.js +++ b/src/parser/getToken/getMustacheOrTriple/getExpression/getExpression.js @@ -178,7 +178,7 @@ var getExpression; allowWhitespace( tokenizer ); - expression = getExpression( tokenizer ); + expression = getTypeOf( tokenizer ); if ( !expression ) { fail( tokenizer, 'an expression' ); }
fix prefix operator precedence in expression AST In `typeof a + b`, parse the `a` and stop; don't allow just any expression as the operand. However, we must be sure to still allow `typeof typeof a`, `typeof -a` and `-typeof a`. Stringification (and therefore behavior) is correct either way because it trusts the parse tree and doesn't insert parentheses.
ractivejs_ractive
train
js
c20d96dbf3248108e98714593d5325e2aff9f260
diff --git a/core/test/com/google/inject/DuplicateBindingsTest.java b/core/test/com/google/inject/DuplicateBindingsTest.java index <HASH>..<HASH> 100644 --- a/core/test/com/google/inject/DuplicateBindingsTest.java +++ b/core/test/com/google/inject/DuplicateBindingsTest.java @@ -504,7 +504,7 @@ public class DuplicateBindingsTest extends TestCase { } @Override - @SuppressWarnings("EqualsBrokenForNull") // intentionally NPE on null for the test + @SuppressWarnings({"EqualsHashCode", "EqualsBrokenForNull"}) // intentionally NPE on null for the test public boolean equals(Object obj) { return obj.getClass() == getClass(); }
Suppress warnings in classes that implement equals() without also implementing hashCode(). The contract for Object.hashCode states that if two objects are equal, then calling the hashCode() method on each of the two objects must produce the same result. Implementing equals() but not hashCode() causes broken behaviour when trying to store the object in a collection. ------------- Created by MOE: <URL>
sonatype_sisu-guice
train
java
2481eb1f54a226b0b7f4c92bf5268f25c6dcc741
diff --git a/spec/matchers.js b/spec/matchers.js index <HASH>..<HASH> 100644 --- a/spec/matchers.js +++ b/spec/matchers.js @@ -3,10 +3,18 @@ exports.toEqualPositions = function(expected) { We don't care about the other fields, only the positions and that the indexes correspond (e.g. the h changes for items with auto height) */ + var _expected, + _actual; + this.message = function () { + return JSON.stringify(_actual) + + " should be at position " + + JSON.stringify(_expected); + }; for (var i = 0; i < expected.length; i++) { if (expected[i].x != this.actual[i].x || expected[i].y != this.actual[i].y) { - console.log('Actual positions', expected[i], this.actual[i]); + _expected = expected[i]; + _actual = this.actual[i]; return false; } }
Include offending items in equalPosition matcher failing message
hootsuite_grid
train
js
cb3b6a0ad9b73c25efafe3e3088c58670a50c7cb
diff --git a/pnc_cli/productversions.py b/pnc_cli/productversions.py index <HASH>..<HASH> 100644 --- a/pnc_cli/productversions.py +++ b/pnc_cli/productversions.py @@ -20,7 +20,7 @@ def create_product_version_object(**kwargs): def version_exists(id): - version_ids = [str(x.id) for x in versions_api.get_all().content] + version_ids = [str(x.id) for x in versions_api.get_all(page_size=1000000).content] return str(id) in version_ids
adjust page size to make sure we don't have failures erroneously
project-ncl_pnc-cli
train
py
13ac76b8f8049278bf353335836be883c03a2fdb
diff --git a/bit/wallet.py b/bit/wallet.py index <HASH>..<HASH> 100644 --- a/bit/wallet.py +++ b/bit/wallet.py @@ -944,6 +944,7 @@ class MultiSig: self._scriptcode = self.redeemscript return self._scriptcode + @property def segwit_scriptcode(self): self._segwit_scriptcode = (OP_0 + OP_PUSH_32 + sha256(self.redeemscript))
Fixes small bug in `segwit_scriptcode` for `MultiSig`
ofek_bit
train
py
b40ea2dd89725833f77a323fc81fa826f200857b
diff --git a/pymc3/step_methods/hmc/hmc.py b/pymc3/step_methods/hmc/hmc.py index <HASH>..<HASH> 100644 --- a/pymc3/step_methods/hmc/hmc.py +++ b/pymc3/step_methods/hmc/hmc.py @@ -119,7 +119,7 @@ class HamiltonianMC(BaseHMC): n_steps = max(1, int(self.path_length / step_size)) n_steps = min(self.max_steps, n_steps) - energy_change = -np.inf + energy_change = np.inf state = start last = state div_info = None @@ -132,9 +132,9 @@ class HamiltonianMC(BaseHMC): else: if not np.isfinite(state.energy): div_info = DivergenceInfo("Divergence encountered, bad energy.", None, last, state) - energy_change = start.energy - state.energy + energy_change = state.energy - start.energy if np.isnan(energy_change): - energy_change = -np.inf + energy_change = np.inf if np.abs(energy_change) > self.Emax: div_info = DivergenceInfo( f"Divergence encountered, energy change larger than {self.Emax}.", @@ -143,7 +143,7 @@ class HamiltonianMC(BaseHMC): state, ) - accept_stat = min(1, np.exp(energy_change)) + accept_stat = min(1, np.exp(-energy_change)) if div_info is not None or np.random.rand() >= accept_stat: end = start
adjust definition of energy change in HMC (#<I>)
pymc-devs_pymc
train
py
f331b16bf663ead3675e77673f7b1e0c6b03c424
diff --git a/dom/src/main/java/org/isisaddons/module/security/dom/tenancy/ApplicationTenancy.java b/dom/src/main/java/org/isisaddons/module/security/dom/tenancy/ApplicationTenancy.java index <HASH>..<HASH> 100644 --- a/dom/src/main/java/org/isisaddons/module/security/dom/tenancy/ApplicationTenancy.java +++ b/dom/src/main/java/org/isisaddons/module/security/dom/tenancy/ApplicationTenancy.java @@ -128,7 +128,7 @@ public class ApplicationTenancy implements Comparable<ApplicationTenancy> { // ////////////////////////////////////// - public static final int MAX_LENGTH_PATH = 30; + public static final int MAX_LENGTH_PATH = 255; public static final int MAX_LENGTH_NAME = 40; public static final int TYPICAL_LENGTH_NAME = 20;
Allow ApplicationTenancy paths length <= <I> On a currently developed project different tenancies are defined for each account, who has an ApplicationUser associated. As the ApplicationUser name must be unique among all users, the most natural way to represent its path is to use it as the path specification (alone or appended to something like "accounts/[applicationUserName]".
isisaddons-legacy_isis-module-security
train
java
494cecd668dc5c1e15301c4cf0774ae2cb9e0a72
diff --git a/src/Common/CommandData.php b/src/Common/CommandData.php index <HASH>..<HASH> 100755 --- a/src/Common/CommandData.php +++ b/src/Common/CommandData.php @@ -143,7 +143,7 @@ class CommandData $validations = ($validations == false) ? '' : $validations; if ($this->getOption('relations')) { - $relation = $this->commandObj->ask('Enter relationship (Leave Black to skip):', ''); + $relation = $this->commandObj->ask('Enter relationship (Leave Black to skip):', false); } else { $relation = ''; }
fixed #<I> Can't skip relations
InfyOmLabs_laravel-generator
train
php
d0f180453ee4f47a16eb53175c2e9e35e282beb0
diff --git a/openquake/calculators/getters.py b/openquake/calculators/getters.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/getters.py +++ b/openquake/calculators/getters.py @@ -491,7 +491,7 @@ def gen_rupture_getters(dstore, srcfilter, ct): rlzs_by_gsim = full_lt.get_rlzs_by_gsim_grp() rup_array = dstore['ruptures'][()] items = list(general.group_array(rup_array, 'grp_id').items()) - items.sort(key=lambda item: item[1]['n_occ'].sum()) + items.sort(key=lambda item: item[1]['n_occ'].sum() * samples[item[0]]) maxweight = None while items: grp_id, rups = items.pop() # from the largest group
Refined rupture weight [skip CI]
gem_oq-engine
train
py
cfefd80c828c309745cc40d8498223b4fbc7b5ca
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index <HASH>..<HASH> 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -221,7 +221,7 @@ class AddCopySpecLimitTests(unittest.TestCase): def test_single_file_under_limit(self): self.mp.add_copy_spec_limit("tests/tail_test.txt", 1) - self.assertEquals(self.mp.copy_specs, ['tests/tail_test.txt']) + self.assertEquals(self.mp.copy_paths, set(['tests/tail_test.txt'])) def test_single_file_over_limit(self): fn = create_file(2) # create 2MB file, consider a context manager
Update Plugin tests to treat copy_paths as a set
sosreport_sos
train
py
f6c19810ffb444b8ae943f5c00d4330ce68d75c7
diff --git a/modules/casper.js b/modules/casper.js index <HASH>..<HASH> 100644 --- a/modules/casper.js +++ b/modules/casper.js @@ -2262,13 +2262,13 @@ function createPage(casper) { casper.emit('load.finished', status); casper.loadInProgress = false; }; - page.onNavigationRequested = function onNavigationRequested(url, type, lock, isMainFrame) { - casper.log(f('Navigation requested: url=%s, type=%s, lock=%s, isMainFrame=%s', - url, type, lock, isMainFrame), "debug"); + page.onNavigationRequested = function onNavigationRequested(url, type, willNavigate, isMainFrame) { + casper.log(f('Navigation requested: url=%s, type=%s, willNavigate=%s, isMainFrame=%s', + url, type, willNavigate, isMainFrame), "debug"); if (isMainFrame && casper.requestUrl !== url) { casper.navigationRequested = true; } - casper.emit('navigation.requested', url, type, lock, isMainFrame); + casper.emit('navigation.requested', url, type, willNavigate, isMainFrame); }; page.onPageCreated = function onPageCreated(popupPage) { casper.emit('popup.created', popupPage);
Rename lock to willNavigate The phantomjs documentation[1] indicates that the lock variable is named 'willNavigate'. After a quick test, the values passed reflect that name, true indicating navigation will happen, false indicating it will not. [1]: <URL>
casperjs_casperjs
train
js
db094fe96073fbfa1e719c1d6cc99bbc3bf536ba
diff --git a/sos/plugins/general.py b/sos/plugins/general.py index <HASH>..<HASH> 100644 --- a/sos/plugins/general.py +++ b/sos/plugins/general.py @@ -22,7 +22,6 @@ class General(Plugin): def setup(self): self.add_copy_specs([ - "/etc/init", # upstart "/etc/event.d", "/etc/inittab", "/etc/sos.conf",
[general] remove duplicate /etc/init collection Already handled by the upstart plugin. Related: #<I>.
sosreport_sos
train
py
d14a51d30f086d88abf417f78937ddd2488720ae
diff --git a/src/main/java/biweekly/util/ListMultimap.java b/src/main/java/biweekly/util/ListMultimap.java index <HASH>..<HASH> 100644 --- a/src/main/java/biweekly/util/ListMultimap.java +++ b/src/main/java/biweekly/util/ListMultimap.java @@ -261,4 +261,9 @@ public class ListMultimap<K, V> implements Iterable<Map.Entry<K, List<V>>> { public Iterator<Map.Entry<K, List<V>>> iterator() { return map.entrySet().iterator(); } + + @Override + public String toString() { + return map.toString(); + } } \ No newline at end of file
Added toString() method to ListMultimap.
mangstadt_biweekly
train
java
3d822f7b2ceb8085f67648e0b8cbf7407f718c15
diff --git a/locales/sw/validation.php b/locales/sw/validation.php index <HASH>..<HASH> 100644 --- a/locales/sw/validation.php +++ b/locales/sw/validation.php @@ -35,7 +35,7 @@ return [ 'date' => 'Kipengele si tarehe halali.', 'date_equals' => ':attribute inapaswa kuwa tarehe sawa na :date.', 'date_format' => 'Kipengele hakilingani na muundo :date.', - 'declined' => ':attribute inapaswa kukataliwa.', + 'declined' => ':Attribute inapaswa kukataliwa.', 'declined_if' => ' :attribute inapaswa kukataliwa kama :other ni :value.', 'different' => 'Kipengele na :other lazima viwe tofauti.', 'digits' => 'Kipengele lazima kiwe :digits tarakimu.',
Update locales/sw/validation.php
caouecs_Laravel-lang
train
php
b5317c5c5c7b6de9093e3b8d5879bce4592e4122
diff --git a/examples_test.go b/examples_test.go index <HASH>..<HASH> 100644 --- a/examples_test.go +++ b/examples_test.go @@ -3,7 +3,7 @@ package validator_test import ( "fmt" - "../validator" + "gopkg.in/bluesuncorp/validator.v6" ) func ExampleValidate_new() {
Update examples_test.go Backport change to update import path from pull request #<I>
go-playground_validator
train
go
91211e90e5a58ebe03d163e81542571b0a9499bf
diff --git a/foundation_formtags/tests/tests.py b/foundation_formtags/tests/tests.py index <HASH>..<HASH> 100644 --- a/foundation_formtags/tests/tests.py +++ b/foundation_formtags/tests/tests.py @@ -24,9 +24,9 @@ class TestFoundationform(unittest.TestCase): data = {'char_field': 'Tests', 'password_field': 'password', 'choice_field': 'Option 1', 'boolean_field': 'True'} simple_form = ComplexForm(data) - template = '{{ form|as_foundation }}' + template = '{{ form|as_foundation }}' + '{% load widget_tweaks %}' context = {'form': simple_form} - contains = '<small class="error">This field is required.</small>' + contains = '<small class="form-error is-visible">This field is required.</small>' self.tag_test(template, context, contains) diff --git a/runtests.py b/runtests.py index <HASH>..<HASH> 100644 --- a/runtests.py +++ b/runtests.py @@ -9,6 +9,7 @@ if not settings.configured: settings_dict = dict( INSTALLED_APPS=( 'foundation_formtags', + 'widget_tweaks', 'foundation_formtags.tests', ), DATABASES={
Tests updated - Issue #<I>
chrisdev_django-foundation-formtags
train
py,py
85836fedff61b8bd23b3a4ee55efba1ecb770e33
diff --git a/fost_authn_debug/tests/test_authentication.py b/fost_authn_debug/tests/test_authentication.py index <HASH>..<HASH> 100644 --- a/fost_authn_debug/tests/test_authentication.py +++ b/fost_authn_debug/tests/test_authentication.py @@ -31,7 +31,7 @@ class TestAuthentication(TestCase): def test_signed_request_missing_timestamp_header(self): del self.request.META['HTTP_X_FOST_TIMESTAMP'] forbidden = [] - def forbid(): + def forbid(error): forbidden.append(True) with mock.patch('fost_authn.authentication._forbid', forbid): result = self.backend.authenticate(request = self.request,
Forbid needs to take a parameter now.
Felspar_django-fost-authn
train
py
0deaa77220f0f9541c02ebd234061930f929f225
diff --git a/github/github.go b/github/github.go index <HASH>..<HASH> 100644 --- a/github/github.go +++ b/github/github.go @@ -57,7 +57,7 @@ func (gh *GitHub) repo() octokit.Repository { } func findOrCreateToken(user, password string) (string, error) { - client := octokit.NewClientWithPassword(user, password) + client := octokit.NewClient().WithLogin(user, password) auths, err := client.Authorizations() if err != nil { return "", err @@ -104,7 +104,7 @@ func (gh *GitHub) client() *octokit.Client { utils.Check(err) } - return octokit.NewClientWithToken(config.Token) + return octokit.NewClient().WithToken(config.Token) } func New() *GitHub {
Update to the latest octokit interface
github_hub
train
go
a661cf9faf6685651d80803ea6cdf610db4c2442
diff --git a/lib/Version/Collection/IndexedVersions.php b/lib/Version/Collection/IndexedVersions.php index <HASH>..<HASH> 100644 --- a/lib/Version/Collection/IndexedVersions.php +++ b/lib/Version/Collection/IndexedVersions.php @@ -20,7 +20,7 @@ use Zend\Stdlib\ArrayUtils; * * @author Gabriel Somoza <gabriel@strategery.io> * - * TODO: this class has 11 methods. Consider refactoring it to keep number of methods under 10. + * IMPROVE: this class has 11 methods. Consider refactoring it to keep number of methods under 10. * * @SuppressWarnings(PHPMD.TooManyMethods) * diff --git a/lib/Version/Collection/Resolver/OffsetResolver.php b/lib/Version/Collection/Resolver/OffsetResolver.php index <HASH>..<HASH> 100644 --- a/lib/Version/Collection/Resolver/OffsetResolver.php +++ b/lib/Version/Collection/Resolver/OffsetResolver.php @@ -46,7 +46,7 @@ class OffsetResolver extends AbstractResolver /** * Resolves an alias into a Version. * - * TODO: this method has an NPath complexity of 400. The configured NPath complexity threshold is 200. + * IMPROVE: this method has an NPath complexity of 400. The configured NPath complexity threshold is 200. * * @SuppressWarnings(PHPMD.NPathComplexity) *
Renamed TODO to IMPROVE for better semantics.
baleen_migrations
train
php,php
003e2701ad07f4f39a3930870791fb6759dcd073
diff --git a/code/SaltedCropperImageExt.php b/code/SaltedCropperImageExt.php index <HASH>..<HASH> 100644 --- a/code/SaltedCropperImageExt.php +++ b/code/SaltedCropperImageExt.php @@ -173,7 +173,7 @@ class SaltedCropperImageExt extends DataExtension { imagejpeg($newImg, $image_path, 100); break; } - + imagedestroy($newImg); }
removed a redundant function; GD now can save png and gif files in their own extensions
salted-herring_salted-cropper
train
php
c3f15611021c6fb43b8d675571669c9647e12048
diff --git a/pyvex/IRExpr/__init__.py b/pyvex/IRExpr/__init__.py index <HASH>..<HASH> 100644 --- a/pyvex/IRExpr/__init__.py +++ b/pyvex/IRExpr/__init__.py @@ -44,7 +44,7 @@ class IRExpr(VEXObject): @staticmethod def _translate(c_expr, irsb): - if c_expr[0] == ffi.NULL: + if c_expr == ffi.NULL or c_expr[0] == ffi.NULL: return None tag = c_expr.tag
Additional NULL check in IRExpr initialization
angr_pyvex
train
py
fcd80d4d6f168245808c93e46463cea796414b2f
diff --git a/lib/Thelia/Controller/Front/CustomerController.php b/lib/Thelia/Controller/Front/CustomerController.php index <HASH>..<HASH> 100755 --- a/lib/Thelia/Controller/Front/CustomerController.php +++ b/lib/Thelia/Controller/Front/CustomerController.php @@ -28,7 +28,7 @@ use Thelia\Core\Event\LostPasswordEvent; use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\UsernameNotFoundException; -use Thelia\Form\CustomerCreation; +use Thelia\Form\CustomerCreateForm; use Thelia\Form\CustomerLogin; use Thelia\Form\CustomerLostPasswordForm; use Thelia\Form\CustomerUpdateForm; @@ -93,7 +93,7 @@ class CustomerController extends BaseFrontController $message = false; - $customerCreation = new CustomerCreation($this->getRequest()); + $customerCreation = new CustomerCreateForm($this->getRequest()); try { $form = $this->validateForm($customerCreation, "post");
Oups... I forgot to rename CustomerCreation into CustomerCreateForm
thelia_core
train
php
36a2c0baff82eefc68cfa97d3ce3a3a2105894e0
diff --git a/src/config/createLatestConfig.js b/src/config/createLatestConfig.js index <HASH>..<HASH> 100644 --- a/src/config/createLatestConfig.js +++ b/src/config/createLatestConfig.js @@ -16,8 +16,8 @@ const modernPreset = [ "env", { ...commonEnvOptions, targets: { - node: 6.5, - electron: 1.4, + node: "6.5", + electron: "1.4", browsers: [ "Safari 10", "iOS 10",
Reconfigured presets using string identifiers as suggested by new version of babel-preset-env.
sebastian-software_preppy
train
js
6306d2ede3baaf954bc6c94d2f94d8dd6342ede4
diff --git a/src/Core/CoreKernel.php b/src/Core/CoreKernel.php index <HASH>..<HASH> 100644 --- a/src/Core/CoreKernel.php +++ b/src/Core/CoreKernel.php @@ -270,8 +270,10 @@ class CoreKernel implements Kernel $databaseConfig = DB::getConfig(); // Gracefully fail if no DB is configured if (empty($databaseConfig['database'])) { + $msg = 'SilverStripe Framework requires a "database" key in DB::getConfig(). ' . + 'Did you forget to set SS_DATABASE_NAME or SS_DATABASE_CHOOSE_NAME in your environment?'; $this->detectLegacyEnvironment(); - $this->redirectToInstaller(); + $this->redirectToInstaller($msg); } } @@ -311,14 +313,17 @@ class CoreKernel implements Kernel } /** - * If missing configuration, redirect to install.php + * If missing configuration, redirect to install.php if it exists. + * Otherwise show a server error to the user. + * + * @param string $msg Optional message to show to the user on an installed project (install.php missing). */ - protected function redirectToInstaller() + protected function redirectToInstaller($msg = '') { // Error if installer not available if (!file_exists(Director::publicFolder() . '/install.php')) { throw new HTTPResponse_Exception( - 'SilverStripe Framework requires database configuration defined via .env', + $msg, 500 ); }
More specific "database missing" error message It's misleading to imply that an .env doesn't exist when it's not what the actual check looks for. It's also poor design to hardcode an unrelated error message in a "redirect to installer" function, which only worked because this function was called from exactly one other place where this error message was correct.
silverstripe_silverstripe-framework
train
php
21d58df2f4c099a2c4c1d4bb2d86b8b4e2b22194
diff --git a/Integration/ClientIntegration.php b/Integration/ClientIntegration.php index <HASH>..<HASH> 100644 --- a/Integration/ClientIntegration.php +++ b/Integration/ClientIntegration.php @@ -215,6 +215,7 @@ class ClientIntegration extends AbstractIntegration && $campaignId == $campaign->getId() ) { $this->event['id'] = $leadEvent->getId(); + $this->event['name'] = $leadEvent->getName(); $this->event['campaignId'] = $campaign->getId(); break; }
Improve accuracy of the event name in Source logs.
TheDMSGroup_mautic-contact-client
train
php
4e7d73ccc508bbac0187aa8d17bb415e14a5ebcd
diff --git a/website/plugin-resolve.js b/website/plugin-resolve.js index <HASH>..<HASH> 100644 --- a/website/plugin-resolve.js +++ b/website/plugin-resolve.js @@ -1,5 +1,12 @@ const path = require('path'); +console.log('resolve cur dir', __dirname); +console.log('resolve cwd', process.cwd()); + +const mainModule = path.resolve(__dirname, '../dist/canvas-sketch.umd.js') +console.log('main module', mainModule); +console.log('main module exists', require('fs').existsSync(mainModule)); + const canvasSketchModule = require.resolve('../'); const basedir = path.dirname(canvasSketchModule); @@ -7,8 +14,6 @@ module.exports = function (bundler, opt = {}) { // Get this module's package dir const resolver = bundler._bresolve; - console.log('Resolving', canvasSketchModule); - console.log('Resolve folder', basedir); // Resolve canvas-sketch from here instead of using working directory bundler._bresolve = function (id, opts, cb) { if (/^canvas-sketch([\\/].*)?$/.test(id)) {
debugging netlify build issue
mattdesl_canvas-sketch
train
js
526ddfb8da6967cf9a70cad81fdfc8304611c1da
diff --git a/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java b/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java index <HASH>..<HASH> 100644 --- a/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java +++ b/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java @@ -234,7 +234,7 @@ public class TempEval3Writer extends CasConsumer_ImplBase { // prepare the transformer to convert from the xml doc to output text Transformer transformer = TransformerFactory.newInstance().newTransformer(); // some pretty printing - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.INDENT, "no"); DOMSource source = new DOMSource(xmlDoc); StreamResult result = new StreamResult(bw);
indenting would break text consistency when two timexes, separated only by whitespaces, would cause a line break to be inserted
HeidelTime_heideltime
train
java
bdce8acb9ca507064160f4ecf5d30914ee5b344a
diff --git a/lib/knapsack/adapters/rspec_adapter.rb b/lib/knapsack/adapters/rspec_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/knapsack/adapters/rspec_adapter.rb +++ b/lib/knapsack/adapters/rspec_adapter.rb @@ -52,7 +52,7 @@ module Knapsack end def self.test_path(example_group) - if defined?(Turnip) && Turnip::VERSION.to_i < 2 + if defined?(::Turnip) && Gem::Version.new(::Turnip::VERSION) < Gem::Version.new('2.0.0') unless example_group[:turnip] until example_group[:parent_example_group].nil? example_group = example_group[:parent_example_group]
check Turnip version with Gem::Version
ArturT_knapsack
train
rb
234d96bb4cd565dcd44713a3883207c85e8a81ff
diff --git a/src/test/java/org/organicdesign/fp/experimental/RrbTree1Test.java b/src/test/java/org/organicdesign/fp/experimental/RrbTree1Test.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/organicdesign/fp/experimental/RrbTree1Test.java +++ b/src/test/java/org/organicdesign/fp/experimental/RrbTree1Test.java @@ -53,7 +53,8 @@ public class RrbTree1Test { Random rand = new Random(); private int mutableRandIdx = 0; // private int[] myRands = new int[] {0, 0, 2, 2, 2, 3, 5, 1}; - private int[] myRands = new int[] {0, 1, 2, 1, 0, 5, 2}; +// private int[] myRands = new int[] {0, 1, 2, 1, 0, 5, 2}; + private int[] myRands = new int[] {0, 0, 1, 2, 3, 0, 1, 5, 8, 2}; private int myRand(int max) { // return rand.nextInt(max);
Updated test to fail at new limitation.
GlenKPeterson_Paguro
train
java
94556346550677d51a5ebaaad297b5f33d2d039c
diff --git a/test/tobe_instrumented/assertion.es20xx.js b/test/tobe_instrumented/assertion.es20xx.js index <HASH>..<HASH> 100644 --- a/test/tobe_instrumented/assertion.es20xx.js +++ b/test/tobe_instrumented/assertion.es20xx.js @@ -78,13 +78,12 @@ describe('power-assert on ES20xx syntax', function () { it('Object Rest/Spread', () => { expectPowerAssertMessage (() => { var o = { a: 1, b: 2 }; - var obj = { ...o, c: 5 }; - assert.deepStrictEqual(obj, { a: 1, b: 2, c: 3 }); + assert.deepStrictEqual({ ...o, c: 5 }, { a: 1, b: 2, c: 3 }); }, [ - ' assert.deepStrictEqual(obj, { a: 1, b: 2, c: 3 })', - ' | | ', - ' | Object{a:1,b:2,c:3} ', - ' Object{a:1,b:2,c:5} ' + ' assert.deepStrictEqual({ ...o, c: 5 }, { a: 1, b: 2, c: 3 })', + ' | | ', + ' | Object{a:1,b:2,c:3} ', + ' Object{a:1,b:2,c:5} ' ]); }); });
test: Object Rest/Spread in assertion expression
power-assert-js_power-assert
train
js
31a344017300b7ba48dde9ebfbfcc583b5b50b22
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -141,7 +141,7 @@ html_theme_path = ['.', sphinx_rtd_theme.get_html_theme_path()] # documentation. # html_theme_options = { - 'logo_only': True, + 'logo_only': False, 'display_version': True, 'prev_next_buttons_location': 'bottom', 'style_external_links': False,
Set logo-only to False (#<I>)
Qiskit_qiskit
train
py
b7105a83deb1b0338f94be5bb2953491e5b4bda6
diff --git a/app/src/Bolt/Configuration/ResourceManager.php b/app/src/Bolt/Configuration/ResourceManager.php index <HASH>..<HASH> 100644 --- a/app/src/Bolt/Configuration/ResourceManager.php +++ b/app/src/Bolt/Configuration/ResourceManager.php @@ -44,10 +44,13 @@ class ResourceManager */ public function __construct($loader, Request $request = null, $verifier = null) { - $this->classLoader = $loader; - $app = dirname($loader->findFile('Bolt\\Application')); - - $this->root = realpath($app . '/../../../'); + + if ($loader instanceof ClassLoader) { + $this->useLoader($loader); + } else { + $this->root = $loader; + } + $this->requestObject = $request; @@ -83,6 +86,13 @@ class ResourceManager { static::$_app = $this->app = $app; } + + public function useLoader(ClassLoader $loader) + { + $this->classLoader = $loader; + $app = dirname($loader->findFile('Bolt\\Application')); + $this->root = realpath($app . '/../../../'); + } public function setPath($name, $value) {
allow directory string to be passed in as previously
bolt_bolt
train
php
5c53edfba561a2ebdca2741c92405dbd69bd469c
diff --git a/alot/db/attachment.py b/alot/db/attachment.py index <HASH>..<HASH> 100644 --- a/alot/db/attachment.py +++ b/alot/db/attachment.py @@ -1,10 +1,10 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> +# Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file import os import tempfile import email.charset as charset -from email.header import Header from copy import deepcopy from ..helper import string_decode, humanize_size, guess_mimetype @@ -86,8 +86,5 @@ class Attachment(object): def get_mime_representation(self): """returns mime part that constitutes this attachment""" part = deepcopy(self.part) - part['Content-Disposition'] = Header( - self.part['Content-Disposition'], - maxlinelen=78, - header_name='Content-Disposition').encode() + part.set_param('maxlinelen', '78', header='Content-Disposition') return part
db/attachment: use set_param() instead of recreating a header This is more elegant and efficient way to handle this.
pazz_alot
train
py
99b50761d2c4d3160204981b2357f0ea081f955c
diff --git a/doc/conf.py b/doc/conf.py index <HASH>..<HASH> 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,9 +11,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- @@ -79,7 +79,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the
Chhaning the readthedocs theme
MAVENSDC_cdflib
train
py
28bea0c91de9933120c298c5f85e9df3d4e24ae3
diff --git a/image_scraper/utils.py b/image_scraper/utils.py index <HASH>..<HASH> 100644 --- a/image_scraper/utils.py +++ b/image_scraper/utils.py @@ -10,7 +10,7 @@ import re from image_scraper.exceptions import * -class ImageScraper: +class ImageScraper(object): url = None no_to_download = 0 format_list = []
:racehorse: Moved to new style python classes. Fixes #<I>.
sananth12_ImageScraper
train
py
c2004a795254f31492cd3c9fa341d288a9cdb9e4
diff --git a/lib/datalib.php b/lib/datalib.php index <HASH>..<HASH> 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -252,7 +252,7 @@ function users_order_by_sql($usertablealias = '', $search = null, context $conte $fieldstocheck = array_merge(array('firstname', 'lastname'), get_extra_user_fields($context)); foreach ($fieldstocheck as $key => $field) { - $exactconditions[] = $tableprefix . $field . ' = :' . $paramkey; + $exactconditions[] = 'LOWER(' . $tableprefix . $field . ') = LOWER(:' . $paramkey . ')'; $params[$paramkey] = $search; $paramkey++; }
MDL-<I> user sort: exact match logic should be case-insensitive.
moodle_moodle
train
php
169fef1e696182169854af64759ac769e57d0ac3
diff --git a/src/Vinelab/Minion/Provider.php b/src/Vinelab/Minion/Provider.php index <HASH>..<HASH> 100644 --- a/src/Vinelab/Minion/Provider.php +++ b/src/Vinelab/Minion/Provider.php @@ -114,6 +114,8 @@ abstract class Provider { * * @param string $topic * @param Closure $callback + * @param array $options + * @param bool $isFunction * * @return \React\Promise\Promise */
update provider's register method docs
Vinelab_minion
train
php
0224aeb552c5a77f67553949cf0c62469c4a13e4
diff --git a/zipline/transforms/batch_transform.py b/zipline/transforms/batch_transform.py index <HASH>..<HASH> 100644 --- a/zipline/transforms/batch_transform.py +++ b/zipline/transforms/batch_transform.py @@ -271,7 +271,7 @@ class BatchTransform(object): _, mkt_close = trading.environment.get_open_and_close(event.dt) if self.bars == 'daily': # Daily bars have their dt set to midnight. - mkt_close = mkt_close.replace(hour=0, minute=0, second=0) + mkt_close = trading.environment.normalize_date(mkt_close) if event.dt >= mkt_close: if self.downsample: downsample_panel(self.rolling_panel,
MAINT: Use enviroment normalize_date instead of dt.replace Continue path of removing scattered calls to dt.replace.
quantopian_zipline
train
py
39046a6adee4786cffabbdaa120bf466afe14e81
diff --git a/contract_sale_generation/models/contract.py b/contract_sale_generation/models/contract.py index <HASH>..<HASH> 100644 --- a/contract_sale_generation/models/contract.py +++ b/contract_sale_generation/models/contract.py @@ -120,6 +120,7 @@ class ContractContract(models.Model): lambda sale: sale.contract_auto_confirm ) sale_orders_to_confirm.action_confirm() + self._compute_recurring_next_date() return sale_orders @api.model
[<I>][FIX] contract_sale_generation: Recompute next recurring date after generation on contract level As in contract module, recompute recurring_next_date after sale generation on contract level
OCA_contract
train
py
ae5f85e9c7ad3d64d535004a13d271500dadf5e6
diff --git a/src/rules/dollar-variable-pattern/index.js b/src/rules/dollar-variable-pattern/index.js index <HASH>..<HASH> 100644 --- a/src/rules/dollar-variable-pattern/index.js +++ b/src/rules/dollar-variable-pattern/index.js @@ -21,7 +21,7 @@ export default function (pattern) { root.walkDecls(decl => { const { prop } = decl - if (prop.slice(0, 1) !== "$") { return } + if (prop[0] !== "$") { return } if (regexpPattern.test(prop.slice(1))) { return } utils.report({
`dollar-variable-pattern`: improve code performance a bit
kristerkari_stylelint-scss
train
js
a7db95a25f5d87320bbb5bfcddeb9b686a211566
diff --git a/js/lib/mediawiki.SelectiveSerializer.js b/js/lib/mediawiki.SelectiveSerializer.js index <HASH>..<HASH> 100644 --- a/js/lib/mediawiki.SelectiveSerializer.js +++ b/js/lib/mediawiki.SelectiveSerializer.js @@ -200,7 +200,7 @@ SSP.parseOriginalSource = function ( doc, cb, finalcb, err, src ) { // Parse the wikitext src to the original DOM, and pass that on to // doSerializeDOM - this.parserPipeline.once( 'document', function ( doc ) { + parserPipeline.once( 'document', function ( doc ) { // XXX: need to get body with .tree.document.childNodes[0].childNodes[1] ? self.env.page.dom = doc; self.doSerializeDOM(err, doc, cb, finalcb);
Fix selser on-demand DOM parsing crash This code path is sadly not covered by parserTests since the DOM tends to be available there (it is cached). The latest selective serializer does not seem to work too well with the VE yet (hangs), which needs further investigation. Change-Id: I<I>cf<I>a<I>dfe<I>f<I>d<I>ab<I>e0a<I>
wikimedia_parsoid
train
js
23f7ebaea231d833fe72f11d8f3b7f27df3e7a50
diff --git a/src/Http/Responses/ResponsesHelper.php b/src/Http/Responses/ResponsesHelper.php index <HASH>..<HASH> 100644 --- a/src/Http/Responses/ResponsesHelper.php +++ b/src/Http/Responses/ResponsesHelper.php @@ -73,13 +73,13 @@ class ResponsesHelper /** * @param mixed $data - * @param int $statusCode * @param array $links * @param mixed|null $meta + * @param int $statusCode * @param array $headers * @return Response */ - public function content($data, $statusCode = Response::HTTP_OK, $links = [], $meta = null, array $headers = []) + public function content($data, array $links = [], $meta = null, $statusCode = Response::HTTP_OK, array $headers = []) { if ($data instanceof Collection) { $data = $data->all(); @@ -101,7 +101,7 @@ class ResponsesHelper * @param array $headers * @return mixed */ - public function created($resource, $links = [], $meta = null, array $headers = []) + public function created($resource, array $links = [], $meta = null, array $headers = []) { $encoder = $this->getEncoder(); $options = $encoder->getEncoderOptions();
Fixes in ResponsesHelper
cloudcreativity_laravel-json-api
train
php
32637fdbecf81dea2503e346288dc80cd545b1e5
diff --git a/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java b/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java index <HASH>..<HASH> 100644 --- a/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java +++ b/azkaban-common/src/main/java/azkaban/executor/container/ContainerCleanupManager.java @@ -222,6 +222,10 @@ public class ContainerCleanupManager { * @param originalStatus */ private void retryFlowQuietly(ExecutableFlow flow, Status originalStatus) { + // EXECUTION_STOPPED flows should not be retried in CleanUpManager periodically + if (originalStatus == Status.EXECUTION_STOPPED) { + return; + } try { logger.info("Restarting cleaned up flow " + flow.getExecutionId()); ExecutionControllerUtils.restartFlow(flow, originalStatus);
Execution_stopped flows should not be retried by ContainerCleanupManager periodically (#<I>)
azkaban_azkaban
train
java
c91a552ea173376b260f184c01b7b82c5aa4c989
diff --git a/molo/commenting/views.py b/molo/commenting/views.py index <HASH>..<HASH> 100644 --- a/molo/commenting/views.py +++ b/molo/commenting/views.py @@ -53,7 +53,13 @@ def view_more_article_comments(request, page_id): article = get_object_or_404(ArticlePage, id=page_id) qs = MoloComment.objects.for_model(ArticlePage).filter( object_pk=page_id, parent__isnull=True) - paginator = Paginator(qs, 20) + + try: + comments_per_page = settings.COMMENTS_PER_PAGE + except AttributeError: + comments_per_page = 20 + + paginator = Paginator(qs, comments_per_page) page = request.GET.get('p', 1) try: comments = paginator.page(page)
added option to settings to change the comments per page value
praekeltfoundation_molo.commenting
train
py
1de3950eceec2b542271d01262f5f2a38419ec6b
diff --git a/rash/database.py b/rash/database.py index <HASH>..<HASH> 100644 --- a/rash/database.py +++ b/rash/database.py @@ -413,7 +413,14 @@ class DataBase(object): regexp = "regexp({1}, {0})" eq = '{0} = {1}' + if not unique and sort_by == 'command_count': + # When not using "GROUP BY", `COUNT(*)` yields just one + # row. As unique is True by default, `unique=False` + # should mean to ignore ``sort_by='command_count'``. + sort_by = None + sc = SQLConstructor(source, columns, keys, + order_by=sort_by or 'start_time', reverse=reverse, limit=limit) sc.add_matches(glob, 'CL.command', match_pattern, include_pattern, exclude_pattern) @@ -435,14 +442,8 @@ class DataBase(object): if unique: sc.uniquify_by('CL.command', 'start_time') - elif sort_by == 'command_count': - # When not using "GROUP BY", `COUNT(*)` yields just one - # row. As unique is True by default, `unique=False` - # should means to ignore `sort_by` - sort_by = None - sc.order_by = sort_by or 'start_time' - if sc.order_by == 'command_count': + if sort_by == 'command_count': sc.add_column('COUNT(*) as command_count', 'command_count') return sc.compile()
Refactor search_command_record; avoid attribute access Don't do this: sc.order_by = sort_by or 'start_time'
tkf_rash
train
py
708a30d2371f3a2c43d0bad2b1dbb632ce7a58e0
diff --git a/ArgusWeb/app/js/directives/charts/lineChart.js b/ArgusWeb/app/js/directives/charts/lineChart.js index <HASH>..<HASH> 100644 --- a/ArgusWeb/app/js/directives/charts/lineChart.js +++ b/ArgusWeb/app/js/directives/charts/lineChart.js @@ -461,6 +461,7 @@ angular.module('argus.directives.charts.lineChart', []) d3.select('svg').remove(); setGraph(); //set up the chart updateGraph(currSeries); //refill the data draw the line + addOverlay(); //restore the zoom&brush context.select(".brush").call
fix the issue that brush disappears when resizing
salesforce_Argus
train
js
8911ab5ec7703c314110240e1c9ae739df737a60
diff --git a/hazelcast/src/main/java/com/hazelcast/client/impl/ClusterViewListenerService.java b/hazelcast/src/main/java/com/hazelcast/client/impl/ClusterViewListenerService.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/client/impl/ClusterViewListenerService.java +++ b/hazelcast/src/main/java/com/hazelcast/client/impl/ClusterViewListenerService.java @@ -96,15 +96,15 @@ public class ClusterViewListenerService { } clusterListeningEndpoints.put(clientEndpoint, correlationId); + ClientMessage memberListViewMessage = getMemberListViewMessage(); + memberListViewMessage.setCorrelationId(correlationId); + clientEndpoint.getConnection().write(memberListViewMessage); + ClientMessage partitionViewMessage = getPartitionViewMessageOrNull(); if (partitionViewMessage != null) { partitionViewMessage.setCorrelationId(correlationId); clientEndpoint.getConnection().write(partitionViewMessage); } - - ClientMessage memberListViewMessage = getMemberListViewMessage(); - memberListViewMessage.setCorrelationId(correlationId); - clientEndpoint.getConnection().write(memberListViewMessage); } private ClientMessage getPartitionViewMessageOrNull() {
Make sure that client receives members map before partition map (#<I>) (#<I>)
hazelcast_hazelcast
train
java
076978181cf1bb51d7b84e438b0351b2157cb040
diff --git a/src/watoki/cli/commands/GenericCommand.php b/src/watoki/cli/commands/GenericCommand.php index <HASH>..<HASH> 100644 --- a/src/watoki/cli/commands/GenericCommand.php +++ b/src/watoki/cli/commands/GenericCommand.php @@ -6,7 +6,7 @@ use watoki\cli\Console; class GenericCommand implements Command { - /** @var callable */ + /** @var null|callable */ private $callback; private $description; @@ -14,17 +14,17 @@ class GenericCommand implements Command { private $helpText; /** - * @param callable $callback + * @param null|callable $callback */ - function __construct($callback) { + function __construct($callback = null) { $this->callback = $callback; } /** - * @param callable $callback + * @param null|callable $callback * @return GenericCommand */ - public static function build($callback) { + public static function build($callback = null) { return new GenericCommand($callback); } @@ -34,6 +34,10 @@ class GenericCommand implements Command { * @return void */ public function execute(Console $console, array $arguments) { + if (!$this->callback) { + return; + } + $callback = $this->callback; $callback($console, $arguments); }
GenericCommand possible without callback
watoki_cli
train
php
176ff1d96d9340bc4047191189909359f432be19
diff --git a/lib/nominet-epp/operations/info.rb b/lib/nominet-epp/operations/info.rb index <HASH>..<HASH> 100644 --- a/lib/nominet-epp/operations/info.rb +++ b/lib/nominet-epp/operations/info.rb @@ -73,7 +73,13 @@ module NominetEPP when "infData" extension.find('//domain-nom-ext:infData', namespaces).first.children.reject { |n| n.empty? }.each do |node| key = node.name.gsub('-', '_').to_sym - hash[key] = node.content.strip + case key + when :notes + hash[:notes] ||= Array.new + hash[:notes] << node.content.strip + else + hash[key] = node.content.strip + end end when "truncated-field" extension.find('//std-warning:truncated-field', namespaces).each do |node|
Support multiple domain notes if provided.
m247_nominet-epp
train
rb
3d4a0fb65a531dbfa9fb2f6f2d67b1a0c42df9c1
diff --git a/src/test/java/integration/ReadonlyElementsTest.java b/src/test/java/integration/ReadonlyElementsTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/integration/ReadonlyElementsTest.java +++ b/src/test/java/integration/ReadonlyElementsTest.java @@ -36,7 +36,10 @@ public class ReadonlyElementsTest extends IntegrationTest { @Test public void cannotSetValueToReadonlyField_fastSetValue() { Configuration.fastSetValue = true; - assertThat(verifySetValueThrowsException(), containsString("Cannot change value of readonly element")); + assertThat(verifySetValueThrowsException(), anyOf( + containsString("Cannot change value of readonly element"), + containsString("Element must be user-editable in order to clear it") + )); } @Test(expected = InvalidStateException.class)
fixed the test, changing on of the expected error messages
selenide_selenide
train
java
d172d58c4a7e3e6e2831400419963dff49287d34
diff --git a/spec/unit/filters/filter_form_builder_spec.rb b/spec/unit/filters/filter_form_builder_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/filters/filter_form_builder_spec.rb +++ b/spec/unit/filters/filter_form_builder_spec.rb @@ -423,8 +423,8 @@ describe ActiveAdmin::Filters::ViewHelper do it "should work as string" do body = Capybara.string(filter :custom_title_searcher, as: :string) - expect(body).to have_selector("input[name='q[custom_title_searcher_contains]']") - expect(body).to have_selector("input[name='q[custom_title_searcher_starts_with]']") + expect(body).to have_selector("option[name='q[custom_title_searcher_contains]']") + expect(body).to have_selector("option[name='q[custom_title_searcher_starts_with]']") end describe "custom date range search" do
fixed wrong selectors for ransackers filters specs
activeadmin_activeadmin
train
rb
824514d8e04d910c0c975c8eac64980e018cae68
diff --git a/js/browser.js b/js/browser.js index <HASH>..<HASH> 100644 --- a/js/browser.js +++ b/js/browser.js @@ -1484,7 +1484,7 @@ Browser.prototype.realInit = function(opts) { if (ev.axis == 1) { ev.stopPropagation(); ev.preventDefault(); if (ev.detail != 0) { - thisB.move(ev.detail); + thisB.move(ev.detail/4); } } }, false);
Reduced sensitivity to panning gestures in Gecko.
dasmoth_dalliance
train
js
6ce1fa5fc525b5783503a985d0297df22a27e429
diff --git a/kubrick/tmdb_proxy.py b/kubrick/tmdb_proxy.py index <HASH>..<HASH> 100644 --- a/kubrick/tmdb_proxy.py +++ b/kubrick/tmdb_proxy.py @@ -26,13 +26,14 @@ app.config.update(REDIS_HOST=os.environ.get('KUBRICK_REDIS_HOST', 'localhost'), redis_conn = redis.StrictRedis(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'], db=app.config['REDIS_DB']) +requests_session = requests.Session() def get_on_tmdb(uri, **kwargs): """ Get a resource on TMDB. """ kwargs['api_key'] = app.config['TMDB_API_KEY'] - response = requests.get((TMDB_API_URL + uri).encode('utf8'), params=kwargs) + response = requests_session.get((TMDB_API_URL + uri).encode('utf8'), params=kwargs) return json.loads(response.text)
Now use requests' Session in tmdb proxy (enable keep-alive)
NaPs_Kolekto
train
py
2a420f5cd4edef189d9fa646357be3015ca9430b
diff --git a/auth/mnet/jump.php b/auth/mnet/jump.php index <HASH>..<HASH> 100644 --- a/auth/mnet/jump.php +++ b/auth/mnet/jump.php @@ -37,6 +37,13 @@ if (!is_enabled_auth('mnet')) { // If hostid hasn't been specified, try getting it using wwwroot if (!$hostid) { + $hostwwwroot = trim($hostwwwroot); + $hostwwwroot = rtrim($hostwwwroot, '/'); + + // ensure the wwwroot starts with a http or https prefix + if (strtolower(substr($hostwwwroot, 0, 4)) != 'http') { + $hostwwwroot = 'http://'.$hostwwwroot; + } $hostid = $DB->get_field('mnet_host', 'id', array('wwwroot' => $hostwwwroot)); }
MDL-<I>: Sanitize httpwwwroot in mnet jump
moodle_moodle
train
php
fcfb20a4603bb605176b528ae9afdee6ef9485a2
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,4 +15,4 @@ gulp.task("browserify-watch", function() { return gulp.watch(browserifyEntryFile, ["browserify"]); }); -gulp.task("default", ["browserify-watch"]); +gulp.task("default", ["browserify", "browserify-watch"]);
Runs the "browserify" task before entering watch mode
mariusschulz_styx
train
js
900fc0ca9900ac29ba1f5ca0100ec2c696955118
diff --git a/lib/active_scaffold/helpers/list_column_helpers.rb b/lib/active_scaffold/helpers/list_column_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold/helpers/list_column_helpers.rb +++ b/lib/active_scaffold/helpers/list_column_helpers.rb @@ -153,7 +153,7 @@ module ActiveScaffold value ||= record.send(column.name) unless record.nil? if value && column.association # cache association size before calling column_empty? associated_size = value.size if column.plural_association? and column.associated_number? # get count before cache association - cache_association(value, column) + cache_association(value, column) if column.plural_association? end if column.association.nil? or column_empty?(value) if column.form_ui == :select && column.options[:options]
cache_association for singular associations has no point, once is retrieved it will be cached
activescaffold_active_scaffold
train
rb
bf9551e87fefe36dc7f5c96e6be79cbb39c85e8c
diff --git a/public/assets/libs/appCore.js b/public/assets/libs/appCore.js index <HASH>..<HASH> 100644 --- a/public/assets/libs/appCore.js +++ b/public/assets/libs/appCore.js @@ -1635,6 +1635,11 @@ async function setUserInNavigator(user, isUserToStore) { USER = user; localStorage.token = user.token; + /** + * Clear all cache for this user + */ + (await window.indexedDB.databases()).forEach(db => { if(/^_cache_get_/.test(db.name)) window.indexedDB.deleteDatabase(db.name); }); + if (typeof isUserToStore === "undefined") { return storeUser().then(loadCacheUser).catch(e => { errorLoadingApp("obter __login", e);
clear all cache get on navigator when set user
edineibauer_uebConfig
train
js
b7376ad64342ae16dbba9c586c29adefd968b2c0
diff --git a/core/src/main/resources/lib/form/select/select.js b/core/src/main/resources/lib/form/select/select.js index <HASH>..<HASH> 100644 --- a/core/src/main/resources/lib/form/select/select.js +++ b/core/src/main/resources/lib/form/select/select.js @@ -8,7 +8,7 @@ function updateListBox(listBox,url,config) { var settingMain = listBox.closest('.setting-main') if (!settingMain) { - console.warn("Couldn't find the expected parent element (.setting-main) for element", e) + console.warn("Couldn't find the expected parent element (.setting-main) for element", listBox) return; }
Fix JavaScript typo (#<I>)
jenkinsci_jenkins
train
js