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
d9314cb70695c572a2421eba347ecc80a1f82564
diff --git a/modules/system/console/OctoberInstall.php b/modules/system/console/OctoberInstall.php index <HASH>..<HASH> 100644 --- a/modules/system/console/OctoberInstall.php +++ b/modules/system/console/OctoberInstall.php @@ -33,6 +33,11 @@ class OctoberInstall extends Command protected $description = 'Set up October CMS for the first time.'; /** + * @var int keyRetries counts license key attempts before giving up + */ + protected $keyRetries = 0; + + /** * handle executes the console command */ public function handle() @@ -267,14 +272,19 @@ class OctoberInstall extends Command */ protected function setupLicenseKey() { - try { - $this->comment('Enter a valid License Key to proceed.'); + if ($this->keyRetries++ > 10) { + $this->output->error('Too many failed attempts, please start again'); + exit(1); + } - $licenceKey = trim($this->ask('License Key')); - if (!strlen($licenceKey)) { - return $this->setupLicenseKey(); - } + $this->comment('Enter a valid License Key to proceed.'); + $licenceKey = trim($this->ask('License Key')); + if (!strlen($licenceKey)) { + return $this->setupLicenseKey(); + } + + try { $result = UpdateManager::instance()->requestProjectDetails($licenceKey); // Check status
Logic error This created an infinite loop! Also added a retry counter
octobercms_october
train
php
4c3af01ce2aec41fca1a36d217e2b09bc98eca86
diff --git a/dropwizard/src/main/java/com/yammer/dropwizard/cli/UsagePrinter.java b/dropwizard/src/main/java/com/yammer/dropwizard/cli/UsagePrinter.java index <HASH>..<HASH> 100644 --- a/dropwizard/src/main/java/com/yammer/dropwizard/cli/UsagePrinter.java +++ b/dropwizard/src/main/java/com/yammer/dropwizard/cli/UsagePrinter.java @@ -5,11 +5,12 @@ import com.yammer.dropwizard.AbstractService; import com.yammer.dropwizard.util.JarLocation; import org.apache.commons.cli.HelpFormatter; +@SuppressWarnings("UseOfSystemOutOrSystemErr") public class UsagePrinter { private UsagePrinter() { // singleton } - + public static void printRootHelp(AbstractService<?> service) { System.out.printf("java -jar %s <command> [arg1 arg2]\n\n", new JarLocation()); System.out.println("Commands");
Suppress some warnings for UsagePrinter.
dropwizard_dropwizard
train
java
df7424712838c1d21f11baa9727e3c8c3c850403
diff --git a/autoapi/__init__.py b/autoapi/__init__.py index <HASH>..<HASH> 100644 --- a/autoapi/__init__.py +++ b/autoapi/__init__.py @@ -1,3 +1,5 @@ """ -AutoAPI Top-level Comment +Sphinx AutoAPI """ + +from .extension import setup
Allow for toplevel module as Sphinx extension Instead of requiring: extensions = ['autoapi.extension'] This allows for the toplevel: extensions = ['autoapi'] This is more intuitive for users, as extension is an internal concept.
rtfd_sphinx-autoapi
train
py
b0c15848d78f98437d5f6078f6f50ee3351396ab
diff --git a/app/models/artefact.rb b/app/models/artefact.rb index <HASH>..<HASH> 100644 --- a/app/models/artefact.rb +++ b/app/models/artefact.rb @@ -86,6 +86,7 @@ class Artefact "cma_case", "drug_safety_update", "international_development_fund", + "maib_report", "manual", "manual-change-history", "manual-section",
Add MAIB Report artefact kind In order to transition MAIB to GOV.UK we need to add their reports as an artefact kind. Owning App is Specialist Publisher.
alphagov_govuk_content_models
train
rb
fc5343b52fe7d104bc1062949e0830a0dd899fd9
diff --git a/salt/modules/git.py b/salt/modules/git.py index <HASH>..<HASH> 100644 --- a/salt/modules/git.py +++ b/salt/modules/git.py @@ -177,6 +177,8 @@ def _git_run(command, cwd=None, user=None, password=None, identity=None, if not id_file: log.error('identity {0} does not exist.'.format(_id_file)) continue + else: + __salt__['file.set_mode'](id_file,'0600') else: if not __salt__['file.file_exists'](id_file): missing_keys.append(id_file)
Ensure Identity files are mode <I> SSH will sometimes refuse to use identity files that are group/world readable. This hopefully fixes that issue.
saltstack_salt
train
py
2b568267b74482ed394286fd4b904a1b2ad28d0d
diff --git a/core.js b/core.js index <HASH>..<HASH> 100644 --- a/core.js +++ b/core.js @@ -226,6 +226,13 @@ exports.get_objc_msgSend = function get_objc_msgSend (objcTypes) { } +// Struct type returned by `protocol_getMethodDescription`. +exports.objc_method_description = ffi.Struct([ + ['pointer', 'name'] + , ['string', 'types'] +]); + + /** * Wraps up a node-ffi pointer if needed (not needed for Numbers, etc.) */
Add struct definition for 'objc_method_description'.
TooTallNate_NodObjC
train
js
44d12f3bd52ec4e0c8e7d645199b9169522b0019
diff --git a/carnifex/ssh/client.py b/carnifex/ssh/client.py index <HASH>..<HASH> 100644 --- a/carnifex/ssh/client.py +++ b/carnifex/ssh/client.py @@ -1,5 +1,6 @@ from twisted.internet.protocol import ClientFactory -from twisted.conch.ssh.transport import SSHClientTransport +from twisted.conch.ssh.transport import SSHClientTransport,\ + DISCONNECT_PROTOCOL_ERROR from twisted.internet.error import ConnectionClosed @@ -13,7 +14,8 @@ class TooManyAuthFailures(DisconnectError): """Too many authentication failures for user """ -disconnectErrors = {2: TooManyAuthFailures} +# Mapping of reason codes to sensible disconnect error types +disconnectErrors = {DISCONNECT_PROTOCOL_ERROR: TooManyAuthFailures} class SSHClientFactory(ClientFactory): @@ -35,6 +37,10 @@ class SSHTransport(SSHClientTransport): self.verifyHostKey = verifyHostKey def receiveError(self, reasonCode, description): + """ + Called when we receive a disconnect error message from the other + side. + """ error = disconnectErrors.get(reasonCode, DisconnectError) self.connectionClosed(error(reasonCode, description)) SSHClientTransport.receiveError(self, reasonCode, description)
Replace magic disconnect reason code number with proper definition
sporsh_carnifex
train
py
bac7dc15e528e4354f4149617c9611dea0d12907
diff --git a/spec/geo_faker/multi_polygon_spec.rb b/spec/geo_faker/multi_polygon_spec.rb index <HASH>..<HASH> 100644 --- a/spec/geo_faker/multi_polygon_spec.rb +++ b/spec/geo_faker/multi_polygon_spec.rb @@ -77,6 +77,22 @@ module GeoFaker ]) end end + + describe '#contains_point' do + let(:multi_polygon) { MultiPolygon.from_geojson(geojson) } + + it 'returns true for contained point' do + expect(multi_polygon.contains_point(Point.new(lat: 30, lon: 20))).to be(true) + end + + it 'returns false for point outside of outer polygon' do + expect(multi_polygon.contains_point(Point.new(lat: 10, lon: 40))).to be(false) + end + + it 'returns TRUE [sic] for point inside of the hole' do + expect(multi_polygon.contains_point(Point.new(lat: 30, lon: 30))).to be(true) + end + end end end end
Add spec for contains_point ignoring holes for now
zweitag_GeoFaker
train
rb
1544d017095ea2186c4ab509674340f9a1fe0f99
diff --git a/xmantissa/signup.py b/xmantissa/signup.py index <HASH>..<HASH> 100644 --- a/xmantissa/signup.py +++ b/xmantissa/signup.py @@ -48,7 +48,7 @@ class TicketClaimer(Page): res = IResource(something) lgo = getattr(res, 'logout', lambda : None) ISession(ctx).setDefaultResource(res, lgo) - return URL.fromContext(ctx).click("/") + return URL.fromContext(ctx).click("/private") return None
redirect to /private after ticket claiming, fixes #<I>
twisted_mantissa
train
py
57046617965fda9c79ed869e074c64fcbb3d5ba3
diff --git a/src/Control/LouverFieldSet.php b/src/Control/LouverFieldSet.php index <HASH>..<HASH> 100644 --- a/src/Control/LouverFieldSet.php +++ b/src/Control/LouverFieldSet.php @@ -140,7 +140,7 @@ class LouverFieldSet extends FieldSet if (!empty($this->templateData)) { - $walker = new PrepareWalker($this->submitName); + $myWalker = new PrepareWalker($this->submitName); // If required add template row to this louver control. This row will be used by JS for adding dynamically // additional rows to the louver control. @@ -148,7 +148,7 @@ class LouverFieldSet extends FieldSet $row = $this->rowFactory->createRow($this->templateData); $row->addClass('slat-template'); $row->setAttrStyle('visibility: collapse'); - $row->prepare($walker); + $row->prepare($myWalker); $this->bodyControl->addFormControl($row); $this->setAttrData('slat-name', $this->bodyControl->submitName);
Fix issue found by Scrutinizer.
SetBased_php-abc-form-louver
train
php
f9a303a9da922200cf294e62224d10f9be9dacbf
diff --git a/agent/lib/agent/message/configure.rb b/agent/lib/agent/message/configure.rb index <HASH>..<HASH> 100644 --- a/agent/lib/agent/message/configure.rb +++ b/agent/lib/agent/message/configure.rb @@ -125,7 +125,6 @@ module Bosh::Agent verify_networks write_ubuntu_network_interfaces - gratuitous_arp write_resolv_conf end @@ -147,6 +146,16 @@ module Bosh::Agent if network_updated @logger.info("Updated networking") restart_networking_service + + # HACK to send a gratuitous arp every 10 seconds for the first minute + # after networking has been reconfigured. + Thread.new do + 6.times do + gratuitous_arp + sleep 10 + end + end + end end diff --git a/agent/lib/agent/version.rb b/agent/lib/agent/version.rb index <HASH>..<HASH> 100644 --- a/agent/lib/agent/version.rb +++ b/agent/lib/agent/version.rb @@ -1,5 +1,5 @@ module Bosh module Agent - VERSION = '0.0.142' + VERSION = '0.0.144' end end
HACK to send a gratuitous arp every <I> seconds for the first minute after networking has been reconfigured
cloudfoundry_bosh
train
rb,rb
6987c4f74bdceb147032af75b532ebea858a5ae4
diff --git a/src/level/TMXLayer.js b/src/level/TMXLayer.js index <HASH>..<HASH> 100644 --- a/src/level/TMXLayer.js +++ b/src/level/TMXLayer.js @@ -360,7 +360,7 @@ me.TMXLayer = me.Renderable.extend({ /** @ignore */ - init: function (tilewidth, tileheight, orientation, tilesets, z, hexsidelength, staggeraxis, staggerindex) { + init: function (tilewidth, tileheight, orientation, tilesets, z) { // super constructor this._super(me.Renderable, "init", [0, 0, 0, 0]); @@ -400,11 +400,6 @@ // for displaying order this.pos.z = z; - - // hexagonal maps only - this.hexsidelength = hexsidelength; - this.staggeraxis = staggeraxis; - this.staggerindex = staggerindex; }, /** @ignore */ @@ -416,8 +411,8 @@ // hexagonal maps only this.hexsidelength = +layer.hexsidelength || undefined; - this.staggeraxis = layer.staggeraxis || undefined; - this.staggerindex = layer.staggerindex || undefined; + this.staggeraxis = layer.staggeraxis; + this.staggerindex = layer.staggerindex; // layer opacity var visible = typeof(layer.visible) !== "undefined" ? layer.visible : true;
These are unnecessary - The extra constructor arguments aren't even passed anywhere...
melonjs_melonJS
train
js
5466700b0f782e85579c4141316efe5600ebb5f5
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/resource/registry_spec.rb +++ b/spec/functional/resource/registry_spec.rb @@ -40,7 +40,7 @@ describe Chef::Resource::RegistryKey, :unix_only do end end -describe Chef::Resource::RegistryKey, :windows_only, :pending => "Refactor helper methods" do +describe Chef::Resource::RegistryKey, :windows_only, :broken => true do # parent and key must be single keys, not paths let(:parent) { 'Opscode' } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -141,6 +141,7 @@ RSpec.configure do |config| config.filter_run_excluding :openssl_lt_101 => true unless openssl_lt_101? config.filter_run_excluding :ruby_lt_20 => true unless ruby_lt_20? config.filter_run_excluding :aes_256_gcm_only => true unless aes_256_gcm? + config.filter_run_excluding :broken => true running_platform_arch = `uname -m`.strip
Disable broken registry_spec tests The registry_spec has been broken since we switched to rspec 3 :pending was running the tests, but expecting them to fail. There seems to be a bug where if there is a failure outside the test, in our case the before block was silently raising an exception accessing resource_name, the tests would fail as expected but rspec would return with an exit code of 1
chef_chef
train
rb,rb
80c704679d299f1018514d48f862edf7ca08ddf5
diff --git a/src/Grant/AuthorizationCode.php b/src/Grant/AuthorizationCode.php index <HASH>..<HASH> 100644 --- a/src/Grant/AuthorizationCode.php +++ b/src/Grant/AuthorizationCode.php @@ -2,9 +2,9 @@ namespace League\OAuth2\Client\Grant; -use League\OAuth2\Client\Token\AccessToken as AccessToken; +use League\OAuth2\Client\Token\AccessToken; -class Authorizationcode implements GrantInterface +class AuthorizationCode implements GrantInterface { public function __toString() {
Renamed Authorizationcode to AuthorizationCode PSR-0 and Ubuntu both care about case-sensitivity.
thephpleague_oauth2-client
train
php
7143765b7ab4757d3cd665450dc53a246aeff646
diff --git a/src/Handlers/Eloquent.php b/src/Handlers/Eloquent.php index <HASH>..<HASH> 100644 --- a/src/Handlers/Eloquent.php +++ b/src/Handlers/Eloquent.php @@ -76,7 +76,7 @@ class Eloquent extends DatabaseHandler */ protected function delete($key) { - $this->resolver()->where('id', '=', $id)->delete(); + $this->resolver()->where('name', '=', $key)->delete(); } /**
[<I>] Fix where call in delete for Eloquent handler
orchestral_memory
train
php
277489c2fb95ddfe1f9a405ce3ac5e4df35c5737
diff --git a/javacord-api/src/main/java/org/javacord/api/entity/server/Server.java b/javacord-api/src/main/java/org/javacord/api/entity/server/Server.java index <HASH>..<HASH> 100644 --- a/javacord-api/src/main/java/org/javacord/api/entity/server/Server.java +++ b/javacord-api/src/main/java/org/javacord/api/entity/server/Server.java @@ -136,6 +136,15 @@ public interface Server extends DiscordEntity, UpdatableFromCache<Server> { Optional<String> getNickname(User user); /** + * Gets your self-muted state. + * + * @return Whether you are self-muted. + */ + default boolean areYouSelfMuted() { + return isSelfMuted(getApi().getYourself()); + } + + /** * Gets the self-muted state of the user with the given id. * * @param userId The id of the user to check.
Add Server#areYouSelfMuted
Javacord_Javacord
train
java
46b2e885fcb6de2dc93fa4bf3b9f6c90bba9110a
diff --git a/structr-ui/src/main/resources/structr/js/schema.js b/structr-ui/src/main/resources/structr/js/schema.js index <HASH>..<HASH> 100644 --- a/structr-ui/src/main/resources/structr/js/schema.js +++ b/structr-ui/src/main/resources/structr/js/schema.js @@ -2196,7 +2196,7 @@ let _Schema = { let unsavedChanges = _Schema.remoteProperties.hasUnsavedChanges(row.closest('table')); if (!unsavedChanges || confirm("Really switch to other type? There are unsaved changes which will be lost!")) { - editSchemaObjectLinkHandler($(this)); + editSchemaObjectLinkHandler($(e.target)); } return false;
Fixes broken link handler for editing schema relationship and linked schema node.
structr_structr
train
js
3b74092b9a83332bbf4f9ba50270de1f9da1cde9
diff --git a/src/frontend/org/voltdb/utils/Collector.java b/src/frontend/org/voltdb/utils/Collector.java index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/utils/Collector.java +++ b/src/frontend/org/voltdb/utils/Collector.java @@ -215,10 +215,14 @@ public class Collector { jsonObject = new JSONObject(builder.toString()); } catch (FileNotFoundException e) { System.err.println("config log file '" + configInfoPath + "' could not be found."); + System.exit(1); } catch (IOException e) { System.err.println(e.getMessage()); + System.exit(1); } catch (JSONException e) { - System.err.println(e.getMessage()); + System.err.println("Error with config file: " + configInfoPath); + System.err.println(e.getLocalizedMessage()); + System.exit(1); } return jsonObject;
Added hooks to stop if invalid directory is given, and more useful error messages
VoltDB_voltdb
train
java
0f0880d4527bb922430b71b79d8f738d84902920
diff --git a/components/switch/index.js b/components/switch/index.js index <HASH>..<HASH> 100644 --- a/components/switch/index.js +++ b/components/switch/index.js @@ -98,10 +98,10 @@ export default class Switch extends Intact { } _onClick(e) { - this.trigger('click', e); if (!e._switchIgnore) { this._toggle(e, false); } + this.trigger('click', e); } _toggle(e, isKeypress) {
fix(Switch): should change value then trigger click event and should keep it consistent, close #<I>
ksc-fe_kpc
train
js
911f65b4b7ac6bc0ab436c09433bf3e6ec410759
diff --git a/lib/knapsack/allocator_builder.rb b/lib/knapsack/allocator_builder.rb index <HASH>..<HASH> 100644 --- a/lib/knapsack/allocator_builder.rb +++ b/lib/knapsack/allocator_builder.rb @@ -8,9 +8,9 @@ module Knapsack def allocator Knapsack::Allocator.new({ report: Knapsack.report.open, + spec_pattern: spec_pattern, ci_node_total: Knapsack::Config::Env.ci_node_total, - ci_node_index: Knapsack::Config::Env.ci_node_index, - spec_pattern: spec_pattern + ci_node_index: Knapsack::Config::Env.ci_node_index }) end
Change args order in allocator builder
ArturT_knapsack
train
rb
07d7e67e1add074e33c3bcc81ac5be7b503f3c0d
diff --git a/Core/InternalModule.php b/Core/InternalModule.php index <HASH>..<HASH> 100644 --- a/Core/InternalModule.php +++ b/Core/InternalModule.php @@ -39,6 +39,7 @@ class InternalModule extends InternalModule_parent { $this->checked = false; $this->state = self::FINE; + $this->metaDataVersion = null; $res = parent::load($id); return $res; }
reset metadataversion on load as I remember this is needed for code that calls load multi le times with different module ids
OXIDprojects_oxid-module-internals
train
php
e6bf04e7bc316a8619afaec7e5eb3b3c7904cd05
diff --git a/src/test/java/net/fortuna/ical4j/model/RecurTest.java b/src/test/java/net/fortuna/ical4j/model/RecurTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/net/fortuna/ical4j/model/RecurTest.java +++ b/src/test/java/net/fortuna/ical4j/model/RecurTest.java @@ -542,7 +542,7 @@ public class RecurTest extends TestCase { Recur recur = new Recur(Recur.DAILY, 10); recur.setInterval(2); log.debug(recur.toString()); - + Calendar cal = Calendar.getInstance(); Date start = new Date(cal.getTime().getTime()); cal.add(Calendar.DAY_OF_WEEK_IN_MONTH, 10); @@ -840,7 +840,7 @@ public class RecurTest extends TestCase { // feb 29 2020 monthly with only valid month by february should return feb 28 2021 recur = new Recur("FREQ=MONTHLY;BYMONTH=2;INTERVAL=1"); suite.addTest(new RecurTest(recur, new DateTime("20200229T000000"), - new DateTime("20200229T000000"), new DateTime("20210228T000000"))); + new DateTime("20200229T000000"), new DateTime("20240229T000000"))); // test hitting limit when getting invalid next recurrence recur = new Recur("FREQ=MONTHLY;BYMONTH=2;BYMONTHDAY=30;INTERVAL=1");
Updated test based on changed behaviour following recurrence refactor
ical4j_ical4j
train
java
584114daf7b4ab42906215cbffb798fc394ef61c
diff --git a/test/integration/active_model_searchable_test.rb b/test/integration/active_model_searchable_test.rb index <HASH>..<HASH> 100644 --- a/test/integration/active_model_searchable_test.rb +++ b/test/integration/active_model_searchable_test.rb @@ -26,9 +26,6 @@ module Slingshot should "save document into index on save and find it" do a = SupermodelArticle.new :title => 'Test' a.save - # p a - # puts a.id - # p SupermodelArticle.find(a.id) Slingshot.index('supermodel_articles').refresh results = SupermodelArticle.search 'test' @@ -56,7 +53,7 @@ module Slingshot Slingshot.index('supermodel_articles').refresh results = SupermodelArticle.search 'foo OR bar^100' - p results + assert_equal 2, results.count assert_equal 'bar', results.first.title
Removing debugging information from ActiveModel integration test
karmi_retire
train
rb
03a5fa24ab4550579ba196e134524bd7e9d22e85
diff --git a/ohc-benchmark/src/main/java/org/caffinitas/ohc/benchmark/BenchmarkOHC.java b/ohc-benchmark/src/main/java/org/caffinitas/ohc/benchmark/BenchmarkOHC.java index <HASH>..<HASH> 100644 --- a/ohc-benchmark/src/main/java/org/caffinitas/ohc/benchmark/BenchmarkOHC.java +++ b/ohc-benchmark/src/main/java/org/caffinitas/ohc/benchmark/BenchmarkOHC.java @@ -216,8 +216,12 @@ public class BenchmarkOHC static long ntime() { -// return threadMXBean.getCurrentThreadCpuTime(); - return System.nanoTime(); + // java.lang.management.ThreadMXBean.getCurrentThreadCpuTime() performs better + // (at least on OSX with single 8-core CPU). Seems that there's less contention/synchronization + // overhead. + + return threadMXBean.getCurrentThreadCpuTime(); +// return System.nanoTime(); } private static void runFor(ThreadPoolExecutor exec, int duration,
use ThreadMXBean for timings
snazy_ohc
train
java
07d8504c3850dcfa1472da386d1a4ee192b60063
diff --git a/pylint/constants.py b/pylint/constants.py index <HASH>..<HASH> 100644 --- a/pylint/constants.py +++ b/pylint/constants.py @@ -8,11 +8,6 @@ from astroid.__pkginfo__ import version as astroid_version from pylint.__pkginfo__ import version as pylint_version -# Allow stopping after the first semicolon/hash encountered, -# so that an option can be continued with the reasons -# why it is active or disabled. -OPTION_RGX = re.compile(r"\s*#.*\bpylint:\s*([^;#]+)[;#]{0,1}") - PY_EXTS = (".py", ".pyc", ".pyo", ".pyw", ".so", ".dll") MSG_STATE_CONFIDENCE = 2
OPTION_RGX is redefined in pragma_parser.py, and is not used anywhere else. Removing this declaration, as it serves no purpose.
PyCQA_pylint
train
py
0aa7420146b7d1de35c02bdc042e8611326b1d82
diff --git a/lib/Vote.php b/lib/Vote.php index <HASH>..<HASH> 100644 --- a/lib/Vote.php +++ b/lib/Vote.php @@ -43,13 +43,13 @@ class Vote implements \Iterator // Vote - private $_ranking; + private array $_ranking; - private $_lastTimestamp; + private float $_lastTimestamp; - private $_counter; + private int $_counter; - private $_ranking_history = []; + private array $_ranking_history = []; private int $_weight = 1;
PHP <I> Type for refactoring Vote
julien-boudry_Condorcet
train
php
6b24c080a6a16a097a3335ab72fe76aaf84f0ca8
diff --git a/siphon/radarserver.py b/siphon/radarserver.py index <HASH>..<HASH> 100644 --- a/siphon/radarserver.py +++ b/siphon/radarserver.py @@ -37,7 +37,9 @@ class RadarQuery(DataQuery): class RadarServer(HTTPEndPoint): def _get_metadata(self): - self.get_path('dataset.xml') + ds_cat = TDSCatalog(self.url_path('dataset.xml')) + self.metadata = ds_cat.metadata + self.variables = set(self.metadata['variables'].keys()) self._get_stations() def _get_stations(self, station_file='stations.xml'): diff --git a/siphon/tests/test_radarsever.py b/siphon/tests/test_radarsever.py index <HASH>..<HASH> 100644 --- a/siphon/tests/test_radarsever.py +++ b/siphon/tests/test_radarsever.py @@ -37,6 +37,9 @@ class TestRadarServer(object): def test_stations(self): assert 'KFTG' in self.client.stations + def test_metadata(self): + assert 'Reflectivity' in self.client.variables + def test_valid_stations(self): q = self.client.query() q.stations('KFTG', 'KTLX')
RadarServer: Parse dataset catalog. Pull the metdata from our dataset catalog. Explicitly pull the variables out of this so they're readily available.
Unidata_siphon
train
py,py
ada8bfe1819c7f345b62370784d0ed1d36e4c580
diff --git a/unity_plugin/src/org/onepf/openiab/UnityPlugin.java b/unity_plugin/src/org/onepf/openiab/UnityPlugin.java index <HASH>..<HASH> 100644 --- a/unity_plugin/src/org/onepf/openiab/UnityPlugin.java +++ b/unity_plugin/src/org/onepf/openiab/UnityPlugin.java @@ -325,6 +325,18 @@ public class UnityPlugin { } } + public boolean isDebugLog() { + return OpenIabHelper.isDebugLog(); + } + + public void enableDebugLogging(boolean enabled) { + OpenIabHelper.enableDebugLogging(enabled); + } + + public void enableDebugLogging(boolean enabled, String tag) { + OpenIabHelper.enableDebugLogging(enabled, tag); + } + // Yandex specific public static final String YANDEX_STORE_SERVICE = "com.yandex.store.service"; public static final String YANDEX_STORE_ACTION_PURCHASE_STATE_CHANGED = YANDEX_STORE_SERVICE + ".PURCHASE_STATE_CHANGED";
#<I> - restored missing methods in unity helper class
onepf_OpenIAB
train
java
dbaf6a4bc372522db9615375698d1613e43e609d
diff --git a/src/hypercorn/asyncio/task_group.py b/src/hypercorn/asyncio/task_group.py index <HASH>..<HASH> 100644 --- a/src/hypercorn/asyncio/task_group.py +++ b/src/hypercorn/asyncio/task_group.py @@ -24,6 +24,10 @@ class TaskGroup: await task finally: task.cancel() + try: + await task + except asyncio.CancelledError: + pass def _cancel_tasks(self) -> None: for task in self._tasks: diff --git a/src/hypercorn/asyncio/tcp_server.py b/src/hypercorn/asyncio/tcp_server.py index <HASH>..<HASH> 100644 --- a/src/hypercorn/asyncio/tcp_server.py +++ b/src/hypercorn/asyncio/tcp_server.py @@ -134,6 +134,11 @@ class TCPServer: async with self.timeout_lock: if self._keep_alive_timeout_handle is not None: self._keep_alive_timeout_handle.cancel() + try: + await self._keep_alive_timeout_handle + except asyncio.CancelledError: + pass + self._keep_alive_timeout_handle = None if self.protocol.idle: self._keep_alive_timeout_handle = self.loop.create_task(
Bugfix wait for tasks to complete when cancelled This seems to be the best practice to avoid any confusing additional errors.
pgjones_hypercorn
train
py,py
d2825470b6fe7183f0a6a67b79b4ed49f2d884fa
diff --git a/lib/dicom/SuperParent.rb b/lib/dicom/SuperParent.rb index <HASH>..<HASH> 100644 --- a/lib/dicom/SuperParent.rb +++ b/lib/dicom/SuperParent.rb @@ -226,6 +226,21 @@ module DICOM end end + # Returns an array of all child elements that belongs to the specified group. + # If no matches are found, returns an empty array. + # + # === Parameters + # + # * <tt>group_string</tt> -- A group string (the first 4 characters of a tag string). + # + def group(group_string) + found = Array.new + children.each do |child| + found << child if child.tag.group == group_string + end + return found + end + # Gathers the desired information from the selected data elements and processes this information to make # a text output which is nicely formatted. Returns a text array and an index of the last data element. # @@ -437,6 +452,19 @@ module DICOM end end + # Removes all data elements of the specified group from this parent. + # + # === Parameters + # + # * <tt>group_string</tt> -- A group string (the first 4 characters of a tag string). + # + def remove_group(group_string) + group_elements = group(group_string) + group_elements.each do |element| + remove(element.tag) + end + end + # Removes all private data elements from the child elements of this parent. # # === Examples
Added methods group() and remove_group() to SuperParent.
dicom_ruby-dicom
train
rb
b10b81c8d1e0123b4d9d58474503ae8e5f010e8a
diff --git a/lib/active_admin/view_helpers/method_or_proc_helper.rb b/lib/active_admin/view_helpers/method_or_proc_helper.rb index <HASH>..<HASH> 100644 --- a/lib/active_admin/view_helpers/method_or_proc_helper.rb +++ b/lib/active_admin/view_helpers/method_or_proc_helper.rb @@ -18,6 +18,8 @@ module MethodOrProcHelper send(symbol_or_proc, *args) when Proc instance_exec(*args, &symbol_or_proc) + else + symbol_or_proc end end @@ -60,6 +62,8 @@ module MethodOrProcHelper else symbol_or_proc.call(receiver, *args) end + else + symbol_or_proc end end @@ -71,7 +75,7 @@ module MethodOrProcHelper case string_symbol_or_proc when Symbol, Proc call_method_or_proc_on(obj, string_symbol_or_proc, options) - when String + else string_symbol_or_proc end end
let MethodOrProcHelper's return the symbol_or_proc as fallback
activeadmin_activeadmin
train
rb
b2ecccb3e8a83a4263cba4a24552b7e8b062e34a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name="pylint-nose-checker", - version="0.0.1", + version="1.0.0", url='http://github.com/OddBloke/pylint-nose-checker', license='GPLv3', description="A pylint plugin which fixes nose.tools import errors",
Bump to <I>.
OddBloke_pylint-nose-checker
train
py
598e5fc0faf45990bc9761e7414fffa69377be75
diff --git a/salt/modules/augeas_cfg.py b/salt/modules/augeas_cfg.py index <HASH>..<HASH> 100644 --- a/salt/modules/augeas_cfg.py +++ b/salt/modules/augeas_cfg.py @@ -95,7 +95,7 @@ def execute(context=None, lens=None, commands=()): .. code-block:: bash - salt '*' augeas.execute commands='["set bind 0.0.0.0", "set maxmemory 1G"]' + salt '*' augeas.execute /files/etc/redis/redis.conf commands='["set bind 0.0.0.0", "set maxmemory 1G"]' ''' ret = {'retval': False}
Add context to augeas.execute CLI example
saltstack_salt
train
py
a3958732581e1d9c26faf24c6679f30ddec3b0ee
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -294,7 +294,7 @@ class FrameworkExtension extends Extension // session storage $container->setAlias('session.storage', $config['storage_id']); $options = array(); - foreach (array('name', 'lifetime', 'path', 'domain', 'secure', 'httponly') as $key) { + foreach (array('name', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'auto_start') as $key) { if (isset($config[$key])) { $options[$key] = $config[$key]; }
[FrameworkBundle][Session] Add auto_start pass to the storage options
symfony_symfony
train
php
d6af155ee54be218079a4694310db080db26684c
diff --git a/livy/client.py b/livy/client.py index <HASH>..<HASH> 100644 --- a/livy/client.py +++ b/livy/client.py @@ -214,6 +214,10 @@ class LivyClient: ) interactive_session_params = {"kind": kind.value} + if heartbeat_timeout is not None: + interactive_session_params[ + "heartbeatTimeoutInSecond" + ] = heartbeat_timeout common_params = _new_session_body( proxy_user, jars, @@ -228,7 +232,6 @@ class LivyClient: queue, name, spark_conf, - heartbeat_timeout, ) body = {**interactive_session_params, **common_params} @@ -450,7 +453,6 @@ def _new_session_body( queue: Optional[str], name: Optional[str], spark_conf: Optional[Dict[str, Any]], - heartbeat_timeout: Optional[int] = None, ) -> Dict[str, Any]: body: Dict[str, Any] = {} if proxy_user is not None: @@ -479,8 +481,4 @@ def _new_session_body( body["name"] = name if spark_conf is not None: body["conf"] = spark_conf - # heartbeat_timeout is only supported for interactive sessions - # not for batch sessions - if heartbeat_timeout is not None: - body["heartbeatTimeoutInSecond"] = heartbeat_timeout return body
Set heartbeatTimeoutInSecond in create_session Prefer not to have it in helper intended for common params.
acroz_pylivy
train
py
5a3332d7c1f5e24343632e43f1e82d5b3eb847e1
diff --git a/lib/fb_graph/connections/permissions.rb b/lib/fb_graph/connections/permissions.rb index <HASH>..<HASH> 100644 --- a/lib/fb_graph/connections/permissions.rb +++ b/lib/fb_graph/connections/permissions.rb @@ -2,17 +2,17 @@ module FbGraph module Connections module Permissions def permissions(options = {}) - if FbGraph.v2? + if self.v2? self.connection(:permissions, options).try(:inject, []) do |arr, entry| arr << entry[:permission].to_sym if entry[:status] == 'granted' arr - end || [] + end else self.connection(:permissions, options).first.try(:inject, []) do |arr, (key, value)| arr << key.to_sym if value.to_i == 1 arr - end || [] - end + end + end || [] end def revoke!(permission = nil, options = {}) diff --git a/lib/fb_graph/node.rb b/lib/fb_graph/node.rb index <HASH>..<HASH> 100644 --- a/lib/fb_graph/node.rb +++ b/lib/fb_graph/node.rb @@ -43,6 +43,10 @@ module FbGraph delete options end + def v2? + self.endpoint.include? 'v2.0' + end + protected def get(params = {})
let node instance know api version
nov_fb_graph
train
rb,rb
9210a998b4c949a0d23438b5ed731e95a9adfa48
diff --git a/beaver/config.py b/beaver/config.py index <HASH>..<HASH> 100644 --- a/beaver/config.py +++ b/beaver/config.py @@ -27,7 +27,7 @@ class Config(): logger = logging.getLogger('beaver') logger.info('Processing config file %s' % configfile) - defaults = { + self._defaults = { 'add_field': '', 'debug': '', 'discover_interval': '15', @@ -41,7 +41,7 @@ class Config(): 'type': '' } self._configfile = configfile - self._config = ConfigParser.ConfigParser(defaults) + self._config = ConfigParser.ConfigParser(self._defaults) self._sanitize() self._files, self._globs = self._parse() @@ -75,8 +75,10 @@ class Config(): return self._files.get(os.path.realpath(filename))[field] def addglob(self, globname, globbed): + config = self._globs.get(globname, self._defaults) + for filename in globbed: - self._files[filename] = self._globs[globname] + self._files[filename] = config def getfilepaths(self): return self._files.keys()
Partial fix for crashes caused by globbed files
python-beaver_python-beaver
train
py
86a064b3ac320088fb3926d0fb2c61e5429f8df9
diff --git a/wisdom-maven-plugin/src/main/java/org/ow2/chameleon/wisdom/maven/utils/BundlePackagerExecutor.java b/wisdom-maven-plugin/src/main/java/org/ow2/chameleon/wisdom/maven/utils/BundlePackagerExecutor.java index <HASH>..<HASH> 100644 --- a/wisdom-maven-plugin/src/main/java/org/ow2/chameleon/wisdom/maven/utils/BundlePackagerExecutor.java +++ b/wisdom-maven-plugin/src/main/java/org/ow2/chameleon/wisdom/maven/utils/BundlePackagerExecutor.java @@ -32,7 +32,7 @@ public class BundlePackagerExecutor { // We look inside target/classes to find the class and resources - File classes = new File("target/classes"); + File classes = new File(mojo.basedir, "target/classes"); Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); // Automatic detection of 'service(s) packages'
Fix packager issue in reactor mode.
wisdom-framework_wisdom
train
java
0b6b1efad356e384fd4764e2f51a2d50dbdcc515
diff --git a/liquibase-core/src/main/java/liquibase/database/core/PostgresDatabase.java b/liquibase-core/src/main/java/liquibase/database/core/PostgresDatabase.java index <HASH>..<HASH> 100644 --- a/liquibase-core/src/main/java/liquibase/database/core/PostgresDatabase.java +++ b/liquibase-core/src/main/java/liquibase/database/core/PostgresDatabase.java @@ -340,6 +340,6 @@ public class PostgresDatabase extends AbstractDatabase { @Override public String escapeIndexName(String schemaName, String indexName) { - return indexName; + return escapeDatabaseObject(indexName); } }
CORE-<I> Missing escaping when creating an index in Postgres
liquibase_liquibase
train
java
1c67d2312fdddb624282baa7266fdeb3b2d26155
diff --git a/cgi.js b/cgi.js index <HASH>..<HASH> 100644 --- a/cgi.js +++ b/cgi.js @@ -98,11 +98,13 @@ function cgi(cgiBin, options) { //var unbase = new Buffer(auth[1], 'base64').toString().split(':'); } + var opts = extend({}, options); + // Now we can spawn the CGI executable debug('env: %o', env); - options.env = env; + opts.env = env; - var cgiSpawn = spawn(cgiBin, options.args, options); + var cgiSpawn = spawn(cgiBin, opts.args, opts); debug('cgi spawn (pid: %o)', cgiSpawn.pid); // The request body is piped to 'stdin' of the CGI spawn
cgi: ensure that the spawn opts don't trump the cgi options object Fixes #<I>.
TooTallNate_node-cgi
train
js
82b7d2cd1983e7240f97851b4a56f77b3044c156
diff --git a/tests/utils/misc/index.js b/tests/utils/misc/index.js index <HASH>..<HASH> 100644 --- a/tests/utils/misc/index.js +++ b/tests/utils/misc/index.js @@ -83,13 +83,13 @@ function wait(ms) { } module.exports = { - logger, - region, confirmCloudWatchLogs, - testServiceIdentifier, - serviceNameRegex, getServiceName, - replaceEnv, + logger, persistentRequest, + region, + replaceEnv, + serviceNameRegex, + testServiceIdentifier, wait, };
test: Alphabetical order on exports
serverless_serverless
train
js
6a9b3c00319224a1a4f935eee060afc9059b8929
diff --git a/howdoi.rb b/howdoi.rb index <HASH>..<HASH> 100644 --- a/howdoi.rb +++ b/howdoi.rb @@ -50,6 +50,11 @@ class Howdoi < Formula sha256 "9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92" end + resource "urllib3" do + url "https://files.pythonhosted.org/packages/4c/13/2386233f7ee40aa8444b47f7463338f3cbdf00c316627558784e3f542f07/urllib3-1.25.3.tar.gz" + sha256 "dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" + end + def install virtualenv_install_with_resources end
Add urllib3 dependency to brew install
gleitz_howdoi
train
rb
d09eae33b0e7a9ee320266adc69f928d2b9d6d49
diff --git a/code/model/Order.php b/code/model/Order.php index <HASH>..<HASH> 100644 --- a/code/model/Order.php +++ b/code/model/Order.php @@ -268,6 +268,10 @@ class Order extends DataObject { )); $fields->addFieldToTab('Root.Main', new LiteralField('MainDetails', $htmlSummary)); + + //TODO: re-introduce this when order status logs have some meaningful purpose + $fields->removeByName('OrderStatusLogs'); + $orderItemsTable = new TableListField( "OrderItems", //$name "OrderItem", //$sourceClass = @@ -282,8 +286,9 @@ class Order extends DataObject { "Total", array("Total" => array("sum","Currency->Nice")) ); + $fields->addFieldToTab('Root.Items',$orderItemsTable); - + $modifierTable = new TableListField( "OrderModifiers", //$name "OrderModifier", //$sourceClass = @@ -1093,9 +1098,13 @@ class Order extends DataObject { function onAfterWrite() { parent::onAfterWrite(); + + /*//FIXME: this is not a good way to change status, especially when orders are saved multiple times when an oder is placed $log = new OrderStatusLog(); $log->OrderID = $this->ID; $log->SentToCustomer = false; + */ + //TO DO: make this sexier OR consider using Versioning! $data = print_r($this->record, true); $log->Title = "Order Update";
Disabled OrderStatusLog creating and viewing. At least until it's implementation/purpose is properly sorted out.
silvershop_silvershop-core
train
php
361f394830eb0378a60e3cc80102530333bb443a
diff --git a/code/libraries/koowa/components/com_activities/controllers/behaviors/loggable.php b/code/libraries/koowa/components/com_activities/controllers/behaviors/loggable.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/components/com_activities/controllers/behaviors/loggable.php +++ b/code/libraries/koowa/components/com_activities/controllers/behaviors/loggable.php @@ -63,7 +63,14 @@ class ComActivitiesControllerBehaviorLoggable extends KControllerBehaviorAbstrac { if (in_array($name, $this->_actions)) { - $data = $context->result; + $parts = explode('.', $name); + + // Properly fetch data for the event. + if ($parts[0] == 'before') { + $data = $this->getMixer()->getModel()->getData(); + } else { + $data = $context->result; + } if ($data instanceof KDatabaseRowInterface || $data instanceof KDatabaseRowsetInterface) { $rowset = array();
Made loggable a bit smarter so that it plays well with before.x events.
joomlatools_joomlatools-framework
train
php
68a467386192b81315bcb4e1931fea82b64ad5b0
diff --git a/lib/Less/Parser.php b/lib/Less/Parser.php index <HASH>..<HASH> 100755 --- a/lib/Less/Parser.php +++ b/lib/Less/Parser.php @@ -1011,7 +1011,7 @@ class Parser { if ($this->match('(')) { $sel = $this->match('parseEntity'); - $this->expect(')'); + if (!$this->match(')')) { return null; } return new \Less\Node\Selector(array(new \Less\Node\Element('', $sel, $this->pos))); }
fix parser bug with mixin call being interpretted as selector
oyejorge_less.php
train
php
0d5952d3ce754ec8619b2d562612ee572ab865f5
diff --git a/tests/test_alldiff.py b/tests/test_alldiff.py index <HASH>..<HASH> 100644 --- a/tests/test_alldiff.py +++ b/tests/test_alldiff.py @@ -1,8 +1,12 @@ -import networkx -from networkx.algorithms import bipartite -from pyscipopt import Model, Conshdlr, SCIP_RESULT, SCIP_PARAMEMPHASIS, SCIP_PARAMSETTING -from types import SimpleNamespace -import matplotlib.pyplot as plt +try: + import networkx + from networkx.algorithms import bipartite + from pyscipopt import Model, Conshdlr, SCIP_RESULT, SCIP_PARAMEMPHASIS, SCIP_PARAMSETTING + from types import SimpleNamespace + import matplotlib.pyplot as plt +except: + import pytest + pytest.skip() #initial Sudoku values init = [5, 3, 0, 0, 7, 0, 0, 0, 0,
skip failing "test" for alldiff example
SCIP-Interfaces_PySCIPOpt
train
py
d64f8d92851ad433a0d2d7e97fa95f3fca85c8c9
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index <HASH>..<HASH> 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -249,17 +249,13 @@ class FeatureContext implements SnippetAcceptingContext { $this->checkFileExists($specification); require($specification->getFilePath()); - if (!class_exists('spec\\'.$specification->getClassName(), false)) { - throw new \RuntimeException(sprintf('Class %s not found', $specification->getClassName())); - } + $this->checkClassExists('spec\\'.$specification->getClassName()); } private function checkClassIsGenerated(ClassSpecification $specification) { $this->checkFileExists($specification); - if (!class_exists($specification->getClassName(), false)) { - throw new \RuntimeException(sprintf('Class %s not found', $specification->getClassName())); - } + $this->checkClassExists($specification->getClassName()); } private function checkFileExists(ObjectSpecification $specification) @@ -274,4 +270,11 @@ class FeatureContext implements SnippetAcceptingContext ); } } + + private function checkClassExists($className) + { + if (!class_exists($className, false)) { + throw new \RuntimeException(sprintf("Class $className not found")); + } + } }
Further reduce duplication in featureContext
MageTest_MageSpec
train
php
a421f94909a1f98095dd707002b4cdf3c084d815
diff --git a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java @@ -61,7 +61,10 @@ public class BootstrapTest { @Test public void shouldNotAllowFactoryToChangeMoreThanOnce() { Bootstrap b = new Bootstrap(); - b.setFactory(createMock(ChannelFactory.class)); + ChannelFactory f = createMock(ChannelFactory.class); + b.setFactory(f); + assertSame(f, b.getFactory()); + try { b.setFactory(createMock(ChannelFactory.class)); fail(); @@ -220,9 +223,10 @@ public class BootstrapTest { Bootstrap b = new Bootstrap(); b.setOption("s", "x"); - assertEquals("x", b.getOptions().get("s")); + assertEquals("x", b.getOption("s")); b.setOption("s", null); + assertNull(b.getOption("s")); assertTrue(b.getOptions().isEmpty()); } }
A couple more test cases for Bootstrap
netty_netty
train
java
0386448b3fdf93f904f247b2c1564be6cec6fca0
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java index <HASH>..<HASH> 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java @@ -999,6 +999,7 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc, private void addLoincFilterAncestorIn(String theSystem, QueryBuilder theQb, BooleanJunction<?> theBool, ValueSet.ConceptSetFilterComponent theFilter) { throw new UnsupportedOperationException(); + // FIXME: DM 2019-09-30 - Working on this presently. // FIXME: DM 2019-09-25 - Filter with op=IN on ancestor; see #1512 in GitHub. // FIXME: DM 2019-09-26 - Once implemented, fix changelog entry for #1454 in changes.xml // String[] values = theFilter.getValue().split(",");
Initial commit for work on ancestor filter with IN operator for LOINC.
jamesagnew_hapi-fhir
train
java
50c2ef752bc6549b26f4bcc51429eded0a0baac9
diff --git a/devices/lidl.js b/devices/lidl.js index <HASH>..<HASH> 100644 --- a/devices/lidl.js +++ b/devices/lidl.js @@ -441,6 +441,16 @@ module.exports = [ toZigbee: [], }, { + fingerprint: [{modelID: 'TS1001', manufacturerName: '_TYZB01_hww2py6b'}], + model: 'FB21-001', + vendor: 'Lidl', + description: 'Livarno Lux switch and dimming light remote control', + exposes: [e.action(['on', 'off', 'brightness_stop', 'brightness_step_up', 'brightness_step_down', 'brightness_move_up', + 'brightness_move_down'])], + fromZigbee: [fz.command_on, fz.command_off, fz.command_step, fz.command_move, fz.command_stop], + toZigbee: [], + }, + { fingerprint: [ {modelID: 'TS011F', manufacturerName: '_TZ3000_wzauvbcs'}, // EU {modelID: 'TS011F', manufacturerName: '_TZ3000_1obwwnmq'},
Add FB<I>-<I> (#<I>) Add support for the Livarno remote control that is included in a Livarno Home LED ceiling light (see <URL>) Same type buttons as the model FB<I>-<I> but different look and layout.
Koenkk_zigbee-shepherd-converters
train
js
bbe55f93bd2aa324171a6d0be107822778e99148
diff --git a/src/chui/utils.js b/src/chui/utils.js index <HASH>..<HASH> 100755 --- a/src/chui/utils.js +++ b/src/chui/utils.js @@ -4,8 +4,11 @@ /////////////// // Create Uuid: /////////////// + UuidBit : 1, + Uuid : function() { - return Date.now().toString(36); + this.UuidBit++ + return Date.now().toString(36) + this.UuidBit; }, ///////////////////////////
Refactored creation of uuids. The $.Uuid method had a problem where if it were called in rapid succession it wouldn’t create a unique id. This has been corrected.
chocolatechip-ui_chocolatechipui
train
js
d7154fccc37142bbdf0443ddfcf8cc0d7fb2c669
diff --git a/src/JPush/Model/PushPayload.php b/src/JPush/Model/PushPayload.php index <HASH>..<HASH> 100644 --- a/src/JPush/Model/PushPayload.php +++ b/src/JPush/Model/PushPayload.php @@ -154,19 +154,14 @@ class PushPayload { } else if ($hasAlert) { $ios = $this->calculateLength(json_encode(array('alert'=>$alert, 'sound'=>'', 'badge'=>1))); } - // ios notification length should be less than 220 - if ($ios > 220) { + // ios notification length should be less than 2048 + if ($ios > 2000) { return true; } } - if (!is_null($ios)) { - $msg_len = $this->calculateLength(json_encode($message)); - $ios += $msg_len; - } - - //ios notification and message length should be less than 1200 - return $ios > 1200; + $msg_len = $this->calculateLength(json_encode($message)); + return $msg_len > 1000; }
update feature that ios notification payload support <I> byte and ios message support <I> byte
jpush_jpush-api-php-client
train
php
c729c2a7b5f4557d502d081f02b5f780db5e753c
diff --git a/lib/metadata/linux/LinuxSystemd.rb b/lib/metadata/linux/LinuxSystemd.rb index <HASH>..<HASH> 100644 --- a/lib/metadata/linux/LinuxSystemd.rb +++ b/lib/metadata/linux/LinuxSystemd.rb @@ -130,7 +130,11 @@ module MiqLinux end def duplicated_link?(file) - existing_dirs.any? { |dir| @fs.getLinkPath(file).start_with?(dir) } if @fs.fileSymLink?(file) + existing_dirs.any? do |dir| + link_levels = @fs.getLinkPath(file).split('/') + levels = dir.split('/') + link_levels.take(levels.length).eql?(levels) + end if @fs.fileSymLink?(file) end def debug(msg)
Changed to use array comparison to check duplicate links
ManageIQ_manageiq-smartstate
train
rb
26f25f5113a3155abe05ba06363f473a2589c2fb
diff --git a/tests/test_warnings.py b/tests/test_warnings.py index <HASH>..<HASH> 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -685,15 +685,9 @@ class TestSuite(unittest.TestCase): @unittest.skipIf(sys.platform == 'win32', WINDOWS_TMP_FILE_MSG) def test_bad_rsiz(self): """ - Should not warn if RSIZ when parsing is turned off. + SCENARIO: The SIZ value parsed from the SIZ segment is invalid. - This test was originally written for OPJ_DATA file - - input/nonregression/edf_c2_1002767.jp2' - - It had an RSIZ value of 32, so that's what we use here. - - Issue196 + EXPECTED RESULT: A warning is issued. """ with tempfile.NamedTemporaryFile(suffix='.jp2', mode='wb') as ofile: with open(self.jp2file, 'rb') as ifile: @@ -710,10 +704,6 @@ class TestSuite(unittest.TestCase): ofile.seek(0) - glymur.set_option('parse.full_codestream', False) - Jp2k(ofile.name) - - glymur.set_option('parse.full_codestream', True) with self.assertWarns(UserWarning): Jp2k(ofile.name)
Fix test for bad RSIZ value A test for a bad RSIZ value was incorrectly written. It assumed that the 'parse.full_codestream' option could turn off parsing the codestream when set to false. That's not true, we would still parse the codestream header, which is where RSIZ lives. Closes-Issue: #<I>
quintusdias_glymur
train
py
946adb0a5bbbb90176f60e124b1dc223e8755003
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,11 @@ var h = require('hyperscript') module.exports = function (img, onCrop) { + onCrop = onCrop || function () {} var width = img.width, height = img.height - var c = CANVAS = h('canvas', { - width: width, height: height, - style: {width: '100%', height: '100%'} + var c = CANVAS = h('canvas.hypercrop__canvas', { + width: width, height: height }) var c2 = h('canvas', { @@ -99,3 +99,5 @@ module.exports = function (img, onCrop) { return c } + +
let user set size via css, etc
hyperhype_hypercrop
train
js
cecad3c3b0cba20d253220f13737055293a48524
diff --git a/O365/connection.py b/O365/connection.py index <HASH>..<HASH> 100644 --- a/O365/connection.py +++ b/O365/connection.py @@ -857,7 +857,7 @@ class Connection: There is no guarantee that this method will be called by the garbage collection But this is not an issue because this connections will be automatically closed. """ - if self.session: + if hasattr(self, 'session'): self.session.close()
Update connection.py Added hasattr check to Connection __del__ method as it was giving an AttributeError
O365_python-o365
train
py
c6faa0ca3693a54cb4454988b6edb5acb24c3829
diff --git a/infoblox_client/objects.py b/infoblox_client/objects.py index <HASH>..<HASH> 100644 --- a/infoblox_client/objects.py +++ b/infoblox_client/objects.py @@ -18115,7 +18115,7 @@ class DNSZone(InfobloxObject): _all_searchable_fields = ['comment', 'dnssec_ksk_rollover_date', 'dnssec_zsk_rollover_date', 'fqdn', 'parent', 'view', 'zone_format'] - _return_fields = ['extattrs', 'fqdn', 'view', 'zone_format', 'ns_group', + _return_fields = ['extattrs', 'fqdn', 'view', 'ns_group', 'prefix', 'grid_primary', 'grid_secondaries'] _remap = {} _shadow_fields = ['_ref']
Changes as per bug/NIOS-<I>
infobloxopen_infoblox-client
train
py
7af9e3768a4151b78a3191b5314968333561898a
diff --git a/lib/__init__.py b/lib/__init__.py index <HASH>..<HASH> 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -3,6 +3,8 @@ from .ds9_region_parser import RegionParser from .wcs_converter import check_wcs as _check_wcs from itertools import cycle +_builtin_open = open + class ShapeList(list): def __init__(self, *ka, **kw): self._comment_list = kw.pop("comment_list", None) @@ -108,8 +110,7 @@ class ShapeList(list): if len(set([shape.coord_format for shape in self])) > 1: raise ValueError("Inconsistent coordinate formats") - import __builtin__ - outf = __builtin__.open(outfile,'w') + outf = _builtin_open(outfile,'w') attr0 = self[0].attr[1] defaultline = " ".join(["%s=%s" % (a,attr0[a]) for a in attr0 if a!='text']) @@ -141,8 +142,7 @@ def parse(region_string): return ShapeList(shape_list, comment_list=comment_list) def open(fname): - import __builtin__ - region_string = __builtin__.open(fname).read() + region_string = _builtin_open(fname).read() return parse(region_string)
revert 7af<I>ef and do not use __builtins__ which needs py3 change
astropy_pyregion
train
py
723b5beec6d2b59bf2e3726fcf022227ea69509d
diff --git a/src/validators/common.js b/src/validators/common.js index <HASH>..<HASH> 100644 --- a/src/validators/common.js +++ b/src/validators/common.js @@ -8,6 +8,11 @@ export const req = value => { return false } + if (value instanceof Date) { + // invalid date won't pass + return !isNaN(value.getTime()) + } + if (typeof value === 'object') { for (let _ in value) return true return false diff --git a/test/unit/specs/validators/required.spec.js b/test/unit/specs/validators/required.spec.js index <HASH>..<HASH> 100644 --- a/test/unit/specs/validators/required.spec.js +++ b/test/unit/specs/validators/required.spec.js @@ -52,4 +52,12 @@ describe('required validator', () => { it('should validate unicode', () => { expect(required('🎉')).to.be.true }) + + it('should validate correct date', () => { + expect(required(new Date(1234123412341))).to.be.true + }) + + it('should not validate invalid date', () => { + expect(required(new Date('a'))).to.be.false + }) })
Add date object support to required validator
vuelidate_vuelidate
train
js,js
b83fc00f6188b06aeb134820eb0af85d76bb843b
diff --git a/app/src/components/FileInfo/index.js b/app/src/components/FileInfo/index.js index <HASH>..<HASH> 100644 --- a/app/src/components/FileInfo/index.js +++ b/app/src/components/FileInfo/index.js @@ -23,9 +23,11 @@ type Props = {| export default function FileInfo(props: Props) { const { robot, sessionLoaded, sessionHasSteps } = props - const uploadError = sessionHasSteps - ? props.uploadError - : { message: NO_STEPS_MESSAGE } + let uploadError = props.uploadError + + if (sessionLoaded && !uploadError && !sessionHasSteps) { + uploadError = { message: NO_STEPS_MESSAGE } + } return ( <div className={styles.file_info_container}> @@ -33,9 +35,7 @@ export default function FileInfo(props: Props) { <ProtocolPipettesCard robot={robot} /> <ProtocolModulesCard robot={robot} /> <ProtocolLabwareCard /> - {sessionLoaded && uploadError && ( - <UploadError uploadError={uploadError} /> - )} + {uploadError && <UploadError uploadError={uploadError} />} {sessionLoaded && !uploadError && <Continue />} </div> )
refactor(app): fix no-steps-in-protocol warning clobbering upload errors (#<I>)
Opentrons_opentrons
train
js
6f63881020b1b52d2fd0d23de13aef078d6910d4
diff --git a/builder/amazon/common/step_security_group.go b/builder/amazon/common/step_security_group.go index <HASH>..<HASH> 100644 --- a/builder/amazon/common/step_security_group.go +++ b/builder/amazon/common/step_security_group.go @@ -80,7 +80,7 @@ func (s *StepSecurityGroup) Run(state multistep.StateBag) multistep.StepAction { // group isn't available immediately because AWS resources are eventually // consistent. ui.Say(fmt.Sprintf( - "Authorizing access to port %d the temporary security group...", + "Authorizing access to port %d on the temporary security group...", port)) for i := 0; i < 5; i++ { _, err = ec2conn.AuthorizeSecurityGroupIngress(req)
fixes a typo introduced in a previous change
hashicorp_packer
train
go
0cc3fcc377fcd6b2183c490fba62cddda7fd40af
diff --git a/mdw-common/src/com/centurylink/mdw/cli/SwaggerGenerate.java b/mdw-common/src/com/centurylink/mdw/cli/SwaggerGenerate.java index <HASH>..<HASH> 100644 --- a/mdw-common/src/com/centurylink/mdw/cli/SwaggerGenerate.java +++ b/mdw-common/src/com/centurylink/mdw/cli/SwaggerGenerate.java @@ -296,15 +296,14 @@ public class SwaggerGenerate extends io.swagger.codegen.cmd.Generate { configurator.setRemoveOperationIdPrefix(removeOperationIdPrefix); } + Map<String,Object> addlProps = new LinkedHashMap<>(); if (generatedFlowBasePackage != null) { - Map<String,Object> addlProps = new LinkedHashMap<>(); addlProps.put(GENERATED_FLOW_BASE_PACKAGE, generatedFlowBasePackage); - configurator.setAdditionalProperties(addlProps); } - if (inputApiPackage != null) { - Map<String,Object> addlProps = new LinkedHashMap<>(); addlProps.put(INPUT_API_PACKAGE, inputApiPackage); + } + if (!addlProps.isEmpty()) { configurator.setAdditionalProperties(addlProps); }
Fix CLI codegen workflow generation.
CenturyLinkCloud_mdw
train
java
1e6fff812ad9b49fa81f44a548b2e9b1bc6fe451
diff --git a/lib/stemcell/builder.rb b/lib/stemcell/builder.rb index <HASH>..<HASH> 100644 --- a/lib/stemcell/builder.rb +++ b/lib/stemcell/builder.rb @@ -248,7 +248,7 @@ private end def definition_dest_dir - File.join(@prefix, "definitions", @name) + File.expand_path File.join(@prefix, "definitions", @name) end def compile_erb(erb_file, dst_file=nil)
Fix path bug in the definition_dest_dir
ankurcha_stemcell
train
rb
7befa9020ae207bd5f312711700876053470a364
diff --git a/lib/locomotive/steam/entities/content_entry.rb b/lib/locomotive/steam/entities/content_entry.rb index <HASH>..<HASH> 100644 --- a/lib/locomotive/steam/entities/content_entry.rb +++ b/lib/locomotive/steam/entities/content_entry.rb @@ -145,6 +145,7 @@ module Locomotive::Steam class FileField < Struct.new(:filename, :base, :updated_at) def url + return if filename.blank? base.blank? ? filename : "#{base}/#{filename}" end
url of a file field (content entry) should be nil if no filename (issue with documents loaded from MongoDB)
locomotivecms_steam
train
rb
074d0fe88e3887b02a7f31d6537cb784f6b1b599
diff --git a/grappa/operators/contain.py b/grappa/operators/contain.py index <HASH>..<HASH> 100644 --- a/grappa/operators/contain.py +++ b/grappa/operators/contain.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- +from array import array from six.moves import collections_abc import six + from ..operator import Operator @@ -59,21 +61,21 @@ class ContainOperator(Operator): NORMALIZE_TYPES = ( collections_abc.Iterator, collections_abc.MappingView, - collections_abc.Set + collections_abc.Set, + array ) def match(self, subject, *expected): if isinstance(subject, self.NORMALIZE_TYPES): subject = list(subject) + elif isinstance(subject, collections_abc.Mapping): + subject = list(subject.values()) - if self._is_not_a_sequence(subject): + if not isinstance(subject, collections_abc.Sequence): return False, ['is not a valid sequence type'] return self._matches(subject, *expected) - def _is_not_a_sequence(self, value): - return not isinstance(value, collections_abc.Sequence) - def _matches(self, subject, *expected): reasons = []
contain now supports dicts and arrays. Partially fix #<I>
grappa-py_grappa
train
py
e3f5d023fffa59ae593810c702f5d6be0ef45651
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index <HASH>..<HASH> 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -168,9 +168,16 @@ module ApplicationTests end test 'db:test:load_structure with database_url' do - require "#{app_path}/config/environment" - set_database_url - db_test_load_structure + old_rails_env = ENV["RAILS_ENV"] + ENV["RAILS_ENV"] = 'test' + + begin + require "#{app_path}/config/environment" + set_database_url + db_test_load_structure + ensure + ENV["RAILS_ENV"] = old_rails_env + end end end end
run the load_structure test in the test environment
rails_rails
train
rb
6e4fea97354782ea89acc26f1cc291980ee2462c
diff --git a/lib/travis/model/build/matrix.rb b/lib/travis/model/build/matrix.rb index <HASH>..<HASH> 100644 --- a/lib/travis/model/build/matrix.rb +++ b/lib/travis/model/build/matrix.rb @@ -55,7 +55,7 @@ class Build def matrix_state tests = matrix.reject { |test| test.allow_failure? } if tests.blank? - nil + :passed elsif tests.any?(&:errored?) :errored elsif tests.any?(&:canceled?) diff --git a/spec/travis/model/build/matrix_spec.rb b/spec/travis/model/build/matrix_spec.rb index <HASH>..<HASH> 100644 --- a/spec/travis/model/build/matrix_spec.rb +++ b/spec/travis/model/build/matrix_spec.rb @@ -79,6 +79,15 @@ describe Build, 'matrix' do end end + context 'matrix with one allow_failure job' do + let(:build) { Factory(:build, config: { rvm: ['1.9.3'] }) } + + it 'returns :passed' do + build.matrix[0].update_attributes!(state: "failed", allow_failure: true) + build.matrix_state.should == :passed + end + end + describe :matrix_duration do let(:build) do Build.new(matrix: [
fix an edge case with matrix_state some builds have single matrix allow_failure jobs, which was resulting in nil for matrix_state when it should just be :passed there are several ways we can solve this, but this is a good simple solution for the time being
travis-ci_travis-core
train
rb,rb
f39f3b1668d3ad64fa4269807e0f609fbbde4c96
diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index <HASH>..<HASH> 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -20,10 +20,16 @@ export default class ServerlessOffline { #lambda = null #serverless = null - constructor(serverless, cliOptions) { + constructor(serverless, cliOptions, v3Utils) { this.#cliOptions = cliOptions this.#serverless = serverless + if (v3Utils) { + this.log = v3Utils.log + this.progress = v3Utils.progress + this.writeText = v3Utils.writeText + } + setLog((...args) => serverless.cli.log(...args)) this.commands = {
refactor: Adapt v3 log writing interfaces
dherault_serverless-offline
train
js
50ec64b841321ee7e90f9402219e91ef361945fb
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -88,16 +88,16 @@ install_requires = [ "python-benedict>=0.21.1", "pyparsing==2.4.7", "typing_extensions>=3.7.4", - "fsspec==2021.4.0", + "fsspec==2021.5.0", "diskcache>=5.2.1", ] # Extra dependencies for remote integrations -gs = ["gcsfs==2021.4.0"] +gs = ["gcsfs==2021.5.0"] gdrive = ["pydrive2>=1.8.1", "six >= 1.13.0"] -s3 = ["s3fs==2021.4.0", "aiobotocore[boto3]==1.3.0"] +s3 = ["s3fs==2021.5.0", "aiobotocore[boto3]==1.3.0"] azure = ["adlfs==0.7.1", "azure-identity>=1.4.0", "knack"] # https://github.com/Legrandin/pycryptodome/issues/465 oss = ["oss2==2.6.1", "pycryptodome>=3.10"]
setup: bump fsspec/s3fs/gcsfs to <I> (#<I>)
iterative_dvc
train
py
30d823db6e4ed85f338b3f16b17f0935f5fde866
diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java index <HASH>..<HASH> 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java @@ -128,5 +128,11 @@ public interface NotificationCenter { */ void unsubscribe(Object channel, NotificationObserver observer); - + + + /** + * Clears all {@link NotificationObserver} subscriptions in the current {@link NotificationCenter} + * for session aware applications that needs to perform a complete reset on logout. + */ + void clear(); }
Adding `clear` operation to the `NotificationCenter` API
sialcasa_mvvmFX
train
java
babff90e7df6abfdbabd61f77fd40d8f4f7ef397
diff --git a/propagator.js b/propagator.js index <HASH>..<HASH> 100644 --- a/propagator.js +++ b/propagator.js @@ -10,9 +10,10 @@ function Propagator(func,input,output) { var self = this assert(func && input && output, "You need to call the propagator constructor with all three of a function, input cell and output cell") - assert(input instanceof Cell || input instanceof Array, "Propagators read from cells or lists of cells, not", typeof input) - assert(output instanceof Cell, "Propagators output to single cells, not", typeof output) + assert(input instanceof Cell || input instanceof Array, "Propagators read from cells or lists of cells, not " + typeof input) + assert(output instanceof Cell, "Propagators output to single cells, not " + typeof output) assert(input !== output, "Propagators shouldn't write out to the same cell they read from.") + if (input instanceof Array) input.forEach( (cell) => assert(cell instanceof Cell,"All inputs need to be cells, not " + typeof cell ) ); this.input = coerceToArray(input); this.output = output;
added an additional invariant check for a missing case
eldritchreality_propagator.js
train
js
b5ab64ad1abb47277831d1dc6d6d78f94f194a7b
diff --git a/salt/modules/cpan.py b/salt/modules/cpan.py index <HASH>..<HASH> 100644 --- a/salt/modules/cpan.py +++ b/salt/modules/cpan.py @@ -217,6 +217,12 @@ def show(module): def show_config(): ''' Return a dict of CPAN configuration values + + CLI Example: + + .. code-block:: bash + + salt '*' cpan.show_config ''' ret = {} cmd = 'cpan -J'
Oops, forgot to finish a docstring
saltstack_salt
train
py
c937f0fa1d349c7679a5045e1e709887f356f353
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -138,6 +138,8 @@ setup( project_urls={ "Documentation": "https://python-tcod.readthedocs.io", "Changelog": "https://github.com/libtcod/python-tcod/blob/develop/CHANGELOG.rst", + "Source": "https://github.com/libtcod/python-tcod", + "Tracker": "https://github.com/libtcod/python-tcod/issues", }, py_modules=["libtcodpy"], packages=["tdl", "tcod"],
Add source and issue tracker project URLs.
libtcod_python-tcod
train
py
9df0a96fa43b7be066f6f4b82bde8c1da0b5920a
diff --git a/app/assets/javascripts/pancore/simMatrix.js b/app/assets/javascripts/pancore/simMatrix.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/pancore/simMatrix.js +++ b/app/assets/javascripts/pancore/simMatrix.js @@ -204,6 +204,7 @@ var constructSimMatrix = function constructSimMatrix(worker) { delete names[id]; var index = order.indexOf(id); order.splice(index, 1); + that.reDraw(); } // initialize the object
removing needs to be fixed in the d3 code of the matrix
unipept_unipept-cli
train
js
c84e492d93458e0bb79bfa1810047841d5bb12ae
diff --git a/repo_file.go b/repo_file.go index <HASH>..<HASH> 100644 --- a/repo_file.go +++ b/repo_file.go @@ -13,3 +13,11 @@ import ( func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) { return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil) } + +// GetArchive downloads the full contents of a repository. Ref can be a branch/tag/commit. +func (c *Client) GetArchive(user, repo, ref, format string) ([]byte, error) { + if format != ".zip" && format != ".tar.gz" { + return nil, fmt.Errorf("invalid format: %s (must be .zip or .tar.gz)", format) + } + return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/archive/%s%s", user, repo, ref, format), nil, nil) +}
Implement GetArchive (#<I>) * Implement GetArchive * Fix capitalization in error message.
gogs_go-gogs-client
train
go
9f824445013a8b4690f8327912727cad1cb459d7
diff --git a/src/main/java/com/treasure_data/client/AbstractClientAdaptor.java b/src/main/java/com/treasure_data/client/AbstractClientAdaptor.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/treasure_data/client/AbstractClientAdaptor.java +++ b/src/main/java/com/treasure_data/client/AbstractClientAdaptor.java @@ -88,8 +88,8 @@ public abstract class AbstractClientAdaptor { // explicit cast should not be used: object to string. because it's // deffensive programming here. By the change of API spec., there is // the possibility that the type of 'job_id' is changed. - Object job_id = map.get("job_id"); - return job_id.toString(); + Object jobID = map.get("job_id"); + return jobID.toString(); } public void setUserAgentHeader(Map<String, String> header) {
minor change of AbstractClientAdaptor class
treasure-data_td-client-java
train
java
16818d4585209c2a77066fb55f4f11787b91eb74
diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index <HASH>..<HASH> 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -314,6 +314,10 @@ class ViewListener extends BaseListener $table = $entity = []; $actions = $this->_crud()->config('actions'); + $blacklist = (array)$this->_action()->config('scaffold.actions_blacklist'); + $blacklist = array_combine($blacklist, $blacklist); + $actions = array_diff_key($actions, $blacklist); + foreach ($actions as $actionName => $config) { $action = $this->_action($actionName);
Add ability to blacklist actions from showing up on a particular template
FriendsOfCake_crud-view
train
php
05b6156d430970adcc628f7f1305d578094fa029
diff --git a/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java b/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java +++ b/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java @@ -184,7 +184,7 @@ public final class ServiceConfigUtil { if (!hedgingPolicy.containsKey(HEDGING_POLICY_MAX_ATTEMPTS_KEY)) { return null; } - return getDouble(hedgingPolicy, RETRY_POLICY_MAX_ATTEMPTS_KEY).intValue(); + return getDouble(hedgingPolicy, HEDGING_POLICY_MAX_ATTEMPTS_KEY).intValue(); } @Nullable
core: using correct key for hedging max attempts
grpc_grpc-java
train
java
029b0dae0186a811deeecfbd9cb26a696f6cf514
diff --git a/src/server/pkg/hashtree/db.go b/src/server/pkg/hashtree/db.go index <HASH>..<HASH> 100644 --- a/src/server/pkg/hashtree/db.go +++ b/src/server/pkg/hashtree/db.go @@ -226,7 +226,6 @@ func glob(tx *bolt.Tx, pattern string) (map[string]*NodeProto, error) { return map[string]*NodeProto{clean(pattern): node}, nil } - pattern = clean(pattern) g, err := globlib.Compile(pattern, '/') if err != nil { return nil, errorf(MalformedGlob, err.Error()) @@ -246,6 +245,7 @@ func glob(tx *bolt.Tx, pattern string) (map[string]*NodeProto, error) { } func (h *dbHashTree) Glob(pattern string) (map[string]*NodeProto, error) { + pattern = clean(pattern) var result map[string]*NodeProto if err := h.View(func(tx *bolt.Tx) error { var err error @@ -605,7 +605,7 @@ func (h *dbHashTree) DeleteFile(path string) error { // Delete root means delete all files if path == "" { - path = "*" + path = "/*" } return h.Batch(func(tx *bolt.Tx) error { paths, err := glob(tx, path)
Make path cleaning for globbing consistent with the rest of the hashtree api
pachyderm_pachyderm
train
go
0d5875e86852126301f0f65b0f2d581f103539a5
diff --git a/h2o-core/src/main/java/water/init/NetworkTest.java b/h2o-core/src/main/java/water/init/NetworkTest.java index <HASH>..<HASH> 100644 --- a/h2o-core/src/main/java/water/init/NetworkTest.java +++ b/h2o-core/src/main/java/water/init/NetworkTest.java @@ -177,7 +177,7 @@ public class NetworkTest extends Iced { } String[] colHeaders = new String[msg_sizes.length]; for (int i = 0; i < colHeaders.length; ++i) { - colHeaders[i] = PrettyPrint.bytes(msg_sizes[i]); + colHeaders[i] = msg_sizes[i] + " bytes"; } String[] colTypes = new String[msg_sizes.length]; for (int i = 0; i < colTypes.length; ++i) { @@ -187,7 +187,7 @@ public class NetworkTest extends Iced { for (int i = 0; i < colTypes.length; ++i) { colFormats[i] = "%s"; } - String colHeaderForRowHeaders = "Destination / Message size"; + String colHeaderForRowHeaders = "Destination"; table = new TwoDimTable(tableHeader, tableDescription, rowHeaders, colHeaders, colTypes, colFormats, colHeaderForRowHeaders);
Cosmetic fix for display of TwoDimTable for NetworkTest.
h2oai_h2o-3
train
java
535bb9949a345207fc06b6d70be7392958eb30a5
diff --git a/lib/spork/diagnoser.rb b/lib/spork/diagnoser.rb index <HASH>..<HASH> 100644 --- a/lib/spork/diagnoser.rb +++ b/lib/spork/diagnoser.rb @@ -58,9 +58,12 @@ class Spork::Diagnoser private def filter_callstack(callstack, entry_file = @entry_file) - callstack = callstack.select { |f| ! f.include?('lib/spork/diagnoser.rb')} callstack.pop until callstack.empty? || callstack.last.include?(@entry_file) if @entry_file - callstack + callstack.map do |line| + next if line.include?('lib/spork/diagnoser.rb') + line.gsub!('require_without_diagnoser', 'require') + line + end.compact end def expand_filename(filename)
make diagnoser leave less footprint on the callstack
sporkrb_spork
train
rb
e284b26a2cb367f5fb00f1a7112a4bdf869eb187
diff --git a/lib/api-client/resources/tenant.js b/lib/api-client/resources/tenant.js index <HASH>..<HASH> 100644 --- a/lib/api-client/resources/tenant.js +++ b/lib/api-client/resources/tenant.js @@ -194,4 +194,22 @@ Tenant.delete = function (options, done) { }); }; +Tenant.options = function(options, done) { + var id; + + if (arguments.length === 1) { + done = options; + id = ""; + + } else { + id = typeof options === 'string' ? options : options.id; + if( id === undefined ) { + id = ""; + } + } + + return this.http.options(this.path + '/' + id, { + done: done || noop + }); +} module.exports = Tenant; diff --git a/test/client/resources/tenantSpec.js b/test/client/resources/tenantSpec.js index <HASH>..<HASH> 100644 --- a/test/client/resources/tenantSpec.js +++ b/test/client/resources/tenantSpec.js @@ -53,4 +53,8 @@ describe('The Tenant resource usage', function() { it('has a `delete` method', function() { expect(Tenant.delete).to.be.a('function'); }); + + it('has a `options` method', function() { + expect(Tenant.options).to.be.a('function'); + }); });
feat(api-client): add options request to tenant resource Related to: #CAM-<I>
camunda_camunda-bpm-sdk-js
train
js,js
2adec37515b2fb43f33d4d1580531fe2e13ce81e
diff --git a/lib/knapsack_pro/client/connection.rb b/lib/knapsack_pro/client/connection.rb index <HASH>..<HASH> 100644 --- a/lib/knapsack_pro/client/connection.rb +++ b/lib/knapsack_pro/client/connection.rb @@ -91,7 +91,7 @@ module KnapsackPro @http_response = http.post(uri.path, request_body, json_headers) @response_body = parse_response_body(http_response.body) - request_uuid = http_response.header['X-Request-Id'] + request_uuid = http_response.header['X-Request-Id'] || 'N/A' logger.debug("API request UUID: #{request_uuid}") logger.debug("Test suite split seed: #{seed}") if has_seed?
Show N/A when X-Request-Id header is not available * X-Request-Id is set by Knapsack Pro API rails app * nginx returns <I> when request never touched unicorn due to busy unicorn then X-Request-Id is empty
KnapsackPro_knapsack_pro-ruby
train
rb
a5cac7aee212a4c1855aee76e90c32e21eb85cd9
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -209,7 +209,7 @@ module.exports = function (grunt) { var browsers = { safari: 'Safari', chrome: 'Google Chrome', - firefox: 'Firefox' + firefox: 'firefox' }; // creates browser_tests:{{browser}} tasks, for the browsers listed directly above
changed application name for firefox to match the commandline executible
elastic_elasticsearch-js
train
js
ca0bcacbd08e5deb2cd18575f2b9ac1d2a057661
diff --git a/lib/page-object/widgets.rb b/lib/page-object/widgets.rb index <HASH>..<HASH> 100644 --- a/lib/page-object/widgets.rb +++ b/lib/page-object/widgets.rb @@ -20,15 +20,7 @@ module PageObject define_nested_elements(Elements::Element, widget_tag) define_locators(PageObject, widget_tag) - PageObject::Platforms.constants.each { |platform| - platform_class = constantize_classname("PageObject::Platforms::#{platform}::PageObject") - if platform_class.respond_to?(:define_widget_accessors) - platform_class.send(:define_widget_accessors,widget_tag, widget_class, base_element_tag) - else - $stderr.puts "*** WARNING" - $stderr.puts "*** Platform PageObject::Platforms::#{platform} does not support widgets! Please add the 'define_widget_accessors' method in PageObject::Platforms::#{platform}::PageObject to support widgets." - end - } + PageObject::Platforms::Watir::PageObject.define_widget_accessors(widget_tag, widget_class, base_element_tag) end end
removed dynamic platform creating from Widget
cheezy_page-object
train
rb
2c8afb357ef159822c4fdab722f81a74168912a9
diff --git a/spec/strategy_spec.rb b/spec/strategy_spec.rb index <HASH>..<HASH> 100644 --- a/spec/strategy_spec.rb +++ b/spec/strategy_spec.rb @@ -75,6 +75,29 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do User.count.should == 2 User.find_by_username("newuser").should_not be_nil end + + it "should register new CAS users if we're overriding the cas_create_user? method" do + begin + class << User + def cas_create_user? + true + end + end + + User.count.should == 1 + TestAdapter.register_valid_user("newuser", "newpassword") + Devise.cas_create_user = false + sign_into_cas "newuser", "newpassword" + + current_url.should == root_url + User.count.should == 2 + User.find_by_username("newuser").should_not be_nil + ensure + class << User + remove_method :cas_create_user? + end + end + end it "should fail CAS login if user is unregistered and cas_create_user is false" do User.count.should == 1
Add a test case for cas_create_users? method
nbudin_devise_cas_authenticatable
train
rb
f8b0cadb8803a589ffc01e59ceceb6e0bf362bfc
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -8,7 +8,7 @@ const tap = require('tap'); const rewire = require('rewire'); const sinon = require('sinon'); -const bakery = rewire('./bakery'); +const bakery = rewire('./index'); let TextEncoder; if (typeof window === 'undefined') {
Import the bakery index into the test.
juju_bakeryjs
train
js
a7e1e7fdef33a45ae44e82b16f68de790312678c
diff --git a/src/charts/line.js b/src/charts/line.js index <HASH>..<HASH> 100644 --- a/src/charts/line.js +++ b/src/charts/line.js @@ -192,12 +192,11 @@ function ChartLine(config) { for (var z = 0; z < set.data.length; z++) { ctx.beginPath(); ctx.fillStyle = (set.pointsColor) ? set.pointsColor : 'rgb(75,75,75)'; - if (typeof(set.data[z]) === 'object') ctx.arc(getXPixel(set.data[z][0]), getYPixel(set.data[z][1]), 4, 0, Math.PI * 2, true); else ctx.arc(getXPixel(z), getYPixel(set.data[z]), 4, 0, Math.PI * 2, true); - + ctx.fill(); ctx.closePath(); ctx.beginPath();
Only changed chartline function in origami.js
raphamorim_origami.js
train
js
055ceac0ea628d4e37b7b58b0d5e3b74d690f428
diff --git a/lib/processMultipart.js b/lib/processMultipart.js index <HASH>..<HASH> 100644 --- a/lib/processMultipart.js +++ b/lib/processMultipart.js @@ -59,8 +59,8 @@ module.exports = (options, req, res, next) => { : memHandler(options, field, filename); // Upload into RAM. // Define upload timer. const uploadTimer = new UploadTimer(options.uploadTimeout, () => { - debugLog(options, `Upload timeout ${field}->${filename}, bytes:${getFileSize()}`); - cleanup(); + // After destroy an error event will be emitted and file clean up will be done. + file.destroy(new Error(`Upload timeout ${field}->${filename}, bytes:${getFileSize()}`)); }); file.on('limit', () => { @@ -109,9 +109,8 @@ module.exports = (options, req, res, next) => { }); file.on('error', (err) => { - // Reset upload timer in case of errors. - uploadTimer.clear(); - debugLog(options, `Error ${field}->${filename}, bytes:${getFileSize()}, error:${err}`); + uploadTimer.clear(); // Reset upload timer in case of errors. + debugLog(options, err); cleanup(); next(); });
Destroy file stream in case of upload timeout.
richardgirges_express-fileupload
train
js
ac974ebc00a91b0af6aada84c455bdc826ffd782
diff --git a/fmn/rules/anitya.py b/fmn/rules/anitya.py index <HASH>..<HASH> 100644 --- a/fmn/rules/anitya.py +++ b/fmn/rules/anitya.py @@ -55,7 +55,10 @@ def anitya_specific_distro(config, message, distro=None, *args, **kw): if d.get('name', '').lower() == distro.lower(): return True - d = message['msg'].get('project', {}).get('distro', {}) + d = None + p = message['msg'].get('project', {}) + if p: + d = p.get('distro', {}) if d: # Have to be careful for None here if d.get('name', '').lower() == distro.lower(): return True
Fix processing messages from anitya Messages such as: <URL>` method of course. With this change, we do things in two steps but at least it should work.
fedora-infra_fmn.rules
train
py
0fd5421d1cfa29deedb86cb36379c2617da6d0dc
diff --git a/application/mqttpubsub/backend_test.go b/application/mqttpubsub/backend_test.go index <HASH>..<HASH> 100644 --- a/application/mqttpubsub/backend_test.go +++ b/application/mqttpubsub/backend_test.go @@ -19,7 +19,6 @@ func TestBackend(t *testing.T) { token := c.Connect() token.Wait() So(token.Error(), ShouldBeNil) - defer c.Disconnect(250) Convey("Given a new Backend", func() { backend, err := NewBackend(conf.Server, conf.Username, conf.Password) diff --git a/gateway/mqttpubsub/backend_test.go b/gateway/mqttpubsub/backend_test.go index <HASH>..<HASH> 100644 --- a/gateway/mqttpubsub/backend_test.go +++ b/gateway/mqttpubsub/backend_test.go @@ -19,7 +19,6 @@ func TestBackend(t *testing.T) { token := c.Connect() token.Wait() So(token.Error(), ShouldBeNil) - defer c.Disconnect(250) Convey("Given a new Backend", func() { backend, err := NewBackend(conf.Server, conf.Username, conf.Password)
Do not close the connection now we get a random id.
brocaar_loraserver
train
go,go
18f82f9b70ea24710db1c104814e5da9341bba68
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -1,6 +1,8 @@ import 'es5-shim'; import moment from 'moment'; import momentLocalizer from '../src/lib/localization/momentDateLocalizer'; +import numbro from 'numbro'; +import numbroLocalizer from '../src/lib/localization/numbroNumberLocalizer'; beforeEach(function() { sinon.stub(console, 'warn'); @@ -25,5 +27,6 @@ const testsContext = require.context('.', true, /Spec$/); // set localization momentLocalizer(moment); +numbroLocalizer(numbro); testsContext.keys().forEach(testsContext);
Fixing unit testes (Numbro localizer wasn't working)
redux-autoform_redux-autoform
train
js
d390f8ef3241e0e9e807d350d45aa29d5a49062a
diff --git a/spec/transliteration_spec.rb b/spec/transliteration_spec.rb index <HASH>..<HASH> 100644 --- a/spec/transliteration_spec.rb +++ b/spec/transliteration_spec.rb @@ -9,7 +9,7 @@ module ICU [ ["Any-Hex", "abcde", "\\u0061\\u0062\\u0063\\u0064\\u0065"], ["Lower", "ABC", "abc"], - ["en", "雙屬性集合之空間分群演算法-應用於地理資料", "shuāng shǔ xìng jí hé zhī kōng jiān fēn qún yǎn suàn fǎ-yīng yòng yú de lǐ zī liào"], + ["Han-Latin", "雙屬性集合之空間分群演算法-應用於地理資料", "shuāng shǔ xìng jí hé zhī kōng jiān fēn qún yǎn suàn fǎ-yīng yòng yú de lǐ zī liào"], ["Devanagari-Latin", "दौलत", "daulata"] ].each do |id, input, output| it "should transliterate #{id}" do
fix a broken test in transliteration
fantasticfears_ffi-icu
train
rb
45682d7a0f2f689cf644b54128efa52e4029b10f
diff --git a/mockgen/reflect.go b/mockgen/reflect.go index <HASH>..<HASH> 100644 --- a/mockgen/reflect.go +++ b/mockgen/reflect.go @@ -27,6 +27,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strings" "text/template" "github.com/golang/mock/mockgen/model" @@ -116,7 +117,7 @@ func runInDir(program []byte, dir string) (*model.Package, error) { cmdArgs := []string{} cmdArgs = append(cmdArgs, "build") if *buildFlags != "" { - cmdArgs = append(cmdArgs, *buildFlags) + cmdArgs = append(cmdArgs, strings.Split(*buildFlags, " ")...) } cmdArgs = append(cmdArgs, "-o", progBinary, progSource)
Pass -build_flags as Multiple Args (#<I>) Value of -build_flags was passed to 'go' as a single argument. For example when passing -build_flags "-mod vendor", the invoked commandline was `go -mod\ vendor` and the go command errored out because there is no such arg. That has caused confusion, e.g. in #<I> Solve this by splitting the argument by a space.
golang_mock
train
go
bb08f67cbfa178a8e89ad7f9ec131531f5598d0b
diff --git a/yargy/labels.py b/yargy/labels.py index <HASH>..<HASH> 100644 --- a/yargy/labels.py +++ b/yargy/labels.py @@ -1,5 +1,8 @@ GENDERS = ("masc", "femn", "neut", "Ms-f", "GNdr") +def get_token_features(candidate, case, grammemes): + return ((g in t.grammemes for g in grammemes) for t in (case, candidate)) + def gram_label(token, value, stack): return value in token.grammemes @@ -7,7 +10,7 @@ def gram_not_label(token, value, stack): return not value in token.grammemes def gender_match_label(token, index, stack, genders=GENDERS): - results = ((g in t.grammemes for g in genders) for t in (stack[index], token)) + results = get_token_features(token, stack[index], genders) *case_token_genders, case_token_msf, case_token_gndr = next(results) *candidate_token_genders, candidate_token_msf, candidate_token_gndr = next(results)
Create get_token_features function
natasha_yargy
train
py
8d30d8581601dcd4325b9da0658e5675346b0a6a
diff --git a/src/main/java/org/graylog/plugins/usagestatistics/collectors/ElasticsearchCollector.java b/src/main/java/org/graylog/plugins/usagestatistics/collectors/ElasticsearchCollector.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/graylog/plugins/usagestatistics/collectors/ElasticsearchCollector.java +++ b/src/main/java/org/graylog/plugins/usagestatistics/collectors/ElasticsearchCollector.java @@ -69,6 +69,9 @@ public class ElasticsearchCollector { continue; } + // TODO remove these as soon as the backend service treats HostInfo as optional + // the host info details aren't available in Elasticsearch 2.x anymore, but we still report the empty + // bean because the backend service still expects some data (even if it is empty) final MacAddress macAddress = MacAddress.EMPTY; final HostInfo.Cpu cpu = null; final HostInfo.Memory memory = null;
add TODO for future removal of HostInfo
Graylog2_graylog-plugin-anonymous-usage-statistics
train
java
ec74d2fedaf848359c03796bd991587ed2194a72
diff --git a/lib/iptocountry.js b/lib/iptocountry.js index <HASH>..<HASH> 100644 --- a/lib/iptocountry.js +++ b/lib/iptocountry.js @@ -182,6 +182,8 @@ exports = module.exports = function() { } if(!isAnyIP) { return {error: 'Missing IP address.'}; + } else if(ipListLen > 10) { + return {error: 'Too many IP addresses. (' + ipListLen + '/10)'}; } // Init vars
Add limit for IP addresses (HTTP)
devfacet_iptocountry
train
js
64add90c6b6b70a431628b02aff1b2cf8cff40e1
diff --git a/djlotrek/tests/test_aes.py b/djlotrek/tests/test_aes.py index <HASH>..<HASH> 100644 --- a/djlotrek/tests/test_aes.py +++ b/djlotrek/tests/test_aes.py @@ -31,6 +31,6 @@ class AESTestCase(TestCase): dec = djlotrek.aes.decode(enc) self.assertEqual(dec, 'marco123@gmail.com') - enc = djlotrek.aes.encode('m.marotta@eglab.it') + enc = djlotrek.aes.encode('m.marot@eglab.it') dec = djlotrek.aes.decode(enc) - self.assertEqual(dec, 'm.marotta@eglab.it') + self.assertEqual(dec, 'm.marot@eglab.it')
tests: change aes test in order to cover encoding with no padding
lotrekagency_djlotrek
train
py
fc3a841f37e1162531cd412f42f07aae944aacda
diff --git a/tests/Validator/IPValidatorTest.php b/tests/Validator/IPValidatorTest.php index <HASH>..<HASH> 100755 --- a/tests/Validator/IPValidatorTest.php +++ b/tests/Validator/IPValidatorTest.php @@ -16,8 +16,9 @@ class IPValidatorTest extends PHPUnit_Framework_TestCase /** @test **/ public function it_should_valiodates_host_names() { - $this->assertTrue(IPValidator::validate('130.56.60.128', 'researchdata.ands.org.au')); - $this->assertFalse(IPValidator::validate('103.6.253.17', 'researchdata.ands.org.au')); + + $this->assertFalse(IPValidator::validate('130.56.60.128', 'researchdata.ands.org.au')); + $this->assertTrue(IPValidator::validate('103.6.253.17', 'researchdata.ands.org.au')); $this->assertFalse(IPValidator::validate('hello world!#$%$#%', '130.56.62.129')); }
amended test input of domain name test to avoid false negatives
au-research_ANDS-DOI-Service
train
php
904d8f29c6ed3c1bf12d4f3f6c637dc5f29ef0ac
diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index <HASH>..<HASH> 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -1187,8 +1187,9 @@ shaka.media.StreamingEngine = class { try { const isMP4 = stream.mimeType == 'video/mp4' || stream.mimeType == 'audio/mp4'; + const isReadableStreamSupported = window.ReadableStream; // Enable MP4 low latency streaming with ReadableStream chunked data. - if (this.config_.lowLatencyMode && isMP4) { + if (this.config_.lowLatencyMode && isReadableStreamSupported && isMP4) { let remaining = new Uint8Array(0); const streamDataCallback = async (data) => { await initSourceBuffer; @@ -1224,6 +1225,10 @@ shaka.media.StreamingEngine = class { await this.fetch_(mediaState, reference, streamDataCallback); } else { + if (this.config_.lowLatencyMode && !isReadableStreamSupported) { + shaka.log.warning('Low latency streaming mode is enabled, but ' + + 'ReadableStream is not supported by the browser.'); + } const fetchSegment = this.fetch_(mediaState, reference); const results = await Promise.all([initSourceBuffer, fetchSegment]); this.destroyer_.ensureNotDestroyed();
feat(LL-Dash): Check whether ReadableStream is supported If low latency mode is enabled and ReadableStream is supported by the browser, use the streamDataCallback to handle the chunked data of the ReadableStream. If low latency mode is enabled but ReadableStream is not supported, show a warning message, and fall back to the regular streaming pipeline. Issue #<I> Change-Id: I4ea<I>b<I>d<I>a<I>fb<I>d<I>b2c<I>f
google_shaka-player
train
js