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
e5c158d53c6b6ad48786d3aa4766cb2c238370a5
diff --git a/src/helpers/filter.js b/src/helpers/filter.js index <HASH>..<HASH> 100644 --- a/src/helpers/filter.js +++ b/src/helpers/filter.js @@ -8,9 +8,7 @@ module.exports = function(target, input, filter) { var res = false; - if(input === filter) - res = true; - else if(typeof filter === "boolean") + if(typeof filter === "boolean") res = filter; else if(typeof filter === "function") res = !!filter.call(target, input); diff --git a/src/helpers/index.js b/src/helpers/index.js index <HASH>..<HASH> 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -31,7 +31,7 @@ var helpers = { for(let i = 0; i < functions.length; i++) { let f = functions[i]; - if(typeof f != "function") + if(typeof f !== "function") continue; if(!result)
removed filter matching on input == filter
owejs_owe
train
js,js
13709a0ca455af1766ccbdcb278dc0d540c5dd67
diff --git a/spec/unit/changeset_spec.rb b/spec/unit/changeset_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/changeset_spec.rb +++ b/spec/unit/changeset_spec.rb @@ -39,4 +39,30 @@ RSpec.describe ROM::Changeset do expect(changeset).to_not be_diff end end + + describe 'quacks like a hash' do + subject(:changeset) { ROM::Changeset.new(relation, data) } + + let(:data) { instance_double(Hash) } + + it 'delegates to its data hash' do + expect(data).to receive(:[]).with(:name).and_return('Jane') + + expect(changeset[:name]).to eql('Jane') + end + + it 'maintains its own type' do + expect(data).to receive(:merge).with(foo: 'bar').and_return(foo: 'bar') + + new_changeset = changeset.merge(foo: 'bar') + + expect(new_changeset).to be_instance_of(ROM::Changeset) + expect(new_changeset.options).to eql(changeset.options) + expect(new_changeset.to_h).to eql(foo: 'bar') + end + + it 'raises NoMethodError when an unknown message was sent' do + expect { changeset.not_here }.to raise_error(NoMethodError, /not_here/) + end + end end
Add unit specs for hash-like changeset behaviors
rom-rb_rom
train
rb
974249e637e7fb919c87567f85cc1c4de2bb6a0c
diff --git a/src/TableColumn/Generic.php b/src/TableColumn/Generic.php index <HASH>..<HASH> 100644 --- a/src/TableColumn/Generic.php +++ b/src/TableColumn/Generic.php @@ -137,7 +137,7 @@ class Generic $cb = $this->setHeaderDropdown($menuITems, $icon, $menuId); $cb->onSelectItem(function ($menu, $item) use ($fx) { - return call_user_func($fx, [$item, $menu]); + return call_user_func($fx, $item, $menu); }); }
fix calling callback with wrong param
atk4_ui
train
php
dcd49db540462511c7d8be22504e87bc1f5ef925
diff --git a/jquery.powertip.js b/jquery.powertip.js index <HASH>..<HASH> 100644 --- a/jquery.powertip.js +++ b/jquery.powertip.js @@ -226,6 +226,7 @@ session.activeHover = null; session.isPopOpen = false; session.isFixedPopOpen = false; + tipElement.removeClass(options.placement); // support mouse-follow and fixed position pops at the same // time by moving the popup to the last known cursor location // after it is hidden @@ -355,6 +356,8 @@ break; } + tipElement.addClass(options.placement); + // set the css position tipElement.css('left', Math.round(x) + 'px'); tipElement.css('top', Math.round(y) + 'px');
Added placement class to tooltip element.
stevenbenner_jquery-powertip
train
js
3ad938fc92586d6b4ede28d5c88b5dee9f10e894
diff --git a/packages/bonde-public/pages/mobilization.connected.js b/packages/bonde-public/pages/mobilization.connected.js index <HASH>..<HASH> 100644 --- a/packages/bonde-public/pages/mobilization.connected.js +++ b/packages/bonde-public/pages/mobilization.connected.js @@ -86,9 +86,6 @@ const plugins = [ FinishDefaultMessage: { component: FormTellAFriend, props: { imageUrl, href: getSharedPath(props.mobilization) } - }, - FinishDonationMessage: { - component: FinishPostDonation } }} /> @@ -107,6 +104,9 @@ const plugins = [ component: DonationTellAFriend, props: { imageUrl, href: getSharedPath(props.mobilization) } }, + FinishDonationMessage: { + component: FinishPostDonation + } }} /> )
fix(public): resolve bug FinishDonationMessage
nossas_bonde-client
train
js
53ea1cd4dc4894a2bead6619ffd92ff7dae421c8
diff --git a/pypeout/mongodb.py b/pypeout/mongodb.py index <HASH>..<HASH> 100644 --- a/pypeout/mongodb.py +++ b/pypeout/mongodb.py @@ -111,7 +111,8 @@ class MongoDB(object): e['_id'] = e.pop(self.id_field) if self.updated_field and self.updated_field in e: try: - e['_updated'] = parse_iso8601(e[self.updated_field]) + uf = e[self.updated_field] + e['_updated'] = uf if isinstance(uf, datetime) else parse_iso8601(uf) if self.updated_field != '_updated': e.pop(self.updated_field) # Only if 1st step completes except Exception, ex:
Don't parse updated_field if its already a datettime.
gear11_pypelogs
train
py
5182678852bb060cc1fb258dc252939b9d14b46e
diff --git a/src/AcMailer/Service/MailServiceMock.php b/src/AcMailer/Service/MailServiceMock.php index <HASH>..<HASH> 100644 --- a/src/AcMailer/Service/MailServiceMock.php +++ b/src/AcMailer/Service/MailServiceMock.php @@ -107,5 +107,13 @@ class MailServiceMock implements MailServiceInterface { // Do nothing } + /** + * Returns the list of attachments + * @return array + */ + public function getAttachments() + { + // Do nothing + } }
Fixed missing method implementation in MailServiceMock
acelaya_ZF-AcMailer
train
php
ac87ce24b2849af5fe4c4b6688b7d7aefaa37c88
diff --git a/src/main/java/net/spy/memcached/MemcachedConnection.java b/src/main/java/net/spy/memcached/MemcachedConnection.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/spy/memcached/MemcachedConnection.java +++ b/src/main/java/net/spy/memcached/MemcachedConnection.java @@ -585,6 +585,7 @@ public final class MemcachedConnection extends SpyObject { Operation op = of.newOp(node, latch); op.initialize(); node.addOp(op); + op.setHandlingNode(node); addedQueue.offer(node); } Selector s=selector.wakeup();
Trace handling node in broadcasts, too.
dustin_java-memcached-client
train
java
cf672e01eb20fbbf064140097747c8611b15bce5
diff --git a/lib/outpost/scout.rb b/lib/outpost/scout.rb index <HASH>..<HASH> 100644 --- a/lib/outpost/scout.rb +++ b/lib/outpost/scout.rb @@ -90,7 +90,7 @@ module Outpost # Executes the Scout and go through all the registered expectations to find # out all expectations that match and return the associated status. # - # @return [Symbol] the current status of the Scout (:up, :down) + # @return [Symbol] the current status of the Scout (:up, :down, :warning) # @raise [NotImplementedError] raised when a configured expectation was not # registered in the Scout. def run @@ -100,7 +100,7 @@ module Outpost # value. # Example: {:response_time => 200} # - # status is the status (:up or :down, for example) that will be returned + # status is the status (:up, :down or :warning, for example) that will be returned # in case the expectation match current system status. @config.reports.each do |response_pair, status| response_pair.each do |expectation, value|
Changing comment to include :warning.
vinibaggio_outpost
train
rb
efaab50f20e4b1adfa554223ac93b207e2a548cf
diff --git a/src/diamond/collector.py b/src/diamond/collector.py index <HASH>..<HASH> 100644 --- a/src/diamond/collector.py +++ b/src/diamond/collector.py @@ -103,7 +103,10 @@ class Collector(object): else: path = self.__class__.__name__ - return '.'.join([prefix, hostname, path, name]) + if path == '.' + return '.'.join([prefix, hostname, name]) + else + return '.'.join([prefix, hostname, path, name]) def collect(self): """
Small fix to make metric path more tuneable. Now you can set 'path' in config to '.' and it will be excluded from metric path. This is made for adding non-python scripts. Otherwise they will be all in a subdirectory of the meta-collector (which will execute all scripts from given directory).
python-diamond_Diamond
train
py
574f52966d59634f42ea0b13db6765c684e4d64d
diff --git a/languagetool-core/src/main/java/org/languagetool/UserConfig.java b/languagetool-core/src/main/java/org/languagetool/UserConfig.java index <HASH>..<HASH> 100644 --- a/languagetool-core/src/main/java/org/languagetool/UserConfig.java +++ b/languagetool-core/src/main/java/org/languagetool/UserConfig.java @@ -133,6 +133,7 @@ public class UserConfig { .append(configurableRuleValues, other.configurableRuleValues) .append(userDictName, other.userDictName) .append(userSpecificSpellerWords, other.userSpecificSpellerWords) + // skipping abTest and textSessionId on purpose - not relevant for caching .isEquals(); } @@ -143,6 +144,7 @@ public class UserConfig { .append(maxSpellingSuggestions) .append(userDictName) .append(configurableRuleValues) + // skipping abTest and textSessionId on purpose - not relevant for caching .toHashCode(); }
document that two member vars are ignored on purpose
languagetool-org_languagetool
train
java
e14de715f7ac2709f7fb6f34ad5c88a2687fa49b
diff --git a/src/infi/clickhouse_orm/migrations.py b/src/infi/clickhouse_orm/migrations.py index <HASH>..<HASH> 100644 --- a/src/infi/clickhouse_orm/migrations.py +++ b/src/infi/clickhouse_orm/migrations.py @@ -83,10 +83,12 @@ class AlterTable(ModelOperation): is_regular_field = not (field.materialized or field.alias) if name not in table_fields: logger.info(' Add column %s', name) - assert prev_name, 'Cannot add a column to the beginning of the table' cmd = 'ADD COLUMN %s %s' % (name, field.get_sql(db=database)) if is_regular_field: - cmd += ' AFTER %s' % prev_name + if prev_name is not None: + cmd += ' AFTER %s' % prev_name + else: + cmd += ' FIRST' self._alter_table(database, cmd) if is_regular_field:
Support for adding a column to the beginning of a table
Infinidat_infi.clickhouse_orm
train
py
f22b2c397f87e32e7c914415fb14ecf7c48ba876
diff --git a/lib/y2r/ast/ruby.rb b/lib/y2r/ast/ruby.rb index <HASH>..<HASH> 100644 --- a/lib/y2r/ast/ruby.rb +++ b/lib/y2r/ast/ruby.rb @@ -802,9 +802,11 @@ module Y2R entry_context = context.dup entry_context.max_key_width = max_key_width - end - wrapped_line_list(entries, "{", ",", "}", entry_context) + wrapped_line_list(entries, "{", ",", "}", entry_context) + else + "{}" + end end end diff --git a/spec/y2r/ast/ruby_spec.rb b/spec/y2r/ast/ruby_spec.rb index <HASH>..<HASH> 100644 --- a/spec/y2r/ast/ruby_spec.rb +++ b/spec/y2r/ast/ruby_spec.rb @@ -2886,10 +2886,7 @@ module Y2R::AST::Ruby describe "for multi-line hashes" do it "emits correct code for empty hashes" do - @node_empty.to_ruby(@context_narrow).should == [ - "{", - "}" - ].join("\n") + @node_empty.to_ruby(@context_narrow).should == "{}" end it "emits correct code for hashes with one entry" do
Formatting: Never split an empty hash to multiple lines
yast_y2r
train
rb,rb
ccc3b9dbb4cfe0d830d9a2b4e6fdd01c8f6df10a
diff --git a/lib/Cake/Utility/Sanitize.php b/lib/Cake/Utility/Sanitize.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Utility/Sanitize.php +++ b/lib/Cake/Utility/Sanitize.php @@ -141,7 +141,7 @@ class Sanitize { * Strips scripts and stylesheets from output * * @param string $str String to sanitize - * @return string String with <script>, <style>, <link> elements removed. + * @return string String with <script>, <style>, <link>, <img> elements removed. */ public static function stripScripts($str) { return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/is', '', $str);
Updating docblock for Sanitize::stripScripts()
cakephp_cakephp
train
php
6c5285b32e2c1d8d03fd41f4f0eb31bcd74db3e1
diff --git a/dpxdt/tools/url_pair_diff.py b/dpxdt/tools/url_pair_diff.py index <HASH>..<HASH> 100755 --- a/dpxdt/tools/url_pair_diff.py +++ b/dpxdt/tools/url_pair_diff.py @@ -86,7 +86,7 @@ class UrlPairDiff(workers.WorkflowItem): upload_build_id, upload_release_name, release_number, - url_parts.path, + url_parts.path or '/', new_url, config_data, ref_url=baseline_url,
Fix bug in url_pair_diff when there is no relative path
bslatkin_dpxdt
train
py
17a564bd9e84d0e934a325e7293574fff8b07a3a
diff --git a/huey/serializer.py b/huey/serializer.py index <HASH>..<HASH> 100644 --- a/huey/serializer.py +++ b/huey/serializer.py @@ -21,14 +21,19 @@ if gzip is not None: def gzip_compress(data, comp_level): buf = BytesIO() - with gzip.open(buf, 'wb', comp_level) as fh: - fh.write(data) + fh = gzip.GzipFile(fileobj=buf, mode='wb', + compresslevel=comp_level) + fh.write(data) + fh.close() return buf.getvalue() def gzip_decompress(data): buf = BytesIO(data) - with gzip.open(buf, 'rb') as fh: + fh = gzip.GzipFile(fileobj=buf, mode='rb') + try: return fh.read() + finally: + fh.close() class Serializer(object):
Ouch, finally get gzip unfucked with Python 2.
coleifer_huey
train
py
2673e63f94f80bcab14df95c2cf76e6d4ca4b435
diff --git a/src/main/java/com/couchbase/lite/BlobStoreWriter.java b/src/main/java/com/couchbase/lite/BlobStoreWriter.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/couchbase/lite/BlobStoreWriter.java +++ b/src/main/java/com/couchbase/lite/BlobStoreWriter.java @@ -79,11 +79,13 @@ public class BlobStoreWriter { void read(InputStream inputStream) { byte[] buffer = new byte[1024]; int len; + length = 0; try { while ((len = inputStream.read(buffer)) != -1) { outStream.write(buffer, 0, len); sha1Digest.update(buffer); md5Digest.update(buffer); + length += len; } } catch (IOException e) { throw new RuntimeException("Unable to read from stream.", e);
testAttachments() was failing on assertEquals(content.getBytes().length, attach.getLength());
couchbase_couchbase-lite-java-core
train
java
6be834df318786de922642653fb05aa96dc8b217
diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js index <HASH>..<HASH> 100644 --- a/cordova-js-src/platform.js +++ b/cordova-js-src/platform.js @@ -24,6 +24,26 @@ module.exports = { cordovaVersion: '4.2.0', // cordova-js bootstrap: function() { + + var cache = navigator.serviceWorker.register; + var cacheCalled = false; + navigator.serviceWorker.register = function() { + cacheCalled = true; + navigator.serviceWorker.register = cache; + return cache.apply(navigator.serviceWorker,arguments); + } + + document.addEventListener('deviceready',function(){ + if(!cacheCalled) { + navigator.serviceWorker.register('/cordova-sw.js').then(function(registration) { + // Registration was successful + console.log('ServiceWorker registration successful with scope: ', registration.scope); + }, function(err) { + // registration failed :( + console.log('ServiceWorker registration failed: ', err); + }); + } + }); var modulemapper = require('cordova/modulemapper'); var channel = require('cordova/channel');
Register service worker if no one else does
apache_cordova-browser
train
js
868340369054c94163f4a0cd1e62b99761b900c7
diff --git a/Classes/Eel/ElasticSearchQueryBuilder.php b/Classes/Eel/ElasticSearchQueryBuilder.php index <HASH>..<HASH> 100644 --- a/Classes/Eel/ElasticSearchQueryBuilder.php +++ b/Classes/Eel/ElasticSearchQueryBuilder.php @@ -542,7 +542,7 @@ class ElasticSearchQueryBuilder implements QueryBuilderInterface, ProtectedConte /** * @return int */ - public function getLimit(): inte + public function getLimit(): int { return $this->limit; }
BUGFIX: Fix wrong return type
Flowpack_Flowpack.ElasticSearch.ContentRepositoryAdaptor
train
php
97909d76075cbbcb7cb0b40b9e92046ae073acae
diff --git a/ontquery/__init__.py b/ontquery/__init__.py index <HASH>..<HASH> 100644 --- a/ontquery/__init__.py +++ b/ontquery/__init__.py @@ -121,7 +121,10 @@ class OntId(text_type): # TODO all terms singletons to prevent nastyness prefix, suffix = curie_ci.split(':') else: curie_ci = curie_or_iri - prefix, suffix = curie_ci.split(':') + try: + prefix, suffix = curie_ci.split(':') + except ValueError as e: + raise ValueError(f'Could not split cuire {curie_ci!r} is it actually an identifier?') from e iri_ci = cls._make_iri(prefix, suffix) if curie is not None: @@ -373,8 +376,10 @@ class OntQuery: for result in out: print(repr(result.asTerm()), '\n') raise ValueError(f'Query {kwargs} returned more than one result. Please review.') - else: + elif len(out) == 1: return out[0] + else: + raise ValueError(f'Query {kwargs} returned no results. Please change your query.') class OntService:
fail loudly and clearly on no results and cant split curie Accidentially passing the search term as a cuire_or_iri is a common problem with using OntTerm to do your queries. Not sure what will ultimately be preferred. I like the terms failing as an error, maybe we can do that with queries somehow to allow copying and pasting?
tgbugs_ontquery
train
py
d86a8ff4634efeffed04985fb6f59348b23f8965
diff --git a/lib/flor/core/executor.rb b/lib/flor/core/executor.rb index <HASH>..<HASH> 100644 --- a/lib/flor/core/executor.rb +++ b/lib/flor/core/executor.rb @@ -333,6 +333,7 @@ module Flor begin message['m'] = counter_next('msgs') # number messages + message['pr'] = counter('runs') # "processing run" determine_heat(message) @@ -346,7 +347,7 @@ module Flor ms += @unit.notify(self, message) # post - ms + ms.each { |m| m['er'] = counter('runs') } # "emitting run" rescue => e error_reply(nil, message, e)
Flag each message with "pr" and "er" * "pr" is "processing run", what run did process the message * "er" is "emitting run", what run did emit the message Run counter starts at 1.
floraison_flor
train
rb
5b13ca7c0af5f41ebe99e983692e7ab90a64bb87
diff --git a/ipaddr.go b/ipaddr.go index <HASH>..<HASH> 100644 --- a/ipaddr.go +++ b/ipaddr.go @@ -38,6 +38,10 @@ type IPAddr interface { // IPPort is the type for an IP port number for the TCP and UDP IP transports. type IPPort uint16 +// IPPrefixLen is a typed integer representing the prefix length for a given +// IPAddr. +type IPPrefixLen byte + // NewIPAddr creates a new IPAddr from a string. Returns nil if the string is // not an IPv4 or an IPv6 address. func NewIPAddr(addr string) (IPAddr, error) { diff --git a/ipv6addr.go b/ipv6addr.go index <HASH>..<HASH> 100644 --- a/ipv6addr.go +++ b/ipv6addr.go @@ -15,12 +15,10 @@ type ( // IPv6Mask is a named type representing an IPv6 network mask. IPv6Mask *big.Int - - IPv6PrefixLen uint16 ) // IPv6HostPrefix is a constant represents a /128 IPv6 Prefix. -const IPv6HostPrefix = IPv6PrefixLen(128) +const IPv6HostPrefix = IPPrefixLen(128) // ipv6HostMask is an unexported big.Int representing a /128 IPv6 address. // This value must be a constant and always set to all ones.
Deorbit IPv6PrefixLen in favor of IPPrefixLen, which could be used for IPv4.
hashicorp_go-sockaddr
train
go,go
85edee26f369c6d5b1ac1a99f1bd4b3ff5fa9a41
diff --git a/lib/accesslib.php b/lib/accesslib.php index <HASH>..<HASH> 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4525,7 +4525,7 @@ function get_users_by_capability($context, $capability, $fields='', $sort='', $sortby = $sort ? " ORDER BY $sort " : ''; // User lastaccess JOIN - if (strpos($sort, 'ul.timeaccess') === FALSE) { // user_lastaccess is not required MDL-13810 + if ((strpos($sort, 'ul.timeaccess') === FALSE) and (strpos($fields, 'ul.timeaccess') === FALSE)) { // user_lastaccess is not required MDL-13810 $uljoin = ''; } else { $uljoin = "LEFT OUTER JOIN {$CFG->prefix}user_lastaccess ul
MDL-<I> Merged from <I>
moodle_moodle
train
php
43e10c4f950f7b939d7b4b7989d3bf8c341ab45b
diff --git a/json-references.js b/json-references.js index <HASH>..<HASH> 100644 --- a/json-references.js +++ b/json-references.js @@ -78,7 +78,7 @@ var makePath = function (path) { } else { //Separation between consecutive strings - str += (index>0 && isNaN(steps[index-1]) ? '.' : '') + steps[index]; + str += '.' + JSON.parse(steps[index]); } } } diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -149,8 +149,8 @@ describe('Verify correct order of references from BFS algorithm.', function () { if(original.hasOwnProperty(index)) { original[index]['friend'] = original[index]['friends'][2]; correctAnswer[index]['friend'] = correctAnswer[index]['friends'][2]; - correctAnswer[index]['friends'][2] = "$["+index+"]\"friend\""; - wrongAnswer[index]['friend'] = "$["+index+"]\"friends\"[2]"; //space extra + correctAnswer[index]['friends'][2] = "$["+index+"].friend"; + wrongAnswer[index]['friend'] = "$["+index+"].friends[2]"; //space extra } }
Now strings in path are beautiful (using JSON.parse), without unnecessary quotes. Tests updated accordingly
Keenpoint_smart-circular
train
js,js
8e0cc7ede2e5988f420c839a43971571405f99d7
diff --git a/pkg/printers/internalversion/printers_test.go b/pkg/printers/internalversion/printers_test.go index <HASH>..<HASH> 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -2605,6 +2605,7 @@ func TestPrintService(t *testing.T) { func TestPrintPodDisruptionBudget(t *testing.T) { minAvailable := intstr.FromInt(22) + maxUnavailable := intstr.FromInt(11) tests := []struct { pdb policy.PodDisruptionBudget expect string @@ -2624,6 +2625,22 @@ func TestPrintPodDisruptionBudget(t *testing.T) { }, }, "pdb1\t22\tN/A\t5\t0s\n", + }, + { + policy.PodDisruptionBudget{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns2", + Name: "pdb2", + CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, + }, + Spec: policy.PodDisruptionBudgetSpec{ + MaxUnavailable: &maxUnavailable, + }, + Status: policy.PodDisruptionBudgetStatus{ + PodDisruptionsAllowed: 5, + }, + }, + "pdb2\tN/A\t11\t5\t0s\n", }} buf := bytes.NewBuffer([]byte{})
add test case for pdb printer
kubernetes_kubernetes
train
go
f9773aa988330b438be548419413b6774279da20
diff --git a/src/Whoops/Run.php b/src/Whoops/Run.php index <HASH>..<HASH> 100644 --- a/src/Whoops/Run.php +++ b/src/Whoops/Run.php @@ -304,11 +304,11 @@ final class Run implements RunInterface // or return it silently. $this->system->startOutputBuffering(); - try { - // Just in case there are no handlers: - $handlerResponse = null; - $handlerContentType = null; + // Just in case there are no handlers: + $handlerResponse = null; + $handlerContentType = null; + try { foreach ($this->handlerQueue as $handler) { $handler->setRun($this); $handler->setInspector($inspector);
updated function handleException() moved assignments outside of try/catch (#3)
filp_whoops
train
php
ae3f4f2e0ae5e88dab8c9f6dc2521a45121f9a2a
diff --git a/tcp_transport.go b/tcp_transport.go index <HASH>..<HASH> 100644 --- a/tcp_transport.go +++ b/tcp_transport.go @@ -81,7 +81,7 @@ func newTCPTransport(bindAddr string, list.Close() return nil, errNotTCP } - if addr.IP.IsUnspecified() { + if addr.IP == nil || addr.IP.IsUnspecified() { list.Close() return nil, errNotAdvertisable } diff --git a/tcp_transport_test.go b/tcp_transport_test.go index <HASH>..<HASH> 100644 --- a/tcp_transport_test.go +++ b/tcp_transport_test.go @@ -12,6 +12,13 @@ func TestTCPTransport_BadAddr(t *testing.T) { } } +func TestTCPTransport_EmptyAddr(t *testing.T) { + _, err := NewTCPTransportWithLogger(":0", nil, 1, 0, newTestLogger(t)) + if err != errNotAdvertisable { + t.Fatalf("err: %v", err) + } +} + func TestTCPTransport_WithAdvertise(t *testing.T) { addr := &net.TCPAddr{IP: []byte{127, 0, 0, 1}, Port: 12345} trans, err := NewTCPTransportWithLogger("0.0.0.0:0", addr, 1, 0, newTestLogger(t))
Fail starting a tcp_transport with no ip (#<I>)
hashicorp_raft
train
go,go
f2f90989f806e1f2e69ad211510fc1dd22879495
diff --git a/demo/app.js b/demo/app.js index <HASH>..<HASH> 100644 --- a/demo/app.js +++ b/demo/app.js @@ -731,7 +731,7 @@ const Demo = React.createClass({ > <div style={{ padding: 20 }}> <p style={{ fontFamily: 'Helvetica, Arial, sans-serif', textAlign: 'center' }}>I am a modal!</p> - <img src='http://www.mx.com/images/home/top-t-i.png' style={[{ maxWidth: '100%', height: 'auto', margin: 'auto' }, this.state.showSmallModal && { width: 400 }]} /> + <img src='https://unsplash.it/1000/600?random' style={[{ maxWidth: '100%', height: 'auto', margin: 'auto' }, this.state.showSmallModal && { width: 400 }]} /> </div> </Modal> ) : null}
Update demo to use random photo from Unsplash.it
mxenabled_mx-react-components
train
js
3d2d8c986fad80f67b9f8347eb1519389644bbe7
diff --git a/tests/integration/scheduler/test_eval.py b/tests/integration/scheduler/test_eval.py index <HASH>..<HASH> 100644 --- a/tests/integration/scheduler/test_eval.py +++ b/tests/integration/scheduler/test_eval.py @@ -52,7 +52,7 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin): self.schedule = salt.utils.schedule.Schedule(copy.deepcopy(DEFAULT_CONFIG), functions, returners={}) self.schedule.opts['loop_interval'] = 1 - self.schedule.opts['grains']['whens'] = {'tea time': '11/29/2017 12;00pm'} + self.schedule.opts['grains']['whens'] = {'tea time': '11/29/2017 12:00pm'} def test_eval(self): '''
Typo in the whens in grains
saltstack_salt
train
py
ae7401397999f5967203ba3aec1ac24ac76fb1f8
diff --git a/src/game/market.js b/src/game/market.js index <HASH>..<HASH> 100644 --- a/src/game/market.js +++ b/src/game/market.js @@ -39,10 +39,11 @@ exports.make = function(runtimeData, intents, register) { }), getOrderById: register.wrapFn(function(id) { - if(!runtimeData.market.orders.all[id]) { + const order = runtimeData.market.orders.all[id] || this.orders[id]; + if(!order) { return null; } - var result = JSON.parse(JSON.stringify(runtimeData.market.orders.all[id])); + const result = JSON.parse(JSON.stringify(order)); result.price /= 1000; return result; }),
hotfix(runtime): method getOrderById for inactive orders DEV-<I>
screeps_engine
train
js
dd9f4e95f6acff25d90279b1949b0b96ea586a63
diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py index <HASH>..<HASH> 100644 --- a/master/buildbot/process/build.py +++ b/master/buildbot/process/build.py @@ -376,7 +376,7 @@ class Build(properties.PropertiesMixin): owners = [r.properties['owner'] for r in self.requests if "owner" in r.properties] if owners: - self.setProperty('owners', owners, self.reason) + self.setProperty('owners', owners, 'Build') self.text = [] # list of text string lists (text2) def _addBuildSteps(self, step_factories):
Use 'Build' as property source for owners
buildbot_buildbot
train
py
83dc288365820dae806de4bf630bd40c960446bd
diff --git a/src/command/Menus.js b/src/command/Menus.js index <HASH>..<HASH> 100644 --- a/src/command/Menus.js +++ b/src/command/Menus.js @@ -299,6 +299,7 @@ define(function (require, exports, module) { * * @param {?string} relativeID - id of command (future: also sub-menu, or menu section). * @param {?string} position - only needed when relativeID is a MenuSection + * @param {HTMLIElement} */ Menu.prototype._getRelativeMenuItem = function (relativeID, position) { var $relativeElement, @@ -320,6 +321,12 @@ define(function (require, exports, module) { return $relativeElement; }; + /** + * Returns a menuItem and a relative position for the menuSection/position requested + * @param {{menuSection: String}} + * @param {String} position constant + * @returns {{relativeElement: HTMLIElement, position: String}} + */ Menu.prototype._getMenuSectionPosition = function (menuSection, position) { var $relativeElement; var $sectionMarker = this._getMenuItemForCommand(CommandManager.get(menuSection.sectionMarker)); @@ -978,8 +985,6 @@ define(function (require, exports, module) { }); } - - // Define public API exports.init = init; exports.AppMenuBar = AppMenuBar;
Adding function comment blocks to Menus.js
adobe_brackets
train
js
f57133174a67e588a11458b5ef666589a570eeeb
diff --git a/src/component/toolbox/feature/DataZoom.js b/src/component/toolbox/feature/DataZoom.js index <HASH>..<HASH> 100644 --- a/src/component/toolbox/feature/DataZoom.js +++ b/src/component/toolbox/feature/DataZoom.js @@ -240,30 +240,12 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) { zoomActive ? { brushType: 'auto', - brushStyle: mapBrushStyle(featureModel.option.brushStyle) + brushStyle: featureModel.getModel('brushStyle').getItemStyle() } : false ); } -function mapBrushStyle(brushStyle) { - var properties = [ - ['fill', 'color'], - ['lineWidth', 'borderWidth'], - ['stroke', 'borderColor'], - ['opacity', 'opacity'] - ]; - var style = {}; - for (var i = 0; i < properties.length; i++) { - var propName = properties[i][1]; - var val = brushStyle[propName]; - if (val != null) { - style[properties[i][0]] = val; - } - } - return style; -} - featureManager.register('dataZoom', DataZoom);
fix(dataZoom): use itemStyle mixin to map style properties.
apache_incubator-echarts
train
js
f70564778e88ff28b6a69b683df2c0b3b89d1d9c
diff --git a/osmnx/pois.py b/osmnx/pois.py index <HASH>..<HASH> 100644 --- a/osmnx/pois.py +++ b/osmnx/pois.py @@ -412,7 +412,7 @@ def pois_from_point(point, distance=None, amenities=None): return create_poi_gdf(amenities=amenities, north=north, south=south, east=east, west=west) -def pois_from_address(address, distance, amenities=None): +def pois_from_address(address, distance, amenities=None, custom_settings=None): """ Get OSM points of Interests within some distance north, south, east, and west of an address. @@ -426,6 +426,9 @@ def pois_from_address(address, distance, amenities=None): amenities : list List of amenities that will be used for finding the POIs from the selected area. See available amenities from: http://wiki.openstreetmap.org/wiki/Key:amenity + custom_settings : string + custom settings to be used in the overpass query instead of the default + ones Returns ------- @@ -436,7 +439,7 @@ def pois_from_address(address, distance, amenities=None): point = geocode(query=address) # get POIs within distance of this point - return pois_from_point(point=point, amenities=amenities, distance=distance) + return pois_from_point(point=point, amenities=amenities, distance=distance, custom_settings=custom_settings) def pois_from_polygon(polygon, amenities=None, custom_settings=None):
pois_from_address now passes custom_settings.
gboeing_osmnx
train
py
cb31c074ac28cd0ae4ca9b2be1721541ccfbaeda
diff --git a/psamm/tests/test_command.py b/psamm/tests/test_command.py index <HASH>..<HASH> 100644 --- a/psamm/tests/test_command.py +++ b/psamm/tests/test_command.py @@ -78,6 +78,16 @@ class TestCommandMain(unittest.TestCase): def tearDown(self): shutil.rmtree(self._model_dir) + def test_invoke_version(self): + _stdout = sys.stdout + try: + sys.stdout = StringIO() + with self.assertRaises(SystemExit) as context: + main(args=['--version']) + self.assertEqual(context.exception.code, 0) + finally: + sys.stdout = _stdout + def test_command_main(self): main(MockCommand, args=[ '--model', self._model_dir, '--test-argument'])
command: Test that main can be invoked with --version
zhanglab_psamm
train
py
1ee5c588d85a5dae9d10e75e7a0f51f8404fea80
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ setup( author_email='[email protected]', url='https://github.com/F5Networks/f5-common-python', keywords=['F5', 'sdk', 'api', 'icontrol', 'bigip', 'api', 'ltm'], - install_requires=['f5-icontrol-rest == 1.1.0'], + install_requires=['f5-icontrol-rest == 1.1.0', 'six'], packages=find_packages( exclude=["*.test", "*.test.*", "test.*", "test_*", "test", "test*"] ),
Python six module required in setup.py Issues: Fixes #<I> Problem: Recently, we began using the 'six' module in the sdk, but we did not update setup.py with six as a required module. This is a critical install failure. Analysis: Added six in setup.py Tests: Pip installed and ensured latest six version was installed
F5Networks_f5-common-python
train
py
cc3bd6a9991408ae71b28e323dbb43759656f3db
diff --git a/lib/tabula/entities/table.rb b/lib/tabula/entities/table.rb index <HASH>..<HASH> 100644 --- a/lib/tabula/entities/table.rb +++ b/lib/tabula/entities/table.rb @@ -23,7 +23,7 @@ module Tabula max = lines.map{|l| l.text_elements.size}.max lines.each do |line| needed = max - line.text_elements.size - needed.times do + needed.times do line.text_elements << TextElement.new(nil, nil, nil, nil, nil, nil, '', nil) end end @@ -39,7 +39,7 @@ module Tabula l.text_elements.map! do |te| te || TextElement.new(nil, nil, nil, nil, nil, nil, '', nil) end - end.sort_by { |l| l.map { |te| te.top || 0 }.max } + end.sort_by { |l| l.map { |te| te.top || 0 }.max } end # create a new Table object from an array of arrays, representing a list of rows in a spreadsheet @@ -89,6 +89,7 @@ module Tabula { 'json_class' => self.class.name, 'extraction_method' => @extraction_method, + 'vertical_separators' => @separators, 'data' => rows, }.to_json(*a) end
include separators in Table#to_json
tabulapdf_tabula-extractor
train
rb
d24be507bfcb10fe87bb5bb1e8354b8bc229d62c
diff --git a/lenstronomy/ImSim/MultiBand/single_band_multi_model.py b/lenstronomy/ImSim/MultiBand/single_band_multi_model.py index <HASH>..<HASH> 100644 --- a/lenstronomy/ImSim/MultiBand/single_band_multi_model.py +++ b/lenstronomy/ImSim/MultiBand/single_band_multi_model.py @@ -162,7 +162,7 @@ class SingleBandMultiModel(ImageLinearFit): kwargs_ps_i = kwargs_ps else: kwargs_ps_i = [kwargs_ps[k] for k in self._index_point_source] - if self._index_optical_depth is None: + if self._index_optical_depth is None or kwargs_extinction is None: kwargs_extinction_i = kwargs_extinction else: kwargs_extinction_i = [kwargs_extinction[k] for k in self._index_optical_depth]
select_kwargs with option of kwargs_extinction to be None
sibirrer_lenstronomy
train
py
d52e293eb527360be4964eb81a36ef78365e4670
diff --git a/lib/core/plugin/node.rb b/lib/core/plugin/node.rb index <HASH>..<HASH> 100644 --- a/lib/core/plugin/node.rb +++ b/lib/core/plugin/node.rb @@ -20,16 +20,7 @@ class Node < CORL.plugin_class(:base) ui.resource = hostname logger = hostname - # TODO: A better way to do this - unless groups.include?(plugin_name) - myself[:groups] = [ plugin_name, groups ].flatten - end - unless groups.include?(plugin_provider) - myself[:groups] = [ plugin_provider, groups ].flatten - end - unless groups.include?("all") - myself[:groups] = [ "all", groups ].flatten - end + myself[:groups] = groups.ary([ "all", plugin_provider, plugin_name ]) unless reload @cli_interface = Util::Liquid.new do |method, args, &code|
Reworking node group initialization in the base node plugin class.
coralnexus_corl
train
rb
5bbfba5f4523e175de1860d465ec4599de8cacea
diff --git a/src/Services/Schematic.php b/src/Services/Schematic.php index <HASH>..<HASH> 100644 --- a/src/Services/Schematic.php +++ b/src/Services/Schematic.php @@ -100,6 +100,7 @@ class Schematic extends BaseApplication $sectionImportResult = Craft::app()->schematic_sections->import($model->getAttribute('sections'), $force); $userGroupImportResult = Craft::app()->schematic_userGroups->import($model->getAttribute('userGroups'), $force); $userImportResult = Craft::app()->schematic_users->import($model->getAttribute('users'), true); + $fieldImportResultFinal = Craft::app()->schematic_fields->import($model->getAttribute('fields'), $force); // Element index settings are supported from Craft 2.5 if (version_compare(CRAFT_VERSION, '2.5', '>=')) { @@ -116,6 +117,7 @@ class Schematic extends BaseApplication $result->consume($sectionImportResult); $result->consume($userGroupImportResult); $result->consume($userImportResult); + $result->consume($fieldImportResultFinal); // Element index settings are supported from Craft 2.5 if (version_compare(CRAFT_VERSION, '2.5', '>=')) {
Repeat field import after everything else has been imported so full double imports are no longer needed
nerds-and-company_schematic
train
php
96fc09fcbf7716a173fbd88cec3cde6e602b260c
diff --git a/DependencyInjection/Source/KeyManagement/JWKSource/Secret.php b/DependencyInjection/Source/KeyManagement/JWKSource/Secret.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Source/KeyManagement/JWKSource/Secret.php +++ b/DependencyInjection/Source/KeyManagement/JWKSource/Secret.php @@ -5,7 +5,7 @@ declare(strict_types=1); /* * The MIT License (MIT) * - * Copyright (c) 2014-2017 Spomky-Labs + * Copyright (c) 2014-2018 Spomky-Labs * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details.
Apply fixes from StyleCI (#<I>) [ci skip] [skip ci]
web-token_jwt-bundle
train
php
142ee01e8afb3fea5e5174cf53c0ac63a9d6f6c7
diff --git a/lib/kafka/broker_pool.rb b/lib/kafka/broker_pool.rb index <HASH>..<HASH> 100644 --- a/lib/kafka/broker_pool.rb +++ b/lib/kafka/broker_pool.rb @@ -18,6 +18,10 @@ module Kafka # @param connect_timeout [Integer, nil] see {Connection#initialize}. # @param socket_timeout [Integer, nil] see {Connection#initialize}. def initialize(seed_brokers:, client_id:, logger:, connect_timeout: nil, socket_timeout: nil) + if seed_brokers.empty? + raise ArgumentError, "At least one seed broker must be configured" + end + @client_id = client_id @logger = logger @connect_timeout = connect_timeout
Raise an exception if no seed brokers are configured
zendesk_ruby-kafka
train
rb
f1559ed36bee30d0e2334974f1d1e02281251c88
diff --git a/src/BackupDestination/BackupDestination.php b/src/BackupDestination/BackupDestination.php index <HASH>..<HASH> 100644 --- a/src/BackupDestination/BackupDestination.php +++ b/src/BackupDestination/BackupDestination.php @@ -137,7 +137,7 @@ class BackupDestination } try { - $this->disk->allFiles($this->backupName); + $this->disk->files($this->backupName); return true; } catch (Exception $exception) {
Use non-recursive files() method to test if destination is reachable
spatie_laravel-backup
train
php
637b1f4c37fbe4f4614b6f23c6972e2ecb0cc643
diff --git a/lib/spreedly/connection.rb b/lib/spreedly/connection.rb index <HASH>..<HASH> 100644 --- a/lib/spreedly/connection.rb +++ b/lib/spreedly/connection.rb @@ -30,13 +30,20 @@ module Spreedly private def http http = Net::HTTP.new(endpoint.host, endpoint.port) + configure_ssl(http) http.open_timeout = 64 http.read_timeout = 64 + http + end + + def configure_ssl(http) + return unless endpoint.scheme == "https" + http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.ca_file = File.dirname(__FILE__) + '/../certs/cacert.pem' - http end + end class OptionsWithResponseBody < Net::HTTPRequest diff --git a/lib/spreedly/version.rb b/lib/spreedly/version.rb index <HASH>..<HASH> 100644 --- a/lib/spreedly/version.rb +++ b/lib/spreedly/version.rb @@ -1,3 +1,3 @@ module Spreedly - VERSION = "2.0.8" + VERSION = "2.0.9" end
Only use ssl if the base url is https
spreedly_spreedly-gem
train
rb,rb
145a1d2000df8bb93106e07558edf79f1f63be8d
diff --git a/orca/server/static/gulpfile.js b/orca/server/static/gulpfile.js index <HASH>..<HASH> 100644 --- a/orca/server/static/gulpfile.js +++ b/orca/server/static/gulpfile.js @@ -17,7 +17,7 @@ var config = { // Mostly copied from: // http://tylermcginnis.com/reactjs-tutorial-pt-2-building-react-applications-with-gulp-and-browserify/ // https://github.com/gulpjs/gulp/blob/master/docs/recipes/fast-browserify-builds-with-watchify.md -gulp.task('js', function() { +gulp.task('js-watch', function() { var bfy_opts = { entries: [config.main], transform: [reactify], @@ -39,4 +39,16 @@ gulp.task('js', function() { return bundle(); }); -gulp.task('default', ['js']); +gulp.task('js-build', function () { + var bfy_opts = { + entries: [config.main], + transform: [reactify] + }; + return browserify(bfy_opts) + .bundle() + .on('error', gutil.log.bind(gutil, 'Browserify Error')) + .pipe(source(config.out)) + .pipe(gulp.dest(config.dest)); +}); + +gulp.task('default', ['js-watch']);
add command for building js bundle
UDST_orca
train
js
39eb2c55b760b040cbb119943c00f4397261a0fe
diff --git a/app/Library/Utilities/PitonInstall.php b/app/Library/Utilities/PitonInstall.php index <HASH>..<HASH> 100644 --- a/app/Library/Utilities/PitonInstall.php +++ b/app/Library/Utilities/PitonInstall.php @@ -22,8 +22,8 @@ class PitonInstall */ protected static function getProjectDir() { - // This class if 5 levels deep - return basename(dirname(__DIR__, 5)); + // This class if 6 levels deep from project root + return basename(dirname(__DIR__, 6)); } /**
Changed dirname levels in getProjectDir(), was too low.
PitonCMS_Engine
train
php
518d149646c13fb49c296a63e61a048f5e672179
diff --git a/commands/commandeer.go b/commands/commandeer.go index <HASH>..<HASH> 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -179,7 +179,7 @@ func newCommandeer(mustHaveConfigFile, running bool, h *hugoBuilderCommon, f fla debounce: rebuildDebouncer, fullRebuildSem: semaphore.NewWeighted(1), // This will be replaced later, but we need something to log to before the configuration is read. - logger: loggers.NewLogger(jww.LevelError, jww.LevelError, out, ioutil.Discard, running), + logger: loggers.NewLogger(jww.LevelWarn, jww.LevelError, out, ioutil.Discard, running), } return c, c.loadConfig(mustHaveConfigFile, running)
commands: Use WARN log level also for the early initialization Fixes #<I>
gohugoio_hugo
train
go
3f139c8863532a3922faf6c584d260f4a509ae1f
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -9,10 +9,7 @@ global.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR = null; global.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = null; global.WEB_SOCKET_SWF_LOCATION = null; -// node only tests -if (env.node) { - require('./url'); -} +require('./url'); // browser only tests if (env.browser) { diff --git a/test/url.js b/test/url.js index <HASH>..<HASH> 100644 --- a/test/url.js +++ b/test/url.js @@ -1,5 +1,4 @@ -var old = global.location = { protocol: 'http:', hostname: 'localhost'}; var loc = {}; var url = require('../lib/url'); var expect = require('expect.js'); @@ -43,7 +42,7 @@ describe('url', function(){ loc.protocol = 'http:'; loc.hostname = 'woot.com'; - expect(url('/woot').path).to.be('/woot'); + expect(url('/woot', loc).path).to.be('/woot'); expect(url('http://google.com').path).to.be('/'); expect(url('http://google.com/').path).to.be('/'); });
test: make url tests run on the browser
tsjing_socket.io-client
train
js,js
6f1ef1c66974170cd848465c551263a65acd71b0
diff --git a/lib/salt/page.rb b/lib/salt/page.rb index <HASH>..<HASH> 100644 --- a/lib/salt/page.rb +++ b/lib/salt/page.rb @@ -3,12 +3,13 @@ module Salt include Frontable include Renderable - attr_accessor :path, :filename, :extension + attr_accessor :path, :filename, :extension, :layout attr_writer :contents def initialize(path = nil) @path = path @extension = 'html' + @layout = nil if path @contents = read_with_yaml(path)
Added a layout accessor, with a nil default.
waferbaby_dimples
train
rb
93de2f341b9263398a0d8f43c8fffd35c6e62b19
diff --git a/tofu/version.py b/tofu/version.py index <HASH>..<HASH> 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.9-135-g11043340' +__version__ = '1.4.10-alpha1'
[#<I>] with the tagged version number
ToFuProject_tofu
train
py
8915bc1d37f1b83fc9bbd3cfef337bd5f75e4779
diff --git a/src/client/Client.js b/src/client/Client.js index <HASH>..<HASH> 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -113,7 +113,8 @@ class Client extends BaseClient { /** * All of the {@link Channel}s that the client is currently handling, mapped by their IDs - * as long as sharding isn't being used, this will be *every* channel in *every* guild the bot - * is a member of, and all DM channels + * is a member of. Note that DM channels will not be initially cached, and thus not be present + * in the store without their explicit fetching or use. * @type {ChannelStore<Snowflake, Channel>} */ this.channels = new ChannelStore(this);
docs:(Client): disambiguate the description of channels collection (#<I>) * Disambiguate the description of <client>.channels Although not explicitly said, the current wording makes it seem like all channels are cached and available at any time in this store. Hopefully this variation makes it a bit clearer. * make more explicit (I think) * remove trailing white spaces
discordjs_discord.js
train
js
75e0d07640db5e03105a7d16f17307c104346411
diff --git a/lib/gds_api/test_helpers/email_alert_api.rb b/lib/gds_api/test_helpers/email_alert_api.rb index <HASH>..<HASH> 100644 --- a/lib/gds_api/test_helpers/email_alert_api.rb +++ b/lib/gds_api/test_helpers/email_alert_api.rb @@ -595,6 +595,12 @@ module GdsApi url = "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists" query ? "#{url}?#{query}" : url end + + # Find and return the subscriber list for a topic if one exists. + def email_alert_api_has_subscriber_list_for_topic(content_id:, list: {}) + url = "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists?links%5Btopics%5D%5B0%5D=#{content_id}" + stub_request(:get, url).to_return(status: 200, body: { "subscriber_list" => list }.to_json) + end end end end
Add API test helper function to find subscriptions for a topic
alphagov_gds-api-adapters
train
rb
bd31c48adee2478fbfc4e92748847f8b96b680ab
diff --git a/test/models/simple_smart_answer_edition_test.rb b/test/models/simple_smart_answer_edition_test.rb index <HASH>..<HASH> 100644 --- a/test/models/simple_smart_answer_edition_test.rb +++ b/test/models/simple_smart_answer_edition_test.rb @@ -32,9 +32,14 @@ class SimpleSmartAnswerEditionTest < ActiveSupport::TestCase edition.nodes.build(:slug => "right", :title => "As you wander through the door, it slams shut behind you, as a tiger starts pacing towards you...", :order => 3, :kind => "outcome") edition.save! - new_edition = edition.build_clone - new_edition.save! + cloned_edition = edition.build_clone + cloned_edition.save! + old_edition = SimpleSmartAnswerEdition.find(edition.id) + assert_equal ["question", "outcome", "outcome"], old_edition.nodes.all.map(&:kind) + assert_equal ["question1", "left", "right"], old_edition.nodes.all.map(&:slug) + + new_edition = SimpleSmartAnswerEdition.find(cloned_edition.id) assert_equal edition.body, new_edition.body assert_equal ["question", "outcome", "outcome"], new_edition.nodes.all.map(&:kind) assert_equal ["question1", "left", "right"], new_edition.nodes.all.map(&:slug)
Add check to make sure old nodes aren't reassigned with use of clone method
alphagov_govuk_content_models
train
rb
20645c845962dfd38f7780155e8c3886d6e090d0
diff --git a/command/catalog/list/dc/catalog_list_datacenters.go b/command/catalog/list/dc/catalog_list_datacenters.go index <HASH>..<HASH> 100644 --- a/command/catalog/list/dc/catalog_list_datacenters.go +++ b/command/catalog/list/dc/catalog_list_datacenters.go @@ -49,6 +49,7 @@ func (c *cmd) Run(args []string) int { dcs, err := client.Catalog().Datacenters() if err != nil { c.UI.Error(fmt.Sprintf("Error listing datacenters: %s", err)) + return 1 } for _, dc := range dcs {
Exit with error code 1 when failing to list DCs (#<I>) Fixes #<I>.
hashicorp_consul
train
go
cf76011439f213c365dd18403d5dc443d9260483
diff --git a/src/cryptojwt/key_bundle.py b/src/cryptojwt/key_bundle.py index <HASH>..<HASH> 100755 --- a/src/cryptojwt/key_bundle.py +++ b/src/cryptojwt/key_bundle.py @@ -834,6 +834,7 @@ class KeyBundle: return res + @keys_writer def load(self, spec): """ Sets attributes according to a specification.
address more comments from @janste<I>
openid_JWTConnect-Python-CryptoJWT
train
py
9597e22b128799a031d7ae093f3b344932bf9c3d
diff --git a/closure/goog/testing/asserts_test.js b/closure/goog/testing/asserts_test.js index <HASH>..<HASH> 100644 --- a/closure/goog/testing/asserts_test.js +++ b/closure/goog/testing/asserts_test.js @@ -984,11 +984,13 @@ async function testAssertRejects() { reject('string error test'); })); assertEquals('string error', 'string error test', e); - assertRejects( + e = await assertRejects( 'assertRejects should fail with a resolved thenable', (async () => { await assertRejects(thenable((resolve) => resolve())); fail('should always throw.'); })()); + assertEquals( + 'IThenable passed into assertRejects did not reject', e.message); } }
Add missing await to test. RELNOTES: none ------------- Created by MOE: <URL>
google_closure-library
train
js
e94d1023284c96993551e5c2dab6838bf94848d3
diff --git a/graylog2-server/src/main/java/org/graylog2/utilities/IPSubnetConverter.java b/graylog2-server/src/main/java/org/graylog2/utilities/IPSubnetConverter.java index <HASH>..<HASH> 100644 --- a/graylog2-server/src/main/java/org/graylog2/utilities/IPSubnetConverter.java +++ b/graylog2-server/src/main/java/org/graylog2/utilities/IPSubnetConverter.java @@ -22,7 +22,7 @@ import com.google.common.base.Joiner; import com.google.common.base.Splitter; import java.net.UnknownHostException; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; /** @@ -31,7 +31,7 @@ import java.util.Set; public class IPSubnetConverter implements Converter<Set<IpSubnet>> { @Override public Set<IpSubnet> convertFrom(String value) { - final Set<IpSubnet> converted = new HashSet<>(); + final Set<IpSubnet> converted = new LinkedHashSet<>(); if (value != null) { Iterable<String> subnets = Splitter.on(',').trimResults().split(value); for (String subnet : subnets) {
Use LinkedHashSet for a deterministic order (#<I>)
Graylog2_graylog2-server
train
java
ce155800cebd9cf676ecb1c2ff77c431a74e4ef6
diff --git a/concrete/controllers/backend/file.php b/concrete/controllers/backend/file.php index <HASH>..<HASH> 100644 --- a/concrete/controllers/backend/file.php +++ b/concrete/controllers/backend/file.php @@ -848,6 +848,14 @@ class File extends Controller } } } + + $fileValidationService = $this->app->make('helper/validation/file'); + + if (!$fileValidationService->extension($filename)) { + $fileHelper = $this->app->make('helper/file'); + throw new UserMessageException(t('The file extension "%s" is not valid.', $fileHelper->getExtension($filename))); + } + $fullFilename = $temporaryDirectory . '/' . $filename; // write the downloaded file to a temporary location on disk $handle = fopen($fullFilename, 'wb');
Add security fix for importing remote urls.
concrete5_concrete5
train
php
cc4806056f5cc39bbe51df8553962650221ee667
diff --git a/lib/boson/libraries/file_library.rb b/lib/boson/libraries/file_library.rb index <HASH>..<HASH> 100644 --- a/lib/boson/libraries/file_library.rb +++ b/lib/boson/libraries/file_library.rb @@ -125,8 +125,6 @@ module Boson def load_source_and_set_module detected = detect_additions(:modules=>true) { load_source } @module = determine_lib_module(detected[:modules]) unless @module - #without this, module's class methods weren't showing up - @module = Util.constantize(@module) if base_module != Commands end def determine_lib_module(detected_modules) @@ -136,10 +134,7 @@ module Boson when 0 then lib_module = create_module_from_path(-1) else unless (lib_module = Util.constantize("boson/commands/#{@name}")) && lib_module.to_s[/^Boson::Commands/] - command_modules = detected_modules.select {|e| e.to_s[/^#{base_module}::/] } - unless command_modules.size == 1 && (lib_module = command_modules[0]) - raise LoaderError, "Can't detect module. Specify a module in this library's config." - end + raise LoaderError, "Can't detect module. Specify a module in this library's config." end end lib_module
tweaked loader, removed old hack
cldwalker_boson
train
rb
0d1f911d8e4ad1fbdc64185e85dba7a87f1f35a8
diff --git a/src/Arrays.php b/src/Arrays.php index <HASH>..<HASH> 100644 --- a/src/Arrays.php +++ b/src/Arrays.php @@ -6,6 +6,7 @@ namespace TraderInteractive\Util; use InvalidArgumentException; +use UnexpectedValueException; /** * Class of static array utility functions. @@ -301,11 +302,8 @@ final class Arrays self::ensureIsArray($array, '$arrays was not a multi-dimensional array'); $key = self::get($array, $keyIndex); - self::ensureValidKey( - $key, - "Value for \$arrays[{$index}][{$keyIndex}] was not a string or integer", - '\\UnexpectedValueException' - ); + $message = "Value for \$arrays[{$index}][{$keyIndex}] was not a string or integer"; + self::ensureValidKey($key, $message, UnexpectedValueException::class); $value = self::get($array, $valueIndex); if (!array_key_exists($key, $result)) {
Refactor to get code coverage to <I>%
traderinteractive_util-arrays-php
train
php
cb896e5986e885f7900ad96d1f8edaf1d82ad158
diff --git a/frontend/app/app.js b/frontend/app/app.js index <HASH>..<HASH> 100644 --- a/frontend/app/app.js +++ b/frontend/app/app.js @@ -41,6 +41,13 @@ var FacilMap = { } }); + // Properly resolve source maps, see https://github.com/angular/angular.js/issues/5217#issuecomment-257143381 + fm.app.factory('$exceptionHandler', function() { + return function(exception, cause) { + console.error(exception.stack); + }; + }); + function wrapApply($scope, f) { return function() { var context = this;
Properly resolve source maps in angular exceptions
FacilMap_facilmap2
train
js
f1d2414d5c3a9fd104b5916a57209707f9f4cb9a
diff --git a/Filter.py b/Filter.py index <HASH>..<HASH> 100644 --- a/Filter.py +++ b/Filter.py @@ -18,7 +18,7 @@ class GrepFilter(Filter): def __init__(self, p_expression, p_case_sensitive=None): self.expression = p_expression - if p_case_sensitive: + if p_case_sensitive != None: self.case_sensitive = p_case_sensitive else: # only be case sensitive when the expression contains at least one diff --git a/test/FilterTest.py b/test/FilterTest.py index <HASH>..<HASH> 100644 --- a/test/FilterTest.py +++ b/test/FilterTest.py @@ -73,3 +73,14 @@ class FilterTest(unittest.TestCase): self.assertEquals(todolist_to_string(filtered_todos), \ todolist_to_string(reference)) + + def test_filter8(self): + """ Test case sensitive match (forced, with lowercase). """ + todos = load_file('data/FilterTest1.txt') + grep = Filter.GrepFilter('+Project', False) + + filtered_todos = grep.filter(todos) + reference = load_file('data/FilterTest1a-result.txt') + + self.assertEquals(todolist_to_string(filtered_todos), \ + todolist_to_string(reference))
Fix bug when case sensitivity is explicitly turned off. When passing False for case sensitivity, it would fall into the logic to automatically determine whether case sensitivity is desired based on the appearance of capitals.
bram85_topydo
train
py,py
ab4f27eeaedd0b55bcda2691635bb55ea4e340a6
diff --git a/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java b/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java index <HASH>..<HASH> 100644 --- a/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java +++ b/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java @@ -1138,11 +1138,10 @@ final class ConsensusModuleAgent implements Agent leadershipTermId(leadershipTermId); - if (null != election && null != appendPosition) + if (null != election) { - final long recordingId = RecordingPos.getRecordingId(aeron.countersReader(), appendPosition.counterId()); election.onReplayNewLeadershipTermEvent( - recordingId, leadershipTermId, logPosition, timestamp, termBaseLogPosition); + logRecordingId(), leadershipTermId, logPosition, timestamp, termBaseLogPosition); } }
[Java] Pick up recording id with more reliable method when processing new leadership event.
real-logic_aeron
train
java
1aca58ef698232fd963f75ffc366783649c2731a
diff --git a/pyipmi/interfaces/aardvark.py b/pyipmi/interfaces/aardvark.py index <HASH>..<HASH> 100644 --- a/pyipmi/interfaces/aardvark.py +++ b/pyipmi/interfaces/aardvark.py @@ -33,7 +33,8 @@ class ChecksumError(Exception): class Aardvark: NAME = 'aardvark' - def __init__(self, slave_address=0x20, port=0, serial_number=None): + def __init__(self, slave_address=0x20, port=0, serial_number=None, + enable_i2c_pullups=True): if pyaardvark is None: raise RuntimeError('No pyaardvark module found. You can not ' 'use this interface.') @@ -45,7 +46,7 @@ class Aardvark: self._dev = pyaardvark.open(port, serial_number) self._dev.enable_i2c = True - self._dev.i2c_pullups = True + self._dev.i2c_pullups = enable_i2c_pullups self._dev.i2c_slave_enable(self.slave_address >> 1) def enable_target_power(self, enabled):
aardvark: make i2c pullups configurable This fixes #6.
kontron_python-ipmi
train
py
2e4b6cba4579269d680d8912e70d8056d39bed91
diff --git a/qiskit/dagcircuit/_dagcircuit.py b/qiskit/dagcircuit/_dagcircuit.py index <HASH>..<HASH> 100644 --- a/qiskit/dagcircuit/_dagcircuit.py +++ b/qiskit/dagcircuit/_dagcircuit.py @@ -74,10 +74,10 @@ class DAGCircuit: self.multi_graph = nx.MultiDiGraph() # Map of qregs to sizes - self.qregs = {} + self.qregs = OrderedDict() # Map of cregs to sizes - self.cregs = {} + self.cregs = OrderedDict() # Map of user defined gates to ast nodes defining them self.gates = {}
Guarantee order of registers in DAGCircuit (#<I>) Use `OrderedDict`s for `DAGCircuit.qregs` and `DAGCircuit.cregs` in order to ensure that they are traversed always in the same order (which should be the order of creation).
Qiskit_qiskit-terra
train
py
307104b069668654144de5c990fa2e2946c52901
diff --git a/src/config/eslint.js b/src/config/eslint.js index <HASH>..<HASH> 100644 --- a/src/config/eslint.js +++ b/src/config/eslint.js @@ -8,8 +8,11 @@ module.exports = { }, plugins: ['flowtype'], rules: { + // eslint + 'arrow-body-style': 'off', + // flowtype - 'flowtype/space-after-type-colon': 'off', + 'flowtype/space-after-type-colon': 'off', // conflict with prettier // import 'import/prefer-default-export': 'off', // conflict when there is only 1 action
Disable arrow-body-style rule
ProAI_react-kickstarter
train
js
fc339bcf9de3582069275ecb8ab0f8a6bbf4c1c2
diff --git a/test_path.py b/test_path.py index <HASH>..<HASH> 100644 --- a/test_path.py +++ b/test_path.py @@ -30,10 +30,7 @@ import time import ntpath import posixpath -from path import path, __version__ as path_version - -# This should match the version of path.py being tested. -__version__ = '2.2.2.990' +from path import path def p(**choices): @@ -604,7 +601,4 @@ class TempDirTestCase(unittest.TestCase): "should not raise an exception.") if __name__ == '__main__': - if __version__ != path_version: - print ("Version mismatch: test_path.py version %s, path version %s" % - (__version__, path_version)) unittest.main()
Remove path version check. We trust the travis tests and technique.
jaraco_path.py
train
py
b96db5ad73a3be22c6a2dfd3d27c0308e5204966
diff --git a/test/unit/model/relation/repository/rdf/RdfMediaRelationRepositoryTest.php b/test/unit/model/relation/repository/rdf/RdfMediaRelationRepositoryTest.php index <HASH>..<HASH> 100644 --- a/test/unit/model/relation/repository/rdf/RdfMediaRelationRepositoryTest.php +++ b/test/unit/model/relation/repository/rdf/RdfMediaRelationRepositoryTest.php @@ -139,7 +139,6 @@ class RdfMediaRelationRepositoryTest extends TestCase $this->complexSearch->method('getGateway')->willReturn($this->searchGateway); $this->searchGateway->method('search')->willReturn($queryResult); - $result = $this->subject->findAll($findAllQueryMock); $resultJson = $result->jsonSerialize(); $this->assertCount(2, $result);
Update test/unit/model/relation/repository/rdf/RdfMediaRelationRepositoryTest.php
oat-sa_extension-tao-mediamanager
train
php
3e61e5be6914dea03f32df4e38e66c3ab3f89e4c
diff --git a/parsl/monitoring/monitoring.py b/parsl/monitoring/monitoring.py index <HASH>..<HASH> 100644 --- a/parsl/monitoring/monitoring.py +++ b/parsl/monitoring/monitoring.py @@ -100,11 +100,8 @@ class UDPRadio(object): Arbitrary pickle-able object that is to be sent Returns: - # bytes sent, - or False if there was a timeout during send, - or None if there was an exception during pickling + None """ - x = 0 try: buffer = pickle.dumps((self.source_id, # Identifier for manager int(time.time()), # epoch timestamp @@ -115,11 +112,11 @@ class UDPRadio(object): return try: - x = self.sock.sendto(buffer, (self.ip, self.port)) + self.sock.sendto(buffer, (self.ip, self.port)) except socket.timeout: logging.error("Could not send message within timeout limit") - return False - return x + return + return class MonitoringHub(RepresentationMixin):
Remove UDPRadio.send return type zoo (#<I>) Before this commit, the return type of UDPRadio.send is a mess and return values are never inspected. This commit replaces all of the return values with None, which better reflects how it is used.
Parsl_parsl
train
py
efc8158d79a8247248805b0ac6fb9425f3bf646e
diff --git a/lib/genversion.js b/lib/genversion.js index <HASH>..<HASH> 100644 --- a/lib/genversion.js +++ b/lib/genversion.js @@ -65,6 +65,13 @@ exports.check = (targetPath, opts, callback) => { return callback(null, true, false, false) } + // Issue axelpale/genversion#15 + // Remove all the CR characters inserted by git on clone/checkout + // when git configuration has core.autocrlf=true + while (fileContent.indexOf('\r') >= 0) { + fileContent = fileContent.replace(/\r/,''); + } + if (fileContent !== referenceContent) { // The file is created by genversion but has outdated content return callback(null, true, true, false)
Github Issue axelpale/genversion#<I> Affects only Windows environment with git configuration core.autocrlf=true. Remove all the CR characters before the --check-only source file comparison. The CR characters are inserted by git on clone/checkout when git configuration has core.autocrlf=true . Affected Environment: Windows
axelpale_genversion
train
js
ec0b424e42c9340934096eae1d703313ad45b5fb
diff --git a/test/runtime/Policies.go b/test/runtime/Policies.go index <HASH>..<HASH> 100644 --- a/test/runtime/Policies.go +++ b/test/runtime/Policies.go @@ -958,6 +958,7 @@ var _ = Describe("RuntimeValidatedPolicies", func() { It("Tests Egress To World", func() { googleDNS := "8.8.8.8" + googleHTTP := "google.com" checkEgressToWorld := func() { By("Testing egress access to the world") res := vm.ContainerExec(helpers.App1, helpers.Ping(googleDNS)) @@ -967,6 +968,10 @@ var _ = Describe("RuntimeValidatedPolicies", func() { res = vm.ContainerExec(helpers.App1, helpers.Ping(helpers.App2)) ExpectWithOffset(2, res.WasSuccessful()).Should( BeFalse(), "unexpectedly able to ping %s", helpers.App2) + + res = vm.ContainerExec(helpers.App1, helpers.CurlFail("http://%s", googleHTTP)) + ExpectWithOffset(2, res.WasSuccessful()).Should( + BeTrue(), "not able to curl %s", googleHTTP) } setupPolicyAndTestEgressToWorld := func(policy string) {
test: Add TCP request to egress world test
cilium_cilium
train
go
90d5a41c1254dda267c5287c403c1034cb98a938
diff --git a/kernel/classes/notification/eznotificationschedule.php b/kernel/classes/notification/eznotificationschedule.php index <HASH>..<HASH> 100644 --- a/kernel/classes/notification/eznotificationschedule.php +++ b/kernel/classes/notification/eznotificationschedule.php @@ -107,7 +107,7 @@ class eZNotificationSchedule if ( $daysDiff < 0 or ( $daysDiff == 0 and $hoursDiff <= 0 ) ) { - $daysDiff += 31; + $daysDiff += $daysInMonth; } $secondsDiff = 3600 * ( $daysDiff * 24 + $hoursDiff )
- Fixed not reported bug: incorrect calculation of the sending date for monthly sent notifications. git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I>
ezsystems_ezpublish-legacy
train
php
e451d49191649e2e9becee92ba79db6805e77b97
diff --git a/src/test/attrs.test.js b/src/test/attrs.test.js index <HASH>..<HASH> 100644 --- a/src/test/attrs.test.js +++ b/src/test/attrs.test.js @@ -105,17 +105,17 @@ describe('attrs', () => { }) it('pass attrs to style block', () => { - /* Would be a React Router Link in IRL */ + /* Would be a React Router Link in URL */ const Comp = styled.a.attrs({ href: '#', - activeClassName: '--is-active' + 'data-active-class-name': '--is-active' })` color:blue; - &.${props => props.activeClassName} { + &.${props => props['data-active-class-name']} { color:red; } ` - expect(shallow(<Comp />).html()).toEqual('<a href="#" class="sc-a b"></a>') + expect(shallow(<Comp />).html()).toEqual('<a href="#" data-active-class-name="--is-active" class="sc-a b"></a>') expectCSSMatches('.sc-a {} .b { color:blue; } .b.--is-active { color:red; }') })
fix: console error in attrs test
styled-components_styled-components
train
js
8206f4bf8a629d6e4a814f77c321cb03006de587
diff --git a/spec/app/models/mdm/web_page_spec.rb b/spec/app/models/mdm/web_page_spec.rb index <HASH>..<HASH> 100644 --- a/spec/app/models/mdm/web_page_spec.rb +++ b/spec/app/models/mdm/web_page_spec.rb @@ -27,6 +27,7 @@ RSpec.describe Mdm::WebPage, type: :model do context 'with string cookie' do let(:cookie) { string_cookie } + it 'persists successfully' do expect{web_page}.to change{Mdm::WebPage.count}.by(1) end @@ -38,6 +39,7 @@ RSpec.describe Mdm::WebPage, type: :model do context 'with Hash cookie' do let(:cookie) { hash_cookie } + it 'persists successfully' do expect{web_page}.to change{Mdm::WebPage.count}.by(1) end @@ -49,6 +51,7 @@ RSpec.describe Mdm::WebPage, type: :model do context 'with WEBrick::Cookie' do let(:cookie) { webrick_cookie } + it 'persists successfully' do expect{web_page}.to change{Mdm::WebPage.count}.by(1) end
Add blank line between let/it MSP-<I> * So that test setup stands out from rest out test itself
rapid7_metasploit_data_models
train
rb
ca705fcc1af31c9d423cf6c21dc546fddb572cb1
diff --git a/test_settings.py b/test_settings.py index <HASH>..<HASH> 100644 --- a/test_settings.py +++ b/test_settings.py @@ -3,6 +3,7 @@ SECRET_KEY = "lorem ipsum" INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.sessions', 'django.contrib.sites', 'tango_shared',
Added sessions to test settings installed apps
tBaxter_tango-comments
train
py
d53fd6d483828da96c862712c72a673b0de5c6e8
diff --git a/spec/moneta/proxy_redis_spec.rb b/spec/moneta/proxy_redis_spec.rb index <HASH>..<HASH> 100644 --- a/spec/moneta/proxy_redis_spec.rb +++ b/spec/moneta/proxy_redis_spec.rb @@ -1,4 +1,7 @@ describe "proxy_redis" do + let(:t_res){ 1 } + let(:min_ttl){ t_res } + moneta_build do Moneta.build do use :Proxy diff --git a/spec/moneta/standard_redis_spec.rb b/spec/moneta/standard_redis_spec.rb index <HASH>..<HASH> 100644 --- a/spec/moneta/standard_redis_spec.rb +++ b/spec/moneta/standard_redis_spec.rb @@ -1,5 +1,5 @@ describe 'standard_redis' do - let(:t_res){ 0.1 } + let(:t_res){ 1 } let(:min_ttl){ t_res } moneta_store :Redis
specs: fix t_res for some redis specs Redis has 1-second time resolution
moneta-rb_moneta
train
rb,rb
2a035d9111d8e5cd50ea7e7e10f5df7687be215c
diff --git a/services/service-tester.js b/services/service-tester.js index <HASH>..<HASH> 100644 --- a/services/service-tester.js +++ b/services/service-tester.js @@ -14,12 +14,14 @@ class ServiceTester { * Mocha output. The `path` is the path prefix which is automatically * prepended to each tested URI. The default is `/${attrs.id}`. */ - constructor(attrs) { + constructor({ id, title, pathPrefix }) { + if (pathPrefix === undefined) { + pathPrefix = `/${id}` + } Object.assign(this, { - id: attrs.id, - title: attrs.title, - pathPrefix: - attrs.pathPrefix === undefined ? `/${attrs.id}` : attrs.pathPrefix, + id, + title, + pathPrefix, specs: [], _only: false, })
ServiceTester: Minor readability tweak (#<I>) Was debugging this just now, and think this is easier to read and understand than the previous version.
badges_shields
train
js
aefdbb0986a7542fb8d5f680c8b6d5990de9769a
diff --git a/config.example.js b/config.example.js index <HASH>..<HASH> 100644 --- a/config.example.js +++ b/config.example.js @@ -201,6 +201,6 @@ conf.client = { /* - * Do not ammend the below lines unless you understand the changes! + * Do not amend the below lines unless you understand the changes! */ module.exports.production = conf;
Fixed typo in config.example.js Comment before module export had misspelled 'amend'.
prawnsalad_KiwiIRC
train
js
95ac38bfee096d373afa12c1d7f9a79aea4a1dc9
diff --git a/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationServiceV1.java b/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationServiceV1.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationServiceV1.java +++ b/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationServiceV1.java @@ -137,7 +137,7 @@ public class SerializationServiceV1 extends AbstractSerializationService { registerConstant(String[].class, new StringArraySerializer()); } - public void registerJavaTypeSerializers() { + protected void registerJavaTypeSerializers() { //Java extensions: more serializers registerConstant(Date.class, new DateSerializer()); registerConstant(BigInteger.class, new BigIntegerSerializer());
Fixed constructor calling overridable method in SerializationServiceV1 (SonarQube issue).
hazelcast_hazelcast
train
java
fce2b3dac86bec41e6e8e4bcc5d482d2d573746b
diff --git a/osuapi/model.py b/osuapi/model.py index <HASH>..<HASH> 100644 --- a/osuapi/model.py +++ b/osuapi/model.py @@ -339,6 +339,12 @@ class Beatmap(AttributeModel): ID of the map creator. difficultyrating : float Star rating of a map. + diff_aim : float + Aim portion of difficulty + diff_speed : float + Speed portion of difficulty + diff_strain : float + Strain portion of difficulty diff_size : float Circle Size. (CS) diff_overall : float @@ -390,6 +396,9 @@ class Beatmap(AttributeModel): creator = Attribute(str) creator_id = Attribute(int) difficultyrating = Attribute(float) + diff_aim = Attribute(float) + diff_speed = Attribute(float) + diff_strain = Attribute(float) diff_size = Attribute(float) diff_overall = Attribute(float) diff_approach = Attribute(float)
add aim, speed, strain to Beatmap
khazhyk_osuapi
train
py
0a3b4e561345bfb9d7fb690616bc8b3886729638
diff --git a/karaage/people/models.py b/karaage/people/models.py index <HASH>..<HASH> 100644 --- a/karaage/people/models.py +++ b/karaage/people/models.py @@ -193,7 +193,7 @@ class Person(AbstractBaseUser): _, _, last_name = self.full_name.rpartition(" ") return last_name.strip() else: - return None + return self.full_name last_name = property(_get_last_name, _set_last_name) def _set_first_name(self, value):
Fix LDAP SN generation. If person has only name return it as last name. Required for LDAP SN field generation. Change-Id: Ief<I>d<I>db1bf0a<I>ca<I>f<I>f<I>ef<I>d
Karaage-Cluster_karaage
train
py
89ef879e5fd689e7b63a9eb834be9b0ebbf737c4
diff --git a/models/classes/upload/UploadService.php b/models/classes/upload/UploadService.php index <HASH>..<HASH> 100644 --- a/models/classes/upload/UploadService.php +++ b/models/classes/upload/UploadService.php @@ -54,8 +54,9 @@ class UploadService extends ConfigurableService throw new \InvalidArgumentException('Upload filename is missing'); } $name = array_key_exists('name', $postedFile) ? $postedFile['name'] : uniqid('unknown_', false); + $extension = pathinfo($name, PATHINFO_EXTENSION); - $targetName = uniqid('tmp', true) . $name; + $targetName = uniqid('tmp', true) . '.' . $extension; $targetLocation = tao_helpers_File::concat([$folder, $targetName]); $fakeFile = $this->getUploadDir()->getFile($targetLocation);
TAO-<I> secure file upload url
oat-sa_tao-core
train
php
9ddb7a95529b9cd488543aba27605259d8f3274b
diff --git a/src/api.js b/src/api.js index <HASH>..<HASH> 100644 --- a/src/api.js +++ b/src/api.js @@ -174,7 +174,9 @@ API.debug = function(name, fn) { concat = Array.prototype.concat; return function debug(arg) { try { - console.debug.apply(console, [name,'()'].concat(arguments)); + var args = [name+'(']; + args.push.apply(args, arguments); + args.push(')'); var ret = fn.apply(this, arguments); if (ret !== undefined && ret !== arg) { console.debug.apply(console, [name, '->', ret]);
debug args weren't being concatenated properly
esha_posterior
train
js
741113883a17327fe7cbd9c686e8bafbf4f5354a
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -403,7 +403,7 @@ Unirest = function (method, uri, headers, body, callback) { // Handle Response Body if (body) { - type = Unirest.type(result.headers['content-type'], true); + type = result.headers['content-type'] ? Unirest.type(result.headers['content-type'], true) : false; if (type) data = Unirest.Response.parse(body, type); else data = body; }
Update index.js Code should not assume every server always returns content-type.
Kong_unirest-nodejs
train
js
e9aca2f3a2dc6908a89404b8e084dd5219ed6a7a
diff --git a/src/Event/LoggedInUserListener.php b/src/Event/LoggedInUserListener.php index <HASH>..<HASH> 100644 --- a/src/Event/LoggedInUserListener.php +++ b/src/Event/LoggedInUserListener.php @@ -4,7 +4,7 @@ namespace Ceeram\Blame\Event; use ArrayObject; use Cake\Controller\Component\AuthComponent; use Cake\Event\Event; -use Cake\Event\EventListener; +use Cake\Event\EventListenerInterface; use Cake\ORM\Entity; /** @@ -13,7 +13,7 @@ use Cake\ORM\Entity; * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt */ -class LoggedInUserListener implements EventListener { +class LoggedInUserListener implements EventListenerInterface { /** * @var AuthComponent @@ -53,4 +53,4 @@ class LoggedInUserListener implements EventListener { $options['loggedInUser'] = $this->_Auth->user('id'); } -} \ No newline at end of file +}
EventListener has been renamed to EventListenerInterface See <URL>
ceeram_blame
train
php
4ba6f58d3283106861a79d9cac38ecd2e7ebc742
diff --git a/cmd/activity-monitor/main.go b/cmd/activity-monitor/main.go index <HASH>..<HASH> 100644 --- a/cmd/activity-monitor/main.go +++ b/cmd/activity-monitor/main.go @@ -124,7 +124,7 @@ func startMonitor(rpcCh *amqp.Channel, logger *blog.AuditLogger, stats statsd.St // Run forever. for d := range deliveries { - go timeDelivery(d, stats, deliveryTimings) + timeDelivery(d, stats, deliveryTimings) // Pass each message to the Analysis Engine err = ae.ProcessMessage(d)
de-concurrify activity-monitor The activity monitor spawns a goroutine only to emit some stats. That goroutine caused some confusion and some other PRs around this code got more complicated trying to manage the thread-safety. But the activity-monitor doesn't really need that goroutine to emit its stats. So, we simplify by removing two letters and a space.
letsencrypt_boulder
train
go
0d21b61022b6638ac800392f7df7d53fb6435f99
diff --git a/pkg/chunked/storage_linux.go b/pkg/chunked/storage_linux.go index <HASH>..<HASH> 100644 --- a/pkg/chunked/storage_linux.go +++ b/pkg/chunked/storage_linux.go @@ -1066,7 +1066,7 @@ func safeMkdir(dirfd int, mode os.FileMode, name string, metadata *internal.File } } - file, err := openFileUnderRoot(name, dirfd, unix.O_DIRECTORY|unix.O_RDONLY, 0) + file, err := openFileUnderRoot(base, parentFd, unix.O_DIRECTORY|unix.O_RDONLY, 0) if err != nil { return err }
chunked: use just created parent directory
containers_storage
train
go
62a110c3c5370c284864ffd05aa19bf95c325c05
diff --git a/sess_test.go b/sess_test.go index <HASH>..<HASH> 100644 --- a/sess_test.go +++ b/sess_test.go @@ -50,9 +50,9 @@ func dialEcho() (*UDPSession, error) { sess.SetStreamMode(true) sess.SetStreamMode(false) sess.SetStreamMode(true) - sess.SetWindowSize(4096, 4096) - sess.SetReadBuffer(4 * 1024 * 1024) - sess.SetWriteBuffer(4 * 1024 * 1024) + sess.SetWindowSize(2048, 2048) + sess.SetReadBuffer(16 * 1024 * 1024) + sess.SetWriteBuffer(16 * 1024 * 1024) sess.SetStreamMode(true) sess.SetNoDelay(1, 10, 2, 1) sess.SetMtu(1400) @@ -70,13 +70,13 @@ func dialSink() (*UDPSession, error) { } sess.SetStreamMode(true) - sess.SetWindowSize(4096, 4096) - sess.SetReadBuffer(4 * 1024 * 1024) - sess.SetWriteBuffer(4 * 1024 * 1024) + sess.SetWindowSize(2048, 2048) + sess.SetReadBuffer(16 * 1024 * 1024) + sess.SetWriteBuffer(16 * 1024 * 1024) sess.SetStreamMode(true) sess.SetNoDelay(1, 10, 2, 1) sess.SetMtu(1400) - sess.SetACKNoDelay(true) + sess.SetACKNoDelay(false) sess.SetDeadline(time.Now().Add(time.Minute)) return sess, err }
if wnd too large while buf small, sometimes krnl w drop pkts, adjust tests
xtaci_kcp-go
train
go
f11b4ca64bba2b3d57a28056dc0e98feab8877cb
diff --git a/datatableview/helpers.py b/datatableview/helpers.py index <HASH>..<HASH> 100644 --- a/datatableview/helpers.py +++ b/datatableview/helpers.py @@ -174,7 +174,7 @@ def make_xeditable(instance=None, extra_attrs=[], *args, **kwargs): data = kwargs.get('default_value', instance) # Compile values to appear as "data-*" attributes on the anchor tag - default_attr_names = ['pk', 'type', 'url', 'title', 'placeholder'] + default_attr_names = ['pk', 'type', 'url', 'source', 'title', 'placeholder'] valid_attr_names = set(default_attr_names + list(extra_attrs)) attrs = {} for k, v in kwargs.items():
Allow make_xeditable "source" to be specified Slight oversight, since the default conditions are so automatic. This should allow a custom choices url to be specified without fussing with the “extra_attrs” argument.
pivotal-energy-solutions_django-datatable-view
train
py
5d4c24c4ac84f8df603efa95272bfd314ae631c3
diff --git a/dynaphopy/interface/interactive_ui.py b/dynaphopy/interface/interactive_ui.py index <HASH>..<HASH> 100755 --- a/dynaphopy/interface/interactive_ui.py +++ b/dynaphopy/interface/interactive_ui.py @@ -331,7 +331,7 @@ def interactive_interface(calculation, trajectory, args, structure_file): if x2 == ord('7'): resolution =float(get_param(screen, "Insert resolution in THz")) calculation.set_spectra_resolution(resolution) - calculation.power_spectra_clear() + calculation.full_clear() curses.endwin() if x2 == ord('8'):
Fixed maximum entropy method coefficient analysis
abelcarreras_DynaPhoPy
train
py
65465deea1988171c8b1634c398ba076c548498f
diff --git a/lib/client.js b/lib/client.js index <HASH>..<HASH> 100644 --- a/lib/client.js +++ b/lib/client.js @@ -149,13 +149,14 @@ function _connect (client) { _reset = false } else { socket.resume() - client[kQueue].resume() } if (_callback) { _callback() _callback = null } + + client[kQueue].resume() } client[kStream].finished(socket, (err) => {
fix: resume queue after callback resuming the queue before callback would cause the task to be unecessarily re-queued.
mcollina_undici
train
js
7927e29460a7ce235a22d1a8aff1e1f76e40b6ab
diff --git a/babel.config.js b/babel.config.js index <HASH>..<HASH> 100644 --- a/babel.config.js +++ b/babel.config.js @@ -61,7 +61,7 @@ const babelConfig = { plugins(meta) { const alias = parseAliases(meta, aliases) const result = [ - './src/babel/get-step', + // './src/babel/get-step', '@babel/plugin-proposal-export-namespace-from', '@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-nullish-coalescing-operator', @@ -97,6 +97,7 @@ const babelConfig = { filename && filename.includes('__tests__') && !filename.includes('redux') + && !filename.includes('browserstack') ) }, plugins: ['./src/babel/babel-plugin'],
ignore browserstack tests by effector babel plugin
zerobias_effector
train
js
c6372724c817c153eb93b3218b32b73868f46445
diff --git a/imagen/ndmapping.py b/imagen/ndmapping.py index <HASH>..<HASH> 100644 --- a/imagen/ndmapping.py +++ b/imagen/ndmapping.py @@ -93,7 +93,7 @@ class NdIndexableMapping(param.Parameterized): metadata = AttrDict(self.metadata, **dict([(k, v) for k, v in items if k not in self.params()])) for key in metadata: - kwargs.pop(key) + kwargs.pop(key, None) return kwargs, metadata
Fixed problem with metadata in NdMapping
pyviz_imagen
train
py
1a685360551e5d26ed9a7ac5a20f46e8e56e54a2
diff --git a/drapery/cli/drape.py b/drapery/cli/drape.py index <HASH>..<HASH> 100644 --- a/drapery/cli/drape.py +++ b/drapery/cli/drape.py @@ -1,7 +1,8 @@ import sys import logging -import click +import warnings +import click import fiona import rasterio from shapely.geometry import mapping @@ -44,6 +45,11 @@ def cli(source_f, raster_f, output, verbose): with rasterio.open(raster_f) as raster: if source_crs != raster.crs: click.BadParameter("Features and raster have different CRS.") + if len(raster.bands) > 1: + warnings.warn("Found {0} bands in {1}, expected a single band raster".format(raster.bands, raster_f)) + supported = ['int16', 'int32', 'float32', 'float64'] + if raster.dtypes[0] not in supported: + warnings.warn("Found {0} type in {1}, expected one of {2}".format(raster.dtypes[0]), raster_f, supported) with fiona.open( output, 'w', driver=source_driver,
Check the raster bands and dtypes, warn if not as expected
mrahnis_drapery
train
py
246cc0e6b52f455dcb1ab23039202d7498d91d30
diff --git a/course/request.php b/course/request.php index <HASH>..<HASH> 100644 --- a/course/request.php +++ b/course/request.php @@ -70,4 +70,4 @@ echo $OUTPUT->header(); echo $OUTPUT->heading($strtitle); // Show the request form. $requestform->display(); -echo $OUTPUT->footer(); +echo $OUTPUT->footer(); \ No newline at end of file
course MDL-<I> removed trailing whitespace
moodle_moodle
train
php
f8be76b5efac76c9b6cf707cc94e669e453cdc52
diff --git a/phy/utils/event.py b/phy/utils/event.py index <HASH>..<HASH> 100644 --- a/phy/utils/event.py +++ b/phy/utils/event.py @@ -127,6 +127,11 @@ class ProgressReporter(EventEmitter): def is_complete(self): return self.current() == self.total() + def set_complete(self): + for k, (v, m) in self._channels.items(): + self._channels[k][0] = m + self.emit('complete') + def current(self): """Return the total current value.""" return sum(v[0] for k, v in self._channels.items()) diff --git a/phy/utils/tests/test_event.py b/phy/utils/tests/test_event.py index <HASH>..<HASH> 100644 --- a/phy/utils/tests/test_event.py +++ b/phy/utils/tests/test_event.py @@ -88,3 +88,9 @@ def test_progress_reporter(): assert not pr.is_complete() pr.set(channel_1=10, channel_2=20) assert pr.is_complete() + + pr.set(channel_1=9, channel_2=19) + assert not pr.is_complete() + pr.set_complete() + assert pr.is_complete() + assert _completed == [True] * 3
Added set_complete() method to ProgressReporter.
kwikteam_phy
train
py,py
4acb8b056017535353bf6ee792e976dc7b5c89c9
diff --git a/packages/reactstrap-validation-select/AvSelect.js b/packages/reactstrap-validation-select/AvSelect.js index <HASH>..<HASH> 100644 --- a/packages/reactstrap-validation-select/AvSelect.js +++ b/packages/reactstrap-validation-select/AvSelect.js @@ -307,6 +307,9 @@ class AvSelect extends AvBaseInput { styles={{ ...styles, placeholder: (provided, state) => { + if (state.isDisabled) { + return provided; + } const showError = touched && hasError && !state.focused; return { @@ -320,7 +323,11 @@ class AvSelect extends AvBaseInput { width: '90%', }), control: (provided, state) => { + if (state.isDisabled) { + return provided; + } const showError = touched && hasError && !state.focused; + return { ...provided, borderRadius: '.25em', @@ -338,6 +345,9 @@ class AvSelect extends AvBaseInput { maxWidth: '99%', }), dropdownIndicator: (provided, state) => { + if (state.isDisabled) { + return provided; + } const showError = touched && hasError && !state.focused; return {
fix(reactstrap-validation-select): prevents the provided styles from react-select from being overridden by the styles applied in error conditions
Availity_availity-react
train
js
e47ce44aa90e053e3225df181ab8e2c7651d232c
diff --git a/tasks/ssh_deploy.js b/tasks/ssh_deploy.js index <HASH>..<HASH> 100644 --- a/tasks/ssh_deploy.js +++ b/tasks/ssh_deploy.js @@ -164,7 +164,7 @@ module.exports = function(grunt) { var closeConnection = function(callback) { connection.end(); - return true; + callback(); }; async.series([
Async series should callback when done #3
dasuchin_grunt-ssh-deploy
train
js
49a046ad821f3ad311ac2759c7d40e245be26369
diff --git a/soundscrape/__init__.py b/soundscrape/__init__.py index <HASH>..<HASH> 100644 --- a/soundscrape/__init__.py +++ b/soundscrape/__init__.py @@ -1 +1 @@ -__version__ = '0.27.3' +__version__ = '0.27.4'
<I> - get all likes when getting likes
Miserlou_SoundScrape
train
py
a6e727fa4411b26af72464619a2f4a4df1e0b1e1
diff --git a/src/Context/Initializer/WordpressContextInitializer.php b/src/Context/Initializer/WordpressContextInitializer.php index <HASH>..<HASH> 100644 --- a/src/Context/Initializer/WordpressContextInitializer.php +++ b/src/Context/Initializer/WordpressContextInitializer.php @@ -67,9 +67,14 @@ class WordpressContextInitializer implements ContextInitializer ); exec($cmd, $cmd_output, $exit_code); - // Unix exit code; a successful command returns 0. + // This means WordPress is installed. Let's remove it. if ($exit_code === 0) { - return; + $cmd = sprintf( + 'wp --path=%s --url=%s db reset --yes', + escapeshellarg($this->params['path']), + escapeshellarg($this->params['url']) + ); + exec($cmd); } $cmd = sprintf(
Delete WordPress before (re-)installing it
paulgibbs_behat-wordpress-extension
train
php