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
a2ce5c7a19a17405ce73f65f9a843ad37d8f3040
diff --git a/lib/business/calendar.rb b/lib/business/calendar.rb index <HASH>..<HASH> 100644 --- a/lib/business/calendar.rb +++ b/lib/business/calendar.rb @@ -170,6 +170,9 @@ module Business raise "Invalid day #{day}" unless DAY_NAMES.include?(normalised_day) end end + extra_working_dates_names = @extra_working_dates.map { |d| d.strftime("%a").downcase } + return if (extra_working_dates_names & @working_days).none? + raise ArgumentError, 'Extra working dates cannot be on working days' end def parse_dates(dates) diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb index <HASH>..<HASH> 100644 --- a/spec/calendar_spec.rb +++ b/spec/calendar_spec.rb @@ -162,6 +162,18 @@ describe Business::Calendar do end end + context "when working date on working day" do + subject do + Business::Calendar.new(working_days: ["mon"], + extra_working_dates: ["Monday 26th Mar, 2018"]) + end + + it do + expect { subject }.to raise_error(ArgumentError) + .with_message('Extra working dates cannot be on working days') + end + end + # A set of examples that are supposed to work when given Date and Time # objects. The implementation slightly differs, so i's worth running the # tests for both Date *and* Time.
raise if working date is on workday
gocardless_business
train
rb,rb
7b361c4a64a587775c30183b74c08cb970abba8f
diff --git a/provider/local/environ.go b/provider/local/environ.go index <HASH>..<HASH> 100644 --- a/provider/local/environ.go +++ b/provider/local/environ.go @@ -406,7 +406,7 @@ func (env *localEnviron) Destroy() error { return err } args := []string{ - osenv.JujuHomeEnvKey + "=" + osenv.JujuHome(), + "env", osenv.JujuHomeEnvKey + "=" + osenv.JujuHome(), juju, "destroy-environment", "-y", "--force", env.Name(), } cmd := exec.Command("sudo", args...) diff --git a/provider/local/environ_test.go b/provider/local/environ_test.go index <HASH>..<HASH> 100644 --- a/provider/local/environ_test.go +++ b/provider/local/environ_test.go @@ -206,6 +206,7 @@ func (s *localJujuTestSuite) TestDestroyCallSudo(c *gc.C) { c.Assert(err, gc.IsNil) expected := []string{ s.fakesudo, + "env", "JUJU_HOME=" + osenv.JujuHome(), os.Args[0], "destroy-environment",
provider/local: use "env" to propagate JUJU_HOME Sudo may not allow environment variables to be set directly, so we must use "env" to set JUJU_HOME when re-executing juju as root. Fixes lp:<I>
juju_juju
train
go,go
7b192e0b8cff72343ee314c7635b93ac42bbbd28
diff --git a/CHANGES b/CHANGES index <HASH>..<HASH> 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.4.0 (2016-06-08) ------------------ -- Add support for geocoder bounding box filter (#70) +- Add support for geocoder bounding box filter (#73) +- mapbox upload arguments in INPUT OUTPUT order, takes input on stdin (#68) 0.3.1 (2016-02-23) ------------------ diff --git a/mapboxcli/__init__.py b/mapboxcli/__init__.py index <HASH>..<HASH> 100644 --- a/mapboxcli/__init__.py +++ b/mapboxcli/__init__.py @@ -1,3 +1,3 @@ # Command line interface to Mapbox Web Services -__version__ = '0.3.1' +__version__ = '0.4.0' diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup(name='mapboxcli', 'click', 'click-plugins', 'cligj>=0.4', - 'mapbox>=0.7', + 'mapbox>=0.9', 'six' ], extras_require={
<I> release, resolves #<I>
mapbox_mapbox-cli-py
train
CHANGES,py,py
4e181b1952ab197bf7743e92750e6146a218852b
diff --git a/worldengine/cli/main.py b/worldengine/cli/main.py index <HASH>..<HASH> 100644 --- a/worldengine/cli/main.py +++ b/worldengine/cli/main.py @@ -68,7 +68,7 @@ def generate_world(world_name, width, height, seed, num_plates, output_dir, def generate_grayscale_heightmap(world, filename): - draw_grayscale_heightmap(world, filename) + draw_grayscale_heightmap_on_file(world, filename) print("+ grayscale heightmap generated in '%s'" % filename) @@ -213,8 +213,12 @@ def main(): (options, args) = parser.parse_args() - if not os.path.isdir(options.output_dir): - raise Exception("Output dir does not exist or it is not a dir") + if os.path.exists(options.output_dir): + if not os.path.isdir(options.output_dir): + raise Exception("Output dir exists but it is not a dir") + else: + print('Directory does not exist, we are creating it') + os.makedirs(options.output_dir) # it needs to be increased to be able to generate very large maps # the limit is hit when drawing ancient maps
Now output directory will be created if needed. Fixed wrong call for generate heightmap. Former-commit-id: <I>e<I>bf<I>eea4c9b7cc<I>e6b9d<I>da<I>ab
Mindwerks_worldengine
train
py
4ea1fa18a43a5179f93702328353101ac01b83ef
diff --git a/lib/doorkeeper/version.rb b/lib/doorkeeper/version.rb index <HASH>..<HASH> 100644 --- a/lib/doorkeeper/version.rb +++ b/lib/doorkeeper/version.rb @@ -6,8 +6,8 @@ module Doorkeeper module VERSION # Semantic versioning MAJOR = 4 - MINOR = 2 - TINY = 6 + MINOR = 3 + TINY = 0 # Full version number STRING = [MAJOR, MINOR, TINY].compact.join('.')
[ci skip] Bump Doorkeeper version
doorkeeper-gem_doorkeeper
train
rb
b1a9c6ef90405f9972d756881feb5077124382a9
diff --git a/lib/crash_log/configuration.rb b/lib/crash_log/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/crash_log/configuration.rb +++ b/lib/crash_log/configuration.rb @@ -52,6 +52,15 @@ module CrashLog # Project Root directory attr_accessor :project_root + # If set, this will serialize the object returned by sending this key to + # the controller context. You can use this to send user data CrashLog to + # correlate errors with users to give you more advanced data about directly + # who was affected. + # + # All user data is stored encrypted for security and always remains your + # property. + attr_accessor :user_context_key + def initialize @secure = true @use_system_ssl_cert_chain= false
Added user_context_key to config
crashlog_crashlog
train
rb
6a5905f80508a1412770538fb113114f10e8c320
diff --git a/src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js b/src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js +++ b/src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js @@ -174,10 +174,11 @@ sap.ui.define(['jquery.sap.global', '../Plugin', '../Support', '../ToolsAPI', 'j */ TechInfo.prototype.onsapUiSupportTechInfoStartE2ETrace = function(oEvent) { - var that = this; + var that = this, + sLevel = oEvent.getParameter("level"); sap.ui.require(['sap/ui/core/support/trace/E2eTraceLib'], function(E2eTraceLib) { - E2eTraceLib.start(oEvent.getParameter("level"), function(traceXml) { + E2eTraceLib.start(sLevel, function(traceXml) { Support.getStub().sendEvent(that.getId() + "FinishedE2ETrace", { trace: traceXml });
[INTERNAL] TechInfo: Fix direct access of event param in async callback oEvent was already reset at the time of access (because access happend asynchronously). This lead to an error "Cannot read property 'level' of null". BCP: <I> <I> <I> Change-Id: I<I>e5b0a<I>c6f<I>ff0ce6bdd2bc
SAP_openui5
train
js
b880d9704fd502d20f2daf8aba44acbc4fe6c779
diff --git a/Swat/SwatRadioButtonCellRenderer.php b/Swat/SwatRadioButtonCellRenderer.php index <HASH>..<HASH> 100644 --- a/Swat/SwatRadioButtonCellRenderer.php +++ b/Swat/SwatRadioButtonCellRenderer.php @@ -158,7 +158,10 @@ class SwatRadioButtonCellRenderer extends SwatCellRenderer $radio_button_tag->checked = 'checked'; } + echo '<span class="swat-radio-wrapper">'; $radio_button_tag->display(); + echo '<span class="swat-radio-shim"></span>'; + echo '</span>'; if ($this->title !== null) { $label_tag->displayContent();
Wrap checkboxes and radio buttons in an element so they may be given custom styles. svn commit r<I>
silverorange_swat
train
php
6ed8c99fdf5a772de74b359e5107624fefb61a7e
diff --git a/lib/telegram/events.rb b/lib/telegram/events.rb index <HASH>..<HASH> 100644 --- a/lib/telegram/events.rb +++ b/lib/telegram/events.rb @@ -4,7 +4,6 @@ module Telegram SERVICE = 0 MESSAGE = 1 ONLINE_STATUS = 2 - end module ActionType @@ -39,8 +38,11 @@ module Telegram @raw_data = data @time = nil - @time = Time.at(time.to_i) if time = data['date'] - @time = DateTime.strptime(time, "%Y-%m-%d %H:%M:%S") if @time == nil and time = date['when'] + @event = event + @action = action + + @time = Time.at(data['date'].to_i) if data.has_key?('date') + @time = DateTime.strptime(data['when'], "%Y-%m-%d %H:%M:%S") if @time.nil? and date.has_key?('when') case event when EventType::SERVICE @@ -95,5 +97,9 @@ module Telegram end end end + + def to_s + "<Event Type=#{@event} Action=#{@action} Time=#{@time} Message=#{@message}>" + end end end
Fix: a routine that makes time object
ssut_telegram-rb
train
rb
e66365a71c587708758f8937c87807605dbc5eb6
diff --git a/tests/getModulesByName-native.js b/tests/getModulesByName-native.js index <HASH>..<HASH> 100644 --- a/tests/getModulesByName-native.js +++ b/tests/getModulesByName-native.js @@ -27,7 +27,6 @@ var nativeModuleNames = [ 'querystring', 'readline', 'repl', - 'smalloc', 'stream', 'string_decoder', 'sys',
Looks like Node <I> doesn't know about the native smalloc module. Adjusting test.
fluidsonic_poison
train
js
8b13f860454485f0b2d73559df00a357c38d4d00
diff --git a/openquake/baselib/parallel.py b/openquake/baselib/parallel.py index <HASH>..<HASH> 100644 --- a/openquake/baselib/parallel.py +++ b/openquake/baselib/parallel.py @@ -759,12 +759,17 @@ class BaseStarmap(object): self.imap = self.pool.imap_unordered( functools.partial(safely_call, func), allargs) + def submit_all(self, progress=logging.info): + """ + :returns: an :class:`IterResult` instance + """ + futs = (mkfuture(res) for res in self.imap) + return IterResult(futs, self.func.__name__, self.num_tasks, progress) + def reduce(self, agg=operator.add, acc=None, progress=logging.info): if acc is None: acc = AccumDict() - futures = (mkfuture(res) for res in self.imap) - for res in IterResult( - futures, self.func.__name__, self.num_tasks, progress): + for res in self.submit_all(progress): acc = agg(acc, res) if self.pool: self.pool.close()
Added a method BaseStarmap.submit_all
gem_oq-engine
train
py
a27be2fab61b1cfde4d2ecbc729a4a68816fca76
diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -390,6 +390,12 @@ class SchemaTool unset($mapping['options']['comment']); } + if (isset($mapping['options']['unsigned'])) { + $options['unsigned'] = $mapping['options']['unsigned']; + + unset($mapping['options']['unsigned']); + } + $options['customSchemaOptions'] = $mapping['options']; }
added unsigned mapping to SchemaTool options
doctrine_orm
train
php
2c4a22de24ccf441351286598b1727ef16708295
diff --git a/lib/modules/apostrophe-tasks/index.js b/lib/modules/apostrophe-tasks/index.js index <HASH>..<HASH> 100644 --- a/lib/modules/apostrophe-tasks/index.js +++ b/lib/modules/apostrophe-tasks/index.js @@ -85,8 +85,8 @@ module.exports = { const argv = { _: args }; - self.apos.argv = aposArgv; Object.assign(argv, options || {}); + self.apos.argv = argv; var promise = task.callback(self.apos, argv, after); if (promise && promise.then) { return promise.then(function() {
now the mechanism to temporarily point apos.argv at the arguments for a nested task really works
apostrophecms_apostrophe
train
js
1baaee6b5a909ae637c8683bfe6955e93bcf9a28
diff --git a/spec/integrations/shared_examples.rb b/spec/integrations/shared_examples.rb index <HASH>..<HASH> 100644 --- a/spec/integrations/shared_examples.rb +++ b/spec/integrations/shared_examples.rb @@ -50,7 +50,7 @@ shared_examples_for 'Firehose::Rack::App' do # Lets have an HTTP Long poll client http_long_poll = Proc.new do |cid, last_sequence| - http = EM::HttpRequest.new(http_url).get(:head => {'pragma' => last_sequence}) + http = EM::HttpRequest.new(http_url).get(:query => {'last_message_sequence' => last_sequence}) http.errback { em.stop } http.callback do received[cid] << http.response @@ -100,7 +100,7 @@ shared_examples_for 'Firehose::Rack::App' do it "should return 400 error for long-polling when using http long polling and sequence header is < 0" do em 5 do - http = EM::HttpRequest.new(http_url).get(:head => {'pragma' => -1}) + http = EM::HttpRequest.new(http_url).get(:query => {'last_message_sequence' => -1}) http.errback { |e| raise e.inspect } http.callback do http.response_header.status.should == 400
fix tests for 'use query string instead of headers because android can't use headers'
firehoseio_firehose
train
rb
8be8543c211a7a45ad679776cac7d93dde2bd446
diff --git a/lib/seory/dsl.rb b/lib/seory/dsl.rb index <HASH>..<HASH> 100644 --- a/lib/seory/dsl.rb +++ b/lib/seory/dsl.rb @@ -4,12 +4,18 @@ require 'seory/repository' module Seory module Dsl def describe(&block) - @repository = Repository.new - Descriptor.new(@repository).describe(&block) + Descriptor.new(seory_repository).describe(&block) end + alias seo_content describe def lookup(controller) - @repository.lookup(controller) + seory_repository.lookup(controller) + end + + private + + def seory_repository + @__seory_repository ||= Repository.new end autoload :PageContentsBuilder, 'seory/dsl/page_contents_builder'
Extract Repository instanciation to private method
esminc_seory
train
rb
a4a31a08c3c0a750bc526b9f644156bc54b3020d
diff --git a/two_factor/views/utils.py b/two_factor/views/utils.py index <HASH>..<HASH> 100644 --- a/two_factor/views/utils.py +++ b/two_factor/views/utils.py @@ -111,8 +111,8 @@ class IdempotentSessionWizardView(SessionWizardView): raise SuspiciousOperation(_('ManagementForm data is missing or has been tampered with')) form_current_step = management_form.cleaned_data['current_step'] - if (form_current_step != self.steps.current and - self.storage.current_step is not None): + if (form_current_step != self.steps.current + and self.storage.current_step is not None): # form refreshed, change current step self.storage.current_step = form_current_step # -- End duplicated code from upstream
Binary operators should not be at the end of a line
Bouke_django-two-factor-auth
train
py
1c00ef5b8e967c979dbe8fdc8933d6feb97dc528
diff --git a/odl/discr/tensor_ops.py b/odl/discr/tensor_ops.py index <HASH>..<HASH> 100644 --- a/odl/discr/tensor_ops.py +++ b/odl/discr/tensor_ops.py @@ -147,11 +147,10 @@ class PointwiseNorm(PointwiseTensorFieldOperator): 0 and 1 are currently not supported due to numerical instability. Default: ``vfspace.exponent`` - weight : `array-like` or float, optional + weight : `array-like` or positive float, optional Weighting array or constant for the norm. If an array is given, its length must be equal to ``domain.size``, and - all entries must be positive. A provided constant must be - positive. + all entries must be positive. By default, the weights are is taken from ``domain.weighting``. Note that this excludes unusual weightings with custom inner product, norm or dist.
MAINT: minor style fix to PointwiseNorm
odlgroup_odl
train
py
1ba04629a54d07f17dd05fca1e30c809a7f6396b
diff --git a/specter/reporting/console.py b/specter/reporting/console.py index <HASH>..<HASH> 100644 --- a/specter/reporting/console.py +++ b/specter/reporting/console.py @@ -20,6 +20,7 @@ class ConsoleReporter(AbstractConsoleReporter, AbstractSerialReporter): self.failed_tests = 0 self.incomplete_tests = 0 self.output_docstrings = output_docstrings + self.show_all = False def get_name(self): return 'Simple BDD Serial console reporter' @@ -32,6 +33,8 @@ class ConsoleReporter(AbstractConsoleReporter, AbstractSerialReporter): def process_arguments(self, args): if args.no_color: self.use_color = False + if args.show_all_expects: + self.show_all = True def get_test_case_status(self, test_case, name): status = TestStatus.FAIL @@ -86,8 +89,8 @@ class ConsoleReporter(AbstractConsoleReporter, AbstractSerialReporter): for line in test_case.error: self.output(line, level+2, TestStatus.FAIL) - #if status == TestStatus.FAIL: - print_expects(test_case, level, self.use_color) + if status == TestStatus.FAIL or self.show_all: + print_expects(test_case, level, self.use_color) def subscribe_to_spec(self, spec): spec.add_listener(TestEvent.COMPLETE, self.test_complete)
Turning off showing expects by default
jmvrbanac_Specter
train
py
cc1905dd9598d894818354ae9e15349f489f645a
diff --git a/lib/double_entry.rb b/lib/double_entry.rb index <HASH>..<HASH> 100644 --- a/lib/double_entry.rb +++ b/lib/double_entry.rb @@ -49,10 +49,6 @@ module DoubleEntry class UserAccountNotLocked < RuntimeError; end class AccountWouldBeSentNegative < RuntimeError; end - def self.table_name_prefix - 'double_entry_' - end - class << self attr_accessor :accounts, :transfers @@ -223,6 +219,10 @@ module DoubleEntry final_balance == sum_of_amounts && final_balance == cached_balance end + def table_name_prefix + 'double_entry_' + end + private delegate :connection, :to => ActiveRecord::Base
Put table_name_prefix in the right spot
envato_double_entry
train
rb
14ff1f83308020c9bf55639f69a9b302d04a5646
diff --git a/agents/lib/instance.rb b/agents/lib/instance.rb index <HASH>..<HASH> 100644 --- a/agents/lib/instance.rb +++ b/agents/lib/instance.rb @@ -30,7 +30,7 @@ require File.join(File.dirname(__FILE__), 'instance', 'duplicable') require File.join(File.dirname(__FILE__), 'instance', 'executable_sequence_proxy') require File.join(File.dirname(__FILE__), 'instance', 'instance_commands') require File.join(File.dirname(__FILE__), 'instance', 'instance_configuration') -require File.join(File.dirname(__FILE__), 'instance', 'instance_state') +require File.normalize_path(File.join(File.dirname(__FILE__), 'instance', 'instance_state')) require File.join(File.dirname(__FILE__), 'instance', 'chef_state') require File.join(File.dirname(__FILE__), 'instance', 'login_manager') require File.join(File.dirname(__FILE__), 'instance', 'options_bag')
Refs# <I> - normalize instance_state require path to prevent override of monkey patch when under test
rightscale_right_link
train
rb
7dee737ee6fb36a9357911745d1081d72a7d6bfb
diff --git a/lib/fluent/winsvc.rb b/lib/fluent/winsvc.rb index <HASH>..<HASH> 100644 --- a/lib/fluent/winsvc.rb +++ b/lib/fluent/winsvc.rb @@ -61,7 +61,6 @@ begin end def service_main - @pid = service_main_start(@service_name) while running? sleep 10 @@ -69,13 +68,23 @@ begin end def service_stop - ev = Win32::Event.open(@service_name) - ev.set - ev.close + set_event(@service_name) if @pid > 0 Process.waitpid(@pid) end end + + def service_paramchange + set_event("#{@service_name}_USR2") + end + + private + + def set_event(event_name) + ev = Win32::Event.open(event_name) + ev.set + ev.close + end end FluentdService.new(opts[:service_name]).mainloop
Add grace-reload trigger for windows service You can trigger it by the following command: sc control fluentdwinsvc paramchange
fluent_fluentd
train
rb
bd50d8330c464f56d9bcb6089e231e287693a4b8
diff --git a/chef/lib/chef/provider/execute.rb b/chef/lib/chef/provider/execute.rb index <HASH>..<HASH> 100644 --- a/chef/lib/chef/provider/execute.rb +++ b/chef/lib/chef/provider/execute.rb @@ -54,7 +54,7 @@ class Chef if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? opts[:live_stream] = STDOUT end - converge_by("would execute #{@new_resource}") do + converge_by("would execute #{@new_resource.command}") do result = shell_out!(@new_resource.command, opts) Chef::Log.info("#{@new_resource} ran successfully") end
made execute provider why-run more descriptive
chef_chef
train
rb
8b471108a10c3cc93a2f8e09fa2a70b7b43530a1
diff --git a/core/src/main/java/com/graphhopper/GraphHopper.java b/core/src/main/java/com/graphhopper/GraphHopper.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/graphhopper/GraphHopper.java +++ b/core/src/main/java/com/graphhopper/GraphHopper.java @@ -467,7 +467,6 @@ public class GraphHopper { if (tagParserManager != null) throw new IllegalStateException("Cannot call init twice. EncodingManager was already initialized."); - emBuilder.setDateRangeParser(DateRangeParser.createInstance(ghConfig.getString("datareader.date_range_parser_day", ""))); setProfiles(ghConfig.getProfiles()); tagParserManager = buildEncodingManager(ghConfig); @@ -522,6 +521,7 @@ public class GraphHopper { if (profilesByName.isEmpty()) throw new IllegalStateException("no profiles exist but assumed to create EncodingManager. E.g. provide them in GraphHopperConfig when calling GraphHopper.init"); + emBuilder.setDateRangeParser(DateRangeParser.createInstance(ghConfig.getString("datareader.date_range_parser_day", ""))); String flagEncodersStr = ghConfig.getString("graph.flag_encoders", ""); Map<String, String> flagEncoderMap = new LinkedHashMap<>(); for (String encoderStr : flagEncodersStr.split(",")) {
Move date range parser initialization into buildEncodingManager
graphhopper_graphhopper
train
java
e2719a787aeecc03861ac23bd3b6c5218abea553
diff --git a/src/Authorizer/SamlAuthorizer.php b/src/Authorizer/SamlAuthorizer.php index <HASH>..<HASH> 100644 --- a/src/Authorizer/SamlAuthorizer.php +++ b/src/Authorizer/SamlAuthorizer.php @@ -10,6 +10,7 @@ namespace ActiveCollab\Authentication\Authorizer; use ActiveCollab\Authentication\AuthenticatedUser\RepositoryInterface; use ActiveCollab\Authentication\Exception\UserNotFoundException; +use LightSaml\ClaimTypes; use LightSaml\Model\Context\DeserializationContext; use LightSaml\Model\Protocol\Response; @@ -45,12 +46,12 @@ class SamlAuthorizer implements AuthorizerInterface $username = null; foreach ($saml_response->getAllAssertions() as $assertion) { - if ($assertion->getSubject()) { - $username = $assertion->getSubject()->getNameID(); + foreach ($assertion->getAllAttributeStatements() as $statement) { + $username = $statement->getFirstAttributeByName(ClaimTypes::EMAIL_ADDRESS); } } - $user = $this->user_repository->findByUsername($username->getValue()); + $user = $this->user_repository->findByUsername($username); if (!$user) { throw new UserNotFoundException();
Refactor for parse saml response
activecollab_authentication
train
php
0fa54ed69bd976be233640390487a60a7810178e
diff --git a/lib/geos/extensions/version.rb b/lib/geos/extensions/version.rb index <HASH>..<HASH> 100644 --- a/lib/geos/extensions/version.rb +++ b/lib/geos/extensions/version.rb @@ -1,7 +1,7 @@ module Geos module Extensions - VERSION = "0.3.0" + VERSION = "0.3.1.dev" end end
Bump to version <I>.dev.
dark-panda_geos-extensions
train
rb
a9612a45e8d1c7d122674f054d2ecc5573c4f033
diff --git a/core-bundle/src/Resources/contao/dca/tl_content.php b/core-bundle/src/Resources/contao/dca/tl_content.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/dca/tl_content.php +++ b/core-bundle/src/Resources/contao/dca/tl_content.php @@ -266,7 +266,7 @@ $GLOBALS['TL_DCA']['tl_content'] = array 'exclude' => true, 'search' => true, 'inputType' => 'text', - 'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'tl_class'=>'w50 wizard'), + 'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'filesOnly'=>true, 'tl_class'=>'w50 wizard'), 'wizard' => array ( array('tl_content', 'pagePicker')
[Core] Fix switching between the page and file picker in the URL wizard (see #<I>).
contao_contao
train
php
b2ce535a59c9aed8f1f2097414350bd7ca0d2e17
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MethodCanBeStaticTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MethodCanBeStaticTest.java index <HASH>..<HASH> 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MethodCanBeStaticTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MethodCanBeStaticTest.java @@ -206,4 +206,18 @@ public class MethodCanBeStaticTest { "}") .doTest(); } + + @Test + public void negative_referencesTypeVariable() { + testHelper + .addSourceLines( + "Test.java", + "class Test<T> {", + " private int add(int x, int y) {", + " T t = null;", + " return x + y;", + " }", + "}") + .doTest(); + } }
Add a test for MethodCanBeStatic to demonstrate that it understands accesses of type variables. MOE_MIGRATED_REVID=<I>
google_error-prone
train
java
13cc4e0c903fdd80dbb9b895c6c7f67f7aff38f2
diff --git a/benchexec/tools/nitwit.py b/benchexec/tools/nitwit.py index <HASH>..<HASH> 100644 --- a/benchexec/tools/nitwit.py +++ b/benchexec/tools/nitwit.py @@ -58,16 +58,16 @@ class Tool(benchexec.tools.template.BaseTool2): about result codes. @return: status of validator after executing a run """ - if run.exit_code.signal is None and (run.exit_code.value == 0 or run.exit_code.value == 245): + if run.exit_code.value in [0, 245]: status = result.RESULT_FALSE_REACH - elif run.exit_code.value is None or run.exit_code.value in [-9, 9]: + elif (run.exit_code.signal == 9) or run.exit_code.value == 9: status = "TIMEOUT" elif run.exit_code.value in [4, 5, 241, 242, 243, 250]: status = result.RESULT_UNKNOWN else: status = result.RESULT_ERROR - if run.output.any_line_contains("Out of memory") or (run.exit_code.value == 251): + if ("out of memory!".lower() in (line.lower() for line in run.output)) or (run.exit_code.value == 251): status = "OUT OF MEMORY" if not status:
Resolve issues with parsing/looking for "out of memory" output.
sosy-lab_benchexec
train
py
e776562b16d7d37b44d25e30a33e9f3ff3e6c2e3
diff --git a/lib/disney/disneyFacilityChannel.js b/lib/disney/disneyFacilityChannel.js index <HASH>..<HASH> 100644 --- a/lib/disney/disneyFacilityChannel.js +++ b/lib/disney/disneyFacilityChannel.js @@ -96,7 +96,7 @@ class FacilityChannel { return Cache.DB().then((db) => { return new Promise((resolve, reject) => { const tidyID = TidyDisneyID(facilityID); - db.get("SELECT C2.key, C2.value FROM cache AS C1 INNER JOIN cache AS C2 ON C2.key = trim(C1.value,'\"') WHERE C1.key = ?;", [this.Cache.Prefix + tidyID], (err, row) => { + db.get("SELECT C2.key, C2.value FROM cache AS C1 INNER JOIN cache AS C2 ON C2.key = C1.value WHERE C1.key = ?;", [this.Cache.Prefix + tidyID], (err, row) => { if (err) { return reject(`Error getting cached facility data from channel for ${facilityID}: ${err}`); }
[~] Remove superfluous trim in SQL query for fetching facility docs
cubehouse_themeparks
train
js
a6aaf831f3ee61e9d52d5b2e3e3ed57964537cad
diff --git a/best/plot.py b/best/plot.py index <HASH>..<HASH> 100644 --- a/best/plot.py +++ b/best/plot.py @@ -19,7 +19,7 @@ from pymc.distributions import noncentral_t_like pretty_blue = '#89d1ea' def plot_posterior( sample_vec, bins=None, ax=None, title=None, stat='mode', - label='', draw_zero=False ): + label='', draw_zero=False ): hdi_min, hdi_max = hdi_of_mcmc( sample_vec ) @@ -48,8 +48,12 @@ def plot_posterior( sample_vec, bins=None, ax=None, title=None, stat='mode', raise ValueError('unknown stat %s'%stat) if ax is not None: - ax.hist( sample_vec, bins=bins, rwidth=0.8, - facecolor=pretty_blue, edgecolor='none' ) + if bins is not None: + kwargs = {'bins':bins} + else: + kwargs = {} + ax.hist( sample_vec, rwidth=0.8, + facecolor=pretty_blue, edgecolor='none', **kwargs ) if title is not None: ax.set_title( title )
bugfix: set bins only if not None
strawlab_best
train
py
b129540db811bdc66a06cd251e06e88a4680adfc
diff --git a/libs/search.js b/libs/search.js index <HASH>..<HASH> 100644 --- a/libs/search.js +++ b/libs/search.js @@ -22,7 +22,7 @@ var intersectsToObj = function (intersects) { }; // Search class -function Search(event, customClient) { +function Search(event, esClient) { var params; logger.debug('received query:', event.query); @@ -52,6 +52,7 @@ function Search(event, customClient) { this.size = parseInt((params.limit) ? params.limit : 1); this.frm = (page - 1) * this.size; this.page = parseInt((params.skip) ? params.skip : page); + this.client = esClient }; var aoiCoveragePercentage = function (feature, scene, aoiArea) {
fix esclient in search class
sat-utils_sat-api-lib
train
js
e7f4768668ecec238f45ef881c4db8b5e77bbb74
diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index <HASH>..<HASH> 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -120,7 +120,7 @@ EOT $file->write($options); - if ($input->isInteractive()) { + if ($input->isInteractive() && is_dir('.git')) { $ignoreFile = realpath('.gitignore'); if (false === $ignoreFile) {
Only ask for gitignore if the current dir is a git repo, fixes composer/satis#<I>
mothership-ec_composer
train
php
876b427fbe8d802041eb12b43cc709842bec43aa
diff --git a/respite/middleware.py b/respite/middleware.py index <HASH>..<HASH> 100644 --- a/respite/middleware.py +++ b/respite/middleware.py @@ -23,6 +23,7 @@ class HttpMethodOverrideMiddleware: if '_method' in request.POST: request._raw_post_data = re.sub(r'_method=(PUT|PATCH|DELETE)&?', '', request.raw_post_data) + request.META.setdefault('HTTP_X_CSRFTOKEN',request.POST.get('csrfmiddlewaretoken', '')) class HttpPutMiddleware: """
Transfer csrfmiddlewaretoken into HTTP_X_CSRFTOKEN Prevent csrf exceptions on POST forms
jgorset_django-respite
train
py
53fffc4f7ab2d2c8b2d74d91a7a37ccea1670c63
diff --git a/lib/luck/display.rb b/lib/luck/display.rb index <HASH>..<HASH> 100644 --- a/lib/luck/display.rb +++ b/lib/luck/display.rb @@ -31,7 +31,6 @@ class Display def initialize &blck @panes = {} @dirty = true - prepare_modes size = terminal_size @width = size[1] @@ -151,6 +150,21 @@ class Display $stdout.flush end + # Run Luck until it errors or is stopped via Ctrl-C. + def run + trap 'INT' do + undo_modes + end + + prepare_modes + begin + handle while sleep 0.01 + rescue => ex + undo_modes + puts ex.class, ex.message, ex.backtrace + end + end + # Handle standard input. def handle_stdin $stdin.read_nonblock(1024).each_char do |chr|
Added Display#run to make Luck applications cleaner
danopia_luck
train
rb
28895292011474f90036ff52f85cf7779c9b5bcc
diff --git a/compiler/js/component.py b/compiler/js/component.py index <HASH>..<HASH> 100644 --- a/compiler/js/component.py +++ b/compiler/js/component.py @@ -282,8 +282,8 @@ class component_generator(object): if isinstance(value, component_generator): var = "%s_%s" %(parent, escape(target)) - prologue.append('\tvar %s' %var) if target != "delegate": + prologue.append('\tvar %s' %var) prologue.append("%s%s = new _globals.%s(%s)" %(ident, var, registry.find_component(value.package, value.component.name), parent)) r.append(self.call_create(registry, ident_n, var, value)) r.append('%s%s.%s = %s' %(ident, parent, target, var))
removed delegate var from prologue
pureqml_qmlcore
train
py
02ccda8130549cca520d5083fd4258c18eebda26
diff --git a/system/modules/DocumentManagementSystem/config/initialize.php b/system/modules/DocumentManagementSystem/config/initialize.php index <HASH>..<HASH> 100644 --- a/system/modules/DocumentManagementSystem/config/initialize.php +++ b/system/modules/DocumentManagementSystem/config/initialize.php @@ -85,7 +85,7 @@ class DocumentManagementSystemInitializer extends \Controller if ($objDir->next()) { - $uuid = \String::binToUuid($objDir->uuid); + $uuid = \StringUtil::binToUuid($objDir->uuid); } if ($uuid == null) @@ -93,7 +93,7 @@ class DocumentManagementSystemInitializer extends \Controller if (file_exists(TL_ROOT . '/' . self::DMS_BASE_DIRECTORY_VALUE)) { $objDir = \Dbafs::addResource(self::DMS_BASE_DIRECTORY_VALUE); - $uuid = \String::binToUuid($objDir->uuid); + $uuid = \StringUtil::binToUuid($objDir->uuid); } else {
Adjust the code to be compatible with PHP7 (belongs to #<I>)
ContaoDMS_dms
train
php
afe964b96f9a8c46480327c0cb87e8a58245486d
diff --git a/pandas/stats/tests/test_ols.py b/pandas/stats/tests/test_ols.py index <HASH>..<HASH> 100644 --- a/pandas/stats/tests/test_ols.py +++ b/pandas/stats/tests/test_ols.py @@ -53,10 +53,12 @@ class TestOLS(BaseTest): self.checkDataSet(datasets.cpunish.load(), skip_moving=True) self.checkDataSet(datasets.longley.load(), skip_moving=True) self.checkDataSet(datasets.stackloss.load(), skip_moving=True) - self.checkDataSet(datasets.ccard.load(), 39, 49) # one col in X all 0s self.checkDataSet(datasets.copper.load()) self.checkDataSet(datasets.scotland.load()) + # degenerate case fails on some platforms + # self.checkDataSet(datasets.ccard.load(), 39, 49) # one col in X all 0s + def checkDataSet(self, dataset, start=None, end=None, skip_moving=False): exog = dataset.exog[start : end] endog = dataset.endog[start : end]
TST: excluding degenerate test case in OLS, address GH #<I>
pandas-dev_pandas
train
py
5a18c2575ca7427e9243d922cfed16e82d1d9861
diff --git a/tracext/github.py b/tracext/github.py index <HASH>..<HASH> 100644 --- a/tracext/github.py +++ b/tracext/github.py @@ -90,7 +90,7 @@ class GitHubLoginModule(LoginModule): redirect_uri = req.abs_href.github('oauth') # Inner import to avoid a hard dependency on requests-oauthlib. from requests_oauthlib import OAuth2Session - return OAuth2Session(client_id, redirect_uri=redirect_uri, scope=[]) + return OAuth2Session(client_id, redirect_uri=redirect_uri, scope=['']) def _client_config(self, key): assert key in ('id', 'secret')
Avoid triggering oauthlib's scope change warning. Without this change and with a recent version of oauthlib, login would fail with this error: Warning: Scope has changed from "" to "". Fix #<I>. Thanks @rjollos for the report.
trac-hacks_trac-github
train
py
34017e16f821dcd85d3264b135e2819a41c3e55d
diff --git a/core/src/main/java/org/bitcoinj/testing/TestWithPeerGroup.java b/core/src/main/java/org/bitcoinj/testing/TestWithPeerGroup.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/bitcoinj/testing/TestWithPeerGroup.java +++ b/core/src/main/java/org/bitcoinj/testing/TestWithPeerGroup.java @@ -34,7 +34,9 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; /** - * Utility class that makes it easy to work with mock NetworkConnections in PeerGroups. + * You can derive from this class and call peerGroup.start() in your tests to get a functional PeerGroup that can be + * used with loopback peers created using connectPeer. This involves real TCP connections so is a pretty accurate + * mock, but means unit tests cannot be run simultaneously. */ public class TestWithPeerGroup extends TestWithNetworkConnections { protected static final NetworkParameters params = UnitTestParams.get(); @@ -72,7 +74,8 @@ public class TestWithPeerGroup extends TestWithNetworkConnections { super.tearDown(); blockJobs = false; Utils.finishMockSleep(); - peerGroup.stopAsync(); + if (peerGroup.isRunning()) + peerGroup.stopAsync(); } catch (Exception e) { throw new RuntimeException(e); }
TestWithPeerGroup: don't stopAsync if the peergroup isn't running and update the class description.
bitcoinj_bitcoinj
train
java
cf5d72be3b6044f6f2f49050c4f8514a62ca4302
diff --git a/src/models/Link.php b/src/models/Link.php index <HASH>..<HASH> 100644 --- a/src/models/Link.php +++ b/src/models/Link.php @@ -4,10 +4,10 @@ namespace typedlinkfield\models; use craft\base\Element; use craft\base\ElementInterface; +use craft\base\Model; use craft\helpers\Html; use craft\helpers\Template; use typedlinkfield\Plugin; -use yii\base\Model; /** * Class Link
Let the link class extend the default craft model class
sebastian-lenz_craft-linkfield
train
php
adfa87936df97efa68f814ebd1bda953973ea565
diff --git a/lxd/device/device.go b/lxd/device/device.go index <HASH>..<HASH> 100644 --- a/lxd/device/device.go +++ b/lxd/device/device.go @@ -17,6 +17,7 @@ var devTypes = map[string]func(config.Device) device{ "unix-char": func(c config.Device) device { return &unixCommon{} }, "unix-block": func(c config.Device) device { return &unixCommon{} }, "disk": func(c config.Device) device { return &disk{} }, + "none": func(c config.Device) device { return &none{} }, } // VolatileSetter is a function that accepts one or more key/value strings to save into the LXD
device/device: Links up none device type
lxc_lxd
train
go
6a99d9537763fe18fc7e58cf6021f49ba3524fe8
diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index <HASH>..<HASH> 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -99,7 +99,7 @@ class OptionParser(optparse.OptionParser): optparse.OptionParser.__init__(self, *args, **kwargs) - if '%prog' in self.epilog: + if self.epilog and '%prog' in self.epilog: self.epilog = self.epilog.replace('%prog', self.get_prog_name()) def parse_args(self, args=None, values=None):
Allow settings the parser's epilog to `None`.
saltstack_salt
train
py
a9bf743806be971c84bb5b08c7df4e13b6d74d89
diff --git a/test/test_crispy.rb b/test/test_crispy.rb index <HASH>..<HASH> 100644 --- a/test/test_crispy.rb +++ b/test/test_crispy.rb @@ -252,8 +252,18 @@ class TestCrispy < MiniTest::Test CrispyWorld.reset end + module CommonClassSpyTests + def test_spy_changes_stubbed_method + @object_instances.each do|object| + assert_equal(:stubbed_instance_method1, object.method_to_stub1) + assert_equal(:stubbed_instance_method2, object.method_to_stub2) + end + end + end + class TestReceivedMessage < self include CommonSpyTests + include CommonClassSpyTests def object_class ObjectClass @@ -329,6 +339,7 @@ class TestCrispy < MiniTest::Test end class TestReceivedMessageWithReceiver < self + include CommonClassSpyTests def object_class ObjectClassNonBasic
add test for stubbing a class's method
igrep_crispy
train
rb
3753317d82e901e440ae8850641415c734c282f2
diff --git a/packages/@vue/cli-test-utils/createTestProject.js b/packages/@vue/cli-test-utils/createTestProject.js index <HASH>..<HASH> 100644 --- a/packages/@vue/cli-test-utils/createTestProject.js +++ b/packages/@vue/cli-test-utils/createTestProject.js @@ -3,6 +3,8 @@ const path = require('path') const execa = require('execa') module.exports = function createTestProject (name, preset, cwd, initGit) { + delete process.env.VUE_CLI_SKIP_WRITE + cwd = cwd || path.resolve(__dirname, '../../test') const projectRoot = path.resolve(cwd, name)
test: allow generateWithPlugin & createTestProject to be invoked in the same file
vuejs_vue-cli
train
js
6e0c71ac02b2f7c4788cca0d238380ab55231af7
diff --git a/packages/@glimmer/blueprint/files/ember-cli-build.js b/packages/@glimmer/blueprint/files/ember-cli-build.js index <HASH>..<HASH> 100644 --- a/packages/@glimmer/blueprint/files/ember-cli-build.js +++ b/packages/@glimmer/blueprint/files/ember-cli-build.js @@ -7,18 +7,5 @@ module.exports = function(defaults) { // Add options here }); - // Use `app.import` to add additional libraries to the generated - // output files. - // - // If you need to use different assets in different - // environments, specify an object as the first parameter. That - // object's keys should be the environment name and the values - // should be the asset to use in that environment. - // - // If the library that you are including contains AMD or ES6 - // modules that you would like to import into your application - // please specify an object with the list of modules as keys - // along with the exports of each module as its value. - return app.toTree(); };
Update ember-cli-build.js
glimmerjs_glimmer.js
train
js
a01b7ae6577fcca9e0b751c14cbb4a9f9a67d035
diff --git a/lib/lib.go b/lib/lib.go index <HASH>..<HASH> 100644 --- a/lib/lib.go +++ b/lib/lib.go @@ -13,7 +13,7 @@ var progname = filepath.Base(os.Args[0]) // ProgName returns what lib thinks the program name is, namely the // basename of of argv0. // -// It is similar to the Linux __progname. +// It is similar to the Linux __progname function. func ProgName() string { return progname } @@ -55,15 +55,6 @@ func Err(exit int, err error, format string, a ...interface{}) { os.Exit(exit) } -// CheckFatal calls Err if err isn't nil. -func CheckFatal(err error, format string, a ...interface{}) { - if err == nil { - return - } - - Err(ExitFailure, err, format, a...) -} - // Itoa provides cheap integer to fixed-width decimal ASCII. Give a // negative width to avoid zero-padding. Adapted from the 'itoa' // function in the log/log.go file in the standard library.
Deprecate CheckFatal in favour of assert package.
kisom_goutils
train
go
256056ee6e4ce4ba0fe33d1a0e17db963a803bca
diff --git a/merb-parts/lib/merb-parts/part_controller.rb b/merb-parts/lib/merb-parts/part_controller.rb index <HASH>..<HASH> 100644 --- a/merb-parts/lib/merb-parts/part_controller.rb +++ b/merb-parts/lib/merb-parts/part_controller.rb @@ -41,5 +41,10 @@ module Merb super(action) @body end + + # Send any methods that are missing back up to the web controller + def method_missing(sym, *args, &blk) + @web_controller.send(sym, *args, &blk) + end end end \ No newline at end of file
[merb-parts] Adds method missing so that controller methods are available in parts
wycats_merb
train
rb
2186535848630a0d9777e6afaf6ca4a63488739d
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -195,8 +195,6 @@ class Container implements ContainerInterface, \ArrayAccess if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { throw new \InvalidArgumentException(sprintf('The service "%s" does not exist.', $id)); - } else { - return null; } }
[DependencyInjection] Removed useless code
symfony_symfony
train
php
a81adf76faceba608b98bce91d580d8067560daa
diff --git a/channelpack/readtxt.py b/channelpack/readtxt.py index <HASH>..<HASH> 100644 --- a/channelpack/readtxt.py +++ b/channelpack/readtxt.py @@ -411,11 +411,13 @@ def textpack(fname, chnames=None, delimiter=None, skiprows=0, usecols=None, return columndata + filename = '' if type(fname) is str: with io.open(fname, encoding=encoding) as fo: for i in range(skiprows): fo.readline() packdict = datadict(fo, debugoutput=debug) + filename = fname else: # some kind of io if type(fname.read(1)) is bytes: @@ -424,8 +426,14 @@ def textpack(fname, chnames=None, delimiter=None, skiprows=0, usecols=None, for i in range(skiprows): fname.readline() packdict = datadict(fname, debugoutput=debug) + try: + filename = fname.name + except AttributeError: + pass - return cp.ChannelPack(data=packdict, chnames=chnames or {}) + pack = cp.ChannelPack(data=packdict, chnames=chnames) + pack.fn = filename + return pack def linetuples(fo, bytehint=False, delimiter=None, usecols=None,
Attempt to add filename to the pack The conditional empty dict is not useful since None is now accepted as argument to the pack.
tomnor_channelpack
train
py
1cc940aa9192761eb27e95b49fb3a25180840d76
diff --git a/scsocket.js b/scsocket.js index <HASH>..<HASH> 100644 --- a/scsocket.js +++ b/scsocket.js @@ -160,6 +160,12 @@ var SCSocket = function (options) { 'fail': 1 }; + this._persistentEvents = { + 'subscribe': 1, + 'unsubscribe': 1, + 'ready': 1 + }; + this._connectAttempts = 0; this._cid = 1; @@ -486,7 +492,8 @@ SCSocket.prototype.emit = function (event, data, callback) { this._emitBuffer.push(eventObject); if (this._emitBuffer.length < 2 && this.connected) { this._flushEmitBuffer(); - } else { + } else if (!this._persistentEvents[event]) { + // Persistent events should never timeout eventObject.timeout = setTimeout(function () { var error = new Error("Event response for '" + event + "' timed out due to failed connection"); callback && callback(error, eventObject);
Persistent events should never timeout
SocketCluster_socketcluster-client
train
js
e6a3779e040da3075b82e4184925dfb44f9467da
diff --git a/duradmin/src/main/webapp/js/spaces-manager.js b/duradmin/src/main/webapp/js/spaces-manager.js index <HASH>..<HASH> 100644 --- a/duradmin/src/main/webapp/js/spaces-manager.js +++ b/duradmin/src/main/webapp/js/spaces-manager.js @@ -134,7 +134,7 @@ $(function(){ //used in conjunctions with the jquery.validate.js and jquery.form $.validator .addMethod("mimetype", function(value, element) { - return value == null || value == '' || /^(\w[-]?)*\w\/(\w[-]?)*\w$/.test(value); + return value == null || value == '' || /^(\w[-]?)*\w\/(\w[-+]?)*\w$/.test(value); }, "Invalid Mimetype"); $.validator
This update resolves <URL>
duracloud_duracloud
train
js
2d5bbaf4c8599ea2f6700c4ab99b46fe69ea4140
diff --git a/csirtg_indicator/format/zzeek.py b/csirtg_indicator/format/zzeek.py index <HASH>..<HASH> 100644 --- a/csirtg_indicator/format/zzeek.py +++ b/csirtg_indicator/format/zzeek.py @@ -57,7 +57,7 @@ def _i_to_zeek(i, cols): y = str(y) if isinstance(y, str): - y = y.replace('\n', ' ') + y = re.sub(r'\r|\t|\n', ' ', y) if PYVERSION == 2: if isinstance(y, unicode):
Replace tabs and newlines (#<I>) Other whitespace characters like CRs and tabs in fields can misalign formatting. Replace any of those instances in a single field with spaces.
csirtgadgets_csirtg-indicator-py
train
py
4e778f627f96c6b66e4bdeb598177e39dddb7d82
diff --git a/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/SVNConfiguration.java b/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/SVNConfiguration.java index <HASH>..<HASH> 100644 --- a/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/SVNConfiguration.java +++ b/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/SVNConfiguration.java @@ -31,7 +31,13 @@ public class SVNConfiguration implements UserPasswordConfiguration<SVNConfigurat public static Form form(List<IssueServiceConfigurationRepresentation> availableIssueServiceConfigurations) { return Form.create() .with(defaultNameField()) - .url() + .with( + // Note that the URL property cannot be implemented through a URL field + // since some SVN repository URL could use the svn: protocol or other. + Text.of("url") + .label("URL") + .help("URL to the root of a SVN repository") + ) .with( Text.of("user") .label("User")
SVN: configuration: cannot use URL field because the svn: protocol must be supported
nemerosa_ontrack
train
java
5ad08445145dccfedd6c21f0c72f964afdefa04a
diff --git a/src/editor/InlineTextEditor.js b/src/editor/InlineTextEditor.js index <HASH>..<HASH> 100644 --- a/src/editor/InlineTextEditor.js +++ b/src/editor/InlineTextEditor.js @@ -197,14 +197,13 @@ define(function (require, exports, module) { var $lineNumber = $("<span>" + (startLine + 1) + "</span>"); - var $fancyname = $("<span></span>").text(doc.file.name).attr("title",doc.file.fullPath); - $filenameDiv.append($dirtyIndicatorDiv) - .append($fancyname) - .append(" : ") - .append($lineNumber); + var $nameWithTooltip = $("<span></span>").text(doc.file.name).attr("title", doc.file.fullPath); + $filenameDiv.append($dirtyIndicatorDiv) + .append($nameWithTooltip) + .append(" : ") + .append($lineNumber); $wrapperDiv.append($filenameDiv); - var inlineInfo = EditorManager.createInlineEditorForDocument(doc, range, wrapperDiv, closeThisInline, additionalKeys); this.editors.push(inlineInfo.editor); container.appendChild(wrapperDiv);
Updated variable name, removed extra space, fixed space/tab issue. Again, thanks to Peter for the help.
adobe_brackets
train
js
db77d52b2928162efcb5bf2e56738bb3888623f8
diff --git a/src/AlgoliaSearch/Client.php b/src/AlgoliaSearch/Client.php index <HASH>..<HASH> 100644 --- a/src/AlgoliaSearch/Client.php +++ b/src/AlgoliaSearch/Client.php @@ -712,7 +712,6 @@ class Client */ public static function generateSecuredApiKey($privateApiKey, $query, $userToken = null) { - $urlEncodedQuery = ''; if (is_array($query)) { $queryParameters = array(); if (array_keys($query) !== array_keys(array_keys($query))) {
Remove unused variable 'urlEncodedQuery'. The value of the variable is overwritten immediately.
algolia_algoliasearch-client-php
train
php
17bb81baa2936c82297dbdb02882b1b983356261
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,7 +49,7 @@ module.exports = function (grunt) { unit: { configFile: 'karma.conf.js', - browsers: ['PhantomJS'], + browsers: ['Chrome'], singleRun: true } },
Configure grunt to use Chrome as test browser
VividCortex_angular-recaptcha
train
js
a64963fbedbd2591c4329c951cf501e329bf6336
diff --git a/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/src/Illuminate/Foundation/Console/ModelMakeCommand.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Foundation/Console/ModelMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ModelMakeCommand.php @@ -133,19 +133,15 @@ class ModelMakeCommand extends GeneratorCommand protected function getOptions() { return [ -<<<<<<< HEAD ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, factory, and resource controller for the model'], ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], - ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], -======= + ['factory', 'fa', InputOption::VALUE_NONE, 'Create a new factory for the model'], + ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the model already exists.'], ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'], ->>>>>>> 5.4 - - ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'], ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller.'], ];
Fix conflicts on ModelMakeCommand (#<I>) I've renamed the shortcut for the factory, otherwise it would throw an error saying that 2 shortcuts with the same name exist.
laravel_framework
train
php
de551925131294b911bf1e56ff4757cde2f2391c
diff --git a/lib/activedirectory.js b/lib/activedirectory.js index <HASH>..<HASH> 100755 --- a/lib/activedirectory.js +++ b/lib/activedirectory.js @@ -93,7 +93,7 @@ var ActiveDirectory = function(url, baseDN, username, password, defaults) { defaultAttributes = _.extend({}, defaultAttributes, this.opts.attributes || {}); defaultReferrals = _.extend({}, defaultReferrals, this.opts.referrals || {}); - defaultEntryParser = typeof this.opts.entryParser == "function" ? this.opts.entryParser : defaultEntryParser; + defaultEntryParser = typeof this.opts.entryParser === "function" ? this.opts.entryParser : defaultEntryParser; // Remove the none ldapJS options delete(this.opts.baseDN);
Use === instead of == for comparision.
gheeres_node-activedirectory
train
js
aee610135bb3dad2f45bbc0fa6e94e623f5a6789
diff --git a/Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php b/Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php index <HASH>..<HASH> 100644 --- a/Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php +++ b/Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php @@ -381,7 +381,7 @@ class HandleCategoryCommandHandler implements CommandHandlerInterface $extractedCategoryPath = array_filter(explode('|', $existingCategory->getPath())); - if (in_array($shopMainCategory->getId(), $extractedCategoryPath, true)) { + if (in_array($shopMainCategory->getId(), $extractedCategoryPath, false)) { return true; }
strict mode (#<I>)
plentymarkets_plentymarkets-shopware-connector
train
php
114cb1dc89da5452ea536398a14414a21444de37
diff --git a/plexapi/playlist.py b/plexapi/playlist.py index <HASH>..<HASH> 100644 --- a/plexapi/playlist.py +++ b/plexapi/playlist.py @@ -62,7 +62,7 @@ class Playlist(PlexPartialObject, Playable): raise BadRequest('Can not mix media types when building a playlist: %s and %s' % (self.playlistType, item.listType)) ratingKeys.append(item.ratingKey) uuid = items[0].section().uuid - ratingKeys = ','.join(ratingKeys) + ratingKeys = ','.join(str(ratingKeys)) path = '%s/items%s' % (self.key, utils.joinArgs({ 'uri': 'library://%s/directory//library/metadata/%s' % (uuid, ratingKeys), }))
fixup after ratingkey was changed to int.
pkkid_python-plexapi
train
py
6bb384ba10f664f1e2b86e4d45ece85d280bfaa6
diff --git a/pyethereum/indexdb.py b/pyethereum/indexdb.py index <HASH>..<HASH> 100644 --- a/pyethereum/indexdb.py +++ b/pyethereum/indexdb.py @@ -20,6 +20,7 @@ class Index(object): def add(self, key, valnum, value): assert isinstance(value, str) self.db.put(self._key(key, valnum), value) + self.db.commit() def append(self, key, value): self.add(key, self.num_values(key), value)
use own db and always commit
ethereum_pyethereum
train
py
272b90223558c5370c9bc2ea725fc1889367aa99
diff --git a/src/toil/provisioners/aws/awsProvisioner.py b/src/toil/provisioners/aws/awsProvisioner.py index <HASH>..<HASH> 100644 --- a/src/toil/provisioners/aws/awsProvisioner.py +++ b/src/toil/provisioners/aws/awsProvisioner.py @@ -179,9 +179,14 @@ class AWSProvisioner(AbstractProvisioner): def getNodeShape(self, nodeType, preemptable=False): instanceType = ec2_instance_types[nodeType] - #EBS-backed instances are listed as having zero disk space in cgcloud.lib.ec2, - #but we'll estimate them at 2GB - disk = max(2 * 2**30, instanceType.disks * instanceType.disk_capacity * 2 ** 30) + + disk = instanceType.disks * instanceType.disk_capacity * 2 ** 30 + if disk == 0: + # This is an EBS-backed instance. We will use the root + # volume, so add the amount of EBS storage requested for + # the root volume + disk = self.nodeStorage * 2 ** 30 + #Underestimate memory by 100M to prevent autoscaler from disagreeing with #mesos about whether a job can run on a particular node type memory = (instanceType.memory - 0.1) * 2** 30
Add nodeStorage to the disk value for the nodeShape Previously the disk was always estimated to be 2GB, making instances with only EBS-backed storage like c4, r4, etc. useless.
DataBiosphere_toil
train
py
0934940f4e2a41823546ba6e0657c49ba49219f4
diff --git a/testutil/io.go b/testutil/io.go index <HASH>..<HASH> 100644 --- a/testutil/io.go +++ b/testutil/io.go @@ -39,6 +39,9 @@ func TempDir(t *testing.T, name string) string { name = strings.Replace(name, "/", "_", -1) d, err := ioutil.TempDir(tmpdir, name) if err != nil { + if t == nil { + panic(err) + } t.Fatalf("err: %s", err) } return d @@ -55,6 +58,9 @@ func TempFile(t *testing.T, name string) *os.File { } f, err := ioutil.TempFile(tmpdir, name) if err != nil { + if t == nil { + panic(err) + } t.Fatalf("err: %s", err) } return f
testutil: If testing.T is nil panic with error (#<I>)
hashicorp_consul
train
go
627bbaf4eceb7714d340dc344ac75359aef39ad3
diff --git a/lib/Structures/Server.js b/lib/Structures/Server.js index <HASH>..<HASH> 100644 --- a/lib/Structures/Server.js +++ b/lib/Structures/Server.js @@ -66,7 +66,7 @@ var Server = (function (_Equality) { this.channels = new _UtilCache2["default"](); this.roles = new _UtilCache2["default"](); this.icon = data.icon; - this.afkTimeout = data.afkTimeout; + this.afkTimeout = data.afk_timeout; this.afkChannelID = data.afk_channel_id || data.afkChannelID; this.memberMap = data.memberMap || {}; this.memberCount = data.member_count || data.memberCount; diff --git a/src/Structures/Server.js b/src/Structures/Server.js index <HASH>..<HASH> 100644 --- a/src/Structures/Server.js +++ b/src/Structures/Server.js @@ -35,7 +35,7 @@ export default class Server extends Equality { this.channels = new Cache(); this.roles = new Cache(); this.icon = data.icon; - this.afkTimeout = data.afkTimeout; + this.afkTimeout = data.afk_timeout; this.afkChannelID = data.afk_channel_id || data.afkChannelID; this.memberMap = data.memberMap || {}; this.memberCount = data.member_count || data.memberCount;
Fix server.afkTimout being undefined (#<I>) (#<I>)
discordjs_discord.js
train
js,js
f96ed220e3a8618aca36bb8a0697dcd7edbc2b48
diff --git a/src/org/opencms/ade/galleries/CmsGalleryService.java b/src/org/opencms/ade/galleries/CmsGalleryService.java index <HASH>..<HASH> 100644 --- a/src/org/opencms/ade/galleries/CmsGalleryService.java +++ b/src/org/opencms/ade/galleries/CmsGalleryService.java @@ -280,7 +280,11 @@ public class CmsGalleryService extends CmsGwtService implements I_CmsGalleryServ data.setGalleries(buildGalleriesList(readGalleryInfosByTypeBeans(types))); data.setStartTab(GalleryTabId.cms_tab_results); if (CmsStringUtil.isEmptyOrWhitespaceOnly(data.getStartGallery()) && !types.isEmpty()) { - data.setStartGallery(getWorkplaceSettings().getLastUsedGallery(types.get(0).getTypeId())); + String lastGallery = getWorkplaceSettings().getLastUsedGallery(types.get(0).getTypeId()); + // check if the gallery is available in this site and still exists + if (getCmsObject().existsResource(lastGallery)) { + data.setStartGallery(lastGallery); + } } if (CmsStringUtil.isEmptyOrWhitespaceOnly(data.getStartGallery()) && CmsStringUtil.isEmptyOrWhitespaceOnly(data.getCurrentElement())) {
Fixing issue when last opened gallery is not accessible.
alkacon_opencms-core
train
java
014fd601641cdea228b438895efb91237c12675a
diff --git a/filepathfilter/filepathfilter.go b/filepathfilter/filepathfilter.go index <HASH>..<HASH> 100644 --- a/filepathfilter/filepathfilter.go +++ b/filepathfilter/filepathfilter.go @@ -105,7 +105,7 @@ func NewPattern(p string) Pattern { // Special case: the below patterns match anything according to existing // behavior. switch pp { - case `*`, `*.*`, `.`, `./`, `.\`: + case `*`, `.`, `./`, `.\`: pp = join("**", "*") }
filepathfilter: no longer special-case *.*
git-lfs_git-lfs
train
go
1192e26f0039c96e73003327057da330a7339b60
diff --git a/src/Strava/API/Service/REST.php b/src/Strava/API/Service/REST.php index <HASH>..<HASH> 100644 --- a/src/Strava/API/Service/REST.php +++ b/src/Strava/API/Service/REST.php @@ -149,6 +149,17 @@ class REST implements ServiceInterface { return $this->format($result); } + public function getActivityFollowing($before = null, $page = null, $per_page = null) { + $path = '/activities/following'; + $parameters = array( + 'before' => $before, + 'page' => $page, + 'per_page' => $per_page + ); + $result = $this->adapter->get($path, $parameters, $this->getHeaders()); + return $this->format($result); + } + public function getActivity($id, $include_all_efforts = null) { $path = '/activities/'.$id; $parameters = array( @@ -157,7 +168,7 @@ class REST implements ServiceInterface { $result = $this->adapter->get($path, $parameters, $this->getHeaders()); return $this->format($result); } - + public function getActivityComments($id, $markdown = null, $page = null, $per_page = null) { $path = '/activities/'.$id.'/comments'; $parameters = array(
Update REST.php Add support to "List friends’ activities" function (<URL>)
basvandorst_StravaPHP
train
php
1508cb38dae9ea715248e265af2930380e8c55b7
diff --git a/src/Core/Storage/Zipper.php b/src/Core/Storage/Zipper.php index <HASH>..<HASH> 100644 --- a/src/Core/Storage/Zipper.php +++ b/src/Core/Storage/Zipper.php @@ -68,7 +68,7 @@ class Zipper $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory)); foreach ($files as $filePath => $file) { - $relative = '/' . Path::makeRelative($filePath, $directory); + $relative = Path::makeRelative($filePath, $directory); if (is_dir($filePath)) { $zip->addEmptyDir($relative);
removed slash prefix from zip file names (#<I>)
nanbando_core
train
php
38f682604b7ed69799cc795eaead631dbd384c7e
diff --git a/nsone/rest/records.py b/nsone/rest/records.py index <HASH>..<HASH> 100644 --- a/nsone/rest/records.py +++ b/nsone/rest/records.py @@ -16,7 +16,7 @@ class Records(resource.BaseResource): body['domain'] = domain body['type'] = type body['answers'] = answers - if ttl: + if ttl is not None: body['ttl'] = int(ttl) return body
allow ttl of 0
ns1_ns1-python
train
py
8b48064593faf08a88910bb9859ea6e37f633e14
diff --git a/lib/fulmar/shell.rb b/lib/fulmar/shell.rb index <HASH>..<HASH> 100644 --- a/lib/fulmar/shell.rb +++ b/lib/fulmar/shell.rb @@ -5,7 +5,7 @@ require 'open3' module Fulmar # Implements simple access to shell commands class Shell - VERSION = '1.6.4' + VERSION = '1.6.5' attr_accessor :debug, :last_output, :last_error, :quiet, :strict attr_reader :path @@ -99,7 +99,7 @@ module Fulmar Open3.popen3(environment, command) do |_stdin, stdout, stderr, wait_thread| Thread.new do stdout.each do |line| - @last_output << line + @last_output << line.strip puts line unless @quiet end end
[BUGFIX] Strip line breaks
CORE4_fulmar-shell
train
rb
a14a949f88ce6136407b4c6d4f9107609b861184
diff --git a/core/lib/generators/refinery/engine/templates/spec/spec_helper.rb b/core/lib/generators/refinery/engine/templates/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/core/lib/generators/refinery/engine/templates/spec/spec_helper.rb +++ b/core/lib/generators/refinery/engine/templates/spec/spec_helper.rb @@ -2,7 +2,14 @@ def setup_environment # Configure Rails Environment ENV["RAILS_ENV"] ||= 'test' - require File.expand_path('../../../../../config/environment', __FILE__) + if File.exist?(dummy_path = File.expand_path('../spec/dummy/config/environment.rb', __FILE__)) + require dummy_path + elsif File.dirname(__FILE__) =~ %r{vendor/extensions} + # Require the path to the refinerycms application this is vendored inside. + require File.expand_path('../../../../../config/environment', __FILE__) + else + raise "Could not find a config/environment.rb file to require. Please specify this in spec/spec_helper.rb" + end require 'rspec/rails' require 'capybara/rspec'
Support the spec/dummy application primarily and fall back to the vendored app or else raise an exception.
refinery_refinerycms
train
rb
9b427c2e3c93dbc3f4a0ea7eb12beac5d4857e9b
diff --git a/lib/connect-couchbase.js b/lib/connect-couchbase.js index <HASH>..<HASH> 100644 --- a/lib/connect-couchbase.js +++ b/lib/connect-couchbase.js @@ -48,7 +48,7 @@ module.exports = function(session){ * password: '', * bucket: 'default' (default) * cachefile: '' - * ttl: 60, + * ttl: 86400, * prefix: 'sess' * } * @api public @@ -98,7 +98,7 @@ module.exports = function(session){ } }); - this.ttl = options.ttl || 60; + this.ttl = options.ttl || 86400; } /** @@ -180,4 +180,4 @@ module.exports = function(session){ }; return CouchbaseStore; -}; \ No newline at end of file +};
Up default TTL from <I> seconds to <I> (one day)
christophermina_connect-couchbase
train
js
9731b1a3d96da5f6351669133d142e72f8038487
diff --git a/slap/esri.py b/slap/esri.py index <HASH>..<HASH> 100644 --- a/slap/esri.py +++ b/slap/esri.py @@ -41,7 +41,8 @@ class ArcpyHelper: def list_data_sources(mxd_paths): data_sources = set() for mxd_path in mxd_paths: - mxd = arcpy.mapping.MapDocument(mxd_path) + full_mxd_path = os.path.abspath(mxd_path) + mxd = arcpy.mapping.MapDocument(full_mxd_path) data_sources.update(ArcpyHelper.list_data_sources_for_mxd(mxd)) return list(data_sources)
Looks up full path for mxd When listing data sources
lobsteropteryx_slap
train
py
f8fc00aefa671774377616b135a71f931e9ce9b1
diff --git a/gtts/tests/test_tts.py b/gtts/tests/test_tts.py index <HASH>..<HASH> 100644 --- a/gtts/tests/test_tts.py +++ b/gtts/tests/test_tts.py @@ -112,9 +112,6 @@ class TestWrite(unittest.TestCase): # Check if file created is > 2k self.assertTrue(os.stat(save_file_path).st_size > 2000) - # Cleanup - os.remove(save_file_path) - class TestgTTSError(unittest.TestCase): """Test gTTsError internal exception handling"""
AppVoyer/Windows doens't like files being deleted during tests
pndurette_gTTS
train
py
cb881314f5338a05185e133bbf132e2e14af7a5b
diff --git a/DependencyInjection/HWIOAuthExtension.php b/DependencyInjection/HWIOAuthExtension.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/HWIOAuthExtension.php +++ b/DependencyInjection/HWIOAuthExtension.php @@ -56,7 +56,7 @@ class HWIOAuthExtension extends Extension if (empty($config['firewall_names']) && !isset($config['firewall_name'])) { throw new InvalidConfigurationException('The child node "firewall_name" or "firewall_names" at path "hwi_oauth" must be configured.'); } elseif (!empty($config['firewall_names']) && isset($config['firewall_name'])) { - $config['firewall_names'] = array_merge(array($config['firewall_name'], $config['firewall_names'])); + $config['firewall_names'] = array_merge(array($config['firewall_name']), $config['firewall_names']); } elseif (empty($config['firewall_names']) && isset($config['firewall_name'])) { @trigger_error('The child node "firewall_name" at path "hwi_oauth" is deprecated since version 0.4.0 and will be removed in version 0.5.0. Use "firewall_names" instead.', E_USER_DEPRECATED); $config['firewall_names'] = array($config['firewall_name']);
Typo when merging firewall_names with firewall_name It was creating array of both firewall_names and firewall_name but only firewall_name should be in
hwi_HWIOAuthBundle
train
php
9d0d06a5205d30c42aefb8daf192059a3f92ab9e
diff --git a/tests/test_filters.py b/tests/test_filters.py index <HASH>..<HASH> 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -37,6 +37,9 @@ def test_filter_sinc(): yield __test, filt, window, num_zeros, precision, rolloff +def test_filter_load(): + half_win, precision = resampy.filters.get_filter('kaiser_best') + @raises(NotImplementedError) def test_filter_missing(): resampy.filters.get_filter('bad name')
added dummy test for loading precomputed filters
bmcfee_resampy
train
py
d4f9b8ebf1715e895449a3a4ace63f8710aa8f5b
diff --git a/src/Controller.php b/src/Controller.php index <HASH>..<HASH> 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -207,14 +207,14 @@ abstract class Controller $result = $validator->run($rawData); - $query = new Query\FindEntity($this->config, $args['id']); - - $entity = $this->commandBus->handle($query); - if ($result->isValid()) { $fields = $result->getValidated(); $data = array_intersect_key($rawData, array_flip($fields)); + $query = new Query\FindEntity($this->config, $args['id']); + + $entity = $this->commandBus->handle($query); + $command = new Command\UpdateEntity($this->config, $entity, $data); $this->commandBus->handle($command);
Only find the entity if the form is valid
indigophp_proton-crud
train
php
336e45fee19091481da285027fb4c6f5e304c8d0
diff --git a/validator/sawtooth_validator/gossip/gossip_handlers.py b/validator/sawtooth_validator/gossip/gossip_handlers.py index <HASH>..<HASH> 100644 --- a/validator/sawtooth_validator/gossip/gossip_handlers.py +++ b/validator/sawtooth_validator/gossip/gossip_handlers.py @@ -80,7 +80,8 @@ class PeerRegisterHandler(Handler): request = PeerRegisterRequest() request.ParseFromString(message_content) - LOGGER.debug("Got peer register message from %s", connection_id) + LOGGER.debug("Got peer register message from %s (%s, protocol v%s)", + connection_id, request.endpoint, request.protocol_version) ack = NetworkAcknowledgement() try:
Improve logging on receipt of PeerRegisterRequests Add info about where the message is from and what protocol version the requester is using.
hyperledger_sawtooth-core
train
py
03f8fdfef90b7fc95a36a91e7314dd374eb1a85d
diff --git a/hazelcast-client/src/main/java/com/hazelcast/client/Serializer.java b/hazelcast-client/src/main/java/com/hazelcast/client/Serializer.java index <HASH>..<HASH> 100644 --- a/hazelcast-client/src/main/java/com/hazelcast/client/Serializer.java +++ b/hazelcast-client/src/main/java/com/hazelcast/client/Serializer.java @@ -52,7 +52,7 @@ public class Serializer { try { if(object instanceof DataSerializable){ dos.writeByte(SERIALIZER_TYPE_DATA); - dos.writeUTF(object.getClass().getName()); + dos.writeUTF(object.getClass().getName().replaceFirst("com.hazelcast.client", "com.hazelcast")); ((DataSerializable) object).writeData(dos); } else if(object instanceof String){ @@ -103,7 +103,7 @@ public class Serializer { try { if(type == SERIALIZER_TYPE_DATA){ String className = dis.readUTF(); - DataSerializable data = (DataSerializable)Class.forName(className).newInstance(); + DataSerializable data = (DataSerializable)Class.forName(className.replaceFirst("com.hazelcast", "com.hazelcast.client")).newInstance(); data.readData(dis); return data; }
fixed the class name compatibilities between client and server git-svn-id: <URL>
hazelcast_hazelcast
train
java
21299e35b01a5222bd92b0e9c3032937561cca4f
diff --git a/src/Illuminate/Support/Facades/Route.php b/src/Illuminate/Support/Facades/Route.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Support/Facades/Route.php +++ b/src/Illuminate/Support/Facades/Route.php @@ -14,7 +14,7 @@ namespace Illuminate\Support\Facades; * @method static \Illuminate\Support\Facades\Route prefix(string $prefix) * @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = []) * @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = []) - * @method static \Illuminate\Support\Facades\Route middleware(array|string|null $middleware) + * @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware) * @method static \Illuminate\Support\Facades\Route substituteBindings(\Illuminate\Support\Facades\Route $route) * @method static void substituteImplicitBindings(\Illuminate\Support\Facades\Route $route) * @method static \Illuminate\Support\Facades\Route as(string $value)
Fix for route facade phpdoc to avoid Phan errors
laravel_framework
train
php
65db273df7059559b30ff0df69e7688a8661a279
diff --git a/lib/crash_watch/gdb_controller.rb b/lib/crash_watch/gdb_controller.rb index <HASH>..<HASH> 100644 --- a/lib/crash_watch/gdb_controller.rb +++ b/lib/crash_watch/gdb_controller.rb @@ -328,7 +328,8 @@ module CrashWatch end elsif result.nil? raise GdbNotFound, - "*** ERROR ***: 'gdb' isn't installed. Please install it first.\n" + + "*** ERROR ***: 'gdb' not found. Please install it (and if using Nginx " + + "ensure that PATH isn't filtered out, see also its \"env\" option).\n" + " Debian/Ubuntu: sudo apt-get install gdb\n" + "RedHat/CentOS/Fedora: sudo yum install gdb\n" + " Mac OS X: please install the Developer Tools or XCode\n" +
Improve error message about gdb. When gdb isn't found, it doesn't necessarily mean that it isn't installed. Could also be the path.
FooBarWidget_crash-watch
train
rb
d8d79b19c5f9f340c03a72d8938c7e84e426e3dc
diff --git a/Xlib/__init__.py b/Xlib/__init__.py index <HASH>..<HASH> 100644 --- a/Xlib/__init__.py +++ b/Xlib/__init__.py @@ -18,13 +18,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -import string - __version__ = (0, 14) __version_extra__ = '' -__version_string__ = string.join(map(str, __version__), '.') + __version_extra__ +__version_string__ = '.'.join(map(str, __version__)) + __version_extra__ __all__ = [ 'X',
Removed need for 'import string' in Xlib/__init__.py
python-xlib_python-xlib
train
py
cc3a28b320cf443b688fd78a4537c6c76a3a96ff
diff --git a/src/Request.php b/src/Request.php index <HASH>..<HASH> 100644 --- a/src/Request.php +++ b/src/Request.php @@ -35,4 +35,9 @@ class Request extends \hiqdev\hiart\proxy\Request 'base_uri' => $this->getDb()->getBaseUri(), ], $config); } + + public static function isSupported() + { + return true; + } }
added `Request::isSupported`
hiqdev_yii2-hiart-guzzle
train
php
823003cb9834289d938e74ad679ef48069771adb
diff --git a/src/Propel/Generator/Manager/AbstractManager.php b/src/Propel/Generator/Manager/AbstractManager.php index <HASH>..<HASH> 100644 --- a/src/Propel/Generator/Manager/AbstractManager.php +++ b/src/Propel/Generator/Manager/AbstractManager.php @@ -317,7 +317,7 @@ EOT $externalSchema->parentNode->removeChild($externalSchema); $externalSchemaDom = new DomDocument('1.0', 'UTF-8'); - $externalSchemaDom->load(realpath($externalSchemaFile)); + $externalSchemaDom->load(realpath($include)); // The external schema may have external schemas of its own ; recurse $this->includeExternalSchemas($externalSchemaDom, $srcDir);
[Generator] [Manager] fixed wrong variable name.
propelorm_Propel2
train
php
64e8056aee6bafdb59f212f511b07afd620be7fd
diff --git a/client/gutenberg/extensions/related-posts/editor.js b/client/gutenberg/extensions/related-posts/editor.js index <HASH>..<HASH> 100644 --- a/client/gutenberg/extensions/related-posts/editor.js +++ b/client/gutenberg/extensions/related-posts/editor.js @@ -77,6 +77,10 @@ export const settings = { } }, + supports: { + html: false, + }, + transforms: { from: [ {
Gutenberg: Disallow Related Posts to be edited as HTML (#<I>)
Automattic_wp-calypso
train
js
47f71db65fe7e374001f34584a3fa4216a1c011c
diff --git a/backend/sublime/sublime_manual.go b/backend/sublime/sublime_manual.go index <HASH>..<HASH> 100644 --- a/backend/sublime/sublime_manual.go +++ b/backend/sublime/sublime_manual.go @@ -196,11 +196,12 @@ func observePlugins(m *py.Module) { for { select { case ev := <-watcher.Event: - if ev.IsModify() { - if p, exist := watchedPlugins[path.Dir(ev.Name)]; exist { - p.Reload() - loadPlugin(p.Package().(*backend.Plugin), m) - } + if !(ev.IsModify() || ev.IsCreate()) { + continue + } + if p, exist := watchedPlugins[path.Dir(ev.Name)]; exist { + p.Reload() + loadPlugin(p.Package().(*backend.Plugin), m) } case err := <-watcher.Error: log4go.Error("error:", err)
backend/sublime: Also reload plugins on the Create fs event. Fixes the reload test on OSX which emits a Create event rather than a modified event when we write out "testdata/plugins/reload.py".
limetext_backend
train
go
6c33bba8298b79988891216d8968e27d9f857b35
diff --git a/src/Client/APIExceptionHandler.php b/src/Client/APIExceptionHandler.php index <HASH>..<HASH> 100644 --- a/src/Client/APIExceptionHandler.php +++ b/src/Client/APIExceptionHandler.php @@ -37,7 +37,7 @@ class APIExceptionHandler if (isset($body['title'])) { // Have to do this check to handle VAPI errors - if (is_string($body['type'])) { + if (isset($body['type']) && is_string($body['type'])) { $errorTitle = sprintf( $this->rfc7807Format, $body['title'], diff --git a/src/Redact/Client.php b/src/Redact/Client.php index <HASH>..<HASH> 100644 --- a/src/Redact/Client.php +++ b/src/Redact/Client.php @@ -50,7 +50,7 @@ class Client implements ClientAwareInterface, APIClient } $this->api->setExceptionErrorHandler($exceptionHandler); } - return clone $this->api; + return $this->api; } public function transaction(string $id, string $product, array $options = []) : void
Fixed check for error message, and no longer clone Redact API
Nexmo_nexmo-php
train
php,php
54c26b9ca60e38c35c1bd7113ed58403cbf859ff
diff --git a/source/net/fortuna/ical4j/data/UnfoldingReader.java b/source/net/fortuna/ical4j/data/UnfoldingReader.java index <HASH>..<HASH> 100644 --- a/source/net/fortuna/ical4j/data/UnfoldingReader.java +++ b/source/net/fortuna/ical4j/data/UnfoldingReader.java @@ -123,6 +123,20 @@ public class UnfoldingReader extends PushbackReader { * @see java.io.PushbackReader#read() */ public final int read() throws IOException { + int c = super.read(); + boolean doUnfold = false; + for (int i = 0; i < patterns.length; i++) { + if (c == patterns[i][0]) { + doUnfold = true; + } + } + if (!doUnfold) { + return c; + } + else { + unread(c); + } + boolean didUnfold; // need to loop since one line fold might be directly followed by another
Applied path #<I> for performance improvements
ical4j_ical4j
train
java
0b813dd37bc53d1df3306a9704ce6a537e6ef68c
diff --git a/pypeerassets/pautils.py b/pypeerassets/pautils.py index <HASH>..<HASH> 100644 --- a/pypeerassets/pautils.py +++ b/pypeerassets/pautils.py @@ -14,7 +14,6 @@ def testnet_or_mainnet(node): def load_p2th_privkeys_into_node(node): if testnet_or_mainnet(node) is "testnet": - assert testnet_PAPROD_addr in node.getaddressbyaccount() try: node.importprivkey(testnet_PAPROD) assert testnet_PAPROD_addr in node.getaddressbyaccount()
pautils, removed unnecessary line.
PeerAssets_pypeerassets
train
py
fa6bc9d654166eb672e914ece131e6211117bae4
diff --git a/jsface.ready.js b/jsface.ready.js index <HASH>..<HASH> 100644 --- a/jsface.ready.js +++ b/jsface.ready.js @@ -14,12 +14,14 @@ readyFns = [], readyCount = 0; - Class.plugins.$ready = function(clazz, parent, api) { - var r = api.$ready, - len = parent ? parent.length : 0, - count = len, + Class.plugins.$ready = function invoke(clazz, parent, api, loop) { + var r = api.$ready, + len = parent ? parent.length : 0, + count = len, + _super = len && parent[0].$super, pa, i, entry; + // find and invoke $ready from parent(s) while (len--) { for (i = 0; i < readyCount; i++) { entry = readyFns[i]; @@ -34,10 +36,15 @@ } } + // call $ready from grandparent(s), if any + if (_super) { + invoke(clazz, [ _super ], api, true); + } + // in an environment where there are a lot of class creating/removing (rarely) // this implementation might cause a leak (saving pointers to clazz and $ready) - if (isFunction(r)) { - r.call(clazz, clazz, parent, api); + if ( !loop && isFunction(r)) { + r.call(clazz, clazz, parent, api); // invoke ready from current class readyFns.push([ clazz, r ]); readyCount++; }
invoke $ready in multiple level inheritance Asume Bar3 extends Bar2 extends Bar1 extends Foo. Foo defines $ready: Bar3 -> Bar2 -> Bar1 -> Foo:$ready Then $ready on Foo will be executed four times: 1- On Foo's level 2- On Bar1's level 3- On Bar2's level 4- On Bar3's level This support makes sure grandparents get notified when their inherit classes are created
tnhu_jsface
train
js
14e27b1bb1c493351f33999d3bc9190a57fbf4f6
diff --git a/test/Query.js b/test/Query.js index <HASH>..<HASH> 100644 --- a/test/Query.js +++ b/test/Query.js @@ -1264,7 +1264,7 @@ describe("Query", () => { const start = Date.now(); await Model.query("name").eq("Charlie").all(10, 2).exec(); const end = Date.now(); - expect(end - start).to.be.above(19); + expect(end - start).to.be.at.least(19); }); it("Should send correct result on query.exec", async () => { diff --git a/test/Scan.js b/test/Scan.js index <HASH>..<HASH> 100644 --- a/test/Scan.js +++ b/test/Scan.js @@ -726,7 +726,7 @@ describe("Scan", () => { const start = Date.now(); await Model.scan().all(10, 2).exec(); const end = Date.now(); - expect(end - start).to.be.above(19); + expect(end - start).to.be.at.least(19); }); it("Should send correct result on scan.exec", async () => {
Updating tests to try to prevent random failures
dynamoosejs_dynamoose
train
js,js
f84d503593497b8071ce6b115ef87df7373ad60a
diff --git a/src/Modelling/ModelState.php b/src/Modelling/ModelState.php index <HASH>..<HASH> 100644 --- a/src/Modelling/ModelState.php +++ b/src/Modelling/ModelState.php @@ -88,7 +88,7 @@ class ModelState implements \ArrayAccess, JsonSerializable public function __set($propertyName, $value) { try { - $oldValue = $this->$propertyName; + $oldValue = (isset($this->modelData[$propertyName])) ? $this->modelData[$propertyName]: null; } catch (\Exception $ex) { // Catch any exceptions thrown when trying to retrieve the old value for the sake // of comparison to trigger the property changed handlers.
Protected setter from throwing warnings if properties were being set for the first time.
RhubarbPHP_Rhubarb
train
php
de58e6902182d084128e4339aea3467ab5dc2908
diff --git a/master/buildbot/test/unit/test_changes_svnpoller.py b/master/buildbot/test/unit/test_changes_svnpoller.py index <HASH>..<HASH> 100644 --- a/master/buildbot/test/unit/test_changes_svnpoller.py +++ b/master/buildbot/test/unit/test_changes_svnpoller.py @@ -640,7 +640,8 @@ class TestSVNPoller(gpo.GetProcessOutputMixin, def test_use_svnurl(self): base = "svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk" - self.assertRaises(TypeError, self.attachSVNPoller, svnurl=base) + with self.assertRaises(TypeError): + self.attachSVNPoller(svnurl=base) class TestSplitFile(unittest.TestCase):
Use assertRaises as context manager in test_changes_svnpoller
buildbot_buildbot
train
py
9b6242a7391e86c5fa0f427168af7bd901409560
diff --git a/xblock/content.py b/xblock/content.py index <HASH>..<HASH> 100644 --- a/xblock/content.py +++ b/xblock/content.py @@ -40,7 +40,7 @@ class HtmlBlock(XBlock): """ block = runtime.construct_xblock_from_class(cls, keys) - block.content = node.text or u"" + block.content = unicode(node.text or u"") for child in node: block.content += etree.tostring(child, encoding='unicode') diff --git a/xblock/test/test_parsing.py b/xblock/test/test_parsing.py index <HASH>..<HASH> 100644 --- a/xblock/test/test_parsing.py +++ b/xblock/test/test_parsing.py @@ -196,3 +196,13 @@ class HtmlInOutTest(XmlTest, unittest.TestCase): xml = self.export_xml_for_block(block) self.assertIn(test, xml) + + def test_text_is_unicode(self): + tests = [ + "<html>Hello, world</html>", + "<html>ᵾnɨȼøđɇ ȼȺn ƀɇ ŧɍɨȼꝁɏ!</html>", + ] + + for test in tests: + block = self.parse_xml_to_block(test) + self.assertIsInstance(block.content, unicode)
Fix bug in which an HTML block with only text body was not being loaded as unicode, and so was failing assert in Fragment.
edx_XBlock
train
py,py
80c77ce81923451d0d02ccdf56a50141949a75e6
diff --git a/test/unit/test_network_extraction.py b/test/unit/test_network_extraction.py index <HASH>..<HASH> 100644 --- a/test/unit/test_network_extraction.py +++ b/test/unit/test_network_extraction.py @@ -1,4 +1,5 @@ import os +import sys from pathlib import Path from platform import system from os.path import realpath @@ -91,6 +92,7 @@ class NetworkExtractionTest(): assert np.allclose(net1['pore.coords'][:, 1], net2['pore.coords'][:, 2]) assert np.allclose(net1['pore.coords'][:, 0], net3['pore.coords'][:, 1]) + @pytest.mark.skipif(not sys.platform.startswith("win"), reason="Windows-only!") def test_max_ball(self): path = Path(realpath(__file__), '../../fixtures/pnextract.exe') if system() == 'Windows':
Minor refactoring of a unit test [no ci]
PMEAL_porespy
train
py
30c224c048bb38ab7e1b6d8996d6dd8e036fcaac
diff --git a/lib/httparty/exceptions.rb b/lib/httparty/exceptions.rb index <HASH>..<HASH> 100644 --- a/lib/httparty/exceptions.rb +++ b/lib/httparty/exceptions.rb @@ -20,6 +20,7 @@ module HTTParty # @param [Net::HTTPResponse] def initialize(response) @response = response + super(response) end end
Add ResponseError response attribute to message
jnunemaker_httparty
train
rb
a894e18694d69a828204004209327a0acc6d17ec
diff --git a/lib/sass/tree/comment_node.rb b/lib/sass/tree/comment_node.rb index <HASH>..<HASH> 100644 --- a/lib/sass/tree/comment_node.rb +++ b/lib/sass/tree/comment_node.rb @@ -51,6 +51,7 @@ module Sass::Tree return if invisible? content = (value.split("\n") + lines.map {|l| l.text}) + return "/* */" if content.empty? content.map! {|l| (l.empty? ? "" : " ") + l} content.first.gsub!(/^ /, '') content.last.gsub!(%r{ ?\*/ *$}, '') diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index <HASH>..<HASH> 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -790,6 +790,14 @@ CSS SASS end + def test_empty_comment + assert_equal(<<CSS, render(<<SASS)) +/* */ +CSS +/* +SASS + end + private def render(sass, options = {})
[Sass] Fix a comment-parsing bug.
sass_ruby-sass
train
rb,rb
3b25867cf5669dc295839a437f6460d28af27a68
diff --git a/distributions.py b/distributions.py index <HASH>..<HASH> 100644 --- a/distributions.py +++ b/distributions.py @@ -578,16 +578,19 @@ class ScalarGaussianFixedvar(ScalarGaussian, GibbsSampling): xbar = None return n, xbar - def max_likelihood(self,data): - raise NotImplementedError - class ScalarGaussianMaxLikelihood(ScalarGaussian): - def max_likelihood(self,data): - assert getdatasize(data) > 0 + def max_likelihood(self,data,weights=None): data = flattendata(data) - self.mu = data.mean() - self.sigmasq = data.var() + + if weights is not None: + weights = flattendata(weights) + else: + weights = np.ones(data.shape) + + weightsum = weights.sum() + self.mu = np.dot(weights,data) / weightsum + self.sigmasq = np.dot(weights,(data-self.mu)**2) / weightsum ##############
added placeholders for max_likelihood_from_pmf
mattjj_pybasicbayes
train
py
d68e5f51c3753e822a7800f4f5d07171a33765b2
diff --git a/hydpy/auxs/smoothtools.py b/hydpy/auxs/smoothtools.py index <HASH>..<HASH> 100644 --- a/hydpy/auxs/smoothtools.py +++ b/hydpy/auxs/smoothtools.py @@ -32,6 +32,8 @@ import os from typing import * # ...from site-packages +# from scipy but not optional due to using interp1d during module initialisation: +from scipy import interpolate # pylint: disable=ungrouped-imports import numpy # ...from HydPy @@ -40,12 +42,8 @@ from hydpy.core import exceptiontools from hydpy.cythons.autogen import smoothutils if TYPE_CHECKING: - from scipy import interpolate from scipy import optimize else: - interpolate = exceptiontools.OptionalImport( - "interpolate", ["scipy.interpolate"], locals() - ) optimize = exceptiontools.OptionalImport("optimize", ["scipy.optimize"], locals())
Make the import of scipy's interpolate module non-optional, as we use it during initialisation in module `smoothtools`.
hydpy-dev_hydpy
train
py
9951d53e342d6e038642af7401c4761aa4cf489c
diff --git a/ExchangeWebServices.php b/ExchangeWebServices.php index <HASH>..<HASH> 100644 --- a/ExchangeWebServices.php +++ b/ExchangeWebServices.php @@ -7,11 +7,37 @@ /** * Base class of the Exchange Web Services application. - * - * @author James I. Armes <http://www.jamesarmes.net> */ class ExchangeWebServices { /** + * Microsoft Exchange 2007 + * + * @var string + */ + const VERSION_2007 = 'Exchange2007'; + + /** + * Microsoft Exchange 2007 SP1 + * + * @var string + */ + const VERSION_2007_SP1 = 'Exchange2007_SP1'; + + /** + * Microsoft Exchange 2010 + * + * @var string + */ + const VERSION_2010 = 'Exchange2010'; + + /** + * Microsoft Exchange 2010 SP1 + * + * @var string + */ + const VERSION_2010_SP1 = 'Exchange2010_SP1'; + + /** * Location of the Exchange server. * * @var string
Issue #3 by <EMAIL>: Added exchange version constants.
jamesiarmes_php-ews
train
php