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
36798745fb83a3d6289d8dc820882f656ab2572b
diff --git a/user/editlib.php b/user/editlib.php index <HASH>..<HASH> 100644 --- a/user/editlib.php +++ b/user/editlib.php @@ -223,7 +223,12 @@ function useredit_shared_definition(&$mform, $editoroptions = null) { if (!empty($CFG->allowuserthemes)) { $choices = array(); $choices[''] = get_string('default'); - $choices += get_list_of_themes(); + $themes = get_list_of_themes(); + foreach ($themes as $key=>$theme) { + if (empty($theme->hidefromselector)) { + $choices[$key] = $theme->name; + } + } $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices); $mform->setAdvanced('theme'); }
user MDL-<I> Fixed incorrect use of get_list_of_themes in editlib.php
moodle_moodle
train
php
ac259b9fe5b807a79a9afecceb0c53baaf6780df
diff --git a/pew/pew.py b/pew/pew.py index <HASH>..<HASH> 100644 --- a/pew/pew.py +++ b/pew/pew.py @@ -18,9 +18,14 @@ except ImportError: from backports.shutil_get_terminal_size import get_terminal_size from clonevirtualenv import clone_virtualenv -from pythonz.commands.install import InstallCommand -from pythonz.commands.list import ListCommand as ListPythons -from pythonz.commands.locate import LocateCommand as LocatePython +try: + from pythonz.commands.install import InstallCommand + from pythonz.commands.list import ListCommand as ListPythons + from pythonz.commands.locate import LocateCommand as LocatePython +except KeyError: + # Pythonz is an interactive tool that requires a valid $HOME, for now we'll + # just ignore the Error to appease the CI environment + pass from pew import __version__ from pew._utils import (check_call, invoke, expandpath, own,
Ignore Error in the CI environment
berdario_pew
train
py
b6bf4838d1cd7bdfbedb77a7172b63caee0b6017
diff --git a/etc/remark/plugins/lint/jsdoc.js b/etc/remark/plugins/lint/jsdoc.js index <HASH>..<HASH> 100644 --- a/etc/remark/plugins/lint/jsdoc.js +++ b/etc/remark/plugins/lint/jsdoc.js @@ -16,6 +16,8 @@ * limitations under the License. */ +/* eslint-disable stdlib/jsdoc-return-annotations-marker */ + 'use strict'; /**
Disable lint rule as examples are not JS
stdlib-js_stdlib
train
js
ac26f591d75ba30e76148d0bee01a22ce7f586fa
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb index <HASH>..<HASH> 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb @@ -81,11 +81,13 @@ class GroupsController < ApplicationController to_index(group.errors, nil) end + # TO BE REMOVED ? def select_user @group = Group.find(params[:id]) render :partial => 'groups/select_user' end + # TO BE REMOVED ? def set_users @group = Group.find(params[:id]) if @group.set_users(params[:users])
Mark two methods as unused in groups_controller.rb
SonarSource_sonarqube
train
rb
aeb94695a7d8073b020a65e08df9ca6b2e17076c
diff --git a/src/main/java/si/mazi/rescu/AnnotationUtils.java b/src/main/java/si/mazi/rescu/AnnotationUtils.java index <HASH>..<HASH> 100644 --- a/src/main/java/si/mazi/rescu/AnnotationUtils.java +++ b/src/main/java/si/mazi/rescu/AnnotationUtils.java @@ -42,7 +42,7 @@ public final class AnnotationUtils { return null; } try { - return (String) ann.getClass().getMethod("value").invoke(ann); + return (String) ann.annotationType().getMethod("value").invoke(ann); } catch (Exception e) { throw new RuntimeException("Can't access element 'value' in " + annotationClass + ". This is probably a bug in rescu.", e); }
Use annotationType instead of getClass. Allows for Native image generation. (#<I>)
mmazi_rescu
train
java
f9cfe01da1c1095e8f10c140071a4e217a8a0b4d
diff --git a/schema_salad/main.py b/schema_salad/main.py index <HASH>..<HASH> 100644 --- a/schema_salad/main.py +++ b/schema_salad/main.py @@ -284,7 +284,7 @@ def main(argsl=None): # type: (List[str]) -> int # Optionally print the RDFS graph from the schema if args.print_rdfs: - print(rdfs.serialize(format=args.rdf_serializer)) + print(rdfs.serialize(format=args.rdf_serializer).decode('utf-8')) return 0 if args.print_metadata and not args.document:
fix printing of rdfs under py3 (#<I>)
common-workflow-language_schema_salad
train
py
c2d4b9f72353b766df6edb52e11a7c698965411a
diff --git a/test/unit/voldemort/store/routed/RoutedStoreTest.java b/test/unit/voldemort/store/routed/RoutedStoreTest.java index <HASH>..<HASH> 100644 --- a/test/unit/voldemort/store/routed/RoutedStoreTest.java +++ b/test/unit/voldemort/store/routed/RoutedStoreTest.java @@ -36,7 +36,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import voldemort.MockTime; import voldemort.ServerTestUtils; import voldemort.TestUtils; import voldemort.VoldemortException; @@ -60,6 +59,7 @@ import voldemort.store.UnreachableStoreException; import voldemort.store.memory.InMemoryStorageEngine; import voldemort.store.versioned.InconsistencyResolvingStore; import voldemort.utils.ByteArray; +import voldemort.utils.SystemTime; import voldemort.utils.Time; import voldemort.utils.Utils; import voldemort.versioning.Occured; @@ -96,7 +96,7 @@ public class RoutedStoreTest extends AbstractByteArrayStoreTest { public void setUp() throws Exception { super.setUp(); cluster = getNineNodeCluster(); - time = new MockTime(); + time = SystemTime.INSTANCE; } @Override
Using system time for unit test as mock time doesn't appear to be working.
voldemort_voldemort
train
java
06880236364874fba170679d2624f6891145b651
diff --git a/presto-main/src/main/java/com/facebook/presto/operator/TableWriterOperator.java b/presto-main/src/main/java/com/facebook/presto/operator/TableWriterOperator.java index <HASH>..<HASH> 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/TableWriterOperator.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/TableWriterOperator.java @@ -129,8 +129,7 @@ public class TableWriterOperator protected void doClose() { if (!closed.getAndSet(true)) { - checkState(!sourceIterator.hasNext(), "writer closed with source iterator still having data!"); - + checkState(operatorStats.isDone() || !sourceIterator.hasNext(), "Writer was closed while source iterator still has data and the operator is not done!"); commitFileHandle(fileHandle); sourceIterator.close(); output.set(ImmutableSet.of(new TableWriterResult(input.get().getShardId(), nodeIdentifier)));
Fix close exception in table writer. Only report a bad close (with sources still left) if it was not caused by the operatorStats declare the query done anyway.
prestodb_presto
train
java
f777a7522c7ed78afce73b06dd51d4b888a2cfb2
diff --git a/app/models/effective/effective_datatable/format.rb b/app/models/effective/effective_datatable/format.rb index <HASH>..<HASH> 100644 --- a/app/models/effective/effective_datatable/format.rb +++ b/app/models/effective/effective_datatable/format.rb @@ -113,12 +113,30 @@ module Effective # Takes all default resource actions # Applies data-remote to anything that's data-method post or delete + # Merges in any extra attributes when passed as a Hash def actions_col_actions(column) - if column[:inline] + actions = if column[:inline] resource.resource_actions.transform_values { |opts| opts['data-remote'] = true; opts } else resource.resource_actions.transform_values { |opts| opts['data-remote'] = true if opts['data-method']; opts } end + + # Merge local options. Special behaviour for remote: false + if column[:actions].kind_of?(Hash) + column[:actions].each do |action, opts| + next unless opts.kind_of?(Hash) + + existing = actions.find { |_, v| v[:action] == action }.first + next unless existing.present? + + actions[existing]['data-remote'] = opts[:remote] if opts.key?(:remote) + actions[existing]['data-remote'] = opts['remote'] if opts.key?('remote') + + actions[existing].merge!(opts.except(:remote, 'remote')) + end + end + + actions end def resource_col_locals(opts)
Pass a Hash of options to actions_col
code-and-effect_effective_datatables
train
rb
f661c79869dd34c017ef97eca7ec7a92b0f73947
diff --git a/lib/pm.js b/lib/pm.js index <HASH>..<HASH> 100644 --- a/lib/pm.js +++ b/lib/pm.js @@ -71,6 +71,14 @@ Pm.prototype.spawn = function(callback) { mkdirp(this.base); + try { + fs.truncateSync(this.logFile, 0); + } catch (er) { + // Ignore, probably the file doesn't exist, and other errors + // will be caught below when we open the file. + debug('truncate failed: %s', er.message); + } + var logFd = fs.openSync(this.logFile, 'a'); var options = { detached: true, @@ -79,8 +87,6 @@ Pm.prototype.spawn = function(callback) { debug('spawn: %s args %j options %j', process.execPath, args, options); - fs.ftruncateSync(logFd, 0); - self.child = spawn(process.execPath, args, options) .once('error', function(err) { debug('spawn error: %s', err);
pm: truncate start.log before opening Its more efficient to open once and truncate after, but Windows doesn't support this for files opened in append mode, and we don't really care what the order is.
strongloop_strong-start
train
js
74c6c1cfcefadcc48d2348c2c2a669a80fb45f22
diff --git a/lib/creek/sheet.rb b/lib/creek/sheet.rb index <HASH>..<HASH> 100644 --- a/lib/creek/sheet.rb +++ b/lib/creek/sheet.rb @@ -116,7 +116,8 @@ module Creek cell = node.attributes['r'] elsif (['v', 't'].include? node.name) and (node.node_type.eql? opener) unless cell.nil? - cells[(use_simple_rows_format ? cell.tr("0-9", "") : cell)] = convert(node.inner_xml, cell_type, cell_style_idx) + node.read + cells[(use_simple_rows_format ? cell.tr("0-9", "") : cell)] = convert(node.value, cell_type, cell_style_idx) end end end
Ampersand escaped test fixed (#<I>) * Failing test to show that ampersand gets escaped * Added working example for when xlsx file uses shared strings * Fix test by getting node value instead of inner_xml
pythonicrubyist_creek
train
rb
5b5bc9682a5c0260aa179656a7bdbf327dd75d42
diff --git a/test/relations/HtmlJsx.js b/test/relations/HtmlJsx.js index <HASH>..<HASH> 100644 --- a/test/relations/HtmlJsx.js +++ b/test/relations/HtmlJsx.js @@ -24,4 +24,24 @@ describe('relations/HtmlJsx', function () { }) .run(done); }); + + it('should attach relations with the correct content type', function (done) { + new AssetGraph({root: __dirname + '/../../testdata/relations/HtmlJsx/'}) + .loadAssets('index.html') + .populate() + .queue(function (assetGraph) { + var html = assetGraph.findAssets({ type: 'Html' })[0]; + var target = assetGraph.findAssets({ fileName: 'external.jsx' })[0]; + var relation = new AssetGraph.HtmlJsx({ + to: target + }); + + relation.attach(html, 'after', target.incomingRelations[0]); + + expect(relation.from, 'to be', html); + expect(relation.node, 'not to be undefined'); + expect(relation.node.getAttribute('type'), 'to be', target.contentType); + }) + .run(done); + }); });
Test attaching HtmlJsx relations
assetgraph_assetgraph
train
js
91dc57bb07d6bfd17af378fd6fccf353317cb06c
diff --git a/tests/test_scatter_series.py b/tests/test_scatter_series.py index <HASH>..<HASH> 100644 --- a/tests/test_scatter_series.py +++ b/tests/test_scatter_series.py @@ -13,3 +13,10 @@ class LineSeriesCreationTests(TestCase): def test_scatter_chart_uses_chart_initialisation(self, mock): series = ScatterSeries((1, 1), (2, 4), (3, 9)) self.assertTrue(mock.called) + + + def test_scatter_series_repr(self): + series = ScatterSeries((1, 1), (2, 4), (3, 9)) + self.assertEqual(str(series), "<ScatterSeries (3 data points)>") + series = ScatterSeries((1, 1), (2, 4), (3, 9), name="line") + self.assertEqual(str(series), "<ScatterSeries 'line' (3 data points)>")
Add check on ScatterSeries repr
samirelanduk_quickplots
train
py
0dae1a60c339de08f6748bf941098538fe0d00c1
diff --git a/gwpy/tests/test_plotter.py b/gwpy/tests/test_plotter.py index <HASH>..<HASH> 100644 --- a/gwpy/tests/test_plotter.py +++ b/gwpy/tests/test_plotter.py @@ -1055,7 +1055,7 @@ class TestHtml(object): fig = figure() ax = fig.gca() line = ax.plot([1, 2, 3, 4, 5])[0] - data = zip(*line.get_data()) + data = list(zip(*line.get_data())) # create HTML map html = map_artist(line, 'test.png')
tests: fixed bug in testing for python3
gwpy_gwpy
train
py
e04586dc7c54fae28c6d98c7c4f67ad106e2ca57
diff --git a/test/rails_test_helper.rb b/test/rails_test_helper.rb index <HASH>..<HASH> 100644 --- a/test/rails_test_helper.rb +++ b/test/rails_test_helper.rb @@ -77,7 +77,7 @@ module Loofah end def self.gem_versions_for rails_version - mm = rails_version.canonical_segments[0,2].join(".") + mm = rails_version.segments[0,2].join(".") YAML.load_file(File.join(ARTIFACTS_DIR, "gem-versions.yml"))[mm] || {} end @@ -142,7 +142,7 @@ module Loofah VERSIONS.each do |version| safe_version = version.to_s.tr(".", "_") - short = version.canonical_segments.first(2).join(".") + short = version.segments.first(2).join(".") ruby_version = RAILS_TO_RUBY_VERSIONS[short] pipeline.write(<<~EOF) # test rails version #{version}
older versions of ruby don't have Gem::Version#canonical_segments
flavorjones_loofah-activerecord
train
rb
22177bfc3b8872e7162bf0d019764e829fe6eb71
diff --git a/pysparkling/fileio/codec/tar.py b/pysparkling/fileio/codec/tar.py index <HASH>..<HASH> 100644 --- a/pysparkling/fileio/codec/tar.py +++ b/pysparkling/fileio/codec/tar.py @@ -32,6 +32,8 @@ class Tar(Codec): with tarfile.open(fileobj=stream, mode='r') as f: for tar_info in f.getmembers(): + if not tar_info.isfile(): + continue uncompressed.write(f.extractfile(tar_info).read()) uncompressed.seek(0) @@ -61,6 +63,8 @@ class TarGz(Codec): with tarfile.open(fileobj=stream, mode='r:gz') as f: for tar_info in f.getmembers(): + if not tar_info.isfile(): + continue uncompressed.write(f.extractfile(tar_info).read()) uncompressed.seek(0) @@ -90,6 +94,8 @@ class TarBz2(Codec): with tarfile.open(fileobj=stream, mode='r:bz2') as f: for tar_info in f.getmembers(): + if not tar_info.isfile(): + continue uncompressed.write(f.extractfile(tar_info).read()) uncompressed.seek(0)
only read file objects (not directories, ...) from tar archives
svenkreiss_pysparkling
train
py
44133c06385fe0e3ce2835323373dbe6929f4541
diff --git a/router/routertest/router.go b/router/routertest/router.go index <HASH>..<HASH> 100644 --- a/router/routertest/router.go +++ b/router/routertest/router.go @@ -1,4 +1,4 @@ -// Copyright 2015 tsuru authors. All rights reserved. +// Copyright 2016 tsuru authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -49,6 +49,12 @@ func (r *fakeRouter) FailForIp(ip string) { r.failuresByIp[ip] = true } +func (r *fakeRouter) RemoveFailForIp(ip string) { + r.mutex.Lock() + defer r.mutex.Unlock() + delete(r.failuresByIp, ip) +} + func (r *fakeRouter) HasBackend(name string) bool { r.mutex.Lock() defer r.mutex.Unlock()
router/routertest: allow removing forced failures from test router
tsuru_tsuru
train
go
86eccd6627140926b0006fcd265de296850712ef
diff --git a/ta4j/src/main/java/eu/verdelhan/ta4j/Tick.java b/ta4j/src/main/java/eu/verdelhan/ta4j/Tick.java index <HASH>..<HASH> 100644 --- a/ta4j/src/main/java/eu/verdelhan/ta4j/Tick.java +++ b/ta4j/src/main/java/eu/verdelhan/ta4j/Tick.java @@ -287,14 +287,14 @@ public class Tick implements Serializable { * @return a human-friendly string of the end timestamp */ public String getDateName() { - return endTime.format(DateTimeFormatter.ISO_DATE); + return endTime.format(DateTimeFormatter.ISO_DATE_TIME); } /** * @return a even more human-friendly string of the end timestamp */ public String getSimpleDateName() { - return endTime.format(DateTimeFormatter.ISO_LOCAL_DATE); + return endTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); } /**
Change DateTimeFormatter.ISO_DATE to ISO_DATE_TIME - Change getDateName() DateTimeFormatter from "ISO_DATE" to "ISO_DATE_TIME" (because "date" AND "time" is needed) - Change getSimpleDateName() DateTimeFormatter from "ISO_LOCAL_DATE" to "ISO_LOCAL_DATE_TIME" (because "date" AND "time" is needed)
mdeverdelhan_ta4j-origins
train
java
2ffc440fef6c123ac335e6a8af1f144686a023bd
diff --git a/core/Access.php b/core/Access.php index <HASH>..<HASH> 100644 --- a/core/Access.php +++ b/core/Access.php @@ -727,6 +727,16 @@ class Access throw new NoAccessException($message); } + + /** + * Returns true if the current user is logged in or not. + * + * @return bool + */ + public function isUserLoggedIn() + { + return !empty($this->login); + } } /** diff --git a/core/FrontController.php b/core/FrontController.php index <HASH>..<HASH> 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -392,6 +392,7 @@ class FrontController extends Singleton $loggedIn = false; + // don't use sessionauth in cli mode // try authenticating w/ session first... $sessionAuth = $this->makeSessionAuthenticator(); if ($sessionAuth) { @@ -647,6 +648,10 @@ class FrontController extends Singleton private function makeSessionAuthenticator() { + if (Common::isPhpClimode()) { // don't use the session auth during CLI requests + return null; + } + $module = Common::getRequestVar('module', self::DEFAULT_MODULE, 'string'); $action = Common::getRequestVar('action', false);
Do not initiate auth instance if a user is already logged in in FrontController::init() (#<I>)
matomo-org_matomo
train
php,php
3fa3f2b2a164698a22eecdb52c7ef6eb7e781c26
diff --git a/workshift/views.py b/workshift/views.py index <HASH>..<HASH> 100644 --- a/workshift/views.py +++ b/workshift/views.py @@ -86,6 +86,14 @@ def add_workshift_context(request): date__gte=date.today(), date__lte=date.today() + timedelta(days=2), ) + # TODO: Add a fudge factor of an hour to this? + happening_now = [ + shift.week_long or + not shift.start_time or + not shift.end_time or + (now > shift.start_time and now < shift.end_time) + for shift in upcoming_shifts + ] return { 'SEMESTER': SEMESTER, 'CURRENT_SEMESTER': CURRENT_SEMESTER, @@ -93,7 +101,7 @@ def add_workshift_context(request): 'days_passed': days_passed, 'total_days': total_days, 'semester_percent': semester_percent, - 'upcoming_shifts': upcoming_shifts, + 'upcoming_shifts': zip(upcoming_shifts, happening_now), } @workshift_manager_required
Zip together upcoming shifts with info about which ones are happening now
knagra_farnsworth
train
py
b29c15dfc85dda362bace6f67a26136403e57bce
diff --git a/docs/assets/js/vendor/Blob.js b/docs/assets/js/vendor/Blob.js index <HASH>..<HASH> 100644 --- a/docs/assets/js/vendor/Blob.js +++ b/docs/assets/js/vendor/Blob.js @@ -189,9 +189,23 @@ var builder = new BlobBuilder(); if (blobParts) { for (var i = 0, len = blobParts.length; i < len; i++) { - builder.append(blobParts[i]); + if (Uint8Array && blobParts[i] instanceof Uint8Array) { + builder.append(blobParts[i].buffer); + } + else { + builder.append(blobParts[i]); + } } } - return builder.getBlob(type); + var blob = builder.getBlob(type); + if (!blob.slice && blob.webkitSlice) { + blob.slice = blob.webkitSlice; + } + return blob; + }; + + var getPrototypeOf = Object.getPrototypeOf || function(object) { + return object.__proto__; }; + view.Blob.prototype = getPrototypeOf(new view.Blob()); }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
Update Blob.js to <I>-<I>-<I>. [ci skip]
twbs_bootstrap
train
js
5e99f9b52580fb7a094fb9f0ac5c377e83fbc0a4
diff --git a/labm8/py/humanize.py b/labm8/py/humanize.py index <HASH>..<HASH> 100644 --- a/labm8/py/humanize.py +++ b/labm8/py/humanize.py @@ -225,7 +225,7 @@ def DecimalPrefix( DecimalScale, min_scale=min_scale, max_scale=max_scale, - ) + ).rstrip() def BinaryPrefix(quantity, unit, precision=1, separator=" "): @@ -285,7 +285,8 @@ def _Prefix(quantity, unit, precision, separator, scale_callable, **args): 0, (precision - int(math.log(abs(scaled_quantity), 10)) - 1), ) - return print_pattern % (scaled_quantity, separator, scaled_unit) + string = print_pattern % (scaled_quantity, separator, scaled_unit) + return string.rstrip() # Prefixes and corresponding min_scale and max_scale for decimal formating.
Strip trailing whitespace when no quantity is provided. github.com/ChrisCummins/phd/issues/<I>
ChrisCummins_labm8
train
py
cb93b64f5f0ad81f5c8db9d666c43491d69ddaa6
diff --git a/cdk-morphlines/cdk-morphlines-saxon/src/test/java/com/cloudera/cdk/morphline/saxon/TagsoupMorphlineTest.java b/cdk-morphlines/cdk-morphlines-saxon/src/test/java/com/cloudera/cdk/morphline/saxon/TagsoupMorphlineTest.java index <HASH>..<HASH> 100644 --- a/cdk-morphlines/cdk-morphlines-saxon/src/test/java/com/cloudera/cdk/morphline/saxon/TagsoupMorphlineTest.java +++ b/cdk-morphlines/cdk-morphlines-saxon/src/test/java/com/cloudera/cdk/morphline/saxon/TagsoupMorphlineTest.java @@ -74,7 +74,7 @@ public class TagsoupMorphlineTest extends AbstractMorphlineTest { @Test public void testConvertHTMLAndExtractLinks() throws Exception { - morphline = createMorphline("test-morphlines/convertHTMLAndExtractLinks"); + morphline = createMorphline("test-morphlines/convertHTMLandExtractLinks"); InputStream in = new FileInputStream(new File(RESOURCES_DIR + "/test-documents/helloworld.html")); Record record = new Record(); record.put("id", "123");
fix test for case-sensitive file systems
kite-sdk_kite
train
java
10eb155c296164b0ac826a848ac6c87dc3264eba
diff --git a/tests/TestCase/Routing/RouterTest.php b/tests/TestCase/Routing/RouterTest.php index <HASH>..<HASH> 100644 --- a/tests/TestCase/Routing/RouterTest.php +++ b/tests/TestCase/Routing/RouterTest.php @@ -98,6 +98,29 @@ class RouterTest extends TestCase } /** + * Test that Router used the correct url including base path for requesting current actions. + * + * @return void + */ + public function testCurrentUrlWithBasePath() + { + Router::fullBaseUrl('http://example.com'); + $request = new Request(); + $request->addParams([ + 'action' => 'view', + 'plugin' => null, + 'controller' => 'pages', + 'pass' => ['1'] + ]); + $request->base = '/cakephp'; + $request->here = '/cakephp/pages/view/1'; + Router::setRequestInfo($request); + $this->assertEquals('http://example.com/cakephp/pages/view/1', Router::url(null, true)); + $this->assertEquals('/cakephp/pages/view/1', Router::url()); + + } + + /** * testRouteDefaultParams method * * @return void
Test for current full url with a base path.
cakephp_cakephp
train
php
6526e70998ded59b05555789f66f0052ddac12c8
diff --git a/modules/components/Routes.js b/modules/components/Routes.js index <HASH>..<HASH> 100644 --- a/modules/components/Routes.js +++ b/modules/components/Routes.js @@ -26,8 +26,7 @@ var REF_NAME = '__activeRoute__'; var NAMED_LOCATIONS = { hash: HashLocation, history: HistoryLocation, - refresh: RefreshLocation, - disabled: RefreshLocation // TODO: Remove + refresh: RefreshLocation }; /**
[removed] location="disabled"
taion_rrtr
train
js
840014b8b7b488af2204b4c342f31be08906e629
diff --git a/src/models/TariffProfile.php b/src/models/TariffProfile.php index <HASH>..<HASH> 100644 --- a/src/models/TariffProfile.php +++ b/src/models/TariffProfile.php @@ -44,7 +44,7 @@ class TariffProfile extends \hipanel\base\Model [['id'], 'required', 'on' => ['update', 'delete']], [['tariff_names'], 'safe'], [['seller_id', 'client_id'], 'integer'], - [['seller', 'client'], 'safe'], + [['seller', 'client', 'items'], 'safe'], [['tariffs'], 'safe'], ]; @@ -99,4 +99,14 @@ class TariffProfile extends \hipanel\base\Model { return (bool) ((string) $this->id === (string) $this->client_id); } + + /** + * Human readable title + * + * @return string + */ + public function getTitle(): string + { + return $this->isDefault() ? Yii::t('hipanel.finance.tariffprofile', 'Default') : $this->name; + } }
Added helper method TariffProfile::getTitle()
hiqdev_hipanel-module-finance
train
php
54069d64dc68099585c094b54e2f9e439c0597f7
diff --git a/app/libraries/Setups/HTML5.php b/app/libraries/Setups/HTML5.php index <HASH>..<HASH> 100644 --- a/app/libraries/Setups/HTML5.php +++ b/app/libraries/Setups/HTML5.php @@ -33,7 +33,7 @@ final class HTML5 extends AbstractSetup { \add_action('after_setup_theme', [$this, 'addSupport']); \add_filter('language_attributes', [$this, 'addMicrodata']); - \add_action('wp_kses_allowed_html', [$this, 'ksesWhitelist'], 10, 2); + \add_filter('wp_kses_allowed_html', [$this, 'ksesWhitelist'], 10, 2); } /** @@ -87,7 +87,7 @@ final class HTML5 extends AbstractSetup $output .= 'ProfilePage'; } elseif ($page->is('search')) { $output .= 'SearchResultsPage'; - } elseif ($page->is('singular', 'post')) { + } elseif ($page->is('single')) { $output .= 'BlogPosting'; } else { $output .= 'WebPage';
Use `add_filter` (instead of `add_action`) for `wp_kses_allowed_html` filter
GrottoPress_jentil
train
php
a0ed48544203caec12ec7f5e15f215bc795d69fa
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ from setuptools import setup, find_packages - setup( name='freezegun', version='0.0.6', @@ -11,6 +10,6 @@ setup( author_email='spulec@gmail', url='https://github.com/spulec/freezegun', packages=find_packages(), - install_requires=['python-dateutil==1.5'], + install_requires=['python-dateutil>=1.0, <2.0'], include_package_data=True, -) \ No newline at end of file +)
More relaxes requirements for dateutil
spulec_freezegun
train
py
943f0f804f80001b68aa52f12e495c56b90c9829
diff --git a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java +++ b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java @@ -759,6 +759,27 @@ public abstract class WebDriverManager { } } + public synchronized void stopDockerRecording() { + webDriverList.stream().forEach(this::stopDockerRecording); + } + + public synchronized void stopDockerRecording(WebDriver driver) { + Optional<WebDriverBrowser> webDriverBrowser = findWebDriverBrowser( + driver); + if (webDriverBrowser.isPresent()) { + stopDockerRecording(webDriverBrowser.get()); + } + } + + protected synchronized void stopDockerRecording( + WebDriverBrowser driverBrowser) { + List<DockerContainer> dockerContainerList = driverBrowser + .getDockerContainerList(); + DockerContainer recorderContainer = dockerContainerList.get(0); + dockerService.stopAndRemoveContainer(recorderContainer); + dockerContainerList.remove(0); + } + protected synchronized void quit(WebDriverBrowser driverBrowser) { try { WebDriver driver = driverBrowser.getDriver();
Include API method for stop Docker recording
bonigarcia_webdrivermanager
train
java
4d4eaa0601088322f8262d0f1d55f58a5d84fcd0
diff --git a/lib/turbo-sprockets/railtie.rb b/lib/turbo-sprockets/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/turbo-sprockets/railtie.rb +++ b/lib/turbo-sprockets/railtie.rb @@ -21,7 +21,8 @@ module TurboSprockets if File.exist?(manifest_path) manifest = YAML.load_file(manifest_path) - config.assets.digest_files = manifest[:digest_files] || {} + # Set both digest keys for backwards compatibility + config.assets.digests = config.assets.digest_files = manifest[:digest_files] || {} config.assets.source_digests = manifest[:source_digests] || {} end end
Set both digest keys for backwards compatibility
ndbroadbent_turbo-sprockets-rails3
train
rb
af0968c83a0efa801db5f0f1c2c91494645b5e39
diff --git a/lib/brainstem/concerns/controller_param_management.rb b/lib/brainstem/concerns/controller_param_management.rb index <HASH>..<HASH> 100644 --- a/lib/brainstem/concerns/controller_param_management.rb +++ b/lib/brainstem/concerns/controller_param_management.rb @@ -9,13 +9,11 @@ module Brainstem extend ActiveSupport::Concern def brainstem_model_name - self.class.brainstem_model_name.to_s.presence || - controller_name.singularize + self.class.brainstem_model_name.to_s end def brainstem_plural_model_name - self.class.brainstem_plural_model_name.to_s.presence || - brainstem_model_name.pluralize + self.class.brainstem_plural_model_name.to_s end module ClassMethods
Remove extraneous default check in instance brainstem model name lookup.
mavenlink_brainstem
train
rb
b70ef6c35d3bc9415d53f14436d682fbd8c8120d
diff --git a/pycbc/events/events.py b/pycbc/events/events.py index <HASH>..<HASH> 100644 --- a/pycbc/events/events.py +++ b/pycbc/events/events.py @@ -63,7 +63,7 @@ def fc_cluster_over_window_fast(times, values, window_length): The reduced list of indices of the SNR values """ if window_length <= 0: - return times + return numpy.arange(len(times)) from scipy.weave import inline indices = numpy.zeros(len(times), dtype=int)
Fix small bug in clustering when window length = 0
gwastro_pycbc
train
py
045bb6f89dde4ceef962db6e0d969b6a7b700d30
diff --git a/src/mistclient/helpers.py b/src/mistclient/helpers.py index <HASH>..<HASH> 100644 --- a/src/mistclient/helpers.py +++ b/src/mistclient/helpers.py @@ -82,6 +82,8 @@ class RequestsHandler(object): def delete(self): data = {'job_id': self.job_id} if self.job_id else {} + if self.data: + data.update(json.loads(self.data)) resp = requests.delete(self.uri, json=data, headers=self.headers, timeout=self.timeout, verify=self.verify) return self.response(resp)
Allow passing a request body when calling HTTP DELETE This is required by the orchestration engine in order to denote the end of a running workflow
mistio_mist.client
train
py
251af423cd74b56bf02ce6ab0fc63c7fb34e6300
diff --git a/lib/moodlelib.php b/lib/moodlelib.php index <HASH>..<HASH> 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2459,6 +2459,15 @@ function remove_course_contents($courseid, $showfeedback=true) { error('No modules are installed!'); } + // Delete course blocks + if (delete_records('block_instance', 'pagetype', PAGE_COURSE_VIEW, 'pageid', $course->id)) { + if ($showfeedback) { + notify($strdeleted .' block_instance'); + } + } else { + $result = false; + } + // Delete any user stuff if (delete_records('user_students', 'course', $course->id)) {
Err... course block instances weren't being deleted along with the course?
moodle_moodle
train
php
715e6466f2d6bed64b7a2338b23f95c260da79e1
diff --git a/manifest.php b/manifest.php index <HASH>..<HASH> 100755 --- a/manifest.php +++ b/manifest.php @@ -27,7 +27,7 @@ return array( 'label' => 'Development Tools', 'description' => 'Developer tools that can assist you in creating new extensions, run scripts, destroy your install', 'license' => 'GPL-2.0', - 'version' => '2.6.1', + 'version' => '2.7.0', 'author' => 'Open Assessment Technologies', 'requires' => array( 'tao' => '>=2.7.0' diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index <HASH>..<HASH> 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -38,6 +38,9 @@ class Updater extends \common_ext_ExtensionUpdater { if ($currentVersion == '2.6') { $currentVersion = '2.6.1'; } + if ($currentVersion == '2.6.1') { + $currentVersion = '2.7.0'; + } return $currentVersion; } } \ No newline at end of file
increase extension version to <I>
oat-sa_extension-tao-devtools
train
php,php
4ff15243873fa1888fc3db920b99e825035237e5
diff --git a/librosa/util/decorators.py b/librosa/util/decorators.py index <HASH>..<HASH> 100644 --- a/librosa/util/decorators.py +++ b/librosa/util/decorators.py @@ -5,8 +5,10 @@ import warnings from decorator import decorator +from functools import wraps import six +__all__ = ['moved', 'deprecated', 'optional_jit'] def moved(moved_from, version, version_removed): '''This is a decorator which can be used to mark functions @@ -64,6 +66,18 @@ def deprecated(version, version_removed): try: from numba.decorators import jit as optional_jit except ImportError: + # Decorator with optional arguments borrowed from + # http://stackoverflow.com/a/10288927 + def magical_decorator(decorator): + @wraps(decorator) + def inner(*args, **kw): + if len(args) == 1 and not kw and callable(args[0]): + return decorator()(args[0]) + else: + return decorator(*args, **kw) + return inner + + @magical_decorator def optional_jit(*_, **__): def __wrapper(func, *args, **kwargs): return func(*args, **kwargs)
fixed #<I>, added support for no-argument optional_jit
librosa_librosa
train
py
3c6312a6fe8e84693aa0fa1f6a3ba1ea5378b692
diff --git a/core/src/test/java/org/infinispan/distribution/MagicKey.java b/core/src/test/java/org/infinispan/distribution/MagicKey.java index <HASH>..<HASH> 100644 --- a/core/src/test/java/org/infinispan/distribution/MagicKey.java +++ b/core/src/test/java/org/infinispan/distribution/MagicKey.java @@ -114,10 +114,6 @@ public class MagicKey implements Serializable { @Override public String toString() { - return "MagicKey{" + - (name == null ? "" : "name=" + name + ", ") + - "hashcode=" + hashcode + - ", address='" + address + '\'' + - '}'; + return "MagicKey#" + name + '{' + Integer.toHexString(hashcode) + '@' + address + '}'; } } \ No newline at end of file
Shorter toString() for MagicKey
infinispan_infinispan
train
java
37254ae5a06515278e773024bfe1390eb01c4311
diff --git a/headnode_notifier.py b/headnode_notifier.py index <HASH>..<HASH> 100755 --- a/headnode_notifier.py +++ b/headnode_notifier.py @@ -74,11 +74,13 @@ def main(): metavar = "", action = "store", dest = "subject", + default = "", help = "Message subject") parser.add_argument("--body", metavar = "", action = "store", dest = "body", + default = "", help = "Message body") parser.add_argument("--password-file", metavar = "",
ENH@argparse:Default vals as empty strings for subject and body
dizak_headnode_notifier
train
py
c7cd4ce8f479ded63d85dd2c75e6f9ebe3c1bc45
diff --git a/library/src/main/java/com/liulishuo/filedownloader/event/DownloadEventPoolImpl.java b/library/src/main/java/com/liulishuo/filedownloader/event/DownloadEventPoolImpl.java index <HASH>..<HASH> 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/event/DownloadEventPoolImpl.java +++ b/library/src/main/java/com/liulishuo/filedownloader/event/DownloadEventPoolImpl.java @@ -127,6 +127,8 @@ public class DownloadEventPoolImpl implements IDownloadEventPool { final Object[] lists = listeners.toArray(); for (Object o : lists) { + if (o == null) continue; // it has been removed while before listeners.toArray(). + if (((IDownloadListener) o).callback(event)) { break; }
fix(npe): fix the small probability npe crash when publish event when it has been removed on other thread Closes #<I>
lingochamp_FileDownloader
train
java
4e2fe30c934f9274c60981a90564298f22a1f6ba
diff --git a/lib/tty/prompt/timeout.rb b/lib/tty/prompt/timeout.rb index <HASH>..<HASH> 100644 --- a/lib/tty/prompt/timeout.rb +++ b/lib/tty/prompt/timeout.rb @@ -6,12 +6,10 @@ require 'timers' module TTY class Prompt class Timeout - Error = Class.new(RuntimeError) - - TIMEOUT_HANDLER = proc { |t| t.raise Error, 'timeout expired' } - + # A class responsible for measuring interval + # + # @api private def initialize(options = {}) - @timeout_handler = options.fetch(:timeout_handler) { TIMEOUT_HANDLER } @interval_handler = options.fetch(:interval_handler) { proc {} } @lock = Mutex.new @running = true
Change to remove timeout handler and error
piotrmurach_tty-prompt
train
rb
3b5ed4ff516d6b691b71abc07f0d45ac8d79e676
diff --git a/lib/node.js b/lib/node.js index <HASH>..<HASH> 100644 --- a/lib/node.js +++ b/lib/node.js @@ -24,14 +24,7 @@ var appendChild = function (parent, child) { } }; -var getIsCurrent = function () { - var node = this.tree.current; - while (node) { - if (node === this) return true; - node = node.parent; - } - return false; -}; +var getIsCurrent = function () { return this.isCurrent; }; var SiteNode = module.exports = function (conf, context, parent) { this.conf = conf; @@ -45,6 +38,14 @@ var SiteNode = module.exports = function (conf, context, parent) { Object.defineProperties(SiteNode.prototype, assign({ parent: d(null), + isCurrent: d.gs(function () { + var node = this.tree.current; + while (node) { + if (node === this) return true; + node = node.parent; + } + return false; + }), // Switches between parent and this node view, or other way _switch: d(function (after) {
refactor: expose isCurrent on view node
medikoo_site-tree
train
js
8046414415addf818523ce84c1bc753d1b4b2cff
diff --git a/ravel.py b/ravel.py index <HASH>..<HASH> 100644 --- a/ravel.py +++ b/ravel.py @@ -1145,6 +1145,16 @@ class Connection : else : removed_entry[interface] = {"at" : when} #end if + if self._props_changed != None : + props_key = (path, interface) + if self._props_changed != None and props_key in self._props_changed : + # cancel pending properties-changed notification + del self._props_changed[key] + if len(self._props_changed) == 0 : + self._props_changed = None + #end if + #end if + #end if obj_entry.remove(interface) #end for if len(obj_entry) == 0 :
Also cancel pending props-changed notifications for removed objects
ldo_dbussy
train
py
bb1c774bccd084248bf47338255d1d375949e40b
diff --git a/aiogram/contrib/fsm_storage/mongo.py b/aiogram/contrib/fsm_storage/mongo.py index <HASH>..<HASH> 100644 --- a/aiogram/contrib/fsm_storage/mongo.py +++ b/aiogram/contrib/fsm_storage/mongo.py @@ -50,7 +50,7 @@ class MongoStorage(BaseStorage): self._uri = uri self._username = username self._password = password - self._kwargs = kwargs + self._kwargs = kwargs # custom client options like SSL configuration, etc. self._mongo: Optional[AsyncIOMotorClient] = None self._db: Optional[AsyncIOMotorDatabase] = None @@ -63,7 +63,7 @@ class MongoStorage(BaseStorage): if self._uri: try: - self._mongo = AsyncIOMotorClient(self._uri) + self._mongo = AsyncIOMotorClient(self._uri, **self._kwargs) except pymongo.errors.ConfigurationError as e: if "query() got an unexpected keyword argument 'lifetime'" in e.args[0]: import logging
Add support for custom kwargs for AsyncIOMotorClient in MongoStorage (#<I>)
aiogram_aiogram
train
py
692b9af6ce797fd319b8775ba2819f184060b7a2
diff --git a/Command/ImportTranslationsCommand.php b/Command/ImportTranslationsCommand.php index <HASH>..<HASH> 100644 --- a/Command/ImportTranslationsCommand.php +++ b/Command/ImportTranslationsCommand.php @@ -91,7 +91,7 @@ class ImportTranslationsCommand extends ContainerAwareCommand $classes = array( 'Symfony\Component\Validator\Validator' => '/Resources/translations', 'Symfony\Component\Form\Form' => '/Resources/translations', - 'Symfony\Component\Security\Core\Exception\AuthenticationException' => '/../Resources/translations', + 'Symfony\Component\Security\Core\Exception\AuthenticationException' => '/../../Resources/translations', ); $dirs = array();
Fixed invalid resources path leading to Exception
lexik_LexikTranslationBundle
train
php
94014b71a91c02e92ef1c5e4709577c54074e6f6
diff --git a/ease/feature_extractor.py b/ease/feature_extractor.py index <HASH>..<HASH> 100644 --- a/ease/feature_extractor.py +++ b/ease/feature_extractor.py @@ -74,8 +74,8 @@ class FeatureExtractor(object): def get_good_pos_ngrams(self): """ - Gets a list of gramatically correct part of speech sequences from an input file called essaycorpus.txt - Returns the list and caches the file + Gets a set of gramatically correct part of speech sequences from an input file called essaycorpus.txt + Returns the set and caches the file """ if(os.path.isfile(NGRAM_PATH)): good_pos_ngrams = pickle.load(open(NGRAM_PATH, 'rb')) @@ -92,7 +92,7 @@ class FeatureExtractor(object): 'NNP .', 'NNP . TO', 'NNP . TO NNP', '. TO', '. TO NNP', '. TO NNP NNP', 'TO NNP', 'TO NNP NNP'] - return good_pos_ngrams + return set(good_pos_ngrams) def _get_grammar_errors(self,pos,text,tokens): """
Use a set instead of a list for good ngram lookup
edx_ease
train
py
324b51fa8c062944f9bcdc79ccd698e0764e202e
diff --git a/lib/compass.js b/lib/compass.js index <HASH>..<HASH> 100644 --- a/lib/compass.js +++ b/lib/compass.js @@ -71,6 +71,8 @@ module.exports = function(file, opts, callback) { // set compass setting if (opts.config_file) { options.push('-c', opts.config_file); + //Support for environment + if (opts.environment) { options.push("--environment", opts.environment); } } else { if (!opts.comments) { options.push('--no-line-comments'); } if (opts.relative) { options.push('--relative-assets'); }
Support for the environment property when using "config_file"
appleboy_gulp-compass
train
js
57b446fa0a8fd479452d9d6f3cd938ad15703456
diff --git a/src/ol/source/imagetilesource.js b/src/ol/source/imagetilesource.js index <HASH>..<HASH> 100644 --- a/src/ol/source/imagetilesource.js +++ b/src/ol/source/imagetilesource.js @@ -109,3 +109,14 @@ ol.source.ImageTileSource.prototype.getTile = function(tileCoord) { ol.source.ImageTileSource.prototype.getTileCoordUrl = function(tileCoord) { return this.tileUrlFunction(tileCoord); }; + + +/** + * @inheritDoc + */ +ol.source.ImageTileSource.prototype.useTile = function(tileCoord) { + var key = tileCoord.toString(); + if (this.tileCache_.containsKey(key)) { + this.tileCache_.get(key); + } +};
Implement useTile for image tile sources with caches
openlayers_openlayers
train
js
cf263c090662657528d6e6cf993c4fbf7c9c0016
diff --git a/apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/ApolloExtension.java b/apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/ApolloExtension.java index <HASH>..<HASH> 100644 --- a/apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/ApolloExtension.java +++ b/apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/ApolloExtension.java @@ -51,7 +51,7 @@ public class ApolloExtension { return generateModelBuilder; } - public void generateModelBuilder(boolean generateModelBuilder) { + public void setGenerateModelBuilder(boolean generateModelBuilder) { this.generateModelBuilder = generateModelBuilder; }
make generateModelBuilder read-write (#<I>)
apollographql_apollo-android
train
java
cff2ebdea289c35d9c0a004a820937cf476686a6
diff --git a/src/Charcoal/Cms/Service/Loader/SectionLoader.php b/src/Charcoal/Cms/Service/Loader/SectionLoader.php index <HASH>..<HASH> 100644 --- a/src/Charcoal/Cms/Service/Loader/SectionLoader.php +++ b/src/Charcoal/Cms/Service/Loader/SectionLoader.php @@ -140,6 +140,7 @@ class SectionLoader extends AbstractLoader $q = 'SELECT * FROM `'.$proto->source()->table().'` WHERE active=1 AND ( ' . implode(' OR ', $filters) . ' ) + AND `route_options_ident` IS NULL ORDER BY creation_date ASC'; $objectRoutes = $loader->loadFromQuery($q);
Update sectionLoader to not load routes with route options ident
locomotivemtl_charcoal-cms
train
php
be6d974840b8f59624c6f6ed0dcfa8a2e7c791af
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index <HASH>..<HASH> 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -168,7 +168,7 @@ module Axlsx # @see Axlsx#date1904 def cast_value(v) if (@type == :time && v.is_a?(Time)) || (@type == :time && v.respond_to?(:to_time)) - v = v.to_time + v = v.respond_to?(:to_time) ? v.to_time : v epoc = Workbook.date1904 ? Time.local(1904,1,1,0,0,0,0,v.zone) : Time.local(1900,1,1,0,0,0,0,v.zone) ((v - epoc) /60.0/60.0/24.0).to_f elsif @type == :float
patch for <I> lack of to_time support on Time
randym_axlsx
train
rb
e8a72f0018f28379bf832e7c891394be67fbc1f6
diff --git a/src/JsonSchema/Constraints/Undefined.php b/src/JsonSchema/Constraints/Undefined.php index <HASH>..<HASH> 100644 --- a/src/JsonSchema/Constraints/Undefined.php +++ b/src/JsonSchema/Constraints/Undefined.php @@ -117,14 +117,15 @@ class Undefined extends Constraint // Verify required values if (is_object($value)) { - if (isset($schema->required) && is_array($schema->required) ) { + + if (!($value instanceof Undefined) && isset($schema->required) && is_array($schema->required) ) { // Draft 4 - Required is an array of strings - e.g. "required": ["foo", ...] foreach ($schema->required as $required) { if (!property_exists($value, $required)) { $this->addError($path, "the property " . $required . " is required"); } } - } else if (isset($schema->required)) { + } else if (isset($schema->required) && !is_array($schema->required)) { // Draft 3 - Required attribute - e.g. "foo": {"type": "string", "required": true} if ( $schema->required && $value instanceof Undefined) { $this->addError($path, "is missing and it is required");
dont validate draft4 required attribute when value is undefined - fixes regression introduced by <I>b2
justinrainbow_json-schema
train
php
24bc17eaa19ab5dbac87901f29e616f59ef83c50
diff --git a/command/agent/local_test.go b/command/agent/local_test.go index <HASH>..<HASH> 100644 --- a/command/agent/local_test.go +++ b/command/agent/local_test.go @@ -664,6 +664,29 @@ func TestAgent_checkTokens(t *testing.T) { } } +func TestAgent_nestedPauseResume(t *testing.T) { + l := new(localState) + if l.isPaused() != false { + t.Fatal("localState should be unPaused after init") + } + l.Pause() + if l.isPaused() != true { + t.Fatal("localState should be Paused after first call to Pause()") + } + l.Pause() + if l.isPaused() != true { + t.Fatal("localState should STILL be Paused after second call to Pause()") + } + l.Resume() + if l.isPaused() != true { + t.Fatal("localState should STILL be Paused after FIRST call to Resume()") + } + l.Resume() + if l.isPaused() != false { + t.Fatal("localState should NOT be Paused after SECOND call to Resume()") + } +} + var testRegisterRules = ` service "api" { policy = "write"
failing test showing that nested Pause()/Resume() release too early see: #<I> / <URL>
hashicorp_consul
train
go
29c290322cbd3b6fc304d9336de01f12c9269015
diff --git a/lib/util.js b/lib/util.js index <HASH>..<HASH> 100644 --- a/lib/util.js +++ b/lib/util.js @@ -476,7 +476,7 @@ var util = { } else if (callback && data.slice === 'function' && !isBuffer && typeof FileReader !== 'undefined') { // this might be a File/Blob - var index = 0, size = 1024 * 1024; + var index = 0, size = 1024 * 512; var reader = new FileReader(); reader.onerror = function() { callback(new Error('Failed to read data.'));
Reduce chunk size to <I>kb
aws_aws-sdk-js
train
js
fd275e1eedfb423d916965c204a6f3a250fa847c
diff --git a/alignak/version.py b/alignak/version.py index <HASH>..<HASH> 100644 --- a/alignak/version.py +++ b/alignak/version.py @@ -2,4 +2,4 @@ This module provide Alignak current version """ -VERSION = "1.1.0rc9" +VERSION = "2.0.0rc1"
Set version as <I> rc1
Alignak-monitoring_alignak
train
py
adeec5dc3a83b446489d56e27f6743b96354dd8c
diff --git a/testsrc/org/mozilla/javascript/tests/Evaluator.java b/testsrc/org/mozilla/javascript/tests/Evaluator.java index <HASH>..<HASH> 100644 --- a/testsrc/org/mozilla/javascript/tests/Evaluator.java +++ b/testsrc/org/mozilla/javascript/tests/Evaluator.java @@ -18,10 +18,10 @@ public class Evaluator { try { Scriptable scope = cx.initStandardObjects(); if (bindings != null) { - for (String id : bindings.keySet()) { - Scriptable object = bindings.get(id); + for (Map.Entry<String, Scriptable> entry : bindings.entrySet()) { + final Scriptable object = entry.getValue(); object.setParentScope(scope); - scope.put(id, scope, object); + scope.put(entry.getKey(), scope, object); } } return cx.evaluateString(scope, source, "source", 1, null);
FindBugs: use entrySet() instead of keySet() with get()
mozilla_rhino
train
java
465c032ea109e99d95ec4cc79f601ba5dc55a5da
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,8 @@ setup( "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3",
Updated setup.py with more relevant classifiers
svisser_ipuz
train
py
814bf0fcfb622dcb48301f76b4642c25d42bd50d
diff --git a/test/tests/helpers.js b/test/tests/helpers.js index <HASH>..<HASH> 100644 --- a/test/tests/helpers.js +++ b/test/tests/helpers.js @@ -43,6 +43,19 @@ buster.testCase('FruitMachine#helpers()', { assert.called(this.spys.destroy); }, + "Should be able to pass functions into `helpers` array if helper hasn't been defined": function() { + var spy = this.spy(); + var view = new helpers.Apple({ + helpers: [ + function(view) { + view.on('initialize', spy); + } + ] + }); + + assert.called(spy); + }, + tearDown: function() { this.view.destroy();
Added test for helpers as functions
ftlabs_fruitmachine
train
js
f7b5af8e3815ee0fa89d5c732a4956aa8c42c422
diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/commands/release/changelog.py b/datadog_checks_dev/datadog_checks/dev/tooling/commands/release/changelog.py index <HASH>..<HASH> 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/commands/release/changelog.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/commands/release/changelog.py @@ -121,7 +121,8 @@ def changelog( thanks_note = '' if entry.from_contributor: thanks_note = f' Thanks [{entry.author}]({entry.author_url}).' - new_entry.write(f'* {entry.title}. See [#{entry.number}]({entry.url}).{thanks_note}\n') + title_period = "." if not entry.title.endswith(".") else "" + new_entry.write(f'* {entry.title}{title_period} See [#{entry.number}]({entry.url}).{thanks_note}\n') new_entry.write('\n') # read the old contents
Avoid double periods at the end of PR titles (#<I>)
DataDog_integrations-core
train
py
1a103e74216689e6b26582e1cf09fb88886759af
diff --git a/parser/parser.go b/parser/parser.go index <HASH>..<HASH> 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -24,7 +24,9 @@ const ( ) var parserFree = sync.Pool{ - New: func() interface{} { return &parser{} }, + New: func() interface{} { + return &parser{helperBuf: new(bytes.Buffer)} + }, } // Parse reads and parses a shell program with an optional name. It @@ -76,11 +78,7 @@ type parser struct { } func (p *parser) unquotedWordBytes(w ast.Word) ([]byte, bool) { - if p.helperBuf == nil { - p.helperBuf = new(bytes.Buffer) - } else { - p.helperBuf.Reset() - } + p.helperBuf.Reset() didUnquote := false for _, wp := range w.Parts { if p.unquotedWordPart(p.helperBuf, wp) {
parser: always allocate a helper buffer Since we're reusing the parser objects, allocating right before it's actually used means unnoticeable gain in any non-trivial use case.
mvdan_sh
train
go
eb9868ca4b6ec0918366c6c72a0e6bed86d3bd89
diff --git a/searchableselect/widgets.py b/searchableselect/widgets.py index <HASH>..<HASH> 100644 --- a/searchableselect/widgets.py +++ b/searchableselect/widgets.py @@ -35,7 +35,7 @@ class SearchableSelect(forms.CheckboxSelectMultiple): self.model = kwargs.pop('model') self.search_field = kwargs.pop('search_field') self.many = kwargs.pop('many', True) - self.limit = kwargs.pop('limit', 10) + self.limit = int(kwargs.pop('limit', 10)) super(SearchableSelect, self).__init__(*args, **kwargs)
issue #5 fix unorderable types: str() >= int() with limit
and3rson_django-searchable-select
train
py
3efa8ab5965db3fc97db72500cb1bc2ea2594f17
diff --git a/tests/TestCase.php b/tests/TestCase.php index <HASH>..<HASH> 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -61,6 +61,8 @@ class TestCase extends BaseTest $this->assertTrue($modifiedFileSize < $originalFileSize, "File {$modifiedFilePath} as size {$modifiedFileSize} which is not less than {$originalFileSize}. Log: {$this->log->getAllLinesAsString()}" ); + + $this->assertTrue($modifiedFileSize > 0, "File {$modifiedFilePath} had a filesize of zero. Something must have gone wrong..."); } public function assertOptimizersUsed($optimizerClasses)
add non zero filesize test, just to be sure
spatie_image-optimizer
train
php
3456f59bb699d0bff44ebe25b057c2b25c407352
diff --git a/src/Kris/LaravelFormBuilder/Form.php b/src/Kris/LaravelFormBuilder/Form.php index <HASH>..<HASH> 100644 --- a/src/Kris/LaravelFormBuilder/Form.php +++ b/src/Kris/LaravelFormBuilder/Form.php @@ -299,10 +299,9 @@ class Form { if ($this->has($name)) { unset($this->fields[$name]); - return $this; } - $this->fieldDoesNotExist($name); + return $this; } /** diff --git a/tests/FormTest.php b/tests/FormTest.php index <HASH>..<HASH> 100644 --- a/tests/FormTest.php +++ b/tests/FormTest.php @@ -287,17 +287,6 @@ class FormTest extends FormBuilderTestCase * @test * @expectedException \InvalidArgumentException */ - public function it_throws_exception_when_removing_nonexisting_field() - { - $this->plainForm->add('name', 'text'); - - $this->plainForm->remove('nonexisting'); - } - - /** - * @test - * @expectedException \InvalidArgumentException - */ public function it_throws_exception_when_rendering_until_nonexisting_field() { $this->plainForm
Avoid exceptions on non-existing fields as discussed in #<I> (also removed this test)
kristijanhusak_laravel-form-builder
train
php,php
62ea61d1fb859bea8c10e5f39c723912643b57f7
diff --git a/Socks/Client.php b/Socks/Client.php index <HASH>..<HASH> 100644 --- a/Socks/Client.php +++ b/Socks/Client.php @@ -116,7 +116,8 @@ class Client implements ConnectionManagerInterface private function resolve($host) { - if ($this->protocolVersion !== '4' && (!$this->resolveLocal || false !== filter_var($host, FILTER_VALIDATE_IP))) { + // return if it's already an IP or we want to resolve remotely (socks 4 only supports resolving locally) + if (false !== filter_var($host, FILTER_VALIDATE_IP) || ($this->protocolVersion !== '4' && !$this->resolveLocal)) { return When::resolve($host); }
Fix logic for resolving target hostname locally/remotely
clue_php-socks
train
php
ebe65eaadcf6e320530a2c37755f56d6545b1c2b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ setup( 'isodate>=0.5.0', 'xmlsec>=0.2.1' ], + dependency_links=['http://github.com/bgaifullin/python-xmlsec/tarball/master'], extras_require={ 'test': ( 'coverage==3.7.1',
added dependency link to xmlsec
onelogin_python3-saml
train
py
0d836289691d8c5f4ce2bd37b458a772a079dc58
diff --git a/src/Expander.php b/src/Expander.php index <HASH>..<HASH> 100644 --- a/src/Expander.php +++ b/src/Expander.php @@ -277,9 +277,12 @@ class Expander implements LoggerAwareInterface if (str_starts_with($property_name, "env.") && !$data->has($property_name)) { $env_key = substr($property_name, 4); - if (isset($_SERVER[$env_key])) { - $data->set($property_name, $_SERVER[$env_key]); - } + if (isset($_SERVER[$env_key])) { + $data->set($property_name, $_SERVER[$env_key]); + } + elseif (getenv($env_key)) { + $data->set($property_name, getenv($env_key)); + } } if (!$data->has($property_name)) {
Use both $_SERVER and getenv() when checking for env vars.
grasmash_expander
train
php
33c5dec40431a58b0a3a367787bd87ddf30f0955
diff --git a/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js b/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js index <HASH>..<HASH> 100755 --- a/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js +++ b/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js @@ -531,6 +531,7 @@ }, _deleteHandler: function (e) { + if (confirm('Are you sure?')) { e.preventDefault(); var button = $(e.currentTarget); this._trigger('destroy', e, { @@ -539,6 +540,7 @@ type: button.attr('data-type') || 'DELETE', dataType: this.options.dataType }); + } }, _forceReflow: function (node) {
Making the delete functionality give a javascript confirm dialog prior to executing.
batter_s3_cors_fileupload
train
js
3f280b8622561ecb3147ddea9e9a5f214cd2a670
diff --git a/salt/version.py b/salt/version.py index <HASH>..<HASH> 100644 --- a/salt/version.py +++ b/salt/version.py @@ -57,8 +57,8 @@ class SaltStackVersion(object): 'Hydrogen': (sys.maxint - 108, 0, 0, 0), 'Helium': (sys.maxint - 107, 0, 0, 0), 'Lithium': (sys.maxint - 106, 0, 0, 0), - #'Beryllium' : (sys.maxint - 105, 0, 0, 0), - #'Boron' : (sys.maxint - 104, 0, 0, 0), + 'Beryllium' : (sys.maxint - 105, 0, 0, 0), + 'Boron' : (sys.maxint - 104, 0, 0, 0), #'Carbon' : (sys.maxint - 103, 0, 0, 0), #'Nitrogen' : (sys.maxint - 102, 0, 0, 0), #'Oxygen' : (sys.maxint - 101, 0, 0, 0),
We will start deprecating until Boron.
saltstack_salt
train
py
11143867559cfa3f51314cddeafa7677572a487a
diff --git a/packages/generators/yeoman-create-component/generators/component/index.js b/packages/generators/yeoman-create-component/generators/component/index.js index <HASH>..<HASH> 100644 --- a/packages/generators/yeoman-create-component/generators/component/index.js +++ b/packages/generators/yeoman-create-component/generators/component/index.js @@ -74,6 +74,7 @@ module.exports = class extends Generator { this.gitInfo.email = 'test@example.org'; this.gitInfo.github = ''; this.boltVersion = '0.0.0'; + this.boltCoreVersion = '0.0.0'; } }
DS-<I>: update generator test to include test boltCoreVersion number
bolt-design-system_bolt
train
js
c81e6995f0d85f348a5f95bc66e4b308ba7da2d0
diff --git a/net/httputil/httputil.go b/net/httputil/httputil.go index <HASH>..<HASH> 100644 --- a/net/httputil/httputil.go +++ b/net/httputil/httputil.go @@ -7,7 +7,7 @@ import ( "os" ) -func GetStore(url string, filepath string, perm os.FileMode) error { +func GetWriteFile(url string, filepath string, perm os.FileMode) error { resp, err := http.Get(url) if err != nil { return err
rename method to httputil.GetWriteFile()
grokify_gotilla
train
go
055241501c4f3f234d12b261f91349f6a725b30d
diff --git a/suspect/basis/__init__.py b/suspect/basis/__init__.py index <HASH>..<HASH> 100644 --- a/suspect/basis/__init__.py +++ b/suspect/basis/__init__.py @@ -2,7 +2,7 @@ import numpy def gaussian(time_axis, frequency, phase, fwhm): - oscillatory_term = numpy.exp(2j * numpy.pi * (frequency * time_axis + phase)) + oscillatory_term = numpy.exp(2j * numpy.pi * (frequency * time_axis) + 1j * phase) damping = numpy.exp(-time_axis ** 2 / 4 * numpy.pi ** 2 / numpy.log(2) * fwhm ** 2) fid = oscillatory_term * damping fid[0] /= 2.0
adjust Gaussian generation to take phase in radians
bennyrowland_suspect
train
py
81bbee77c96eabaadab7469b7bf302d99b88ec98
diff --git a/lib/starscope/langs/javascript.rb b/lib/starscope/langs/javascript.rb index <HASH>..<HASH> 100644 --- a/lib/starscope/langs/javascript.rb +++ b/lib/starscope/langs/javascript.rb @@ -12,12 +12,15 @@ module Starscope::Lang def self.extract(path, contents, &block) transform = Babel::Transpiler.transform(contents, - 'optional' => ['es7.functionBind', 'es7.decorators'], + 'stage' => 0, + 'blacklist' => ['validation.react'], 'externalHelpers' => true, 'compact' => false, 'sourceMaps' => true) map = SourceMap::Map.from_hash(transform['map']) ast = RKelly::Parser.new.parse(transform['code']) + return unless ast + lines = contents.lines.to_a found = {}
Adjust babel js options again also skip entirely empty empty js files
eapache_starscope
train
rb
2414f67a656a29eb0159defc2e56de53f7ec3ae8
diff --git a/src/sap.ui.integration/src/sap/ui/integration/widgets/Card.js b/src/sap.ui.integration/src/sap/ui/integration/widgets/Card.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.integration/src/sap/ui/integration/widgets/Card.js +++ b/src/sap.ui.integration/src/sap/ui/integration/widgets/Card.js @@ -1070,6 +1070,7 @@ sap.ui.define([ /** * Resolves the destination and returns its URL. + * @public * @param {string} sKey The destination's key used in the configuration. * @returns {Promise} A promise which resolves with the URL of the destination. */
[INTERNAL] Integration Cards: Fix documentation for resolveDestination The method resolveDestination is public and is included in the card facade, but the @public tag was missing. Change-Id: I9faef<I>e8be4b<I>f<I>a6c<I>b<I>d<I>a<I>a
SAP_openui5
train
js
ad8face0b31ccd179f5feefe59298d84cea8b878
diff --git a/neurom/analysis/morphtree.py b/neurom/analysis/morphtree.py index <HASH>..<HASH> 100644 --- a/neurom/analysis/morphtree.py +++ b/neurom/analysis/morphtree.py @@ -87,8 +87,6 @@ def find_tree_type(tree): tree.type = tree_types[int(np.median(types))] - return tree - def get_tree_type(tree): @@ -99,7 +97,7 @@ def get_tree_type(tree): """ if not hasattr(tree, 'type'): - tree = find_tree_type(tree) + find_tree_type(tree) return tree.type diff --git a/neurom/analysis/tests/test_morphtree.py b/neurom/analysis/tests/test_morphtree.py index <HASH>..<HASH> 100644 --- a/neurom/analysis/tests/test_morphtree.py +++ b/neurom/analysis/tests/test_morphtree.py @@ -126,7 +126,7 @@ def test_get_tree_type(): del test_tree.type # tree.type should be computed here. nt.ok_(get_tree_type(test_tree) == tree_types[en_tree]) - test_tree = find_tree_type(test_tree) + find_tree_type(test_tree) # tree.type should already exists here, from previous action. nt.ok_(get_tree_type(test_tree) == tree_types[en_tree])
Minor change in morphtree find_tree_type to make consistent with make_tree. Change-Id: I9d0f<I>d3b4a0eebac7c8dbb<I>e<I>e<I>a<I>ada
BlueBrain_NeuroM
train
py,py
a6af6fdc8ad22919025cc8cee2f968af14bca3af
diff --git a/seed_control_interface/settings.py b/seed_control_interface/settings.py index <HASH>..<HASH> 100644 --- a/seed_control_interface/settings.py +++ b/seed_control_interface/settings.py @@ -170,4 +170,4 @@ EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', '') EMAIL_PORT = int(os.environ.get('EMAIL_PORT', '25')) EMAIL_SUBJECT_PREFIX = os.environ.get('EMAIL_SUBJECT_PREFIX', '[Django]') -MESSAGES_PER_IDENTITY = 100 +MESSAGES_PER_IDENTITY = 30
Reduce the number of messages displayed on the identity page
praekeltfoundation_seed-control-interface
train
py
06b332e048a90fd710ded1f402ce647228dddfc7
diff --git a/src/common.js b/src/common.js index <HASH>..<HASH> 100644 --- a/src/common.js +++ b/src/common.js @@ -31,8 +31,8 @@ function normalizeShortSig (root, transform = identity) { return types; } -function normalizeLongSig (submit, success, failure) { - const submitCreator = typeof submit === 'string' ? creatorFactory(submit, identity) : submit; +function normalizeLongSig (submit, success, failure, transform = identity) { + const submitCreator = typeof submit === 'string' ? creatorFactory(submit, transform) : submit; return [submitCreator, success, failure]; }
Allows a transform function to be passed to onSubmitActions on the Long Signature form I don't think it breaks any existing code, since it defaults to "identity", but let me know if there are any problems, or you don't agree with this.
colinbate_redux-form-submit-saga
train
js
6dd3225e5fb39e6bcde3eb2d3e81dfa9b17ceeee
diff --git a/examples/glyphs/trail.py b/examples/glyphs/trail.py index <HASH>..<HASH> 100644 --- a/examples/glyphs/trail.py +++ b/examples/glyphs/trail.py @@ -44,8 +44,8 @@ def distance(p1, p2): def prep_data(dataset): df = dataset.copy() - latlon = zip(df.lat, df.lon) - dist = np.array([0] + [ distance(latlon[i+1], latlon[i]) for i, _ in enumerate(latlon[:-1]) ]) + latlon = list(zip(df.lat, df.lon)) + dist = np.array([0] + [ distance(latlon[i+1], latlon[i]) for i in range(len((latlon[:-1]))) ]) df["dist"] = np.cumsum(dist)
Fix py3 compatibility in glyphs/trail
bokeh_bokeh
train
py
ed85b2749e378963462c2cfd9cecc1da7419a445
diff --git a/test/backend-receiver.test.js b/test/backend-receiver.test.js index <HASH>..<HASH> 100644 --- a/test/backend-receiver.test.js +++ b/test/backend-receiver.test.js @@ -29,7 +29,7 @@ function sendPacketTo(packet, port) { return clientSocket; }) .next(function(clientSocket) { - clientSocket.close(); + clientSocket.destroy(); }); }
Call Socket#destory instaead of undefined destructor Socket#close
droonga_express-droonga
train
js
cbad3c516ff932a92354d412e64733f464554140
diff --git a/src/IteratorPipeline/Pipeline.php b/src/IteratorPipeline/Pipeline.php index <HASH>..<HASH> 100644 --- a/src/IteratorPipeline/Pipeline.php +++ b/src/IteratorPipeline/Pipeline.php @@ -98,7 +98,7 @@ class Pipeline implements \IteratorAggregate */ final public static function with(iterable $iterable): self { - return new static($iterable); + return $iterable instanceof static ? $iterable : new static($iterable); } /** diff --git a/tests/IteratorPipeline/PipelineTest.php b/tests/IteratorPipeline/PipelineTest.php index <HASH>..<HASH> 100644 --- a/tests/IteratorPipeline/PipelineTest.php +++ b/tests/IteratorPipeline/PipelineTest.php @@ -119,6 +119,15 @@ class PipelineTest extends TestCase $this->assertAttributeSame($values, 'iterable', $pipeline); } + public function testWithSelf() + { + $input = new Pipeline([]); + $pipeline = Pipeline::with($input); + + $this->assertInstanceOf(Pipeline::class, $pipeline); + $this->assertSame($input, $pipeline); + } + public function testBuild() { $builder = Pipeline::build();
Passing a Pipeline to `with` returns the input (nop).
improved-php-library_iterable
train
php,php
f6785ee23ac8a80e5a91c420d2c310d580d81e0d
diff --git a/src/Lister.php b/src/Lister.php index <HASH>..<HASH> 100644 --- a/src/Lister.php +++ b/src/Lister.php @@ -11,6 +11,9 @@ class Lister extends View public function renderView() { + if (!$this->template) { + throw new Exception(['Lister requires you to specify template explicitly']); + } $this->t_row = $this->template->cloneRegion('row'); //$this->t_totals = isset($this->template['totals']) ? $this->template->cloneRegion('totals') : null;
Add a check in Lister to make sure it has workable template
atk4_ui
train
php
928c854589b1c2ad02962e5915ba48ade618fe8e
diff --git a/lib/commands/validate_schema.rb b/lib/commands/validate_schema.rb index <HASH>..<HASH> 100644 --- a/lib/commands/validate_schema.rb +++ b/lib/commands/validate_schema.rb @@ -80,7 +80,13 @@ module Commands # Builds a JSON Reference + message like "/path/to/file#/path/to/data". def map_schema_errors(file, errors) - errors.map { |e| "#{file}#{e.schema.pointer}: #{e.message}" } + errors.map { |e| + if e.is_a?(JsonSchema::ValidationError) + "#{file}#{e.pointer}: failed #{e.schema.pointer}: #{e.message}" + else + "#{file}#{e.schema.pointer}: #{e.message}" + end + } end def parse(file)
Better validation errors that include two JSON Pointers (data + schema)
brandur_json_schema
train
rb
335bee2fb455a02ccf4c949713d958111d82e56d
diff --git a/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php b/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php +++ b/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php @@ -19,7 +19,7 @@ namespace Symfony\Component\Security\Core\Role; class RoleHierarchy implements RoleHierarchyInterface { private $hierarchy; - private $map; + protected $map; /** * Constructor. @@ -56,7 +56,7 @@ class RoleHierarchy implements RoleHierarchyInterface return $reachableRoles; } - private function buildRoleMap() + protected function buildRoleMap() { $this->map = array(); foreach ($this->hierarchy as $main => $roles) {
Change of scope When overriding the Symfony RoleHierarchy it would be great to be able to get access to the buildRoleMap-method and map-variable for more advanced usage.
symfony_symfony
train
php
35720518cee62ff23584d85233fb939c7b9154d0
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='fantasy_football_auction', packages=['fantasy_football_auction'], - version='0.9.1', + version='0.9.2', description='Python library simulating a fantasy football auction. Intended to be used for AI, but you should be ' 'able to use this for other purposes as well. This task assumes that each draftable player has a ' 'specific value (for example, looking at the ratings from FantasyPros).',
fix bug where str didn't work right for auction
chairbender_fantasy-football-auction
train
py
4186d4bafe04d0e98e71a2410634c0a0785f6a4a
diff --git a/lib/utils.js b/lib/utils.js index <HASH>..<HASH> 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -3,6 +3,11 @@ var path = require('path'); function getAssetsFileOptions(folder, compilation) { var fileOptions = []; compilation.chunks.forEach(function(chunk) { + //re-upload only changed files + if(!chunk.rendered) { + return; + } + chunk.files.forEach(function(filePath) { fileOptions.push({ folder: path.join(folder, path.dirname(filePath)),
Added performance improvements for multiple chunks.
yohanb_spsave-webpack-plugin
train
js
bbb0b7db0a5bde5189a643b1c09ea6030a48cc1f
diff --git a/grunt/config/shell.js b/grunt/config/shell.js index <HASH>..<HASH> 100644 --- a/grunt/config/shell.js +++ b/grunt/config/shell.js @@ -11,6 +11,7 @@ module.exports = function (grunt) { } return { + // See [How to release a new version: Prerequisites](https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#prerequisites-1) for information on generating release notes. // Install with: gem install github_changelog_generator // 'github_changelog_generator --no-author --between-tags 3.11.4,3.11.5 --compare-link -t ' notes: {
Adds link to wiki about release notes step and the required Ruby Gem installaiton.
ExactTarget_fuelux
train
js
9008736b9c7a8c14ceac20c0b6ebbadf171711b5
diff --git a/src/python/tmclient/cli.py b/src/python/tmclient/cli.py index <HASH>..<HASH> 100644 --- a/src/python/tmclient/cli.py +++ b/src/python/tmclient/cli.py @@ -602,7 +602,8 @@ microscope_file_upload_parser.add_argument( ) ) microscope_file_upload_parser.add_argument( - '--retries', type=int, metavar='NUM', default=5, + '--retries', action='store', dest='retry', + type=int, metavar='NUM', default=5, help=('Retry failed uploads up to NUM times.' ' If this option is omitted, `tm_client`' ' will retry failed uploads up to %(default)s times.'),
Fix "TypeError: unsupported operands for `+=`"
TissueMAPS_TmClient
train
py
3648abea9b10277844dbbda9dbd0f941be0e7eb7
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -232,7 +232,7 @@ abstract class Kernel implements KernelInterface public function getBundle($name, $first = true) { if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your %s.php file?', $name, get_class($this))); + throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); } if (true === $first) {
=Minor chnage: replaced function by method
symfony_symfony
train
php
f4dfb43993a24432374fb7900a49aaead180a31d
diff --git a/tests/e2e/pkg/tester/tester.go b/tests/e2e/pkg/tester/tester.go index <HASH>..<HASH> 100644 --- a/tests/e2e/pkg/tester/tester.go +++ b/tests/e2e/pkg/tester/tester.go @@ -68,7 +68,7 @@ func (t *Tester) addHostArgument() error { return fmt.Errorf("kubeconfig did not contain server") } - klog.Info("Adding --host=%s", server) + klog.Infof("Adding --host=%s", server) t.TestArgs += " --host=" + server return nil } @@ -98,7 +98,7 @@ func (t *Tester) execute() error { return err } - return t.Execute() + return t.Test() } func NewDefaultTester() *Tester {
kubetest2: Call Test, not Execute Execute will reparse the flags; we want to reuse the test execution but not the flag setup.
kubernetes_kops
train
go
7a410f1a0ed312f91c04d2889a30c9c2a67628c0
diff --git a/src/Service/Api.php b/src/Service/Api.php index <HASH>..<HASH> 100644 --- a/src/Service/Api.php +++ b/src/Service/Api.php @@ -44,6 +44,9 @@ class Api /** @var Environment[] */ protected static $environmentsCache = []; + /** @var bool */ + protected static $environmentsCacheRefreshed = false; + /** @var array */ protected static $notFound = []; @@ -316,6 +319,7 @@ class Api } $this->cache->save($cacheKey, $toCache, $this->config->get('api.environments_ttl')); + self::$environmentsCacheRefreshed = true; } else { $environments = []; $endpoint = $project->getUri(); @@ -350,9 +354,20 @@ class Api } $environments = $this->getEnvironments($project, $refresh); + + // Retry if the environment was not found in the cache. + if (!isset($environments[$id]) + && $refresh === null + && !self::$environmentsCacheRefreshed) { + $environments = $this->getEnvironments($project, true); + } + + // Look for the environment by ID. if (isset($environments[$id])) { return $environments[$id]; } + + // Look for the environment by machine name. if ($tryMachineName) { foreach ($environments as $environment) { if ($environment->machine_name === $id) {
Ensure a fresh cache in getEnvironment() before determining nonexistence of an environment
platformsh_platformsh-cli
train
php
212c9399f212680a4dc52b304927c65039047ac0
diff --git a/src/PhpFileConfiguration.php b/src/PhpFileConfiguration.php index <HASH>..<HASH> 100644 --- a/src/PhpFileConfiguration.php +++ b/src/PhpFileConfiguration.php @@ -73,7 +73,7 @@ final class PhpFileConfiguration implements ConfigurationInterface // ensure the file returns an array. if (! is_array($contents)) { throw new \UnexpectedValueException( - vsprintf('PHP configuration file must return an array, %s returned (see %s)', [ + vsprintf('PHP configuration file must return an array, %s returned (%s)', [ gettype($contents), realpath($this->path), ]) @@ -94,7 +94,7 @@ final class PhpFileConfiguration implements ConfigurationInterface if (! $result->isValid()) { throw new \UnexpectedValueException( - vsprintf('%s (see %s)', [ + vsprintf('%s (%s)', [ $result->message()->source('configuration array'), realpath($this->path), ])
wording in exception message of php file configuration
quantaphp_container-factories
train
php
df8ab16bb7e92d4c9a3cd38b464109325778d46b
diff --git a/lib/lanes/logger.rb b/lib/lanes/logger.rb index <HASH>..<HASH> 100644 --- a/lib/lanes/logger.rb +++ b/lib/lanes/logger.rb @@ -26,22 +26,7 @@ module Lanes class << self def logger - @logger ||= ( - if defined?(::Rails) - Rails.logger - else - if Lanes.env.production? - dest = if FileTest.writable?("log/production.log") - "log/production.log" - else - STDOUT - end - ::Logger.new(dest) - else - ::Logger.new MultiDestinationLogger.new - end - end - ) + @logger ||= _create_logger end def logger=( logger ) @@ -64,10 +49,35 @@ module Lanes logger.debug '⚡ '*40 end + private + + def _create_logger + if defined?(::Rails) + Rails.logger + else + if Lanes.env.production? + dest = if FileTest.writable?("log/production.log") + "log/production.log" + else + STDOUT + end + logger = ::Logger.new(dest) + logger.level = ::Logger::WARN + logger + else + logger = ::Logger.new MultiDestinationLogger.new + logger.level = ::Logger::DEBUG + logger + end + end + end + + end Lanes.config.get(:environment) do | env | self.logger=nil # it'll be re-opened on next write end + end
set level on logger when creating it
argosity_hippo
train
rb
87f10f52f37691fb7868969be000b6f6f37ef5a2
diff --git a/test/prey_conf_spec.js b/test/prey_conf_spec.js index <HASH>..<HASH> 100644 --- a/test/prey_conf_spec.js +++ b/test/prey_conf_spec.js @@ -31,9 +31,9 @@ describe('prey_conf_spec', function(){ endpoints.should.be.equal('control-panel'); }); - it('host should be set to control.preyproject.com', function(){ + it('host should be set to solid.preyproject.com', function(){ var host = get_value('host'); - host.should.be.equal('control.preyproject.com'); + host.should.be.equal('solid.preyproject.com'); }); it('protocol should be set to https', function(){
Fix the test relative to `solid`
prey_prey-node-client
train
js
3a49087acfc9b63a32cfefe5cbc8057dcde394ad
diff --git a/packages/idyll-docs/components/top-nav.js b/packages/idyll-docs/components/top-nav.js index <HASH>..<HASH> 100644 --- a/packages/idyll-docs/components/top-nav.js +++ b/packages/idyll-docs/components/top-nav.js @@ -138,15 +138,16 @@ export default ({ selected }) => { } .expanded { height: auto; - padding-bottom: 10px; } .link { - padding-top: 15px; + margin-top: 15px; + margin-bottom: 10px; } .logo-container { font-size: 24px; margin: 0; + width: 50px; } .nav-logo { // top: 1px;
minor css update to docs
idyll-lang_idyll
train
js
07c48f73f0738a0b7855aed347f34e009dde0ca8
diff --git a/src/Event/IndexViewListener.php b/src/Event/IndexViewListener.php index <HASH>..<HASH> 100644 --- a/src/Event/IndexViewListener.php +++ b/src/Event/IndexViewListener.php @@ -1,12 +1,12 @@ <?php namespace CsvMigrations\Event; -use App\View\AppView; use Cake\Event\Event; use Cake\Event\EventManager; use Cake\Network\Request; use Cake\ORM\Query; use Cake\ORM\ResultSet; +use Cake\View\View; use CsvMigrations\ConfigurationTrait; use CsvMigrations\Event\BaseViewListener; @@ -212,7 +212,7 @@ class IndexViewListener extends BaseViewListener return; } - $appView = new AppView(); + $appView = new View(); $plugin = $event->subject()->request->plugin; $controller = $event->subject()->request->controller; $displayField = $event->subject()->{$event->subject()->name}->displayField();
Use cake View instance to remove app coupling (task #<I>)
QoboLtd_cakephp-csv-migrations
train
php
8f025ff395c702f08bd0a4d0e2cfebbf2d23a767
diff --git a/src/bosh-softlayer-cpi/action/create_vm.go b/src/bosh-softlayer-cpi/action/create_vm.go index <HASH>..<HASH> 100644 --- a/src/bosh-softlayer-cpi/action/create_vm.go +++ b/src/bosh-softlayer-cpi/action/create_vm.go @@ -318,6 +318,10 @@ func (cv CreateVM) getNetworkComponents(networks Networks) (*datatypes.Virtual_G } } + if privateNetworkComponent == nil { + return publicNetworkComponent, privateNetworkComponent, bosherr.Error("A private network is required. Please check vlanIds") + } + return publicNetworkComponent, privateNetworkComponent, nil }
Inspect privateNetworkComponent existing.
cloudfoundry_bosh-softlayer-cpi-release
train
go
0fbc29ef8ad20de5d611d58edb5f12a37c981d73
diff --git a/i3pystatus/weather/wunderground.py b/i3pystatus/weather/wunderground.py index <HASH>..<HASH> 100644 --- a/i3pystatus/weather/wunderground.py +++ b/i3pystatus/weather/wunderground.py @@ -68,7 +68,7 @@ class Wunderground(WeatherBackend): colorize=True, hints={'markup': 'pango'}, backend=wunderground.Wunderground( - api_key='dbafe887d56ba4ad', + api_key='api_key_goes_here', location_code='pws:MAT645', units='imperial', forecast=True,
I'm an idiot and put my API key in the Weather Underground example (#<I>) Just got a usage alert when my laptop wasn't even on. n<I>b mistake! I've disabled the API key, and this removes it from the example in the documentation.
enkore_i3pystatus
train
py
fd000b720c6b29b8f8da63c34871d67fbd1ce9ea
diff --git a/lib/components/viewers/stop-schedule-table.js b/lib/components/viewers/stop-schedule-table.js index <HASH>..<HASH> 100644 --- a/lib/components/viewers/stop-schedule-table.js +++ b/lib/components/viewers/stop-schedule-table.js @@ -6,6 +6,7 @@ import styled from 'styled-components' import { isBlank } from '../../util/ui' import { excludeLastStop, + getRouteIdForPattern, getSecondsUntilDeparture, getStopTimesByPattern, stopTimeComparator @@ -75,6 +76,16 @@ class StopScheduleTable extends Component { // Merge stop times, so that we can sort them across all route patterns. let mergedStopTimes = [] Object.values(stopTimesByPattern).forEach(({ pattern, route, times }) => { + // TODO: refactor the IF block below (copied fromn StopViewer). + // Only add pattern if route is found. + // FIXME: there is currently a bug with the alernative transit index + // where routes are not associated with the stop if the only stoptimes + // for the stop are drop off only. See https://github.com/ibi-group/trimet-mod-otp/issues/217 + if (!route) { + console.warn(`Cannot render stop times for missing route ID: ${getRouteIdForPattern(pattern)}`) + return + } + const filteredTimes = times .filter(excludeLastStop) .map(stopTime => {
refactor(StopScheduleTable): Do not render times for pattern without route object.
opentripplanner_otp-react-redux
train
js
48cb5bf604f2b7a06621b35901a1affa8e16ff49
diff --git a/fabric_gce_tools/__init__.py b/fabric_gce_tools/__init__.py index <HASH>..<HASH> 100644 --- a/fabric_gce_tools/__init__.py +++ b/fabric_gce_tools/__init__.py @@ -120,8 +120,8 @@ def _get_roles(data): if not role in roles: roles[role] = [] - address = i["networkInterfaces"][0]["accessConfigs"][0]["natIP"] - if not address in roles[role]: + address = i.get("networkInterfaces", [{}])[0].get("accessConfigs", [{}])[0].get("natIP", None) + if address and not address in roles[role]: roles[role].append(address) return roles diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ from setuptools import setup, find_packages setup( name="fabric-gce-tools", - version="0.4", + version="0.5", description="Fabric integration with Google Compute Engine (GCE)", author="Eran Sandler", author_email="eran@sandler.co.il",
another minor fix for handling terminated instances still alive on the instances list
erans_fabric-gce-tools
train
py,py
d84a7c0df911b5aee3a7e7b79ca64b4bb21f3851
diff --git a/outbound.js b/outbound.js index <HASH>..<HASH> 100644 --- a/outbound.js +++ b/outbound.js @@ -151,6 +151,8 @@ exports.send_trans_email = function (transaction, next) { this.loginfo("Adding missing Date header"); transaction.add_header('Date', new Date().toString()); } + + transaction.add_header('Received', 'via haraka outbound.js at ' + new Date().toString()); // First get each domain var recips = {}; @@ -884,7 +886,7 @@ HMailItem.prototype.bounce_respond = function (retval, msg) { } var from = new Address ('<>'); - var recip = new Address (hmail.todo.mail_from.user, hmail.todo.mail_from.host); + var recip = new Address (this.todo.mail_from.user, this.todo.mail_from.host); var dom = recip.host; populate_bounce_message(from, recip, err, this, function (err, data_lines) { if (err) {
Add Received headers to outbound mail. Fix for bounce processing.
haraka_Haraka
train
js
4364b3eccf0c1ea524041e317e2e1e3ab88bc426
diff --git a/lib/synvert/cli.rb b/lib/synvert/cli.rb index <HASH>..<HASH> 100644 --- a/lib/synvert/cli.rb +++ b/lib/synvert/cli.rb @@ -27,12 +27,12 @@ module Synvert case @options[:command] when 'list' - load_rewriters + read_rewriters list_available_rewriters when 'open' open_rewriter when 'query' - load_rewriters + read_rewriters query_available_rewriters when 'show' show_rewriter @@ -44,7 +44,7 @@ module Synvert execute_snippet else # run - load_rewriters + read_rewriters run_snippet end true @@ -129,21 +129,9 @@ module Synvert end end - # Load all rewriters. - def load_rewriters + # read all rewriters. + def read_rewriters Dir.glob(File.join(default_snippets_home, 'lib/**/*.rb')).each { |file| require file } - - @options[:custom_snippet_paths].each do |snippet_path| - if /^http/.match?(snippet_path) - uri = URI.parse snippet_path - eval(uri.read) - else - require snippet_path - end - end - rescue StandardError - FileUtils.rm_rf default_snippets_home - retry end # List and print all available rewriters.
rename load_rewriters to read_rewriters
xinminlabs_synvert
train
rb
85077a121d7b6b43f393a4c69da8faa143e89503
diff --git a/src/utility/expandRuleAntecedent.js b/src/utility/expandRuleAntecedent.js index <HASH>..<HASH> 100644 --- a/src/utility/expandRuleAntecedent.js +++ b/src/utility/expandRuleAntecedent.js @@ -33,10 +33,11 @@ module.exports = function expandRuleAntecedent(result, literals, thetaPath, prog return l .substitute(crrArg.theta); }); - let newClause = remappedClauseFront + let newRule = remappedClauseFront .concat(crrArg.clause) .concat(remappedClauseBack); - expandRuleAntecedent(result, newClause, thetaPath.concat([crrArg.theta]), program); + // check and expand the new antecedent again + expandRuleAntecedent(result, newRule, thetaPath.concat([crrArg.theta]), program); }); if (!isLeaf) { break;
add comments and rename variables in expandRuleAntecedent
lps-js_lps.js
train
js