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
434ca7a595d1f680f4a0a1e3833a58acbbefee0c
diff --git a/src/idle/idle.js b/src/idle/idle.js index <HASH>..<HASH> 100644 --- a/src/idle/idle.js +++ b/src/idle/idle.js @@ -119,7 +119,7 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage']) function getExpiry() { var obj = LocalStorage.get('expiry'); - return obj.time; + return new Date(obj.time); } function setExpiry(date) { @@ -131,9 +131,6 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage']) _options: function() { return options; }, - _getNow: function() { - return new Date(); - }, setIdle: function(seconds) { changeOption(this, setIdle, seconds); }, @@ -142,7 +139,7 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage']) }, isExpired: function() { var expiry = getExpiry(); - return expiry && expiry <= this._getNow(); + return expiry && expiry <= Date.now(); }, running: function() { return state.running;
Update idle.js Changed "getExpiry()" to return a new Date object from "obj.time" because of the changes I made to the ngIdle.localStorage service. Replaced "svc._getNow" with "Date.now()"
HackedByChinese_ng-idle
train
js
54c43c67b042882a251fca46103b4d72f2f4eb5f
diff --git a/minium-webelements/src/main/java/minium/web/internal/actions/HighlightInteraction.java b/minium-webelements/src/main/java/minium/web/internal/actions/HighlightInteraction.java index <HASH>..<HASH> 100644 --- a/minium-webelements/src/main/java/minium/web/internal/actions/HighlightInteraction.java +++ b/minium-webelements/src/main/java/minium/web/internal/actions/HighlightInteraction.java @@ -20,12 +20,14 @@ import minium.web.EvalWebElements; public class HighlightInteraction extends AbstractWebInteraction { + public static final String HIGHLIGHT_EVAL_EXPR = "$(this).highlight && $(this).highlight();"; + public HighlightInteraction(Elements elems) { super(elems); } @Override protected void doPerform() { - getSource().as(EvalWebElements.class).eval("$(this).highlight();"); + getSource().as(EvalWebElements.class).eval(HIGHLIGHT_EVAL_EXPR); } }
DebugInteraction now provides its eval expression as a constant for use in minium developer
viltgroup_minium
train
java
2a1d8b4f296b7c98ff9650ca709423adf82b21a8
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,6 +72,7 @@ gulp.task('watch', ['build'], function () { gulp.task('dev', ['watch'], function() { return gulp.src('build') .pipe(webserver({ + host: '0.0.0.0', port: 8080, livereload: false, fallback: 'index.html'
Fixes #<I>: Development server can't be accessed from local network
mozilla_webmaker-android
train
js
790a63cce08a2f269ab4a6242a0329e970f29ded
diff --git a/lib/logster/redis_store.rb b/lib/logster/redis_store.rb index <HASH>..<HASH> 100644 --- a/lib/logster/redis_store.rb +++ b/lib/logster/redis_store.rb @@ -16,23 +16,31 @@ module Logster end - def report(severity, progname, message, opts = nil) + def report(severity, progname, message, opts = {}) return if (!message || (String === message && message.empty?)) && skip_empty return if level && severity < level return if @ignore && @ignore.any?{|pattern| message =~ pattern} - message = Logster::Message.new(severity, progname, message, (opts && opts[:timestamp])) + message = Logster::Message.new(severity, progname, message, opts[:timestamp]) - if opts && backtrace = opts[:backtrace] + env = opts[:env] + backtrace = opts[:backtrace] + + if env + if env[:backtrace] + # Special - passing backtrace through env + backtrace = env.delete(:backtrace) + end + + message.populate_from_env(env) + end + + if backtrace message.backtrace = backtrace else message.backtrace = caller.join("\n") end - if opts && env = opts[:env] - message.populate_from_env(env) - end - # multi for integrity @redis.multi do @redis.hset(hash_key, message.key, message.to_json)
Delete the backtrace from env when it's passed through there
discourse_logster
train
rb
716969c01377538116c8ebcd32c4ee8887f14063
diff --git a/src/config/prettier.config.js b/src/config/prettier.config.js index <HASH>..<HASH> 100644 --- a/src/config/prettier.config.js +++ b/src/config/prettier.config.js @@ -2,4 +2,5 @@ module.exports = { semi: false, singleQuote: true, trailingComma: 'es5', + proseWrap: 'always', }
fix(prettier): include proseWrap: always in Prettier config
macklinu_mdu-scripts
train
js
b9ff3a0741d9ec927f60f44a6b9a612f2891071a
diff --git a/pkg/labels/selector.go b/pkg/labels/selector.go index <HASH>..<HASH> 100644 --- a/pkg/labels/selector.go +++ b/pkg/labels/selector.go @@ -146,6 +146,20 @@ func (r *Requirement) Matches(ls Labels) bool { } } +func (r *Requirement) Key() string { + return r.key +} +func (r *Requirement) Operator() Operator { + return r.operator +} +func (r *Requirement) Values() sets.String { + ret := sets.String{} + for k := range r.strValues { + ret.Insert(k) + } + return ret +} + // Return true if the LabelSelector doesn't restrict selection space func (lsel LabelSelector) Empty() bool { if lsel == nil {
Add getters for labels.Requirement Useful for some label backends that need access to the fields.
kubernetes_kubernetes
train
go
841289f6b0a49506ce97f6475e4828bf6e4453a4
diff --git a/argh/assembling.py b/argh/assembling.py index <HASH>..<HASH> 100644 --- a/argh/assembling.py +++ b/argh/assembling.py @@ -231,11 +231,11 @@ def set_default_command(parser, function): # 1) make sure that this declared arg conforms to the function # signature and therefore only refines an inferred arg: # - # @arg('foo') maps to func(foo) - # @arg('--bar') maps to func(bar=...) + # @arg('my-foo') maps to func(my_foo) + # @arg('--my-bar') maps to func(my_bar=...) # - dest = _get_dest(parser, kw) + dest = _get_dest(parser, kw).replace('_', '-') if dest in inferred_dict: # 2) merge declared args into inferred ones (e.g. help=...) inferred_dict[dest].update(**kw)
Normalize hyphen/underscore when comparing a declared arg with function signature
neithere_argh
train
py
1a3b20f56c2a26b4e74b61449ea94a49b0f4a92f
diff --git a/src/Webiny/Component/Router/Route/RouteCollection.php b/src/Webiny/Component/Router/Route/RouteCollection.php index <HASH>..<HASH> 100755 --- a/src/Webiny/Component/Router/Route/RouteCollection.php +++ b/src/Webiny/Component/Router/Route/RouteCollection.php @@ -34,7 +34,7 @@ class RouteCollection } /** - * Adds a Route to current collection. + * Adds a Route to the end of current collection. * * @param string $name Route name. * @param Route $route Instance of Route. @@ -45,6 +45,17 @@ class RouteCollection } /** + * Adds a Route to the beginning of current collection. + * + * @param string $name Route name. + * @param Route $route Instance of Route. + */ + function prepend($name, Route $route) + { + $this->_routes->prepend($name, $route); + } + + /** * Removes the route under the given name. * * @param string $name Route name.
Added option to prepend a route
Webiny_Framework
train
php
d14f8ea24a7728476a1cfd2df9cd1c2eca10abf8
diff --git a/hazelcast/src/main/java/com/hazelcast/nio/tcp/AbstractIOSelector.java b/hazelcast/src/main/java/com/hazelcast/nio/tcp/AbstractIOSelector.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/nio/tcp/AbstractIOSelector.java +++ b/hazelcast/src/main/java/com/hazelcast/nio/tcp/AbstractIOSelector.java @@ -18,7 +18,6 @@ package com.hazelcast.nio.tcp; import com.hazelcast.core.HazelcastException; import com.hazelcast.logging.ILogger; -import com.hazelcast.logging.Logger; import java.io.IOException; import java.nio.channels.SelectionKey; @@ -72,7 +71,7 @@ public abstract class AbstractIOSelector extends Thread implements IOSelector { }); interrupt(); } catch (Throwable t) { - Logger.getLogger(AbstractIOSelector.class).finest("Exception while waiting for shutdown", t); + logger.finest("Exception while waiting for shutdown", t); } } @@ -151,7 +150,7 @@ public abstract class AbstractIOSelector extends Thread implements IOSelector { } selector.close(); } catch (final Exception e) { - Logger.getLogger(AbstractIOSelector.class).finest("Exception while closing selector", e); + logger.finest("Exception while closing selector", e); } } }
Minor AbstractIOSelector logging cleanup Instead of obtaining logger through: Logger.getLogger(AbstractIOSelector.class) we make use of the logger field that is part of the AbstractIOSelector.
hazelcast_hazelcast
train
java
9f97f83ac1997e1fb0234fd82ff2344eebd32ad7
diff --git a/test/test_library/unit/test_database.py b/test/test_library/unit/test_database.py index <HASH>..<HASH> 100644 --- a/test/test_library/unit/test_database.py +++ b/test/test_library/unit/test_database.py @@ -74,11 +74,6 @@ class LibraryDbTest(unittest.TestCase): .filter_by(**filter_kwargs) assert query.first() is None - @unittest.skip('Will implement it just before merge.') - def test_initialization_raises_exception_if_driver_not_found(self): - with self.assertRaises(ValueError): - LibraryDb(driver='1') - def test_initialization_populates_port(self): db = LibraryDb(driver='postgres', port=5232) self.assertIn('5232', db.dsn) @@ -446,11 +441,6 @@ class LibraryDbTest(unittest.TestCase): PartitionFactory(dataset=ds1) self.sqlite_db.session.commit() - @unittest.skip('Uncomment and implement.') - def test_creates_code_table(self): - # CodeFactory() - self.sqlite_db.session.commit() - def test_creates_columnstat_table(self): self.sqlite_db.session.commit() ColumnStatFactory()
library.database tests cleaned up. CivicKnowledge/ambry#8.
CivicSpleen_ambry
train
py
f6f1d333fe9d8317c6fa703a80d31a4153207074
diff --git a/core/renderMiddleware.js b/core/renderMiddleware.js index <HASH>..<HASH> 100644 --- a/core/renderMiddleware.js +++ b/core/renderMiddleware.js @@ -1,5 +1,5 @@ -var logger = require('./logging').getLogger(__LOGGER__), +var logger = require('./logging').getLogger(__LOGGER__({guage:{hi:1}})), React = require('react/addons'), RequestContext = require('./context/RequestContext'), ClientCssHelper = require('./util/ClientCssHelper'), @@ -271,6 +271,7 @@ function setupLateArrivals(req, res, context, start) { var promises = notLoaded.map( result => result.entry.dfd.promise ); Q.allSettled(promises).then(function () { res.end("</body></html>"); + logger.guage(`count_late_arrivals.${routeName}`, notLoaded.length); logger.time(`all_done.${routeName}`, new Date - start); }); }
Add a guage for number of late arrivals
redfin_react-server
train
js
419f695405b8c4f9655a765d87027b305225f0b2
diff --git a/client-vendor/after-body/jquery.floatbox/jquery.floatbox.js b/client-vendor/after-body/jquery.floatbox/jquery.floatbox.js index <HASH>..<HASH> 100755 --- a/client-vendor/after-body/jquery.floatbox/jquery.floatbox.js +++ b/client-vendor/after-body/jquery.floatbox/jquery.floatbox.js @@ -96,7 +96,7 @@ this.$floatbox.trap(); this.$layer.data('floatbox', this); - $element.trigger('floatbox-open'); + $element.triggerHandler('floatbox-open'); }, close: function() { if (!this.options.closable) { @@ -106,7 +106,7 @@ if (this.$parent.length) { this.$parent.append($element); } - this.$floatbox.trigger('floatbox-close'); + this.$floatbox.triggerHandler('floatbox-close'); this.$layer.remove(); $viewport.children('.floatbox-layer:last').addClass('active'); if (lastFocusedElement) { @@ -122,7 +122,7 @@ $body.css({top: 0, left: 0}); } $(window).off('resize.floatbox', this.windowResizeCallback); - $element.trigger('floatbox-close'); + $element.triggerHandler('floatbox-close'); this.$parent = null; this.$floatbox = null;
Make sure events "foatbox-open" and "-close" don't bubble jQuery's `trigger()` triggers a native event on the DOM that bubbles up through the element hierarchy. We usually bind on specific elements about these events. So if a floatbox *inside* such an element is opened/closed we wrongly assume the outer floatbox got opened/closed. The function `triggerHandler()` only triggers jQuery-internal handlers, and thus doesn't bubble.
cargomedia_cm
train
js
b636233977263d129892734786ff76f8f62d43d0
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -439,6 +439,7 @@ class Cnyks { console.error("Failure in cnyks", err, err && err.stack); throw "Failure in cnyks"; })).then(function() { + process.stdin.unref(); process.emit('cnyksEnd'); });
Should unref stdin
131_cnyks
train
js
98782708b0ac89925a707002ed8144a799512aff
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools import setup, find_packages general_requirements = [ 'dpath >= 1.5.0, < 2.0.0', 'pytest >= 4.4.1, < 6.0.0', # For openfisca test - 'numpy >= 1.11, < 1.19', + 'numpy >= 1.11, < 1.21', 'psutil >= 5.4.7, < 6.0.0', 'PyYAML >= 3.10', 'sortedcontainers == 2.2.2',
Update numpy Needed for M1 processors
openfisca_openfisca-core
train
py
55bc368f50a1ea384c30e8f596ab3bfc0a307927
diff --git a/pkg/synthetictests/allowedalerts/all.go b/pkg/synthetictests/allowedalerts/all.go index <HASH>..<HASH> 100644 --- a/pkg/synthetictests/allowedalerts/all.go +++ b/pkg/synthetictests/allowedalerts/all.go @@ -22,7 +22,7 @@ func AllAlertTests() []AlertTest { newAlert("etcd", "etcdHighNumberOfLeaderChanges").firing(), newAlert("kube-apiserver", "KubeAPIErrorBudgetBurn").pending().neverFail(), - newAlert("kube-apiserver", "KubeAPIErrorBudgetBurn").firing(), + newAlert("kube-apiserver", "KubeAPIErrorBudgetBurn").firing().neverFail(), // https://bugzilla.redhat.com/show_bug.cgi?id=2039539 newAlert("kube-apiserver", "KubeClientErrors").pending().neverFail(), newAlert("kube-apiserver", "KubeClientErrors").firing(),
allow burn budget to flake until kube-apiserver team finds and fixes it
openshift_origin
train
go
a298e9824320be4dc346287d31eb259e80420b62
diff --git a/lib/display/index.js b/lib/display/index.js index <HASH>..<HASH> 100644 --- a/lib/display/index.js +++ b/lib/display/index.js @@ -72,8 +72,11 @@ function Display(transitive) { // set up the svg display var div = d3.select(el) - .attr('class', 'Transitive') - .call(zoom); + .attr('class', 'Transitive'); + + if(transitive.options.zoomEnabled) { + div.call(zoom); + } this.svg = div .append('svg') diff --git a/lib/transitive.js b/lib/transitive.js index <HASH>..<HASH> 100644 --- a/lib/transitive.js +++ b/lib/transitive.js @@ -45,6 +45,7 @@ function Transitive(options) { this.options = options; if (this.options.useDynamicRendering === undefined) this.options.useDynamicRendering = true; + if (this.options.zoomEnabled === undefined) this.options.zoomEnabled = true; if (options.el) this.setElement(options.el);
Allow enabling/disabling of native pan/zoom support
conveyal_transitive.js
train
js,js
7adb8eb65f2900843a33b7b38ac867855c12f0c1
diff --git a/tests/mask.js b/tests/mask.js index <HASH>..<HASH> 100644 --- a/tests/mask.js +++ b/tests/mask.js @@ -1,17 +1,17 @@ /** - * @file testing the Masking parameters in SauceNao + * @file Test file for Sagiri for DB mask support. * @author Capuccino - * @license MIT - **/ + * @author Ovyerus + */ - const Handler = require('../'); - const token = require('./token.json').token; - const s = new Handler(token, { - // disable site index for this test - dbMaskI: 0, - dbMask: 10, - testMode: 1 - }); - - //one-liners ecksde - s.getSauce('https://cdn.awwni.me/zqqd.jpg').then(res => console.log(res)).catch(err => console.error(err)); \ No newline at end of file +const Sagiri = require('../'); +const token = require('./token.json').token; + +const sourcer = new Sagiri(token, { + dbMaskI: 0, + dbMask: 10, + testMode: 1 +}); + + +sourcer.getSauce('https://cdn.awwni.me/zqqd.jpg').then(res => console.log(res)).catch(err => console.error(err)); \ No newline at end of file
Make mask test confrom to rest of project standards
ClarityCafe_Sagiri
train
js
0af2dedd96e973f4ed59af0cc325a70ca0b9100a
diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go b/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go index <HASH>..<HASH> 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go @@ -56,7 +56,7 @@ var ( KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff command. By default, the "diff" command available in your path will be - run with "-u" (unicode) and "-N" (treat new files as empty) options.`)) + run with "-u" (unified diff) and "-N" (treat absent files as empty) options.`)) diffExample = templates.Examples(i18n.T(` # Diff resources included in pod.json. kubectl diff -f pod.json
Fix description of diff flags. Running `diff -u` produces a unified diff. It isn't related to Unicode. Also, `diff -N` treats _absent_ files as empty, not new files.
kubernetes_kubernetes
train
go
6736c24f81a91bf6ca4713c7dd047113d016cb52
diff --git a/ModelBundle/Repository/ContentRepository.php b/ModelBundle/Repository/ContentRepository.php index <HASH>..<HASH> 100644 --- a/ModelBundle/Repository/ContentRepository.php +++ b/ModelBundle/Repository/ContentRepository.php @@ -673,4 +673,19 @@ class ContentRepository extends AbstractAggregateRepository implements FieldAuto return $this->countDocumentAggregateQuery($qa, self::ALIAS_FOR_GROUP); } + + /** + * @param string $contentId + * + * @return ContentInterface + */ + public function findLastVersion($contentId) + { + $qa = $this->createAggregationQuery(); + $qa->match(array('deleted' => false)); + $qa->match(array('contentId' => $contentId)); + $qa->sort(array('createdAt' => -1)); + + return $this->singleHydrateAggregateQuery($qa); + } }
add repository method to allow create content in new language (#<I>)
open-orchestra_open-orchestra-model-bundle
train
php
287318f0bd638cf375bfa919758fffae29a4f40f
diff --git a/types/encrypted_key.go b/types/encrypted_key.go index <HASH>..<HASH> 100644 --- a/types/encrypted_key.go +++ b/types/encrypted_key.go @@ -103,15 +103,22 @@ func (ek *EncryptedKey) DecryptSymmetricKey(cert *tls.Certificate) (cipher.Block var h hash.Hash switch ek.EncryptionMethod.DigestMethod.Algorithm { + case "": + return nil, fmt.Errorf("missing digest algorithm") case MethodSHA1: h = sha1.New() case MethodSHA256: h = sha256.New() case MethodSHA512: h = sha512.New() + default: + return nil, fmt.Errorf("unsupported digest algorithm: %v", + ek.EncryptionMethod.DigestMethod.Algorithm) } switch ek.EncryptionMethod.Algorithm { + case "": + return nil, fmt.Errorf("missing encryption algorithm") case MethodRSAOAEP, MethodRSAOAEP2: pt, err := rsa.DecryptOAEP(h, rand.Reader, pk, cipherText, nil) if err != nil {
Key decryption function should catch empty invalid digest/encryption algorithm
russellhaering_gosaml2
train
go
aa09afd85ff2a5a57fc533a07436b1bfe0ef5172
diff --git a/go/vt/vtctl/reparentutil/util.go b/go/vt/vtctl/reparentutil/util.go index <HASH>..<HASH> 100644 --- a/go/vt/vtctl/reparentutil/util.go +++ b/go/vt/vtctl/reparentutil/util.go @@ -107,7 +107,6 @@ func reparentReplicas(ctx context.Context, ev *events.Reparent, logger logutil.L var replicaMutex sync.Mutex replCtx, replCancel := context.WithTimeout(ctx, opts.waitReplicasTimeout) - defer replCancel() event.DispatchUpdate(ev, "reparenting all tablets") @@ -211,6 +210,11 @@ func reparentReplicas(ctx context.Context, ev *events.Reparent, logger logutil.L return nil, vterrors.Wrapf(primaryErr, "failed to PopulateReparentJournal on primary: %v", primaryErr) } + go func() { + replWg.Wait() + defer replCancel() + }() + select { case <-replSuccessCtx.Done(): // At least one replica was able to SetMaster successfully
do not cancel replication context until all the replicas are done
vitessio_vitess
train
go
bb6b5f004575f9ecabc9f045176d46500e6eee53
diff --git a/src/frontend/org/voltdb/client/exampleutils/ClientConnectionPool.java b/src/frontend/org/voltdb/client/exampleutils/ClientConnectionPool.java index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/client/exampleutils/ClientConnectionPool.java +++ b/src/frontend/org/voltdb/client/exampleutils/ClientConnectionPool.java @@ -203,12 +203,12 @@ public class ClientConnectionPool } if (!ClientConnections.containsKey(clientConnectionKey)) ClientConnections.put(clientConnectionKey, new ClientConnection(clientConnectionKeyBase, clientConnectionKey, servers, port, user, password, isHeavyWeight, maxOutstandingTxns)); + return ClientConnections.get(clientConnectionKey).use(); } finally { lock.unlock(); } - return ClientConnections.get(clientConnectionKey).use(); } /**
Mutual exclusion for fun and profit.
VoltDB_voltdb
train
java
ad2ee66ac1dadb281e099001a3843b16c744eb13
diff --git a/Framework/DoozR/Core.php b/Framework/DoozR/Core.php index <HASH>..<HASH> 100644 --- a/Framework/DoozR/Core.php +++ b/Framework/DoozR/Core.php @@ -806,9 +806,8 @@ final class DoozR_Core extends DoozR_Base_Class_Singleton implements DoozR_Inter return self::$version; } else { // etxract the version from svn-Id - preg_match('/\d+/', self::$version, $version); - //return $version[0]; - return 123; + //preg_match('/\d+/', self::$version, $version); + return self::$version; } }
try to use git hash as version reference
Doozer-Framework_Doozr
train
php
e3ceb35a0b5ba6f4d69686099b7a4254cbe13356
diff --git a/lib/jsonapi/utils.rb b/lib/jsonapi/utils.rb index <HASH>..<HASH> 100644 --- a/lib/jsonapi/utils.rb +++ b/lib/jsonapi/utils.rb @@ -26,11 +26,11 @@ module JSONAPI end def jsonapi_render_internal_server_error - Rails.env.development? || jsonapi_render_errors(::JSONAPI::Utils::Exceptions::InternalServerError.new) + jsonapi_render_errors(::JSONAPI::Utils::Exceptions::InternalServerError.new) end def jsonapi_render_bad_request - Rails.env.development? || jsonapi_render_errors(::JSONAPI::Utils::Exceptions::BadRequest.new) + jsonapi_render_errors(::JSONAPI::Utils::Exceptions::BadRequest.new) end def jsonapi_render_not_found diff --git a/lib/jsonapi/utils/version.rb b/lib/jsonapi/utils/version.rb index <HASH>..<HASH> 100644 --- a/lib/jsonapi/utils/version.rb +++ b/lib/jsonapi/utils/version.rb @@ -1,5 +1,5 @@ module JSONAPI module Utils - VERSION = '0.3.2' + VERSION = '0.3.3' end end
Remove development checking in order to let the application layer deal with it
tiagopog_jsonapi-utils
train
rb,rb
f3bfe337161399a047eac80f033ad45210b17d64
diff --git a/flask_unchained/commands/shell.py b/flask_unchained/commands/shell.py index <HASH>..<HASH> 100644 --- a/flask_unchained/commands/shell.py +++ b/flask_unchained/commands/shell.py @@ -48,7 +48,7 @@ def _get_shell_ctx(): # Match the behavior of the cpython shell where an error in # PYTHONSTARTUP prints an exception and continues. try: - exec(compile(pythonrc_code, pythonrc, 'exec'), ctx) # nosec + exec(compile(pythonrc_code, pythonrc, 'exec'), ctx) # skipcq: PYL-W0122 except: traceback.print_exc()
i guess deepsource doesnt respect nosec
briancappello_flask-unchained
train
py
cbcbce83ff904c71280024c9786bdc2af43cfa3c
diff --git a/formicd/file.go b/formicd/file.go index <HASH>..<HASH> 100644 --- a/formicd/file.go +++ b/formicd/file.go @@ -691,6 +691,9 @@ func (o *OortFS) Setxattr(ctx context.Context, id []byte, name string, value []b if err != nil { return &pb.SetxattrResponse{}, err } + if n.Xattr == nil { + n.Xattr = make(map[string][]byte) + } n.Xattr[name] = value b, err = proto.Marshal(n) if err != nil {
Fixed xattr write on file if it doesn't exist
creiht_formic
train
go
879235603e520c8ccb28679af0f9a35dcdc94e5c
diff --git a/src/Orchestra/Auth/CommandServiceProvider.php b/src/Orchestra/Auth/CommandServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Orchestra/Auth/CommandServiceProvider.php +++ b/src/Orchestra/Auth/CommandServiceProvider.php @@ -5,6 +5,13 @@ use Illuminate\Support\ServiceProvider; class CommandServiceProvider extends ServiceProvider { /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** * Register the service provider. * * @return void @@ -18,4 +25,14 @@ class CommandServiceProvider extends ServiceProvider { $this->commands('orchestra.commands.auth'); } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('orchestra.commands.auth'); + } }
Defer the CommandServiceProvider
orchestral_auth
train
php
53c67f3f9b903825928c78ff321b1c3fc1fb6e9b
diff --git a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java index <HASH>..<HASH> 100644 --- a/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java +++ b/analytics/src/test/java/com/ning/billing/analytics/api/TestAnalyticsService.java @@ -276,6 +276,7 @@ public class TestAnalyticsService extends AnalyticsTestSuiteWithEmbeddedDB { // Test subscriptions integration - this is just to exercise the code. It's hard to test the actual subscriptions // as we would need to mock a bunch of APIs (see integration tests in Beatrix instead) bus.post(transition); + Thread.sleep(5000); // Test invoice integration - the account creation notification has triggered a BAC update Assert.assertEquals(accountSqlDao.getAccountByKey(ACCOUNT_KEY).getTotalInvoiceBalance().compareTo(INVOICE_AMOUNT), 1);
analytics: fix race condition in TestAnalyticsService
killbill_killbill
train
java
992f823f7da6dbec76e40a6713eb97b570baf151
diff --git a/pypika/tests/test_terms.py b/pypika/tests/test_terms.py index <HASH>..<HASH> 100644 --- a/pypika/tests/test_terms.py +++ b/pypika/tests/test_terms.py @@ -15,6 +15,18 @@ class FieldAliasTests(TestCase): self.assertEqual('bar', str(c1.alias)) +class FieldHashingTests(TestCase): + def test_tabled_fields_dict_has_no_collisions(self): + customer_name = Field(name="name", table=Table("customers")) + client_name = Field(name="name", table=Table("clients")) + name_fields = { + customer_name: "Jason", + client_name: "Jacob", + } + + self.assertTrue(len(name_fields.keys()) == 2) + + class AtTimezoneTests(TestCase): def test_when_interval_not_specified(self): query = Query.from_("customers").select(AtTimezone("date", "US/Eastern"))
Test tabled fields dict key collision
kayak_pypika
train
py
48d1faaca69d37dc9cac2136c54600caadfc8a96
diff --git a/sources/lib/Model/ModelTrait/WriteTrait.php b/sources/lib/Model/ModelTrait/WriteTrait.php index <HASH>..<HASH> 100644 --- a/sources/lib/Model/ModelTrait/WriteTrait.php +++ b/sources/lib/Model/ModelTrait/WriteTrait.php @@ -120,7 +120,7 @@ trait WriteTrait */ public function deleteOne(FlexibleEntity &$entity) { - $where = $this->getWhereFrom($entity->get($this->structure->getPrimaryKey())); + $where = $this->getWhereFrom($entity->get($this->getStructure()->getPrimaryKey())); $sql = strtr( "delete from :relation where :condition returning :projection", [
Fixed major in WriteTrait::deleteOne()
pomm-project_ModelManager
train
php
169f3a8322d23d9912da2b3b3d1d5fcdbaaebdf9
diff --git a/discord/state.py b/discord/state.py index <HASH>..<HASH> 100644 --- a/discord/state.py +++ b/discord/state.py @@ -469,10 +469,13 @@ class ConnectionState: def parse_channel_create(self, data): factory, ch_type = _channel_factory(data['type']) channel = None + if ch_type in (ChannelType.group, ChannelType.private): - channel = factory(me=self.user, data=data, state=self) - self._add_private_channel(channel) - self.dispatch('private_channel_create', channel) + channel_id = int(data['id']) + if self._get_private_channel(channel_id) is None: + channel = factory(me=self.user, data=data, state=self) + self._add_private_channel(channel) + self.dispatch('private_channel_create', channel) else: guild_id = utils._get_as_snowflake(data, 'guild_id') guild = self._get_guild(guild_id)
Don't unnecessarily re-create private channels. New API change[1] will make it so CHANNEL_CREATE will keep getting sent for private channels, so might as well avoid the overhead of constantly creating the channel if we can avoid it. [1]: <URL>
Rapptz_discord.py
train
py
a65e99b3a29df6b6253b6bd0adef6e8e59619e5c
diff --git a/src/Exscriptd/Config.py b/src/Exscriptd/Config.py index <HASH>..<HASH> 100644 --- a/src/Exscriptd/Config.py +++ b/src/Exscriptd/Config.py @@ -29,7 +29,7 @@ from Exscriptd.util import find_module_recursive from Exscriptd.xml import get_accounts_from_etree, add_accounts_to_etree default_config_dir = os.path.join('/etc', 'exscriptd') -default_logdir = os.path.join('/var', 'log', 'exscriptd') +default_log_dir = os.path.join('/var', 'log', 'exscriptd') cache = {} def cache_result(func): @@ -47,7 +47,7 @@ class Config(ConfigReader): self.cfg_dir = cfg_dir self.service_dir = os.path.join(cfg_dir, 'services') filename = os.path.join(cfg_dir, 'main.xml') - self.logdir = default_logdir + self.logdir = default_log_dir ConfigReader.__init__(self, filename, resolve_variables) logdir_elem = self.cfgtree.find('exscriptd/logdir')
fix: exscriptd-config would not find default log dir.
knipknap_exscript
train
py
a80cb3bcb5fe0294398c96e3c4fa0b32b688db48
diff --git a/modin/core/io/text/text_file_dispatcher.py b/modin/core/io/text/text_file_dispatcher.py index <HASH>..<HASH> 100644 --- a/modin/core/io/text/text_file_dispatcher.py +++ b/modin/core/io/text/text_file_dispatcher.py @@ -23,7 +23,6 @@ from modin.core.storage_formats.pandas.utils import compute_chunksize from modin.utils import _inherit_docstrings import numpy as np import warnings -import io import os from typing import Union, Sequence, Optional, Tuple import pandas @@ -63,7 +62,7 @@ class TextFileDispatcher(FileDispatcher): use it without having to fall back to pandas and share file objects between workers. Given a filepath, return it immediately. """ - if isinstance(filepath_or_buffer, (io.BufferedReader, io.TextIOWrapper)): + if hasattr(filepath_or_buffer, "name"): buffer_filepath = filepath_or_buffer.name if cls.file_exists(buffer_filepath): warnings.warn(
FEAT-#<I>: Support reading gzipped fwf. (#<I>)
modin-project_modin
train
py
426c8f10369f4489d4b6d357bcc0f7af53490c61
diff --git a/src/Aws/S3/Sync/UploadSyncBuilder.php b/src/Aws/S3/Sync/UploadSyncBuilder.php index <HASH>..<HASH> 100644 --- a/src/Aws/S3/Sync/UploadSyncBuilder.php +++ b/src/Aws/S3/Sync/UploadSyncBuilder.php @@ -166,7 +166,7 @@ class UploadSyncBuilder extends AbstractSyncBuilder $size = $command['Body']->getContentLength(); $percentage = number_format(($progress / $totalSize) * 100, 2); fwrite($resource, "- Part {$command['PartNumber']} ({$size} bytes, {$percentage}%)\n"); - $progress .= $size; + $progress += $size; } ); });
Fixing concat vs addition issue in the debug output of upload directory
aws_aws-sdk-php
train
php
5b7df64c889b1df3df975c2c6d4b641531ac6be2
diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php index <HASH>..<HASH> 100644 --- a/tests/ContainerTest.php +++ b/tests/ContainerTest.php @@ -3,9 +3,12 @@ declare(strict_types = 1); namespace Tests\Innmind\AMQP; -use Innmind\AMQP\Client\{ - Client, - SignalAware +use Innmind\AMQP\{ + Client\Client, + Client\SignalAware, + Command\Get, + Command\Purge, + Command\Consume, }; use Innmind\Compose\{ ContainerBuilder\ContainerBuilder, @@ -40,5 +43,8 @@ class ContainerTest extends TestCase $this->assertInstanceOf(Client::class, $container->get('basic')); $this->assertInstanceOf(SignalAware::class, $container->get('client')); + $this->assertInstanceOf(Get::class, $container->get('getCommand')); + $this->assertInstanceOf(Purge::class, $container->get('purgeCommand')); + $this->assertInstanceOf(Consume::class, $container->get('consumeCommand')); } }
test commands are correctly built via the container
Innmind_AMQP
train
php
f2517dc00601f00bfe712f82763d3ba1b6889559
diff --git a/src/Support/DelegatedValidator.php b/src/Support/DelegatedValidator.php index <HASH>..<HASH> 100644 --- a/src/Support/DelegatedValidator.php +++ b/src/Support/DelegatedValidator.php @@ -110,7 +110,7 @@ class DelegatedValidator */ public function doReplacements($message, $attribute, $rule, $parameters) { - return $this->callValidator('doReplacements', [$message, $attribute, $rule, $parameters]); + return $this->callValidator('makeReplacements', [$message, $attribute, $rule, $parameters]); } /**
Changed doReplacements to makeReplacements
proengsoft_laravel-jsvalidation
train
php
446b6986e58129746c9bf6a39cd9ac3509a625ca
diff --git a/django_su/tests/test_views.py b/django_su/tests/test_views.py index <HASH>..<HASH> 100644 --- a/django_su/tests/test_views.py +++ b/django_su/tests/test_views.py @@ -1,11 +1,15 @@ from django.conf import settings from django.contrib import auth -from django.core.urlresolvers import reverse from django.test import TestCase, Client from django.contrib.sessions.backends import cached_db from django.utils.datetime_safe import datetime try: + from django.urls import reverse +except ImportError: + from django.core.urlresolvers import reverse + +try: from django.contrib.auth import get_user_model, user_logged_in User = get_user_model()
Fix for relocation of django.core.urlresolvers -> django.urls in Django 2
adamcharnock_django-su
train
py
94c4fd2d19ac3d11730198908710b68357a77796
diff --git a/bakery/management/commands/publish.py b/bakery/management/commands/publish.py index <HASH>..<HASH> 100644 --- a/bakery/management/commands/publish.py +++ b/bakery/management/commands/publish.py @@ -155,7 +155,7 @@ in settings.py or provide it with --aws-bucket-name" # walk through the build directory for (dirpath, dirnames, filenames) in os.walk(self.build_dir): - self.upload_s3(dirpath, filenames, keys) + self.sync_s3(dirpath, filenames, keys) # Execute the command
oops got my functions mixed up
datadesk_django-bakery
train
py
79c69ab8dd856601cdb6ed60102821bd163884cc
diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index <HASH>..<HASH> 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -675,6 +675,9 @@ func (k *Bootstrapper) JoinCluster(cc config.ClusterConfig, n config.Node, joinC _, err = k.c.RunCmd(exec.Command("/bin/bash", "-c", joinCmd)) if err != nil { + if strings.Contains(err.Error(), "status \"Ready\" already exists in the cluster") { + klog.Infof("still waiting for the worker node to register with the api server") + } return errors.Wrapf(err, "kubeadm join") } return nil
add logging for waiting for worker to register
kubernetes_minikube
train
go
672be80d8445d4be6068ac40e118e7870dc2b18b
diff --git a/tools/run_tests/xds_k8s_test_driver/tests/failover_test.py b/tools/run_tests/xds_k8s_test_driver/tests/failover_test.py index <HASH>..<HASH> 100644 --- a/tools/run_tests/xds_k8s_test_driver/tests/failover_test.py +++ b/tools/run_tests/xds_k8s_test_driver/tests/failover_test.py @@ -40,7 +40,7 @@ class FailoverTest(xds_k8s_testcase.RegularXdsKubernetesTestCase): # Test case implementation seems to be broken for Java and Go. # Core (cpp and python), and Node seem to work fine. # TODO(b/238226704): Remove when the test is fixed. - return config.client_lang not in _Lang.JAVA | _Lang.GO + return config.client_lang not in _Lang.JAVA | _Lang.GO | _Lang.CPP def setUp(self): super().setUp()
disable cpp failover test (#<I>)
grpc_grpc
train
py
162d0e71df9a2c36826e5edac3f61e6b163f84c7
diff --git a/src/main/java/com/threerings/gwt/ui/PagedWidget.java b/src/main/java/com/threerings/gwt/ui/PagedWidget.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/threerings/gwt/ui/PagedWidget.java +++ b/src/main/java/com/threerings/gwt/ui/PagedWidget.java @@ -141,6 +141,14 @@ public abstract class PagedWidget<T> extends FlowPanel } /** + * Returns the controls in use by this panel or null if we have no model. + */ + public SmartTable getControls () + { + return _controls; + } + + /** * Displays the specified page. Does nothing if we are already displaying * that page unless forceRefresh is true. */
Add a data accessor for controls panel in PagedTable.
threerings_gwt-utils
train
java
60706fc3f96c6eb9c76d722bd44d4de2ff8ec8c8
diff --git a/lib/OpenLayers/Handler/Point.js b/lib/OpenLayers/Handler/Point.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Handler/Point.js +++ b/lib/OpenLayers/Handler/Point.js @@ -151,13 +151,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { * Finish the geometry and call the "done" callback. */ finalize: function() { - this.layer.renderer.clear(); - this.drawing = false; - this.mouseDown = false; - this.lastDown = null; - this.lastUp = null; - this.callback("done", [this.geometryClone()]); - this.destroyFeature(); + this.cleanup("done"); }, /** @@ -165,12 +159,15 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { * Finish the geometry and call the "cancel" callback. */ cancel: function() { - this.layer.renderer.clear(); - this.drawing = false; + this.cleanup("cancel"); + }, + + cleanup: function(callback) { + this.layer.eraseFeatures(this.point); this.mouseDown = false; this.lastDown = null; this.lastUp = null; - this.callback("cancel", [this.geometryClone()]); + this.callback(callback, [this.geometryClone()]); this.destroyFeature(); },
Refactor Hanadler.Point cancel/finalize to just call a cleanup and pass a callback type, since otherwise they're the same thing. From sbenthall, r=me (Closes #<I>) git-svn-id: <URL>
openlayers_openlayers
train
js
379fb1c8830c9f433e61e876b7b0036f36a0036f
diff --git a/projects/doc_generator.py b/projects/doc_generator.py index <HASH>..<HASH> 100644 --- a/projects/doc_generator.py +++ b/projects/doc_generator.py @@ -5,7 +5,7 @@ def generate_doc(data, width): doc = '=' * width + '\n' name = data['name'].upper() name = ' '.join(name) - name = name.center(width) + '\n' + name = name.center(width).rstrip() + '\n' doc += name doc += '=' * width + '\n\n'
rstrip added to the doc title.
tiborsimon_projects
train
py
2ba91bb6500da00d7069c75241a6bfffcc8a9287
diff --git a/controllers/twitch_badge.go b/controllers/twitch_badge.go index <HASH>..<HASH> 100644 --- a/controllers/twitch_badge.go +++ b/controllers/twitch_badge.go @@ -11,6 +11,13 @@ import ( var ( twitchBadge *template.Template reValidPath = regexp.MustCompile(`badge/(\d+)`) + emptyPage = ` +<html> +<head> +<meta http-equiv="refresh" content="5"> +</head> +</html> +` ) func TwitchBadge(w http.ResponseWriter, r *http.Request) { @@ -30,7 +37,8 @@ func TwitchBadge(w http.ResponseWriter, r *http.Request) { id, err := player.GetLobbyID(false) if err != nil { - //player not in lobby right now + //player not in lobby right now, just serve a page that refreshes every 5 seconds + w.Write([]byte(emptyPage)) return }
Serve auto-refreshing page if player isn't in any lobby.
TF2Stadium_Helen
train
go
2589edc4c70f66d863bfa72c8a312f54a7d7c4cc
diff --git a/pysentiment/utils.py b/pysentiment/utils.py index <HASH>..<HASH> 100644 --- a/pysentiment/utils.py +++ b/pysentiment/utils.py @@ -52,12 +52,13 @@ class Tokenizer(BaseTokenizer): 'Names.txt'] stopset = set() for f in files: - fin = open('%s/%s'%(STATIC_PATH, f)) + fin = open('%s/%s'%(STATIC_PATH, f), 'rb') for line in fin.readlines(): + line = line.decode(encoding='latin-1') match = re.search('(\w+)', line) if match == None: continue word = match.group(1) stopset.add(self._stemmer.stem(word.lower())) fin.close() - return stopset \ No newline at end of file + return stopset
read token files as binary and decode to latin-1 in order to maintain compatibility with Python 3 string handling
hanzhichao2000_pysentiment
train
py
bb387ad4a0e6318e3105940167f00c4e90aa0a85
diff --git a/lib/Controller/Data/Mongo.php b/lib/Controller/Data/Mongo.php index <HASH>..<HASH> 100644 --- a/lib/Controller/Data/Mongo.php +++ b/lib/Controller/Data/Mongo.php @@ -217,7 +217,6 @@ class Controller_Data_Mongo extends Controller_Data { return $this->selectQuery($model)->count(); } function rewind($model){ - if ($model->debug) echo '<font style="color: blue">db.'.$model->table.'.find('.json_encode($model->_table[$this->short_name]['conditions']).')</font>'; $c=$this->selectQuery($model); $model->data=$c->getNext();
selectQuery will show debug now, no longer needed here.
atk4_atk4
train
php
6f41f53468fbee1280370763cc63d0354f878dbd
diff --git a/nats/aio/client.py b/nats/aio/client.py index <HASH>..<HASH> 100644 --- a/nats/aio/client.py +++ b/nats/aio/client.py @@ -75,7 +75,7 @@ PING_PROTO = PING_OP + _CRLF_ PONG_PROTO = PONG_OP + _CRLF_ DEFAULT_INBOX_PREFIX = b'_INBOX' -DEFAULT_PENDING_SIZE = 64 * 1024 * 1024 +DEFAULT_PENDING_SIZE = 2 * 1024 * 1024 DEFAULT_BUFFER_SIZE = 32768 DEFAULT_RECONNECT_TIME_WAIT = 2 # in seconds DEFAULT_MAX_RECONNECT_ATTEMPTS = 60
Lower default pending size to twice max payload
nats-io_asyncio-nats
train
py
6b4ab5d661cd1dae34fc41782959a2832d407994
diff --git a/memstore.go b/memstore.go index <HASH>..<HASH> 100644 --- a/memstore.go +++ b/memstore.go @@ -20,7 +20,7 @@ type MemStore struct { cache *cache } -type valueType = map[interface{}]interface{} +type valueType map[interface{}]interface{} // NewMemStore returns a new MemStore. //
Remove type alias from definition of valueType
quasoft_memstore
train
go
6bb78068c8322a335ee926edc5771a0e2740faa2
diff --git a/config/routes/frontend.rb b/config/routes/frontend.rb index <HASH>..<HASH> 100644 --- a/config/routes/frontend.rb +++ b/config/routes/frontend.rb @@ -29,7 +29,7 @@ Rails.application.routes.draw do instance_eval(PluginRoutes.load("front")) - get "*slug" => 'frontend#post', format: true, :as => :post1, defaults: { format: :html }, constraints: { slug: /(?!admin)[a-zA-Z0-9\._=\s\-]+/} - get "*slug" => 'frontend#post', :as => :post, constraints: { slug: /(?!admin)[a-zA-Z0-9\._=\s\-]+/} + get "*slug" => 'frontend#post', format: true, :as => :post1, defaults: { format: :html }, constraints: { slug: /(?!admin)[a-zA-Z0-9\._=\s\-\/]+/} + get "*slug" => 'frontend#post', :as => :post, constraints: { slug: /(?!admin)[a-zA-Z0-9\._=\s\-\/]+/} end end
Raise error when visiting unexisting urls. Example: Random troll writes domain.com/asdasdasd/adfasdasd.
owen2345_camaleon-cms
train
rb
ac612e6d7496211237cc24ec826b2a021d6f52b2
diff --git a/components/Button/components/GenericButton.js b/components/Button/components/GenericButton.js index <HASH>..<HASH> 100644 --- a/components/Button/components/GenericButton.js +++ b/components/Button/components/GenericButton.js @@ -12,7 +12,7 @@ type GenericProps = {| form: boolean, reversed: boolean, icon?: SvgAsset, - onClick?: MouseEvent => void, + onClick?: MouseEvent => any, href?: string, type?: 'submit' | 'reset', automationId?: string,
fix(Button): Allow async functions to be used in onClick without Flow errors
cultureamp_cultureamp-style-guide
train
js
944c00900e0bd5d584dc6aa4b884021368d4d1a3
diff --git a/template/parse_test.go b/template/parse_test.go index <HASH>..<HASH> 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -346,7 +346,7 @@ func TestParse(t *testing.T) { tpl.RawContents = nil } if diff := cmp.Diff(tpl, tc.Result); diff != "" { - t.Fatalf("[%d]bad: %v", i, diff) + t.Fatalf("[%d]bad: %s\n%v", i, tc.File, diff) } } }
parse_test.go: still display file name in case of error
hashicorp_packer
train
go
e5fa8dab04a66cc1f21c0dc235920ba2c1ebc160
diff --git a/src/mopgui/mopgui/io/writer.py b/src/mopgui/mopgui/io/writer.py index <HASH>..<HASH> 100644 --- a/src/mopgui/mopgui/io/writer.py +++ b/src/mopgui/mopgui/io/writer.py @@ -90,22 +90,3 @@ def format_ra_dec(ra_deg, dec_deg): return formatted_ra, formatted_dec - -class AcceptRejectResultsWriter(object): - """ - A simplified output that just writes the source name and whether it - was accepted or rejected. It just does formatting, it must be provided - with all required data. - """ - - def __init__(self, filehandle, name_generator): - # XXX name generator not used - self.name_generator = name_generator - self.filehandle = filehandle - - def write_result(self, sourcename, status): - self.filehandle.write("%s: %s\n" % (sourcename, status)) - - def close(self): - self.filehandle.close() -
Removed old result writer used for early experimentation which is no longer used.
OSSOS_MOP
train
py
adc614cedda0e36a03463a1964335faf906eee7b
diff --git a/indra/tests/make_mock_ontology.py b/indra/tests/make_mock_ontology.py index <HASH>..<HASH> 100644 --- a/indra/tests/make_mock_ontology.py +++ b/indra/tests/make_mock_ontology.py @@ -34,11 +34,11 @@ always_include = { 'CHEBI:CHEBI:25000', 'CHEBI:CHEBI:35701', 'CHEBI:CHEBI:36963', 'GO:GO:0005886', 'GO:GO:0005737', 'GO:GO:0098826', 'GO:GO:0016020', 'GO:GO:0005634', - 'UP:Q02750', 'UP:P01112', 'UP:P01019', 'UP:Q9MZT7', 'UP:Q13422' + 'UP:Q02750', 'UP:P01112', 'UP:P01019', 'UP:Q9MZT7', 'UP:Q13422', + 'HMDB:HMDB0000122', 'HGNC:7', 'HGNC:5' } -always_include_ns = {'FPLX', 'HGNC', - 'INDRA_ACTIVITIES', 'INDRA_MODS'} +always_include_ns = {'FPLX', 'INDRA_ACTIVITIES', 'INDRA_MODS'} def keep_node(node):
Remove HGNC and add more specific entries
sorgerlab_indra
train
py
324c26e4a9126923ae54dc341169094f7cbb245d
diff --git a/MAVProxy/modules/mavproxy_adsb.py b/MAVProxy/modules/mavproxy_adsb.py index <HASH>..<HASH> 100644 --- a/MAVProxy/modules/mavproxy_adsb.py +++ b/MAVProxy/modules/mavproxy_adsb.py @@ -207,7 +207,7 @@ class ADSBModule(mp_module.MPModule): self.threat_vehicles[id].update(m.to_dict(), self.get_time()) for mp in self.module_matching('map*'): # update the map - ground_alt = self.console.ElevationMap.GetElevation(m.lat*1e-7, m.lon*1e-7) + ground_alt = mp.ElevationMap.GetElevation(m.lat*1e-7, m.lon*1e-7) alt_amsl = m.altitude * 0.001 if alt_amsl > 0: alt = int(alt_amsl - ground_alt)
mavproxy_adsb: get ElevationMap from relevant map rather than console the visual console has this attribute, the "SimpleConsole" does not
ArduPilot_MAVProxy
train
py
665d2a727df16a5d6edf3da516840abf312a6681
diff --git a/lib/health-data-standards/validate/data_validator.rb b/lib/health-data-standards/validate/data_validator.rb index <HASH>..<HASH> 100644 --- a/lib/health-data-standards/validate/data_validator.rb +++ b/lib/health-data-standards/validate/data_validator.rb @@ -67,7 +67,7 @@ module HealthDataStandards null_flavor = node.at_xpath("@nullFlavor") if !vs errors << build_error("The valueset #{oid} declared in the document cannot be found", node.path, options[:file_name]) - elsif !@oids.include?(oid) + elsif !@oids.include?(oid.value) errors << build_error("File appears to contain data criteria outside that required by the measures. Valuesets in file not in measures tested #{oid}'", node.path, options[:file_name]) elsif vs.concepts.where({"code" => code, "code_system"=>code_system}).count() == 0
fixes comparision between provided oid and oid list
projectcypress_health-data-standards
train
rb
f609a95a7a3ee9599d4f4636cbbaa8e11fb7f2d7
diff --git a/react-app/src/components/GmaForm.js b/react-app/src/components/GmaForm.js index <HASH>..<HASH> 100644 --- a/react-app/src/components/GmaForm.js +++ b/react-app/src/components/GmaForm.js @@ -90,7 +90,7 @@ class GmaForm extends Component { </div> <div className="mt4"> <Field - heading="The area I live is called:" + heading="I live in:" name="neighborhood" options={Neighborhood.enumValues.map((val) => { return { id: val.name, label: val.text } })} component={MultiRadio} diff --git a/react-app/src/components/ParentForm.js b/react-app/src/components/ParentForm.js index <HASH>..<HASH> 100644 --- a/react-app/src/components/ParentForm.js +++ b/react-app/src/components/ParentForm.js @@ -239,7 +239,7 @@ class ParentForm extends Component { </div> <div className="mt4"> <Field - heading="The area I live is called:" + heading="I live in:" name="neighborhood" options={Neighborhood.enumValues.map((val) => { return { id: val.name, label: val.text } })} component={MultiRadio}
change area I live in to I live in
floodfx_gma-village
train
js,js
fbfdf2adfa84b67e2b028c797b86f010c4289bf0
diff --git a/js/bootstrap-select.js b/js/bootstrap-select.js index <HASH>..<HASH> 100644 --- a/js/bootstrap-select.js +++ b/js/bootstrap-select.js @@ -1605,6 +1605,7 @@ if (!this.multiple) li.classList.add('active'); } else if (li.classList.contains('selected')) { li.classList.remove('selected'); + if (li.classList.contains('active')) li.classList.remove('active'); } if (li.firstChild) li.firstChild.setAttribute('aria-selected', selected);
remove active class if no longer selected
snapappointments_bootstrap-select
train
js
f106a434df84497e12cfbdf1e693e28b6c567711
diff --git a/kubespawner/utils.py b/kubespawner/utils.py index <HASH>..<HASH> 100644 --- a/kubespawner/utils.py +++ b/kubespawner/utils.py @@ -18,7 +18,16 @@ class SingletonExecutor(SingletonConfigurable, ThreadPoolExecutor): pass @gen.coroutine -def exponential_backoff(func, fail_message, timeout=10, *args, **kwargs): +def exponential_backoff(pass_func, fail_message, timeout=10, *args, **kwargs): + """ + Exponentially backoff until pass_func is true. + + This function will wait with exponential backoff + random jitter for as + many iterations as needed, with maximum timeout timeout. If pass_func is + still returning false at the end of timeout, a TimeoutError will be raised. + + *args and **kwargs are passed to pass_func. + """ loop = ioloop.IOLoop.current() start_tic = loop.time() dt = DT_MIN @@ -26,7 +35,7 @@ def exponential_backoff(func, fail_message, timeout=10, *args, **kwargs): if (loop.time() - start_tic) > timeout: # We time out! break - if func(*args, **kwargs): + if pass_func(*args, **kwargs): return else: yield gen.sleep(dt)
Add docstrings to exponential backoff
jupyterhub_kubespawner
train
py
98d7f785e9cdd1ac2e17266e2dbdbe1419baf8f2
diff --git a/dvc/command/experiments/show.py b/dvc/command/experiments/show.py index <HASH>..<HASH> 100644 --- a/dvc/command/experiments/show.py +++ b/dvc/command/experiments/show.py @@ -517,14 +517,6 @@ def _format_json(item): return encode_exception(item) -def _raise_error_if_all_disabled(**kwargs): - if not any(kwargs.values()): - raise InvalidArgumentError( - "Either of `-w|--workspace`, `-a|--all-branches`, `-T|--all-tags` " - "or `--all-commits` needs to be set." - ) - - class CmdExperimentsShow(CmdBase): def run(self): try:
exp show: remove a useless function The function `_raise_error_if_all_disabled` is copyed wrongly to this place during sub command refactoring. It used to be used in `exp gc`, can be deleted from this function.
iterative_dvc
train
py
52d9fd04bc74caadc6d1f497d7c09fefb4adfb96
diff --git a/src/array-model.js b/src/array-model.js index <HASH>..<HASH> 100644 --- a/src/array-model.js +++ b/src/array-model.js @@ -2,9 +2,9 @@ var ARRAY_MUTATOR_METHODS = ["pop", "push", "reverse", "shift", "sort", "splice" Model.Array = function ArrayModel(def){ - var model = function() { + var model = function(array) { - var array = cloneArray(arguments), proxy; + var proxy; model.validate(array); if(isProxySupported){ proxy = new Proxy(array, {
array model constructors now receive an array as parameter
sylvainpolletvillard_ObjectModel
train
js
56725e5843662189c6701478f7598db306d5fb02
diff --git a/lib/sprockets/rails/task.rb b/lib/sprockets/rails/task.rb index <HASH>..<HASH> 100644 --- a/lib/sprockets/rails/task.rb +++ b/lib/sprockets/rails/task.rb @@ -47,15 +47,6 @@ module Sprockets end end - def cache_path - if app - "#{app.config.paths['tmp'].first}/cache/assets" - else - @cache_path - end - end - attr_writer :cache_path - def define namespace :assets do # Override this task change the loaded dependencies @@ -84,7 +75,6 @@ module Sprockets task :clobber => :environment do with_logger do manifest.clobber - rm_rf cache_path if cache_path end end end
clobber keeps tmp/cache
rails_sprockets-rails
train
rb
1b1c407b2a1d6fd04c5bd0cfd4efa58d28c02286
diff --git a/vsphere/virtual_machine_config_structure.go b/vsphere/virtual_machine_config_structure.go index <HASH>..<HASH> 100644 --- a/vsphere/virtual_machine_config_structure.go +++ b/vsphere/virtual_machine_config_structure.go @@ -362,7 +362,6 @@ func schemaVirtualMachineResourceAllocation() map[string]*schema.Schema { s[reservationKey] = &schema.Schema{ Type: schema.TypeInt, Optional: true, - Default: 0, Description: fmt.Sprintf(reservationFmt, t), ValidateFunc: validation.IntAtLeast(0), }
r/virtual_machine: Remove zero-value default Just to be consistent. There has been situations where tainting a resource has caused issues with zero-value defaults, but we have them in lots of places here, so if we want to not have inferred zero-value defaults anymore, we should probably do this as a larger refactoring effort.
terraform-providers_terraform-provider-vsphere
train
go
0ca6836a5a5dc249f82c98d34e17205a559157cf
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index <HASH>..<HASH> 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -20,14 +20,9 @@ module ActionView def digest(*args) options = _setup_options(*args) - name = options[:name] - format = options[:format] - variant = options[:variant] - finder = options[:finder] - - details_key = finder.details_key.hash + details_key = options[:finder].details_key.hash dependencies = Array.wrap(options[:dependencies]) - cache_key = ([name, details_key, format, variant].compact + dependencies).join('.') + cache_key = ([options[:name], details_key, options[:format], options[:variant]].compact + dependencies).join('.') # this is a correctly done double-checked locking idiom # (ThreadSafe::Cache's lookups have volatile semantics)
Don't create addition vars, use options[] directly
rails_rails
train
rb
58680668102282fcc4215a48e8947c2c1b051201
diff --git a/src/Illuminate/Queue/DatabaseQueue.php b/src/Illuminate/Queue/DatabaseQueue.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Queue/DatabaseQueue.php +++ b/src/Illuminate/Queue/DatabaseQueue.php @@ -239,7 +239,7 @@ class DatabaseQueue extends Queue implements QueueContract return 'FOR UPDATE SKIP LOCKED'; } - return 'FOR UPDATE'; + return true; } /**
fix locks for sqlsrv queue
laravel_framework
train
php
fe38264b6da573464cb00b7a1918e78eee0a4f34
diff --git a/tests/DatabaseDriverTest.php b/tests/DatabaseDriverTest.php index <HASH>..<HASH> 100644 --- a/tests/DatabaseDriverTest.php +++ b/tests/DatabaseDriverTest.php @@ -29,15 +29,6 @@ class DatabaseDriverTest extends PersistentDriverTestCase parent::setUp(); } - protected function tearDown() - { - // Unset the database connection. - $this->database->getConnection()->disconnect(); - unset($this->database); - - parent::tearDown(); - } - /** * Setup the database */ @@ -50,9 +41,6 @@ class DatabaseDriverTest extends PersistentDriverTestCase 'database' => ':memory:' ]); - // Reset the sqlite database. - $this->database->getConnection()->getSchemaBuilder()->dropIfExists($this->table); - // Execute migrations. $this->database->getConnection()->getSchemaBuilder()->create($this->table, function (Blueprint $table) { $table->increments('id');
Removed redundant code with move to in-memory sqlite tests
BeatSwitch_lock-laravel
train
php
eea08bf2d9e3eed52aa4e0c6c2c7872ff2be6985
diff --git a/src/components/control-component.js b/src/components/control-component.js index <HASH>..<HASH> 100644 --- a/src/components/control-component.js +++ b/src/components/control-component.js @@ -14,8 +14,8 @@ class Control extends Component { return cloneElement( control, { - ...this.props, ...control.props, + ...this.props, }); } }
Reversing priority on Control component of control props
davidkpiano_react-redux-form
train
js
4f89c6060e635122868e767dba12e11c54699aca
diff --git a/lib/topologies/shared.js b/lib/topologies/shared.js index <HASH>..<HASH> 100644 --- a/lib/topologies/shared.js +++ b/lib/topologies/shared.js @@ -425,11 +425,22 @@ const isRetryableWritesSupported = function(topology) { * * @param {ClientSession} session */ -const incrementTransactionNumber = function(session) { +function incrementTransactionNumber(session) { session.serverSession.txnNumber++; }; /** + * Increment the statement id on the ServerSession contained by the provided ClientSession + * + * @param {ClientSession} session the client sessions + * @param {Number} [operationCount] the number of operations performed + */ +function incrementStatementId(session, operationCount) { + operationCount = operationCount || 1; + session.serverSession.stmtId += operationCount; +}; + +/** * Relays events for a given listener and emitter * * @param {EventEmitter} listener the EventEmitter to listen to the events for @@ -454,4 +465,5 @@ module.exports.Interval = Interval; module.exports.Timeout = Timeout; module.exports.isRetryableWritesSupported = isRetryableWritesSupported; module.exports.incrementTransactionNumber = incrementTransactionNumber; +module.exports.incrementStatementId = incrementStatementId; module.exports.relayEvents = relayEvents;
refactor(shared): provide common method for incrementing stmtId
mongodb-js_mongodb-core
train
js
dea512094c52ea2105680702364fc28794a11a9d
diff --git a/go/chat/sender_test.go b/go/chat/sender_test.go index <HASH>..<HASH> 100644 --- a/go/chat/sender_test.go +++ b/go/chat/sender_test.go @@ -247,6 +247,7 @@ func TestNonblockTimer(t *testing.T) { for i := 0; i < 5; i++ { obr, err := outbox.PushMessage(context.TODO(), res.ConvID, chat1.MessagePlaintext{ ClientHeader: chat1.MessageClientHeader{ + Conv: trip, Sender: u.User.GetUID().ToBytes(), TlfName: u.Username, TlfPublic: false,
pass the conv ID triple to all messages in TestNonblockTimer That test has some kind of deadlock, which seems to get triggered only when a conv ID id invalid. We haven't figured out exactly why it's happening, and we still need to fix it, but making sure the test doesn't construct invalid messages is a workaround for now. <URL>
keybase_client
train
go
f9e0c0dd4aec8f179cb6dc4f2aea811f36b58f54
diff --git a/hooks/papertrail/papertrail.go b/hooks/papertrail/papertrail.go index <HASH>..<HASH> 100644 --- a/hooks/papertrail/papertrail.go +++ b/hooks/papertrail/papertrail.go @@ -30,7 +30,7 @@ func NewPapertrailHook(host string, port int, appName string) (*PapertrailHook, // Fire is called when a log event is fired. func (hook *PapertrailHook) Fire(entry *logrus.Entry) error { date := time.Now().Format(format) - payload := fmt.Sprintf("<22> %s %s: [%s] %s", date, hook.AppName, entry.Data["level"], entry.Message) + payload := fmt.Sprintf("<22> %s %s: [%s] %s", date, hook.AppName, entry.Level, entry.Message) bytesWritten, err := hook.UDPConn.Write([]byte(payload)) if err != nil {
Fix Papertrail bug Conflicts: hooks/papertrail/papertrail.go
sirupsen_logrus
train
go
24c9d7ddf57dadf8278b22d4393bc6f45f63d901
diff --git a/src/Cmgmyr/Messenger/Models/Thread.php b/src/Cmgmyr/Messenger/Models/Thread.php index <HASH>..<HASH> 100644 --- a/src/Cmgmyr/Messenger/Models/Thread.php +++ b/src/Cmgmyr/Messenger/Models/Thread.php @@ -57,7 +57,10 @@ class Thread extends Eloquent */ public function participantsUserIds() { - return $this->participants->lists('user_id'); + $users = $this->participants->lists('user_id'); + $users[] = \Auth::user()->id; + + return $users; } /**
always have current user in thread participants list
cmgmyr_laravel-messenger
train
php
93f0c3f7a3d420c20295eb2e1da4c2627099e0b3
diff --git a/pushover.py b/pushover.py index <HASH>..<HASH> 100644 --- a/pushover.py +++ b/pushover.py @@ -86,7 +86,7 @@ class Request: raise RequestError(self.answer["errors"]) def __str__(self): - print self.answer + return self.answer class MessageRequest(Request): """Class representing a message request to the Pushover API. You do not
print -> return I think this is supposed to be a return rather than a print. Print returns none and string serialization fails.
Thibauth_python-pushover
train
py
b79ff61c354872a6971e6d2d25f02194a10ef6fb
diff --git a/openquake/engine/tools/make_html_report.py b/openquake/engine/tools/make_html_report.py index <HASH>..<HASH> 100644 --- a/openquake/engine/tools/make_html_report.py +++ b/openquake/engine/tools/make_html_report.py @@ -102,12 +102,12 @@ class HtmlTable(object): JOB_STATS = ''' SELECT id, user_name, start_time, stop_time, status, -stop_time - start_time AS duration FROM job WHERE id=%s; +stop_time - start_time AS duration FROM job WHERE id=?; ''' ALL_JOBS = ''' SELECT id, user_name, status, ds_calc_dir FROM job -WHERE stop_time::date = %s OR stop_time IS NULL AND start_time >= %s +WHERE stop_time = ? OR stop_time IS NULL AND start_time >= ? ORDER BY stop_time '''
Fixed make_html_report to work with SQLite
gem_oq-engine
train
py
a3583f2c40cc18d4604fe8233df29182f8d88cb1
diff --git a/database/table/activities.php b/database/table/activities.php index <HASH>..<HASH> 100644 --- a/database/table/activities.php +++ b/database/table/activities.php @@ -25,6 +25,7 @@ class ComActivitiesDatabaseTableActivities extends KDatabaseTableAbstract protected function _initialize(KObjectConfig $config) { $config->append(array( + 'name' => 'activities', 'behaviors' => array( 'creatable', 'identifiable', 'parameterizable' => array('column' => 'metadata') ),
Use 'activities' table instead of 'activities_activities'.
joomlatools_joomlatools-framework
train
php
161f6d0131967ea45904e61f7c8322a1e4de327a
diff --git a/lib/amq/protocol/server.rb b/lib/amq/protocol/server.rb index <HASH>..<HASH> 100644 --- a/lib/amq/protocol/server.rb +++ b/lib/amq/protocol/server.rb @@ -247,7 +247,7 @@ module AMQ Array.new.tap do |array| while body - payload, body = body[0, limit + 1], body[limit, body.length - limit] + payload, body = body[0, limit + 1], body[limit + 1, body.length - limit] # array << [0x03, payload] array << BodyFrame.new(payload, channel) end
Same off-by-one fix for server.rb as for client.rb
ruby-amqp_amq-protocol
train
rb
a6c6ff261974bb0fe4270057f1129b61e947031d
diff --git a/Entity/ExtendedFieldRepositoryTrait.php b/Entity/ExtendedFieldRepositoryTrait.php index <HASH>..<HASH> 100644 --- a/Entity/ExtendedFieldRepositoryTrait.php +++ b/Entity/ExtendedFieldRepositoryTrait.php @@ -29,12 +29,6 @@ trait ExtendedFieldRepositoryTrait */ protected $customLeadFieldList = []; - - /** - * @var array - */ - protected $fields = []; - /** * Stores the parsed columns and their negate status for addAdvancedSearchWhereClause(). *
Resolve redefinition of on trait.
TheDMSGroup_mautic-extended-field
train
php
10dc6c7a91212e2bfe51fba1a6ad9fb5be1d0e2a
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 @@ -47,6 +47,10 @@ RSpec.configure do |config| clear_all_output end + config.after(:all, type: :feature) do + shell.stop if shell + end + config.after(:each, type: :feature) do Dir.chdir(tmp_dir) do FileUtils.rm_rf Dir.glob('*') diff --git a/spec/support/yap_spec_dsl.rb b/spec/support/yap_spec_dsl.rb index <HASH>..<HASH> 100644 --- a/spec/support/yap_spec_dsl.rb +++ b/spec/support/yap_spec_dsl.rb @@ -102,6 +102,7 @@ module Yap # tmpdir = File.dirname(__FILE__) + '/../tmp' process.cwd = File.dirname(__FILE__) process.start + process end end
Make sure child processes are told to stop at exit. Avoids having zombie processes kept around when running tests.
zdennis_yap-shell-core
train
rb,rb
e2b0d1ab64bdb1b42a9008b495185c258b3000ad
diff --git a/src/chisel/__init__.py b/src/chisel/__init__.py index <HASH>..<HASH> 100644 --- a/src/chisel/__init__.py +++ b/src/chisel/__init__.py @@ -5,7 +5,7 @@ TODO """ -__version__ = '0.9.90' +__version__ = '0.9.91' from .action import \ Action, \
chisel <I>
craigahobbs_chisel
train
py
15491529ae33cce84349cf19e06afc553182f484
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,6 +20,7 @@ import gettext import os import sys +import traceback from os import path import sphinxcontrib.plantuml @@ -321,7 +322,12 @@ def setup(self): locale_dir = os.path.join(package_dir, 'locale') print("locale_dir exists:", os.path.exists(locale_dir), locale_dir) print(locale.init([locale_dir], self.config.language, MESSAGE_CATALOG_NAME)) - print(gettext.find(MESSAGE_CATALOG_NAME, locale_dir, [self.config.language], all=True)) + try: + print(gettext.find(MESSAGE_CATALOG_NAME, locale_dir, [self.config.language], all=True)) + except Exception as e: + print("gettext.find emits", e) + traceback.print_exc(limit=2, file=sys.stdout) + self.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir) self.add_message_catalog("sphinx", locale_dir) self.config.language = conversion.get(self.config.language, self.config.language)
docs: rtd translation debug 1
blueset_ehForwarderBot
train
py
ba13bb75a4513e181565f849a01df825d6838935
diff --git a/lib/sloc/runner.rb b/lib/sloc/runner.rb index <HASH>..<HASH> 100644 --- a/lib/sloc/runner.rb +++ b/lib/sloc/runner.rb @@ -19,7 +19,8 @@ module Sloc end # TODO: formatted output - p report + require 'pp' + pp report nil end
Use pp for printing report prettier
meganemura_sloc
train
rb
be2bf9095d82581453f0ed573eec141f17777813
diff --git a/tasks/aws_s3.js b/tasks/aws_s3.js index <HASH>..<HASH> 100755 --- a/tasks/aws_s3.js +++ b/tasks/aws_s3.js @@ -731,8 +731,6 @@ module.exports = function (grunt) { doGzipRename(object, options); - console.log(object) - var server_file = _.where(server_files, { Key: object.dest })[0]; if (server_file && !options.overwrite) {
Recome stray console log
MathieuLoutre_grunt-aws-s3
train
js
36c5414a10c9d6615cc111d40657ccea2e5b99ad
diff --git a/hollow/src/main/java/com/netflix/hollow/tools/history/HollowHistory.java b/hollow/src/main/java/com/netflix/hollow/tools/history/HollowHistory.java index <HASH>..<HASH> 100644 --- a/hollow/src/main/java/com/netflix/hollow/tools/history/HollowHistory.java +++ b/hollow/src/main/java/com/netflix/hollow/tools/history/HollowHistory.java @@ -99,10 +99,10 @@ public class HollowHistory { if (pKey == null) continue; keyIndex.addTypeIndex(pKey); + keyIndex.indexTypeField(pKey); } } } - } /**
HollowHistory: by default, index all primary key fields for lookup.
Netflix_hollow
train
java
191941977242e23d4c4684bf790e21bdd08bde05
diff --git a/src/MessageTest.php b/src/MessageTest.php index <HASH>..<HASH> 100644 --- a/src/MessageTest.php +++ b/src/MessageTest.php @@ -26,9 +26,9 @@ class MessageTest extends TestCase public function aggregate_root_id_accessor() { $event = EventStub::create('some value'); - $message = new Message($event, [ - Header::AGGREGATE_ROOT_ID => UuidAggregateRootId::create() - ]); + $message = new Message($event); + $this->assertNull($message->aggregateRootId()); + $message = $message->withHeader(Header::AGGREGATE_ROOT_ID, UuidAggregateRootId::create()); $this->assertInstanceOf(AggregateRootId::class, $message->aggregateRootId()); } } \ No newline at end of file
Added the nullable case in the test
EventSaucePHP_EventSauce
train
php
946cec70df65a204cbe210307529e2584ee82cba
diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index <HASH>..<HASH> 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -13,11 +13,12 @@ module AcceptanceTestHelpers before :all do initialize_aruba_instance_variables + build_default_dummy_gems end before do cleanup_artifacts - build_default_dummy_gems + build_default_gemfile unset_bundler_env_vars ENV["GEM_PATH"] = [TMP_GEM_ROOT, ENV["GEM_PATH"]].join(":") end @@ -69,6 +70,9 @@ module AcceptanceTestHelpers build_gem 'dummy', '1.0.0' build_gem 'dummy', '1.1.0' + end + + def build_default_gemfile build_gemfile <<-Gemfile source 'https://rubygems.org'
Speed up some test by build gem only once
thoughtbot_appraisal
train
rb
1ab2a0453b76d24bf5c1e35414abde9797ba210e
diff --git a/modules/orionode/lib/git/diff.js b/modules/orionode/lib/git/diff.js index <HASH>..<HASH> 100644 --- a/modules/orionode/lib/git/diff.js +++ b/modules/orionode/lib/git/diff.js @@ -55,7 +55,7 @@ function getDiff(req, res) { var includeDiffs = parts.indexOf("diffs") !== -1; var URIs, diffContents = [], diffs = []; if (includeURIs) { - var p = path.join(fileDir, filePath); + var p = api.toURLPath(path.join(fileDir, filePath)); URIs = { "Base": getBaseLocation(scope, p), "CloneLocation": "/gitapi/clone" + fileDir,
nodegit: fix git diff on windows (bad slashes)
eclipse_orion.client
train
js
e11e260b3101fe071e3cdad8b6d925801e848f97
diff --git a/lib/ljm-ffi.js b/lib/ljm-ffi.js index <HASH>..<HASH> 100644 --- a/lib/ljm-ffi.js +++ b/lib/ljm-ffi.js @@ -525,7 +525,7 @@ function performLJMLibLocationsSearch(foundLJMLibLocations, currentDir) { if(fpInfo.base.indexOf(LJM_LIBRARY_BASE_NAME) != 0) { isValidFile = false; } - if(fpInfo.ext.indexOf(LJM_LIBRARY_FILE_TYPE) < 0) { + if(fpInfo.base.indexOf(LJM_LIBRARY_FILE_TYPE) < 0) { isValidFile = false; } diff --git a/test/load_specific_ljm.js b/test/load_specific_ljm.js index <HASH>..<HASH> 100644 --- a/test/load_specific_ljm.js +++ b/test/load_specific_ljm.js @@ -53,7 +53,7 @@ if(typeof(approxPlatform) === 'undefined') { } var LJM_VERSION_TO_TEST_FOR = { - 'linux': '1.8.6', + 'linux': '1.8.7', 'darwin': '1.8.8', 'win32': '1.11.0' }[approxPlatform];
Fixed LJM library version checking for linux
chrisJohn404_ljm-ffi
train
js,js
378ff68a5f5c96a4cc3d5f7f2bcc3ac90b6d0cbb
diff --git a/tests/Command/IssueCreateCommandTest.php b/tests/Command/IssueCreateCommandTest.php index <HASH>..<HASH> 100644 --- a/tests/Command/IssueCreateCommandTest.php +++ b/tests/Command/IssueCreateCommandTest.php @@ -33,6 +33,24 @@ class IssueCreateCommandTest extends BaseTestCase $this->assertEquals('Created issue https://github.com/gushphp/gush/issues/77', trim($tester->getDisplay())); } + public function testCommandWithTitleAndBodyOptions() + { + $tester = $this->getCommandTester($command = new IssueCreateCommand()); + $tester->execute( + [ + '--org' => 'gushphp', + '--repo' => 'gush', + '--issue_title' => self::ISSUE_TITLE, + '--issue_body' => self::ISSUE_DESCRIPTION + ], + [ + 'interactive' => false + ] + ); + + $this->assertEquals('Created issue https://github.com/gushphp/gush/issues/77', trim($tester->getDisplay())); + } + private function expectDialog() { $dialog = $this->getMock(
added test to issue create command with options
gushphp_gush
train
php
83d13c5865441d8594a0a93b35fa2aad1cab0f21
diff --git a/lib/pulsar/db.js b/lib/pulsar/db.js index <HASH>..<HASH> 100644 --- a/lib/pulsar/db.js +++ b/lib/pulsar/db.js @@ -51,6 +51,7 @@ module.exports = (function() { this.client = MongoClient.connect(url, function(err, db) { if (err) { callback(err); + return; } this.db = db; this.collection = db.collection(collection); diff --git a/test/pulsar.js b/test/pulsar.js index <HASH>..<HASH> 100644 --- a/test/pulsar.js +++ b/test/pulsar.js @@ -18,6 +18,7 @@ describe('tests of pulsar API', function() { new PulsarDb(testConfig.mongodb, function(err, db) { if (err) { done(err); + return; } self.pulsarDb = db; //remove all items from collection that might remain from previous tests.
Add return after callbacks to remove callback redundancy.
cargomedia_pulsar-rest-api
train
js,js
27a381f4e0d18ede49647f64499b3a13e39326f2
diff --git a/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php b/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php index <HASH>..<HASH> 100644 --- a/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php +++ b/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php @@ -137,7 +137,8 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex */ public function getRegionObj($region) { // Try to find regions directly by CSS selector - $regionObj = $this->getSession()->getPage()->find('css', $region); + $regionObj = $this->getSession()->getPage()->find('css', + $this->getSession()->getSelectorsHandler()->xpathLiteral($region)); if($regionObj) { return $regionObj; }
handle single quote with build-in way in getRegionObj
jeffreyguo_SS-Behat-quicksetup
train
php
40aafa4036b2f552924f876df750151f7f0f3be7
diff --git a/lib/event_sourcery/event_store/memory.rb b/lib/event_sourcery/event_store/memory.rb index <HASH>..<HASH> 100644 --- a/lib/event_sourcery/event_store/memory.rb +++ b/lib/event_sourcery/event_store/memory.rb @@ -32,12 +32,24 @@ module EventSourcery end def get_next_from(id, event_types: nil, limit: 1000) - events = event_types.nil? ? @events : @events.select { |e| event_types.include?(e.type) } - events.select { |event| event.id >= id }.first(limit) + events = if event_types.nil? + @events + else + @events.select { |e| event_types.include?(e.type) } + end + + events + .select { |event| event.id >= id } + .first(limit) end def latest_event_id(event_types: nil) - events = event_types.nil? ? @events : @events.select { |e| event_types.include?(e.type) } + events = if event_types.nil? + @events + else + @events.select { |e| event_types.include?(e.type) } + end + events.empty? ? 0 : events.last.id end
Expand if/else into multiline statement
envato_event_sourcery
train
rb
3d0c967d2ae73de0502738ac649e729b56cba448
diff --git a/test/unit/ble/data/gap/servicedata.test.js b/test/unit/ble/data/gap/servicedata.test.js index <HASH>..<HASH> 100644 --- a/test/unit/ble/data/gap/servicedata.test.js +++ b/test/unit/ble/data/gap/servicedata.test.js @@ -48,7 +48,6 @@ describe('ble data servicedata', function() { function() { var advertiserData = {}; servicedata.process(INPUT_DATA_COMPANY_NAME, CURSOR, advertiserData); - console.log(advertiserData); assert.deepEqual(advertiserData, EXPECTED_DATA_COMPANY_NAME); }); });
Removing extra console log which was used for test fix
reelyactive_advlib
train
js
1ebbb302055f1434877741517db550d8e430bef8
diff --git a/pefile.py b/pefile.py index <HASH>..<HASH> 100644 --- a/pefile.py +++ b/pefile.py @@ -3622,7 +3622,7 @@ class PE(object): return "" for entry in self.DIRECTORY_ENTRY_IMPORT: libname = entry.dll.lower() - parts = libname.rsplit('.', 1) + parts = libname.rsplit(b'.', 1) if len(parts) > 1 and parts[1] in exts: libname = parts[0]
correct bug in get_imphash
erocarrera_pefile
train
py
c3447eff9eb42b17003fb9af339d7458a2e90291
diff --git a/lib/server.js b/lib/server.js index <HASH>..<HASH> 100644 --- a/lib/server.js +++ b/lib/server.js @@ -192,6 +192,16 @@ function handleRequest (opts, req, resp) { }; reqOpts.log = reqOpts.logger.log.bind(reqOpts.logger); + // Simplistic count of requests from public & private networks + var xff = req.headers['x-forwarded-for']; + var remoteAddr = xff && xff.split(',')[0].trim() + || req.socket.remoteAddress; + if (/^(?:10|127)\./.test(remoteAddr)) { + reqOpts.metrics.increment('requests.private'); + } else { + reqOpts.metrics.increment('requests.public'); + } + // Create a new, clean request object var urlData = rbUtil.parseURL(req.url);
Count public & private requests Keep a simplistic count of requests from public & private networks.
wikimedia_restbase
train
js
4710c49b2865b0d1fd8a253b4bdaa980c66a08fa
diff --git a/twython3k/twython.py b/twython3k/twython.py index <HASH>..<HASH> 100644 --- a/twython3k/twython.py +++ b/twython3k/twython.py @@ -156,6 +156,9 @@ class Twython(object): else: # If they don't do authentication, but still want to request unprotected resources, we need an opener. self.client = httplib2.Http(**client_args) + # register available funcs to allow listing name when debugging. + for key in api_table.keys(): + self.__dict__[key] = self.__getattr__(key) def __getattr__(self, api_call): """
Allow for easier debugging/development, by registering endpoints directly into Twython3k.
ryanmcgrath_twython
train
py
1d80edbc2c2095a7cfcac2d739c82adf246fec4a
diff --git a/src/BoomCMS/Link/Internal.php b/src/BoomCMS/Link/Internal.php index <HASH>..<HASH> 100644 --- a/src/BoomCMS/Link/Internal.php +++ b/src/BoomCMS/Link/Internal.php @@ -52,7 +52,7 @@ class Internal extends Link public function getFeatureImageId(): int { return (isset($this->attrs['asset_id']) && !empty($this->attrs['asset_id'])) ? - $this->attrs['asset_id'] : $this->page->getFeatureImageId(); + (int) $this->attrs['asset_id'] : $this->page->getFeatureImageId(); } public function getPage() diff --git a/src/BoomCMS/Link/Link.php b/src/BoomCMS/Link/Link.php index <HASH>..<HASH> 100644 --- a/src/BoomCMS/Link/Link.php +++ b/src/BoomCMS/Link/Link.php @@ -76,7 +76,7 @@ abstract class Link implements LinkableInterface */ public function getFeatureImageId(): int { - return $this->attrs['asset_id'] ?? 0; + return (int) $this->attrs['asset_id'] ?? 0; } /**
Links: Cast feature image return value to int
boomcms_boom-core
train
php,php
9911f886eaa10c238154b02668ebdddca2bc31fe
diff --git a/engine/watcher.go b/engine/watcher.go index <HASH>..<HASH> 100644 --- a/engine/watcher.go +++ b/engine/watcher.go @@ -113,10 +113,10 @@ func (self *JobWatcher) AddJobWatch(watch *job.JobWatch) bool { if len(sched) > 0 { self.scheduler.FinalizeSchedule(&sched, self.machines, self.registry) - log.Printf("Submitting schedule to Registry", watch.Payload.Name) + log.Printf("Submitting schedule: %s", sched.String()) self.submitSchedule(sched) } else { - log.Printf("No schedule changes made", watch.Payload.Name) + log.Printf("No schedule changes made") } return true @@ -167,7 +167,7 @@ func (self *JobWatcher) TrackMachine(m *machine.Machine) { } if len(partial) > 0 { - log.Printf("Submitting schedule") + log.Printf("Submitting schedule: %s", partial.String()) self.submitSchedule(partial) } }
fix(engine): clean up logging
coreos_fleet
train
go
37624385a63f7e4753fb44740e27ddd73b4fc9c5
diff --git a/jss/distribution_points.py b/jss/distribution_points.py index <HASH>..<HASH> 100755 --- a/jss/distribution_points.py +++ b/jss/distribution_points.py @@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. import os import shutil import subprocess +import sys import urllib import casper @@ -317,7 +318,16 @@ class MountedRepository(Repository): """Try to unmount our mount point.""" # If not mounted, don't bother. if os.path.exists(self.connection['mount_point']): - subprocess.check_call(['umount', self.connection['mount_point']]) + # Force an unmount. If you are manually mounting and unmounting + # shares with python, chances are good that you know what you are + # doing and *want* it to unmount. For real. + if sys.platform == 'darwin': + subprocess.check_call(['/usr/sbin/diskutil', 'unmount', + 'force', + self.connection['mount_point']]) + else: + subprocess.check_call(['umount', '-f', + self.connection['mount_point']]) def is_mounted(self): """Test for whether a mount point is mounted."""
Change umount methods. Now preferentially (on OS X) uses diskutil. In either case, it now uses the force or -f flag to ensure that umounting occurs. I believe it is safe to assume that if you are mounting things with python, when you tell python to unmount, you want it to happen.
jssimporter_python-jss
train
py
91df3a45a4fb3bde57f8bf9e936b693ca1bb2b83
diff --git a/tests/test_folium.py b/tests/test_folium.py index <HASH>..<HASH> 100644 --- a/tests/test_folium.py +++ b/tests/test_folium.py @@ -12,10 +12,6 @@ import json import os import warnings import sys -try: - import importlib -except ImportError: - import imp as importlib import branca.element @@ -36,6 +32,10 @@ try: except ImportError: import mock +import importlib +if not hasattr(importlib, 'reload'): + import imp as importlib + rootpath = os.path.abspath(os.path.dirname(__file__))
Fix importlib import problem importlib does exist in <I>, it just doesn't have the reload function.
python-visualization_folium
train
py
4a3c4514527e385024da4bbd61fa34e9243857a2
diff --git a/nblr/src/main/java/jlibs/nblr/codegen/java/JavaCodeGenerator.java b/nblr/src/main/java/jlibs/nblr/codegen/java/JavaCodeGenerator.java index <HASH>..<HASH> 100644 --- a/nblr/src/main/java/jlibs/nblr/codegen/java/JavaCodeGenerator.java +++ b/nblr/src/main/java/jlibs/nblr/codegen/java/JavaCodeGenerator.java @@ -270,8 +270,13 @@ public class JavaCodeGenerator extends CodeGenerator{ nodesToBeExecuted.setLength(0); int nextState = -1; + boolean wasNode = false; for(Object obj: path){ if(obj instanceof Node){ + if(wasNode) + println("pop();"); + wasNode = true; + Node node = (Node)obj; if(debuggable){ if(nodesToBeExecuted.length()>0) @@ -280,6 +285,7 @@ public class JavaCodeGenerator extends CodeGenerator{ }else if(node.action!=null) printer.println(node.action.javaCode()+';'); }else if(obj instanceof Edge){ + wasNode = false; Edge edge = (Edge)obj; if(edge.ruleTarget!=null) println("push(RULE_"+edge.ruleTarget.rule.name+", "+edge.target.id+", "+edge.ruleTarget.node().id+");");
if there is a path in a rule, which consumes nothing, then from some other node it is possible to have both push and pop of rules
santhosh-tekuri_jlibs
train
java
47fdd538d60806149a8d2449fa27140bc7ddd164
diff --git a/src/view/items/element/ConditionalAttribute.js b/src/view/items/element/ConditionalAttribute.js index <HASH>..<HASH> 100644 --- a/src/view/items/element/ConditionalAttribute.js +++ b/src/view/items/element/ConditionalAttribute.js @@ -92,9 +92,10 @@ export default class ConditionalAttribute extends Item { function parseAttributes ( str, isSvg ) { const tagName = isSvg ? 'svg' : 'div'; - div.innerHTML = `<${tagName} ${str}></${tagName}>`; - - return toArray( div.childNodes[0].attributes ); + return str + ? (div.innerHTML = `<${tagName} ${str}></${tagName}>`) && + toArray(div.childNodes[0].attributes) + : []; } function notIn ( haystack, needle ) {
Update ConditionalAttribute.js if str is empty, let's not waist time manipulating dom elements
ractivejs_ractive
train
js
c3a8fbb8624000f2d7a8f295d2d8740273c8c07a
diff --git a/src/NativeFileSystem.js b/src/NativeFileSystem.js index <HASH>..<HASH> 100644 --- a/src/NativeFileSystem.js +++ b/src/NativeFileSystem.js @@ -228,7 +228,7 @@ define(function (require, exports, module) { // TODO (jasonsj): handle Blob data instead of string FileWriter.prototype.write = function (data) { - if (!data) { + if (data === null || data === undefined) { throw new Error(); }
Allow empty files to be written again.
adobe_brackets
train
js