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
13ea2d994949ce60a2f0107d079d553b77334e64
diff --git a/code/pages/SolrSearchPage.php b/code/pages/SolrSearchPage.php index <HASH>..<HASH> 100644 --- a/code/pages/SolrSearchPage.php +++ b/code/pages/SolrSearchPage.php @@ -97,7 +97,7 @@ class SolrSearchPage extends Page $objFields['LastEdited'] = 'LastEdited'; $objFields['Created'] = 'Created'; $objFields['ID'] = 'ID'; - $objFields['Score'] = 'Score'; + $objFields['score'] = 'Score'; ksort($objFields); return $objFields; @@ -176,6 +176,7 @@ class SolrSearchPage extends Page if (!isset($fields[$sortBy])) { $sortBy = 'score'; } + $sortDir = $sortDir == 'Ascending' ? 'asc' : 'desc'; $activeFacets = $this->getActiveFacets(); @@ -200,6 +201,9 @@ class SolrSearchPage extends Page $query .= ' AND ClassNameHierarchy_ms:'.$type; } + if (!$sortBy) { + $sortBy = 'score'; + } $params = array( 'facet' => 'true', 'facet.field' => self::$facets,
BUGFIX: Make sure score uses lowercase
nyeholt_silverstripe-solr
train
php
afef3676f05575089928397684072716a89ffcab
diff --git a/openquake/engine/calculators/hazard/general.py b/openquake/engine/calculators/hazard/general.py index <HASH>..<HASH> 100644 --- a/openquake/engine/calculators/hazard/general.py +++ b/openquake/engine/calculators/hazard/general.py @@ -337,7 +337,7 @@ class BaseHazardCalculator(base.Calculator): for trt_model in cm.trt_models: trt_model.num_ruptures = models.TrtModel.objects.get( pk=trt_model.id).num_ruptures - cm.reduce_trt_models() + cm.reduce_gsim_lt() rlzs_assoc = cm.get_rlzs_assoc() gsims_by_trt_id = rlzs_assoc.get_gsims_by_trt_id()
Renamed reduce_trt_models
gem_oq-engine
train
py
46936dd3129e94be249c457bcef8dbee3beb12e8
diff --git a/lib/codemirror.js b/lib/codemirror.js index <HASH>..<HASH> 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -3827,7 +3827,9 @@ var reader = new FileReader; reader.onload = operation(cm, function() { - text[i] = reader.result; + var content = reader.result; + if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) content = ""; + text[i] = content; if (++read == n) { pos = clipPos(cm.doc, pos); var change = {from: pos, to: pos,
Refuse to accept dropped binary files Issue #<I>
codemirror_CodeMirror
train
js
38723dc9eebf3ee69bb4b97732b2a6219c3e029a
diff --git a/lib/scss_lint.rb b/lib/scss_lint.rb index <HASH>..<HASH> 100644 --- a/lib/scss_lint.rb +++ b/lib/scss_lint.rb @@ -8,6 +8,7 @@ module SCSSLint autoload :Linter, 'scss_lint/linter' autoload :Reporter, 'scss_lint/reporter' autoload :Runner, 'scss_lint/runner' + autoload :VERSION, 'scss_lint/version' # Load all linters Dir[File.expand_path('scss_lint/linter/*.rb', File.dirname(__FILE__))].each do |file|
Fix `scss-lint --version` The `VERSION` constant wasn't being autoloaded, leading to embarassing failures trying to run with the --version flag. Change-Id: I<I>d<I>bc<I>e9fcc0d<I>fae<I>b<I>fca7d Reviewed-on: <URL>
sds_scss-lint
train
rb
5f55d2b8b9aeabf9a444dcc2cdf39ff80a71edc0
diff --git a/pyxmpp2/test/_util.py b/pyxmpp2/test/_util.py index <HASH>..<HASH> 100644 --- a/pyxmpp2/test/_util.py +++ b/pyxmpp2/test/_util.py @@ -131,6 +131,11 @@ class NetReaderWritter(object): try: ret = infd, _outfd, _errfd = select.select([self.sock], [], [], 5) + except select.error, err: + if err == getattr(errno, "WSAEBADF", None): + self.sock = None + break + raise finally: self.lock.acquire() if not self.sock:
win fix: test/_util.py: quietly handle WSAEBADF
Jajcus_pyxmpp2
train
py
c9c1ca02f31f1e377ff4a2ae8a5a4e642a099448
diff --git a/ella/core/migrations/0005_compute_publishable_publish_from.py b/ella/core/migrations/0005_compute_publishable_publish_from.py index <HASH>..<HASH> 100644 --- a/ella/core/migrations/0005_compute_publishable_publish_from.py +++ b/ella/core/migrations/0005_compute_publishable_publish_from.py @@ -2,26 +2,12 @@ from datetime import datetime from south.db import db from django.db import models from ella.core.models import * +from django.core.management import call_command class Migration: def forwards(self, orm): - db.execute(''' - UPDATE core_publishable INNER JOIN ( - SELECT - pub.id AS id, - MIN(plac.publish_from) AS pf - FROM - core_publishable AS pub INNER JOIN core_placement plac - ON plac.publishable_id = pub.id - GROUP BY - pub.id - ) AS a - ON core_publishable.id = a.id - SET - core_publishable.publish_from = a.pf - ''') - + call_command('update_publishable_publish_from') def backwards(self, orm): pass
no need to be overly clever, we already have this as a management command
ella_ella
train
py
7457d917affd136bf0ccdec8ec090776efb3374c
diff --git a/scripts/check-commit-message.js b/scripts/check-commit-message.js index <HASH>..<HASH> 100644 --- a/scripts/check-commit-message.js +++ b/scripts/check-commit-message.js @@ -174,8 +174,8 @@ const isExcludedCommit = (commit) => { * special cases, so they don't need to be checked. */ - if ((/^🚀 (hint|(configuration|connector|formatter|hint|parser|rule|utils)(-[0-9a-z]+)+) - v\d+\.\d+\.\d+/i).test(commit.message) || - (/^(Chore|Breaking): Update `(hint|(configuration|connector|formatter|hint|parser|rule|utils)(-[0-9a-z]+)+)` to `v\d+\.\d+\.\d+`/i).test(commit.message)) { + if ((/^🚀 (hint|(configuration|connector|create|formatter|hint|parser|utils)(-[0-9a-z]+)+) - v\d+\.\d+\.\d+/i).test(commit.message) || + (/^(Chore|Breaking): Update `(hint|(configuration|connector|create|formatter|hint|parser|utils)(-[0-9a-z]+)+)` to `v\d+\.\d+\.\d+`/i).test(commit.message)) { return true; }
Build: Allow commit messages to start with "🚀 create-..."
webhintio_hint
train
js
7a60e86b08fed50cb5dc9a0ea2c65f9d8d517b80
diff --git a/lib/faktory/rails.rb b/lib/faktory/rails.rb index <HASH>..<HASH> 100644 --- a/lib/faktory/rails.rb +++ b/lib/faktory/rails.rb @@ -23,9 +23,19 @@ module Faktory if ::Rails::VERSION::MAJOR < 5 raise "Your current version of Rails, #{::Rails::VERSION::STRING}, is not supported" end - + Faktory.options[:reloader] = Faktory::Rails::Reloader.new end + + begin + # https://github.com/rails/rails/pull/41248 + if defined?(::Mail::SMTP) + ::Mail::SMTP::DEFAULTS[:read_timeout] ||= 5 + ::Mail::SMTP::DEFAULTS[:open_timeout] ||= 5 + end + rescue => ex + # ignore + end end class Reloader
Add hack to fix lack of SMTP timeouts
contribsys_faktory_worker_ruby
train
rb
2bc75fdc65b95b30eb4260e231d994109e58057f
diff --git a/rdt/transformers/NullTransformer.py b/rdt/transformers/NullTransformer.py index <HASH>..<HASH> 100644 --- a/rdt/transformers/NullTransformer.py +++ b/rdt/transformers/NullTransformer.py @@ -21,8 +21,8 @@ class NullTransformer(BaseTransformer): new_name = '?' + self.col_name out[new_name] = pd.notnull(col) * 1 # replace missing values - if not pd.isnull(col.values.mean()): - clean_col = col.fillna(col.values.mean()) + if not pd.isnull(col.mean()): + clean_col = col.fillna(col.mean()) else: clean_col = col.fillna(0) out[self.col_name] = clean_col
NullTransformer fills gaps with mean of non nulls
HDI-Project_RDT
train
py
ca636e7c35542c2045ccd0b0781547a44b6d4aa8
diff --git a/src/Api.php b/src/Api.php index <HASH>..<HASH> 100644 --- a/src/Api.php +++ b/src/Api.php @@ -72,14 +72,6 @@ class Api extends BaseApi { } /** - * TODO: Push to BaseApi - * @return array - */ - protected function getCriticalRequestItems() { - return []; - } - - /** * @return int */ public function getEntityId() { @@ -121,14 +113,10 @@ class Api extends BaseApi { protected function preSendVerification() { parent::preSendVerification(); - array_map( - function ( $sItemKey ) { - if ( !$this->hasRequestDataItem( $sItemKey ) ) { - throw new \Exception( sprintf( 'Key "%s" must be provided', $sItemKey ) ); - } - }, - $this->getCriticalRequestItems() - ); + if ( in_array( $this->getHttpRequestMethod(), array( 'post', 'put' ) ) + && count( $this->getRequestData() ) == 0 ) { + throw new \Exception( 'Sending a "post/put" request with empty request data' ); + } } /**
Check for empty request data for post/put
FernleafSystems_ApiWrappers-FreeAgent
train
php
127de8eaf7344032745bf073eb6c0ee81688f16e
diff --git a/src/Commands/GenerateDocumentation.php b/src/Commands/GenerateDocumentation.php index <HASH>..<HASH> 100644 --- a/src/Commands/GenerateDocumentation.php +++ b/src/Commands/GenerateDocumentation.php @@ -83,6 +83,9 @@ class GenerateDocumentation extends Command $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) { return $routeGroup->map(function ($route) { + if (count($route['cleanBodyParameters'])) { + $route['headers']['Content-Type'] = 'application/json'; + } $route['output'] = (string) view('apidoc::partials.route')->with('route', $route)->render(); return $route;
Added json content-type header to doc request body if needed
mpociot_laravel-apidoc-generator
train
php
1e0b37a9a87bc103e1da7ad3d60b756c29d152c8
diff --git a/datastore.go b/datastore.go index <HASH>..<HASH> 100644 --- a/datastore.go +++ b/datastore.go @@ -34,13 +34,13 @@ type DataStore interface { // Write the chunk read from src into the file specified by the id at the // given offset. The handler will take care of validating the offset and // limiting the size of the src to not overflow the file's size. It may - // return an os.ErrNotExist which will be interpretet as a 404 Not Found. + // return an os.ErrNotExist which will be interpreted as a 404 Not Found. // It will also lock resources while they are written to ensure only one // write happens per time. // The function call must return the number of bytes written. WriteChunk(id string, offset int64, src io.Reader) (int64, error) // Read the fileinformation used to validate the offset and respond to HEAD - // requests. It may return an os.ErrNotExist which will be interpretet as a + // requests. It may return an os.ErrNotExist which will be interpreted as a // 404 Not Found. GetInfo(id string) (FileInfo, error) // Get an io.Reader to allow downloading the file. This feature is not
Fixes typo in datastore.go fixes two occurences of the word interpreted in datastore.go
tus_tusd
train
go
80a65912323c821fcb0b9fb54f9070ef16fd004c
diff --git a/lib/librato.js b/lib/librato.js index <HASH>..<HASH> 100644 --- a/lib/librato.js +++ b/lib/librato.js @@ -630,8 +630,8 @@ exports.init = function librato_init(startup_time, config, events, logger) tags = config.librato.tags; } - // Set global measurement tags if they are defined. - if (config.librato.writeToLegacy && Object.keys(config.librato.writeToLegacy).length) { + // Write metrics to legacy API + if (config.librato.writeToLegacy) { writeToLegacy = config.librato.writeToLegacy; }
Fix bad copy-paste for writeToLegacy check
librato_statsd-librato-backend
train
js
247760038ba3fa3e5e15b9c7a0f27c7f588a7b6e
diff --git a/demos/life.php b/demos/life.php index <HASH>..<HASH> 100644 --- a/demos/life.php +++ b/demos/life.php @@ -8,7 +8,7 @@ * with this source code in the file LICENSE. */ -include __DIR__ . (isset($_GET['original']) ? './autoload.php' : './autoload_aspect.php'); +include __DIR__ . (isset($_GET['original']) ? '/autoload.php' : '/autoload_aspect.php'); // Test case with human $man = new Demo\Example\Human();
also fix include path for life.php
goaop_framework
train
php
78af00238e00cb7a69298054cfddf2d9fd636c6c
diff --git a/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java b/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java index <HASH>..<HASH> 100644 --- a/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java +++ b/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java @@ -291,7 +291,7 @@ public class MetaModel implements Serializable { public <A extends Association> A getAssociationForTarget(Class<? extends Model> targetModelClass, Class<A> associationClass){ Association result = null; for (Association association : associations) { - if (association.getClass().equals(associationClass) && association.getTargetClass().equals(targetModelClass)) { + if (association.getClass().getName().equals(associationClass.getName()) && association.getTargetClass().getName().equals(targetModelClass.getName())) { result = association; break; } }
Update MetaModel.java Fix problem with association for diffrent class loader when you use Model.getAll()
javalite_activejdbc
train
java
6216a6579912fc28c6a5b2f80c18b58fe9d008a0
diff --git a/handlers/announce.js b/handlers/announce.js index <HASH>..<HASH> 100644 --- a/handlers/announce.js +++ b/handlers/announce.js @@ -113,6 +113,9 @@ module.exports = function(signaller) { // initialise the peer data copyData(peer.data, data); + // not inactive + peer.inactive = false; + // set the peer data signaller.peers.set(data.id, peer);
Ensure that a peer is not marked as inactive when an announce is received (it could be a reannounce)
rtc-io_rtc-signaller
train
js
e00f45f9598e7d0f56012d7d1a1477d2d15ce174
diff --git a/src/classes/operation/NostoOperationProduct.php b/src/classes/operation/NostoOperationProduct.php index <HASH>..<HASH> 100644 --- a/src/classes/operation/NostoOperationProduct.php +++ b/src/classes/operation/NostoOperationProduct.php @@ -153,7 +153,7 @@ class NostoOperationProduct { return array( 'url' => $product->getUrl(), - 'product_id' => (int)$product->getProductId(), + 'product_id' => $product->getProductId(), 'name' => $product->getName(), 'image_url' => $product->getImageUrl(), 'price' => Nosto::helper('price')->format($product->getPrice()), @@ -201,10 +201,7 @@ class NostoOperationProduct $data = array(); foreach ($this->collection->getArrayCopy() as $item) { /** @var NostoProductInterface $item */ - $productId = (int)$item->getProductId(); - if ($productId > 0) { - $data[] = $productId; - } + $data[] = $item->getProductId(); } if (empty($data)) { throw new NostoException('No products found in collection.');
Don't force product ID to be an integer in product operation API requests
Nosto_nosto-php-sdk
train
php
d7c023132e0233d7e880bd1286a2fe88117ab063
diff --git a/libraries/lithium/console/command/g11n/Extract.php b/libraries/lithium/console/command/g11n/Extract.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/console/command/g11n/Extract.php +++ b/libraries/lithium/console/command/g11n/Extract.php @@ -42,7 +42,7 @@ class Extract extends \lithium\console\Command { return 1; } $count = count($data); - $this->out("Yielded {$count} items."); + $this->out("Yielded {$count} item(s)."); $this->out(); $this->header('Message Template Creation');
Account for yielding just one item.
UnionOfRAD_framework
train
php
2583cc9f4af187090af5b83323b52f00bd974e3f
diff --git a/libraries/lithium/core/Libraries.php b/libraries/lithium/core/Libraries.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/core/Libraries.php +++ b/libraries/lithium/core/Libraries.php @@ -602,8 +602,10 @@ class Libraries { if (is_object($class)) { return $class; } - $success = (is_string($class) && class_exists($class)); - return $success ? new $class($params['options']) : null; + if (!(is_string($class) && class_exists($class))) { + throw new ClassNotFoundException("Class `{$name}` of type `{$type}` not defined."); + } + return new $class($params['options']); }; if (!isset(static::$_methodFilters[__FUNCTION__])) { return $implementation(get_called_class(), $params);
Libraries is acting like a Samurai if no classes can be found.
UnionOfRAD_framework
train
php
0a698c6dd4aa8df3ce4e1f482d2182a886c03df1
diff --git a/src/Presentation/Factory/CalendarFactory.php b/src/Presentation/Factory/CalendarFactory.php index <HASH>..<HASH> 100644 --- a/src/Presentation/Factory/CalendarFactory.php +++ b/src/Presentation/Factory/CalendarFactory.php @@ -36,7 +36,10 @@ class CalendarFactory return new Component('VCALENDAR', $properties, $components); } - protected function createCalendarComponents(Calendar $calendar): Generator + /** + * @return iterable<Component> + */ + protected function createCalendarComponents(Calendar $calendar): iterable { yield from $this->eventFactory->createComponents($calendar->getEvents()); yield from $this->timeZoneFactory->createComponents($calendar->getTimeZones());
Fix automated tests (#<I>)
markuspoerschke_iCal
train
php
ff31ff308d42684b09789cc493e9bafb2cf54815
diff --git a/src/Components/AbstractSegment.php b/src/Components/AbstractSegment.php index <HASH>..<HASH> 100644 --- a/src/Components/AbstractSegment.php +++ b/src/Components/AbstractSegment.php @@ -75,17 +75,15 @@ abstract class AbstractSegment extends AbstractArray } /** - * Sanitize a string component + * Sanitize a string component recursively * * @param mixed $str * - * @return string|null + * @return mixed */ protected function sanitizeValue($str) { - if (is_null($str)) { - return $str; - } elseif (is_array($str)) { + if (is_array($str)) { foreach ($str as &$value) { $value = $this->sanitizeValue($value); }
improved AbstractSegment::sanitizeValue method
thephpleague_uri-components
train
php
7ee5a185a7fe1ee183300674884c96eea5aec9aa
diff --git a/worker/undertaker/undertaker_test.go b/worker/undertaker/undertaker_test.go index <HASH>..<HASH> 100644 --- a/worker/undertaker/undertaker_test.go +++ b/worker/undertaker/undertaker_test.go @@ -24,11 +24,11 @@ type undertakerSuite struct { var _ = gc.Suite(&undertakerSuite{}) type clock struct { - *testing.Clock - // advanceDurationAfterNow is the duration to advance the clock after the // next call to Now(). advanceDurationAfterNow int64 + + *testing.Clock } func (c *clock) Now() time.Time {
worker/undertaker: fix alignment for atomic ops Fix tests on <I>-bit architectures by aligning variable used in atomic operations to <I>-bit boundary.
juju_juju
train
go
3e17df97f90bdd1e9b8084064fc37984b2a6a135
diff --git a/bundles/org.eclipse.orion.client.cf/web/cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard.js b/bundles/org.eclipse.orion.client.cf/web/cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.cf/web/cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard.js +++ b/bundles/org.eclipse.orion.client.cf/web/cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard.js @@ -313,6 +313,8 @@ define(["orion/bootstrap", "orion/xhr", 'orion/webui/littlelib', 'orion/Deferred var messageDiv = document.getElementById("planMessage"); messageDiv.innerHTML = message; + }, function(error){ + postError(error); }); }, validate: function(setValid){ @@ -805,6 +807,7 @@ define(["orion/bootstrap", "orion/xhr", 'orion/webui/littlelib', 'orion/Deferred configAdmin.getConfiguration("app.settings").then( function(config) { // get target and app, then do push and open application + getTarget(cFService, config, preferences).then( function(targetResp){ target = targetResp;
[nobug] Gather credentials in case of an error in node.js wizard
eclipse_orion.client
train
js
9beb157db8deef6dfdb4b395f90c92799110af95
diff --git a/src/engine/GoalTree.js b/src/engine/GoalTree.js index <HASH>..<HASH> 100644 --- a/src/engine/GoalTree.js +++ b/src/engine/GoalTree.js @@ -490,7 +490,15 @@ function GoalTree(program, goalClause) { let _evaluateQueue = [_root]; this.getEarliestDeadline = function getEarliestDeadline(currentTime) { - return _root.getEarliestDeadline(currentTime); + let earliestDeadline = null; + for (let i = 0; i < _evaluateQueue.length; i += 1) { + let earliestForNode = _evaluateQueue[i].getEarliestDeadline(currentTime); + if (earliestDeadline === null + || (earliestForNode < earliestDeadline)) { + earliestDeadline = earliestForNode; + } + } + return earliestDeadline; }; this.getRootClause = function () {
update getEarliestDeadline to only traverse nodes in eval queue
lps-js_lps.js
train
js
5120bbbd2822ae4bd6338ac5eaeae154df4d2705
diff --git a/tests/test_project.py b/tests/test_project.py index <HASH>..<HASH> 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -151,7 +151,6 @@ class TestProject: def test_delete(self, session, network_with_data): net = network_with_data - print session.dirty project_id = net.project_id log.info("Purging project %s", project_id) res = hb.delete_project(project_id, user_id=pytest.root_user_id)
Fix print statement in tests causing failures
hydraplatform_hydra-base
train
py
2a5bb3d85d71c12a93541357f10bb7e46bdd6dbe
diff --git a/reana_commons/version.py b/reana_commons/version.py index <HASH>..<HASH> 100755 --- a/reana_commons/version.py +++ b/reana_commons/version.py @@ -14,4 +14,4 @@ and parsed by ``setup.py``. from __future__ import absolute_import, print_function -__version__ = "0.6.0.dev20190704" +__version__ = "0.6.0.dev20190715"
release: <I>.de<I>
reanahub_reana-commons
train
py
7ec8c954f071122bc7743017bb97f6b4b662c134
diff --git a/spec/schema_dumper_spec.rb b/spec/schema_dumper_spec.rb index <HASH>..<HASH> 100644 --- a/spec/schema_dumper_spec.rb +++ b/spec/schema_dumper_spec.rb @@ -60,10 +60,10 @@ describe "Schema dump" do it "should order indexes" do with_index Post, :user_id do with_index Post, :author_id do - foreign_key_defs = dump.split("\n").select { |x| x.match(/add_index/) } - foreign_key_defs.size.should be_equal(2) - foreign_key_defs[0].should match(to_regexp(%q{add_index "posts", ["author_id"]})) - foreign_key_defs[1].should match(to_regexp(%q{add_index "posts", ["user_id"]})) + index_defs = dump.split("\n").select { |x| x.match(/add_index/) } + index_defs.size.should be_equal(2) + index_defs[0].should match(to_regexp(%q{add_index "posts", ["author_id"]})) + index_defs[1].should match(to_regexp(%q{add_index "posts", ["user_id"]})) end end end
clean-up of some copy-and-paste junk
mlomnicki_redhillonrails_core
train
rb
7b86bddc7a30a621d4b06fa0048e81d64bfa0d61
diff --git a/owlmixin/__init__.py b/owlmixin/__init__.py index <HASH>..<HASH> 100644 --- a/owlmixin/__init__.py +++ b/owlmixin/__init__.py @@ -8,7 +8,7 @@ from owlmixin.owlenum import OwlEnum, OwlObjectEnum from owlmixin import util from owlmixin.transformers import DictTransformer, JsonTransformer, YamlTransformer, traverse_dict, TOption -__version__ = '2.0.0a5' +__version__ = '2.0.0a6' T = TypeVar('T', bound='OwlMixin')
:package: Version <I>a6
tadashi-aikawa_owlmixin
train
py
d5ef502d2a7968957376db453177183af062a2b1
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -83,13 +83,13 @@ module ActiveSupport #:nodoc: super { |h,k| h[k] = [] } end - # return a list of new constants found since the last call to watch_modules + # return a list of new constants found since the last call to watch_namespaces def new_constants constants = [] # Grab the list of namespaces that we're looking for new constants under @watching.last.each do |namespace| - # Retrieve the constants that were present under the namespace when watch_modules + # Retrieve the constants that were present under the namespace when watch_namespaces # was originally called original_constants = self[namespace].last @@ -115,7 +115,7 @@ module ActiveSupport #:nodoc: end constants ensure - # A call to new_constants is always called after a call to watch_modules + # A call to new_constants is always called after a call to watch_namespaces pop_modules(@watching.pop) end
Reference watch_namespaces in comments instead of watch_modules
rails_rails
train
rb
eecad85377283eb937e93f4026b65e55a0b98236
diff --git a/lib/productions/callback.js b/lib/productions/callback.js index <HASH>..<HASH> 100644 --- a/lib/productions/callback.js +++ b/lib/productions/callback.js @@ -1,5 +1,5 @@ -import { Base } from "./base"; -import { return_type, argument_list, unescape } from "./helpers"; +import { Base } from "./base.js"; +import { return_type, argument_list, unescape } from "./helpers.js"; export class CallbackFunction extends Base { /**
fix: add missing file extensions (#<I>) Brave Browser was being picky and giving <I>s because there was no file extension.
w3c_webidl2.js
train
js
a35e09e22c5968fcd21396587e8ef30932a8fd4d
diff --git a/tests/UnifiedSpecTests/UnifiedSpecTest.php b/tests/UnifiedSpecTests/UnifiedSpecTest.php index <HASH>..<HASH> 100644 --- a/tests/UnifiedSpecTests/UnifiedSpecTest.php +++ b/tests/UnifiedSpecTests/UnifiedSpecTest.php @@ -64,6 +64,8 @@ class UnifiedSpecTest extends FunctionalTestCase 'valid-pass/createEntities-operation: createEntities operation' => 'CSOT is not yet implemented (PHPC-1760)', 'valid-pass/entity-cursor-iterateOnce: iterateOnce' => 'CSOT is not yet implemented (PHPC-1760)', 'valid-pass/matches-lte-operator: special lte matching operator' => 'CSOT is not yet implemented (PHPC-1760)', + // Fails on sharded clusters + 'change-streams/change-streams-showExpandedEvents: when showExpandedEvents is true, createIndex events are reported' => 'Fails on sharded clusters (PHPLIB-912)', ]; /** @var UnifiedTestRunner */
PHPLIB-<I>: Skip failing test until test is updated (#<I>)
mongodb_mongo-php-library
train
php
7e674e2cfc62dc93c4c63423aad554369eb9c567
diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index <HASH>..<HASH> 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -127,25 +127,16 @@ class Seeder */ public function call(string $class) { - if (empty($class)) + $class = trim($class); + + if ($class === '') { throw new InvalidArgumentException('No seeder was specified.'); } - $path = str_replace('.php', '', $class) . '.php'; - - // If we have namespaced class, simply try to load it. - if (strpos($class, '\\') !== false) + if (strpos($class, '\\') === false) { - /** - * @var Seeder - */ - $seeder = new $class($this->config); - } - // Otherwise, try to load the class manually. - else - { - $path = $this->seedPath . $path; + $path = $this->seedPath . str_replace('.php', '', $class) . '.php'; if (! is_file($path)) { @@ -160,14 +151,13 @@ class Seeder { require_once $path; } - - /** - * @var Seeder - */ - $seeder = new $class($this->config); // @codeCoverageIgnoreEnd } + /** + * @var Seeder + */ + $seeder = new $class($this->config); $seeder->setSilent($this->silent)->run(); unset($seeder);
De-duplicate seeder instantiation
codeigniter4_CodeIgniter4
train
php
b9705b309477742b426f91d1fcee903b8a3d892c
diff --git a/src/AuthenticationModule.php b/src/AuthenticationModule.php index <HASH>..<HASH> 100644 --- a/src/AuthenticationModule.php +++ b/src/AuthenticationModule.php @@ -88,7 +88,7 @@ class AuthenticationModule extends Module $className = $url->logoutLeafClassName; return new $className($url->loginProviderClassName); }), - $url->activateChildUrl => $activate = new ClassMappedUrlHandler($url->activatePasswordLeafClassName), + $url->activateChildUrl => $activate = new LeafCollectionUrlHandler($url->activatePasswordLeafClassName,$url->activatePasswordLeafClassName), ]), $url->urlToProtect => $protected = new ValidateLoginUrlHandler($provider::singleton(), $url->loginUrl),
Change this over to use a LeafCollectionUrlHandler so that the hash is passed in as the itemIdentifier
RhubarbPHP_Scaffold.Authentication
train
php
db3d29806b6d794a18de3a2ceb8c478b6be95b5c
diff --git a/Controller/Crud/Listener/ViewListener.php b/Controller/Crud/Listener/ViewListener.php index <HASH>..<HASH> 100644 --- a/Controller/Crud/Listener/ViewListener.php +++ b/Controller/Crud/Listener/ViewListener.php @@ -394,7 +394,7 @@ class ViewListener extends CrudListener { * @return mixed */ protected function _primaryKeyValue() { - return $this->_derriveFieldFromContext($this->_model()->primaryKey); + return $this->_deriveFieldFromContext($this->_model()->primaryKey); } /** @@ -405,7 +405,7 @@ class ViewListener extends CrudListener { * @return string */ protected function _displayFieldValue() { - return $this->_derriveFieldFromContext($this->_model()->displayField); + return $this->_deriveFieldFromContext($this->_model()->displayField); } /** @@ -415,7 +415,7 @@ class ViewListener extends CrudListener { * @param string $field * @return mixed */ - protected function _derriveFieldFromContext($field) { + protected function _deriveFieldFromContext($field) { $controller = $this->_controller(); $model = $this->_model(); $request = $this->_request();
Fixed misspelled "derive" in method name.
FriendsOfCake_crud-view
train
php
49471419a8bd2ce1b31468764b3d47ab9b50f70a
diff --git a/evaluator/evaluator.go b/evaluator/evaluator.go index <HASH>..<HASH> 100644 --- a/evaluator/evaluator.go +++ b/evaluator/evaluator.go @@ -389,6 +389,7 @@ func (e *Evaluator) checkInList(not bool, in types.Datum, list []types.Datum) (d d.SetInt64(1) return d } + d.SetInt64(0) return d } } diff --git a/evaluator/evaluator_test.go b/evaluator/evaluator_test.go index <HASH>..<HASH> 100644 --- a/evaluator/evaluator_test.go +++ b/evaluator/evaluator_test.go @@ -489,6 +489,10 @@ func (s *testEvaluatorSuite) TestExtract(c *C) { func (s *testEvaluatorSuite) TestPatternIn(c *C) { cases := []testCase{ { + exprStr: "1 not in (1, 2, 3)", + resultStr: "0", + }, + { exprStr: "1 in (1, 2, 3)", resultStr: "1", },
evaluator: fix a bug in checkInList. Fix a bug in checkInList.
pingcap_tidb
train
go,go
844cfcdc2b3a7b227a2675a778f79934998e228a
diff --git a/lib/Predis/Async/Client.php b/lib/Predis/Async/Client.php index <HASH>..<HASH> 100644 --- a/lib/Predis/Async/Client.php +++ b/lib/Predis/Async/Client.php @@ -211,7 +211,7 @@ class Client */ public function __call($method, $arguments) { - if (!($callback = array_pop($arguments)) instanceof \Closure) { + if (!is_callable($callback = array_pop($arguments))) { $arguments[] = $callback; $callback = null; } @@ -236,9 +236,9 @@ class Client * Executes the specified Redis command. * * @param CommandInterface $command A Redis command. - * @param \Closure $callback Optional callback. + * @param mixed $callback Optional callback. */ - public function executeCommand(CommandInterface $command, \Closure $callback = null) + public function executeCommand(CommandInterface $command, $callback = null) { $this->connection->executeCommand($command, $callback); }
Accept any kind of callable object for callbacks.
nrk_predis-async
train
php
8d54974ffa83561fcdbfecda8b5c98a9ce555fe1
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,7 +15,7 @@ Capybara.app = DillApp Capybara.javascript_driver = :webkit module WidgetSpecDSL - def GivenHTML(body_html, path = "/test") + def GivenAction(body_html, path) before :all do DillApp.class_eval do get path do @@ -29,6 +29,10 @@ module WidgetSpecDSL end end end + end + + def GivenHTML(body_html, path = "/test") + GivenAction body_html, path Given(:path) { path } Given { visit path }
[specs] Extract action creation.
mojotech_capybara-ui
train
rb
cf3ff9d83b4a4be888bdeb2084091bfbc84931c3
diff --git a/src/system/device.js b/src/system/device.js index <HASH>..<HASH> 100644 --- a/src/system/device.js +++ b/src/system/device.js @@ -34,7 +34,7 @@ function _domReady() { // Make sure that the DOM is not already loaded if (!isReady) { // be sure document.body is there - if (!device.nodeJS && !document.body) { + if (typeof globalThis.document !== "undefined" && !globalThis.document.body) { return setTimeout(_domReady, 13); }
better test in case we are running in a headless environment
melonjs_melonJS
train
js
f9190f63f2175dc8a0bcb24aed673b214912ea0f
diff --git a/gems/cache/spec/torque_box_store_spec.rb b/gems/cache/spec/torque_box_store_spec.rb index <HASH>..<HASH> 100644 --- a/gems/cache/spec/torque_box_store_spec.rb +++ b/gems/cache/spec/torque_box_store_spec.rb @@ -12,6 +12,7 @@ describe ActiveSupport::Cache::TorqueBoxStore do @manager = org.infinispan.manager.DefaultCacheManager.new service = org.projectodd.polyglot.cache.as.CacheService.new service.stub!(:cache_container).and_return( @manager ) + TorqueBox::Registry.merge!("transaction-manager" => nil) TorqueBox::ServiceRegistry.stub!(:[]).with(org.projectodd.polyglot.cache.as.CacheService::CACHE).and_return( service ) TorqueBox::ServiceRegistry.service_registry = nil @cache = ActiveSupport::Cache::TorqueBoxStore.new()
Fix test failures in torque_box_store_spec.rb I'm unsure why these aren't failing locally, but this same fix worked for cache_spec.rb
torquebox_torquebox
train
rb
35dff8250cd108a44cd3ef42c298ef85885fa4e8
diff --git a/src/main/java/org/acra/util/HttpRequest.java b/src/main/java/org/acra/util/HttpRequest.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/acra/util/HttpRequest.java +++ b/src/main/java/org/acra/util/HttpRequest.java @@ -76,9 +76,7 @@ public final class HttpRequest { final TrustManagerFactory tmf = TrustManagerFactory.getInstance(algorithm); final KeyStore keyStore = ACRA.getConfig().keyStore(); - if (keyStore != null) { - tmf.init(keyStore); - } + tmf.init(keyStore); final SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, tmf.getTrustManagers(), null); @@ -118,6 +116,10 @@ public final class HttpRequest { urlConnection.setRequestMethod(method.name()); urlConnection.setDoOutput(true); urlConnection.setChunkedStreamingMode(0); + + // Disable ConnectionPooling because otherwise OkHttp ConnectionPool will try to start a Thread on #connect + System.setProperty("http.keepAlive", "false"); + urlConnection.connect(); final OutputStream outputStream = new BufferedOutputStream(urlConnection.getOutputStream());
Always initialize TrustManager, even if KeyStore is null (thats ok).
ACRA_acra
train
java
8b3d3c71d040d7cb68b823e2af16269458f042f2
diff --git a/tests/frontend/org/voltdb/TestAdHocQueries.java b/tests/frontend/org/voltdb/TestAdHocQueries.java index <HASH>..<HASH> 100644 --- a/tests/frontend/org/voltdb/TestAdHocQueries.java +++ b/tests/frontend/org/voltdb/TestAdHocQueries.java @@ -108,6 +108,14 @@ public class TestAdHocQueries extends TestCase { // We inserted a 1,1,1 row way earlier assertEquals(2, result.getRowCount()); + // try something like the queries in ENG-1242 + try { + client.callProcedure("@AdHoc", "select * from blah; dfvsdfgvdf select * from blah WHERE IVAL = 1;"); + fail("Bad SQL failed to throw expected exception"); + } + catch (Exception e) {} + client.callProcedure("@AdHoc", "select\n* from blah;"); + // try a decimal calculation (ENG-1093) modCount = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES (2, '2011-06-24 10:30:26', 1.12345*1);").getResults()[0]; assertTrue(modCount.getRowCount() == 1);
Test for ENG-<I>: Malformed ad-hoc query may leave ad-hoc planner in unstable state These bad SQL statements seem to work now. Closing.
VoltDB_voltdb
train
java
cbd03b723bb1268d798e53b575f552b81014436c
diff --git a/fastlane/lib/fastlane/commands_generator.rb b/fastlane/lib/fastlane/commands_generator.rb index <HASH>..<HASH> 100644 --- a/fastlane/lib/fastlane/commands_generator.rb +++ b/fastlane/lib/fastlane/commands_generator.rb @@ -11,7 +11,11 @@ module Fastlane # since at this point we haven't yet loaded commander # however we do want to log verbose information in the PluginManager $verbose = true if ARGV.include?("--verbose") - $capture_output = true if ARGV.include?("--capture_output") + + if ARGV.include?("--capture_output") + $capture_output = true + $verbose = true + end # has to be checked here - in case we wan't to troubleshoot plugin related issues if ARGV.include?("--troubleshoot") @@ -81,7 +85,10 @@ module Fastlane program :help_formatter, :compact global_option('--verbose') { $verbose = true } - global_option('--capture_output', 'Captures the output of the current run, and generates a markdown issue template') { $capture_output = true } + global_option('--capture_output', 'Captures the output of the current run, and generates a markdown issue template') do + $capture_output = true + $verbose = true + end global_option('--troubleshoot', 'Enables extended verbose mode. Use with caution, as this even includes ALL sensitive data. Cannot be used on CI.') always_trace!
Enable --verbose during --capture_output (#<I>) should help on troubleshooting where users report crashes supply the output of $capture_output, but missing a stacktrace
fastlane_fastlane
train
rb
a86616d685d6f30c77f36b903ecb5ffac647d9ba
diff --git a/holoviews/plotting/raster.py b/holoviews/plotting/raster.py index <HASH>..<HASH> 100644 --- a/holoviews/plotting/raster.py +++ b/holoviews/plotting/raster.py @@ -53,7 +53,6 @@ class RasterPlot(ElementPlot): ranges = self.compute_ranges(self.map, self.keys[-1], ranges) ranges = match_spec(view, ranges) - xdim, ydim = view.key_dimensions xticks, yticks = self._compute_ticks(view, ranges)
Removed unused variables in RasterPlot
pyviz_holoviews
train
py
c8d3345cd3e0bbf3d627d591d19c5a2b725ad9ab
diff --git a/lib/setuplib.php b/lib/setuplib.php index <HASH>..<HASH> 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -501,6 +501,12 @@ function get_exception_info($ex) { } } + // when printing an error the continue button should never link offsite + if (stripos($link, $CFG->wwwroot) === false && + stripos($link, $CFG->httpswwwroot) === false) { + $link = $CFG->wwwroot.'/'; + } + $info = new stdClass(); $info->message = $message; $info->errorcode = $errorcode;
MDL-<I> continuation link sometimes links off-site This code was manually merged from MOODLE_<I>_STABLE, credit goes to Matt Meisberger.
moodle_moodle
train
php
aa74d263a6b2dfd3e847b325b0992a6dd091e8eb
diff --git a/tests/lib/file_system_tests.js b/tests/lib/file_system_tests.js index <HASH>..<HASH> 100644 --- a/tests/lib/file_system_tests.js +++ b/tests/lib/file_system_tests.js @@ -49,8 +49,6 @@ describe('lib', () => { }) describe('findFirstFile', function () { - this.retries(3) - it('should return the first element of findAllFiles', async () => { const includedDirectories = ['lib/', 'rules/'] const fs = new FileSystem(path.resolve('./tests'), includedDirectories)
tests: remove retries from filesystem tests
todogroup_repolinter
train
js
e6dde91f6023d8b402a464b1682bfcfacf657991
diff --git a/src/utils.js b/src/utils.js index <HASH>..<HASH> 100644 --- a/src/utils.js +++ b/src/utils.js @@ -14,7 +14,7 @@ Utils.io = function (url, timeout = 1000, responseType = 'text', method = 'GET', request.timeout = timeout; request.onload = () => { if (request.status === 200) { - resolve(request.responseText); + resolve(request.response); } else { reject(Error('Request error with a status of ' + request.statusText)); }
use response instead of responseText, to handle binary responses
tangrams_tangram
train
js
887fd428064eb1785ae96b6c3e741a9f43875d14
diff --git a/Lib/ufo2ft/featureCompiler.py b/Lib/ufo2ft/featureCompiler.py index <HASH>..<HASH> 100644 --- a/Lib/ufo2ft/featureCompiler.py +++ b/Lib/ufo2ft/featureCompiler.py @@ -278,7 +278,10 @@ class MtiFeatureCompiler(BaseFeatureCompiler): # defcon (as of 0.5.3) lists UFO data filenames using platform-specific # path separators, whereas the new fontTools.ufoLib uses `fs` module # internally which always requires UNIX forward slashes on all platforms - sep = "/" if hasattr(ufo, "fs") else os.path.sep + if hasattr(ufo, "reader") and hasattr(ufo.reader, "fs"): + sep = "/" + else: + sep = os.path.sep self._mti_features_prefix = MTI_FEATURES_PREFIX + sep def setupFeatures(self):
FeatureCompiler: fix the logic to check for fs-powered UFO
googlefonts_ufo2ft
train
py
7cebe9f21f5b85da318f9a508c2284c56fb549f5
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,8 @@ Setup envvars """ +import envvars + try: from setuptools import setup except ImportError: @@ -12,7 +14,7 @@ except ImportError: setup( name='envvars', - version='0.1.0', + version=envvars.__version__, description='Get and Set environment variables using .env file', author='Matt Seymour', author_email='[email protected]',
setup.py pulls version from envvars.__init__
mattseymour_python-env
train
py
34f8d8828846879b5e41e9af0a6a674d0cc3ab83
diff --git a/spec/controllers/drugs_controller_spec.rb b/spec/controllers/drugs_controller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controllers/drugs_controller_spec.rb +++ b/spec/controllers/drugs_controller_spec.rb @@ -21,8 +21,8 @@ RSpec.describe DrugsController, :type => :controller do describe 'GET index' do it 'assigns drugs' do create(:drug) - get :index + get :index expect(assigns(:drugs).first).to be_a(Drug) end end @@ -35,7 +35,6 @@ RSpec.describe DrugsController, :type => :controller do it 'responds successfully' do get :index - expect(response).to have_http_status(:success) end @@ -58,6 +57,7 @@ RSpec.describe DrugsController, :type => :controller do get :index, q: { name_cont: 'cillin' } end end + context 'with pagination params' do it 'assigns paging variables' do get :index, {q: {name_cont: 'cillin'}, page: '2', per_page: '50'}
Remove soft delete from Drug Conflicts: spec/controllers/drugs_controller_spec.rb spec/models/drug_spec.rb
airslie_renalware-core
train
rb
1461e95c39d0ec4b7b5b0d08f51b2d2cb5110349
diff --git a/src/lib/modules/whisper/index.js b/src/lib/modules/whisper/index.js index <HASH>..<HASH> 100644 --- a/src/lib/modules/whisper/index.js +++ b/src/lib/modules/whisper/index.js @@ -30,12 +30,21 @@ class Whisper { this.connectToProvider(); this.events.request('processes:register', 'whisper', (cb) => { - this.setServiceCheck(); - this.addWhisperToEmbarkJS(); - this.addSetProvider(); - this.waitForWeb3Ready(() => { - this.registerAPICalls(); - cb(); + this.web3.shh.getInfo((err) => { + if (err) { + const message = err.message || err; + if (message.indexOf('not supported') > -1) { + this.logger.error('Whisper is not supported on your node. Are you using the simulator?'); + return this.logger.trace(message); + } + } + this.setServiceCheck(); + this.addWhisperToEmbarkJS(); + this.addSetProvider(); + this.waitForWeb3Ready(() => { + this.registerAPICalls(); + cb(); + }); }); });
fix(whisper): fix crash on using whisper with the simualtor
embark-framework_embark
train
js
df490e7349e7a2e9a3072de763c5ad175b5db18a
diff --git a/bcbio/provenance/do.py b/bcbio/provenance/do.py index <HASH>..<HASH> 100644 --- a/bcbio/provenance/do.py +++ b/bcbio/provenance/do.py @@ -127,7 +127,7 @@ def file_reasonable_size(target_file, input_file): if input_file.strip().startswith("<("): return True if input_file.endswith((".bam", ".gz")): - scale = 5.0 + scale = 7.0 else: scale = 10.0 orig_size = os.path.getsize(input_file) / pow(1024.0, 3)
Avoid triggering reasonable size check when BAM file has large read group inputs. Fixes #<I>
bcbio_bcbio-nextgen
train
py
667f4163f936307c798e3dbf1a76165864641d40
diff --git a/salt/master.py b/salt/master.py index <HASH>..<HASH> 100644 --- a/salt/master.py +++ b/salt/master.py @@ -258,6 +258,11 @@ class MWorker(multiprocessing.Process): The _handle_payload method is the key method used to figure out what needs to be done with communication to the server ''' + try: + key = payload['enc'] + load = payload['load'] + except KeyError: + return '' return {'aes': self._handle_aes, 'pub': self._handle_pub, 'clear': self._handle_clear}[payload['enc']](payload['load'])
Add saftey to prevent master workers from dying with old minions
saltstack_salt
train
py
6c6cf6873356c3f13ca65783ee22bf9e497e1155
diff --git a/examples/basic_tagger.py b/examples/basic_tagger.py index <HASH>..<HASH> 100644 --- a/examples/basic_tagger.py +++ b/examples/basic_tagger.py @@ -130,12 +130,16 @@ def main(): dev_Y = model.ops.flatten(dev_Y) with model.begin_training(train_data) as (trainer, optimizer): trainer.nb_epoch = 10 + trainer.batch_size = 8 + trainer.nb_epoch = 10 + trainer.dropout = 0.3 + trainer.dropout_decay = 0. for examples, truth in trainer.iterate(model, train_data, dev_X, dev_Y, nb_epoch=trainer.nb_epoch): truth = model.ops.flatten(truth) examples = model.ops.flatten(examples) guess, finish_update = model.begin_update(examples, - dropout=0.3) + dropout=trainer.dropout) gradient, loss = categorical_crossentropy(guess, truth) optimizer.set_loss(loss)
Update params in tagger example
explosion_thinc
train
py
fe57abf76b9fde8362e931f873f15a0175380090
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ license: GNU-GPL2 from setuptools import setup setup(name='arguments', - version='60', + version='61', description='Argument parser based on docopt', url='https://github.com/erikdejonge/arguments', author='Erik de Jonge',
James Monroe: Isnt history ultimately the result of our fear of boredom? Wednesday <I> June <I> (week:<I> day:<I>), <I>:<I>:<I>
erikdejonge_arguments
train
py
45de570954c570deb66686f06da9854ea361779f
diff --git a/src/Monolog/Formatter/NormalizerFormatter.php b/src/Monolog/Formatter/NormalizerFormatter.php index <HASH>..<HASH> 100644 --- a/src/Monolog/Formatter/NormalizerFormatter.php +++ b/src/Monolog/Formatter/NormalizerFormatter.php @@ -70,17 +70,13 @@ class NormalizerFormatter implements FormatterInterface return $data; } - if (is_array($data) || $data instanceof \Traversable) { + if (is_array($data)) { $normalized = array(); $count = 1; - if ($data instanceof \Generator && !$data->valid()) { - return array('...' => 'Generator is already consumed, aborting'); - } - foreach ($data as $key => $value) { if ($count++ >= 1000) { - $normalized['...'] = 'Over 1000 items ('.($data instanceof \Generator ? 'generator function' : count($data).' total').'), aborting normalization'; + $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; break; } $normalized[$key] = $this->normalize($value);
Don't even try to attempt normalizing iterators or generators in context Iterators and Generators may not be rewindable, so foreach is not safe to use on them. Iterators and especially Generators may trigger irreversible actions on calling next(), so iterating over all values can potentially cause harm, e.g. imagine an iterator over a set of HTTP POST requests that are sent when the next value is requested . The only sufficiently safe thing to iterate and include here are primitive arrays.
Seldaek_monolog
train
php
88bf00c8f59bfc466736f82675dbb03cd1aa1933
diff --git a/app/AppKernel.php b/app/AppKernel.php index <HASH>..<HASH> 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -24,6 +24,7 @@ class AppKernel extends Apnet\FunctionalTestBundle\HttpKernel\AppKernel new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), + new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(), new Apnet\FunctionalTestBundle\ApnetFunctionalTestBundle(), new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(), );
Added SensioGeneratorBundle
apnet_bootstrap
train
php
e1dfd2e11732340057c45ec4f19adcc6f6267333
diff --git a/addons/storyshots/src/index.js b/addons/storyshots/src/index.js index <HASH>..<HASH> 100644 --- a/addons/storyshots/src/index.js +++ b/addons/storyshots/src/index.js @@ -31,11 +31,14 @@ export default function testStorySnapshots(options = {}) { if (isStorybook) { storybook = require.requireActual('@storybook/react'); // eslint-disable-next-line - const loadBabelConfig = require('@storybook/react/dist/server/babel_config').default; + const loadBabelConfig = require('@storybook/react/dist/server/babel_config') + .default; const configDirPath = path.resolve(options.configPath || '.storybook'); configPath = path.join(configDirPath, 'config.js'); const babelConfig = loadBabelConfig(configDirPath); + // We set this in the default babel config, but it is webpack-only + delete babelConfig.cacheDirectory; const content = babel.transformFileSync(configPath, babelConfig).code; const contextOpts = { filename: configPath,
Remove the `cacheDirectory` option from babel config In storyshots, we are running babel directly, not through webpack, so we can't use this option, which applies to `babel-loader`. See <URL>
storybooks_storybook
train
js
87f92c0a1c6965ad4a51b171d32a0b678a547acb
diff --git a/lib/serverspec/type/service.rb b/lib/serverspec/type/service.rb index <HASH>..<HASH> 100644 --- a/lib/serverspec/type/service.rb +++ b/lib/serverspec/type/service.rb @@ -33,5 +33,20 @@ module Serverspec::Type def has_property?(property) @runner.check_service_has_property(@name, property) end + + def property + get_property if @property.nil? + @property + end + + private + def get_property + @property = {} + props = @runner.get_service_property(@name).stdout + props.split(/\n/).each do |line| + property, _type, *value = line.split(/\s+/) + @property[property] = value.join(' ') + end + end end end
add property and get_property for 'its(:property)' syntax to test property of Solaris service
mizzy_serverspec
train
rb
c5ea482808d6bcce585eb046a7770905462cff5f
diff --git a/lib/oauthenticator/faraday_signer.rb b/lib/oauthenticator/faraday_signer.rb index <HASH>..<HASH> 100644 --- a/lib/oauthenticator/faraday_signer.rb +++ b/lib/oauthenticator/faraday_signer.rb @@ -1,4 +1,5 @@ require 'faraday' +require 'rack' if Faraday.respond_to?(:register_middleware) Faraday.register_middleware(:request, :oauthenticator_signer => proc { OAuthenticator::FaradaySigner }) @@ -53,10 +54,11 @@ module OAuthenticator # do the thing def call(request_env) + media_type = Rack::Request.new('CONTENT_TYPE' => request_env[:request_headers]['Content-Type']).media_type request_attributes = { :request_method => request_env[:method], :uri => request_env[:url], - :media_type => request_env[:request_headers]['Content-Type'], + :media_type => media_type, :body => request_env[:body] } # the adapter will set the media type to form-encoded when not otherwise specified on
fix usage of content-type where media type is needed. I should read my own documentation or something.
notEthan_oauthenticator
train
rb
8a47a2453f02f2e9b0e3c6ea7f07eb1b11d8a0fa
diff --git a/openquake/calculators/event_based_risk.py b/openquake/calculators/event_based_risk.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/event_based_risk.py +++ b/openquake/calculators/event_based_risk.py @@ -160,7 +160,7 @@ class EbrCalculator(base.RiskCalculator): is_stochastic = True precalc = 'event_based' accept_precalc = ['event_based', 'event_based_risk', 'ucerf_hazard', - 'ebrisk'] + 'ebrisk', 'event_based_advanced'] def pre_execute(self): oq = self.oqparam
Add the new calculator as an accepted precalculator for event_based_risk Former-commit-id: <I>c<I>ef<I>f9eeb<I>d1b<I>
gem_oq-engine
train
py
fc8f2a66899e0a542d28a1d6b55dc91f1e0abcc6
diff --git a/lib/controller.js b/lib/controller.js index <HASH>..<HASH> 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -32,6 +32,9 @@ Tessel.list = function(opts) { // Start looking for Tessels var seeker = new discover.TesselSeeker().start(seekerOpts); + var noTessels = opts.authorized ? + 'No Authorized Tessels Found.' : + 'No Tessels Found.' ; // When a Tessel is found seeker.on('tessel', function displayResults(tessel) { @@ -55,7 +58,7 @@ Tessel.list = function(opts) { // If there were no Tessels found if (foundTessels.length === 0) { // Report the sadness - reject('No Tessels Found'); + reject(noTessels); } else if (foundTessels.length === 1) { // Close all opened connections and resolve controller.closeTesselConnections(foundTessels) @@ -122,12 +125,15 @@ Tessel.get = function(opts) { } // Create a seeker object and start detecting any Tessels var seeker = new discover.TesselSeeker().start(seekerOpts); + var noTessels = seekerOpts.authorized ? + 'No Authorized Tessels Found.' : + 'No Tessels Found.' ; function searchComplete() { // If we found no Tessels if (tessels.length === 0) { // Report it - reject('No Tessels Found.'); + reject(noTessels); return; } // The name match for a given Tessel happens upon discovery, not at
Make tessel found message contextually relevant to "authorized" filter
tessel_t2-cli
train
js
b35a4648787e9df311734d53749b79041fc149a6
diff --git a/src/views/boom/editor/chunk/location.php b/src/views/boom/editor/chunk/location.php index <HASH>..<HASH> 100644 --- a/src/views/boom/editor/chunk/location.php +++ b/src/views/boom/editor/chunk/location.php @@ -9,7 +9,7 @@ <label class="b-address"> <span>Address</span> - <textarea name="address"><?= $chunk->getAddress() ?></textarea> + <textarea name="address"><?= str_replace('<br />', "", $chunk->getAddress()) ?></textarea> </label> <label class="b-postcode">
Bugfix: remove HTML line breaks from address in location chunk editor
boomcms_boom-core
train
php
2bc60d4454ffc01fc48c1ed7c6594ca0565fd823
diff --git a/fastlane/lib/fastlane/setup/crashlytics_beta.rb b/fastlane/lib/fastlane/setup/crashlytics_beta.rb index <HASH>..<HASH> 100644 --- a/fastlane/lib/fastlane/setup/crashlytics_beta.rb +++ b/fastlane/lib/fastlane/setup/crashlytics_beta.rb @@ -14,6 +14,8 @@ module Fastlane fastfile = fastfile_template(keys[:api_key], keys[:build_secret], project.schemes.first) FileUtils.mkdir_p('fastlane') File.write('fastlane/Fastfile', fastfile) + UI.success('A Fastfile has been generated for you at ./fastlane/Fastfile') + UI.success('Run `fastlane beta` to build and upload to Beta by Crashlytics.') end end @@ -34,7 +36,9 @@ module Fastlane build_secret: script_array[2] } else - UI.important('Please enter your API Key and Build Secret:') + UI.important('fastlane was unable to detect your Fabric API Key and Build Secret.') + UI.important('Navigate to https://www.fabric.io/settings/organizations, select the appropriate organization,') + UI.important('and copy the API Key and Build Secret.') keys = {} loop do keys[:api_key] = UI.input('API Key:')
Add success message and prompt for API key/build secret (#<I>)
fastlane_fastlane
train
rb
7ac27f7b5c0c06390e60e18beae373aedc89ff49
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -199,7 +199,7 @@ if (domain) { // TODO: remove in future! if (domain.create().dispose) { - it("shouldn't run taskks bound to disposed domains", function (done) { + it("shouldn't run tasks bound to disposed domains", function (done) { var d = domain.create(); asap(d.bind(function () { @@ -210,6 +210,20 @@ if (domain) { asap(done); }); + + it("shouldn't run tasks implicitly bounded to disposed domains", function (done) { + var d = domain.create(); + + d.run(function () { + asap(function () { + expect(true).to.be(false); + }); + }); + + d.dispose(); + + asap(done); + }); } }); }
Add test for tasks implicitly bounded to disposed domains.
kriskowal_asap
train
js
5d6a5faafec6b645b8837c06f0eea1bb8d8b64c3
diff --git a/lib/atomy/module.rb b/lib/atomy/module.rb index <HASH>..<HASH> 100644 --- a/lib/atomy/module.rb +++ b/lib/atomy/module.rb @@ -36,6 +36,9 @@ module Atomy end expanded.bytecode(gen, self) + rescue + puts "when compiling: #{node}" + raise end def evaluate(node, binding = nil)
when compiling fails, print the code that blew up
vito_atomy
train
rb
f10208d4789a3b1d9893e517e58694a4a68dcada
diff --git a/components/doc/blockui/index.js b/components/doc/blockui/index.js index <HASH>..<HASH> 100644 --- a/components/doc/blockui/index.js +++ b/components/doc/blockui/index.js @@ -3,6 +3,7 @@ import Link from 'next/link'; import { TabView, TabPanel } from '../../lib/tabview/TabView'; import { useLiveEditorTabs } from '../common/liveeditor'; import { CodeHighlight } from '../common/codehighlight'; +import { DevelopmentSection } from '../common/developmentsection'; const BlockUIDoc = memo(() => { @@ -492,6 +493,16 @@ export const BlockUIDemo = () => { </table> </div> + <h5>Accessibility</h5> + <DevelopmentSection> + <h6>Screen Reader</h6> + <p>BlockUI manages <i>aria-busy</i> state attribute when the UI gets blocked and unblocked. Any valid attribute is passed to the root element so additional attributes + like <i>role</i> and <i>aria-live</i> can be used to define live regions.</p> + + <h5>Keyboard Support</h5> + <p>Component does not include any interactive elements.</p> + </DevelopmentSection> + <h5>Dependencies</h5> <p>None.</p> </TabPanel>
a<I>y for BlockUI
primefaces_primereact
train
js
0be1464169363a40ea88cc71a99d9f3e6a7e748e
diff --git a/pytablewriter/_excel_writer.py b/pytablewriter/_excel_writer.py index <HASH>..<HASH> 100644 --- a/pytablewriter/_excel_writer.py +++ b/pytablewriter/_excel_writer.py @@ -193,7 +193,7 @@ class ExcelTableWriter(TableWriter, TextWriterInterface): Make a worksheet to the current workbook. :param str sheet_name: - Name of the worksheet to create. Name of the work sheet will + Name of the worksheet to create. Name of the work sheet will automatically decided (like ``"Sheet1"``) if the ``sheet_name`` is empty. """
Remove a space character of the end of the line
thombashi_pytablewriter
train
py
613982e9f137f0bfd58a7d3bb2b0a76cf4e553ff
diff --git a/lib/nesta/models.rb b/lib/nesta/models.rb index <HASH>..<HASH> 100644 --- a/lib/nesta/models.rb +++ b/lib/nesta/models.rb @@ -250,16 +250,19 @@ module Nesta end end - def body(scope = nil) - body_text = case @format + def body_markup + case @format when :mdown markup.sub(/^#[^#].*$\r?\n(\r?\n)?/, '') when :haml markup.sub(/^\s*%h1\s+.*$\r?\n(\r?\n)?/, '') when :textile markup.sub(/^\s*h1\.\s+.*$\r?\n(\r?\n)?/, '') - end - convert_to_html(@format, scope, body_text) + end + end + + def body(scope = nil) + convert_to_html(@format, scope, body_markup) end def categories diff --git a/spec/models_spec.rb b/spec/models_spec.rb index <HASH>..<HASH> 100644 --- a/spec/models_spec.rb +++ b/spec/models_spec.rb @@ -408,6 +408,10 @@ describe "Page", :shared => true do it "should not include metadata in the HTML" do @article.to_html.should_not have_tag("p", /^Date/) end + + it "should not include heading in body markup" do + @article.body_markup.should_not include("My article"); + end it "should not include heading in body" do @article.body.should_not have_tag("h1", "My article")
Factor out body_markup as its own method in Page
gma_nesta
train
rb,rb
fb693a40963c110c3b27baeeea33b8f961af0365
diff --git a/salt/modules/network.py b/salt/modules/network.py index <HASH>..<HASH> 100644 --- a/salt/modules/network.py +++ b/salt/modules/network.py @@ -86,7 +86,10 @@ def ping(host, timeout=False, return_boolean=False): salt '*' network.ping archlinux.org timeout=3 ''' if timeout: - cmd = 'ping -W {0} -c 4 {1}'.format(timeout, salt.utils.network.sanitize_host(host)) + if salt.utils.is_sunos(): + cmd = 'ping -c 4 {1} {0}'.format(timeout, salt.utils.network.sanitize_host(host)) + else: + cmd = 'ping -W {0} -c 4 {1}'.format(timeout, salt.utils.network.sanitize_host(host)) else: cmd = 'ping -c 4 {0}'.format(salt.utils.network.sanitize_host(host)) if return_boolean:
ping with timeout should work on sunos like systems - /usr/sbin/ping host [timeout]
saltstack_salt
train
py
ca1fbb90496d38d645cac3301c4bc903436348f2
diff --git a/lib/skeptic/rules/english_words_for_names.rb b/lib/skeptic/rules/english_words_for_names.rb index <HASH>..<HASH> 100644 --- a/lib/skeptic/rules/english_words_for_names.rb +++ b/lib/skeptic/rules/english_words_for_names.rb @@ -107,4 +107,4 @@ module Skeptic end end end -end \ No newline at end of file +end
Add a newline to the end of english_words_for_names.rb
skanev_skeptic
train
rb
97ed56f2b230fe4fa5c5563c48476695b3dec1e9
diff --git a/lib/pickle/email.rb b/lib/pickle/email.rb index <HASH>..<HASH> 100644 --- a/lib/pickle/email.rb +++ b/lib/pickle/email.rb @@ -64,13 +64,23 @@ module Pickle # e.g. Click here in <a href="http://confirm">Click here</a> def parse_email_for_anchor_text_link(email, link_text) - if match_data = email.body.match(%r{<a[^>]*href=['"]?([^'"]*)['"]?[^>]*?>[^<]*?#{link_text}[^<]*?</a>}) + if email.multipart? + body = email.html_part.body + else + body = email.body + end + if match_data = body.match(%r{<a[^>]*href=['"]?([^'"]*)['"]?[^>]*?>[^<]*?#{link_text}[^<]*?</a>}) match_data[1] end end def links_in_email(email, protos=['http', 'https']) - URI.extract(email.body.to_s, protos) + if email.multipart? + body = email.html_part.body + else + body = email.body + end + URI.extract(body.to_s, protos) end end
prefer the html_part in a multipart email and throw away the host:port part of the extracted urls.
ianwhite_pickle
train
rb
2491bcc3b3d043b31dbd33d8158a23b564711394
diff --git a/tracer/tracer.py b/tracer/tracer.py index <HASH>..<HASH> 100644 --- a/tracer/tracer.py +++ b/tracer/tracer.py @@ -43,6 +43,9 @@ class Tracer(object): self.base = os.path.join(os.path.dirname(__file__), "..", "..") + # internal project object, useful for obtaining certain kinds of info + self._p = angr.Project(self.binary) + self._setup() l.debug("accumulating basic block trace...") @@ -67,9 +70,6 @@ class Tracer(object): # whether we should follow the qemu trace self.no_follow = False - # internal project object, useful for obtaining certain kinds of info - self._p = angr.Project(self.binary) - # set of resolved dynamic functions which have been resolved # useful for handling PLT stubs self._resolved = set()
Initialize project before calling _setup
angr_angr
train
py
b96843401b7733daf81e21115020edbbacc48625
diff --git a/definitions/npm/moment_v2.x.x/flow_v0.28.x-/moment_v2.x.x.js b/definitions/npm/moment_v2.x.x/flow_v0.28.x-/moment_v2.x.x.js index <HASH>..<HASH> 100644 --- a/definitions/npm/moment_v2.x.x/flow_v0.28.x-/moment_v2.x.x.js +++ b/definitions/npm/moment_v2.x.x/flow_v0.28.x-/moment_v2.x.x.js @@ -93,6 +93,7 @@ declare class moment$MomentDuration { as(unit: string): number; get(unit: string): number; toJSON(): string; + toISOString(): string; } declare class moment$Moment { static ISO_8601: string;
Add toISOString to moment$Duration (#<I>)
flow-typed_flow-typed
train
js
053ba9005dc713642ea145d23f46991dc2316b77
diff --git a/builtin/providers/aws/resource_aws_network_acl.go b/builtin/providers/aws/resource_aws_network_acl.go index <HASH>..<HASH> 100644 --- a/builtin/providers/aws/resource_aws_network_acl.go +++ b/builtin/providers/aws/resource_aws_network_acl.go @@ -169,6 +169,13 @@ func resourceAwsNetworkAclRead(d *schema.ResourceData, meta interface{}) error { }) if err != nil { + if ec2err, ok := err.(awserr.Error); ok { + if ec2err.Code() == "InvalidNetworkAclID.NotFound" { + log.Printf("[DEBUG] Network ACL (%s) not found", d.Id()) + d.SetId("") + return nil + } + } return err } if resp == nil {
provider/aws: Remove Network ACL from state if not found
hashicorp_terraform
train
go
bba8d146c995aa00aeda69210737a76e25aa07b8
diff --git a/lib/fluent/plugin/out_forward.rb b/lib/fluent/plugin/out_forward.rb index <HASH>..<HASH> 100644 --- a/lib/fluent/plugin/out_forward.rb +++ b/lib/fluent/plugin/out_forward.rb @@ -123,18 +123,29 @@ class ForwardOutput < ObjectBufferedOutput end def write_objects(tag, es) + error = nil + wlen = @weight_array.length wlen.times do node = @weight_array[@rr] @rr = (@rr + 1) % wlen if node.available? - send_data(node, tag, es) - return + begin + send_data(node, tag, es) + return + rescue + # for load balancing during detecting crashed servers + error = $! # use the latest error + end end end - raise "no nodes are available" # TODO message + if error + raise error + else + raise "no nodes are available" # TODO message + end end private @@ -170,6 +181,10 @@ class ForwardOutput < ObjectBufferedOutput } } + # for load balancing during detecting crashed servers + coe = (regular_nodes.size * 6) / weight_array.size + weight_array *= coe if coe > 1 + r = Random.new(@rand_seed) weight_array.sort_by! { r.rand }
out_forward: improved load balancing during detecting crashed servers
fluent_fluentd
train
rb
0c4dd5d0cb73f760795bba2fa8121bc925e34209
diff --git a/lib/sycle.js b/lib/sycle.js index <HASH>..<HASH> 100644 --- a/lib/sycle.js +++ b/lib/sycle.js @@ -14,14 +14,14 @@ var sycle = module.exports = createApplication; */ function createApplication(options) { options = options || {}; - var app = new Application(); - + var sapp = new Application(); + sapp.sycle = sycle; if (options.loadBuiltinModels) { - app.phase(require('./boot/builtin-models')()); + sapp.phase(require('./boot/builtin-models')()); } - return app; + return sapp; }
added sycle to sapp
uugolab_sycle
train
js
3447604e603cf90d0824f2397f06b4af8ca551e1
diff --git a/furious/async.py b/furious/async.py index <HASH>..<HASH> 100644 --- a/furious/async.py +++ b/furious/async.py @@ -155,6 +155,17 @@ class Async(object): self._executing = False self._executed = True + if self._options.get('persist_result'): + self._persist_result() + + def _persist_result(self): + """Store this Async's result in persistent storage.""" + + self._prepare_persistence_engine() + + return self._persistence_engine.store_async_result( + self.id, self.result) + @property def _function_path(self): return self.job[0] @@ -363,13 +374,6 @@ class Async(object): import uuid return uuid.uuid4().hex - def persist_result(self): - """Store this Async's result in persistent storage.""" - self._prepare_persistence_engine() - - return self._persistence_engine.store_async_result( - self.id, self.result) - def _increment_recursion_level(self): """Increment current_depth based on either defaults or the enclosing Async.
In persist mode, call _persist_result when result set When `persist_result` is set in an Async's options, Async._persist_result will be called when the result is set one the Async. The persistence engine must be specified or an exception will be raised.
Workiva_furious
train
py
bb5d3f23dffa4c193672a646bf4656a58c653e25
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -381,6 +381,7 @@ def main(): library_dirs = [ os.path.join(TANGO_ROOT, 'lib'), os.path.join(BOOST_ROOT, 'lib'), + os.path.join(LOG4TANGO_ROOT, 'lib'), ] if os.name == 'nt':
Added LOG4TANGO_ROOT to configuration of include and lib directories in setup.py git-svn-id: <URL>
tango-controls_pytango
train
py
b13b43b1add1e6608201ed4f23a1100c4d7096f3
diff --git a/js/igvxhr.js b/js/igvxhr.js index <HASH>..<HASH> 100755 --- a/js/igvxhr.js +++ b/js/igvxhr.js @@ -102,12 +102,18 @@ var igvxhr = (function (igvxhr) { igvxhr.loadString = function (url, options) { var success = options.success, - compression, result; + compression, result, + fn, idx; + + // Strip parameters from url + // TODO -- handle local files with ? + idx = url.indexOf("?"); + fn = idx > 0 ? url.substring(0, idx) : url; if (options.bgz) { compression = BGZF; } - else if (url.endsWith(".gz")) { + else if (fn.endsWith(".gz")) { compression = GZIP; }
Fix test for ".gz" extension
igvteam_igv.js
train
js
2cc9cab17fb9814bcb48bdf7e5b284ebacff540d
diff --git a/zipline/protocol.py b/zipline/protocol.py index <HASH>..<HASH> 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -67,9 +67,17 @@ class Order(Event): class Portfolio(object): - def __init__(self, initial_values=None): - if initial_values: - self.__dict__ = initial_values + def __init__(self): + self.capital_used = 0.0 + self.starting_cash = 0.0 + self.portfolio_value = 0.0 + self.pnl = 0.0 + self.returns = 0.0 + self.cash = 0.0 + self.positions = Positions() + self.start_date = None + self.positions_value = 0.0 + self.portfolio_value = 0.0 def __getitem__(self, key): return self.__dict__[key]
MAINT: Initialize Portfolio object with default values for attributes instead of no attributes at all
quantopian_zipline
train
py
24e1274b90f440e63680534525049a35a18ae29e
diff --git a/bin/preinstall.js b/bin/preinstall.js index <HASH>..<HASH> 100644 --- a/bin/preinstall.js +++ b/bin/preinstall.js @@ -3,21 +3,19 @@ var os = require('os'), exec = require('child_process').exec, pkg = ''; -console.log('Installing background service utilities...'); - switch (os.platform().toLowerCase()){ case 'win32': - console.log('Installing node-windows service manager...'); + console.log('Installing Windows service manager...'); pkg = 'node-windows'; break; case 'darwin': - console.log('Installing node-mac daemon manager...'); + console.log('Installing Mac daemon manager...'); pkg = 'node-mac'; break; case 'linux': - console.log('Installing node-linux daemon manager...'); + console.log('Installing Linux daemon manager...'); pkg = 'node-linux'; break; } -exec('npm install -g '+pkg,function(){}); \ No newline at end of file +exec('npm install '+pkg,{cwd:__dirname},function(){}); \ No newline at end of file
Updated preinstall to support multi-OS daemon dependencies
ngnjs_NGN
train
js
440cc2915f0516bf13518d0f0a9bd4b60a990e5c
diff --git a/src/util/getElementTagLength.js b/src/util/getElementTagLength.js index <HASH>..<HASH> 100644 --- a/src/util/getElementTagLength.js +++ b/src/util/getElementTagLength.js @@ -1,9 +1,15 @@ import React from 'react'; import splitReactElement from './splitReactElement'; -export default (element, type = 'start') => { +const getElementTagLength = (element, type = 'start') => { if (React.isValidElement(element)) { - return splitReactElement(element)[type].length; + const length = splitReactElement(element)[type].length; + + const child = React.Children.toArray(element.props.children)[0]; + return length + (child && React.isValidElement(child) + ? getElementTagLength(child, type) + : 0 + ); } if (typeof element === 'object') { @@ -12,3 +18,5 @@ export default (element, type = 'start') => { return 0; }; + +export default getElementTagLength;
add recursive getElementTagLength call and revert comparison order for diff cleanliness
HubSpot_draft-convert
train
js
3b08fc7a78fe7742d5a29c5a4ad999169adaf3cb
diff --git a/test/session.js b/test/session.js index <HASH>..<HASH> 100644 --- a/test/session.js +++ b/test/session.js @@ -482,7 +482,7 @@ describe('session()', function(){ .get('/') .set('Cookie', cookie(res)) .expect(shouldSetCookie('connect.sid')) - .expect(shouldSetCookieToDifferentSessionId(res)) + .expect(shouldSetCookieToDifferentSessionId(sid(res))) .expect(200, 'session 2', done) }) })
tests: fix test validation of session ID closes #<I>
expressjs_session
train
js
c9a7b900ba125ffee4bcbc08755481abbd0c5ec5
diff --git a/src/collectors/postgres/postgres.py b/src/collectors/postgres/postgres.py index <HASH>..<HASH> 100644 --- a/src/collectors/postgres/postgres.py +++ b/src/collectors/postgres/postgres.py @@ -288,6 +288,8 @@ class RelationSizeStats(QueryStats): pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE reltype != 0 + AND relkind != 'S' + AND nspname NOT IN ('pg_catalog', 'information_schema') """
Restrict catalog / sequences from size metrics
python-diamond_Diamond
train
py
a4ebd3c7de21fff56ed321e6a8efc480edc47c06
diff --git a/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java b/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java index <HASH>..<HASH> 100644 --- a/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java +++ b/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java @@ -803,6 +803,20 @@ public class IconicsDrawable extends Drawable { } /** + * @return the IIcon which is used inside this IconicsDrawable + */ + public IIcon getIcon() { + return mIcon; + } + + /** + * @return the PlainIcon which is used inside this IconicsDrawable + */ + public String getPlainIcon() { + return mPlainIcon; + } + + /** * just a helper method to get the alpha value * * @return
* add new getters to get the icon from an IconicsDrawable
mikepenz_Android-Iconics
train
java
6ea46c550c36d029987648db92a8c0984aa51838
diff --git a/tests/Unit/Instruction/Relation/HasMany_indicates_a_polygamic_relationship.php b/tests/Unit/Instruction/Relation/HasMany_indicates_a_polygamic_relationship.php index <HASH>..<HASH> 100644 --- a/tests/Unit/Instruction/Relation/HasMany_indicates_a_polygamic_relationship.php +++ b/tests/Unit/Instruction/Relation/HasMany_indicates_a_polygamic_relationship.php @@ -68,7 +68,7 @@ class HasMany_indicates_a_polygamic_relationship extends TestCase function producing_an_extra_lazy_hasMany() { self::assertEquals( - HasManyProxies::inPropertyWithDifferentKey('contents', 'chapters', + HasManyProxies::inProperty('contents', VariadicConstructor::forThe(Contents::class), ProxyFactory::fromThis( SimpleHydrator::forThe(ChapterProxy::class),
Limit current test scope to properties with same keys
Stratadox_HydrationMapper
train
php
e1809daa0f85e54bab4f74d0ad5369c75999bb69
diff --git a/template/types/primitive/decimal_type.php b/template/types/primitive/decimal_type.php index <HASH>..<HASH> 100644 --- a/template/types/primitive/decimal_type.php +++ b/template/types/primitive/decimal_type.php @@ -41,8 +41,8 @@ echo require_with( $this->value = null; } elseif ('double' === ($type = gettype($value))) { $this->value = $value; - } elseif ('string' === $type && is_numeric($value)) { - $this->value = (float)$value; + } elseif ('integer' === $type || ('string' === $type && is_numeric($value))) { + $this->value = floatval($value); } else { throw new \InvalidArgumentException(sprintf('<?php echo $fhirName; ?> value must be null, float, or numeric string, %s seen.', gettype($value))); }
allowing integers to be passed into FHIRDecimalPrimitive
dcarbone_php-fhir
train
php
ddedf2ebc25c2973128ba2de81a82934f54df86f
diff --git a/aws/internal/service/lakeformation/waiter/status.go b/aws/internal/service/lakeformation/waiter/status.go index <HASH>..<HASH> 100644 --- a/aws/internal/service/lakeformation/waiter/status.go +++ b/aws/internal/service/lakeformation/waiter/status.go @@ -3,6 +3,7 @@ package waiter import ( "fmt" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/lakeformation" "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -19,6 +20,10 @@ func PermissionsStatus(conn *lakeformation.LakeFormation, input *lakeformation.L continue } + if aws.StringValue(input.Principal.DataLakePrincipalIdentifier) != aws.StringValue(permission.Principal.DataLakePrincipalIdentifier) { + continue + } + permissions = append(permissions, permission) } return !lastPage
i/lakeformation: Ensure same principal
terraform-providers_terraform-provider-aws
train
go
a29aa3a556746333a8c12230c1cd618d7474e444
diff --git a/lib/kubeclient/aws_eks_credentials.rb b/lib/kubeclient/aws_eks_credentials.rb index <HASH>..<HASH> 100644 --- a/lib/kubeclient/aws_eks_credentials.rb +++ b/lib/kubeclient/aws_eks_credentials.rb @@ -38,7 +38,7 @@ module Kubeclient 'X-K8s-Aws-Id' => eks_cluster } ) - kube_token = 'k8s-aws-v1.' + Base64.urlsafe_encode64(presigned_url_string.to_s).chomp('==') + kube_token = 'k8s-aws-v1.' + Base64.urlsafe_encode64(presigned_url_string.to_s).sub(/=(.*)?/,'') kube_token end end
Remove padding from Base<I> token in AmazonEksCredentials The Base<I> encoding of the signature request sometimes comes back with 1 or 2 equals (or 'padding' - <URL>
abonas_kubeclient
train
rb
4c045a968feaf2a0d44dfd4867b7d0fc2d2b0420
diff --git a/display/render/src/main/java/org/openscience/cdk/renderer/RendererModel.java b/display/render/src/main/java/org/openscience/cdk/renderer/RendererModel.java index <HASH>..<HASH> 100644 --- a/display/render/src/main/java/org/openscience/cdk/renderer/RendererModel.java +++ b/display/render/src/main/java/org/openscience/cdk/renderer/RendererModel.java @@ -200,8 +200,7 @@ public class RendererModel implements Serializable, Cloneable { * @param value new {@link IGeneratorParameter} value */ @TestMethod("testSetRenderingParameter") - public <T extends IGeneratorParameter<S>,S> void set( - Class<T> paramType, S value) { + public <T extends IGeneratorParameter<S>,S,U extends S> void set(Class<T> paramType, U value) { T parameter = getParameter(paramType); parameter.setValue(value); }
Allow inherited parameters to be set in the render model. This would previously require an explicit cast.
cdk_cdk
train
java
3ede1515ae54564b5f51de61ce9ae952f9ab42cb
diff --git a/src/main/java/com/qiniu/storage/FixBlockUploader.java b/src/main/java/com/qiniu/storage/FixBlockUploader.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/qiniu/storage/FixBlockUploader.java +++ b/src/main/java/com/qiniu/storage/FixBlockUploader.java @@ -761,9 +761,8 @@ public class FixBlockUploader { index++; final int idx = index + 0; dataWraper = new DataWraper() { - int size; public int getSize() { - return size; + return readLength; } public int getIndex() { @@ -773,10 +772,10 @@ public class FixBlockUploader { @Override public byte[] getData() throws IOException { byte[] data = new byte[blockDataSize]; + lock.lock(); try { - lock.lock(); fis.seek(start); - size = fis.read(data); + int size = fis.read(data); assert readLength == size : "read size should equals " + "(int)Math.min(totalLength - alreadyReadSize, blockDataSize): " + readLength; } finally {
fix getSize() does not depends on seq
qiniu_java-sdk
train
java
f9ad3ece34509fe162e2cbe222ed0ba686eb5000
diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js index <HASH>..<HASH> 100644 --- a/js/lib/ext.core.LinkHandler.js +++ b/js/lib/ext.core.LinkHandler.js @@ -302,7 +302,7 @@ WikiLinkHandler.prototype.renderFile = function ( token, frame, cb, fileName, ti bits = getOption( origOText.trim() ), normalizedBit0 = bits ? bits.k.trim().toLowerCase() : null, key = bits ? WikitextConstants.Image.PrefixOptions[normalizedBit0] : null; - if (imgOption && key !== null) { + if (imgOption && key === null) { // the options array only has non-localized values options.push( new KV(imgOption, shortCanonicalOption ) ); oHash[imgOption] = shortCanonicalOption;
Fix stupid image bug In dealing with one regression I caused another. Change-Id: Ib<I>adfcefaad6fa<I>ae3cd<I>a7a8bc<I>c7fd
wikimedia_parsoid
train
js
a18f2a7a9768a512a6416a635f071503641c43bc
diff --git a/src/Codeception/Test/Loader.php b/src/Codeception/Test/Loader.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Test/Loader.php +++ b/src/Codeception/Test/Loader.php @@ -130,7 +130,7 @@ class Loader $formatFinder = clone($finder); $testFiles = $formatFinder->name($format->getPattern()); foreach ($testFiles as $test) { - $pathname = str_replace("//", "/", $test->getPathname()); + $pathname = str_replace(["//", "\\\\"], ["/", "\\"], $test->getPathname()); $format->loadTests($pathname); } $this->tests = array_merge($this->tests, $format->getTests());
Fixed issue #<I> by removing double backslashes from the filepath
Codeception_base
train
php
3d39feeac918cd866009ef281c2349ed89c7dfd2
diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index <HASH>..<HASH> 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -405,7 +405,7 @@ class ViewTask extends Shell { $this->out("view <controller>"); $this->out("\twill read the given controller for methods"); $this->out("\tand bake corresponding views."); - $this->out("\tIf var scaffold is found it will bake the scaffolded actions"); + $this->out("\tIf var scaffold is found it will bake the CRUD actions"); $this->out("\t(index,view,add,edit)"); $this->out(''); $this->out("view <controller> <action>"); @@ -414,7 +414,10 @@ class ViewTask extends Shell { $this->out("view <controller> <template> <alias>"); $this->out("\twill use the template specified"); $this->out("\tbut name the file based on the alias"); - $this->out(""); + $this->out(''); + $this->out("view all"); + $this->out("\tBake all CRUD action views for all controllers."); + $this->out("\tRequires that models and controllers exist."); $this->_stop(); }
Adding help() entry for bake view all
cakephp_cakephp
train
php
c080e575e1e30d28595772189ceced9b6f30b53d
diff --git a/src/core.js b/src/core.js index <HASH>..<HASH> 100755 --- a/src/core.js +++ b/src/core.js @@ -102,11 +102,11 @@ window.me = window.me || {}; /** * Specify whether to stop the game when losing focus or not<br> * The engine restarts on focus if this is enabled. - * default value : true<br> + * default value : false<br> * @type Boolean * @memberOf me.sys */ - stopOnBlur : true, + stopOnBlur : false, /** * Specify the rendering method for layers <br>
fixed both `pauseOnBlur` and `StopOnBlur` both being enabled by default I let `pauseOnBlur` to true so that we restore the same behavior than in previous version.
melonjs_melonJS
train
js
fafa673d87c598220b18ee8b5704c33267a0e6f8
diff --git a/src/DataForm/Field/File.php b/src/DataForm/Field/File.php index <HASH>..<HASH> 100644 --- a/src/DataForm/Field/File.php +++ b/src/DataForm/Field/File.php @@ -200,6 +200,11 @@ class File extends Field */ protected function updateName($save) { + if (!(\Schema::connection($this->model->getConnectionName())->hasColumn($this->model->getTable(), $this->db_name) + || $this->model->hasSetMutator($this->db_name))) + { + return true; + } if (isset($this->new_value)) { $this->model->setAttribute($this->db_name, $this->new_value); } else {
fix file & image upload when is not a db-field
zofe_rapyd-laravel
train
php
6e70577b46072a8d95d8d1a9013c180eb157e81b
diff --git a/spikeextractors/extractors/tridesclousextractor/tridesclousextractor.py b/spikeextractors/extractors/tridesclousextractor/tridesclousextractor.py index <HASH>..<HASH> 100644 --- a/spikeextractors/extractors/tridesclousextractor/tridesclousextractor.py +++ b/spikeextractors/extractors/tridesclousextractor/tridesclousextractor.py @@ -13,9 +13,9 @@ class TridesclousSortingExtractor(SortingExtractor): SortingExtractor.__init__(self) self.dataio = tdc.DataIO(tdc_folder) if chan_grp is None: - # if chan_grp is not provide take the first one if unique + # if chan_grp is not provided, take the first one if unique chan_grps = list(self.dataio.channel_groups.keys()) - assert len(chan_grps) == 1, 'There are sevreal in the folder chan_grp, specify it' + assert len(chan_grps) == 1, 'There are several in the folder chan_grp, specify it' chan_grp = chan_grps[0] self.chan_grp = chan_grp
Update tridesclousextractor.py
SpikeInterface_spikeextractors
train
py
afc9ff556b8b2dc0d3e9057aa8ada95e1fee1023
diff --git a/supervisor_logging/__init__.py b/supervisor_logging/__init__.py index <HASH>..<HASH> 100755 --- a/supervisor_logging/__init__.py +++ b/supervisor_logging/__init__.py @@ -21,12 +21,12 @@ Send received events to a syslog instance. from __future__ import print_function import logging -import logging.handlers import os import re import socket import sys import time +from logging.handlers import SysLogHandler class PalletFormatter(logging.Formatter): @@ -63,13 +63,6 @@ class PalletFormatter(logging.Formatter): return message -class SysLogHandler(logging.handlers.SysLogHandler): - """ - A SysLogHandler not appending NUL character to messages - """ - append_nul = False - - def get_headers(line): """ Parse Supervisor message headers.
Remove append_nul as not working and not tested for
infoxchange_supervisor-logging
train
py
f5ae85881f47bfffe75ff2826e27d56514d69190
diff --git a/pythran/tests/test_ipython.py b/pythran/tests/test_ipython.py index <HASH>..<HASH> 100644 --- a/pythran/tests/test_ipython.py +++ b/pythran/tests/test_ipython.py @@ -1,10 +1,15 @@ +import os import subprocess from unittest import TestCase class TestIpythonMagic(TestCase): def test_loadext_and_run(self): - subprocess.check_call(['ipython', 'ipython_script.ipy']) + subprocess.check_call(['ipython', + os.path.join(os.path.dirname(__file__), + 'ipython_script.ipy')]) def test_loadext_and_run_timeit_twice(self): - subprocess.check_call(['ipython', 'ipython_script_timeit.ipy']) + subprocess.check_call(['ipython', + os.path.join(os.path.dirname(__file__), + 'ipython_script_timeit.ipy')])
Fix ipython testing Use explicit path in test.
serge-sans-paille_pythran
train
py
ca1aa65fc27848871c49103c1fa69599766f515a
diff --git a/flask_ci/tasks/run_pep8.py b/flask_ci/tasks/run_pep8.py index <HASH>..<HASH> 100644 --- a/flask_ci/tasks/run_pep8.py +++ b/flask_ci/tasks/run_pep8.py @@ -15,7 +15,7 @@ class Reporter(object): if options.get('pep8-rcfile', None): return options['pep8-rcfile'] - rcfile = getattr(settings, 'PEP8_RCFILE', None) + rcfile = getattr(settings, 'PEP8_RCFILE', '') if os.path.exists(rcfile): return rcfile
Fixing rcfile error on pep8 tasks
vicenteneto_flask-ci
train
py